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,220 +1 @@
|
|
|
1
|
-
import { randomBytes }
|
|
2
|
-
import { readFileSync, writeFileSync, renameSync, unlinkSync, existsSync, openSync, closeSync, constants, } from "fs";
|
|
3
|
-
export class PersistentStorage {
|
|
4
|
-
filePath;
|
|
5
|
-
lock;
|
|
6
|
-
constructor(filePath) {
|
|
7
|
-
this.filePath = filePath;
|
|
8
|
-
this.lock = new Lock(`${filePath}.lock`);
|
|
9
|
-
if (!existsSync(filePath)) {
|
|
10
|
-
writeFileSync(filePath, JSON.stringify({}));
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
async readAll() {
|
|
14
|
-
await this.lock.acquireShared();
|
|
15
|
-
try {
|
|
16
|
-
const content = readFileSync(this.filePath, "utf8");
|
|
17
|
-
return JSON.parse(content);
|
|
18
|
-
}
|
|
19
|
-
finally {
|
|
20
|
-
await this.lock.releaseShared();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
async writeAll(data) {
|
|
24
|
-
await this.lock.acquireExclusive();
|
|
25
|
-
try {
|
|
26
|
-
const tempFilePath = `${this.filePath}.tmp.${randomBytes(8).toString("hex")}`;
|
|
27
|
-
writeFileSync(tempFilePath, JSON.stringify(data));
|
|
28
|
-
renameSync(tempFilePath, this.filePath);
|
|
29
|
-
}
|
|
30
|
-
finally {
|
|
31
|
-
await this.lock.releaseExclusive();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
async set(key, value) {
|
|
35
|
-
await this.lock.acquireExclusive();
|
|
36
|
-
try {
|
|
37
|
-
const content = readFileSync(this.filePath, "utf8");
|
|
38
|
-
const data = JSON.parse(content);
|
|
39
|
-
data[key] = value;
|
|
40
|
-
const tempFilePath = `${this.filePath}.tmp.${randomBytes(8).toString("hex")}`;
|
|
41
|
-
writeFileSync(tempFilePath, JSON.stringify(data));
|
|
42
|
-
renameSync(tempFilePath, this.filePath);
|
|
43
|
-
}
|
|
44
|
-
finally {
|
|
45
|
-
await this.lock.releaseExclusive();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
async get(key) {
|
|
49
|
-
await this.lock.acquireShared();
|
|
50
|
-
try {
|
|
51
|
-
const content = readFileSync(this.filePath, "utf8");
|
|
52
|
-
const data = JSON.parse(content);
|
|
53
|
-
return data[key];
|
|
54
|
-
}
|
|
55
|
-
finally {
|
|
56
|
-
await this.lock.releaseShared();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
async transaction(transactionFn) {
|
|
60
|
-
await this.lock.acquireExclusive();
|
|
61
|
-
try {
|
|
62
|
-
const content = readFileSync(this.filePath, "utf8");
|
|
63
|
-
const data = JSON.parse(content);
|
|
64
|
-
const updatedData = transactionFn(data);
|
|
65
|
-
const tempFilePath = `${this.filePath}.tmp.${randomBytes(8).toString("hex")}`;
|
|
66
|
-
writeFileSync(tempFilePath, JSON.stringify(updatedData));
|
|
67
|
-
renameSync(tempFilePath, this.filePath);
|
|
68
|
-
}
|
|
69
|
-
finally {
|
|
70
|
-
await this.lock.releaseExclusive();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
async clear() {
|
|
74
|
-
await this.lock.acquireExclusive();
|
|
75
|
-
try {
|
|
76
|
-
const tempFilePath = `${this.filePath}.tmp.${randomBytes(8).toString("hex")}`;
|
|
77
|
-
writeFileSync(tempFilePath, JSON.stringify({}));
|
|
78
|
-
renameSync(tempFilePath, this.filePath);
|
|
79
|
-
}
|
|
80
|
-
finally {
|
|
81
|
-
await this.lock.releaseExclusive();
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
export class Lock {
|
|
86
|
-
lockPath;
|
|
87
|
-
sharedLockPath;
|
|
88
|
-
lockFd = null;
|
|
89
|
-
sharedLockCount = 0;
|
|
90
|
-
exclusiveLockCount = 0;
|
|
91
|
-
constructor(lockPath) {
|
|
92
|
-
this.lockPath = lockPath;
|
|
93
|
-
this.sharedLockPath = `${lockPath}.shared`;
|
|
94
|
-
}
|
|
95
|
-
async acquireShared() {
|
|
96
|
-
if (this.exclusiveLockCount > 0) {
|
|
97
|
-
this.sharedLockCount++;
|
|
98
|
-
this.exclusiveLockCount--;
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (this.sharedLockCount > 0) {
|
|
102
|
-
this.sharedLockCount++;
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
let attempts = 0;
|
|
106
|
-
const maxAttempts = 100;
|
|
107
|
-
const delay = 50;
|
|
108
|
-
while (attempts < maxAttempts) {
|
|
109
|
-
try {
|
|
110
|
-
if (existsSync(this.lockPath)) {
|
|
111
|
-
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
112
|
-
attempts++;
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
writeFileSync(this.sharedLockPath, "");
|
|
116
|
-
this.sharedLockCount = 1;
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
121
|
-
attempts++;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
throw new Error("Failed to acquire shared lock after multiple attempts");
|
|
125
|
-
}
|
|
126
|
-
async acquireExclusive() {
|
|
127
|
-
if (this.exclusiveLockCount > 0) {
|
|
128
|
-
this.exclusiveLockCount++;
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
let attempts = 0;
|
|
132
|
-
const maxAttempts = 100;
|
|
133
|
-
const delay = 50;
|
|
134
|
-
while (attempts < maxAttempts) {
|
|
135
|
-
try {
|
|
136
|
-
if (existsSync(this.sharedLockPath)) {
|
|
137
|
-
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
138
|
-
attempts++;
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
const fd = openSync(this.lockPath, constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY, 0o644);
|
|
142
|
-
closeSync(fd);
|
|
143
|
-
this.exclusiveLockCount = 1;
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
catch (error) {
|
|
147
|
-
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
148
|
-
attempts++;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
throw new Error("Failed to acquire exclusive lock after multiple attempts");
|
|
152
|
-
}
|
|
153
|
-
async releaseShared() {
|
|
154
|
-
if (this.sharedLockCount === 0) {
|
|
155
|
-
throw new Error("No shared lock to release");
|
|
156
|
-
}
|
|
157
|
-
this.sharedLockCount--;
|
|
158
|
-
if (this.sharedLockCount === 0) {
|
|
159
|
-
try {
|
|
160
|
-
unlinkSync(this.sharedLockPath);
|
|
161
|
-
}
|
|
162
|
-
catch (error) {
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
async releaseExclusive() {
|
|
167
|
-
if (this.exclusiveLockCount === 0) {
|
|
168
|
-
throw new Error("No exclusive lock to release");
|
|
169
|
-
}
|
|
170
|
-
this.exclusiveLockCount--;
|
|
171
|
-
if (this.exclusiveLockCount === 0) {
|
|
172
|
-
try {
|
|
173
|
-
unlinkSync(this.lockPath);
|
|
174
|
-
}
|
|
175
|
-
catch (error) {
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
export class MultiProcessKVStore {
|
|
181
|
-
storage;
|
|
182
|
-
constructor(filePath) {
|
|
183
|
-
this.storage = new PersistentStorage(filePath);
|
|
184
|
-
}
|
|
185
|
-
async get(key) {
|
|
186
|
-
return this.storage.get(key);
|
|
187
|
-
}
|
|
188
|
-
async set(key, value) {
|
|
189
|
-
return this.storage.set(key, value);
|
|
190
|
-
}
|
|
191
|
-
async delete(key) {
|
|
192
|
-
return this.storage.transaction((data) => {
|
|
193
|
-
delete data[key];
|
|
194
|
-
return data;
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
async has(key) {
|
|
198
|
-
const value = await this.storage.get(key);
|
|
199
|
-
return value !== undefined;
|
|
200
|
-
}
|
|
201
|
-
async keys() {
|
|
202
|
-
const data = await this.storage.readAll();
|
|
203
|
-
return Object.keys(data);
|
|
204
|
-
}
|
|
205
|
-
async values() {
|
|
206
|
-
const data = await this.storage.readAll();
|
|
207
|
-
return Object.values(data);
|
|
208
|
-
}
|
|
209
|
-
async entries() {
|
|
210
|
-
const data = await this.storage.readAll();
|
|
211
|
-
return Object.entries(data);
|
|
212
|
-
}
|
|
213
|
-
async clear() {
|
|
214
|
-
return this.storage.clear();
|
|
215
|
-
}
|
|
216
|
-
async size() {
|
|
217
|
-
const data = await this.storage.readAll();
|
|
218
|
-
return Object.keys(data).length;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
1
|
+
import{randomBytes}from'crypto';import{readFileSync,writeFileSync,renameSync,unlinkSync,existsSync,openSync,closeSync,constants}from'fs';export class PersistentStorage{['filePath'];['lock'];constructor(a){this['filePath']=a,this['lock']=new Lock(a+'.lock'),!existsSync(a)&&writeFileSync(a,JSON['stringify']({}));}async['readAll'](){await this['lock']['acquireShared']();try{const a=readFileSync(this['filePath'],'utf8');return JSON['parse'](a);}finally{await this['lock']['releaseShared']();}}async['writeAll'](a){await this['lock']['acquireExclusive']();try{const b=this['filePath']+'.tmp.'+randomBytes(0x8)['toString']('hex');writeFileSync(b,JSON['stringify'](a)),renameSync(b,this['filePath']);}finally{await this['lock']['releaseExclusive']();}}async['set'](a,b){await this['lock']['acquireExclusive']();try{const c=readFileSync(this['filePath'],'utf8'),d=JSON['parse'](c);d[a]=b;const e=this['filePath']+'.tmp.'+randomBytes(0x8)['toString']('hex');writeFileSync(e,JSON['stringify'](d)),renameSync(e,this['filePath']);}finally{await this['lock']['releaseExclusive']();}}async['get'](a){await this['lock']['acquireShared']();try{const b=readFileSync(this['filePath'],'utf8'),c=JSON['parse'](b);return c[a];}finally{await this['lock']['releaseShared']();}}async['transaction'](a){await this['lock']['acquireExclusive']();try{const b=readFileSync(this['filePath'],'utf8'),c=JSON['parse'](b),d=a(c),e=this['filePath']+'.tmp.'+randomBytes(0x8)['toString']('hex');writeFileSync(e,JSON['stringify'](d)),renameSync(e,this['filePath']);}finally{await this['lock']['releaseExclusive']();}}async['clear'](){await this['lock']['acquireExclusive']();try{const a=this['filePath']+'.tmp.'+randomBytes(0x8)['toString']('hex');writeFileSync(a,JSON['stringify']({})),renameSync(a,this['filePath']);}finally{await this['lock']['releaseExclusive']();}}}export class Lock{['lockPath'];['sharedLockPath'];['lockFd']=null;['sharedLockCount']=0x0;['exclusiveLockCount']=0x0;constructor(a){this['lockPath']=a,this['sharedLockPath']=a+'.shared';}async['acquireShared'](){if(this['exclusiveLockCount']>0x0){this['sharedLockCount']++,this['exclusiveLockCount']--;return;}if(this['sharedLockCount']>0x0){this['sharedLockCount']++;return;}let a=0x0;const b=0x64,c=0x32;while(a<b){try{if(existsSync(this['lockPath'])){await new Promise(d=>setTimeout(d,c)),a++;continue;}writeFileSync(this['sharedLockPath'],''),this['sharedLockCount']=0x1;return;}catch(d){await new Promise(e=>setTimeout(e,c)),a++;}}throw new Error('Failed\x20to\x20acquire\x20shared\x20lock\x20after\x20multiple\x20attempts');}async['acquireExclusive'](){if(this['exclusiveLockCount']>0x0){this['exclusiveLockCount']++;return;}let a=0x0;const b=0x64,c=0x32;while(a<b){try{if(existsSync(this['sharedLockPath'])){await new Promise(e=>setTimeout(e,c)),a++;continue;}const d=openSync(this['lockPath'],constants['O_CREAT']|constants['O_EXCL']|constants['O_WRONLY'],0x1a4);closeSync(d),this['exclusiveLockCount']=0x1;return;}catch(e){await new Promise(f=>setTimeout(f,c)),a++;}}throw new Error('Failed\x20to\x20acquire\x20exclusive\x20lock\x20after\x20multiple\x20attempts');}async['releaseShared'](){if(this['sharedLockCount']===0x0)throw new Error('No\x20shared\x20lock\x20to\x20release');this['sharedLockCount']--;if(this['sharedLockCount']===0x0)try{unlinkSync(this['sharedLockPath']);}catch(a){}}async['releaseExclusive'](){if(this['exclusiveLockCount']===0x0)throw new Error('No\x20exclusive\x20lock\x20to\x20release');this['exclusiveLockCount']--;if(this['exclusiveLockCount']===0x0)try{unlinkSync(this['lockPath']);}catch(a){}}}export class MultiProcessKVStore{['storage'];constructor(a){this['storage']=new PersistentStorage(a);}async['get'](a){return this['storage']['get'](a);}async['set'](a,b){return this['storage']['set'](a,b);}async['delete'](a){return this['storage']['transaction'](b=>{return delete b[a],b;});}async['has'](a){const b=await this['storage']['get'](a);return b!==undefined;}async['keys'](){const a=await this['storage']['readAll']();return Object['keys'](a);}async['values'](){const a=await this['storage']['readAll']();return Object['values'](a);}async['entries'](){const a=await this['storage']['readAll']();return Object['entries'](a);}async['clear'](){return this['storage']['clear']();}async['size'](){const a=await this['storage']['readAll']();return Object['keys'](a)['length'];}}
|
|
@@ -1,144 +1 @@
|
|
|
1
|
-
import { PersistentStorage, MultiProcessKVStore, }
|
|
2
|
-
import { existsSync, unlinkSync } from "fs";
|
|
3
|
-
const STORAGE_FILE = "./test-storage.json";
|
|
4
|
-
const KV_STORE_FILE = "./test-kv-store.json";
|
|
5
|
-
function cleanupTestFiles() {
|
|
6
|
-
if (existsSync(STORAGE_FILE)) {
|
|
7
|
-
unlinkSync(STORAGE_FILE);
|
|
8
|
-
}
|
|
9
|
-
if (existsSync(`${STORAGE_FILE}.lock`)) {
|
|
10
|
-
unlinkSync(`${STORAGE_FILE}.lock`);
|
|
11
|
-
}
|
|
12
|
-
if (existsSync(`${STORAGE_FILE}.lock.shared`)) {
|
|
13
|
-
unlinkSync(`${STORAGE_FILE}.lock.shared`);
|
|
14
|
-
}
|
|
15
|
-
if (existsSync(KV_STORE_FILE)) {
|
|
16
|
-
unlinkSync(KV_STORE_FILE);
|
|
17
|
-
}
|
|
18
|
-
if (existsSync(`${KV_STORE_FILE}.lock`)) {
|
|
19
|
-
unlinkSync(`${KV_STORE_FILE}.lock`);
|
|
20
|
-
}
|
|
21
|
-
if (existsSync(`${KV_STORE_FILE}.lock.shared`)) {
|
|
22
|
-
unlinkSync(`${KV_STORE_FILE}.lock.shared`);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
async function testPersistentStorage() {
|
|
26
|
-
console.log("=== Testing PersistentStorage ===");
|
|
27
|
-
const storage = new PersistentStorage(STORAGE_FILE);
|
|
28
|
-
console.log("Writing initial data...");
|
|
29
|
-
await storage.writeAll({
|
|
30
|
-
port: 3000,
|
|
31
|
-
host: "localhost",
|
|
32
|
-
debug: true,
|
|
33
|
-
});
|
|
34
|
-
console.log("Initial data written successfully!");
|
|
35
|
-
console.log("Reading all data...");
|
|
36
|
-
const data = await storage.readAll();
|
|
37
|
-
console.log("Read data:", data);
|
|
38
|
-
console.log("Getting specific key (port)...");
|
|
39
|
-
const port = await storage.get("port");
|
|
40
|
-
console.log("Port:", port);
|
|
41
|
-
console.log("Setting new value for port...");
|
|
42
|
-
await storage.set("port", 4000);
|
|
43
|
-
console.log("New port set to:", await storage.get("port"));
|
|
44
|
-
console.log("Adding new key (apiKey)...");
|
|
45
|
-
await storage.set("apiKey", "test-12345");
|
|
46
|
-
console.log("New apiKey:", await storage.get("apiKey"));
|
|
47
|
-
console.log("Running transaction...");
|
|
48
|
-
await storage.transaction((config) => {
|
|
49
|
-
config.debug = false;
|
|
50
|
-
config.host = "0.0.0.0";
|
|
51
|
-
return config;
|
|
52
|
-
});
|
|
53
|
-
console.log("After transaction:", await storage.readAll());
|
|
54
|
-
console.log("Clearing all data...");
|
|
55
|
-
await storage.clear();
|
|
56
|
-
console.log("After clearing:", await storage.readAll());
|
|
57
|
-
console.log("PersistentStorage tests completed!\n");
|
|
58
|
-
}
|
|
59
|
-
async function testMultiProcessKVStore() {
|
|
60
|
-
console.log("=== Testing MultiProcessKVStore ===");
|
|
61
|
-
const kvStore = new MultiProcessKVStore(KV_STORE_FILE);
|
|
62
|
-
console.log("Setting values...");
|
|
63
|
-
await kvStore.set("username", "john_doe");
|
|
64
|
-
await kvStore.set("email", "john@example.com");
|
|
65
|
-
await kvStore.set("role", "admin");
|
|
66
|
-
console.log("Values set successfully!");
|
|
67
|
-
console.log("Getting values...");
|
|
68
|
-
console.log("Username:", await kvStore.get("username"));
|
|
69
|
-
console.log("Email:", await kvStore.get("email"));
|
|
70
|
-
console.log("Role:", await kvStore.get("role"));
|
|
71
|
-
console.log("Checking if keys exist...");
|
|
72
|
-
console.log("Username exists:", await kvStore.has("username"));
|
|
73
|
-
console.log("Password exists:", await kvStore.has("password"));
|
|
74
|
-
console.log("Getting all keys...");
|
|
75
|
-
const keys = await kvStore.keys();
|
|
76
|
-
console.log("Keys:", keys);
|
|
77
|
-
console.log("Getting all values...");
|
|
78
|
-
const values = await kvStore.values();
|
|
79
|
-
console.log("Values:", values);
|
|
80
|
-
console.log("Getting all entries...");
|
|
81
|
-
const entries = await kvStore.entries();
|
|
82
|
-
console.log("Entries:", entries);
|
|
83
|
-
console.log("Getting size...");
|
|
84
|
-
const size = await kvStore.size();
|
|
85
|
-
console.log("Size:", size);
|
|
86
|
-
console.log("Deleting a key (role)...");
|
|
87
|
-
await kvStore.delete("role");
|
|
88
|
-
console.log("Role exists after deletion:", await kvStore.has("role"));
|
|
89
|
-
console.log("Size after deletion:", await kvStore.size());
|
|
90
|
-
console.log("Clearing all data...");
|
|
91
|
-
await kvStore.clear();
|
|
92
|
-
console.log("Size after clearing:", await kvStore.size());
|
|
93
|
-
console.log("MultiProcessKVStore tests completed!\n");
|
|
94
|
-
}
|
|
95
|
-
async function testMultiProcessSimulation() {
|
|
96
|
-
console.log("=== Testing Multi-Process Simulation ===");
|
|
97
|
-
const storage1 = new PersistentStorage(STORAGE_FILE);
|
|
98
|
-
const storage2 = new PersistentStorage(STORAGE_FILE);
|
|
99
|
-
await storage1.writeAll({ counter: 0 });
|
|
100
|
-
console.log("Initial counter:", await storage1.get("counter"));
|
|
101
|
-
console.log("Simulating concurrent updates...");
|
|
102
|
-
const update1 = async () => {
|
|
103
|
-
for (let i = 0; i < 5; i++) {
|
|
104
|
-
await storage1.transaction((data) => {
|
|
105
|
-
data.counter += 1;
|
|
106
|
-
return data;
|
|
107
|
-
});
|
|
108
|
-
console.log("Process 1: counter =", await storage1.get("counter"));
|
|
109
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
const update2 = async () => {
|
|
113
|
-
for (let i = 0; i < 5; i++) {
|
|
114
|
-
await storage2.transaction((data) => {
|
|
115
|
-
data.counter += 1;
|
|
116
|
-
return data;
|
|
117
|
-
});
|
|
118
|
-
console.log("Process 2: counter =", await storage2.get("counter"));
|
|
119
|
-
await new Promise((resolve) => setTimeout(resolve, 150));
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
await Promise.all([update1(), update2()]);
|
|
123
|
-
const finalCounter = await storage1.get("counter");
|
|
124
|
-
console.log("Final counter value:", finalCounter);
|
|
125
|
-
console.log("Expected final counter value: 10");
|
|
126
|
-
console.log("Multi-process simulation completed!\n");
|
|
127
|
-
}
|
|
128
|
-
async function runAllTests() {
|
|
129
|
-
try {
|
|
130
|
-
cleanupTestFiles();
|
|
131
|
-
await testPersistentStorage();
|
|
132
|
-
await testMultiProcessKVStore();
|
|
133
|
-
await testMultiProcessSimulation();
|
|
134
|
-
cleanupTestFiles();
|
|
135
|
-
console.log("All tests completed successfully!");
|
|
136
|
-
}
|
|
137
|
-
catch (error) {
|
|
138
|
-
console.error("Error running tests:", error);
|
|
139
|
-
cleanupTestFiles();
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
if (require.main === module) {
|
|
143
|
-
runAllTests().catch(console.error);
|
|
144
|
-
}
|
|
1
|
+
import{PersistentStorage,MultiProcessKVStore}from'./persistent-storage.js';import{existsSync,unlinkSync}from'fs';const STORAGE_FILE='./test-storage.json',KV_STORE_FILE='./test-kv-store.json';function cleanupTestFiles(){existsSync(STORAGE_FILE)&&unlinkSync(STORAGE_FILE),existsSync(STORAGE_FILE+'.lock')&&unlinkSync(STORAGE_FILE+'.lock'),existsSync(STORAGE_FILE+'.lock.shared')&&unlinkSync(STORAGE_FILE+'.lock.shared'),existsSync(KV_STORE_FILE)&&unlinkSync(KV_STORE_FILE),existsSync(KV_STORE_FILE+'.lock')&&unlinkSync(KV_STORE_FILE+'.lock'),existsSync(KV_STORE_FILE+'.lock.shared')&&unlinkSync(KV_STORE_FILE+'.lock.shared');}async function testPersistentStorage(){console['log']('===\x20Testing\x20PersistentStorage\x20===');const a=new PersistentStorage(STORAGE_FILE);console['log']('Writing\x20initial\x20data...'),await a['writeAll']({'port':0xbb8,'host':'localhost','debug':!![]}),console['log']('Initial\x20data\x20written\x20successfully!'),console['log']('Reading\x20all\x20data...');const b=await a['readAll']();console['log']('Read\x20data:',b),console['log']('Getting\x20specific\x20key\x20(port)...');const c=await a['get']('port');console['log']('Port:',c),console['log']('Setting\x20new\x20value\x20for\x20port...'),await a['set']('port',0xfa0),console['log']('New\x20port\x20set\x20to:',await a['get']('port')),console['log']('Adding\x20new\x20key\x20(apiKey)...'),await a['set']('apiKey','test-12345'),console['log']('New\x20apiKey:',await a['get']('apiKey')),console['log']('Running\x20transaction...'),await a['transaction'](d=>{return d['debug']=![],d['host']='0.0.0.0',d;}),console['log']('After\x20transaction:',await a['readAll']()),console['log']('Clearing\x20all\x20data...'),await a['clear'](),console['log']('After\x20clearing:',await a['readAll']()),console['log']('PersistentStorage\x20tests\x20completed!\x0a');}async function testMultiProcessKVStore(){console['log']('===\x20Testing\x20MultiProcessKVStore\x20===');const a=new MultiProcessKVStore(KV_STORE_FILE);console['log']('Setting\x20values...'),await a['set']('username','john_doe'),await a['set']('email','john@example.com'),await a['set']('role','admin'),console['log']('Values\x20set\x20successfully!'),console['log']('Getting\x20values...'),console['log']('Username:',await a['get']('username')),console['log']('Email:',await a['get']('email')),console['log']('Role:',await a['get']('role')),console['log']('Checking\x20if\x20keys\x20exist...'),console['log']('Username\x20exists:',await a['has']('username')),console['log']('Password\x20exists:',await a['has']('password')),console['log']('Getting\x20all\x20keys...');const b=await a['keys']();console['log']('Keys:',b),console['log']('Getting\x20all\x20values...');const c=await a['values']();console['log']('Values:',c),console['log']('Getting\x20all\x20entries...');const d=await a['entries']();console['log']('Entries:',d),console['log']('Getting\x20size...');const e=await a['size']();console['log']('Size:',e),console['log']('Deleting\x20a\x20key\x20(role)...'),await a['delete']('role'),console['log']('Role\x20exists\x20after\x20deletion:',await a['has']('role')),console['log']('Size\x20after\x20deletion:',await a['size']()),console['log']('Clearing\x20all\x20data...'),await a['clear'](),console['log']('Size\x20after\x20clearing:',await a['size']()),console['log']('MultiProcessKVStore\x20tests\x20completed!\x0a');}async function testMultiProcessSimulation(){console['log']('===\x20Testing\x20Multi-Process\x20Simulation\x20===');const a=new PersistentStorage(STORAGE_FILE),b=new PersistentStorage(STORAGE_FILE);await a['writeAll']({'counter':0x0}),console['log']('Initial\x20counter:',await a['get']('counter')),console['log']('Simulating\x20concurrent\x20updates...');const c=async()=>{for(let f=0x0;f<0x5;f++){await a['transaction'](g=>{return g['counter']+=0x1,g;}),console['log']('Process\x201:\x20counter\x20=',await a['get']('counter')),await new Promise(g=>setTimeout(g,0x64));}},d=async()=>{for(let f=0x0;f<0x5;f++){await b['transaction'](g=>{return g['counter']+=0x1,g;}),console['log']('Process\x202:\x20counter\x20=',await b['get']('counter')),await new Promise(g=>setTimeout(g,0x96));}};await Promise['all']([c(),d()]);const e=await a['get']('counter');console['log']('Final\x20counter\x20value:',e),console['log']('Expected\x20final\x20counter\x20value:\x2010'),console['log']('Multi-process\x20simulation\x20completed!\x0a');}async function runAllTests(){try{cleanupTestFiles(),await testPersistentStorage(),await testMultiProcessKVStore(),await testMultiProcessSimulation(),cleanupTestFiles(),console['log']('All\x20tests\x20completed\x20successfully!');}catch(a){console['error']('Error\x20running\x20tests:',a),cleanupTestFiles();}}require['main']===module&&runAllTests()['catch'](console['error']);
|
|
@@ -1,96 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { TransactionDataBuilder } from "../../transactions/TransactionData.js";
|
|
3
|
-
export function parseTransactionBcs(bytes) {
|
|
4
|
-
return {
|
|
5
|
-
...TransactionDataBuilder.fromBytes(bytes).snapshot(),
|
|
6
|
-
bcs: bytes,
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
export function parseTransactionEffectsBcs(effects) {
|
|
10
|
-
const parsed = bcs.TransactionEffects.parse(effects);
|
|
11
|
-
switch (parsed.$kind) {
|
|
12
|
-
case "V1":
|
|
13
|
-
return parseTransactionEffectsV1({
|
|
14
|
-
bytes: effects,
|
|
15
|
-
effects: parsed.V1,
|
|
16
|
-
});
|
|
17
|
-
case "V2":
|
|
18
|
-
return parseTransactionEffectsV2({
|
|
19
|
-
bytes: effects,
|
|
20
|
-
effects: parsed.V2,
|
|
21
|
-
});
|
|
22
|
-
default:
|
|
23
|
-
throw new Error(`Unknown transaction effects version: ${parsed.$kind}`);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function parseTransactionEffectsV1(_) {
|
|
27
|
-
throw new Error("V1 effects are not supported yet");
|
|
28
|
-
}
|
|
29
|
-
function parseTransactionEffectsV2({ bytes, effects, }) {
|
|
30
|
-
const changedObjects = effects.changedObjects.map(([id, change]) => {
|
|
31
|
-
return {
|
|
32
|
-
id,
|
|
33
|
-
inputState: change.inputState.$kind === "Exist"
|
|
34
|
-
? "Exists"
|
|
35
|
-
: "DoesNotExist",
|
|
36
|
-
inputVersion: change.inputState.Exist?.[0][0] ?? null,
|
|
37
|
-
inputDigest: change.inputState.Exist?.[0][1] ?? null,
|
|
38
|
-
inputOwner: change.inputState.Exist?.[1] ?? null,
|
|
39
|
-
outputState: change.outputState.$kind === "NotExist"
|
|
40
|
-
? "DoesNotExist"
|
|
41
|
-
: change.outputState.$kind,
|
|
42
|
-
outputVersion: change.outputState.$kind === "PackageWrite"
|
|
43
|
-
? change.outputState.PackageWrite?.[0]
|
|
44
|
-
: change.outputState.ObjectWrite
|
|
45
|
-
? effects.lamportVersion
|
|
46
|
-
: null,
|
|
47
|
-
outputDigest: change.outputState.$kind === "PackageWrite"
|
|
48
|
-
? change.outputState.PackageWrite?.[1]
|
|
49
|
-
: (change.outputState.ObjectWrite?.[0] ?? null),
|
|
50
|
-
outputOwner: change.outputState.ObjectWrite
|
|
51
|
-
? change.outputState.ObjectWrite[1]
|
|
52
|
-
: null,
|
|
53
|
-
idOperation: change.idOperation.$kind,
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
return {
|
|
57
|
-
bcs: bytes,
|
|
58
|
-
digest: effects.transactionDigest,
|
|
59
|
-
version: 2,
|
|
60
|
-
status: effects.status.$kind === "Success"
|
|
61
|
-
? {
|
|
62
|
-
success: true,
|
|
63
|
-
error: null,
|
|
64
|
-
}
|
|
65
|
-
: {
|
|
66
|
-
success: false,
|
|
67
|
-
error: effects.status.Failed.error.$kind,
|
|
68
|
-
},
|
|
69
|
-
gasUsed: effects.gasUsed,
|
|
70
|
-
transactionDigest: effects.transactionDigest,
|
|
71
|
-
gasObject: effects.gasObjectIndex === null
|
|
72
|
-
? null
|
|
73
|
-
: (changedObjects[effects.gasObjectIndex] ?? null),
|
|
74
|
-
eventsDigest: effects.eventsDigest,
|
|
75
|
-
dependencies: effects.dependencies,
|
|
76
|
-
lamportVersion: effects.lamportVersion,
|
|
77
|
-
changedObjects,
|
|
78
|
-
unchangedConsensusObjects: effects.unchangedSharedObjects.map(([objectId, object,]) => {
|
|
79
|
-
return {
|
|
80
|
-
kind: object.$kind === "MutateDeleted"
|
|
81
|
-
? "MutateConsensusStreamEnded"
|
|
82
|
-
: object.$kind === "ReadDeleted"
|
|
83
|
-
? "ReadConsensusStreamEnded"
|
|
84
|
-
: object.$kind,
|
|
85
|
-
objectId: objectId,
|
|
86
|
-
version: object.$kind === "ReadOnlyRoot"
|
|
87
|
-
? object.ReadOnlyRoot[0]
|
|
88
|
-
: object[object.$kind],
|
|
89
|
-
digest: object.$kind === "ReadOnlyRoot"
|
|
90
|
-
? object.ReadOnlyRoot[1]
|
|
91
|
-
: null,
|
|
92
|
-
};
|
|
93
|
-
}),
|
|
94
|
-
auxiliaryDataDigest: effects.auxDataDigest,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
1
|
+
import{bcs}from'../../bcs/index.js';import{TransactionDataBuilder}from'../../transactions/TransactionData.js';export function parseTransactionBcs(a){return{...TransactionDataBuilder['fromBytes'](a)['snapshot'](),'bcs':a};}export function parseTransactionEffectsBcs(a){const b=bcs['TransactionEffects']['parse'](a);switch(b['$kind']){case'V1':return parseTransactionEffectsV1({'bytes':a,'effects':b['V1']});case'V2':return parseTransactionEffectsV2({'bytes':a,'effects':b['V2']});default:throw new Error('Unknown\x20transaction\x20effects\x20version:\x20'+b['$kind']);}}function parseTransactionEffectsV1(a){throw new Error('V1\x20effects\x20are\x20not\x20supported\x20yet');}function parseTransactionEffectsV2({bytes:a,effects:b}){const c=b['changedObjects']['map'](([d,e])=>{return{'id':d,'inputState':e['inputState']['$kind']==='Exist'?'Exists':'DoesNotExist','inputVersion':e['inputState']['Exist']?.[0x0][0x0]??null,'inputDigest':e['inputState']['Exist']?.[0x0][0x1]??null,'inputOwner':e['inputState']['Exist']?.[0x1]??null,'outputState':e['outputState']['$kind']==='NotExist'?'DoesNotExist':e['outputState']['$kind'],'outputVersion':e['outputState']['$kind']==='PackageWrite'?e['outputState']['PackageWrite']?.[0x0]:e['outputState']['ObjectWrite']?b['lamportVersion']:null,'outputDigest':e['outputState']['$kind']==='PackageWrite'?e['outputState']['PackageWrite']?.[0x1]:e['outputState']['ObjectWrite']?.[0x0]??null,'outputOwner':e['outputState']['ObjectWrite']?e['outputState']['ObjectWrite'][0x1]:null,'idOperation':e['idOperation']['$kind']};});return{'bcs':a,'digest':b['transactionDigest'],'version':0x2,'status':b['status']['$kind']==='Success'?{'success':!![],'error':null}:{'success':![],'error':b['status']['Failed']['error']['$kind']},'gasUsed':b['gasUsed'],'transactionDigest':b['transactionDigest'],'gasObject':b['gasObjectIndex']===null?null:c[b['gasObjectIndex']]??null,'eventsDigest':b['eventsDigest'],'dependencies':b['dependencies'],'lamportVersion':b['lamportVersion'],'changedObjects':c,'unchangedConsensusObjects':b['unchangedSharedObjects']['map'](([d,e])=>{return{'kind':e['$kind']==='MutateDeleted'?'MutateConsensusStreamEnded':e['$kind']==='ReadDeleted'?'ReadConsensusStreamEnded':e['$kind'],'objectId':d,'version':e['$kind']==='ReadOnlyRoot'?e['ReadOnlyRoot'][0x0]:e[e['$kind']],'digest':e['$kind']==='ReadOnlyRoot'?e['ReadOnlyRoot'][0x1]:null};}),'auxiliaryDataDigest':b['auxDataDigest']};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export{};
|
|
@@ -1,99 +1 @@
|
|
|
1
|
-
export class FaucetRateLimitError extends Error {
|
|
2
|
-
}
|
|
3
|
-
async function faucetRequest({ host, path, body, headers, method, }) {
|
|
4
|
-
const endpoint = new URL(path, host).toString();
|
|
5
|
-
const requestHeaders = {
|
|
6
|
-
"Content-Type": "application/json",
|
|
7
|
-
};
|
|
8
|
-
if (headers) {
|
|
9
|
-
Object.assign(requestHeaders, headers);
|
|
10
|
-
}
|
|
11
|
-
const res = await fetch(endpoint, {
|
|
12
|
-
method,
|
|
13
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
14
|
-
headers: requestHeaders,
|
|
15
|
-
});
|
|
16
|
-
if (res.status === 429) {
|
|
17
|
-
throw new FaucetRateLimitError(`Too many requests from this client have been sent to the faucet. Please retry later`);
|
|
18
|
-
}
|
|
19
|
-
try {
|
|
20
|
-
const parsed = await res.json();
|
|
21
|
-
return parsed;
|
|
22
|
-
}
|
|
23
|
-
catch (e) {
|
|
24
|
-
throw new Error(`Encountered error when parsing response from faucet, error: ${e}, status ${res.status}, response ${res}`);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export async function requestSuiFromFaucetV0(input) {
|
|
28
|
-
const response = await faucetRequest({
|
|
29
|
-
host: input.host,
|
|
30
|
-
path: "/gas",
|
|
31
|
-
body: {
|
|
32
|
-
FixedAmountRequest: {
|
|
33
|
-
recipient: input.recipient,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
headers: input.headers,
|
|
37
|
-
method: "POST",
|
|
38
|
-
});
|
|
39
|
-
if (response.error) {
|
|
40
|
-
throw new Error(`Faucet request failed: ${response.error}`);
|
|
41
|
-
}
|
|
42
|
-
return response;
|
|
43
|
-
}
|
|
44
|
-
export async function requestSuiFromFaucetV1(input) {
|
|
45
|
-
const response = await faucetRequest({
|
|
46
|
-
host: input.host,
|
|
47
|
-
path: "/v1/gas",
|
|
48
|
-
body: {
|
|
49
|
-
FixedAmountRequest: {
|
|
50
|
-
recipient: input.recipient,
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
headers: input.headers,
|
|
54
|
-
method: "POST",
|
|
55
|
-
});
|
|
56
|
-
if (response.error) {
|
|
57
|
-
throw new Error(`Faucet request failed: ${response.error}`);
|
|
58
|
-
}
|
|
59
|
-
return response;
|
|
60
|
-
}
|
|
61
|
-
export async function requestSuiFromFaucetV2(input) {
|
|
62
|
-
const response = await faucetRequest({
|
|
63
|
-
host: input.host,
|
|
64
|
-
path: "/v2/gas",
|
|
65
|
-
body: {
|
|
66
|
-
FixedAmountRequest: {
|
|
67
|
-
recipient: input.recipient,
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
headers: input.headers,
|
|
71
|
-
method: "POST",
|
|
72
|
-
});
|
|
73
|
-
if (response.status !== "Success") {
|
|
74
|
-
throw new Error(`Faucet request failed: ${response.status.Failure.internal}`);
|
|
75
|
-
}
|
|
76
|
-
return response;
|
|
77
|
-
}
|
|
78
|
-
export async function getFaucetRequestStatus(input) {
|
|
79
|
-
const response = await faucetRequest({
|
|
80
|
-
host: input.host,
|
|
81
|
-
path: `/v1/status/${input.taskId}`,
|
|
82
|
-
headers: input.headers,
|
|
83
|
-
method: "GET",
|
|
84
|
-
});
|
|
85
|
-
if (response.error) {
|
|
86
|
-
throw new Error(`Faucet request failed: ${response.error}`);
|
|
87
|
-
}
|
|
88
|
-
return response;
|
|
89
|
-
}
|
|
90
|
-
export function getFaucetHost(network) {
|
|
91
|
-
switch (network) {
|
|
92
|
-
case "testnet":
|
|
93
|
-
return "https://faucet.testnet.wowok.net";
|
|
94
|
-
case "localnet":
|
|
95
|
-
return "http://127.0.0.1:9123";
|
|
96
|
-
default:
|
|
97
|
-
throw new Error(`Unknown network: ${network}`);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
1
|
+
export class FaucetRateLimitError extends Error{}async function faucetRequest({host:a,path:b,body:c,headers:d,method:f}){const g=new URL(b,a)['toString'](),h={'Content-Type':'application/json'};d&&Object['assign'](h,d);const i=await fetch(g,{'method':f,'body':c?JSON['stringify'](c):undefined,'headers':h});if(i['status']===0x1ad)throw new FaucetRateLimitError('Too\x20many\x20requests\x20from\x20this\x20client\x20have\x20been\x20sent\x20to\x20the\x20faucet.\x20Please\x20retry\x20later');try{const j=await i['json']();return j;}catch(k){throw new Error('Encountered\x20error\x20when\x20parsing\x20response\x20from\x20faucet,\x20error:\x20'+k+',\x20status\x20'+i['status']+',\x20response\x20'+i);}}export async function requestSuiFromFaucetV0(a){const b=await faucetRequest({'host':a['host'],'path':'/gas','body':{'FixedAmountRequest':{'recipient':a['recipient']}},'headers':a['headers'],'method':'POST'});if(b['error'])throw new Error('Faucet\x20request\x20failed:\x20'+b['error']);return b;}export async function requestSuiFromFaucetV1(a){const b=await faucetRequest({'host':a['host'],'path':'/v1/gas','body':{'FixedAmountRequest':{'recipient':a['recipient']}},'headers':a['headers'],'method':'POST'});if(b['error'])throw new Error('Faucet\x20request\x20failed:\x20'+b['error']);return b;}export async function requestSuiFromFaucetV2(a){const b=await faucetRequest({'host':a['host'],'path':'/v2/gas','body':{'FixedAmountRequest':{'recipient':a['recipient']}},'headers':a['headers'],'method':'POST'});if(b['status']!=='Success')throw new Error('Faucet\x20request\x20failed:\x20'+b['status']['Failure']['internal']);return b;}export async function getFaucetRequestStatus(a){const b=await faucetRequest({'host':a['host'],'path':'/v1/status/'+a['taskId'],'headers':a['headers'],'method':'GET'});if(b['error'])throw new Error('Faucet\x20request\x20failed:\x20'+b['error']);return b;}export function getFaucetHost(a){switch(a){case'testnet':return'https://faucet.testnet.wowok.net';case'localnet':return'http://127.0.0.1:9123';default:throw new Error('Unknown\x20network:\x20'+a);}}
|
package/dist/cjs/faucet/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export{requestSuiFromFaucetV0,requestSuiFromFaucetV1,requestSuiFromFaucetV2,getFaucetRequestStatus,getFaucetHost,FaucetRateLimitError}from'./faucet.js';
|
package/dist/cjs/grpc/client.js
CHANGED
|
@@ -1,42 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { TransactionExecutionServiceClient } from "./proto/sui/rpc/v2/transaction_execution_service.client.js";
|
|
3
|
-
import { LedgerServiceClient } from "./proto/sui/rpc/v2/ledger_service.client.js";
|
|
4
|
-
import { MovePackageServiceClient } from "./proto/sui/rpc/v2/move_package_service.client.js";
|
|
5
|
-
import { SignatureVerificationServiceClient } from "./proto/sui/rpc/v2/signature_verification_service.client.js";
|
|
6
|
-
import { StateServiceClient } from "./proto/sui/rpc/v2/state_service.client.js";
|
|
7
|
-
import { SubscriptionServiceClient } from "./proto/sui/rpc/v2/subscription_service.client.js";
|
|
8
|
-
import { GrpcCoreClient } from "./core.js";
|
|
9
|
-
import { Experimental_BaseClient } from "../experimental/index.js";
|
|
10
|
-
import { NameServiceClient } from "./proto/sui/rpc/v2/name_service.client.js";
|
|
11
|
-
export class SuiGrpcClient extends Experimental_BaseClient {
|
|
12
|
-
core;
|
|
13
|
-
transactionExecutionService;
|
|
14
|
-
ledgerService;
|
|
15
|
-
stateService;
|
|
16
|
-
subscriptionService;
|
|
17
|
-
movePackageService;
|
|
18
|
-
signatureVerificationService;
|
|
19
|
-
nameService;
|
|
20
|
-
constructor(options) {
|
|
21
|
-
super({ network: options.network });
|
|
22
|
-
const transport = options.transport ??
|
|
23
|
-
new GrpcWebFetchTransport({
|
|
24
|
-
baseUrl: options.baseUrl,
|
|
25
|
-
fetchInit: options.fetchInit,
|
|
26
|
-
});
|
|
27
|
-
this.transactionExecutionService =
|
|
28
|
-
new TransactionExecutionServiceClient(transport);
|
|
29
|
-
this.ledgerService = new LedgerServiceClient(transport);
|
|
30
|
-
this.stateService = new StateServiceClient(transport);
|
|
31
|
-
this.subscriptionService = new SubscriptionServiceClient(transport);
|
|
32
|
-
this.movePackageService = new MovePackageServiceClient(transport);
|
|
33
|
-
this.signatureVerificationService =
|
|
34
|
-
new SignatureVerificationServiceClient(transport);
|
|
35
|
-
this.nameService = new NameServiceClient(transport);
|
|
36
|
-
this.core = new GrpcCoreClient({
|
|
37
|
-
client: this,
|
|
38
|
-
base: this,
|
|
39
|
-
network: options.network,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
import{GrpcWebFetchTransport}from'@protobuf-ts/grpcweb-transport';import{TransactionExecutionServiceClient}from'./proto/sui/rpc/v2/transaction_execution_service.client.js';import{LedgerServiceClient}from'./proto/sui/rpc/v2/ledger_service.client.js';import{MovePackageServiceClient}from'./proto/sui/rpc/v2/move_package_service.client.js';import{SignatureVerificationServiceClient}from'./proto/sui/rpc/v2/signature_verification_service.client.js';import{StateServiceClient}from'./proto/sui/rpc/v2/state_service.client.js';import{SubscriptionServiceClient}from'./proto/sui/rpc/v2/subscription_service.client.js';import{GrpcCoreClient}from'./core.js';import{Experimental_BaseClient}from'../experimental/index.js';import{NameServiceClient}from'./proto/sui/rpc/v2/name_service.client.js';export class SuiGrpcClient extends Experimental_BaseClient{['core'];['transactionExecutionService'];['ledgerService'];['stateService'];['subscriptionService'];['movePackageService'];['signatureVerificationService'];['nameService'];constructor(a){super({'network':a['network']});const b=a['transport']??new GrpcWebFetchTransport({'baseUrl':a['baseUrl'],'fetchInit':a['fetchInit']});this['transactionExecutionService']=new TransactionExecutionServiceClient(b),this['ledgerService']=new LedgerServiceClient(b),this['stateService']=new StateServiceClient(b),this['subscriptionService']=new SubscriptionServiceClient(b),this['movePackageService']=new MovePackageServiceClient(b),this['signatureVerificationService']=new SignatureVerificationServiceClient(b),this['nameService']=new NameServiceClient(b),this['core']=new GrpcCoreClient({'client':this,'base':this,'network':a['network']});}}
|