agent/agent 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
Internal metadata for actors. It's an enhanced version of ActorConfig with some fields marked as required (as they are defaulted) and canisterId as a Principal type.
ActorMethod
Agent
An Agent able to make calls and queries to a Replica.
AgentBLS
AgentFactory
AnonymousIdentity
AssetActor
Try to understand how idl can be transformed.
BaseBlob
BaseRequest
BigIntEncoder
BufferEncoder
BufferPipe<T>
ByteBufferEncoder
CallConfig
CallOptions
Options when doing a Agent.call call.
CallRequest
CallResponseBody
CanisterActor
Cert
CertDelegation
Certificate
Credentials
DartRandom
DefaultHttpAgentOption
E2EResponse
EncryptMessageResponse
Endpoint
Expiry
ExtraEncoder<T>
FetchResponse
FieldOptions
HttpAgent
HttpAgentBaseRequest<T extends WithToJson>
HttpAgentCallRequest
HttpAgentOptions
HttpAgentQueryRequest
HttpAgentReadStateRequest
HttpAgentRequestTransformFn
HttpAgentSubmitRequest
HttpResponseBody
Identity
KeyDerivator
KeyPair
A Key Pair, containing a secret and public key.
KeyStore
NativeDeriveKeyResult
PrincipalEncoder
ProxyAgent
ProxyMessage<T>
ProxyMessageBase
ProxyMessageCall
ProxyMessageCallResponse
ProxyMessageError<T>
ProxyMessageGetPrincipal
ProxyMessageGetPrincipalResponse
ProxyMessageKind
ProxyMessageQuery
ProxyMessageQueryResponse
ProxyMessageReadState
ProxyMessageReadStateResponse
ProxyMessageStatus
ProxyMessageStatusResponse
ProxyStubAgent
PublicKey
QueryFields
Options when doing a Agent.query call.
QueryRequest
QueryResponse
QueryResponseBase
QueryResponseRejected
QueryResponseReplied
QueryResponseStatus
type QueryResponse = QueryResponseReplied | QueryResponseRejected;
QueryResponseWithStatus
ReadRequestType
ReadStateOptions
Options when doing a Agent.readState call.
ReadStateRequest
ReadStateResponse
ReadStateResponseResult
ReplicaRejectCode
Codes used by the replica for rejecting a message. See https://sdk.dfinity.org/docs/interface-spec/#reject-codes for the interface spec.
Reply
ResponseBody
SelfDescribeEncoder
Signed<T>
SignIdentity
An Identity that can sign blobs.
SubmitRequestType
SubmitResponse
ToCborable
ToHashable
UnSigned<T>

Enums

AssetMethod
BlobType
CanisterInstallMode
FetchMethod
NodeId
type HashTree = | 0 | 1, HashTree, HashTree | 2, ArrayBuffer, HashTree | 3, ArrayBuffer | 4, ArrayBuffer;
RequestStatusResponseStatus

Mixins

WithToJson

Constants

btoa → const String Function(dynamic value)
defaultExpireInDuration → const Duration
defaultExpireInMinutes → const int
Most of the timeouts will happen in 5 minutes.
defaultHttpAgentOption → const DefaultHttpAgentOption
defaultTimeout → const Duration

Properties

bn53 BigInt
final

Functions

