Skip to main content

SDK API Reference

Account#

create#

- Creates an instance of WalletKeypar using password.
This method is used to create a WalletKeypar using password. The Keypair contains some essential information, such as:

  •   address
  •   public key
  •   key store

and so on, and it is used for pretty much any personalized operation that user can do using FindoraSdk

Parameters:#
  •   <string> - Password of account
Results:#
  •   Promise<WalletKeypar> - An instance of WalletKeypar
Example:#
const password = "qsjEI%123";
// Create a wallet info object using given passwordconst walletInfo = await Account.create(password);

getBalance#

- Get the balance of the specific asset for the given user

Using this function user can retrieve the balance for the specific asset code, which could be either custom asset or an FRA asset

Parameters:#
  •   <WalletKeypar> - An instance of WalletKeypar
  •   <string> - (optional) Asset Code which could be either custom asset or an FRA asset.
Results:#
  •   Promise<string> - The balance of the specific asset for the given user.
Example:#
const pkey = "lfyd1234!";const password = "uuicnf!34";
// Restore Walletconst walletInfo = await Keypair.restoreFromPrivateKey(pkey, password);
// Get balanceconst balance = await Account.getBalance(walletInfo, customAssetCode);

getBalanceInWei#

- Get the balance of the specific asset for the given user in Wei format

Using this function user can retrieve the balance for the specific asset code, which could be either custom asset or an FRA asset

Parameters:#
  •   <WalletKeypar> - An instance of WalletKeypar
  •   <string> - (optional) Asset Code which could be either custom asset or an FRA asset.
Results:#
  •   Promise<BigNumberValue> - The balance of the specific asset for the given user in Wei format.
Example:#
const pkey = "lfyd1234!";const password = "uuicnf!34";
// Restore Walletconst walletInfo = await Keypair.restoreFromPrivateKey(pkey, password);
// Get balance in Wei formatconst balance = await Account.getBalanceInWei(walletInfo, customAssetCode);

getCreatedAssets#

- Get an array of instances of ProcessedIssuedRecord using wallet address.

This method is used to get created Assets. The ProcessedIssuedRecord contains some essential information, such as:

  •   code
  •   record
  •   id
  •   ownerMemo

and so on. It's the issued asset.

Parameters:#
  •   <string> - Wallet address.
Results:#
  •   Promise<ProcessedIssuedRecord[]> - an array of ProcessedIssuedRecord instances.
Example:#
const pkey = "lfyd1234!";const password = "uuicnf!34";
// Restore Walletconst walletInfo = await Keypair.restoreFromPrivateKey(pkey, password);
// Get balance in Wei formatconst balance = await Account.getBalanceInWei(walletInfo, customAssetCode);

KeyPair#

createKeypair#

- Creates an instance of WalletKeypar using password.
This method is used to restore a wallet keypair. The Keypair contains some essential information, such as:

  •   address
  •   public key
  •   key store

and so on, and it is used for pretty much any personalized operation that user can do using FindoraSdk

Parameters:#
  •   <string> - Password to be used to generate an encrypted KeyStore
Results:#
  •   Promise<WalletKeypar> - An instance of WalletKeypar
Example:#
const password = "qsjEI%123";
// Create a wallet info object using given passwordconst walletPair = await Keypair.createKeypair(password);

getAddressByPublicKey#

- Get wallet address by given public key
Using this function user can retreive the wallet address by given public key

Parameters:#
  •   <string> - Public key
Results:#
  •   Promise<string> - A wallet address.
Example:#
const pubkey = "qsjEI%123";// Get wallet address by public keyconst walletAddress = await Keypair.getAddressByPublicKey(pubkey);

getAddressPublicAndKey#

- Create an instance of LightWalletKeypair using given wallet address.
This method is used to create a light version of the WalletKeypar using given wallet address.The LightWalletKeypair contains two essential information:

  •   address
  •   public key

It's a light version of the WalletKeypar, containing only address and publickey

Parameters:#
  •   <string> - Wallet address
Results:#
  •   Promise<LightWalletKeypair> - An instance of LightWalletKeypair.
