Developers
  • SWT PROTOCOL
    • Introduction
    • Accounts
    • Transactions
    • Fees
    • Smart Contracts
  • GETTING STARTED
    • Network Node
      • Introduction
      • STEP 1:RENTING A LINUX VPS
      • STEP 2:INSTALLATION OF PUTTY
      • STEP 3:INSTALLATION OF FILEZILLA
      • STEP 4:VPS CONNECTION AND LINUX CONFIGURATION WITH PUTTY (SSH)
      • STEP 5:HOW TO SECURE YOUR VPS
      • STEP 6:USING TMUX THROUGH PUTTY
      • STEP 7:UPLOAD OF THE SWT SOFTWARE WITH FILEZILLA
      • STEP 8:EXTRACT THE SWT SOFTWARE FOLDER
      • STEP 9:RUNNING THE SWT NODE THROUGH TMUX
      • STEP 10:RUNNING THE MONITORING TOOLS
  • API REFERENCE
    • Apache Thrift API
      • Transactions
      • Blocks
      • Smart contract
      • Tokens
      • Wallets
      • Sync info
      • Data structures
    • REST API
      • GetBlocks()
      • GetNodeInfo()
      • GetBalance()
      • GetWalletInfo()
      • GetTokenBalance()
      • GetTransactionsByWallet()
      • GetTransactionInfo()
      • GetEstimatedFee()
      • GetContractByAddress()
      • GetContractFromTransaction()
      • GetContractMethods()
      • ContractValidation()
      • ContractCall()
      • TransactionPack()
      • TransactionExec()
  • SMART CONTRACTS
    • Creating "Hello-world" Smart Contract
    • Smart Contract Methods
    • Smart Contract Standarts
      • Token Smart Contract
      • Escrow Smart Contract
      • Stable coin Token
  • HOW TO REST API
    • Introduction
    • Retrieve a balance from the blockchain
    • Request a specific transaction from the blockchain
    • Sending Transactions to the SWT Blockchain
    • Validating and deploying a Smart Contract with REST API
Powered by GitBook
On this page
  • SmartContractGet()
  • SmartContractsListGet()
  • SmartContractAddressesListGet()
  • SmartContractsAllListGet()
  • TransactionsStateGet()
  • ContractAllMethodsGet()
  • SmartMethodParamsGet()
  • SmartContractDataGet()
  • SmartContractCompile()
  1. API REFERENCE
  2. Apache Thrift API

Smart contract

This section contains a description of methods for working with smart contracts of the SWT platform

SmartContractGet()

returns the smart contract code to its address

SmartContractGetResult SmartContractGet(1:general.Address address)

SmartContractsListGet()

returns a list of smart contracts according to the list of the deployer starting with offset in the amount of limit

SmartContractsListGetResult SmartContractsListGet(1:general.Address deployer, 2:i64 offset, 3:i64 limit)

SmartContractAddressesListGet()

returns a list of addresses of smart contracts of the deployer

SmartContractAddressesListGetResult SmartContractAddressesListGet(1:general.Address deployer)

// Blocks till obsolete is not the last block in chain.

PoolHash WaitForBlock(1:PoolHash obsolete)

// Blocks till there are transactions arrived to smart_address

// not yet reported by this method in current node's process lifetime.

TransactionId WaitForSmartTransaction(1:general.Address smart_public)

SmartContractsAllListGet()

Returns all smart contracts in the system

SmartContractsListGetResult SmartContractsAllListGet(1:i64 offset, 2:i64 limit)

Required parameters:

int64 offset - offset from the end of the list

int64 limit - number of smart contracts returned

Return value:

struct SmartContractsListGetResult

{

1: general.APIResponse status - response status message describing the problem, if any

2: i32 count - smart-contracts count

3: list smartContractsList - list of smart-contracts

},

where

struct SmartContract

{

1: required general.Address address

2: general.Address deployer

3: SmartContractDeploy smartContractDeploy

4: binary objectState

5: Time createTime

6: i32 transactionsCount

}

TransactionsStateGet()

returns the state of a smart contract after a transaction with id

TransactionsStateGetResult TransactionsStateGet(1:general.Address address, 2:list id)

ContractAllMethodsGet()

returns all smart contract methods

ContractAllMethodsGetResult ContractAllMethodsGet(1: list<general.ByteCodeObject> byteCodeObjects)

SmartMethodParamsGet()

returns all parameters of a smart contract

SmartMethodParamsGetResult SmartMethodParamsGet(1:general.Address address, 2:TransactionInnerId id)

SmartContractDataGet()

get smart contract code

SmartContractDataResult SmartContractDataGet(1:general.Address address)

SmartContractCompile()

returns the result of compiling a smart contract

SmartContractCompileResult SmartContractCompile(1:string sourceCode)

PreviousBlocksNextTokens

Last updated 1 year ago