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
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
BaseBlob
BaseRequest
BigIntEncoder
BufferEncoder
BufferPipe<T>
ByteBufferEncoder
CallConfig
CallOptions
Options when doing a {@link Agent.call} call.
CallRequest
CallResponseBody
CanisterActor
CanisterInstallMode
Cert
Certificate
Credentials
DartRandom
DefaultHttpAgentOption
Delegation
Endpoint
Expiry
ExtraEncoder<T>
FieldOptions
HttpAgent
HttpAgentBaseRequest<T extends WithToJson>
HttpAgentCallRequest
HttpAgentOptions
HttpAgentQueryRequest
HttpAgentReadStateRequest
HttpAgentRequestTransformFn
HttpAgentSubmitRequest
HttpResponseBody
Identity
IdentityDescriptor
Create an IdentityDescriptor from a @dfinity/authentication Identity @param identity - identity describe in returned descriptor
KeyPair
A Key Pair, containing a secret and public key.
NodeId
PrincipalEncoder
Promise<T>
ProxyAgent
ProxyMessage<T>
ProxyMessageBase
ProxyMessageCall
ProxyMessageCallResponse
ProxyMessageError
ProxyMessageGetPrincipal
ProxyMessageGetPrincipalResponse
ProxyMessageKind
ProxyMessageQuery
ProxyMessageQueryResponse
ProxyMessageReadState
ProxyMessageReadStateResponse
ProxyMessageStatus
ProxyMessageStatusResponse
ProxyStubAgent
PublicKey
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
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
ResponseBody
SelfDescribeEncoder
Signed<T>
SignIdentity
An Identity that can sign blobs.
SubmitRequestType
SubmitResponse
ToCBorable
ToHashable
UnSigned<T>
WithToJson

Constants

btoa → const String Function(dynamic value)
DEFAULT_INGRESS_EXPIRY_DELTA_IN_MSECS → const int
DEFAULT_LENGTH → const int
FIVE_MINUTES_IN_MSEC → const int
IC_ROOT_KEY → const String
KEY_LENGTH → const int

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}) BinaryBlob
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(Predicate<bool> condition, int timeInMsec) PollStrategy
createAssetCanisterActor(ActorConfig config) CanisterActor
Create a management canister actor. @param config
createIdentityDescriptor(Identity identity) IdentityDescriptor
decodeReturnValue(List<CType> types, BinaryBlob msg) → dynamic
defaultStrategy() PollStrategy
derBlobFromBlob(BinaryBlob blob) DerEncodedBlob
domainSep(String s) Uint8List
extractDER(Uint8List buf) Uint8List
findLabel(Uint8List l, List<List> trees) List?
flattenForks(List t) List<List>
getManagementCanister(CallConfig config) CanisterActor
getRandomValues([int length = DEFAULT_LENGTH]) 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) num
idlLabelToId(String label) num
initCborSerializer() SelfDescribeEncoder
initCborSerializerNoHead() SelfDescribeEncoder
isIdentityDescriptor(dynamic value) bool
Type Guard for whether the unknown value is an IdentityDescriptor or not. @param value - value to type guard
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.
lookupPath(List path, List tree) Uint8List?
@param path @param tree
lookupPathEx(List path, List tree) Uint8List?
@param path @param tree
makeNonce() Nonce
makeNonceTransform([NonceFunc nonceFn = makeNonce]) HttpAgentRequestTransformFnCall
managementIDL() Service
maxAttempts(int count) PollStrategy
once() Predicate<bool>
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>
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(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.
throttle(int throttleInMsec) PollStrategy
Throttle polling. @param throttleInMsec Amount in millisecond to wait between each polling.
timeout(int timeInMsec) PollStrategy
writeIntLE(dynamic value, int byteLength) Uint8List
writeUIntLE(dynamic value, int byteLength) Uint8List

Typedefs

ActorConstructor = CanisterActor Function(ActorConfig config)
BinaryBlob = Uint8List
DerEncodedBlob = BinaryBlob
Envelope<T> = UnSigned<T>
FetchFunc<T> = Future<T> Function({dynamic body, required String endpoint, Map<String, String>? headers, String? host, FetchMethod method})
HttpAgentRequest = HttpAgentBaseRequest<WithToJson>
HttpAgentRequestTransformFnCall = Future<HttpAgentRequest?> Function(HttpAgentRequest args)
MethodCaller = Future Function(CallConfig options, List args)
Nonce = BinaryBlob
NonceFunc = Nonce Function()
PollStrategy = Future<void> Function(Principal canisterId, RequestId requestId, String status)
PollStrategyFactory = PollStrategy Function()
Predicate<T> = Future<T> Function(Principal canisterId, RequestId requestId, String status)
PromiseReject = Future Function(dynamic value)
PromiseResolve = Future Function(dynamic value)
ReadRequest = ReadStateRequest
RequestId = BinaryBlob

Exceptions / Errors

ActorCallError
AgentError
PollingResponseDoneException
PollingResponseException
PollingResponseRejectedException
QueryCallRejectedError
UnverifiedCertificateError
A certificate needs to be verified (using {@link Certificate.prototype.verify}) before it can be used.
UpdateCallRejectedError