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,516 +1 @@
|
|
|
1
|
-
import { fromBase58, toBase64, toHex } from "@mysten/bcs";
|
|
2
|
-
import { Experimental_BaseClient } from "../experimental/client.js";
|
|
3
|
-
import { isTransaction } from "../transactions/Transaction.js";
|
|
4
|
-
import { isValidWowAddress, isValidWowObjectId, isValidTransactionDigest, normalizeWowAddress, normalizeWowObjectId, } from "../utils/sui-types.js";
|
|
5
|
-
import { JsonRpcHTTPTransport } from "./http-transport.js";
|
|
6
|
-
import { JSONRpcCoreClient } from "./core.js";
|
|
7
|
-
const SUI_CLIENT_BRAND = Symbol.for("@mysten/SuiClient");
|
|
8
|
-
export function isSuiJsonRpcClient(client) {
|
|
9
|
-
return (typeof client === "object" &&
|
|
10
|
-
client !== null &&
|
|
11
|
-
client[SUI_CLIENT_BRAND] === true);
|
|
12
|
-
}
|
|
13
|
-
export class SuiJsonRpcClient extends Experimental_BaseClient {
|
|
14
|
-
core;
|
|
15
|
-
jsonRpc = this;
|
|
16
|
-
transport;
|
|
17
|
-
get [SUI_CLIENT_BRAND]() {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
constructor(options) {
|
|
21
|
-
super({ network: options.network ?? "unknown" });
|
|
22
|
-
this.transport =
|
|
23
|
-
options.transport ?? new JsonRpcHTTPTransport({ url: options.url });
|
|
24
|
-
this.core = new JSONRpcCoreClient({
|
|
25
|
-
jsonRpcClient: this,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
async getRpcApiVersion({ signal } = {}) {
|
|
29
|
-
const resp = await this.transport.request({
|
|
30
|
-
method: "rpc.discover",
|
|
31
|
-
params: [],
|
|
32
|
-
signal,
|
|
33
|
-
});
|
|
34
|
-
return resp.info.version;
|
|
35
|
-
}
|
|
36
|
-
async getCoins({ coinType, owner, cursor, limit, signal, }) {
|
|
37
|
-
if (!owner || !isValidWowAddress(normalizeWowAddress(owner))) {
|
|
38
|
-
throw new Error("Invalid Wow address");
|
|
39
|
-
}
|
|
40
|
-
return await this.transport.request({
|
|
41
|
-
method: "wx_getCoins",
|
|
42
|
-
params: [owner, coinType, cursor, limit],
|
|
43
|
-
signal: signal,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
async getAllCoins(input) {
|
|
47
|
-
if (!input.owner ||
|
|
48
|
-
!isValidWowAddress(normalizeWowAddress(input.owner))) {
|
|
49
|
-
throw new Error("Invalid Wow address");
|
|
50
|
-
}
|
|
51
|
-
return await this.transport.request({
|
|
52
|
-
method: "wx_getAllCoins",
|
|
53
|
-
params: [input.owner, input.cursor, input.limit],
|
|
54
|
-
signal: input.signal,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
async getBalance({ owner, coinType, signal, }) {
|
|
58
|
-
if (!owner || !isValidWowAddress(normalizeWowAddress(owner))) {
|
|
59
|
-
throw new Error("Invalid Wow address");
|
|
60
|
-
}
|
|
61
|
-
return await this.transport.request({
|
|
62
|
-
method: "wx_getBalance",
|
|
63
|
-
params: [owner, coinType],
|
|
64
|
-
signal: signal,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
async getAllBalances(input) {
|
|
68
|
-
if (!input.owner ||
|
|
69
|
-
!isValidWowAddress(normalizeWowAddress(input.owner))) {
|
|
70
|
-
throw new Error("Invalid Wow address");
|
|
71
|
-
}
|
|
72
|
-
return await this.transport.request({
|
|
73
|
-
method: "wx_getAllBalances",
|
|
74
|
-
params: [input.owner],
|
|
75
|
-
signal: input.signal,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
async getCoinMetadata({ coinType, signal, }) {
|
|
79
|
-
return await this.transport.request({
|
|
80
|
-
method: "wx_getCoinMetadata",
|
|
81
|
-
params: [coinType],
|
|
82
|
-
signal: signal,
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
async getTotalSupply({ coinType, signal, }) {
|
|
86
|
-
return await this.transport.request({
|
|
87
|
-
method: "wx_getTotalSupply",
|
|
88
|
-
params: [coinType],
|
|
89
|
-
signal: signal,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
async call(method, params, { signal } = {}) {
|
|
93
|
-
return await this.transport.request({ method, params, signal });
|
|
94
|
-
}
|
|
95
|
-
async getMoveFunctionArgTypes({ package: pkg, module, function: fn, signal, }) {
|
|
96
|
-
return await this.transport.request({
|
|
97
|
-
method: "w_getMoveFunctionArgTypes",
|
|
98
|
-
params: [pkg, module, fn],
|
|
99
|
-
signal: signal,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
async getNormalizedMoveModulesByPackage({ package: pkg, signal, }) {
|
|
103
|
-
return await this.transport.request({
|
|
104
|
-
method: "w_getNormalizedMoveModulesByPackage",
|
|
105
|
-
params: [pkg],
|
|
106
|
-
signal: signal,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
async getNormalizedMoveModule({ package: pkg, module, signal, }) {
|
|
110
|
-
return await this.transport.request({
|
|
111
|
-
method: "w_getNormalizedMoveModule",
|
|
112
|
-
params: [pkg, module],
|
|
113
|
-
signal: signal,
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
async getNormalizedMoveFunction({ package: pkg, module, function: fn, signal, }) {
|
|
117
|
-
return await this.transport.request({
|
|
118
|
-
method: "w_getNormalizedMoveFunction",
|
|
119
|
-
params: [pkg, module, fn],
|
|
120
|
-
signal: signal,
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
async getNormalizedMoveStruct({ package: pkg, module, struct, signal, }) {
|
|
124
|
-
return await this.transport.request({
|
|
125
|
-
method: "w_getNormalizedMoveStruct",
|
|
126
|
-
params: [pkg, module, struct],
|
|
127
|
-
signal: signal,
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
async getOwnedObjects(input) {
|
|
131
|
-
if (!input.owner ||
|
|
132
|
-
!isValidWowAddress(normalizeWowAddress(input.owner))) {
|
|
133
|
-
throw new Error("Invalid Wow address");
|
|
134
|
-
}
|
|
135
|
-
return await this.transport.request({
|
|
136
|
-
method: "wx_getOwnedObjects",
|
|
137
|
-
params: [
|
|
138
|
-
input.owner,
|
|
139
|
-
{
|
|
140
|
-
filter: input.filter,
|
|
141
|
-
options: input.options,
|
|
142
|
-
},
|
|
143
|
-
input.cursor,
|
|
144
|
-
input.limit,
|
|
145
|
-
],
|
|
146
|
-
signal: input.signal,
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
async getObject(input) {
|
|
150
|
-
if (!input.id || !isValidWowObjectId(normalizeWowObjectId(input.id))) {
|
|
151
|
-
throw new Error("Invalid object ID");
|
|
152
|
-
}
|
|
153
|
-
return await this.transport.request({
|
|
154
|
-
method: "w_getObject",
|
|
155
|
-
params: [input.id, input.options],
|
|
156
|
-
signal: input.signal,
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
async tryGetPastObject(input) {
|
|
160
|
-
return await this.transport.request({
|
|
161
|
-
method: "w_tryGetPastObject",
|
|
162
|
-
params: [input.id, input.version, input.options],
|
|
163
|
-
signal: input.signal,
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
async multiGetObjects(input) {
|
|
167
|
-
input.ids.forEach((id) => {
|
|
168
|
-
if (!id || !isValidWowObjectId(normalizeWowObjectId(id))) {
|
|
169
|
-
throw new Error(`Invalid object ID ${id}`);
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
const hasDuplicates = input.ids.length !== new Set(input.ids).size;
|
|
173
|
-
if (hasDuplicates) {
|
|
174
|
-
throw new Error(`Duplicate object ids in batch call ${input.ids}`);
|
|
175
|
-
}
|
|
176
|
-
return await this.transport.request({
|
|
177
|
-
method: "w_multiGetObjects",
|
|
178
|
-
params: [input.ids, input.options],
|
|
179
|
-
signal: input.signal,
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
async queryTransactionBlocks({ filter, options, cursor, limit, order, signal, }) {
|
|
183
|
-
return await this.transport.request({
|
|
184
|
-
method: "wx_queryTransactionBlocks",
|
|
185
|
-
params: [
|
|
186
|
-
{
|
|
187
|
-
filter,
|
|
188
|
-
options,
|
|
189
|
-
},
|
|
190
|
-
cursor,
|
|
191
|
-
limit,
|
|
192
|
-
(order || "descending") === "descending",
|
|
193
|
-
],
|
|
194
|
-
signal,
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
async getTransactionBlock(input) {
|
|
198
|
-
if (!isValidTransactionDigest(input.digest)) {
|
|
199
|
-
throw new Error("Invalid Transaction digest");
|
|
200
|
-
}
|
|
201
|
-
return await this.transport.request({
|
|
202
|
-
method: "w_getTransactionBlock",
|
|
203
|
-
params: [input.digest, input.options],
|
|
204
|
-
signal: input.signal,
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
async multiGetTransactionBlocks(input) {
|
|
208
|
-
input.digests.forEach((d) => {
|
|
209
|
-
if (!isValidTransactionDigest(d)) {
|
|
210
|
-
throw new Error(`Invalid Transaction digest ${d}`);
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
const hasDuplicates = input.digests.length !== new Set(input.digests).size;
|
|
214
|
-
if (hasDuplicates) {
|
|
215
|
-
throw new Error(`Duplicate digests in batch call ${input.digests}`);
|
|
216
|
-
}
|
|
217
|
-
return await this.transport.request({
|
|
218
|
-
method: "w_multiGetTransactionBlocks",
|
|
219
|
-
params: [input.digests, input.options],
|
|
220
|
-
signal: input.signal,
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
async executeTransactionBlock({ transactionBlock, signature, options, requestType, signal, }) {
|
|
224
|
-
const result = await this.transport.request({
|
|
225
|
-
method: "w_executeTransactionBlock",
|
|
226
|
-
params: [
|
|
227
|
-
typeof transactionBlock === "string"
|
|
228
|
-
? transactionBlock
|
|
229
|
-
: toBase64(transactionBlock),
|
|
230
|
-
Array.isArray(signature) ? signature : [signature],
|
|
231
|
-
options,
|
|
232
|
-
],
|
|
233
|
-
signal,
|
|
234
|
-
});
|
|
235
|
-
if (requestType === "WaitForLocalExecution") {
|
|
236
|
-
try {
|
|
237
|
-
await this.waitForTransaction({
|
|
238
|
-
digest: result.digest,
|
|
239
|
-
signal,
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
catch (e) {
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
return result;
|
|
246
|
-
}
|
|
247
|
-
async signAndExecuteTransaction({ transaction, signer, ...input }) {
|
|
248
|
-
let transactionBytes;
|
|
249
|
-
if (transaction instanceof Uint8Array) {
|
|
250
|
-
transactionBytes = transaction;
|
|
251
|
-
}
|
|
252
|
-
else {
|
|
253
|
-
transaction.setSenderIfNotSet(signer.toWAddress());
|
|
254
|
-
transactionBytes = await transaction.build({ client: this });
|
|
255
|
-
}
|
|
256
|
-
const { signature, bytes } = await signer.signTransaction(transactionBytes);
|
|
257
|
-
return this.executeTransactionBlock({
|
|
258
|
-
transactionBlock: bytes,
|
|
259
|
-
signature,
|
|
260
|
-
...input,
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
async getTotalTransactionBlocks({ signal, } = {}) {
|
|
264
|
-
const resp = await this.transport.request({
|
|
265
|
-
method: "w_getTotalTransactionBlocks",
|
|
266
|
-
params: [],
|
|
267
|
-
signal,
|
|
268
|
-
});
|
|
269
|
-
return BigInt(resp);
|
|
270
|
-
}
|
|
271
|
-
async getReferenceGasPrice({ signal, } = {}) {
|
|
272
|
-
const resp = await this.transport.request({
|
|
273
|
-
method: "wx_getReferenceGasPrice",
|
|
274
|
-
params: [],
|
|
275
|
-
signal,
|
|
276
|
-
});
|
|
277
|
-
return BigInt(resp);
|
|
278
|
-
}
|
|
279
|
-
async getStakes(input) {
|
|
280
|
-
if (!input.owner ||
|
|
281
|
-
!isValidWowAddress(normalizeWowAddress(input.owner))) {
|
|
282
|
-
throw new Error("Invalid Wow address");
|
|
283
|
-
}
|
|
284
|
-
return await this.transport.request({
|
|
285
|
-
method: "wx_getStakes",
|
|
286
|
-
params: [input.owner],
|
|
287
|
-
signal: input.signal,
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
async getStakesByIds(input) {
|
|
291
|
-
input.stakedSuiIds.forEach((id) => {
|
|
292
|
-
if (!id || !isValidWowObjectId(normalizeWowObjectId(id))) {
|
|
293
|
-
throw new Error(`Invalid Wow Stake id ${id}`);
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
return await this.transport.request({
|
|
297
|
-
method: "wx_getStakesByIds",
|
|
298
|
-
params: [input.stakedSuiIds],
|
|
299
|
-
signal: input.signal,
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
async getLatestSuiSystemState({ signal, } = {}) {
|
|
303
|
-
return await this.transport.request({
|
|
304
|
-
method: "wx_getLatestSuiSystemState",
|
|
305
|
-
params: [],
|
|
306
|
-
signal,
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
async queryEvents({ query, cursor, limit, order, signal, }) {
|
|
310
|
-
return await this.transport.request({
|
|
311
|
-
method: "wx_queryEvents",
|
|
312
|
-
params: [
|
|
313
|
-
query,
|
|
314
|
-
cursor,
|
|
315
|
-
limit,
|
|
316
|
-
(order || "descending") === "descending",
|
|
317
|
-
],
|
|
318
|
-
signal,
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
async subscribeEvent(input) {
|
|
322
|
-
return this.transport.subscribe({
|
|
323
|
-
method: "wx_subscribeEvent",
|
|
324
|
-
unsubscribe: "wx_unsubscribeEvent",
|
|
325
|
-
params: [input.filter],
|
|
326
|
-
onMessage: input.onMessage,
|
|
327
|
-
signal: input.signal,
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
async subscribeTransaction(input) {
|
|
331
|
-
return this.transport.subscribe({
|
|
332
|
-
method: "wx_subscribeTransaction",
|
|
333
|
-
unsubscribe: "wx_unsubscribeTransaction",
|
|
334
|
-
params: [input.filter],
|
|
335
|
-
onMessage: input.onMessage,
|
|
336
|
-
signal: input.signal,
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
async devInspectTransactionBlock(input) {
|
|
340
|
-
let devInspectTxBytes;
|
|
341
|
-
if (isTransaction(input.transactionBlock)) {
|
|
342
|
-
input.transactionBlock.setSenderIfNotSet(input.sender);
|
|
343
|
-
devInspectTxBytes = toBase64(await input.transactionBlock.build({
|
|
344
|
-
client: this,
|
|
345
|
-
onlyTransactionKind: true,
|
|
346
|
-
}));
|
|
347
|
-
}
|
|
348
|
-
else if (typeof input.transactionBlock === "string") {
|
|
349
|
-
devInspectTxBytes = input.transactionBlock;
|
|
350
|
-
}
|
|
351
|
-
else if (input.transactionBlock instanceof Uint8Array) {
|
|
352
|
-
devInspectTxBytes = toBase64(input.transactionBlock);
|
|
353
|
-
}
|
|
354
|
-
else {
|
|
355
|
-
throw new Error("Unknown transaction block format.");
|
|
356
|
-
}
|
|
357
|
-
input.signal?.throwIfAborted();
|
|
358
|
-
return await this.transport.request({
|
|
359
|
-
method: "w_devInspectTransactionBlock",
|
|
360
|
-
params: [
|
|
361
|
-
input.sender,
|
|
362
|
-
devInspectTxBytes,
|
|
363
|
-
input.gasPrice?.toString(),
|
|
364
|
-
input.epoch,
|
|
365
|
-
],
|
|
366
|
-
signal: input.signal,
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
async dryRunTransactionBlock(input) {
|
|
370
|
-
return await this.transport.request({
|
|
371
|
-
method: "w_dryRunTransactionBlock",
|
|
372
|
-
params: [
|
|
373
|
-
typeof input.transactionBlock === "string"
|
|
374
|
-
? input.transactionBlock
|
|
375
|
-
: toBase64(input.transactionBlock),
|
|
376
|
-
],
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
async getDynamicFields(input) {
|
|
380
|
-
if (!input.parentId ||
|
|
381
|
-
!isValidWowObjectId(normalizeWowObjectId(input.parentId))) {
|
|
382
|
-
throw new Error("Invalid Sui Object id");
|
|
383
|
-
}
|
|
384
|
-
return await this.transport.request({
|
|
385
|
-
method: "wx_getDynamicFields",
|
|
386
|
-
params: [input.parentId, input.cursor, input.limit],
|
|
387
|
-
signal: input.signal,
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
async getDynamicFieldObject(input) {
|
|
391
|
-
return await this.transport.request({
|
|
392
|
-
method: "wx_getDynamicFieldObject",
|
|
393
|
-
params: [input.parentId, input.name],
|
|
394
|
-
signal: input.signal,
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
async getLatestCheckpointSequenceNumber({ signal, } = {}) {
|
|
398
|
-
const resp = await this.transport.request({
|
|
399
|
-
method: "w_getLatestCheckpointSequenceNumber",
|
|
400
|
-
params: [],
|
|
401
|
-
signal,
|
|
402
|
-
});
|
|
403
|
-
return String(resp);
|
|
404
|
-
}
|
|
405
|
-
async getCheckpoint(input) {
|
|
406
|
-
return await this.transport.request({
|
|
407
|
-
method: "w_getCheckpoint",
|
|
408
|
-
params: [input.id],
|
|
409
|
-
signal: input.signal,
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
async getCheckpoints(input) {
|
|
413
|
-
return await this.transport.request({
|
|
414
|
-
method: "w_getCheckpoints",
|
|
415
|
-
params: [input.cursor, input?.limit, input.descendingOrder],
|
|
416
|
-
signal: input.signal,
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
async getCommitteeInfo(input) {
|
|
420
|
-
return await this.transport.request({
|
|
421
|
-
method: "wx_getCommitteeInfo",
|
|
422
|
-
params: [input?.epoch],
|
|
423
|
-
signal: input?.signal,
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
async getNetworkMetrics({ signal, } = {}) {
|
|
427
|
-
return await this.transport.request({
|
|
428
|
-
method: "wx_getNetworkMetrics",
|
|
429
|
-
params: [],
|
|
430
|
-
signal,
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
async getAddressMetrics({ signal, } = {}) {
|
|
434
|
-
return await this.transport.request({
|
|
435
|
-
method: "wx_getLatestAddressMetrics",
|
|
436
|
-
params: [],
|
|
437
|
-
signal,
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
async getEpochMetrics(input) {
|
|
441
|
-
return await this.transport.request({
|
|
442
|
-
method: "wx_getEpochMetrics",
|
|
443
|
-
params: [input?.cursor, input?.limit, input?.descendingOrder],
|
|
444
|
-
signal: input?.signal,
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
async getAllEpochAddressMetrics(input) {
|
|
448
|
-
return await this.transport.request({
|
|
449
|
-
method: "wx_getAllEpochAddressMetrics",
|
|
450
|
-
params: [input?.descendingOrder],
|
|
451
|
-
signal: input?.signal,
|
|
452
|
-
});
|
|
453
|
-
}
|
|
454
|
-
async getEpochs(input) {
|
|
455
|
-
return await this.transport.request({
|
|
456
|
-
method: "wx_getEpochs",
|
|
457
|
-
params: [input?.cursor, input?.limit, input?.descendingOrder],
|
|
458
|
-
signal: input?.signal,
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
async getMoveCallMetrics({ signal, } = {}) {
|
|
462
|
-
return await this.transport.request({
|
|
463
|
-
method: "wx_getMoveCallMetrics",
|
|
464
|
-
params: [],
|
|
465
|
-
signal,
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
async getCurrentEpoch({ signal, } = {}) {
|
|
469
|
-
return await this.transport.request({
|
|
470
|
-
method: "wx_getCurrentEpoch",
|
|
471
|
-
params: [],
|
|
472
|
-
signal,
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
async getValidatorsApy({ signal, } = {}) {
|
|
476
|
-
return await this.transport.request({
|
|
477
|
-
method: "wx_getValidatorsApy",
|
|
478
|
-
params: [],
|
|
479
|
-
signal,
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
async getChainIdentifier({ signal, } = {}) {
|
|
483
|
-
const checkpoint = await this.getCheckpoint({ id: "0", signal });
|
|
484
|
-
const bytes = fromBase58(checkpoint.digest);
|
|
485
|
-
return toHex(bytes.slice(0, 4));
|
|
486
|
-
}
|
|
487
|
-
async getProtocolConfig(input) {
|
|
488
|
-
return await this.transport.request({
|
|
489
|
-
method: "w_getProtocolConfig",
|
|
490
|
-
params: [input?.version],
|
|
491
|
-
signal: input?.signal,
|
|
492
|
-
});
|
|
493
|
-
}
|
|
494
|
-
async waitForTransaction({ signal, timeout = 60 * 1000, pollInterval = 2 * 1000, ...input }) {
|
|
495
|
-
const timeoutSignal = AbortSignal.timeout(timeout);
|
|
496
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
497
|
-
timeoutSignal.addEventListener("abort", () => reject(timeoutSignal.reason));
|
|
498
|
-
});
|
|
499
|
-
timeoutPromise.catch(() => {
|
|
500
|
-
});
|
|
501
|
-
while (!timeoutSignal.aborted) {
|
|
502
|
-
signal?.throwIfAborted();
|
|
503
|
-
try {
|
|
504
|
-
return await this.getTransactionBlock(input);
|
|
505
|
-
}
|
|
506
|
-
catch {
|
|
507
|
-
await Promise.race([
|
|
508
|
-
new Promise((resolve) => setTimeout(resolve, pollInterval)),
|
|
509
|
-
timeoutPromise,
|
|
510
|
-
]);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
timeoutSignal.throwIfAborted();
|
|
514
|
-
throw new Error("Unexpected error while waiting for transaction block.");
|
|
515
|
-
}
|
|
516
|
-
}
|
|
1
|
+
import{fromBase58,toBase64,toHex}from'@mysten/bcs';import{Experimental_BaseClient}from'../experimental/client.js';import{isTransaction}from'../transactions/Transaction.js';import{isValidWowAddress,isValidWowObjectId,isValidTransactionDigest,normalizeWowAddress,normalizeWowObjectId}from'../utils/sui-types.js';import{JsonRpcHTTPTransport}from'./http-transport.js';import{JSONRpcCoreClient}from'./core.js';const SUI_CLIENT_BRAND=Symbol['for']('@mysten/SuiClient');export function isSuiJsonRpcClient(a){return typeof a==='object'&&a!==null&&a[SUI_CLIENT_BRAND]===!![];}export class SuiJsonRpcClient extends Experimental_BaseClient{['core'];['jsonRpc']=this;['transport'];get[SUI_CLIENT_BRAND](){return!![];}constructor(a){super({'network':a['network']??'unknown'}),this['transport']=a['transport']??new JsonRpcHTTPTransport({'url':a['url']}),this['core']=new JSONRpcCoreClient({'jsonRpcClient':this});}async['getRpcApiVersion']({signal:a}={}){const b=await this['transport']['request']({'method':'rpc.discover','params':[],'signal':a});return b['info']['version'];}async['getCoins']({coinType:a,owner:b,cursor:c,limit:d,signal:e}){if(!b||!isValidWowAddress(normalizeWowAddress(b)))throw new Error('Invalid\x20Wow\x20address');return await this['transport']['request']({'method':'wx_getCoins','params':[b,a,c,d],'signal':e});}async['getAllCoins'](a){if(!a['owner']||!isValidWowAddress(normalizeWowAddress(a['owner'])))throw new Error('Invalid\x20Wow\x20address');return await this['transport']['request']({'method':'wx_getAllCoins','params':[a['owner'],a['cursor'],a['limit']],'signal':a['signal']});}async['getBalance']({owner:a,coinType:b,signal:c}){if(!a||!isValidWowAddress(normalizeWowAddress(a)))throw new Error('Invalid\x20Wow\x20address');return await this['transport']['request']({'method':'wx_getBalance','params':[a,b],'signal':c});}async['getAllBalances'](a){if(!a['owner']||!isValidWowAddress(normalizeWowAddress(a['owner'])))throw new Error('Invalid\x20Wow\x20address');return await this['transport']['request']({'method':'wx_getAllBalances','params':[a['owner']],'signal':a['signal']});}async['getCoinMetadata']({coinType:a,signal:b}){return await this['transport']['request']({'method':'wx_getCoinMetadata','params':[a],'signal':b});}async['getTotalSupply']({coinType:a,signal:b}){return await this['transport']['request']({'method':'wx_getTotalSupply','params':[a],'signal':b});}async['call'](a,b,{signal:c}={}){return await this['transport']['request']({'method':a,'params':b,'signal':c});}async['getMoveFunctionArgTypes']({package:a,module:b,function:c,signal:d}){return await this['transport']['request']({'method':'w_getMoveFunctionArgTypes','params':[a,b,c],'signal':d});}async['getNormalizedMoveModulesByPackage']({package:a,signal:b}){return await this['transport']['request']({'method':'w_getNormalizedMoveModulesByPackage','params':[a],'signal':b});}async['getNormalizedMoveModule']({package:a,module:b,signal:c}){return await this['transport']['request']({'method':'w_getNormalizedMoveModule','params':[a,b],'signal':c});}async['getNormalizedMoveFunction']({package:a,module:b,function:c,signal:d}){return await this['transport']['request']({'method':'w_getNormalizedMoveFunction','params':[a,b,c],'signal':d});}async['getNormalizedMoveStruct']({package:a,module:b,struct:c,signal:d}){return await this['transport']['request']({'method':'w_getNormalizedMoveStruct','params':[a,b,c],'signal':d});}async['getOwnedObjects'](a){if(!a['owner']||!isValidWowAddress(normalizeWowAddress(a['owner'])))throw new Error('Invalid\x20Wow\x20address');return await this['transport']['request']({'method':'wx_getOwnedObjects','params':[a['owner'],{'filter':a['filter'],'options':a['options']},a['cursor'],a['limit']],'signal':a['signal']});}async['getObject'](a){if(!a['id']||!isValidWowObjectId(normalizeWowObjectId(a['id'])))throw new Error('Invalid\x20object\x20ID');return await this['transport']['request']({'method':'w_getObject','params':[a['id'],a['options']],'signal':a['signal']});}async['tryGetPastObject'](a){return await this['transport']['request']({'method':'w_tryGetPastObject','params':[a['id'],a['version'],a['options']],'signal':a['signal']});}async['multiGetObjects'](a){a['ids']['forEach'](c=>{if(!c||!isValidWowObjectId(normalizeWowObjectId(c)))throw new Error('Invalid\x20object\x20ID\x20'+c);});const b=a['ids']['length']!==new Set(a['ids'])['size'];if(b)throw new Error('Duplicate\x20object\x20ids\x20in\x20batch\x20call\x20'+a['ids']);return await this['transport']['request']({'method':'w_multiGetObjects','params':[a['ids'],a['options']],'signal':a['signal']});}async['queryTransactionBlocks']({filter:a,options:b,cursor:c,limit:d,order:e,signal:f}){return await this['transport']['request']({'method':'wx_queryTransactionBlocks','params':[{'filter':a,'options':b},c,d,(e||'descending')==='descending'],'signal':f});}async['getTransactionBlock'](a){if(!isValidTransactionDigest(a['digest']))throw new Error('Invalid\x20Transaction\x20digest');return await this['transport']['request']({'method':'w_getTransactionBlock','params':[a['digest'],a['options']],'signal':a['signal']});}async['multiGetTransactionBlocks'](a){a['digests']['forEach'](c=>{if(!isValidTransactionDigest(c))throw new Error('Invalid\x20Transaction\x20digest\x20'+c);});const b=a['digests']['length']!==new Set(a['digests'])['size'];if(b)throw new Error('Duplicate\x20digests\x20in\x20batch\x20call\x20'+a['digests']);return await this['transport']['request']({'method':'w_multiGetTransactionBlocks','params':[a['digests'],a['options']],'signal':a['signal']});}async['executeTransactionBlock']({transactionBlock:a,signature:b,options:c,requestType:d,signal:f}){const g=await this['transport']['request']({'method':'w_executeTransactionBlock','params':[typeof a==='string'?a:toBase64(a),Array['isArray'](b)?b:[b],c],'signal':f});if(d==='WaitForLocalExecution')try{await this['waitForTransaction']({'digest':g['digest'],'signal':f});}catch(h){}return g;}async['signAndExecuteTransaction']({transaction:a,signer:b,...c}){let d;a instanceof Uint8Array?d=a:(a['setSenderIfNotSet'](b['toWAddress']()),d=await a['build']({'client':this}));const {signature:e,bytes:f}=await b['signTransaction'](d);return this['executeTransactionBlock']({'transactionBlock':f,'signature':e,...c});}async['getTotalTransactionBlocks']({signal:a}={}){const b=await this['transport']['request']({'method':'w_getTotalTransactionBlocks','params':[],'signal':a});return BigInt(b);}async['getReferenceGasPrice']({signal:a}={}){const b=await this['transport']['request']({'method':'wx_getReferenceGasPrice','params':[],'signal':a});return BigInt(b);}async['getStakes'](a){if(!a['owner']||!isValidWowAddress(normalizeWowAddress(a['owner'])))throw new Error('Invalid\x20Wow\x20address');return await this['transport']['request']({'method':'wx_getStakes','params':[a['owner']],'signal':a['signal']});}async['getStakesByIds'](a){return a['stakedSuiIds']['forEach'](b=>{if(!b||!isValidWowObjectId(normalizeWowObjectId(b)))throw new Error('Invalid\x20Wow\x20Stake\x20id\x20'+b);}),await this['transport']['request']({'method':'wx_getStakesByIds','params':[a['stakedSuiIds']],'signal':a['signal']});}async['getLatestSuiSystemState']({signal:a}={}){return await this['transport']['request']({'method':'wx_getLatestSuiSystemState','params':[],'signal':a});}async['queryEvents']({query:a,cursor:b,limit:c,order:d,signal:e}){return await this['transport']['request']({'method':'wx_queryEvents','params':[a,b,c,(d||'descending')==='descending'],'signal':e});}async['subscribeEvent'](a){return this['transport']['subscribe']({'method':'wx_subscribeEvent','unsubscribe':'wx_unsubscribeEvent','params':[a['filter']],'onMessage':a['onMessage'],'signal':a['signal']});}async['subscribeTransaction'](a){return this['transport']['subscribe']({'method':'wx_subscribeTransaction','unsubscribe':'wx_unsubscribeTransaction','params':[a['filter']],'onMessage':a['onMessage'],'signal':a['signal']});}async['devInspectTransactionBlock'](a){let b;if(isTransaction(a['transactionBlock']))a['transactionBlock']['setSenderIfNotSet'](a['sender']),b=toBase64(await a['transactionBlock']['build']({'client':this,'onlyTransactionKind':!![]}));else{if(typeof a['transactionBlock']==='string')b=a['transactionBlock'];else{if(a['transactionBlock']instanceof Uint8Array)b=toBase64(a['transactionBlock']);else throw new Error('Unknown\x20transaction\x20block\x20format.');}}return a['signal']?.['throwIfAborted'](),await this['transport']['request']({'method':'w_devInspectTransactionBlock','params':[a['sender'],b,a['gasPrice']?.['toString'](),a['epoch']],'signal':a['signal']});}async['dryRunTransactionBlock'](a){return await this['transport']['request']({'method':'w_dryRunTransactionBlock','params':[typeof a['transactionBlock']==='string'?a['transactionBlock']:toBase64(a['transactionBlock'])]});}async['getDynamicFields'](a){if(!a['parentId']||!isValidWowObjectId(normalizeWowObjectId(a['parentId'])))throw new Error('Invalid\x20Sui\x20Object\x20id');return await this['transport']['request']({'method':'wx_getDynamicFields','params':[a['parentId'],a['cursor'],a['limit']],'signal':a['signal']});}async['getDynamicFieldObject'](a){return await this['transport']['request']({'method':'wx_getDynamicFieldObject','params':[a['parentId'],a['name']],'signal':a['signal']});}async['getLatestCheckpointSequenceNumber']({signal:a}={}){const b=await this['transport']['request']({'method':'w_getLatestCheckpointSequenceNumber','params':[],'signal':a});return String(b);}async['getCheckpoint'](a){return await this['transport']['request']({'method':'w_getCheckpoint','params':[a['id']],'signal':a['signal']});}async['getCheckpoints'](a){return await this['transport']['request']({'method':'w_getCheckpoints','params':[a['cursor'],a?.['limit'],a['descendingOrder']],'signal':a['signal']});}async['getCommitteeInfo'](a){return await this['transport']['request']({'method':'wx_getCommitteeInfo','params':[a?.['epoch']],'signal':a?.['signal']});}async['getNetworkMetrics']({signal:a}={}){return await this['transport']['request']({'method':'wx_getNetworkMetrics','params':[],'signal':a});}async['getAddressMetrics']({signal:a}={}){return await this['transport']['request']({'method':'wx_getLatestAddressMetrics','params':[],'signal':a});}async['getEpochMetrics'](a){return await this['transport']['request']({'method':'wx_getEpochMetrics','params':[a?.['cursor'],a?.['limit'],a?.['descendingOrder']],'signal':a?.['signal']});}async['getAllEpochAddressMetrics'](a){return await this['transport']['request']({'method':'wx_getAllEpochAddressMetrics','params':[a?.['descendingOrder']],'signal':a?.['signal']});}async['getEpochs'](a){return await this['transport']['request']({'method':'wx_getEpochs','params':[a?.['cursor'],a?.['limit'],a?.['descendingOrder']],'signal':a?.['signal']});}async['getMoveCallMetrics']({signal:a}={}){return await this['transport']['request']({'method':'wx_getMoveCallMetrics','params':[],'signal':a});}async['getCurrentEpoch']({signal:a}={}){return await this['transport']['request']({'method':'wx_getCurrentEpoch','params':[],'signal':a});}async['getValidatorsApy']({signal:a}={}){return await this['transport']['request']({'method':'wx_getValidatorsApy','params':[],'signal':a});}async['getChainIdentifier']({signal:a}={}){const b=await this['getCheckpoint']({'id':'0','signal':a}),c=fromBase58(b['digest']);return toHex(c['slice'](0x0,0x4));}async['getProtocolConfig'](a){return await this['transport']['request']({'method':'w_getProtocolConfig','params':[a?.['version']],'signal':a?.['signal']});}async['waitForTransaction']({signal:a,timeout:timeout=0x3c*0x3e8,pollInterval:pollInterval=0x2*0x3e8,...b}){const c=AbortSignal['timeout'](timeout),d=new Promise((e,f)=>{c['addEventListener']('abort',()=>f(c['reason']));});d['catch'](()=>{});while(!c['aborted']){a?.['throwIfAborted']();try{return await this['getTransactionBlock'](b);}catch{await Promise['race']([new Promise(e=>setTimeout(e,pollInterval)),d]);}}c['throwIfAborted']();throw new Error('Unexpected\x20error\x20while\x20waiting\x20for\x20transaction\x20block.');}}
|