agent_dart library

Classes

Actor
An actor base class. An actor is an object containing only functions that will return a promise. These functions are derived from the IDL definition.
ActorConfig
Configuration that can be passed to customize the Actor behaviour.
ActorMetadata
ActorMethod
Agent
An Agent able to make calls and queries to a Replica.
AgentFactory
AnonymousIdentity
AssetActor
try to understand how idl can be transformed
AssetMethod
AuthClient
AuthClientCreateOptions
AuthClientLoginOptions
AuthPayload
AuthResponse
AuthResponseFailure
AuthResponseSuccess
BaseAccount
BaseBlob
BaseRequest
BaseSigner<T extends BaseAccount, R extends SignablePayload, E>
Bech32
Bech32Codec
Bech32Decoder
Bech32Encoder
Bech32Validations
Generic validations for Bech32 standard.
BigIntEncoder
BoolClass
Represents an IDL Bool
BufferEncoder
BufferPipe<T>
ByteBufferEncoder
CallConfig
CallOptions
Options when doing a {@link Agent.call} call.
CallRequest
CallResponseBody
CanisterActor
CanisterId
CanisterInstallMode
Cert
Certificate
CombineSignedTransactionResult
ConstructType<T>
CreateUrlOptions
Options for {@link createAuthenticationRequestUrl}. All these options may be limited further by the identity provider, or an error can happen.
Credentials
CType<T>
Represents an IDL type.
DartRandom
DefaultHttpAgentOption
Delegation
DelegationChain
A chain of delegations. This is JSON Serializable. This is the object to serialize and pass to a DelegationIdentity. It does not keep any private keys.
DelegationIdentity
An Identity that adds delegation to a request. Everywhere in this class, the name innerKey refers to the SignIdentity that is being used to sign the requests, while originalKey is the identity that is being borrowed. More identities can be used in the middle to delegate.
DelegationIdentityPublicKey
DelegationValidChecks
List of things to check for a delegation chain validity.
DelegationWithSignature
ECKeys
Ed25519KeyIdentity
Ed25519KeyIdentityRecoveredFromII
Ed25519KeyPair
Ed25519PublicKey
EmptyClass<T>
Endpoint
Expiry
ExtraEncoder<T>
FieldOptions
FixedIntClass
FixedNatClass
FloatClass
FromStorageResult
FuncClass
HttpAgent
HttpAgentBaseRequest<T extends WithToJson>
HttpAgentCallRequest
HttpAgentOptions
HttpAgentQueryRequest
HttpAgentReadStateRequest
HttpAgentRequestTransformFn
HttpAgentSubmitRequest
HttpResponseBody
ICPAccount
ICPSigner
Identity
IdentityDescriptor
Create an IdentityDescriptor from a @dfinity/authentication Identity @param identity - identity describe in returned descriptor
IDL
IDLTypeIds
IJsonnableDelegationChain
IntClass
InternetIdentityAuthRequest
KeyPair
A Key Pair, containing a secret and public key.
MessageBlock
NatClass
NodeId
NullClass
Observable
OptClass<T>
Options
PemFile
PrimitiveType<T>
Principal
PrincipalClass
PrincipalEncoder
Promise<T>
ProxyAgent
ProxyMessage<T>
ProxyMessageBase
ProxyMessageCall
ProxyMessageCallResponse
ProxyMessageError
ProxyMessageGetPrincipal
ProxyMessageGetPrincipalResponse
ProxyMessageKind
ProxyMessageQuery
ProxyMessageQueryResponse
ProxyMessageReadState
ProxyMessageReadStateResponse
ProxyMessageStatus
ProxyMessageStatusResponse
ProxyStubAgent
PublicKey
PublicKeyBlock
QueryFields
Options when doing a {@link Agent.query} call.
QueryRequest
QueryResponse
QueryResponseBase
QueryResponseRejected
QueryResponseReplied
QueryResponseStatus
QueryResponseWithStatus
ReadRequestType
ReadStateOptions
Options when doing a {@link Agent.readState} call.
ReadStateRequest
ReadStateResponse
ReadStateResponseResult
RecClass<T>
Represents a reference to an IDL type, used for defining recursive data types.
RecordClass
ReplicaRejectCode
Codes used by the replica for rejecting a message. See {@link https://sdk.dfinity.org/docs/interface-spec/#reject-codes | the interface spec}.
Reply
RequestStatusResponseStatus
ReservedClass
ResponseBody
RosettaApi
Manages Rosetta API calls.
RosettaTransaction
Contains information about a transaction.
Secp256k1PublicKey
SelfDescribeEncoder
ServiceClass
SHA224
SignatureBlock
Signed<T>
SignedDelegation
Signer<T extends SignablePayload, R>
SignIdentity
An Identity that can sign blobs.
SigningBlock
SigningBlockDecoder
SigningBlockEncoder
SigningBlockResult
SingingBlockZipFileEncoder
SubmitRequestType
SubmitResponse
TextClass
ToCBorable
ToHashable
TupleClass<T extends List>
TypeTable
An IDL Type Table, which precedes the data in the stream.
UnSigned<T>
VariantClass
VecClass<T>
Visitor<D, R>
WithToJson
ZipSigningBlock

Constants

alphabet → const String
ANONYMOUS_SUFFIX → const int
bech32 → const Bech32Codec
btoa → const String Function(dynamic value)
charset → const List<String>
DEFAULT_IDENTITY_PROVIDER_URL → const String
DEFAULT_INGRESS_EXPIRY_DELTA_IN_MSECS → const int
DEFAULT_LENGTH → const int
FIVE_MINUTES_IN_MSEC → const int
FORMAT → const List<int>
generator → const List<int>
HARDENED → const int
The following part is ported from InternetIdentity service. It's main purpose is to recover an identity that registered. These truths are covered.
HRP → const String
IC_BASE_PATH → const List<int>
IC_DERIVATION_PATH → const List<int>
IC_ROOT_KEY → const String
ICP_PATH → const String
IDENTITY_PROVIDER_DEFAULT → const String
IDENTITY_PROVIDER_ENDPOINT → const String
KEY_LENGTH → const int
KEY_LOCALSTORAGE_DELEGATION → const String
KEY_LOCALSTORAGE_KEY → const String
magicNumber → const String
MAX_LENGTH_IN_BYTES → const int
SELF_AUTHENTICATING_SUFFIX → const int
separator → const String
tweetNaclSignedPubLength → const int
TYPE_OPAQUE → const int

Properties

authDelegationDomainSeparator Uint8List
final
bls BaseBLS
getter/setter pair
bn53 BigInt
final
bnHundred BigInt
final
bnOne BigInt
final
bnTen BigInt
final
bnThrousand BigInt
final
bnZero BigInt
final
defaultHttpAgentOption DefaultHttpAgentOption
final
DER_COSE_OID Uint8List
A DER encoded SEQUENCE(OID) for DER-encoded-COSE
final
DER_PREFIX Uint8List
final
DOMAIN_IC_REQUEST Uint8List
final
domainSeparator Uint8List
final
ED25519_OID Uint8List
A DER encoded SEQUENCE(OID) for the Ed25519 algorithm
final
lookUpTable Uint32List
getter/setter pair
NANOSECONDS_PER_MILLISECONDS BigInt
final
params → ECCurve_secp256k1
final
REPLICA_PERMITTED_DRIFT_MILLISECONDS BigInt
final
requestDomainSeparator Uint8List
final

Functions

assetIDL() Service
backoff(num startingThrottleInMsec, num backoffFactor) PollStrategy
base32Decode(String input) Uint8List
@param input The base32 encoded string to decode.
base32Encode(Uint8List input) String
@param input The input array to encode. @returns A Base32 string encoding the input.
base64Decode(String value) Uint8List
base64Encode(dynamic value) String
base64Pad(String value) String
base64Trim(String value) String
base64Validate(String? value) bool
bitnot(BigInt bn, {int? bitLength}) BigInt
blobFromBuffer(ByteBuffer b) BinaryBlob
blobFromHex(String hex) BinaryBlob
blobFromText(String text) BinaryBlob
blobFromUint32Array(Uint32List arr) BinaryBlob
blobFromUint8Array(Uint8List arr) BinaryBlob
blobToHex(BinaryBlob blob) String
blobToUint8Array(BinaryBlob blob) Uint8List
bnMax(List<BigInt> list) BigInt
bnMin(List<BigInt> list) BigInt
bnSqrt(BigInt bn) BigInt
bnToBn(dynamic value) BigInt
bnToHex(BigInt bn, {int bitLength = -1, Endian endian = Endian.big, bool isNegative = false}) String
bnToU8a(BigInt? value, {int bitLength = -1, Endian endian = Endian.little, bool isNegative = false}) Uint8List
bufEquals(ByteBuffer b1, ByteBuffer b2) bool
bytesToHex(List<int> bytes, {bool include0x = false}) String
Converts the bytes given as a list of integers into a hexadecimal representation.
bytesToInt(List<int> bytes) BigInt
Converts the bytes from that list (big endian) to a BigInt.
cborDecode<T>(List<int> value) → T
cborEncode(dynamic value, {SelfDescribeEncoder? withSerializer}) BinaryBlob
chain(List<PollStrategy> strategies) PollStrategy
combine(ConstructionCombineRequestPart req) CombineSignedTransactionResult
compactToBn(Map<String, dynamic> value) BigInt
compareLists<T extends Comparable<T>>(List<T> a, List<T> b) int
compareListsBy<T>(List<T> a, List<T> b, int compare(T a, T b)) int
concat(List<BinaryBlob> bs) BinaryBlob
conditionalDelay(Predicate<bool> condition, int timeInMsec) PollStrategy
convertArray(List<int> arr) Uint8List
convertString(String str, {bool useDartEncode = true}) Uint8List
crc32Add(Uint8List buf) Uint8List
Prepend a big-endian CRC32 checksum. @param {Buffer} buf @returns {Buffer}
crc32Del(Uint8List buf) Uint8List
Given an account address with a prepended big-endian CRC32 checksum, verify the checksum and remove it. @param {Buffer} buf @returns {Buffer}
createAssetCanisterActor(ActorConfig config) CanisterActor
Create a management canister actor. @param config
createAuthenticationRequestUrl(CreateUrlOptions options) Uri
Create a URL that can be used to redirect the browser to request authentication (e.g. using the authentication provider). Will throw if some options are invalid. @param options An option with all options for the authentication request.
createDelegationChainFromAccessToken(String accessToken) DelegationChain
Create a DelegationChain from an AccessToken extracted from a redirect URL. @param accessToken The access token extracted from a redirect URL.
createIdentityDescriptor(Identity identity) IdentityDescriptor
decodeBigInt(List<int> bytes, {Endian endian = Endian.little}) BigInt
decodeLenBytes(Uint8List buf, int offset) int
decodePrincipalId(Pipe b) PrincipalId
decodeReturnValue(List<CType> types, BinaryBlob msg) → dynamic
defaultStrategy() PollStrategy
derBlobFromBlob(BinaryBlob blob) DerEncodedBlob
derive(Uint8List parentKey, Uint8List parentChaincode, int i) Set<Uint8List>
domainSep(String s) Uint8List
dropLeadingUserNumber(String s) String
ecTransferCombine(Secp256k1KeyIdentity identity, SignablePayload payloadsRes) Future<CombineSignedTransactionResult>
ed25519KeyIdentityFromPem(String pem) Future<Ed25519KeyIdentity>
encodeBigInt(BigInt number, {Endian endian = Endian.little, int? bitLength}) Uint8List
encodeLen(Uint8List buf, int offset, int len) int
encodeLenBytes(int len) int
extractDER(Uint8List buf) Uint8List
extractUserNumber(String s) BigInt?
findLabel(Uint8List l, List<List> trees) List?
flattenForks(List t) List<List>
flatternArray<T>(List<List<T>> list) List<T>
fromBech32Address(String address) String
fromHexString(String hexString) Uint8List
fromMnemonicWithoutValidation(String mnemonic, List<int>? derivationPath, {int offset = HARDENED}) Ed25519KeyIdentity
Create an Ed25519 based on a mnemonic phrase according to SLIP 0010: https://github.com/satoshilabs/slips/blob/master/slip-0010.md
fromSeed(Uint8List seed, {int index = 0}) ECKeys
fromSeedWithSlip0010(Uint8List masterSeed, List<int>? derivationPath, {int offset = HARDENED}) Ed25519KeyIdentity
Create an Ed25519 according to SLIP 0010: https://github.com/satoshilabs/slips/blob/master/slip-0010.md
generateMasterKey(Uint8List seed) Set<Uint8List>
generateMnemonic({int bitLength = 128}) String
getAccessTokenFromURL(dynamic url) String?
Analyze a URL and try to extract an AccessToken from it. @param url The URL to look into.
getAccessTokenFromWindow(dynamic link) → dynamic
Returns an AccessToken from the Window object. This cannot be used in Node, instead use the {@link getAccessTokenFromURL} function.
getAccountIdFromDerKey(Uint8List der) Uint8List
getAccountIdFromEd25519PublicKey(Uint8List publicKey) Uint8List
getAccountIdFromPrincipal(Principal principal) Uint8List
getAccountIdFromPrincipalID(String id) Uint8List
getAccountIdFromRawPublicKey(Uint8List publicKey) Uint8List
getCrc32(ByteBuffer buf) int
Calculate the CRC32 of a blob. @param buf The blob to calculate the CRC32 of.
getECKeys(String mnemonic, {String passphase = "", int index = 0}) ECKeys
getManagementCanister(CallConfig config) CanisterActor
getPemFile(String path) Future<PemFile>
getPrincipalFromECPublicKey(Uint8List publicKey) String
getPublicFromPrivateKey(Uint8List privateKey, [bool compress = false]) Uint8List?
getPublicFromPrivateKeyBigInt(BigInt bigint, [bool compress = false]) Uint8List?
getRandomValues([int length = DEFAULT_LENGTH]) Uint8List
hash(Uint8List data) BinaryBlob
hash_array(List elements) Uint8List
@param {Array
hash_bytes(Uint8List value) Uint8List
@param {Buffer} value @returns {Buffer}
hash_key_val(dynamic key, dynamic val) Uint8List
@param {string} key @param {string|Buffer|BigInt} val @returns {Buffer}
hash_of_map(Map map) Uint8List
@param {object} map @returns {Buffer}
hash_string(String value) Uint8List
@param {string} value @returns {Buffer}
hash_U64(BigInt n) Uint8List
@param {BigInt} n @returns {Buffer}
hash_val(dynamic val) Uint8List
@param {string|Buffer|BigInt} val @returns {Buffer}
hashString(String value) BinaryBlob
hashTreeToString(List tree) String
Make a human readable string out of a hash tree. @param tree
hashValue(dynamic value) BinaryBlob
hexAddPrefix(String? value) String
hexFixLength(String value, [int bitLength = -1, bool withPadding = false]) String
hexHasPrefix(String value) bool
hexStripPrefix(String value) String
hexToBn(dynamic value, {Endian endian = Endian.big, bool isNegative = false}) BigInt
hexToBytes(String hexStr) List<int>
sequence.
hexToNumber(dynamic value) int?
hexToPlainText(String hex) String
hexToString(String value) String
hexToU8a(String value, [int bitLength = -1]) Uint8List
value sholud be 0x hex
hexToU8aStream(String value) Uint8List
HttpCanisterUpdate_id(Map update) Uint8List
@param {object} update @returns {Buffer}
HttpCanisterUpdate_representation_independent_hash(Map update) Uint8List
@param {object} update @returns {Buffer}
HttpReadState_representation_independent_hash(Map readState) Uint8List
@param {object} read_state @returns {Buffer}
idlDecode(List<CType> retTypes, Uint8List bytes) List
Decode a binary value @param retTypes - Types expected in the buffer. @param bytes - hex-encoded string, or buffer. @returns Value deserialised to JS type
idlEncode(List<CType> argTypes, List args) BinaryBlob
Encode a array of values @returns {Buffer} serialised value
idlHash(String s) num
idlLabelToId(String label) num
initCborSerializer() SelfDescribeEncoder
initCborSerializerNoHead() SelfDescribeEncoder
isAddress(String str) bool
isAscii(dynamic value) bool
isBase64(String value) bool
isBech32(String str) bool
isBigInt(dynamic value) bool
isBn(dynamic value) bool
isBoolean(dynamic value) bool
isBuffer(dynamic value) bool
isByteString(String byStr, {required int length}) bool
isDelegationValid(DelegationChain chain, DelegationValidChecks? checks) → dynamic
Analyze a DelegationChain and validate that it's valid, ie. not expired and apply to the scope. @param chain The chain to validate. @param checks Various checks to validate on the chain.
isError(dynamic value) bool
isFunction(dynamic value) bool
isHex(dynamic value, [int bitLength = -1, bool ignoreLength = false]) bool
isHexadecimal(String str) bool
isHexString(String str) bool
isIdentityDescriptor(dynamic value) bool
Type Guard for whether the unknown value is an IdentityDescriptor or not. @param value - value to type guard
isIp(String value, String type) bool
isJsonObject(dynamic value) bool
isNull(dynamic value) bool
isNumber(dynamic value) bool
isObject(dynamic value) bool
isObservable(dynamic value) bool
isPrivateKey(String str) bool
isPublicKey(String str) bool
isSignature(String str) bool
isString(dynamic value) bool
isTestChain(String value) bool
isU8a(dynamic value) bool
isUrl(String url) bool
isUtf8(dynamic value) bool
isValidUTF8(Uint8List buf) bool
lebDecode<T>(BufferPipe<T> pipe) BigInt
Decode a leb encoded buffer into a bigint. The number will always be positive (does not support signed leb encoding). @param pipe A Buffer containing the leb encoded bits.
lebEncode(dynamic value) Uint8List
Encode a positive number (or bigint) into a Buffer. The number will be floored to the nearest integer. @param value The number to encode.
log2(num x) num
lookupPath(List path, List tree) Uint8List?
@param path @param tree
lookupPathEx(List path, List tree) Uint8List?
@param path @param tree
make_read_state_from_update(Map update) Map<String, dynamic>
@param {object} update @returns {object}
make_sig_data(Uint8List messageId) Uint8List
@param {Buffer} message_id @returns {Buffer}
makeBigIntToString(Map input) Map
makeMap(List<CType> components) Map
makeNonce() Nonce
makeNonceTransform([NonceFunc nonceFn = makeNonce]) HttpAgentRequestTransformFnCall
managementIDL() Service
maxAttempts(int count) PollStrategy
mnemonicToSeed(String phrase, {String passphrase = ""}) Uint8List
newtonIteration(BigInt n, BigInt x0) BigInt
numberToHex(dynamic number, {bool pad = false, bool include0x = false, int? forcePadLen}) String
Converts the number, which can either be a dart int or a BigInt, into a hexadecimal representation. The number needs to be positive or zero.
once() Predicate<bool>
parseStringToU8a(String str) Uint8List
parseUserNumber(String s) BigInt?
plainTextToHex(String plainText) String
pollForResponse(Agent agent, Principal canisterId, RequestId requestId, PollStrategy strategy) Future<BinaryBlob>
randomAsHex([int length = 32]) String
randomAsNumber() int
randomAsU8a([int length = DEFAULT_LENGTH]) Uint8List
readIntLE(BufferPipe pipe, int byteLength) BigInt
readUIntLE(BufferPipe pipe, int byteLength) BigInt
reconstruct(List t) Future<Uint8List>
requestIdOf(Map<String, dynamic> request) RequestId
Get the RequestId of the provided ic-ref request. RequestId is the result of the representation-independent-hash function. https://sdk.dfinity.org/docs/interface-spec/index.html#hash-of-map @param request - ic-ref request to hash into RequestId
requestIdToHex(RequestId requestId) String
safeRead<T>(BufferPipe<T> pipe, int ref) List<T>
secp256k1KeyIdentityFromPem(String pem) Future<Secp256k1KeyIdentity>
serializeValue(int major, int minor, String val) ByteBuffer
sha224Hash(ByteBuffer buf) Uint8List
sha256Chunks(List chunks) Uint8List
slebDecode(BufferPipe pipe) BigInt
Decode a leb encoded buffer into a bigint. The number is decoded with support for negative signed-leb encoding. @param pipe A Buffer containing the signed leb encoded bits.
slebEncode(Comparable value) Uint8List
Encode a number (or bigint) into a Buffer, with support for negative numbers. The number will be floored to the nearest integer. @param value The number to encode.
stringCamelCase(String value) String
stringLowerFirst(String value) String
stringShorten(String value, {int prefixLength = 6}) String
stringToU8a(String msg, {String? enc, bool useDartEncode = true}) Uint8List
stringUpperFirst(String value) String
strip0xHex(String hex) String
textDecoder(Uint8List value) String
textEncoder(String value) Uint8List
throttle(int throttleInMsec) PollStrategy
Throttle polling. @param throttleInMsec Amount in millisecond to wait between each polling.
timeout(int timeInMsec) PollStrategy
toBech32Address(String address) String
toBigEndianArray(int n) Uint8List
toHex(dynamic msg) String
toHexString(Uint8List bytes) String
toReadableString(dynamic x) String
@param x @returns {string}
transactionDecoder(String txnHash) Map<String, dynamic>
transferCombine(Ed25519KeyIdentity identity, SignablePayload payloadsRes) Future<CombineSignedTransactionResult>
tryToJson(CType type, dynamic value) Uint8List?
u8aConcat(List list) Uint8List
u8aEq(Uint8List a, Uint8List b) bool
u8aFixLength(Uint8List value, {int bitLength = -1, bool atStart = false}) Uint8List
u8aSorted(List<Uint8List> u8as) List<Uint8List>
u8aToBn(Uint8List u8a, {Endian endian = Endian.little, bool isNegative = false}) BigInt
u8aToBuffer(Uint8List u8a) ByteBuffer
u8aToHex(Uint8List u8a, {bool include0x = true}) String
u8aToString(Uint8List u8a, {bool useDartEncode = false}) String
u8aToU8a(dynamic value, {bool useDartEncode = true}) Uint8List
unwrapDER(ByteBuffer derEncoded, Uint8List oid) Uint8List
Extracts a payload from the given derEncoded data, and checks that it was tagged with the given oid.
validateMnemonic(String mnemonic) bool
wrapDER(ByteBuffer payload, Uint8List oid) Uint8List
Wraps the given payload in a DER encoding tagged with the given encoded oid like so: SEQUENCE(oid, BITSTRING(payload))
writeIntLE(dynamic value, int byteLength) Uint8List
writeUIntLE(dynamic value, int byteLength) Uint8List
zero2(dynamic word) String
zipWith<TX, TY, TR>(List<TX> xs, List<TY> ys, TR f(TX a, TY b)) List<TR>