Example:#
const address = "fra234xfde4";
// Create a LightWalletKeypair object using given addressconst lightWalletKeypair = await Keypair.getAddressPublicAndKey(address);

getMnemonic#

- Creates an array of Mnemonic phrases.
This method is used to creates an array of Mnemonic phrases.

Parameters:#
  •   <number> - Desired length of mnemonic phrases. It can only be 12/15/18/21/24.
  •   <string> - (optional) Default is en.
Results:#
  •   Promise<LightWalletKeypair> - An instance of LightWalletKeypair.
Example:#
const desiredLength = 24;
// Create a wallet info object using given passwordconst mnemonic = await Keypair.getMnemonic(desiredLength);

restoreFromMnemonic#

- Creates an instance of WalletKeypar using Mnemonic and password.
This method is used to restore a wallet keypair. The Keypair contains some essential information, such as:

  •   address
  •   public key
  •   key store

and so on, and it is used for pretty much any personalized operation that user can do using FindoraSdk

Parameters:#
  •   <string[]> - mnemonic words
  •   <string> - Password to be used to generate an encrypted KeyStore
Results:#
  •   Promise<WalletKeypar> - An instance of WalletKeypar.
Example:#
const password = "qsjEI%123";const mnemonic = ["Apple", "Orange", "Banana"];
// Create a wallet info object using given Mnemonic and passwordconst walletPair = await Keypair.restoreFromMnemonic(mnemonic, password);

restoreFromPrivateKey#

- Creates an instance of WalletKeypar using given private key and password.
This method is used to restore a wallet keypair. The Keypair contains some essential information, such as:

  •   address
  •   public key
  •   key store

and so on, and it is used for pretty much any personalized operation that user can do using FindoraSdk

Parameters:#
  •   <string> - Private key
  •   <string> - Password to be used to generate an encrypted KeyStore
Results:#
  •   Promise<WalletKeypar> - An instance of WalletKeypar.
Example:#
const password = "qsjEI%123";const pkey = "XXXXXXXXXX";
// Create a wallet info object using given private key and passwordconst walletInfo = await Keypair.restoreFromPrivateKey(pkey, password);

Network#

getAbciInfo#

- Get ABCI information
This method is used to get ABCI information.

Parameters:#
  •   <string> - a wallet address
  •   <NetworkAxiosConfig> - (optinal) network config
Results:#
  •   Promise<AbciInfoResult> - An instance of AbciInfoResult containing the response and error.
Example:#
const data = "0x12345d";
// Get ABCI informationconst acbiInfo = await Network.getAbciInfo(data);

getAbciNoce#

- Get ABCI Noce
This method is used to get ABCI Noce.

Parameters:#
  •   <string> - a wallet address
  •   <NetworkAxiosConfig> - (optinal) network config
Results:#
  •   Promise<AbciNoceResult> - An instance of AbciNoceResult containing the response and error.
Example:#
const data = "0x12345d";
// Get ABCI Noceconst acbiNoce = await Network.getAbciNoce(data);

getAssetToken#

- Get information of given type of asset token
This method is used to get information of given type of asset token

Parameters:#
  •   <string> - asset code
  •   <NetworkAxiosConfig> - (optinal) network config
Results:#
  •   Promise<AssetTokenDataResult> - An instance of AssetTokenDataResult containing the response and error.
Example:#
const data = "0x12345d";
// Get ABCI Noceconst acbiNoce = await Network.getAbciNoce(data);

getBlock#

- Get datails of given block
This method is used to get details of given block.

Parameters:#
  •   <number> - block Height
  •   <NetworkAxiosConfig> - (optinal) network config
Results:#
  •   Promise<BlockDetailsDataResult> - An instance of BlockDetailsDataResult containing the response and error.
Example:#
const blockHeight = 1432;
// Get block #1432 detailsconst blockDetail = await Network.getBlock(blockHeight);

getDelegateInfo#

- Get the delegation information
This method is used to get the delegation information.

Parameters:#
  •   <string> - public key
  •   <NetworkAxiosConfig> - (optinal) network config
