agent/agent
library
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 , 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 >
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
Typedefs
ActorConstructor
= CanisterActor Function(ActorConfig config )
BinaryBlob
= Uint8List
CreateActorMethod
= ActorMethod Function(Actor actor , String methodName , Func func )
DerEncodedBlob
= BinaryBlob
Envelope <T >
= UnSigned <T >
FetchFunction <T >
= Future <T > Function({dynamic body , required String endpoint , 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()
PollPredicate <T >
= Future <T > Function(Principal canisterId , RequestId requestId , RequestStatusResponseStatus status )
PollStrategy
= Future <void > Function(Principal canisterId , RequestId requestId , RequestStatusResponseStatus status )
PollStrategyFactory
= PollStrategy Function()
ReadRequest
= ReadStateRequest
RequestId
= BinaryBlob
agent_dart_base 1.0.0-dev.31