@taquito/wallet-connect 24.3.0-beta.2 → 24.3.0-beta.3
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/dist/lib/{taquito-wallet-connect/src/taquito-wallet-connect.js → taquito-wallet-connect.js} +1 -4
- package/dist/lib/{taquito-http-utils/src/version.js → version.js} +2 -2
- package/package.json +5 -7
- package/dist/lib/taquito/src/batch/constants.js +0 -16
- package/dist/lib/taquito/src/batch/rpc-batch-provider.js +0 -327
- package/dist/lib/taquito/src/constants.js +0 -135
- package/dist/lib/taquito/src/context.js +0 -178
- package/dist/lib/taquito/src/contract/big-map.js +0 -57
- package/dist/lib/taquito/src/contract/compose.js +0 -6
- package/dist/lib/taquito/src/contract/constants.js +0 -4
- package/dist/lib/taquito/src/contract/contract-methods/contract-method-factory.js +0 -18
- package/dist/lib/taquito/src/contract/contract-methods/contract-method-interface.js +0 -2
- package/dist/lib/taquito/src/contract/contract-methods/contract-method-object-param.js +0 -72
- package/dist/lib/taquito/src/contract/contract-methods/contract-on-chain-view.js +0 -111
- package/dist/lib/taquito/src/contract/contract.js +0 -158
- package/dist/lib/taquito/src/contract/errors.js +0 -140
- package/dist/lib/taquito/src/contract/index.js +0 -30
- package/dist/lib/taquito/src/contract/interface.js +0 -2
- package/dist/lib/taquito/src/contract/manager-lambda.js +0 -71
- package/dist/lib/taquito/src/contract/prepare.js +0 -231
- package/dist/lib/taquito/src/contract/rpc-contract-provider.js +0 -675
- package/dist/lib/taquito/src/contract/sapling-state-abstraction.js +0 -24
- package/dist/lib/taquito/src/contract/semantic.js +0 -43
- package/dist/lib/taquito/src/contract/view_lambda.js +0 -27
- package/dist/lib/taquito/src/errors.js +0 -42
- package/dist/lib/taquito/src/estimate/errors.js +0 -16
- package/dist/lib/taquito/src/estimate/estimate-provider-interface.js +0 -2
- package/dist/lib/taquito/src/estimate/estimate.js +0 -176
- package/dist/lib/taquito/src/estimate/index.js +0 -20
- package/dist/lib/taquito/src/estimate/rpc-estimate-provider.js +0 -640
- package/dist/lib/taquito/src/extension/extension.js +0 -2
- package/dist/lib/taquito/src/forger/composite-forger.js +0 -32
- package/dist/lib/taquito/src/forger/errors.js +0 -30
- package/dist/lib/taquito/src/forger/rpc-forger.js +0 -12
- package/dist/lib/taquito/src/forger/taquito-local-forger.js +0 -21
- package/dist/lib/taquito/src/global-constants/default-global-constants-provider.js +0 -35
- package/dist/lib/taquito/src/global-constants/errors.js +0 -30
- package/dist/lib/taquito/src/global-constants/interface-global-constants-provider.js +0 -2
- package/dist/lib/taquito/src/global-constants/noop-global-constants-provider.js +0 -10
- package/dist/lib/taquito/src/import-key.js +0 -40
- package/dist/lib/taquito/src/injector/helper.js +0 -18
- package/dist/lib/taquito/src/injector/interface.js +0 -2
- package/dist/lib/taquito/src/injector/rpc-injector.js +0 -27
- package/dist/lib/taquito/src/operations/ballot-operation.js +0 -32
- package/dist/lib/taquito/src/operations/batch-operation.js +0 -69
- package/dist/lib/taquito/src/operations/delegate-operation.js +0 -54
- package/dist/lib/taquito/src/operations/drain-delegate-operation.js +0 -31
- package/dist/lib/taquito/src/operations/errors.js +0 -133
- package/dist/lib/taquito/src/operations/failing-noop-operation.js +0 -2
- package/dist/lib/taquito/src/operations/increase-paid-storage-operation.js +0 -49
- package/dist/lib/taquito/src/operations/index.js +0 -54
- package/dist/lib/taquito/src/operations/operations.js +0 -193
- package/dist/lib/taquito/src/operations/origination-operation.js +0 -78
- package/dist/lib/taquito/src/operations/proposals-operation.js +0 -29
- package/dist/lib/taquito/src/operations/register-global-constant-operation.js +0 -52
- package/dist/lib/taquito/src/operations/reveal-operation.js +0 -74
- package/dist/lib/taquito/src/operations/smart-rollup-add-messages-operation.js +0 -44
- package/dist/lib/taquito/src/operations/smart-rollup-execute-outbox-message-operation.js +0 -53
- package/dist/lib/taquito/src/operations/smart-rollup-originate-operation.js +0 -50
- package/dist/lib/taquito/src/operations/transaction-operation.js +0 -73
- package/dist/lib/taquito/src/operations/transfer-ticket-operation.js +0 -47
- package/dist/lib/taquito/src/operations/types.js +0 -88
- package/dist/lib/taquito/src/operations/update-companion-key-operation.js +0 -55
- package/dist/lib/taquito/src/operations/update-consensus-key-operation.js +0 -55
- package/dist/lib/taquito/src/packer/interface.js +0 -2
- package/dist/lib/taquito/src/packer/michel-codec-packer.js +0 -11
- package/dist/lib/taquito/src/packer/rpc-packer.js +0 -12
- package/dist/lib/taquito/src/parser/interface.js +0 -2
- package/dist/lib/taquito/src/parser/michel-codec-parser.js +0 -110
- package/dist/lib/taquito/src/parser/noop-parser.js +0 -9
- package/dist/lib/taquito/src/prepare/index.js +0 -18
- package/dist/lib/taquito/src/prepare/interface.js +0 -2
- package/dist/lib/taquito/src/prepare/prepare-provider.js +0 -1049
- package/dist/lib/taquito/src/provider.js +0 -363
- package/dist/lib/taquito/src/read-provider/interface.js +0 -2
- package/dist/lib/taquito/src/read-provider/rpc-read-adapter.js +0 -183
- package/dist/lib/taquito/src/signer/errors.js +0 -17
- package/dist/lib/taquito/src/signer/noop.js +0 -23
- package/dist/lib/taquito/src/subscribe/create-observable-from-subscription.js +0 -20
- package/dist/lib/taquito/src/subscribe/errors.js +0 -30
- package/dist/lib/taquito/src/subscribe/filters.js +0 -96
- package/dist/lib/taquito/src/subscribe/interface.js +0 -2
- package/dist/lib/taquito/src/subscribe/observable-subscription.js +0 -79
- package/dist/lib/taquito/src/subscribe/polling-subcribe-provider.js +0 -118
- package/dist/lib/taquito/src/taquito.js +0 -404
- package/dist/lib/taquito/src/tz/interface.js +0 -2
- package/dist/lib/taquito/src/tz/rpc-tz-provider.js +0 -46
- package/dist/lib/taquito/src/version.js +0 -8
- package/dist/lib/taquito/src/wallet/batch-operation.js +0 -71
- package/dist/lib/taquito/src/wallet/delegation-operation.js +0 -42
- package/dist/lib/taquito/src/wallet/errors.js +0 -40
- package/dist/lib/taquito/src/wallet/increase-paid-storage-operation.js +0 -42
- package/dist/lib/taquito/src/wallet/index.js +0 -25
- package/dist/lib/taquito/src/wallet/interface.js +0 -2
- package/dist/lib/taquito/src/wallet/legacy.js +0 -51
- package/dist/lib/taquito/src/wallet/operation-factory.js +0 -88
- package/dist/lib/taquito/src/wallet/operation.js +0 -221
- package/dist/lib/taquito/src/wallet/origination-operation.js +0 -53
- package/dist/lib/taquito/src/wallet/receipt.js +0 -46
- package/dist/lib/taquito/src/wallet/register-global-constant-operation.js +0 -45
- package/dist/lib/taquito/src/wallet/transaction-operation.js +0 -38
- package/dist/lib/taquito/src/wallet/transfer-ticket-operation.js +0 -38
- package/dist/lib/taquito/src/wallet/wallet.js +0 -445
- package/dist/lib/taquito-core/src/errors.js +0 -351
- package/dist/lib/taquito-core/src/signer-interfaces.js +0 -2
- package/dist/lib/taquito-core/src/taquito-core.js +0 -22
- package/dist/lib/taquito-http-utils/src/errors.js +0 -103
- package/dist/lib/taquito-http-utils/src/status_code.js +0 -322
- package/dist/lib/taquito-http-utils/src/taquito-http-utils.js +0 -308
- package/dist/lib/taquito-http-utils/src/transport-errors.js +0 -141
- package/dist/lib/taquito-local-forging/src/codec.js +0 -543
- package/dist/lib/taquito-local-forging/src/constants.js +0 -291
- package/dist/lib/taquito-local-forging/src/decoder.js +0 -64
- package/dist/lib/taquito-local-forging/src/encoder.js +0 -63
- package/dist/lib/taquito-local-forging/src/errors.js +0 -179
- package/dist/lib/taquito-local-forging/src/interface.js +0 -2
- package/dist/lib/taquito-local-forging/src/michelson/codec.js +0 -283
- package/dist/lib/taquito-local-forging/src/protocols.js +0 -60
- package/dist/lib/taquito-local-forging/src/schema/operation.js +0 -259
- package/dist/lib/taquito-local-forging/src/taquito-local-forging.js +0 -117
- package/dist/lib/taquito-local-forging/src/uint8array-consumer.js +0 -35
- package/dist/lib/taquito-local-forging/src/utils.js +0 -18
- package/dist/lib/taquito-local-forging/src/validator.js +0 -57
- package/dist/lib/taquito-local-forging/src/version.js +0 -8
- package/dist/lib/taquito-michel-codec/src/base58.js +0 -255
- package/dist/lib/taquito-michel-codec/src/binary.js +0 -1271
- package/dist/lib/taquito-michel-codec/src/errors.js +0 -90
- package/dist/lib/taquito-michel-codec/src/formatters.js +0 -58
- package/dist/lib/taquito-michel-codec/src/global-constants.js +0 -12
- package/dist/lib/taquito-michel-codec/src/macros.js +0 -551
- package/dist/lib/taquito-michel-codec/src/micheline-emitter.js +0 -128
- package/dist/lib/taquito-michel-codec/src/micheline-parser.js +0 -402
- package/dist/lib/taquito-michel-codec/src/micheline.js +0 -5
- package/dist/lib/taquito-michel-codec/src/michelson-contract.js +0 -93
- package/dist/lib/taquito-michel-codec/src/michelson-typecheck.js +0 -1756
- package/dist/lib/taquito-michel-codec/src/michelson-types.js +0 -83
- package/dist/lib/taquito-michel-codec/src/michelson-validator.js +0 -833
- package/dist/lib/taquito-michel-codec/src/scan.js +0 -128
- package/dist/lib/taquito-michel-codec/src/taquito-michel-codec.js +0 -38
- package/dist/lib/taquito-michel-codec/src/utils.js +0 -323
- package/dist/lib/taquito-michel-codec/src/version.js +0 -8
- package/dist/lib/taquito-michelson-encoder/src/constants.js +0 -11
- package/dist/lib/taquito-michelson-encoder/src/errors.js +0 -38
- package/dist/lib/taquito-michelson-encoder/src/michelson-map.js +0 -201
- package/dist/lib/taquito-michelson-encoder/src/schema/errors.js +0 -127
- package/dist/lib/taquito-michelson-encoder/src/schema/event-schema.js +0 -52
- package/dist/lib/taquito-michelson-encoder/src/schema/parameter.js +0 -113
- package/dist/lib/taquito-michelson-encoder/src/schema/storage.js +0 -260
- package/dist/lib/taquito-michelson-encoder/src/schema/types.js +0 -2
- package/dist/lib/taquito-michelson-encoder/src/schema/view-schema.js +0 -90
- package/dist/lib/taquito-michelson-encoder/src/taquito-michelson-encoder.js +0 -36
- package/dist/lib/taquito-michelson-encoder/src/tokens/bigmap.js +0 -130
- package/dist/lib/taquito-michelson-encoder/src/tokens/bls12-381-fr.js +0 -86
- package/dist/lib/taquito-michelson-encoder/src/tokens/bls12-381-g1.js +0 -76
- package/dist/lib/taquito-michelson-encoder/src/tokens/bls12-381-g2.js +0 -76
- package/dist/lib/taquito-michelson-encoder/src/tokens/chain-id.js +0 -78
- package/dist/lib/taquito-michelson-encoder/src/tokens/chest-key.js +0 -74
- package/dist/lib/taquito-michelson-encoder/src/tokens/chest.js +0 -74
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/address.js +0 -116
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/bool.js +0 -59
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/bytes.js +0 -90
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/int.js +0 -90
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/key_hash.js +0 -90
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/mutez.js +0 -90
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/nat.js +0 -93
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/string.js +0 -48
- package/dist/lib/taquito-michelson-encoder/src/tokens/comparable/timestamp.js +0 -66
- package/dist/lib/taquito-michelson-encoder/src/tokens/constant.js +0 -80
- package/dist/lib/taquito-michelson-encoder/src/tokens/contract.js +0 -86
- package/dist/lib/taquito-michelson-encoder/src/tokens/createToken.js +0 -35
- package/dist/lib/taquito-michelson-encoder/src/tokens/key.js +0 -97
- package/dist/lib/taquito-michelson-encoder/src/tokens/lambda.js +0 -55
- package/dist/lib/taquito-michelson-encoder/src/tokens/list.js +0 -85
- package/dist/lib/taquito-michelson-encoder/src/tokens/map.js +0 -112
- package/dist/lib/taquito-michelson-encoder/src/tokens/never.js +0 -61
- package/dist/lib/taquito-michelson-encoder/src/tokens/operation.js +0 -39
- package/dist/lib/taquito-michelson-encoder/src/tokens/option.js +0 -88
- package/dist/lib/taquito-michelson-encoder/src/tokens/or.js +0 -282
- package/dist/lib/taquito-michelson-encoder/src/tokens/pair.js +0 -233
- package/dist/lib/taquito-michelson-encoder/src/tokens/sapling-state.js +0 -84
- package/dist/lib/taquito-michelson-encoder/src/tokens/sapling-transaction-deprecated.js +0 -74
- package/dist/lib/taquito-michelson-encoder/src/tokens/sapling-transaction.js +0 -74
- package/dist/lib/taquito-michelson-encoder/src/tokens/set.js +0 -82
- package/dist/lib/taquito-michelson-encoder/src/tokens/signature.js +0 -82
- package/dist/lib/taquito-michelson-encoder/src/tokens/ticket-deprecated.js +0 -92
- package/dist/lib/taquito-michelson-encoder/src/tokens/ticket.js +0 -92
- package/dist/lib/taquito-michelson-encoder/src/tokens/token.js +0 -100
- package/dist/lib/taquito-michelson-encoder/src/tokens/tokens.js +0 -75
- package/dist/lib/taquito-michelson-encoder/src/tokens/unit.js +0 -52
- package/dist/lib/taquito-michelson-encoder/src/version.js +0 -8
- package/dist/lib/taquito-rpc/src/opkind.js +0 -49
- package/dist/lib/taquito-rpc/src/rpc-client-interface.js +0 -60
- package/dist/lib/taquito-rpc/src/rpc-client-modules/rpc-cache.js +0 -1118
- package/dist/lib/taquito-rpc/src/taquito-rpc.js +0 -990
- package/dist/lib/taquito-rpc/src/types.js +0 -114
- package/dist/lib/taquito-rpc/src/utils/utils.js +0 -65
- package/dist/lib/taquito-rpc/src/version.js +0 -8
- package/dist/lib/taquito-signer/src/bls-key.js +0 -104
- package/dist/lib/taquito-signer/src/derivation-tools/ecdsa.js +0 -156
- package/dist/lib/taquito-signer/src/derivation-tools/ed25519.js +0 -82
- package/dist/lib/taquito-signer/src/derivation-tools/index.js +0 -79
- package/dist/lib/taquito-signer/src/derivation-tools/types.js +0 -4
- package/dist/lib/taquito-signer/src/derivation-tools/utils.js +0 -16
- package/dist/lib/taquito-signer/src/ec-key.js +0 -196
- package/dist/lib/taquito-signer/src/ed-key.js +0 -130
- package/dist/lib/taquito-signer/src/errors.js +0 -77
- package/dist/lib/taquito-signer/src/helpers.js +0 -44
- package/dist/lib/taquito-signer/src/in-memory-signer.js +0 -240
- package/dist/lib/taquito-signer/src/key-interface.js +0 -6
- package/dist/lib/taquito-signer/src/taquito-signer.js +0 -28
- package/dist/lib/taquito-signer/src/version.js +0 -8
- package/dist/lib/taquito-utils/src/constants.js +0 -203
- package/dist/lib/taquito-utils/src/encoding.js +0 -606
- package/dist/lib/taquito-utils/src/errors.js +0 -45
- package/dist/lib/taquito-utils/src/format.js +0 -29
- package/dist/lib/taquito-utils/src/taquito-utils.js +0 -42
- package/dist/lib/taquito-utils/src/validators.js +0 -236
- package/dist/lib/taquito-utils/src/verify-signature.js +0 -136
- package/dist/lib/taquito-utils/src/version.js +0 -8
- package/dist/lib/taquito-wallet-connect/src/version.js +0 -8
- package/dist/types/taquito/src/batch/constants.d.ts +0 -3
- package/dist/types/taquito/src/batch/rpc-batch-provider.d.ts +0 -139
- package/dist/types/taquito/src/constants.d.ts +0 -81
- package/dist/types/taquito/src/context.d.ts +0 -100
- package/dist/types/taquito/src/contract/big-map.d.ts +0 -35
- package/dist/types/taquito/src/contract/compose.d.ts +0 -5
- package/dist/types/taquito/src/contract/constants.d.ts +0 -1
- package/dist/types/taquito/src/contract/contract-methods/contract-method-factory.d.ts +0 -14
- package/dist/types/taquito/src/contract/contract-methods/contract-method-interface.d.ts +0 -28
- package/dist/types/taquito/src/contract/contract-methods/contract-method-object-param.d.ts +0 -39
- package/dist/types/taquito/src/contract/contract-methods/contract-on-chain-view.d.ts +0 -43
- package/dist/types/taquito/src/contract/contract.d.ts +0 -75
- package/dist/types/taquito/src/contract/errors.d.ts +0 -83
- package/dist/types/taquito/src/contract/index.d.ts +0 -11
- package/dist/types/taquito/src/contract/interface.d.ts +0 -254
- package/dist/types/taquito/src/contract/manager-lambda.d.ts +0 -73
- package/dist/types/taquito/src/contract/prepare.d.ts +0 -18
- package/dist/types/taquito/src/contract/rpc-contract-provider.d.ts +0 -270
- package/dist/types/taquito/src/contract/sapling-state-abstraction.d.ts +0 -17
- package/dist/types/taquito/src/contract/semantic.d.ts +0 -7
- package/dist/types/taquito/src/contract/view_lambda.d.ts +0 -34
- package/dist/types/taquito/src/errors.d.ts +0 -26
- package/dist/types/taquito/src/estimate/errors.d.ts +0 -8
- package/dist/types/taquito/src/estimate/estimate-provider-interface.d.ts +0 -153
- package/dist/types/taquito/src/estimate/estimate.d.ts +0 -111
- package/dist/types/taquito/src/estimate/index.d.ts +0 -4
- package/dist/types/taquito/src/estimate/rpc-estimate-provider.d.ts +0 -174
- package/dist/types/taquito/src/extension/extension.d.ts +0 -4
- package/dist/types/taquito/src/forger/composite-forger.d.ts +0 -6
- package/dist/types/taquito/src/forger/errors.d.ts +0 -16
- package/dist/types/taquito/src/forger/rpc-forger.d.ts +0 -7
- package/dist/types/taquito/src/forger/taquito-local-forger.d.ts +0 -8
- package/dist/types/taquito/src/global-constants/default-global-constants-provider.d.ts +0 -18
- package/dist/types/taquito/src/global-constants/errors.d.ts +0 -16
- package/dist/types/taquito/src/global-constants/interface-global-constants-provider.d.ts +0 -11
- package/dist/types/taquito/src/global-constants/noop-global-constants-provider.d.ts +0 -5
- package/dist/types/taquito/src/import-key.d.ts +0 -13
- package/dist/types/taquito/src/injector/helper.d.ts +0 -2
- package/dist/types/taquito/src/injector/interface.d.ts +0 -5
- package/dist/types/taquito/src/injector/rpc-injector.d.ts +0 -7
- package/dist/types/taquito/src/operations/ballot-operation.d.ts +0 -18
- package/dist/types/taquito/src/operations/batch-operation.d.ts +0 -19
- package/dist/types/taquito/src/operations/delegate-operation.d.ts +0 -24
- package/dist/types/taquito/src/operations/drain-delegate-operation.d.ts +0 -17
- package/dist/types/taquito/src/operations/errors.d.ts +0 -50
- package/dist/types/taquito/src/operations/failing-noop-operation.d.ts +0 -17
- package/dist/types/taquito/src/operations/increase-paid-storage-operation.d.ts +0 -23
- package/dist/types/taquito/src/operations/index.d.ts +0 -18
- package/dist/types/taquito/src/operations/operations.d.ts +0 -35
- package/dist/types/taquito/src/operations/origination-operation.d.ts +0 -35
- package/dist/types/taquito/src/operations/proposals-operation.d.ts +0 -17
- package/dist/types/taquito/src/operations/register-global-constant-operation.d.ts +0 -25
- package/dist/types/taquito/src/operations/reveal-operation.d.ts +0 -25
- package/dist/types/taquito/src/operations/smart-rollup-add-messages-operation.d.ts +0 -20
- package/dist/types/taquito/src/operations/smart-rollup-execute-outbox-message-operation.d.ts +0 -24
- package/dist/types/taquito/src/operations/smart-rollup-originate-operation.d.ts +0 -23
- package/dist/types/taquito/src/operations/transaction-operation.d.ts +0 -28
- package/dist/types/taquito/src/operations/transfer-ticket-operation.d.ts +0 -22
- package/dist/types/taquito/src/operations/types.d.ts +0 -823
- package/dist/types/taquito/src/operations/update-companion-key-operation.d.ts +0 -23
- package/dist/types/taquito/src/operations/update-consensus-key-operation.d.ts +0 -23
- package/dist/types/taquito/src/packer/interface.d.ts +0 -4
- package/dist/types/taquito/src/packer/michel-codec-packer.d.ts +0 -5
- package/dist/types/taquito/src/packer/rpc-packer.d.ts +0 -8
- package/dist/types/taquito/src/parser/interface.d.ts +0 -4
- package/dist/types/taquito/src/parser/michel-codec-parser.d.ts +0 -16
- package/dist/types/taquito/src/parser/noop-parser.d.ts +0 -5
- package/dist/types/taquito/src/prepare/index.d.ts +0 -2
- package/dist/types/taquito/src/prepare/interface.d.ts +0 -152
- package/dist/types/taquito/src/prepare/prepare-provider.d.ts +0 -187
- package/dist/types/taquito/src/provider.d.ts +0 -50
- package/dist/types/taquito/src/read-provider/interface.d.ts +0 -132
- package/dist/types/taquito/src/read-provider/rpc-read-adapter.d.ts +0 -130
- package/dist/types/taquito/src/signer/errors.d.ts +0 -8
- package/dist/types/taquito/src/signer/noop.d.ts +0 -11
- package/dist/types/taquito/src/subscribe/create-observable-from-subscription.d.ts +0 -4
- package/dist/types/taquito/src/subscribe/errors.d.ts +0 -18
- package/dist/types/taquito/src/subscribe/filters.d.ts +0 -6
- package/dist/types/taquito/src/subscribe/interface.d.ts +0 -48
- package/dist/types/taquito/src/subscribe/observable-subscription.d.ts +0 -21
- package/dist/types/taquito/src/subscribe/polling-subcribe-provider.d.ts +0 -23
- package/dist/types/taquito/src/taquito.d.ts +0 -248
- package/dist/types/taquito/src/tz/interface.d.ts +0 -20
- package/dist/types/taquito/src/tz/rpc-tz-provider.d.ts +0 -13
- package/dist/types/taquito/src/version.d.ts +0 -4
- package/dist/types/taquito/src/wallet/batch-operation.d.ts +0 -13
- package/dist/types/taquito/src/wallet/delegation-operation.d.ts +0 -12
- package/dist/types/taquito/src/wallet/errors.d.ts +0 -24
- package/dist/types/taquito/src/wallet/increase-paid-storage-operation.d.ts +0 -12
- package/dist/types/taquito/src/wallet/index.d.ts +0 -9
- package/dist/types/taquito/src/wallet/interface.d.ts +0 -66
- package/dist/types/taquito/src/wallet/legacy.d.ts +0 -21
- package/dist/types/taquito/src/wallet/operation-factory.d.ts +0 -32
- package/dist/types/taquito/src/wallet/operation.d.ts +0 -55
- package/dist/types/taquito/src/wallet/origination-operation.d.ts +0 -14
- package/dist/types/taquito/src/wallet/receipt.d.ts +0 -16
- package/dist/types/taquito/src/wallet/register-global-constant-operation.d.ts +0 -13
- package/dist/types/taquito/src/wallet/transaction-operation.d.ts +0 -12
- package/dist/types/taquito/src/wallet/transfer-ticket-operation.d.ts +0 -12
- package/dist/types/taquito/src/wallet/wallet.d.ts +0 -196
- package/dist/types/taquito-core/src/errors.d.ts +0 -213
- package/dist/types/taquito-core/src/signer-interfaces.d.ts +0 -38
- package/dist/types/taquito-core/src/taquito-core.d.ts +0 -6
- package/dist/types/taquito-http-utils/src/errors.d.ts +0 -63
- package/dist/types/taquito-http-utils/src/status_code.d.ts +0 -318
- package/dist/types/taquito-http-utils/src/taquito-http-utils.d.ts +0 -58
- package/dist/types/taquito-http-utils/src/transport-errors.d.ts +0 -28
- package/dist/types/taquito-local-forging/src/codec.d.ts +0 -79
- package/dist/types/taquito-local-forging/src/constants.d.ts +0 -75
- package/dist/types/taquito-local-forging/src/decoder.d.ts +0 -5
- package/dist/types/taquito-local-forging/src/encoder.d.ts +0 -4
- package/dist/types/taquito-local-forging/src/errors.d.ts +0 -109
- package/dist/types/taquito-local-forging/src/interface.d.ts +0 -9
- package/dist/types/taquito-local-forging/src/michelson/codec.d.ts +0 -49
- package/dist/types/taquito-local-forging/src/protocols.d.ts +0 -27
- package/dist/types/taquito-local-forging/src/schema/operation.d.ts +0 -198
- package/dist/types/taquito-local-forging/src/taquito-local-forging.d.ts +0 -27
- package/dist/types/taquito-local-forging/src/uint8array-consumer.d.ts +0 -10
- package/dist/types/taquito-local-forging/src/utils.d.ts +0 -3
- package/dist/types/taquito-local-forging/src/validator.d.ts +0 -13
- package/dist/types/taquito-local-forging/src/version.d.ts +0 -4
- package/dist/types/taquito-michel-codec/src/base58.d.ts +0 -13
- package/dist/types/taquito-michel-codec/src/binary.d.ts +0 -127
- package/dist/types/taquito-michel-codec/src/errors.d.ts +0 -57
- package/dist/types/taquito-michel-codec/src/formatters.d.ts +0 -6
- package/dist/types/taquito-michel-codec/src/global-constants.d.ts +0 -3
- package/dist/types/taquito-michel-codec/src/macros.d.ts +0 -13
- package/dist/types/taquito-michel-codec/src/micheline-emitter.d.ts +0 -17
- package/dist/types/taquito-michel-codec/src/micheline-parser.d.ts +0 -130
- package/dist/types/taquito-michel-codec/src/micheline.d.ts +0 -44
- package/dist/types/taquito-michel-codec/src/michelson-contract.d.ts +0 -24
- package/dist/types/taquito-michel-codec/src/michelson-typecheck.d.ts +0 -38
- package/dist/types/taquito-michel-codec/src/michelson-types.d.ts +0 -147
- package/dist/types/taquito-michel-codec/src/michelson-validator.d.ts +0 -66
- package/dist/types/taquito-michel-codec/src/scan.d.ts +0 -26
- package/dist/types/taquito-michel-codec/src/taquito-michel-codec.d.ts +0 -16
- package/dist/types/taquito-michel-codec/src/utils.d.ts +0 -76
- package/dist/types/taquito-michel-codec/src/version.d.ts +0 -4
- package/dist/types/taquito-michelson-encoder/src/constants.d.ts +0 -8
- package/dist/types/taquito-michelson-encoder/src/errors.d.ts +0 -17
- package/dist/types/taquito-michelson-encoder/src/michelson-map.d.ts +0 -82
- package/dist/types/taquito-michelson-encoder/src/schema/errors.d.ts +0 -83
- package/dist/types/taquito-michelson-encoder/src/schema/event-schema.d.ts +0 -12
- package/dist/types/taquito-michelson-encoder/src/schema/parameter.d.ts +0 -54
- package/dist/types/taquito-michelson-encoder/src/schema/storage.d.ts +0 -97
- package/dist/types/taquito-michelson-encoder/src/schema/types.d.ts +0 -105
- package/dist/types/taquito-michelson-encoder/src/schema/view-schema.d.ts +0 -53
- package/dist/types/taquito-michelson-encoder/src/taquito-michelson-encoder.d.ts +0 -16
- package/dist/types/taquito-michelson-encoder/src/tokens/bigmap.d.ts +0 -51
- package/dist/types/taquito-michelson-encoder/src/tokens/bls12-381-fr.d.ts +0 -51
- package/dist/types/taquito-michelson-encoder/src/tokens/bls12-381-g1.d.ts +0 -47
- package/dist/types/taquito-michelson-encoder/src/tokens/bls12-381-g2.d.ts +0 -47
- package/dist/types/taquito-michelson-encoder/src/tokens/chain-id.d.ts +0 -51
- package/dist/types/taquito-michelson-encoder/src/tokens/chest-key.d.ts +0 -47
- package/dist/types/taquito-michelson-encoder/src/tokens/chest.d.ts +0 -47
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/address.d.ts +0 -61
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/bool.d.ts +0 -32
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/bytes.d.ts +0 -52
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/int.d.ts +0 -56
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/key_hash.d.ts +0 -55
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/mutez.d.ts +0 -53
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/nat.d.ts +0 -55
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/string.d.ts +0 -31
- package/dist/types/taquito-michelson-encoder/src/tokens/comparable/timestamp.d.ts +0 -34
- package/dist/types/taquito-michelson-encoder/src/tokens/constant.d.ts +0 -51
- package/dist/types/taquito-michelson-encoder/src/tokens/contract.d.ts +0 -48
- package/dist/types/taquito-michelson-encoder/src/tokens/createToken.d.ts +0 -18
- package/dist/types/taquito-michelson-encoder/src/tokens/key.d.ts +0 -55
- package/dist/types/taquito-michelson-encoder/src/tokens/lambda.d.ts +0 -24
- package/dist/types/taquito-michelson-encoder/src/tokens/list.d.ts +0 -46
- package/dist/types/taquito-michelson-encoder/src/tokens/map.d.ts +0 -47
- package/dist/types/taquito-michelson-encoder/src/tokens/never.d.ts +0 -41
- package/dist/types/taquito-michelson-encoder/src/tokens/operation.d.ts +0 -24
- package/dist/types/taquito-michelson-encoder/src/tokens/option.d.ts +0 -37
- package/dist/types/taquito-michelson-encoder/src/tokens/or.d.ts +0 -53
- package/dist/types/taquito-michelson-encoder/src/tokens/pair.d.ts +0 -50
- package/dist/types/taquito-michelson-encoder/src/tokens/sapling-state.d.ts +0 -44
- package/dist/types/taquito-michelson-encoder/src/tokens/sapling-transaction-deprecated.d.ts +0 -40
- package/dist/types/taquito-michelson-encoder/src/tokens/sapling-transaction.d.ts +0 -40
- package/dist/types/taquito-michelson-encoder/src/tokens/set.d.ts +0 -43
- package/dist/types/taquito-michelson-encoder/src/tokens/signature.d.ts +0 -53
- package/dist/types/taquito-michelson-encoder/src/tokens/ticket-deprecated.d.ts +0 -38
- package/dist/types/taquito-michelson-encoder/src/tokens/ticket.d.ts +0 -38
- package/dist/types/taquito-michelson-encoder/src/tokens/token.d.ts +0 -68
- package/dist/types/taquito-michelson-encoder/src/tokens/tokens.d.ts +0 -36
- package/dist/types/taquito-michelson-encoder/src/tokens/unit.d.ts +0 -34
- package/dist/types/taquito-michelson-encoder/src/version.d.ts +0 -4
- package/dist/types/taquito-rpc/src/opkind.d.ts +0 -45
- package/dist/types/taquito-rpc/src/rpc-client-interface.d.ts +0 -126
- package/dist/types/taquito-rpc/src/rpc-client-modules/rpc-cache.d.ts +0 -473
- package/dist/types/taquito-rpc/src/taquito-rpc.d.ts +0 -483
- package/dist/types/taquito-rpc/src/types.d.ts +0 -2362
- package/dist/types/taquito-rpc/src/utils/utils.d.ts +0 -14
- package/dist/types/taquito-rpc/src/version.d.ts +0 -4
- package/dist/types/taquito-signer/src/bls-key.d.ts +0 -21
- package/dist/types/taquito-signer/src/derivation-tools/ecdsa.d.ts +0 -49
- package/dist/types/taquito-signer/src/derivation-tools/ed25519.d.ts +0 -33
- package/dist/types/taquito-signer/src/derivation-tools/index.d.ts +0 -12
- package/dist/types/taquito-signer/src/derivation-tools/types.d.ts +0 -10
- package/dist/types/taquito-signer/src/derivation-tools/utils.d.ts +0 -1
- package/dist/types/taquito-signer/src/ec-key.d.ts +0 -42
- package/dist/types/taquito-signer/src/ed-key.d.ts +0 -39
- package/dist/types/taquito-signer/src/errors.d.ts +0 -51
- package/dist/types/taquito-signer/src/helpers.d.ts +0 -10
- package/dist/types/taquito-signer/src/in-memory-signer.d.ts +0 -56
- package/dist/types/taquito-signer/src/key-interface.d.ts +0 -37
- package/dist/types/taquito-signer/src/taquito-signer.d.ts +0 -10
- package/dist/types/taquito-signer/src/version.d.ts +0 -4
- package/dist/types/taquito-utils/src/constants.d.ts +0 -78
- package/dist/types/taquito-utils/src/encoding.d.ts +0 -184
- package/dist/types/taquito-utils/src/errors.d.ts +0 -20
- package/dist/types/taquito-utils/src/format.d.ts +0 -4
- package/dist/types/taquito-utils/src/taquito-utils.d.ts +0 -11
- package/dist/types/taquito-utils/src/validators.d.ts +0 -167
- package/dist/types/taquito-utils/src/verify-signature.d.ts +0 -22
- package/dist/types/taquito-utils/src/version.d.ts +0 -4
- package/dist/types/taquito-wallet-connect/src/version.d.ts +0 -4
- /package/dist/lib/{taquito-wallet-connect/src/errors.js → errors.js} +0 -0
- /package/dist/lib/{taquito-wallet-connect/src/types.js → types.js} +0 -0
- /package/dist/types/{taquito-wallet-connect/src/errors.d.ts → errors.d.ts} +0 -0
- /package/dist/types/{taquito-wallet-connect/src/taquito-wallet-connect.d.ts → taquito-wallet-connect.d.ts} +0 -0
- /package/dist/types/{taquito-wallet-connect/src/types.d.ts → types.d.ts} +0 -0
- /package/dist/types/{taquito-http-utils/src/version.d.ts → version.d.ts} +0 -0
|
@@ -1,675 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RpcContractProvider = void 0;
|
|
4
|
-
const http_utils_1 = require("@taquito/http-utils");
|
|
5
|
-
const michelson_encoder_1 = require("@taquito/michelson-encoder");
|
|
6
|
-
const rpc_1 = require("@taquito/rpc");
|
|
7
|
-
const utils_1 = require("@taquito/utils");
|
|
8
|
-
const core_1 = require("@taquito/core");
|
|
9
|
-
const rpc_batch_provider_1 = require("../batch/rpc-batch-provider");
|
|
10
|
-
const delegate_operation_1 = require("../operations/delegate-operation");
|
|
11
|
-
const origination_operation_1 = require("../operations/origination-operation");
|
|
12
|
-
const register_global_constant_operation_1 = require("../operations/register-global-constant-operation");
|
|
13
|
-
const reveal_operation_1 = require("../operations/reveal-operation");
|
|
14
|
-
const transaction_operation_1 = require("../operations/transaction-operation");
|
|
15
|
-
const contract_1 = require("./contract");
|
|
16
|
-
const errors_1 = require("./errors");
|
|
17
|
-
const semantic_1 = require("./semantic");
|
|
18
|
-
const transfer_ticket_operation_1 = require("../operations/transfer-ticket-operation");
|
|
19
|
-
const increase_paid_storage_operation_1 = require("../operations/increase-paid-storage-operation");
|
|
20
|
-
const ballot_operation_1 = require("../operations/ballot-operation");
|
|
21
|
-
const drain_delegate_operation_1 = require("../operations/drain-delegate-operation");
|
|
22
|
-
const proposals_operation_1 = require("../operations/proposals-operation");
|
|
23
|
-
const update_consensus_key_operation_1 = require("../operations/update-consensus-key-operation");
|
|
24
|
-
const update_companion_key_operation_1 = require("../operations/update-companion-key-operation");
|
|
25
|
-
const smart_rollup_add_messages_operation_1 = require("../operations/smart-rollup-add-messages-operation");
|
|
26
|
-
const smart_rollup_originate_operation_1 = require("../operations/smart-rollup-originate-operation");
|
|
27
|
-
const smart_rollup_execute_outbox_message_operation_1 = require("../operations/smart-rollup-execute-outbox-message-operation");
|
|
28
|
-
const provider_1 = require("../provider");
|
|
29
|
-
const prepare_1 = require("../prepare");
|
|
30
|
-
class RpcContractProvider extends provider_1.Provider {
|
|
31
|
-
constructor(context, estimator) {
|
|
32
|
-
super(context);
|
|
33
|
-
this.estimator = estimator;
|
|
34
|
-
this.contractProviderTypeSymbol = Symbol.for('taquito-contract-provider-type-symbol');
|
|
35
|
-
this.prepare = new prepare_1.PrepareProvider(this.context);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
* Return a well formatted json object of the contract storage
|
|
40
|
-
*
|
|
41
|
-
* @param contract contract address you want to get the storage from
|
|
42
|
-
* @param schema optional schema can either be the contract script rpc response or a michelson-encoder schema
|
|
43
|
-
* @throws {@link InvalidContractAddressError}
|
|
44
|
-
* @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-script
|
|
45
|
-
*/
|
|
46
|
-
async getStorage(contract, schema) {
|
|
47
|
-
const contractValidation = (0, utils_1.validateContractAddress)(contract);
|
|
48
|
-
if (contractValidation !== utils_1.ValidationResult.VALID) {
|
|
49
|
-
throw new core_1.InvalidContractAddressError(contract, contractValidation);
|
|
50
|
-
}
|
|
51
|
-
const script = await this.context.readProvider.getScript(contract, 'head');
|
|
52
|
-
if (!schema) {
|
|
53
|
-
schema = script;
|
|
54
|
-
}
|
|
55
|
-
let contractSchema;
|
|
56
|
-
if (michelson_encoder_1.Schema.isSchema(schema)) {
|
|
57
|
-
contractSchema = schema;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
contractSchema = michelson_encoder_1.Schema.fromRPCResponse({ script: schema });
|
|
61
|
-
}
|
|
62
|
-
return contractSchema.Execute(script.storage, (0, semantic_1.smartContractAbstractionSemantic)(this)); // Cast into T because only the caller can know the true type of the storage
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
66
|
-
* Return a well formatted json object of a big map value
|
|
67
|
-
*
|
|
68
|
-
* @param id Big Map ID
|
|
69
|
-
* @param keyToEncode key to query (will be encoded properly according to the schema)
|
|
70
|
-
* @param schema Big Map schema (can be determined using your contract type)
|
|
71
|
-
* @param block optional block level to fetch the values from
|
|
72
|
-
*
|
|
73
|
-
* @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-big-maps-big-map-id-script-expr
|
|
74
|
-
*/
|
|
75
|
-
async getBigMapKeyByID(id, keyToEncode, schema, block) {
|
|
76
|
-
const { key, type } = schema.EncodeBigMapKey(keyToEncode);
|
|
77
|
-
const { packed } = await this.context.packer.packData({ data: key, type });
|
|
78
|
-
const encodedExpr = (0, utils_1.encodeExpr)(packed);
|
|
79
|
-
const bigMapValue = block
|
|
80
|
-
? await this.context.readProvider.getBigMapValue({ id: id.toString(), expr: encodedExpr }, block)
|
|
81
|
-
: await this.context.readProvider.getBigMapValue({ id: id.toString(), expr: encodedExpr }, 'head');
|
|
82
|
-
return schema.ExecuteOnBigMapValue(bigMapValue, (0, semantic_1.smartContractAbstractionSemantic)(this));
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
*
|
|
86
|
-
* Fetch multiple values in a big map
|
|
87
|
-
* All values will be fetched on the same block level. If a block is specified in the request, the values will be fetched at it.
|
|
88
|
-
* Otherwise, a first request will be done to the node to fetch the level of the head and all values will be fetched at this level.
|
|
89
|
-
* If one of the keys does not exist in the big map, its value will be set to undefined.
|
|
90
|
-
*
|
|
91
|
-
* @param id Big Map ID
|
|
92
|
-
* @param keys Array of keys to query (will be encoded properly according to the schema)
|
|
93
|
-
* @param schema Big Map schema (can be determined using your contract type)
|
|
94
|
-
* @param block optional block level to fetch the values from
|
|
95
|
-
* @param batchSize optional batch size representing the number of requests to execute in parallel
|
|
96
|
-
* @returns A MichelsonMap containing the keys queried in the big map and their value in a well-formatted JSON object format
|
|
97
|
-
*
|
|
98
|
-
*/
|
|
99
|
-
async getBigMapKeysByID(id, keys, schema, block, batchSize = 5) {
|
|
100
|
-
const level = await this.getBlockForRequest(keys, block);
|
|
101
|
-
const bigMapValues = new michelson_encoder_1.MichelsonMap();
|
|
102
|
-
// Execute batch of promises in series
|
|
103
|
-
let position = 0;
|
|
104
|
-
let results = [];
|
|
105
|
-
while (position < keys.length) {
|
|
106
|
-
const keysBatch = keys.slice(position, position + batchSize);
|
|
107
|
-
const batch = keysBatch.map((keyToEncode) => this.getBigMapValueOrUndefined(keyToEncode, id, schema, level));
|
|
108
|
-
results = [...results, ...(await Promise.all(batch))];
|
|
109
|
-
position += batchSize;
|
|
110
|
-
}
|
|
111
|
-
for (let i = 0; i < results.length; i++) {
|
|
112
|
-
bigMapValues.set(keys[i], results[i]);
|
|
113
|
-
}
|
|
114
|
-
return bigMapValues;
|
|
115
|
-
}
|
|
116
|
-
async getBlockForRequest(keys, block) {
|
|
117
|
-
return keys.length === 1 || typeof block !== 'undefined'
|
|
118
|
-
? block
|
|
119
|
-
: await this.context.readProvider.getBlockLevel('head');
|
|
120
|
-
}
|
|
121
|
-
async getBigMapValueOrUndefined(keyToEncode, id, schema, level) {
|
|
122
|
-
try {
|
|
123
|
-
return await this.getBigMapKeyByID(id, keyToEncode, schema, level);
|
|
124
|
-
}
|
|
125
|
-
catch (ex) {
|
|
126
|
-
if (ex instanceof http_utils_1.HttpResponseError && ex.status === http_utils_1.STATUS_CODE.NOT_FOUND) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
throw ex;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
*
|
|
136
|
-
* Return a well formatted json object of a sapling state
|
|
137
|
-
*
|
|
138
|
-
* @param id Sapling state ID
|
|
139
|
-
* @param block optional block level to fetch the value from
|
|
140
|
-
*
|
|
141
|
-
*/
|
|
142
|
-
async getSaplingDiffByID(id, block) {
|
|
143
|
-
const saplingState = block
|
|
144
|
-
? await this.context.readProvider.getSaplingDiffById({ id: id.toString() }, block)
|
|
145
|
-
: await this.context.readProvider.getSaplingDiffById({ id: id.toString() }, 'head');
|
|
146
|
-
return saplingState;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
*
|
|
150
|
-
* Originate a new contract according to the script in parameters. Will sign and inject an operation using the current context
|
|
151
|
-
*
|
|
152
|
-
* @returns An operation handle with the result from the rpc node
|
|
153
|
-
*
|
|
154
|
-
* @warn You cannot specify storage and init at the same time (use init to pass the raw michelson representation of storage)
|
|
155
|
-
*
|
|
156
|
-
* @param params Originate operation parameter
|
|
157
|
-
*/
|
|
158
|
-
async originate(params) {
|
|
159
|
-
const estimate = await this.estimate(params, this.estimator.originate.bind(this.estimator));
|
|
160
|
-
const preparedOrigination = await this.prepare.originate({ ...params, ...estimate });
|
|
161
|
-
const content = preparedOrigination.opOb.contents.find((op) => op.kind === rpc_1.OpKind.ORIGINATION);
|
|
162
|
-
const forgedOrigination = await this.forge(preparedOrigination);
|
|
163
|
-
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(forgedOrigination);
|
|
164
|
-
return new origination_operation_1.OriginationOperation(hash, content, forgedBytes, opResponse, context, this);
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
*
|
|
168
|
-
* Set the delegate for a contract. Will sign and inject an operation using the current context
|
|
169
|
-
*
|
|
170
|
-
* @returns An operation handle with the result from the rpc node
|
|
171
|
-
*
|
|
172
|
-
* @param params SetDelegate operation parameter
|
|
173
|
-
*/
|
|
174
|
-
async setDelegate(params) {
|
|
175
|
-
const sourceValidation = (0, utils_1.validateAddress)(params.source ?? '');
|
|
176
|
-
if (params.source && sourceValidation !== utils_1.ValidationResult.VALID) {
|
|
177
|
-
throw new core_1.InvalidAddressError(params.source, sourceValidation);
|
|
178
|
-
}
|
|
179
|
-
const delegateValidation = (0, utils_1.validateAddress)(params.delegate ?? '');
|
|
180
|
-
if (params.delegate && delegateValidation !== utils_1.ValidationResult.VALID) {
|
|
181
|
-
throw new core_1.InvalidAddressError(params.delegate, delegateValidation);
|
|
182
|
-
}
|
|
183
|
-
// Since babylon delegation source cannot smart contract
|
|
184
|
-
if (/^kt1/i.test(params.source ?? '')) {
|
|
185
|
-
throw new errors_1.InvalidDelegationSource(params.source ?? '');
|
|
186
|
-
}
|
|
187
|
-
const publicKeyHash = await this.signer.publicKeyHash();
|
|
188
|
-
const sourceOrDefault = params.source || publicKeyHash;
|
|
189
|
-
const estimate = await this.estimate(params, this.estimator.setDelegate.bind(this.estimator));
|
|
190
|
-
const preparedDelegation = await this.prepare.delegation({ ...params, ...estimate });
|
|
191
|
-
const content = preparedDelegation.opOb.contents.find((op) => op.kind === rpc_1.OpKind.DELEGATION);
|
|
192
|
-
const opBytes = await this.forge(preparedDelegation);
|
|
193
|
-
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
|
|
194
|
-
return new delegate_operation_1.DelegateOperation(hash, content, sourceOrDefault, forgedBytes, opResponse, context);
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
*
|
|
198
|
-
* Register the current address as delegate. Will sign and inject an operation using the current context
|
|
199
|
-
*
|
|
200
|
-
* @returns An operation handle with the result from the rpc node
|
|
201
|
-
*
|
|
202
|
-
* @param params RegisterDelegate operation parameter
|
|
203
|
-
*/
|
|
204
|
-
async registerDelegate(params) {
|
|
205
|
-
const estimate = await this.estimate(params, this.estimator.registerDelegate.bind(this.estimator));
|
|
206
|
-
const source = await this.signer.publicKeyHash();
|
|
207
|
-
const prepared = await this.prepare.registerDelegate({ ...params, ...estimate });
|
|
208
|
-
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.DELEGATION);
|
|
209
|
-
const opBytes = await this.forge(prepared);
|
|
210
|
-
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
|
|
211
|
-
return new delegate_operation_1.DelegateOperation(hash, content, source, forgedBytes, opResponse, context);
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
*
|
|
215
|
-
* Transfer tz from current address to a specific address. Will sign and inject an operation using the current context
|
|
216
|
-
*
|
|
217
|
-
* @returns An operation handle with the result from the rpc node
|
|
218
|
-
*
|
|
219
|
-
* @param params Transfer operation parameter
|
|
220
|
-
*/
|
|
221
|
-
async transfer(params) {
|
|
222
|
-
const toValidation = (0, utils_1.validateAddress)(params.to);
|
|
223
|
-
if (toValidation !== utils_1.ValidationResult.VALID) {
|
|
224
|
-
throw new core_1.InvalidAddressError(params.to, toValidation);
|
|
225
|
-
}
|
|
226
|
-
const sourceValidation = (0, utils_1.validateAddress)(params.source ?? '');
|
|
227
|
-
if (params.source && sourceValidation !== utils_1.ValidationResult.VALID) {
|
|
228
|
-
throw new core_1.InvalidAddressError(params.source, sourceValidation);
|
|
229
|
-
}
|
|
230
|
-
if (params.amount < 0) {
|
|
231
|
-
throw new core_1.InvalidAmountError(params.amount.toString());
|
|
232
|
-
}
|
|
233
|
-
const publicKeyHash = await this.signer.publicKeyHash();
|
|
234
|
-
const estimate = await this.estimate(params, this.estimator.transfer.bind(this.estimator));
|
|
235
|
-
const source = params.source || publicKeyHash;
|
|
236
|
-
const prepared = await this.prepare.transaction({ ...params, ...estimate });
|
|
237
|
-
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.TRANSACTION);
|
|
238
|
-
const opBytes = await this.forge(prepared);
|
|
239
|
-
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
|
|
240
|
-
return new transaction_operation_1.TransactionOperation(hash, content, source, forgedBytes, opResponse, context);
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
*
|
|
244
|
-
* Stake a given amount for the source address
|
|
245
|
-
*
|
|
246
|
-
* @returns An operation handle with the result from the rpc node
|
|
247
|
-
*
|
|
248
|
-
* @param params Stake pseudo-operation parameter
|
|
249
|
-
*/
|
|
250
|
-
async stake(params) {
|
|
251
|
-
const sourceValidation = (0, utils_1.validateAddress)(params.source ?? '');
|
|
252
|
-
if (params.source && sourceValidation !== utils_1.ValidationResult.VALID) {
|
|
253
|
-
throw new core_1.InvalidAddressError(params.source, sourceValidation);
|
|
254
|
-
}
|
|
255
|
-
if (!params.to) {
|
|
256
|
-
params.to = params.source;
|
|
257
|
-
}
|
|
258
|
-
if (params.to && params.to !== params.source) {
|
|
259
|
-
throw new core_1.InvalidStakingAddressError(params.to);
|
|
260
|
-
}
|
|
261
|
-
if (params.amount < 0) {
|
|
262
|
-
throw new core_1.InvalidAmountError(params.amount.toString());
|
|
263
|
-
}
|
|
264
|
-
const publicKeyHash = await this.signer.publicKeyHash();
|
|
265
|
-
const estimate = await this.estimate(params, this.estimator.stake.bind(this.estimator));
|
|
266
|
-
const source = params.source || publicKeyHash;
|
|
267
|
-
const prepared = await this.prepare.stake({ ...params, ...estimate });
|
|
268
|
-
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.TRANSACTION);
|
|
269
|
-
const opBytes = await this.forge(prepared);
|
|
270
|
-
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
|
|
271
|
-
return new transaction_operation_1.TransactionOperation(hash, content, source, forgedBytes, opResponse, context);
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
*
|
|
275
|
-
* Unstake the given amount. If "everything" is given as amount, unstakes everything from the staking balance.
|
|
276
|
-
* Unstaked tez remains frozen for a set amount of cycles (the slashing period) after the operation. Once this period is over,
|
|
277
|
-
* the operation "finalize unstake" must be called for the funds to appear in the liquid balance.
|
|
278
|
-
*
|
|
279
|
-
* @returns An operation handle with the result from the rpc node
|
|
280
|
-
*
|
|
281
|
-
* @param params Unstake pseudo-operation parameter
|
|
282
|
-
*/
|
|
283
|
-
async unstake(params) {
|
|
284
|
-
const sourceValidation = (0, utils_1.validateAddress)(params.source ?? '');
|
|
285
|
-
if (params.source && sourceValidation !== utils_1.ValidationResult.VALID) {
|
|
286
|
-
throw new core_1.InvalidAddressError(params.source, sourceValidation);
|
|
287
|
-
}
|
|
288
|
-
if (!params.to) {
|
|
289
|
-
params.to = params.source;
|
|
290
|
-
}
|
|
291
|
-
if (params.to && params.to !== params.source) {
|
|
292
|
-
throw new core_1.InvalidStakingAddressError(params.to);
|
|
293
|
-
}
|
|
294
|
-
if (params.amount < 0) {
|
|
295
|
-
throw new core_1.InvalidAmountError(params.amount.toString());
|
|
296
|
-
}
|
|
297
|
-
const publicKeyHash = await this.signer.publicKeyHash();
|
|
298
|
-
const estimate = await this.estimate(params, this.estimator.unstake.bind(this.estimator));
|
|
299
|
-
const source = params.source || publicKeyHash;
|
|
300
|
-
const prepared = await this.prepare.unstake({ ...params, ...estimate });
|
|
301
|
-
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.TRANSACTION);
|
|
302
|
-
const opBytes = await this.forge(prepared);
|
|
303
|
-
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
|
|
304
|
-
return new transaction_operation_1.TransactionOperation(hash, content, source, forgedBytes, opResponse, context);
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
*
|
|
308
|
-
* Transfer all the finalizable unstaked funds of the source to their liquid balance
|
|
309
|
-
* @returns An operation handle with the result from the rpc node
|
|
310
|
-
*
|
|
311
|
-
* @param params Finalize_unstake pseudo-operation parameter
|
|
312
|
-
*/
|
|
313
|
-
async finalizeUnstake(params) {
|
|
314
|
-
const sourceValidation = (0, utils_1.validateAddress)(params.source ?? '');
|
|
315
|
-
if (params.source && sourceValidation !== utils_1.ValidationResult.VALID) {
|
|
316
|
-
throw new core_1.InvalidAddressError(params.source, sourceValidation);
|
|
317
|
-
}
|
|
318
|
-
if (!params.to) {
|
|
319
|
-
params.to = params.source;
|
|
320
|
-
}
|
|
321
|
-
if (!params.amount) {
|
|
322
|
-
params.amount = 0;
|
|
323
|
-
}
|
|
324
|
-
if (params.amount !== undefined && params.amount > 0) {
|
|
325
|
-
throw new core_1.InvalidFinalizeUnstakeAmountError('Amount must be 0 to finalize unstake.');
|
|
326
|
-
}
|
|
327
|
-
const publicKeyHash = await this.signer.publicKeyHash();
|
|
328
|
-
const estimate = await this.estimate(params, this.estimator.finalizeUnstake.bind(this.estimator));
|
|
329
|
-
const source = params.source || publicKeyHash;
|
|
330
|
-
const prepared = await this.prepare.finalizeUnstake({ ...params, ...estimate });
|
|
331
|
-
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.TRANSACTION);
|
|
332
|
-
const opBytes = await this.forge(prepared);
|
|
333
|
-
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
|
|
334
|
-
return new transaction_operation_1.TransactionOperation(hash, content, source, forgedBytes, opResponse, context);
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
*
|
|
338
|
-
* Transfer Tickets to a smart contract address
|
|
339
|
-
*
|
|
340
|
-
* @returns An operation handle with the result from the rpc node
|
|
341
|
-
*
|
|
342
|
-
* @param params TransferTicket operation parameter
|
|
343
|
-
*/
|
|
344
|
-
async transferTicket(params) {
|
|
345
|
-
const destinationValidation = (0, utils_1.validateAddress)(params.destination);
|
|
346
|
-
if (destinationValidation !== utils_1.ValidationResult.VALID) {
|
|
347
|
-
throw new core_1.InvalidAddressError(params.destination, destinationValidation);
|
|
348
|
-
}
|
|
349
|
-
const sourceValidation = (0, utils_1.validateAddress)(params.source ?? '');
|
|
350
|
-
if (params.source && sourceValidation !== utils_1.ValidationResult.VALID) {
|
|
351
|
-
throw new core_1.InvalidAddressError(params.source, sourceValidation);
|
|
352
|
-
}
|
|
353
|
-
const publicKeyHash = await this.signer.publicKeyHash();
|
|
354
|
-
const source = params.source ?? publicKeyHash;
|
|
355
|
-
const estimate = await this.estimate(params, this.estimator.transferTicket.bind(this.estimator));
|
|
356
|
-
const prepared = await this.prepare.transferTicket({ ...params, ...estimate });
|
|
357
|
-
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.TRANSFER_TICKET);
|
|
358
|
-
const opBytes = await this.forge(prepared);
|
|
359
|
-
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
|
|
360
|
-
return new transfer_ticket_operation_1.TransferTicketOperation(hash, content, source, forgedBytes, opResponse, context);
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
*
|
|
364
|
-
* Reveal the public key of the current address. Will throw an error if the address is already revealed.
|
|
365
|
-
* @returns An operation handle with the result from the rpc node
|
|
366
|
-
*
|
|
367
|
-
* @param params Reveal operation parameter
|
|
368
|
-
*/
|
|
369
|
-
async reveal(params) {
|
|
370
|
-
const publicKeyHash = await this.signer.publicKeyHash();
|
|
371
|
-
const [, pkhPrefix] = (0, utils_1.b58DecodeAndCheckPrefix)(publicKeyHash, utils_1.publicKeyHashPrefixes);
|
|
372
|
-
if (pkhPrefix === utils_1.PrefixV2.BLS12_381PublicKeyHash) {
|
|
373
|
-
if (params.proof) {
|
|
374
|
-
(0, utils_1.b58DecodeAndCheckPrefix)(params.proof, [utils_1.PrefixV2.BLS12_381Signature]); // validate proof to be a bls signature
|
|
375
|
-
}
|
|
376
|
-
else {
|
|
377
|
-
const { prefixSig } = await this.signer.provePossession();
|
|
378
|
-
params.proof = prefixSig;
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
else {
|
|
382
|
-
if (params.proof) {
|
|
383
|
-
throw new core_1.ProhibitedActionError('Proof field is only allowed to reveal a bls account ');
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
const estimateReveal = await this.estimator.reveal(params);
|
|
387
|
-
if (estimateReveal) {
|
|
388
|
-
const estimated = await this.estimate(params, async () => estimateReveal);
|
|
389
|
-
const prepared = await this.prepare.reveal({ ...params, ...estimated });
|
|
390
|
-
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.REVEAL);
|
|
391
|
-
const opBytes = await this.forge(prepared);
|
|
392
|
-
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
|
|
393
|
-
return new reveal_operation_1.RevealOperation(hash, content, publicKeyHash, forgedBytes, opResponse, context);
|
|
394
|
-
}
|
|
395
|
-
else {
|
|
396
|
-
throw new errors_1.RevealOperationError(`The publicKeyHash '${publicKeyHash}' has already been revealed.`);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
*
|
|
401
|
-
* Register a Micheline expression in a global table of constants. Will sign and inject an operation using the current context
|
|
402
|
-
*
|
|
403
|
-
* @returns An operation handle with the result from the rpc node
|
|
404
|
-
*
|
|
405
|
-
* @param params registerGlobalConstant operation parameter
|
|
406
|
-
*/
|
|
407
|
-
async registerGlobalConstant(params) {
|
|
408
|
-
const publicKeyHash = await this.signer.publicKeyHash();
|
|
409
|
-
const estimate = await this.estimate(params, this.estimator.registerGlobalConstant.bind(this.estimator));
|
|
410
|
-
const prepared = await this.prepare.registerGlobalConstant({ ...params, ...estimate });
|
|
411
|
-
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.REGISTER_GLOBAL_CONSTANT);
|
|
412
|
-
const opBytes = await this.forge(prepared);
|
|
413
|
-
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
|
|
414
|
-
return new register_global_constant_operation_1.RegisterGlobalConstantOperation(hash, content, publicKeyHash, forgedBytes, opResponse, context);
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
*
|
|
418
|
-
* Increase the paid storage of a smart contract
|
|
419
|
-
*
|
|
420
|
-
* @returns An operation handle with the result from the rpc node
|
|
421
|
-
*
|
|
422
|
-
* @param params increasePaidStorage operation parameter
|
|
423
|
-
*/
|
|
424
|
-
async increasePaidStorage(params) {
|
|
425
|
-
if (params.amount <= 0) {
|
|
426
|
-
throw new core_1.InvalidAmountError(params.amount.toString());
|
|
427
|
-
}
|
|
428
|
-
const publicKeyHash = await this.signer.publicKeyHash();
|
|
429
|
-
const estimate = await this.estimate(params, this.estimator.increasePaidStorage.bind(this.estimator));
|
|
430
|
-
const prepared = await this.prepare.increasePaidStorage({ ...params, ...estimate });
|
|
431
|
-
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.INCREASE_PAID_STORAGE);
|
|
432
|
-
const opBytes = await this.forge(prepared);
|
|
433
|
-
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
|
|
434
|
-
return new increase_paid_storage_operation_1.IncreasePaidStorageOperation(hash, content, publicKeyHash, forgedBytes, opResponse, context);
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
*
|
|
438
|
-
* Transfers the spendable balance of the delegate to destination when consensus_key is the active consensus key of delegate
|
|
439
|
-
*
|
|
440
|
-
* @returns An operation handle with the result from the rpc node
|
|
441
|
-
*
|
|
442
|
-
* @param params drainDelegate operation parameter
|
|
443
|
-
*/
|
|
444
|
-
async drainDelegate(params) {
|
|
445
|
-
const prepared = await this.prepare.drainDelegate(params);
|
|
446
|
-
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.DRAIN_DELEGATE);
|
|
447
|
-
const opBytes = await this.forge(prepared);
|
|
448
|
-
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
|
|
449
|
-
return new drain_delegate_operation_1.DrainDelegateOperation(hash, content, forgedBytes, opResponse, context);
|
|
450
|
-
}
|
|
451
|
-
/**
|
|
452
|
-
*
|
|
453
|
-
* Submit a ballot vote to a specified proposal
|
|
454
|
-
*
|
|
455
|
-
* @returns An operation handle with the result from the rpc node
|
|
456
|
-
*
|
|
457
|
-
* @param params Ballot operation parameter
|
|
458
|
-
*/
|
|
459
|
-
async ballot(params) {
|
|
460
|
-
const publicKeyHash = await this.signer.publicKeyHash();
|
|
461
|
-
const sourceValidation = (0, utils_1.validateAddress)(params.source ?? '');
|
|
462
|
-
if (params.source && sourceValidation !== utils_1.ValidationResult.VALID) {
|
|
463
|
-
throw new core_1.InvalidAddressError(params.source, sourceValidation);
|
|
464
|
-
}
|
|
465
|
-
const source = params.source ?? publicKeyHash;
|
|
466
|
-
const prepared = await this.prepare.ballot({ ...params, source });
|
|
467
|
-
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.BALLOT);
|
|
468
|
-
const opBytes = await this.forge(prepared);
|
|
469
|
-
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
|
|
470
|
-
return new ballot_operation_1.BallotOperation(hash, content, publicKeyHash, forgedBytes, opResponse, context);
|
|
471
|
-
}
|
|
472
|
-
/**
|
|
473
|
-
*
|
|
474
|
-
* Submit or upvote a proposal during the Proposal period
|
|
475
|
-
*
|
|
476
|
-
* @returns An operation handle with the result from the rpc node
|
|
477
|
-
*
|
|
478
|
-
* @param params Proposals operation parameter
|
|
479
|
-
*/
|
|
480
|
-
async proposals(params) {
|
|
481
|
-
const publicKeyHash = await this.signer.publicKeyHash();
|
|
482
|
-
const sourceValidation = (0, utils_1.validateAddress)(params.source ?? '');
|
|
483
|
-
if (params.source && sourceValidation !== utils_1.ValidationResult.VALID) {
|
|
484
|
-
throw new core_1.InvalidAddressError(params.source, sourceValidation);
|
|
485
|
-
}
|
|
486
|
-
const source = params.source ?? publicKeyHash;
|
|
487
|
-
const prepared = await this.prepare.proposals({ ...params, source });
|
|
488
|
-
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.PROPOSALS);
|
|
489
|
-
const opBytes = await this.forge(prepared);
|
|
490
|
-
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
|
|
491
|
-
return new proposals_operation_1.ProposalsOperation(hash, content, publicKeyHash, forgedBytes, opResponse, context);
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
*
|
|
495
|
-
* Update the consensus key of a delegate starting from the current cycle plus CONSENSUS_RIGHTS_DELAY + 1
|
|
496
|
-
* @returns An operation handle with the result from the rpc node
|
|
497
|
-
*
|
|
498
|
-
* @param params UpdateConsensusKey operation parameter
|
|
499
|
-
*/
|
|
500
|
-
async updateConsensusKey(params) {
|
|
501
|
-
const publicKeyHash = await this.signer.publicKeyHash();
|
|
502
|
-
const [, pkPrefix] = (0, utils_1.b58DecodeAndCheckPrefix)(params.pk, utils_1.publicKeyPrefixes);
|
|
503
|
-
if (pkPrefix === utils_1.PrefixV2.BLS12_381PublicKey) {
|
|
504
|
-
if (!params.proof) {
|
|
505
|
-
throw new core_1.InvalidProofError('Proof is required to set a bls account as consensus key ');
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
else {
|
|
509
|
-
if (params.proof) {
|
|
510
|
-
throw new core_1.ProhibitedActionError('Proof field is only allowed for a bls account as consensus key');
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
const estimate = await this.estimate(params, this.estimator.updateConsensusKey.bind(this.estimator));
|
|
514
|
-
const prepared = await this.prepare.updateConsensusKey({ ...params, ...estimate });
|
|
515
|
-
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.UPDATE_CONSENSUS_KEY);
|
|
516
|
-
const opBytes = await this.forge(prepared);
|
|
517
|
-
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
|
|
518
|
-
return new update_consensus_key_operation_1.UpdateConsensusKeyOperation(hash, content, publicKeyHash, forgedBytes, opResponse, context);
|
|
519
|
-
}
|
|
520
|
-
/**
|
|
521
|
-
*
|
|
522
|
-
* Updates the companion key of the delegate starting from the current cycle plus CONSENSUS_KEY_ACTIVATION_DELAY + 1
|
|
523
|
-
* @returns An operation handle with the result from the rpc node
|
|
524
|
-
*
|
|
525
|
-
* @param params UpdateCompanionKey operation parameter
|
|
526
|
-
*/
|
|
527
|
-
async updateCompanionKey(params) {
|
|
528
|
-
const publicKeyHash = await this.signer.publicKeyHash();
|
|
529
|
-
const [, pkPrefix] = (0, utils_1.b58DecodeAndCheckPrefix)(params.pk, utils_1.publicKeyPrefixes);
|
|
530
|
-
if (pkPrefix !== utils_1.PrefixV2.BLS12_381PublicKey) {
|
|
531
|
-
throw new core_1.ProhibitedActionError('Proof field is only allowed for a bls account as companion key');
|
|
532
|
-
}
|
|
533
|
-
if (!params.proof) {
|
|
534
|
-
throw new core_1.InvalidProofError('Proof is required to set a bls account as companion key ');
|
|
535
|
-
}
|
|
536
|
-
const estimate = await this.estimate(params, this.estimator.updateCompanionKey.bind(this.estimator));
|
|
537
|
-
const prepared = await this.prepare.updateCompanionKey({ ...params, ...estimate });
|
|
538
|
-
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.UPDATE_COMPANION_KEY);
|
|
539
|
-
const opBytes = await this.forge(prepared);
|
|
540
|
-
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
|
|
541
|
-
return new update_companion_key_operation_1.UpdateCompanionKeyOperation(hash, content, publicKeyHash, forgedBytes, opResponse, context);
|
|
542
|
-
}
|
|
543
|
-
/**
|
|
544
|
-
* Adds messages to the rollup inbox that can be executed/claimed after it gets cemented
|
|
545
|
-
* @param params SmartRollupAddMessages operation parameter
|
|
546
|
-
* @returns An operation handle with results from the RPC node
|
|
547
|
-
*/
|
|
548
|
-
async smartRollupAddMessages(params) {
|
|
549
|
-
const publicKeyHash = await this.signer.publicKeyHash();
|
|
550
|
-
const estimate = await this.estimate(params, this.estimator.smartRollupAddMessages.bind(this.estimator));
|
|
551
|
-
const prepared = await this.prepare.smartRollupAddMessages({ ...params, ...estimate });
|
|
552
|
-
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.SMART_ROLLUP_ADD_MESSAGES);
|
|
553
|
-
const opBytes = await this.forge(prepared);
|
|
554
|
-
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
|
|
555
|
-
return new smart_rollup_add_messages_operation_1.SmartRollupAddMessagesOperation(hash, content, publicKeyHash, forgedBytes, opResponse, context);
|
|
556
|
-
}
|
|
557
|
-
/**
|
|
558
|
-
* Creates a smart rollup originate operation
|
|
559
|
-
* @param params SmartRollupOriginate operation parameter
|
|
560
|
-
* @returns An operation handle with results from the RPC node
|
|
561
|
-
*/
|
|
562
|
-
async smartRollupOriginate(params) {
|
|
563
|
-
const publicKeyHash = await this.signer.publicKeyHash();
|
|
564
|
-
const estimate = await this.estimate(params, this.estimator.smartRollupOriginate.bind(this.estimator));
|
|
565
|
-
const prepared = await this.prepare.smartRollupOriginate({ ...params, ...estimate });
|
|
566
|
-
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.SMART_ROLLUP_ORIGINATE);
|
|
567
|
-
const opBytes = await this.forge(prepared);
|
|
568
|
-
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
|
|
569
|
-
return new smart_rollup_originate_operation_1.SmartRollupOriginateOperation(hash, content, publicKeyHash, forgedBytes, opResponse, context);
|
|
570
|
-
}
|
|
571
|
-
/**
|
|
572
|
-
* Execute a message from a smart rollup's outbox of a cemented commitment
|
|
573
|
-
* @param params SmartRollupExecuteOutboxMessage operation parameter
|
|
574
|
-
* @returns An operation handle with results from the RPC node
|
|
575
|
-
*/
|
|
576
|
-
async smartRollupExecuteOutboxMessage(params) {
|
|
577
|
-
const publicKeyHash = await this.signer.publicKeyHash();
|
|
578
|
-
const estimate = await this.estimate(params, this.estimator.smartRollupExecuteOutboxMessage.bind(this.estimator));
|
|
579
|
-
const prepared = await this.prepare.smartRollupExecuteOutboxMessage({ ...params, ...estimate });
|
|
580
|
-
const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE);
|
|
581
|
-
const opBytes = await this.forge(prepared);
|
|
582
|
-
const { hash, context, forgedBytes, opResponse } = await this.signAndInject(opBytes);
|
|
583
|
-
return new smart_rollup_execute_outbox_message_operation_1.SmartRollupExecuteOutboxMessageOperation(hash, content, publicKeyHash, forgedBytes, opResponse, context);
|
|
584
|
-
}
|
|
585
|
-
/**
|
|
586
|
-
*
|
|
587
|
-
* A failing_noop operation that is guaranteed to fail.
|
|
588
|
-
*
|
|
589
|
-
* @returns A FailingNoopOperation object representing the signed failing_noop operation
|
|
590
|
-
*
|
|
591
|
-
* @param params failingNoop operation parameter
|
|
592
|
-
*/
|
|
593
|
-
async failingNoop(params) {
|
|
594
|
-
const op = {
|
|
595
|
-
kind: rpc_1.OpKind.FAILING_NOOP,
|
|
596
|
-
arbitrary: params.arbitrary,
|
|
597
|
-
};
|
|
598
|
-
const hash = await this.context.readProvider.getBlockHash(params.basedOnBlock);
|
|
599
|
-
const forged = await this.context.forger.forge({
|
|
600
|
-
branch: hash,
|
|
601
|
-
contents: [op],
|
|
602
|
-
});
|
|
603
|
-
const { prefixSig } = await this.signer.sign(forged, new Uint8Array([3]));
|
|
604
|
-
return {
|
|
605
|
-
signature: prefixSig,
|
|
606
|
-
bytes: forged,
|
|
607
|
-
signedContent: {
|
|
608
|
-
branch: hash,
|
|
609
|
-
contents: [
|
|
610
|
-
{
|
|
611
|
-
kind: rpc_1.OpKind.FAILING_NOOP,
|
|
612
|
-
arbitrary: params.arbitrary,
|
|
613
|
-
},
|
|
614
|
-
],
|
|
615
|
-
},
|
|
616
|
-
};
|
|
617
|
-
}
|
|
618
|
-
/**
|
|
619
|
-
*
|
|
620
|
-
* Create an smart contract abstraction for the address specified.
|
|
621
|
-
*
|
|
622
|
-
* @param address Smart contract address
|
|
623
|
-
* @throws {@link InvalidContractAddressError}
|
|
624
|
-
*/
|
|
625
|
-
async at(address, contractAbstractionComposer = (x) => x, block = 'head') {
|
|
626
|
-
const addressValidation = (0, utils_1.validateContractAddress)(address);
|
|
627
|
-
if (addressValidation !== utils_1.ValidationResult.VALID) {
|
|
628
|
-
throw new core_1.InvalidContractAddressError(address, addressValidation);
|
|
629
|
-
}
|
|
630
|
-
const rpc = this.context.withExtensions().rpc;
|
|
631
|
-
const readProvider = this.context.withExtensions().readProvider;
|
|
632
|
-
const loadContractState = async (requestedBlock) => {
|
|
633
|
-
const script = await readProvider.getScript(address, requestedBlock);
|
|
634
|
-
const entrypoints = requestedBlock === 'head'
|
|
635
|
-
? await readProvider.getEntrypoints(address)
|
|
636
|
-
: await rpc.getEntrypoints(address, { block: String(requestedBlock) });
|
|
637
|
-
return { script, entrypoints };
|
|
638
|
-
};
|
|
639
|
-
let contractState;
|
|
640
|
-
try {
|
|
641
|
-
contractState = await loadContractState(block);
|
|
642
|
-
}
|
|
643
|
-
catch (error) {
|
|
644
|
-
// Shadownet's rolling nodes occasionally 404 a just-originated contract at the exact
|
|
645
|
-
// inclusion level even after confirmation. Retry at head so the contract abstraction still
|
|
646
|
-
// resolves once the node's contract index catches up.
|
|
647
|
-
if (block !== 'head' &&
|
|
648
|
-
error instanceof http_utils_1.HttpResponseError &&
|
|
649
|
-
error.status === http_utils_1.STATUS_CODE.NOT_FOUND) {
|
|
650
|
-
contractState = await loadContractState('head');
|
|
651
|
-
}
|
|
652
|
-
else {
|
|
653
|
-
throw error;
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
const abs = new contract_1.ContractAbstraction(address, contractState.script, this, this, contractState.entrypoints, rpc, readProvider);
|
|
657
|
-
return contractAbstractionComposer(abs, this.context);
|
|
658
|
-
}
|
|
659
|
-
/**
|
|
660
|
-
*
|
|
661
|
-
* Batch a group of operation together. Operations will be applied in the order in which they are added to the batch
|
|
662
|
-
*
|
|
663
|
-
* @returns A batch object from which we can add more operation or send a command to execute the batch
|
|
664
|
-
*
|
|
665
|
-
* @param params List of operation to batch together
|
|
666
|
-
*/
|
|
667
|
-
batch(params) {
|
|
668
|
-
const batch = new rpc_batch_provider_1.OperationBatch(this.context, this.estimator);
|
|
669
|
-
if (Array.isArray(params)) {
|
|
670
|
-
batch.with(params);
|
|
671
|
-
}
|
|
672
|
-
return batch;
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
exports.RpcContractProvider = RpcContractProvider;
|