Results:#
  •   Promise<DelegateInfoDataResult> - An instance of DelegateInfoDataResult containing the response and error.
Example:#
const publickey = "qsedx23rtgds";
// Get the delegation informationconst blockDetail = await Network.getDelegateInfo(publickey);

getHashSwap#

- Get transaction details
This method is used to get details of transaction with given hash

Parameters:#
  •   <string> - transaction hash
  •   <NetworkAxiosConfig> - (optinal) network config
Results:#
  •   Promise<HashSwapDataResult> - An instance of HashSwapDataResult containing the response and error.
Example:#
const hash = `YOUR_TX_HASH`;
// Get transaction details of given hashconst txDetail = await Network.getHashSwap(hash);

getIssuedRecords#

- Get information of issued records for given public key
This method is used to get information of issued records for given public key

Parameters:#
  •   <string> - public key
  •   <NetworkAxiosConfig> - (optinal) network config
Results:#
  •   Promise<IssuedRecordDataResult> - An instance of IssuedRecordDataResult containing the response and error.
Example:#
const publickey = `publickeyexample`;
// Get issed records informationconst issuedRecords = await Network.getIssuedRecords(publickey);

getOwnedSids#

- Get Sids owned by given address
This method is used to get Sids owned by given address

Parameters:#
  •   <string> - wallet address
  •   <NetworkAxiosConfig> - (optinal) network config
Results:#
  •   Promise<OwnedSidsDataResult> - An instance of OwnedSidsDataResult containing the response and error.
Example:#
const address = `frabhhjsswerf`;
// Get Sids' informationconst ownedSids = await Network.getOwnedSids(address);

getOwnerMemo#

- Get the owner memo by given UTXO sid
This method is used to get owner memo by given UTXO sid

Parameters:#
  •   <number> - UTXO sid
  •   <NetworkAxiosConfig> - (optinal) network config
Results:#
  •   Promise<OwnerMemoDataResult> - An instance of OwnerMemoDataResult containing the response and error.
Example:#
const utxoSid = 143;
// Get owner memoconst ownerMemo = await Network.getOwnerMemo(utxoSid);

getStateCommitment#

- Returns state commitment
An important property of a Findora ledger is the ability to authenticate transactions. Users can authenticate transactions against a small tag called the state commitment. The state commitment is a commitment to the current state of the ledger. The state commitment response is a tuple containing the state commitment and the state commitment version.

Parameters:#
  •   <NetworkAxiosConfig> - (optinal) network config
Results:#
  •   Promise<StateCommitmentDataResult> - An instance of StateCommitmentDataResult containing the response and error.
Example:#
// Get state commitmentconst stateCommitment = await Network.getStateCommitment();

getTransactionStatus#

- Returns transaction status
Using the transaction handle, user can fetch the status of the transaction from the query server.

Parameters:#
  •   <string> - transaction handle (hash)
  •   <NetworkAxiosConfig> - (optinal) network config
Results:#
  •   Promise<TransactionStatusDataResult> - An instance of TransactionStatusDataResult containing the response and error.
Example:#
const handle = `YOUR_TX_HASH`;
// Get transaction statusconst transactionStatus = await Network.getTransactionStatus(handle);

getTransactionDetails#

- Returns transaction details
Using the transaction handle, user can fetch the details of the transaction from the query server.

Parameters:#
  •   <string> - transaction handle (hash)
  •   <NetworkAxiosConfig> - (optinal) network config
Results:#
  •   Promise<TxDetailsDataResult> - An instance of TxDetailsDataResult containing the response and error.
Example:#
const handle = `YOUR_TX_HASH`;
// Get transaction detailsconst transactionDetails = await Network.getTransactionDetails(handle);

getTxList#

- Get a list of transactions for given wallet address
This method is used to get a list of transactions for given wallet address

Parameters:#
  •   <string> - wallet address
  •   <"to"|"from"> - transaction type. it can only be "to" or "from"
  •   <number> - pagination. Default is 1.
  •   <NetworkAxiosConfig> - (optinal) network config
Results:#
  •   Promise<TxListDataResult> - An instance of TxListDataResult containing the response and error.
