wowok 2.1.10 → 2.1.13
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/cjs/bcs/bcs.d.ts +199 -199
- package/dist/cjs/bcs/bcs.js +273 -318
- package/dist/cjs/bcs/bcs.js.map +1 -0
- package/dist/cjs/bcs/effects.d.ts +109 -109
- package/dist/cjs/bcs/effects.js +205 -230
- package/dist/cjs/bcs/effects.js.map +1 -0
- package/dist/cjs/bcs/index.d.ts +1 -2584
- package/dist/cjs/bcs/index.js +61 -76
- package/dist/cjs/bcs/index.js.map +1 -0
- package/dist/cjs/bcs/pure.js +38 -58
- package/dist/cjs/bcs/pure.js.map +1 -0
- package/dist/cjs/bcs/type-tag-serializer.js +102 -114
- package/dist/cjs/bcs/type-tag-serializer.js.map +1 -0
- package/dist/cjs/bcs/types.js +6 -23
- package/dist/cjs/bcs/types.js.map +1 -0
- package/dist/cjs/client/index.js +17 -33
- package/dist/cjs/client/index.js.map +1 -0
- package/dist/cjs/client/network.js +25 -40
- package/dist/cjs/client/network.js.map +1 -0
- package/dist/cjs/cryptography/index.js +29 -45
- package/dist/cjs/cryptography/index.js.map +1 -0
- package/dist/cjs/cryptography/intent.d.ts +1 -1
- package/dist/cjs/cryptography/intent.js +20 -31
- package/dist/cjs/cryptography/intent.js.map +1 -0
- package/dist/cjs/cryptography/keypair.js +102 -116
- package/dist/cjs/cryptography/keypair.js.map +1 -0
- package/dist/cjs/cryptography/mnemonics.js +43 -41
- package/dist/cjs/cryptography/mnemonics.js.map +1 -0
- package/dist/cjs/cryptography/publickey.js +112 -134
- package/dist/cjs/cryptography/publickey.js.map +1 -0
- package/dist/cjs/cryptography/signature-scheme.js +24 -43
- package/dist/cjs/cryptography/signature-scheme.js.map +1 -0
- package/dist/cjs/cryptography/signature.d.ts +2 -24
- package/dist/cjs/cryptography/signature.js +50 -67
- package/dist/cjs/cryptography/signature.js.map +1 -0
- package/dist/cjs/experimental/cache.js +65 -0
- package/dist/cjs/experimental/cache.js.map +1 -0
- package/dist/cjs/experimental/client.js +27 -0
- package/dist/cjs/experimental/client.js.map +1 -0
- package/dist/cjs/experimental/core.js +89 -0
- package/dist/cjs/experimental/core.js.map +1 -0
- package/dist/cjs/experimental/errors.js +32 -0
- package/dist/cjs/experimental/errors.js.map +1 -0
- package/dist/cjs/experimental/index.js +15 -0
- package/dist/cjs/experimental/index.js.map +1 -0
- package/dist/cjs/experimental/persistent-storage.js +343 -0
- package/dist/cjs/experimental/persistent-storage.js.map +1 -0
- package/dist/cjs/experimental/persistent-storage.test.js +200 -0
- package/dist/cjs/experimental/persistent-storage.test.js.map +1 -0
- package/dist/cjs/experimental/transports/utils.js +104 -0
- package/dist/cjs/experimental/transports/utils.js.map +1 -0
- package/dist/cjs/experimental/types.js +6 -0
- package/dist/cjs/experimental/types.js.map +1 -0
- package/dist/cjs/faucet/faucet.js +106 -124
- package/dist/cjs/faucet/faucet.js.map +1 -0
- package/dist/cjs/faucet/index.js +12 -28
- package/dist/cjs/faucet/index.js.map +1 -0
- package/dist/cjs/grpc/client.js +47 -62
- package/dist/cjs/grpc/client.js.map +1 -0
- package/dist/cjs/grpc/core.js +580 -617
- package/dist/cjs/grpc/core.js.map +1 -0
- package/dist/cjs/grpc/index.js +9 -25
- package/dist/cjs/grpc/index.js.map +1 -0
- package/dist/cjs/grpc/proto/google/protobuf/any.js +168 -135
- package/dist/cjs/grpc/proto/google/protobuf/any.js.map +1 -0
- package/dist/cjs/grpc/proto/google/protobuf/duration.js +105 -90
- package/dist/cjs/grpc/proto/google/protobuf/duration.js.map +1 -0
- package/dist/cjs/grpc/proto/google/protobuf/empty.js +50 -28
- package/dist/cjs/grpc/proto/google/protobuf/empty.js.map +1 -0
- package/dist/cjs/grpc/proto/google/protobuf/field_mask.js +96 -75
- package/dist/cjs/grpc/proto/google/protobuf/field_mask.js.map +1 -0
- package/dist/cjs/grpc/proto/google/protobuf/struct.js +266 -215
- package/dist/cjs/grpc/proto/google/protobuf/struct.js.map +1 -0
- package/dist/cjs/grpc/proto/google/protobuf/timestamp.js +150 -131
- package/dist/cjs/grpc/proto/google/protobuf/timestamp.js.map +1 -0
- package/dist/cjs/grpc/proto/google/rpc/error_details.js +331 -302
- package/dist/cjs/grpc/proto/google/rpc/error_details.js.map +1 -0
- package/dist/cjs/grpc/proto/google/rpc/status.js +50 -50
- package/dist/cjs/grpc/proto/google/rpc/status.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/argument.js +84 -68
- package/dist/cjs/grpc/proto/sui/rpc/v2/argument.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.js +45 -50
- package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.js +38 -43
- package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.js +70 -75
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.js +79 -81
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.js +183 -166
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/effects.js +369 -296
- package/dist/cjs/grpc/proto/sui/rpc/v2/effects.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.js +80 -85
- package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.js +31 -28
- package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/event.js +81 -83
- package/dist/cjs/grpc/proto/sui/rpc/v2/event.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.js +80 -85
- package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.js +876 -506
- package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.js +56 -61
- package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/input.js +103 -83
- package/dist/cjs/grpc/proto/sui/rpc/v2/input.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.js +76 -78
- package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.js +69 -119
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.js +392 -350
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.js +599 -473
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.js +46 -78
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.js +242 -224
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.js +32 -52
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.js +139 -134
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/object.js +109 -111
- package/dist/cjs/grpc/proto/sui/rpc/v2/object.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.js +46 -51
- package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/owner.js +76 -61
- package/dist/cjs/grpc/proto/sui/rpc/v2/owner.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.js +46 -59
- package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature.js +568 -522
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.js +54 -32
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +27 -47
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.js +83 -86
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.js +53 -85
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.js +645 -529
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.js +37 -51
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.js +58 -61
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.js +749 -730
- package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.js +1218 -975
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +32 -46
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js.map +1 -0
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.js +186 -167
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.js.map +1 -0
- package/dist/cjs/index.js +96 -91
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/jsonRpc/client.js +654 -743
- package/dist/cjs/jsonRpc/client.js.map +1 -0
- package/dist/cjs/jsonRpc/core.d.ts +7 -7
- package/dist/cjs/jsonRpc/core.js +562 -606
- package/dist/cjs/jsonRpc/core.js.map +1 -0
- package/dist/cjs/jsonRpc/errors.js +38 -56
- package/dist/cjs/jsonRpc/errors.js.map +1 -0
- package/dist/cjs/jsonRpc/http-transport.js +70 -114
- package/dist/cjs/jsonRpc/http-transport.js.map +1 -0
- package/dist/cjs/jsonRpc/index.js +14 -30
- package/dist/cjs/jsonRpc/index.js.map +1 -0
- package/dist/cjs/jsonRpc/json-rpc-resolver.js +286 -290
- package/dist/cjs/jsonRpc/json-rpc-resolver.js.map +1 -0
- package/dist/cjs/jsonRpc/rpc-websocket-client.js +150 -207
- package/dist/cjs/jsonRpc/rpc-websocket-client.js.map +1 -0
- package/dist/cjs/jsonRpc/types/chain.js +4 -15
- package/dist/cjs/jsonRpc/types/chain.js.map +1 -0
- package/dist/cjs/jsonRpc/types/changes.js +4 -15
- package/dist/cjs/jsonRpc/types/changes.js.map +1 -0
- package/dist/cjs/jsonRpc/types/coins.js +4 -15
- package/dist/cjs/jsonRpc/types/coins.js.map +1 -0
- package/dist/cjs/jsonRpc/types/common.js +4 -15
- package/dist/cjs/jsonRpc/types/common.js.map +1 -0
- package/dist/cjs/jsonRpc/types/generated.d.ts +1 -1
- package/dist/cjs/jsonRpc/types/generated.js +4 -15
- package/dist/cjs/jsonRpc/types/generated.js.map +1 -0
- package/dist/cjs/jsonRpc/types/index.js +4 -15
- package/dist/cjs/jsonRpc/types/index.js.map +1 -0
- package/dist/cjs/jsonRpc/types/params.js +4 -15
- package/dist/cjs/jsonRpc/types/params.js.map +1 -0
- package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js +54 -69
- package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js.map +1 -0
- package/dist/cjs/keypairs/ed25519/index.js +10 -26
- package/dist/cjs/keypairs/ed25519/index.js.map +1 -0
- package/dist/cjs/keypairs/ed25519/keypair.js +134 -159
- package/dist/cjs/keypairs/ed25519/keypair.js.map +1 -0
- package/dist/cjs/keypairs/ed25519/publickey.js +70 -84
- package/dist/cjs/keypairs/ed25519/publickey.js.map +1 -0
- package/dist/cjs/keypairs/index.js +21 -19
- package/dist/cjs/keypairs/index.js.map +1 -0
- package/dist/cjs/keypairs/passkey/index.js +11 -27
- package/dist/cjs/keypairs/passkey/index.js.map +1 -0
- package/dist/cjs/keypairs/passkey/keypair.js +245 -256
- package/dist/cjs/keypairs/passkey/keypair.js.map +1 -0
- package/dist/cjs/keypairs/passkey/publickey.js +163 -162
- package/dist/cjs/keypairs/passkey/publickey.js.map +1 -0
- package/dist/cjs/keypairs/passkey/types.js +4 -15
- package/dist/cjs/keypairs/passkey/types.js.map +1 -0
- package/dist/cjs/keypairs/secp256k1/index.js +10 -26
- package/dist/cjs/keypairs/secp256k1/index.js.map +1 -0
- package/dist/cjs/keypairs/secp256k1/keypair.js +129 -151
- package/dist/cjs/keypairs/secp256k1/keypair.js.map +1 -0
- package/dist/cjs/keypairs/secp256k1/publickey.js +71 -89
- package/dist/cjs/keypairs/secp256k1/publickey.js.map +1 -0
- package/dist/cjs/keypairs/secp256r1/index.js +10 -26
- package/dist/cjs/keypairs/secp256r1/index.js.map +1 -0
- package/dist/cjs/keypairs/secp256r1/keypair.js +127 -148
- package/dist/cjs/keypairs/secp256r1/keypair.js.map +1 -0
- package/dist/cjs/keypairs/secp256r1/publickey.js +72 -90
- package/dist/cjs/keypairs/secp256r1/publickey.js.map +1 -0
- package/dist/cjs/multisig/index.js +10 -26
- package/dist/cjs/multisig/index.js.map +1 -0
- package/dist/cjs/multisig/publickey.d.ts +1 -1
- package/dist/cjs/multisig/publickey.js +228 -276
- package/dist/cjs/multisig/publickey.js.map +1 -0
- package/dist/cjs/multisig/signer.js +62 -110
- package/dist/cjs/multisig/signer.js.map +1 -0
- package/dist/cjs/transactions/Arguments.d.ts +4 -4
- package/dist/cjs/transactions/Arguments.js +13 -34
- package/dist/cjs/transactions/Arguments.js.map +1 -0
- package/dist/cjs/transactions/Commands.js +111 -141
- package/dist/cjs/transactions/Commands.js.map +1 -0
- package/dist/cjs/transactions/Inputs.js +53 -82
- package/dist/cjs/transactions/Inputs.js.map +1 -0
- package/dist/cjs/transactions/ObjectCache.d.ts +8 -8
- package/dist/cjs/transactions/ObjectCache.js +204 -241
- package/dist/cjs/transactions/ObjectCache.js.map +1 -0
- package/dist/cjs/transactions/Transaction.d.ts +31 -31
- package/dist/cjs/transactions/Transaction.js +628 -719
- package/dist/cjs/transactions/Transaction.js.map +1 -0
- package/dist/cjs/transactions/TransactionData.d.ts +9 -9
- package/dist/cjs/transactions/TransactionData.js +396 -440
- package/dist/cjs/transactions/TransactionData.js.map +1 -0
- package/dist/cjs/transactions/__tests__/Transaction.test.js +169 -0
- package/dist/cjs/transactions/__tests__/Transaction.test.js.map +1 -0
- package/dist/cjs/transactions/__tests__/bcs.test.js +202 -0
- package/dist/cjs/transactions/__tests__/bcs.test.js.map +1 -0
- package/dist/cjs/transactions/data/internal.js +166 -207
- package/dist/cjs/transactions/data/internal.js.map +1 -0
- package/dist/cjs/transactions/data/v1.js +436 -495
- package/dist/cjs/transactions/data/v1.js.map +1 -0
- package/dist/cjs/transactions/data/v2.d.ts +5 -5
- package/dist/cjs/transactions/data/v2.js +94 -107
- package/dist/cjs/transactions/data/v2.js.map +1 -0
- package/dist/cjs/transactions/executor/caching.js +71 -113
- package/dist/cjs/transactions/executor/caching.js.map +1 -0
- package/dist/cjs/transactions/executor/parallel.js +339 -378
- package/dist/cjs/transactions/executor/parallel.js.map +1 -0
- package/dist/cjs/transactions/executor/queue.js +60 -80
- package/dist/cjs/transactions/executor/queue.js.map +1 -0
- package/dist/cjs/transactions/executor/serial.d.ts +4 -4
- package/dist/cjs/transactions/executor/serial.js +102 -131
- package/dist/cjs/transactions/executor/serial.js.map +1 -0
- package/dist/cjs/transactions/hash.js +17 -28
- package/dist/cjs/transactions/hash.js.map +1 -0
- package/dist/cjs/transactions/index.js +33 -49
- package/dist/cjs/transactions/index.js.map +1 -0
- package/dist/cjs/transactions/intents/CoinWithBalance.js +137 -191
- package/dist/cjs/transactions/intents/CoinWithBalance.js.map +1 -0
- package/dist/cjs/transactions/object.js +88 -111
- package/dist/cjs/transactions/object.js.map +1 -0
- package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js +20 -32
- package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js.map +1 -0
- package/dist/cjs/transactions/pure.js +38 -60
- package/dist/cjs/transactions/pure.js.map +1 -0
- package/dist/cjs/transactions/resolve.js +62 -88
- package/dist/cjs/transactions/resolve.js.map +1 -0
- package/dist/cjs/transactions/serializer.js +150 -163
- package/dist/cjs/transactions/serializer.js.map +1 -0
- package/dist/cjs/transactions/utils.d.ts +1 -1
- package/dist/cjs/transactions/utils.js +114 -125
- package/dist/cjs/transactions/utils.js.map +1 -0
- package/dist/cjs/utils/constants.js +29 -56
- package/dist/cjs/utils/constants.js.map +1 -0
- package/dist/cjs/utils/derived-objects.js +14 -30
- package/dist/cjs/utils/derived-objects.js.map +1 -0
- package/dist/cjs/utils/dynamic-fields.js +20 -37
- package/dist/cjs/utils/dynamic-fields.js.map +1 -0
- package/dist/cjs/utils/format.js +14 -30
- package/dist/cjs/utils/format.js.map +1 -0
- package/dist/cjs/utils/index.js +50 -64
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/move-registry.js +37 -35
- package/dist/cjs/utils/move-registry.js.map +1 -0
- package/dist/cjs/utils/sui-types.js +74 -68
- package/dist/cjs/utils/sui-types.js.map +1 -0
- package/dist/cjs/utils/suins.js +30 -46
- package/dist/cjs/utils/suins.js.map +1 -0
- package/dist/cjs/verify/index.js +12 -27
- package/dist/cjs/verify/index.js.map +1 -0
- package/dist/cjs/verify/verify.js +83 -110
- package/dist/cjs/verify/verify.js.map +1 -0
- package/dist/cjs/version.js +8 -25
- package/dist/cjs/version.js.map +1 -0
- package/dist/cjs/w/call/allocation.js +323 -413
- package/dist/cjs/w/call/allocation.js.map +1 -0
- package/dist/cjs/w/call/arb.js +105 -136
- package/dist/cjs/w/call/arb.js.map +1 -0
- package/dist/cjs/w/call/arbitration.js +1206 -1581
- package/dist/cjs/w/call/arbitration.js.map +1 -0
- package/dist/cjs/w/call/base.js +303 -333
- package/dist/cjs/w/call/base.js.map +1 -0
- package/dist/cjs/w/call/contact.js +335 -452
- package/dist/cjs/w/call/contact.js.map +1 -0
- package/dist/cjs/w/call/demand.js +690 -844
- package/dist/cjs/w/call/demand.js.map +1 -0
- package/dist/cjs/w/call/entity.js +167 -201
- package/dist/cjs/w/call/entity.js.map +1 -0
- package/dist/cjs/w/call/guard-ins.js +4376 -4389
- package/dist/cjs/w/call/guard-ins.js.map +1 -0
- package/dist/cjs/w/call/guard.js +1078 -1112
- package/dist/cjs/w/call/guard.js.map +1 -0
- package/dist/cjs/w/call/index.js +69 -70
- package/dist/cjs/w/call/index.js.map +1 -0
- package/dist/cjs/w/call/machine.js +1105 -1419
- package/dist/cjs/w/call/machine.js.map +1 -0
- package/dist/cjs/w/call/order.js +314 -454
- package/dist/cjs/w/call/order.js.map +1 -0
- package/dist/cjs/w/call/passport.js +214 -253
- package/dist/cjs/w/call/passport.js.map +1 -0
- package/dist/cjs/w/call/payment.js +187 -224
- package/dist/cjs/w/call/payment.js.map +1 -0
- package/dist/cjs/w/call/permission.js +1183 -1294
- package/dist/cjs/w/call/permission.js.map +1 -0
- package/dist/cjs/w/call/personal.js +132 -170
- package/dist/cjs/w/call/personal.js.map +1 -0
- package/dist/cjs/w/call/progress.js +634 -794
- package/dist/cjs/w/call/progress.js.map +1 -0
- package/dist/cjs/w/call/proof.js +67 -116
- package/dist/cjs/w/call/proof.js.map +1 -0
- package/dist/cjs/w/call/repository.js +1037 -1251
- package/dist/cjs/w/call/repository.js.map +1 -0
- package/dist/cjs/w/call/resource.js +111 -131
- package/dist/cjs/w/call/resource.js.map +1 -0
- package/dist/cjs/w/call/reward.js +675 -853
- package/dist/cjs/w/call/reward.js.map +1 -0
- package/dist/cjs/w/call/service.js +1879 -2385
- package/dist/cjs/w/call/service.js.map +1 -0
- package/dist/cjs/w/call/treasury.js +841 -1138
- package/dist/cjs/w/call/treasury.js.map +1 -0
- package/dist/cjs/w/call/util.js +593 -624
- package/dist/cjs/w/call/util.js.map +1 -0
- package/dist/cjs/w/common.d.ts +1 -1
- package/dist/cjs/w/common.js +548 -518
- package/dist/cjs/w/common.js.map +1 -0
- package/dist/cjs/w/exception.js +574 -584
- package/dist/cjs/w/exception.js.map +1 -0
- package/dist/cjs/w/index.js +26 -23
- package/dist/cjs/w/index.js.map +1 -0
- package/dist/cjs/w/local/account.js +664 -741
- package/dist/cjs/w/local/account.js.map +1 -0
- package/dist/cjs/w/local/cache.js +180 -166
- package/dist/cjs/w/local/cache.js.map +1 -0
- package/dist/cjs/w/local/config.js +51 -80
- package/dist/cjs/w/local/config.js.map +1 -0
- package/dist/cjs/w/local/index.js +225 -290
- package/dist/cjs/w/local/index.js.map +1 -0
- package/dist/cjs/w/local/local.d.ts +2 -2
- package/dist/cjs/w/local/local.js +638 -646
- package/dist/cjs/w/local/local.js.map +1 -0
- package/dist/cjs/w/local/storage.js +210 -164
- package/dist/cjs/w/local/storage.js.map +1 -0
- package/dist/cjs/w/local/token.js +158 -175
- package/dist/cjs/w/local/token.js.map +1 -0
- package/dist/cjs/w/local/util.js +80 -51
- package/dist/cjs/w/local/util.js.map +1 -0
- package/dist/cjs/w/local/wip.js +1078 -802
- package/dist/cjs/w/local/wip.js.map +1 -0
- package/dist/cjs/w/messenger/crypto.js +496 -389
- package/dist/cjs/w/messenger/crypto.js.map +1 -0
- package/dist/cjs/w/messenger/index.js +53 -35
- package/dist/cjs/w/messenger/index.js.map +1 -0
- package/dist/cjs/w/messenger/messenger-api.js +1159 -1035
- package/dist/cjs/w/messenger/messenger-api.js.map +1 -0
- package/dist/cjs/w/messenger/messenger-manager.js +954 -1083
- package/dist/cjs/w/messenger/messenger-manager.js.map +1 -0
- package/dist/cjs/w/messenger/messenger.d.ts +1 -1
- package/dist/cjs/w/messenger/messenger.js +1304 -1450
- package/dist/cjs/w/messenger/messenger.js.map +1 -0
- package/dist/cjs/w/messenger/server.js +390 -512
- package/dist/cjs/w/messenger/server.js.map +1 -0
- package/dist/cjs/w/messenger/session.js +399 -403
- package/dist/cjs/w/messenger/session.js.map +1 -0
- package/dist/cjs/w/messenger/storage.js +881 -777
- package/dist/cjs/w/messenger/storage.js.map +1 -0
- package/dist/cjs/w/messenger/types.d.ts +2 -2
- package/dist/cjs/w/messenger/types.js +83 -103
- package/dist/cjs/w/messenger/types.js.map +1 -0
- package/dist/cjs/w/messenger/utils.js +29 -34
- package/dist/cjs/w/messenger/utils.js.map +1 -0
- package/dist/cjs/w/query/bult-in.js +101 -110
- package/dist/cjs/w/query/bult-in.js.map +1 -0
- package/dist/cjs/w/query/event.js +134 -146
- package/dist/cjs/w/query/event.js.map +1 -0
- package/dist/cjs/w/query/index.js +22 -20
- package/dist/cjs/w/query/index.js.map +1 -0
- package/dist/cjs/w/query/object.js +1576 -1576
- package/dist/cjs/w/query/object.js.map +1 -0
- package/dist/cjs/w/query/received.js +66 -88
- package/dist/cjs/w/query/received.js.map +1 -0
- package/dist/cjs/w/query/util.js +53 -77
- package/dist/cjs/w/query/util.js.map +1 -0
- package/dist/cjs/w/util.js +589 -675
- package/dist/cjs/w/util.js.map +1 -0
- package/dist/esm/bcs/bcs.d.ts +199 -199
- package/dist/esm/bcs/bcs.js +269 -310
- package/dist/esm/bcs/bcs.js.map +1 -0
- package/dist/esm/bcs/effects.d.ts +109 -109
- package/dist/esm/bcs/effects.js +171 -179
- package/dist/esm/bcs/effects.js.map +1 -0
- package/dist/esm/bcs/index.d.ts +1 -2584
- package/dist/esm/bcs/index.js +51 -94
- package/dist/esm/bcs/index.js.map +1 -0
- package/dist/esm/bcs/pure.js +35 -38
- package/dist/esm/bcs/pure.js.map +1 -0
- package/dist/esm/bcs/type-tag-serializer.js +98 -95
- package/dist/esm/bcs/type-tag-serializer.js.map +1 -0
- package/dist/esm/bcs/types.js +5 -5
- package/dist/esm/bcs/types.js.map +1 -0
- package/dist/esm/client/index.js +7 -23
- package/dist/esm/client/index.js.map +1 -0
- package/dist/esm/client/network.js +23 -22
- package/dist/esm/client/network.js.map +1 -0
- package/dist/esm/cryptography/index.js +9 -46
- package/dist/esm/cryptography/index.js.map +1 -0
- package/dist/esm/cryptography/intent.d.ts +1 -1
- package/dist/esm/cryptography/intent.js +18 -12
- package/dist/esm/cryptography/intent.js.map +1 -0
- package/dist/esm/cryptography/keypair.js +95 -99
- package/dist/esm/cryptography/keypair.js.map +1 -0
- package/dist/esm/cryptography/mnemonics.js +40 -24
- package/dist/esm/cryptography/mnemonics.js.map +1 -0
- package/dist/esm/cryptography/publickey.js +104 -115
- package/dist/esm/cryptography/publickey.js.map +1 -0
- package/dist/esm/cryptography/signature-scheme.js +22 -24
- package/dist/esm/cryptography/signature-scheme.js.map +1 -0
- package/dist/esm/cryptography/signature.d.ts +2 -24
- package/dist/esm/cryptography/signature.js +44 -48
- package/dist/esm/cryptography/signature.js.map +1 -0
- package/dist/esm/experimental/cache.js +61 -0
- package/dist/esm/experimental/cache.js.map +1 -0
- package/dist/esm/experimental/client.js +23 -0
- package/dist/esm/experimental/client.js.map +1 -0
- package/dist/esm/experimental/core.js +85 -0
- package/dist/esm/experimental/core.js.map +1 -0
- package/dist/esm/experimental/errors.js +27 -0
- package/dist/esm/experimental/errors.js.map +1 -0
- package/dist/esm/experimental/index.js +8 -0
- package/dist/esm/experimental/index.js.map +1 -0
- package/dist/esm/experimental/persistent-storage.js +337 -0
- package/dist/esm/experimental/persistent-storage.js.map +1 -0
- package/dist/esm/experimental/persistent-storage.test.js +198 -0
- package/dist/esm/experimental/persistent-storage.test.js.map +1 -0
- package/dist/esm/experimental/transports/utils.js +100 -0
- package/dist/esm/experimental/transports/utils.js.map +1 -0
- package/dist/esm/experimental/types.js +5 -0
- package/dist/esm/experimental/types.js.map +1 -0
- package/dist/esm/faucet/faucet.js +104 -111
- package/dist/esm/faucet/faucet.js.map +1 -0
- package/dist/esm/faucet/index.js +4 -16
- package/dist/esm/faucet/index.js.map +1 -0
- package/dist/esm/grpc/client.js +34 -34
- package/dist/esm/grpc/client.js.map +1 -0
- package/dist/esm/grpc/core.js +570 -601
- package/dist/esm/grpc/core.js.map +1 -0
- package/dist/esm/grpc/index.js +5 -6
- package/dist/esm/grpc/index.js.map +1 -0
- package/dist/esm/grpc/proto/google/protobuf/any.js +161 -111
- package/dist/esm/grpc/proto/google/protobuf/any.js.map +1 -0
- package/dist/esm/grpc/proto/google/protobuf/duration.js +99 -67
- package/dist/esm/grpc/proto/google/protobuf/duration.js.map +1 -0
- package/dist/esm/grpc/proto/google/protobuf/empty.js +46 -7
- package/dist/esm/grpc/proto/google/protobuf/empty.js.map +1 -0
- package/dist/esm/grpc/proto/google/protobuf/field_mask.js +90 -52
- package/dist/esm/grpc/proto/google/protobuf/field_mask.js.map +1 -0
- package/dist/esm/grpc/proto/google/protobuf/struct.js +258 -190
- package/dist/esm/grpc/proto/google/protobuf/struct.js.map +1 -0
- package/dist/esm/grpc/proto/google/protobuf/timestamp.js +144 -108
- package/dist/esm/grpc/proto/google/protobuf/timestamp.js.map +1 -0
- package/dist/esm/grpc/proto/google/rpc/error_details.js +313 -267
- package/dist/esm/grpc/proto/google/rpc/error_details.js.map +1 -0
- package/dist/esm/grpc/proto/google/rpc/status.js +45 -28
- package/dist/esm/grpc/proto/google/rpc/status.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/argument.js +80 -47
- package/dist/esm/grpc/proto/sui/rpc/v2/argument.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.js +41 -29
- package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/bcs.js +34 -22
- package/dist/esm/grpc/proto/sui/rpc/v2/bcs.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.js +61 -49
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.js +72 -57
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.js +173 -139
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/effects.js +358 -268
- package/dist/esm/grpc/proto/sui/rpc/v2/effects.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/epoch.js +72 -60
- package/dist/esm/grpc/proto/sui/rpc/v2/epoch.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.js +29 -9
- package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/event.js +74 -59
- package/dist/esm/grpc/proto/sui/rpc/v2/event.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.js +69 -57
- package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.js +861 -474
- package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.js +52 -40
- package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/input.js +98 -61
- package/dist/esm/grpc/proto/sui/rpc/v2/input.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/jwk.js +71 -56
- package/dist/esm/grpc/proto/sui/rpc/v2/jwk.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.js +65 -100
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.js +365 -306
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package.js +585 -442
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.js +42 -59
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.js +226 -191
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.client.js +28 -33
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.js +129 -107
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/object.js +100 -85
- package/dist/esm/grpc/proto/sui/rpc/v2/object.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.js +42 -30
- package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/owner.js +72 -40
- package/dist/esm/grpc/proto/sui/rpc/v2/owner.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.js +42 -38
- package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature.js +544 -481
- package/dist/esm/grpc/proto/sui/rpc/v2/signature.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.js +52 -13
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +23 -28
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.js +74 -60
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.js +49 -66
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.js +623 -490
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.js +33 -32
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.js +50 -36
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/system_state.js +737 -701
- package/dist/esm/grpc/proto/sui/rpc/v2/system_state.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction.js +1177 -917
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +28 -27
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js.map +1 -0
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.js +169 -133
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.js.map +1 -0
- package/dist/esm/index.js +21 -107
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/jsonRpc/client.js +646 -727
- package/dist/esm/jsonRpc/client.js.map +1 -0
- package/dist/esm/jsonRpc/core.d.ts +7 -7
- package/dist/esm/jsonRpc/core.js +550 -581
- package/dist/esm/jsonRpc/core.js.map +1 -0
- package/dist/esm/jsonRpc/errors.js +36 -41
- package/dist/esm/jsonRpc/errors.js.map +1 -0
- package/dist/esm/jsonRpc/http-transport.js +65 -93
- package/dist/esm/jsonRpc/http-transport.js.map +1 -0
- package/dist/esm/jsonRpc/index.js +6 -20
- package/dist/esm/jsonRpc/index.js.map +1 -0
- package/dist/esm/jsonRpc/json-rpc-resolver.js +281 -276
- package/dist/esm/jsonRpc/json-rpc-resolver.js.map +1 -0
- package/dist/esm/jsonRpc/rpc-websocket-client.js +147 -189
- package/dist/esm/jsonRpc/rpc-websocket-client.js.map +1 -0
- package/dist/esm/jsonRpc/types/chain.js +4 -0
- package/dist/esm/jsonRpc/types/chain.js.map +1 -0
- package/dist/esm/jsonRpc/types/changes.js +4 -0
- package/dist/esm/jsonRpc/types/changes.js.map +1 -0
- package/dist/esm/jsonRpc/types/coins.js +4 -0
- package/dist/esm/jsonRpc/types/coins.js.map +1 -0
- package/dist/esm/jsonRpc/types/common.js +4 -0
- package/dist/esm/jsonRpc/types/common.js.map +1 -0
- package/dist/esm/jsonRpc/types/generated.d.ts +1 -1
- package/dist/esm/jsonRpc/types/generated.js +4 -0
- package/dist/esm/jsonRpc/types/generated.js.map +1 -0
- package/dist/esm/jsonRpc/types/index.js +4 -0
- package/dist/esm/jsonRpc/types/index.js.map +1 -0
- package/dist/esm/jsonRpc/types/params.js +4 -0
- package/dist/esm/jsonRpc/types/params.js.map +1 -0
- package/dist/esm/keypairs/ed25519/ed25519-hd-key.js +49 -48
- package/dist/esm/keypairs/ed25519/ed25519-hd-key.js.map +1 -0
- package/dist/esm/keypairs/ed25519/index.js +5 -10
- package/dist/esm/keypairs/ed25519/index.js.map +1 -0
- package/dist/esm/keypairs/ed25519/keypair.js +128 -146
- package/dist/esm/keypairs/ed25519/keypair.js.map +1 -0
- package/dist/esm/keypairs/ed25519/publickey.js +64 -67
- package/dist/esm/keypairs/ed25519/publickey.js.map +1 -0
- package/dist/esm/keypairs/index.js +3 -0
- package/dist/esm/keypairs/index.js.map +1 -0
- package/dist/esm/keypairs/passkey/index.js +5 -12
- package/dist/esm/keypairs/passkey/index.js.map +1 -0
- package/dist/esm/keypairs/passkey/keypair.js +236 -243
- package/dist/esm/keypairs/passkey/keypair.js.map +1 -0
- package/dist/esm/keypairs/passkey/publickey.js +154 -140
- package/dist/esm/keypairs/passkey/publickey.js.map +1 -0
- package/dist/esm/keypairs/passkey/types.js +4 -0
- package/dist/esm/keypairs/passkey/types.js.map +1 -0
- package/dist/esm/keypairs/secp256k1/index.js +5 -10
- package/dist/esm/keypairs/secp256k1/index.js.map +1 -0
- package/dist/esm/keypairs/secp256k1/keypair.js +120 -134
- package/dist/esm/keypairs/secp256k1/keypair.js.map +1 -0
- package/dist/esm/keypairs/secp256k1/publickey.js +64 -71
- package/dist/esm/keypairs/secp256k1/publickey.js.map +1 -0
- package/dist/esm/keypairs/secp256r1/index.js +5 -10
- package/dist/esm/keypairs/secp256r1/index.js.map +1 -0
- package/dist/esm/keypairs/secp256r1/keypair.js +118 -131
- package/dist/esm/keypairs/secp256r1/keypair.js.map +1 -0
- package/dist/esm/keypairs/secp256r1/publickey.js +63 -66
- package/dist/esm/keypairs/secp256r1/publickey.js.map +1 -0
- package/dist/esm/multisig/index.js +5 -10
- package/dist/esm/multisig/index.js.map +1 -0
- package/dist/esm/multisig/publickey.d.ts +1 -1
- package/dist/esm/multisig/publickey.js +216 -253
- package/dist/esm/multisig/publickey.js.map +1 -0
- package/dist/esm/multisig/signer.js +57 -89
- package/dist/esm/multisig/signer.js.map +1 -0
- package/dist/esm/transactions/Arguments.d.ts +4 -4
- package/dist/esm/transactions/Arguments.js +9 -13
- package/dist/esm/transactions/Arguments.js.map +1 -0
- package/dist/esm/transactions/Commands.js +105 -118
- package/dist/esm/transactions/Commands.js.map +1 -0
- package/dist/esm/transactions/Inputs.js +49 -61
- package/dist/esm/transactions/Inputs.js.map +1 -0
- package/dist/esm/transactions/ObjectCache.d.ts +8 -8
- package/dist/esm/transactions/ObjectCache.js +200 -223
- package/dist/esm/transactions/ObjectCache.js.map +1 -0
- package/dist/esm/transactions/Transaction.d.ts +32 -32
- package/dist/esm/transactions/Transaction.js +611 -696
- package/dist/esm/transactions/Transaction.js.map +1 -0
- package/dist/esm/transactions/TransactionData.d.ts +9 -9
- package/dist/esm/transactions/TransactionData.js +386 -415
- package/dist/esm/transactions/TransactionData.js.map +1 -0
- package/dist/esm/transactions/__tests__/Transaction.test.js +167 -0
- package/dist/esm/transactions/__tests__/Transaction.test.js.map +1 -0
- package/dist/esm/transactions/__tests__/bcs.test.js +200 -0
- package/dist/esm/transactions/__tests__/bcs.test.js.map +1 -0
- package/dist/esm/transactions/data/internal.js +158 -205
- package/dist/esm/transactions/data/internal.js.map +1 -0
- package/dist/esm/transactions/data/v1.js +419 -487
- package/dist/esm/transactions/data/v1.js.map +1 -0
- package/dist/esm/transactions/data/v2.d.ts +5 -5
- package/dist/esm/transactions/data/v2.js +89 -107
- package/dist/esm/transactions/data/v2.js.map +1 -0
- package/dist/esm/transactions/executor/caching.d.ts +2 -2
- package/dist/esm/transactions/executor/caching.js +66 -93
- package/dist/esm/transactions/executor/caching.js.map +1 -0
- package/dist/esm/transactions/executor/parallel.js +329 -352
- package/dist/esm/transactions/executor/parallel.js.map +1 -0
- package/dist/esm/transactions/executor/queue.js +58 -64
- package/dist/esm/transactions/executor/queue.js.map +1 -0
- package/dist/esm/transactions/executor/serial.d.ts +5 -5
- package/dist/esm/transactions/executor/serial.js +96 -110
- package/dist/esm/transactions/executor/serial.js.map +1 -0
- package/dist/esm/transactions/hash.js +15 -9
- package/dist/esm/transactions/hash.js.map +1 -0
- package/dist/esm/transactions/index.js +15 -41
- package/dist/esm/transactions/index.js.map +1 -0
- package/dist/esm/transactions/intents/CoinWithBalance.js +127 -165
- package/dist/esm/transactions/intents/CoinWithBalance.js.map +1 -0
- package/dist/esm/transactions/object.js +86 -92
- package/dist/esm/transactions/object.js.map +1 -0
- package/dist/esm/transactions/plugins/NamedPackagesPlugin.js +18 -15
- package/dist/esm/transactions/plugins/NamedPackagesPlugin.js.map +1 -0
- package/dist/esm/transactions/pure.js +34 -39
- package/dist/esm/transactions/pure.js.map +1 -0
- package/dist/esm/transactions/resolve.js +58 -69
- package/dist/esm/transactions/resolve.js.map +1 -0
- package/dist/esm/transactions/serializer.js +145 -144
- package/dist/esm/transactions/serializer.js.map +1 -0
- package/dist/esm/transactions/utils.d.ts +1 -1
- package/dist/esm/transactions/utils.js +110 -109
- package/dist/esm/transactions/utils.js.map +1 -0
- package/dist/esm/utils/constants.js +26 -36
- package/dist/esm/utils/constants.js.map +1 -0
- package/dist/esm/utils/derived-objects.js +11 -10
- package/dist/esm/utils/derived-objects.js.map +1 -0
- package/dist/esm/utils/dynamic-fields.js +16 -16
- package/dist/esm/utils/dynamic-fields.js.map +1 -0
- package/dist/esm/utils/format.js +13 -13
- package/dist/esm/utils/format.js.map +1 -0
- package/dist/esm/utils/index.js +15 -76
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/move-registry.js +34 -17
- package/dist/esm/utils/move-registry.js.map +1 -0
- package/dist/esm/utils/sui-types.js +70 -54
- package/dist/esm/utils/sui-types.js.map +1 -0
- package/dist/esm/utils/suins.js +29 -29
- package/dist/esm/utils/suins.js.map +1 -0
- package/dist/esm/verify/index.js +5 -14
- package/dist/esm/verify/index.js.map +1 -0
- package/dist/esm/verify/verify.js +76 -93
- package/dist/esm/verify/verify.js.map +1 -0
- package/dist/esm/version.js +6 -6
- package/dist/esm/version.js.map +1 -0
- package/dist/esm/w/call/allocation.js +307 -402
- package/dist/esm/w/call/allocation.js.map +1 -0
- package/dist/esm/w/call/arb.js +100 -129
- package/dist/esm/w/call/arb.js.map +1 -0
- package/dist/esm/w/call/arbitration.js +1170 -1568
- package/dist/esm/w/call/arbitration.js.map +1 -0
- package/dist/esm/w/call/base.js +288 -315
- package/dist/esm/w/call/base.js.map +1 -0
- package/dist/esm/w/call/contact.js +318 -442
- package/dist/esm/w/call/contact.js.map +1 -0
- package/dist/esm/w/call/demand.js +673 -841
- package/dist/esm/w/call/demand.js.map +1 -0
- package/dist/esm/w/call/entity.js +162 -203
- package/dist/esm/w/call/entity.js.map +1 -0
- package/dist/esm/w/call/guard-ins.js +4373 -4371
- package/dist/esm/w/call/guard-ins.js.map +1 -0
- package/dist/esm/w/call/guard.js +1061 -1108
- package/dist/esm/w/call/guard.js.map +1 -0
- package/dist/esm/w/call/index.js +24 -56
- package/dist/esm/w/call/index.js.map +1 -0
- package/dist/esm/w/call/machine.js +1086 -1433
- package/dist/esm/w/call/machine.js.map +1 -0
- package/dist/esm/w/call/order.js +301 -448
- package/dist/esm/w/call/order.js.map +1 -0
- package/dist/esm/w/call/passport.js +204 -240
- package/dist/esm/w/call/passport.js.map +1 -0
- package/dist/esm/w/call/payment.js +177 -215
- package/dist/esm/w/call/payment.js.map +1 -0
- package/dist/esm/w/call/permission.js +1172 -1320
- package/dist/esm/w/call/permission.js.map +1 -0
- package/dist/esm/w/call/personal.js +121 -156
- package/dist/esm/w/call/personal.js.map +1 -0
- package/dist/esm/w/call/progress.js +625 -797
- package/dist/esm/w/call/progress.js.map +1 -0
- package/dist/esm/w/call/proof.js +61 -103
- package/dist/esm/w/call/proof.js.map +1 -0
- package/dist/esm/w/call/repository.js +1017 -1251
- package/dist/esm/w/call/repository.js.map +1 -0
- package/dist/esm/w/call/resource.js +108 -124
- package/dist/esm/w/call/resource.js.map +1 -0
- package/dist/esm/w/call/reward.js +660 -847
- package/dist/esm/w/call/reward.js.map +1 -0
- package/dist/esm/w/call/service.js +1849 -2400
- package/dist/esm/w/call/service.js.map +1 -0
- package/dist/esm/w/call/treasury.js +815 -1125
- package/dist/esm/w/call/treasury.js.map +1 -0
- package/dist/esm/w/call/util.js +553 -576
- package/dist/esm/w/call/util.js.map +1 -0
- package/dist/esm/w/common.d.ts +1 -1
- package/dist/esm/w/common.js +579 -580
- package/dist/esm/w/common.js.map +1 -0
- package/dist/esm/w/exception.js +570 -573
- package/dist/esm/w/exception.js.map +1 -0
- package/dist/esm/w/index.js +4 -0
- package/dist/esm/w/index.js.map +1 -0
- package/dist/esm/w/local/account.js +652 -709
- package/dist/esm/w/local/account.js.map +1 -0
- package/dist/esm/w/local/cache.js +176 -147
- package/dist/esm/w/local/cache.js.map +1 -0
- package/dist/esm/w/local/config.js +46 -60
- package/dist/esm/w/local/config.js.map +1 -0
- package/dist/esm/w/local/index.js +196 -273
- package/dist/esm/w/local/index.js.map +1 -0
- package/dist/esm/w/local/local.d.ts +2 -2
- package/dist/esm/w/local/local.js +631 -626
- package/dist/esm/w/local/local.js.map +1 -0
- package/dist/esm/w/local/storage.js +168 -136
- package/dist/esm/w/local/storage.js.map +1 -0
- package/dist/esm/w/local/token.js +149 -151
- package/dist/esm/w/local/token.js.map +1 -0
- package/dist/esm/w/local/util.js +45 -22
- package/dist/esm/w/local/util.js.map +1 -0
- package/dist/esm/w/local/wip.js +1038 -781
- package/dist/esm/w/local/wip.js.map +1 -0
- package/dist/esm/w/messenger/crypto.js +491 -387
- package/dist/esm/w/messenger/crypto.js.map +1 -0
- package/dist/esm/w/messenger/index.js +27 -24
- package/dist/esm/w/messenger/index.js.map +1 -0
- package/dist/esm/w/messenger/messenger-api.js +1111 -1017
- package/dist/esm/w/messenger/messenger-api.js.map +1 -0
- package/dist/esm/w/messenger/messenger-manager.js +944 -1052
- package/dist/esm/w/messenger/messenger-manager.js.map +1 -0
- package/dist/esm/w/messenger/messenger.d.ts +1 -1
- package/dist/esm/w/messenger/messenger.js +1258 -1421
- package/dist/esm/w/messenger/messenger.js.map +1 -0
- package/dist/esm/w/messenger/server.js +388 -499
- package/dist/esm/w/messenger/server.js.map +1 -0
- package/dist/esm/w/messenger/session.js +394 -399
- package/dist/esm/w/messenger/session.js.map +1 -0
- package/dist/esm/w/messenger/storage.js +840 -751
- package/dist/esm/w/messenger/storage.js.map +1 -0
- package/dist/esm/w/messenger/types.d.ts +2 -2
- package/dist/esm/w/messenger/types.js +80 -85
- package/dist/esm/w/messenger/types.js.map +1 -0
- package/dist/esm/w/messenger/utils.js +28 -16
- package/dist/esm/w/messenger/utils.js.map +1 -0
- package/dist/esm/w/query/bult-in.js +95 -100
- package/dist/esm/w/query/bult-in.js.map +1 -0
- package/dist/esm/w/query/event.js +128 -125
- package/dist/esm/w/query/event.js.map +1 -0
- package/dist/esm/w/query/index.js +3 -0
- package/dist/esm/w/query/index.js.map +1 -0
- package/dist/esm/w/query/object.js +1560 -1574
- package/dist/esm/w/query/object.js.map +1 -0
- package/dist/esm/w/query/received.js +57 -63
- package/dist/esm/w/query/received.js.map +1 -0
- package/dist/esm/w/query/util.js +48 -56
- package/dist/esm/w/query/util.js.map +1 -0
- package/dist/esm/w/util.js +578 -673
- package/dist/esm/w/util.js.map +1 -0
- package/package.json +13 -7
- package/prebuilds/better-sqlite3-v12.9.0-node-v115-darwin-arm64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v115-darwin-x64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v115-linux-arm.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v115-linux-arm64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v115-linux-x64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v115-win32-arm64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v115-win32-x64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v127-darwin-arm64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v127-darwin-x64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v127-linux-arm.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v127-linux-arm64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v127-linux-x64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v127-win32-arm64.node +0 -0
- package/prebuilds/better-sqlite3-v12.9.0-node-v127-win32-x64.node +0 -0
- package/scripts/download-prebuilds.js +234 -0
- package/scripts/install-better-sqlite3.js +377 -0
- package/dist/cjs/graphql/client.js +0 -98
- package/dist/cjs/graphql/core.js +0 -506
- package/dist/cjs/graphql/generated/2024.1/tada-env.js +0 -13141
- package/dist/cjs/graphql/generated/2024.1/tsconfig.tada.js +0 -11
- package/dist/cjs/graphql/generated/2024.4/tada-env.js +0 -13287
- package/dist/cjs/graphql/generated/2024.4/tsconfig.tada.js +0 -11
- package/dist/cjs/graphql/generated/latest/tada-env.js +0 -12925
- package/dist/cjs/graphql/generated/latest/tsconfig.tada.js +0 -11
- package/dist/cjs/graphql/generated/queries.js +0 -807
- package/dist/cjs/graphql/index.js +0 -25
- package/dist/cjs/graphql/schemas/2024.1/index.js +0 -28
- package/dist/cjs/graphql/schemas/2024.4/index.js +0 -28
- package/dist/cjs/graphql/schemas/latest/index.js +0 -28
- package/dist/cjs/graphql/types.js +0 -16
- package/dist/cjs/package.json +0 -5
- package/dist/cjs/w/local/.eslintrc.js +0 -15
- package/dist/cjs/w/messenger/.eslintrc.js +0 -15
- package/dist/cjs/zklogin/address.js +0 -93
- package/dist/cjs/zklogin/bcs.js +0 -41
- package/dist/cjs/zklogin/index.js +0 -45
- package/dist/cjs/zklogin/jwt-decode.js +0 -88
- package/dist/cjs/zklogin/jwt-utils.js +0 -128
- package/dist/cjs/zklogin/nonce.js +0 -60
- package/dist/cjs/zklogin/poseidon.js +0 -64
- package/dist/cjs/zklogin/publickey.js +0 -281
- package/dist/cjs/zklogin/signature.js +0 -57
- package/dist/cjs/zklogin/utils.js +0 -98
- package/dist/esm/graphql/client.js +0 -79
- package/dist/esm/graphql/core.js +0 -505
- package/dist/esm/graphql/generated/2024.1/tada-env.js +0 -13121
- package/dist/esm/graphql/generated/2024.1/tsconfig.tada.js +0 -16
- package/dist/esm/graphql/generated/2024.4/tada-env.js +0 -13267
- package/dist/esm/graphql/generated/2024.4/tsconfig.tada.js +0 -16
- package/dist/esm/graphql/generated/latest/tada-env.js +0 -12905
- package/dist/esm/graphql/generated/latest/tsconfig.tada.js +0 -16
- package/dist/esm/graphql/generated/queries.js +0 -788
- package/dist/esm/graphql/index.js +0 -8
- package/dist/esm/graphql/schemas/2024.1/index.js +0 -8
- package/dist/esm/graphql/schemas/2024.4/index.js +0 -8
- package/dist/esm/graphql/schemas/latest/index.js +0 -8
- package/dist/esm/graphql/types.js +0 -0
- package/dist/esm/package.json +0 -5
- package/dist/esm/w/local/.eslintrc.js +0 -23
- package/dist/esm/w/messenger/.eslintrc.js +0 -23
- package/dist/esm/zklogin/address.js +0 -78
- package/dist/esm/zklogin/bcs.js +0 -21
- package/dist/esm/zklogin/index.js +0 -38
- package/dist/esm/zklogin/jwt-decode.js +0 -68
- package/dist/esm/zklogin/jwt-utils.js +0 -108
- package/dist/esm/zklogin/nonce.js +0 -40
- package/dist/esm/zklogin/poseidon.js +0 -61
- package/dist/esm/zklogin/publickey.js +0 -265
- package/dist/esm/zklogin/signature.js +0 -37
- package/dist/esm/zklogin/utils.js +0 -78
- package/dist/tsconfig.esm.tsbuildinfo +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,742 +1,651 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
25
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
26
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
27
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
28
|
-
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
29
|
-
var Transaction_exports = {};
|
|
30
|
-
__export(Transaction_exports, {
|
|
31
|
-
Transaction: () => Transaction,
|
|
32
|
-
isTransaction: () => isTransaction
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(Transaction_exports);
|
|
35
|
-
var import_bcs = require("@mysten/bcs");
|
|
36
|
-
var import_valibot = require("valibot");
|
|
37
|
-
var import_sui_types = require("../utils/sui-types.js");
|
|
38
|
-
var import_Commands = require("./Commands.js");
|
|
39
|
-
var import_internal = require("./data/internal.js");
|
|
40
|
-
var import_v1 = require("./data/v1.js");
|
|
41
|
-
var import_v2 = require("./data/v2.js");
|
|
42
|
-
var import_Inputs = require("./Inputs.js");
|
|
43
|
-
var import_resolve = require("./resolve.js");
|
|
44
|
-
var import_object = require("./object.js");
|
|
45
|
-
var import_pure = require("./pure.js");
|
|
46
|
-
var import_TransactionData = require("./TransactionData.js");
|
|
47
|
-
var import_utils = require("./utils.js");
|
|
48
|
-
var import_NamedPackagesPlugin = require("./plugins/NamedPackagesPlugin.js");
|
|
49
|
-
var _serializationPlugins, _buildPlugins, _intentResolvers, _inputSection, _commandSection, _availableResults, _pendingPromises, _added, _data, _Transaction_instances, fork_fn, addCommand_fn, addInput_fn, normalizeTransactionArgument_fn, resolveArgument_fn, prepareBuild_fn, runPlugins_fn, waitForPendingTasks_fn, sortCommandsAndInputs_fn;
|
|
2
|
+
// Copyright (c) Mysten Labs, Inc.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
var _a;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Transaction = void 0;
|
|
7
|
+
exports.isTransaction = isTransaction;
|
|
8
|
+
const bcs_1 = require("@mysten/bcs");
|
|
9
|
+
const valibot_1 = require("valibot");
|
|
10
|
+
const sui_types_js_1 = require("../utils/sui-types.js");
|
|
11
|
+
const Commands_js_1 = require("./Commands.js");
|
|
12
|
+
const internal_js_1 = require("./data/internal.js");
|
|
13
|
+
const v1_js_1 = require("./data/v1.js");
|
|
14
|
+
const v2_js_1 = require("./data/v2.js");
|
|
15
|
+
const Inputs_js_1 = require("./Inputs.js");
|
|
16
|
+
const resolve_js_1 = require("./resolve.js");
|
|
17
|
+
const object_js_1 = require("./object.js");
|
|
18
|
+
const pure_js_1 = require("./pure.js");
|
|
19
|
+
const TransactionData_js_1 = require("./TransactionData.js");
|
|
20
|
+
const utils_js_1 = require("./utils.js");
|
|
21
|
+
const NamedPackagesPlugin_js_1 = require("./plugins/NamedPackagesPlugin.js");
|
|
50
22
|
function createTransactionResult(index, length = Infinity) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
23
|
+
const baseResult = {
|
|
24
|
+
$kind: "Result",
|
|
25
|
+
get Result() {
|
|
26
|
+
return typeof index === "function" ? index() : index;
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
const nestedResults = [];
|
|
30
|
+
const nestedResultFor = (resultIndex) => (nestedResults[resultIndex] ??= {
|
|
31
|
+
$kind: "NestedResult",
|
|
32
|
+
get NestedResult() {
|
|
33
|
+
return [
|
|
34
|
+
typeof index === "function" ? index() : index,
|
|
35
|
+
resultIndex,
|
|
36
|
+
];
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
return new Proxy(baseResult, {
|
|
40
|
+
set() {
|
|
41
|
+
throw new Error("The transaction result is a proxy, and does not support setting properties directly");
|
|
42
|
+
},
|
|
43
|
+
// TODO: Instead of making this return a concrete argument, we should ideally
|
|
44
|
+
// make it reference-based (so that this gets resolved at build-time), which
|
|
45
|
+
// allows re-ordering transactions.
|
|
46
|
+
get(target, property) {
|
|
47
|
+
// This allows this transaction argument to be used in the singular form:
|
|
48
|
+
if (property in target) {
|
|
49
|
+
return Reflect.get(target, property);
|
|
50
|
+
}
|
|
51
|
+
// Support destructuring:
|
|
52
|
+
if (property === Symbol.iterator) {
|
|
53
|
+
return function* () {
|
|
54
|
+
let i = 0;
|
|
55
|
+
while (i < length) {
|
|
56
|
+
yield nestedResultFor(i);
|
|
57
|
+
i++;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (typeof property === "symbol")
|
|
62
|
+
return;
|
|
63
|
+
const resultIndex = parseInt(property, 10);
|
|
64
|
+
if (Number.isNaN(resultIndex) || resultIndex < 0)
|
|
65
|
+
return;
|
|
66
|
+
return nestedResultFor(resultIndex);
|
|
67
|
+
},
|
|
68
|
+
});
|
|
95
69
|
}
|
|
96
|
-
const TRANSACTION_BRAND =
|
|
70
|
+
const TRANSACTION_BRAND = Symbol.for("@mysten/transaction");
|
|
97
71
|
function isTransaction(obj) {
|
|
98
|
-
|
|
72
|
+
return (!!obj &&
|
|
73
|
+
typeof obj === "object" &&
|
|
74
|
+
obj[TRANSACTION_BRAND] === true);
|
|
99
75
|
}
|
|
100
76
|
const modulePluginRegistry = {
|
|
101
|
-
|
|
102
|
-
|
|
77
|
+
buildPlugins: new Map(),
|
|
78
|
+
serializationPlugins: new Map(),
|
|
103
79
|
};
|
|
104
|
-
const TRANSACTION_REGISTRY_KEY =
|
|
80
|
+
const TRANSACTION_REGISTRY_KEY = Symbol.for("@mysten/transaction/registry");
|
|
105
81
|
function getGlobalPluginRegistry() {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
82
|
+
try {
|
|
83
|
+
const target = globalThis;
|
|
84
|
+
if (!target[TRANSACTION_REGISTRY_KEY]) {
|
|
85
|
+
target[TRANSACTION_REGISTRY_KEY] = modulePluginRegistry;
|
|
86
|
+
}
|
|
87
|
+
return target[TRANSACTION_REGISTRY_KEY];
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return modulePluginRegistry;
|
|
91
|
+
}
|
|
115
92
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Transaction Builder
|
|
95
|
+
*/
|
|
96
|
+
class Transaction {
|
|
97
|
+
#serializationPlugins;
|
|
98
|
+
#buildPlugins;
|
|
99
|
+
#intentResolvers = new Map();
|
|
100
|
+
#inputSection = [];
|
|
101
|
+
#commandSection = [];
|
|
102
|
+
#availableResults = new Set();
|
|
103
|
+
#pendingPromises = new Set();
|
|
104
|
+
#added = new Map();
|
|
105
|
+
/**
|
|
106
|
+
* Converts from a serialize transaction kind (built with `build({ onlyTransactionKind: true })`) to a `Transaction` class.
|
|
107
|
+
* Supports either a byte array, or base64-encoded bytes.
|
|
108
|
+
*/
|
|
109
|
+
static fromKind(serialized) {
|
|
110
|
+
const tx = new _a();
|
|
111
|
+
tx.#data = TransactionData_js_1.TransactionDataBuilder.fromKindBytes(typeof serialized === "string"
|
|
112
|
+
? (0, bcs_1.fromBase64)(serialized)
|
|
113
|
+
: serialized);
|
|
114
|
+
tx.#inputSection = tx.#data.inputs.slice();
|
|
115
|
+
tx.#commandSection = tx.#data.commands.slice();
|
|
116
|
+
tx.#availableResults = new Set(tx.#commandSection.map((_, i) => i));
|
|
117
|
+
return tx;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Converts from a serialized transaction format to a `Transaction` class.
|
|
121
|
+
* There are two supported serialized formats:
|
|
122
|
+
* - A string returned from `Transaction#serialize`. The serialized format must be compatible, or it will throw an error.
|
|
123
|
+
* - A byte array (or base64-encoded bytes) containing BCS transaction data.
|
|
124
|
+
*/
|
|
125
|
+
static from(transaction) {
|
|
126
|
+
const newTransaction = new _a();
|
|
127
|
+
if (isTransaction(transaction)) {
|
|
128
|
+
newTransaction.#data = TransactionData_js_1.TransactionDataBuilder.restore(transaction.getData());
|
|
129
|
+
}
|
|
130
|
+
else if (typeof transaction !== "string" ||
|
|
131
|
+
!transaction.startsWith("{")) {
|
|
132
|
+
newTransaction.#data = TransactionData_js_1.TransactionDataBuilder.fromBytes(typeof transaction === "string"
|
|
133
|
+
? (0, bcs_1.fromBase64)(transaction)
|
|
134
|
+
: transaction);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
newTransaction.#data = TransactionData_js_1.TransactionDataBuilder.restore(JSON.parse(transaction));
|
|
138
|
+
}
|
|
139
|
+
newTransaction.#inputSection = newTransaction.#data.inputs.slice();
|
|
140
|
+
newTransaction.#commandSection = newTransaction.#data.commands.slice();
|
|
141
|
+
newTransaction.#availableResults = new Set(newTransaction.#commandSection.map((_, i) => i));
|
|
142
|
+
return newTransaction;
|
|
143
|
+
}
|
|
144
|
+
static registerGlobalSerializationPlugin(stepOrStep, step) {
|
|
145
|
+
getGlobalPluginRegistry().serializationPlugins.set(stepOrStep, step ?? stepOrStep);
|
|
146
|
+
}
|
|
147
|
+
static unregisterGlobalSerializationPlugin(name) {
|
|
148
|
+
getGlobalPluginRegistry().serializationPlugins.delete(name);
|
|
149
|
+
}
|
|
150
|
+
static registerGlobalBuildPlugin(stepOrStep, step) {
|
|
151
|
+
getGlobalPluginRegistry().buildPlugins.set(stepOrStep, step ?? stepOrStep);
|
|
152
|
+
}
|
|
153
|
+
static unregisterGlobalBuildPlugin(name) {
|
|
154
|
+
getGlobalPluginRegistry().buildPlugins.delete(name);
|
|
155
|
+
}
|
|
156
|
+
addSerializationPlugin(step) {
|
|
157
|
+
this.#serializationPlugins.push(step);
|
|
158
|
+
}
|
|
159
|
+
addBuildPlugin(step) {
|
|
160
|
+
this.#buildPlugins.push(step);
|
|
161
|
+
}
|
|
162
|
+
addIntentResolver(intent, resolver) {
|
|
163
|
+
if (this.#intentResolvers.has(intent) &&
|
|
164
|
+
this.#intentResolvers.get(intent) !== resolver) {
|
|
165
|
+
throw new Error(`Intent resolver for ${intent} already exists`);
|
|
166
|
+
}
|
|
167
|
+
this.#intentResolvers.set(intent, resolver);
|
|
168
|
+
}
|
|
169
|
+
setSender(sender) {
|
|
170
|
+
this.#data.sender = sender;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Sets the sender only if it has not already been set.
|
|
174
|
+
* This is useful for sponsored transaction flows where the sender may not be the same as the signer address.
|
|
175
|
+
*/
|
|
176
|
+
setSenderIfNotSet(sender) {
|
|
177
|
+
if (!this.#data.sender) {
|
|
178
|
+
this.#data.sender = sender;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
setExpiration(expiration) {
|
|
182
|
+
this.#data.expiration = expiration
|
|
183
|
+
? (0, valibot_1.parse)(internal_js_1.TransactionExpiration, expiration)
|
|
184
|
+
: null;
|
|
185
|
+
}
|
|
186
|
+
setGasPrice(price) {
|
|
187
|
+
this.#data.gasConfig.price = String(price);
|
|
188
|
+
}
|
|
189
|
+
setGasBudget(budget) {
|
|
190
|
+
this.#data.gasConfig.budget = String(budget);
|
|
191
|
+
}
|
|
192
|
+
setGasBudgetIfNotSet(budget) {
|
|
193
|
+
if (this.#data.gasData.budget == null) {
|
|
194
|
+
this.#data.gasConfig.budget = String(budget);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
setGasOwner(owner) {
|
|
198
|
+
this.#data.gasConfig.owner = owner;
|
|
199
|
+
}
|
|
200
|
+
setGasPayment(payments) {
|
|
201
|
+
this.#data.gasConfig.payment = payments.map((payment) => (0, valibot_1.parse)(internal_js_1.ObjectRefSchema, payment));
|
|
202
|
+
}
|
|
203
|
+
#data;
|
|
204
|
+
/** @deprecated Use `getData()` instead. */
|
|
205
|
+
get blockData() {
|
|
206
|
+
return (0, v1_js_1.serializeV1TransactionData)(this.#data.snapshot());
|
|
207
|
+
}
|
|
208
|
+
/** Get a snapshot of the transaction data, in JSON form: */
|
|
209
|
+
getData() {
|
|
210
|
+
return this.#data.snapshot();
|
|
211
|
+
}
|
|
212
|
+
// Used to brand transaction classes so that they can be identified, even between multiple copies
|
|
213
|
+
// of the builder.
|
|
214
|
+
get [TRANSACTION_BRAND]() {
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
// Temporary workaround for the wallet interface accidentally serializing transactions via postMessage
|
|
218
|
+
get pure() {
|
|
219
|
+
Object.defineProperty(this, "pure", {
|
|
220
|
+
enumerable: false,
|
|
221
|
+
value: (0, pure_js_1.createPure)((value) => {
|
|
222
|
+
if ((0, bcs_1.isSerializedBcs)(value)) {
|
|
223
|
+
return this.#addInput("pure", {
|
|
224
|
+
$kind: "Pure",
|
|
225
|
+
Pure: {
|
|
226
|
+
bytes: value.toBase64(),
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
// TODO: we can also do some deduplication here
|
|
231
|
+
return this.#addInput("pure", (0, valibot_1.is)(internal_js_1.NormalizedCallArg, value)
|
|
232
|
+
? (0, valibot_1.parse)(internal_js_1.NormalizedCallArg, value)
|
|
233
|
+
: value instanceof Uint8Array
|
|
234
|
+
? Inputs_js_1.Inputs.Pure(value)
|
|
235
|
+
: {
|
|
236
|
+
$kind: "UnresolvedPure",
|
|
237
|
+
UnresolvedPure: { value },
|
|
238
|
+
});
|
|
239
|
+
}),
|
|
240
|
+
});
|
|
241
|
+
return this.pure;
|
|
242
|
+
}
|
|
243
|
+
constructor() {
|
|
244
|
+
const globalPlugins = getGlobalPluginRegistry();
|
|
245
|
+
this.#data = new TransactionData_js_1.TransactionDataBuilder();
|
|
246
|
+
this.#buildPlugins = [...globalPlugins.buildPlugins.values()];
|
|
247
|
+
this.#serializationPlugins = [
|
|
248
|
+
...globalPlugins.serializationPlugins.values(),
|
|
249
|
+
];
|
|
250
|
+
}
|
|
251
|
+
/** Returns an argument for the gas coin, to be used in a transaction. */
|
|
252
|
+
get gas() {
|
|
253
|
+
return { $kind: "GasCoin", GasCoin: true };
|
|
254
|
+
}
|
|
128
255
|
/**
|
|
129
256
|
* Add a new object input to the transaction.
|
|
130
257
|
*/
|
|
131
|
-
|
|
132
|
-
(value) => {
|
|
258
|
+
object = (0, object_js_1.createObjectMethods)((value) => {
|
|
133
259
|
if (typeof value === "function") {
|
|
134
|
-
|
|
135
|
-
this.add(
|
|
136
|
-
value
|
|
137
|
-
)
|
|
138
|
-
);
|
|
260
|
+
return this.object(this.add(value));
|
|
139
261
|
}
|
|
140
|
-
if (typeof value === "object" && (0,
|
|
141
|
-
|
|
262
|
+
if (typeof value === "object" && (0, valibot_1.is)(internal_js_1.ArgumentSchema, value)) {
|
|
263
|
+
return value;
|
|
142
264
|
}
|
|
143
|
-
const id = (0,
|
|
144
|
-
const inserted =
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
265
|
+
const id = (0, utils_js_1.getIdFromCallArg)(value);
|
|
266
|
+
const inserted = this.#data.inputs.find((i) => id === (0, utils_js_1.getIdFromCallArg)(i));
|
|
267
|
+
// Upgrade shared object inputs to mutable if needed:
|
|
268
|
+
if (inserted?.Object?.SharedObject &&
|
|
269
|
+
typeof value === "object" &&
|
|
270
|
+
value.Object?.SharedObject) {
|
|
271
|
+
inserted.Object.SharedObject.mutable =
|
|
272
|
+
inserted.Object.SharedObject.mutable ||
|
|
273
|
+
value.Object.SharedObject.mutable;
|
|
149
274
|
}
|
|
150
|
-
return inserted
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
$kind: "UnresolvedObject",
|
|
156
|
-
UnresolvedObject: {
|
|
157
|
-
objectId: (0, import_sui_types.normalizeWowAddress)(value)
|
|
158
|
-
}
|
|
159
|
-
} : value);
|
|
160
|
-
}
|
|
161
|
-
));
|
|
162
|
-
const globalPlugins = getGlobalPluginRegistry();
|
|
163
|
-
__privateSet(this, _data, new import_TransactionData.TransactionDataBuilder());
|
|
164
|
-
__privateSet(this, _buildPlugins, [...globalPlugins.buildPlugins.values()]);
|
|
165
|
-
__privateSet(this, _serializationPlugins, [
|
|
166
|
-
...globalPlugins.serializationPlugins.values()
|
|
167
|
-
]);
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Converts from a serialize transaction kind (built with `build({ onlyTransactionKind: true })`) to a `Transaction` class.
|
|
171
|
-
* Supports either a byte array, or base64-encoded bytes.
|
|
172
|
-
*/
|
|
173
|
-
static fromKind(serialized) {
|
|
174
|
-
const tx = new _Transaction();
|
|
175
|
-
__privateSet(tx, _data, import_TransactionData.TransactionDataBuilder.fromKindBytes(
|
|
176
|
-
typeof serialized === "string" ? (0, import_bcs.fromBase64)(serialized) : serialized
|
|
177
|
-
));
|
|
178
|
-
__privateSet(tx, _inputSection, __privateGet(tx, _data).inputs.slice());
|
|
179
|
-
__privateSet(tx, _commandSection, __privateGet(tx, _data).commands.slice());
|
|
180
|
-
__privateSet(tx, _availableResults, new Set(__privateGet(tx, _commandSection).map((_, i) => i)));
|
|
181
|
-
return tx;
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Converts from a serialized transaction format to a `Transaction` class.
|
|
185
|
-
* There are two supported serialized formats:
|
|
186
|
-
* - A string returned from `Transaction#serialize`. The serialized format must be compatible, or it will throw an error.
|
|
187
|
-
* - A byte array (or base64-encoded bytes) containing BCS transaction data.
|
|
188
|
-
*/
|
|
189
|
-
static from(transaction) {
|
|
190
|
-
const newTransaction = new _Transaction();
|
|
191
|
-
if (isTransaction(transaction)) {
|
|
192
|
-
__privateSet(newTransaction, _data, import_TransactionData.TransactionDataBuilder.restore(
|
|
193
|
-
transaction.getData()
|
|
194
|
-
));
|
|
195
|
-
} else if (typeof transaction !== "string" || !transaction.startsWith("{")) {
|
|
196
|
-
__privateSet(newTransaction, _data, import_TransactionData.TransactionDataBuilder.fromBytes(
|
|
197
|
-
typeof transaction === "string" ? (0, import_bcs.fromBase64)(transaction) : transaction
|
|
198
|
-
));
|
|
199
|
-
} else {
|
|
200
|
-
__privateSet(newTransaction, _data, import_TransactionData.TransactionDataBuilder.restore(
|
|
201
|
-
JSON.parse(transaction)
|
|
202
|
-
));
|
|
203
|
-
}
|
|
204
|
-
__privateSet(newTransaction, _inputSection, __privateGet(newTransaction, _data).inputs.slice());
|
|
205
|
-
__privateSet(newTransaction, _commandSection, __privateGet(newTransaction, _data).commands.slice());
|
|
206
|
-
__privateSet(newTransaction, _availableResults, new Set(
|
|
207
|
-
__privateGet(newTransaction, _commandSection).map((_, i) => i)
|
|
208
|
-
));
|
|
209
|
-
return newTransaction;
|
|
210
|
-
}
|
|
211
|
-
static registerGlobalSerializationPlugin(stepOrStep, step) {
|
|
212
|
-
getGlobalPluginRegistry().serializationPlugins.set(
|
|
213
|
-
stepOrStep,
|
|
214
|
-
step ?? stepOrStep
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
static unregisterGlobalSerializationPlugin(name) {
|
|
218
|
-
getGlobalPluginRegistry().serializationPlugins.delete(name);
|
|
219
|
-
}
|
|
220
|
-
static registerGlobalBuildPlugin(stepOrStep, step) {
|
|
221
|
-
getGlobalPluginRegistry().buildPlugins.set(
|
|
222
|
-
stepOrStep,
|
|
223
|
-
step ?? stepOrStep
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
static unregisterGlobalBuildPlugin(name) {
|
|
227
|
-
getGlobalPluginRegistry().buildPlugins.delete(name);
|
|
228
|
-
}
|
|
229
|
-
addSerializationPlugin(step) {
|
|
230
|
-
__privateGet(this, _serializationPlugins).push(step);
|
|
231
|
-
}
|
|
232
|
-
addBuildPlugin(step) {
|
|
233
|
-
__privateGet(this, _buildPlugins).push(step);
|
|
234
|
-
}
|
|
235
|
-
addIntentResolver(intent, resolver) {
|
|
236
|
-
if (__privateGet(this, _intentResolvers).has(intent) && __privateGet(this, _intentResolvers).get(intent) !== resolver) {
|
|
237
|
-
throw new Error(`Intent resolver for ${intent} already exists`);
|
|
238
|
-
}
|
|
239
|
-
__privateGet(this, _intentResolvers).set(intent, resolver);
|
|
240
|
-
}
|
|
241
|
-
setSender(sender) {
|
|
242
|
-
__privateGet(this, _data).sender = sender;
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Sets the sender only if it has not already been set.
|
|
246
|
-
* This is useful for sponsored transaction flows where the sender may not be the same as the signer address.
|
|
247
|
-
*/
|
|
248
|
-
setSenderIfNotSet(sender) {
|
|
249
|
-
if (!__privateGet(this, _data).sender) {
|
|
250
|
-
__privateGet(this, _data).sender = sender;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
setExpiration(expiration) {
|
|
254
|
-
__privateGet(this, _data).expiration = expiration ? (0, import_valibot.parse)(import_internal.TransactionExpiration, expiration) : null;
|
|
255
|
-
}
|
|
256
|
-
setGasPrice(price) {
|
|
257
|
-
__privateGet(this, _data).gasConfig.price = String(price);
|
|
258
|
-
}
|
|
259
|
-
setGasBudget(budget) {
|
|
260
|
-
__privateGet(this, _data).gasConfig.budget = String(budget);
|
|
261
|
-
}
|
|
262
|
-
setGasBudgetIfNotSet(budget) {
|
|
263
|
-
if (__privateGet(this, _data).gasData.budget == null) {
|
|
264
|
-
__privateGet(this, _data).gasConfig.budget = String(budget);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
setGasOwner(owner) {
|
|
268
|
-
__privateGet(this, _data).gasConfig.owner = owner;
|
|
269
|
-
}
|
|
270
|
-
setGasPayment(payments) {
|
|
271
|
-
__privateGet(this, _data).gasConfig.payment = payments.map(
|
|
272
|
-
(payment) => (0, import_valibot.parse)(import_internal.ObjectRefSchema, payment)
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
/** @deprecated Use `getData()` instead. */
|
|
276
|
-
get blockData() {
|
|
277
|
-
return (0, import_v1.serializeV1TransactionData)(__privateGet(this, _data).snapshot());
|
|
278
|
-
}
|
|
279
|
-
/** Get a snapshot of the transaction data, in JSON form: */
|
|
280
|
-
getData() {
|
|
281
|
-
return __privateGet(this, _data).snapshot();
|
|
282
|
-
}
|
|
283
|
-
// Used to brand transaction classes so that they can be identified, even between multiple copies
|
|
284
|
-
// of the builder.
|
|
285
|
-
get [TRANSACTION_BRAND]() {
|
|
286
|
-
return true;
|
|
287
|
-
}
|
|
288
|
-
// Temporary workaround for the wallet interface accidentally serializing transactions via postMessage
|
|
289
|
-
get pure() {
|
|
290
|
-
Object.defineProperty(this, "pure", {
|
|
291
|
-
enumerable: false,
|
|
292
|
-
value: (0, import_pure.createPure)((value) => {
|
|
293
|
-
if ((0, import_bcs.isSerializedBcs)(value)) {
|
|
294
|
-
return __privateMethod(this, _Transaction_instances, addInput_fn).call(this, "pure", {
|
|
295
|
-
$kind: "Pure",
|
|
296
|
-
Pure: {
|
|
297
|
-
bytes: value.toBase64()
|
|
275
|
+
return inserted
|
|
276
|
+
? {
|
|
277
|
+
$kind: "Input",
|
|
278
|
+
Input: this.#data.inputs.indexOf(inserted),
|
|
279
|
+
type: "object",
|
|
298
280
|
}
|
|
299
|
-
|
|
281
|
+
: this.#addInput("object", typeof value === "string"
|
|
282
|
+
? {
|
|
283
|
+
$kind: "UnresolvedObject",
|
|
284
|
+
UnresolvedObject: {
|
|
285
|
+
objectId: (0, sui_types_js_1.normalizeWowAddress)(value),
|
|
286
|
+
},
|
|
287
|
+
}
|
|
288
|
+
: value);
|
|
289
|
+
});
|
|
290
|
+
/**
|
|
291
|
+
* Add a new object input to the transaction using the fully-resolved object reference.
|
|
292
|
+
* If you only have an object ID, use `builder.object(id)` instead.
|
|
293
|
+
*/
|
|
294
|
+
objectRef(...args) {
|
|
295
|
+
return this.object(Inputs_js_1.Inputs.ObjectRef(...args));
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Add a new receiving input to the transaction using the fully-resolved object reference.
|
|
299
|
+
* If you only have an object ID, use `builder.object(id)` instead.
|
|
300
|
+
*/
|
|
301
|
+
receivingRef(...args) {
|
|
302
|
+
return this.object(Inputs_js_1.Inputs.ReceivingRef(...args));
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Add a new shared object input to the transaction using the fully-resolved shared object reference.
|
|
306
|
+
* If you only have an object ID, use `builder.object(id)` instead.
|
|
307
|
+
*/
|
|
308
|
+
sharedObjectRef(...args) {
|
|
309
|
+
return this.object(Inputs_js_1.Inputs.SharedObjectRef(...args));
|
|
310
|
+
}
|
|
311
|
+
#fork() {
|
|
312
|
+
const fork = new _a();
|
|
313
|
+
fork.#data = this.#data;
|
|
314
|
+
fork.#serializationPlugins = this.#serializationPlugins;
|
|
315
|
+
fork.#buildPlugins = this.#buildPlugins;
|
|
316
|
+
fork.#intentResolvers = this.#intentResolvers;
|
|
317
|
+
fork.#pendingPromises = this.#pendingPromises;
|
|
318
|
+
fork.#availableResults = new Set(this.#availableResults);
|
|
319
|
+
fork.#added = this.#added;
|
|
320
|
+
this.#inputSection.push(fork.#inputSection);
|
|
321
|
+
this.#commandSection.push(fork.#commandSection);
|
|
322
|
+
return fork;
|
|
323
|
+
}
|
|
324
|
+
add(command) {
|
|
325
|
+
if (typeof command === "function") {
|
|
326
|
+
if (this.#added.has(command)) {
|
|
327
|
+
return this.#added.get(command);
|
|
328
|
+
}
|
|
329
|
+
const fork = this.#fork();
|
|
330
|
+
const result = command(fork);
|
|
331
|
+
if (!(result && typeof result === "object" && "then" in result)) {
|
|
332
|
+
this.#availableResults = fork.#availableResults;
|
|
333
|
+
this.#added.set(command, result);
|
|
334
|
+
return result;
|
|
335
|
+
}
|
|
336
|
+
const placeholder = this.#addCommand({
|
|
337
|
+
$kind: "$Intent",
|
|
338
|
+
$Intent: {
|
|
339
|
+
name: "AsyncTransactionThunk",
|
|
340
|
+
inputs: {},
|
|
341
|
+
data: {
|
|
342
|
+
resultIndex: this.#data.commands.length,
|
|
343
|
+
result: null,
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
});
|
|
347
|
+
this.#pendingPromises.add(Promise.resolve(result).then((result) => {
|
|
348
|
+
placeholder.$Intent.data.result = result;
|
|
349
|
+
}));
|
|
350
|
+
const txResult = createTransactionResult(() => placeholder.$Intent.data.resultIndex);
|
|
351
|
+
this.#added.set(command, txResult);
|
|
352
|
+
return txResult;
|
|
300
353
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
354
|
+
else {
|
|
355
|
+
this.#addCommand(command);
|
|
356
|
+
}
|
|
357
|
+
return createTransactionResult(this.#data.commands.length - 1);
|
|
358
|
+
}
|
|
359
|
+
#addCommand(command) {
|
|
360
|
+
const resultIndex = this.#data.commands.length;
|
|
361
|
+
this.#commandSection.push(command);
|
|
362
|
+
this.#availableResults.add(resultIndex);
|
|
363
|
+
this.#data.commands.push(command);
|
|
364
|
+
this.#data.mapCommandArguments(resultIndex, (arg) => {
|
|
365
|
+
if (arg.$kind === "Result" &&
|
|
366
|
+
!this.#availableResults.has(arg.Result)) {
|
|
367
|
+
throw new Error(`Result { Result: ${arg.Result} } is not available to use in the current transaction`);
|
|
368
|
+
}
|
|
369
|
+
if (arg.$kind === "NestedResult" &&
|
|
370
|
+
!this.#availableResults.has(arg.NestedResult[0])) {
|
|
371
|
+
throw new Error(`Result { NestedResult: [${arg.NestedResult[0]}, ${arg.NestedResult[1]}] } is not available to use in the current transaction`);
|
|
372
|
+
}
|
|
373
|
+
if (arg.$kind === "Input" &&
|
|
374
|
+
arg.Input >= this.#data.inputs.length) {
|
|
375
|
+
throw new Error(`Input { Input: ${arg.Input} } references an input that does not exist in the current transaction`);
|
|
376
|
+
}
|
|
377
|
+
return arg;
|
|
304
378
|
});
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
* Add a new object input to the transaction using the fully-resolved object reference.
|
|
315
|
-
* If you only have an object ID, use `builder.object(id)` instead.
|
|
316
|
-
*/
|
|
317
|
-
objectRef(...args) {
|
|
318
|
-
return this.object(import_Inputs.Inputs.ObjectRef(...args));
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Add a new receiving input to the transaction using the fully-resolved object reference.
|
|
322
|
-
* If you only have an object ID, use `builder.object(id)` instead.
|
|
323
|
-
*/
|
|
324
|
-
receivingRef(...args) {
|
|
325
|
-
return this.object(import_Inputs.Inputs.ReceivingRef(...args));
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Add a new shared object input to the transaction using the fully-resolved shared object reference.
|
|
329
|
-
* If you only have an object ID, use `builder.object(id)` instead.
|
|
330
|
-
*/
|
|
331
|
-
sharedObjectRef(...args) {
|
|
332
|
-
return this.object(import_Inputs.Inputs.SharedObjectRef(...args));
|
|
333
|
-
}
|
|
334
|
-
add(command) {
|
|
335
|
-
if (typeof command === "function") {
|
|
336
|
-
if (__privateGet(this, _added).has(command)) {
|
|
337
|
-
return __privateGet(this, _added).get(command);
|
|
338
|
-
}
|
|
339
|
-
const fork = __privateMethod(this, _Transaction_instances, fork_fn).call(this);
|
|
340
|
-
const result = command(fork);
|
|
341
|
-
if (!(result && typeof result === "object" && "then" in result)) {
|
|
342
|
-
__privateSet(this, _availableResults, __privateGet(fork, _availableResults));
|
|
343
|
-
__privateGet(this, _added).set(command, result);
|
|
344
|
-
return result;
|
|
345
|
-
}
|
|
346
|
-
const placeholder = __privateMethod(this, _Transaction_instances, addCommand_fn).call(this, {
|
|
347
|
-
$kind: "$Intent",
|
|
348
|
-
$Intent: {
|
|
349
|
-
name: "AsyncTransactionThunk",
|
|
350
|
-
inputs: {},
|
|
351
|
-
data: {
|
|
352
|
-
resultIndex: __privateGet(this, _data).commands.length,
|
|
353
|
-
result: null
|
|
354
|
-
}
|
|
379
|
+
return command;
|
|
380
|
+
}
|
|
381
|
+
#addInput(type, input) {
|
|
382
|
+
this.#inputSection.push(input);
|
|
383
|
+
return this.#data.addInput(type, input);
|
|
384
|
+
}
|
|
385
|
+
#normalizeTransactionArgument(arg) {
|
|
386
|
+
if ((0, bcs_1.isSerializedBcs)(arg)) {
|
|
387
|
+
return this.pure(arg);
|
|
355
388
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
fullyResolved ? {
|
|
470
|
-
...__privateGet(this, _data).snapshot(),
|
|
471
|
-
digest: __privateGet(this, _data).getDigest()
|
|
472
|
-
} : __privateGet(this, _data).snapshot()
|
|
473
|
-
),
|
|
474
|
-
(_key, value) => typeof value === "bigint" ? value.toString() : value,
|
|
475
|
-
2
|
|
476
|
-
);
|
|
477
|
-
}
|
|
478
|
-
/** Build the transaction to BCS bytes, and sign it with the provided keypair. */
|
|
479
|
-
async sign(options) {
|
|
480
|
-
const { signer, ...buildOptions } = options;
|
|
481
|
-
const bytes = await this.build(buildOptions);
|
|
482
|
-
return signer.signTransaction(bytes);
|
|
483
|
-
}
|
|
484
|
-
/**
|
|
485
|
-
* Ensures that:
|
|
486
|
-
* - All objects have been fully resolved to a specific version
|
|
487
|
-
* - All pure inputs have been serialized to bytes
|
|
488
|
-
* - All async thunks have been fully resolved
|
|
489
|
-
* - All transaction intents have been resolved
|
|
490
|
-
* - The gas payment, budget, and price have been set
|
|
491
|
-
* - The transaction sender has been set
|
|
492
|
-
*
|
|
493
|
-
* When true, the transaction will always be built to the same bytes and digest (unless the transaction is mutated)
|
|
494
|
-
*/
|
|
495
|
-
isFullyResolved() {
|
|
496
|
-
if (!__privateGet(this, _data).sender) {
|
|
497
|
-
return false;
|
|
498
|
-
}
|
|
499
|
-
if (__privateGet(this, _pendingPromises).size > 0) {
|
|
500
|
-
return false;
|
|
501
|
-
}
|
|
502
|
-
if (__privateGet(this, _data).commands.some((cmd) => cmd.$Intent)) {
|
|
503
|
-
return false;
|
|
504
|
-
}
|
|
505
|
-
if ((0, import_resolve.needsTransactionResolution)(__privateGet(this, _data), {})) {
|
|
506
|
-
return false;
|
|
507
|
-
}
|
|
508
|
-
return true;
|
|
509
|
-
}
|
|
510
|
-
/** Build the transaction to BCS bytes. */
|
|
511
|
-
async build(options = {}) {
|
|
512
|
-
await this.prepareForSerialization(options);
|
|
513
|
-
await __privateMethod(this, _Transaction_instances, prepareBuild_fn).call(this, options);
|
|
514
|
-
return __privateGet(this, _data).build({
|
|
515
|
-
onlyTransactionKind: options.onlyTransactionKind
|
|
516
|
-
});
|
|
517
|
-
}
|
|
518
|
-
/** Derive transaction digest */
|
|
519
|
-
async getDigest(options = {}) {
|
|
520
|
-
await this.prepareForSerialization(options);
|
|
521
|
-
await __privateMethod(this, _Transaction_instances, prepareBuild_fn).call(this, options);
|
|
522
|
-
return __privateGet(this, _data).getDigest();
|
|
523
|
-
}
|
|
524
|
-
async prepareForSerialization(options) {
|
|
525
|
-
await __privateMethod(this, _Transaction_instances, waitForPendingTasks_fn).call(this);
|
|
526
|
-
__privateMethod(this, _Transaction_instances, sortCommandsAndInputs_fn).call(this);
|
|
527
|
-
const intents = /* @__PURE__ */ new Set();
|
|
528
|
-
for (const command of __privateGet(this, _data).commands) {
|
|
529
|
-
if (command.$Intent) {
|
|
530
|
-
intents.add(command.$Intent.name);
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
const steps = [...__privateGet(this, _serializationPlugins)];
|
|
534
|
-
for (const intent of intents) {
|
|
535
|
-
if (options.supportedIntents?.includes(intent)) {
|
|
536
|
-
continue;
|
|
537
|
-
}
|
|
538
|
-
if (!__privateGet(this, _intentResolvers).has(intent)) {
|
|
539
|
-
throw new Error(`Missing intent resolver for ${intent}`);
|
|
540
|
-
}
|
|
541
|
-
steps.push(__privateGet(this, _intentResolvers).get(intent));
|
|
542
|
-
}
|
|
543
|
-
steps.push((0, import_NamedPackagesPlugin.namedPackagesPlugin)());
|
|
544
|
-
await __privateMethod(this, _Transaction_instances, runPlugins_fn).call(this, steps, options);
|
|
545
|
-
}
|
|
546
|
-
};
|
|
547
|
-
_serializationPlugins = new WeakMap();
|
|
548
|
-
_buildPlugins = new WeakMap();
|
|
549
|
-
_intentResolvers = new WeakMap();
|
|
550
|
-
_inputSection = new WeakMap();
|
|
551
|
-
_commandSection = new WeakMap();
|
|
552
|
-
_availableResults = new WeakMap();
|
|
553
|
-
_pendingPromises = new WeakMap();
|
|
554
|
-
_added = new WeakMap();
|
|
555
|
-
_data = new WeakMap();
|
|
556
|
-
_Transaction_instances = new WeakSet();
|
|
557
|
-
fork_fn = function() {
|
|
558
|
-
const fork = new _Transaction();
|
|
559
|
-
__privateSet(fork, _data, __privateGet(this, _data));
|
|
560
|
-
__privateSet(fork, _serializationPlugins, __privateGet(this, _serializationPlugins));
|
|
561
|
-
__privateSet(fork, _buildPlugins, __privateGet(this, _buildPlugins));
|
|
562
|
-
__privateSet(fork, _intentResolvers, __privateGet(this, _intentResolvers));
|
|
563
|
-
__privateSet(fork, _pendingPromises, __privateGet(this, _pendingPromises));
|
|
564
|
-
__privateSet(fork, _availableResults, new Set(__privateGet(this, _availableResults)));
|
|
565
|
-
__privateSet(fork, _added, __privateGet(this, _added));
|
|
566
|
-
__privateGet(this, _inputSection).push(__privateGet(fork, _inputSection));
|
|
567
|
-
__privateGet(this, _commandSection).push(__privateGet(fork, _commandSection));
|
|
568
|
-
return fork;
|
|
569
|
-
};
|
|
570
|
-
addCommand_fn = function(command) {
|
|
571
|
-
const resultIndex = __privateGet(this, _data).commands.length;
|
|
572
|
-
__privateGet(this, _commandSection).push(command);
|
|
573
|
-
__privateGet(this, _availableResults).add(resultIndex);
|
|
574
|
-
__privateGet(this, _data).commands.push(command);
|
|
575
|
-
__privateGet(this, _data).mapCommandArguments(resultIndex, (arg) => {
|
|
576
|
-
if (arg.$kind === "Result" && !__privateGet(this, _availableResults).has(arg.Result)) {
|
|
577
|
-
throw new Error(
|
|
578
|
-
`Result { Result: ${arg.Result} } is not available to use in the current transaction`
|
|
579
|
-
);
|
|
580
|
-
}
|
|
581
|
-
if (arg.$kind === "NestedResult" && !__privateGet(this, _availableResults).has(arg.NestedResult[0])) {
|
|
582
|
-
throw new Error(
|
|
583
|
-
`Result { NestedResult: [${arg.NestedResult[0]}, ${arg.NestedResult[1]}] } is not available to use in the current transaction`
|
|
584
|
-
);
|
|
585
|
-
}
|
|
586
|
-
if (arg.$kind === "Input" && arg.Input >= __privateGet(this, _data).inputs.length) {
|
|
587
|
-
throw new Error(
|
|
588
|
-
`Input { Input: ${arg.Input} } references an input that does not exist in the current transaction`
|
|
589
|
-
);
|
|
590
|
-
}
|
|
591
|
-
return arg;
|
|
592
|
-
});
|
|
593
|
-
return command;
|
|
594
|
-
};
|
|
595
|
-
addInput_fn = function(type, input) {
|
|
596
|
-
__privateGet(this, _inputSection).push(input);
|
|
597
|
-
return __privateGet(this, _data).addInput(type, input);
|
|
598
|
-
};
|
|
599
|
-
normalizeTransactionArgument_fn = function(arg) {
|
|
600
|
-
if ((0, import_bcs.isSerializedBcs)(arg)) {
|
|
601
|
-
return this.pure(arg);
|
|
602
|
-
}
|
|
603
|
-
return __privateMethod(this, _Transaction_instances, resolveArgument_fn).call(this, arg);
|
|
604
|
-
};
|
|
605
|
-
resolveArgument_fn = function(arg) {
|
|
606
|
-
if (typeof arg === "function") {
|
|
607
|
-
const resolved = this.add(arg);
|
|
608
|
-
if (typeof resolved === "function") {
|
|
609
|
-
return __privateMethod(this, _Transaction_instances, resolveArgument_fn).call(this, resolved);
|
|
610
|
-
}
|
|
611
|
-
return (0, import_valibot.parse)(import_internal.ArgumentSchema, resolved);
|
|
612
|
-
}
|
|
613
|
-
return (0, import_valibot.parse)(import_internal.ArgumentSchema, arg);
|
|
614
|
-
};
|
|
615
|
-
prepareBuild_fn = async function(options) {
|
|
616
|
-
if (!options.onlyTransactionKind && !__privateGet(this, _data).sender) {
|
|
617
|
-
throw new Error("Missing transaction sender");
|
|
618
|
-
}
|
|
619
|
-
await __privateMethod(this, _Transaction_instances, runPlugins_fn).call(this, [...__privateGet(this, _buildPlugins), import_resolve.resolveTransactionPlugin], options);
|
|
620
|
-
};
|
|
621
|
-
runPlugins_fn = async function(plugins, options) {
|
|
622
|
-
try {
|
|
623
|
-
const createNext = (i) => {
|
|
624
|
-
if (i >= plugins.length) {
|
|
625
|
-
return () => {
|
|
626
|
-
};
|
|
627
|
-
}
|
|
628
|
-
const plugin = plugins[i];
|
|
629
|
-
return async () => {
|
|
630
|
-
const next = createNext(i + 1);
|
|
631
|
-
let calledNext = false;
|
|
632
|
-
let nextResolved = false;
|
|
633
|
-
await plugin(__privateGet(this, _data), options, async () => {
|
|
634
|
-
if (calledNext) {
|
|
635
|
-
throw new Error(
|
|
636
|
-
`next() was call multiple times in TransactionPlugin ${i}`
|
|
637
|
-
);
|
|
638
|
-
}
|
|
639
|
-
calledNext = true;
|
|
640
|
-
await next();
|
|
641
|
-
nextResolved = true;
|
|
389
|
+
return this.#resolveArgument(arg);
|
|
390
|
+
}
|
|
391
|
+
#resolveArgument(arg) {
|
|
392
|
+
if (typeof arg === "function") {
|
|
393
|
+
const resolved = this.add(arg);
|
|
394
|
+
if (typeof resolved === "function") {
|
|
395
|
+
return this.#resolveArgument(resolved);
|
|
396
|
+
}
|
|
397
|
+
return (0, valibot_1.parse)(internal_js_1.ArgumentSchema, resolved);
|
|
398
|
+
}
|
|
399
|
+
return (0, valibot_1.parse)(internal_js_1.ArgumentSchema, arg);
|
|
400
|
+
}
|
|
401
|
+
// Method shorthands:
|
|
402
|
+
splitCoins(coin, amounts) {
|
|
403
|
+
const command = Commands_js_1.Commands.SplitCoins(typeof coin === "string"
|
|
404
|
+
? this.object(coin)
|
|
405
|
+
: this.#resolveArgument(coin), amounts.map((amount) => typeof amount === "number" ||
|
|
406
|
+
typeof amount === "bigint" ||
|
|
407
|
+
typeof amount === "string"
|
|
408
|
+
? this.pure.u64(amount)
|
|
409
|
+
: this.#normalizeTransactionArgument(amount)));
|
|
410
|
+
this.#addCommand(command);
|
|
411
|
+
return createTransactionResult(this.#data.commands.length - 1, amounts.length);
|
|
412
|
+
}
|
|
413
|
+
mergeCoins(destination, sources) {
|
|
414
|
+
return this.add(Commands_js_1.Commands.MergeCoins(this.object(destination), sources.map((src) => this.object(src))));
|
|
415
|
+
}
|
|
416
|
+
publish({ modules, dependencies, }) {
|
|
417
|
+
return this.add(Commands_js_1.Commands.Publish({
|
|
418
|
+
modules,
|
|
419
|
+
dependencies,
|
|
420
|
+
}));
|
|
421
|
+
}
|
|
422
|
+
upgrade({ modules, dependencies, package: packageId, ticket, }) {
|
|
423
|
+
return this.add(Commands_js_1.Commands.Upgrade({
|
|
424
|
+
modules,
|
|
425
|
+
dependencies,
|
|
426
|
+
package: packageId,
|
|
427
|
+
ticket: this.object(ticket),
|
|
428
|
+
}));
|
|
429
|
+
}
|
|
430
|
+
moveCall({ arguments: args, ...input }) {
|
|
431
|
+
return this.add(Commands_js_1.Commands.MoveCall({
|
|
432
|
+
...input,
|
|
433
|
+
arguments: args?.map((arg) => this.#normalizeTransactionArgument(arg)),
|
|
434
|
+
}));
|
|
435
|
+
}
|
|
436
|
+
transferObjects(objects, address) {
|
|
437
|
+
return this.add(Commands_js_1.Commands.TransferObjects(objects.map((obj) => this.object(obj)), typeof address === "string"
|
|
438
|
+
? this.pure.address(address)
|
|
439
|
+
: this.#normalizeTransactionArgument(address)));
|
|
440
|
+
}
|
|
441
|
+
makeMoveVec({ type, elements, }) {
|
|
442
|
+
return this.add(Commands_js_1.Commands.MakeMoveVec({
|
|
443
|
+
type,
|
|
444
|
+
elements: elements.map((obj) => this.object(obj)),
|
|
445
|
+
}));
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* @deprecated Use toJSON instead.
|
|
449
|
+
* For synchronous serialization, you can use `getData()`
|
|
450
|
+
* */
|
|
451
|
+
serialize() {
|
|
452
|
+
return JSON.stringify((0, v1_js_1.serializeV1TransactionData)(this.#data.snapshot()));
|
|
453
|
+
}
|
|
454
|
+
async toJSON(options = {}) {
|
|
455
|
+
await this.prepareForSerialization(options);
|
|
456
|
+
const fullyResolved = this.isFullyResolved();
|
|
457
|
+
return JSON.stringify((0, valibot_1.parse)(v2_js_1.SerializedTransactionDataV2Schema, fullyResolved
|
|
458
|
+
? {
|
|
459
|
+
...this.#data.snapshot(),
|
|
460
|
+
digest: this.#data.getDigest(),
|
|
461
|
+
}
|
|
462
|
+
: this.#data.snapshot()), (_key, value) => typeof value === "bigint" ? value.toString() : value, 2);
|
|
463
|
+
}
|
|
464
|
+
/** Build the transaction to BCS bytes, and sign it with the provided keypair. */
|
|
465
|
+
async sign(options) {
|
|
466
|
+
const { signer, ...buildOptions } = options;
|
|
467
|
+
const bytes = await this.build(buildOptions);
|
|
468
|
+
return signer.signTransaction(bytes);
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Ensures that:
|
|
472
|
+
* - All objects have been fully resolved to a specific version
|
|
473
|
+
* - All pure inputs have been serialized to bytes
|
|
474
|
+
* - All async thunks have been fully resolved
|
|
475
|
+
* - All transaction intents have been resolved
|
|
476
|
+
* - The gas payment, budget, and price have been set
|
|
477
|
+
* - The transaction sender has been set
|
|
478
|
+
*
|
|
479
|
+
* When true, the transaction will always be built to the same bytes and digest (unless the transaction is mutated)
|
|
480
|
+
*/
|
|
481
|
+
isFullyResolved() {
|
|
482
|
+
if (!this.#data.sender) {
|
|
483
|
+
return false;
|
|
484
|
+
}
|
|
485
|
+
if (this.#pendingPromises.size > 0) {
|
|
486
|
+
return false;
|
|
487
|
+
}
|
|
488
|
+
if (this.#data.commands.some((cmd) => cmd.$Intent)) {
|
|
489
|
+
return false;
|
|
490
|
+
}
|
|
491
|
+
if ((0, resolve_js_1.needsTransactionResolution)(this.#data, {})) {
|
|
492
|
+
return false;
|
|
493
|
+
}
|
|
494
|
+
return true;
|
|
495
|
+
}
|
|
496
|
+
/** Build the transaction to BCS bytes. */
|
|
497
|
+
async build(options = {}) {
|
|
498
|
+
await this.prepareForSerialization(options);
|
|
499
|
+
await this.#prepareBuild(options);
|
|
500
|
+
return this.#data.build({
|
|
501
|
+
onlyTransactionKind: options.onlyTransactionKind,
|
|
642
502
|
});
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
503
|
+
}
|
|
504
|
+
/** Derive transaction digest */
|
|
505
|
+
async getDigest(options = {}) {
|
|
506
|
+
await this.prepareForSerialization(options);
|
|
507
|
+
await this.#prepareBuild(options);
|
|
508
|
+
return this.#data.getDigest();
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Prepare the transaction by validating the transaction data and resolving all inputs
|
|
512
|
+
* so that it can be built into bytes.
|
|
513
|
+
*/
|
|
514
|
+
async #prepareBuild(options) {
|
|
515
|
+
if (!options.onlyTransactionKind && !this.#data.sender) {
|
|
516
|
+
throw new Error("Missing transaction sender");
|
|
647
517
|
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
518
|
+
await this.#runPlugins([...this.#buildPlugins, resolve_js_1.resolveTransactionPlugin], options);
|
|
519
|
+
}
|
|
520
|
+
async #runPlugins(plugins, options) {
|
|
521
|
+
try {
|
|
522
|
+
const createNext = (i) => {
|
|
523
|
+
if (i >= plugins.length) {
|
|
524
|
+
return () => { };
|
|
525
|
+
}
|
|
526
|
+
const plugin = plugins[i];
|
|
527
|
+
return async () => {
|
|
528
|
+
const next = createNext(i + 1);
|
|
529
|
+
let calledNext = false;
|
|
530
|
+
let nextResolved = false;
|
|
531
|
+
await plugin(this.#data, options, async () => {
|
|
532
|
+
if (calledNext) {
|
|
533
|
+
throw new Error(`next() was call multiple times in TransactionPlugin ${i}`);
|
|
534
|
+
}
|
|
535
|
+
calledNext = true;
|
|
536
|
+
await next();
|
|
537
|
+
nextResolved = true;
|
|
538
|
+
});
|
|
539
|
+
if (!calledNext) {
|
|
540
|
+
throw new Error(`next() was not called in TransactionPlugin ${i}`);
|
|
541
|
+
}
|
|
542
|
+
if (!nextResolved) {
|
|
543
|
+
throw new Error(`next() was not awaited in TransactionPlugin ${i}`);
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
};
|
|
547
|
+
await createNext(0)();
|
|
652
548
|
}
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
549
|
+
finally {
|
|
550
|
+
this.#inputSection = this.#data.inputs.slice();
|
|
551
|
+
this.#commandSection = this.#data.commands.slice();
|
|
552
|
+
this.#availableResults = new Set(this.#commandSection.map((_, i) => i));
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
async #waitForPendingTasks() {
|
|
556
|
+
while (this.#pendingPromises.size > 0) {
|
|
557
|
+
const newPromise = Promise.all(this.#pendingPromises);
|
|
558
|
+
this.#pendingPromises.clear();
|
|
559
|
+
this.#pendingPromises.add(newPromise);
|
|
560
|
+
await newPromise;
|
|
561
|
+
this.#pendingPromises.delete(newPromise);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
#sortCommandsAndInputs() {
|
|
565
|
+
const unorderedCommands = this.#data.commands;
|
|
566
|
+
const unorderedInputs = this.#data.inputs;
|
|
567
|
+
const orderedCommands = this.#commandSection.flat(Infinity);
|
|
568
|
+
const orderedInputs = this.#inputSection.flat(Infinity);
|
|
569
|
+
if (orderedCommands.length !== unorderedCommands.length) {
|
|
570
|
+
throw new Error("Unexpected number of commands found in transaction data");
|
|
571
|
+
}
|
|
572
|
+
if (orderedInputs.length !== unorderedInputs.length) {
|
|
573
|
+
throw new Error("Unexpected number of inputs found in transaction data");
|
|
574
|
+
}
|
|
575
|
+
const filteredCommands = orderedCommands.filter((cmd) => cmd.$Intent?.name !== "AsyncTransactionThunk");
|
|
576
|
+
this.#data.commands = filteredCommands;
|
|
577
|
+
this.#data.inputs = orderedInputs;
|
|
578
|
+
this.#commandSection = filteredCommands;
|
|
579
|
+
this.#inputSection = orderedInputs;
|
|
580
|
+
this.#availableResults = new Set(filteredCommands.map((_, i) => i));
|
|
581
|
+
function getOriginalIndex(index) {
|
|
582
|
+
const command = unorderedCommands[index];
|
|
583
|
+
if (command.$Intent?.name === "AsyncTransactionThunk") {
|
|
584
|
+
const result = command.$Intent.data
|
|
585
|
+
.result;
|
|
586
|
+
if (result == null) {
|
|
587
|
+
throw new Error("AsyncTransactionThunk has not been resolved");
|
|
588
|
+
}
|
|
589
|
+
return getOriginalIndex(result.Result);
|
|
590
|
+
}
|
|
591
|
+
const updated = filteredCommands.indexOf(command);
|
|
592
|
+
if (updated === -1) {
|
|
593
|
+
throw new Error("Unable to find original index for command");
|
|
594
|
+
}
|
|
595
|
+
return updated;
|
|
596
|
+
}
|
|
597
|
+
this.#data.mapArguments((arg) => {
|
|
598
|
+
if (arg.$kind === "Input") {
|
|
599
|
+
const updated = orderedInputs.indexOf(unorderedInputs[arg.Input]);
|
|
600
|
+
if (updated === -1) {
|
|
601
|
+
throw new Error("Input has not been resolved");
|
|
602
|
+
}
|
|
603
|
+
return { ...arg, Input: updated };
|
|
604
|
+
}
|
|
605
|
+
else if (arg.$kind === "Result") {
|
|
606
|
+
const updated = getOriginalIndex(arg.Result);
|
|
607
|
+
return { ...arg, Result: updated };
|
|
608
|
+
}
|
|
609
|
+
else if (arg.$kind === "NestedResult") {
|
|
610
|
+
const updated = getOriginalIndex(arg.NestedResult[0]);
|
|
611
|
+
return { ...arg, NestedResult: [updated, arg.NestedResult[1]] };
|
|
612
|
+
}
|
|
613
|
+
return arg;
|
|
614
|
+
});
|
|
615
|
+
for (const [i, cmd] of unorderedCommands.entries()) {
|
|
616
|
+
if (cmd.$Intent?.name === "AsyncTransactionThunk") {
|
|
617
|
+
try {
|
|
618
|
+
cmd.$Intent.data.resultIndex = getOriginalIndex(i);
|
|
619
|
+
}
|
|
620
|
+
catch {
|
|
621
|
+
// If async thunk did not return a result, this will error, but is safe to ignore
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
async prepareForSerialization(options) {
|
|
627
|
+
await this.#waitForPendingTasks();
|
|
628
|
+
this.#sortCommandsAndInputs();
|
|
629
|
+
const intents = new Set();
|
|
630
|
+
for (const command of this.#data.commands) {
|
|
631
|
+
if (command.$Intent) {
|
|
632
|
+
intents.add(command.$Intent.name);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
const steps = [...this.#serializationPlugins];
|
|
636
|
+
for (const intent of intents) {
|
|
637
|
+
if (options.supportedIntents?.includes(intent)) {
|
|
638
|
+
continue;
|
|
639
|
+
}
|
|
640
|
+
if (!this.#intentResolvers.has(intent)) {
|
|
641
|
+
throw new Error(`Missing intent resolver for ${intent}`);
|
|
642
|
+
}
|
|
643
|
+
steps.push(this.#intentResolvers.get(intent));
|
|
644
|
+
}
|
|
645
|
+
steps.push((0, NamedPackagesPlugin_js_1.namedPackagesPlugin)());
|
|
646
|
+
await this.#runPlugins(steps, options);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
exports.Transaction = Transaction;
|
|
650
|
+
_a = Transaction;
|
|
651
|
+
//# sourceMappingURL=Transaction.js.map
|