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,78 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { blake2b } from "@noble/hashes/blake2b";
|
|
3
|
-
import { sha256 } from "@noble/hashes/sha256";
|
|
4
|
-
import { bytesToHex } from "@noble/hashes/utils";
|
|
5
|
-
import { HDKey } from "@scure/bip32";
|
|
6
|
-
import { decodeWowPrivateKey, encodeWowPrivateKey, Keypair, } from "../../cryptography/keypair.js";
|
|
7
|
-
import { isValidBIP32Path, mnemonicToSeed, } from "../../cryptography/mnemonics.js";
|
|
8
|
-
import { Secp256r1PublicKey } from "./publickey.js";
|
|
9
|
-
export const DEFAULT_SECP256R1_DERIVATION_PATH = "m/74'/784'/0'/0/0";
|
|
10
|
-
export class Secp256r1Keypair extends Keypair {
|
|
11
|
-
keypair;
|
|
12
|
-
constructor(keypair) {
|
|
13
|
-
super();
|
|
14
|
-
if (keypair) {
|
|
15
|
-
this.keypair = keypair;
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
const secretKey = secp256r1.utils.randomPrivateKey();
|
|
19
|
-
const publicKey = secp256r1.getPublicKey(secretKey, true);
|
|
20
|
-
this.keypair = { publicKey, secretKey };
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
getKeyScheme() {
|
|
24
|
-
return "Secp256r1";
|
|
25
|
-
}
|
|
26
|
-
static generate() {
|
|
27
|
-
return new Secp256r1Keypair();
|
|
28
|
-
}
|
|
29
|
-
static fromSecretKey(secretKey, options) {
|
|
30
|
-
if (typeof secretKey === "string") {
|
|
31
|
-
const decoded = decodeWowPrivateKey(secretKey);
|
|
32
|
-
if (decoded.scheme !== "Secp256r1") {
|
|
33
|
-
throw new Error(`Expected a Secp256r1 keypair, got ${decoded.scheme}`);
|
|
34
|
-
}
|
|
35
|
-
return this.fromSecretKey(decoded.secretKey, options);
|
|
36
|
-
}
|
|
37
|
-
const publicKey = secp256r1.getPublicKey(secretKey, true);
|
|
38
|
-
if (!options || !options.skipValidation) {
|
|
39
|
-
const encoder = new TextEncoder();
|
|
40
|
-
const signData = encoder.encode("sui validation");
|
|
41
|
-
const msgHash = bytesToHex(blake2b(signData, { dkLen: 32 }));
|
|
42
|
-
const signature = secp256r1.sign(msgHash, secretKey, {
|
|
43
|
-
lowS: true,
|
|
44
|
-
});
|
|
45
|
-
if (!secp256r1.verify(signature, msgHash, publicKey, { lowS: true })) {
|
|
46
|
-
throw new Error("Provided secretKey is invalid");
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return new Secp256r1Keypair({ publicKey, secretKey });
|
|
50
|
-
}
|
|
51
|
-
static fromSeed(seed) {
|
|
52
|
-
const publicKey = secp256r1.getPublicKey(seed, true);
|
|
53
|
-
return new Secp256r1Keypair({ publicKey, secretKey: seed });
|
|
54
|
-
}
|
|
55
|
-
getPublicKey() {
|
|
56
|
-
return new Secp256r1PublicKey(this.keypair.publicKey);
|
|
57
|
-
}
|
|
58
|
-
getSecretKey() {
|
|
59
|
-
return encodeWowPrivateKey(this.keypair.secretKey, this.getKeyScheme());
|
|
60
|
-
}
|
|
61
|
-
async sign(data) {
|
|
62
|
-
const msgHash = sha256(data);
|
|
63
|
-
const sig = secp256r1.sign(msgHash, this.keypair.secretKey, {
|
|
64
|
-
lowS: true,
|
|
65
|
-
});
|
|
66
|
-
return sig.toCompactRawBytes();
|
|
67
|
-
}
|
|
68
|
-
static deriveKeypair(mnemonics, path) {
|
|
69
|
-
if (path == null) {
|
|
70
|
-
path = DEFAULT_SECP256R1_DERIVATION_PATH;
|
|
71
|
-
}
|
|
72
|
-
if (!isValidBIP32Path(path)) {
|
|
73
|
-
throw new Error("Invalid derivation path");
|
|
74
|
-
}
|
|
75
|
-
const privateKey = HDKey.fromMasterSeed(mnemonicToSeed(mnemonics)).derive(path).privateKey;
|
|
76
|
-
return Secp256r1Keypair.fromSecretKey(privateKey);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
1
|
+
import{secp256r1}from'@noble/curves/p256';import{blake2b}from'@noble/hashes/blake2b';import{sha256}from'@noble/hashes/sha256';import{bytesToHex}from'@noble/hashes/utils';import{HDKey}from'@scure/bip32';import{decodeWowPrivateKey,encodeWowPrivateKey,Keypair}from'../../cryptography/keypair.js';import{isValidBIP32Path,mnemonicToSeed}from'../../cryptography/mnemonics.js';import{Secp256r1PublicKey}from'./publickey.js';export const DEFAULT_SECP256R1_DERIVATION_PATH='m/74\x27/784\x27/0\x27/0/0';export class Secp256r1Keypair extends Keypair{['keypair'];constructor(a){super();if(a)this['keypair']=a;else{const b=secp256r1['utils']['randomPrivateKey'](),c=secp256r1['getPublicKey'](b,!![]);this['keypair']={'publicKey':c,'secretKey':b};}}['getKeyScheme'](){return'Secp256r1';}static['generate'](){return new Secp256r1Keypair();}static['fromSecretKey'](a,b){if(typeof a==='string'){const d=decodeWowPrivateKey(a);if(d['scheme']!=='Secp256r1')throw new Error('Expected\x20a\x20Secp256r1\x20keypair,\x20got\x20'+d['scheme']);return this['fromSecretKey'](d['secretKey'],b);}const c=secp256r1['getPublicKey'](a,!![]);if(!b||!b['skipValidation']){const e=new TextEncoder(),f=e['encode']('sui\x20validation'),g=bytesToHex(blake2b(f,{'dkLen':0x20})),h=secp256r1['sign'](g,a,{'lowS':!![]});if(!secp256r1['verify'](h,g,c,{'lowS':!![]}))throw new Error('Provided\x20secretKey\x20is\x20invalid');}return new Secp256r1Keypair({'publicKey':c,'secretKey':a});}static['fromSeed'](a){const b=secp256r1['getPublicKey'](a,!![]);return new Secp256r1Keypair({'publicKey':b,'secretKey':a});}['getPublicKey'](){return new Secp256r1PublicKey(this['keypair']['publicKey']);}['getSecretKey'](){return encodeWowPrivateKey(this['keypair']['secretKey'],this['getKeyScheme']());}async['sign'](a){const b=sha256(a),c=secp256r1['sign'](b,this['keypair']['secretKey'],{'lowS':!![]});return c['toCompactRawBytes']();}static['deriveKeypair'](a,b){b==null&&(b=DEFAULT_SECP256R1_DERIVATION_PATH);if(!isValidBIP32Path(b))throw new Error('Invalid\x20derivation\x20path');const c=HDKey['fromMasterSeed'](mnemonicToSeed(a))['derive'](b)['privateKey'];return Secp256r1Keypair['fromSecretKey'](c);}}
|
|
@@ -1,52 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { secp256r1 } from "@noble/curves/p256";
|
|
3
|
-
import { sha256 } from "@noble/hashes/sha256";
|
|
4
|
-
import { bytesEqual, PublicKey } from "../../cryptography/publickey.js";
|
|
5
|
-
import { SIGNATURE_SCHEME_TO_FLAG } from "../../cryptography/signature-scheme.js";
|
|
6
|
-
import { parseSerializedSignature } from "../../cryptography/signature.js";
|
|
7
|
-
const SECP256R1_PUBLIC_KEY_SIZE = 33;
|
|
8
|
-
export class Secp256r1PublicKey extends PublicKey {
|
|
9
|
-
static SIZE = SECP256R1_PUBLIC_KEY_SIZE;
|
|
10
|
-
data;
|
|
11
|
-
constructor(value) {
|
|
12
|
-
super();
|
|
13
|
-
if (typeof value === "string") {
|
|
14
|
-
this.data = fromBase64(value);
|
|
15
|
-
}
|
|
16
|
-
else if (value instanceof Uint8Array) {
|
|
17
|
-
this.data = value;
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
this.data = Uint8Array.from(value);
|
|
21
|
-
}
|
|
22
|
-
if (this.data.length !== SECP256R1_PUBLIC_KEY_SIZE) {
|
|
23
|
-
throw new Error(`Invalid public key input. Expected ${SECP256R1_PUBLIC_KEY_SIZE} bytes, got ${this.data.length}`);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
equals(publicKey) {
|
|
27
|
-
return super.equals(publicKey);
|
|
28
|
-
}
|
|
29
|
-
toRawBytes() {
|
|
30
|
-
return this.data;
|
|
31
|
-
}
|
|
32
|
-
flag() {
|
|
33
|
-
return SIGNATURE_SCHEME_TO_FLAG["Secp256r1"];
|
|
34
|
-
}
|
|
35
|
-
async verify(message, signature) {
|
|
36
|
-
let bytes;
|
|
37
|
-
if (typeof signature === "string") {
|
|
38
|
-
const parsed = parseSerializedSignature(signature);
|
|
39
|
-
if (parsed.signatureScheme !== "Secp256r1") {
|
|
40
|
-
throw new Error("Invalid signature scheme");
|
|
41
|
-
}
|
|
42
|
-
if (!bytesEqual(this.toRawBytes(), parsed.publicKey)) {
|
|
43
|
-
throw new Error("Signature does not match public key");
|
|
44
|
-
}
|
|
45
|
-
bytes = parsed.signature;
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
bytes = signature;
|
|
49
|
-
}
|
|
50
|
-
return secp256r1.verify(secp256r1.Signature.fromCompact(bytes), sha256(message), this.toRawBytes());
|
|
51
|
-
}
|
|
52
|
-
}
|
|
1
|
+
import{fromBase64}from'@mysten/bcs';import{secp256r1}from'@noble/curves/p256';import{sha256}from'@noble/hashes/sha256';import{bytesEqual,PublicKey}from'../../cryptography/publickey.js';import{SIGNATURE_SCHEME_TO_FLAG}from'../../cryptography/signature-scheme.js';import{parseSerializedSignature}from'../../cryptography/signature.js';const SECP256R1_PUBLIC_KEY_SIZE=0x21;export class Secp256r1PublicKey extends PublicKey{static ['SIZE']=SECP256R1_PUBLIC_KEY_SIZE;['data'];constructor(a){super();if(typeof a==='string')this['data']=fromBase64(a);else a instanceof Uint8Array?this['data']=a:this['data']=Uint8Array['from'](a);if(this['data']['length']!==SECP256R1_PUBLIC_KEY_SIZE)throw new Error('Invalid\x20public\x20key\x20input.\x20Expected\x20'+SECP256R1_PUBLIC_KEY_SIZE+'\x20bytes,\x20got\x20'+this['data']['length']);}['equals'](a){return super['equals'](a);}['toRawBytes'](){return this['data'];}['flag'](){return SIGNATURE_SCHEME_TO_FLAG['Secp256r1'];}async['verify'](a,b){let c;if(typeof b==='string'){const d=parseSerializedSignature(b);if(d['signatureScheme']!=='Secp256r1')throw new Error('Invalid\x20signature\x20scheme');if(!bytesEqual(this['toRawBytes'](),d['publicKey']))throw new Error('Signature\x20does\x20not\x20match\x20public\x20key');c=d['signature'];}else c=b;return secp256r1['verify'](secp256r1['Signature']['fromCompact'](c),sha256(a),this['toRawBytes']());}}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { MultiSigPublicKey, parsePartialSignatures, } from "./publickey.js";
|
|
1
|
+
export{MultiSigSigner}from'./signer.js';export{MultiSigPublicKey,parsePartialSignatures}from'./publickey.js';
|
|
@@ -1,201 +1 @@
|
|
|
1
|
-
import { fromBase64,
|
|
2
|
-
import { blake2b } from "@noble/hashes/blake2b";
|
|
3
|
-
import { bytesToHex } from "@noble/hashes/utils";
|
|
4
|
-
import { bcs } from "../bcs/index.js";
|
|
5
|
-
import { bytesEqual, PublicKey } from "../cryptography/publickey.js";
|
|
6
|
-
import { SIGNATURE_FLAG_TO_SCHEME, SIGNATURE_SCHEME_TO_FLAG, } from "../cryptography/signature-scheme.js";
|
|
7
|
-
import { parseSerializedSignature } from "../cryptography/signature.js";
|
|
8
|
-
import { normalizeWowAddress } from "../utils/sui-types.js";
|
|
9
|
-
import { publicKeyFromRawBytes } from "../verify/index.js";
|
|
10
|
-
import { MultiSigSigner } from "./signer.js";
|
|
11
|
-
export const MAX_SIGNER_IN_MULTISIG = 10;
|
|
12
|
-
export const MIN_SIGNER_IN_MULTISIG = 1;
|
|
13
|
-
export class MultiSigPublicKey extends PublicKey {
|
|
14
|
-
rawBytes;
|
|
15
|
-
multisigPublicKey;
|
|
16
|
-
publicKeys;
|
|
17
|
-
constructor(value) {
|
|
18
|
-
super();
|
|
19
|
-
if (typeof value === "string") {
|
|
20
|
-
this.rawBytes = fromBase64(value);
|
|
21
|
-
this.multisigPublicKey = bcs.MultiSigPublicKey.parse(this.rawBytes);
|
|
22
|
-
}
|
|
23
|
-
else if (value instanceof Uint8Array) {
|
|
24
|
-
this.rawBytes = value;
|
|
25
|
-
this.multisigPublicKey = bcs.MultiSigPublicKey.parse(this.rawBytes);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
this.multisigPublicKey = value;
|
|
29
|
-
this.rawBytes = bcs.MultiSigPublicKey.serialize(value).toBytes();
|
|
30
|
-
}
|
|
31
|
-
if (this.multisigPublicKey.threshold < 1) {
|
|
32
|
-
throw new Error("Invalid threshold");
|
|
33
|
-
}
|
|
34
|
-
const seenPublicKeys = new Set();
|
|
35
|
-
this.publicKeys = this.multisigPublicKey.pk_map.map(({ pubKey, weight }) => {
|
|
36
|
-
const [scheme, bytes] = Object.entries(pubKey).filter(([name]) => name !== "$kind")[0];
|
|
37
|
-
const publicKeyStr = Uint8Array.from(bytes).toString();
|
|
38
|
-
if (seenPublicKeys.has(publicKeyStr)) {
|
|
39
|
-
throw new Error(`Multisig does not support duplicate public keys`);
|
|
40
|
-
}
|
|
41
|
-
seenPublicKeys.add(publicKeyStr);
|
|
42
|
-
if (weight < 1) {
|
|
43
|
-
throw new Error(`Invalid weight`);
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
publicKey: publicKeyFromRawBytes(scheme, Uint8Array.from(bytes)),
|
|
47
|
-
weight,
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
const totalWeight = this.publicKeys.reduce((sum, { weight }) => sum + weight, 0);
|
|
51
|
-
if (this.multisigPublicKey.threshold > totalWeight) {
|
|
52
|
-
throw new Error(`Unreachable threshold`);
|
|
53
|
-
}
|
|
54
|
-
if (this.publicKeys.length > MAX_SIGNER_IN_MULTISIG) {
|
|
55
|
-
throw new Error(`Max number of signers in a multisig is ${MAX_SIGNER_IN_MULTISIG}`);
|
|
56
|
-
}
|
|
57
|
-
if (this.publicKeys.length < MIN_SIGNER_IN_MULTISIG) {
|
|
58
|
-
throw new Error(`Min number of signers in a multisig is ${MIN_SIGNER_IN_MULTISIG}`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
static fromPublicKeys({ threshold, publicKeys, }) {
|
|
62
|
-
return new MultiSigPublicKey({
|
|
63
|
-
pk_map: publicKeys.map(({ publicKey, weight }) => {
|
|
64
|
-
const scheme = SIGNATURE_FLAG_TO_SCHEME[publicKey.flag()];
|
|
65
|
-
return {
|
|
66
|
-
pubKey: {
|
|
67
|
-
[scheme]: publicKey.toRawBytes(),
|
|
68
|
-
},
|
|
69
|
-
weight,
|
|
70
|
-
};
|
|
71
|
-
}),
|
|
72
|
-
threshold,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
equals(publicKey) {
|
|
76
|
-
return super.equals(publicKey);
|
|
77
|
-
}
|
|
78
|
-
toRawBytes() {
|
|
79
|
-
return this.rawBytes;
|
|
80
|
-
}
|
|
81
|
-
getPublicKeys() {
|
|
82
|
-
return this.publicKeys;
|
|
83
|
-
}
|
|
84
|
-
getThreshold() {
|
|
85
|
-
return this.multisigPublicKey.threshold;
|
|
86
|
-
}
|
|
87
|
-
getSigner(...signers) {
|
|
88
|
-
return new MultiSigSigner(this, signers);
|
|
89
|
-
}
|
|
90
|
-
toWAddress() {
|
|
91
|
-
const maxLength = 1 + (64 + 1) * MAX_SIGNER_IN_MULTISIG + 2;
|
|
92
|
-
const tmp = new Uint8Array(maxLength);
|
|
93
|
-
tmp.set([SIGNATURE_SCHEME_TO_FLAG["MultiSig"]]);
|
|
94
|
-
tmp.set(bcs.u16().serialize(this.multisigPublicKey.threshold).toBytes(), 1);
|
|
95
|
-
let i = 3;
|
|
96
|
-
for (const { publicKey, weight } of this.publicKeys) {
|
|
97
|
-
const bytes = publicKey.toWBytes();
|
|
98
|
-
tmp.set(bytes, i);
|
|
99
|
-
i += bytes.length;
|
|
100
|
-
tmp.set([weight], i++);
|
|
101
|
-
}
|
|
102
|
-
return normalizeWowAddress(bytesToHex(blake2b(tmp.slice(0, i), { dkLen: 32 })));
|
|
103
|
-
}
|
|
104
|
-
flag() {
|
|
105
|
-
return SIGNATURE_SCHEME_TO_FLAG["MultiSig"];
|
|
106
|
-
}
|
|
107
|
-
async verify(message, multisigSignature) {
|
|
108
|
-
const parsed = parseSerializedSignature(multisigSignature);
|
|
109
|
-
if (parsed.signatureScheme !== "MultiSig") {
|
|
110
|
-
throw new Error("Invalid signature scheme");
|
|
111
|
-
}
|
|
112
|
-
const { multisig } = parsed;
|
|
113
|
-
let signatureWeight = 0;
|
|
114
|
-
if (!bytesEqual(bcs.MultiSigPublicKey.serialize(this.multisigPublicKey).toBytes(), bcs.MultiSigPublicKey.serialize(multisig.multisig_pk).toBytes())) {
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
for (const { publicKey, weight, signature } of parsePartialSignatures(multisig)) {
|
|
118
|
-
if (!(await publicKey.verify(message, signature))) {
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
signatureWeight += weight;
|
|
122
|
-
}
|
|
123
|
-
return signatureWeight >= this.multisigPublicKey.threshold;
|
|
124
|
-
}
|
|
125
|
-
combinePartialSignatures(signatures) {
|
|
126
|
-
if (signatures.length > MAX_SIGNER_IN_MULTISIG) {
|
|
127
|
-
throw new Error(`Max number of signatures in a multisig is ${MAX_SIGNER_IN_MULTISIG}`);
|
|
128
|
-
}
|
|
129
|
-
let bitmap = 0;
|
|
130
|
-
const compressedSignatures = new Array(signatures.length);
|
|
131
|
-
for (let i = 0; i < signatures.length; i++) {
|
|
132
|
-
const parsed = parseSerializedSignature(signatures[i]);
|
|
133
|
-
if (parsed.signatureScheme === "MultiSig") {
|
|
134
|
-
throw new Error("MultiSig is not supported inside MultiSig");
|
|
135
|
-
}
|
|
136
|
-
const publicKey = parsed.publicKey;
|
|
137
|
-
compressedSignatures[i] = {
|
|
138
|
-
[parsed.signatureScheme]: parsed.signature,
|
|
139
|
-
};
|
|
140
|
-
let publicKeyIndex;
|
|
141
|
-
for (let j = 0; j < this.publicKeys.length; j++) {
|
|
142
|
-
if (bytesEqual(publicKey, this.publicKeys[j].publicKey.toRawBytes())) {
|
|
143
|
-
if (bitmap & (1 << j)) {
|
|
144
|
-
throw new Error("Received multiple signatures from the same public key");
|
|
145
|
-
}
|
|
146
|
-
publicKeyIndex = j;
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
if (publicKeyIndex === undefined) {
|
|
151
|
-
throw new Error("Received signature from unknown public key");
|
|
152
|
-
}
|
|
153
|
-
bitmap |= 1 << publicKeyIndex;
|
|
154
|
-
}
|
|
155
|
-
const multisig = {
|
|
156
|
-
sigs: compressedSignatures,
|
|
157
|
-
bitmap,
|
|
158
|
-
multisig_pk: this.multisigPublicKey,
|
|
159
|
-
};
|
|
160
|
-
const bytes = bcs.MultiSig.serialize(multisig, {
|
|
161
|
-
maxSize: 8192,
|
|
162
|
-
}).toBytes();
|
|
163
|
-
const tmp = new Uint8Array(bytes.length + 1);
|
|
164
|
-
tmp.set([SIGNATURE_SCHEME_TO_FLAG["MultiSig"]]);
|
|
165
|
-
tmp.set(bytes, 1);
|
|
166
|
-
return toBase64(tmp);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
export function parsePartialSignatures(multisig) {
|
|
170
|
-
const res = new Array(multisig.sigs.length);
|
|
171
|
-
for (let i = 0; i < multisig.sigs.length; i++) {
|
|
172
|
-
const [signatureScheme, signature] = Object.entries(multisig.sigs[i]).filter(([name]) => name !== "$kind")[0];
|
|
173
|
-
const indices = asIndices(multisig.bitmap);
|
|
174
|
-
const pkIndex = indices[i];
|
|
175
|
-
const pair = multisig.multisig_pk.pk_map[pkIndex];
|
|
176
|
-
const pkBytes = Uint8Array.from(Object.values(pair.pubKey)[0]);
|
|
177
|
-
if (signatureScheme === "MultiSig") {
|
|
178
|
-
throw new Error("MultiSig is not supported inside MultiSig");
|
|
179
|
-
}
|
|
180
|
-
const publicKey = publicKeyFromRawBytes(signatureScheme, pkBytes);
|
|
181
|
-
res[i] = {
|
|
182
|
-
signatureScheme,
|
|
183
|
-
signature: Uint8Array.from(signature),
|
|
184
|
-
publicKey: publicKey,
|
|
185
|
-
weight: pair.weight,
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
return res;
|
|
189
|
-
}
|
|
190
|
-
function asIndices(bitmap) {
|
|
191
|
-
if (bitmap < 0 || bitmap > 1024) {
|
|
192
|
-
throw new Error("Invalid bitmap");
|
|
193
|
-
}
|
|
194
|
-
const res = [];
|
|
195
|
-
for (let i = 0; i < 10; i++) {
|
|
196
|
-
if ((bitmap & (1 << i)) !== 0) {
|
|
197
|
-
res.push(i);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
return Uint8Array.from(res);
|
|
201
|
-
}
|
|
1
|
+
import{fromBase64,toBase64}from'@mysten/bcs';import{blake2b}from'@noble/hashes/blake2b';import{bytesToHex}from'@noble/hashes/utils';import{bcs}from'../bcs/index.js';import{bytesEqual,PublicKey}from'../cryptography/publickey.js';import{SIGNATURE_FLAG_TO_SCHEME,SIGNATURE_SCHEME_TO_FLAG}from'../cryptography/signature-scheme.js';import{parseSerializedSignature}from'../cryptography/signature.js';import{normalizeWowAddress}from'../utils/sui-types.js';import{publicKeyFromRawBytes}from'../verify/index.js';import{MultiSigSigner}from'./signer.js';export const MAX_SIGNER_IN_MULTISIG=0xa;export const MIN_SIGNER_IN_MULTISIG=0x1;export class MultiSigPublicKey extends PublicKey{['rawBytes'];['multisigPublicKey'];['publicKeys'];constructor(a){super();if(typeof a==='string')this['rawBytes']=fromBase64(a),this['multisigPublicKey']=bcs['MultiSigPublicKey']['parse'](this['rawBytes']);else a instanceof Uint8Array?(this['rawBytes']=a,this['multisigPublicKey']=bcs['MultiSigPublicKey']['parse'](this['rawBytes'])):(this['multisigPublicKey']=a,this['rawBytes']=bcs['MultiSigPublicKey']['serialize'](a)['toBytes']());if(this['multisigPublicKey']['threshold']<0x1)throw new Error('Invalid\x20threshold');const b=new Set();this['publicKeys']=this['multisigPublicKey']['pk_map']['map'](({pubKey:d,weight:e})=>{const [f,g]=Object['entries'](d)['filter'](([i])=>i!=='$kind')[0x0],h=Uint8Array['from'](g)['toString']();if(b['has'](h))throw new Error('Multisig\x20does\x20not\x20support\x20duplicate\x20public\x20keys');b['add'](h);if(e<0x1)throw new Error('Invalid\x20weight');return{'publicKey':publicKeyFromRawBytes(f,Uint8Array['from'](g)),'weight':e};});const c=this['publicKeys']['reduce']((d,{weight:e})=>d+e,0x0);if(this['multisigPublicKey']['threshold']>c)throw new Error('Unreachable\x20threshold');if(this['publicKeys']['length']>MAX_SIGNER_IN_MULTISIG)throw new Error('Max\x20number\x20of\x20signers\x20in\x20a\x20multisig\x20is\x20'+MAX_SIGNER_IN_MULTISIG);if(this['publicKeys']['length']<MIN_SIGNER_IN_MULTISIG)throw new Error('Min\x20number\x20of\x20signers\x20in\x20a\x20multisig\x20is\x20'+MIN_SIGNER_IN_MULTISIG);}static['fromPublicKeys']({threshold:a,publicKeys:b}){return new MultiSigPublicKey({'pk_map':b['map'](({publicKey:c,weight:d})=>{const e=SIGNATURE_FLAG_TO_SCHEME[c['flag']()];return{'pubKey':{[e]:c['toRawBytes']()},'weight':d};}),'threshold':a});}['equals'](a){return super['equals'](a);}['toRawBytes'](){return this['rawBytes'];}['getPublicKeys'](){return this['publicKeys'];}['getThreshold'](){return this['multisigPublicKey']['threshold'];}['getSigner'](...a){return new MultiSigSigner(this,a);}['toWAddress'](){const a=0x1+(0x40+0x1)*MAX_SIGNER_IN_MULTISIG+0x2,b=new Uint8Array(a);b['set']([SIGNATURE_SCHEME_TO_FLAG['MultiSig']]),b['set'](bcs['u16']()['serialize'](this['multisigPublicKey']['threshold'])['toBytes'](),0x1);let c=0x3;for(const {publicKey:d,weight:e}of this['publicKeys']){const f=d['toWBytes']();b['set'](f,c),c+=f['length'],b['set']([e],c++);}return normalizeWowAddress(bytesToHex(blake2b(b['slice'](0x0,c),{'dkLen':0x20})));}['flag'](){return SIGNATURE_SCHEME_TO_FLAG['MultiSig'];}async['verify'](a,b){const c=parseSerializedSignature(b);if(c['signatureScheme']!=='MultiSig')throw new Error('Invalid\x20signature\x20scheme');const {multisig:d}=c;let e=0x0;if(!bytesEqual(bcs['MultiSigPublicKey']['serialize'](this['multisigPublicKey'])['toBytes'](),bcs['MultiSigPublicKey']['serialize'](d['multisig_pk'])['toBytes']()))return![];for(const {publicKey:f,weight:g,signature:h}of parsePartialSignatures(d)){if(!await f['verify'](a,h))return![];e+=g;}return e>=this['multisigPublicKey']['threshold'];}['combinePartialSignatures'](a){if(a['length']>MAX_SIGNER_IN_MULTISIG)throw new Error('Max\x20number\x20of\x20signatures\x20in\x20a\x20multisig\x20is\x20'+MAX_SIGNER_IN_MULTISIG);let b=0x0;const c=new Array(a['length']);for(let g=0x0;g<a['length'];g++){const h=parseSerializedSignature(a[g]);if(h['signatureScheme']==='MultiSig')throw new Error('MultiSig\x20is\x20not\x20supported\x20inside\x20MultiSig');const k=h['publicKey'];c[g]={[h['signatureScheme']]:h['signature']};let l;for(let m=0x0;m<this['publicKeys']['length'];m++){if(bytesEqual(k,this['publicKeys'][m]['publicKey']['toRawBytes']())){if(b&0x1<<m)throw new Error('Received\x20multiple\x20signatures\x20from\x20the\x20same\x20public\x20key');l=m;break;}}if(l===undefined)throw new Error('Received\x20signature\x20from\x20unknown\x20public\x20key');b|=0x1<<l;}const d={'sigs':c,'bitmap':b,'multisig_pk':this['multisigPublicKey']},e=bcs['MultiSig']['serialize'](d,{'maxSize':0x2000})['toBytes'](),f=new Uint8Array(e['length']+0x1);return f['set']([SIGNATURE_SCHEME_TO_FLAG['MultiSig']]),f['set'](e,0x1),toBase64(f);}}export function parsePartialSignatures(a){const b=new Array(a['sigs']['length']);for(let c=0x0;c<a['sigs']['length'];c++){const [d,e]=Object['entries'](a['sigs'][c])['filter'](([l])=>l!=='$kind')[0x0],f=asIndices(a['bitmap']),g=f[c],h=a['multisig_pk']['pk_map'][g],j=Uint8Array['from'](Object['values'](h['pubKey'])[0x0]);if(d==='MultiSig')throw new Error('MultiSig\x20is\x20not\x20supported\x20inside\x20MultiSig');const k=publicKeyFromRawBytes(d,j);b[c]={'signatureScheme':d,'signature':Uint8Array['from'](e),'publicKey':k,'weight':h['weight']};}return b;}function asIndices(a){if(a<0x0||a>0x400)throw new Error('Invalid\x20bitmap');const b=[];for(let c=0x0;c<0xa;c++){(a&0x1<<c)!==0x0&&b['push'](c);}return Uint8Array['from'](b);}
|
|
@@ -1,58 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Signer } from "../cryptography/index.js";
|
|
3
|
-
export class MultiSigSigner extends Signer {
|
|
4
|
-
#pubkey;
|
|
5
|
-
#signers;
|
|
6
|
-
constructor(pubkey, signers = []) {
|
|
7
|
-
super();
|
|
8
|
-
this.#pubkey = pubkey;
|
|
9
|
-
this.#signers = signers;
|
|
10
|
-
const uniqueKeys = new Set();
|
|
11
|
-
let combinedWeight = 0;
|
|
12
|
-
const weights = pubkey.getPublicKeys().map(({ weight, publicKey }) => ({
|
|
13
|
-
weight,
|
|
14
|
-
address: publicKey.toWAddress(),
|
|
15
|
-
}));
|
|
16
|
-
for (const signer of signers) {
|
|
17
|
-
const address = signer.toWAddress();
|
|
18
|
-
if (uniqueKeys.has(address)) {
|
|
19
|
-
throw new Error(`Can't create MultiSigSigner with duplicate signers`);
|
|
20
|
-
}
|
|
21
|
-
uniqueKeys.add(address);
|
|
22
|
-
const weight = weights.find((w) => w.address === address)?.weight;
|
|
23
|
-
if (!weight) {
|
|
24
|
-
throw new Error(`Signer ${address} is not part of the MultiSig public key`);
|
|
25
|
-
}
|
|
26
|
-
combinedWeight += weight;
|
|
27
|
-
}
|
|
28
|
-
if (combinedWeight < pubkey.getThreshold()) {
|
|
29
|
-
throw new Error(`Combined weight of signers is less than threshold`);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
getKeyScheme() {
|
|
33
|
-
return "MultiSig";
|
|
34
|
-
}
|
|
35
|
-
getPublicKey() {
|
|
36
|
-
return this.#pubkey;
|
|
37
|
-
}
|
|
38
|
-
sign(_data) {
|
|
39
|
-
throw new Error("MultiSigSigner does not support signing directly. Use signTransaction or signPersonalMessage instead");
|
|
40
|
-
}
|
|
41
|
-
signData(_data) {
|
|
42
|
-
throw new Error("MultiSigSigner does not support signing directly. Use signTransaction or signPersonalMessage instead");
|
|
43
|
-
}
|
|
44
|
-
async signTransaction(bytes) {
|
|
45
|
-
const signature = this.#pubkey.combinePartialSignatures(await Promise.all(this.#signers.map(async (signer) => (await signer.signTransaction(bytes)).signature)));
|
|
46
|
-
return {
|
|
47
|
-
signature,
|
|
48
|
-
bytes: toBase64(bytes),
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
async signPersonalMessage(bytes) {
|
|
52
|
-
const signature = this.#pubkey.combinePartialSignatures(await Promise.all(this.#signers.map(async (signer) => (await signer.signPersonalMessage(bytes)).signature)));
|
|
53
|
-
return {
|
|
54
|
-
signature,
|
|
55
|
-
bytes: toBase64(bytes),
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
1
|
+
import{toBase64}from'@mysten/bcs';import{Signer}from'../cryptography/index.js';export class MultiSigSigner extends Signer{#pubkey;#signers;constructor(a,b=[]){super(),this.#pubkey=a,this.#signers=b;const c=new Set();let d=0x0;const e=a['getPublicKeys']()['map'](({weight:f,publicKey:g})=>({'weight':f,'address':g['toWAddress']()}));for(const f of b){const g=f['toWAddress']();if(c['has'](g))throw new Error('Can\x27t\x20create\x20MultiSigSigner\x20with\x20duplicate\x20signers');c['add'](g);const h=e['find'](i=>i['address']===g)?.['weight'];if(!h)throw new Error('Signer\x20'+g+'\x20is\x20not\x20part\x20of\x20the\x20MultiSig\x20public\x20key');d+=h;}if(d<a['getThreshold']())throw new Error('Combined\x20weight\x20of\x20signers\x20is\x20less\x20than\x20threshold');}['getKeyScheme'](){return'MultiSig';}['getPublicKey'](){return this.#pubkey;}['sign'](a){throw new Error('MultiSigSigner\x20does\x20not\x20support\x20signing\x20directly.\x20Use\x20signTransaction\x20or\x20signPersonalMessage\x20instead');}['signData'](a){throw new Error('MultiSigSigner\x20does\x20not\x20support\x20signing\x20directly.\x20Use\x20signTransaction\x20or\x20signPersonalMessage\x20instead');}async['signTransaction'](a){const b=this.#pubkey['combinePartialSignatures'](await Promise['all'](this.#signers['map'](async c=>(await c['signTransaction'](a))['signature'])));return{'signature':b,'bytes':toBase64(a)};}async['signPersonalMessage'](a){const b=this.#pubkey['combinePartialSignatures'](await Promise['all'](this.#signers['map'](async c=>(await c['signPersonalMessage'](a))['signature'])));return{'signature':b,'bytes':toBase64(a)};}}
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createPure } from "./pure.js";
|
|
3
|
-
export const Arguments = {
|
|
4
|
-
pure: createPure((value) => (tx) => tx.pure(value)),
|
|
5
|
-
object: createObjectMethods((value) => (tx) => tx.object(value)),
|
|
6
|
-
sharedObjectRef: (...args) => (tx) => tx.sharedObjectRef(...args),
|
|
7
|
-
objectRef: (...args) => (tx) => tx.objectRef(...args),
|
|
8
|
-
receivingRef: (...args) => (tx) => tx.receivingRef(...args),
|
|
9
|
-
};
|
|
1
|
+
import{createObjectMethods}from'./object.js';import{createPure}from'./pure.js';export const Arguments={'pure':createPure(a=>b=>b['pure'](a)),'object':createObjectMethods(a=>b=>b['object'](a)),'sharedObjectRef':(...a)=>b=>b['sharedObjectRef'](...a),'objectRef':(...a)=>b=>b['objectRef'](...a),'receivingRef':(...a)=>b=>b['receivingRef'](...a)};
|
|
@@ -1,102 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { parse } from "valibot";
|
|
3
|
-
import { normalizeWowObjectId } from "../utils/sui-types.js";
|
|
4
|
-
import { ArgumentSchema } from "./data/internal.js";
|
|
5
|
-
export var UpgradePolicy;
|
|
6
|
-
(function (UpgradePolicy) {
|
|
7
|
-
UpgradePolicy[UpgradePolicy["COMPATIBLE"] = 0] = "COMPATIBLE";
|
|
8
|
-
UpgradePolicy[UpgradePolicy["ADDITIVE"] = 128] = "ADDITIVE";
|
|
9
|
-
UpgradePolicy[UpgradePolicy["DEP_ONLY"] = 192] = "DEP_ONLY";
|
|
10
|
-
})(UpgradePolicy || (UpgradePolicy = {}));
|
|
11
|
-
export const Commands = {
|
|
12
|
-
MoveCall(input) {
|
|
13
|
-
const [pkg, mod = "", fn = ""] = "target" in input
|
|
14
|
-
? input.target.split("::")
|
|
15
|
-
: [input.package, input.module, input.function];
|
|
16
|
-
return {
|
|
17
|
-
$kind: "MoveCall",
|
|
18
|
-
MoveCall: {
|
|
19
|
-
package: pkg,
|
|
20
|
-
module: mod,
|
|
21
|
-
function: fn,
|
|
22
|
-
typeArguments: input.typeArguments ?? [],
|
|
23
|
-
arguments: input.arguments ?? [],
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
},
|
|
27
|
-
TransferObjects(objects, address) {
|
|
28
|
-
return {
|
|
29
|
-
$kind: "TransferObjects",
|
|
30
|
-
TransferObjects: {
|
|
31
|
-
objects: objects.map((o) => parse(ArgumentSchema, o)),
|
|
32
|
-
address: parse(ArgumentSchema, address),
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
SplitCoins(coin, amounts) {
|
|
37
|
-
return {
|
|
38
|
-
$kind: "SplitCoins",
|
|
39
|
-
SplitCoins: {
|
|
40
|
-
coin: parse(ArgumentSchema, coin),
|
|
41
|
-
amounts: amounts.map((o) => parse(ArgumentSchema, o)),
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
},
|
|
45
|
-
MergeCoins(destination, sources) {
|
|
46
|
-
return {
|
|
47
|
-
$kind: "MergeCoins",
|
|
48
|
-
MergeCoins: {
|
|
49
|
-
destination: parse(ArgumentSchema, destination),
|
|
50
|
-
sources: sources.map((o) => parse(ArgumentSchema, o)),
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
},
|
|
54
|
-
Publish({ modules, dependencies, }) {
|
|
55
|
-
return {
|
|
56
|
-
$kind: "Publish",
|
|
57
|
-
Publish: {
|
|
58
|
-
modules: modules.map((module) => typeof module === "string"
|
|
59
|
-
? module
|
|
60
|
-
: toBase64(new Uint8Array(module))),
|
|
61
|
-
dependencies: dependencies.map((dep) => normalizeWowObjectId(dep)),
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
Upgrade({ modules, dependencies, package: packageId, ticket, }) {
|
|
66
|
-
return {
|
|
67
|
-
$kind: "Upgrade",
|
|
68
|
-
Upgrade: {
|
|
69
|
-
modules: modules.map((module) => typeof module === "string"
|
|
70
|
-
? module
|
|
71
|
-
: toBase64(new Uint8Array(module))),
|
|
72
|
-
dependencies: dependencies.map((dep) => normalizeWowObjectId(dep)),
|
|
73
|
-
package: packageId,
|
|
74
|
-
ticket: parse(ArgumentSchema, ticket),
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
},
|
|
78
|
-
MakeMoveVec({ type, elements, }) {
|
|
79
|
-
return {
|
|
80
|
-
$kind: "MakeMoveVec",
|
|
81
|
-
MakeMoveVec: {
|
|
82
|
-
type: type ?? null,
|
|
83
|
-
elements: elements.map((o) => parse(ArgumentSchema, o)),
|
|
84
|
-
},
|
|
85
|
-
};
|
|
86
|
-
},
|
|
87
|
-
Intent({ name, inputs = {}, data = {}, }) {
|
|
88
|
-
return {
|
|
89
|
-
$kind: "$Intent",
|
|
90
|
-
$Intent: {
|
|
91
|
-
name,
|
|
92
|
-
inputs: Object.fromEntries(Object.entries(inputs).map(([key, value]) => [
|
|
93
|
-
key,
|
|
94
|
-
Array.isArray(value)
|
|
95
|
-
? value.map((o) => parse(ArgumentSchema, o))
|
|
96
|
-
: parse(ArgumentSchema, value),
|
|
97
|
-
])),
|
|
98
|
-
data,
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
},
|
|
102
|
-
};
|
|
1
|
+
import{toBase64}from'@mysten/bcs';import{parse}from'valibot';import{normalizeWowObjectId}from'../utils/sui-types.js';import{ArgumentSchema}from'./data/internal.js';export var UpgradePolicy;(function(a){a[a['COMPATIBLE']=0x0]='COMPATIBLE',a[a['ADDITIVE']=0x80]='ADDITIVE',a[a['DEP_ONLY']=0xc0]='DEP_ONLY';}(UpgradePolicy||(UpgradePolicy={})));export const Commands={'MoveCall'(a){const [b,c='',d='']='target'in a?a['target']['split']('::'):[a['package'],a['module'],a['function']];return{'$kind':'MoveCall','MoveCall':{'package':b,'module':c,'function':d,'typeArguments':a['typeArguments']??[],'arguments':a['arguments']??[]}};},'TransferObjects'(a,b){return{'$kind':'TransferObjects','TransferObjects':{'objects':a['map'](c=>parse(ArgumentSchema,c)),'address':parse(ArgumentSchema,b)}};},'SplitCoins'(a,b){return{'$kind':'SplitCoins','SplitCoins':{'coin':parse(ArgumentSchema,a),'amounts':b['map'](c=>parse(ArgumentSchema,c))}};},'MergeCoins'(a,b){return{'$kind':'MergeCoins','MergeCoins':{'destination':parse(ArgumentSchema,a),'sources':b['map'](c=>parse(ArgumentSchema,c))}};},'Publish'({modules:a,dependencies:b}){return{'$kind':'Publish','Publish':{'modules':a['map'](c=>typeof c==='string'?c:toBase64(new Uint8Array(c))),'dependencies':b['map'](c=>normalizeWowObjectId(c))}};},'Upgrade'({modules:a,dependencies:b,package:c,ticket:d}){return{'$kind':'Upgrade','Upgrade':{'modules':a['map'](e=>typeof e==='string'?e:toBase64(new Uint8Array(e))),'dependencies':b['map'](e=>normalizeWowObjectId(e)),'package':c,'ticket':parse(ArgumentSchema,d)}};},'MakeMoveVec'({type:a,elements:b}){return{'$kind':'MakeMoveVec','MakeMoveVec':{'type':a??null,'elements':b['map'](c=>parse(ArgumentSchema,c))}};},'Intent'({name:a,inputs:inputs={},data:data={}}){return{'$kind':'$Intent','$Intent':{'name':a,'inputs':Object['fromEntries'](Object['entries'](inputs)['map'](([b,c])=>[b,Array['isArray'](c)?c['map'](d=>parse(ArgumentSchema,d)):parse(ArgumentSchema,c)])),'data':data}};}};
|
|
@@ -1,52 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { normalizeWowAddress } from "../utils/sui-types.js";
|
|
3
|
-
function Pure(data) {
|
|
4
|
-
return {
|
|
5
|
-
$kind: "Pure",
|
|
6
|
-
Pure: {
|
|
7
|
-
bytes: data instanceof Uint8Array ? toBase64(data) : data.toBase64(),
|
|
8
|
-
},
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export const Inputs = {
|
|
12
|
-
Pure,
|
|
13
|
-
ObjectRef({ objectId, digest, version, }) {
|
|
14
|
-
return {
|
|
15
|
-
$kind: "Object",
|
|
16
|
-
Object: {
|
|
17
|
-
$kind: "ImmOrOwnedObject",
|
|
18
|
-
ImmOrOwnedObject: {
|
|
19
|
-
digest,
|
|
20
|
-
version,
|
|
21
|
-
objectId: normalizeWowAddress(objectId),
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
SharedObjectRef({ objectId, mutable, initialSharedVersion, }) {
|
|
27
|
-
return {
|
|
28
|
-
$kind: "Object",
|
|
29
|
-
Object: {
|
|
30
|
-
$kind: "SharedObject",
|
|
31
|
-
SharedObject: {
|
|
32
|
-
mutable,
|
|
33
|
-
initialSharedVersion,
|
|
34
|
-
objectId: normalizeWowAddress(objectId),
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
},
|
|
39
|
-
ReceivingRef({ objectId, digest, version, }) {
|
|
40
|
-
return {
|
|
41
|
-
$kind: "Object",
|
|
42
|
-
Object: {
|
|
43
|
-
$kind: "Receiving",
|
|
44
|
-
Receiving: {
|
|
45
|
-
digest,
|
|
46
|
-
version,
|
|
47
|
-
objectId: normalizeWowAddress(objectId),
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
},
|
|
52
|
-
};
|
|
1
|
+
import{toBase64}from'@mysten/bcs';import{normalizeWowAddress}from'../utils/sui-types.js';function Pure(a){return{'$kind':'Pure','Pure':{'bytes':a instanceof Uint8Array?toBase64(a):a['toBase64']()}};}export const Inputs={'Pure':Pure,'ObjectRef'({objectId:a,digest:b,version:c}){return{'$kind':'Object','Object':{'$kind':'ImmOrOwnedObject','ImmOrOwnedObject':{'digest':b,'version':c,'objectId':normalizeWowAddress(a)}}};},'SharedObjectRef'({objectId:a,mutable:b,initialSharedVersion:c}){return{'$kind':'Object','Object':{'$kind':'SharedObject','SharedObject':{'mutable':b,'initialSharedVersion':c,'objectId':normalizeWowAddress(a)}}};},'ReceivingRef'({objectId:a,digest:b,version:c}){return{'$kind':'Object','Object':{'$kind':'Receiving','Receiving':{'digest':b,'version':c,'objectId':normalizeWowAddress(a)}}};}};
|