Example:#
const address = `fra000xxsr`;const type = "to";
// Get list of `to` transaction of given addressconst txDetail = await Network.getTxList(address, type);

getUtxo#

- Get UTXO ledger for given utxo sid
This method is used to get UTXO ledger for given UTXO sid

Parameters:#
  •   <number> - UTXO SID
  •   <NetworkAxiosConfig> - (optinal) network config
Results:#
  •   Promise<UtxoDataResult> - An instance of UtxoDataResult containing the response and error.
Example:#
const utxoSid = 143;
// Get UTXO detailsconst utxoData = await Network.getUtxo(utxoSid);

getValidatorList#

- Get validator list
This method is used to get the list of validators.

Parameters:#
  •   <NetworkAxiosConfig> - (optinal) network config
Results:#
  •   Promise<ValidatorListDataResult> - An instance of ValidatorListDataResult containing the response and error.
Example:#
// Get validator listconst acbiInfo = await Network.getValidatorList();

sendRpcCall#

- Send RPC call
This method is used to send RPC call.

Parameters:#
  •   <string> - RPC url
  •   <{[key: string]: any}> - payload
  •   <NetworkAxiosConfig> - (optinal) network config
Results:#
  •   Promise<T> - The response object from RPC call.
Example:#
cont url = `https://prod-testnet.prod.findora.org:8545`;const payload = {  method: `eth_getBlockByHash`,  params: ['0x1af723767d06...',true],};
// Send the RPC call to get block details by hashconst response = await Network.sendRpcCall(url,payload);

submitEvmTx#

- Submit EVM transaction
This method is used to submit a EVM transaction.

Parameters:#
  •   <string> - transaction hash
  •   <NetworkAxiosConfig> - (optinal) network config
Results:#
  •   Promise<SubmitEvmTxResult> - An instance of SubmitEvmTxResult containing the response and error.
Example:#
const tx = "Your_TX_Hash";
// Submit a EVM transactionconst result = await Network.submitEvmTx(tx);

submitTransaction#

- Submit transation
This method is used to submit a transaction

Parameters:#
  •   <TransactionData> - (optinal) transaction data
  •   <NetworkAxiosConfig> - (optinal) network config
Results:#
  •   Promise<SubmitTransactionDataResult> - An instance of SubmitTransactionDataResult containing the response and error.
Example:#
const data = `Your_Transaction_Data`;
// Submit transactionconst txResult = await Network.submitTransaction(data);

sdkAsset#

defineAsset#

- Defines a custom asset
An asset definition operation registers an asset with the Findora ledger. An asset is a digital resource that can be issued and transferred.
An asset has an issuer and a unique code. The DefineAsset operation must provide an unused token code. The transaction containing the DefineAsset operation will fail if there is already another asset on the ledger with the same code.

Parameters:#
  •   <WalletKeypar> - Wallet keypair
  •   <string> - asset name
  •   <string> - (optinal) asset memo
  •   <string> - (optinal) A set of rules (options) for the new asset.
Results:#
  •   Promise<TransactionBuilder> - An instance of TransactionBuilder from Ledger
Example:#
const walletInfo = await Keypair.restoreFromPrivateKey(pkey, password);
// First, we create a transaction builderconst assetBuilder = await Asset.defineAsset(walletInfo, assetCode);
// Then, we submit a transactionconst handle = await Transaction.submitTransaction(assetBuilder);

getAssetCode#

- Return Asset Code
This method returns Asset Code by given asset type

Parameters:#
  •   <number[]> - asset type
Results:#
  •   Promise<string> - asset code.
Example:#
const assetType = [1, 2];
// Get the decrypted Asset codeconst assetCode = await Asset.getAssetCode(assetType);

getAssetDetails#

- Get Asset Details
This method returns Asset details by given asset code

Parameters:#
  •   <string> - asset code
Results:#
  •   Promise<IAsset> - An instance of FindoraWallet.IAsset
Example:#
const assetCode = "Your_Asset_Code";
// Get asset detailsconst assetDetails = await getAssetDetails(assetCode);

getFraAssetCode#

