@paimaexample/wallets 0.3.117
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 +1 -0
- package/esm/chain-types/src/hash.d.ts +28 -0
- package/esm/chain-types/src/hash.d.ts.map +1 -0
- package/esm/chain-types/src/hash.js +29 -0
- package/esm/chain-types/src/mod.d.ts +3 -0
- package/esm/chain-types/src/mod.d.ts.map +1 -0
- package/esm/chain-types/src/mod.js +2 -0
- package/esm/chain-types/src/types.d.ts +70 -0
- package/esm/chain-types/src/types.d.ts.map +1 -0
- package/esm/chain-types/src/types.js +1 -0
- package/esm/concise/src/batcher.d.ts +40 -0
- package/esm/concise/src/batcher.d.ts.map +1 -0
- package/esm/concise/src/batcher.js +117 -0
- package/esm/concise/src/delegate.d.ts +18 -0
- package/esm/concise/src/delegate.d.ts.map +1 -0
- package/esm/concise/src/delegate.js +118 -0
- package/esm/concise/src/mod.d.ts +5 -0
- package/esm/concise/src/mod.d.ts.map +1 -0
- package/esm/concise/src/mod.js +3 -0
- package/esm/concise/src/v2/builtins/batcher.d.ts +27 -0
- package/esm/concise/src/v2/builtins/batcher.d.ts.map +1 -0
- package/esm/concise/src/v2/builtins/batcher.js +51 -0
- package/esm/concise/src/v2/builtins/grammar.d.ts +25 -0
- package/esm/concise/src/v2/builtins/grammar.d.ts.map +1 -0
- package/esm/concise/src/v2/builtins/grammar.js +40 -0
- package/esm/concise/src/v2/builtins/index.d.ts +3 -0
- package/esm/concise/src/v2/builtins/index.d.ts.map +1 -0
- package/esm/concise/src/v2/builtins/index.js +3 -0
- package/esm/concise/src/v2/grammar.d.ts +8 -0
- package/esm/concise/src/v2/grammar.d.ts.map +1 -0
- package/esm/concise/src/v2/grammar.js +19 -0
- package/esm/concise/src/v2/inputs.d.ts +7 -0
- package/esm/concise/src/v2/inputs.d.ts.map +1 -0
- package/esm/concise/src/v2/inputs.js +37 -0
- package/esm/concise/src/v2/mod.d.ts +5 -0
- package/esm/concise/src/v2/mod.d.ts.map +1 -0
- package/esm/concise/src/v2/mod.js +4 -0
- package/esm/concise/src/v2/types.d.ts +23 -0
- package/esm/concise/src/v2/types.d.ts.map +1 -0
- package/esm/concise/src/v2/types.js +1 -0
- package/esm/config/src/config/builder.d.ts +33 -0
- package/esm/config/src/config/builder.d.ts.map +1 -0
- package/esm/config/src/config/builder.js +82 -0
- package/esm/config/src/config/configCheck.d.ts +32 -0
- package/esm/config/src/config/configCheck.d.ts.map +1 -0
- package/esm/config/src/config/configCheck.js +67 -0
- package/esm/config/src/config/context.d.ts +23 -0
- package/esm/config/src/config/context.d.ts.map +1 -0
- package/esm/config/src/config/context.js +25 -0
- package/esm/config/src/config/mod.d.ts +7 -0
- package/esm/config/src/config/mod.d.ts.map +1 -0
- package/esm/config/src/config/mod.js +4 -0
- package/esm/config/src/config/parts/deployedAddresses.d.ts +17 -0
- package/esm/config/src/config/parts/deployedAddresses.d.ts.map +1 -0
- package/esm/config/src/config/parts/deployedAddresses.js +24 -0
- package/esm/config/src/config/parts/network.d.ts +19 -0
- package/esm/config/src/config/parts/network.d.ts.map +1 -0
- package/esm/config/src/config/parts/network.js +29 -0
- package/esm/config/src/config/parts/primitive.d.ts +31 -0
- package/esm/config/src/config/parts/primitive.d.ts.map +1 -0
- package/esm/config/src/config/parts/primitive.js +28 -0
- package/esm/config/src/config/parts/securityNamespace.d.ts +14 -0
- package/esm/config/src/config/parts/securityNamespace.d.ts.map +1 -0
- package/esm/config/src/config/parts/securityNamespace.js +26 -0
- package/esm/config/src/config/parts/syncProtocols.d.ts +43 -0
- package/esm/config/src/config/parts/syncProtocols.d.ts.map +1 -0
- package/esm/config/src/config/parts/syncProtocols.js +66 -0
- package/esm/config/src/config/utils.d.ts +40 -0
- package/esm/config/src/config/utils.d.ts.map +1 -0
- package/esm/config/src/config/utils.js +55 -0
- package/esm/config/src/mod.d.ts +3 -0
- package/esm/config/src/mod.d.ts.map +1 -0
- package/esm/config/src/mod.js +2 -0
- package/esm/config/src/schema/common.d.ts +26 -0
- package/esm/config/src/schema/common.d.ts.map +1 -0
- package/esm/config/src/schema/common.js +51 -0
- package/esm/config/src/schema/mod.d.ts +7 -0
- package/esm/config/src/schema/mod.d.ts.map +1 -0
- package/esm/config/src/schema/mod.js +6 -0
- package/esm/config/src/schema/namespace.d.ts +39 -0
- package/esm/config/src/schema/namespace.d.ts.map +1 -0
- package/esm/config/src/schema/namespace.js +34 -0
- package/esm/config/src/schema/network/algorand.d.ts +12 -0
- package/esm/config/src/schema/network/algorand.d.ts.map +1 -0
- package/esm/config/src/schema/network/algorand.js +23 -0
- package/esm/config/src/schema/network/all.d.ts +175 -0
- package/esm/config/src/schema/network/all.d.ts.map +1 -0
- package/esm/config/src/schema/network/all.js +24 -0
- package/esm/config/src/schema/network/bitcoin.d.ts +19 -0
- package/esm/config/src/schema/network/bitcoin.d.ts.map +1 -0
- package/esm/config/src/schema/network/bitcoin.js +21 -0
- package/esm/config/src/schema/network/cardano.d.ts +12 -0
- package/esm/config/src/schema/network/cardano.d.ts.map +1 -0
- package/esm/config/src/schema/network/cardano.js +27 -0
- package/esm/config/src/schema/network/evm.d.ts +68 -0
- package/esm/config/src/schema/network/evm.d.ts.map +1 -0
- package/esm/config/src/schema/network/evm.js +70 -0
- package/esm/config/src/schema/network/mina.d.ts +14 -0
- package/esm/config/src/schema/network/mina.d.ts.map +1 -0
- package/esm/config/src/schema/network/mina.js +25 -0
- package/esm/config/src/schema/network/mod.d.ts +9 -0
- package/esm/config/src/schema/network/mod.d.ts.map +1 -0
- package/esm/config/src/schema/network/mod.js +8 -0
- package/esm/config/src/schema/network/ntp.d.ts +32 -0
- package/esm/config/src/schema/network/ntp.d.ts.map +1 -0
- package/esm/config/src/schema/network/ntp.js +39 -0
- package/esm/config/src/schema/network/substrate/avail.d.ts +14 -0
- package/esm/config/src/schema/network/substrate/avail.d.ts.map +1 -0
- package/esm/config/src/schema/network/substrate/avail.js +26 -0
- package/esm/config/src/schema/network/substrate/common.d.ts +18 -0
- package/esm/config/src/schema/network/substrate/common.d.ts.map +1 -0
- package/esm/config/src/schema/network/substrate/common.js +32 -0
- package/esm/config/src/schema/network/substrate/midnight.d.ts +20 -0
- package/esm/config/src/schema/network/substrate/midnight.d.ts.map +1 -0
- package/esm/config/src/schema/network/substrate/midnight.js +32 -0
- package/esm/config/src/schema/network/substrate/mod.d.ts +4 -0
- package/esm/config/src/schema/network/substrate/mod.d.ts.map +1 -0
- package/esm/config/src/schema/network/substrate/mod.js +3 -0
- package/esm/config/src/schema/network/types.d.ts +13 -0
- package/esm/config/src/schema/network/types.d.ts.map +1 -0
- package/esm/config/src/schema/network/types.js +13 -0
- package/esm/config/src/schema/network/utils.d.ts +5 -0
- package/esm/config/src/schema/network/utils.d.ts.map +1 -0
- package/esm/config/src/schema/network/utils.js +73 -0
- package/esm/config/src/schema/primitive/mod.d.ts +2 -0
- package/esm/config/src/schema/primitive/mod.d.ts.map +1 -0
- package/esm/config/src/schema/primitive/mod.js +1 -0
- package/esm/config/src/schema/primitive/types.d.ts +58 -0
- package/esm/config/src/schema/primitive/types.d.ts.map +1 -0
- package/esm/config/src/schema/primitive/types.js +1 -0
- package/esm/config/src/schema/sync-protocols/all.d.ts +583 -0
- package/esm/config/src/schema/sync-protocols/all.d.ts.map +1 -0
- package/esm/config/src/schema/sync-protocols/all.js +55 -0
- package/esm/config/src/schema/sync-protocols/avail/rpc.d.ts +76 -0
- package/esm/config/src/schema/sync-protocols/avail/rpc.d.ts.map +1 -0
- package/esm/config/src/schema/sync-protocols/avail/rpc.js +56 -0
- package/esm/config/src/schema/sync-protocols/bitcoin/rpc.d.ts +76 -0
- package/esm/config/src/schema/sync-protocols/bitcoin/rpc.d.ts.map +1 -0
- package/esm/config/src/schema/sync-protocols/bitcoin/rpc.js +47 -0
- package/esm/config/src/schema/sync-protocols/cardano/carp.d.ts +80 -0
- package/esm/config/src/schema/sync-protocols/cardano/carp.d.ts.map +1 -0
- package/esm/config/src/schema/sync-protocols/cardano/carp.js +62 -0
- package/esm/config/src/schema/sync-protocols/cardano/mod.d.ts +2 -0
- package/esm/config/src/schema/sync-protocols/cardano/mod.d.ts.map +1 -0
- package/esm/config/src/schema/sync-protocols/cardano/mod.js +1 -0
- package/esm/config/src/schema/sync-protocols/cardano/utxorpc.d.ts +56 -0
- package/esm/config/src/schema/sync-protocols/cardano/utxorpc.d.ts.map +1 -0
- package/esm/config/src/schema/sync-protocols/cardano/utxorpc.js +56 -0
- package/esm/config/src/schema/sync-protocols/common.d.ts +60 -0
- package/esm/config/src/schema/sync-protocols/common.d.ts.map +1 -0
- package/esm/config/src/schema/sync-protocols/common.js +54 -0
- package/esm/config/src/schema/sync-protocols/decorators/all.d.ts +17 -0
- package/esm/config/src/schema/sync-protocols/decorators/all.d.ts.map +1 -0
- package/esm/config/src/schema/sync-protocols/decorators/all.js +8 -0
- package/esm/config/src/schema/sync-protocols/decorators/emulated.d.ts +8 -0
- package/esm/config/src/schema/sync-protocols/decorators/emulated.d.ts.map +1 -0
- package/esm/config/src/schema/sync-protocols/decorators/emulated.js +12 -0
- package/esm/config/src/schema/sync-protocols/decorators/mod.d.ts +4 -0
- package/esm/config/src/schema/sync-protocols/decorators/mod.d.ts.map +1 -0
- package/esm/config/src/schema/sync-protocols/decorators/mod.js +3 -0
- package/esm/config/src/schema/sync-protocols/decorators/types.d.ts +4 -0
- package/esm/config/src/schema/sync-protocols/decorators/types.d.ts.map +1 -0
- package/esm/config/src/schema/sync-protocols/decorators/types.js +4 -0
- package/esm/config/src/schema/sync-protocols/evm/rpc.d.ts +68 -0
- package/esm/config/src/schema/sync-protocols/evm/rpc.d.ts.map +1 -0
- package/esm/config/src/schema/sync-protocols/evm/rpc.js +44 -0
- package/esm/config/src/schema/sync-protocols/midnight/graphql.d.ts +66 -0
- package/esm/config/src/schema/sync-protocols/midnight/graphql.d.ts.map +1 -0
- package/esm/config/src/schema/sync-protocols/midnight/graphql.js +50 -0
- package/esm/config/src/schema/sync-protocols/mina/graphql.d.ts +73 -0
- package/esm/config/src/schema/sync-protocols/mina/graphql.d.ts.map +1 -0
- package/esm/config/src/schema/sync-protocols/mina/graphql.js +59 -0
- package/esm/config/src/schema/sync-protocols/mod.d.ts +10 -0
- package/esm/config/src/schema/sync-protocols/mod.d.ts.map +1 -0
- package/esm/config/src/schema/sync-protocols/mod.js +9 -0
- package/esm/config/src/schema/sync-protocols/ntp/rpc.d.ts +45 -0
- package/esm/config/src/schema/sync-protocols/ntp/rpc.d.ts.map +1 -0
- package/esm/config/src/schema/sync-protocols/ntp/rpc.js +33 -0
- package/esm/config/src/schema/sync-protocols/types.d.ts +125 -0
- package/esm/config/src/schema/sync-protocols/types.d.ts.map +1 -0
- package/esm/config/src/schema/sync-protocols/types.js +22 -0
- package/esm/config/src/schema/utils.d.ts +53 -0
- package/esm/config/src/schema/utils.d.ts.map +1 -0
- package/esm/config/src/schema/utils.js +58 -0
- package/esm/events/src/app-events.d.ts +65 -0
- package/esm/events/src/app-events.d.ts.map +1 -0
- package/esm/events/src/app-events.js +51 -0
- package/esm/events/src/asyncapi.d.ts +1173 -0
- package/esm/events/src/asyncapi.d.ts.map +1 -0
- package/esm/events/src/asyncapi.js +7 -0
- package/esm/events/src/builtin-event-utils.d.ts +5 -0
- package/esm/events/src/builtin-event-utils.d.ts.map +1 -0
- package/esm/events/src/builtin-event-utils.js +58 -0
- package/esm/events/src/builtin-events.d.ts +106 -0
- package/esm/events/src/builtin-events.d.ts.map +1 -0
- package/esm/events/src/builtin-events.js +198 -0
- package/esm/events/src/event-connect.d.ts +15 -0
- package/esm/events/src/event-connect.d.ts.map +1 -0
- package/esm/events/src/event-connect.js +75 -0
- package/esm/events/src/event-manager.d.ts +54 -0
- package/esm/events/src/event-manager.d.ts.map +1 -0
- package/esm/events/src/event-manager.js +129 -0
- package/esm/events/src/evm.d.ts +6 -0
- package/esm/events/src/evm.d.ts.map +1 -0
- package/esm/events/src/evm.js +55 -0
- package/esm/events/src/mod.d.ts +10 -0
- package/esm/events/src/mod.d.ts.map +1 -0
- package/esm/events/src/mod.js +9 -0
- package/esm/events/src/types.d.ts +255 -0
- package/esm/events/src/types.d.ts.map +1 -0
- package/esm/events/src/types.js +103 -0
- package/esm/events/src/utils.d.ts +16 -0
- package/esm/events/src/utils.d.ts.map +1 -0
- package/esm/events/src/utils.js +93 -0
- package/esm/package.json +3 -0
- package/esm/utils/src/binary-search.d.ts +7 -0
- package/esm/utils/src/binary-search.d.ts.map +1 -0
- package/esm/utils/src/binary-search.js +38 -0
- package/esm/utils/src/captcha.d.ts +9 -0
- package/esm/utils/src/captcha.d.ts.map +1 -0
- package/esm/utils/src/captcha.js +19 -0
- package/esm/utils/src/concurrency/condVar.d.ts +25 -0
- package/esm/utils/src/concurrency/condVar.d.ts.map +1 -0
- package/esm/utils/src/concurrency/condVar.js +39 -0
- package/esm/utils/src/concurrency/latch.d.ts +25 -0
- package/esm/utils/src/concurrency/latch.d.ts.map +1 -0
- package/esm/utils/src/concurrency/latch.js +51 -0
- package/esm/utils/src/concurrency/mod.d.ts +5 -0
- package/esm/utils/src/concurrency/mod.d.ts.map +1 -0
- package/esm/utils/src/concurrency/mod.js +4 -0
- package/esm/utils/src/concurrency/retry.d.ts +14 -0
- package/esm/utils/src/concurrency/retry.d.ts.map +1 -0
- package/esm/utils/src/concurrency/retry.js +26 -0
- package/esm/utils/src/concurrency/utils.d.ts +27 -0
- package/esm/utils/src/concurrency/utils.d.ts.map +1 -0
- package/esm/utils/src/concurrency/utils.js +27 -0
- package/esm/utils/src/constants.d.ts +4 -0
- package/esm/utils/src/constants.d.ts.map +1 -0
- package/esm/utils/src/constants.js +7 -0
- package/esm/utils/src/decorators/bound.d.ts +10 -0
- package/esm/utils/src/decorators/bound.d.ts.map +1 -0
- package/esm/utils/src/decorators/bound.js +17 -0
- package/esm/utils/src/decorators/mod.d.ts +2 -0
- package/esm/utils/src/decorators/mod.d.ts.map +1 -0
- package/esm/utils/src/decorators/mod.js +1 -0
- package/esm/utils/src/mod.d.ts +8 -0
- package/esm/utils/src/mod.d.ts.map +1 -0
- package/esm/utils/src/mod.js +7 -0
- package/esm/utils/src/types/json-query.d.ts +30 -0
- package/esm/utils/src/types/json-query.d.ts.map +1 -0
- package/esm/utils/src/types/json-query.js +1 -0
- package/esm/utils/src/types/misc.d.ts +109 -0
- package/esm/utils/src/types/misc.d.ts.map +1 -0
- package/esm/utils/src/types/misc.js +2 -0
- package/esm/utils/src/types/mod.d.ts +7 -0
- package/esm/utils/src/types/mod.d.ts.map +1 -0
- package/esm/utils/src/types/mod.js +3 -0
- package/esm/utils/src/types/nominal.d.ts +87 -0
- package/esm/utils/src/types/nominal.d.ts.map +1 -0
- package/esm/utils/src/types/nominal.js +1 -0
- package/esm/utils/src/types/typebox-helpers.d.ts +183 -0
- package/esm/utils/src/types/typebox-helpers.d.ts.map +1 -0
- package/esm/utils/src/types/typebox-helpers.js +235 -0
- package/esm/utils/src/types/utils.d.ts +37 -0
- package/esm/utils/src/types/utils.d.ts.map +1 -0
- package/esm/utils/src/types/utils.js +46 -0
- package/esm/utils/src/types/validators/algorand.d.ts +31 -0
- package/esm/utils/src/types/validators/algorand.d.ts.map +1 -0
- package/esm/utils/src/types/validators/algorand.js +90 -0
- package/esm/utils/src/types/validators/cardano.d.ts +26 -0
- package/esm/utils/src/types/validators/cardano.d.ts.map +1 -0
- package/esm/utils/src/types/validators/cardano.js +113 -0
- package/esm/utils/src/types/validators/mina.d.ts +15 -0
- package/esm/utils/src/types/validators/mina.d.ts.map +1 -0
- package/esm/utils/src/types/validators/mina.js +43 -0
- package/esm/utils/src/types/validators/minicbor.d.ts +98 -0
- package/esm/utils/src/types/validators/minicbor.d.ts.map +1 -0
- package/esm/utils/src/types/validators/minicbor.js +332 -0
- package/esm/utils/src/types/validators/mod.d.ts +3 -0
- package/esm/utils/src/types/validators/mod.d.ts.map +1 -0
- package/esm/utils/src/types/validators/mod.js +2 -0
- package/esm/utils/src/types/validators/utils.d.ts +6 -0
- package/esm/utils/src/types/validators/utils.d.ts.map +1 -0
- package/esm/utils/src/types/validators/utils.js +24 -0
- package/esm/utils/src/viem.d.ts +6 -0
- package/esm/utils/src/viem.d.ts.map +1 -0
- package/esm/utils/src/viem.js +15 -0
- package/esm/wallets/src/IProvider.d.ts +48 -0
- package/esm/wallets/src/IProvider.d.ts.map +1 -0
- package/esm/wallets/src/IProvider.js +7 -0
- package/esm/wallets/src/avail/avail.d.ts +28 -0
- package/esm/wallets/src/avail/avail.d.ts.map +1 -0
- package/esm/wallets/src/avail/avail.js +65 -0
- package/esm/wallets/src/avail/wrapper.d.ts +6 -0
- package/esm/wallets/src/avail/wrapper.d.ts.map +1 -0
- package/esm/wallets/src/avail/wrapper.js +31 -0
- package/esm/wallets/src/cardano/cardano.d.ts +30 -0
- package/esm/wallets/src/cardano/cardano.d.ts.map +1 -0
- package/esm/wallets/src/cardano/cardano.js +158 -0
- package/esm/wallets/src/cardano/wrapper.d.ts +7 -0
- package/esm/wallets/src/cardano/wrapper.d.ts.map +1 -0
- package/esm/wallets/src/cardano/wrapper.js +22 -0
- package/esm/wallets/src/evm/ethers.d.ts +28 -0
- package/esm/wallets/src/evm/ethers.d.ts.map +1 -0
- package/esm/wallets/src/evm/ethers.js +79 -0
- package/esm/wallets/src/evm/injected.d.ts +74 -0
- package/esm/wallets/src/evm/injected.d.ts.map +1 -0
- package/esm/wallets/src/evm/injected.js +322 -0
- package/esm/wallets/src/evm/types.d.ts +3 -0
- package/esm/wallets/src/evm/types.d.ts.map +1 -0
- package/esm/wallets/src/evm/types.js +1 -0
- package/esm/wallets/src/evm/wrapper-ethers.d.ts +6 -0
- package/esm/wallets/src/evm/wrapper-ethers.d.ts.map +1 -0
- package/esm/wallets/src/evm/wrapper-ethers.js +38 -0
- package/esm/wallets/src/evm/wrapper-injected.d.ts +7 -0
- package/esm/wallets/src/evm/wrapper-injected.d.ts.map +1 -0
- package/esm/wallets/src/evm/wrapper-injected.js +80 -0
- package/esm/wallets/src/midnight/midnight.d.ts +26 -0
- package/esm/wallets/src/midnight/midnight.d.ts.map +1 -0
- package/esm/wallets/src/midnight/midnight.js +112 -0
- package/esm/wallets/src/midnight/wrapper.d.ts +7 -0
- package/esm/wallets/src/midnight/wrapper.d.ts.map +1 -0
- package/esm/wallets/src/midnight/wrapper.js +22 -0
- package/esm/wallets/src/mina/mina.d.ts +28 -0
- package/esm/wallets/src/mina/mina.d.ts.map +1 -0
- package/esm/wallets/src/mina/mina.js +133 -0
- package/esm/wallets/src/mina/wrapper.d.ts +6 -0
- package/esm/wallets/src/mina/wrapper.d.ts.map +1 -0
- package/esm/wallets/src/mina/wrapper.js +12 -0
- package/esm/wallets/src/mod.d.ts +8 -0
- package/esm/wallets/src/mod.d.ts.map +1 -0
- package/esm/wallets/src/mod.js +5 -0
- package/esm/wallets/src/paima.d.ts +104 -0
- package/esm/wallets/src/paima.d.ts.map +1 -0
- package/esm/wallets/src/paima.js +244 -0
- package/esm/wallets/src/types.d.ts +49 -0
- package/esm/wallets/src/types.d.ts.map +1 -0
- package/esm/wallets/src/types.js +1 -0
- package/esm/wallets/src/utils.d.ts +41 -0
- package/esm/wallets/src/utils.d.ts.map +1 -0
- package/esm/wallets/src/utils.js +75 -0
- package/esm/wallets/src/wallet-modes.d.ts +49 -0
- package/esm/wallets/src/wallet-modes.d.ts.map +1 -0
- package/esm/wallets/src/wallet-modes.js +26 -0
- package/esm/wallets/src/wallets.d.ts +5 -0
- package/esm/wallets/src/wallets.d.ts.map +1 -0
- package/esm/wallets/src/wallets.js +55 -0
- package/esm/wallets/src/windows.d.ts +5 -0
- package/esm/wallets/src/windows.d.ts.map +1 -0
- package/esm/wallets/src/windows.js +9 -0
- package/package.json +51 -0
- package/script/chain-types/src/hash.d.ts +28 -0
- package/script/chain-types/src/hash.d.ts.map +1 -0
- package/script/chain-types/src/hash.js +36 -0
- package/script/chain-types/src/mod.d.ts +3 -0
- package/script/chain-types/src/mod.d.ts.map +1 -0
- package/script/chain-types/src/mod.js +18 -0
- package/script/chain-types/src/types.d.ts +70 -0
- package/script/chain-types/src/types.d.ts.map +1 -0
- package/script/chain-types/src/types.js +2 -0
- package/script/concise/src/batcher.d.ts +40 -0
- package/script/concise/src/batcher.d.ts.map +1 -0
- package/script/concise/src/batcher.js +122 -0
- package/script/concise/src/delegate.d.ts +18 -0
- package/script/concise/src/delegate.d.ts.map +1 -0
- package/script/concise/src/delegate.js +123 -0
- package/script/concise/src/mod.d.ts +5 -0
- package/script/concise/src/mod.d.ts.map +1 -0
- package/script/concise/src/mod.js +19 -0
- package/script/concise/src/v2/builtins/batcher.d.ts +27 -0
- package/script/concise/src/v2/builtins/batcher.d.ts.map +1 -0
- package/script/concise/src/v2/builtins/batcher.js +54 -0
- package/script/concise/src/v2/builtins/grammar.d.ts +25 -0
- package/script/concise/src/v2/builtins/grammar.d.ts.map +1 -0
- package/script/concise/src/v2/builtins/grammar.js +43 -0
- package/script/concise/src/v2/builtins/index.d.ts +3 -0
- package/script/concise/src/v2/builtins/index.d.ts.map +1 -0
- package/script/concise/src/v2/builtins/index.js +19 -0
- package/script/concise/src/v2/grammar.d.ts +8 -0
- package/script/concise/src/v2/grammar.d.ts.map +1 -0
- package/script/concise/src/v2/grammar.js +24 -0
- package/script/concise/src/v2/inputs.d.ts +7 -0
- package/script/concise/src/v2/inputs.d.ts.map +1 -0
- package/script/concise/src/v2/inputs.js +43 -0
- package/script/concise/src/v2/mod.d.ts +5 -0
- package/script/concise/src/v2/mod.d.ts.map +1 -0
- package/script/concise/src/v2/mod.js +20 -0
- package/script/concise/src/v2/types.d.ts +23 -0
- package/script/concise/src/v2/types.d.ts.map +1 -0
- package/script/concise/src/v2/types.js +2 -0
- package/script/config/src/config/builder.d.ts +33 -0
- package/script/config/src/config/builder.d.ts.map +1 -0
- package/script/config/src/config/builder.js +86 -0
- package/script/config/src/config/configCheck.d.ts +32 -0
- package/script/config/src/config/configCheck.d.ts.map +1 -0
- package/script/config/src/config/configCheck.js +70 -0
- package/script/config/src/config/context.d.ts +23 -0
- package/script/config/src/config/context.d.ts.map +1 -0
- package/script/config/src/config/context.js +31 -0
- package/script/config/src/config/mod.d.ts +7 -0
- package/script/config/src/config/mod.d.ts.map +1 -0
- package/script/config/src/config/mod.js +22 -0
- package/script/config/src/config/parts/deployedAddresses.d.ts +17 -0
- package/script/config/src/config/parts/deployedAddresses.d.ts.map +1 -0
- package/script/config/src/config/parts/deployedAddresses.js +28 -0
- package/script/config/src/config/parts/network.d.ts +19 -0
- package/script/config/src/config/parts/network.d.ts.map +1 -0
- package/script/config/src/config/parts/network.js +33 -0
- package/script/config/src/config/parts/primitive.d.ts +31 -0
- package/script/config/src/config/parts/primitive.d.ts.map +1 -0
- package/script/config/src/config/parts/primitive.js +32 -0
- package/script/config/src/config/parts/securityNamespace.d.ts +14 -0
- package/script/config/src/config/parts/securityNamespace.d.ts.map +1 -0
- package/script/config/src/config/parts/securityNamespace.js +30 -0
- package/script/config/src/config/parts/syncProtocols.d.ts +43 -0
- package/script/config/src/config/parts/syncProtocols.d.ts.map +1 -0
- package/script/config/src/config/parts/syncProtocols.js +70 -0
- package/script/config/src/config/utils.d.ts +40 -0
- package/script/config/src/config/utils.d.ts.map +1 -0
- package/script/config/src/config/utils.js +62 -0
- package/script/config/src/mod.d.ts +3 -0
- package/script/config/src/mod.d.ts.map +1 -0
- package/script/config/src/mod.js +18 -0
- package/script/config/src/schema/common.d.ts +26 -0
- package/script/config/src/schema/common.d.ts.map +1 -0
- package/script/config/src/schema/common.js +54 -0
- package/script/config/src/schema/mod.d.ts +7 -0
- package/script/config/src/schema/mod.d.ts.map +1 -0
- package/script/config/src/schema/mod.js +22 -0
- package/script/config/src/schema/namespace.d.ts +39 -0
- package/script/config/src/schema/namespace.d.ts.map +1 -0
- package/script/config/src/schema/namespace.js +38 -0
- package/script/config/src/schema/network/algorand.d.ts +12 -0
- package/script/config/src/schema/network/algorand.d.ts.map +1 -0
- package/script/config/src/schema/network/algorand.js +26 -0
- package/script/config/src/schema/network/all.d.ts +175 -0
- package/script/config/src/schema/network/all.d.ts.map +1 -0
- package/script/config/src/schema/network/all.js +28 -0
- package/script/config/src/schema/network/bitcoin.d.ts +19 -0
- package/script/config/src/schema/network/bitcoin.d.ts.map +1 -0
- package/script/config/src/schema/network/bitcoin.js +24 -0
- package/script/config/src/schema/network/cardano.d.ts +12 -0
- package/script/config/src/schema/network/cardano.d.ts.map +1 -0
- package/script/config/src/schema/network/cardano.js +30 -0
- package/script/config/src/schema/network/evm.d.ts +68 -0
- package/script/config/src/schema/network/evm.d.ts.map +1 -0
- package/script/config/src/schema/network/evm.js +75 -0
- package/script/config/src/schema/network/mina.d.ts +14 -0
- package/script/config/src/schema/network/mina.d.ts.map +1 -0
- package/script/config/src/schema/network/mina.js +28 -0
- package/script/config/src/schema/network/mod.d.ts +9 -0
- package/script/config/src/schema/network/mod.d.ts.map +1 -0
- package/script/config/src/schema/network/mod.js +24 -0
- package/script/config/src/schema/network/ntp.d.ts +32 -0
- package/script/config/src/schema/network/ntp.d.ts.map +1 -0
- package/script/config/src/schema/network/ntp.js +42 -0
- package/script/config/src/schema/network/substrate/avail.d.ts +14 -0
- package/script/config/src/schema/network/substrate/avail.d.ts.map +1 -0
- package/script/config/src/schema/network/substrate/avail.js +29 -0
- package/script/config/src/schema/network/substrate/common.d.ts +18 -0
- package/script/config/src/schema/network/substrate/common.d.ts.map +1 -0
- package/script/config/src/schema/network/substrate/common.js +35 -0
- package/script/config/src/schema/network/substrate/midnight.d.ts +20 -0
- package/script/config/src/schema/network/substrate/midnight.d.ts.map +1 -0
- package/script/config/src/schema/network/substrate/midnight.js +35 -0
- package/script/config/src/schema/network/substrate/mod.d.ts +4 -0
- package/script/config/src/schema/network/substrate/mod.d.ts.map +1 -0
- package/script/config/src/schema/network/substrate/mod.js +19 -0
- package/script/config/src/schema/network/types.d.ts +13 -0
- package/script/config/src/schema/network/types.d.ts.map +1 -0
- package/script/config/src/schema/network/types.js +16 -0
- package/script/config/src/schema/network/utils.d.ts +5 -0
- package/script/config/src/schema/network/utils.d.ts.map +1 -0
- package/script/config/src/schema/network/utils.js +76 -0
- package/script/config/src/schema/primitive/mod.d.ts +2 -0
- package/script/config/src/schema/primitive/mod.d.ts.map +1 -0
- package/script/config/src/schema/primitive/mod.js +17 -0
- package/script/config/src/schema/primitive/types.d.ts +58 -0
- package/script/config/src/schema/primitive/types.d.ts.map +1 -0
- package/script/config/src/schema/primitive/types.js +2 -0
- package/script/config/src/schema/sync-protocols/all.d.ts +583 -0
- package/script/config/src/schema/sync-protocols/all.d.ts.map +1 -0
- package/script/config/src/schema/sync-protocols/all.js +62 -0
- package/script/config/src/schema/sync-protocols/avail/rpc.d.ts +76 -0
- package/script/config/src/schema/sync-protocols/avail/rpc.d.ts.map +1 -0
- package/script/config/src/schema/sync-protocols/avail/rpc.js +59 -0
- package/script/config/src/schema/sync-protocols/bitcoin/rpc.d.ts +76 -0
- package/script/config/src/schema/sync-protocols/bitcoin/rpc.d.ts.map +1 -0
- package/script/config/src/schema/sync-protocols/bitcoin/rpc.js +50 -0
- package/script/config/src/schema/sync-protocols/cardano/carp.d.ts +80 -0
- package/script/config/src/schema/sync-protocols/cardano/carp.d.ts.map +1 -0
- package/script/config/src/schema/sync-protocols/cardano/carp.js +65 -0
- package/script/config/src/schema/sync-protocols/cardano/mod.d.ts +2 -0
- package/script/config/src/schema/sync-protocols/cardano/mod.d.ts.map +1 -0
- package/script/config/src/schema/sync-protocols/cardano/mod.js +17 -0
- package/script/config/src/schema/sync-protocols/cardano/utxorpc.d.ts +56 -0
- package/script/config/src/schema/sync-protocols/cardano/utxorpc.d.ts.map +1 -0
- package/script/config/src/schema/sync-protocols/cardano/utxorpc.js +59 -0
- package/script/config/src/schema/sync-protocols/common.d.ts +60 -0
- package/script/config/src/schema/sync-protocols/common.d.ts.map +1 -0
- package/script/config/src/schema/sync-protocols/common.js +61 -0
- package/script/config/src/schema/sync-protocols/decorators/all.d.ts +17 -0
- package/script/config/src/schema/sync-protocols/decorators/all.d.ts.map +1 -0
- package/script/config/src/schema/sync-protocols/decorators/all.js +12 -0
- package/script/config/src/schema/sync-protocols/decorators/emulated.d.ts +8 -0
- package/script/config/src/schema/sync-protocols/decorators/emulated.d.ts.map +1 -0
- package/script/config/src/schema/sync-protocols/decorators/emulated.js +15 -0
- package/script/config/src/schema/sync-protocols/decorators/mod.d.ts +4 -0
- package/script/config/src/schema/sync-protocols/decorators/mod.d.ts.map +1 -0
- package/script/config/src/schema/sync-protocols/decorators/mod.js +19 -0
- package/script/config/src/schema/sync-protocols/decorators/types.d.ts +4 -0
- package/script/config/src/schema/sync-protocols/decorators/types.d.ts.map +1 -0
- package/script/config/src/schema/sync-protocols/decorators/types.js +7 -0
- package/script/config/src/schema/sync-protocols/evm/rpc.d.ts +68 -0
- package/script/config/src/schema/sync-protocols/evm/rpc.d.ts.map +1 -0
- package/script/config/src/schema/sync-protocols/evm/rpc.js +47 -0
- package/script/config/src/schema/sync-protocols/midnight/graphql.d.ts +66 -0
- package/script/config/src/schema/sync-protocols/midnight/graphql.d.ts.map +1 -0
- package/script/config/src/schema/sync-protocols/midnight/graphql.js +53 -0
- package/script/config/src/schema/sync-protocols/mina/graphql.d.ts +73 -0
- package/script/config/src/schema/sync-protocols/mina/graphql.d.ts.map +1 -0
- package/script/config/src/schema/sync-protocols/mina/graphql.js +62 -0
- package/script/config/src/schema/sync-protocols/mod.d.ts +10 -0
- package/script/config/src/schema/sync-protocols/mod.d.ts.map +1 -0
- package/script/config/src/schema/sync-protocols/mod.js +25 -0
- package/script/config/src/schema/sync-protocols/ntp/rpc.d.ts +45 -0
- package/script/config/src/schema/sync-protocols/ntp/rpc.d.ts.map +1 -0
- package/script/config/src/schema/sync-protocols/ntp/rpc.js +36 -0
- package/script/config/src/schema/sync-protocols/types.d.ts +125 -0
- package/script/config/src/schema/sync-protocols/types.d.ts.map +1 -0
- package/script/config/src/schema/sync-protocols/types.js +25 -0
- package/script/config/src/schema/utils.d.ts +53 -0
- package/script/config/src/schema/utils.d.ts.map +1 -0
- package/script/config/src/schema/utils.js +62 -0
- package/script/events/src/app-events.d.ts +65 -0
- package/script/events/src/app-events.d.ts.map +1 -0
- package/script/events/src/app-events.js +62 -0
- package/script/events/src/asyncapi.d.ts +1173 -0
- package/script/events/src/asyncapi.d.ts.map +1 -0
- package/script/events/src/asyncapi.js +8 -0
- package/script/events/src/builtin-event-utils.d.ts +5 -0
- package/script/events/src/builtin-event-utils.d.ts.map +1 -0
- package/script/events/src/builtin-event-utils.js +63 -0
- package/script/events/src/builtin-events.d.ts +106 -0
- package/script/events/src/builtin-events.d.ts.map +1 -0
- package/script/events/src/builtin-events.js +204 -0
- package/script/events/src/event-connect.d.ts +15 -0
- package/script/events/src/event-connect.d.ts.map +1 -0
- package/script/events/src/event-connect.js +82 -0
- package/script/events/src/event-manager.d.ts +54 -0
- package/script/events/src/event-manager.d.ts.map +1 -0
- package/script/events/src/event-manager.js +133 -0
- package/script/events/src/evm.d.ts +6 -0
- package/script/events/src/evm.d.ts.map +1 -0
- package/script/events/src/evm.js +59 -0
- package/script/events/src/mod.d.ts +10 -0
- package/script/events/src/mod.d.ts.map +1 -0
- package/script/events/src/mod.js +25 -0
- package/script/events/src/types.d.ts +255 -0
- package/script/events/src/types.d.ts.map +1 -0
- package/script/events/src/types.js +111 -0
- package/script/events/src/utils.d.ts +16 -0
- package/script/events/src/utils.d.ts.map +1 -0
- package/script/events/src/utils.js +98 -0
- package/script/package.json +3 -0
- package/script/utils/src/binary-search.d.ts +7 -0
- package/script/utils/src/binary-search.d.ts.map +1 -0
- package/script/utils/src/binary-search.js +41 -0
- package/script/utils/src/captcha.d.ts +9 -0
- package/script/utils/src/captcha.d.ts.map +1 -0
- package/script/utils/src/captcha.js +22 -0
- package/script/utils/src/concurrency/condVar.d.ts +25 -0
- package/script/utils/src/concurrency/condVar.d.ts.map +1 -0
- package/script/utils/src/concurrency/condVar.js +42 -0
- package/script/utils/src/concurrency/latch.d.ts +25 -0
- package/script/utils/src/concurrency/latch.d.ts.map +1 -0
- package/script/utils/src/concurrency/latch.js +54 -0
- package/script/utils/src/concurrency/mod.d.ts +5 -0
- package/script/utils/src/concurrency/mod.d.ts.map +1 -0
- package/script/utils/src/concurrency/mod.js +20 -0
- package/script/utils/src/concurrency/retry.d.ts +14 -0
- package/script/utils/src/concurrency/retry.d.ts.map +1 -0
- package/script/utils/src/concurrency/retry.js +30 -0
- package/script/utils/src/concurrency/utils.d.ts +27 -0
- package/script/utils/src/concurrency/utils.d.ts.map +1 -0
- package/script/utils/src/concurrency/utils.js +30 -0
- package/script/utils/src/constants.d.ts +4 -0
- package/script/utils/src/constants.d.ts.map +1 -0
- package/script/utils/src/constants.js +12 -0
- package/script/utils/src/decorators/bound.d.ts +10 -0
- package/script/utils/src/decorators/bound.d.ts.map +1 -0
- package/script/utils/src/decorators/bound.js +20 -0
- package/script/utils/src/decorators/mod.d.ts +2 -0
- package/script/utils/src/decorators/mod.d.ts.map +1 -0
- package/script/utils/src/decorators/mod.js +17 -0
- package/script/utils/src/mod.d.ts +8 -0
- package/script/utils/src/mod.d.ts.map +1 -0
- package/script/utils/src/mod.js +23 -0
- package/script/utils/src/types/json-query.d.ts +30 -0
- package/script/utils/src/types/json-query.d.ts.map +1 -0
- package/script/utils/src/types/json-query.js +2 -0
- package/script/utils/src/types/misc.d.ts +109 -0
- package/script/utils/src/types/misc.d.ts.map +1 -0
- package/script/utils/src/types/misc.js +3 -0
- package/script/utils/src/types/mod.d.ts +7 -0
- package/script/utils/src/types/mod.d.ts.map +1 -0
- package/script/utils/src/types/mod.js +19 -0
- package/script/utils/src/types/nominal.d.ts +87 -0
- package/script/utils/src/types/nominal.d.ts.map +1 -0
- package/script/utils/src/types/nominal.js +2 -0
- package/script/utils/src/types/typebox-helpers.d.ts +183 -0
- package/script/utils/src/types/typebox-helpers.d.ts.map +1 -0
- package/script/utils/src/types/typebox-helpers.js +277 -0
- package/script/utils/src/types/utils.d.ts +37 -0
- package/script/utils/src/types/utils.d.ts.map +1 -0
- package/script/utils/src/types/utils.js +52 -0
- package/script/utils/src/types/validators/algorand.d.ts +31 -0
- package/script/utils/src/types/validators/algorand.d.ts.map +1 -0
- package/script/utils/src/types/validators/algorand.js +98 -0
- package/script/utils/src/types/validators/cardano.d.ts +26 -0
- package/script/utils/src/types/validators/cardano.d.ts.map +1 -0
- package/script/utils/src/types/validators/cardano.js +121 -0
- package/script/utils/src/types/validators/mina.d.ts +15 -0
- package/script/utils/src/types/validators/mina.d.ts.map +1 -0
- package/script/utils/src/types/validators/mina.js +51 -0
- package/script/utils/src/types/validators/minicbor.d.ts +98 -0
- package/script/utils/src/types/validators/minicbor.d.ts.map +1 -0
- package/script/utils/src/types/validators/minicbor.js +337 -0
- package/script/utils/src/types/validators/mod.d.ts +3 -0
- package/script/utils/src/types/validators/mod.d.ts.map +1 -0
- package/script/utils/src/types/validators/mod.js +18 -0
- package/script/utils/src/types/validators/utils.d.ts +6 -0
- package/script/utils/src/types/validators/utils.d.ts.map +1 -0
- package/script/utils/src/types/validators/utils.js +31 -0
- package/script/utils/src/viem.d.ts +6 -0
- package/script/utils/src/viem.d.ts.map +1 -0
- package/script/utils/src/viem.js +19 -0
- package/script/wallets/src/IProvider.d.ts +48 -0
- package/script/wallets/src/IProvider.d.ts.map +1 -0
- package/script/wallets/src/IProvider.js +10 -0
- package/script/wallets/src/avail/avail.d.ts +28 -0
- package/script/wallets/src/avail/avail.d.ts.map +1 -0
- package/script/wallets/src/avail/avail.js +70 -0
- package/script/wallets/src/avail/wrapper.d.ts +6 -0
- package/script/wallets/src/avail/wrapper.d.ts.map +1 -0
- package/script/wallets/src/avail/wrapper.js +34 -0
- package/script/wallets/src/cardano/cardano.d.ts +30 -0
- package/script/wallets/src/cardano/cardano.d.ts.map +1 -0
- package/script/wallets/src/cardano/cardano.js +163 -0
- package/script/wallets/src/cardano/wrapper.d.ts +7 -0
- package/script/wallets/src/cardano/wrapper.d.ts.map +1 -0
- package/script/wallets/src/cardano/wrapper.js +26 -0
- package/script/wallets/src/evm/ethers.d.ts +28 -0
- package/script/wallets/src/evm/ethers.d.ts.map +1 -0
- package/script/wallets/src/evm/ethers.js +84 -0
- package/script/wallets/src/evm/injected.d.ts +74 -0
- package/script/wallets/src/evm/injected.d.ts.map +1 -0
- package/script/wallets/src/evm/injected.js +360 -0
- package/script/wallets/src/evm/types.d.ts +3 -0
- package/script/wallets/src/evm/types.d.ts.map +1 -0
- package/script/wallets/src/evm/types.js +4 -0
- package/script/wallets/src/evm/wrapper-ethers.d.ts +6 -0
- package/script/wallets/src/evm/wrapper-ethers.d.ts.map +1 -0
- package/script/wallets/src/evm/wrapper-ethers.js +41 -0
- package/script/wallets/src/evm/wrapper-injected.d.ts +7 -0
- package/script/wallets/src/evm/wrapper-injected.d.ts.map +1 -0
- package/script/wallets/src/evm/wrapper-injected.js +84 -0
- package/script/wallets/src/midnight/midnight.d.ts +26 -0
- package/script/wallets/src/midnight/midnight.d.ts.map +1 -0
- package/script/wallets/src/midnight/midnight.js +117 -0
- package/script/wallets/src/midnight/wrapper.d.ts +7 -0
- package/script/wallets/src/midnight/wrapper.d.ts.map +1 -0
- package/script/wallets/src/midnight/wrapper.js +26 -0
- package/script/wallets/src/mina/mina.d.ts +28 -0
- package/script/wallets/src/mina/mina.d.ts.map +1 -0
- package/script/wallets/src/mina/mina.js +138 -0
- package/script/wallets/src/mina/wrapper.d.ts +6 -0
- package/script/wallets/src/mina/wrapper.d.ts.map +1 -0
- package/script/wallets/src/mina/wrapper.js +15 -0
- package/script/wallets/src/mod.d.ts +8 -0
- package/script/wallets/src/mod.d.ts.map +1 -0
- package/script/wallets/src/mod.js +26 -0
- package/script/wallets/src/paima.d.ts +104 -0
- package/script/wallets/src/paima.d.ts.map +1 -0
- package/script/wallets/src/paima.js +253 -0
- package/script/wallets/src/types.d.ts +49 -0
- package/script/wallets/src/types.d.ts.map +1 -0
- package/script/wallets/src/types.js +2 -0
- package/script/wallets/src/utils.d.ts +41 -0
- package/script/wallets/src/utils.d.ts.map +1 -0
- package/script/wallets/src/utils.js +81 -0
- package/script/wallets/src/wallet-modes.d.ts +49 -0
- package/script/wallets/src/wallet-modes.d.ts.map +1 -0
- package/script/wallets/src/wallet-modes.js +29 -0
- package/script/wallets/src/wallets.d.ts +5 -0
- package/script/wallets/src/wallets.d.ts.map +1 -0
- package/script/wallets/src/wallets.js +58 -0
- package/script/wallets/src/windows.d.ts +5 -0
- package/script/wallets/src/windows.d.ts.map +1 -0
- package/script/wallets/src/windows.js +12 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.AddressTypebox = exports.AddressValidator = exports.TypeboxHelpers = exports.AddressType = void 0;
|
|
40
|
+
exports.checkOrError = checkOrError;
|
|
41
|
+
exports.pick = pick;
|
|
42
|
+
exports.pickAll = pickAll;
|
|
43
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
44
|
+
const value_1 = require("@sinclair/typebox/value");
|
|
45
|
+
const ss58 = __importStar(require("@subsquid/ss58-codec"));
|
|
46
|
+
const bs58check_1 = __importDefault(require("bs58check"));
|
|
47
|
+
const bech32_1 = require("bech32");
|
|
48
|
+
const algorand_js_1 = require("./validators/algorand.js");
|
|
49
|
+
const mina_js_1 = require("./validators/mina.js");
|
|
50
|
+
const cardano_js_1 = require("./validators/cardano.js");
|
|
51
|
+
// IMPORTANT
|
|
52
|
+
// These types are used in the on-chain messages.
|
|
53
|
+
// Do not change or reuse the numeric values.
|
|
54
|
+
var AddressType;
|
|
55
|
+
(function (AddressType) {
|
|
56
|
+
AddressType[AddressType["NONE"] = -1] = "NONE";
|
|
57
|
+
AddressType[AddressType["EVM"] = 0] = "EVM";
|
|
58
|
+
AddressType[AddressType["CARDANO"] = 1] = "CARDANO";
|
|
59
|
+
AddressType[AddressType["SUBSTRATE"] = 2] = "SUBSTRATE";
|
|
60
|
+
AddressType[AddressType["ALGORAND"] = 3] = "ALGORAND";
|
|
61
|
+
AddressType[AddressType["MINA"] = 4] = "MINA";
|
|
62
|
+
AddressType[AddressType["MIDNIGHT"] = 5] = "MIDNIGHT";
|
|
63
|
+
AddressType[AddressType["AVAIL"] = 6] = "AVAIL";
|
|
64
|
+
AddressType[AddressType["POLKADOT"] = 7] = "POLKADOT";
|
|
65
|
+
})(AddressType || (exports.AddressType = AddressType = {}));
|
|
66
|
+
function tryDecode(val, validator, checkResult = () => true) {
|
|
67
|
+
try {
|
|
68
|
+
return checkResult(validator(val));
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
typebox_1.FormatRegistry.Set("algorand-address", (val) => tryDecode(val, algorand_js_1.verifyAlgorandAddress));
|
|
75
|
+
typebox_1.FormatRegistry.Set("algorand-blockhash", (val) => tryDecode(val, algorand_js_1.verifyAlgorandBlockHash));
|
|
76
|
+
typebox_1.FormatRegistry.Set("algorand-txid", (val) => tryDecode(val, algorand_js_1.verifyAlgorandTransactionHash));
|
|
77
|
+
typebox_1.FormatRegistry.Set("mina-address", (val) => tryDecode(val, mina_js_1.verifyMinaAddress));
|
|
78
|
+
typebox_1.FormatRegistry.Set("mina-blockhash", (val) => tryDecode(val, mina_js_1.verifyMinaBlockHash));
|
|
79
|
+
typebox_1.FormatRegistry.Set("mina-txid", (val) => tryDecode(val, mina_js_1.verifyMinaTransactionHash));
|
|
80
|
+
typebox_1.FormatRegistry.Set("cardano-address", (val) => tryDecode(val, cardano_js_1.verifyCardanoByronAddress) ||
|
|
81
|
+
tryDecode(val, cardano_js_1.verifyCardanoShelleyAddress));
|
|
82
|
+
typebox_1.FormatRegistry.Set("ss58", (val) => tryDecode(val, ss58.decode));
|
|
83
|
+
typebox_1.FormatRegistry.Set("bs58check", (val) => tryDecode(val, bs58check_1.default.decode));
|
|
84
|
+
typebox_1.FormatRegistry.Set("bech32", (val) =>
|
|
85
|
+
// note: increase max bech32 limit since some cryptocurrencies need it
|
|
86
|
+
tryDecode(val, (val) => bech32_1.bech32.decode(val, Number.MAX_SAFE_INTEGER / 2)));
|
|
87
|
+
function forceLowercase(schema) {
|
|
88
|
+
return typebox_1.Type.Transform(schema)
|
|
89
|
+
.Decode((value) => value.toLowerCase())
|
|
90
|
+
.Encode((value) => value.toLowerCase());
|
|
91
|
+
}
|
|
92
|
+
function forceUppercase(schema) {
|
|
93
|
+
return typebox_1.Type.Transform(schema)
|
|
94
|
+
.Decode((value) => value.toUpperCase())
|
|
95
|
+
.Encode((value) => value.toUpperCase());
|
|
96
|
+
}
|
|
97
|
+
exports.TypeboxHelpers = {
|
|
98
|
+
Uint256: typebox_1.Type.Transform(typebox_1.Type.BigInt({
|
|
99
|
+
maximum: 115792089237316195423570985008687907853269984665640564039457584007913129639935n,
|
|
100
|
+
minimum: 0n,
|
|
101
|
+
}))
|
|
102
|
+
.Decode((value) => value.toString())
|
|
103
|
+
.Encode((value) => BigInt(value)),
|
|
104
|
+
BlockNumber: (options) => typebox_1.Type.Unsafe(typebox_1.Type.Number(options)),
|
|
105
|
+
AbsoluteSlotNumber: (options) => typebox_1.Type.Unsafe(typebox_1.Type.Number(options)),
|
|
106
|
+
EpochNumber: (options) => typebox_1.Type.Unsafe(typebox_1.Type.Number(options)),
|
|
107
|
+
Algorand: {
|
|
108
|
+
BlockHash: typebox_1.Type.Unsafe(typebox_1.Type.String({ format: "algorand-blockhash" })),
|
|
109
|
+
TxHash: typebox_1.Type.Unsafe(forceUppercase(typebox_1.Type.String({ format: "algorand-txid" }))),
|
|
110
|
+
Address: typebox_1.Type.Unsafe(forceUppercase(typebox_1.Type.String({ format: "algorand-address" }))),
|
|
111
|
+
},
|
|
112
|
+
Substrate: {
|
|
113
|
+
Address: typebox_1.Type.Unsafe(typebox_1.Type.String({ format: "ss58" })),
|
|
114
|
+
},
|
|
115
|
+
Avail: {
|
|
116
|
+
BlockHash: typebox_1.Type.Unsafe(forceLowercase(typebox_1.Type.RegExp(/^0x[a-fA-F0-9]{64}$/))),
|
|
117
|
+
Address: typebox_1.Type.Unsafe(typebox_1.Type.String({ format: "ss58" })),
|
|
118
|
+
// recall: no good concept of tx hash on Substrate chains
|
|
119
|
+
},
|
|
120
|
+
Cardano: {
|
|
121
|
+
BlockHash: typebox_1.Type.Unsafe(forceLowercase(typebox_1.Type.RegExp(/^[a-fA-F0-9]{64}$/))),
|
|
122
|
+
TxHash: typebox_1.Type.Unsafe(forceLowercase(typebox_1.Type.RegExp(/^[a-fA-F0-9]{64}$/))),
|
|
123
|
+
// TODO: this fails on Byron-era addresses
|
|
124
|
+
Address: typebox_1.Type.Unsafe(typebox_1.Type.String({ format: "cardano-address" })),
|
|
125
|
+
Credential: typebox_1.Type.Unsafe(forceLowercase(typebox_1.Type.RegExp(/^[a-fA-F0-9]{64}$/))),
|
|
126
|
+
// TODO: there are two common poolIDs. regex, and poolID bech32
|
|
127
|
+
PoolId: typebox_1.Type.Unsafe(forceLowercase(typebox_1.Type.String())),
|
|
128
|
+
PolicyId: typebox_1.Type.Unsafe(forceLowercase(typebox_1.Type.RegExp(/^[a-fA-F0-9]{56}$/))),
|
|
129
|
+
AssetName: typebox_1.Type.Unsafe(forceLowercase(typebox_1.Type.RegExp(/^[a-fA-F0-9]{64}$/))),
|
|
130
|
+
// TODO: bech32
|
|
131
|
+
Cip14Fingerprint: typebox_1.Type.Unsafe(typebox_1.Type.String()),
|
|
132
|
+
AmountLovelace: typebox_1.Type.Unsafe(typebox_1.Type.RegExp(/^\d+$/)),
|
|
133
|
+
},
|
|
134
|
+
Evm: {
|
|
135
|
+
BlockHash: typebox_1.Type.Unsafe(forceLowercase(typebox_1.Type.RegExp(/^0x[a-fA-F0-9]{64}$/))),
|
|
136
|
+
TxHash: typebox_1.Type.Unsafe(forceLowercase(typebox_1.Type.RegExp(/^0x[a-fA-F0-9]{64}$/))),
|
|
137
|
+
Address: typebox_1.Type.Unsafe(forceLowercase(typebox_1.Type.RegExp(/^0x[a-fA-F0-9]{40}$/))),
|
|
138
|
+
Selector: typebox_1.Type.Unsafe(forceLowercase(typebox_1.Type.RegExp(/^0x[a-fA-F0-9]{8}$/))),
|
|
139
|
+
FullSelector: typebox_1.Type.Unsafe(forceLowercase(typebox_1.Type.RegExp(/^0x[a-fA-F0-9]{64}$/))),
|
|
140
|
+
Signature: typebox_1.Type.Unsafe(typebox_1.Type.RegExp(/^0x[a-fA-F0-9]{130}$/)),
|
|
141
|
+
PrivateKey: typebox_1.Type.Unsafe(typebox_1.Type.RegExp(/^0x[a-fA-F0-9]{64}$/)),
|
|
142
|
+
},
|
|
143
|
+
Midnight: {
|
|
144
|
+
BlockHash: typebox_1.Type.Unsafe(forceLowercase(typebox_1.Type.RegExp(/^0x[a-fA-F0-9]{64}$/))),
|
|
145
|
+
TxHash: typebox_1.Type.Unsafe(forceLowercase(typebox_1.Type.RegExp(/^0x[a-fA-F0-9]{64}$/))),
|
|
146
|
+
Address: typebox_1.Type.Unsafe(forceLowercase(typebox_1.Type.RegExp(/^[a-fA-F0-9]{181}$/))),
|
|
147
|
+
},
|
|
148
|
+
Mina: {
|
|
149
|
+
BlockHash: typebox_1.Type.Unsafe(typebox_1.Type.String({ format: "mina-blockhash" })),
|
|
150
|
+
TxHash: typebox_1.Type.Unsafe(typebox_1.Type.String({ format: "mina-txid" })),
|
|
151
|
+
Address: typebox_1.Type.Unsafe(typebox_1.Type.String({ format: "mina-address" })),
|
|
152
|
+
},
|
|
153
|
+
// TODO THIS IS WRONG TYPE - ONLY A PLACEHOLDER
|
|
154
|
+
Polkadot: {
|
|
155
|
+
BlockHash: typebox_1.Type.Unsafe(typebox_1.Type.String({ format: "mina-blockhash" })),
|
|
156
|
+
TxHash: typebox_1.Type.Unsafe(typebox_1.Type.String({ format: "mina-txid" })),
|
|
157
|
+
Address: typebox_1.Type.Unsafe(typebox_1.Type.String({ format: "mina-address" })),
|
|
158
|
+
},
|
|
159
|
+
Caip2: typebox_1.Type.Unsafe(typebox_1.Type.String()),
|
|
160
|
+
WalletAddress: () => typebox_1.Type.Union(exports.AddressTypebox),
|
|
161
|
+
IntervalMs: (options) => typebox_1.Type.Unsafe(typebox_1.Type.Number(options)),
|
|
162
|
+
IntervalSec: (options) => typebox_1.Type.Unsafe(typebox_1.Type.Number(options)),
|
|
163
|
+
TimestampMs: (options) => typebox_1.Type.Unsafe(typebox_1.Type.Number(options)),
|
|
164
|
+
TimestampMsStr: typebox_1.Type.Unsafe(typebox_1.Type.RegExp(/^\d+$/)),
|
|
165
|
+
HexString0x: (options) => typebox_1.Type.Unsafe(typebox_1.Type.RegExp(/^0x[a-fA-F0-9]+$/, options)),
|
|
166
|
+
HexStringNo0x: (options) => typebox_1.Type.Unsafe(typebox_1.Type.RegExp(/^[a-fA-F0-9]+$/, options)),
|
|
167
|
+
UnknownFormat: typebox_1.Type.Unsafe(typebox_1.Type.String()),
|
|
168
|
+
Lowercase: forceLowercase(typebox_1.Type.String()),
|
|
169
|
+
TrueOrFalse: typebox_1.Type.Transform(typebox_1.Type.Union([typebox_1.Type.Literal("T"), typebox_1.Type.Literal("F")]))
|
|
170
|
+
.Decode((value) => value === "T")
|
|
171
|
+
.Encode((value) => (value ? "T" : "F")),
|
|
172
|
+
Nullable: (schema, options) => typebox_1.Type.Union([schema, typebox_1.Type.Null()], options),
|
|
173
|
+
SerializeObjAsJson: () => typebox_1.Type.Transform(typebox_1.Type.Unsafe(typebox_1.Type.Any()))
|
|
174
|
+
.Decode((x) => JSON.stringify(x))
|
|
175
|
+
.Encode((x) => JSON.parse(x)),
|
|
176
|
+
SerializeJsonAsObj: (schema) => typebox_1.Type.Transform(schema)
|
|
177
|
+
.Decode((x) => JSON.parse(x))
|
|
178
|
+
.Encode((x) => JSON.stringify(x)),
|
|
179
|
+
// TODO: maybe improve with a typebox-specific EVM ABI wrapper
|
|
180
|
+
// abitype library comes with a ZOD verifier, and that can be ported to typebox
|
|
181
|
+
EvmAbiEvent: typebox_1.Type.Unsafe(typebox_1.Type.Any()),
|
|
182
|
+
};
|
|
183
|
+
exports.AddressValidator = {
|
|
184
|
+
[AddressType.NONE]: typebox_1.Type.Literal("0x0"),
|
|
185
|
+
[AddressType.EVM]: exports.TypeboxHelpers.Evm.Address,
|
|
186
|
+
[AddressType.CARDANO]: exports.TypeboxHelpers.Cardano.Address,
|
|
187
|
+
[AddressType.SUBSTRATE]: exports.TypeboxHelpers.Substrate.Address,
|
|
188
|
+
[AddressType.AVAIL]: exports.TypeboxHelpers.Avail.Address,
|
|
189
|
+
[AddressType.ALGORAND]: exports.TypeboxHelpers.Algorand.Address,
|
|
190
|
+
[AddressType.MINA]: exports.TypeboxHelpers.Mina.Address,
|
|
191
|
+
[AddressType.MIDNIGHT]: exports.TypeboxHelpers.Midnight.Address,
|
|
192
|
+
[AddressType.POLKADOT]: exports.TypeboxHelpers.Polkadot.Address,
|
|
193
|
+
};
|
|
194
|
+
exports.AddressTypebox = [
|
|
195
|
+
typebox_1.Type.Object({
|
|
196
|
+
type: typebox_1.Type.Literal(AddressType.NONE),
|
|
197
|
+
address: typebox_1.Type.Literal("0x0"),
|
|
198
|
+
}),
|
|
199
|
+
typebox_1.Type.Object({
|
|
200
|
+
type: typebox_1.Type.Literal(AddressType.EVM),
|
|
201
|
+
address: exports.TypeboxHelpers.Evm.Address,
|
|
202
|
+
}),
|
|
203
|
+
typebox_1.Type.Object({
|
|
204
|
+
type: typebox_1.Type.Literal(AddressType.CARDANO),
|
|
205
|
+
address: exports.TypeboxHelpers.Cardano.Address,
|
|
206
|
+
}),
|
|
207
|
+
typebox_1.Type.Object({
|
|
208
|
+
type: typebox_1.Type.Literal(AddressType.SUBSTRATE),
|
|
209
|
+
address: exports.TypeboxHelpers.Substrate.Address,
|
|
210
|
+
}),
|
|
211
|
+
typebox_1.Type.Object({
|
|
212
|
+
type: typebox_1.Type.Literal(AddressType.AVAIL),
|
|
213
|
+
address: exports.TypeboxHelpers.Avail.Address,
|
|
214
|
+
}),
|
|
215
|
+
typebox_1.Type.Object({
|
|
216
|
+
type: typebox_1.Type.Literal(AddressType.ALGORAND),
|
|
217
|
+
address: exports.TypeboxHelpers.Algorand.Address,
|
|
218
|
+
}),
|
|
219
|
+
typebox_1.Type.Object({
|
|
220
|
+
type: typebox_1.Type.Literal(AddressType.MINA),
|
|
221
|
+
address: exports.TypeboxHelpers.Mina.Address,
|
|
222
|
+
}),
|
|
223
|
+
typebox_1.Type.Object({
|
|
224
|
+
type: typebox_1.Type.Literal(AddressType.MIDNIGHT),
|
|
225
|
+
address: exports.TypeboxHelpers.Midnight.Address,
|
|
226
|
+
}),
|
|
227
|
+
typebox_1.Type.Object({
|
|
228
|
+
type: typebox_1.Type.Literal(AddressType.POLKADOT),
|
|
229
|
+
address: exports.TypeboxHelpers.Polkadot.Address,
|
|
230
|
+
}),
|
|
231
|
+
];
|
|
232
|
+
true;
|
|
233
|
+
function checkOrError(name, structure, config) {
|
|
234
|
+
// 1) Check if there are any errors since Value.Decode doesn't give error messages
|
|
235
|
+
{
|
|
236
|
+
const errors = Array.from(value_1.Value.Errors(structure, config)).filter(
|
|
237
|
+
// there are many useless errors in this library
|
|
238
|
+
// ex: 1st error: "foo" should be "bar" in struct Foo
|
|
239
|
+
// 2nd error: struct Foo is invalid inside struct Config
|
|
240
|
+
// in this case, the 2nd error is useless as we only care about the 1st error
|
|
241
|
+
// However, we always want to show the error if for some reason it's the only error
|
|
242
|
+
(error) => error.type !== value_1.ValueErrorType.Intersect &&
|
|
243
|
+
error.type !== value_1.ValueErrorType.Union);
|
|
244
|
+
for (const error of errors) {
|
|
245
|
+
console.error({
|
|
246
|
+
name: name ?? "Schema root",
|
|
247
|
+
path: error.path,
|
|
248
|
+
valueProvided: error.value,
|
|
249
|
+
message: error.message,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
if (errors.length > 1) {
|
|
253
|
+
throw new Error(`Schema field missing or invalid. See above for error.`);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
const decoded = value_1.Value.Decode(structure, config);
|
|
257
|
+
return decoded;
|
|
258
|
+
}
|
|
259
|
+
function pick(keys) {
|
|
260
|
+
return {
|
|
261
|
+
from: (obj) => {
|
|
262
|
+
const result = [];
|
|
263
|
+
for (const key of keys) {
|
|
264
|
+
result.push([key, obj.properties[key]]);
|
|
265
|
+
}
|
|
266
|
+
return result;
|
|
267
|
+
},
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Same as `pick`, but requires that you include ALL properties and not just a subset of them
|
|
272
|
+
*/
|
|
273
|
+
function pickAll(keys) {
|
|
274
|
+
return {
|
|
275
|
+
from: (obj) => pick(keys).from(obj),
|
|
276
|
+
};
|
|
277
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { HexString0x, HexStringNo0x } from "./nominal.js";
|
|
2
|
+
export type Json = null | boolean | number | string | Json[] | {
|
|
3
|
+
[key: string]: Json;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* This is a patch for a limitation in Typescript
|
|
7
|
+
* When writing functions with return types that are conditional (ex: (): T extends ... ? Foo : Bar
|
|
8
|
+
* It can't easily know type narrowing in function body leads to satisfying return type constraints
|
|
9
|
+
*
|
|
10
|
+
* Typically, this is solved by using an `as` when using `return`:
|
|
11
|
+
* ```
|
|
12
|
+
* function foo<T>(foo: T): Result<T> {
|
|
13
|
+
* if (foo === ...) {
|
|
14
|
+
* return { ... } as Result<T>; // we have to cast (`as`) to make it work
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
* but this loses some type safety (in hides any error in the `{ ... }`
|
|
19
|
+
*
|
|
20
|
+
* To solve this, this function checks that
|
|
21
|
+
* the input is valid for *some* instance of the generic
|
|
22
|
+
* and then casts it to a more general instance
|
|
23
|
+
*
|
|
24
|
+
* TODO: we can probably delete this once Typescript 5.8 is released
|
|
25
|
+
* https://github.com/microsoft/TypeScript/pull/56941
|
|
26
|
+
*/
|
|
27
|
+
export declare function narrowResult<const General, const Input extends General, const Output extends General>(result: Input): Output;
|
|
28
|
+
export declare function strip0x(str: string): HexStringNo0x;
|
|
29
|
+
export declare function add0x(str: string): HexString0x;
|
|
30
|
+
/**
|
|
31
|
+
* Typed version of Object.keys()
|
|
32
|
+
*
|
|
33
|
+
* careful: this is dangerous.
|
|
34
|
+
* Only use when you're sure there are no other key types added dynamically
|
|
35
|
+
*/
|
|
36
|
+
export declare function keysOf<Key extends number | string>(obj: Record<Key, unknown>): Key[];
|
|
37
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/utils/src/types/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE/D,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,EAAE,GAAG;IAC7D,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAC1B,KAAK,CAAC,OAAO,EACb,KAAK,CAAC,KAAK,SAAS,OAAO,EAC3B,KAAK,CAAC,MAAM,SAAS,OAAO,EAC5B,MAAM,EAAE,KAAK,GAAG,MAAM,CAEvB;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAKlD;AACD,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAK9C;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,GAAG,SAAS,MAAM,GAAG,MAAM,EAChD,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,GACxB,GAAG,EAAE,CAEP"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.narrowResult = narrowResult;
|
|
4
|
+
exports.strip0x = strip0x;
|
|
5
|
+
exports.add0x = add0x;
|
|
6
|
+
exports.keysOf = keysOf;
|
|
7
|
+
/**
|
|
8
|
+
* This is a patch for a limitation in Typescript
|
|
9
|
+
* When writing functions with return types that are conditional (ex: (): T extends ... ? Foo : Bar
|
|
10
|
+
* It can't easily know type narrowing in function body leads to satisfying return type constraints
|
|
11
|
+
*
|
|
12
|
+
* Typically, this is solved by using an `as` when using `return`:
|
|
13
|
+
* ```
|
|
14
|
+
* function foo<T>(foo: T): Result<T> {
|
|
15
|
+
* if (foo === ...) {
|
|
16
|
+
* return { ... } as Result<T>; // we have to cast (`as`) to make it work
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
* but this loses some type safety (in hides any error in the `{ ... }`
|
|
21
|
+
*
|
|
22
|
+
* To solve this, this function checks that
|
|
23
|
+
* the input is valid for *some* instance of the generic
|
|
24
|
+
* and then casts it to a more general instance
|
|
25
|
+
*
|
|
26
|
+
* TODO: we can probably delete this once Typescript 5.8 is released
|
|
27
|
+
* https://github.com/microsoft/TypeScript/pull/56941
|
|
28
|
+
*/
|
|
29
|
+
function narrowResult(result) {
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
function strip0x(str) {
|
|
33
|
+
if (str.startsWith("0x")) {
|
|
34
|
+
return str.substring(2);
|
|
35
|
+
}
|
|
36
|
+
return str;
|
|
37
|
+
}
|
|
38
|
+
function add0x(str) {
|
|
39
|
+
if (str.startsWith("0x")) {
|
|
40
|
+
return str;
|
|
41
|
+
}
|
|
42
|
+
return `0x${str}`;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Typed version of Object.keys()
|
|
46
|
+
*
|
|
47
|
+
* careful: this is dangerous.
|
|
48
|
+
* Only use when you're sure there are no other key types added dynamically
|
|
49
|
+
*/
|
|
50
|
+
function keysOf(obj) {
|
|
51
|
+
return Object.keys(obj);
|
|
52
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Taken from https://github.com/algorand/js-algorand-sdk/blob/6973ff583b243ddb0632e91f4c0383021430a789/src/encoding/address.ts#L88
|
|
3
|
+
*
|
|
4
|
+
* For regular addresses,
|
|
5
|
+
* base32 encoding of a 32-byte ed25519 public key and a 4-byte checksum (the last 4 bytes of the SHA-512/256 hash of the public key)
|
|
6
|
+
* For multisig addresses,
|
|
7
|
+
* instead of a 32-byte public key, it’s the hash of some fields that specify the details of the multisig account.
|
|
8
|
+
* more specifically, it’s the SHA-512/256 hash of (a version byte, a threshold, and the public keys of all possible signers).
|
|
9
|
+
* The checksum is computed the same way as for regular addresses.
|
|
10
|
+
*
|
|
11
|
+
* Example address: JY2FRXQP7Q6SYH7QE2HF2XWNE644V6KUH3PYC4SYWPUSEATTDJSNUHMHR4
|
|
12
|
+
*/
|
|
13
|
+
export declare function verifyAlgorandAddress(address: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Note: strangely, there are 3 common ways to encode Algorand block hashes
|
|
16
|
+
* 1. (rpc) base64
|
|
17
|
+
* 2. (algokit json) blk-${base32} (stripping padding)
|
|
18
|
+
* 3. (msgpck) base32 (unsure about padding)
|
|
19
|
+
*
|
|
20
|
+
* Example block hash: 3KYSrPgi16Cl3iLu3r+GaeZkBBrgNFbMB60jsrJtTdI=
|
|
21
|
+
*/
|
|
22
|
+
export declare function verifyAlgorandBlockHash(hash: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Taken from https://github.com/algorand/js-algorand-sdk/blob/6973ff583b243ddb0632e91f4c0383021430a789/src/transaction.ts#L1102
|
|
25
|
+
*
|
|
26
|
+
* base32 string encoding (stripping padding) of a "rawTxId" (SHA512/256 digest)
|
|
27
|
+
*
|
|
28
|
+
* Example tx hash: IJFAHCDFJ25GBPPNXXZ67KR2IQMZ5XGMAFWCKXIETKY6WV4OR6YQ
|
|
29
|
+
*/
|
|
30
|
+
export declare function verifyAlgorandTransactionHash(hash: string): boolean;
|
|
31
|
+
//# sourceMappingURL=algorand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"algorand.d.ts","sourceRoot":"","sources":["../../../../../src/utils/src/types/validators/algorand.ts"],"names":[],"mappings":"AA2BA;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAiC9D;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAY7D;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CASnE"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.verifyAlgorandAddress = verifyAlgorandAddress;
|
|
7
|
+
exports.verifyAlgorandBlockHash = verifyAlgorandBlockHash;
|
|
8
|
+
exports.verifyAlgorandTransactionHash = verifyAlgorandTransactionHash;
|
|
9
|
+
const hi_base32_1 = __importDefault(require("hi-base32"));
|
|
10
|
+
const js_sha512_1 = __importDefault(require("js-sha512"));
|
|
11
|
+
const js_base64_1 = require("js-base64");
|
|
12
|
+
const utils_js_1 = require("./utils.js");
|
|
13
|
+
const BLOCK_HASH_BYTE_LENGTH = 32;
|
|
14
|
+
const TX_ID_BYTE_LENGTH = 32;
|
|
15
|
+
const ADDRESS_BYTE_LENGTH = 36;
|
|
16
|
+
const CHECKSUM_BYTE_LENGTH = 4;
|
|
17
|
+
const ADDRESS_LENGTH = 58;
|
|
18
|
+
const HASH_BYTES_LENGTH = 32;
|
|
19
|
+
const PUBLIC_KEY_LENGTH = 32;
|
|
20
|
+
const MALFORMED_BLOCK_HASH_ERROR_MSG = (0, utils_js_1.MALFORMED_ERROR_MSG)("block hash");
|
|
21
|
+
const MALFORMED_TX_ID_ERROR_MSG = (0, utils_js_1.MALFORMED_ERROR_MSG)("tx id");
|
|
22
|
+
const MALFORMED_ADDRESS_ERROR_MSG = (0, utils_js_1.MALFORMED_ERROR_MSG)("address");
|
|
23
|
+
const CHECKSUM_ADDRESS_ERROR_MSG = (0, utils_js_1.CHECKSUM_ERROR_MSG)("address");
|
|
24
|
+
function checksumFromPublicKey(pk) {
|
|
25
|
+
return Uint8Array.from(js_sha512_1.default.sha512_256.array(pk).slice(HASH_BYTES_LENGTH - CHECKSUM_BYTE_LENGTH, HASH_BYTES_LENGTH));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Taken from https://github.com/algorand/js-algorand-sdk/blob/6973ff583b243ddb0632e91f4c0383021430a789/src/encoding/address.ts#L88
|
|
29
|
+
*
|
|
30
|
+
* For regular addresses,
|
|
31
|
+
* base32 encoding of a 32-byte ed25519 public key and a 4-byte checksum (the last 4 bytes of the SHA-512/256 hash of the public key)
|
|
32
|
+
* For multisig addresses,
|
|
33
|
+
* instead of a 32-byte public key, it’s the hash of some fields that specify the details of the multisig account.
|
|
34
|
+
* more specifically, it’s the SHA-512/256 hash of (a version byte, a threshold, and the public keys of all possible signers).
|
|
35
|
+
* The checksum is computed the same way as for regular addresses.
|
|
36
|
+
*
|
|
37
|
+
* Example address: JY2FRXQP7Q6SYH7QE2HF2XWNE644V6KUH3PYC4SYWPUSEATTDJSNUHMHR4
|
|
38
|
+
*/
|
|
39
|
+
function verifyAlgorandAddress(address) {
|
|
40
|
+
if (typeof address !== "string") {
|
|
41
|
+
throw new Error(`${MALFORMED_ADDRESS_ERROR_MSG}: expected string, got ${typeof address}, ${address}`);
|
|
42
|
+
}
|
|
43
|
+
if (address.length !== ADDRESS_LENGTH) {
|
|
44
|
+
throw new Error(`${MALFORMED_ADDRESS_ERROR_MSG}: expected length ${ADDRESS_LENGTH}, got ${address.length}: ${address}`);
|
|
45
|
+
}
|
|
46
|
+
// try to decode
|
|
47
|
+
const decoded = hi_base32_1.default.decode.asBytes(address);
|
|
48
|
+
// Sanity check
|
|
49
|
+
if (decoded.length !== ADDRESS_BYTE_LENGTH) {
|
|
50
|
+
throw new Error(`${MALFORMED_ADDRESS_ERROR_MSG}: expected byte length ${ADDRESS_BYTE_LENGTH}, got ${decoded.length}`);
|
|
51
|
+
}
|
|
52
|
+
// Find publickey and checksum
|
|
53
|
+
const pk = new Uint8Array(decoded.slice(0, ADDRESS_BYTE_LENGTH - CHECKSUM_BYTE_LENGTH));
|
|
54
|
+
const cs = new Uint8Array(decoded.slice(PUBLIC_KEY_LENGTH, ADDRESS_BYTE_LENGTH));
|
|
55
|
+
const checksum = checksumFromPublicKey(pk);
|
|
56
|
+
// Check if the checksum and the address are equal
|
|
57
|
+
if (!arrayEqual(checksum, cs))
|
|
58
|
+
throw new Error(CHECKSUM_ADDRESS_ERROR_MSG);
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Note: strangely, there are 3 common ways to encode Algorand block hashes
|
|
63
|
+
* 1. (rpc) base64
|
|
64
|
+
* 2. (algokit json) blk-${base32} (stripping padding)
|
|
65
|
+
* 3. (msgpck) base32 (unsure about padding)
|
|
66
|
+
*
|
|
67
|
+
* Example block hash: 3KYSrPgi16Cl3iLu3r+GaeZkBBrgNFbMB60jsrJtTdI=
|
|
68
|
+
*/
|
|
69
|
+
function verifyAlgorandBlockHash(hash) {
|
|
70
|
+
// TODO: length check?
|
|
71
|
+
const decoded = js_base64_1.Base64.toUint8Array("3KYSrPgi16Cl3iLu3r+GaeZkBBrgNFbMB60jsrJtTdI=");
|
|
72
|
+
// Sanity check
|
|
73
|
+
if (decoded.length !== TX_ID_BYTE_LENGTH) {
|
|
74
|
+
throw new Error(`${MALFORMED_TX_ID_ERROR_MSG}: expected byte length ${TX_ID_BYTE_LENGTH}, got ${decoded.length}`);
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Taken from https://github.com/algorand/js-algorand-sdk/blob/6973ff583b243ddb0632e91f4c0383021430a789/src/transaction.ts#L1102
|
|
80
|
+
*
|
|
81
|
+
* base32 string encoding (stripping padding) of a "rawTxId" (SHA512/256 digest)
|
|
82
|
+
*
|
|
83
|
+
* Example tx hash: IJFAHCDFJ25GBPPNXXZ67KR2IQMZ5XGMAFWCKXIETKY6WV4OR6YQ
|
|
84
|
+
*/
|
|
85
|
+
function verifyAlgorandTransactionHash(hash) {
|
|
86
|
+
const decoded = hi_base32_1.default.decode.asBytes(hash);
|
|
87
|
+
// Sanity check
|
|
88
|
+
if (decoded.length !== BLOCK_HASH_BYTE_LENGTH) {
|
|
89
|
+
throw new Error(`${MALFORMED_BLOCK_HASH_ERROR_MSG}: expected byte length ${MALFORMED_BLOCK_HASH_ERROR_MSG}, got ${decoded.length}`);
|
|
90
|
+
}
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
function arrayEqual(a, b) {
|
|
94
|
+
if (a.length !== b.length) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
return Array.from(a).every((val, i) => val === b[i]);
|
|
98
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const InvalidArgumentError: ErrorConstructor;
|
|
2
|
+
/**
|
|
3
|
+
* Example address:
|
|
4
|
+
* - (mainnet icarus) Ae2tdPwUPEZFRbyhz3cpfC2CumGzNkFBN2L42rcUc2yjQpEkxDbkPodpMAi
|
|
5
|
+
* - (testnet byron) 37btjrVyb4KDXBNC4haBVPCrro8AQPHwvCMp3RFhhSVWwfFmZ6wwzSK6JK1hY6wHNmtrpTf1kdbva8TCneM2YsiXT7mrzT21EacHnPpz5YyUdj64na
|
|
6
|
+
* - (mainnet byron) 82d818584283581caf335162c1ecb0a5b95342e3d1d0c9c38a246fa976b077e81dea9d9ba101581e581c2d574aa85a82a80fd6d1c51ea115c2b03b68166230a3c383c9f89ad5001ac3de014e
|
|
7
|
+
*/
|
|
8
|
+
export declare function verifyCardanoByronAddress(address: string): boolean;
|
|
9
|
+
export declare enum AddressType {
|
|
10
|
+
BasePaymentKeyStakeKey = 0,
|
|
11
|
+
BasePaymentScriptStakeKey = 1,
|
|
12
|
+
BasePaymentKeyStakeScript = 2,
|
|
13
|
+
BasePaymentScriptStakeScript = 3,
|
|
14
|
+
PointerKey = 4,
|
|
15
|
+
PointerScript = 5,
|
|
16
|
+
EnterpriseKey = 6,
|
|
17
|
+
EnterpriseScript = 7,
|
|
18
|
+
Byron = 8,
|
|
19
|
+
RewardKey = 14,
|
|
20
|
+
RewardScript = 15
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* See: https://github.com/input-output-hk/cardano-js-sdk/blob/d1544fc9d1fb3997eb7c5b94a233789bb9e5cd9f/packages/core/src/Cardano/Address/Address.ts
|
|
24
|
+
*/
|
|
25
|
+
export declare function verifyCardanoShelleyAddress(address: string): boolean;
|
|
26
|
+
//# sourceMappingURL=cardano.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cardano.d.ts","sourceRoot":"","sources":["../../../../../src/utils/src/types/validators/cardano.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,oBAAoB,kBAAQ,CAAC;AAE1C;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAElE;AAkBD,oBAAY,WAAW;IACrB,sBAAsB,IAAS;IAC/B,yBAAyB,IAAS;IAClC,yBAAyB,IAAS;IAClC,4BAA4B,IAAS;IACrC,UAAU,IAAS;IACnB,aAAa,IAAS;IACtB,aAAa,IAAS;IACtB,gBAAgB,IAAS;IAGzB,KAAK,IAAS;IACd,SAAS,KAAS;IAClB,YAAY,KAAS;CAEtB;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAwDpE"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AddressType = exports.InvalidArgumentError = void 0;
|
|
7
|
+
exports.verifyCardanoByronAddress = verifyCardanoByronAddress;
|
|
8
|
+
exports.verifyCardanoShelleyAddress = verifyCardanoShelleyAddress;
|
|
9
|
+
const crc_1 = require("@foxglove/crc");
|
|
10
|
+
const utils_js_1 = require("./utils.js");
|
|
11
|
+
const minicbor_js_1 = require("./minicbor.js");
|
|
12
|
+
const bs58_1 = __importDefault(require("bs58"));
|
|
13
|
+
const bech32_1 = require("bech32");
|
|
14
|
+
const node_buffer_1 = require("node:buffer");
|
|
15
|
+
const CHECKSUM_ADDRESS_ERROR_MSG = (0, utils_js_1.CHECKSUM_ERROR_MSG)("address");
|
|
16
|
+
exports.InvalidArgumentError = Error;
|
|
17
|
+
/**
|
|
18
|
+
* Example address:
|
|
19
|
+
* - (mainnet icarus) Ae2tdPwUPEZFRbyhz3cpfC2CumGzNkFBN2L42rcUc2yjQpEkxDbkPodpMAi
|
|
20
|
+
* - (testnet byron) 37btjrVyb4KDXBNC4haBVPCrro8AQPHwvCMp3RFhhSVWwfFmZ6wwzSK6JK1hY6wHNmtrpTf1kdbva8TCneM2YsiXT7mrzT21EacHnPpz5YyUdj64na
|
|
21
|
+
* - (mainnet byron) 82d818584283581caf335162c1ecb0a5b95342e3d1d0c9c38a246fa976b077e81dea9d9ba101581e581c2d574aa85a82a80fd6d1c51ea115c2b03b68166230a3c383c9f89ad5001ac3de014e
|
|
22
|
+
*/
|
|
23
|
+
function verifyCardanoByronAddress(address) {
|
|
24
|
+
return verifyCardanoByronAddressBytes(bs58_1.default.decode(address));
|
|
25
|
+
}
|
|
26
|
+
function verifyCardanoByronAddressBytes(data) {
|
|
27
|
+
const reader = new minicbor_js_1.MiniCborReader(node_buffer_1.Buffer.from(data).toString("hex"));
|
|
28
|
+
reader.readStartArray();
|
|
29
|
+
reader.readTag();
|
|
30
|
+
const addressDataEncoded = reader.readByteString();
|
|
31
|
+
if (Number(reader.readInt()) !== (0, crc_1.crc32)(addressDataEncoded)) {
|
|
32
|
+
throw new Error(CHECKSUM_ADDRESS_ERROR_MSG);
|
|
33
|
+
}
|
|
34
|
+
// skip the rest of the address verification and assume if the checksum matches the rest is okay
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
var AddressType;
|
|
38
|
+
(function (AddressType) {
|
|
39
|
+
AddressType[AddressType["BasePaymentKeyStakeKey"] = 0] = "BasePaymentKeyStakeKey";
|
|
40
|
+
AddressType[AddressType["BasePaymentScriptStakeKey"] = 1] = "BasePaymentScriptStakeKey";
|
|
41
|
+
AddressType[AddressType["BasePaymentKeyStakeScript"] = 2] = "BasePaymentKeyStakeScript";
|
|
42
|
+
AddressType[AddressType["BasePaymentScriptStakeScript"] = 3] = "BasePaymentScriptStakeScript";
|
|
43
|
+
AddressType[AddressType["PointerKey"] = 4] = "PointerKey";
|
|
44
|
+
AddressType[AddressType["PointerScript"] = 5] = "PointerScript";
|
|
45
|
+
AddressType[AddressType["EnterpriseKey"] = 6] = "EnterpriseKey";
|
|
46
|
+
AddressType[AddressType["EnterpriseScript"] = 7] = "EnterpriseScript";
|
|
47
|
+
// 0b1000 was chosen because all existing Byron addresses actually start with 0b1000,
|
|
48
|
+
// therefore we can re-use Byron addresses as-is
|
|
49
|
+
AddressType[AddressType["Byron"] = 8] = "Byron";
|
|
50
|
+
AddressType[AddressType["RewardKey"] = 14] = "RewardKey";
|
|
51
|
+
AddressType[AddressType["RewardScript"] = 15] = "RewardScript";
|
|
52
|
+
// 1001-1101 are left for future formats
|
|
53
|
+
})(AddressType || (exports.AddressType = AddressType = {}));
|
|
54
|
+
/**
|
|
55
|
+
* See: https://github.com/input-output-hk/cardano-js-sdk/blob/d1544fc9d1fb3997eb7c5b94a233789bb9e5cd9f/packages/core/src/Cardano/Address/Address.ts
|
|
56
|
+
*/
|
|
57
|
+
function verifyCardanoShelleyAddress(address) {
|
|
58
|
+
const bech32data = bech32_1.bech32.decode(address, Number.MAX_SAFE_INTEGER / 2);
|
|
59
|
+
const data = bech32_1.bech32.fromWords(bech32data.words);
|
|
60
|
+
// strictly speaking, you don't have to use these prefixes
|
|
61
|
+
// but it's a good sanity check
|
|
62
|
+
// see CIP5
|
|
63
|
+
if (!["addr", "addr_test", "stake", "stake_test"].includes(bech32data.prefix)) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
const type = data[0] >> 4;
|
|
67
|
+
switch (type) {
|
|
68
|
+
case AddressType.BasePaymentKeyStakeKey:
|
|
69
|
+
case AddressType.BasePaymentScriptStakeKey:
|
|
70
|
+
case AddressType.BasePaymentKeyStakeScript:
|
|
71
|
+
case AddressType.BasePaymentScriptStakeScript: {
|
|
72
|
+
return data.length === 57;
|
|
73
|
+
}
|
|
74
|
+
case AddressType.PointerKey:
|
|
75
|
+
case AddressType.PointerScript: {
|
|
76
|
+
if (data.length <= 29) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
let index = 29;
|
|
80
|
+
const dataBuffer = node_buffer_1.Buffer.from(data);
|
|
81
|
+
const { bytesRead: slotBytes } = variableLengthDecode(dataBuffer.subarray(index));
|
|
82
|
+
index += slotBytes;
|
|
83
|
+
const { bytesRead: txIndexBytes } = variableLengthDecode(dataBuffer.subarray(index));
|
|
84
|
+
index += txIndexBytes;
|
|
85
|
+
variableLengthDecode(dataBuffer.subarray(index));
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
case AddressType.EnterpriseKey:
|
|
89
|
+
case AddressType.EnterpriseScript: {
|
|
90
|
+
return data.length === 47;
|
|
91
|
+
}
|
|
92
|
+
case AddressType.RewardKey:
|
|
93
|
+
case AddressType.RewardScript: {
|
|
94
|
+
return data.length === 47;
|
|
95
|
+
}
|
|
96
|
+
case AddressType.Byron: {
|
|
97
|
+
return verifyCardanoByronAddressBytes(new Uint8Array(data));
|
|
98
|
+
}
|
|
99
|
+
default:
|
|
100
|
+
throw new Error((0, utils_js_1.MALFORMED_ERROR_MSG)("address"));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Decodes a value previously encoded in a variable length array.
|
|
105
|
+
*
|
|
106
|
+
* @param array The encoded value.
|
|
107
|
+
* @returns the decoded value.
|
|
108
|
+
*/
|
|
109
|
+
const variableLengthDecode = (array) => {
|
|
110
|
+
let more = true;
|
|
111
|
+
let value = 0n;
|
|
112
|
+
let bytesRead = 0;
|
|
113
|
+
while (more && bytesRead < array.length) {
|
|
114
|
+
const b = array[bytesRead];
|
|
115
|
+
value <<= 7n;
|
|
116
|
+
value |= BigInt(b & 127);
|
|
117
|
+
more = (b & 128) !== 0;
|
|
118
|
+
++bytesRead;
|
|
119
|
+
}
|
|
120
|
+
return { bytesRead, value };
|
|
121
|
+
};
|