@taquito/wallet-connect 24.3.0-beta.1 → 24.3.0-beta.2
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 +4 -1
- package/dist/lib/taquito/src/batch/constants.js +16 -0
- package/dist/lib/taquito/src/batch/rpc-batch-provider.js +327 -0
- package/dist/lib/taquito/src/constants.js +135 -0
- package/dist/lib/taquito/src/context.js +178 -0
- package/dist/lib/taquito/src/contract/big-map.js +57 -0
- package/dist/lib/taquito/src/contract/compose.js +6 -0
- package/dist/lib/taquito/src/contract/constants.js +4 -0
- package/dist/lib/taquito/src/contract/contract-methods/contract-method-factory.js +18 -0
- package/dist/lib/taquito/src/contract/contract-methods/contract-method-interface.js +2 -0
- package/dist/lib/taquito/src/contract/contract-methods/contract-method-object-param.js +72 -0
- package/dist/lib/taquito/src/contract/contract-methods/contract-on-chain-view.js +111 -0
- package/dist/lib/taquito/src/contract/contract.js +158 -0
- package/dist/lib/taquito/src/contract/errors.js +140 -0
- package/dist/lib/taquito/src/contract/index.js +30 -0
- package/dist/lib/taquito/src/contract/interface.js +2 -0
- package/dist/lib/taquito/src/contract/manager-lambda.js +71 -0
- package/dist/lib/taquito/src/contract/prepare.js +231 -0
- package/dist/lib/taquito/src/contract/rpc-contract-provider.js +675 -0
- package/dist/lib/taquito/src/contract/sapling-state-abstraction.js +24 -0
- package/dist/lib/taquito/src/contract/semantic.js +43 -0
- package/dist/lib/taquito/src/contract/view_lambda.js +27 -0
- package/dist/lib/taquito/src/errors.js +42 -0
- package/dist/lib/taquito/src/estimate/errors.js +16 -0
- package/dist/lib/taquito/src/estimate/estimate-provider-interface.js +2 -0
- package/dist/lib/taquito/src/estimate/estimate.js +176 -0
- package/dist/lib/taquito/src/estimate/index.js +20 -0
- package/dist/lib/taquito/src/estimate/rpc-estimate-provider.js +640 -0
- package/dist/lib/taquito/src/extension/extension.js +2 -0
- package/dist/lib/taquito/src/forger/composite-forger.js +32 -0
- package/dist/lib/taquito/src/forger/errors.js +30 -0
- package/dist/lib/taquito/src/forger/rpc-forger.js +12 -0
- package/dist/lib/taquito/src/forger/taquito-local-forger.js +21 -0
- package/dist/lib/taquito/src/global-constants/default-global-constants-provider.js +35 -0
- package/dist/lib/taquito/src/global-constants/errors.js +30 -0
- package/dist/lib/taquito/src/global-constants/interface-global-constants-provider.js +2 -0
- package/dist/lib/taquito/src/global-constants/noop-global-constants-provider.js +10 -0
- package/dist/lib/taquito/src/import-key.js +40 -0
- package/dist/lib/taquito/src/injector/helper.js +18 -0
- package/dist/lib/taquito/src/injector/interface.js +2 -0
- package/dist/lib/taquito/src/injector/rpc-injector.js +27 -0
- package/dist/lib/taquito/src/operations/ballot-operation.js +32 -0
- package/dist/lib/taquito/src/operations/batch-operation.js +69 -0
- package/dist/lib/taquito/src/operations/delegate-operation.js +54 -0
- package/dist/lib/taquito/src/operations/drain-delegate-operation.js +31 -0
- package/dist/lib/taquito/src/operations/errors.js +133 -0
- package/dist/lib/taquito/src/operations/failing-noop-operation.js +2 -0
- package/dist/lib/taquito/src/operations/increase-paid-storage-operation.js +49 -0
- package/dist/lib/taquito/src/operations/index.js +54 -0
- package/dist/lib/taquito/src/operations/operations.js +193 -0
- package/dist/lib/taquito/src/operations/origination-operation.js +78 -0
- package/dist/lib/taquito/src/operations/proposals-operation.js +29 -0
- package/dist/lib/taquito/src/operations/register-global-constant-operation.js +52 -0
- package/dist/lib/taquito/src/operations/reveal-operation.js +74 -0
- package/dist/lib/taquito/src/operations/smart-rollup-add-messages-operation.js +44 -0
- package/dist/lib/taquito/src/operations/smart-rollup-execute-outbox-message-operation.js +53 -0
- package/dist/lib/taquito/src/operations/smart-rollup-originate-operation.js +50 -0
- package/dist/lib/taquito/src/operations/transaction-operation.js +73 -0
- package/dist/lib/taquito/src/operations/transfer-ticket-operation.js +47 -0
- package/dist/lib/taquito/src/operations/types.js +88 -0
- package/dist/lib/taquito/src/operations/update-companion-key-operation.js +55 -0
- package/dist/lib/taquito/src/operations/update-consensus-key-operation.js +55 -0
- package/dist/lib/taquito/src/packer/interface.js +2 -0
- package/dist/lib/taquito/src/packer/michel-codec-packer.js +11 -0
- package/dist/lib/taquito/src/packer/rpc-packer.js +12 -0
- package/dist/lib/taquito/src/parser/interface.js +2 -0
- package/dist/lib/taquito/src/parser/michel-codec-parser.js +110 -0
- package/dist/lib/taquito/src/parser/noop-parser.js +9 -0
- package/dist/lib/taquito/src/prepare/index.js +18 -0
- package/dist/lib/taquito/src/prepare/interface.js +2 -0
- package/dist/lib/taquito/src/prepare/prepare-provider.js +1049 -0
- package/dist/lib/taquito/src/provider.js +363 -0
- package/dist/lib/taquito/src/read-provider/interface.js +2 -0
- package/dist/lib/taquito/src/read-provider/rpc-read-adapter.js +183 -0
- package/dist/lib/taquito/src/signer/errors.js +17 -0
- package/dist/lib/taquito/src/signer/noop.js +23 -0
- package/dist/lib/taquito/src/subscribe/create-observable-from-subscription.js +20 -0
- package/dist/lib/taquito/src/subscribe/errors.js +30 -0
- package/dist/lib/taquito/src/subscribe/filters.js +96 -0
- package/dist/lib/taquito/src/subscribe/interface.js +2 -0
- package/dist/lib/taquito/src/subscribe/observable-subscription.js +79 -0
- package/dist/lib/taquito/src/subscribe/polling-subcribe-provider.js +118 -0
- package/dist/lib/taquito/src/taquito.js +404 -0
- package/dist/lib/taquito/src/tz/interface.js +2 -0
- package/dist/lib/taquito/src/tz/rpc-tz-provider.js +46 -0
- package/dist/lib/taquito/src/version.js +8 -0
- package/dist/lib/taquito/src/wallet/batch-operation.js +71 -0
- package/dist/lib/taquito/src/wallet/delegation-operation.js +42 -0
- package/dist/lib/taquito/src/wallet/errors.js +40 -0
- package/dist/lib/taquito/src/wallet/increase-paid-storage-operation.js +42 -0
- package/dist/lib/taquito/src/wallet/index.js +25 -0
- package/dist/lib/taquito/src/wallet/interface.js +2 -0
- package/dist/lib/taquito/src/wallet/legacy.js +51 -0
- package/dist/lib/taquito/src/wallet/operation-factory.js +88 -0
- package/dist/lib/taquito/src/wallet/operation.js +221 -0
- package/dist/lib/taquito/src/wallet/origination-operation.js +53 -0
- package/dist/lib/taquito/src/wallet/receipt.js +46 -0
- package/dist/lib/taquito/src/wallet/register-global-constant-operation.js +45 -0
- package/dist/lib/taquito/src/wallet/transaction-operation.js +38 -0
- package/dist/lib/taquito/src/wallet/transfer-ticket-operation.js +38 -0
- package/dist/lib/taquito/src/wallet/wallet.js +445 -0
- package/dist/lib/taquito-core/src/errors.js +351 -0
- package/dist/lib/taquito-core/src/signer-interfaces.js +2 -0
- package/dist/lib/taquito-core/src/taquito-core.js +22 -0
- package/dist/lib/taquito-http-utils/src/errors.js +103 -0
- package/dist/lib/taquito-http-utils/src/status_code.js +322 -0
- package/dist/lib/taquito-http-utils/src/taquito-http-utils.js +308 -0
- package/dist/lib/taquito-http-utils/src/transport-errors.js +141 -0
- package/dist/lib/{version.js → taquito-http-utils/src/version.js} +2 -2
- package/dist/lib/taquito-local-forging/src/codec.js +543 -0
- package/dist/lib/taquito-local-forging/src/constants.js +291 -0
- package/dist/lib/taquito-local-forging/src/decoder.js +64 -0
- package/dist/lib/taquito-local-forging/src/encoder.js +63 -0
- package/dist/lib/taquito-local-forging/src/errors.js +179 -0
- package/dist/lib/taquito-local-forging/src/interface.js +2 -0
- package/dist/lib/taquito-local-forging/src/michelson/codec.js +283 -0
- package/dist/lib/taquito-local-forging/src/protocols.js +60 -0
- package/dist/lib/taquito-local-forging/src/schema/operation.js +259 -0
- package/dist/lib/taquito-local-forging/src/taquito-local-forging.js +117 -0
- package/dist/lib/taquito-local-forging/src/uint8array-consumer.js +35 -0
- package/dist/lib/taquito-local-forging/src/utils.js +18 -0
- package/dist/lib/taquito-local-forging/src/validator.js +57 -0
- package/dist/lib/taquito-local-forging/src/version.js +8 -0
- package/dist/lib/taquito-michel-codec/src/base58.js +255 -0
- package/dist/lib/taquito-michel-codec/src/binary.js +1271 -0
- package/dist/lib/taquito-michel-codec/src/errors.js +90 -0
- package/dist/lib/taquito-michel-codec/src/formatters.js +58 -0
- package/dist/lib/taquito-michel-codec/src/global-constants.js +12 -0
- package/dist/lib/taquito-michel-codec/src/macros.js +551 -0
- package/dist/lib/taquito-michel-codec/src/micheline-emitter.js +128 -0
- package/dist/lib/taquito-michel-codec/src/micheline-parser.js +402 -0
- package/dist/lib/taquito-michel-codec/src/micheline.js +5 -0
- package/dist/lib/taquito-michel-codec/src/michelson-contract.js +93 -0
- package/dist/lib/taquito-michel-codec/src/michelson-typecheck.js +1756 -0
- package/dist/lib/taquito-michel-codec/src/michelson-types.js +83 -0
- package/dist/lib/taquito-michel-codec/src/michelson-validator.js +833 -0
- package/dist/lib/taquito-michel-codec/src/scan.js +128 -0
- package/dist/lib/taquito-michel-codec/src/taquito-michel-codec.js +38 -0
- package/dist/lib/taquito-michel-codec/src/utils.js +323 -0
- package/dist/lib/taquito-michel-codec/src/version.js +8 -0
- package/dist/lib/taquito-michelson-encoder/src/constants.js +11 -0
- package/dist/lib/taquito-michelson-encoder/src/errors.js +38 -0
- package/dist/lib/taquito-michelson-encoder/src/michelson-map.js +201 -0
- package/dist/lib/taquito-michelson-encoder/src/schema/errors.js +127 -0
- package/dist/lib/taquito-michelson-encoder/src/schema/event-schema.js +52 -0
- package/dist/lib/taquito-michelson-encoder/src/schema/parameter.js +113 -0
- package/dist/lib/taquito-michelson-encoder/src/schema/storage.js +260 -0
- package/dist/lib/taquito-michelson-encoder/src/schema/types.js +2 -0
- package/dist/lib/taquito-michelson-encoder/src/schema/view-schema.js +90 -0
- package/dist/lib/taquito-michelson-encoder/src/taquito-michelson-encoder.js +36 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/bigmap.js +130 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/bls12-381-fr.js +86 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/bls12-381-g1.js +76 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/bls12-381-g2.js +76 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/chain-id.js +78 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/chest-key.js +74 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/chest.js +74 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/address.js +116 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/bool.js +59 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/bytes.js +90 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/int.js +90 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/key_hash.js +90 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/mutez.js +90 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/nat.js +93 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/string.js +48 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/timestamp.js +66 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/constant.js +80 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/contract.js +86 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/createToken.js +35 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/key.js +97 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/lambda.js +55 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/list.js +85 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/map.js +112 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/never.js +61 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/operation.js +39 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/option.js +88 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/or.js +282 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/pair.js +233 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/sapling-state.js +84 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/sapling-transaction-deprecated.js +74 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/sapling-transaction.js +74 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/set.js +82 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/signature.js +82 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/ticket-deprecated.js +92 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/ticket.js +92 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/token.js +100 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/tokens.js +75 -0
- package/dist/lib/taquito-michelson-encoder/src/tokens/unit.js +52 -0
- package/dist/lib/taquito-michelson-encoder/src/version.js +8 -0
- package/dist/lib/taquito-rpc/src/opkind.js +49 -0
- package/dist/lib/taquito-rpc/src/rpc-client-interface.js +60 -0
- package/dist/lib/taquito-rpc/src/rpc-client-modules/rpc-cache.js +1118 -0
- package/dist/lib/taquito-rpc/src/taquito-rpc.js +990 -0
- package/dist/lib/taquito-rpc/src/types.js +114 -0
- package/dist/lib/taquito-rpc/src/utils/utils.js +65 -0
- package/dist/lib/taquito-rpc/src/version.js +8 -0
- package/dist/lib/taquito-signer/src/bls-key.js +104 -0
- package/dist/lib/taquito-signer/src/derivation-tools/ecdsa.js +156 -0
- package/dist/lib/taquito-signer/src/derivation-tools/ed25519.js +82 -0
- package/dist/lib/taquito-signer/src/derivation-tools/index.js +79 -0
- package/dist/lib/taquito-signer/src/derivation-tools/types.js +4 -0
- package/dist/lib/taquito-signer/src/derivation-tools/utils.js +16 -0
- package/dist/lib/taquito-signer/src/ec-key.js +196 -0
- package/dist/lib/taquito-signer/src/ed-key.js +130 -0
- package/dist/lib/taquito-signer/src/errors.js +77 -0
- package/dist/lib/taquito-signer/src/helpers.js +44 -0
- package/dist/lib/taquito-signer/src/in-memory-signer.js +240 -0
- package/dist/lib/taquito-signer/src/key-interface.js +6 -0
- package/dist/lib/taquito-signer/src/taquito-signer.js +28 -0
- package/dist/lib/taquito-signer/src/version.js +8 -0
- package/dist/lib/taquito-utils/src/constants.js +203 -0
- package/dist/lib/taquito-utils/src/encoding.js +606 -0
- package/dist/lib/taquito-utils/src/errors.js +45 -0
- package/dist/lib/taquito-utils/src/format.js +29 -0
- package/dist/lib/taquito-utils/src/taquito-utils.js +42 -0
- package/dist/lib/taquito-utils/src/validators.js +236 -0
- package/dist/lib/taquito-utils/src/verify-signature.js +136 -0
- package/dist/lib/taquito-utils/src/version.js +8 -0
- package/dist/lib/{taquito-wallet-connect.js → taquito-wallet-connect/src/taquito-wallet-connect.js} +50 -33
- package/dist/lib/taquito-wallet-connect/src/version.js +8 -0
- package/dist/taquito-wallet-connect.es6.js +46 -32
- package/dist/taquito-wallet-connect.es6.js.map +1 -1
- package/dist/taquito-wallet-connect.umd.js +46 -32
- package/dist/taquito-wallet-connect.umd.js.map +1 -1
- package/dist/types/taquito/src/batch/constants.d.ts +3 -0
- package/dist/types/taquito/src/batch/rpc-batch-provider.d.ts +139 -0
- package/dist/types/taquito/src/constants.d.ts +81 -0
- package/dist/types/taquito/src/context.d.ts +100 -0
- package/dist/types/taquito/src/contract/big-map.d.ts +35 -0
- package/dist/types/taquito/src/contract/compose.d.ts +5 -0
- package/dist/types/taquito/src/contract/constants.d.ts +1 -0
- package/dist/types/taquito/src/contract/contract-methods/contract-method-factory.d.ts +14 -0
- package/dist/types/taquito/src/contract/contract-methods/contract-method-interface.d.ts +28 -0
- package/dist/types/taquito/src/contract/contract-methods/contract-method-object-param.d.ts +39 -0
- package/dist/types/taquito/src/contract/contract-methods/contract-on-chain-view.d.ts +43 -0
- package/dist/types/taquito/src/contract/contract.d.ts +75 -0
- package/dist/types/taquito/src/contract/errors.d.ts +83 -0
- package/dist/types/taquito/src/contract/index.d.ts +11 -0
- package/dist/types/taquito/src/contract/interface.d.ts +254 -0
- package/dist/types/taquito/src/contract/manager-lambda.d.ts +73 -0
- package/dist/types/taquito/src/contract/prepare.d.ts +18 -0
- package/dist/types/taquito/src/contract/rpc-contract-provider.d.ts +270 -0
- package/dist/types/taquito/src/contract/sapling-state-abstraction.d.ts +17 -0
- package/dist/types/taquito/src/contract/semantic.d.ts +7 -0
- package/dist/types/taquito/src/contract/view_lambda.d.ts +34 -0
- package/dist/types/taquito/src/errors.d.ts +26 -0
- package/dist/types/taquito/src/estimate/errors.d.ts +8 -0
- package/dist/types/taquito/src/estimate/estimate-provider-interface.d.ts +153 -0
- package/dist/types/taquito/src/estimate/estimate.d.ts +111 -0
- package/dist/types/taquito/src/estimate/index.d.ts +4 -0
- package/dist/types/taquito/src/estimate/rpc-estimate-provider.d.ts +174 -0
- package/dist/types/taquito/src/extension/extension.d.ts +4 -0
- package/dist/types/taquito/src/forger/composite-forger.d.ts +6 -0
- package/dist/types/taquito/src/forger/errors.d.ts +16 -0
- package/dist/types/taquito/src/forger/rpc-forger.d.ts +7 -0
- package/dist/types/taquito/src/forger/taquito-local-forger.d.ts +8 -0
- package/dist/types/taquito/src/global-constants/default-global-constants-provider.d.ts +18 -0
- package/dist/types/taquito/src/global-constants/errors.d.ts +16 -0
- package/dist/types/taquito/src/global-constants/interface-global-constants-provider.d.ts +11 -0
- package/dist/types/taquito/src/global-constants/noop-global-constants-provider.d.ts +5 -0
- package/dist/types/taquito/src/import-key.d.ts +13 -0
- package/dist/types/taquito/src/injector/helper.d.ts +2 -0
- package/dist/types/taquito/src/injector/interface.d.ts +5 -0
- package/dist/types/taquito/src/injector/rpc-injector.d.ts +7 -0
- package/dist/types/taquito/src/operations/ballot-operation.d.ts +18 -0
- package/dist/types/taquito/src/operations/batch-operation.d.ts +19 -0
- package/dist/types/taquito/src/operations/delegate-operation.d.ts +24 -0
- package/dist/types/taquito/src/operations/drain-delegate-operation.d.ts +17 -0
- package/dist/types/taquito/src/operations/errors.d.ts +50 -0
- package/dist/types/taquito/src/operations/failing-noop-operation.d.ts +17 -0
- package/dist/types/taquito/src/operations/increase-paid-storage-operation.d.ts +23 -0
- package/dist/types/taquito/src/operations/index.d.ts +18 -0
- package/dist/types/taquito/src/operations/operations.d.ts +35 -0
- package/dist/types/taquito/src/operations/origination-operation.d.ts +35 -0
- package/dist/types/taquito/src/operations/proposals-operation.d.ts +17 -0
- package/dist/types/taquito/src/operations/register-global-constant-operation.d.ts +25 -0
- package/dist/types/taquito/src/operations/reveal-operation.d.ts +25 -0
- package/dist/types/taquito/src/operations/smart-rollup-add-messages-operation.d.ts +20 -0
- package/dist/types/taquito/src/operations/smart-rollup-execute-outbox-message-operation.d.ts +24 -0
- package/dist/types/taquito/src/operations/smart-rollup-originate-operation.d.ts +23 -0
- package/dist/types/taquito/src/operations/transaction-operation.d.ts +28 -0
- package/dist/types/taquito/src/operations/transfer-ticket-operation.d.ts +22 -0
- package/dist/types/taquito/src/operations/types.d.ts +823 -0
- package/dist/types/taquito/src/operations/update-companion-key-operation.d.ts +23 -0
- package/dist/types/taquito/src/operations/update-consensus-key-operation.d.ts +23 -0
- package/dist/types/taquito/src/packer/interface.d.ts +4 -0
- package/dist/types/taquito/src/packer/michel-codec-packer.d.ts +5 -0
- package/dist/types/taquito/src/packer/rpc-packer.d.ts +8 -0
- package/dist/types/taquito/src/parser/interface.d.ts +4 -0
- package/dist/types/taquito/src/parser/michel-codec-parser.d.ts +16 -0
- package/dist/types/taquito/src/parser/noop-parser.d.ts +5 -0
- package/dist/types/taquito/src/prepare/index.d.ts +2 -0
- package/dist/types/taquito/src/prepare/interface.d.ts +152 -0
- package/dist/types/taquito/src/prepare/prepare-provider.d.ts +187 -0
- package/dist/types/taquito/src/provider.d.ts +50 -0
- package/dist/types/taquito/src/read-provider/interface.d.ts +132 -0
- package/dist/types/taquito/src/read-provider/rpc-read-adapter.d.ts +130 -0
- package/dist/types/taquito/src/signer/errors.d.ts +8 -0
- package/dist/types/taquito/src/signer/noop.d.ts +11 -0
- package/dist/types/taquito/src/subscribe/create-observable-from-subscription.d.ts +4 -0
- package/dist/types/taquito/src/subscribe/errors.d.ts +18 -0
- package/dist/types/taquito/src/subscribe/filters.d.ts +6 -0
- package/dist/types/taquito/src/subscribe/interface.d.ts +48 -0
- package/dist/types/taquito/src/subscribe/observable-subscription.d.ts +21 -0
- package/dist/types/taquito/src/subscribe/polling-subcribe-provider.d.ts +23 -0
- package/dist/types/taquito/src/taquito.d.ts +248 -0
- package/dist/types/taquito/src/tz/interface.d.ts +20 -0
- package/dist/types/taquito/src/tz/rpc-tz-provider.d.ts +13 -0
- package/dist/types/taquito/src/version.d.ts +4 -0
- package/dist/types/taquito/src/wallet/batch-operation.d.ts +13 -0
- package/dist/types/taquito/src/wallet/delegation-operation.d.ts +12 -0
- package/dist/types/taquito/src/wallet/errors.d.ts +24 -0
- package/dist/types/taquito/src/wallet/increase-paid-storage-operation.d.ts +12 -0
- package/dist/types/taquito/src/wallet/index.d.ts +9 -0
- package/dist/types/taquito/src/wallet/interface.d.ts +66 -0
- package/dist/types/taquito/src/wallet/legacy.d.ts +21 -0
- package/dist/types/taquito/src/wallet/operation-factory.d.ts +32 -0
- package/dist/types/taquito/src/wallet/operation.d.ts +55 -0
- package/dist/types/taquito/src/wallet/origination-operation.d.ts +14 -0
- package/dist/types/taquito/src/wallet/receipt.d.ts +16 -0
- package/dist/types/taquito/src/wallet/register-global-constant-operation.d.ts +13 -0
- package/dist/types/taquito/src/wallet/transaction-operation.d.ts +12 -0
- package/dist/types/taquito/src/wallet/transfer-ticket-operation.d.ts +12 -0
- package/dist/types/taquito/src/wallet/wallet.d.ts +196 -0
- package/dist/types/taquito-core/src/errors.d.ts +213 -0
- package/dist/types/taquito-core/src/signer-interfaces.d.ts +38 -0
- package/dist/types/taquito-core/src/taquito-core.d.ts +6 -0
- package/dist/types/taquito-http-utils/src/errors.d.ts +63 -0
- package/dist/types/taquito-http-utils/src/status_code.d.ts +318 -0
- package/dist/types/taquito-http-utils/src/taquito-http-utils.d.ts +58 -0
- package/dist/types/taquito-http-utils/src/transport-errors.d.ts +28 -0
- package/dist/types/taquito-local-forging/src/codec.d.ts +79 -0
- package/dist/types/taquito-local-forging/src/constants.d.ts +75 -0
- package/dist/types/taquito-local-forging/src/decoder.d.ts +5 -0
- package/dist/types/taquito-local-forging/src/encoder.d.ts +4 -0
- package/dist/types/taquito-local-forging/src/errors.d.ts +109 -0
- package/dist/types/taquito-local-forging/src/interface.d.ts +9 -0
- package/dist/types/taquito-local-forging/src/michelson/codec.d.ts +49 -0
- package/dist/types/taquito-local-forging/src/protocols.d.ts +27 -0
- package/dist/types/taquito-local-forging/src/schema/operation.d.ts +198 -0
- package/dist/types/taquito-local-forging/src/taquito-local-forging.d.ts +27 -0
- package/dist/types/taquito-local-forging/src/uint8array-consumer.d.ts +10 -0
- package/dist/types/taquito-local-forging/src/utils.d.ts +3 -0
- package/dist/types/taquito-local-forging/src/validator.d.ts +13 -0
- package/dist/types/taquito-local-forging/src/version.d.ts +4 -0
- package/dist/types/taquito-michel-codec/src/base58.d.ts +13 -0
- package/dist/types/taquito-michel-codec/src/binary.d.ts +127 -0
- package/dist/types/taquito-michel-codec/src/errors.d.ts +57 -0
- package/dist/types/taquito-michel-codec/src/formatters.d.ts +6 -0
- package/dist/types/taquito-michel-codec/src/global-constants.d.ts +3 -0
- package/dist/types/taquito-michel-codec/src/macros.d.ts +13 -0
- package/dist/types/taquito-michel-codec/src/micheline-emitter.d.ts +17 -0
- package/dist/types/taquito-michel-codec/src/micheline-parser.d.ts +130 -0
- package/dist/types/taquito-michel-codec/src/micheline.d.ts +44 -0
- package/dist/types/taquito-michel-codec/src/michelson-contract.d.ts +24 -0
- package/dist/types/taquito-michel-codec/src/michelson-typecheck.d.ts +38 -0
- package/dist/types/taquito-michel-codec/src/michelson-types.d.ts +147 -0
- package/dist/types/taquito-michel-codec/src/michelson-validator.d.ts +66 -0
- package/dist/types/taquito-michel-codec/src/scan.d.ts +26 -0
- package/dist/types/taquito-michel-codec/src/taquito-michel-codec.d.ts +16 -0
- package/dist/types/taquito-michel-codec/src/utils.d.ts +76 -0
- package/dist/types/taquito-michel-codec/src/version.d.ts +4 -0
- package/dist/types/taquito-michelson-encoder/src/constants.d.ts +8 -0
- package/dist/types/taquito-michelson-encoder/src/errors.d.ts +17 -0
- package/dist/types/taquito-michelson-encoder/src/michelson-map.d.ts +82 -0
- package/dist/types/taquito-michelson-encoder/src/schema/errors.d.ts +83 -0
- package/dist/types/taquito-michelson-encoder/src/schema/event-schema.d.ts +12 -0
- package/dist/types/taquito-michelson-encoder/src/schema/parameter.d.ts +54 -0
- package/dist/types/taquito-michelson-encoder/src/schema/storage.d.ts +97 -0
- package/dist/types/taquito-michelson-encoder/src/schema/types.d.ts +105 -0
- package/dist/types/taquito-michelson-encoder/src/schema/view-schema.d.ts +53 -0
- package/dist/types/taquito-michelson-encoder/src/taquito-michelson-encoder.d.ts +16 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/bigmap.d.ts +51 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/bls12-381-fr.d.ts +51 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/bls12-381-g1.d.ts +47 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/bls12-381-g2.d.ts +47 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/chain-id.d.ts +51 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/chest-key.d.ts +47 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/chest.d.ts +47 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/address.d.ts +61 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/bool.d.ts +32 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/bytes.d.ts +52 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/int.d.ts +56 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/key_hash.d.ts +55 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/mutez.d.ts +53 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/nat.d.ts +55 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/string.d.ts +31 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/timestamp.d.ts +34 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/constant.d.ts +51 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/contract.d.ts +48 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/createToken.d.ts +18 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/key.d.ts +55 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/lambda.d.ts +24 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/list.d.ts +46 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/map.d.ts +47 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/never.d.ts +41 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/operation.d.ts +24 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/option.d.ts +37 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/or.d.ts +53 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/pair.d.ts +50 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/sapling-state.d.ts +44 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/sapling-transaction-deprecated.d.ts +40 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/sapling-transaction.d.ts +40 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/set.d.ts +43 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/signature.d.ts +53 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/ticket-deprecated.d.ts +38 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/ticket.d.ts +38 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/token.d.ts +68 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/tokens.d.ts +36 -0
- package/dist/types/taquito-michelson-encoder/src/tokens/unit.d.ts +34 -0
- package/dist/types/taquito-michelson-encoder/src/version.d.ts +4 -0
- package/dist/types/taquito-rpc/src/opkind.d.ts +45 -0
- package/dist/types/taquito-rpc/src/rpc-client-interface.d.ts +126 -0
- package/dist/types/taquito-rpc/src/rpc-client-modules/rpc-cache.d.ts +473 -0
- package/dist/types/taquito-rpc/src/taquito-rpc.d.ts +483 -0
- package/dist/types/taquito-rpc/src/types.d.ts +2362 -0
- package/dist/types/taquito-rpc/src/utils/utils.d.ts +14 -0
- package/dist/types/taquito-rpc/src/version.d.ts +4 -0
- package/dist/types/taquito-signer/src/bls-key.d.ts +21 -0
- package/dist/types/taquito-signer/src/derivation-tools/ecdsa.d.ts +49 -0
- package/dist/types/taquito-signer/src/derivation-tools/ed25519.d.ts +33 -0
- package/dist/types/taquito-signer/src/derivation-tools/index.d.ts +12 -0
- package/dist/types/taquito-signer/src/derivation-tools/types.d.ts +10 -0
- package/dist/types/taquito-signer/src/derivation-tools/utils.d.ts +1 -0
- package/dist/types/taquito-signer/src/ec-key.d.ts +42 -0
- package/dist/types/taquito-signer/src/ed-key.d.ts +39 -0
- package/dist/types/taquito-signer/src/errors.d.ts +51 -0
- package/dist/types/taquito-signer/src/helpers.d.ts +10 -0
- package/dist/types/taquito-signer/src/in-memory-signer.d.ts +56 -0
- package/dist/types/taquito-signer/src/key-interface.d.ts +37 -0
- package/dist/types/taquito-signer/src/taquito-signer.d.ts +10 -0
- package/dist/types/taquito-signer/src/version.d.ts +4 -0
- package/dist/types/taquito-utils/src/constants.d.ts +78 -0
- package/dist/types/taquito-utils/src/encoding.d.ts +184 -0
- package/dist/types/taquito-utils/src/errors.d.ts +20 -0
- package/dist/types/taquito-utils/src/format.d.ts +4 -0
- package/dist/types/taquito-utils/src/taquito-utils.d.ts +11 -0
- package/dist/types/taquito-utils/src/validators.d.ts +167 -0
- package/dist/types/taquito-utils/src/verify-signature.d.ts +22 -0
- package/dist/types/taquito-utils/src/version.d.ts +4 -0
- package/dist/types/{taquito-wallet-connect.d.ts → taquito-wallet-connect/src/taquito-wallet-connect.d.ts} +4 -2
- package/dist/types/taquito-wallet-connect/src/version.d.ts +4 -0
- package/package.json +9 -35
- /package/dist/lib/{errors.js → taquito-wallet-connect/src/errors.js} +0 -0
- /package/dist/lib/{types.js → taquito-wallet-connect/src/types.js} +0 -0
- /package/dist/types/{version.d.ts → taquito-http-utils/src/version.d.ts} +0 -0
- /package/dist/types/{errors.d.ts → taquito-wallet-connect/src/errors.d.ts} +0 -0
- /package/dist/types/{types.d.ts → taquito-wallet-connect/src/types.d.ts} +0 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Cross-runtime transport error classifier.
|
|
4
|
+
*
|
|
5
|
+
* Inspects structural properties first (err.code, err.cause.code, err.name),
|
|
6
|
+
* falls back to message substring matching only when structure isn't enough.
|
|
7
|
+
* Handles node-fetch FetchError, native fetch/undici TypeError + cause chain,
|
|
8
|
+
* browser TypeError, Deno, and Bun error shapes.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.classifyTransportError = classifyTransportError;
|
|
12
|
+
const MAY_HAVE_REACHED = {
|
|
13
|
+
abort: false,
|
|
14
|
+
dns: false,
|
|
15
|
+
connect: false,
|
|
16
|
+
socket: true,
|
|
17
|
+
tls: false,
|
|
18
|
+
timeout: true,
|
|
19
|
+
network: true,
|
|
20
|
+
};
|
|
21
|
+
function extractCode(err) {
|
|
22
|
+
if (typeof err !== 'object' || err === null)
|
|
23
|
+
return undefined;
|
|
24
|
+
const code = err['code'];
|
|
25
|
+
return typeof code === 'string' ? code : undefined;
|
|
26
|
+
}
|
|
27
|
+
function extractCause(err) {
|
|
28
|
+
if (typeof err !== 'object' || err === null)
|
|
29
|
+
return undefined;
|
|
30
|
+
return err['cause'];
|
|
31
|
+
}
|
|
32
|
+
function extractCauseCode(err) {
|
|
33
|
+
return extractCode(extractCause(err));
|
|
34
|
+
}
|
|
35
|
+
function extractCauseMessage(err) {
|
|
36
|
+
const cause = extractCause(err);
|
|
37
|
+
if (typeof cause === 'object' && cause !== null) {
|
|
38
|
+
const msg = cause['message'];
|
|
39
|
+
if (typeof msg === 'string')
|
|
40
|
+
return msg.toLowerCase();
|
|
41
|
+
}
|
|
42
|
+
return '';
|
|
43
|
+
}
|
|
44
|
+
function classify(kind, err) {
|
|
45
|
+
return { kind, mayHaveReachedServer: MAY_HAVE_REACHED[kind], original: err };
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Classify a thrown value as a transport-level error.
|
|
49
|
+
*
|
|
50
|
+
* Inspects structural properties first (err.code, err.cause.code, err.name),
|
|
51
|
+
* then falls back to message substring matching. Handles node-fetch FetchError,
|
|
52
|
+
* native fetch/undici TypeError + cause chain, browser TypeError, Deno, and Bun.
|
|
53
|
+
*
|
|
54
|
+
* @returns the classification, or `undefined` if the error is not transport-related.
|
|
55
|
+
*/
|
|
56
|
+
function classifyTransportError(err) {
|
|
57
|
+
if (!(err instanceof Error))
|
|
58
|
+
return undefined;
|
|
59
|
+
const code = extractCode(err);
|
|
60
|
+
const causeCode = extractCauseCode(err);
|
|
61
|
+
const msg = err.message.toLowerCase();
|
|
62
|
+
const causeMsg = extractCauseMessage(err);
|
|
63
|
+
// 1. AbortError (our timeout or caller cancel)
|
|
64
|
+
if (err.name === 'AbortError') {
|
|
65
|
+
return classify('abort', err);
|
|
66
|
+
}
|
|
67
|
+
// 2. DNS resolution failure
|
|
68
|
+
if (code === 'ENOTFOUND' ||
|
|
69
|
+
code === 'EAI_AGAIN' ||
|
|
70
|
+
causeCode === 'ENOTFOUND' ||
|
|
71
|
+
causeCode === 'EAI_AGAIN' ||
|
|
72
|
+
msg.includes('enotfound') ||
|
|
73
|
+
msg.includes('eai_again')) {
|
|
74
|
+
return classify('dns', err);
|
|
75
|
+
}
|
|
76
|
+
// 3. Connection refused / connect timeout
|
|
77
|
+
if (code === 'ECONNREFUSED' ||
|
|
78
|
+
causeCode === 'ECONNREFUSED' ||
|
|
79
|
+
causeCode === 'UND_ERR_CONNECT_TIMEOUT' ||
|
|
80
|
+
msg.includes('econnrefused')) {
|
|
81
|
+
return classify('connect', err);
|
|
82
|
+
}
|
|
83
|
+
// 4. TLS errors (check before socket/timeout since TLS errors can also set ECONNRESET)
|
|
84
|
+
// Also inspect cause.message for native fetch which wraps TLS errors in TypeError("fetch failed")
|
|
85
|
+
if (msg.includes('certificate') ||
|
|
86
|
+
msg.includes('self signed') ||
|
|
87
|
+
msg.includes('ssl') ||
|
|
88
|
+
msg.includes('handshake') ||
|
|
89
|
+
causeMsg.includes('certificate') ||
|
|
90
|
+
causeMsg.includes('self signed') ||
|
|
91
|
+
causeMsg.includes('ssl') ||
|
|
92
|
+
causeMsg.includes('handshake')) {
|
|
93
|
+
return classify('tls', err);
|
|
94
|
+
}
|
|
95
|
+
// 5. TCP/connect timeout and undici header/body timeouts
|
|
96
|
+
if (code === 'ETIMEDOUT' ||
|
|
97
|
+
causeCode === 'ETIMEDOUT' ||
|
|
98
|
+
causeCode === 'UND_ERR_HEADERS_TIMEOUT' ||
|
|
99
|
+
causeCode === 'UND_ERR_BODY_TIMEOUT' ||
|
|
100
|
+
msg.includes('etimedout') ||
|
|
101
|
+
msg.includes('timed out')) {
|
|
102
|
+
return classify('timeout', err);
|
|
103
|
+
}
|
|
104
|
+
// 6. Socket-level errors (connection was established or partially established)
|
|
105
|
+
if (code === 'ECONNRESET' ||
|
|
106
|
+
causeCode === 'ECONNRESET' ||
|
|
107
|
+
causeCode === 'UND_ERR_SOCKET' ||
|
|
108
|
+
msg.includes('econnreset') ||
|
|
109
|
+
msg.includes('socket hang up') ||
|
|
110
|
+
msg.includes('other side closed') ||
|
|
111
|
+
msg.includes('closed unexpectedly') ||
|
|
112
|
+
msg.includes('connection reset')) {
|
|
113
|
+
return classify('socket', err);
|
|
114
|
+
}
|
|
115
|
+
// 7. Generic fetch failure (browser TypeError, undici wrapper)
|
|
116
|
+
// "terminated" is undici's wrapper for body-read failures (e.g. response.json() after socket drop)
|
|
117
|
+
if (err instanceof TypeError &&
|
|
118
|
+
(msg.includes('fetch failed') ||
|
|
119
|
+
msg.includes('failed to fetch') ||
|
|
120
|
+
msg.includes('network error') ||
|
|
121
|
+
msg.includes('error sending request') ||
|
|
122
|
+
msg === 'terminated')) {
|
|
123
|
+
return classify('network', err);
|
|
124
|
+
}
|
|
125
|
+
// 8. Remaining node-fetch FetchError.
|
|
126
|
+
// Transport types: 'system' (OS-level), 'request-timeout', 'body-timeout'.
|
|
127
|
+
// Non-transport types: 'invalid-json', 'no-redirect', 'max-size'.
|
|
128
|
+
if (err.name === 'FetchError') {
|
|
129
|
+
const fetchType = err['type'];
|
|
130
|
+
if (fetchType === 'request-timeout' || fetchType === 'body-timeout') {
|
|
131
|
+
return classify('timeout', err);
|
|
132
|
+
}
|
|
133
|
+
if (fetchType === 'system') {
|
|
134
|
+
return classify('network', err);
|
|
135
|
+
}
|
|
136
|
+
// Not a transport error (e.g. JSON parse failure on a 200 response)
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
// Not a transport error
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VERSION = void 0;
|
|
4
4
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT!
|
|
5
5
|
exports.VERSION = {
|
|
6
|
-
"commitHash": "
|
|
7
|
-
"version": "24.3.0-beta.
|
|
6
|
+
"commitHash": "fb73f1546d3dff2fbba7741ca6006680212bef16",
|
|
7
|
+
"version": "24.3.0-beta.2"
|
|
8
8
|
};
|
|
@@ -0,0 +1,543 @@
|
|
|
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.burnLimitDecoder = exports.burnLimitEncoder = exports.entrypointNameDecoder = exports.entrypointNameEncoder = exports.blockPayloadHashDecoder = exports.blockPayloadHashEncoder = exports.valueParameterDecoder = exports.valueParameterEncoder = exports.parametersEncoder = exports.entrypointEncoder = exports.parametersDecoder = exports.entrypointDecoder = exports.zarithDecoder = exports.zarithEncoder = exports.smartRollupCommitmentHashDecoder = exports.smartContractAddressDecoder = exports.smartRollupAddressDecoder = exports.addressDecoder = exports.smartRollupCommitmentHashEncoder = exports.publicKeyDecoder = exports.smartContractAddressEncoder = exports.smartRollupAddressEncoder = exports.addressEncoder = exports.publicKeyEncoder = exports.publicKeyHashesEncoder = exports.publicKeyHashEncoder = exports.delegateDecoder = exports.boolDecoder = exports.int16Decoder = exports.int16Encoder = exports.int32Decoder = exports.int32Encoder = exports.delegateEncoder = exports.pvmKindDecoder = exports.pvmKindEncoder = exports.ballotDecoder = exports.ballotEncoder = exports.proposalsEncoder = exports.proposalsDecoder = exports.proposalDecoder = exports.proposalEncoder = exports.boolEncoder = exports.tz1Encoder = exports.branchEncoder = exports.publicKeyHashesDecoder = exports.publicKeyHashDecoder = exports.branchDecoder = exports.tz1Decoder = exports.prefixDecoder = exports.prefixEncoder = void 0;
|
|
7
|
+
exports.slotHeaderDecoder = exports.slotHeaderEncoder = exports.dalCommitmentDecoder = exports.dalCommitmentEncoder = exports.smartRollupMessageDecoder = exports.smartRollupMessageEncoder = exports.paddedBytesDecoder = exports.paddedBytesEncoder = exports.signatureProofDecoder = exports.signatureProofEncoder = exports.depositsLimitDecoder = exports.depositsLimitEncoder = void 0;
|
|
8
|
+
const utils_1 = require("@taquito/utils");
|
|
9
|
+
const errors_1 = require("./errors");
|
|
10
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
11
|
+
const constants_1 = require("./constants");
|
|
12
|
+
const codec_1 = require("./michelson/codec");
|
|
13
|
+
const uint8array_consumer_1 = require("./uint8array-consumer");
|
|
14
|
+
const utils_2 = require("./utils");
|
|
15
|
+
const core_1 = require("@taquito/core");
|
|
16
|
+
// https://tezos.gitlab.io/shell/p2p_api.html specifies data types and structure for forging
|
|
17
|
+
const prefixEncoder = (prefix) => (str) => {
|
|
18
|
+
const [pl] = (0, utils_1.b58DecodeAndCheckPrefix)(str, [prefix]);
|
|
19
|
+
return (0, utils_1.buf2hex)(pl);
|
|
20
|
+
};
|
|
21
|
+
exports.prefixEncoder = prefixEncoder;
|
|
22
|
+
const prefixDecoder = (pre) => (str) => {
|
|
23
|
+
const val = str.consume(utils_1.payloadLength[pre]);
|
|
24
|
+
return (0, utils_1.b58Encode)(val, pre);
|
|
25
|
+
};
|
|
26
|
+
exports.prefixDecoder = prefixDecoder;
|
|
27
|
+
exports.tz1Decoder = (0, exports.prefixDecoder)(utils_1.PrefixV2.Ed25519PublicKeyHash);
|
|
28
|
+
exports.branchDecoder = (0, exports.prefixDecoder)(utils_1.PrefixV2.BlockHash);
|
|
29
|
+
const publicKeyHashDecoder = (val) => {
|
|
30
|
+
const prefix = val.consume(1);
|
|
31
|
+
if (prefix[0] === 0x00) {
|
|
32
|
+
return (0, exports.prefixDecoder)(utils_1.PrefixV2.Ed25519PublicKeyHash)(val);
|
|
33
|
+
}
|
|
34
|
+
else if (prefix[0] === 0x01) {
|
|
35
|
+
return (0, exports.prefixDecoder)(utils_1.PrefixV2.Secp256k1PublicKeyHash)(val);
|
|
36
|
+
}
|
|
37
|
+
else if (prefix[0] === 0x02) {
|
|
38
|
+
return (0, exports.prefixDecoder)(utils_1.PrefixV2.P256PublicKeyHash)(val);
|
|
39
|
+
}
|
|
40
|
+
else if (prefix[0] === 0x03) {
|
|
41
|
+
return (0, exports.prefixDecoder)(utils_1.PrefixV2.BLS12_381PublicKeyHash)(val);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.publicKeyHashDecoder = publicKeyHashDecoder;
|
|
45
|
+
const publicKeyHashesDecoder = (val) => {
|
|
46
|
+
if (!(0, exports.boolDecoder)(val)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const publicKeyHashes = [];
|
|
50
|
+
val.consume(4);
|
|
51
|
+
while (val.length() > 0) {
|
|
52
|
+
publicKeyHashes.push((0, exports.publicKeyHashDecoder)(val));
|
|
53
|
+
}
|
|
54
|
+
return publicKeyHashes;
|
|
55
|
+
};
|
|
56
|
+
exports.publicKeyHashesDecoder = publicKeyHashesDecoder;
|
|
57
|
+
exports.branchEncoder = (0, exports.prefixEncoder)(utils_1.PrefixV2.BlockHash);
|
|
58
|
+
exports.tz1Encoder = (0, exports.prefixEncoder)(utils_1.PrefixV2.Ed25519PublicKeyHash);
|
|
59
|
+
const boolEncoder = (bool) => (bool ? 'ff' : '00');
|
|
60
|
+
exports.boolEncoder = boolEncoder;
|
|
61
|
+
const proposalEncoder = (proposal) => {
|
|
62
|
+
return (0, exports.prefixEncoder)(utils_1.PrefixV2.ProtocolHash)(proposal);
|
|
63
|
+
};
|
|
64
|
+
exports.proposalEncoder = proposalEncoder;
|
|
65
|
+
const proposalDecoder = (proposal) => {
|
|
66
|
+
return (0, exports.prefixDecoder)(utils_1.PrefixV2.ProtocolHash)(proposal);
|
|
67
|
+
};
|
|
68
|
+
exports.proposalDecoder = proposalDecoder;
|
|
69
|
+
const proposalsDecoder = (proposal) => {
|
|
70
|
+
const proposals = [];
|
|
71
|
+
proposal.consume(4);
|
|
72
|
+
while (proposal.length() > 0) {
|
|
73
|
+
proposals.push((0, exports.proposalDecoder)(proposal));
|
|
74
|
+
}
|
|
75
|
+
return proposals;
|
|
76
|
+
};
|
|
77
|
+
exports.proposalsDecoder = proposalsDecoder;
|
|
78
|
+
const proposalsEncoder = (proposals) => {
|
|
79
|
+
return (0, utils_2.pad)(32 * proposals.length) + proposals.map((x) => (0, exports.proposalEncoder)(x)).join('');
|
|
80
|
+
};
|
|
81
|
+
exports.proposalsEncoder = proposalsEncoder;
|
|
82
|
+
const ballotEncoder = (ballot) => {
|
|
83
|
+
switch (ballot) {
|
|
84
|
+
case 'yay':
|
|
85
|
+
return '00';
|
|
86
|
+
case 'nay':
|
|
87
|
+
return '01';
|
|
88
|
+
case 'pass':
|
|
89
|
+
return '02';
|
|
90
|
+
default:
|
|
91
|
+
throw new errors_1.InvalidBallotValueError(ballot);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
exports.ballotEncoder = ballotEncoder;
|
|
95
|
+
const ballotDecoder = (ballot) => {
|
|
96
|
+
const value = ballot.consume(1);
|
|
97
|
+
switch (value[0]) {
|
|
98
|
+
case 0x00:
|
|
99
|
+
return 'yay';
|
|
100
|
+
case 0x01:
|
|
101
|
+
return 'nay';
|
|
102
|
+
case 0x02:
|
|
103
|
+
return 'pass';
|
|
104
|
+
default:
|
|
105
|
+
throw new errors_1.DecodeBallotValueError(value[0].toString());
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
exports.ballotDecoder = ballotDecoder;
|
|
109
|
+
const pvmKindEncoder = (pvm) => {
|
|
110
|
+
switch (pvm) {
|
|
111
|
+
case 'arith':
|
|
112
|
+
return '00';
|
|
113
|
+
case 'wasm_2_0_0':
|
|
114
|
+
return '01';
|
|
115
|
+
case 'riscv':
|
|
116
|
+
return '02';
|
|
117
|
+
default:
|
|
118
|
+
throw new errors_1.UnsupportedPvmKindError(pvm);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
exports.pvmKindEncoder = pvmKindEncoder;
|
|
122
|
+
const pvmKindDecoder = (pvm) => {
|
|
123
|
+
const value = pvm.consume(1);
|
|
124
|
+
switch (value[0]) {
|
|
125
|
+
case 0x00:
|
|
126
|
+
return 'arith';
|
|
127
|
+
case 0x01:
|
|
128
|
+
return 'wasm_2_0_0';
|
|
129
|
+
case 0x02:
|
|
130
|
+
return 'riscv';
|
|
131
|
+
default:
|
|
132
|
+
throw new errors_1.DecodePvmKindError(value[0].toString());
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
exports.pvmKindDecoder = pvmKindDecoder;
|
|
136
|
+
const delegateEncoder = (val) => {
|
|
137
|
+
if (val) {
|
|
138
|
+
return (0, exports.boolEncoder)(true) + (0, exports.publicKeyHashEncoder)(val);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
return (0, exports.boolEncoder)(false);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
exports.delegateEncoder = delegateEncoder;
|
|
145
|
+
const int32Encoder = (val) => {
|
|
146
|
+
const num = parseInt(String(val), 10);
|
|
147
|
+
const byte = [];
|
|
148
|
+
for (let i = 0; i < 4; i++) {
|
|
149
|
+
const shiftBy = (4 - (i + 1)) * 8;
|
|
150
|
+
byte.push((num & (0xff << shiftBy)) >> shiftBy);
|
|
151
|
+
}
|
|
152
|
+
return Buffer.from(byte).toString('hex');
|
|
153
|
+
};
|
|
154
|
+
exports.int32Encoder = int32Encoder;
|
|
155
|
+
const int32Decoder = (val) => {
|
|
156
|
+
const num = val.consume(4);
|
|
157
|
+
let finalNum = 0;
|
|
158
|
+
for (let i = 0; i < num.length; i++) {
|
|
159
|
+
finalNum = finalNum | (num[i] << ((num.length - (i + 1)) * 8));
|
|
160
|
+
}
|
|
161
|
+
return finalNum;
|
|
162
|
+
};
|
|
163
|
+
exports.int32Decoder = int32Decoder;
|
|
164
|
+
const int16Encoder = (val) => {
|
|
165
|
+
const num = parseInt(String(val), 10);
|
|
166
|
+
const byte = [];
|
|
167
|
+
for (let i = 0; i < 2; i++) {
|
|
168
|
+
const shiftBy = (2 - (i + 1)) * 8;
|
|
169
|
+
byte.push((num & (0xff << shiftBy)) >> shiftBy);
|
|
170
|
+
}
|
|
171
|
+
return Buffer.from(byte).toString('hex');
|
|
172
|
+
};
|
|
173
|
+
exports.int16Encoder = int16Encoder;
|
|
174
|
+
const int16Decoder = (val) => {
|
|
175
|
+
const num = val.consume(2);
|
|
176
|
+
let finalNum = 0;
|
|
177
|
+
for (let i = 0; i < num.length; i++) {
|
|
178
|
+
finalNum = finalNum | (num[i] << ((num.length - (i + 1)) * 8));
|
|
179
|
+
}
|
|
180
|
+
return finalNum;
|
|
181
|
+
};
|
|
182
|
+
exports.int16Decoder = int16Decoder;
|
|
183
|
+
const boolDecoder = (val) => {
|
|
184
|
+
const bool = val.consume(1);
|
|
185
|
+
return bool[0] === 0xff;
|
|
186
|
+
};
|
|
187
|
+
exports.boolDecoder = boolDecoder;
|
|
188
|
+
const delegateDecoder = (val) => {
|
|
189
|
+
const hasDelegate = (0, exports.boolDecoder)(val);
|
|
190
|
+
if (hasDelegate) {
|
|
191
|
+
return (0, exports.publicKeyHashDecoder)(val);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
exports.delegateDecoder = delegateDecoder;
|
|
195
|
+
const publicKeyHashEncoder = (val) => {
|
|
196
|
+
try {
|
|
197
|
+
return (0, utils_1.b58DecodePublicKeyHash)(val);
|
|
198
|
+
}
|
|
199
|
+
catch (err) {
|
|
200
|
+
throw new core_1.InvalidKeyHashError(val, err instanceof core_1.ParameterValidationError ? err.result : undefined);
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
exports.publicKeyHashEncoder = publicKeyHashEncoder;
|
|
204
|
+
const publicKeyHashesEncoder = (val) => {
|
|
205
|
+
if (!val) {
|
|
206
|
+
return (0, exports.boolEncoder)(false);
|
|
207
|
+
}
|
|
208
|
+
if (val.length === 0) {
|
|
209
|
+
return (0, exports.boolEncoder)(true) + (0, utils_2.pad)(0);
|
|
210
|
+
}
|
|
211
|
+
const publicKeyHashes = val.reduce((prev, curr) => {
|
|
212
|
+
return prev + (0, exports.publicKeyHashEncoder)(curr);
|
|
213
|
+
}, '');
|
|
214
|
+
return (0, exports.boolEncoder)(true) + (0, utils_2.pad)(publicKeyHashes.length / 2) + publicKeyHashes;
|
|
215
|
+
};
|
|
216
|
+
exports.publicKeyHashesEncoder = publicKeyHashesEncoder;
|
|
217
|
+
const publicKeyEncoder = (val) => {
|
|
218
|
+
try {
|
|
219
|
+
return (0, utils_1.b58DecodePublicKey)(val);
|
|
220
|
+
}
|
|
221
|
+
catch (err) {
|
|
222
|
+
throw new utils_1.InvalidPublicKeyError(val, err instanceof core_1.ParameterValidationError ? err.result : undefined);
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
exports.publicKeyEncoder = publicKeyEncoder;
|
|
226
|
+
const addressEncoder = (val) => {
|
|
227
|
+
return (0, utils_1.b58DecodeAddress)(val);
|
|
228
|
+
};
|
|
229
|
+
exports.addressEncoder = addressEncoder;
|
|
230
|
+
const smartRollupAddressEncoder = (val) => {
|
|
231
|
+
try {
|
|
232
|
+
return (0, exports.prefixEncoder)(utils_1.PrefixV2.SmartRollupHash)(val);
|
|
233
|
+
}
|
|
234
|
+
catch (err) {
|
|
235
|
+
if (err instanceof core_1.ParameterValidationError) {
|
|
236
|
+
throw new errors_1.InvalidSmartRollupAddressError(val);
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
throw err;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
exports.smartRollupAddressEncoder = smartRollupAddressEncoder;
|
|
244
|
+
const smartContractAddressEncoder = (val) => (0, utils_1.b58DecodeAddress)(val);
|
|
245
|
+
exports.smartContractAddressEncoder = smartContractAddressEncoder;
|
|
246
|
+
const publicKeyDecoder = (val) => {
|
|
247
|
+
const preamble = val.consume(1);
|
|
248
|
+
switch (preamble[0]) {
|
|
249
|
+
case 0x00:
|
|
250
|
+
return (0, exports.prefixDecoder)(utils_1.PrefixV2.Ed25519PublicKey)(val);
|
|
251
|
+
case 0x01:
|
|
252
|
+
return (0, exports.prefixDecoder)(utils_1.PrefixV2.Secp256k1PublicKey)(val);
|
|
253
|
+
case 0x02:
|
|
254
|
+
return (0, exports.prefixDecoder)(utils_1.PrefixV2.P256PublicKey)(val);
|
|
255
|
+
case 0x03:
|
|
256
|
+
return (0, exports.prefixDecoder)(utils_1.PrefixV2.BLS12_381PublicKey)(val);
|
|
257
|
+
default:
|
|
258
|
+
throw new utils_1.InvalidPublicKeyError(undefined, utils_1.ValidationResult.NO_PREFIX_MATCHED);
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
exports.publicKeyDecoder = publicKeyDecoder;
|
|
262
|
+
const smartRollupCommitmentHashEncoder = (val) => {
|
|
263
|
+
try {
|
|
264
|
+
return (0, exports.prefixEncoder)(utils_1.PrefixV2.SmartRollupCommitmentHash)(val);
|
|
265
|
+
}
|
|
266
|
+
catch (err) {
|
|
267
|
+
if (err instanceof core_1.ParameterValidationError) {
|
|
268
|
+
throw new errors_1.InvalidSmartRollupCommitmentHashError(val);
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
throw err;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
exports.smartRollupCommitmentHashEncoder = smartRollupCommitmentHashEncoder;
|
|
276
|
+
const addressDecoder = (val) => {
|
|
277
|
+
const preamble = val.consume(1);
|
|
278
|
+
switch (preamble[0]) {
|
|
279
|
+
case 0x00:
|
|
280
|
+
return (0, exports.publicKeyHashDecoder)(val);
|
|
281
|
+
case 0x01: {
|
|
282
|
+
const address = (0, exports.prefixDecoder)(utils_1.PrefixV2.ContractHash)(val);
|
|
283
|
+
val.consume(1);
|
|
284
|
+
return address;
|
|
285
|
+
}
|
|
286
|
+
default:
|
|
287
|
+
throw new core_1.InvalidAddressError(val.toString(), ': Unable to decode.');
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
exports.addressDecoder = addressDecoder;
|
|
291
|
+
const smartRollupAddressDecoder = (val) => {
|
|
292
|
+
return (0, exports.prefixDecoder)(utils_1.PrefixV2.SmartRollupHash)(val);
|
|
293
|
+
};
|
|
294
|
+
exports.smartRollupAddressDecoder = smartRollupAddressDecoder;
|
|
295
|
+
const smartContractAddressDecoder = (val) => {
|
|
296
|
+
const preamble = val.consume(1);
|
|
297
|
+
if (preamble[0] === 0x01) {
|
|
298
|
+
const scAddress = (0, exports.prefixDecoder)(utils_1.PrefixV2.ContractHash)(val);
|
|
299
|
+
val.consume(1);
|
|
300
|
+
return scAddress;
|
|
301
|
+
}
|
|
302
|
+
throw new core_1.InvalidContractAddressError(val.toString(), utils_1.ValidationResult.NO_PREFIX_MATCHED);
|
|
303
|
+
};
|
|
304
|
+
exports.smartContractAddressDecoder = smartContractAddressDecoder;
|
|
305
|
+
const smartRollupCommitmentHashDecoder = (val) => {
|
|
306
|
+
return (0, exports.prefixDecoder)(utils_1.PrefixV2.SmartRollupCommitmentHash)(val);
|
|
307
|
+
};
|
|
308
|
+
exports.smartRollupCommitmentHashDecoder = smartRollupCommitmentHashDecoder;
|
|
309
|
+
const zarithEncoder = (n) => {
|
|
310
|
+
const fn = [];
|
|
311
|
+
let nn = new bignumber_js_1.default(n, 10);
|
|
312
|
+
if (nn.isNaN()) {
|
|
313
|
+
throw new TypeError(`Invalid zarith number ${n}`);
|
|
314
|
+
}
|
|
315
|
+
// eslint-disable-next-line no-constant-condition
|
|
316
|
+
while (true) {
|
|
317
|
+
if (nn.lt(128)) {
|
|
318
|
+
if (nn.lt(16))
|
|
319
|
+
fn.push('0');
|
|
320
|
+
fn.push(nn.toString(16));
|
|
321
|
+
break;
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
let b = nn.mod(128);
|
|
325
|
+
nn = nn.minus(b);
|
|
326
|
+
nn = nn.dividedBy(128);
|
|
327
|
+
b = b.plus(128);
|
|
328
|
+
fn.push(b.toString(16));
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return fn.join('');
|
|
332
|
+
};
|
|
333
|
+
exports.zarithEncoder = zarithEncoder;
|
|
334
|
+
const zarithDecoder = (n) => {
|
|
335
|
+
let mostSignificantByte = 0;
|
|
336
|
+
while (mostSignificantByte < n.length() && (n.get(mostSignificantByte) & 128) !== 0) {
|
|
337
|
+
mostSignificantByte += 1;
|
|
338
|
+
}
|
|
339
|
+
let num = new bignumber_js_1.default(0);
|
|
340
|
+
for (let i = mostSignificantByte; i >= 0; i -= 1) {
|
|
341
|
+
const tmp = n.get(i) & 0x7f;
|
|
342
|
+
num = num.multipliedBy(128);
|
|
343
|
+
num = num.plus(tmp);
|
|
344
|
+
}
|
|
345
|
+
n.consume(mostSignificantByte + 1);
|
|
346
|
+
return new bignumber_js_1.default(num).toString();
|
|
347
|
+
};
|
|
348
|
+
exports.zarithDecoder = zarithDecoder;
|
|
349
|
+
const entrypointDecoder = (value) => {
|
|
350
|
+
const preamble = (0, utils_2.pad)(value.consume(1)[0], 2);
|
|
351
|
+
if (preamble in constants_1.entrypointMapping) {
|
|
352
|
+
return constants_1.entrypointMapping[preamble];
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
const entry = (0, codec_1.extractRequiredLen)(value, 1);
|
|
356
|
+
const entrypoint = Buffer.from(entry).toString('utf8');
|
|
357
|
+
if (entrypoint.length > constants_1.ENTRYPOINT_MAX_LENGTH) {
|
|
358
|
+
throw new errors_1.OversizedEntryPointError(entrypoint);
|
|
359
|
+
}
|
|
360
|
+
return entrypoint;
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
exports.entrypointDecoder = entrypointDecoder;
|
|
364
|
+
const parametersDecoder = (val) => {
|
|
365
|
+
const preamble = val.consume(1);
|
|
366
|
+
if (preamble[0] === 0x00) {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
const encodedEntrypoint = (0, exports.entrypointDecoder)(val);
|
|
371
|
+
const params = (0, codec_1.extractRequiredLen)(val);
|
|
372
|
+
const parameters = (0, codec_1.valueDecoder)(new uint8array_consumer_1.Uint8ArrayConsumer(params));
|
|
373
|
+
return {
|
|
374
|
+
entrypoint: encodedEntrypoint,
|
|
375
|
+
value: parameters,
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
exports.parametersDecoder = parametersDecoder;
|
|
380
|
+
const entrypointEncoder = (entrypoint) => {
|
|
381
|
+
if (entrypoint in constants_1.entrypointMappingReverse) {
|
|
382
|
+
return `${constants_1.entrypointMappingReverse[entrypoint]}`;
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
if (entrypoint.length > constants_1.ENTRYPOINT_MAX_LENGTH) {
|
|
386
|
+
throw new errors_1.OversizedEntryPointError(entrypoint);
|
|
387
|
+
}
|
|
388
|
+
const value = { string: entrypoint };
|
|
389
|
+
return `ff${(0, codec_1.valueEncoder)(value).slice(8)}`;
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
exports.entrypointEncoder = entrypointEncoder;
|
|
393
|
+
const parametersEncoder = (val) => {
|
|
394
|
+
if (!val || (val.entrypoint === 'default' && 'prim' in val.value && val.value.prim === 'Unit')) {
|
|
395
|
+
return '00';
|
|
396
|
+
}
|
|
397
|
+
const encodedEntrypoint = (0, exports.entrypointEncoder)(val.entrypoint);
|
|
398
|
+
const parameters = (0, codec_1.valueEncoder)(val.value);
|
|
399
|
+
const length = (0, utils_2.pad)(parameters.length / 2);
|
|
400
|
+
return `ff${encodedEntrypoint}${length}${parameters}`;
|
|
401
|
+
};
|
|
402
|
+
exports.parametersEncoder = parametersEncoder;
|
|
403
|
+
const valueParameterEncoder = (value) => {
|
|
404
|
+
const valueEncoded = (0, codec_1.valueEncoder)(value);
|
|
405
|
+
return `${(0, utils_2.pad)(valueEncoded.length / 2)}${valueEncoded}`;
|
|
406
|
+
};
|
|
407
|
+
exports.valueParameterEncoder = valueParameterEncoder;
|
|
408
|
+
const valueParameterDecoder = (val) => {
|
|
409
|
+
const value = (0, codec_1.extractRequiredLen)(val);
|
|
410
|
+
return (0, codec_1.valueDecoder)(new uint8array_consumer_1.Uint8ArrayConsumer(value));
|
|
411
|
+
};
|
|
412
|
+
exports.valueParameterDecoder = valueParameterDecoder;
|
|
413
|
+
exports.blockPayloadHashEncoder = (0, exports.prefixEncoder)(utils_1.PrefixV2.ValueHash);
|
|
414
|
+
exports.blockPayloadHashDecoder = (0, exports.prefixDecoder)(utils_1.PrefixV2.ValueHash);
|
|
415
|
+
const entrypointNameEncoder = (entrypoint) => {
|
|
416
|
+
const value = { string: entrypoint };
|
|
417
|
+
return `${(0, codec_1.valueEncoder)(value).slice(2)}`;
|
|
418
|
+
};
|
|
419
|
+
exports.entrypointNameEncoder = entrypointNameEncoder;
|
|
420
|
+
const entrypointNameDecoder = (val) => {
|
|
421
|
+
const entry = (0, codec_1.extractRequiredLen)(val);
|
|
422
|
+
return Buffer.from(entry).toString('utf8');
|
|
423
|
+
};
|
|
424
|
+
exports.entrypointNameDecoder = entrypointNameDecoder;
|
|
425
|
+
const burnLimitEncoder = (val) => {
|
|
426
|
+
return !val ? '00' : `ff${(0, exports.zarithEncoder)(val)}`;
|
|
427
|
+
};
|
|
428
|
+
exports.burnLimitEncoder = burnLimitEncoder;
|
|
429
|
+
const burnLimitDecoder = (value) => {
|
|
430
|
+
const prefix = value.consume(1);
|
|
431
|
+
if (Buffer.from(prefix).toString('hex') !== '00') {
|
|
432
|
+
return (0, exports.zarithDecoder)(value);
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
exports.burnLimitDecoder = burnLimitDecoder;
|
|
436
|
+
const depositsLimitEncoder = (val) => {
|
|
437
|
+
return !val ? '00' : `ff${(0, exports.zarithEncoder)(val)}`;
|
|
438
|
+
};
|
|
439
|
+
exports.depositsLimitEncoder = depositsLimitEncoder;
|
|
440
|
+
const depositsLimitDecoder = (value) => {
|
|
441
|
+
const prefix = value.consume(1);
|
|
442
|
+
if (Buffer.from(prefix).toString('hex') !== '00') {
|
|
443
|
+
return (0, exports.zarithDecoder)(value);
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
exports.depositsLimitDecoder = depositsLimitDecoder;
|
|
447
|
+
const signatureV1Encoder = (val) => {
|
|
448
|
+
try {
|
|
449
|
+
const [data, pre] = (0, utils_1.b58DecodeAndCheckPrefix)(val, utils_1.signaturePrefixes);
|
|
450
|
+
if (pre === utils_1.PrefixV2.BLS12_381Signature) {
|
|
451
|
+
return (0, exports.paddedBytesEncoder)((0, utils_1.buf2hex)(data));
|
|
452
|
+
}
|
|
453
|
+
else {
|
|
454
|
+
throw new core_1.ProhibitedActionError('we only support encoding of BLSIG signatures from protocol Seoul');
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
catch (err) {
|
|
458
|
+
if (err instanceof core_1.ParameterValidationError) {
|
|
459
|
+
throw new core_1.InvalidSignatureError(val, err.result);
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
throw err;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
const signatureV1Decoder = (val) => {
|
|
467
|
+
val.consume(4);
|
|
468
|
+
if (val.length().toString() === '96') {
|
|
469
|
+
return (0, exports.prefixDecoder)(utils_1.PrefixV2.BLS12_381Signature)(val);
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
throw new core_1.ProhibitedActionError('we only support decoding of BLSIG signatures');
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
const signatureProofEncoder = (val) => {
|
|
476
|
+
if (val) {
|
|
477
|
+
return (0, exports.boolEncoder)(true) + signatureV1Encoder(val);
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
return (0, exports.boolEncoder)(false);
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
exports.signatureProofEncoder = signatureProofEncoder;
|
|
484
|
+
const signatureProofDecoder = (value) => {
|
|
485
|
+
const hasProof = (0, exports.boolDecoder)(value);
|
|
486
|
+
if (hasProof) {
|
|
487
|
+
return signatureV1Decoder(value);
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
exports.signatureProofDecoder = signatureProofDecoder;
|
|
491
|
+
const paddedBytesEncoder = (val, paddingLength = 8) => {
|
|
492
|
+
return `${(0, utils_2.pad)(val.length / 2, paddingLength)}${val}`;
|
|
493
|
+
};
|
|
494
|
+
exports.paddedBytesEncoder = paddedBytesEncoder;
|
|
495
|
+
const paddedBytesDecoder = (val) => {
|
|
496
|
+
const value = (0, codec_1.extractRequiredLen)(val);
|
|
497
|
+
return Buffer.from(value).toString('hex');
|
|
498
|
+
};
|
|
499
|
+
exports.paddedBytesDecoder = paddedBytesDecoder;
|
|
500
|
+
const smartRollupMessageEncoder = (val) => {
|
|
501
|
+
const message = val.reduce((prev, curr) => {
|
|
502
|
+
return prev + `${(0, utils_2.pad)(curr.length / 2)}${curr}`;
|
|
503
|
+
}, '');
|
|
504
|
+
return `${(0, utils_2.pad)(message.length / 2)}${message}`;
|
|
505
|
+
};
|
|
506
|
+
exports.smartRollupMessageEncoder = smartRollupMessageEncoder;
|
|
507
|
+
const smartRollupMessageDecoder = (val) => {
|
|
508
|
+
const valueArray = (0, codec_1.extractRequiredLen)(val);
|
|
509
|
+
const ret = (0, codec_1.stripLengthPrefixFromBytes)(new uint8array_consumer_1.Uint8ArrayConsumer(valueArray));
|
|
510
|
+
return ret.map((value) => Buffer.from(value).toString('hex'));
|
|
511
|
+
};
|
|
512
|
+
exports.smartRollupMessageDecoder = smartRollupMessageDecoder;
|
|
513
|
+
const dalCommitmentEncoder = (val) => {
|
|
514
|
+
try {
|
|
515
|
+
return (0, exports.prefixEncoder)(utils_1.PrefixV2.SlotHeader)(val);
|
|
516
|
+
}
|
|
517
|
+
catch (err) {
|
|
518
|
+
if (err instanceof core_1.ParameterValidationError) {
|
|
519
|
+
throw new errors_1.InvalidDalCommitmentError(val);
|
|
520
|
+
}
|
|
521
|
+
else {
|
|
522
|
+
throw err;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
};
|
|
526
|
+
exports.dalCommitmentEncoder = dalCommitmentEncoder;
|
|
527
|
+
const dalCommitmentDecoder = (val) => {
|
|
528
|
+
return (0, exports.prefixDecoder)(utils_1.PrefixV2.SlotHeader)(val);
|
|
529
|
+
};
|
|
530
|
+
exports.dalCommitmentDecoder = dalCommitmentDecoder;
|
|
531
|
+
const slotHeaderEncoder = (val) => {
|
|
532
|
+
return (0, utils_2.pad)(val.slot_index, 2) + (0, exports.dalCommitmentEncoder)(val.commitment) + val.commitment_proof;
|
|
533
|
+
};
|
|
534
|
+
exports.slotHeaderEncoder = slotHeaderEncoder;
|
|
535
|
+
const slotHeaderDecoder = (val) => {
|
|
536
|
+
const preamble = val.consume(1);
|
|
537
|
+
return {
|
|
538
|
+
slot_index: Number(preamble[0].toString(10)),
|
|
539
|
+
commitment: (0, exports.dalCommitmentDecoder)(val),
|
|
540
|
+
commitment_proof: (0, utils_2.toHexString)(val.consume(96)), // rpcForger expect commitment_proof bytes to be len 96
|
|
541
|
+
};
|
|
542
|
+
};
|
|
543
|
+
exports.slotHeaderDecoder = slotHeaderDecoder;
|