- Returns the pre-defined FRA asset code
FRA asset code can not be re-defined, as well as it can not be used in the DefineAset or IssueAsset operations.
This is the main asset code, which is used when user needs to create a transaction, or calculate the fee and so on.

Results:#
  •   Promise<string> - Findora Asset code
Example:#
// Get the FRA Asset codeconst fraAssetCode = await Asset.getFraAssetCode();

getFraPublicKey#

- Return Destination's Public Key
This method returns the public key of destination

Results:#
  •   Promise<XfrPublicKey> - An instance of XfrPublicKey.
Example:#
// Get the public key of destinationconst pubKey = await Asset.getFraPublicKey();

getMinimalFee#

- Return Minimal Fee for transaction
This method returns the required minimal fee for transaction

Results:#
  •   Promise<BigInt> - An instance of BigInt.
Example:#
// Get the minimal fee for transactionconst minFee = await Asset.getMinimalFee();

getRandomAssetCode#

- Returns a random asset code
Using Ledger, it generates and returns a random custom asset code

Results:#
  •   Promise<string> - Asset code.
Example:#
// Get a random asset codeconst assetCode = await Asset.getRandomAssetCode();

issueAsset#

- Issue some amount of a custom asset
Asset issuers can use the IssueAsset operation to mint units of an asset that they have created. Concretely, the IssueAsset operation creates asset records that represent ownership by a public key of a certain amount of an asset. These asset records are stored in a structure called a transaction output (TXO).

Parameters:#
  •   <WalletKeypar> - wallet keypair
  •   <string> - asset name
  •   <string> - amount to be issued
  •   <AssetBlindRules> - asset blind rules
  •   <number> - (optional) asset decimals. This parameter can define how many numbers after the comma would this asset have
Results:#
  •   Promise<TransactionBuilder> - An instance of TransactionBuilder from Ledger
Example:#
const walletInfo = await Keypair.restoreFromPrivateKey(pkey, password);
// Define the new asset parameters (rules)const assetBlindRules = { isAmountBlind: false };
// First, we create a transaction builderconst assetBuilder = await Asset.issueAsset(  walletInfo,  customAssetCode,  amountToIssue,  assetBlindRules);
// Then, we submit a transactionconst handle = await Transaction.submitTransaction(assetBuilder);

Staking#

claim#

- Claim FRA Token Rewards
This function enables users to claim rewards earned from staking FRA tokens.

Parameters:#
  •   <WalletKeypar> - Wallet keypair
  •   <string> - the amout of rewards which users wants to claim
Results:#
  •   Promise<TransactionBuilder> - TransactionBuilder which should be used in Transaction.submitTransaction.
Example:#
const walletInfo = await Keypair.restoreFromPrivateKey(pkey, password);
// First, we create a transaction builderconst assetBuilder = await Asset.defineAsset(walletInfo, assetCode);
// Then, we submit a transactionconst handle = await Transaction.submitTransaction(assetBuilder);

delegate#

- Delegates FRA tokens
This function allows users to delegate FRA tokens to a validator.
This functionality is nearly identical to Transaction.sendToAddress except it adds one additional operation (i.e. add_operation_delegate) to the transaction builder.

Parameters:#
  •   <WalletKeypar> - Wallet keypair
  •   <string> - Target address for delegation
  •   <string> - delegation amout
  •   <string> - Asset Code
  •   <string> - Target validator Address
  •   <AssetBlindRules> - (optional) Confidential options for blind rule
Results:#
  •   Promise<TransactionBuilder> - TransactionBuilder which should be used in Transaction.submitTransaction.
Example:#
const ledger = await getLedger();
// This is the address funds are sent to.// Actual `transfer to validator` process would be handled via added `add_operation_delegate` operation
const delegationTargetPublicKey = Ledger.get_delegation_target_address();const delegationTargetAddress = await Keypair.getAddressByPublicKey(  delegationTargetPublicKey);
const walletInfo = await Keypair.restoreFromPrivateKey(pkey, password);
const assetCode = await Asset.getFraAssetCode();
const assetBlindRules: Asset.AssetBlindRules = {  isTypeBlind: false,  isAmountBlind: false,};
const transactionBuilder = await StakingApi.delegate(  walletInfo,  delegationTargetAddress,  amount,  assetCode,  validatorAddress,  assetBlindRules);
const resultHandle = await Transaction.submitTransaction(transactionBuilder);

