nekoton/nekoton_lib
library
Functions
-
checkPublicKey(PublicKey publicKey)
→ bool
-
Check if public key is correct.
Return true or false
-
codeToTvc(String code)
→ (String, String)
-
Convert code to base64 tvc string and return (tvc, hash) or throw error
-
computeStorageFee({required String config, required String account, required int utime, bool? isMasterchain})
→ Future<StorageFeeInfo>
-
config
- value from Transport.getBlockchainConfig
account
- base64-encoded boc
utime
- seconds
isMasterchain
- default: false
-
computeTonWalletAddress({required PublicKey publicKey, required WalletType walletType, required int workchain})
→ Address
-
-
createExternalMessage({required String dst, required String contractAbi, required String method, String? stateInit, required TokensObject input, required PublicKey publicKey, required Duration timeout})
→ Future<UnsignedMessage>
-
Create external unsigned message that can be listened and handled or throws error
-
createExternalMessageWithoutSignature({required Address dst, required String contractAbi, required String method, String? stateInit, required TokensObject input, required Duration timeout})
→ Future<SignedMessage>
-
Returns SignedMessage from nekoton or throws error
-
createRawExternalMessage({required Address dst, required Duration timeout, String? stateInit, String? body})
→ Future<SignedMessage>
-
Create raw external message without real signing or throws error
-
decodeEvent({required String messageBody, required String contractAbi, dynamic event})
→ Future<DecodedEvent?>
-
Decode input data and return DecodedEvent or throws error
-
decodeInput({required String messageBody, required String contractAbi, dynamic method, required bool internal})
→ Future<DecodedInput?>
-
Decode input data and return DecodedInput or throws error
-
decodeOutput({required String messageBody, required String contractAbi, dynamic method})
→ Future<DecodedOutput?>
-
Decode output data and return DecodedOutput or throws error
-
decodeTransaction({required Transaction transaction, required String contractAbi, dynamic method})
→ Future<DecodedTransaction?>
-
Decode transaction and return DecodedTransaction or throws error
-
decodeTransactionEvents({required Transaction transaction, required String contractAbi})
→ Future<List<DecodedEvent>>
-
Decode events of transaction and return list of DecodedEvent or throws error
-
deriveFromPhrase({required String phrase, required MnemonicType mnemonicType})
→ Keypair
-
Generate public and secret keys from seed phrase and mnemonic type
Returns json {'public': '...', 'secret': '...'}
or throws Exception
-
comment
- comment to encode
plain
- if true, then return plain comment payload (used for TON)
-
encodeInternalInput({required String contractAbi, required String method, required TokensObject input})
→ Future<String>
-
Returns base64-encoded body that was encoded or throws error
-
encodeInternalMessage({required Address dst, required bool bounce, required BigInt amount, Address? src, String? stateInit, String? body, bool? bounced})
→ Future<String>
-
Returns base-64 encoded Message or throws error
-
executeLocal({required String config, required String account, required String message, required DateTime utime, required bool disableSignatureCheck, BigInt? overwriteBalance, int? globalId})
→ Future<(String, Transaction)>
-
Run contract locally.
config
- value from Transport.getBlockchainConfig
account
- boc from makeFullAccountBoc
message
- base64-encoded boc from one of:
-
Extract public key from boc and return it or throw error
-
generateKey({required MnemonicType accountType})
→ GeneratedKeyG
-
Generate seed phrase by specified mnemonic type
-
getBocHash(String boc)
→ String
-
Returns hash of decoded boc or throws error
-
getCodeSalt(String code)
→ String?
-
Get salt from code if possible and return base64-encoded salt or throw error
-
getContractTypeNumber(WalletType walletType)
→ int
-
-
getExpectedAddress({required String tvc, required String contractAbi, required int workchainId, PublicKey? publicKey, required TokensObject initData})
→ Future<(Address, String, String)>
-
Get address of tvc and contract_abi.
Returns list of
address, state_init, hash
or throws error
-
getHash(String string)
→ String
-
Get hash of String
-
getHints({required String input})
→ List<String>
-
Get hints for input part of word of seed phrase to get possible words
input: acco
returns
account, accommodate, ...
-
makeFullAccountBoc(String? accountStuffBoc)
→ Future<String>
-
Returns base-64 encoded Account or throws error
accountStuffBoc
- FullContractState.boc
-
mergeTvc({required String code, required String data})
→ (String, String)
-
Merge code and data to tvc base64 string and return (tvc, hash)
or throw error
-
packAddress(Address address, {bool isUrlSafe = true, bool bounceable = true})
→ Address
-
-
packIntoCell({required List<AbiParam> params, required TokensObject tokens, String? abiVersion})
→ (String, String)
-
Return (base64 tvc, hash) or throws error
-
packStdSmcAddr({required Address address, required bool base64Url, required bool bounceable})
→ String
-
Pack address std smd or throw error
Returns new packed address as string
-
parseFullAccountBoc(String account)
→ Future<FullContractState?>
-
account
- base64-encoded boc after executeLocal
-
parseKnownPayload(String payload)
→ KnownPayload?
-
Parse payload and return KnownPayload or throws error
-
repackAddress(Address address)
→ Address
-
Repack address and return json-encoded MsgAddressInt or throw error
-
runGetter({required String accountStuffBoc, required String contractAbi, required String methodId, required Map<String, dynamic> input, int? signatureId, Map<String, String>? libraries})
→ Future<ExecutionOutput>
-
Run getter.
Return json-encoded ExecutionOutput or throws error.
-
runLocal({required String accountStuffBoc, required String contractAbi, required String methodId, required Map<String, dynamic> input, required bool responsible, int? signatureId, Map<String, String>? libraries})
→ Future<ExecutionOutput>
-
Run contract local.
Return json-encoded ExecutionOutput or throws error.
-
runLocalWithLibs({required Transport transport, required String accountStuffBoc, required String contractAbi, required String methodId, required Map<String, dynamic> input, required bool responsible, int? signatureId, Map<String, String>? libraries, int retryCount = 5})
→ Future<ExecutionOutput>
-
-
setCodeSalt({required String code, required String salt})
→ (String, String)
-
Set salt to code and return (tvc, hash) or throw error
-
splitTvc(String tvc)
→ (String?, String?)
-
Split base64 tvc string into data and code.
Return (data, code) or throw error
-
unpackContractFields({required String contractAbi, required String boc, required bool allowPartial})
→ Future<Map<String, dynamic>?>
-
Unpack contract fields.
Returns optional json-encoded Map<String, Token> or throw error
-
unpackFromCell({required List<AbiParam> params, required String boc, required bool allowPartial, String? abiVersion})
→ TokensObject
-
Parse list of params and return json-encoded Tokens or throws error
-
unpackInitData({required String contractAbi, required String data})
→ Future<(PublicKey?, Map<String, dynamic>)>
-
Unpack data from
contractAbi
.
Returns optional public key and json-encoded Map<String, Token>
or throws error.
-
unpackStdSmcAddr({required String packed, required bool base64Url})
→ String
-
-
validateAddress(Address address)
→ bool
-
Return true if address is valid, false otherwise
-
verifySignature({required PublicKey publicKey, required String data, required String signature, required int? signatureId})
→ Future<bool>
-
Check signature by publicKey and data hash