@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,551 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MacroError = void 0;
|
|
4
|
+
exports.expandMacros = expandMacros;
|
|
5
|
+
const core_1 = require("@taquito/core");
|
|
6
|
+
const michelson_types_1 = require("./michelson-types");
|
|
7
|
+
/**
|
|
8
|
+
* @category Error
|
|
9
|
+
* Error that indicates macros failed to be expanded
|
|
10
|
+
*/
|
|
11
|
+
class MacroError extends core_1.TaquitoError {
|
|
12
|
+
constructor(prim, message) {
|
|
13
|
+
super();
|
|
14
|
+
this.prim = prim;
|
|
15
|
+
this.message = message;
|
|
16
|
+
this.name = 'MacroError';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.MacroError = MacroError;
|
|
20
|
+
function assertArgs(ex, n) {
|
|
21
|
+
if ((n === 0 && ex.args === undefined) || ex.args?.length === n) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
throw new MacroError(ex, `macro ${ex.prim} expects ${n} arguments, was given ${ex.args?.length}`);
|
|
25
|
+
}
|
|
26
|
+
function assertNoAnnots(ex) {
|
|
27
|
+
if (ex.annots === undefined) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
throw new MacroError(ex, `unexpected annotation on macro ${ex.prim}: ${ex.annots}`);
|
|
31
|
+
}
|
|
32
|
+
function assertIntArg(ex, arg) {
|
|
33
|
+
if ('int' in arg) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
throw new MacroError(ex, `macro ${ex.prim} expects int argument`);
|
|
37
|
+
}
|
|
38
|
+
function parsePairUnpairExpr(p, expr, annotations, agg) {
|
|
39
|
+
let i = 0;
|
|
40
|
+
let ai = 0;
|
|
41
|
+
const ann = [null, null];
|
|
42
|
+
// Left expression
|
|
43
|
+
let lexpr;
|
|
44
|
+
if (i === expr.length) {
|
|
45
|
+
throw new MacroError(p, `unexpected end: ${p.prim}`);
|
|
46
|
+
}
|
|
47
|
+
let c = expr[i++];
|
|
48
|
+
switch (c) {
|
|
49
|
+
case 'P': {
|
|
50
|
+
const { r, n, an } = parsePairUnpairExpr(p, expr.slice(i), annotations.slice(ai), agg);
|
|
51
|
+
lexpr = r;
|
|
52
|
+
i += n;
|
|
53
|
+
ai += an;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
case 'A':
|
|
57
|
+
if (ai !== annotations.length) {
|
|
58
|
+
ann[0] = annotations[ai++];
|
|
59
|
+
}
|
|
60
|
+
break;
|
|
61
|
+
default:
|
|
62
|
+
throw new MacroError(p, `${p.prim}: unexpected character: ${c}`);
|
|
63
|
+
}
|
|
64
|
+
// Right expression
|
|
65
|
+
let rexpr;
|
|
66
|
+
if (i === expr.length) {
|
|
67
|
+
throw new MacroError(p, `unexpected end: ${p.prim}`);
|
|
68
|
+
}
|
|
69
|
+
c = expr[i++];
|
|
70
|
+
switch (c) {
|
|
71
|
+
case 'P': {
|
|
72
|
+
const { r, n, an } = parsePairUnpairExpr(p, expr.slice(i), annotations.slice(ai), agg);
|
|
73
|
+
rexpr = r.map(([v, a]) => [v + 1, a]);
|
|
74
|
+
i += n;
|
|
75
|
+
ai += an;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
case 'I':
|
|
79
|
+
if (ai !== annotations.length) {
|
|
80
|
+
ann[1] = annotations[ai++];
|
|
81
|
+
}
|
|
82
|
+
break;
|
|
83
|
+
default:
|
|
84
|
+
throw new MacroError(p, `${p.prim}: unexpected character: ${c}`);
|
|
85
|
+
}
|
|
86
|
+
return { r: agg(lexpr, rexpr, [0, ann]), n: i, an: ai };
|
|
87
|
+
}
|
|
88
|
+
function parseSetMapCadr(p, expr, vann, term) {
|
|
89
|
+
const c = expr[0];
|
|
90
|
+
switch (c) {
|
|
91
|
+
case 'A':
|
|
92
|
+
return expr.length > 1
|
|
93
|
+
? [
|
|
94
|
+
{ prim: 'DUP' },
|
|
95
|
+
{
|
|
96
|
+
prim: 'DIP',
|
|
97
|
+
args: [
|
|
98
|
+
[{ prim: 'CAR', annots: ['@%%'] }, parseSetMapCadr(p, expr.slice(1), [], term)],
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
{ prim: 'CDR', annots: ['@%%'] },
|
|
102
|
+
{ prim: 'SWAP' },
|
|
103
|
+
{ prim: 'PAIR', annots: ['%@', '%@', ...vann] },
|
|
104
|
+
]
|
|
105
|
+
: term.a;
|
|
106
|
+
case 'D':
|
|
107
|
+
return expr.length > 1
|
|
108
|
+
? [
|
|
109
|
+
{ prim: 'DUP' },
|
|
110
|
+
{
|
|
111
|
+
prim: 'DIP',
|
|
112
|
+
args: [
|
|
113
|
+
[{ prim: 'CDR', annots: ['@%%'] }, parseSetMapCadr(p, expr.slice(1), [], term)],
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
{ prim: 'CAR', annots: ['@%%'] },
|
|
117
|
+
{ prim: 'PAIR', annots: ['%@', '%@', ...vann] },
|
|
118
|
+
]
|
|
119
|
+
: term.d;
|
|
120
|
+
default:
|
|
121
|
+
throw new MacroError(p, `${p.prim}: unexpected character: ${c}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function trimLast(a, v) {
|
|
125
|
+
let l = a.length;
|
|
126
|
+
while (l > 0 && a[l - 1] === v) {
|
|
127
|
+
l--;
|
|
128
|
+
}
|
|
129
|
+
return a.slice(0, l);
|
|
130
|
+
}
|
|
131
|
+
function filterAnnotations(a) {
|
|
132
|
+
const fields = [];
|
|
133
|
+
const rest = [];
|
|
134
|
+
if (a !== undefined) {
|
|
135
|
+
for (const v of a) {
|
|
136
|
+
(v.length !== 0 && v[0] === '%' ? fields : rest).push(v);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return { fields, rest };
|
|
140
|
+
}
|
|
141
|
+
function mkPrim({ prim, annots, args }) {
|
|
142
|
+
return {
|
|
143
|
+
prim,
|
|
144
|
+
...(annots && { annots }),
|
|
145
|
+
...(args && { args }),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
const pairRe = /^P[PAI]{3,}R$/;
|
|
149
|
+
const unpairRe = /^UNP[PAI]{2,}R$/;
|
|
150
|
+
const cadrRe = /^C[AD]{2,}R$/;
|
|
151
|
+
const setCadrRe = /^SET_C[AD]+R$/;
|
|
152
|
+
const mapCadrRe = /^MAP_C[AD]+R$/;
|
|
153
|
+
const diipRe = /^DI{2,}P$/;
|
|
154
|
+
const duupRe = /^DU+P$/;
|
|
155
|
+
function expandMacros(ex, opt) {
|
|
156
|
+
const proto = opt?.protocol || michelson_types_1.DefaultProtocol;
|
|
157
|
+
function mayRename(annots) {
|
|
158
|
+
return annots !== undefined ? [{ prim: 'RENAME', annots }] : [];
|
|
159
|
+
}
|
|
160
|
+
switch (ex.prim) {
|
|
161
|
+
// Compare
|
|
162
|
+
case 'CMPEQ':
|
|
163
|
+
case 'CMPNEQ':
|
|
164
|
+
case 'CMPLT':
|
|
165
|
+
case 'CMPGT':
|
|
166
|
+
case 'CMPLE':
|
|
167
|
+
case 'CMPGE':
|
|
168
|
+
if (assertArgs(ex, 0)) {
|
|
169
|
+
return [{ prim: 'COMPARE' }, mkPrim({ prim: ex.prim.slice(3), annots: ex.annots })];
|
|
170
|
+
}
|
|
171
|
+
break;
|
|
172
|
+
case 'IFEQ':
|
|
173
|
+
case 'IFNEQ':
|
|
174
|
+
case 'IFLT':
|
|
175
|
+
case 'IFGT':
|
|
176
|
+
case 'IFLE':
|
|
177
|
+
case 'IFGE':
|
|
178
|
+
if (assertArgs(ex, 2)) {
|
|
179
|
+
return [
|
|
180
|
+
{ prim: ex.prim.slice(2) },
|
|
181
|
+
mkPrim({ prim: 'IF', annots: ex.annots, args: ex.args }),
|
|
182
|
+
];
|
|
183
|
+
}
|
|
184
|
+
break;
|
|
185
|
+
case 'IFCMPEQ':
|
|
186
|
+
case 'IFCMPNEQ':
|
|
187
|
+
case 'IFCMPLT':
|
|
188
|
+
case 'IFCMPGT':
|
|
189
|
+
case 'IFCMPLE':
|
|
190
|
+
case 'IFCMPGE':
|
|
191
|
+
if (assertArgs(ex, 2)) {
|
|
192
|
+
return [
|
|
193
|
+
{ prim: 'COMPARE' },
|
|
194
|
+
{ prim: ex.prim.slice(5) },
|
|
195
|
+
mkPrim({ prim: 'IF', annots: ex.annots, args: ex.args }),
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
break;
|
|
199
|
+
// Fail
|
|
200
|
+
case 'FAIL':
|
|
201
|
+
if (assertArgs(ex, 0) && assertNoAnnots(ex)) {
|
|
202
|
+
return [{ prim: 'UNIT' }, { prim: 'FAILWITH' }];
|
|
203
|
+
}
|
|
204
|
+
break;
|
|
205
|
+
// Assertion macros
|
|
206
|
+
case 'ASSERT':
|
|
207
|
+
if (assertArgs(ex, 0) && assertNoAnnots(ex)) {
|
|
208
|
+
return [
|
|
209
|
+
{
|
|
210
|
+
prim: 'IF',
|
|
211
|
+
args: [[], [[{ prim: 'UNIT' }, { prim: 'FAILWITH' }]]],
|
|
212
|
+
},
|
|
213
|
+
];
|
|
214
|
+
}
|
|
215
|
+
break;
|
|
216
|
+
case 'ASSERT_EQ':
|
|
217
|
+
case 'ASSERT_NEQ':
|
|
218
|
+
case 'ASSERT_LT':
|
|
219
|
+
case 'ASSERT_GT':
|
|
220
|
+
case 'ASSERT_LE':
|
|
221
|
+
case 'ASSERT_GE':
|
|
222
|
+
if (assertArgs(ex, 0) && assertNoAnnots(ex)) {
|
|
223
|
+
return [
|
|
224
|
+
{ prim: ex.prim.slice(7) },
|
|
225
|
+
{
|
|
226
|
+
prim: 'IF',
|
|
227
|
+
args: [[], [[{ prim: 'UNIT' }, { prim: 'FAILWITH' }]]],
|
|
228
|
+
},
|
|
229
|
+
];
|
|
230
|
+
}
|
|
231
|
+
break;
|
|
232
|
+
case 'ASSERT_CMPEQ':
|
|
233
|
+
case 'ASSERT_CMPNEQ':
|
|
234
|
+
case 'ASSERT_CMPLT':
|
|
235
|
+
case 'ASSERT_CMPGT':
|
|
236
|
+
case 'ASSERT_CMPLE':
|
|
237
|
+
case 'ASSERT_CMPGE':
|
|
238
|
+
if (assertArgs(ex, 0) && assertNoAnnots(ex)) {
|
|
239
|
+
return [
|
|
240
|
+
[{ prim: 'COMPARE' }, { prim: ex.prim.slice(10) }],
|
|
241
|
+
{
|
|
242
|
+
prim: 'IF',
|
|
243
|
+
args: [[], [[{ prim: 'UNIT' }, { prim: 'FAILWITH' }]]],
|
|
244
|
+
},
|
|
245
|
+
];
|
|
246
|
+
}
|
|
247
|
+
break;
|
|
248
|
+
case 'ASSERT_NONE':
|
|
249
|
+
if (assertArgs(ex, 0) && assertNoAnnots(ex)) {
|
|
250
|
+
return [
|
|
251
|
+
{
|
|
252
|
+
prim: 'IF_NONE',
|
|
253
|
+
args: [[], [[{ prim: 'UNIT' }, { prim: 'FAILWITH' }]]],
|
|
254
|
+
},
|
|
255
|
+
];
|
|
256
|
+
}
|
|
257
|
+
break;
|
|
258
|
+
case 'ASSERT_SOME':
|
|
259
|
+
if (assertArgs(ex, 0)) {
|
|
260
|
+
return [
|
|
261
|
+
{
|
|
262
|
+
prim: 'IF_NONE',
|
|
263
|
+
args: [[[{ prim: 'UNIT' }, { prim: 'FAILWITH' }]], mayRename(ex.annots)],
|
|
264
|
+
},
|
|
265
|
+
];
|
|
266
|
+
}
|
|
267
|
+
break;
|
|
268
|
+
case 'ASSERT_LEFT':
|
|
269
|
+
if (assertArgs(ex, 0)) {
|
|
270
|
+
return [
|
|
271
|
+
{
|
|
272
|
+
prim: 'IF_LEFT',
|
|
273
|
+
args: [mayRename(ex.annots), [[{ prim: 'UNIT' }, { prim: 'FAILWITH' }]]],
|
|
274
|
+
},
|
|
275
|
+
];
|
|
276
|
+
}
|
|
277
|
+
break;
|
|
278
|
+
case 'ASSERT_RIGHT':
|
|
279
|
+
if (assertArgs(ex, 0)) {
|
|
280
|
+
return [
|
|
281
|
+
{
|
|
282
|
+
prim: 'IF_LEFT',
|
|
283
|
+
args: [[[{ prim: 'UNIT' }, { prim: 'FAILWITH' }]], mayRename(ex.annots)],
|
|
284
|
+
},
|
|
285
|
+
];
|
|
286
|
+
}
|
|
287
|
+
break;
|
|
288
|
+
// Syntactic conveniences
|
|
289
|
+
case 'IF_SOME':
|
|
290
|
+
if (assertArgs(ex, 2)) {
|
|
291
|
+
return [mkPrim({ prim: 'IF_NONE', annots: ex.annots, args: [ex.args[1], ex.args[0]] })];
|
|
292
|
+
}
|
|
293
|
+
break;
|
|
294
|
+
case 'IF_RIGHT':
|
|
295
|
+
if (assertArgs(ex, 2)) {
|
|
296
|
+
return [mkPrim({ prim: 'IF_LEFT', annots: ex.annots, args: [ex.args[1], ex.args[0]] })];
|
|
297
|
+
}
|
|
298
|
+
break;
|
|
299
|
+
// CAR/CDR n
|
|
300
|
+
case 'CAR':
|
|
301
|
+
case 'CDR':
|
|
302
|
+
if (ex.args !== undefined) {
|
|
303
|
+
if (assertArgs(ex, 1) && assertIntArg(ex, ex.args[0])) {
|
|
304
|
+
const n = parseInt(ex.args[0].int, 10);
|
|
305
|
+
return mkPrim({
|
|
306
|
+
prim: 'GET',
|
|
307
|
+
args: [{ int: ex.prim === 'CAR' ? String(n * 2 + 1) : String(n * 2) }],
|
|
308
|
+
annots: ex.annots,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
return ex;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
// More syntactic conveniences
|
|
317
|
+
// PAPPAIIR macro
|
|
318
|
+
if (pairRe.test(ex.prim)) {
|
|
319
|
+
if (assertArgs(ex, 0)) {
|
|
320
|
+
const { fields, rest } = filterAnnotations(ex.annots);
|
|
321
|
+
const { r } = parsePairUnpairExpr(ex, ex.prim.slice(1), fields, (l, r, top) => [
|
|
322
|
+
...(l || []),
|
|
323
|
+
...(r || []),
|
|
324
|
+
top,
|
|
325
|
+
]);
|
|
326
|
+
return r.map(([v, a], i) => {
|
|
327
|
+
const ann = [
|
|
328
|
+
...trimLast(a, null).map((v) => (v === null ? '%' : v)),
|
|
329
|
+
...(v === 0 && i === r.length - 1 ? rest : []),
|
|
330
|
+
];
|
|
331
|
+
const leaf = mkPrim({ prim: 'PAIR', annots: ann.length !== 0 ? ann : undefined });
|
|
332
|
+
return v === 0
|
|
333
|
+
? leaf
|
|
334
|
+
: {
|
|
335
|
+
prim: 'DIP',
|
|
336
|
+
args: v === 1 ? [[leaf]] : [{ int: String(v) }, [leaf]],
|
|
337
|
+
};
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
// UNPAPPAIIR macro
|
|
342
|
+
if (unpairRe.test(ex.prim)) {
|
|
343
|
+
if ((0, michelson_types_1.ProtoInferiorTo)(proto, michelson_types_1.Protocol.PtEdo2Zk) && assertArgs(ex, 0)) {
|
|
344
|
+
const { r } = parsePairUnpairExpr(ex, ex.prim.slice(3), ex.annots || [], (l, r, top) => [
|
|
345
|
+
top,
|
|
346
|
+
...(r || []),
|
|
347
|
+
...(l || []),
|
|
348
|
+
]);
|
|
349
|
+
return r.map(([v, a]) => {
|
|
350
|
+
const leaf = [
|
|
351
|
+
{ prim: 'DUP' },
|
|
352
|
+
mkPrim({ prim: 'CAR', annots: a[0] !== null ? [a[0]] : undefined }),
|
|
353
|
+
{
|
|
354
|
+
prim: 'DIP',
|
|
355
|
+
args: [[mkPrim({ prim: 'CDR', annots: a[1] !== null ? [a[1]] : undefined })]],
|
|
356
|
+
},
|
|
357
|
+
];
|
|
358
|
+
return v === 0
|
|
359
|
+
? leaf
|
|
360
|
+
: {
|
|
361
|
+
prim: 'DIP',
|
|
362
|
+
args: v === 1 ? [[leaf]] : [{ int: String(v) }, [leaf]],
|
|
363
|
+
};
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
if (ex.prim === 'UNPAIR') {
|
|
368
|
+
return ex;
|
|
369
|
+
}
|
|
370
|
+
if (assertArgs(ex, 0)) {
|
|
371
|
+
// 008_edo: annotations are deprecated
|
|
372
|
+
const { r } = parsePairUnpairExpr(ex, ex.prim.slice(3), [], (l, r, top) => [
|
|
373
|
+
top,
|
|
374
|
+
...(r || []),
|
|
375
|
+
...(l || []),
|
|
376
|
+
]);
|
|
377
|
+
return r.map(([v]) => {
|
|
378
|
+
const leaf = mkPrim({
|
|
379
|
+
prim: 'UNPAIR',
|
|
380
|
+
});
|
|
381
|
+
return v === 0
|
|
382
|
+
? leaf
|
|
383
|
+
: {
|
|
384
|
+
prim: 'DIP',
|
|
385
|
+
args: v === 1 ? [[leaf]] : [{ int: String(v) }, [leaf]],
|
|
386
|
+
};
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
// C[AD]+R macro
|
|
392
|
+
if (cadrRe.test(ex.prim)) {
|
|
393
|
+
if (assertArgs(ex, 0)) {
|
|
394
|
+
const ch = [...ex.prim.slice(1, ex.prim.length - 1)];
|
|
395
|
+
return ch.map((c, i) => {
|
|
396
|
+
const ann = i === ch.length - 1 ? ex.annots : undefined;
|
|
397
|
+
switch (c) {
|
|
398
|
+
case 'A':
|
|
399
|
+
return mkPrim({ prim: 'CAR', annots: ann });
|
|
400
|
+
case 'D':
|
|
401
|
+
return mkPrim({ prim: 'CDR', annots: ann });
|
|
402
|
+
default:
|
|
403
|
+
throw new MacroError(ex, `unexpected character: ${c}`);
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
// SET_C[AD]+R macro
|
|
409
|
+
if (setCadrRe.test(ex.prim)) {
|
|
410
|
+
if (assertArgs(ex, 0)) {
|
|
411
|
+
const { fields, rest } = filterAnnotations(ex.annots);
|
|
412
|
+
if (fields.length > 1) {
|
|
413
|
+
throw new MacroError(ex, `unexpected annotation on macro ${ex.prim}: ${fields}`);
|
|
414
|
+
}
|
|
415
|
+
const term = fields.length !== 0
|
|
416
|
+
? {
|
|
417
|
+
a: [
|
|
418
|
+
{ prim: 'DUP' },
|
|
419
|
+
{ prim: 'CAR', annots: fields },
|
|
420
|
+
{ prim: 'DROP' },
|
|
421
|
+
{ prim: 'CDR', annots: ['@%%'] },
|
|
422
|
+
{ prim: 'SWAP' },
|
|
423
|
+
{ prim: 'PAIR', annots: [fields[0], '%@'] },
|
|
424
|
+
],
|
|
425
|
+
d: [
|
|
426
|
+
{ prim: 'DUP' },
|
|
427
|
+
{ prim: 'CDR', annots: fields },
|
|
428
|
+
{ prim: 'DROP' },
|
|
429
|
+
{ prim: 'CAR', annots: ['@%%'] },
|
|
430
|
+
{ prim: 'PAIR', annots: ['%@', fields[0]] },
|
|
431
|
+
],
|
|
432
|
+
}
|
|
433
|
+
: {
|
|
434
|
+
a: [
|
|
435
|
+
{ prim: 'CDR', annots: ['@%%'] },
|
|
436
|
+
{ prim: 'SWAP' },
|
|
437
|
+
{ prim: 'PAIR', annots: ['%', '%@'] },
|
|
438
|
+
],
|
|
439
|
+
d: [
|
|
440
|
+
{ prim: 'CAR', annots: ['@%%'] },
|
|
441
|
+
{ prim: 'PAIR', annots: ['%@', '%'] },
|
|
442
|
+
],
|
|
443
|
+
};
|
|
444
|
+
return parseSetMapCadr(ex, ex.prim.slice(5, ex.prim.length - 1), rest, term);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
// MAP_C[AD]+R macro
|
|
448
|
+
if (mapCadrRe.test(ex.prim)) {
|
|
449
|
+
if (assertArgs(ex, 1)) {
|
|
450
|
+
const { fields } = filterAnnotations(ex.annots);
|
|
451
|
+
if (fields.length > 1) {
|
|
452
|
+
throw new MacroError(ex, `unexpected annotation on macro ${ex.prim}: ${fields}`);
|
|
453
|
+
}
|
|
454
|
+
const term = {
|
|
455
|
+
a: [
|
|
456
|
+
{ prim: 'DUP' },
|
|
457
|
+
{ prim: 'CDR', annots: ['@%%'] },
|
|
458
|
+
{
|
|
459
|
+
prim: 'DIP',
|
|
460
|
+
args: [
|
|
461
|
+
[
|
|
462
|
+
mkPrim({
|
|
463
|
+
prim: 'CAR',
|
|
464
|
+
annots: fields.length !== 0 ? ['@' + fields[0].slice(1)] : undefined,
|
|
465
|
+
}),
|
|
466
|
+
ex.args[0],
|
|
467
|
+
],
|
|
468
|
+
],
|
|
469
|
+
},
|
|
470
|
+
{ prim: 'SWAP' },
|
|
471
|
+
{ prim: 'PAIR', annots: [fields.length !== 0 ? fields[0] : '%', '%@'] },
|
|
472
|
+
],
|
|
473
|
+
d: [
|
|
474
|
+
{ prim: 'DUP' },
|
|
475
|
+
mkPrim({
|
|
476
|
+
prim: 'CDR',
|
|
477
|
+
annots: fields.length !== 0 ? ['@' + fields[0].slice(1)] : undefined,
|
|
478
|
+
}),
|
|
479
|
+
ex.args[0],
|
|
480
|
+
{ prim: 'SWAP' },
|
|
481
|
+
{ prim: 'CAR', annots: ['@%%'] },
|
|
482
|
+
{ prim: 'PAIR', annots: ['%@', fields.length !== 0 ? fields[0] : '%'] },
|
|
483
|
+
],
|
|
484
|
+
};
|
|
485
|
+
return parseSetMapCadr(ex, ex.prim.slice(5, ex.prim.length - 1), [], term);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
// Expand deprecated DI...IP to [DIP n]
|
|
489
|
+
if (diipRe.test(ex.prim)) {
|
|
490
|
+
if (assertArgs(ex, 1)) {
|
|
491
|
+
let n = 0;
|
|
492
|
+
while (ex.prim[1 + n] === 'I') {
|
|
493
|
+
n++;
|
|
494
|
+
}
|
|
495
|
+
return mkPrim({ prim: 'DIP', args: [{ int: String(n) }, ex.args[0]] });
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
// Expand DU...UP and DUP n
|
|
499
|
+
if (duupRe.test(ex.prim)) {
|
|
500
|
+
let n = 0;
|
|
501
|
+
while (ex.prim[1 + n] === 'U') {
|
|
502
|
+
n++;
|
|
503
|
+
}
|
|
504
|
+
if ((0, michelson_types_1.ProtoInferiorTo)(proto, michelson_types_1.Protocol.PtEdo2Zk)) {
|
|
505
|
+
if (n === 1) {
|
|
506
|
+
if (ex.args === undefined) {
|
|
507
|
+
return ex; // skip
|
|
508
|
+
}
|
|
509
|
+
if (assertArgs(ex, 1) && assertIntArg(ex, ex.args[0])) {
|
|
510
|
+
n = parseInt(ex.args[0].int, 10);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
else {
|
|
514
|
+
assertArgs(ex, 0);
|
|
515
|
+
}
|
|
516
|
+
if (n === 1) {
|
|
517
|
+
return [mkPrim({ prim: 'DUP', annots: ex.annots })];
|
|
518
|
+
}
|
|
519
|
+
else if (n === 2) {
|
|
520
|
+
return [
|
|
521
|
+
{
|
|
522
|
+
prim: 'DIP',
|
|
523
|
+
args: [[mkPrim({ prim: 'DUP', annots: ex.annots })]],
|
|
524
|
+
},
|
|
525
|
+
{ prim: 'SWAP' },
|
|
526
|
+
];
|
|
527
|
+
}
|
|
528
|
+
else {
|
|
529
|
+
return [
|
|
530
|
+
{
|
|
531
|
+
prim: 'DIP',
|
|
532
|
+
args: [{ int: String(n - 1) }, [mkPrim({ prim: 'DUP', annots: ex.annots })]],
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
prim: 'DIG',
|
|
536
|
+
args: [{ int: String(n) }],
|
|
537
|
+
},
|
|
538
|
+
];
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
else {
|
|
542
|
+
if (n === 1) {
|
|
543
|
+
return ex;
|
|
544
|
+
}
|
|
545
|
+
if (assertArgs(ex, 0)) {
|
|
546
|
+
return mkPrim({ prim: 'DUP', args: [{ int: String(n) }], annots: ex.annots });
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
return ex;
|
|
551
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.emitMicheline = emitMicheline;
|
|
4
|
+
const micheline_1 = require("./micheline");
|
|
5
|
+
class Formatter {
|
|
6
|
+
constructor(opt, lev = 0) {
|
|
7
|
+
this.opt = opt;
|
|
8
|
+
this.lev = lev;
|
|
9
|
+
}
|
|
10
|
+
indent(n = 0) {
|
|
11
|
+
let ret = '';
|
|
12
|
+
if (this.opt?.indent !== undefined) {
|
|
13
|
+
for (let i = this.lev + n; i > 0; i--) {
|
|
14
|
+
ret += this.opt.indent;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return ret;
|
|
18
|
+
}
|
|
19
|
+
get lf() {
|
|
20
|
+
return this.opt?.newline || '';
|
|
21
|
+
}
|
|
22
|
+
get lfsp() {
|
|
23
|
+
return this.opt?.newline || ' ';
|
|
24
|
+
}
|
|
25
|
+
down(n) {
|
|
26
|
+
return new Formatter(this.opt, this.lev + n);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function hasArgs(node) {
|
|
30
|
+
return ('prim' in node &&
|
|
31
|
+
((node.annots !== undefined && node.annots.length !== 0) ||
|
|
32
|
+
(node.args !== undefined && node.args.length !== 0)));
|
|
33
|
+
}
|
|
34
|
+
function isMultiline(node) {
|
|
35
|
+
if (node.args !== undefined) {
|
|
36
|
+
for (const a of node.args) {
|
|
37
|
+
if (Array.isArray(a) || hasArgs(a)) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
function emitExpr(node, f, foldMacros) {
|
|
45
|
+
const macro = node[micheline_1.sourceReference]?.macro;
|
|
46
|
+
if (foldMacros && macro) {
|
|
47
|
+
return emitExpr(macro, f, foldMacros);
|
|
48
|
+
}
|
|
49
|
+
if (Array.isArray(node)) {
|
|
50
|
+
return emitSeq(node, f, foldMacros);
|
|
51
|
+
}
|
|
52
|
+
else if ('string' in node) {
|
|
53
|
+
return JSON.stringify(node.string);
|
|
54
|
+
}
|
|
55
|
+
else if ('int' in node) {
|
|
56
|
+
return node.int;
|
|
57
|
+
}
|
|
58
|
+
else if ('bytes' in node) {
|
|
59
|
+
return '0x' + node.bytes;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
if ((node.annots === undefined || node.annots.length === 0) &&
|
|
63
|
+
(node.args === undefined || node.args.length === 0)) {
|
|
64
|
+
return node.prim;
|
|
65
|
+
}
|
|
66
|
+
let ret = '(' + node.prim;
|
|
67
|
+
if (node.annots !== undefined) {
|
|
68
|
+
for (const a of node.annots) {
|
|
69
|
+
ret += ' ' + a;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (node.args !== undefined) {
|
|
73
|
+
const multiline = isMultiline(node);
|
|
74
|
+
for (const a of node.args) {
|
|
75
|
+
if (multiline) {
|
|
76
|
+
ret += f.lfsp + f.indent(1) + emitExpr(a, f.down(1), foldMacros);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
ret += ' ' + emitExpr(a, f, foldMacros);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return ret + ')';
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function emitSeq(node, f, foldMacros) {
|
|
87
|
+
let ret = '{' + f.lf;
|
|
88
|
+
let i = node.length;
|
|
89
|
+
for (const el of node) {
|
|
90
|
+
ret += f.indent(1);
|
|
91
|
+
if ('prim' in el) {
|
|
92
|
+
ret += el.prim;
|
|
93
|
+
if (el.annots !== undefined) {
|
|
94
|
+
for (const a of el.annots) {
|
|
95
|
+
ret += ' ' + a;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (el.args !== undefined) {
|
|
99
|
+
const multiline = isMultiline(el);
|
|
100
|
+
for (const a of el.args) {
|
|
101
|
+
if (multiline) {
|
|
102
|
+
ret += f.lfsp + f.indent(2) + emitExpr(a, f.down(2), foldMacros);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
ret += ' ' + emitExpr(a, f, foldMacros);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
ret += emitExpr(el, f.down(1), foldMacros);
|
|
112
|
+
}
|
|
113
|
+
ret += i > 1 ? ';' + f.lfsp : f.lf;
|
|
114
|
+
i--;
|
|
115
|
+
}
|
|
116
|
+
return ret + f.indent() + '}';
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Formats Micheline expression
|
|
120
|
+
* @param expr An AST node
|
|
121
|
+
* @param opt Options
|
|
122
|
+
*/
|
|
123
|
+
function emitMicheline(expr, opt, foldMacros = false) {
|
|
124
|
+
if (typeof expr !== 'object') {
|
|
125
|
+
throw new TypeError(`object type was expected, got ${typeof expr} instead`);
|
|
126
|
+
}
|
|
127
|
+
return emitExpr(expr, new Formatter(opt), foldMacros);
|
|
128
|
+
}
|