getDelegateInfo#

- Get the delegation information
This method is used to get the delegation information

Parameters:#
  •   <string> - wallet address
Results:#
  •   Promise<DelegateInfoResponse> - An instance of DelegateInfoDataResult containing the response and error..
Example:#
const address = "fra123sxde";
// Get the delegation informationconst delegateInfo = await StakingApi.getDelegateInfo(address);

getValidatorList#

- Get validator list
This method is used to get the list of validators.

Results:#
  •   Promise<validatorListResponse> - An instance of validatorListResponse containing the response and error..
Example:#
// Get validator listconst validatorList = await StakingApi.getValidatorList();

unStake#

- Unstake FRA tokens
This function allows users to unstake (aka unbond) FRA tokens.

Parameters:#
  •   <WalletKeypar> - Wallet keypair
  •   <string> - the amount users wants to unstake
  •   <string> - validator's address
  •   <boolean> - fully unstake option. Default is false
Results:#
  •   Promise<TransactionBuilder> - TransactionBuilder which should be used in Transaction.submitTransaction.
Example:#
const walletInfo = await Keypair.restoreFromPrivateKey(pkey, password);
// Define whether or not user desires to unstake all the tokens, or only part of the staked amountconst isFullUnstake = false;
const transactionBuilder = await StakingApi.unStake(  walletInfo,  amount,  validator,  isFullUnstake);
const resultHandle = await Transaction.submitTransaction(transactionBuilder);

Transaction#

getTransactionBuilder#

- Create an instance of TransactionBuilder
This method is used to create a transaction builder

Results:#
  •   Promise<TransactionBuilder> - TransactionBuilder which should be used in Transaction.submitTransaction.
Example:#
// Create a TransactionBuilder objectconst transactionBuilder = await Transaction.getTransactionBuilder();

getTxList#

- Get a list of transactions for given wallet address
This method is used to get a list of transactions for given wallet address

Parameters:#
  •   <string> - wallet address
  •   <"to" | "from"> - transaction type. it can only be 'to' or 'from'
  •   <number> - pagination. The defaul value is 1.
Results:#
  •   Promise<ProcessedTxListResponseResult> - An instance of ProcessedTxListResponseResult containing the total count and transactions.
Example:#
const address = `fra000xxsr`;const type = "to";
// Get list of `to` transaction of given addressconst txDetail = await Transaction.getTxList(address, type);

sendToAddress#

- Send some asset to an address
Using this function, user can transfer some amount of given asset to another address

Parameters:#
  •   <WalletKeypar> - wallet keypair
  •   <string> - target wallet address
  •   <string> - amount to be sent
  •   <string> - asset code
  •   <AssetBlindRules> - (optional) confidential options for blind rule
Results:#
  •   Promise<TransactionBuilder> - A TransactionBuilder which should be used in Transaction.submitTransaction
Example:#
const walletInfo = await Keypair.restoreFromPrivateKey(pkey, password);const toWalletInfo = await Keypair.restoreFromPrivateKey(toPkeyMine2, password);
const assetCode = await Asset.getFraAssetCode();
const assetBlindRules: Asset.AssetBlindRules = {  isTypeBlind: false,  isAmountBlind: false,};
const transactionBuilder = await Transaction.sendToAddress(  walletInfo,  toWalletInfo.address,  "2",  assetCode,  assetBlindRules);
const resultHandle = await Transaction.submitTransaction(transactionBuilder);

sendToMany#

- Send some asset to multiple receivers
Using this function, user can transfer perform multiple transfers of the same asset to multiple receivers using different amounts

Parameters:#
  •   <WalletKeypar> - wallet keypair
  •   <TransferReciever[]> - the list of target wallet addresses and amount
  •   <string> - asset code
  •   <AssetBlindRules> - (optional) confidential options for blind rule
