@icp-sdk/core 4.2.2 → 5.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/agent/actor.d.ts +203 -0
- package/lib/cjs/agent/actor.d.ts.map +1 -0
- package/lib/cjs/agent/actor.js +341 -0
- package/lib/cjs/agent/actor.js.map +1 -0
- package/lib/cjs/agent/agent/api.d.ts +216 -0
- package/lib/cjs/agent/agent/api.d.ts.map +1 -0
- package/lib/cjs/agent/agent/api.js +39 -0
- package/lib/cjs/agent/agent/api.js.map +1 -0
- package/lib/cjs/agent/agent/http/__certificates__/goldenCertificates.d.ts +7 -0
- package/lib/cjs/agent/agent/http/__certificates__/goldenCertificates.d.ts.map +1 -0
- package/lib/cjs/agent/agent/http/__certificates__/goldenCertificates.js +19 -0
- package/lib/cjs/agent/agent/http/__certificates__/goldenCertificates.js.map +1 -0
- package/lib/cjs/agent/agent/http/index.d.ts +171 -0
- package/lib/cjs/agent/agent/http/index.d.ts.map +1 -0
- package/lib/cjs/agent/agent/http/index.js +1079 -0
- package/lib/cjs/agent/agent/http/index.js.map +1 -0
- package/lib/cjs/agent/agent/http/transforms.d.ts +54 -0
- package/lib/cjs/agent/agent/http/transforms.d.ts.map +1 -0
- package/lib/cjs/agent/agent/http/transforms.js +135 -0
- package/lib/cjs/agent/agent/http/transforms.js.map +1 -0
- package/lib/cjs/agent/agent/http/types.d.ts +81 -0
- package/lib/cjs/agent/agent/http/types.d.ts.map +1 -0
- package/lib/cjs/agent/agent/http/types.js +43 -0
- package/lib/cjs/agent/agent/http/types.js.map +1 -0
- package/lib/cjs/agent/agent/index.d.ts +3 -0
- package/lib/cjs/agent/agent/index.d.ts.map +1 -0
- package/lib/cjs/agent/agent/index.js +19 -0
- package/lib/cjs/agent/agent/index.js.map +1 -0
- package/lib/cjs/agent/auth.d.ts +91 -0
- package/lib/cjs/agent/auth.d.ts.map +1 -0
- package/lib/cjs/agent/auth.js +65 -0
- package/lib/cjs/agent/auth.js.map +1 -0
- package/lib/cjs/agent/canisterStatus/index.d.ts +93 -0
- package/lib/cjs/agent/canisterStatus/index.d.ts.map +1 -0
- package/lib/cjs/agent/canisterStatus/index.js +301 -0
- package/lib/cjs/agent/canisterStatus/index.js.map +1 -0
- package/lib/cjs/agent/cbor.d.ts +26 -0
- package/lib/cjs/agent/cbor.d.ts.map +1 -0
- package/lib/cjs/agent/cbor.js +93 -0
- package/lib/cjs/agent/cbor.js.map +1 -0
- package/lib/cjs/agent/certificate.d.ts +228 -0
- package/lib/cjs/agent/certificate.d.ts.map +1 -0
- package/lib/cjs/agent/certificate.js +591 -0
- package/lib/cjs/agent/certificate.js.map +1 -0
- package/lib/cjs/agent/constants.d.ts +14 -0
- package/lib/cjs/agent/constants.d.ts.map +1 -0
- package/lib/cjs/agent/constants.js +18 -0
- package/lib/cjs/agent/constants.js.map +1 -0
- package/lib/cjs/agent/der.d.ts +34 -0
- package/lib/cjs/agent/der.d.ts.map +1 -0
- package/lib/cjs/agent/der.js +175 -0
- package/lib/cjs/agent/der.js.map +1 -0
- package/lib/cjs/agent/errors.d.ts +380 -0
- package/lib/cjs/agent/errors.d.ts.map +1 -0
- package/lib/cjs/agent/errors.js +733 -0
- package/lib/cjs/agent/errors.js.map +1 -0
- package/lib/cjs/agent/fetch_candid.d.ts +9 -0
- package/lib/cjs/agent/fetch_candid.d.ts.map +1 -0
- package/lib/cjs/agent/fetch_candid.js +69 -0
- package/lib/cjs/agent/fetch_candid.js.map +1 -0
- package/lib/cjs/agent/index.d.ts +31 -1
- package/lib/cjs/agent/index.d.ts.map +1 -1
- package/lib/cjs/agent/index.js +59 -1
- package/lib/cjs/agent/index.js.map +1 -1
- package/lib/cjs/agent/observable.d.ts +24 -0
- package/lib/cjs/agent/observable.d.ts.map +1 -0
- package/lib/cjs/agent/observable.js +34 -0
- package/lib/cjs/agent/observable.js.map +1 -0
- package/lib/cjs/agent/polling/backoff.d.ts +50 -0
- package/lib/cjs/agent/polling/backoff.d.ts.map +1 -0
- package/lib/cjs/agent/polling/backoff.js +90 -0
- package/lib/cjs/agent/polling/backoff.js.map +1 -0
- package/lib/cjs/agent/polling/index.d.ts +63 -0
- package/lib/cjs/agent/polling/index.d.ts.map +1 -0
- package/lib/cjs/agent/polling/index.js +183 -0
- package/lib/cjs/agent/polling/index.js.map +1 -0
- package/lib/cjs/agent/polling/strategy.d.ts +52 -0
- package/lib/cjs/agent/polling/strategy.d.ts.map +1 -0
- package/lib/cjs/agent/polling/strategy.js +104 -0
- package/lib/cjs/agent/polling/strategy.js.map +1 -0
- package/lib/cjs/agent/public_key.d.ts +16 -0
- package/lib/cjs/agent/public_key.d.ts.map +1 -0
- package/lib/cjs/agent/public_key.js +52 -0
- package/lib/cjs/agent/public_key.js.map +1 -0
- package/lib/cjs/agent/request_id.d.ts +24 -0
- package/lib/cjs/agent/request_id.d.ts.map +1 -0
- package/lib/cjs/agent/request_id.js +88 -0
- package/lib/cjs/agent/request_id.js.map +1 -0
- package/lib/cjs/agent/utils/bls.d.ts +10 -0
- package/lib/cjs/agent/utils/bls.d.ts.map +1 -0
- package/lib/cjs/agent/utils/bls.js +20 -0
- package/lib/cjs/agent/utils/bls.js.map +1 -0
- package/lib/cjs/agent/utils/buffer.d.ts +22 -0
- package/lib/cjs/agent/utils/buffer.d.ts.map +1 -0
- package/lib/cjs/agent/utils/buffer.js +55 -0
- package/lib/cjs/agent/utils/buffer.js.map +1 -0
- package/lib/cjs/agent/utils/expirableMap.d.ts +80 -0
- package/lib/cjs/agent/utils/expirableMap.d.ts.map +1 -0
- package/lib/cjs/agent/utils/expirableMap.js +148 -0
- package/lib/cjs/agent/utils/expirableMap.js.map +1 -0
- package/lib/cjs/agent/utils/leb.d.ts +3 -0
- package/lib/cjs/agent/utils/leb.d.ts.map +1 -0
- package/lib/cjs/agent/utils/leb.js +17 -0
- package/lib/cjs/agent/utils/leb.js.map +1 -0
- package/lib/cjs/agent/utils/random.d.ts +6 -0
- package/lib/cjs/agent/utils/random.d.ts.map +1 -0
- package/lib/cjs/agent/utils/random.js +29 -0
- package/lib/cjs/agent/utils/random.js.map +1 -0
- package/lib/cjs/candid/candid-core.d.ts +72 -0
- package/lib/cjs/candid/candid-core.d.ts.map +1 -0
- package/lib/cjs/candid/candid-core.js +251 -0
- package/lib/cjs/candid/candid-core.js.map +1 -0
- package/lib/cjs/candid/candid-ui.d.ts +35 -0
- package/lib/cjs/candid/candid-ui.d.ts.map +1 -0
- package/lib/cjs/candid/candid-ui.js +317 -0
- package/lib/cjs/candid/candid-ui.js.map +1 -0
- package/lib/cjs/candid/idl.d.ts +579 -0
- package/lib/cjs/candid/idl.d.ts.map +1 -0
- package/lib/cjs/candid/idl.js +2228 -0
- package/lib/cjs/candid/idl.js.map +1 -0
- package/lib/cjs/candid/index.d.ts +11 -1
- package/lib/cjs/candid/index.d.ts.map +1 -1
- package/lib/cjs/candid/index.js +33 -1
- package/lib/cjs/candid/index.js.map +1 -1
- package/lib/cjs/candid/types.d.ts +6 -0
- package/lib/cjs/candid/types.d.ts.map +1 -0
- package/lib/cjs/candid/types.js +4 -0
- package/lib/cjs/candid/types.js.map +1 -0
- package/lib/cjs/candid/utils/bigint-math.d.ts +14 -0
- package/lib/cjs/candid/utils/bigint-math.d.ts.map +1 -0
- package/lib/cjs/candid/utils/bigint-math.js +30 -0
- package/lib/cjs/candid/utils/bigint-math.js.map +1 -0
- package/lib/cjs/candid/utils/buffer.d.ts +86 -0
- package/lib/cjs/candid/utils/buffer.d.ts.map +1 -0
- package/lib/cjs/candid/utils/buffer.js +191 -0
- package/lib/cjs/candid/utils/buffer.js.map +1 -0
- package/lib/cjs/candid/utils/hash.d.ts +7 -0
- package/lib/cjs/candid/utils/hash.d.ts.map +1 -0
- package/lib/cjs/candid/utils/hash.js +33 -0
- package/lib/cjs/candid/utils/hash.js.map +1 -0
- package/lib/cjs/candid/utils/leb128.d.ts +65 -0
- package/lib/cjs/candid/utils/leb128.d.ts.map +1 -0
- package/lib/cjs/candid/utils/leb128.js +228 -0
- package/lib/cjs/candid/utils/leb128.js.map +1 -0
- package/lib/cjs/identity/identity/delegation.d.ts +164 -0
- package/lib/cjs/identity/identity/delegation.d.ts.map +1 -0
- package/lib/cjs/identity/identity/delegation.js +302 -0
- package/lib/cjs/identity/identity/delegation.js.map +1 -0
- package/lib/cjs/identity/identity/ecdsa.d.ts +62 -0
- package/lib/cjs/identity/identity/ecdsa.d.ts.map +1 -0
- package/lib/cjs/identity/identity/ecdsa.js +117 -0
- package/lib/cjs/identity/identity/ecdsa.js.map +1 -0
- package/lib/cjs/identity/identity/ed25519.d.ts +67 -0
- package/lib/cjs/identity/identity/ed25519.d.ts.map +1 -0
- package/lib/cjs/identity/identity/ed25519.js +200 -0
- package/lib/cjs/identity/identity/ed25519.js.map +1 -0
- package/lib/cjs/identity/identity/partial.d.ts +34 -0
- package/lib/cjs/identity/identity/partial.d.ts.map +1 -0
- package/lib/cjs/identity/identity/partial.js +54 -0
- package/lib/cjs/identity/identity/partial.js.map +1 -0
- package/lib/cjs/identity/identity/webauthn.d.ts +51 -0
- package/lib/cjs/identity/identity/webauthn.d.ts.map +1 -0
- package/lib/cjs/identity/identity/webauthn.js +197 -0
- package/lib/cjs/identity/identity/webauthn.js.map +1 -0
- package/lib/cjs/identity/index.d.ts +15 -1
- package/lib/cjs/identity/index.d.ts.map +1 -1
- package/lib/cjs/identity/index.js +24 -1
- package/lib/cjs/identity/index.js.map +1 -1
- package/lib/cjs/identity/secp256k1/der.d.ts +33 -0
- package/lib/cjs/identity/secp256k1/der.d.ts.map +1 -0
- package/lib/cjs/identity/secp256k1/der.js +165 -0
- package/lib/cjs/identity/secp256k1/der.js.map +1 -0
- package/lib/cjs/identity/secp256k1/index.d.ts +4 -1
- package/lib/cjs/identity/secp256k1/index.d.ts.map +1 -1
- package/lib/cjs/identity/secp256k1/index.js +4 -1
- package/lib/cjs/identity/secp256k1/index.js.map +1 -1
- package/lib/cjs/identity/secp256k1/pem.d.ts +7 -0
- package/lib/cjs/identity/secp256k1/pem.d.ts.map +1 -0
- package/lib/cjs/identity/secp256k1/pem.js +75 -0
- package/lib/cjs/identity/secp256k1/pem.js.map +1 -0
- package/lib/cjs/identity/secp256k1/secp256k1.d.ts +87 -0
- package/lib/cjs/identity/secp256k1/secp256k1.d.ts.map +1 -0
- package/lib/cjs/identity/secp256k1/secp256k1.js +260 -0
- package/lib/cjs/identity/secp256k1/secp256k1.js.map +1 -0
- package/lib/cjs/principal/index.d.ts +3 -1
- package/lib/cjs/principal/index.d.ts.map +1 -1
- package/lib/cjs/principal/index.js +7 -1
- package/lib/cjs/principal/index.js.map +1 -1
- package/lib/cjs/principal/principal.d.ts +50 -0
- package/lib/cjs/principal/principal.d.ts.map +1 -0
- package/lib/cjs/principal/principal.js +148 -0
- package/lib/cjs/principal/principal.js.map +1 -0
- package/lib/cjs/principal/utils/base32.d.ts +10 -0
- package/lib/cjs/principal/utils/base32.d.ts.map +1 -0
- package/lib/cjs/principal/utils/base32.js +90 -0
- package/lib/cjs/principal/utils/base32.js.map +1 -0
- package/lib/cjs/principal/utils/getCrc.d.ts +6 -0
- package/lib/cjs/principal/utils/getCrc.d.ts.map +1 -0
- package/lib/cjs/principal/utils/getCrc.js +53 -0
- package/lib/cjs/principal/utils/getCrc.js.map +1 -0
- package/lib/esm/agent/actor.d.ts +203 -0
- package/lib/esm/agent/actor.d.ts.map +1 -0
- package/lib/esm/agent/actor.js +337 -0
- package/lib/esm/agent/actor.js.map +1 -0
- package/lib/esm/agent/agent/api.d.ts +216 -0
- package/lib/esm/agent/agent/api.d.ts.map +1 -0
- package/lib/esm/agent/agent/api.js +34 -0
- package/lib/esm/agent/agent/api.js.map +1 -0
- package/lib/esm/agent/agent/http/__certificates__/goldenCertificates.d.ts +7 -0
- package/lib/esm/agent/agent/http/__certificates__/goldenCertificates.d.ts.map +1 -0
- package/lib/esm/agent/agent/http/__certificates__/goldenCertificates.js +16 -0
- package/lib/esm/agent/agent/http/__certificates__/goldenCertificates.js.map +1 -0
- package/lib/esm/agent/agent/http/index.d.ts +171 -0
- package/lib/esm/agent/agent/http/index.d.ts.map +1 -0
- package/lib/esm/agent/agent/http/index.js +1037 -0
- package/lib/esm/agent/agent/http/index.js.map +1 -0
- package/lib/esm/agent/agent/http/transforms.d.ts +54 -0
- package/lib/esm/agent/agent/http/transforms.d.ts.map +1 -0
- package/lib/esm/agent/agent/http/transforms.js +128 -0
- package/lib/esm/agent/agent/http/transforms.js.map +1 -0
- package/lib/esm/agent/agent/http/types.d.ts +81 -0
- package/lib/esm/agent/agent/http/types.d.ts.map +1 -0
- package/lib/esm/agent/agent/http/types.js +39 -0
- package/lib/esm/agent/agent/http/types.js.map +1 -0
- package/lib/esm/agent/agent/index.d.ts +3 -0
- package/lib/esm/agent/agent/index.d.ts.map +1 -0
- package/lib/esm/agent/agent/index.js +3 -0
- package/lib/esm/agent/agent/index.js.map +1 -0
- package/lib/esm/agent/auth.d.ts +91 -0
- package/lib/esm/agent/auth.d.ts.map +1 -0
- package/lib/esm/agent/auth.js +59 -0
- package/lib/esm/agent/auth.js.map +1 -0
- package/lib/esm/agent/canister-env/index.d.ts +110 -1
- package/lib/esm/agent/canister-env/index.d.ts.map +1 -1
- package/lib/esm/agent/canister-env/index.js +110 -1
- package/lib/esm/agent/canister-env/index.js.map +1 -1
- package/lib/esm/agent/canisterStatus/index.d.ts +93 -0
- package/lib/esm/agent/canisterStatus/index.d.ts.map +1 -0
- package/lib/esm/agent/canisterStatus/index.js +261 -0
- package/lib/esm/agent/canisterStatus/index.js.map +1 -0
- package/lib/esm/agent/cbor.d.ts +26 -0
- package/lib/esm/agent/cbor.d.ts.map +1 -0
- package/lib/esm/agent/cbor.js +54 -0
- package/lib/esm/agent/cbor.js.map +1 -0
- package/lib/esm/agent/certificate.d.ts +228 -0
- package/lib/esm/agent/certificate.d.ts.map +1 -0
- package/lib/esm/agent/certificate.js +545 -0
- package/lib/esm/agent/certificate.js.map +1 -0
- package/lib/esm/agent/constants.d.ts +14 -0
- package/lib/esm/agent/constants.d.ts.map +1 -0
- package/lib/esm/agent/constants.js +15 -0
- package/lib/esm/agent/constants.js.map +1 -0
- package/lib/esm/agent/der.d.ts +34 -0
- package/lib/esm/agent/der.d.ts.map +1 -0
- package/lib/esm/agent/der.js +166 -0
- package/lib/esm/agent/der.js.map +1 -0
- package/lib/esm/agent/errors.d.ts +380 -0
- package/lib/esm/agent/errors.d.ts.map +1 -0
- package/lib/esm/agent/errors.js +678 -0
- package/lib/esm/agent/errors.js.map +1 -0
- package/lib/esm/agent/fetch_candid.d.ts +9 -0
- package/lib/esm/agent/fetch_candid.d.ts.map +1 -0
- package/lib/esm/agent/fetch_candid.js +33 -0
- package/lib/esm/agent/fetch_candid.js.map +1 -0
- package/lib/esm/agent/index.d.ts +31 -1
- package/lib/esm/agent/index.d.ts.map +1 -1
- package/lib/esm/agent/index.js +31 -1
- package/lib/esm/agent/index.js.map +1 -1
- package/lib/esm/agent/observable.d.ts +24 -0
- package/lib/esm/agent/observable.d.ts.map +1 -0
- package/lib/esm/agent/observable.js +29 -0
- package/lib/esm/agent/observable.js.map +1 -0
- package/lib/esm/agent/polling/backoff.d.ts +50 -0
- package/lib/esm/agent/polling/backoff.d.ts.map +1 -0
- package/lib/esm/agent/polling/backoff.js +85 -0
- package/lib/esm/agent/polling/backoff.js.map +1 -0
- package/lib/esm/agent/polling/index.d.ts +63 -0
- package/lib/esm/agent/polling/index.d.ts.map +1 -0
- package/lib/esm/agent/polling/index.js +144 -0
- package/lib/esm/agent/polling/index.js.map +1 -0
- package/lib/esm/agent/polling/strategy.d.ts +52 -0
- package/lib/esm/agent/polling/strategy.d.ts.map +1 -0
- package/lib/esm/agent/polling/strategy.js +94 -0
- package/lib/esm/agent/polling/strategy.js.map +1 -0
- package/lib/esm/agent/public_key.d.ts +16 -0
- package/lib/esm/agent/public_key.d.ts.map +1 -0
- package/lib/esm/agent/public_key.js +48 -0
- package/lib/esm/agent/public_key.js.map +1 -0
- package/lib/esm/agent/request_id.d.ts +24 -0
- package/lib/esm/agent/request_id.d.ts.map +1 -0
- package/lib/esm/agent/request_id.js +83 -0
- package/lib/esm/agent/request_id.js.map +1 -0
- package/lib/esm/agent/utils/bls.d.ts +10 -0
- package/lib/esm/agent/utils/bls.d.ts.map +1 -0
- package/lib/esm/agent/utils/bls.js +17 -0
- package/lib/esm/agent/utils/bls.js.map +1 -0
- package/lib/esm/agent/utils/buffer.d.ts +22 -0
- package/lib/esm/agent/utils/buffer.d.ts.map +1 -0
- package/lib/esm/agent/utils/buffer.js +50 -0
- package/lib/esm/agent/utils/buffer.js.map +1 -0
- package/lib/esm/agent/utils/expirableMap.d.ts +80 -0
- package/lib/esm/agent/utils/expirableMap.d.ts.map +1 -0
- package/lib/esm/agent/utils/expirableMap.js +144 -0
- package/lib/esm/agent/utils/expirableMap.js.map +1 -0
- package/lib/esm/agent/utils/leb.d.ts +3 -0
- package/lib/esm/agent/utils/leb.d.ts.map +1 -0
- package/lib/esm/agent/utils/leb.js +12 -0
- package/lib/esm/agent/utils/leb.js.map +1 -0
- package/lib/esm/agent/utils/random.d.ts +6 -0
- package/lib/esm/agent/utils/random.d.ts.map +1 -0
- package/lib/esm/agent/utils/random.js +25 -0
- package/lib/esm/agent/utils/random.js.map +1 -0
- package/lib/esm/candid/candid-core.d.ts +72 -0
- package/lib/esm/candid/candid-core.d.ts.map +1 -0
- package/lib/esm/candid/candid-core.js +241 -0
- package/lib/esm/candid/candid-core.js.map +1 -0
- package/lib/esm/candid/candid-ui.d.ts +35 -0
- package/lib/esm/candid/candid-ui.d.ts.map +1 -0
- package/lib/esm/candid/candid-ui.js +272 -0
- package/lib/esm/candid/candid-ui.js.map +1 -0
- package/lib/esm/candid/idl.d.ts +579 -0
- package/lib/esm/candid/idl.d.ts.map +1 -0
- package/lib/esm/candid/idl.js +2189 -0
- package/lib/esm/candid/idl.js.map +1 -0
- package/lib/esm/candid/index.d.ts +11 -1
- package/lib/esm/candid/index.d.ts.map +1 -1
- package/lib/esm/candid/index.js +10 -1
- package/lib/esm/candid/index.js.map +1 -1
- package/lib/esm/candid/types.d.ts +6 -0
- package/lib/esm/candid/types.d.ts.map +1 -0
- package/lib/esm/candid/types.js +3 -0
- package/lib/esm/candid/types.js.map +1 -0
- package/lib/esm/candid/utils/bigint-math.d.ts +14 -0
- package/lib/esm/candid/utils/bigint-math.d.ts.map +1 -0
- package/lib/esm/candid/utils/bigint-math.js +26 -0
- package/lib/esm/candid/utils/bigint-math.js.map +1 -0
- package/lib/esm/candid/utils/buffer.d.ts +86 -0
- package/lib/esm/candid/utils/buffer.d.ts.map +1 -0
- package/lib/esm/candid/utils/buffer.js +182 -0
- package/lib/esm/candid/utils/buffer.js.map +1 -0
- package/lib/esm/candid/utils/hash.d.ts +7 -0
- package/lib/esm/candid/utils/hash.d.ts.map +1 -0
- package/lib/esm/candid/utils/hash.js +30 -0
- package/lib/esm/candid/utils/hash.js.map +1 -0
- package/lib/esm/candid/utils/leb128.d.ts +65 -0
- package/lib/esm/candid/utils/leb128.d.ts.map +1 -0
- package/lib/esm/candid/utils/leb128.js +216 -0
- package/lib/esm/candid/utils/leb128.js.map +1 -0
- package/lib/esm/identity/identity/delegation.d.ts +164 -0
- package/lib/esm/identity/identity/delegation.d.ts.map +1 -0
- package/lib/esm/identity/identity/delegation.js +294 -0
- package/lib/esm/identity/identity/delegation.js.map +1 -0
- package/lib/esm/identity/identity/ecdsa.d.ts +62 -0
- package/lib/esm/identity/identity/ecdsa.d.ts.map +1 -0
- package/lib/esm/identity/identity/ecdsa.js +112 -0
- package/lib/esm/identity/identity/ecdsa.js.map +1 -0
- package/lib/esm/identity/identity/ed25519.d.ts +67 -0
- package/lib/esm/identity/identity/ed25519.d.ts.map +1 -0
- package/lib/esm/identity/identity/ed25519.js +195 -0
- package/lib/esm/identity/identity/ed25519.js.map +1 -0
- package/lib/esm/identity/identity/partial.d.ts +34 -0
- package/lib/esm/identity/identity/partial.d.ts.map +1 -0
- package/lib/esm/identity/identity/partial.js +50 -0
- package/lib/esm/identity/identity/partial.js.map +1 -0
- package/lib/esm/identity/identity/webauthn.d.ts +51 -0
- package/lib/esm/identity/identity/webauthn.d.ts.map +1 -0
- package/lib/esm/identity/identity/webauthn.js +192 -0
- package/lib/esm/identity/identity/webauthn.js.map +1 -0
- package/lib/esm/identity/index.d.ts +15 -1
- package/lib/esm/identity/index.d.ts.map +1 -1
- package/lib/esm/identity/index.js +17 -1
- package/lib/esm/identity/index.js.map +1 -1
- package/lib/esm/identity/secp256k1/der.d.ts +33 -0
- package/lib/esm/identity/secp256k1/der.d.ts.map +1 -0
- package/lib/esm/identity/secp256k1/der.js +156 -0
- package/lib/esm/identity/secp256k1/der.js.map +1 -0
- package/lib/esm/identity/secp256k1/index.d.ts +4 -1
- package/lib/esm/identity/secp256k1/index.d.ts.map +1 -1
- package/lib/esm/identity/secp256k1/index.js +4 -1
- package/lib/esm/identity/secp256k1/index.js.map +1 -1
- package/lib/esm/identity/secp256k1/pem.d.ts +7 -0
- package/lib/esm/identity/secp256k1/pem.d.ts.map +1 -0
- package/lib/esm/identity/secp256k1/pem.js +39 -0
- package/lib/esm/identity/secp256k1/pem.js.map +1 -0
- package/lib/esm/identity/secp256k1/secp256k1.d.ts +87 -0
- package/lib/esm/identity/secp256k1/secp256k1.d.ts.map +1 -0
- package/lib/esm/identity/secp256k1/secp256k1.js +222 -0
- package/lib/esm/identity/secp256k1/secp256k1.js.map +1 -0
- package/lib/esm/principal/index.d.ts +3 -1
- package/lib/esm/principal/index.d.ts.map +1 -1
- package/lib/esm/principal/index.js +3 -1
- package/lib/esm/principal/index.js.map +1 -1
- package/lib/esm/principal/principal.d.ts +50 -0
- package/lib/esm/principal/principal.d.ts.map +1 -0
- package/lib/esm/principal/principal.js +144 -0
- package/lib/esm/principal/principal.js.map +1 -0
- package/lib/esm/principal/utils/base32.d.ts +10 -0
- package/lib/esm/principal/utils/base32.d.ts.map +1 -0
- package/lib/esm/principal/utils/base32.js +86 -0
- package/lib/esm/principal/utils/base32.js.map +1 -0
- package/lib/esm/principal/utils/getCrc.d.ts +6 -0
- package/lib/esm/principal/utils/getCrc.d.ts.map +1 -0
- package/lib/esm/principal/utils/getCrc.js +50 -0
- package/lib/esm/principal/utils/getCrc.js.map +1 -0
- package/package.json +17 -11
- package/src/agent/actor.ts +576 -0
- package/src/agent/agent/api.ts +262 -0
- package/src/agent/agent/http/index.ts +1405 -0
- package/src/agent/agent/http/transforms.ts +158 -0
- package/src/agent/agent/http/types.ts +126 -0
- package/src/agent/agent/index.ts +2 -0
- package/src/agent/auth.ts +147 -0
- package/src/agent/canister-env/index.ts +191 -1
- package/src/agent/canisterStatus/index.ts +412 -0
- package/src/agent/cbor.ts +63 -0
- package/src/agent/certificate.ts +841 -0
- package/src/agent/constants.ts +19 -0
- package/src/agent/der.ts +170 -0
- package/src/agent/errors.ts +868 -0
- package/src/agent/fetch_candid.ts +37 -0
- package/src/agent/index.ts +37 -1
- package/src/agent/observable.ts +49 -0
- package/src/agent/polling/backoff.ts +130 -0
- package/src/agent/polling/index.ts +250 -0
- package/src/agent/polling/strategy.ts +144 -0
- package/src/agent/public_key.ts +65 -0
- package/src/agent/request_id.ts +92 -0
- package/src/agent/utils/bls.ts +18 -0
- package/src/agent/utils/buffer.ts +60 -0
- package/src/agent/utils/expirableMap.ts +163 -0
- package/src/agent/utils/leb.ts +14 -0
- package/src/agent/utils/random.ts +30 -0
- package/src/candid/candid-core.ts +276 -0
- package/src/candid/candid-ui.ts +289 -0
- package/src/candid/idl.ts +2556 -0
- package/src/candid/index.ts +16 -1
- package/src/candid/types.ts +7 -0
- package/src/candid/utils/bigint-math.ts +26 -0
- package/src/candid/utils/buffer.ts +221 -0
- package/src/candid/utils/hash.ts +31 -0
- package/src/candid/utils/leb128.ts +234 -0
- package/src/identity/identity/delegation.ts +411 -0
- package/src/identity/identity/ecdsa.ts +158 -0
- package/src/identity/identity/ed25519.ts +239 -0
- package/src/identity/identity/partial.ts +60 -0
- package/src/identity/identity/webauthn.ts +265 -0
- package/src/identity/index.ts +19 -1
- package/src/identity/secp256k1/der.ts +156 -0
- package/src/identity/secp256k1/index.ts +5 -1
- package/src/identity/secp256k1/pem.ts +40 -0
- package/src/identity/secp256k1/secp256k1.ts +270 -0
- package/src/package.json +4 -0
- package/src/principal/index.ts +3 -1
- package/src/principal/principal.ts +171 -0
- package/src/principal/utils/base32.ts +101 -0
- package/src/principal/utils/getCrc.ts +52 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCrc32 = getCrc32;
|
|
4
|
+
// This file is translated to JavaScript from
|
|
5
|
+
// https://lxp32.github.io/docs/a-simple-example-crc32-calculation/
|
|
6
|
+
const lookUpTable = new Uint32Array([
|
|
7
|
+
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
|
|
8
|
+
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
|
|
9
|
+
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
|
|
10
|
+
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
|
|
11
|
+
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
|
|
12
|
+
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
|
|
13
|
+
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
|
|
14
|
+
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
|
|
15
|
+
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
|
|
16
|
+
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
|
|
17
|
+
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
|
|
18
|
+
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
|
|
19
|
+
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
|
|
20
|
+
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
|
|
21
|
+
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
|
22
|
+
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
|
|
23
|
+
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
|
|
24
|
+
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
|
|
25
|
+
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
|
|
26
|
+
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
|
|
27
|
+
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
|
|
28
|
+
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
|
|
29
|
+
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
|
|
30
|
+
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
|
|
31
|
+
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
|
|
32
|
+
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
|
|
33
|
+
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
|
|
34
|
+
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
|
|
35
|
+
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
|
|
36
|
+
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
|
37
|
+
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
|
|
38
|
+
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
|
|
39
|
+
]);
|
|
40
|
+
/**
|
|
41
|
+
* Calculate the CRC32 of a Uint8Array.
|
|
42
|
+
* @param buf The Uint8Array to calculate the CRC32 of.
|
|
43
|
+
*/
|
|
44
|
+
function getCrc32(buf) {
|
|
45
|
+
let crc = -1;
|
|
46
|
+
for (let i = 0; i < buf.length; i++) {
|
|
47
|
+
const byte = buf[i];
|
|
48
|
+
const t = (byte ^ crc) & 0xff;
|
|
49
|
+
crc = lookUpTable[t] ^ (crc >>> 8);
|
|
50
|
+
}
|
|
51
|
+
return (crc ^ -1) >>> 0;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=getCrc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCrc.js","sourceRoot":"","sources":["../../../../src/principal/utils/getCrc.ts"],"names":[],"mappings":";;AAyCA,4BAUC;AAnDD,6CAA6C;AAC7C,mEAAmE;AACnE,MAAM,WAAW,GAAgB,IAAI,WAAW,CAAC;IAC/C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,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AU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;CAC/F,CAAC,CAAC;AAEH;;;GAGG;AACH,SAAgB,QAAQ,CAAC,GAAe;IACtC,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC;IAEb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACpB,MAAM,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC;QAC9B,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { type Agent, type HttpDetailsResponse } from './agent/index.ts';
|
|
2
|
+
import { IDL } from '../candid/index.js';
|
|
3
|
+
import { type PollingOptions } from './polling/index.ts';
|
|
4
|
+
import { Principal } from '../principal/index.js';
|
|
5
|
+
import { Certificate, type CreateCertificateOptions } from './certificate.ts';
|
|
6
|
+
/**
|
|
7
|
+
* Configuration to make calls to the Replica.
|
|
8
|
+
*/
|
|
9
|
+
export interface CallConfig {
|
|
10
|
+
/**
|
|
11
|
+
* An agent to use in this call, otherwise the actor or call will try to discover the
|
|
12
|
+
* agent to use.
|
|
13
|
+
*/
|
|
14
|
+
agent?: Agent;
|
|
15
|
+
/**
|
|
16
|
+
* Options for controlling polling behavior.
|
|
17
|
+
*/
|
|
18
|
+
pollingOptions?: PollingOptions;
|
|
19
|
+
/**
|
|
20
|
+
* The canister ID of this Actor.
|
|
21
|
+
*/
|
|
22
|
+
canisterId?: string | Principal;
|
|
23
|
+
/**
|
|
24
|
+
* The effective canister ID.
|
|
25
|
+
*/
|
|
26
|
+
effectiveCanisterId?: Principal;
|
|
27
|
+
/**
|
|
28
|
+
* The nonce to use for this call. This is used to prevent replay attacks.
|
|
29
|
+
*/
|
|
30
|
+
nonce?: Uint8Array;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Configuration that can be passed to customize the Actor behavior.
|
|
34
|
+
*/
|
|
35
|
+
export interface ActorConfig extends Pick<CallConfig, 'agent' | 'effectiveCanisterId'> {
|
|
36
|
+
/**
|
|
37
|
+
* The Canister ID of this Actor. This is required for an Actor.
|
|
38
|
+
*/
|
|
39
|
+
canisterId: string | Principal;
|
|
40
|
+
/**
|
|
41
|
+
* An override function for update calls' CallConfig. This will be called on every calls.
|
|
42
|
+
*/
|
|
43
|
+
callTransform?(methodName: string, args: unknown[], callConfig: CallConfig): Partial<CallConfig> | void;
|
|
44
|
+
/**
|
|
45
|
+
* An override function for query calls' CallConfig. This will be called on every query.
|
|
46
|
+
*/
|
|
47
|
+
queryTransform?(methodName: string, args: unknown[], callConfig: CallConfig): Partial<CallConfig> | void;
|
|
48
|
+
/**
|
|
49
|
+
* Polyfill for BLS Certificate verification in case wasm is not supported
|
|
50
|
+
*/
|
|
51
|
+
blsVerify?: CreateCertificateOptions['blsVerify'];
|
|
52
|
+
/**
|
|
53
|
+
* Polling options to use when making update calls. This will override the default DEFAULT_POLLING_OPTIONS.
|
|
54
|
+
*/
|
|
55
|
+
pollingOptions?: PollingOptions;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A subclass of an actor. Actor class itself is meant to be a based class.
|
|
59
|
+
*/
|
|
60
|
+
export type ActorSubclass<T = Record<string, ActorMethod>> = Actor & T;
|
|
61
|
+
/**
|
|
62
|
+
* An actor method type, defined for each methods of the actor service.
|
|
63
|
+
*/
|
|
64
|
+
export interface ActorMethod<Args extends unknown[] = unknown[], Ret = unknown> {
|
|
65
|
+
(...args: Args): Promise<Ret>;
|
|
66
|
+
withOptions(options: CallConfig): (...args: Args) => Promise<Ret>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* An actor method type, defined for each methods of the actor service.
|
|
70
|
+
*/
|
|
71
|
+
export interface ActorMethodWithHttpDetails<Args extends unknown[] = unknown[], Ret = unknown> extends ActorMethod {
|
|
72
|
+
(...args: Args): Promise<{
|
|
73
|
+
httpDetails: HttpDetailsResponse;
|
|
74
|
+
result: Ret;
|
|
75
|
+
}>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* An actor method type, defined for each methods of the actor service.
|
|
79
|
+
*/
|
|
80
|
+
export interface ActorMethodExtended<Args extends unknown[] = unknown[], Ret = unknown> extends ActorMethod {
|
|
81
|
+
(...args: Args): Promise<{
|
|
82
|
+
certificate?: Certificate;
|
|
83
|
+
httpDetails?: HttpDetailsResponse;
|
|
84
|
+
result: Ret;
|
|
85
|
+
}>;
|
|
86
|
+
}
|
|
87
|
+
export type FunctionWithArgsAndReturn<Args extends unknown[] = unknown[], Ret = unknown> = (...args: Args) => Ret;
|
|
88
|
+
export type ActorMethodMappedWithHttpDetails<T> = {
|
|
89
|
+
[K in keyof T]: T[K] extends FunctionWithArgsAndReturn<infer Args, infer Ret> ? ActorMethodWithHttpDetails<Args, Ret> : never;
|
|
90
|
+
};
|
|
91
|
+
export type ActorMethodMappedExtended<T> = {
|
|
92
|
+
[K in keyof T]: T[K] extends FunctionWithArgsAndReturn<infer Args, infer Ret> ? ActorMethodExtended<Args, Ret> : never;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Internal metadata for actors. It's an enhanced version of ActorConfig with
|
|
96
|
+
* some fields marked as required (as they are defaulted) and canisterId as
|
|
97
|
+
* a Principal type.
|
|
98
|
+
*/
|
|
99
|
+
interface ActorMetadata {
|
|
100
|
+
service: IDL.ServiceClass;
|
|
101
|
+
agent?: Agent;
|
|
102
|
+
config: ActorConfig;
|
|
103
|
+
}
|
|
104
|
+
declare const metadataSymbol: unique symbol;
|
|
105
|
+
export interface CreateActorClassOpts {
|
|
106
|
+
httpDetails?: boolean;
|
|
107
|
+
certificate?: boolean;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* An actor base class. An actor is an object containing only functions that will
|
|
111
|
+
* return a promise. These functions are derived from the IDL definition.
|
|
112
|
+
*/
|
|
113
|
+
export declare class Actor {
|
|
114
|
+
/**
|
|
115
|
+
* Get the Agent class this Actor would call, or undefined if the Actor would use
|
|
116
|
+
* the default agent (global.ic.agent).
|
|
117
|
+
* @param actor The actor to get the agent of.
|
|
118
|
+
*/
|
|
119
|
+
static agentOf(actor: Actor): Agent | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* Get the interface of an actor, in the form of an instance of a Service.
|
|
122
|
+
* @param actor The actor to get the interface of.
|
|
123
|
+
*/
|
|
124
|
+
static interfaceOf(actor: Actor): IDL.ServiceClass;
|
|
125
|
+
static canisterIdOf(actor: Actor): Principal;
|
|
126
|
+
static createActorClass(interfaceFactory: IDL.InterfaceFactory, options?: CreateActorClassOpts): ActorConstructor;
|
|
127
|
+
/**
|
|
128
|
+
* Creates an actor with the given interface factory and configuration.
|
|
129
|
+
*
|
|
130
|
+
* The [`@icp-sdk/bindgen`](https://js.icp.build/bindgen/) package can be used to generate the interface factory for your canister.
|
|
131
|
+
* @param interfaceFactory - the interface factory for the actor, typically generated by the [`@icp-sdk/bindgen`](https://js.icp.build/bindgen/) package
|
|
132
|
+
* @param configuration - the configuration for the actor
|
|
133
|
+
* @returns an actor with the given interface factory and configuration
|
|
134
|
+
* @see The {@link https://js.icp.build/core/latest/canister-environment/ | Canister Environment Guide} for more details on how to configure an actor using the canister environment.
|
|
135
|
+
* @example
|
|
136
|
+
* Using the interface factory generated by the [`@icp-sdk/bindgen`](https://js.icp.build/bindgen/) package:
|
|
137
|
+
* ```ts
|
|
138
|
+
* import { Actor, HttpAgent } from '@icp-sdk/core/agent';
|
|
139
|
+
* import { Principal } from '@icp-sdk/core/principal';
|
|
140
|
+
* import { idlFactory } from './api/declarations/hello-world.did';
|
|
141
|
+
*
|
|
142
|
+
* // For a convenient way to get the canister ID,
|
|
143
|
+
* // see the https://js.icp.build/core/latest/canister-environment/ guide.
|
|
144
|
+
* const canisterId = Principal.fromText('rrkah-fqaaa-aaaaa-aaaaq-cai');
|
|
145
|
+
*
|
|
146
|
+
* const agent = await HttpAgent.create({
|
|
147
|
+
* host: 'https://icp-api.io',
|
|
148
|
+
* });
|
|
149
|
+
*
|
|
150
|
+
* const actor = Actor.createActor(idlFactory, {
|
|
151
|
+
* agent,
|
|
152
|
+
* canisterId,
|
|
153
|
+
* });
|
|
154
|
+
*
|
|
155
|
+
* const response = await actor.greet('world');
|
|
156
|
+
* console.log(response);
|
|
157
|
+
* ```
|
|
158
|
+
* @example
|
|
159
|
+
* Using the `createActor` wrapper function generated by the [`@icp-sdk/bindgen`](https://js.icp.build/bindgen/) package:
|
|
160
|
+
* ```ts
|
|
161
|
+
* import { HttpAgent } from '@icp-sdk/core/agent';
|
|
162
|
+
* import { Principal } from '@icp-sdk/core/principal';
|
|
163
|
+
* import { createActor } from './api/hello-world';
|
|
164
|
+
*
|
|
165
|
+
* // For a convenient way to get the canister ID,
|
|
166
|
+
* // see the https://js.icp.build/core/latest/canister-environment/ guide.
|
|
167
|
+
* const canisterId = Principal.fromText('rrkah-fqaaa-aaaaa-aaaaq-cai');
|
|
168
|
+
*
|
|
169
|
+
* const agent = await HttpAgent.create({
|
|
170
|
+
* host: 'https://icp-api.io',
|
|
171
|
+
* });
|
|
172
|
+
*
|
|
173
|
+
* const actor = createActor(canisterId, {
|
|
174
|
+
* agent,
|
|
175
|
+
* });
|
|
176
|
+
*
|
|
177
|
+
* const response = await actor.greet('world');
|
|
178
|
+
* console.log(response);
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
static createActor<T = Record<string, ActorMethod>>(interfaceFactory: IDL.InterfaceFactory, configuration: ActorConfig): ActorSubclass<T>;
|
|
182
|
+
/**
|
|
183
|
+
* Returns an actor with methods that return the http response details along with the result
|
|
184
|
+
* @param interfaceFactory - the interface factory for the actor
|
|
185
|
+
* @param configuration - the configuration for the actor
|
|
186
|
+
* @deprecated - use createActor with actorClassOptions instead
|
|
187
|
+
*/
|
|
188
|
+
static createActorWithHttpDetails<T = Record<string, ActorMethod>>(interfaceFactory: IDL.InterfaceFactory, configuration: ActorConfig): ActorSubclass<ActorMethodMappedWithHttpDetails<T>>;
|
|
189
|
+
/**
|
|
190
|
+
* Returns an actor with methods that return the http response details along with the result
|
|
191
|
+
* @param interfaceFactory - the interface factory for the actor
|
|
192
|
+
* @param configuration - the configuration for the actor
|
|
193
|
+
* @param actorClassOptions - options for the actor class extended details to return with the result
|
|
194
|
+
*/
|
|
195
|
+
static createActorWithExtendedDetails<T = Record<string, ActorMethod>>(interfaceFactory: IDL.InterfaceFactory, configuration: ActorConfig, actorClassOptions?: CreateActorClassOpts): ActorSubclass<ActorMethodMappedExtended<T>>;
|
|
196
|
+
private [metadataSymbol];
|
|
197
|
+
protected constructor(metadata: ActorMetadata);
|
|
198
|
+
}
|
|
199
|
+
export type ActorConstructor = new (config: ActorConfig) => ActorSubclass;
|
|
200
|
+
export declare const ACTOR_METHOD_WITH_HTTP_DETAILS = "http-details";
|
|
201
|
+
export declare const ACTOR_METHOD_WITH_CERTIFICATE = "certificate";
|
|
202
|
+
export {};
|
|
203
|
+
//# sourceMappingURL=actor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actor.d.ts","sourceRoot":"","sources":["../../../src/agent/actor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,KAAK,EACV,KAAK,mBAAmB,EAIzB,MAAM,kBAAkB,CAAC;AAa1B,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAmB,KAAK,cAAc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CAAC,CAAC;IAMrD;;;;;OAKG;WACW,8BAA8B,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAC1E,gBAAgB,EAAE,GAAG,CAAC,gBAAgB,EACtC,aAAa,EAAE,WAAW,EAC1B,iBAAiB,GAAE,oBAGlB,GACA,aAAa,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC;IAM9C,OAAO,CAAC,CAAC,cAAc,CAAC,CAAgB;IAExC,SAAS,aAAa,QAAQ,EAAE,aAAa;CAG9C;AAqBD,MAAM,MAAM,gBAAgB,GAAG,KAAK,MAAM,EAAE,WAAW,KAAK,aAAa,CAAC;AAE1E,eAAO,MAAM,8BAA8B,iBAAiB,CAAC;AAC7D,eAAO,MAAM,6BAA6B,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { isV2ResponseBody, isV3ResponseBody, QueryResponseStatus, } from "./agent/index.js";
|
|
2
|
+
import { CertifiedRejectErrorCode, ExternalError, InputError, MissingCanisterIdErrorCode, MissingRootKeyErrorCode, RejectError, UncertifiedRejectErrorCode, UncertifiedRejectUpdateErrorCode, UnexpectedErrorCode, UnknownError, } from "./errors.js";
|
|
3
|
+
import { IDL } from '../candid/index.js';
|
|
4
|
+
import { pollForResponse, DEFAULT_POLLING_OPTIONS } from "./polling/index.js";
|
|
5
|
+
import { Principal } from '../principal/index.js';
|
|
6
|
+
import { Certificate, lookupResultToBuffer } from "./certificate.js";
|
|
7
|
+
import { HttpAgent } from "./agent/http/index.js";
|
|
8
|
+
import { utf8ToBytes } from '@noble/hashes/utils';
|
|
9
|
+
const metadataSymbol = Symbol.for('ic-agent-metadata');
|
|
10
|
+
/**
|
|
11
|
+
* An actor base class. An actor is an object containing only functions that will
|
|
12
|
+
* return a promise. These functions are derived from the IDL definition.
|
|
13
|
+
*/
|
|
14
|
+
export class Actor {
|
|
15
|
+
/**
|
|
16
|
+
* Get the Agent class this Actor would call, or undefined if the Actor would use
|
|
17
|
+
* the default agent (global.ic.agent).
|
|
18
|
+
* @param actor The actor to get the agent of.
|
|
19
|
+
*/
|
|
20
|
+
static agentOf(actor) {
|
|
21
|
+
return actor[metadataSymbol].config.agent;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get the interface of an actor, in the form of an instance of a Service.
|
|
25
|
+
* @param actor The actor to get the interface of.
|
|
26
|
+
*/
|
|
27
|
+
static interfaceOf(actor) {
|
|
28
|
+
return actor[metadataSymbol].service;
|
|
29
|
+
}
|
|
30
|
+
static canisterIdOf(actor) {
|
|
31
|
+
return Principal.from(actor[metadataSymbol].config.canisterId);
|
|
32
|
+
}
|
|
33
|
+
static createActorClass(interfaceFactory, options) {
|
|
34
|
+
const service = interfaceFactory({ IDL });
|
|
35
|
+
class CanisterActor extends Actor {
|
|
36
|
+
constructor(config) {
|
|
37
|
+
if (!config.canisterId) {
|
|
38
|
+
throw InputError.fromCode(new MissingCanisterIdErrorCode(config.canisterId));
|
|
39
|
+
}
|
|
40
|
+
const canisterId = typeof config.canisterId === 'string'
|
|
41
|
+
? Principal.fromText(config.canisterId)
|
|
42
|
+
: config.canisterId;
|
|
43
|
+
super({
|
|
44
|
+
config: {
|
|
45
|
+
...DEFAULT_ACTOR_CONFIG,
|
|
46
|
+
...config,
|
|
47
|
+
canisterId,
|
|
48
|
+
},
|
|
49
|
+
service,
|
|
50
|
+
});
|
|
51
|
+
for (const [methodName, func] of service._fields) {
|
|
52
|
+
if (options?.httpDetails) {
|
|
53
|
+
func.annotations.push(ACTOR_METHOD_WITH_HTTP_DETAILS);
|
|
54
|
+
}
|
|
55
|
+
if (options?.certificate) {
|
|
56
|
+
func.annotations.push(ACTOR_METHOD_WITH_CERTIFICATE);
|
|
57
|
+
}
|
|
58
|
+
this[methodName] = _createActorMethod(this, methodName, func, config.blsVerify);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return CanisterActor;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Creates an actor with the given interface factory and configuration.
|
|
66
|
+
*
|
|
67
|
+
* The [`@icp-sdk/bindgen`](https://js.icp.build/bindgen/) package can be used to generate the interface factory for your canister.
|
|
68
|
+
* @param interfaceFactory - the interface factory for the actor, typically generated by the [`@icp-sdk/bindgen`](https://js.icp.build/bindgen/) package
|
|
69
|
+
* @param configuration - the configuration for the actor
|
|
70
|
+
* @returns an actor with the given interface factory and configuration
|
|
71
|
+
* @see The {@link https://js.icp.build/core/latest/canister-environment/ | Canister Environment Guide} for more details on how to configure an actor using the canister environment.
|
|
72
|
+
* @example
|
|
73
|
+
* Using the interface factory generated by the [`@icp-sdk/bindgen`](https://js.icp.build/bindgen/) package:
|
|
74
|
+
* ```ts
|
|
75
|
+
* import { Actor, HttpAgent } from '@icp-sdk/core/agent';
|
|
76
|
+
* import { Principal } from '@icp-sdk/core/principal';
|
|
77
|
+
* import { idlFactory } from './api/declarations/hello-world.did';
|
|
78
|
+
*
|
|
79
|
+
* // For a convenient way to get the canister ID,
|
|
80
|
+
* // see the https://js.icp.build/core/latest/canister-environment/ guide.
|
|
81
|
+
* const canisterId = Principal.fromText('rrkah-fqaaa-aaaaa-aaaaq-cai');
|
|
82
|
+
*
|
|
83
|
+
* const agent = await HttpAgent.create({
|
|
84
|
+
* host: 'https://icp-api.io',
|
|
85
|
+
* });
|
|
86
|
+
*
|
|
87
|
+
* const actor = Actor.createActor(idlFactory, {
|
|
88
|
+
* agent,
|
|
89
|
+
* canisterId,
|
|
90
|
+
* });
|
|
91
|
+
*
|
|
92
|
+
* const response = await actor.greet('world');
|
|
93
|
+
* console.log(response);
|
|
94
|
+
* ```
|
|
95
|
+
* @example
|
|
96
|
+
* Using the `createActor` wrapper function generated by the [`@icp-sdk/bindgen`](https://js.icp.build/bindgen/) package:
|
|
97
|
+
* ```ts
|
|
98
|
+
* import { HttpAgent } from '@icp-sdk/core/agent';
|
|
99
|
+
* import { Principal } from '@icp-sdk/core/principal';
|
|
100
|
+
* import { createActor } from './api/hello-world';
|
|
101
|
+
*
|
|
102
|
+
* // For a convenient way to get the canister ID,
|
|
103
|
+
* // see the https://js.icp.build/core/latest/canister-environment/ guide.
|
|
104
|
+
* const canisterId = Principal.fromText('rrkah-fqaaa-aaaaa-aaaaq-cai');
|
|
105
|
+
*
|
|
106
|
+
* const agent = await HttpAgent.create({
|
|
107
|
+
* host: 'https://icp-api.io',
|
|
108
|
+
* });
|
|
109
|
+
*
|
|
110
|
+
* const actor = createActor(canisterId, {
|
|
111
|
+
* agent,
|
|
112
|
+
* });
|
|
113
|
+
*
|
|
114
|
+
* const response = await actor.greet('world');
|
|
115
|
+
* console.log(response);
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
static createActor(interfaceFactory, configuration) {
|
|
119
|
+
if (!configuration.canisterId) {
|
|
120
|
+
throw InputError.fromCode(new MissingCanisterIdErrorCode(configuration.canisterId));
|
|
121
|
+
}
|
|
122
|
+
return new (this.createActorClass(interfaceFactory))(configuration);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Returns an actor with methods that return the http response details along with the result
|
|
126
|
+
* @param interfaceFactory - the interface factory for the actor
|
|
127
|
+
* @param configuration - the configuration for the actor
|
|
128
|
+
* @deprecated - use createActor with actorClassOptions instead
|
|
129
|
+
*/
|
|
130
|
+
static createActorWithHttpDetails(interfaceFactory, configuration) {
|
|
131
|
+
return new (this.createActorClass(interfaceFactory, { httpDetails: true }))(configuration);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Returns an actor with methods that return the http response details along with the result
|
|
135
|
+
* @param interfaceFactory - the interface factory for the actor
|
|
136
|
+
* @param configuration - the configuration for the actor
|
|
137
|
+
* @param actorClassOptions - options for the actor class extended details to return with the result
|
|
138
|
+
*/
|
|
139
|
+
static createActorWithExtendedDetails(interfaceFactory, configuration, actorClassOptions = {
|
|
140
|
+
httpDetails: true,
|
|
141
|
+
certificate: true,
|
|
142
|
+
}) {
|
|
143
|
+
return new (this.createActorClass(interfaceFactory, actorClassOptions))(configuration);
|
|
144
|
+
}
|
|
145
|
+
constructor(metadata) {
|
|
146
|
+
this[metadataSymbol] = Object.freeze(metadata);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// IDL functions can have multiple return values, so decoding always
|
|
150
|
+
// produces an array. Ensure that functions with single or zero return
|
|
151
|
+
// values behave as expected.
|
|
152
|
+
function decodeReturnValue(types, msg) {
|
|
153
|
+
const returnValues = IDL.decode(types, msg);
|
|
154
|
+
switch (returnValues.length) {
|
|
155
|
+
case 0:
|
|
156
|
+
return undefined;
|
|
157
|
+
case 1:
|
|
158
|
+
return returnValues[0];
|
|
159
|
+
default:
|
|
160
|
+
return returnValues;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const DEFAULT_ACTOR_CONFIG = {
|
|
164
|
+
pollingOptions: DEFAULT_POLLING_OPTIONS,
|
|
165
|
+
};
|
|
166
|
+
export const ACTOR_METHOD_WITH_HTTP_DETAILS = 'http-details';
|
|
167
|
+
export const ACTOR_METHOD_WITH_CERTIFICATE = 'certificate';
|
|
168
|
+
function _createActorMethod(actor, methodName, func, blsVerify) {
|
|
169
|
+
let caller;
|
|
170
|
+
if (func.annotations.includes('query') || func.annotations.includes('composite_query')) {
|
|
171
|
+
caller = async (options, ...args) => {
|
|
172
|
+
// First, if there's a config transformation, call it.
|
|
173
|
+
options = {
|
|
174
|
+
...options,
|
|
175
|
+
...actor[metadataSymbol].config.queryTransform?.(methodName, args, {
|
|
176
|
+
...actor[metadataSymbol].config,
|
|
177
|
+
...options,
|
|
178
|
+
}),
|
|
179
|
+
};
|
|
180
|
+
const agent = options.agent || actor[metadataSymbol].config.agent || new HttpAgent();
|
|
181
|
+
const cid = Principal.from(options.canisterId || actor[metadataSymbol].config.canisterId);
|
|
182
|
+
const arg = IDL.encode(func.argTypes, args);
|
|
183
|
+
const result = await agent.query(cid, {
|
|
184
|
+
methodName,
|
|
185
|
+
arg,
|
|
186
|
+
effectiveCanisterId: options.effectiveCanisterId,
|
|
187
|
+
});
|
|
188
|
+
const httpDetails = {
|
|
189
|
+
...result.httpDetails,
|
|
190
|
+
requestDetails: result.requestDetails,
|
|
191
|
+
};
|
|
192
|
+
switch (result.status) {
|
|
193
|
+
case QueryResponseStatus.Rejected: {
|
|
194
|
+
const uncertifiedRejectErrorCode = new UncertifiedRejectErrorCode(result.requestId, result.reject_code, result.reject_message, result.error_code, result.signatures);
|
|
195
|
+
uncertifiedRejectErrorCode.callContext = {
|
|
196
|
+
canisterId: cid,
|
|
197
|
+
methodName,
|
|
198
|
+
httpDetails,
|
|
199
|
+
};
|
|
200
|
+
throw RejectError.fromCode(uncertifiedRejectErrorCode);
|
|
201
|
+
}
|
|
202
|
+
case QueryResponseStatus.Replied:
|
|
203
|
+
return func.annotations.includes(ACTOR_METHOD_WITH_HTTP_DETAILS)
|
|
204
|
+
? {
|
|
205
|
+
httpDetails,
|
|
206
|
+
result: decodeReturnValue(func.retTypes, result.reply.arg),
|
|
207
|
+
}
|
|
208
|
+
: decodeReturnValue(func.retTypes, result.reply.arg);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
caller = async (options, ...args) => {
|
|
214
|
+
// First, if there's a config transformation, call it.
|
|
215
|
+
options = {
|
|
216
|
+
...options,
|
|
217
|
+
...actor[metadataSymbol].config.callTransform?.(methodName, args, {
|
|
218
|
+
...actor[metadataSymbol].config,
|
|
219
|
+
...options,
|
|
220
|
+
}),
|
|
221
|
+
};
|
|
222
|
+
const agent = options.agent || actor[metadataSymbol].config.agent || HttpAgent.createSync();
|
|
223
|
+
const { canisterId, effectiveCanisterId, pollingOptions } = {
|
|
224
|
+
...DEFAULT_ACTOR_CONFIG,
|
|
225
|
+
...actor[metadataSymbol].config,
|
|
226
|
+
...options,
|
|
227
|
+
};
|
|
228
|
+
const cid = Principal.from(canisterId);
|
|
229
|
+
const ecid = effectiveCanisterId !== undefined ? Principal.from(effectiveCanisterId) : cid;
|
|
230
|
+
const arg = IDL.encode(func.argTypes, args);
|
|
231
|
+
const { requestId, response, requestDetails } = await agent.call(cid, {
|
|
232
|
+
methodName,
|
|
233
|
+
arg,
|
|
234
|
+
effectiveCanisterId: ecid,
|
|
235
|
+
nonce: options.nonce,
|
|
236
|
+
});
|
|
237
|
+
let reply;
|
|
238
|
+
let certificate;
|
|
239
|
+
if (isV3ResponseBody(response.body)) {
|
|
240
|
+
if (agent.rootKey == null) {
|
|
241
|
+
throw ExternalError.fromCode(new MissingRootKeyErrorCode());
|
|
242
|
+
}
|
|
243
|
+
const cert = response.body.certificate;
|
|
244
|
+
certificate = await Certificate.create({
|
|
245
|
+
certificate: cert,
|
|
246
|
+
rootKey: agent.rootKey,
|
|
247
|
+
canisterId: ecid,
|
|
248
|
+
blsVerify,
|
|
249
|
+
agent,
|
|
250
|
+
});
|
|
251
|
+
const path = [utf8ToBytes('request_status'), requestId];
|
|
252
|
+
const status = new TextDecoder().decode(lookupResultToBuffer(certificate.lookup_path([...path, 'status'])));
|
|
253
|
+
switch (status) {
|
|
254
|
+
case 'replied':
|
|
255
|
+
reply = lookupResultToBuffer(certificate.lookup_path([...path, 'reply']));
|
|
256
|
+
break;
|
|
257
|
+
case 'rejected': {
|
|
258
|
+
// Find rejection details in the certificate
|
|
259
|
+
const rejectCode = new Uint8Array(lookupResultToBuffer(certificate.lookup_path([...path, 'reject_code'])))[0];
|
|
260
|
+
const rejectMessage = new TextDecoder().decode(lookupResultToBuffer(certificate.lookup_path([...path, 'reject_message'])));
|
|
261
|
+
const error_code_buf = lookupResultToBuffer(certificate.lookup_path([...path, 'error_code']));
|
|
262
|
+
const error_code = error_code_buf
|
|
263
|
+
? new TextDecoder().decode(error_code_buf)
|
|
264
|
+
: undefined;
|
|
265
|
+
const certifiedRejectErrorCode = new CertifiedRejectErrorCode(requestId, rejectCode, rejectMessage, error_code);
|
|
266
|
+
certifiedRejectErrorCode.callContext = {
|
|
267
|
+
canisterId: cid,
|
|
268
|
+
methodName,
|
|
269
|
+
httpDetails: response,
|
|
270
|
+
};
|
|
271
|
+
throw RejectError.fromCode(certifiedRejectErrorCode);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
else if (isV2ResponseBody(response.body)) {
|
|
276
|
+
const { reject_code, reject_message, error_code } = response.body;
|
|
277
|
+
const errorCode = new UncertifiedRejectUpdateErrorCode(requestId, reject_code, reject_message, error_code);
|
|
278
|
+
errorCode.callContext = {
|
|
279
|
+
canisterId: cid,
|
|
280
|
+
methodName,
|
|
281
|
+
httpDetails: response,
|
|
282
|
+
};
|
|
283
|
+
throw RejectError.fromCode(errorCode);
|
|
284
|
+
}
|
|
285
|
+
// Fall back to polling if we receive an Accepted response code
|
|
286
|
+
if (response.status === 202) {
|
|
287
|
+
const pollOptions = {
|
|
288
|
+
...pollingOptions,
|
|
289
|
+
blsVerify,
|
|
290
|
+
};
|
|
291
|
+
// Contains the certificate and the reply from the boundary node
|
|
292
|
+
const response = await pollForResponse(agent, ecid, requestId, pollOptions);
|
|
293
|
+
certificate = response.certificate;
|
|
294
|
+
reply = response.reply;
|
|
295
|
+
}
|
|
296
|
+
const shouldIncludeHttpDetails = func.annotations.includes(ACTOR_METHOD_WITH_HTTP_DETAILS);
|
|
297
|
+
const shouldIncludeCertificate = func.annotations.includes(ACTOR_METHOD_WITH_CERTIFICATE);
|
|
298
|
+
const httpDetails = { ...response, requestDetails };
|
|
299
|
+
if (reply !== undefined) {
|
|
300
|
+
if (shouldIncludeHttpDetails && shouldIncludeCertificate) {
|
|
301
|
+
return {
|
|
302
|
+
httpDetails,
|
|
303
|
+
certificate,
|
|
304
|
+
result: decodeReturnValue(func.retTypes, reply),
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
else if (shouldIncludeCertificate) {
|
|
308
|
+
return {
|
|
309
|
+
certificate,
|
|
310
|
+
result: decodeReturnValue(func.retTypes, reply),
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
else if (shouldIncludeHttpDetails) {
|
|
314
|
+
return {
|
|
315
|
+
httpDetails,
|
|
316
|
+
result: decodeReturnValue(func.retTypes, reply),
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
return decodeReturnValue(func.retTypes, reply);
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
const errorCode = new UnexpectedErrorCode(`Call was returned undefined. We cannot determine if the call was successful or not. Return types: [${func.retTypes.map(t => t.display()).join(',')}].`);
|
|
323
|
+
errorCode.callContext = {
|
|
324
|
+
canisterId: cid,
|
|
325
|
+
methodName,
|
|
326
|
+
httpDetails,
|
|
327
|
+
};
|
|
328
|
+
throw UnknownError.fromCode(errorCode);
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
const handler = (...args) => caller({}, ...args);
|
|
333
|
+
handler.withOptions =
|
|
334
|
+
(options) => (...args) => caller(options, ...args);
|
|
335
|
+
return handler;
|
|
336
|
+
}
|
|
337
|
+
//# sourceMappingURL=actor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actor.js","sourceRoot":"","sources":["../../../src/agent/actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,wBAAwB,EACxB,aAAa,EACb,UAAU,EACV,0BAA0B,EAC1B,uBAAuB,EACvB,WAAW,EACX,0BAA0B,EAC1B,gCAAgC,EAChC,mBAAmB,EACnB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAuB,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACnG,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAiC,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACpG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