nekoton/nekoton_lib
library
Functions
-
checkPublicKey({required PublicKey publicKey})
→ Future<bool>
-
Check if public key is correct.
Return true or false
-
codeToTvc(String code)
→ Future<(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
-
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})
→ Future<Keypair>
-
Generate public and secret keys from seed phrase and mnemonic type
Returns json {'public': '...', 'secret': '...'}
or throws Exception
-
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})
→ Future<GeneratedKeyG>
-
Generate seed phrase by specified mnemonic type
-
getBocHash(String boc)
→ Future<String>
-
Returns hash of decoded boc or throws error
-
getCodeSalt(String code)
→ Future<String?>
-
Get salt from code if possible and return base64-encoded salt or throw error
-
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})
→ Future<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})
→ Future<(String, String)>
-
Merge code and data to tvc base64 string and return (tvc, hash)
or throw error
-
packIntoCell({required List<AbiParam> params, required TokensObject tokens, required String? abiVersion})
→ Future<(String, String)>
-
Return (base64 tvc, hash) or throws error
-
packStdSmcAddr({required Address address, required bool base64Url, required bool bounceable})
→ Future<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)
→ Future<KnownPayload?>
-
Parse payload and return KnownPayload or throws error
-
repackAddress(Address address)
→ Future<Address>
-
Repack address and return json-encoded MsgAddressInt or throw error
-
runLocal({required String accountStuffBoc, required String contractAbi, required String method, required Map<String, dynamic> input, required bool responsible})
→ Future<ExecutionOutput>
-
Run contract local.
Return json-encoded ExecutionOutput or throws error.
-
setCodeSalt({required String code, required String salt})
→ Future<(String, String)>
-
Set salt to code and return (tvc, hash) or throw error
-
splitTvc(String tvc)
→ Future<(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, required String? abiVersion})
→ Future<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})
→ Future<String>
-
-
validateAddress(Address address)
→ Future<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
Typedefs
-
GqlConnectionGet
= Future<String> Function(String endpoint)
-
-
GqlConnectionPost
= Future<String> Function({required String data, required String endpoint, })
-
-
JrpcConnectionPost
= Future<String> Function({required String data, required String endpoint, })
-
-
LedgerConnectionGetPublicKey
= Future<PublicKey> Function(int accountId)
-
-
LedgerConnectionSign
= Future<String> Function({required int account, Object? context, required List<int> message})
-
-
MethodName
= dynamic
-
-
ProtoConnectionPost
= Future<Uint8List> Function({required Uint8List dataBytes, required String endpoint, })
-
Callback to make post requrest in proto connection.
Must return bytes.
-
StorageGet
= Future<String?> Function(String key)
-
-
StorageRemove
= Future<void> Function(String key)
-
-
StorageRemoveUnchecked
= void Function(String key)
-
-
StorageSet
= Future<void> Function({required String key, required String value})
-
-
StorageSetUnchecked
= void Function({required String key, required String value})
-
-
TokensObject
= Map<String, dynamic>
-