zerc20-client-sdk 0.1.13 → 0.1.14
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/README.md +261 -0
- package/dist/constants.d.ts +15 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +15 -0
- package/dist/constants.js.map +1 -1
- package/dist/decider/__tests__/prover.test.d.ts +2 -0
- package/dist/decider/__tests__/prover.test.d.ts.map +1 -0
- package/dist/decider/__tests__/prover.test.js +246 -0
- package/dist/decider/__tests__/prover.test.js.map +1 -0
- package/dist/decider/prover.d.ts +36 -4
- package/dist/decider/prover.d.ts.map +1 -1
- package/dist/decider/prover.js +48 -38
- package/dist/decider/prover.js.map +1 -1
- package/dist/ic/__tests__/candid.test.d.ts +2 -0
- package/dist/ic/__tests__/candid.test.d.ts.map +1 -0
- package/dist/ic/__tests__/candid.test.js +44 -0
- package/dist/ic/__tests__/candid.test.js.map +1 -0
- package/dist/ic/__tests__/client.test.d.ts +2 -0
- package/dist/ic/__tests__/client.test.d.ts.map +1 -0
- package/dist/ic/__tests__/client.test.js +522 -0
- package/dist/ic/__tests__/client.test.js.map +1 -0
- package/dist/ic/__tests__/config.test.d.ts +2 -0
- package/dist/ic/__tests__/config.test.d.ts.map +1 -0
- package/dist/ic/__tests__/config.test.js +72 -0
- package/dist/ic/__tests__/config.test.js.map +1 -0
- package/dist/ic/__tests__/connections.test.d.ts +2 -0
- package/dist/ic/__tests__/connections.test.d.ts.map +1 -0
- package/dist/ic/__tests__/connections.test.js +385 -0
- package/dist/ic/__tests__/connections.test.js.map +1 -0
- package/dist/ic/__tests__/invoice.test.d.ts +2 -0
- package/dist/ic/__tests__/invoice.test.d.ts.map +1 -0
- package/dist/ic/__tests__/invoice.test.js +95 -0
- package/dist/ic/__tests__/invoice.test.js.map +1 -0
- package/dist/ic/authorization.d.ts +28 -0
- package/dist/ic/authorization.d.ts.map +1 -1
- package/dist/ic/authorization.js +24 -0
- package/dist/ic/authorization.js.map +1 -1
- package/dist/ic/candid.d.ts +72 -0
- package/dist/ic/candid.d.ts.map +1 -0
- package/dist/ic/candid.js +35 -0
- package/dist/ic/candid.js.map +1 -0
- package/dist/ic/client.d.ts +57 -59
- package/dist/ic/client.d.ts.map +1 -1
- package/dist/ic/client.js +59 -81
- package/dist/ic/client.js.map +1 -1
- package/dist/ic/config.d.ts +27 -0
- package/dist/ic/config.d.ts.map +1 -1
- package/dist/ic/config.js +27 -0
- package/dist/ic/config.js.map +1 -1
- package/dist/ic/connections.d.ts +99 -4
- package/dist/ic/connections.d.ts.map +1 -1
- package/dist/ic/connections.js +222 -30
- package/dist/ic/connections.js.map +1 -1
- package/dist/ic/encryption.d.ts +33 -0
- package/dist/ic/encryption.d.ts.map +1 -1
- package/dist/ic/encryption.js +21 -0
- package/dist/ic/encryption.js.map +1 -1
- package/dist/ic/errors.d.ts +15 -0
- package/dist/ic/errors.d.ts.map +1 -1
- package/dist/ic/errors.js +15 -0
- package/dist/ic/errors.js.map +1 -1
- package/dist/ic/idl.d.ts +26 -0
- package/dist/ic/idl.d.ts.map +1 -0
- package/dist/ic/idl.js +84 -0
- package/dist/ic/idl.js.map +1 -0
- package/dist/ic/index.d.ts +1 -1
- package/dist/ic/index.d.ts.map +1 -1
- package/dist/ic/index.js +1 -1
- package/dist/ic/index.js.map +1 -1
- package/dist/ic/invoice.d.ts.map +1 -1
- package/dist/ic/invoice.js.map +1 -1
- package/dist/ic/types.d.ts +42 -0
- package/dist/ic/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/onchain/__tests__/contracts.test.d.ts +2 -0
- package/dist/onchain/__tests__/contracts.test.d.ts.map +1 -0
- package/dist/onchain/__tests__/contracts.test.js +42 -0
- package/dist/onchain/__tests__/contracts.test.js.map +1 -0
- package/dist/onchain/contracts.d.ts +22 -0
- package/dist/onchain/contracts.d.ts.map +1 -1
- package/dist/onchain/contracts.js +22 -0
- package/dist/onchain/contracts.js.map +1 -1
- package/dist/operations/__tests__/invoice.test.d.ts +2 -0
- package/dist/operations/__tests__/invoice.test.d.ts.map +1 -0
- package/dist/operations/__tests__/invoice.test.js +261 -0
- package/dist/operations/__tests__/invoice.test.js.map +1 -0
- package/dist/operations/__tests__/privateSend.test.d.ts +2 -0
- package/dist/operations/__tests__/privateSend.test.d.ts.map +1 -0
- package/dist/operations/__tests__/privateSend.test.js +135 -0
- package/dist/operations/__tests__/privateSend.test.js.map +1 -0
- package/dist/operations/__tests__/reexports.test.d.ts +2 -0
- package/dist/operations/__tests__/reexports.test.d.ts.map +1 -0
- package/dist/operations/__tests__/reexports.test.js +22 -0
- package/dist/operations/__tests__/reexports.test.js.map +1 -0
- package/dist/operations/__tests__/scanner.test.d.ts +2 -0
- package/dist/operations/__tests__/scanner.test.d.ts.map +1 -0
- package/dist/operations/__tests__/scanner.test.js +201 -0
- package/dist/operations/__tests__/scanner.test.js.map +1 -0
- package/dist/operations/__tests__/teleport.test.d.ts +2 -0
- package/dist/operations/__tests__/teleport.test.d.ts.map +1 -0
- package/dist/operations/__tests__/teleport.test.js +35 -0
- package/dist/operations/__tests__/teleport.test.js.map +1 -0
- package/dist/operations/__tests__/teleportProof.test.d.ts +2 -0
- package/dist/operations/__tests__/teleportProof.test.d.ts.map +1 -0
- package/dist/operations/__tests__/teleportProof.test.js +126 -0
- package/dist/operations/__tests__/teleportProof.test.js.map +1 -0
- package/dist/operations/invoice.d.ts +44 -0
- package/dist/operations/invoice.d.ts.map +1 -1
- package/dist/operations/invoice.js +30 -0
- package/dist/operations/invoice.js.map +1 -1
- package/dist/operations/liquidityManager/__tests__/balance.test.d.ts +2 -0
- package/dist/operations/liquidityManager/__tests__/balance.test.d.ts.map +1 -0
- package/dist/operations/liquidityManager/__tests__/balance.test.js +104 -0
- package/dist/operations/liquidityManager/__tests__/balance.test.js.map +1 -0
- package/dist/operations/liquidityManager/__tests__/crossUnwrap.test.d.ts +2 -0
- package/dist/operations/liquidityManager/__tests__/crossUnwrap.test.d.ts.map +1 -0
- package/dist/operations/liquidityManager/__tests__/crossUnwrap.test.js +198 -0
- package/dist/operations/liquidityManager/__tests__/crossUnwrap.test.js.map +1 -0
- package/dist/operations/liquidityManager/__tests__/helpers.test.d.ts +2 -0
- package/dist/operations/liquidityManager/__tests__/helpers.test.d.ts.map +1 -0
- package/dist/operations/liquidityManager/__tests__/helpers.test.js +126 -0
- package/dist/operations/liquidityManager/__tests__/helpers.test.js.map +1 -0
- package/dist/operations/liquidityManager/__tests__/unwrap.test.d.ts +2 -0
- package/dist/operations/liquidityManager/__tests__/unwrap.test.d.ts.map +1 -0
- package/dist/operations/liquidityManager/__tests__/unwrap.test.js +224 -0
- package/dist/operations/liquidityManager/__tests__/unwrap.test.js.map +1 -0
- package/dist/operations/liquidityManager/__tests__/wrap.test.d.ts +2 -0
- package/dist/operations/liquidityManager/__tests__/wrap.test.d.ts.map +1 -0
- package/dist/operations/liquidityManager/__tests__/wrap.test.js +144 -0
- package/dist/operations/liquidityManager/__tests__/wrap.test.js.map +1 -0
- package/dist/operations/liquidityManager/balance.d.ts +19 -0
- package/dist/operations/liquidityManager/balance.d.ts.map +1 -0
- package/dist/operations/liquidityManager/balance.js +62 -0
- package/dist/operations/liquidityManager/balance.js.map +1 -0
- package/dist/operations/liquidityManager/crossUnwrap.d.ts +73 -0
- package/dist/operations/liquidityManager/crossUnwrap.d.ts.map +1 -0
- package/dist/operations/liquidityManager/crossUnwrap.js +189 -0
- package/dist/operations/liquidityManager/crossUnwrap.js.map +1 -0
- package/dist/operations/liquidityManager/helpers.d.ts +15521 -0
- package/dist/operations/liquidityManager/helpers.d.ts.map +1 -0
- package/dist/operations/liquidityManager/helpers.js +81 -0
- package/dist/operations/liquidityManager/helpers.js.map +1 -0
- package/dist/operations/liquidityManager/index.d.ts +12 -0
- package/dist/operations/liquidityManager/index.d.ts.map +1 -0
- package/dist/operations/liquidityManager/index.js +9 -0
- package/dist/operations/liquidityManager/index.js.map +1 -0
- package/dist/operations/liquidityManager/types.d.ts +90 -0
- package/dist/operations/liquidityManager/types.d.ts.map +1 -0
- package/dist/operations/liquidityManager/types.js +5 -0
- package/dist/operations/liquidityManager/types.js.map +1 -0
- package/dist/operations/liquidityManager/unwrap.d.ts +54 -0
- package/dist/operations/liquidityManager/unwrap.d.ts.map +1 -0
- package/dist/operations/liquidityManager/unwrap.js +80 -0
- package/dist/operations/liquidityManager/unwrap.js.map +1 -0
- package/dist/operations/liquidityManager/wrap.d.ts +38 -0
- package/dist/operations/liquidityManager/wrap.d.ts.map +1 -0
- package/dist/operations/liquidityManager/wrap.js +53 -0
- package/dist/operations/liquidityManager/wrap.js.map +1 -0
- package/dist/operations/liquidityManager.d.ts +3 -104
- package/dist/operations/liquidityManager.d.ts.map +1 -1
- package/dist/operations/liquidityManager.js +3 -343
- package/dist/operations/liquidityManager.js.map +1 -1
- package/dist/operations/privateSend.d.ts +26 -0
- package/dist/operations/privateSend.d.ts.map +1 -1
- package/dist/operations/privateSend.js +11 -0
- package/dist/operations/privateSend.js.map +1 -1
- package/dist/operations/receive/__tests__/announcementStatus.test.d.ts +2 -0
- package/dist/operations/receive/__tests__/announcementStatus.test.d.ts.map +1 -0
- package/dist/operations/receive/__tests__/announcementStatus.test.js +223 -0
- package/dist/operations/receive/__tests__/announcementStatus.test.js.map +1 -0
- package/dist/operations/receive/__tests__/cache.test.d.ts +2 -0
- package/dist/operations/receive/__tests__/cache.test.d.ts.map +1 -0
- package/dist/operations/receive/__tests__/cache.test.js +339 -0
- package/dist/operations/receive/__tests__/cache.test.js.map +1 -0
- package/dist/operations/receive/__tests__/helpers.test.d.ts +2 -0
- package/dist/operations/receive/__tests__/helpers.test.d.ts.map +1 -0
- package/dist/operations/receive/__tests__/helpers.test.js +80 -0
- package/dist/operations/receive/__tests__/helpers.test.js.map +1 -0
- package/dist/operations/receive/__tests__/redeemContext.test.d.ts +2 -0
- package/dist/operations/receive/__tests__/redeemContext.test.d.ts.map +1 -0
- package/dist/operations/receive/__tests__/redeemContext.test.js +230 -0
- package/dist/operations/receive/__tests__/redeemContext.test.js.map +1 -0
- package/dist/operations/receive/announcementStatus.d.ts +12 -0
- package/dist/operations/receive/announcementStatus.d.ts.map +1 -0
- package/dist/operations/receive/announcementStatus.js +56 -0
- package/dist/operations/receive/announcementStatus.js.map +1 -0
- package/dist/operations/receive/cache.d.ts +69 -0
- package/dist/operations/receive/cache.d.ts.map +1 -0
- package/dist/operations/receive/cache.js +105 -0
- package/dist/operations/receive/cache.js.map +1 -0
- package/dist/operations/receive/helpers.d.ts +16 -0
- package/dist/operations/receive/helpers.d.ts.map +1 -0
- package/dist/operations/receive/helpers.js +33 -0
- package/dist/operations/receive/helpers.js.map +1 -0
- package/dist/operations/receive/index.d.ts +9 -0
- package/dist/operations/receive/index.d.ts.map +1 -0
- package/dist/operations/receive/index.js +9 -0
- package/dist/operations/receive/index.js.map +1 -0
- package/dist/operations/receive/redeemContext.d.ts +16 -0
- package/dist/operations/receive/redeemContext.d.ts.map +1 -0
- package/dist/operations/receive/redeemContext.js +107 -0
- package/dist/operations/receive/redeemContext.js.map +1 -0
- package/dist/operations/receive/types.d.ts +141 -0
- package/dist/operations/receive/types.d.ts.map +1 -0
- package/dist/operations/receive/types.js +5 -0
- package/dist/operations/receive/types.js.map +1 -0
- package/dist/operations/receive.d.ts +5 -66
- package/dist/operations/receive.d.ts.map +1 -1
- package/dist/operations/receive.js +5 -173
- package/dist/operations/receive.js.map +1 -1
- package/dist/operations/scanner.d.ts +37 -0
- package/dist/operations/scanner.d.ts.map +1 -1
- package/dist/operations/scanner.js +21 -0
- package/dist/operations/scanner.js.map +1 -1
- package/dist/operations/teleport.d.ts +5 -0
- package/dist/operations/teleport.d.ts.map +1 -1
- package/dist/operations/teleport.js +5 -0
- package/dist/operations/teleport.js.map +1 -1
- package/dist/operations/teleportProof.d.ts +34 -0
- package/dist/operations/teleportProof.d.ts.map +1 -1
- package/dist/operations/teleportProof.js +16 -0
- package/dist/operations/teleportProof.js.map +1 -1
- package/dist/registry/__tests__/helpers.test.d.ts +2 -0
- package/dist/registry/__tests__/helpers.test.d.ts.map +1 -0
- package/dist/registry/__tests__/helpers.test.js +98 -0
- package/dist/registry/__tests__/helpers.test.js.map +1 -0
- package/dist/registry/__tests__/loader.test.d.ts +2 -0
- package/dist/registry/__tests__/loader.test.d.ts.map +1 -0
- package/dist/registry/__tests__/loader.test.js +300 -0
- package/dist/registry/__tests__/loader.test.js.map +1 -0
- package/dist/registry/__tests__/normalize.test.d.ts +2 -0
- package/dist/registry/__tests__/normalize.test.d.ts.map +1 -0
- package/dist/registry/__tests__/normalize.test.js +180 -0
- package/dist/registry/__tests__/normalize.test.js.map +1 -0
- package/dist/registry/__tests__/parsing.test.d.ts +2 -0
- package/dist/registry/__tests__/parsing.test.d.ts.map +1 -0
- package/dist/registry/__tests__/parsing.test.js +188 -0
- package/dist/registry/__tests__/parsing.test.js.map +1 -0
- package/dist/registry/helpers.d.ts +14 -0
- package/dist/registry/helpers.d.ts.map +1 -0
- package/dist/registry/helpers.js +29 -0
- package/dist/registry/helpers.js.map +1 -0
- package/dist/registry/index.d.ts +13 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +15 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/loader.d.ts +57 -0
- package/dist/registry/loader.d.ts.map +1 -0
- package/dist/registry/loader.js +188 -0
- package/dist/registry/loader.js.map +1 -0
- package/dist/registry/normalize.d.ts +29 -0
- package/dist/registry/normalize.d.ts.map +1 -0
- package/dist/registry/normalize.js +81 -0
- package/dist/registry/normalize.js.map +1 -0
- package/dist/registry/parsing.d.ts +55 -0
- package/dist/registry/parsing.d.ts.map +1 -0
- package/dist/registry/parsing.js +139 -0
- package/dist/registry/parsing.js.map +1 -0
- package/dist/registry/tokens.d.ts +6 -42
- package/dist/registry/tokens.d.ts.map +1 -1
- package/dist/registry/tokens.js +6 -231
- package/dist/registry/tokens.js.map +1 -1
- package/dist/registry/types.d.ts +81 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/types.js +2 -0
- package/dist/registry/types.js.map +1 -0
- package/dist/sdk.d.ts +57 -0
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +21 -0
- package/dist/sdk.js.map +1 -1
- package/dist/sdk.publicApi.test.d.ts +2 -0
- package/dist/sdk.publicApi.test.d.ts.map +1 -0
- package/dist/sdk.publicApi.test.js +78 -0
- package/dist/sdk.publicApi.test.js.map +1 -0
- package/dist/types.d.ts +159 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/__tests__/branded.test.d.ts +2 -0
- package/dist/utils/__tests__/branded.test.d.ts.map +1 -0
- package/dist/utils/__tests__/branded.test.js +293 -0
- package/dist/utils/__tests__/branded.test.js.map +1 -0
- package/dist/utils/__tests__/fees.test.d.ts +2 -0
- package/dist/utils/__tests__/fees.test.d.ts.map +1 -0
- package/dist/utils/__tests__/fees.test.js +84 -0
- package/dist/utils/__tests__/fees.test.js.map +1 -0
- package/dist/utils/__tests__/hex.test.d.ts +2 -0
- package/dist/utils/__tests__/hex.test.d.ts.map +1 -0
- package/dist/utils/__tests__/hex.test.js +252 -0
- package/dist/utils/__tests__/hex.test.js.map +1 -0
- package/dist/utils/__tests__/http.test.d.ts +2 -0
- package/dist/utils/__tests__/http.test.d.ts.map +1 -0
- package/dist/utils/__tests__/http.test.js +295 -0
- package/dist/utils/__tests__/http.test.js.map +1 -0
- package/dist/utils/branded.d.ts +154 -0
- package/dist/utils/branded.d.ts.map +1 -0
- package/dist/utils/branded.js +177 -0
- package/dist/utils/branded.js.map +1 -0
- package/dist/utils/fees.d.ts +6 -0
- package/dist/utils/fees.d.ts.map +1 -1
- package/dist/utils/fees.js +4 -0
- package/dist/utils/fees.js.map +1 -1
- package/dist/utils/hex.d.ts +37 -0
- package/dist/utils/hex.d.ts.map +1 -1
- package/dist/utils/hex.js +30 -0
- package/dist/utils/hex.js.map +1 -1
- package/dist/utils/http.d.ts +100 -0
- package/dist/utils/http.d.ts.map +1 -1
- package/dist/utils/http.js +158 -0
- package/dist/utils/http.js.map +1 -1
- package/dist/utils/merkle.d.ts +26 -0
- package/dist/utils/merkle.d.ts.map +1 -1
- package/dist/utils/merkle.js +26 -0
- package/dist/utils/merkle.js.map +1 -1
- package/dist/wasm/__tests__/artifacts.test.d.ts +2 -0
- package/dist/wasm/__tests__/artifacts.test.d.ts.map +1 -0
- package/dist/wasm/__tests__/artifacts.test.js +437 -0
- package/dist/wasm/__tests__/artifacts.test.js.map +1 -0
- package/dist/wasm/__tests__/functions.test.d.ts +2 -0
- package/dist/wasm/__tests__/functions.test.d.ts.map +1 -0
- package/dist/wasm/__tests__/functions.test.js +34 -0
- package/dist/wasm/__tests__/functions.test.js.map +1 -0
- package/dist/wasm/__tests__/helpers.test.d.ts +2 -0
- package/dist/wasm/__tests__/helpers.test.d.ts.map +1 -0
- package/dist/wasm/__tests__/helpers.test.js +128 -0
- package/dist/wasm/__tests__/helpers.test.js.map +1 -0
- package/dist/wasm/__tests__/loader.test.d.ts +2 -0
- package/dist/wasm/__tests__/loader.test.d.ts.map +1 -0
- package/dist/wasm/__tests__/loader.test.js +201 -0
- package/dist/wasm/__tests__/loader.test.js.map +1 -0
- package/dist/wasm/__tests__/runtime.test.d.ts +2 -0
- package/dist/wasm/__tests__/runtime.test.d.ts.map +1 -0
- package/dist/wasm/__tests__/runtime.test.js +335 -0
- package/dist/wasm/__tests__/runtime.test.js.map +1 -0
- package/dist/wasm/__tests__/serialization.test.d.ts +2 -0
- package/dist/wasm/__tests__/serialization.test.d.ts.map +1 -0
- package/dist/wasm/__tests__/serialization.test.js +226 -0
- package/dist/wasm/__tests__/serialization.test.js.map +1 -0
- package/dist/wasm/__tests__/validation.test.js +15 -15
- package/dist/wasm/__tests__/validation.test.js.map +1 -1
- package/dist/wasm/artifacts.d.ts +121 -3
- package/dist/wasm/artifacts.d.ts.map +1 -1
- package/dist/wasm/artifacts.js +175 -50
- package/dist/wasm/artifacts.js.map +1 -1
- package/dist/wasm/functions.d.ts +77 -0
- package/dist/wasm/functions.d.ts.map +1 -0
- package/dist/wasm/functions.js +120 -0
- package/dist/wasm/functions.js.map +1 -0
- package/dist/wasm/helpers.d.ts +32 -0
- package/dist/wasm/helpers.d.ts.map +1 -0
- package/dist/wasm/helpers.js +79 -0
- package/dist/wasm/helpers.js.map +1 -0
- package/dist/wasm/index.d.ts +13 -68
- package/dist/wasm/index.d.ts.map +1 -1
- package/dist/wasm/index.js +14 -514
- package/dist/wasm/index.js.map +1 -1
- package/dist/wasm/loader.d.ts +76 -0
- package/dist/wasm/loader.d.ts.map +1 -0
- package/dist/wasm/loader.js +145 -0
- package/dist/wasm/loader.js.map +1 -0
- package/dist/wasm/runtime.d.ts +65 -0
- package/dist/wasm/runtime.d.ts.map +1 -0
- package/dist/wasm/runtime.js +227 -0
- package/dist/wasm/runtime.js.map +1 -0
- package/dist/wasm/serialization.d.ts +113 -0
- package/dist/wasm/serialization.d.ts.map +1 -0
- package/dist/wasm/serialization.js +188 -0
- package/dist/wasm/serialization.js.map +1 -0
- package/dist/wasm/types.d.ts +30 -0
- package/dist/wasm/types.d.ts.map +1 -0
- package/dist/wasm/types.js +2 -0
- package/dist/wasm/types.js.map +1 -0
- package/dist/zkp/__tests__/proofService.test.d.ts +2 -0
- package/dist/zkp/__tests__/proofService.test.d.ts.map +1 -0
- package/dist/zkp/__tests__/proofService.test.js +283 -0
- package/dist/zkp/__tests__/proofService.test.js.map +1 -0
- package/dist/zkp/__tests__/proofUtils.test.js +86 -0
- package/dist/zkp/__tests__/proofUtils.test.js.map +1 -1
- package/dist/zkp/__tests__/runNovaProver.test.js +13 -1
- package/dist/zkp/__tests__/runNovaProver.test.js.map +1 -1
- package/dist/zkp/__tests__/workerClient.test.d.ts +2 -0
- package/dist/zkp/__tests__/workerClient.test.d.ts.map +1 -0
- package/dist/zkp/__tests__/workerClient.test.js +415 -0
- package/dist/zkp/__tests__/workerClient.test.js.map +1 -0
- package/dist/zkp/index.d.ts +1 -1
- package/dist/zkp/index.d.ts.map +1 -1
- package/dist/zkp/index.js +1 -1
- package/dist/zkp/index.js.map +1 -1
- package/dist/zkp/proofService.d.ts +27 -0
- package/dist/zkp/proofService.d.ts.map +1 -1
- package/dist/zkp/proofService.js +29 -21
- package/dist/zkp/proofService.js.map +1 -1
- package/dist/zkp/proofUtils.d.ts +36 -0
- package/dist/zkp/proofUtils.d.ts.map +1 -1
- package/dist/zkp/proofUtils.js +50 -0
- package/dist/zkp/proofUtils.js.map +1 -1
- package/dist/zkp/workerClient.d.ts +65 -0
- package/dist/zkp/workerClient.d.ts.map +1 -1
- package/dist/zkp/workerClient.js +135 -61
- package/dist/zkp/workerClient.js.map +1 -1
- package/dist/zkp/workerTypes.d.ts +27 -0
- package/dist/zkp/workerTypes.d.ts.map +1 -1
- package/package.json +7 -3
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Candid type definitions for ICP canister interaction.
|
|
3
|
+
* These types match the canister interface (snake_case) and are internal implementation details.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Most SDK consumers should not import this module directly. Use {@link StealthCanisterClient}
|
|
7
|
+
* and the higher-level operations in `src/operations/*`.
|
|
8
|
+
*/
|
|
9
|
+
import { ActorMethod } from "@dfinity/agent";
|
|
10
|
+
import type { CanisterResult } from "./types.js";
|
|
11
|
+
export type KeyManagerActor = {
|
|
12
|
+
get_view_public_key: ActorMethod<[Uint8Array], CanisterResult<Uint8Array>>;
|
|
13
|
+
request_encrypted_view_key: ActorMethod<[
|
|
14
|
+
EncryptedViewKeyRequestCandid
|
|
15
|
+
], CanisterResult<Uint8Array>>;
|
|
16
|
+
get_max_nonce: ActorMethod<[Uint8Array], CanisterResult<bigint>>;
|
|
17
|
+
};
|
|
18
|
+
export type StorageActor = {
|
|
19
|
+
submit_announcement: ActorMethod<[AnnouncementInputCandid], CanisterResult<AnnouncementCandid>>;
|
|
20
|
+
submit_invoice: ActorMethod<[InvoiceSubmissionCandid], CanisterResult<null>>;
|
|
21
|
+
list_invoices: ActorMethod<[Uint8Array, string], CanisterResult<Uint8Array[]>>;
|
|
22
|
+
list_announcements: ActorMethod<[[] | [bigint], [] | [number], string], AnnouncementPageCandid>;
|
|
23
|
+
list_announcements_by_time: ActorMethod<[
|
|
24
|
+
[] | [bigint],
|
|
25
|
+
[] | [number],
|
|
26
|
+
string
|
|
27
|
+
], AnnouncementPageByTimeCandid>;
|
|
28
|
+
get_announcement: ActorMethod<[bigint], [] | [AnnouncementCandid]>;
|
|
29
|
+
};
|
|
30
|
+
export interface AnnouncementInputCandid {
|
|
31
|
+
ibe_ciphertext: Uint8Array;
|
|
32
|
+
ciphertext: Uint8Array;
|
|
33
|
+
nonce: Uint8Array;
|
|
34
|
+
tag: string;
|
|
35
|
+
}
|
|
36
|
+
export interface EncryptedViewKeyRequestCandid {
|
|
37
|
+
address: Uint8Array;
|
|
38
|
+
transport_public_key: Uint8Array;
|
|
39
|
+
expiry_ns: bigint;
|
|
40
|
+
nonce: bigint;
|
|
41
|
+
signature: Uint8Array;
|
|
42
|
+
}
|
|
43
|
+
export interface InvoiceSubmissionCandid {
|
|
44
|
+
invoice_id: Uint8Array;
|
|
45
|
+
signature: Uint8Array;
|
|
46
|
+
tag: string;
|
|
47
|
+
}
|
|
48
|
+
export interface AnnouncementCandid {
|
|
49
|
+
id: bigint;
|
|
50
|
+
ibe_ciphertext: Uint8Array;
|
|
51
|
+
ciphertext: Uint8Array;
|
|
52
|
+
nonce: Uint8Array;
|
|
53
|
+
created_at_ns: bigint;
|
|
54
|
+
tag: string;
|
|
55
|
+
}
|
|
56
|
+
export interface AnnouncementPageCandid {
|
|
57
|
+
announcements: AnnouncementCandid[];
|
|
58
|
+
next_id: [] | [bigint];
|
|
59
|
+
}
|
|
60
|
+
export interface AnnouncementPageByTimeCandid {
|
|
61
|
+
announcements: AnnouncementCandid[];
|
|
62
|
+
next_ts: [] | [bigint];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Unwraps a canister result, handling both Ok/Err and ok/err variants.
|
|
66
|
+
* @param result - Result union returned by canister method.
|
|
67
|
+
* @param method - Method name used for error context.
|
|
68
|
+
* @throws {@link StealthError} if the result is an error variant.
|
|
69
|
+
* @throws {@link StealthError} if the variant is unknown.
|
|
70
|
+
*/
|
|
71
|
+
export declare function unwrapResult<T>(result: CanisterResult<T>, method: string): T;
|
|
72
|
+
//# sourceMappingURL=candid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"candid.d.ts","sourceRoot":"","sources":["../../src/ic/candid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAMjD,MAAM,MAAM,eAAe,GAAG;IAC5B,mBAAmB,EAAE,WAAW,CAAC,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;IAC3E,0BAA0B,EAAE,WAAW,CACrC;QAAC,6BAA6B;KAAC,EAC/B,cAAc,CAAC,UAAU,CAAC,CAC3B,CAAC;IACF,aAAa,EAAE,WAAW,CAAC,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;CAClE,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,mBAAmB,EAAE,WAAW,CAAC,CAAC,uBAAuB,CAAC,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAChG,cAAc,EAAE,WAAW,CAAC,CAAC,uBAAuB,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7E,aAAa,EAAE,WAAW,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE,cAAc,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IAC/E,kBAAkB,EAA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AAkB,EAAE,CAAC;IACpC,OAAO,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACxB;AAMD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,CAc5E"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Candid type definitions for ICP canister interaction.
|
|
3
|
+
* These types match the canister interface (snake_case) and are internal implementation details.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Most SDK consumers should not import this module directly. Use {@link StealthCanisterClient}
|
|
7
|
+
* and the higher-level operations in `src/operations/*`.
|
|
8
|
+
*/
|
|
9
|
+
import { StealthError } from "./errors.js";
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Result Unwrapping
|
|
12
|
+
// ============================================================================
|
|
13
|
+
/**
|
|
14
|
+
* Unwraps a canister result, handling both Ok/Err and ok/err variants.
|
|
15
|
+
* @param result - Result union returned by canister method.
|
|
16
|
+
* @param method - Method name used for error context.
|
|
17
|
+
* @throws {@link StealthError} if the result is an error variant.
|
|
18
|
+
* @throws {@link StealthError} if the variant is unknown.
|
|
19
|
+
*/
|
|
20
|
+
export function unwrapResult(result, method) {
|
|
21
|
+
if ("Ok" in result) {
|
|
22
|
+
return result.Ok;
|
|
23
|
+
}
|
|
24
|
+
if ("ok" in result) {
|
|
25
|
+
return result.ok;
|
|
26
|
+
}
|
|
27
|
+
if ("Err" in result) {
|
|
28
|
+
throw new StealthError(`${method} failed: ${result.Err}`);
|
|
29
|
+
}
|
|
30
|
+
if ("err" in result) {
|
|
31
|
+
throw new StealthError(`${method} failed: ${result.err}`);
|
|
32
|
+
}
|
|
33
|
+
throw new StealthError(`${method} failed: unknown canister result variant`);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=candid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"candid.js","sourceRoot":"","sources":["../../src/ic/candid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAwE3C,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAI,MAAyB,EAAE,MAAc;IACvE,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;QACnB,OAAO,MAAM,CAAC,EAAE,CAAC;IACnB,CAAC;IACD,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;QACnB,OAAO,MAAM,CAAC,EAAE,CAAC;IACnB,CAAC;IACD,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;QACpB,MAAM,IAAI,YAAY,CAAC,GAAG,MAAM,YAAY,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;QACpB,MAAM,IAAI,YAAY,CAAC,GAAG,MAAM,YAAY,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,MAAM,IAAI,YAAY,CAAC,GAAG,MAAM,0CAA0C,CAAC,CAAC;AAC9E,CAAC"}
|
package/dist/ic/client.d.ts
CHANGED
|
@@ -1,89 +1,87 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Agent } from "@dfinity/agent";
|
|
2
2
|
import { Principal } from "@dfinity/principal";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
ibe_ciphertext: Uint8Array;
|
|
13
|
-
ciphertext: Uint8Array;
|
|
14
|
-
nonce: Uint8Array;
|
|
15
|
-
tag: string;
|
|
16
|
-
}
|
|
17
|
-
export interface EncryptedViewKeyRequestCandid {
|
|
18
|
-
address: Uint8Array;
|
|
19
|
-
transport_public_key: Uint8Array;
|
|
20
|
-
expiry_ns: bigint;
|
|
21
|
-
nonce: bigint;
|
|
22
|
-
signature: Uint8Array;
|
|
23
|
-
}
|
|
24
|
-
export interface InvoiceSubmissionCandid {
|
|
25
|
-
invoice_id: Uint8Array;
|
|
26
|
-
signature: Uint8Array;
|
|
27
|
-
tag: string;
|
|
28
|
-
}
|
|
29
|
-
export type StorageActor = {
|
|
30
|
-
submit_announcement: ActorMethod<[AnnouncementInputCandid], CanisterResult<AnnouncementCandid>>;
|
|
31
|
-
submit_invoice: ActorMethod<[InvoiceSubmissionCandid], CanisterResult<null>>;
|
|
32
|
-
list_invoices: ActorMethod<[Uint8Array, string], CanisterResult<Uint8Array[]>>;
|
|
33
|
-
list_announcements: ActorMethod<[
|
|
34
|
-
[] | [bigint],
|
|
35
|
-
[] | [number],
|
|
36
|
-
string
|
|
37
|
-
], AnnouncementPageCandid>;
|
|
38
|
-
list_announcements_by_time: ActorMethod<[
|
|
39
|
-
[] | [bigint],
|
|
40
|
-
[] | [number],
|
|
41
|
-
string
|
|
42
|
-
], AnnouncementPageByTimeCandid>;
|
|
43
|
-
get_announcement: ActorMethod<[bigint], [] | [AnnouncementCandid]>;
|
|
44
|
-
};
|
|
45
|
-
export interface AnnouncementCandid {
|
|
46
|
-
id: bigint;
|
|
47
|
-
ibe_ciphertext: Uint8Array;
|
|
48
|
-
ciphertext: Uint8Array;
|
|
49
|
-
nonce: Uint8Array;
|
|
50
|
-
created_at_ns: bigint;
|
|
51
|
-
tag: string;
|
|
52
|
-
}
|
|
53
|
-
export interface AnnouncementPageCandid {
|
|
54
|
-
announcements: AnnouncementCandid[];
|
|
55
|
-
next_id: [] | [bigint];
|
|
56
|
-
}
|
|
57
|
-
export interface AnnouncementPageByTimeCandid {
|
|
58
|
-
announcements: AnnouncementCandid[];
|
|
59
|
-
next_ts: [] | [bigint];
|
|
60
|
-
}
|
|
3
|
+
import { AnnouncementCandid, AnnouncementInputCandid, EncryptedViewKeyRequestCandid, InvoiceSubmissionCandid } from "./candid.js";
|
|
4
|
+
import { Announcement, AnnouncementInput, AnnouncementPage, AnnouncementPageByTime, EncryptedViewKeyRequest, InvoiceSubmission } from "./types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Internet Computer canister client used for stealth announcements and invoices.
|
|
7
|
+
* @remarks
|
|
8
|
+
* This client:
|
|
9
|
+
* - Creates and memoizes canister actors for the key manager and storage canisters.
|
|
10
|
+
* - Unwraps `Result`-style canister responses (`Ok`/`ok`, `Err`/`err`) via `unwrapResult`.
|
|
11
|
+
*/
|
|
61
12
|
export declare class StealthCanisterClient {
|
|
62
13
|
private readonly agent;
|
|
63
14
|
private readonly storageCanisterId;
|
|
64
15
|
private readonly keyManagerCanisterId;
|
|
65
16
|
private keyManagerActor;
|
|
66
17
|
private storageActor;
|
|
18
|
+
/**
|
|
19
|
+
* Create a canister client using a pre-configured {@link Agent} and canister principals.
|
|
20
|
+
*/
|
|
67
21
|
constructor(agent: Agent, storageCanisterId: Principal, keyManagerCanisterId: Principal);
|
|
22
|
+
/** Return the configured agent. */
|
|
68
23
|
getAgent(): Agent;
|
|
24
|
+
/** Return the configured storage canister id. */
|
|
69
25
|
getStorageCanisterId(): Principal;
|
|
26
|
+
/** Return the configured key manager canister id. */
|
|
70
27
|
getKeyManagerCanisterId(): Principal;
|
|
28
|
+
/**
|
|
29
|
+
* Fetch the view public key for an EVM address (encoded as bytes).
|
|
30
|
+
*/
|
|
71
31
|
getViewPublicKey(address: Uint8Array): Promise<Uint8Array>;
|
|
32
|
+
/**
|
|
33
|
+
* Request an encrypted view key (vetKD flow).
|
|
34
|
+
* @remarks See {@link EncryptedViewKeyRequest} for required signature/nonce/expiry fields.
|
|
35
|
+
*/
|
|
72
36
|
requestEncryptedViewKey(request: EncryptedViewKeyRequest): Promise<Uint8Array>;
|
|
37
|
+
/**
|
|
38
|
+
* Read the maximum nonce for the given address from the key manager canister.
|
|
39
|
+
*/
|
|
73
40
|
getMaxNonce(address: Uint8Array): Promise<bigint>;
|
|
41
|
+
/**
|
|
42
|
+
* Submit an encrypted announcement to the storage canister.
|
|
43
|
+
*/
|
|
74
44
|
submitAnnouncement(input: AnnouncementInput): Promise<Announcement>;
|
|
45
|
+
/**
|
|
46
|
+
* Submit an invoice (signed pointer) to the storage canister.
|
|
47
|
+
*/
|
|
75
48
|
submitInvoice(submission: InvoiceSubmission): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* List invoice ids for an address.
|
|
51
|
+
* @param address - Address bytes used by the canister as the invoice owner key.
|
|
52
|
+
* @param tag - Optional storage tag. Defaults to {@link DEFAULT_ZSTORAGE_TAG}.
|
|
53
|
+
*/
|
|
76
54
|
listInvoices(address: Uint8Array, tag?: string): Promise<Uint8Array[]>;
|
|
55
|
+
/**
|
|
56
|
+
* List announcements using an id-based cursor.
|
|
57
|
+
* @param startAfter - If provided, results start strictly after this announcement id.
|
|
58
|
+
* @param limit - Maximum number of announcements to return.
|
|
59
|
+
* @param tag - Optional storage tag. Defaults to {@link DEFAULT_ZSTORAGE_TAG}.
|
|
60
|
+
* @returns A page with announcements and `nextId` cursor (or null if no more pages).
|
|
61
|
+
*/
|
|
77
62
|
listAnnouncements(startAfter?: bigint, limit?: number, tag?: string): Promise<AnnouncementPage>;
|
|
78
63
|
/**
|
|
79
64
|
* List announcements filtered by time.
|
|
80
65
|
* @param startAfterTs - Timestamp in nanoseconds. Only announcements created after this time will be returned.
|
|
81
66
|
* @param limit - Maximum number of announcements to return.
|
|
82
67
|
* @param tag - Storage tag to filter by.
|
|
68
|
+
* @returns A page with announcements and `nextTs` cursor (or null if no more pages).
|
|
83
69
|
*/
|
|
84
70
|
listAnnouncementsByTime(startAfterTs?: bigint, limit?: number, tag?: string): Promise<AnnouncementPageByTime>;
|
|
71
|
+
/**
|
|
72
|
+
* Fetch a single announcement by its id.
|
|
73
|
+
* @returns The announcement if present, otherwise `null`.
|
|
74
|
+
*/
|
|
85
75
|
getAnnouncement(id: bigint): Promise<Announcement | null>;
|
|
86
76
|
private getKeyManagerActor;
|
|
87
77
|
private getStorageActor;
|
|
88
78
|
}
|
|
79
|
+
/** @internal */
|
|
80
|
+
export declare function mapAnnouncement(announcement: AnnouncementCandid): Announcement;
|
|
81
|
+
/** @internal */
|
|
82
|
+
export declare function toCandidAnnouncementInput(input: AnnouncementInput): AnnouncementInputCandid;
|
|
83
|
+
/** @internal */
|
|
84
|
+
export declare function toCandidEncryptedViewKeyRequest(request: EncryptedViewKeyRequest): EncryptedViewKeyRequestCandid;
|
|
85
|
+
/** @internal */
|
|
86
|
+
export declare function toCandidInvoiceSubmission(submission: InvoiceSubmission): InvoiceSubmissionCandid;
|
|
89
87
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/ic/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/ic/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/ic/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,6BAA6B,EAC7B,uBAAuB,EAIxB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAGpB;;;;;;GAMG;AACH,qBAAa,qBAAqB;IAQ9B,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IATvC,OAAO,CAAC,eAAe,CAAgC;IACvD,OAAO,CAAC,YAAY,CAA6B;IAEjD;;OAEG;gBAEgB,KAAK,EAAE,KAAK,EAC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AAgB,yBAAyB,CAAC,KAAK,EAAE,iBAAiB,GAAG,uBAAuB,CAO3F;AAED,gBAAgB;AAChB,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,uBAAuB,GAC/B,6BAA6B,CAQ/B;AAED,gBAAgB;AAChB,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,iBAAiB,GAAG,uBAAuB,CAMhG"}
|
package/dist/ic/client.js
CHANGED
|
@@ -1,57 +1,99 @@
|
|
|
1
1
|
import { Actor } from "@dfinity/agent";
|
|
2
|
-
import {
|
|
2
|
+
import { unwrapResult, } from "./candid.js";
|
|
3
|
+
import { keyManagerIdlFactory, storageIdlFactory } from "./idl.js";
|
|
3
4
|
import { DEFAULT_ZSTORAGE_TAG } from "../constants.js";
|
|
5
|
+
/**
|
|
6
|
+
* Internet Computer canister client used for stealth announcements and invoices.
|
|
7
|
+
* @remarks
|
|
8
|
+
* This client:
|
|
9
|
+
* - Creates and memoizes canister actors for the key manager and storage canisters.
|
|
10
|
+
* - Unwraps `Result`-style canister responses (`Ok`/`ok`, `Err`/`err`) via `unwrapResult`.
|
|
11
|
+
*/
|
|
4
12
|
export class StealthCanisterClient {
|
|
5
13
|
agent;
|
|
6
14
|
storageCanisterId;
|
|
7
15
|
keyManagerCanisterId;
|
|
8
16
|
keyManagerActor = null;
|
|
9
17
|
storageActor = null;
|
|
18
|
+
/**
|
|
19
|
+
* Create a canister client using a pre-configured {@link Agent} and canister principals.
|
|
20
|
+
*/
|
|
10
21
|
constructor(agent, storageCanisterId, keyManagerCanisterId) {
|
|
11
22
|
this.agent = agent;
|
|
12
23
|
this.storageCanisterId = storageCanisterId;
|
|
13
24
|
this.keyManagerCanisterId = keyManagerCanisterId;
|
|
14
25
|
}
|
|
26
|
+
/** Return the configured agent. */
|
|
15
27
|
getAgent() {
|
|
16
28
|
return this.agent;
|
|
17
29
|
}
|
|
30
|
+
/** Return the configured storage canister id. */
|
|
18
31
|
getStorageCanisterId() {
|
|
19
32
|
return this.storageCanisterId;
|
|
20
33
|
}
|
|
34
|
+
/** Return the configured key manager canister id. */
|
|
21
35
|
getKeyManagerCanisterId() {
|
|
22
36
|
return this.keyManagerCanisterId;
|
|
23
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Fetch the view public key for an EVM address (encoded as bytes).
|
|
40
|
+
*/
|
|
24
41
|
async getViewPublicKey(address) {
|
|
25
42
|
const actor = await this.getKeyManagerActor();
|
|
26
43
|
const result = await actor.get_view_public_key(address);
|
|
27
44
|
return unwrapResult(result, "get_view_public_key");
|
|
28
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Request an encrypted view key (vetKD flow).
|
|
48
|
+
* @remarks See {@link EncryptedViewKeyRequest} for required signature/nonce/expiry fields.
|
|
49
|
+
*/
|
|
29
50
|
async requestEncryptedViewKey(request) {
|
|
30
51
|
const actor = await this.getKeyManagerActor();
|
|
31
52
|
const result = await actor.request_encrypted_view_key(toCandidEncryptedViewKeyRequest(request));
|
|
32
53
|
return unwrapResult(result, "request_encrypted_view_key");
|
|
33
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Read the maximum nonce for the given address from the key manager canister.
|
|
57
|
+
*/
|
|
34
58
|
async getMaxNonce(address) {
|
|
35
59
|
const actor = await this.getKeyManagerActor();
|
|
36
60
|
const result = await actor.get_max_nonce(address);
|
|
37
61
|
return unwrapResult(result, "get_max_nonce");
|
|
38
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Submit an encrypted announcement to the storage canister.
|
|
65
|
+
*/
|
|
39
66
|
async submitAnnouncement(input) {
|
|
40
67
|
const actor = await this.getStorageActor();
|
|
41
68
|
const result = await actor.submit_announcement(toCandidAnnouncementInput(input));
|
|
42
69
|
const announcement = unwrapResult(result, "submit_announcement");
|
|
43
70
|
return mapAnnouncement(announcement);
|
|
44
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Submit an invoice (signed pointer) to the storage canister.
|
|
74
|
+
*/
|
|
45
75
|
async submitInvoice(submission) {
|
|
46
76
|
const actor = await this.getStorageActor();
|
|
47
77
|
const result = await actor.submit_invoice(toCandidInvoiceSubmission(submission));
|
|
48
78
|
unwrapResult(result, "submit_invoice");
|
|
49
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* List invoice ids for an address.
|
|
82
|
+
* @param address - Address bytes used by the canister as the invoice owner key.
|
|
83
|
+
* @param tag - Optional storage tag. Defaults to {@link DEFAULT_ZSTORAGE_TAG}.
|
|
84
|
+
*/
|
|
50
85
|
async listInvoices(address, tag = DEFAULT_ZSTORAGE_TAG) {
|
|
51
86
|
const actor = await this.getStorageActor();
|
|
52
87
|
const result = await actor.list_invoices(address, tag);
|
|
53
88
|
return unwrapResult(result, "list_invoices");
|
|
54
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* List announcements using an id-based cursor.
|
|
92
|
+
* @param startAfter - If provided, results start strictly after this announcement id.
|
|
93
|
+
* @param limit - Maximum number of announcements to return.
|
|
94
|
+
* @param tag - Optional storage tag. Defaults to {@link DEFAULT_ZSTORAGE_TAG}.
|
|
95
|
+
* @returns A page with announcements and `nextId` cursor (or null if no more pages).
|
|
96
|
+
*/
|
|
55
97
|
async listAnnouncements(startAfter, limit, tag = DEFAULT_ZSTORAGE_TAG) {
|
|
56
98
|
const actor = await this.getStorageActor();
|
|
57
99
|
const start = (startAfter === undefined ? [] : [startAfter]);
|
|
@@ -67,6 +109,7 @@ export class StealthCanisterClient {
|
|
|
67
109
|
* @param startAfterTs - Timestamp in nanoseconds. Only announcements created after this time will be returned.
|
|
68
110
|
* @param limit - Maximum number of announcements to return.
|
|
69
111
|
* @param tag - Storage tag to filter by.
|
|
112
|
+
* @returns A page with announcements and `nextTs` cursor (or null if no more pages).
|
|
70
113
|
*/
|
|
71
114
|
async listAnnouncementsByTime(startAfterTs, limit, tag = DEFAULT_ZSTORAGE_TAG) {
|
|
72
115
|
const actor = await this.getStorageActor();
|
|
@@ -78,6 +121,10 @@ export class StealthCanisterClient {
|
|
|
78
121
|
nextTs: page.next_ts.length === 0 ? null : page.next_ts[0],
|
|
79
122
|
};
|
|
80
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Fetch a single announcement by its id.
|
|
126
|
+
* @returns The announcement if present, otherwise `null`.
|
|
127
|
+
*/
|
|
81
128
|
async getAnnouncement(id) {
|
|
82
129
|
const actor = await this.getStorageActor();
|
|
83
130
|
const result = await actor.get_announcement(id);
|
|
@@ -107,22 +154,11 @@ export class StealthCanisterClient {
|
|
|
107
154
|
return this.storageActor;
|
|
108
155
|
}
|
|
109
156
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return result.ok;
|
|
116
|
-
}
|
|
117
|
-
if ("Err" in result) {
|
|
118
|
-
throw new StealthError(`${method} failed: ${result.Err}`);
|
|
119
|
-
}
|
|
120
|
-
if ("err" in result) {
|
|
121
|
-
throw new StealthError(`${method} failed: ${result.err}`);
|
|
122
|
-
}
|
|
123
|
-
throw new StealthError(`${method} failed: unknown canister result variant`);
|
|
124
|
-
}
|
|
125
|
-
function mapAnnouncement(announcement) {
|
|
157
|
+
// ============================================================================
|
|
158
|
+
// Internal Converters (exported for testing)
|
|
159
|
+
// ============================================================================
|
|
160
|
+
/** @internal */
|
|
161
|
+
export function mapAnnouncement(announcement) {
|
|
126
162
|
return {
|
|
127
163
|
id: announcement.id,
|
|
128
164
|
ibeCiphertext: announcement.ibe_ciphertext,
|
|
@@ -132,7 +168,8 @@ function mapAnnouncement(announcement) {
|
|
|
132
168
|
tag: announcement.tag,
|
|
133
169
|
};
|
|
134
170
|
}
|
|
135
|
-
|
|
171
|
+
/** @internal */
|
|
172
|
+
export function toCandidAnnouncementInput(input) {
|
|
136
173
|
return {
|
|
137
174
|
ibe_ciphertext: input.ibeCiphertext,
|
|
138
175
|
ciphertext: input.ciphertext,
|
|
@@ -140,7 +177,8 @@ function toCandidAnnouncementInput(input) {
|
|
|
140
177
|
tag: input.tag ?? DEFAULT_ZSTORAGE_TAG,
|
|
141
178
|
};
|
|
142
179
|
}
|
|
143
|
-
|
|
180
|
+
/** @internal */
|
|
181
|
+
export function toCandidEncryptedViewKeyRequest(request) {
|
|
144
182
|
return {
|
|
145
183
|
address: request.address,
|
|
146
184
|
transport_public_key: request.transportPublicKey,
|
|
@@ -149,72 +187,12 @@ function toCandidEncryptedViewKeyRequest(request) {
|
|
|
149
187
|
signature: request.signature,
|
|
150
188
|
};
|
|
151
189
|
}
|
|
152
|
-
|
|
190
|
+
/** @internal */
|
|
191
|
+
export function toCandidInvoiceSubmission(submission) {
|
|
153
192
|
return {
|
|
154
193
|
invoice_id: submission.invoiceId,
|
|
155
194
|
signature: submission.signature,
|
|
156
195
|
tag: submission.tag ?? DEFAULT_ZSTORAGE_TAG,
|
|
157
196
|
};
|
|
158
197
|
}
|
|
159
|
-
const keyManagerIdlFactory = ({ IDL: idl }) => {
|
|
160
|
-
const Address = idl.Vec(idl.Nat8);
|
|
161
|
-
const PublicKey = idl.Vec(idl.Nat8);
|
|
162
|
-
const Signature = idl.Vec(idl.Nat8);
|
|
163
|
-
const EncryptedKey = idl.Vec(idl.Nat8);
|
|
164
|
-
const EncryptedViewKeyRequest = idl.Record({
|
|
165
|
-
address: Address,
|
|
166
|
-
transport_public_key: PublicKey,
|
|
167
|
-
expiry_ns: idl.Nat64,
|
|
168
|
-
nonce: idl.Nat64,
|
|
169
|
-
signature: Signature,
|
|
170
|
-
});
|
|
171
|
-
const ResultPublicKey = idl.Variant({ Ok: PublicKey, Err: idl.Text });
|
|
172
|
-
const ResultEncryptedKey = idl.Variant({ Ok: EncryptedKey, Err: idl.Text });
|
|
173
|
-
const ResultNonce = idl.Variant({ Ok: idl.Nat64, Err: idl.Text });
|
|
174
|
-
return idl.Service({
|
|
175
|
-
get_view_public_key: idl.Func([Address], [ResultPublicKey], []),
|
|
176
|
-
request_encrypted_view_key: idl.Func([EncryptedViewKeyRequest], [ResultEncryptedKey], []),
|
|
177
|
-
get_max_nonce: idl.Func([Address], [ResultNonce], ["query"]),
|
|
178
|
-
});
|
|
179
|
-
};
|
|
180
|
-
const storageIdlFactory = ({ IDL: idl }) => {
|
|
181
|
-
const AnnouncementInput = idl.Record({
|
|
182
|
-
ibe_ciphertext: idl.Vec(idl.Nat8),
|
|
183
|
-
ciphertext: idl.Vec(idl.Nat8),
|
|
184
|
-
nonce: idl.Vec(idl.Nat8),
|
|
185
|
-
tag: idl.Text,
|
|
186
|
-
});
|
|
187
|
-
const Announcement = idl.Record({
|
|
188
|
-
id: idl.Nat64,
|
|
189
|
-
ibe_ciphertext: idl.Vec(idl.Nat8),
|
|
190
|
-
ciphertext: idl.Vec(idl.Nat8),
|
|
191
|
-
nonce: idl.Vec(idl.Nat8),
|
|
192
|
-
created_at_ns: idl.Nat64,
|
|
193
|
-
tag: idl.Text,
|
|
194
|
-
});
|
|
195
|
-
const AnnouncementPage = idl.Record({
|
|
196
|
-
announcements: idl.Vec(Announcement),
|
|
197
|
-
next_id: idl.Opt(idl.Nat64),
|
|
198
|
-
});
|
|
199
|
-
const AnnouncementPageByTime = idl.Record({
|
|
200
|
-
announcements: idl.Vec(Announcement),
|
|
201
|
-
next_ts: idl.Opt(idl.Nat64),
|
|
202
|
-
});
|
|
203
|
-
const InvoiceSubmission = idl.Record({
|
|
204
|
-
invoice_id: idl.Vec(idl.Nat8),
|
|
205
|
-
signature: idl.Vec(idl.Nat8),
|
|
206
|
-
tag: idl.Text,
|
|
207
|
-
});
|
|
208
|
-
const SubmitAnnouncementResult = idl.Variant({ Ok: Announcement, Err: idl.Text });
|
|
209
|
-
const SubmitInvoiceResult = idl.Variant({ Ok: idl.Null, Err: idl.Text });
|
|
210
|
-
const ListInvoicesResult = idl.Variant({ Ok: idl.Vec(idl.Vec(idl.Nat8)), Err: idl.Text });
|
|
211
|
-
return idl.Service({
|
|
212
|
-
submit_announcement: idl.Func([AnnouncementInput], [SubmitAnnouncementResult], []),
|
|
213
|
-
submit_invoice: idl.Func([InvoiceSubmission], [SubmitInvoiceResult], []),
|
|
214
|
-
list_invoices: idl.Func([idl.Vec(idl.Nat8), idl.Text], [ListInvoicesResult], ["query"]),
|
|
215
|
-
list_announcements: idl.Func([idl.Opt(idl.Nat64), idl.Opt(idl.Nat32), idl.Text], [AnnouncementPage], ["query"]),
|
|
216
|
-
list_announcements_by_time: idl.Func([idl.Opt(idl.Nat64), idl.Opt(idl.Nat32), idl.Text], [AnnouncementPageByTime], ["query"]),
|
|
217
|
-
get_announcement: idl.Func([idl.Nat64], [idl.Opt(Announcement)], ["query"]),
|
|
218
|
-
});
|
|
219
|
-
};
|
|
220
198
|
//# sourceMappingURL=client.js.map
|
package/dist/ic/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/ic/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/ic/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAS,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAOL,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AASnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;;;;;GAMG;AACH,MAAM,OAAO,qBAAqB;IAQb;IACA;IACA;IATX,eAAe,GAA2B,IAAI,CAAC;IAC/C,YAAY,GAAwB,IAAI,CAAC;IAEjD;;OAEG;IACH,YACmB,KAAY,EACZ,iBAA4B,EAC5B,oBAA+B;QAF/B,UAAK,GAAL,KAAK,CAAO;QACZ,sBAAiB,GAAjB,iBAAiB,CAAW;QAC5B,yBAAoB,GAApB,oBAAoB,CAAW;IAC/C,CAAC;IAEJ,mCAAmC;IACnC,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,iDAAiD;IACjD,oBAAoB;Q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hC,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,oBAAoB,EAAE,OAAO,CAAC,kBAAkB;QAChD,SAAS,EAAE,OAAO,CAAC,QAAQ;QAC3B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,SAAS,EAAE,OAAO,CAAC,SAAS;KAC7B,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,yBAAyB,CAAC,UAA6B;IACrE,OAAO;QACL,UAAU,EAAE,UAAU,CAAC,SAAS;QAChC,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,oBAAoB;KAC5C,CAAC;AACJ,CAAC"}
|
package/dist/ic/config.d.ts
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default configuration helpers for IC stealth canister interactions.
|
|
3
|
+
* @remarks
|
|
4
|
+
* These helpers are used to construct vetKD context bytes and select key id names when interacting
|
|
5
|
+
* with the key manager canister.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Default vetKD context prefix (domain separator) used by the SDK.
|
|
9
|
+
* @remarks The full context is typically `DEFAULT_CONTEXT_PREFIX || addressBytes`.
|
|
10
|
+
*/
|
|
1
11
|
export declare const DEFAULT_CONTEXT_PREFIX: Uint8Array<ArrayBuffer>;
|
|
12
|
+
/**
|
|
13
|
+
* Default vetKD key id name for production deployments.
|
|
14
|
+
* @remarks This must match the key id configured in the key manager canister.
|
|
15
|
+
*/
|
|
2
16
|
export declare const DEFAULT_KEY_ID_NAME = "key_1";
|
|
17
|
+
/**
|
|
18
|
+
* Default vetKD key id name commonly used for test/local deployments.
|
|
19
|
+
* @remarks This is useful when running against local replicas or staging environments.
|
|
20
|
+
*/
|
|
3
21
|
export declare const DEFAULT_TEST_KEY_ID_NAME = "test_key_1";
|
|
22
|
+
/**
|
|
23
|
+
* Derive the vetKD context bytes for an address.
|
|
24
|
+
* @param address - 20-byte EVM address (binary form).
|
|
25
|
+
* @param domain - Optional domain separator prefix. Defaults to {@link DEFAULT_CONTEXT_PREFIX}.
|
|
26
|
+
* @returns Concatenated context bytes: `domain || address`.
|
|
27
|
+
*/
|
|
4
28
|
export declare function deriveContext(address: Uint8Array, domain?: Uint8Array): Uint8Array;
|
|
29
|
+
/**
|
|
30
|
+
* Encode a UTF-8 string into bytes.
|
|
31
|
+
*/
|
|
5
32
|
export declare function textToUint8(text: string): Uint8Array;
|
|
6
33
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/ic/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/ic/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/ic/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;GAGG;AACH,eAAO,MAAM,sBAAsB,yBAAiC,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,wBAAwB,eAAe,CAAC;AAErD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,UAAU,EACnB,MAAM,GAAE,UAAmC,GAC1C,UAAU,CAKZ;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAEpD"}
|
package/dist/ic/config.js
CHANGED
|
@@ -1,14 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default configuration helpers for IC stealth canister interactions.
|
|
3
|
+
* @remarks
|
|
4
|
+
* These helpers are used to construct vetKD context bytes and select key id names when interacting
|
|
5
|
+
* with the key manager canister.
|
|
6
|
+
*/
|
|
1
7
|
const DEFAULT_DOMAIN = "icp-stealth-announcement-v1";
|
|
2
8
|
const encoder = new TextEncoder();
|
|
9
|
+
/**
|
|
10
|
+
* Default vetKD context prefix (domain separator) used by the SDK.
|
|
11
|
+
* @remarks The full context is typically `DEFAULT_CONTEXT_PREFIX || addressBytes`.
|
|
12
|
+
*/
|
|
3
13
|
export const DEFAULT_CONTEXT_PREFIX = encoder.encode(DEFAULT_DOMAIN);
|
|
14
|
+
/**
|
|
15
|
+
* Default vetKD key id name for production deployments.
|
|
16
|
+
* @remarks This must match the key id configured in the key manager canister.
|
|
17
|
+
*/
|
|
4
18
|
export const DEFAULT_KEY_ID_NAME = "key_1";
|
|
19
|
+
/**
|
|
20
|
+
* Default vetKD key id name commonly used for test/local deployments.
|
|
21
|
+
* @remarks This is useful when running against local replicas or staging environments.
|
|
22
|
+
*/
|
|
5
23
|
export const DEFAULT_TEST_KEY_ID_NAME = "test_key_1";
|
|
24
|
+
/**
|
|
25
|
+
* Derive the vetKD context bytes for an address.
|
|
26
|
+
* @param address - 20-byte EVM address (binary form).
|
|
27
|
+
* @param domain - Optional domain separator prefix. Defaults to {@link DEFAULT_CONTEXT_PREFIX}.
|
|
28
|
+
* @returns Concatenated context bytes: `domain || address`.
|
|
29
|
+
*/
|
|
6
30
|
export function deriveContext(address, domain = DEFAULT_CONTEXT_PREFIX) {
|
|
7
31
|
const context = new Uint8Array(domain.length + address.length);
|
|
8
32
|
context.set(domain, 0);
|
|
9
33
|
context.set(address, domain.length);
|
|
10
34
|
return context;
|
|
11
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Encode a UTF-8 string into bytes.
|
|
38
|
+
*/
|
|
12
39
|
export function textToUint8(text) {
|
|
13
40
|
return encoder.encode(text);
|
|
14
41
|
}
|
package/dist/ic/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/ic/config.ts"],"names":[],"mappings":"AAAA,MAAM,cAAc,GAAG,6BAA6B,CAAC;AAErD,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAElC,MAAM,CAAC,MAAM,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/ic/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,cAAc,GAAG,6BAA6B,CAAC;AAErD,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAElC;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;AAErE;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,YAAY,CAAC;AAErD;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAmB,EACnB,SAAqB,sBAAsB;IAE3C,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/D,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACvB,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"}
|