assetIDL() Service
backoff(num startingThrottleInMsec, num backoffFactor) PollStrategy
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
cborDecode<T>(List<int> value) → T
cborEncode(dynamic value, {SelfDescribeEncoder? withSerializer}) Uint8List
chain(List<PollStrategy> strategies) PollStrategy
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(PollPredicate<bool> condition, int timeInMsec) PollStrategy
createAssetCanisterActor(ActorConfig config) CanisterActor
Create a management canister actor. @param config
decodePhrase(Map<String, dynamic> keyStore, String psw) Future<String>
decodePrivateKey(Map<String, dynamic> keyStore, {String? password}) Future<String>
decodeReturnValue(List<CType> types, BinaryBlob msg) → dynamic
decrypt(Map<String, dynamic> keyStore, {String? password}) Future<String>
decryptCborPhrase(List<int> bytes, {String? password}) Future<String>
decryptMessage({required Secp256k1KeyIdentity identity, required Secp256k1PublicKey theirPublicKey, required String cipherText}) Future<String>
decryptP256Message({required P256Identity identity, required P256PublicKey theirPublicKey, required String cipherText}) Future<String>
decryptPhrase(Map<String, dynamic> keyStore, String passphrase) Future<String>
defaultFetch({required String endpoint, String? host, String? defaultHost, FetchMethod method = FetchMethod.post, Map<String, String>? baseHeaders, Map<String, String>? headers, Duration? timeout = defaultTimeout, bool cbor = true, dynamic body}) Future<Map<String, dynamic>>
defaultFetch is a wrapper of http.get, which can be replaced by any other http packages (e.g. dio). http has embedded by default, so the library use it directly. Users can set host should be full path of http/https. Usually the usage could be defaultHost+endpoint and set the defaultHost to somewhere final, then change the endpoint programmatically. defaultTimeout is the default timeout limit, and throw error directly to end the request section.
defaultStrategy() PollStrategy
derBlobFromBlob(BinaryBlob blob) DerEncodedBlob
domainSep(String s) Uint8List
encodePhrase(String prvKey, {String? password, Map<String, dynamic>? options}) Future<String>
encodePrivateKey(String prvKey, {String? password, Map<String, dynamic>? options}) Future<String>
encrypt(String privateKey, {String? password, Map<String, dynamic>? options}) Future<String>
encryptCborPhrase(String phrase, {String? password, Map<String, dynamic>? options}) Future<Uint8List>
encryptMessage({required Secp256k1KeyIdentity identity, required Secp256k1PublicKey theirPublicKey, required String text}) Future<EncryptMessageResponse>
encryptP256Message({required P256Identity identity, required P256PublicKey theirPublicKey, required String text, Uint8List? sharedSecret}) Future<E2EResponse>
encryptPhrase(String phrase, {String? password, Map<String, dynamic>? options}) Future<String>
extractDER(Uint8List buf) Uint8List
findLabel(Uint8List l, List<List> trees) List?
flattenForks(List t) List<List>
getDerivedKey(String kdf, Map<String, dynamic> params) KeyDerivator
getDerivedKey by kdf type
getManagementCanister(CallConfig config) CanisterActor
getRandomValues([int length = _defaultLength]) Uint8List
hash(Uint8List data) BinaryBlob
hashString(String value) BinaryBlob
hashTreeToString(List tree) String
Make a human readable string out of a hash tree. @param tree
hashValue(dynamic value) BinaryBlob
idlHash(String s) int
idlLabelToId(String label) num
initCborSerializer() SelfDescribeEncoder
initCborSerializerNoHead() SelfDescribeEncoder
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).
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.
lookupPath(List path, List tree) Uint8List?
lookupPathEx(List path, List tree) Uint8List?
makeNonce() Nonce
makeNonceTransform([NonceFunc nonceFn = makeNonce]) HttpAgentRequestTransformFnCall
managementIDL() Service
maxAttempts(int count) PollStrategy
nativeDeriveKey({required String kdf, required List<int> iv, required String? message, required Uint8List? useCipherText, required Map<String, dynamic> kdfParams, required String salt, String? passphrase}) Future<NativeDeriveKeyResult>
once() PollPredicate<bool>
pollForResponse(Agent agent, Principal canisterId, RequestId requestId, PollStrategy strategy, String method, {BinaryBlob? overrideCertificate}) Future<BinaryBlob>
randomAsHex([int length = 32]) String
randomAsNumber() int
randomAsU8a([int length = _defaultLength]) 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>
serializeValue(int major, int minor, String val) ByteBuffer
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(dynamic 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.
throttlePolling(int throttleMilliseconds) PollStrategy
Throttle polling. @param throttleMilliseconds
timeout(Duration duration) PollStrategy
withRetry<T>(FutureOr<T> action(), {int retryTimes = 3, int retryIntervalMills = 500}) Future<T>
writeIntLE(dynamic value, int byteLength) Uint8List
writeUIntLE(dynamic value, int byteLength) Uint8List

Exceptions / Errors

ActorCallError
AgentFetchError
An fetch error when using agent to make HTTP/S requests.
PollingResponseException
PollingResponseNoReplyException
PollingResponseRejectedException
QueryCallRejectedError
UnreachableError
UnverifiedCertificateError
A certificate needs to be verified (using Certificate.prototype.verify) before it can be used.
UpdateCallRejectedError