wowok 2.1.40 → 2.1.41
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.js +1 -253
- package/dist/cjs/bcs/effects.js +1 -199
- package/dist/cjs/bcs/index.js +1 -51
- package/dist/cjs/bcs/pure.js +1 -36
- package/dist/cjs/bcs/type-tag-serializer.js +1 -104
- package/dist/cjs/bcs/types.js +1 -3
- package/dist/cjs/client/index.js +1 -4
- package/dist/cjs/client/network.js +1 -15
- package/dist/cjs/cryptography/index.js +1 -6
- package/dist/cjs/cryptography/intent.js +1 -14
- package/dist/cjs/cryptography/keypair.js +1 -74
- package/dist/cjs/cryptography/mnemonics.js +1 -20
- package/dist/cjs/cryptography/publickey.js +1 -80
- package/dist/cjs/cryptography/signature-scheme.js +1 -22
- package/dist/cjs/cryptography/signature.js +1 -41
- package/dist/cjs/experimental/cache.js +1 -58
- package/dist/cjs/experimental/client.js +1 -19
- package/dist/cjs/experimental/core.js +1 -80
- package/dist/cjs/experimental/errors.js +1 -24
- package/dist/cjs/experimental/index.js +1 -5
- package/dist/cjs/experimental/persistent-storage.js +1 -220
- package/dist/cjs/experimental/persistent-storage.test.js +1 -144
- package/dist/cjs/experimental/transports/utils.js +1 -96
- package/dist/cjs/experimental/types.js +1 -1
- package/dist/cjs/faucet/faucet.js +1 -99
- package/dist/cjs/faucet/index.js +1 -1
- package/dist/cjs/grpc/client.js +1 -42
- package/dist/cjs/grpc/core.js +1 -587
- package/dist/cjs/grpc/index.js +1 -2
- package/dist/cjs/grpc/proto/google/protobuf/any.js +1 -106
- package/dist/cjs/grpc/proto/google/protobuf/duration.js +1 -58
- package/dist/cjs/grpc/proto/google/protobuf/empty.js +1 -7
- package/dist/cjs/grpc/proto/google/protobuf/field_mask.js +1 -47
- package/dist/cjs/grpc/proto/google/protobuf/struct.js +1 -191
- package/dist/cjs/grpc/proto/google/protobuf/timestamp.js +1 -91
- package/dist/cjs/grpc/proto/google/rpc/error_details.js +1 -265
- package/dist/cjs/grpc/proto/google/rpc/status.js +1 -23
- package/dist/cjs/grpc/proto/sui/rpc/v2/argument.js +1 -46
- package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.js +1 -29
- package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.js +1 -22
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.js +1 -54
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.js +1 -60
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.js +1 -144
- package/dist/cjs/grpc/proto/sui/rpc/v2/effects.js +1 -271
- package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.js +1 -64
- package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.js +1 -6
- package/dist/cjs/grpc/proto/sui/rpc/v2/event.js +1 -62
- package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.js +1 -64
- package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.js +1 -481
- package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.js +1 -40
- package/dist/cjs/grpc/proto/sui/rpc/v2/input.js +1 -61
- package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.js +1 -57
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.js +1 -39
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.js +1 -329
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.js +1 -447
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.js +1 -27
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.js +1 -206
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.js +1 -19
- package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.js +1 -109
- package/dist/cjs/grpc/proto/sui/rpc/v2/object.js +1 -90
- package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.js +1 -30
- package/dist/cjs/grpc/proto/sui/rpc/v2/owner.js +1 -39
- package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.js +1 -30
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature.js +1 -501
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.js +1 -10
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +1 -15
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.js +1 -62
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.js +1 -31
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.js +1 -504
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.js +1 -15
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.js +1 -37
- package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.js +1 -709
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.js +1 -950
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +1 -19
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.js +1 -144
- package/dist/cjs/index.js +1 -22
- package/dist/cjs/jsonRpc/client.js +1 -516
- package/dist/cjs/jsonRpc/core.js +1 -587
- package/dist/cjs/jsonRpc/errors.js +1 -38
- package/dist/cjs/jsonRpc/http-transport.js +1 -70
- package/dist/cjs/jsonRpc/index.js +1 -3
- package/dist/cjs/jsonRpc/json-rpc-resolver.js +1 -296
- package/dist/cjs/jsonRpc/rpc-websocket-client.js +1 -155
- package/dist/cjs/jsonRpc/types/chain.js +1 -1
- package/dist/cjs/jsonRpc/types/changes.js +1 -1
- package/dist/cjs/jsonRpc/types/coins.js +1 -1
- package/dist/cjs/jsonRpc/types/common.js +1 -1
- package/dist/cjs/jsonRpc/types/generated.js +1 -1
- package/dist/cjs/jsonRpc/types/index.js +1 -1
- package/dist/cjs/jsonRpc/types/params.js +1 -1
- package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js +1 -58
- package/dist/cjs/keypairs/ed25519/index.js +1 -2
- package/dist/cjs/keypairs/ed25519/keypair.js +1 -90
- package/dist/cjs/keypairs/ed25519/publickey.js +1 -50
- package/dist/cjs/keypairs/index.js +1 -4
- package/dist/cjs/keypairs/passkey/index.js +1 -2
- package/dist/cjs/keypairs/passkey/keypair.js +1 -155
- package/dist/cjs/keypairs/passkey/publickey.js +1 -117
- package/dist/cjs/keypairs/passkey/types.js +1 -1
- package/dist/cjs/keypairs/secp256k1/index.js +1 -2
- package/dist/cjs/keypairs/secp256k1/keypair.js +1 -82
- package/dist/cjs/keypairs/secp256k1/publickey.js +1 -51
- package/dist/cjs/keypairs/secp256r1/index.js +1 -2
- package/dist/cjs/keypairs/secp256r1/keypair.js +1 -78
- package/dist/cjs/keypairs/secp256r1/publickey.js +1 -52
- package/dist/cjs/multisig/index.js +1 -2
- package/dist/cjs/multisig/publickey.js +1 -201
- package/dist/cjs/multisig/signer.js +1 -58
- package/dist/cjs/transactions/Arguments.js +1 -9
- package/dist/cjs/transactions/Commands.js +1 -102
- package/dist/cjs/transactions/Inputs.js +1 -52
- package/dist/cjs/transactions/ObjectCache.js +1 -205
- package/dist/cjs/transactions/Transaction.js +1 -574
- package/dist/cjs/transactions/TransactionData.js +1 -409
- package/dist/cjs/transactions/__tests__/Transaction.test.js +1 -160
- package/dist/cjs/transactions/__tests__/bcs.test.js +1 -182
- package/dist/cjs/transactions/data/internal.js +1 -169
- package/dist/cjs/transactions/data/v1.js +1 -469
- package/dist/cjs/transactions/data/v2.js +1 -97
- package/dist/cjs/transactions/executor/caching.js +1 -65
- package/dist/cjs/transactions/executor/parallel.js +1 -347
- package/dist/cjs/transactions/executor/queue.js +1 -59
- package/dist/cjs/transactions/executor/serial.js +1 -99
- package/dist/cjs/transactions/hash.js +1 -8
- package/dist/cjs/transactions/index.js +1 -12
- package/dist/cjs/transactions/intents/CoinWithBalance.js +1 -145
- package/dist/cjs/transactions/object.js +1 -87
- package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js +1 -11
- package/dist/cjs/transactions/pure.js +1 -36
- package/dist/cjs/transactions/resolve.js +1 -69
- package/dist/cjs/transactions/serializer.js +1 -167
- package/dist/cjs/transactions/utils.js +1 -121
- package/dist/cjs/utils/constants.js +1 -18
- package/dist/cjs/utils/derived-objects.js +1 -8
- package/dist/cjs/utils/dynamic-fields.js +1 -17
- package/dist/cjs/utils/format.js +1 -11
- package/dist/cjs/utils/index.js +1 -8
- package/dist/cjs/utils/move-registry.js +1 -24
- package/dist/cjs/utils/sui-types.js +1 -66
- package/dist/cjs/utils/suins.js +1 -33
- package/dist/cjs/verify/index.js +1 -1
- package/dist/cjs/verify/verify.js +1 -87
- package/dist/cjs/version.js +1 -2
- package/dist/cjs/w/call/allocation.js +1 -345
- package/dist/cjs/w/call/arb.js +1 -103
- package/dist/cjs/w/call/arbitration.js +1 -1192
- package/dist/cjs/w/call/base.js +1 -293
- package/dist/cjs/w/call/contact.js +1 -345
- package/dist/cjs/w/call/demand.js +1 -681
- package/dist/cjs/w/call/entity.js +1 -173
- package/dist/cjs/w/call/guard-ins.js +1 -4449
- package/dist/cjs/w/call/guard.d.ts +111 -0
- package/dist/cjs/w/call/guard.js +1 -1048
- package/dist/cjs/w/call/index.js +1 -22
- package/dist/cjs/w/call/machine.js +1 -1127
- package/dist/cjs/w/call/order.js +1 -337
- package/dist/cjs/w/call/passport.js +1 -220
- package/dist/cjs/w/call/payment.js +1 -178
- package/dist/cjs/w/call/permission.js +1 -1162
- package/dist/cjs/w/call/personal.js +1 -139
- package/dist/cjs/w/call/progress.js +1 -678
- package/dist/cjs/w/call/proof.js +1 -66
- package/dist/cjs/w/call/repository.js +1 -1024
- package/dist/cjs/w/call/resource.js +1 -108
- package/dist/cjs/w/call/reward.js +1 -675
- package/dist/cjs/w/call/service.js +1 -1960
- package/dist/cjs/w/call/treasury.js +1 -873
- package/dist/cjs/w/call/util.d.ts +1 -0
- package/dist/cjs/w/call/util.js +1 -566
- package/dist/cjs/w/common.js +1 -571
- package/dist/cjs/w/exception.js +1 -618
- package/dist/cjs/w/index.js +1 -8
- package/dist/cjs/w/local/account.js +1 -656
- package/dist/cjs/w/local/cache.js +1 -161
- package/dist/cjs/w/local/config.js +1 -43
- package/dist/cjs/w/local/index.js +1 -228
- package/dist/cjs/w/local/local.js +1 -574
- package/dist/cjs/w/local/storage.js +1 -185
- package/dist/cjs/w/local/token.js +1 -131
- package/dist/cjs/w/local/util.js +1 -26
- package/dist/cjs/w/local/wip.js +1 -864
- package/dist/cjs/w/messenger/crypto.js +1 -380
- package/dist/cjs/w/messenger/index.js +1 -4
- package/dist/cjs/w/messenger/messenger-api.js +1 -1154
- package/dist/cjs/w/messenger/messenger-manager.js +1 -1003
- package/dist/cjs/w/messenger/messenger.js +1 -1093
- package/dist/cjs/w/messenger/server.js +1 -343
- package/dist/cjs/w/messenger/session.js +1 -628
- package/dist/cjs/w/messenger/storage.js +1 -1023
- package/dist/cjs/w/messenger/templates/wts-html-template.js +1 -371
- package/dist/cjs/w/messenger/types.js +1 -76
- package/dist/cjs/w/messenger/utils.js +1 -12
- package/dist/cjs/w/query/bult-in.js +1 -95
- package/dist/cjs/w/query/event.js +1 -137
- package/dist/cjs/w/query/index.js +1 -5
- package/dist/cjs/w/query/object.js +1 -1550
- package/dist/cjs/w/query/received.js +1 -62
- package/dist/cjs/w/query/util.js +1 -49
- package/dist/cjs/w/util.js +1 -587
- package/dist/esm/bcs/bcs.js +1 -253
- package/dist/esm/bcs/effects.js +1 -199
- package/dist/esm/bcs/index.js +1 -51
- package/dist/esm/bcs/pure.js +1 -36
- package/dist/esm/bcs/type-tag-serializer.js +1 -104
- package/dist/esm/bcs/types.js +1 -3
- package/dist/esm/client/index.js +1 -4
- package/dist/esm/client/network.js +1 -15
- package/dist/esm/cryptography/index.js +1 -6
- package/dist/esm/cryptography/intent.js +1 -14
- package/dist/esm/cryptography/keypair.js +1 -74
- package/dist/esm/cryptography/mnemonics.js +1 -20
- package/dist/esm/cryptography/publickey.js +1 -80
- package/dist/esm/cryptography/signature-scheme.js +1 -22
- package/dist/esm/cryptography/signature.js +1 -41
- package/dist/esm/experimental/cache.js +1 -58
- package/dist/esm/experimental/client.js +1 -19
- package/dist/esm/experimental/core.js +1 -80
- package/dist/esm/experimental/errors.js +1 -24
- package/dist/esm/experimental/index.js +1 -5
- package/dist/esm/experimental/persistent-storage.js +1 -220
- package/dist/esm/experimental/persistent-storage.test.js +1 -144
- package/dist/esm/experimental/transports/utils.js +1 -96
- package/dist/esm/experimental/types.js +1 -1
- package/dist/esm/faucet/faucet.js +1 -99
- package/dist/esm/faucet/index.js +1 -1
- package/dist/esm/grpc/client.js +1 -42
- package/dist/esm/grpc/core.js +1 -587
- package/dist/esm/grpc/index.js +1 -2
- package/dist/esm/grpc/proto/google/protobuf/any.js +1 -106
- package/dist/esm/grpc/proto/google/protobuf/duration.js +1 -58
- package/dist/esm/grpc/proto/google/protobuf/empty.js +1 -7
- package/dist/esm/grpc/proto/google/protobuf/field_mask.js +1 -47
- package/dist/esm/grpc/proto/google/protobuf/struct.js +1 -191
- package/dist/esm/grpc/proto/google/protobuf/timestamp.js +1 -91
- package/dist/esm/grpc/proto/google/rpc/error_details.js +1 -265
- package/dist/esm/grpc/proto/google/rpc/status.js +1 -23
- package/dist/esm/grpc/proto/sui/rpc/v2/argument.js +1 -46
- package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.js +1 -29
- package/dist/esm/grpc/proto/sui/rpc/v2/bcs.js +1 -22
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.js +1 -54
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.js +1 -60
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.js +1 -144
- package/dist/esm/grpc/proto/sui/rpc/v2/effects.js +1 -271
- package/dist/esm/grpc/proto/sui/rpc/v2/epoch.js +1 -64
- package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.js +1 -6
- package/dist/esm/grpc/proto/sui/rpc/v2/event.js +1 -62
- package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.js +1 -64
- package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.js +1 -481
- package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.js +1 -40
- package/dist/esm/grpc/proto/sui/rpc/v2/input.js +1 -61
- package/dist/esm/grpc/proto/sui/rpc/v2/jwk.js +1 -57
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.js +1 -39
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.js +1 -329
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package.js +1 -447
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.js +1 -27
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.js +1 -206
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.client.js +1 -19
- package/dist/esm/grpc/proto/sui/rpc/v2/name_service.js +1 -109
- package/dist/esm/grpc/proto/sui/rpc/v2/object.js +1 -90
- package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.js +1 -30
- package/dist/esm/grpc/proto/sui/rpc/v2/owner.js +1 -39
- package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.js +1 -30
- package/dist/esm/grpc/proto/sui/rpc/v2/signature.js +1 -501
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.js +1 -10
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +1 -15
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.js +1 -62
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.js +1 -31
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.js +1 -504
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.js +1 -15
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.js +1 -37
- package/dist/esm/grpc/proto/sui/rpc/v2/system_state.js +1 -709
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction.js +1 -950
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +1 -19
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.js +1 -144
- package/dist/esm/index.js +1 -22
- package/dist/esm/jsonRpc/client.js +1 -516
- package/dist/esm/jsonRpc/core.js +1 -587
- package/dist/esm/jsonRpc/errors.js +1 -38
- package/dist/esm/jsonRpc/http-transport.js +1 -70
- package/dist/esm/jsonRpc/index.js +1 -3
- package/dist/esm/jsonRpc/json-rpc-resolver.js +1 -296
- package/dist/esm/jsonRpc/rpc-websocket-client.js +1 -155
- package/dist/esm/jsonRpc/types/chain.js +1 -1
- package/dist/esm/jsonRpc/types/changes.js +1 -1
- package/dist/esm/jsonRpc/types/coins.js +1 -1
- package/dist/esm/jsonRpc/types/common.js +1 -1
- package/dist/esm/jsonRpc/types/generated.js +1 -1
- package/dist/esm/jsonRpc/types/index.js +1 -1
- package/dist/esm/jsonRpc/types/params.js +1 -1
- package/dist/esm/keypairs/ed25519/ed25519-hd-key.js +1 -58
- package/dist/esm/keypairs/ed25519/index.js +1 -2
- package/dist/esm/keypairs/ed25519/keypair.js +1 -90
- package/dist/esm/keypairs/ed25519/publickey.js +1 -50
- package/dist/esm/keypairs/index.js +1 -4
- package/dist/esm/keypairs/passkey/index.js +1 -2
- package/dist/esm/keypairs/passkey/keypair.js +1 -155
- package/dist/esm/keypairs/passkey/publickey.js +1 -117
- package/dist/esm/keypairs/passkey/types.js +1 -1
- package/dist/esm/keypairs/secp256k1/index.js +1 -2
- package/dist/esm/keypairs/secp256k1/keypair.js +1 -82
- package/dist/esm/keypairs/secp256k1/publickey.js +1 -51
- package/dist/esm/keypairs/secp256r1/index.js +1 -2
- package/dist/esm/keypairs/secp256r1/keypair.js +1 -78
- package/dist/esm/keypairs/secp256r1/publickey.js +1 -52
- package/dist/esm/multisig/index.js +1 -2
- package/dist/esm/multisig/publickey.js +1 -201
- package/dist/esm/multisig/signer.js +1 -58
- package/dist/esm/transactions/Arguments.js +1 -9
- package/dist/esm/transactions/Commands.js +1 -102
- package/dist/esm/transactions/Inputs.js +1 -52
- package/dist/esm/transactions/ObjectCache.js +1 -205
- package/dist/esm/transactions/Transaction.js +1 -574
- package/dist/esm/transactions/TransactionData.js +1 -409
- package/dist/esm/transactions/__tests__/Transaction.test.js +1 -160
- package/dist/esm/transactions/__tests__/bcs.test.js +1 -182
- package/dist/esm/transactions/data/internal.js +1 -169
- package/dist/esm/transactions/data/v1.js +1 -469
- package/dist/esm/transactions/data/v2.js +1 -97
- package/dist/esm/transactions/executor/caching.js +1 -65
- package/dist/esm/transactions/executor/parallel.js +1 -347
- package/dist/esm/transactions/executor/queue.js +1 -59
- package/dist/esm/transactions/executor/serial.js +1 -99
- package/dist/esm/transactions/hash.js +1 -8
- package/dist/esm/transactions/index.js +1 -12
- package/dist/esm/transactions/intents/CoinWithBalance.js +1 -145
- package/dist/esm/transactions/object.js +1 -87
- package/dist/esm/transactions/plugins/NamedPackagesPlugin.js +1 -11
- package/dist/esm/transactions/pure.js +1 -36
- package/dist/esm/transactions/resolve.js +1 -69
- package/dist/esm/transactions/serializer.js +1 -167
- package/dist/esm/transactions/utils.js +1 -121
- package/dist/esm/utils/constants.js +1 -18
- package/dist/esm/utils/derived-objects.js +1 -8
- package/dist/esm/utils/dynamic-fields.js +1 -17
- package/dist/esm/utils/format.js +1 -11
- package/dist/esm/utils/index.js +1 -8
- package/dist/esm/utils/move-registry.js +1 -24
- package/dist/esm/utils/sui-types.js +1 -66
- package/dist/esm/utils/suins.js +1 -33
- package/dist/esm/verify/index.js +1 -1
- package/dist/esm/verify/verify.js +1 -87
- package/dist/esm/version.js +1 -2
- package/dist/esm/w/call/allocation.js +1 -345
- package/dist/esm/w/call/arb.js +1 -103
- package/dist/esm/w/call/arbitration.js +1 -1192
- package/dist/esm/w/call/base.js +1 -293
- package/dist/esm/w/call/contact.js +1 -345
- package/dist/esm/w/call/demand.js +1 -681
- package/dist/esm/w/call/entity.js +1 -173
- package/dist/esm/w/call/guard-ins.js +1 -4449
- package/dist/esm/w/call/guard.d.ts +111 -0
- package/dist/esm/w/call/guard.js +1 -1048
- package/dist/esm/w/call/index.js +1 -22
- package/dist/esm/w/call/machine.js +1 -1127
- package/dist/esm/w/call/order.js +1 -337
- package/dist/esm/w/call/passport.js +1 -220
- package/dist/esm/w/call/payment.js +1 -178
- package/dist/esm/w/call/permission.js +1 -1162
- package/dist/esm/w/call/personal.js +1 -139
- package/dist/esm/w/call/progress.js +1 -678
- package/dist/esm/w/call/proof.js +1 -66
- package/dist/esm/w/call/repository.js +1 -1024
- package/dist/esm/w/call/resource.js +1 -108
- package/dist/esm/w/call/reward.js +1 -675
- package/dist/esm/w/call/service.js +1 -1960
- package/dist/esm/w/call/treasury.js +1 -873
- package/dist/esm/w/call/util.d.ts +1 -0
- package/dist/esm/w/call/util.js +1 -566
- package/dist/esm/w/common.js +1 -571
- package/dist/esm/w/exception.js +1 -618
- package/dist/esm/w/index.js +1 -8
- package/dist/esm/w/local/account.js +1 -656
- package/dist/esm/w/local/cache.js +1 -161
- package/dist/esm/w/local/config.js +1 -43
- package/dist/esm/w/local/index.js +1 -228
- package/dist/esm/w/local/local.js +1 -574
- package/dist/esm/w/local/storage.js +1 -185
- package/dist/esm/w/local/token.js +1 -131
- package/dist/esm/w/local/util.js +1 -26
- package/dist/esm/w/local/wip.js +1 -864
- package/dist/esm/w/messenger/crypto.js +1 -380
- package/dist/esm/w/messenger/index.js +1 -4
- package/dist/esm/w/messenger/messenger-api.js +1 -1154
- package/dist/esm/w/messenger/messenger-manager.js +1 -1003
- package/dist/esm/w/messenger/messenger.js +1 -1093
- package/dist/esm/w/messenger/server.js +1 -343
- package/dist/esm/w/messenger/session.js +1 -628
- package/dist/esm/w/messenger/storage.js +1 -1023
- package/dist/esm/w/messenger/templates/wts-html-template.js +1 -371
- package/dist/esm/w/messenger/types.js +1 -76
- package/dist/esm/w/messenger/utils.js +1 -12
- package/dist/esm/w/query/bult-in.js +1 -95
- package/dist/esm/w/query/event.js +1 -137
- package/dist/esm/w/query/index.js +1 -5
- package/dist/esm/w/query/object.js +1 -1550
- package/dist/esm/w/query/received.js +1 -62
- package/dist/esm/w/query/util.js +1 -49
- package/dist/esm/w/util.js +1 -587
- package/package.json +5 -2
|
@@ -1,145 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { bcs } from "../../bcs/index.js";
|
|
3
|
-
import { normalizeStructTag } from "../../utils/sui-types.js";
|
|
4
|
-
import { Commands } from "../Commands.js";
|
|
5
|
-
import { Inputs } from "../Inputs.js";
|
|
6
|
-
import { getClient } from "../resolve.js";
|
|
7
|
-
const COIN_WITH_BALANCE = "CoinWithBalance";
|
|
8
|
-
const SUI_TYPE = normalizeStructTag("0x2::sui::SUI");
|
|
9
|
-
export function coinWithBalance({ type = SUI_TYPE, balance, useGasCoin = true, }) {
|
|
10
|
-
let coinResult = null;
|
|
11
|
-
return (tx) => {
|
|
12
|
-
if (coinResult) {
|
|
13
|
-
return coinResult;
|
|
14
|
-
}
|
|
15
|
-
tx.addIntentResolver(COIN_WITH_BALANCE, resolveCoinBalance);
|
|
16
|
-
const coinType = type === "gas" ? type : normalizeStructTag(type);
|
|
17
|
-
coinResult = tx.add(Commands.Intent({
|
|
18
|
-
name: COIN_WITH_BALANCE,
|
|
19
|
-
inputs: {},
|
|
20
|
-
data: {
|
|
21
|
-
type: coinType === SUI_TYPE && useGasCoin ? "gas" : coinType,
|
|
22
|
-
balance: BigInt(balance),
|
|
23
|
-
},
|
|
24
|
-
}));
|
|
25
|
-
return coinResult;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
const CoinWithBalanceData = object({
|
|
29
|
-
type: string(),
|
|
30
|
-
balance: bigint(),
|
|
31
|
-
});
|
|
32
|
-
async function resolveCoinBalance(transactionData, buildOptions, next) {
|
|
33
|
-
const coinTypes = new Set();
|
|
34
|
-
const totalByType = new Map();
|
|
35
|
-
if (!transactionData.sender) {
|
|
36
|
-
throw new Error("Sender must be set to resolve CoinWithBalance");
|
|
37
|
-
}
|
|
38
|
-
for (const command of transactionData.commands) {
|
|
39
|
-
if (command.$kind === "$Intent" &&
|
|
40
|
-
command.$Intent.name === COIN_WITH_BALANCE) {
|
|
41
|
-
const { type, balance } = parse(CoinWithBalanceData, command.$Intent.data);
|
|
42
|
-
if (type !== "gas" && balance > 0n) {
|
|
43
|
-
coinTypes.add(type);
|
|
44
|
-
}
|
|
45
|
-
totalByType.set(type, (totalByType.get(type) ?? 0n) + balance);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
const usedIds = new Set();
|
|
49
|
-
for (const input of transactionData.inputs) {
|
|
50
|
-
if (input.Object?.ImmOrOwnedObject) {
|
|
51
|
-
usedIds.add(input.Object.ImmOrOwnedObject.objectId);
|
|
52
|
-
}
|
|
53
|
-
if (input.UnresolvedObject?.objectId) {
|
|
54
|
-
usedIds.add(input.UnresolvedObject.objectId);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
const coinsByType = new Map();
|
|
58
|
-
const client = getSuiClient(buildOptions);
|
|
59
|
-
await Promise.all([...coinTypes].map(async (coinType) => {
|
|
60
|
-
coinsByType.set(coinType, await getCoinsOfType({
|
|
61
|
-
coinType,
|
|
62
|
-
balance: totalByType.get(coinType),
|
|
63
|
-
client,
|
|
64
|
-
owner: transactionData.sender,
|
|
65
|
-
usedIds,
|
|
66
|
-
}));
|
|
67
|
-
}));
|
|
68
|
-
const mergedCoins = new Map();
|
|
69
|
-
mergedCoins.set("gas", { $kind: "GasCoin", GasCoin: true });
|
|
70
|
-
for (const [index, transaction] of transactionData.commands.entries()) {
|
|
71
|
-
if (transaction.$kind !== "$Intent" ||
|
|
72
|
-
transaction.$Intent.name !== COIN_WITH_BALANCE) {
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
const { type, balance } = transaction.$Intent.data;
|
|
76
|
-
if (balance === 0n && type !== "gas") {
|
|
77
|
-
transactionData.replaceCommand(index, Commands.MoveCall({
|
|
78
|
-
target: "0x2::coin::zero",
|
|
79
|
-
typeArguments: [type],
|
|
80
|
-
}));
|
|
81
|
-
continue;
|
|
82
|
-
}
|
|
83
|
-
const commands = [];
|
|
84
|
-
if (!mergedCoins.has(type)) {
|
|
85
|
-
const [first, ...rest] = coinsByType.get(type).map((coin) => transactionData.addInput("object", Inputs.ObjectRef({
|
|
86
|
-
objectId: coin.coinObjectId,
|
|
87
|
-
digest: coin.digest,
|
|
88
|
-
version: coin.version,
|
|
89
|
-
})));
|
|
90
|
-
if (rest.length > 0) {
|
|
91
|
-
commands.push(Commands.MergeCoins(first, rest));
|
|
92
|
-
}
|
|
93
|
-
mergedCoins.set(type, first);
|
|
94
|
-
}
|
|
95
|
-
commands.push(Commands.SplitCoins(mergedCoins.get(type), [
|
|
96
|
-
transactionData.addInput("pure", Inputs.Pure(bcs.u64().serialize(balance))),
|
|
97
|
-
]));
|
|
98
|
-
transactionData.replaceCommand(index, commands);
|
|
99
|
-
transactionData.mapArguments((arg) => {
|
|
100
|
-
if (arg.$kind === "Result" && arg.Result === index) {
|
|
101
|
-
return {
|
|
102
|
-
$kind: "NestedResult",
|
|
103
|
-
NestedResult: [index + commands.length - 1, 0],
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
return arg;
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
return next();
|
|
110
|
-
}
|
|
111
|
-
async function getCoinsOfType({ coinType, balance, client, owner, usedIds, }) {
|
|
112
|
-
let remainingBalance = balance;
|
|
113
|
-
const coins = [];
|
|
114
|
-
return loadMoreCoins();
|
|
115
|
-
async function loadMoreCoins(cursor = null) {
|
|
116
|
-
const { data, hasNextPage, nextCursor } = await client.getCoins({
|
|
117
|
-
owner,
|
|
118
|
-
coinType,
|
|
119
|
-
cursor,
|
|
120
|
-
});
|
|
121
|
-
const sortedCoins = data.sort((a, b) => Number(BigInt(b.balance) - BigInt(a.balance)));
|
|
122
|
-
for (const coin of sortedCoins) {
|
|
123
|
-
if (usedIds.has(coin.coinObjectId)) {
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
const coinBalance = BigInt(coin.balance);
|
|
127
|
-
coins.push(coin);
|
|
128
|
-
remainingBalance -= coinBalance;
|
|
129
|
-
if (remainingBalance <= 0) {
|
|
130
|
-
return coins;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
if (hasNextPage) {
|
|
134
|
-
return loadMoreCoins(nextCursor);
|
|
135
|
-
}
|
|
136
|
-
throw new Error(`Not enough coins of type ${coinType} to satisfy requested balance`);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
export function getSuiClient(options) {
|
|
140
|
-
const client = getClient(options);
|
|
141
|
-
if (!client.jsonRpc) {
|
|
142
|
-
throw new Error(`CoinWithBalance intent currently only works with SuiClient`);
|
|
143
|
-
}
|
|
144
|
-
return client;
|
|
145
|
-
}
|
|
1
|
+
import{bigint,object,parse,string}from'valibot';import{bcs}from'../../bcs/index.js';import{normalizeStructTag}from'../../utils/sui-types.js';import{Commands}from'../Commands.js';import{Inputs}from'../Inputs.js';import{getClient}from'../resolve.js';const COIN_WITH_BALANCE='CoinWithBalance',SUI_TYPE=normalizeStructTag('0x2::sui::SUI');export function coinWithBalance({type:type=SUI_TYPE,balance:a,useGasCoin:useGasCoin=!![]}){let b=null;return c=>{if(b)return b;c['addIntentResolver'](COIN_WITH_BALANCE,resolveCoinBalance);const d=type==='gas'?type:normalizeStructTag(type);return b=c['add'](Commands['Intent']({'name':COIN_WITH_BALANCE,'inputs':{},'data':{'type':d===SUI_TYPE&&useGasCoin?'gas':d,'balance':BigInt(a)}})),b;};}const CoinWithBalanceData=object({'type':string(),'balance':bigint()});async function resolveCoinBalance(a,b,c){const d=new Set(),e=new Map();if(!a['sender'])throw new Error('Sender\x20must\x20be\x20set\x20to\x20resolve\x20CoinWithBalance');for(const j of a['commands']){if(j['$kind']==='$Intent'&&j['$Intent']['name']===COIN_WITH_BALANCE){const {type:k,balance:l}=parse(CoinWithBalanceData,j['$Intent']['data']);k!=='gas'&&l>0x0n&&d['add'](k),e['set'](k,(e['get'](k)??0x0n)+l);}}const f=new Set();for(const m of a['inputs']){m['Object']?.['ImmOrOwnedObject']&&f['add'](m['Object']['ImmOrOwnedObject']['objectId']),m['UnresolvedObject']?.['objectId']&&f['add'](m['UnresolvedObject']['objectId']);}const g=new Map(),h=getSuiClient(b);await Promise['all']([...d]['map'](async n=>{g['set'](n,await getCoinsOfType({'coinType':n,'balance':e['get'](n),'client':h,'owner':a['sender'],'usedIds':f}));}));const i=new Map();i['set']('gas',{'$kind':'GasCoin','GasCoin':!![]});for(const [n,o]of a['commands']['entries']()){if(o['$kind']!=='$Intent'||o['$Intent']['name']!==COIN_WITH_BALANCE)continue;const {type:p,balance:q}=o['$Intent']['data'];if(q===0x0n&&p!=='gas'){a['replaceCommand'](n,Commands['MoveCall']({'target':'0x2::coin::zero','typeArguments':[p]}));continue;}const r=[];if(!i['has'](p)){const [s,...t]=g['get'](p)['map'](u=>a['addInput']('object',Inputs['ObjectRef']({'objectId':u['coinObjectId'],'digest':u['digest'],'version':u['version']})));t['length']>0x0&&r['push'](Commands['MergeCoins'](s,t)),i['set'](p,s);}r['push'](Commands['SplitCoins'](i['get'](p),[a['addInput']('pure',Inputs['Pure'](bcs['u64']()['serialize'](q)))])),a['replaceCommand'](n,r),a['mapArguments'](u=>{if(u['$kind']==='Result'&&u['Result']===n)return{'$kind':'NestedResult','NestedResult':[n+r['length']-0x1,0x0]};return u;});}return c();}async function getCoinsOfType({coinType:a,balance:b,client:c,owner:d,usedIds:e}){let f=b;const g=[];return h();async function h(i=null){const {data:j,hasNextPage:k,nextCursor:l}=await c['getCoins']({'owner':d,'coinType':a,'cursor':i}),m=j['sort']((n,o)=>Number(BigInt(o['balance'])-BigInt(n['balance'])));for(const n of m){if(e['has'](n['coinObjectId']))continue;const o=BigInt(n['balance']);g['push'](n),f-=o;if(f<=0x0)return g;}if(k)return h(l);throw new Error('Not\x20enough\x20coins\x20of\x20type\x20'+a+'\x20to\x20satisfy\x20requested\x20balance');}}export function getSuiClient(a){const b=getClient(a);if(!b['jsonRpc'])throw new Error('CoinWithBalance\x20intent\x20currently\x20only\x20works\x20with\x20SuiClient');return b;}
|
|
@@ -1,87 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export function createObjectMethods(makeObject) {
|
|
3
|
-
function object(value) {
|
|
4
|
-
return makeObject(value);
|
|
5
|
-
}
|
|
6
|
-
object.system = (options) => {
|
|
7
|
-
const mutable = options?.mutable;
|
|
8
|
-
if (mutable !== undefined) {
|
|
9
|
-
return object(Inputs.SharedObjectRef({
|
|
10
|
-
objectId: "0x5",
|
|
11
|
-
initialSharedVersion: 1,
|
|
12
|
-
mutable,
|
|
13
|
-
}));
|
|
14
|
-
}
|
|
15
|
-
return object({
|
|
16
|
-
$kind: "UnresolvedObject",
|
|
17
|
-
UnresolvedObject: {
|
|
18
|
-
objectId: "0x5",
|
|
19
|
-
initialSharedVersion: 1,
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
object.clock = () => object(Inputs.SharedObjectRef({
|
|
24
|
-
objectId: "0x6",
|
|
25
|
-
initialSharedVersion: 1,
|
|
26
|
-
mutable: false,
|
|
27
|
-
}));
|
|
28
|
-
object.random = () => object({
|
|
29
|
-
$kind: "UnresolvedObject",
|
|
30
|
-
UnresolvedObject: {
|
|
31
|
-
objectId: "0x8",
|
|
32
|
-
mutable: false,
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
object.denyList = (options) => {
|
|
36
|
-
return object({
|
|
37
|
-
$kind: "UnresolvedObject",
|
|
38
|
-
UnresolvedObject: {
|
|
39
|
-
objectId: "0x403",
|
|
40
|
-
mutable: options?.mutable,
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
object.registrar = (options) => {
|
|
45
|
-
return object({
|
|
46
|
-
$kind: "UnresolvedObject",
|
|
47
|
-
UnresolvedObject: {
|
|
48
|
-
objectId: "0xaaa",
|
|
49
|
-
mutable: options?.mutable,
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
object.mutRegistrar = () => {
|
|
54
|
-
return object({
|
|
55
|
-
$kind: "UnresolvedObject",
|
|
56
|
-
UnresolvedObject: {
|
|
57
|
-
objectId: "0xaaa",
|
|
58
|
-
mutable: true,
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
object.entity = (options) => {
|
|
63
|
-
return object({
|
|
64
|
-
$kind: "UnresolvedObject",
|
|
65
|
-
UnresolvedObject: {
|
|
66
|
-
objectId: "0xaab",
|
|
67
|
-
mutable: options?.mutable,
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
object.mutEntity = () => {
|
|
72
|
-
return object({
|
|
73
|
-
$kind: "UnresolvedObject",
|
|
74
|
-
UnresolvedObject: {
|
|
75
|
-
objectId: "0xaab",
|
|
76
|
-
mutable: true,
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
object.option =
|
|
81
|
-
({ type, value, }) => (tx) => tx.moveCall({
|
|
82
|
-
typeArguments: [type],
|
|
83
|
-
target: `0x1::option::${value === null ? "none" : "some"}`,
|
|
84
|
-
arguments: value === null ? [] : [tx.object(value)],
|
|
85
|
-
});
|
|
86
|
-
return object;
|
|
87
|
-
}
|
|
1
|
+
import{Inputs}from'./Inputs.js';export function createObjectMethods(a){function b(c){return a(c);}return b['system']=c=>{const d=c?.['mutable'];if(d!==undefined)return b(Inputs['SharedObjectRef']({'objectId':'0x5','initialSharedVersion':0x1,'mutable':d}));return b({'$kind':'UnresolvedObject','UnresolvedObject':{'objectId':'0x5','initialSharedVersion':0x1}});},b['clock']=()=>b(Inputs['SharedObjectRef']({'objectId':'0x6','initialSharedVersion':0x1,'mutable':![]})),b['random']=()=>b({'$kind':'UnresolvedObject','UnresolvedObject':{'objectId':'0x8','mutable':![]}}),b['denyList']=c=>{return b({'$kind':'UnresolvedObject','UnresolvedObject':{'objectId':'0x403','mutable':c?.['mutable']}});},b['registrar']=c=>{return b({'$kind':'UnresolvedObject','UnresolvedObject':{'objectId':'0xaaa','mutable':c?.['mutable']}});},b['mutRegistrar']=()=>{return b({'$kind':'UnresolvedObject','UnresolvedObject':{'objectId':'0xaaa','mutable':!![]}});},b['entity']=c=>{return b({'$kind':'UnresolvedObject','UnresolvedObject':{'objectId':'0xaab','mutable':c?.['mutable']}});},b['mutEntity']=()=>{return b({'$kind':'UnresolvedObject','UnresolvedObject':{'objectId':'0xaab','mutable':!![]}});},b['option']=({type:c,value:d})=>e=>e['moveCall']({'typeArguments':[c],'target':'0x1::option::'+(d===null?'none':'some'),'arguments':d===null?[]:[e['object'](d)]}),b;}
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
export const namedPackagesPlugin
|
|
2
|
-
return async (_transactionData, _buildOptions, next) => {
|
|
3
|
-
await next();
|
|
4
|
-
};
|
|
5
|
-
};
|
|
6
|
-
export function getClient(options) {
|
|
7
|
-
if (!options.client) {
|
|
8
|
-
throw new Error(`No wowok client passed to Transaction#build, but transaction data was not sufficient to build offline.`);
|
|
9
|
-
}
|
|
10
|
-
return options.client;
|
|
11
|
-
}
|
|
1
|
+
export const namedPackagesPlugin=a=>{return async(b,c,d)=>{await d();};};export function getClient(a){if(!a['client'])throw new Error('No\x20wowok\x20client\x20passed\x20to\x20Transaction#build,\x20but\x20transaction\x20data\x20was\x20not\x20sufficient\x20to\x20build\x20offline.');return a['client'];}
|
|
@@ -1,36 +1 @@
|
|
|
1
|
-
import { isSerializedBcs }
|
|
2
|
-
import { bcs } from "../bcs/index.js";
|
|
3
|
-
import { pureBcsSchemaFromTypeName } from "../bcs/pure.js";
|
|
4
|
-
export function createPure(makePure) {
|
|
5
|
-
function pure(typeOrSerializedValue, value) {
|
|
6
|
-
if (typeof typeOrSerializedValue === "string") {
|
|
7
|
-
return makePure(pureBcsSchemaFromTypeName(typeOrSerializedValue).serialize(value));
|
|
8
|
-
}
|
|
9
|
-
if (typeOrSerializedValue instanceof Uint8Array ||
|
|
10
|
-
isSerializedBcs(typeOrSerializedValue)) {
|
|
11
|
-
return makePure(typeOrSerializedValue);
|
|
12
|
-
}
|
|
13
|
-
throw new Error("tx.pure must be called either a bcs type name, or a serialized bcs value");
|
|
14
|
-
}
|
|
15
|
-
pure.u8 = (value) => makePure(bcs.U8.serialize(value));
|
|
16
|
-
pure.u16 = (value) => makePure(bcs.U16.serialize(value));
|
|
17
|
-
pure.u32 = (value) => makePure(bcs.U32.serialize(value));
|
|
18
|
-
pure.u64 = (value) => makePure(bcs.U64.serialize(value));
|
|
19
|
-
pure.u128 = (value) => makePure(bcs.U128.serialize(value));
|
|
20
|
-
pure.u256 = (value) => makePure(bcs.U256.serialize(value));
|
|
21
|
-
pure.bool = (value) => makePure(bcs.Bool.serialize(value));
|
|
22
|
-
pure.string = (value) => makePure(bcs.String.serialize(value));
|
|
23
|
-
pure.address = (value) => makePure(bcs.Address.serialize(value));
|
|
24
|
-
pure.id = pure.address;
|
|
25
|
-
pure.vector = (type, value) => {
|
|
26
|
-
return makePure(bcs
|
|
27
|
-
.vector(pureBcsSchemaFromTypeName(type))
|
|
28
|
-
.serialize(value));
|
|
29
|
-
};
|
|
30
|
-
pure.option = (type, value) => {
|
|
31
|
-
return makePure(bcs
|
|
32
|
-
.option(pureBcsSchemaFromTypeName(type))
|
|
33
|
-
.serialize(value));
|
|
34
|
-
};
|
|
35
|
-
return pure;
|
|
36
|
-
}
|
|
1
|
+
import{isSerializedBcs}from'@mysten/bcs';import{bcs}from'../bcs/index.js';import{pureBcsSchemaFromTypeName}from'../bcs/pure.js';export function createPure(a){function b(c,d){if(typeof c==='string')return a(pureBcsSchemaFromTypeName(c)['serialize'](d));if(c instanceof Uint8Array||isSerializedBcs(c))return a(c);throw new Error('tx.pure\x20must\x20be\x20called\x20either\x20a\x20bcs\x20type\x20name,\x20or\x20a\x20serialized\x20bcs\x20value');}return b['u8']=c=>a(bcs['U8']['serialize'](c)),b['u16']=c=>a(bcs['U16']['serialize'](c)),b['u32']=c=>a(bcs['U32']['serialize'](c)),b['u64']=c=>a(bcs['U64']['serialize'](c)),b['u128']=c=>a(bcs['U128']['serialize'](c)),b['u256']=c=>a(bcs['U256']['serialize'](c)),b['bool']=c=>a(bcs['Bool']['serialize'](c)),b['string']=c=>a(bcs['String']['serialize'](c)),b['address']=c=>a(bcs['Address']['serialize'](c)),b['id']=b['address'],b['vector']=(c,d)=>{return a(bcs['vector'](pureBcsSchemaFromTypeName(c))['serialize'](d));},b['option']=(c,d)=>{return a(bcs['option'](pureBcsSchemaFromTypeName(c))['serialize'](d));},b;}
|
|
@@ -1,69 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { bcs } from "../bcs/index.js";
|
|
3
|
-
import { jsonRpcClientResolveTransactionPlugin } from "../jsonRpc/json-rpc-resolver.js";
|
|
4
|
-
export function needsTransactionResolution(data, options) {
|
|
5
|
-
if (data.inputs.some((input) => {
|
|
6
|
-
return input.UnresolvedObject || input.UnresolvedPure;
|
|
7
|
-
})) {
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
if (!options.onlyTransactionKind) {
|
|
11
|
-
if (!data.gasConfig.price ||
|
|
12
|
-
!data.gasConfig.budget ||
|
|
13
|
-
!data.gasConfig.payment) {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
export async function resolveTransactionPlugin(transactionData, options, next) {
|
|
20
|
-
normalizeRawArguments(transactionData);
|
|
21
|
-
if (!needsTransactionResolution(transactionData, options)) {
|
|
22
|
-
await validate(transactionData);
|
|
23
|
-
return next();
|
|
24
|
-
}
|
|
25
|
-
const client = getClient(options);
|
|
26
|
-
const plugin = client.core?.resolveTransactionPlugin() ??
|
|
27
|
-
jsonRpcClientResolveTransactionPlugin(client);
|
|
28
|
-
return plugin(transactionData, options, async () => {
|
|
29
|
-
await validate(transactionData);
|
|
30
|
-
await next();
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
function validate(transactionData) {
|
|
34
|
-
transactionData.inputs.forEach((input, index) => {
|
|
35
|
-
if (input.$kind !== "Object" && input.$kind !== "Pure") {
|
|
36
|
-
throw new Error(`Input at index ${index} has not been resolved. Expected a Pure or Object input, but found ${JSON.stringify(input)}`);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
export function getClient(options) {
|
|
41
|
-
if (!options.client) {
|
|
42
|
-
throw new Error(`No wowok client passed to Transaction#build, but transaction data was not sufficient to build offline.`);
|
|
43
|
-
}
|
|
44
|
-
return options.client;
|
|
45
|
-
}
|
|
46
|
-
function normalizeRawArguments(transactionData) {
|
|
47
|
-
for (const command of transactionData.commands) {
|
|
48
|
-
switch (command.$kind) {
|
|
49
|
-
case "SplitCoins":
|
|
50
|
-
command.SplitCoins.amounts.forEach((amount) => {
|
|
51
|
-
normalizeRawArgument(amount, bcs.U64, transactionData);
|
|
52
|
-
});
|
|
53
|
-
break;
|
|
54
|
-
case "TransferObjects":
|
|
55
|
-
normalizeRawArgument(command.TransferObjects.address, bcs.Address, transactionData);
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function normalizeRawArgument(arg, schema, transactionData) {
|
|
61
|
-
if (arg.$kind !== "Input") {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
const input = transactionData.inputs[arg.Input];
|
|
65
|
-
if (input.$kind !== "UnresolvedPure") {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
transactionData.inputs[arg.Input] = Inputs.Pure(schema.serialize(input.UnresolvedPure.value));
|
|
69
|
-
}
|
|
1
|
+
import{Inputs}from'./Inputs.js';import{bcs}from'../bcs/index.js';import{jsonRpcClientResolveTransactionPlugin}from'../jsonRpc/json-rpc-resolver.js';export function needsTransactionResolution(a,b){if(a['inputs']['some'](c=>{return c['UnresolvedObject']||c['UnresolvedPure'];}))return!![];if(!b['onlyTransactionKind']){if(!a['gasConfig']['price']||!a['gasConfig']['budget']||!a['gasConfig']['payment'])return!![];}return![];}export async function resolveTransactionPlugin(a,b,c){normalizeRawArguments(a);if(!needsTransactionResolution(a,b))return await validate(a),c();const d=getClient(b),e=d['core']?.['resolveTransactionPlugin']()??jsonRpcClientResolveTransactionPlugin(d);return e(a,b,async()=>{await validate(a),await c();});}function validate(a){a['inputs']['forEach']((b,c)=>{if(b['$kind']!=='Object'&&b['$kind']!=='Pure')throw new Error('Input\x20at\x20index\x20'+c+'\x20has\x20not\x20been\x20resolved.\x20\x20Expected\x20a\x20Pure\x20or\x20Object\x20input,\x20but\x20found\x20'+JSON['stringify'](b));});}export function getClient(a){if(!a['client'])throw new Error('No\x20wowok\x20client\x20passed\x20to\x20Transaction#build,\x20but\x20transaction\x20data\x20was\x20not\x20sufficient\x20to\x20build\x20offline.');return a['client'];}function normalizeRawArguments(a){for(const b of a['commands']){switch(b['$kind']){case'SplitCoins':b['SplitCoins']['amounts']['forEach'](c=>{normalizeRawArgument(c,bcs['U64'],a);});break;case'TransferObjects':normalizeRawArgument(b['TransferObjects']['address'],bcs['Address'],a);break;}}}function normalizeRawArgument(a,b,c){if(a['$kind']!=='Input')return;const d=c['inputs'][a['Input']];if(d['$kind']!=='UnresolvedPure')return;c['inputs'][a['Input']]=Inputs['Pure'](b['serialize'](d['UnresolvedPure']['value']));}
|
|
@@ -1,167 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { MOVE_STDLIB_ADDRESS, WOW_FRAMEWORK_ADDRESS } from "../utils/index.js";
|
|
3
|
-
import { normalizeWowAddress } from "../utils/sui-types.js";
|
|
4
|
-
const OBJECT_MODULE_NAME = "object";
|
|
5
|
-
const ID_STRUCT_NAME = "ID";
|
|
6
|
-
const STD_ASCII_MODULE_NAME = "ascii";
|
|
7
|
-
const STD_ASCII_STRUCT_NAME = "String";
|
|
8
|
-
const STD_UTF8_MODULE_NAME = "string";
|
|
9
|
-
const STD_UTF8_STRUCT_NAME = "String";
|
|
10
|
-
const STD_OPTION_MODULE_NAME = "option";
|
|
11
|
-
const STD_OPTION_STRUCT_NAME = "Option";
|
|
12
|
-
export function isTxContext(param) {
|
|
13
|
-
const struct = typeof param.body === "object" && "datatype" in param.body
|
|
14
|
-
? param.body.datatype
|
|
15
|
-
: null;
|
|
16
|
-
return (!!struct &&
|
|
17
|
-
normalizeWowAddress(struct.package) === normalizeWowAddress("0x2") &&
|
|
18
|
-
struct.module === "tx_context" &&
|
|
19
|
-
struct.type === "TxContext");
|
|
20
|
-
}
|
|
21
|
-
export function getPureBcsSchema(typeSignature) {
|
|
22
|
-
if (typeof typeSignature === "string") {
|
|
23
|
-
switch (typeSignature) {
|
|
24
|
-
case "address":
|
|
25
|
-
return bcs.Address;
|
|
26
|
-
case "bool":
|
|
27
|
-
return bcs.Bool;
|
|
28
|
-
case "u8":
|
|
29
|
-
return bcs.U8;
|
|
30
|
-
case "u16":
|
|
31
|
-
return bcs.U16;
|
|
32
|
-
case "u32":
|
|
33
|
-
return bcs.U32;
|
|
34
|
-
case "u64":
|
|
35
|
-
return bcs.U64;
|
|
36
|
-
case "u128":
|
|
37
|
-
return bcs.U128;
|
|
38
|
-
case "u256":
|
|
39
|
-
return bcs.U256;
|
|
40
|
-
default:
|
|
41
|
-
throw new Error(`Unknown type signature ${typeSignature}`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if ("vector" in typeSignature) {
|
|
45
|
-
if (typeSignature.vector === "u8") {
|
|
46
|
-
return bcs.byteVector().transform({
|
|
47
|
-
input: (val) => typeof val === "string"
|
|
48
|
-
? new TextEncoder().encode(val)
|
|
49
|
-
: val,
|
|
50
|
-
output: (val) => val,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
const type = getPureBcsSchema(typeSignature.vector);
|
|
54
|
-
return type ? bcs.vector(type) : null;
|
|
55
|
-
}
|
|
56
|
-
if ("datatype" in typeSignature) {
|
|
57
|
-
const pkg = normalizeWowAddress(typeSignature.datatype.package);
|
|
58
|
-
if (pkg === normalizeWowAddress(MOVE_STDLIB_ADDRESS)) {
|
|
59
|
-
if (typeSignature.datatype.module === STD_ASCII_MODULE_NAME &&
|
|
60
|
-
typeSignature.datatype.type === STD_ASCII_STRUCT_NAME) {
|
|
61
|
-
return bcs.String;
|
|
62
|
-
}
|
|
63
|
-
if (typeSignature.datatype.module === STD_UTF8_MODULE_NAME &&
|
|
64
|
-
typeSignature.datatype.type === STD_UTF8_STRUCT_NAME) {
|
|
65
|
-
return bcs.String;
|
|
66
|
-
}
|
|
67
|
-
if (typeSignature.datatype.module === STD_OPTION_MODULE_NAME &&
|
|
68
|
-
typeSignature.datatype.type === STD_OPTION_STRUCT_NAME) {
|
|
69
|
-
const type = getPureBcsSchema(typeSignature.datatype.typeParameters[0]);
|
|
70
|
-
return type ? bcs.vector(type) : null;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (pkg === normalizeWowAddress(WOW_FRAMEWORK_ADDRESS) &&
|
|
74
|
-
typeSignature.datatype.module === OBJECT_MODULE_NAME &&
|
|
75
|
-
typeSignature.datatype.type === ID_STRUCT_NAME) {
|
|
76
|
-
return bcs.Address;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
export function normalizedTypeToMoveTypeSignature(type) {
|
|
82
|
-
if (typeof type === "object" && "Reference" in type) {
|
|
83
|
-
return {
|
|
84
|
-
ref: "&",
|
|
85
|
-
body: normalizedTypeToMoveTypeSignatureBody(type.Reference),
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
if (typeof type === "object" && "MutableReference" in type) {
|
|
89
|
-
return {
|
|
90
|
-
ref: "&mut",
|
|
91
|
-
body: normalizedTypeToMoveTypeSignatureBody(type.MutableReference),
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
ref: null,
|
|
96
|
-
body: normalizedTypeToMoveTypeSignatureBody(type),
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
function normalizedTypeToMoveTypeSignatureBody(type) {
|
|
100
|
-
if (typeof type === "string") {
|
|
101
|
-
switch (type) {
|
|
102
|
-
case "Address":
|
|
103
|
-
return "address";
|
|
104
|
-
case "Bool":
|
|
105
|
-
return "bool";
|
|
106
|
-
case "U8":
|
|
107
|
-
return "u8";
|
|
108
|
-
case "U16":
|
|
109
|
-
return "u16";
|
|
110
|
-
case "U32":
|
|
111
|
-
return "u32";
|
|
112
|
-
case "U64":
|
|
113
|
-
return "u64";
|
|
114
|
-
case "U128":
|
|
115
|
-
return "u128";
|
|
116
|
-
case "U256":
|
|
117
|
-
return "u256";
|
|
118
|
-
default:
|
|
119
|
-
throw new Error(`Unexpected type ${type}`);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if ("Vector" in type) {
|
|
123
|
-
return { vector: normalizedTypeToMoveTypeSignatureBody(type.Vector) };
|
|
124
|
-
}
|
|
125
|
-
if ("Struct" in type) {
|
|
126
|
-
return {
|
|
127
|
-
datatype: {
|
|
128
|
-
package: type.Struct.address,
|
|
129
|
-
module: type.Struct.module,
|
|
130
|
-
type: type.Struct.name,
|
|
131
|
-
typeParameters: type.Struct.typeArguments.map(normalizedTypeToMoveTypeSignatureBody),
|
|
132
|
-
},
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
if ("TypeParameter" in type) {
|
|
136
|
-
return { typeParameter: type.TypeParameter };
|
|
137
|
-
}
|
|
138
|
-
throw new Error(`Unexpected type ${JSON.stringify(type)}`);
|
|
139
|
-
}
|
|
140
|
-
export function pureBcsSchemaFromOpenMoveTypeSignatureBody(typeSignature) {
|
|
141
|
-
if (typeof typeSignature === "string") {
|
|
142
|
-
switch (typeSignature) {
|
|
143
|
-
case "address":
|
|
144
|
-
return bcs.Address;
|
|
145
|
-
case "bool":
|
|
146
|
-
return bcs.Bool;
|
|
147
|
-
case "u8":
|
|
148
|
-
return bcs.U8;
|
|
149
|
-
case "u16":
|
|
150
|
-
return bcs.U16;
|
|
151
|
-
case "u32":
|
|
152
|
-
return bcs.U32;
|
|
153
|
-
case "u64":
|
|
154
|
-
return bcs.U64;
|
|
155
|
-
case "u128":
|
|
156
|
-
return bcs.U128;
|
|
157
|
-
case "u256":
|
|
158
|
-
return bcs.U256;
|
|
159
|
-
default:
|
|
160
|
-
throw new Error(`Unknown type signature ${typeSignature}`);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
if ("vector" in typeSignature) {
|
|
164
|
-
return bcs.vector(pureBcsSchemaFromOpenMoveTypeSignatureBody(typeSignature.vector));
|
|
165
|
-
}
|
|
166
|
-
throw new Error(`Expected pure typeSignature, but got ${JSON.stringify(typeSignature)}`);
|
|
167
|
-
}
|
|
1
|
+
import{bcs}from'../bcs/index.js';import{MOVE_STDLIB_ADDRESS,WOW_FRAMEWORK_ADDRESS}from'../utils/index.js';import{normalizeWowAddress}from'../utils/sui-types.js';const OBJECT_MODULE_NAME='object',ID_STRUCT_NAME='ID',STD_ASCII_MODULE_NAME='ascii',STD_ASCII_STRUCT_NAME='String',STD_UTF8_MODULE_NAME='string',STD_UTF8_STRUCT_NAME='String',STD_OPTION_MODULE_NAME='option',STD_OPTION_STRUCT_NAME='Option';export function isTxContext(a){const b=typeof a['body']==='object'&&'datatype'in a['body']?a['body']['datatype']:null;return!!b&&normalizeWowAddress(b['package'])===normalizeWowAddress('0x2')&&b['module']==='tx_context'&&b['type']==='TxContext';}export function getPureBcsSchema(a){if(typeof a==='string')switch(a){case'address':return bcs['Address'];case'bool':return bcs['Bool'];case'u8':return bcs['U8'];case'u16':return bcs['U16'];case'u32':return bcs['U32'];case'u64':return bcs['U64'];case'u128':return bcs['U128'];case'u256':return bcs['U256'];default:throw new Error('Unknown\x20type\x20signature\x20'+a);}if('vector'in a){if(a['vector']==='u8')return bcs['byteVector']()['transform']({'input':c=>typeof c==='string'?new TextEncoder()['encode'](c):c,'output':c=>c});const b=getPureBcsSchema(a['vector']);return b?bcs['vector'](b):null;}if('datatype'in a){const c=normalizeWowAddress(a['datatype']['package']);if(c===normalizeWowAddress(MOVE_STDLIB_ADDRESS)){if(a['datatype']['module']===STD_ASCII_MODULE_NAME&&a['datatype']['type']===STD_ASCII_STRUCT_NAME)return bcs['String'];if(a['datatype']['module']===STD_UTF8_MODULE_NAME&&a['datatype']['type']===STD_UTF8_STRUCT_NAME)return bcs['String'];if(a['datatype']['module']===STD_OPTION_MODULE_NAME&&a['datatype']['type']===STD_OPTION_STRUCT_NAME){const d=getPureBcsSchema(a['datatype']['typeParameters'][0x0]);return d?bcs['vector'](d):null;}}if(c===normalizeWowAddress(WOW_FRAMEWORK_ADDRESS)&&a['datatype']['module']===OBJECT_MODULE_NAME&&a['datatype']['type']===ID_STRUCT_NAME)return bcs['Address'];}return null;}export function normalizedTypeToMoveTypeSignature(a){if(typeof a==='object'&&'Reference'in a)return{'ref':'&','body':normalizedTypeToMoveTypeSignatureBody(a['Reference'])};if(typeof a==='object'&&'MutableReference'in a)return{'ref':'&mut','body':normalizedTypeToMoveTypeSignatureBody(a['MutableReference'])};return{'ref':null,'body':normalizedTypeToMoveTypeSignatureBody(a)};}function normalizedTypeToMoveTypeSignatureBody(a){if(typeof a==='string')switch(a){case'Address':return'address';case'Bool':return'bool';case'U8':return'u8';case'U16':return'u16';case'U32':return'u32';case'U64':return'u64';case'U128':return'u128';case'U256':return'u256';default:throw new Error('Unexpected\x20type\x20'+a);}if('Vector'in a)return{'vector':normalizedTypeToMoveTypeSignatureBody(a['Vector'])};if('Struct'in a)return{'datatype':{'package':a['Struct']['address'],'module':a['Struct']['module'],'type':a['Struct']['name'],'typeParameters':a['Struct']['typeArguments']['map'](normalizedTypeToMoveTypeSignatureBody)}};if('TypeParameter'in a)return{'typeParameter':a['TypeParameter']};throw new Error('Unexpected\x20type\x20'+JSON['stringify'](a));}export function pureBcsSchemaFromOpenMoveTypeSignatureBody(a){if(typeof a==='string')switch(a){case'address':return bcs['Address'];case'bool':return bcs['Bool'];case'u8':return bcs['U8'];case'u16':return bcs['U16'];case'u32':return bcs['U32'];case'u64':return bcs['U64'];case'u128':return bcs['U128'];case'u256':return bcs['U256'];default:throw new Error('Unknown\x20type\x20signature\x20'+a);}if('vector'in a)return bcs['vector'](pureBcsSchemaFromOpenMoveTypeSignatureBody(a['vector']));throw new Error('Expected\x20pure\x20typeSignature,\x20but\x20got\x20'+JSON['stringify'](a));}
|