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,185 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
import * as fs from "fs";
|
|
4
|
-
import { getWowDir } from "./util.js";
|
|
5
|
-
const WOW_DIR = getWowDir();
|
|
6
|
-
const CACHE_DB_PATH = path.join(WOW_DIR, "cache.db");
|
|
7
|
-
const ACCOUNT_DB_PATH = path.join(WOW_DIR, "account.db");
|
|
8
|
-
function ensureWowDirExists() {
|
|
9
|
-
if (!fs.existsSync(WOW_DIR)) {
|
|
10
|
-
fs.mkdirSync(WOW_DIR, { recursive: true });
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
ensureWowDirExists();
|
|
14
|
-
function getCacheDatabase() {
|
|
15
|
-
ensureWowDirExists();
|
|
16
|
-
const db = new Database(CACHE_DB_PATH);
|
|
17
|
-
db.pragma("journal_mode = WAL");
|
|
18
|
-
db.pragma("synchronous = NORMAL");
|
|
19
|
-
db.exec(`
|
|
20
|
-
CREATE TABLE IF NOT EXISTS cache (
|
|
21
|
-
key TEXT PRIMARY KEY,
|
|
22
|
-
value TEXT NOT NULL,
|
|
23
|
-
updated_at INTEGER DEFAULT (strftime('%s', 'now'))
|
|
24
|
-
);
|
|
25
|
-
`);
|
|
26
|
-
return db;
|
|
27
|
-
}
|
|
28
|
-
let cacheDbInstance = null;
|
|
29
|
-
function getCacheDb() {
|
|
30
|
-
if (!cacheDbInstance) {
|
|
31
|
-
cacheDbInstance = getCacheDatabase();
|
|
32
|
-
}
|
|
33
|
-
return cacheDbInstance;
|
|
34
|
-
}
|
|
35
|
-
function getAccountDatabase() {
|
|
36
|
-
ensureWowDirExists();
|
|
37
|
-
const db = new Database(ACCOUNT_DB_PATH);
|
|
38
|
-
db.pragma("journal_mode = WAL");
|
|
39
|
-
db.pragma("synchronous = NORMAL");
|
|
40
|
-
try {
|
|
41
|
-
fs.chmodSync(ACCOUNT_DB_PATH, 0o600);
|
|
42
|
-
}
|
|
43
|
-
catch {
|
|
44
|
-
}
|
|
45
|
-
db.exec(`
|
|
46
|
-
CREATE TABLE IF NOT EXISTS accounts (
|
|
47
|
-
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
48
|
-
data TEXT NOT NULL,
|
|
49
|
-
updated_at INTEGER DEFAULT (strftime('%s', 'now'))
|
|
50
|
-
);
|
|
51
|
-
`);
|
|
52
|
-
return db;
|
|
53
|
-
}
|
|
54
|
-
let accountDbInstance = null;
|
|
55
|
-
function getAccountDb() {
|
|
56
|
-
if (!accountDbInstance) {
|
|
57
|
-
accountDbInstance = getAccountDatabase();
|
|
58
|
-
}
|
|
59
|
-
return accountDbInstance;
|
|
60
|
-
}
|
|
61
|
-
export class SQLiteStorage {
|
|
62
|
-
_db;
|
|
63
|
-
_dbSource;
|
|
64
|
-
constructor(db) {
|
|
65
|
-
this._dbSource = db;
|
|
66
|
-
}
|
|
67
|
-
get db() {
|
|
68
|
-
if (this._dbSource) {
|
|
69
|
-
return this._dbSource;
|
|
70
|
-
}
|
|
71
|
-
if (!this._db) {
|
|
72
|
-
this._db = getCacheDb();
|
|
73
|
-
}
|
|
74
|
-
return this._db;
|
|
75
|
-
}
|
|
76
|
-
async get(key) {
|
|
77
|
-
const row = this.db
|
|
78
|
-
.prepare("SELECT value FROM cache WHERE key = ?")
|
|
79
|
-
.get(key);
|
|
80
|
-
return row?.value;
|
|
81
|
-
}
|
|
82
|
-
async getMany(keys) {
|
|
83
|
-
const placeholders = keys.map(() => "?").join(",");
|
|
84
|
-
const rows = this.db
|
|
85
|
-
.prepare(`SELECT key, value FROM cache WHERE key IN (${placeholders})`)
|
|
86
|
-
.all(...keys);
|
|
87
|
-
const map = new Map(rows.map((r) => [r.key, r.value]));
|
|
88
|
-
return keys.map((k) => map.get(k));
|
|
89
|
-
}
|
|
90
|
-
async put(key, value) {
|
|
91
|
-
this.db
|
|
92
|
-
.prepare(`
|
|
93
|
-
INSERT INTO cache (key, value, updated_at)
|
|
94
|
-
VALUES (?, ?, strftime('%s', 'now'))
|
|
95
|
-
ON CONFLICT(key) DO UPDATE SET value = excluded.value, updated_at = excluded.updated_at
|
|
96
|
-
`)
|
|
97
|
-
.run(key, value);
|
|
98
|
-
}
|
|
99
|
-
async putMany(items) {
|
|
100
|
-
const stmt = this.db.prepare(`
|
|
101
|
-
INSERT INTO cache (key, value, updated_at)
|
|
102
|
-
VALUES (?, ?, strftime('%s', 'now'))
|
|
103
|
-
ON CONFLICT(key) DO UPDATE SET value = excluded.value, updated_at = excluded.updated_at
|
|
104
|
-
`);
|
|
105
|
-
const insertMany = this.db.transaction((items) => {
|
|
106
|
-
for (const item of items)
|
|
107
|
-
stmt.run(item.key, item.value);
|
|
108
|
-
});
|
|
109
|
-
insertMany(items);
|
|
110
|
-
}
|
|
111
|
-
async del(key) {
|
|
112
|
-
this.db.prepare("DELETE FROM cache WHERE key = ?").run(key);
|
|
113
|
-
}
|
|
114
|
-
async clear() {
|
|
115
|
-
this.db.exec("DELETE FROM cache");
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
export class SQLiteAccountStorage {
|
|
119
|
-
_db;
|
|
120
|
-
_dbSource;
|
|
121
|
-
constructor(db) {
|
|
122
|
-
this._dbSource = db;
|
|
123
|
-
}
|
|
124
|
-
get db() {
|
|
125
|
-
if (this._dbSource) {
|
|
126
|
-
return this._dbSource;
|
|
127
|
-
}
|
|
128
|
-
if (!this._db) {
|
|
129
|
-
this._db = getAccountDb();
|
|
130
|
-
}
|
|
131
|
-
return this._db;
|
|
132
|
-
}
|
|
133
|
-
async get() {
|
|
134
|
-
const row = this.db
|
|
135
|
-
.prepare("SELECT data FROM accounts WHERE id = 1")
|
|
136
|
-
.get();
|
|
137
|
-
return row?.data;
|
|
138
|
-
}
|
|
139
|
-
async put(data) {
|
|
140
|
-
this.db
|
|
141
|
-
.prepare(`
|
|
142
|
-
INSERT INTO accounts (id, data, updated_at)
|
|
143
|
-
VALUES (1, ?, strftime('%s', 'now'))
|
|
144
|
-
ON CONFLICT(id) DO UPDATE SET data = excluded.data, updated_at = excluded.updated_at
|
|
145
|
-
`)
|
|
146
|
-
.run(data);
|
|
147
|
-
}
|
|
148
|
-
async clear() {
|
|
149
|
-
this.db.exec("DELETE FROM accounts");
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
export function resetAllDbConnections() {
|
|
153
|
-
if (cacheDbInstance) {
|
|
154
|
-
try {
|
|
155
|
-
cacheDbInstance.close();
|
|
156
|
-
}
|
|
157
|
-
catch (e) {
|
|
158
|
-
}
|
|
159
|
-
cacheDbInstance = null;
|
|
160
|
-
}
|
|
161
|
-
if (accountDbInstance) {
|
|
162
|
-
try {
|
|
163
|
-
accountDbInstance.close();
|
|
164
|
-
}
|
|
165
|
-
catch (e) {
|
|
166
|
-
}
|
|
167
|
-
accountDbInstance = null;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
process.on("exit", () => {
|
|
171
|
-
resetAllDbConnections();
|
|
172
|
-
});
|
|
173
|
-
process.on("SIGINT", () => {
|
|
174
|
-
resetAllDbConnections();
|
|
175
|
-
process.exit(0);
|
|
176
|
-
});
|
|
177
|
-
process.on("SIGTERM", () => {
|
|
178
|
-
resetAllDbConnections();
|
|
179
|
-
process.exit(0);
|
|
180
|
-
});
|
|
181
|
-
export function resetAllStorage() {
|
|
182
|
-
resetAllDbConnections();
|
|
183
|
-
}
|
|
184
|
-
export const defaultStorage = new SQLiteStorage();
|
|
185
|
-
export const defaultAccountStorage = new SQLiteAccountStorage();
|
|
1
|
+
import a175a from'better-sqlite3';import*as a175b from'path';import*as a175c from'fs';import{getWowDir}from'./util.js';const WOW_DIR=getWowDir(),CACHE_DB_PATH=a175b['join'](WOW_DIR,'cache.db'),ACCOUNT_DB_PATH=a175b['join'](WOW_DIR,'account.db');function ensureWowDirExists(){!a175c['existsSync'](WOW_DIR)&&a175c['mkdirSync'](WOW_DIR,{'recursive':!![]});}ensureWowDirExists();function getCacheDatabase(){ensureWowDirExists();const a=new a175a(CACHE_DB_PATH);return a['pragma']('journal_mode\x20=\x20WAL'),a['pragma']('synchronous\x20=\x20NORMAL'),a['exec']('\x0a\x09\x09CREATE\x20TABLE\x20IF\x20NOT\x20EXISTS\x20cache\x20(\x0a\x09\x09\x09key\x20TEXT\x20PRIMARY\x20KEY,\x0a\x09\x09\x09value\x20TEXT\x20NOT\x20NULL,\x0a\x09\x09\x09updated_at\x20INTEGER\x20DEFAULT\x20(strftime(\x27%s\x27,\x20\x27now\x27))\x0a\x09\x09);\x0a\x09'),a;}let cacheDbInstance=null;function getCacheDb(){return!cacheDbInstance&&(cacheDbInstance=getCacheDatabase()),cacheDbInstance;}function getAccountDatabase(){ensureWowDirExists();const a=new a175a(ACCOUNT_DB_PATH);a['pragma']('journal_mode\x20=\x20WAL'),a['pragma']('synchronous\x20=\x20NORMAL');try{a175c['chmodSync'](ACCOUNT_DB_PATH,0x180);}catch{}return a['exec']('\x0a\x09\x09CREATE\x20TABLE\x20IF\x20NOT\x20EXISTS\x20accounts\x20(\x0a\x09\x09\x09id\x20INTEGER\x20PRIMARY\x20KEY\x20CHECK\x20(id\x20=\x201),\x0a\x09\x09\x09data\x20TEXT\x20NOT\x20NULL,\x0a\x09\x09\x09updated_at\x20INTEGER\x20DEFAULT\x20(strftime(\x27%s\x27,\x20\x27now\x27))\x0a\x09\x09);\x0a\x09'),a;}let accountDbInstance=null;function getAccountDb(){return!accountDbInstance&&(accountDbInstance=getAccountDatabase()),accountDbInstance;}export class SQLiteStorage{['_db'];['_dbSource'];constructor(a){this['_dbSource']=a;}get['db'](){if(this['_dbSource'])return this['_dbSource'];return!this['_db']&&(this['_db']=getCacheDb()),this['_db'];}async['get'](a){const b=this['db']['prepare']('SELECT\x20value\x20FROM\x20cache\x20WHERE\x20key\x20=\x20?')['get'](a);return b?.['value'];}async['getMany'](a){const b=a['map'](()=>'?')['join'](','),c=this['db']['prepare']('SELECT\x20key,\x20value\x20FROM\x20cache\x20WHERE\x20key\x20IN\x20('+b+')')['all'](...a),d=new Map(c['map'](e=>[e['key'],e['value']]));return a['map'](e=>d['get'](e));}async['put'](a,b){this['db']['prepare']('\x0a\x09\x09\x09INSERT\x20INTO\x20cache\x20(key,\x20value,\x20updated_at)\x20\x0a\x09\x09\x09VALUES\x20(?,\x20?,\x20strftime(\x27%s\x27,\x20\x27now\x27))\x0a\x09\x09\x09ON\x20CONFLICT(key)\x20DO\x20UPDATE\x20SET\x20value\x20=\x20excluded.value,\x20updated_at\x20=\x20excluded.updated_at\x0a\x09\x09')['run'](a,b);}async['putMany'](a){const b=this['db']['prepare']('\x0a\x09\x09\x09INSERT\x20INTO\x20cache\x20(key,\x20value,\x20updated_at)\x20\x0a\x09\x09\x09VALUES\x20(?,\x20?,\x20strftime(\x27%s\x27,\x20\x27now\x27))\x0a\x09\x09\x09ON\x20CONFLICT(key)\x20DO\x20UPDATE\x20SET\x20value\x20=\x20excluded.value,\x20updated_at\x20=\x20excluded.updated_at\x0a\x09\x09'),c=this['db']['transaction'](d=>{for(const e of d)b['run'](e['key'],e['value']);});c(a);}async['del'](a){this['db']['prepare']('DELETE\x20FROM\x20cache\x20WHERE\x20key\x20=\x20?')['run'](a);}async['clear'](){this['db']['exec']('DELETE\x20FROM\x20cache');}}export class SQLiteAccountStorage{['_db'];['_dbSource'];constructor(a){this['_dbSource']=a;}get['db'](){if(this['_dbSource'])return this['_dbSource'];return!this['_db']&&(this['_db']=getAccountDb()),this['_db'];}async['get'](){const a=this['db']['prepare']('SELECT\x20data\x20FROM\x20accounts\x20WHERE\x20id\x20=\x201')['get']();return a?.['data'];}async['put'](a){this['db']['prepare']('\x0a\x09\x09\x09INSERT\x20INTO\x20accounts\x20(id,\x20data,\x20updated_at)\x20\x0a\x09\x09\x09VALUES\x20(1,\x20?,\x20strftime(\x27%s\x27,\x20\x27now\x27))\x0a\x09\x09\x09ON\x20CONFLICT(id)\x20DO\x20UPDATE\x20SET\x20data\x20=\x20excluded.data,\x20updated_at\x20=\x20excluded.updated_at\x0a\x09\x09')['run'](a);}async['clear'](){this['db']['exec']('DELETE\x20FROM\x20accounts');}}export function resetAllDbConnections(){if(cacheDbInstance){try{cacheDbInstance['close']();}catch(a){}cacheDbInstance=null;}if(accountDbInstance){try{accountDbInstance['close']();}catch(b){}accountDbInstance=null;}}process['on']('exit',()=>{resetAllDbConnections();}),process['on']('SIGINT',()=>{resetAllDbConnections(),process['exit'](0x0);}),process['on']('SIGTERM',()=>{resetAllDbConnections(),process['exit'](0x0);});export function resetAllStorage(){resetAllDbConnections();}export const defaultStorage=new SQLiteStorage();export const defaultAccountStorage=new SQLiteAccountStorage();
|
|
@@ -1,131 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getFullnodeUrl } from "../../client/network.js";
|
|
3
|
-
import { GasTokenType } from "../common.js";
|
|
4
|
-
import { Config } from "./config.js";
|
|
5
|
-
import { Cache, CachePrefix } from "./cache.js";
|
|
6
|
-
import { W_ERROR, WErrors } from "../exception.js";
|
|
7
|
-
export class TokenInfo {
|
|
8
|
-
static _instance;
|
|
9
|
-
static Instance() {
|
|
10
|
-
if (!TokenInfo._instance) {
|
|
11
|
-
TokenInfo._instance = new TokenInfo();
|
|
12
|
-
}
|
|
13
|
-
return TokenInfo._instance;
|
|
14
|
-
}
|
|
15
|
-
cacheKey = [CachePrefix.token];
|
|
16
|
-
async fetch_imp(network, tokenType, alias) {
|
|
17
|
-
const client = new SuiClient({ url: getFullnodeUrl(network) });
|
|
18
|
-
const r = await client.getCoinMetadata({ coinType: tokenType });
|
|
19
|
-
if (r) {
|
|
20
|
-
return { alias: alias, type: tokenType, ...r };
|
|
21
|
-
}
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
async fetch(tokenType, alias, network) {
|
|
25
|
-
tokenType = tokenType ?? GasTokenType;
|
|
26
|
-
const net = await Config.Instance().network_get(network);
|
|
27
|
-
const cachedData = await Cache.read([...this.cacheKey, net], async (_) => {
|
|
28
|
-
return {
|
|
29
|
-
expire: "INFINITE",
|
|
30
|
-
data: [],
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
let foundToken = cachedData?.data?.find((token) => token.type === tokenType);
|
|
34
|
-
if (!foundToken) {
|
|
35
|
-
foundToken = await this.fetch_imp(net, tokenType, alias);
|
|
36
|
-
if (!foundToken) {
|
|
37
|
-
W_ERROR(WErrors.TokenNotFoundLocally, `token type: ${tokenType}`);
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
const updatedTokens = [...(cachedData?.data || []), foundToken];
|
|
41
|
-
await Cache.read([...this.cacheKey, net], async (_) => ({
|
|
42
|
-
expire: "INFINITE",
|
|
43
|
-
data: updatedTokens,
|
|
44
|
-
}), true);
|
|
45
|
-
}
|
|
46
|
-
else if (alias && foundToken.alias !== alias) {
|
|
47
|
-
foundToken.alias = alias;
|
|
48
|
-
const updatedTokens = cachedData?.data?.map((token) => token.type === tokenType ? foundToken : token) || [];
|
|
49
|
-
await Cache.read([...this.cacheKey, net], async (_) => ({
|
|
50
|
-
expire: "INFINITE",
|
|
51
|
-
data: updatedTokens,
|
|
52
|
-
}), true);
|
|
53
|
-
}
|
|
54
|
-
return foundToken;
|
|
55
|
-
}
|
|
56
|
-
async list(filter, network) {
|
|
57
|
-
const net = await Config.Instance().network_get(network);
|
|
58
|
-
let cachedData = await Cache.read([...this.cacheKey, net], async (_) => {
|
|
59
|
-
return {
|
|
60
|
-
expire: "INFINITE",
|
|
61
|
-
data: [],
|
|
62
|
-
};
|
|
63
|
-
});
|
|
64
|
-
let tokens = cachedData?.data || [];
|
|
65
|
-
const targetType = filter?.type ?? GasTokenType;
|
|
66
|
-
const alias = filter?.type ? filter?.alias_or_name : undefined;
|
|
67
|
-
const foundByType = tokens.find((t) => t.type === targetType);
|
|
68
|
-
if (!foundByType) {
|
|
69
|
-
const fetched = await this.fetch_imp(net, targetType, alias);
|
|
70
|
-
if (fetched) {
|
|
71
|
-
const updatedTokens = [...tokens, fetched];
|
|
72
|
-
await Cache.read([...this.cacheKey, net], async (_) => ({
|
|
73
|
-
expire: "INFINITE",
|
|
74
|
-
data: updatedTokens,
|
|
75
|
-
}), true);
|
|
76
|
-
cachedData = await Cache.read([...this.cacheKey, net], async (_) => ({
|
|
77
|
-
expire: "INFINITE",
|
|
78
|
-
data: updatedTokens,
|
|
79
|
-
}));
|
|
80
|
-
tokens = cachedData?.data || [];
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (filter) {
|
|
84
|
-
tokens = tokens.filter((token) => {
|
|
85
|
-
let match = true;
|
|
86
|
-
if (filter.symbol && match) {
|
|
87
|
-
match = token.symbol === filter.symbol;
|
|
88
|
-
}
|
|
89
|
-
if (filter.type && match) {
|
|
90
|
-
match = token.type === targetType;
|
|
91
|
-
}
|
|
92
|
-
return match;
|
|
93
|
-
});
|
|
94
|
-
if (filter.alias_or_name) {
|
|
95
|
-
const searchTerm = filter.alias_or_name.toLowerCase();
|
|
96
|
-
tokens = tokens.map((token) => {
|
|
97
|
-
let score = 0;
|
|
98
|
-
const alias = token.alias?.toLowerCase() || "";
|
|
99
|
-
const name = token.name?.toLowerCase() || "";
|
|
100
|
-
if (alias === searchTerm || name === searchTerm) {
|
|
101
|
-
score = 3;
|
|
102
|
-
}
|
|
103
|
-
else if (alias.startsWith(searchTerm) ||
|
|
104
|
-
name.startsWith(searchTerm)) {
|
|
105
|
-
score = 2;
|
|
106
|
-
}
|
|
107
|
-
else if (alias.includes(searchTerm) ||
|
|
108
|
-
name.includes(searchTerm)) {
|
|
109
|
-
score = 1;
|
|
110
|
-
}
|
|
111
|
-
return { ...token, _score: score };
|
|
112
|
-
});
|
|
113
|
-
tokens = tokens
|
|
114
|
-
.filter((token) => token._score > 0)
|
|
115
|
-
.sort((a, b) => {
|
|
116
|
-
const scoreDiff = b._score - a._score;
|
|
117
|
-
if (scoreDiff !== 0)
|
|
118
|
-
return scoreDiff;
|
|
119
|
-
const aNameLength = (a.alias?.length || 0) + (a.name?.length || 0);
|
|
120
|
-
const bNameLength = (b.alias?.length || 0) + (b.name?.length || 0);
|
|
121
|
-
return aNameLength - bNameLength;
|
|
122
|
-
});
|
|
123
|
-
tokens = tokens.map((token) => {
|
|
124
|
-
const { _score, ...rest } = token;
|
|
125
|
-
return rest;
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return tokens;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
1
|
+
import{SuiClient}from'../../client/index.js';import{getFullnodeUrl}from'../../client/network.js';import{GasTokenType}from'../common.js';import{Config}from'./config.js';import{Cache,CachePrefix}from'./cache.js';import{W_ERROR,WErrors}from'../exception.js';export class TokenInfo{static ['_instance'];static['Instance'](){return!TokenInfo['_instance']&&(TokenInfo['_instance']=new TokenInfo()),TokenInfo['_instance'];}['cacheKey']=[CachePrefix['token']];async['fetch_imp'](a,b,c){const d=new SuiClient({'url':getFullnodeUrl(a)}),e=await d['getCoinMetadata']({'coinType':b});if(e)return{'alias':c,'type':b,...e};return undefined;}async['fetch'](a,b,c){a=a??GasTokenType;const d=await Config['Instance']()['network_get'](c),e=await Cache['read']([...this['cacheKey'],d],async g=>{return{'expire':'INFINITE','data':[]};});let f=e?.['data']?.['find'](g=>g['type']===a);if(!f){f=await this['fetch_imp'](d,a,b);if(!f)return W_ERROR(WErrors['TokenNotFoundLocally'],'token\x20type:\x20'+a),undefined;const g=[...e?.['data']||[],f];await Cache['read']([...this['cacheKey'],d],async h=>({'expire':'INFINITE','data':g}),!![]);}else{if(b&&f['alias']!==b){f['alias']=b;const h=e?.['data']?.['map'](i=>i['type']===a?f:i)||[];await Cache['read']([...this['cacheKey'],d],async i=>({'expire':'INFINITE','data':h}),!![]);}}return f;}async['list'](a,b){const c=await Config['Instance']()['network_get'](b);let d=await Cache['read']([...this['cacheKey'],c],async i=>{return{'expire':'INFINITE','data':[]};}),e=d?.['data']||[];const f=a?.['type']??GasTokenType,g=a?.['type']?a?.['alias_or_name']:undefined,h=e['find'](i=>i['type']===f);if(!h){const i=await this['fetch_imp'](c,f,g);if(i){const j=[...e,i];await Cache['read']([...this['cacheKey'],c],async k=>({'expire':'INFINITE','data':j}),!![]),d=await Cache['read']([...this['cacheKey'],c],async k=>({'expire':'INFINITE','data':j})),e=d?.['data']||[];}}if(a){e=e['filter'](k=>{let l=!![];return a['symbol']&&l&&(l=k['symbol']===a['symbol']),a['type']&&l&&(l=k['type']===f),l;});if(a['alias_or_name']){const k=a['alias_or_name']['toLowerCase']();e=e['map'](l=>{let m=0x0;const n=l['alias']?.['toLowerCase']()||'',o=l['name']?.['toLowerCase']()||'';if(n===k||o===k)m=0x3;else{if(n['startsWith'](k)||o['startsWith'](k))m=0x2;else(n['includes'](k)||o['includes'](k))&&(m=0x1);}return{...l,'_score':m};}),e=e['filter'](l=>l['_score']>0x0)['sort']((l,m)=>{const n=m['_score']-l['_score'];if(n!==0x0)return n;const o=(l['alias']?.['length']||0x0)+(l['name']?.['length']||0x0),p=(m['alias']?.['length']||0x0)+(m['name']?.['length']||0x0);return o-p;}),e=e['map'](l=>{const {_score:m,...n}=l;return n;});}}return e;}}
|
package/dist/esm/w/local/util.js
CHANGED
|
@@ -1,26 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as os from "os";
|
|
3
|
-
export function getWowDir() {
|
|
4
|
-
if (process.env.WOWOK_DATA_DIR) {
|
|
5
|
-
return process.env.WOWOK_DATA_DIR;
|
|
6
|
-
}
|
|
7
|
-
const home = os.homedir();
|
|
8
|
-
const platform = os.platform();
|
|
9
|
-
if (platform === "win32") {
|
|
10
|
-
return path.join(home, ".wow");
|
|
11
|
-
}
|
|
12
|
-
else if (platform === "darwin") {
|
|
13
|
-
return path.join(home, "Library", "Application Support", ".wow");
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
17
|
-
if (xdgConfig) {
|
|
18
|
-
return path.join(xdgConfig, ".wow");
|
|
19
|
-
}
|
|
20
|
-
const xdgData = process.env.XDG_DATA_HOME;
|
|
21
|
-
if (xdgData) {
|
|
22
|
-
return path.join(xdgData, ".wow");
|
|
23
|
-
}
|
|
24
|
-
return path.join(home, ".wow");
|
|
25
|
-
}
|
|
26
|
-
}
|
|
1
|
+
import*as a177a from'path';import*as a177b from'os';export function getWowDir(){if(process['env']['WOWOK_DATA_DIR'])return process['env']['WOWOK_DATA_DIR'];const a=a177b['homedir'](),b=a177b['platform']();if(b==='win32')return a177a['join'](a,'.wow');else{if(b==='darwin')return a177a['join'](a,'Library','Application\x20Support','.wow');else{const c=process['env']['XDG_CONFIG_HOME'];if(c)return a177a['join'](c,'.wow');const d=process['env']['XDG_DATA_HOME'];if(d)return a177a['join'](d,'.wow');return a177a['join'](a,'.wow');}}}
|