Results:#
  •   Promise<TransactionBuilder> - A TransactionBuilder which should be used in Transaction.submitTransaction
Example:#
const walletInfo = await Keypair.restoreFromPrivateKey(pkey, password);const toWalletInfoMine2 = await Keypair.restoreFromPrivateKey(  toPkeyMine2,  password);const toWalletInfoMine3 = await Keypair.restoreFromPrivateKey(  toPkeyMine3,  password);
const assetCode = await Asset.getFraAssetCode();
const assetBlindRules: Asset.AssetBlindRules = {  isTypeBlind: false,  isAmountBlind: false,};
const recieversInfo = [  { reciverWalletInfo: toWalletInfoMine2, amount: "2" },  { reciverWalletInfo: toWalletInfoMine3, amount: "3" },];
const transactionBuilder = await Transaction.sendToMany(  walletInfo,  recieversInfo,  assetCode,  assetBlindRules);
const resultHandle = await Transaction.submitTransaction(transactionBuilder);

sendToPublicKey#

- Send some asset to a wallet by public key
Using this function, user can transfer some amount of given asset to another wallet by target's public key

Parameters:#
  •   <WalletKeypar> - wallet keypair
  •   <string> - target's public key
  •   <string> - amount to be sent
  •   <string> - asset code
  •   <AssetBlindRules> - (optional) confidential options for blind rule
Results:#
  •   Promise<TransactionBuilder> - A TransactionBuilder which should be used in Transaction.submitTransaction
Example:#
const walletInfo = await Keypair.restoreFromPrivateKey(pkey, password);const toWalletPublicKey = `tgshauuy213`;
const assetCode = await Asset.getFraAssetCode();
const assetBlindRules: Asset.AssetBlindRules = {  isTypeBlind: false,  isAmountBlind: false,};
const transactionBuilder = await Transaction.sendToPublicKey(  walletInfo,  toWalletPublicKey,  "2",  assetCode,  assetBlindRules);
const resultHandle = await Transaction.submitTransaction(transactionBuilder);

submitTransaction#

- Submits a transaction
The next step after creating a transaction is submitting it to the ledger, and, as a response, we retrieve the transaction handle.

Parameters:#
  •   <TransactionBuilder> - an instance of TransactionBuilder
Results:#
  •   Promise<string> - Transaction status handle
Example:#
onst walletInfo = await Keypair.restoreFromPrivateKey(pkey, password);
// First, we create a transaction builderconst assetBuilder = await Asset.defineAsset(walletInfo, assetCode);
// Then, we submit a transaction// If succcesful, the response of the submit transaction request will return a handle that can be used the query the status of the transaction.const handle = await Transaction.submitTransaction(assetBuilder);

Helpers#

getBlockTime#

- Get Block Time by given block height.
Using this function, user can get block time by given block height

Parameters:#
  •   <number> - block height
Results:#
  •   Promise<undefined | string> - Block time
Example:#
const blockHeight = 2341;// Get block time at Block #2341const blockTime = await helpers.getBlockTime(blockHeight);

getTxListFromResponse#

- Get Transaction List by given transaction data response.
Using this function, user can Get Transaction List by given transaction data response

Parameters:#
  •   <TxListDataResult> - transaction data response
Results:#
  •   Promise<null | TxInfo[]> - transaction list
Example:#
const address = "fra12dsfew";const type = "to";const dataResult = await Network.getTxList(address, type);// Get tx listconst txList = await helpers.getTxListFromResponse();

getTxOperationsList#

- Get Operation List by given parsed transaction
Using this function, user can Get Transaction List by given parsed transaction

Parameters:#
  •   <ParsedTx> - parsed tx info
Results:#
  •   TxOperation[]> - transaction operation list
Example:#
const address = "fra12dsfew";const type = "to";const dataResult = await Network.getTxList(address, type);// Get tx listconst txList = await helpers.getTxListFromResponse();// Get one parsed txparsedTx = JSON.parse(Base64.decode(txList[0].tx));// Get operation LsitopList = helpers.getTxOperationsList(parsedTx);