@wowok/wowok 2.2.16 → 2.3.1
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/esm/Transaction-CnEnSz1Q.mjs +1 -0
- package/dist/esm/arb-2vqYhvkj.mjs +1 -0
- package/dist/esm/base-Diz77Zc6.mjs +1 -0
- package/dist/esm/bcs/index.d.mts +3 -0
- package/dist/esm/bcs/index.mjs +1 -0
- package/dist/esm/bcs-DDXHXJXy.mjs +1 -0
- package/dist/esm/cache-DTr3MtXv.d.mts +38 -0
- package/dist/esm/call-57y0AfFd.mjs +1 -0
- package/dist/esm/chunk-D7D4PA-g.mjs +1 -0
- package/dist/esm/client/index.d.mts +3 -0
- package/dist/esm/client/index.mjs +1 -0
- package/dist/esm/client-BgCe6jlf.mjs +1 -0
- package/dist/esm/common-DAjh24WX.mjs +1 -0
- package/dist/esm/config-lfC3m3Qq.d.mts +22 -0
- package/dist/esm/cryptography/index.d.mts +2 -0
- package/dist/esm/cryptography/index.mjs +1 -0
- package/dist/esm/ed25519-DZsBW8ka.mjs +1 -0
- package/dist/esm/effects-lLpKpzCX.mjs +1 -0
- package/dist/esm/falcon512-DqfhrRs6.mjs +1 -0
- package/dist/esm/faucet/index.d.mts +2 -0
- package/dist/esm/faucet/index.mjs +1 -0
- package/dist/esm/faucet-BhrCl1M5.mjs +1 -0
- package/dist/esm/graphql/index.d.mts +2 -0
- package/dist/esm/graphql/index.mjs +1 -0
- package/dist/esm/graphql/schema/index.d.mts +10 -0
- package/dist/esm/graphql/schema/index.mjs +1 -0
- package/dist/esm/graphql--097PLGc.mjs +1 -0
- package/dist/esm/grpc/index.d.mts +2 -0
- package/dist/esm/grpc/index.mjs +1 -0
- package/dist/esm/grpc-DELIRSmn.mjs +1 -0
- package/dist/esm/index-B-cxGU73.d.mts +3059 -0
- package/dist/esm/index-CGqMj3cG.d.mts +67 -0
- package/dist/esm/index-D8z18cO-.d.mts +19933 -0
- package/dist/esm/index-uCW4oBx-.d.mts +24 -0
- package/dist/esm/index.d.mts +9 -0
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/jsonRpc/index.d.mts +2 -0
- package/dist/esm/jsonRpc/index.mjs +1 -0
- package/dist/esm/jsonRpc-BpByny_f.mjs +1 -0
- package/dist/esm/keypair-1v1DkI3F.mjs +1 -0
- package/dist/esm/keypairs/ed25519/index.d.mts +2 -0
- package/dist/esm/keypairs/ed25519/index.mjs +1 -0
- package/dist/esm/keypairs/falcon512/index.d.mts +2 -0
- package/dist/esm/keypairs/falcon512/index.mjs +1 -0
- package/dist/esm/keypairs/passkey/index.d.mts +2 -0
- package/dist/esm/keypairs/passkey/index.mjs +1 -0
- package/dist/esm/keypairs/secp256k1/index.d.mts +2 -0
- package/dist/esm/keypairs/secp256k1/index.mjs +1 -0
- package/dist/esm/keypairs/secp256r1/index.d.mts +2 -0
- package/dist/esm/keypairs/secp256r1/index.mjs +1 -0
- package/dist/esm/local-CjihK7WF.mjs +1 -0
- package/dist/esm/local-CtSmnSPu.d.mts +101 -0
- package/dist/esm/messenger-C8iIIH8a.mjs +1 -0
- package/dist/esm/messenger-api-CTTyAaH7.mjs +1 -0
- package/dist/esm/mnemonics-C6qlqegr.mjs +1 -0
- package/dist/esm/multisig/index.d.mts +2 -0
- package/dist/esm/multisig/index.mjs +1 -0
- package/dist/esm/network-DeigCh6J.mjs +1 -0
- package/dist/esm/object-CYKpq_cj.mjs +1 -0
- package/dist/esm/passkey-Dh6btBAD.mjs +1 -0
- package/dist/esm/pqxdh-CKkqzvPb.d.mts +42 -0
- package/dist/esm/proof-C5WiT6s8.mjs +1 -0
- package/dist/esm/publickey-6O2imwxm.mjs +1 -0
- package/dist/esm/publickey-BPT9QiGv.mjs +1 -0
- package/dist/esm/publickey-Bf71fssx.mjs +1 -0
- package/dist/esm/publickey-C6fyN2VZ.mjs +1 -0
- package/dist/esm/publickey-CltJ4l8n.mjs +1 -0
- package/dist/esm/publickey-qLbcTInT.mjs +1 -0
- package/dist/esm/received-DbaY6EZw.mjs +1 -0
- package/dist/esm/secp256k1-BZUdTK1D.mjs +1 -0
- package/dist/esm/secp256r1-COXOSFIF.mjs +1 -0
- package/dist/esm/service-BQ3NbWhf.mjs +1 -0
- package/dist/esm/sui-types-CuBKFvrd.mjs +1 -0
- package/dist/esm/transactions/index.d.mts +2 -0
- package/dist/esm/transactions/index.mjs +1 -0
- package/dist/esm/transactions-D9q2j6ZA.mjs +1 -0
- package/dist/esm/type-tag-serializer-BOCNO96r.d.mts +68 -0
- package/dist/esm/types-CiFC9IV5.d.mts +74 -0
- package/dist/esm/util-JBmJ6s-D.mjs +1 -0
- package/dist/esm/utils/index.d.mts +3 -0
- package/dist/esm/utils/index.mjs +1 -0
- package/dist/esm/utils-IlS3fpdQ.mjs +1 -0
- package/dist/esm/verify/index.d.mts +2 -0
- package/dist/esm/verify/index.mjs +1 -0
- package/dist/esm/w/call/allocation.d.mts +2 -0
- package/dist/esm/w/call/allocation.mjs +1 -0
- package/dist/esm/w/call/arbitration.d.mts +2 -0
- package/dist/esm/w/call/arbitration.mjs +1 -0
- package/dist/esm/w/call/base.d.mts +2 -0
- package/dist/esm/w/call/base.mjs +1 -0
- package/dist/esm/w/call/demand.d.mts +2 -0
- package/dist/esm/w/call/demand.mjs +1 -0
- package/dist/esm/w/call/guard.d.mts +2 -0
- package/dist/esm/w/call/guard.mjs +1 -0
- package/dist/esm/w/call/index.d.mts +2 -0
- package/dist/esm/w/call/index.mjs +1 -0
- package/dist/esm/w/call/machine.d.mts +2 -0
- package/dist/esm/w/call/machine.mjs +1 -0
- package/dist/esm/w/call/passport.d.mts +2 -0
- package/dist/esm/w/call/passport.mjs +1 -0
- package/dist/esm/w/call/payment.d.mts +2 -0
- package/dist/esm/w/call/payment.mjs +1 -0
- package/dist/esm/w/call/permission.d.mts +2 -0
- package/dist/esm/w/call/permission.mjs +1 -0
- package/dist/esm/w/call/progress.d.mts +2 -0
- package/dist/esm/w/call/progress.mjs +1 -0
- package/dist/esm/w/call/repository.d.mts +2 -0
- package/dist/esm/w/call/repository.mjs +1 -0
- package/dist/esm/w/call/reward.d.mts +2 -0
- package/dist/esm/w/call/reward.mjs +1 -0
- package/dist/esm/w/call/service.d.mts +2 -0
- package/dist/esm/w/call/service.mjs +1 -0
- package/dist/esm/w/call/treasury.d.mts +2 -0
- package/dist/esm/w/call/treasury.mjs +1 -0
- package/dist/esm/w/common.d.mts +2 -0
- package/dist/esm/w/common.mjs +1 -0
- package/dist/esm/w/index.d.mts +5 -0
- package/dist/esm/w/index.mjs +1 -0
- package/dist/esm/w/local/account.d.mts +2 -0
- package/dist/esm/w/local/account.mjs +1 -0
- package/dist/esm/w/local/cache.d.mts +2 -0
- package/dist/esm/w/local/cache.mjs +1 -0
- package/dist/esm/w/local/config.d.mts +2 -0
- package/dist/esm/w/local/config.mjs +1 -0
- package/dist/esm/w/local/index.d.mts +5 -0
- package/dist/esm/w/local/index.mjs +1 -0
- package/dist/esm/w/local/local.d.mts +2 -0
- package/dist/esm/w/local/local.mjs +1 -0
- package/dist/esm/w/local/storage.d.mts +53 -0
- package/dist/esm/w/local/storage.mjs +1 -0
- package/dist/esm/w/local/token.d.mts +2 -0
- package/dist/esm/w/local/token.mjs +1 -0
- package/dist/esm/w/local/util.d.mts +9 -0
- package/dist/esm/w/local/util.mjs +1 -0
- package/dist/esm/w/local/wip.d.mts +2 -0
- package/dist/esm/w/local/wip.mjs +1 -0
- package/dist/esm/w/messenger/crypto.d.mts +271 -0
- package/dist/esm/w/messenger/crypto.mjs +1 -0
- package/dist/esm/w/messenger/index.d.mts +2 -0
- package/dist/esm/w/messenger/index.mjs +1 -0
- package/dist/esm/w/messenger/messenger-api.d.mts +2 -0
- package/dist/esm/w/messenger/messenger-api.mjs +1 -0
- package/dist/esm/w/messenger/messenger.d.mts +2 -0
- package/dist/esm/w/messenger/messenger.mjs +1 -0
- package/dist/esm/w/messenger/pq/crypto.d.mts +43 -0
- package/dist/esm/w/messenger/pq/crypto.mjs +1 -0
- package/dist/esm/w/messenger/pq/erasure.d.mts +19 -0
- package/dist/esm/w/messenger/pq/erasure.mjs +1 -0
- package/dist/esm/w/messenger/pq/index.d.mts +10 -0
- package/dist/esm/w/messenger/pq/index.mjs +1 -0
- package/dist/esm/w/messenger/pq/keycombiner.d.mts +4 -0
- package/dist/esm/w/messenger/pq/keycombiner.mjs +1 -0
- package/dist/esm/w/messenger/pq/pqxdh.d.mts +2 -0
- package/dist/esm/w/messenger/pq/pqxdh.mjs +1 -0
- package/dist/esm/w/messenger/pq/ratchet.d.mts +16 -0
- package/dist/esm/w/messenger/pq/ratchet.mjs +1 -0
- package/dist/esm/w/messenger/pq/session.d.mts +46 -0
- package/dist/esm/w/messenger/pq/session.mjs +1 -0
- package/dist/esm/w/messenger/pq/spqr.d.mts +27 -0
- package/dist/esm/w/messenger/pq/spqr.mjs +1 -0
- package/dist/esm/w/messenger/pq/store-adapter.d.mts +35 -0
- package/dist/esm/w/messenger/pq/store-adapter.mjs +1 -0
- package/dist/esm/w/messenger/pq/types.d.mts +189 -0
- package/dist/esm/w/messenger/pq/types.mjs +1 -0
- package/dist/esm/w/messenger/storage.d.mts +256 -0
- package/dist/esm/w/messenger/storage.mjs +1 -0
- package/dist/esm/w/messenger/types.d.mts +2 -0
- package/dist/esm/w/messenger/types.mjs +1 -0
- package/dist/esm/w/query/index.d.mts +2 -0
- package/dist/esm/w/query/index.mjs +1 -0
- package/dist/esm/w/query/object.d.mts +2 -0
- package/dist/esm/w/query/object.mjs +1 -0
- package/dist/esm/wip-NbB1ChbI.d.mts +229 -0
- package/package.json +142 -152
- package/dist/cjs/_deps/bcs/bcs-type.d.ts +0 -127
- package/dist/cjs/_deps/bcs/bcs-type.js +0 -1
- package/dist/cjs/_deps/bcs/bcs.d.ts +0 -49
- package/dist/cjs/_deps/bcs/bcs.js +0 -1
- package/dist/cjs/_deps/bcs/index.d.ts +0 -16
- package/dist/cjs/_deps/bcs/index.js +0 -1
- package/dist/cjs/_deps/bcs/reader.d.ts +0 -15
- package/dist/cjs/_deps/bcs/reader.js +0 -1
- package/dist/cjs/_deps/bcs/types.d.ts +0 -24
- package/dist/cjs/_deps/bcs/types.js +0 -1
- package/dist/cjs/_deps/bcs/uleb.d.ts +0 -5
- package/dist/cjs/_deps/bcs/uleb.js +0 -1
- package/dist/cjs/_deps/bcs/utils.d.ts +0 -4
- package/dist/cjs/_deps/bcs/utils.js +0 -1
- package/dist/cjs/_deps/bcs/writer.d.ts +0 -28
- package/dist/cjs/_deps/bcs/writer.js +0 -1
- package/dist/cjs/_deps/utils/b58.d.ts +0 -2
- package/dist/cjs/_deps/utils/b58.js +0 -1
- package/dist/cjs/_deps/utils/b64.d.ts +0 -2
- package/dist/cjs/_deps/utils/b64.js +0 -1
- package/dist/cjs/_deps/utils/chunk.d.ts +0 -1
- package/dist/cjs/_deps/utils/chunk.js +0 -1
- package/dist/cjs/_deps/utils/dataloader.d.ts +0 -43
- package/dist/cjs/_deps/utils/dataloader.js +0 -1
- package/dist/cjs/_deps/utils/hex.d.ts +0 -2
- package/dist/cjs/_deps/utils/hex.js +0 -1
- package/dist/cjs/_deps/utils/index.d.ts +0 -7
- package/dist/cjs/_deps/utils/index.js +0 -1
- package/dist/cjs/_deps/utils/types.d.ts +0 -4
- package/dist/cjs/_deps/utils/types.js +0 -1
- package/dist/cjs/_deps/utils/with-resolver.d.ts +0 -6
- package/dist/cjs/_deps/utils/with-resolver.js +0 -1
- package/dist/cjs/bcs/bcs.d.ts +0 -1927
- package/dist/cjs/bcs/bcs.js +0 -1
- package/dist/cjs/bcs/effects.d.ts +0 -579
- package/dist/cjs/bcs/effects.js +0 -1
- package/dist/cjs/bcs/index.d.ts +0 -6
- package/dist/cjs/bcs/index.js +0 -1
- package/dist/cjs/bcs/pure.d.ts +0 -22
- package/dist/cjs/bcs/pure.js +0 -1
- package/dist/cjs/bcs/type-tag-serializer.d.ts +0 -7
- package/dist/cjs/bcs/type-tag-serializer.js +0 -1
- package/dist/cjs/bcs/types.d.ts +0 -65
- package/dist/cjs/bcs/types.js +0 -1
- package/dist/cjs/client/index.d.ts +0 -5
- package/dist/cjs/client/index.js +0 -1
- package/dist/cjs/client/network.d.ts +0 -5
- package/dist/cjs/client/network.js +0 -1
- package/dist/cjs/cryptography/index.d.ts +0 -7
- package/dist/cjs/cryptography/index.js +0 -1
- package/dist/cjs/cryptography/intent.d.ts +0 -3
- package/dist/cjs/cryptography/intent.js +0 -1
- package/dist/cjs/cryptography/keypair.d.ts +0 -39
- package/dist/cjs/cryptography/keypair.js +0 -1
- package/dist/cjs/cryptography/mnemonics.d.ts +0 -4
- package/dist/cjs/cryptography/mnemonics.js +0 -1
- package/dist/cjs/cryptography/publickey.d.ts +0 -25
- package/dist/cjs/cryptography/publickey.js +0 -1
- package/dist/cjs/cryptography/signature-scheme.d.ts +0 -13
- package/dist/cjs/cryptography/signature-scheme.js +0 -1
- package/dist/cjs/cryptography/signature.d.ts +0 -21
- package/dist/cjs/cryptography/signature.js +0 -1
- package/dist/cjs/experimental/cache.d.ts +0 -12
- package/dist/cjs/experimental/cache.js +0 -1
- package/dist/cjs/experimental/client.d.ts +0 -12
- package/dist/cjs/experimental/client.js +0 -1
- package/dist/cjs/experimental/core.d.ts +0 -31
- package/dist/cjs/experimental/core.js +0 -1
- package/dist/cjs/experimental/errors.d.ts +0 -8
- package/dist/cjs/experimental/errors.js +0 -1
- package/dist/cjs/experimental/index.d.ts +0 -7
- package/dist/cjs/experimental/index.js +0 -1
- package/dist/cjs/experimental/persistent-storage.d.ts +0 -36
- package/dist/cjs/experimental/persistent-storage.js +0 -1
- package/dist/cjs/experimental/persistent-storage.test.d.ts +0 -1
- package/dist/cjs/experimental/persistent-storage.test.js +0 -1
- package/dist/cjs/experimental/transports/utils.d.ts +0 -3
- package/dist/cjs/experimental/transports/utils.js +0 -1
- package/dist/cjs/experimental/types.d.ts +0 -361
- package/dist/cjs/experimental/types.js +0 -1
- package/dist/cjs/faucet/faucet.d.ts +0 -57
- package/dist/cjs/faucet/faucet.js +0 -1
- package/dist/cjs/faucet/index.d.ts +0 -1
- package/dist/cjs/faucet/index.js +0 -1
- package/dist/cjs/grpc/client.d.ts +0 -30
- package/dist/cjs/grpc/client.js +0 -1
- package/dist/cjs/grpc/core.d.ts +0 -28
- package/dist/cjs/grpc/core.js +0 -1
- package/dist/cjs/grpc/index.d.ts +0 -4
- package/dist/cjs/grpc/index.js +0 -1
- package/dist/cjs/grpc/proto/google/protobuf/any.d.ts +0 -29
- package/dist/cjs/grpc/proto/google/protobuf/any.js +0 -1
- package/dist/cjs/grpc/proto/google/protobuf/duration.d.ts +0 -23
- package/dist/cjs/grpc/proto/google/protobuf/duration.js +0 -1
- package/dist/cjs/grpc/proto/google/protobuf/empty.d.ts +0 -16
- package/dist/cjs/grpc/proto/google/protobuf/empty.js +0 -1
- package/dist/cjs/grpc/proto/google/protobuf/field_mask.d.ts +0 -22
- package/dist/cjs/grpc/proto/google/protobuf/field_mask.js +0 -1
- package/dist/cjs/grpc/proto/google/protobuf/struct.d.ts +0 -72
- package/dist/cjs/grpc/proto/google/protobuf/struct.js +0 -1
- package/dist/cjs/grpc/proto/google/protobuf/timestamp.d.ts +0 -26
- package/dist/cjs/grpc/proto/google/protobuf/timestamp.js +0 -1
- package/dist/cjs/grpc/proto/google/rpc/error_details.d.ts +0 -166
- package/dist/cjs/grpc/proto/google/rpc/error_details.js +0 -1
- package/dist/cjs/grpc/proto/google/rpc/status.d.ts +0 -20
- package/dist/cjs/grpc/proto/google/rpc/status.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/argument.d.ts +0 -18
- package/dist/cjs/grpc/proto/sui/rpc/v2/argument.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.d.ts +0 -11
- package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.d.ts +0 -10
- package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.d.ts +0 -20
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.d.ts +0 -23
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.d.ts +0 -46
- package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/effects.d.ts +0 -81
- package/dist/cjs/grpc/proto/sui/rpc/v2/effects.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.d.ts +0 -21
- package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.d.ts +0 -5
- package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/event.d.ts +0 -25
- package/dist/cjs/grpc/proto/sui/rpc/v2/event.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.d.ts +0 -24
- package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.d.ts +0 -220
- package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.d.ts +0 -12
- package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/input.d.ts +0 -23
- package/dist/cjs/grpc/proto/sui/rpc/v2/input.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.d.ts +0 -43
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.d.ts +0 -160
- package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.d.ts +0 -150
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.d.ts +0 -31
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.d.ts +0 -78
- package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/object.d.ts +0 -32
- package/dist/cjs/grpc/proto/sui/rpc/v2/object.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.d.ts +0 -11
- package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/owner.d.ts +0 -19
- package/dist/cjs/grpc/proto/sui/rpc/v2/owner.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.d.ts +0 -15
- package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature.d.ts +0 -105
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.d.ts +0 -5
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.ts +0 -19
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.d.ts +0 -23
- package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.d.ts +0 -35
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.d.ts +0 -172
- package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.d.ts +0 -19
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.d.ts +0 -21
- package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.d.ts +0 -146
- package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.d.ts +0 -338
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.ts +0 -23
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +0 -1
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.d.ts +0 -66
- package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.js +0 -1
- package/dist/cjs/index.d.ts +0 -25
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/jsonRpc/client.d.ts +0 -121
- package/dist/cjs/jsonRpc/client.js +0 -1
- package/dist/cjs/jsonRpc/core.d.ts +0 -87
- package/dist/cjs/jsonRpc/core.js +0 -1
- package/dist/cjs/jsonRpc/errors.d.ts +0 -12
- package/dist/cjs/jsonRpc/errors.js +0 -1
- package/dist/cjs/jsonRpc/http-transport.d.ts +0 -39
- package/dist/cjs/jsonRpc/http-transport.js +0 -1
- package/dist/cjs/jsonRpc/index.d.ts +0 -4
- package/dist/cjs/jsonRpc/index.js +0 -1
- package/dist/cjs/jsonRpc/json-rpc-resolver.d.ts +0 -4
- package/dist/cjs/jsonRpc/json-rpc-resolver.js +0 -1
- package/dist/cjs/jsonRpc/rpc-websocket-client.d.ts +0 -28
- package/dist/cjs/jsonRpc/rpc-websocket-client.js +0 -1
- package/dist/cjs/jsonRpc/types/chain.d.ts +0 -94
- package/dist/cjs/jsonRpc/types/chain.js +0 -1
- package/dist/cjs/jsonRpc/types/changes.d.ts +0 -19
- package/dist/cjs/jsonRpc/types/changes.js +0 -1
- package/dist/cjs/jsonRpc/types/coins.d.ts +0 -6
- package/dist/cjs/jsonRpc/types/coins.js +0 -1
- package/dist/cjs/jsonRpc/types/common.d.ts +0 -2
- package/dist/cjs/jsonRpc/types/common.js +0 -1
- package/dist/cjs/jsonRpc/types/generated.d.ts +0 -932
- package/dist/cjs/jsonRpc/types/generated.js +0 -1
- package/dist/cjs/jsonRpc/types/generated_old.d.ts +0 -954
- package/dist/cjs/jsonRpc/types/generated_old.js +0 -1
- package/dist/cjs/jsonRpc/types/index.d.ts +0 -6
- package/dist/cjs/jsonRpc/types/index.js +0 -1
- package/dist/cjs/jsonRpc/types/params.d.ts +0 -303
- package/dist/cjs/jsonRpc/types/params.js +0 -1
- package/dist/cjs/keypairs/falcon512/index.d.ts +0 -2
- package/dist/cjs/keypairs/falcon512/index.js +0 -1
- package/dist/cjs/keypairs/falcon512/keypair.d.ts +0 -19
- package/dist/cjs/keypairs/falcon512/keypair.js +0 -1
- package/dist/cjs/keypairs/falcon512/publickey.d.ts +0 -11
- package/dist/cjs/keypairs/falcon512/publickey.js +0 -1
- package/dist/cjs/keypairs/index.d.ts +0 -1
- package/dist/cjs/keypairs/index.js +0 -1
- package/dist/cjs/multisig/index.d.ts +0 -2
- package/dist/cjs/multisig/index.js +0 -1
- package/dist/cjs/multisig/publickey.d.ts +0 -44
- package/dist/cjs/multisig/publickey.js +0 -1
- package/dist/cjs/multisig/signer.d.ts +0 -19
- package/dist/cjs/multisig/signer.js +0 -1
- package/dist/cjs/transactions/Arguments.d.ts +0 -57
- package/dist/cjs/transactions/Arguments.js +0 -1
- package/dist/cjs/transactions/Commands.d.ts +0 -54
- package/dist/cjs/transactions/Commands.js +0 -1
- package/dist/cjs/transactions/Inputs.d.ts +0 -22
- package/dist/cjs/transactions/Inputs.js +0 -1
- package/dist/cjs/transactions/ObjectCache.d.ts +0 -83
- package/dist/cjs/transactions/ObjectCache.js +0 -1
- package/dist/cjs/transactions/Transaction.d.ts +0 -654
- package/dist/cjs/transactions/Transaction.js +0 -1
- package/dist/cjs/transactions/TransactionData.d.ts +0 -67
- package/dist/cjs/transactions/TransactionData.js +0 -1
- package/dist/cjs/transactions/__tests__/Transaction.test.d.ts +0 -1
- package/dist/cjs/transactions/__tests__/Transaction.test.js +0 -1
- package/dist/cjs/transactions/__tests__/bcs.test.d.ts +0 -1
- package/dist/cjs/transactions/__tests__/bcs.test.js +0 -1
- package/dist/cjs/transactions/data/internal.d.ts +0 -1010
- package/dist/cjs/transactions/data/internal.js +0 -1
- package/dist/cjs/transactions/data/v1.d.ts +0 -312
- package/dist/cjs/transactions/data/v1.js +0 -1
- package/dist/cjs/transactions/data/v2.d.ts +0 -153
- package/dist/cjs/transactions/data/v2.js +0 -1
- package/dist/cjs/transactions/executor/caching.d.ts +0 -27
- package/dist/cjs/transactions/executor/caching.js +0 -1
- package/dist/cjs/transactions/executor/parallel.d.ts +0 -26
- package/dist/cjs/transactions/executor/parallel.js +0 -1
- package/dist/cjs/transactions/executor/queue.d.ts +0 -11
- package/dist/cjs/transactions/executor/queue.js +0 -1
- package/dist/cjs/transactions/executor/serial.d.ts +0 -30
- package/dist/cjs/transactions/executor/serial.js +0 -1
- package/dist/cjs/transactions/hash.d.ts +0 -1
- package/dist/cjs/transactions/hash.js +0 -1
- package/dist/cjs/transactions/index.d.ts +0 -20
- package/dist/cjs/transactions/index.js +0 -1
- package/dist/cjs/transactions/intents/CoinWithBalance.d.ts +0 -9
- package/dist/cjs/transactions/intents/CoinWithBalance.js +0 -1
- package/dist/cjs/transactions/object.d.ts +0 -24
- package/dist/cjs/transactions/object.js +0 -1
- package/dist/cjs/transactions/plugins/NamedPackagesPlugin.d.ts +0 -13
- package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js +0 -1
- package/dist/cjs/transactions/pure.d.ts +0 -20
- package/dist/cjs/transactions/pure.js +0 -1
- package/dist/cjs/transactions/resolve.d.ts +0 -13
- package/dist/cjs/transactions/resolve.js +0 -1
- package/dist/cjs/transactions/serializer.d.ts +0 -7
- package/dist/cjs/transactions/serializer.js +0 -1
- package/dist/cjs/transactions/utils.d.ts +0 -10
- package/dist/cjs/transactions/utils.js +0 -1
- package/dist/cjs/utils/constants.d.ts +0 -11
- package/dist/cjs/utils/constants.js +0 -1
- package/dist/cjs/utils/derived-objects.d.ts +0 -2
- package/dist/cjs/utils/derived-objects.js +0 -1
- package/dist/cjs/utils/dynamic-fields.d.ts +0 -2
- package/dist/cjs/utils/dynamic-fields.js +0 -1
- package/dist/cjs/utils/format.d.ts +0 -2
- package/dist/cjs/utils/format.js +0 -1
- package/dist/cjs/utils/index.d.ts +0 -8
- package/dist/cjs/utils/index.js +0 -1
- package/dist/cjs/utils/move-registry.d.ts +0 -2
- package/dist/cjs/utils/move-registry.js +0 -1
- package/dist/cjs/utils/wow-types.d.ts +0 -14
- package/dist/cjs/utils/wow-types.js +0 -1
- package/dist/cjs/verify/index.d.ts +0 -1
- package/dist/cjs/verify/index.js +0 -1
- package/dist/cjs/verify/verify.d.ts +0 -16
- package/dist/cjs/verify/verify.js +0 -1
- package/dist/cjs/version.d.ts +0 -2
- package/dist/cjs/version.js +0 -1
- package/dist/cjs/w/call/allocation.d.ts +0 -35
- package/dist/cjs/w/call/allocation.js +0 -1
- package/dist/cjs/w/call/arb.d.ts +0 -17
- package/dist/cjs/w/call/arb.js +0 -1
- package/dist/cjs/w/call/arbitration.d.ts +0 -106
- package/dist/cjs/w/call/arbitration.js +0 -1
- package/dist/cjs/w/call/base.d.ts +0 -43
- package/dist/cjs/w/call/base.js +0 -1
- package/dist/cjs/w/call/contact.d.ts +0 -45
- package/dist/cjs/w/call/contact.js +0 -1
- package/dist/cjs/w/call/demand.d.ts +0 -79
- package/dist/cjs/w/call/demand.js +0 -1
- package/dist/cjs/w/call/entity.d.ts +0 -33
- package/dist/cjs/w/call/entity.js +0 -1
- package/dist/cjs/w/call/guard-ins.d.ts +0 -29
- package/dist/cjs/w/call/guard-ins.js +0 -1
- package/dist/cjs/w/call/guard.d.ts +0 -350
- package/dist/cjs/w/call/guard.js +0 -1
- package/dist/cjs/w/call/index.d.ts +0 -37
- package/dist/cjs/w/call/index.js +0 -1
- package/dist/cjs/w/call/machine.d.ts +0 -124
- package/dist/cjs/w/call/machine.js +0 -1
- package/dist/cjs/w/call/order.d.ts +0 -73
- package/dist/cjs/w/call/order.js +0 -1
- package/dist/cjs/w/call/passport.d.ts +0 -24
- package/dist/cjs/w/call/passport.js +0 -1
- package/dist/cjs/w/call/payment.d.ts +0 -27
- package/dist/cjs/w/call/payment.js +0 -1
- package/dist/cjs/w/call/permission.d.ts +0 -202
- package/dist/cjs/w/call/permission.js +0 -1
- package/dist/cjs/w/call/personal.d.ts +0 -51
- package/dist/cjs/w/call/personal.js +0 -1
- package/dist/cjs/w/call/progress.d.ts +0 -95
- package/dist/cjs/w/call/progress.js +0 -1
- package/dist/cjs/w/call/proof.d.ts +0 -27
- package/dist/cjs/w/call/proof.js +0 -1
- package/dist/cjs/w/call/repository.d.ts +0 -97
- package/dist/cjs/w/call/repository.js +0 -1
- package/dist/cjs/w/call/resource.d.ts +0 -27
- package/dist/cjs/w/call/resource.js +0 -1
- package/dist/cjs/w/call/reward.d.ts +0 -52
- package/dist/cjs/w/call/reward.js +0 -1
- package/dist/cjs/w/call/service.d.ts +0 -186
- package/dist/cjs/w/call/service.js +0 -1
- package/dist/cjs/w/call/treasury.d.ts +0 -77
- package/dist/cjs/w/call/treasury.js +0 -1
- package/dist/cjs/w/call/util.d.ts +0 -13
- package/dist/cjs/w/call/util.js +0 -1
- package/dist/cjs/w/common.d.ts +0 -344
- package/dist/cjs/w/common.js +0 -1
- package/dist/cjs/w/exception.d.ts +0 -83
- package/dist/cjs/w/exception.js +0 -1
- package/dist/cjs/w/index.d.ts +0 -8
- package/dist/cjs/w/index.js +0 -1
- package/dist/cjs/w/local/account.d.ts +0 -99
- package/dist/cjs/w/local/account.js +0 -1
- package/dist/cjs/w/local/cache.d.ts +0 -35
- package/dist/cjs/w/local/cache.js +0 -1
- package/dist/cjs/w/local/config.d.ts +0 -12
- package/dist/cjs/w/local/config.js +0 -1
- package/dist/cjs/w/local/index.d.ts +0 -199
- package/dist/cjs/w/local/index.js +0 -1
- package/dist/cjs/w/local/local.d.ts +0 -96
- package/dist/cjs/w/local/local.js +0 -1
- package/dist/cjs/w/local/storage.d.ts +0 -41
- package/dist/cjs/w/local/storage.js +0 -1
- package/dist/cjs/w/local/token.d.ts +0 -19
- package/dist/cjs/w/local/token.js +0 -1
- package/dist/cjs/w/local/util.d.ts +0 -1
- package/dist/cjs/w/local/util.js +0 -1
- package/dist/cjs/w/local/wip.d.ts +0 -135
- package/dist/cjs/w/local/wip.js +0 -1
- package/dist/cjs/w/messenger/crypto.d.ts +0 -88
- package/dist/cjs/w/messenger/crypto.js +0 -1
- package/dist/cjs/w/messenger/index.d.ts +0 -5
- package/dist/cjs/w/messenger/index.js +0 -1
- package/dist/cjs/w/messenger/messenger-api.d.ts +0 -140
- package/dist/cjs/w/messenger/messenger-api.js +0 -1
- package/dist/cjs/w/messenger/messenger-manager.d.ts +0 -85
- package/dist/cjs/w/messenger/messenger-manager.js +0 -1
- package/dist/cjs/w/messenger/messenger.d.ts +0 -92
- package/dist/cjs/w/messenger/messenger.js +0 -1
- package/dist/cjs/w/messenger/pq/crypto.d.ts +0 -39
- package/dist/cjs/w/messenger/pq/crypto.js +0 -1
- package/dist/cjs/w/messenger/pq/erasure.d.ts +0 -17
- package/dist/cjs/w/messenger/pq/erasure.js +0 -1
- package/dist/cjs/w/messenger/pq/index.d.ts +0 -9
- package/dist/cjs/w/messenger/pq/index.js +0 -1
- package/dist/cjs/w/messenger/pq/keycombiner.d.ts +0 -1
- package/dist/cjs/w/messenger/pq/keycombiner.js +0 -1
- package/dist/cjs/w/messenger/pq/pqxdh.d.ts +0 -38
- package/dist/cjs/w/messenger/pq/pqxdh.js +0 -1
- package/dist/cjs/w/messenger/pq/ratchet.d.ts +0 -12
- package/dist/cjs/w/messenger/pq/ratchet.js +0 -1
- package/dist/cjs/w/messenger/pq/session.d.ts +0 -41
- package/dist/cjs/w/messenger/pq/session.js +0 -1
- package/dist/cjs/w/messenger/pq/spqr.d.ts +0 -23
- package/dist/cjs/w/messenger/pq/spqr.js +0 -1
- package/dist/cjs/w/messenger/pq/store-adapter.d.ts +0 -31
- package/dist/cjs/w/messenger/pq/store-adapter.js +0 -1
- package/dist/cjs/w/messenger/pq/types.d.ts +0 -180
- package/dist/cjs/w/messenger/pq/types.js +0 -1
- package/dist/cjs/w/messenger/server.d.ts +0 -48
- package/dist/cjs/w/messenger/server.js +0 -1
- package/dist/cjs/w/messenger/session.d.ts +0 -65
- package/dist/cjs/w/messenger/session.js +0 -1
- package/dist/cjs/w/messenger/storage.d.ts +0 -110
- package/dist/cjs/w/messenger/storage.js +0 -1
- package/dist/cjs/w/messenger/templates/wts-html-template.d.ts +0 -30
- package/dist/cjs/w/messenger/templates/wts-html-template.js +0 -1
- package/dist/cjs/w/messenger/types.d.ts +0 -647
- package/dist/cjs/w/messenger/types.js +0 -1
- package/dist/cjs/w/messenger/utils.d.ts +0 -1
- package/dist/cjs/w/messenger/utils.js +0 -1
- package/dist/cjs/w/query/bult-in.d.ts +0 -62
- package/dist/cjs/w/query/bult-in.js +0 -1
- package/dist/cjs/w/query/event.d.ts +0 -76
- package/dist/cjs/w/query/event.js +0 -1
- package/dist/cjs/w/query/index.d.ts +0 -5
- package/dist/cjs/w/query/index.js +0 -1
- package/dist/cjs/w/query/object.d.ts +0 -626
- package/dist/cjs/w/query/object.js +0 -1
- package/dist/cjs/w/query/received.d.ts +0 -30
- package/dist/cjs/w/query/received.js +0 -1
- package/dist/cjs/w/query/util.d.ts +0 -4
- package/dist/cjs/w/query/util.js +0 -1
- package/dist/cjs/w/util.d.ts +0 -16
- package/dist/cjs/w/util.js +0 -1
- package/dist/esm/_deps/bcs/bcs-type.d.ts +0 -127
- package/dist/esm/_deps/bcs/bcs-type.js +0 -1
- package/dist/esm/_deps/bcs/bcs.d.ts +0 -49
- package/dist/esm/_deps/bcs/bcs.js +0 -1
- package/dist/esm/_deps/bcs/index.d.ts +0 -16
- package/dist/esm/_deps/bcs/index.js +0 -1
- package/dist/esm/_deps/bcs/reader.d.ts +0 -15
- package/dist/esm/_deps/bcs/reader.js +0 -1
- package/dist/esm/_deps/bcs/types.d.ts +0 -24
- package/dist/esm/_deps/bcs/types.js +0 -1
- package/dist/esm/_deps/bcs/uleb.d.ts +0 -5
- package/dist/esm/_deps/bcs/uleb.js +0 -1
- package/dist/esm/_deps/bcs/utils.d.ts +0 -4
- package/dist/esm/_deps/bcs/utils.js +0 -1
- package/dist/esm/_deps/bcs/writer.d.ts +0 -28
- package/dist/esm/_deps/bcs/writer.js +0 -1
- package/dist/esm/_deps/utils/b58.d.ts +0 -2
- package/dist/esm/_deps/utils/b58.js +0 -1
- package/dist/esm/_deps/utils/b64.d.ts +0 -2
- package/dist/esm/_deps/utils/b64.js +0 -1
- package/dist/esm/_deps/utils/chunk.d.ts +0 -1
- package/dist/esm/_deps/utils/chunk.js +0 -1
- package/dist/esm/_deps/utils/dataloader.d.ts +0 -43
- package/dist/esm/_deps/utils/dataloader.js +0 -1
- package/dist/esm/_deps/utils/hex.d.ts +0 -2
- package/dist/esm/_deps/utils/hex.js +0 -1
- package/dist/esm/_deps/utils/index.d.ts +0 -7
- package/dist/esm/_deps/utils/index.js +0 -1
- package/dist/esm/_deps/utils/types.d.ts +0 -4
- package/dist/esm/_deps/utils/types.js +0 -1
- package/dist/esm/_deps/utils/with-resolver.d.ts +0 -6
- package/dist/esm/_deps/utils/with-resolver.js +0 -1
- package/dist/esm/bcs/bcs.d.ts +0 -1927
- package/dist/esm/bcs/bcs.js +0 -1
- package/dist/esm/bcs/effects.d.ts +0 -579
- package/dist/esm/bcs/effects.js +0 -1
- package/dist/esm/bcs/index.d.ts +0 -6
- package/dist/esm/bcs/index.js +0 -1
- package/dist/esm/bcs/pure.d.ts +0 -22
- package/dist/esm/bcs/pure.js +0 -1
- package/dist/esm/bcs/type-tag-serializer.d.ts +0 -7
- package/dist/esm/bcs/type-tag-serializer.js +0 -1
- package/dist/esm/bcs/types.d.ts +0 -65
- package/dist/esm/bcs/types.js +0 -1
- package/dist/esm/client/index.d.ts +0 -5
- package/dist/esm/client/index.js +0 -1
- package/dist/esm/client/network.d.ts +0 -5
- package/dist/esm/client/network.js +0 -1
- package/dist/esm/cryptography/index.d.ts +0 -7
- package/dist/esm/cryptography/index.js +0 -1
- package/dist/esm/cryptography/intent.d.ts +0 -3
- package/dist/esm/cryptography/intent.js +0 -1
- package/dist/esm/cryptography/keypair.d.ts +0 -39
- package/dist/esm/cryptography/keypair.js +0 -1
- package/dist/esm/cryptography/mnemonics.d.ts +0 -4
- package/dist/esm/cryptography/mnemonics.js +0 -1
- package/dist/esm/cryptography/publickey.d.ts +0 -25
- package/dist/esm/cryptography/publickey.js +0 -1
- package/dist/esm/cryptography/signature-scheme.d.ts +0 -13
- package/dist/esm/cryptography/signature-scheme.js +0 -1
- package/dist/esm/cryptography/signature.d.ts +0 -21
- package/dist/esm/cryptography/signature.js +0 -1
- package/dist/esm/experimental/cache.d.ts +0 -12
- package/dist/esm/experimental/cache.js +0 -1
- package/dist/esm/experimental/client.d.ts +0 -12
- package/dist/esm/experimental/client.js +0 -1
- package/dist/esm/experimental/core.d.ts +0 -31
- package/dist/esm/experimental/core.js +0 -1
- package/dist/esm/experimental/errors.d.ts +0 -8
- package/dist/esm/experimental/errors.js +0 -1
- package/dist/esm/experimental/index.d.ts +0 -7
- package/dist/esm/experimental/index.js +0 -1
- package/dist/esm/experimental/persistent-storage.d.ts +0 -36
- package/dist/esm/experimental/persistent-storage.js +0 -1
- package/dist/esm/experimental/persistent-storage.test.d.ts +0 -1
- package/dist/esm/experimental/persistent-storage.test.js +0 -1
- package/dist/esm/experimental/transports/utils.d.ts +0 -3
- package/dist/esm/experimental/transports/utils.js +0 -1
- package/dist/esm/experimental/types.d.ts +0 -361
- package/dist/esm/experimental/types.js +0 -1
- package/dist/esm/faucet/faucet.d.ts +0 -57
- package/dist/esm/faucet/faucet.js +0 -1
- package/dist/esm/faucet/index.d.ts +0 -1
- package/dist/esm/faucet/index.js +0 -1
- package/dist/esm/grpc/client.d.ts +0 -30
- package/dist/esm/grpc/client.js +0 -1
- package/dist/esm/grpc/core.d.ts +0 -28
- package/dist/esm/grpc/core.js +0 -1
- package/dist/esm/grpc/index.d.ts +0 -4
- package/dist/esm/grpc/index.js +0 -1
- package/dist/esm/grpc/proto/google/protobuf/any.d.ts +0 -29
- package/dist/esm/grpc/proto/google/protobuf/any.js +0 -1
- package/dist/esm/grpc/proto/google/protobuf/duration.d.ts +0 -23
- package/dist/esm/grpc/proto/google/protobuf/duration.js +0 -1
- package/dist/esm/grpc/proto/google/protobuf/empty.d.ts +0 -16
- package/dist/esm/grpc/proto/google/protobuf/empty.js +0 -1
- package/dist/esm/grpc/proto/google/protobuf/field_mask.d.ts +0 -22
- package/dist/esm/grpc/proto/google/protobuf/field_mask.js +0 -1
- package/dist/esm/grpc/proto/google/protobuf/struct.d.ts +0 -72
- package/dist/esm/grpc/proto/google/protobuf/struct.js +0 -1
- package/dist/esm/grpc/proto/google/protobuf/timestamp.d.ts +0 -26
- package/dist/esm/grpc/proto/google/protobuf/timestamp.js +0 -1
- package/dist/esm/grpc/proto/google/rpc/error_details.d.ts +0 -166
- package/dist/esm/grpc/proto/google/rpc/error_details.js +0 -1
- package/dist/esm/grpc/proto/google/rpc/status.d.ts +0 -20
- package/dist/esm/grpc/proto/google/rpc/status.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/argument.d.ts +0 -18
- package/dist/esm/grpc/proto/sui/rpc/v2/argument.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.d.ts +0 -11
- package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/bcs.d.ts +0 -10
- package/dist/esm/grpc/proto/sui/rpc/v2/bcs.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.d.ts +0 -20
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.d.ts +0 -23
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.d.ts +0 -46
- package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/effects.d.ts +0 -81
- package/dist/esm/grpc/proto/sui/rpc/v2/effects.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/epoch.d.ts +0 -21
- package/dist/esm/grpc/proto/sui/rpc/v2/epoch.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.d.ts +0 -5
- package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/event.d.ts +0 -25
- package/dist/esm/grpc/proto/sui/rpc/v2/event.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.d.ts +0 -24
- package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.d.ts +0 -220
- package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.d.ts +0 -12
- package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/input.d.ts +0 -23
- package/dist/esm/grpc/proto/sui/rpc/v2/input.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.d.ts +0 -43
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.d.ts +0 -160
- package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package.d.ts +0 -150
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.d.ts +0 -31
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.d.ts +0 -78
- package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/object.d.ts +0 -32
- package/dist/esm/grpc/proto/sui/rpc/v2/object.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.d.ts +0 -11
- package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/owner.d.ts +0 -19
- package/dist/esm/grpc/proto/sui/rpc/v2/owner.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.d.ts +0 -15
- package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/signature.d.ts +0 -105
- package/dist/esm/grpc/proto/sui/rpc/v2/signature.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.d.ts +0 -5
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.ts +0 -19
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.d.ts +0 -23
- package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.d.ts +0 -35
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.d.ts +0 -172
- package/dist/esm/grpc/proto/sui/rpc/v2/state_service.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.d.ts +0 -19
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.d.ts +0 -21
- package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/system_state.d.ts +0 -146
- package/dist/esm/grpc/proto/sui/rpc/v2/system_state.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction.d.ts +0 -338
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.ts +0 -23
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +0 -1
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.d.ts +0 -66
- package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.js +0 -1
- package/dist/esm/index.d.ts +0 -25
- package/dist/esm/index.js +0 -1
- package/dist/esm/jsonRpc/client.d.ts +0 -121
- package/dist/esm/jsonRpc/client.js +0 -1
- package/dist/esm/jsonRpc/core.d.ts +0 -87
- package/dist/esm/jsonRpc/core.js +0 -1
- package/dist/esm/jsonRpc/errors.d.ts +0 -12
- package/dist/esm/jsonRpc/errors.js +0 -1
- package/dist/esm/jsonRpc/http-transport.d.ts +0 -39
- package/dist/esm/jsonRpc/http-transport.js +0 -1
- package/dist/esm/jsonRpc/index.d.ts +0 -4
- package/dist/esm/jsonRpc/index.js +0 -1
- package/dist/esm/jsonRpc/json-rpc-resolver.d.ts +0 -4
- package/dist/esm/jsonRpc/json-rpc-resolver.js +0 -1
- package/dist/esm/jsonRpc/rpc-websocket-client.d.ts +0 -28
- package/dist/esm/jsonRpc/rpc-websocket-client.js +0 -1
- package/dist/esm/jsonRpc/types/chain.d.ts +0 -94
- package/dist/esm/jsonRpc/types/chain.js +0 -1
- package/dist/esm/jsonRpc/types/changes.d.ts +0 -19
- package/dist/esm/jsonRpc/types/changes.js +0 -1
- package/dist/esm/jsonRpc/types/coins.d.ts +0 -6
- package/dist/esm/jsonRpc/types/coins.js +0 -1
- package/dist/esm/jsonRpc/types/common.d.ts +0 -2
- package/dist/esm/jsonRpc/types/common.js +0 -1
- package/dist/esm/jsonRpc/types/generated.d.ts +0 -932
- package/dist/esm/jsonRpc/types/generated.js +0 -1
- package/dist/esm/jsonRpc/types/generated_old.d.ts +0 -954
- package/dist/esm/jsonRpc/types/generated_old.js +0 -1
- package/dist/esm/jsonRpc/types/index.d.ts +0 -6
- package/dist/esm/jsonRpc/types/index.js +0 -1
- package/dist/esm/jsonRpc/types/params.d.ts +0 -303
- package/dist/esm/jsonRpc/types/params.js +0 -1
- package/dist/esm/keypairs/falcon512/index.d.ts +0 -2
- package/dist/esm/keypairs/falcon512/index.js +0 -1
- package/dist/esm/keypairs/falcon512/keypair.d.ts +0 -19
- package/dist/esm/keypairs/falcon512/keypair.js +0 -1
- package/dist/esm/keypairs/falcon512/publickey.d.ts +0 -11
- package/dist/esm/keypairs/falcon512/publickey.js +0 -1
- package/dist/esm/keypairs/index.d.ts +0 -1
- package/dist/esm/keypairs/index.js +0 -1
- package/dist/esm/multisig/index.d.ts +0 -2
- package/dist/esm/multisig/index.js +0 -1
- package/dist/esm/multisig/publickey.d.ts +0 -44
- package/dist/esm/multisig/publickey.js +0 -1
- package/dist/esm/multisig/signer.d.ts +0 -19
- package/dist/esm/multisig/signer.js +0 -1
- package/dist/esm/transactions/Arguments.d.ts +0 -57
- package/dist/esm/transactions/Arguments.js +0 -1
- package/dist/esm/transactions/Commands.d.ts +0 -54
- package/dist/esm/transactions/Commands.js +0 -1
- package/dist/esm/transactions/Inputs.d.ts +0 -22
- package/dist/esm/transactions/Inputs.js +0 -1
- package/dist/esm/transactions/ObjectCache.d.ts +0 -83
- package/dist/esm/transactions/ObjectCache.js +0 -1
- package/dist/esm/transactions/Transaction.d.ts +0 -654
- package/dist/esm/transactions/Transaction.js +0 -1
- package/dist/esm/transactions/TransactionData.d.ts +0 -67
- package/dist/esm/transactions/TransactionData.js +0 -1
- package/dist/esm/transactions/__tests__/Transaction.test.d.ts +0 -1
- package/dist/esm/transactions/__tests__/Transaction.test.js +0 -1
- package/dist/esm/transactions/__tests__/bcs.test.d.ts +0 -1
- package/dist/esm/transactions/__tests__/bcs.test.js +0 -1
- package/dist/esm/transactions/data/internal.d.ts +0 -1010
- package/dist/esm/transactions/data/internal.js +0 -1
- package/dist/esm/transactions/data/v1.d.ts +0 -312
- package/dist/esm/transactions/data/v1.js +0 -1
- package/dist/esm/transactions/data/v2.d.ts +0 -153
- package/dist/esm/transactions/data/v2.js +0 -1
- package/dist/esm/transactions/executor/caching.d.ts +0 -27
- package/dist/esm/transactions/executor/caching.js +0 -1
- package/dist/esm/transactions/executor/parallel.d.ts +0 -26
- package/dist/esm/transactions/executor/parallel.js +0 -1
- package/dist/esm/transactions/executor/queue.d.ts +0 -11
- package/dist/esm/transactions/executor/queue.js +0 -1
- package/dist/esm/transactions/executor/serial.d.ts +0 -30
- package/dist/esm/transactions/executor/serial.js +0 -1
- package/dist/esm/transactions/hash.d.ts +0 -1
- package/dist/esm/transactions/hash.js +0 -1
- package/dist/esm/transactions/index.d.ts +0 -20
- package/dist/esm/transactions/index.js +0 -1
- package/dist/esm/transactions/intents/CoinWithBalance.d.ts +0 -9
- package/dist/esm/transactions/intents/CoinWithBalance.js +0 -1
- package/dist/esm/transactions/object.d.ts +0 -24
- package/dist/esm/transactions/object.js +0 -1
- package/dist/esm/transactions/plugins/NamedPackagesPlugin.d.ts +0 -13
- package/dist/esm/transactions/plugins/NamedPackagesPlugin.js +0 -1
- package/dist/esm/transactions/pure.d.ts +0 -20
- package/dist/esm/transactions/pure.js +0 -1
- package/dist/esm/transactions/resolve.d.ts +0 -13
- package/dist/esm/transactions/resolve.js +0 -1
- package/dist/esm/transactions/serializer.d.ts +0 -7
- package/dist/esm/transactions/serializer.js +0 -1
- package/dist/esm/transactions/utils.d.ts +0 -10
- package/dist/esm/transactions/utils.js +0 -1
- package/dist/esm/utils/constants.d.ts +0 -11
- package/dist/esm/utils/constants.js +0 -1
- package/dist/esm/utils/derived-objects.d.ts +0 -2
- package/dist/esm/utils/derived-objects.js +0 -1
- package/dist/esm/utils/dynamic-fields.d.ts +0 -2
- package/dist/esm/utils/dynamic-fields.js +0 -1
- package/dist/esm/utils/format.d.ts +0 -2
- package/dist/esm/utils/format.js +0 -1
- package/dist/esm/utils/index.d.ts +0 -8
- package/dist/esm/utils/index.js +0 -1
- package/dist/esm/utils/move-registry.d.ts +0 -2
- package/dist/esm/utils/move-registry.js +0 -1
- package/dist/esm/utils/wow-types.d.ts +0 -14
- package/dist/esm/utils/wow-types.js +0 -1
- package/dist/esm/verify/index.d.ts +0 -1
- package/dist/esm/verify/index.js +0 -1
- package/dist/esm/verify/verify.d.ts +0 -16
- package/dist/esm/verify/verify.js +0 -1
- package/dist/esm/version.d.ts +0 -2
- package/dist/esm/version.js +0 -1
- package/dist/esm/w/call/allocation.d.ts +0 -35
- package/dist/esm/w/call/allocation.js +0 -1
- package/dist/esm/w/call/arb.d.ts +0 -17
- package/dist/esm/w/call/arb.js +0 -1
- package/dist/esm/w/call/arbitration.d.ts +0 -106
- package/dist/esm/w/call/arbitration.js +0 -1
- package/dist/esm/w/call/base.d.ts +0 -43
- package/dist/esm/w/call/base.js +0 -1
- package/dist/esm/w/call/contact.d.ts +0 -45
- package/dist/esm/w/call/contact.js +0 -1
- package/dist/esm/w/call/demand.d.ts +0 -79
- package/dist/esm/w/call/demand.js +0 -1
- package/dist/esm/w/call/entity.d.ts +0 -33
- package/dist/esm/w/call/entity.js +0 -1
- package/dist/esm/w/call/guard-ins.d.ts +0 -29
- package/dist/esm/w/call/guard-ins.js +0 -1
- package/dist/esm/w/call/guard.d.ts +0 -350
- package/dist/esm/w/call/guard.js +0 -1
- package/dist/esm/w/call/index.d.ts +0 -37
- package/dist/esm/w/call/index.js +0 -1
- package/dist/esm/w/call/machine.d.ts +0 -124
- package/dist/esm/w/call/machine.js +0 -1
- package/dist/esm/w/call/order.d.ts +0 -73
- package/dist/esm/w/call/order.js +0 -1
- package/dist/esm/w/call/passport.d.ts +0 -24
- package/dist/esm/w/call/passport.js +0 -1
- package/dist/esm/w/call/payment.d.ts +0 -27
- package/dist/esm/w/call/payment.js +0 -1
- package/dist/esm/w/call/permission.d.ts +0 -202
- package/dist/esm/w/call/permission.js +0 -1
- package/dist/esm/w/call/personal.d.ts +0 -51
- package/dist/esm/w/call/personal.js +0 -1
- package/dist/esm/w/call/progress.d.ts +0 -95
- package/dist/esm/w/call/progress.js +0 -1
- package/dist/esm/w/call/proof.d.ts +0 -27
- package/dist/esm/w/call/proof.js +0 -1
- package/dist/esm/w/call/repository.d.ts +0 -97
- package/dist/esm/w/call/repository.js +0 -1
- package/dist/esm/w/call/resource.d.ts +0 -27
- package/dist/esm/w/call/resource.js +0 -1
- package/dist/esm/w/call/reward.d.ts +0 -52
- package/dist/esm/w/call/reward.js +0 -1
- package/dist/esm/w/call/service.d.ts +0 -186
- package/dist/esm/w/call/service.js +0 -1
- package/dist/esm/w/call/treasury.d.ts +0 -77
- package/dist/esm/w/call/treasury.js +0 -1
- package/dist/esm/w/call/util.d.ts +0 -13
- package/dist/esm/w/call/util.js +0 -1
- package/dist/esm/w/common.d.ts +0 -344
- package/dist/esm/w/common.js +0 -1
- package/dist/esm/w/exception.d.ts +0 -83
- package/dist/esm/w/exception.js +0 -1
- package/dist/esm/w/index.d.ts +0 -8
- package/dist/esm/w/index.js +0 -1
- package/dist/esm/w/local/account.d.ts +0 -99
- package/dist/esm/w/local/account.js +0 -1
- package/dist/esm/w/local/cache.d.ts +0 -35
- package/dist/esm/w/local/cache.js +0 -1
- package/dist/esm/w/local/config.d.ts +0 -12
- package/dist/esm/w/local/config.js +0 -1
- package/dist/esm/w/local/index.d.ts +0 -199
- package/dist/esm/w/local/index.js +0 -1
- package/dist/esm/w/local/local.d.ts +0 -96
- package/dist/esm/w/local/local.js +0 -1
- package/dist/esm/w/local/storage.d.ts +0 -41
- package/dist/esm/w/local/storage.js +0 -1
- package/dist/esm/w/local/token.d.ts +0 -19
- package/dist/esm/w/local/token.js +0 -1
- package/dist/esm/w/local/util.d.ts +0 -1
- package/dist/esm/w/local/util.js +0 -1
- package/dist/esm/w/local/wip.d.ts +0 -135
- package/dist/esm/w/local/wip.js +0 -1
- package/dist/esm/w/messenger/crypto.d.ts +0 -88
- package/dist/esm/w/messenger/crypto.js +0 -1
- package/dist/esm/w/messenger/index.d.ts +0 -5
- package/dist/esm/w/messenger/index.js +0 -1
- package/dist/esm/w/messenger/messenger-api.d.ts +0 -140
- package/dist/esm/w/messenger/messenger-api.js +0 -1
- package/dist/esm/w/messenger/messenger-manager.d.ts +0 -85
- package/dist/esm/w/messenger/messenger-manager.js +0 -1
- package/dist/esm/w/messenger/messenger.d.ts +0 -92
- package/dist/esm/w/messenger/messenger.js +0 -1
- package/dist/esm/w/messenger/pq/crypto.d.ts +0 -39
- package/dist/esm/w/messenger/pq/crypto.js +0 -1
- package/dist/esm/w/messenger/pq/erasure.d.ts +0 -17
- package/dist/esm/w/messenger/pq/erasure.js +0 -1
- package/dist/esm/w/messenger/pq/index.d.ts +0 -9
- package/dist/esm/w/messenger/pq/index.js +0 -1
- package/dist/esm/w/messenger/pq/keycombiner.d.ts +0 -1
- package/dist/esm/w/messenger/pq/keycombiner.js +0 -1
- package/dist/esm/w/messenger/pq/pqxdh.d.ts +0 -38
- package/dist/esm/w/messenger/pq/pqxdh.js +0 -1
- package/dist/esm/w/messenger/pq/ratchet.d.ts +0 -12
- package/dist/esm/w/messenger/pq/ratchet.js +0 -1
- package/dist/esm/w/messenger/pq/session.d.ts +0 -41
- package/dist/esm/w/messenger/pq/session.js +0 -1
- package/dist/esm/w/messenger/pq/spqr.d.ts +0 -23
- package/dist/esm/w/messenger/pq/spqr.js +0 -1
- package/dist/esm/w/messenger/pq/store-adapter.d.ts +0 -31
- package/dist/esm/w/messenger/pq/store-adapter.js +0 -1
- package/dist/esm/w/messenger/pq/types.d.ts +0 -180
- package/dist/esm/w/messenger/pq/types.js +0 -1
- package/dist/esm/w/messenger/server.d.ts +0 -48
- package/dist/esm/w/messenger/server.js +0 -1
- package/dist/esm/w/messenger/session.d.ts +0 -65
- package/dist/esm/w/messenger/session.js +0 -1
- package/dist/esm/w/messenger/storage.d.ts +0 -110
- package/dist/esm/w/messenger/storage.js +0 -1
- package/dist/esm/w/messenger/templates/wts-html-template.d.ts +0 -30
- package/dist/esm/w/messenger/templates/wts-html-template.js +0 -1
- package/dist/esm/w/messenger/types.d.ts +0 -647
- package/dist/esm/w/messenger/types.js +0 -1
- package/dist/esm/w/messenger/utils.d.ts +0 -1
- package/dist/esm/w/messenger/utils.js +0 -1
- package/dist/esm/w/query/bult-in.d.ts +0 -62
- package/dist/esm/w/query/bult-in.js +0 -1
- package/dist/esm/w/query/event.d.ts +0 -76
- package/dist/esm/w/query/event.js +0 -1
- package/dist/esm/w/query/index.d.ts +0 -5
- package/dist/esm/w/query/index.js +0 -1
- package/dist/esm/w/query/object.d.ts +0 -626
- package/dist/esm/w/query/object.js +0 -1
- package/dist/esm/w/query/received.d.ts +0 -30
- package/dist/esm/w/query/received.js +0 -1
- package/dist/esm/w/query/util.d.ts +0 -4
- package/dist/esm/w/query/util.js +0 -1
- package/dist/esm/w/util.d.ts +0 -16
- package/dist/esm/w/util.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{WowClient}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 WowClient({'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;}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getWowDir(): string;
|
package/dist/cjs/w/local/util.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as a179a from'path';import*as a179b from'os';export function getWowDir(){if(process['env']['WOWOK_DATA_DIR'])return process['env']['WOWOK_DATA_DIR'];const a=a179b['homedir'](),b=a179b['platform']();if(b==='win32')return a179a['join'](a,'.wow','V1');else{if(b==='darwin')return a179a['join'](a,'Library','Application\x20Support','.wow','V1');else{const c=process['env']['XDG_CONFIG_HOME'];if(c)return a179a['join'](c,'.wow','V1');const d=process['env']['XDG_DATA_HOME'];if(d)return a179a['join'](d,'.wow','V1');return a179a['join'](a,'.wow','V1');}}}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
export type TextFormat = "plain" | "markdown" | "html";
|
|
2
|
-
export type ImageMimeType = "image/png" | "image/jpeg" | "image/gif" | "image/webp";
|
|
3
|
-
export type HashAlgorithm = "sha256";
|
|
4
|
-
export type SignatureAlgorithm = "Falcon512";
|
|
5
|
-
export interface WipContent {
|
|
6
|
-
text: string;
|
|
7
|
-
format: TextFormat;
|
|
8
|
-
}
|
|
9
|
-
export interface WipMedia {
|
|
10
|
-
id: string;
|
|
11
|
-
type: ImageMimeType;
|
|
12
|
-
data: string;
|
|
13
|
-
filename?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface WipPayload {
|
|
16
|
-
content: WipContent;
|
|
17
|
-
media: WipMedia[];
|
|
18
|
-
}
|
|
19
|
-
export interface WipSignature {
|
|
20
|
-
value: string;
|
|
21
|
-
publicKey: string;
|
|
22
|
-
algorithm: SignatureAlgorithm;
|
|
23
|
-
address?: string;
|
|
24
|
-
}
|
|
25
|
-
export interface WipMeta {
|
|
26
|
-
type: "wip";
|
|
27
|
-
version: string;
|
|
28
|
-
created: string;
|
|
29
|
-
hash: string;
|
|
30
|
-
algorithm: HashAlgorithm;
|
|
31
|
-
signature?: WipSignature | WipSignature[];
|
|
32
|
-
}
|
|
33
|
-
export interface WipFile {
|
|
34
|
-
wip: string;
|
|
35
|
-
payload: WipPayload;
|
|
36
|
-
meta: WipMeta;
|
|
37
|
-
}
|
|
38
|
-
export interface ImageSource {
|
|
39
|
-
source: string;
|
|
40
|
-
id?: string;
|
|
41
|
-
filename?: string;
|
|
42
|
-
}
|
|
43
|
-
export interface WipCreateOptions {
|
|
44
|
-
text: string;
|
|
45
|
-
textFormat?: TextFormat;
|
|
46
|
-
images?: ImageSource[];
|
|
47
|
-
signKeyPair?: {
|
|
48
|
-
publicKey: string;
|
|
49
|
-
privateKey: string;
|
|
50
|
-
};
|
|
51
|
-
signAlgorithm?: SignatureAlgorithm;
|
|
52
|
-
}
|
|
53
|
-
export interface WipLimits {
|
|
54
|
-
maxImageSize: number;
|
|
55
|
-
maxTotalSize: number;
|
|
56
|
-
maxImageCount: number;
|
|
57
|
-
maxTextLength: number;
|
|
58
|
-
}
|
|
59
|
-
export declare const DEFAULT_LIMITS: WipLimits;
|
|
60
|
-
export declare class WipError extends Error {
|
|
61
|
-
constructor(message: string);
|
|
62
|
-
}
|
|
63
|
-
export declare class WipValidationError extends WipError {
|
|
64
|
-
constructor(message: string);
|
|
65
|
-
}
|
|
66
|
-
export declare class WipSizeError extends WipError {
|
|
67
|
-
constructor(message: string);
|
|
68
|
-
}
|
|
69
|
-
export declare class WIP {
|
|
70
|
-
private limits;
|
|
71
|
-
private resourceLoader;
|
|
72
|
-
constructor(limits?: Partial<WipLimits>);
|
|
73
|
-
create(options: WipCreateOptions): Promise<WipFile>;
|
|
74
|
-
private processImage;
|
|
75
|
-
private sign;
|
|
76
|
-
verify(wipFile: WipFile): Promise<{
|
|
77
|
-
valid: boolean;
|
|
78
|
-
error?: string;
|
|
79
|
-
signatures?: {
|
|
80
|
-
address?: string;
|
|
81
|
-
valid: boolean;
|
|
82
|
-
}[];
|
|
83
|
-
}>;
|
|
84
|
-
private verifySignature;
|
|
85
|
-
toHtml(wipFile: WipFile, options?: {
|
|
86
|
-
title?: string;
|
|
87
|
-
theme?: "light" | "dark";
|
|
88
|
-
}): Promise<string>;
|
|
89
|
-
stringify(wipFile: WipFile, pretty?: boolean): string;
|
|
90
|
-
parse(jsonString: string): WipFile;
|
|
91
|
-
load(source: string): Promise<WipFile>;
|
|
92
|
-
getHash(wipFile: WipFile): string;
|
|
93
|
-
extractImages(wipFile: WipFile, outputDir: string): string[];
|
|
94
|
-
save(wipFile: WipFile, filePath: string, pretty?: boolean): void;
|
|
95
|
-
getLimits(): WipLimits;
|
|
96
|
-
setLimits(limits: Partial<WipLimits>): void;
|
|
97
|
-
}
|
|
98
|
-
export declare function createWip(options: WipCreateOptions, limits?: Partial<WipLimits>): Promise<WipFile>;
|
|
99
|
-
export declare function verifyWip(wipFile: WipFile, hash_equal?: string): Promise<{
|
|
100
|
-
valid: boolean;
|
|
101
|
-
error?: string;
|
|
102
|
-
}>;
|
|
103
|
-
export declare function wipToHtml(wipFile: WipFile, options?: {
|
|
104
|
-
title?: string;
|
|
105
|
-
theme?: "light" | "dark";
|
|
106
|
-
}): Promise<string>;
|
|
107
|
-
export declare function loadWip(source: string, limits?: Partial<WipLimits>): Promise<WipFile>;
|
|
108
|
-
export interface WipGenerationOptions {
|
|
109
|
-
markdown_text: string;
|
|
110
|
-
images?: ImageSource[];
|
|
111
|
-
account?: string;
|
|
112
|
-
}
|
|
113
|
-
export interface WipSignatureVerification {
|
|
114
|
-
publicKey: string;
|
|
115
|
-
address?: string;
|
|
116
|
-
valid: boolean;
|
|
117
|
-
}
|
|
118
|
-
export interface WipVerificationResult {
|
|
119
|
-
valid: boolean;
|
|
120
|
-
error?: string;
|
|
121
|
-
hashValid: boolean;
|
|
122
|
-
signatureValid?: boolean;
|
|
123
|
-
hasSignature: boolean;
|
|
124
|
-
signatures?: WipSignatureVerification[];
|
|
125
|
-
}
|
|
126
|
-
export interface WipToHtmlOptions {
|
|
127
|
-
title?: string;
|
|
128
|
-
theme?: "light" | "dark";
|
|
129
|
-
outputPath?: string;
|
|
130
|
-
}
|
|
131
|
-
export declare function generate_wip(options: WipGenerationOptions, outputPath: string): Promise<string>;
|
|
132
|
-
export declare function verify_wip(wipFilePath: string, hash_equal?: string, requireSignature?: boolean): Promise<WipVerificationResult>;
|
|
133
|
-
export declare function sign_wip(wipFilePath: string, account: string | undefined | null, outputPath?: string): Promise<string>;
|
|
134
|
-
export declare function wip2html(wipPath: string, options?: WipToHtmlOptions): Promise<string | string[]>;
|
|
135
|
-
export default WIP;
|
package/dist/cjs/w/local/wip.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{sha256}from'@noble/hashes/sha256';import{bytesToHex}from'@noble/hashes/utils';import*as a180a from'fs';import*as a180b from'path';import*as a180c from'https';import*as a180d from'http';const WIP_SCHEMA_URL='https://github.com/wowok-ai/docs/blob/main/WIP.md',WIP_VERSION='1.0.0';export const DEFAULT_LIMITS={'maxImageSize':0x2*0x400*0x400,'maxTotalSize':0xa*0x400*0x400,'maxImageCount':0xa,'maxTextLength':0x2710};export class WipError extends Error{constructor(a){super(a),this['name']='WipError';}}export class WipValidationError extends WipError{constructor(a){super(a),this['name']='WipValidationError';}}export class WipSizeError extends WipError{constructor(a){super(a),this['name']='WipSizeError';}}function detectMimeType(a){if(a['length']>=0x4&&a[0x0]===0x89&&a[0x1]===0x50&&a[0x2]===0x4e&&a[0x3]===0x47)return'image/png';if(a['length']>=0x3&&a[0x0]===0xff&&a[0x1]===0xd8&&a[0x2]===0xff)return'image/jpeg';if(a['length']>=0x6&&a[0x0]===0x47&&a[0x1]===0x49&&a[0x2]===0x46)return'image/gif';if(a['length']>=0xc&&a[0x0]===0x52&&a[0x1]===0x49&&a[0x2]===0x46&&a[0x3]===0x46&&a[0x8]===0x57&&a[0x9]===0x45&&a[0xa]===0x42&&a[0xb]===0x50)return'image/webp';return null;}function uint8ArrayToBase64(a){let b='';const c=a['length'];for(let d=0x0;d<c;d++){b+=String['fromCharCode'](a[d]);}return btoa(b);}function base64ToUint8Array(a){const b=atob(a),c=b['length'],d=new Uint8Array(c);for(let e=0x0;e<c;e++){d[e]=b['charCodeAt'](e);}return d;}function canonicalizeJson(a){if(a===null||typeof a!=='object')return JSON['stringify'](a);if(Array['isArray'](a))return'['+a['map'](canonicalizeJson)['join'](',')+']';const b=a,c=Object['keys'](b)['sort'](),d=c['map'](e=>'\x22'+e+'\x22:'+canonicalizeJson(b[e]));return'{'+d['join'](',')+'}';}function computeHash(a){const b=sha256(new TextEncoder()['encode'](a));return bytesToHex(b);}function generateId(a){const b=Date['now']()['toString'](0x24),c=Math['random']()['toString'](0x24)['substring'](0x2,0x8);return a+'-'+b+'-'+c;}function getExtensionFromMimeType(a){const b={'image/png':'png','image/jpeg':'jpg','image/gif':'gif','image/webp':'webp'};return b[a]||'bin';}class ResourceLoader{['maxSize'];constructor(a){this['maxSize']=a;}async['load'](a){if(!a||a['trim']()==='')throw new WipError('WIP\x20file\x20path\x20cannot\x20be\x20empty');if(a['startsWith']('data:'))return this['loadFromDataUrl'](a);if(a['startsWith']('http://')||a['startsWith']('https://'))return this['loadFromNetwork'](a);return this['loadFromFile'](a);}['loadFromDataUrl'](a){const b=a['match'](/^data:image\/(\w+);base64,(.+)$/);if(!b)throw new WipValidationError('Invalid\x20data\x20URL\x20format:\x20'+a['substring'](0x0,0x32)+'...');const c=b[0x2];try{return base64ToUint8Array(c);}catch(d){throw new WipError('Failed\x20to\x20decode\x20data\x20URL:\x20'+d);}}async['loadFromNetwork'](a){return new Promise((b,c)=>{const d=setTimeout(()=>{c(new WipError('Network\x20timeout\x20while\x20fetching:\x20'+a));},0x7530),e=a['startsWith']('https:'),f=e?a180c:a180d,g={'headers':{'Accept':'application/json,*/*'}};e&&(g['rejectUnauthorized']=![]);const h=f['get'](a,g,i=>{clearTimeout(d);if(i['statusCode']!==0xc8){c(new WipError('Failed\x20to\x20fetch:\x20'+i['statusCode']+'\x20'+i['statusMessage']));return;}const j=i['headers']['content-length'];if(j&&parseInt(j)>this['maxSize']){c(new WipSizeError('Resource\x20from\x20'+a+'\x20size\x20('+j+'\x20bytes)\x20exceeds\x20limit\x20('+this['maxSize']+'\x20bytes)'));return;}const k=[];i['on']('data',l=>{k['push'](l);}),i['on']('end',()=>{const l=Buffer['concat'](k);if(l['length']>this['maxSize']){c(new WipSizeError('Resource\x20from\x20'+a+'\x20size\x20('+l['length']+'\x20bytes)\x20exceeds\x20limit\x20('+this['maxSize']+'\x20bytes)'));return;}b(new Uint8Array(l));}),i['on']('error',l=>{c(new WipError('Network\x20error:\x20'+l['message']));});});h['on']('error',i=>{clearTimeout(d),c(new WipError('Network\x20error:\x20'+i['message']));});});}['loadFromFile'](a){const b=a180b['resolve'](a);if(!a180a['existsSync'](b))throw new WipError('File\x20not\x20found:\x20'+b);const c=a180a['statSync'](b);if(!c['isFile']())throw new WipError('Path\x20is\x20not\x20a\x20file:\x20'+b);if(c['size']>this['maxSize'])throw new WipSizeError('File\x20'+b+'\x20size\x20('+c['size']+'\x20bytes)\x20exceeds\x20limit\x20('+this['maxSize']+'\x20bytes)');const d=a180a['readFileSync'](b);return new Uint8Array(d);}}export class WIP{['limits'];['resourceLoader'];constructor(a={}){this['limits']={...DEFAULT_LIMITS,...a},this['resourceLoader']=new ResourceLoader(this['limits']['maxImageSize']);}async['create'](a){if(a['text']['length']>this['limits']['maxTextLength'])throw new WipSizeError('Text\x20length\x20('+a['text']['length']+')\x20exceeds\x20limit\x20('+this['limits']['maxTextLength']+')');const b=[];if(a['images']&&a['images']['length']>0x0){if(a['images']['length']>this['limits']['maxImageCount'])throw new WipSizeError('Image\x20count\x20('+a['images']['length']+')\x20exceeds\x20limit\x20('+this['limits']['maxImageCount']+')');for(let j=0x0;j<a['images']['length'];j++){const k=await this['processImage'](a['images'][j],j);b['push'](k);}}const c={'content':{'text':a['text'],'format':a['textFormat']||'plain'},'media':b},d={'wip':WIP_SCHEMA_URL,'payload':c},e=computeHash(canonicalizeJson(d)),f={'type':'wip','version':WIP_VERSION,'created':new Date()['toISOString'](),'hash':e,'algorithm':'sha256'};if(a['signKeyPair']){const {signature:l,...m}=f,n=computeHash(canonicalizeJson(m)),o=await this['sign'](n,a['signKeyPair']['privateKey'],a['signAlgorithm']||'Falcon512');f['signature']={'value':o,'publicKey':a['signKeyPair']['publicKey'],'algorithm':a['signAlgorithm']||'Falcon512'};}const g={'wip':WIP_SCHEMA_URL,'payload':c,'meta':f},h=JSON['stringify'](g);if(h['length']>this['limits']['maxTotalSize'])throw new WipSizeError('Total\x20WIP\x20file\x20size\x20('+h['length']+'\x20bytes)\x20exceeds\x20limit\x20('+this['limits']['maxTotalSize']+'\x20bytes)');return g;}async['processImage'](a,b){const c=await this['resourceLoader']['load'](a['source']),d=detectMimeType(c);if(!d)throw new WipValidationError('Unsupported\x20image\x20format:\x20'+a['source']);let e=a['filename'];if(!e){if(a['source']['startsWith']('http')){const f=new URL(a['source']),g=f['pathname'];e=g['substring'](g['lastIndexOf']('/')+0x1)||'image-'+b;}else e=a['source']['substring'](a['source']['lastIndexOf']('/')+0x1)||'image-'+b;}return{'id':a['id']||generateId('img'),'type':d,'data':uint8ArrayToBase64(c),'filename':e};}async['sign'](a,b,c){if(c!=='Falcon512')throw new WipError('Unsupported\x20signature\x20algorithm:\x20'+c);const {Falcon512Keypair:d}=await import('../../keypairs/falcon512/index.js'),e=d['fromSecretKey'](b),f=await e['sign'](new TextEncoder()['encode'](a));return uint8ArrayToBase64(f);}async['verify'](a){try{if(!a['wip']||!a['payload']||!a['meta'])return{'valid':![],'error':'Invalid\x20WIP\x20file\x20structure'};if(a['meta']['type']!=='wip')return{'valid':![],'error':'Invalid\x20meta.type:\x20'+a['meta']['type']};const b={'wip':a['wip'],'payload':a['payload']},c=computeHash(canonicalizeJson(b));if(c!==a['meta']['hash'])return{'valid':![],'error':'Hash\x20mismatch\x20-\x20content\x20has\x20been\x20tampered'};const d=[];if(a['meta']['signature']){const {signature:e,...f}=a['meta'],g=computeHash(canonicalizeJson(f)),h=Array['isArray'](a['meta']['signature'])?a['meta']['signature']:[a['meta']['signature']];for(const i of h){const j=await this['verifySignature'](g,i['value'],i['publicKey'],i['algorithm']);d['push']({'address':i['address'],'valid':j});if(!j)return{'valid':![],'error':'Invalid\x20signature','signatures':d};}}return{'valid':!![],'signatures':d};}catch(k){return{'valid':![],'error':'Verification\x20error:\x20'+k};}}async['verifySignature'](a,b,c,d){if(d!=='Falcon512')throw new WipError('Unsupported\x20signature\x20algorithm:\x20'+d);try{const {Falcon512PublicKey:e}=await import('../../keypairs/falcon512/publickey.js');let f;if(c['startsWith']('0x')){const i=Buffer['from'](c['slice'](0x2),'hex');if(i['length']===0x382)f=i['slice'](0x1);else i['length']===0x381?f=i:f=i;}else try{const j=Buffer['from'](c,'base64');j['length']===0x382?f=j['slice'](0x1):f=j;}catch{f=Buffer['from'](c,'base64');}const g=new e(f),h=Uint8Array['from'](Buffer['from'](b,'base64'));return await g['verify'](new TextEncoder()['encode'](a),h);}catch(k){return console['error']('Signature\x20verification\x20error:',k),![];}}async['toHtml'](a,b={}){const {title:title='WIP\x20Document',theme:theme='light'}=b,{payload:c,meta:d}=a,e=o=>{return o['replace'](/&/g,'&')['replace'](/</g,'<')['replace'](/>/g,'>')['replace'](/"/g,'"')['replace'](/'/g,''');},f=(o,p)=>{switch(p){case'html':return o;case'markdown':return o['replace'](/\*\*(.+?)\*\*/g,'<strong>$1</strong>')['replace'](/\*(.+?)\*/g,'<em>$1</em>')['replace'](/\n/g,'<br>');case'plain':default:return e(o)['replace'](/\n/g,'<br>');}},g=theme==='dark'?'#1a1a1a':'#ffffff',h=theme==='dark'?'#e0e0e0':'#333333',i=theme==='dark'?'#444444':'#e0e0e0',j='#4caf50',k='#ff9800',l=await this['verify'](a),m=l['valid']?'<span\x20style=\x22background:\x20'+j+';\x20color:\x20white;\x20padding:\x204px\x208px;\x20border-radius:\x204px;\x20font-size:\x2012px;\x22>✓\x20Verified</span>':'<span\x20style=\x22background:\x20'+k+';\x20color:\x20white;\x20padding:\x204px\x208px;\x20border-radius:\x204px;\x20font-size:\x2012px;\x22>⚠\x20Tampered</span>',n=c['media']['map'](o=>'\x0a\x09\x09\x09\x09<div\x20style=\x22margin:\x2016px\x200;\x20border:\x201px\x20solid\x20'+i+';\x20border-radius:\x208px;\x20overflow:\x20hidden;\x22>\x0a\x09\x09\x09\x09\x09<img\x20src=\x22data:'+o['type']+';base64,'+o['data']+'\x22\x20\x0a\x09\x09\x09\x09\x09\x20\x20\x20\x20\x20style=\x22max-width:\x20100%;\x20height:\x20auto;\x20display:\x20block;\x22\x20\x0a\x09\x09\x09\x09\x09\x20\x20\x20\x20\x20alt=\x22'+e(o['filename']||o['id'])+'\x22\x20/>\x0a\x09\x09\x09\x09\x09'+(o['filename']?'<div\x20style=\x22padding:\x208px;\x20font-size:\x2012px;\x20color:\x20#666;\x20background:\x20'+(theme==='dark'?'#2a2a2a':'#f5f5f5')+';\x20border-top:\x201px\x20solid\x20'+i+';\x22>'+e(o['filename'])+'</div>':'')+'\x0a\x09\x09\x09\x09</div>\x0a\x09\x09\x09')['join']('');return'<!DOCTYPE\x20html>\x0a<html\x20lang=\x22en\x22>\x0a<head>\x0a\x20\x20\x20\x20<meta\x20charset=\x22UTF-8\x22>\x0a\x20\x20\x20\x20<meta\x20name=\x22viewport\x22\x20content=\x22width=device-width,\x20initial-scale=1.0\x22>\x0a\x20\x20\x20\x20<title>'+e(title)+'</title>\x0a</head>\x0a<body\x20style=\x22margin:\x200;\x20padding:\x2020px;\x20font-family:\x20-apple-system,\x20BlinkMacSystemFont,\x20\x27Segoe\x20UI\x27,\x20Roboto,\x20sans-serif;\x20background:\x20'+g+';\x20color:\x20'+h+';\x20line-height:\x201.6;\x22>\x0a\x20\x20\x20\x20<div\x20style=\x22max-width:\x20800px;\x20margin:\x200\x20auto;\x20background:\x20'+(theme==='dark'?'#252525':'#ffffff')+';\x20border-radius:\x2012px;\x20box-shadow:\x200\x202px\x208px\x20rgba(0,0,0,0.1);\x20overflow:\x20hidden;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22padding:\x2020px\x2024px;\x20border-bottom:\x201px\x20solid\x20'+i+';\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22display:\x20flex;\x20justify-content:\x20space-between;\x20align-items:\x20center;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<h1\x20style=\x22margin:\x200;\x20font-size:\x2020px;\x20font-weight:\x20600;\x22>'+e(title)+'</h1>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22font-size:\x2012px;\x20color:\x20#666;\x20margin-top:\x204px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WIP\x20v'+d['version']+'\x20•\x20'+new Date(d['created'])['toLocaleString']()+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+m+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22font-size:\x2011px;\x20color:\x20#999;\x20margin-top:\x2012px;\x20padding:\x208px;\x20background:\x20'+(theme==='dark'?'#2a2a2a':'#f5f5f5')+';\x20border-radius:\x204px;\x20font-style:\x20italic;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Important\x20Note:\x20This\x20page\x20is\x20for\x20document\x20browsing\x20and\x20verification\x20reference\x20only.\x20Please\x20verify\x20the\x20document\x20integrity\x20through\x20the\x20API\x20using\x20the\x20WIP\x20file.\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+(l['signatures']&&l['signatures']['length']>0x0?'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22margin-top:\x2012px;\x20padding:\x208px;\x20background:\x20'+(theme==='dark'?'#2a3f2a':'#e8f5e9')+';\x20border-radius:\x204px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22font-size:\x2011px;\x20color:\x20'+(theme==='dark'?'#81c784':'#2e7d32')+';\x20margin-bottom:\x204px;\x22>✓\x20Signature\x20Verification\x20('+l['signatures']['length']+'\x20signature'+(l['signatures']['length']>0x1?'s':'')+')</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+l['signatures']['map']((o,p)=>'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22font-size:\x2010px;\x20color:\x20'+h+';\x20margin-left:\x208px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+(p+0x1)+'.\x20'+(o['address']?e(o['address']['slice'](0x0,0x14))+'...':'Unknown')+':\x20'+(o['valid']?'<span\x20style=\x22color:\x20#4caf50;\x22>✓\x20Valid</span>':'<span\x20style=\x22color:\x20#f44336;\x22>✗\x20Invalid</span>')+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20')['join']('')+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20':'')+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22padding:\x2024px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22font-size:\x2016px;\x20line-height:\x201.8;\x20margin-bottom:\x2024px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+f(c['content']['text'],c['content']['format'])+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+n+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22padding:\x2016px\x2024px;\x20background:\x20'+(theme==='dark'?'#2a2a2a':'#f8f9fa')+';\x20border-top:\x201px\x20solid\x20'+i+';\x20font-size:\x2011px;\x20color:\x20#666;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22display:\x20flex;\x20justify-content:\x20space-between;\x20align-items:\x20center;\x20flex-wrap:\x20wrap;\x20gap:\x208px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<strong>Hash:</strong>\x20<code\x20style=\x22background:\x20'+(theme==='dark'?'#333':'#e9ecef')+';\x20padding:\x202px\x206px;\x20border-radius:\x203px;\x22>'+e(d['hash'])+'</code>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+(l['valid']?'Content\x20integrity\x20verified':'Verification\x20failed:\x20'+e(l['error']||'Unknown\x20error'))+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20</div>\x0a</body>\x0a</html>';}['stringify'](a,b=!![]){return b?JSON['stringify'](a,null,0x2):JSON['stringify'](a);}['parse'](a){try{const b=JSON['parse'](a);if(!b['wip']||!b['payload']||!b['meta'])throw new WipValidationError('Invalid\x20WIP\x20file\x20structure');return b;}catch(c){if(c instanceof WipError)throw c;throw new WipValidationError('Failed\x20to\x20parse\x20WIP\x20file:\x20'+c);}}async['load'](a){const b=await this['resourceLoader']['load'](a),c=new TextDecoder()['decode'](b);return this['parse'](c);}['getHash'](a){const b=a['meta']['hash'];if(b['includes'](':'))return b['split'](':')[0x1];return b;}['extractImages'](a,b){!a180a['existsSync'](b)&&a180a['mkdirSync'](b,{'recursive':!![]});const c=[];for(const d of a['payload']['media']){const e=getExtensionFromMimeType(d['type']),f=d['filename']||d['id']+'.'+e,g=a180b['join'](b,f),h=Buffer['from'](base64ToUint8Array(d['data']));a180a['writeFileSync'](g,h),c['push'](g);}return c;}['save'](a,b,c=!![]){const d=a180b['dirname'](b);!a180a['existsSync'](d)&&a180a['mkdirSync'](d,{'recursive':!![]}),a180a['writeFileSync'](b,this['stringify'](a,c),'utf-8');}['getLimits'](){return{...this['limits']};}['setLimits'](a){this['limits']={...this['limits'],...a},this['resourceLoader']=new ResourceLoader(this['limits']['maxImageSize']);}}export async function createWip(a,b){const c=new WIP(b);return c['create'](a);}export async function verifyWip(a,b){if(b!==undefined){const e=a['meta']['hash']['toLowerCase']()['replace'](/^sha256:/,''),f=b['toLowerCase']()['replace'](/^sha256:/,'');if(e!==f)return{'valid':![],'error':'Hash\x20mismatch'};}const c=new WIP(),d=await c['verify'](a);return{'valid':d['valid'],'error':d['error']};}export async function wipToHtml(a,b){const c=new WIP();return c['toHtml'](a,b);}export async function loadWip(a,b){const c=new WIP(b);return c['load'](a);}export async function generate_wip(a,b){const c=new WIP(DEFAULT_LIMITS);let d=await c['create']({'text':a['markdown_text'],'textFormat':'markdown','images':a['images']});if(a['account']){const {Account:e}=await import('./account.js'),f=await e['Instance']()['get_address'](a['account']);if(!f)throw new WipValidationError('Account\x20not\x20found:\x20'+a['account']);const {signature:g,...h}=d['meta'],i=computeHash(canonicalizeJson(h)),j=await e['Instance']()['sign'](f,i),k=await e['Instance']()['get'](f);if(!k||!k['pubkey'])throw new WipValidationError('Cannot\x20get\x20public\x20key\x20for\x20account:\x20'+f);let l;if(k['pubkey']['startsWith']('0x')){const p=Buffer['from'](k['pubkey']['slice'](0x2),'hex');if(p['length']===0x382)l=p['slice'](0x1)['toString']('base64');else{if(p['length']===0x381)l=p['toString']('base64');else throw new WipValidationError('Invalid\x20public\x20key\x20length:\x20'+p['length']+',\x20expected\x20897\x20or\x20898\x20bytes');}}else l=k['pubkey'];const m=Buffer['from'](j['slice'](0x2),'hex')['toString']('base64'),n={'value':m,'publicKey':l,'algorithm':'Falcon512','address':f};let o;d['meta']['signature']?o=Array['isArray'](d['meta']['signature'])?[...d['meta']['signature'],n]:[d['meta']['signature'],n]:o=[n],d={...d,'meta':{...d['meta'],'signature':o}};}return c['save'](d,b,!![]),b;}export async function verify_wip(a,b,c){const d=new WIP();let e;try{e=await d['load'](a);}catch(k){return{'valid':![],'error':'Failed\x20to\x20load\x20WIP\x20file:\x20'+k,'hashValid':![],'hasSignature':![]};}if(!e['wip']||!e['payload']||!e['meta'])return{'valid':![],'error':'Invalid\x20WIP\x20file\x20structure','hashValid':![],'hasSignature':![]};if(e['meta']['type']!=='wip')return{'valid':![],'error':'Invalid\x20meta.type:\x20'+e['meta']['type'],'hashValid':![],'hasSignature':!!e['meta']['signature']};if(b!==undefined){const l=e['meta']['hash']['toLowerCase']()['replace'](/^sha256:/,''),m=b['toLowerCase']()['replace'](/^sha256:/,'');if(l!==m)return{'valid':![],'error':'Hash\x20mismatch','hashValid':![],'hasSignature':!!e['meta']['signature']};}if(c&&!e['meta']['signature'])return{'valid':![],'error':'Signature\x20required\x20but\x20WIP\x20file\x20has\x20no\x20signature','hashValid':!![],'hasSignature':![]};const f={'wip':e['wip'],'payload':e['payload']},g=computeHash(canonicalizeJson(f)),h=g===e['meta']['hash'];if(!h)return{'valid':![],'error':'Hash\x20mismatch\x20-\x20content\x20has\x20been\x20tampered','hashValid':![],'hasSignature':!!e['meta']['signature']};let i;const j=[];if(e['meta']['signature']){const {signature:n,...o}=e['meta'],p=computeHash(canonicalizeJson(o)),q=Array['isArray'](e['meta']['signature'])?e['meta']['signature']:[e['meta']['signature']];let r=!![];for(const s of q){const t=await d['verifySignature'](p,s['value'],s['publicKey'],s['algorithm']);let u;try{const {Falcon512PublicKey:v}=await import('../../keypairs/falcon512/publickey.js'),w=new v(s['publicKey']);u=w['toWAddress']();}catch{}j['push']({'publicKey':s['publicKey'],'address':u,'valid':t}),!t&&(r=![]);}i=r;if(!i){const x=j['filter'](y=>!y['valid']&&y['address'])['map'](y=>y['address']);return{'valid':![],'error':'Signatures\x20from\x20the\x20following\x20addresses\x20are\x20invalid:\x20'+x['join'](',\x20'),'hashValid':!![],'signatureValid':![],'hasSignature':!![],'signatures':j};}}return{'valid':!![],'hashValid':!![],'signatureValid':i,'hasSignature':!!e['meta']['signature'],'signatures':j['length']>0x0?j:undefined};}export async function sign_wip(a,b,c){const d=new WIP(),e=await d['load'](a);if(!e['wip']||!e['payload']||!e['meta'])throw new WipValidationError('Invalid\x20WIP\x20file\x20structure');if(e['meta']['type']!=='wip')throw new WipValidationError('Invalid\x20meta.type:\x20'+e['meta']['type']);const {Account:f}=await import('./account.js'),g=await f['Instance']()['get_address'](b);if(!g)throw new WipValidationError('Account\x20not\x20found:\x20'+b);const {signature:h,...i}=e['meta'],j=computeHash(canonicalizeJson(i)),k=await f['Instance']()['signData'](g,j);let l;const m=k['publicKey'];if(m['startsWith']('0x')){const r=Buffer['from'](m['slice'](0x2),'hex');if(r['length']===0x382)l=r['slice'](0x1)['toString']('base64');else{if(r['length']===0x381)l=r['toString']('base64');else throw new WipValidationError('Invalid\x20public\x20key\x20length:\x20'+r['length']+',\x20expected\x20897\x20or\x20898\x20bytes');}}else l=m;const n={'value':Buffer['from'](k['signature']['slice'](0x2),'hex')['toString']('base64'),'publicKey':l,'algorithm':'Falcon512','address':k['address']};let o;if(e['meta']['signature']){const s=Array['isArray'](e['meta']['signature'])?[...e['meta']['signature']]:[e['meta']['signature']],t=s['findIndex'](u=>u['publicKey']===l);t>=0x0?(s[t]=n,o=s):o=[...s,n];}else o=[n];const p={...e,'meta':{...e['meta'],'signature':o}};let q;if(c)q=c;else{const u=a180b['dirname'](a),v=a180b['extname'](a),w=a180b['basename'](a,v);q=a180b['join'](u,'signed_'+w+v);}return d['save'](p,q,!![]),q;}export async function wip2html(a,b={}){const c=await import('fs'),d=await import('path'),e=c['statSync'](a);if(e['isFile']()){const f=new WIP(),g=await f['load'](a),h=await f['toHtml'](g,b);if(b['outputPath'])return c['writeFileSync'](b['outputPath'],h),b['outputPath'];const i=d['dirname'](a),j=d['extname'](a),k=d['basename'](a,j),l=d['join'](i,k+'.html');return c['writeFileSync'](l,h),l;}else{if(e['isDirectory']()){const m=c['readdirSync'](a),n=m['filter'](q=>q['endsWith']('.wip'));if(n['length']===0x0)throw new WipValidationError('No\x20.wip\x20files\x20found\x20in\x20directory:\x20'+a);const o=[],p=new WIP();for(const q of n){const r=d['join'](a,q),s=await p['load'](r),t=await p['toHtml'](s,b),u=q['replace']('.wip','.html'),v=b['outputPath']?d['join'](b['outputPath'],u):d['join'](a,u),w=d['dirname'](v);!c['existsSync'](w)&&c['mkdirSync'](w,{'recursive':!![]}),c['writeFileSync'](v,t),o['push'](v);}return o;}else throw new WipValidationError('Invalid\x20path:\x20'+a);}}export default WIP;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
export declare function hashSha256(data: Uint8Array): Uint8Array;
|
|
2
|
-
export declare function hashMessage(data: string): string;
|
|
3
|
-
export declare function hashPlaintext(plaintext: string, clientTimestamp: number, guardAddress?: string, passportAddress?: string, lastReceivedLeafIndex?: number): string;
|
|
4
|
-
export declare function generateNonce(): string;
|
|
5
|
-
export declare function bytesToBase64(bytes: Uint8Array): string;
|
|
6
|
-
export declare function base64ToBytes(base64: string): Uint8Array;
|
|
7
|
-
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
8
|
-
export declare function hexToBytes(hex: string): Uint8Array;
|
|
9
|
-
export declare function arrayBufferToUint8Array(buf: ArrayBuffer): Uint8Array;
|
|
10
|
-
export declare function uint8ArrayToArrayBuffer(arr: Uint8Array): ArrayBuffer;
|
|
11
|
-
export declare function bufferEqual(a: ArrayBufferLike, b: ArrayBufferLike): boolean;
|
|
12
|
-
export declare function calculateMerkleLeafHash(plaintextHash: string, serverTimestamp: number): string;
|
|
13
|
-
export declare function merkleHash(left: string, right: string): string;
|
|
14
|
-
export declare function computeNewRoot(prevRoot: string, leafHash: string, leafIndex: number): string;
|
|
15
|
-
export declare function verifyMerkleProof(leafHash: string, proof: {
|
|
16
|
-
root: string;
|
|
17
|
-
siblings: string[];
|
|
18
|
-
indices: number[];
|
|
19
|
-
}): boolean;
|
|
20
|
-
export interface MerkleChainValidationResult {
|
|
21
|
-
valid: boolean;
|
|
22
|
-
error?: string;
|
|
23
|
-
expectedRoot?: string;
|
|
24
|
-
actualRoot?: string;
|
|
25
|
-
}
|
|
26
|
-
export declare function verifyMerkleChain(messages: Array<{
|
|
27
|
-
leafIndex: number;
|
|
28
|
-
prevRoot: string;
|
|
29
|
-
newRoot: string;
|
|
30
|
-
plaintextHash: string;
|
|
31
|
-
serverTimestamp: number;
|
|
32
|
-
}>, initialRoot?: string): MerkleChainValidationResult;
|
|
33
|
-
export declare function verifySingleMerkleRoot(prevRoot: string, newRoot: string, plaintextHash: string, serverTimestamp: number, leafIndex: number): MerkleChainValidationResult;
|
|
34
|
-
export interface MessageVerificationResult {
|
|
35
|
-
valid: boolean;
|
|
36
|
-
error?: string;
|
|
37
|
-
failedCheck?: "merkle" | "plaintext";
|
|
38
|
-
}
|
|
39
|
-
export interface MessageVerificationParams {
|
|
40
|
-
messageId: string;
|
|
41
|
-
plaintext: string;
|
|
42
|
-
plaintextHash: string;
|
|
43
|
-
createdAt: number;
|
|
44
|
-
guardAddress?: string;
|
|
45
|
-
passportAddress?: string;
|
|
46
|
-
lastReceivedLeafIndex?: number;
|
|
47
|
-
serverSignature?: string;
|
|
48
|
-
serverPublicKey?: string;
|
|
49
|
-
merkleMetadata?: {
|
|
50
|
-
prevRoot?: string;
|
|
51
|
-
newRoot: string;
|
|
52
|
-
timestamp?: number;
|
|
53
|
-
serverTimestamp?: number;
|
|
54
|
-
leafIndex: number;
|
|
55
|
-
proofSiblings?: string[];
|
|
56
|
-
proofIndices?: number[];
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
export declare function verifyMessage(params: MessageVerificationParams): MessageVerificationResult;
|
|
60
|
-
export declare function verifyFalcon512Signature(publicKeyHex: string, message: string, signatureHex: string): boolean;
|
|
61
|
-
export interface WtsMessageVerificationParams {
|
|
62
|
-
id: string;
|
|
63
|
-
from: string;
|
|
64
|
-
to: string;
|
|
65
|
-
plaintextHash: string;
|
|
66
|
-
clientTimestamp: number;
|
|
67
|
-
timestamp: number;
|
|
68
|
-
leafIndex: number;
|
|
69
|
-
merkleRoot: string;
|
|
70
|
-
prevRoot?: string;
|
|
71
|
-
serverSignature?: string;
|
|
72
|
-
serverPublicKey?: string;
|
|
73
|
-
guardAddress?: string;
|
|
74
|
-
passportAddress?: string;
|
|
75
|
-
lastReceivedLeafIndex?: number;
|
|
76
|
-
plaintext?: string;
|
|
77
|
-
merkleProof?: {
|
|
78
|
-
siblings: string[];
|
|
79
|
-
indices: number[];
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
export interface WtsVerificationResult {
|
|
83
|
-
valid: boolean;
|
|
84
|
-
error?: string;
|
|
85
|
-
failedMessageIndex?: number;
|
|
86
|
-
failedCheck?: "plaintext" | "merkle" | "chain";
|
|
87
|
-
}
|
|
88
|
-
export declare function verifyWtsMessages(messages: WtsMessageVerificationParams[]): WtsVerificationResult;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{falcon512padded}from'@noble/post-quantum/falcon.js';import{sha256}from'@noble/hashes/sha256';import{randomBytes}from'@noble/hashes/utils';function verifyFalcon512(a,b,c){try{return falcon512padded['verify'](c,b,a);}catch{return![];}}export function hashSha256(a){return sha256(a);}export function hashMessage(a){const b=sha256(new TextEncoder()['encode'](a));return bytesToHex(b);}export function hashPlaintext(a,b,c,d,e){let f=a;e!==undefined&&e>=0x0&&(f+=e['toString']());f+=b['toString']();c&&(f+=c);d&&(f+=d);const g=sha256(new TextEncoder()['encode'](f));return'0x'+bytesToHex(g);}export function generateNonce(){return bytesToHex(randomBytes(0x10));}export function bytesToBase64(a){return Buffer['from'](a)['toString']('base64');}export function base64ToBytes(a){return new Uint8Array(Buffer['from'](a,'base64'));}export function bytesToHex(a){return Buffer['from'](a)['toString']('hex');}export function hexToBytes(a){return new Uint8Array(Buffer['from'](a,'hex'));}export function arrayBufferToUint8Array(a){return new Uint8Array(a);}export function uint8ArrayToArrayBuffer(a){const b=a['buffer']['slice'](a['byteOffset'],a['byteOffset']+a['byteLength']);return b;}export function bufferEqual(c,d){if(c['byteLength']!==d['byteLength'])return![];const e=new Uint8Array(c),f=new Uint8Array(d);for(let g=0x0;g<e['length'];g++){if(e[g]!==f[g])return![];}return!![];}export function calculateMerkleLeafHash(a,b){const c=new TextEncoder()['encode'](a),d=new ArrayBuffer(0x8),e=new DataView(d);e['setBigUint64'](0x0,BigInt(b),!![]);const f=new Uint8Array(d),g=new Uint8Array(c['length']+f['length']);g['set'](c),g['set'](f,c['length']);const h=sha256(g);return'0x'+bytesToHex(h);}export function merkleHash(a,b){const c=hexToBytes(a['replace'](/^0x/,'')),d=hexToBytes(b['replace'](/^0x/,'')),e=new Uint8Array(c['length']+d['length']);return e['set'](c),e['set'](d,c['length']),'0x'+bytesToHex(sha256(e));}export function computeNewRoot(a,b,c){const d=new TextEncoder()['encode'](a),e=new TextEncoder()['encode'](b),f=new ArrayBuffer(0x4),g=new DataView(f);g['setUint32'](0x0,c,!![]);const h=new Uint8Array(f),i=new Uint8Array(d['length']+e['length']+h['length']);return i['set'](d),i['set'](e,d['length']),i['set'](h,d['length']+e['length']),'0x'+bytesToHex(sha256(i));}export function verifyMerkleProof(a,b){let c=a;for(let d=0x0;d<b['siblings']['length'];d++){b['indices'][d]===0x0?c=merkleHash(c,b['siblings'][d]):c=merkleHash(b['siblings'][d],c);}return c===b['root'];}export function verifyMerkleChain(a,b){if(a['length']===0x0)return{'valid':!![]};const c=[...a]['sort']((f,g)=>f['leafIndex']-g['leafIndex']),d=b||'0x'+'0'['repeat'](0x40);let e=d;for(const f of c){if(f['prevRoot']['toLowerCase']()!==e['toLowerCase']())return{'valid':![],'error':'Root\x20chain\x20broken\x20at\x20leafIndex\x20'+f['leafIndex']+':\x20expected\x20prevRoot\x20'+e+',\x20got\x20'+f['prevRoot'],'expectedRoot':e,'actualRoot':f['prevRoot']};const g=verifySingleMerkleRoot(f['prevRoot'],f['newRoot'],f['plaintextHash'],f['serverTimestamp'],f['leafIndex']);if(!g['valid'])return{'valid':![],'error':g['error']+'\x20at\x20leafIndex\x20'+f['leafIndex'],'expectedRoot':g['expectedRoot'],'actualRoot':g['actualRoot']};e=f['newRoot'];}return{'valid':!![]};}export function verifySingleMerkleRoot(a,b,c,d,e){if(!a)return{'valid':![],'error':'Missing\x20prevRoot'};if(!b)return{'valid':![],'error':'Missing\x20newRoot'};if(!c)return{'valid':![],'error':'Missing\x20plaintextHash'};if(d===undefined||d===null)return{'valid':![],'error':'Missing\x20serverTimestamp'};if(e===undefined||e===null)return{'valid':![],'error':'Missing\x20leafIndex'};const f=calculateMerkleLeafHash(c,d),g=computeNewRoot(a,f,e);if(g['toLowerCase']()!==b['toLowerCase']())return{'valid':![],'error':'Root\x20computation\x20mismatch:\x20expected\x20'+g+',\x20got\x20'+b,'expectedRoot':g,'actualRoot':b};return{'valid':!![]};}export function verifyMessage(a){const {messageId:b,plaintext:c,plaintextHash:d,createdAt:e,guardAddress:f,passportAddress:g,lastReceivedLeafIndex:h,serverSignature:i,serverPublicKey:j,merkleMetadata:k}=a,l=hashPlaintext(c,e,f,g,h),m=n=>{return n['toLowerCase']()['replace'](/^0x/,'');};if(m(l)!==m(d))return{'valid':![],'error':'Plaintext\x20hash\x20mismatch\x20for\x20message\x20'+b+':\x20expected\x20'+d+',\x20got\x20'+l,'failedCheck':'plaintext'};if(k){if(k['proofSiblings']&&k['proofIndices']){const p=calculateMerkleLeafHash(d,k['serverTimestamp']),q=verifyMerkleProof(p,{'root':k['newRoot'],'siblings':k['proofSiblings'],'indices':k['proofIndices']});if(!q)return{'valid':![],'error':'Merkle\x20proof\x20verification\x20failed\x20for\x20message\x20'+b,'failedCheck':'merkle'};}const n=k['serverTimestamp'];if(!n)return{'valid':![],'error':'Missing\x20server\x20timestamp\x20for\x20Merkle\x20root\x20verification\x20in\x20message\x20'+b,'failedCheck':'merkle'};if(!k['prevRoot'])return{'valid':![],'error':'Missing\x20prevRoot\x20for\x20Merkle\x20root\x20verification\x20in\x20message\x20'+b,'failedCheck':'merkle'};const o=verifySingleMerkleRoot(k['prevRoot'],k['newRoot'],d,n,k['leafIndex']);if(!o['valid'])return{'valid':![],'error':'Merkle\x20root\x20verification\x20failed\x20for\x20message\x20'+b+':\x20'+o['error'],'failedCheck':'merkle'};}if(i&&j){const r=k?.['serverTimestamp'];if(!r)return{'valid':![],'error':'Missing\x20server\x20timestamp\x20for\x20signature\x20verification\x20in\x20message\x20'+b,'failedCheck':'merkle'};if(!k?.['newRoot'])return{'valid':![],'error':'Missing\x20newRoot\x20for\x20signature\x20verification\x20in\x20message\x20'+b,'failedCheck':'merkle'};if(!k?.['prevRoot'])return{'valid':![],'error':'Missing\x20prevRoot\x20for\x20signature\x20verification\x20in\x20message\x20'+b,'failedCheck':'merkle'};const s=k['prevRoot']+':'+k['newRoot']+':'+r+':'+j,t=verifyFalcon512Signature(j,s,i);if(!t)return{'valid':![],'error':'Server\x20signature\x20verification\x20failed\x20for\x20message\x20'+b,'failedCheck':'merkle'};}return{'valid':!![]};}export function verifyFalcon512Signature(a,b,c){try{const d=hexToBytes(a['replace']('0x','')),e=hexToBytes(c['replace']('0x','')),f=new TextEncoder()['encode'](b);return verifyFalcon512(d,f,e);}catch{return![];}}export function verifyWtsMessages(a){if(a['length']===0x0)return{'valid':!![]};const b=[...a]['sort']((d,e)=>d['leafIndex']-e['leafIndex']);for(let d=0x0;d<b['length'];d++){const e=b[d];if(e['plaintext']!=null){const f=hashPlaintext(e['plaintext']||'',e['clientTimestamp'],e['guardAddress'],e['passportAddress'],e['lastReceivedLeafIndex']);if(f['toLowerCase']()!==e['plaintextHash']['toLowerCase']())return{'valid':![],'error':'Plaintext\x20hash\x20mismatch\x20for\x20message\x20'+e['id']+'\x20at\x20index\x20'+d,'failedMessageIndex':d,'failedCheck':'plaintext'};}if(e['merkleProof']){const g=calculateMerkleLeafHash(e['plaintextHash'],e['timestamp']),h=verifyMerkleProof(g,{'root':e['merkleRoot'],'siblings':e['merkleProof']['siblings'],'indices':e['merkleProof']['indices']});if(!h)return{'valid':![],'error':'Merkle\x20proof\x20verification\x20failed\x20for\x20message\x20'+e['id']+'\x20at\x20index\x20'+d,'failedMessageIndex':d,'failedCheck':'merkle'};}if(e['serverSignature']&&e['serverPublicKey']){if(!e['merkleRoot'])return{'valid':![],'error':'Missing\x20merkleRoot\x20for\x20message\x20'+e['id']+'\x20at\x20index\x20'+d,'failedMessageIndex':d,'failedCheck':'merkle'};if(!e['timestamp'])return{'valid':![],'error':'Missing\x20timestamp\x20for\x20message\x20'+e['id']+'\x20at\x20index\x20'+d,'failedMessageIndex':d,'failedCheck':'merkle'};if(!e['prevRoot'])return{'valid':![],'error':'Missing\x20prevRoot\x20for\x20message\x20'+e['id']+'\x20at\x20index\x20'+d,'failedMessageIndex':d,'failedCheck':'merkle'};const j=e['prevRoot']+':'+e['merkleRoot']+':'+e['timestamp']+':'+e['serverPublicKey'],k=verifyFalcon512Signature(e['serverPublicKey'],j,e['serverSignature']);if(!k)return{'valid':![],'error':'Server\x20signature\x20verification\x20failed\x20for\x20message\x20'+e['id']+'\x20at\x20index\x20'+d,'failedMessageIndex':d,'failedCheck':'merkle'};}}const c=verifyMerkleChain(b['map'](l=>({'leafIndex':l['leafIndex'],'prevRoot':l['merkleRoot'],'newRoot':l['merkleRoot'],'plaintextHash':l['plaintextHash'],'serverTimestamp':l['timestamp']})));if(!c['valid'])return{'valid':![],'error':c['error'],'failedCheck':'chain'};return{'valid':!![]};}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { MessengerManager } from "./messenger-manager.js";
|
|
2
|
-
export { Messenger } from "./messenger.js";
|
|
3
|
-
export * from "./messenger-api.js";
|
|
4
|
-
export type { Message, MessageFilter, ConversationsFilter, SendMessageResult, DecryptedMessage, MessengerConfig, MessageListResult, ConversationInfo, WtsGenerationParams, WtsFileResult, MessageContentType, } from "./types.js";
|
|
5
|
-
export { MessageType, MessageDirection, MessageStatus, MessengerErrorCode, DEFAULT_MESSENGER_CONFIG, MessengerError, DEFAULT_QUERY_LIMIT, MAX_QUERY_LIMIT, } from "./types.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{MessengerManager}from'./messenger-manager.js';export{Messenger}from'./messenger.js';export*from'./messenger-api.js';export{MessageType,MessageDirection,MessageStatus,MessengerErrorCode,DEFAULT_MESSENGER_CONFIG,MessengerError,DEFAULT_QUERY_LIMIT,MAX_QUERY_LIMIT}from'./types.js';
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import type { ConversationInfo, ConversationsFilter, Message, MessageFilter, SendMessageResult, WtsFileResult, WtsGenerationParams, WtsToHtmlOptions, WtsVerificationResult, ListOperationResponse, GetSettingsResponse } from "./types.js";
|
|
2
|
-
import { MessengerManager } from "./messenger-manager.js";
|
|
3
|
-
import type { ENTRYPOINT } from "../../client/network.js";
|
|
4
|
-
import type { AccountOrMark_Address, ManyAccountOrMark_Address } from "../local/index.js";
|
|
5
|
-
export declare function getMessengerManager(): MessengerManager;
|
|
6
|
-
export declare function watch_conversations(filter?: ConversationsFilter): Promise<ConversationInfo[]>;
|
|
7
|
-
export declare function mark_messages_as_viewed(messageIds: string[], account?: string): Promise<number>;
|
|
8
|
-
export declare function mark_conversation_as_viewed(peerAddress: string | AccountOrMark_Address, account?: string): Promise<number>;
|
|
9
|
-
export declare function send_message(from: string | undefined | null, to: AccountOrMark_Address, content: string, options?: {
|
|
10
|
-
guardAddress?: string;
|
|
11
|
-
passportAddress?: string;
|
|
12
|
-
force?: boolean;
|
|
13
|
-
new_messenger_name?: string;
|
|
14
|
-
}): Promise<SendMessageResult>;
|
|
15
|
-
export declare function send_file(from: string | undefined | null, to: AccountOrMark_Address, filePath: string, options?: {
|
|
16
|
-
fileName?: string;
|
|
17
|
-
contentType?: "wts" | "wip" | "zip";
|
|
18
|
-
guardAddress?: string;
|
|
19
|
-
passportAddress?: string;
|
|
20
|
-
force?: boolean;
|
|
21
|
-
new_messenger_name?: string;
|
|
22
|
-
}): Promise<SendMessageResult>;
|
|
23
|
-
export declare function watch_messages(filter?: MessageFilter): Promise<Message[]>;
|
|
24
|
-
export declare function pull_messages(account?: string | undefined | null, limit?: number): Promise<Message[]>;
|
|
25
|
-
export declare function extract_zip_messages(account: string | undefined | null, messages: (Message | string)[], outputDir: string): Promise<string[]>;
|
|
26
|
-
export declare function generate_wts(params: WtsGenerationParams): Promise<WtsFileResult>;
|
|
27
|
-
export declare function verify_wts(wtsFilePath: string): Promise<WtsVerificationResult>;
|
|
28
|
-
export declare function sign_wts(wtsFilePath: string, account: string | undefined | null, outputPath?: string): Promise<string>;
|
|
29
|
-
export declare function wts2html(wtsPath: string, options?: WtsToHtmlOptions): Promise<string | string[]>;
|
|
30
|
-
export declare function proof_message(account: string | undefined | null, messageId: string, network: ENTRYPOINT): Promise<{
|
|
31
|
-
proofAddress: string;
|
|
32
|
-
}>;
|
|
33
|
-
export type BlacklistRequest = {
|
|
34
|
-
op: "add" | "remove";
|
|
35
|
-
account: string | undefined | null;
|
|
36
|
-
users: ManyAccountOrMark_Address;
|
|
37
|
-
} | {
|
|
38
|
-
op: "clear";
|
|
39
|
-
account: string | undefined | null;
|
|
40
|
-
} | {
|
|
41
|
-
op: "get";
|
|
42
|
-
account: string | undefined | null;
|
|
43
|
-
} | {
|
|
44
|
-
op: "exist";
|
|
45
|
-
account: string | undefined | null;
|
|
46
|
-
users: ManyAccountOrMark_Address;
|
|
47
|
-
};
|
|
48
|
-
export type BlacklistResponse = {
|
|
49
|
-
op: "add";
|
|
50
|
-
result: ListOperationResponse;
|
|
51
|
-
} | {
|
|
52
|
-
op: "remove";
|
|
53
|
-
result: ListOperationResponse;
|
|
54
|
-
} | {
|
|
55
|
-
op: "clear";
|
|
56
|
-
result: ListOperationResponse;
|
|
57
|
-
} | {
|
|
58
|
-
op: "get";
|
|
59
|
-
result: string[];
|
|
60
|
-
} | {
|
|
61
|
-
op: "exist";
|
|
62
|
-
result: ListOperationResponse;
|
|
63
|
-
};
|
|
64
|
-
export declare function blacklist(request: BlacklistRequest): Promise<BlacklistResponse>;
|
|
65
|
-
export type FriendslistRequest = {
|
|
66
|
-
op: "add" | "remove";
|
|
67
|
-
account: string | undefined | null;
|
|
68
|
-
users: ManyAccountOrMark_Address;
|
|
69
|
-
} | {
|
|
70
|
-
op: "clear";
|
|
71
|
-
account: string | undefined | null;
|
|
72
|
-
} | {
|
|
73
|
-
op: "get";
|
|
74
|
-
account: string | undefined | null;
|
|
75
|
-
} | {
|
|
76
|
-
op: "exist";
|
|
77
|
-
account: string | undefined | null;
|
|
78
|
-
users: ManyAccountOrMark_Address;
|
|
79
|
-
};
|
|
80
|
-
export type FriendslistResponse = {
|
|
81
|
-
op: "add";
|
|
82
|
-
result: ListOperationResponse;
|
|
83
|
-
} | {
|
|
84
|
-
op: "remove";
|
|
85
|
-
result: ListOperationResponse;
|
|
86
|
-
} | {
|
|
87
|
-
op: "clear";
|
|
88
|
-
result: ListOperationResponse;
|
|
89
|
-
} | {
|
|
90
|
-
op: "get";
|
|
91
|
-
result: string[];
|
|
92
|
-
} | {
|
|
93
|
-
op: "exist";
|
|
94
|
-
result: ListOperationResponse;
|
|
95
|
-
};
|
|
96
|
-
export declare function friendslist(request: FriendslistRequest): Promise<FriendslistResponse>;
|
|
97
|
-
export interface GuardParam {
|
|
98
|
-
guard: string;
|
|
99
|
-
passportValiditySeconds: number;
|
|
100
|
-
}
|
|
101
|
-
export type GuardlistRequest = {
|
|
102
|
-
op: "add";
|
|
103
|
-
account: string | undefined | null;
|
|
104
|
-
guards: GuardParam[];
|
|
105
|
-
} | {
|
|
106
|
-
op: "remove";
|
|
107
|
-
account: string | undefined | null;
|
|
108
|
-
guards: string[];
|
|
109
|
-
} | {
|
|
110
|
-
op: "get";
|
|
111
|
-
account: string | undefined | null;
|
|
112
|
-
};
|
|
113
|
-
export type GuardlistResponse = {
|
|
114
|
-
op: "add";
|
|
115
|
-
result: ListOperationResponse;
|
|
116
|
-
} | {
|
|
117
|
-
op: "remove";
|
|
118
|
-
result: ListOperationResponse;
|
|
119
|
-
} | {
|
|
120
|
-
op: "get";
|
|
121
|
-
result: ListOperationResponse;
|
|
122
|
-
};
|
|
123
|
-
export declare function guardlist(request: GuardlistRequest): Promise<GuardlistResponse>;
|
|
124
|
-
export type SettingsRequest = {
|
|
125
|
-
op: "get";
|
|
126
|
-
account: string | undefined | null;
|
|
127
|
-
} | {
|
|
128
|
-
op: "set";
|
|
129
|
-
account: string | undefined | null;
|
|
130
|
-
allowStrangerMessages?: boolean;
|
|
131
|
-
maxInboxSize?: number;
|
|
132
|
-
};
|
|
133
|
-
export type SettingsResponse = {
|
|
134
|
-
op: "get";
|
|
135
|
-
result: GetSettingsResponse;
|
|
136
|
-
} | {
|
|
137
|
-
op: "set";
|
|
138
|
-
result: boolean;
|
|
139
|
-
};
|
|
140
|
-
export declare function settings(request: SettingsRequest): Promise<SettingsResponse>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{MessengerManager}from'./messenger-manager.js';import{Account}from'../local/account.js';import{W_ERROR,WErrors}from'../exception.js';import{LocalMark}from'../local/local.js';import{MessageStorage}from'./storage.js';import{MessengerError,MessengerErrorCode,CHAIN_PROOF_TYPE,MessageDirection}from'./types.js';import{createHash}from'crypto';import*as a183a from'fs';import*as a183b from'path';import{isValidU64}from'../common.js';import{verifySingleMerkleRoot,hashPlaintext,verifyFalcon512Signature}from'./crypto.js';import{canonicalizeJson}from'./utils.js';import{generateHtmlPage,getThemeColors}from'./templates/wts-html-template.js';import{GetAccountOrMark_Address,GetManyAccountOrMark_Address}from'../local/index.js';import{query_objects}from'../query/object.js';import{Messenger}from'./messenger.js';let managerInstance=null,isInitialized=![],startPromise=null,backgroundTimer=null;async function autoRegisterMessengerAccounts(){const a=await Account['Instance']()['list_messenger_accounts']();for(const b of a){if(!b['address']||!b['m'])continue;try{const c=new Messenger(b['address']);await c['initialize']();}catch(d){console['error']('Failed\x20to\x20initialize\x20account\x20'+b['address']+':',d);}}}export function getMessengerManager(){return!managerInstance&&(managerInstance=new MessengerManager()),!isInitialized&&(isInitialized=!![],startPromise=autoRegisterMessengerAccounts()['then'](()=>{return managerInstance['start']();})['catch'](a=>{return console['error']('Failed\x20to\x20auto-register\x20messenger\x20accounts:',a),managerInstance['start']();})['catch'](a=>{console['error']('Failed\x20to\x20auto-start\x20messenger\x20manager:',a);})),managerInstance;}function registerCleanupHandler(){const a=()=>{backgroundTimer&&(clearInterval(backgroundTimer),backgroundTimer=null),managerInstance&&managerInstance['stop']();};process['on']('exit',a),process['on']('SIGINT',()=>{a(),process['exit']();}),process['on']('SIGTERM',()=>{a(),process['exit']();});}registerCleanupHandler();export async function watch_conversations(a){const b=await Account['Instance']()['get_address'](a?.['account']);!b&&W_ERROR(WErrors['AccountNotFound'],'watch_conversations.account\x20'+a?.['account']);const c=b['toLowerCase'](),d=getMessengerManager();startPromise&&await startPromise;const e=await d['ensureAccountReady'](b);await e['messenger']['pullMessages']();const f=new MessageStorage(c),g=f['getAllMessages'](c),h=new Map(),i=a?.['previewMessageCount']??0x2,j=a?.['skipAutoMarkViewed']??![];for(const n of g){const o=n['fromAddress']['toLowerCase']()===c?n['toAddress']:n['fromAddress'];!h['has'](o)&&h['set'](o,{'peerAddress':o,'lastMessageAt':n['createdAt'],'messageCount':0x0,'unreadCount':0x0,'lastMessagePreview':n['plaintext'],'messages':[]});const p=h['get'](o);p['messages']['push'](n),p['messageCount']++,n['createdAt']>p['lastMessageAt']&&(p['lastMessageAt']=n['createdAt'],p['lastMessagePreview']=n['plaintext']),n['direction']===MessageDirection['RECEIVED']&&n['viewedAt']===undefined&&p['unreadCount']++;}const k=[];for(const [,q]of h){if(a?.['startTime']!==undefined&&q['lastMessageAt']<a['startTime'])continue;if(a?.['endTime']!==undefined&&q['lastMessageAt']>a['endTime'])continue;if(a?.['unreadOnly']&&q['unreadCount']===0x0)continue;const r=[];if(i>0x0){const s=q['messages']['sort']((u,v)=>v['createdAt']-u['createdAt']),t=s['slice'](0x0,i);r['push'](...t['reverse']());if(!j){const u=t['filter'](v=>v['direction']===MessageDirection['RECEIVED']&&v['viewedAt']===undefined)['map'](v=>v['messageId']);u['length']>0x0&&f['updateMessagesViewed'](u);}}k['push']({'peerAddress':q['peerAddress'],'lastMessageAt':q['lastMessageAt'],'messageCount':q['messageCount'],'unreadCount':q['unreadCount'],'lastMessagePreview':q['lastMessagePreview'],...i>0x0&&{'previewMessages':r}});}const l=a?.['sortBy']??'lastMessageAt',m=a?.['sortOrder']??'desc';return k['sort']((v,w)=>{let x=0x0;switch(l){case'lastMessageAt':x=v['lastMessageAt']-w['lastMessageAt'];break;case'unreadCount':x=v['unreadCount']-w['unreadCount'];break;case'messageCount':x=v['messageCount']-w['messageCount'];break;}return m==='asc'?x:-x;}),k;}export async function mark_messages_as_viewed(a,b){if(!a||a['length']===0x0)return 0x0;const c=await Account['Instance']()['get_address'](b);!c&&W_ERROR(WErrors['AccountNotFound'],'mark_messages_as_viewed.account\x20'+b);const d=c['toLowerCase'](),e=new MessageStorage(d);return e['updateMessagesViewed'](a);}export async function mark_conversation_as_viewed(a,b){const c=await Account['Instance']()['get_address'](b);!c&&W_ERROR(WErrors['AccountNotFound'],'mark_conversation_as_viewed.account\x20'+b);const d=c['toLowerCase'](),e=await GetAccountOrMark_Address(a);!e&&W_ERROR(WErrors['AccountNotFound'],'mark_conversation_as_viewed.peerAddress\x20'+a+'\x20is\x20not\x20a\x20valid\x20account/address');const f=e['toLowerCase'](),g=new MessageStorage(d),h=g['getMessagesBySession'](d,f),i=h['filter'](j=>j['direction']===MessageDirection['RECEIVED']&&j['viewedAt']===undefined)['map'](j=>j['messageId']);if(i['length']===0x0)return 0x0;return g['updateMessagesViewed'](i);}export async function send_message(a,b,c,d){const e=await Account['Instance']()['get_address'](a);!e&&W_ERROR(WErrors['AccountNotFound'],'send_message.from\x20'+a);const f=await GetAccountOrMark_Address(b);!f&&W_ERROR(WErrors['AccountNotFound'],'send_message.to\x20'+b+'\x20is\x20not\x20a\x20valid\x20account/address');d?.['guardAddress']!=null&&d?.['passportAddress']!=null&&([d['guardAddress'],d['passportAddress']]=await LocalMark['Instance']()['get_many_address']([d['guardAddress'],d['passportAddress']]),(!d['guardAddress']||!d['passportAddress'])&&W_ERROR(WErrors['AccountNotFound'],'send_message.guardAddress\x20or\x20passportAddress\x20not\x20found'));const g=getMessengerManager();return startPromise&&await startPromise,g['send'](e,f,c,d);}export async function send_file(a,b,c,d){const e=await Account['Instance']()['get_address'](a);!e&&W_ERROR(WErrors['AccountNotFound'],'send_file.from\x20'+a);const f=await GetAccountOrMark_Address(b);!f&&W_ERROR(WErrors['AccountNotFound'],'send_file.to\x20'+b+'\x20is\x20not\x20a\x20valid\x20account/address');d?.['guardAddress']!=null&&d?.['passportAddress']!=null&&([d['guardAddress'],d['passportAddress']]=await LocalMark['Instance']()['get_many_address']([d['guardAddress'],d['passportAddress']]),(!d['guardAddress']||!d['passportAddress'])&&W_ERROR(WErrors['AccountNotFound'],'send_file.guardAddress\x20or\x20passportAddress\x20not\x20found'));const g=getMessengerManager();return startPromise&&await startPromise,g['send_file'](e,f,c,d);}export async function watch_messages(a){a?.['account']!==undefined&&(a['account']=await Account['Instance']()['get_address'](a['account']),!a['account']&&W_ERROR(WErrors['AccountNotFound'],'watch_messages.account\x20'+a['account']));a?.['customListFilter']?.['includeAddresses']!=null&&(a['customListFilter']['includeAddresses']=(await Account['Instance']()['get_many_address'](a['customListFilter']['includeAddresses']))['filter'](e=>e!=null));a?.['customListFilter']?.['excludeAddresses']!=null&&(a['customListFilter']['excludeAddresses']=(await Account['Instance']()['get_many_address'](a['customListFilter']['excludeAddresses']))['filter'](e=>e!=null));const b=getMessengerManager();startPromise&&await startPromise;const c=await b['watch'](a),d=a?.['skipAutoMarkViewed']??![];if(!d&&c['length']>0x0&&a?.['account']){const e=a['account']['toLowerCase'](),f=new MessageStorage(e),g=c['filter'](h=>h['direction']===MessageDirection['RECEIVED']&&h['viewedAt']===undefined)['map'](h=>h['messageId']);g['length']>0x0&&f['updateMessagesViewed'](g);}return c;}export async function pull_messages(a,b){const c=await Account['Instance']()['get_address'](a);!c&&W_ERROR(WErrors['AccountNotFound'],'pull_messages.account\x20'+a);const d=getMessengerManager();startPromise&&await startPromise;const e=await d['ensureAccountReady'](c),f=await e['messenger']['pullMessages'](b);return f['messages']['map'](g=>g);}async function extract_zip_message(a,b){if(!a['zipMetadata'])throw new MessengerError(MessengerErrorCode['INVALID_MESSAGE_TYPE'],'Message\x20is\x20not\x20a\x20ZIP\x20archive');if(!a['plaintext'])throw new MessengerError(MessengerErrorCode['MESSAGE_NOT_DECRYPTED'],'Message\x20plaintext\x20not\x20available');const c=a['plaintext'],d=Buffer['from'](c,'base64');if(a['zipMetadata']?.['fileHash']){const k=createHash('sha256')['update'](d)['digest']('hex'),l=a['zipMetadata']['fileHash']['replace']('0x','');if(k!==l)throw new MessengerError(MessengerErrorCode['HASH_MISMATCH'],'ZIP\x20file\x20hash\x20mismatch:\x20expected\x20'+l+',\x20got\x20'+k);}const {ZipReader:e,BlobReader:f,BlobWriter:g}=await import('@zip.js/zip.js'),h=new e(new f(new Blob([d]))),i=await h['getEntries']();!a183a['existsSync'](b)&&a183a['mkdirSync'](b,{'recursive':!![]});const j=[];for(const m of i){if(!m['directory']){const n=m,o=new g(),p=await n['getData'](o),q=Buffer['from'](await p['arrayBuffer']()),r=a183b['join'](b,m['filename']);a183a['writeFileSync'](r,q),j['push'](r);}}await h['close']();if(j['length']>0x0&&a['zipMetadata']){const s={'fileName':a['zipMetadata']['fileName'],'fileSize':a['zipMetadata']['fileSize'],'fileHash':a['zipMetadata']['fileHash'],'contentType':a['zipMetadata']['contentType'],'localCachePath':j[0x0],'downloadedAt':Date['now']()};a['zipMetadata']=s;const t=a['direction']==='sent'?a['fromAddress']:a['toAddress'],u=new MessageStorage(t);u['saveMessage'](a);}return j[0x0]||'';}export async function extract_zip_messages(a,b,c){const d=[],f=await Account['Instance']()['get_address'](a);if(!f)throw new MessengerError(MessengerErrorCode['INVALID_INPUT'],'account\x20is\x20required\x20when\x20extracting\x20by\x20message\x20IDs');for(const g of b){try{let h;if(typeof g==='string'){const j=g,k=new MessageStorage(f),l=k['getMessageById'](j);if(!l){console['error']('Message\x20not\x20found:\x20'+j);continue;}h=l;}else h=g;if(!h['zipMetadata']){console['error']('Message\x20'+h['messageId']+'\x20is\x20not\x20a\x20ZIP\x20archive');continue;}const i=await extract_zip_message(h,c);d['push'](i);}catch(m){const n=typeof g==='string'?g:g['messageId'];console['error']('Failed\x20to\x20extract\x20message\x20'+n+':',m);}}return d;}export async function generate_wts(a){const b=await Account['Instance']()['get_address'](a['myAccount']);!b&&W_ERROR(WErrors['AccountNotFound'],'generate_wts.myAccount\x20'+a['myAccount']);const c=await GetAccountOrMark_Address(a['peerAccount']);return!c&&W_ERROR(WErrors['AccountNotFound'],'generate_wts.peerAccount\x20'+a['peerAccount']),getMessengerManager()['generate_wts'](a['outputDir'],b,c,a['range'],a['excludePlaintext']);}function load_wts(a){const b=a183a['readFileSync'](a,'utf-8');return JSON['parse'](b);}function save_wts(a,b){const c=a183b['dirname'](b);!a183a['existsSync'](c)&&a183a['mkdirSync'](c,{'recursive':!![]}),a183a['writeFileSync'](b,JSON['stringify'](a,null,0x2),'utf-8');}function resolveServerPublicKey(a,b){if(b['serverPublicKeys']&&a['serverPublicKeyIndex']!==undefined&&a['serverPublicKeyIndex']>=0x0&&a['serverPublicKeyIndex']<b['serverPublicKeys']['length'])return b['serverPublicKeys'][a['serverPublicKeyIndex']]['publicKey'];const c=a;if(c['serverPublicKey'])return c['serverPublicKey'];return null;}export async function verify_wts(a){try{const b=load_wts(a);if(!b['payload']||!b['meta'])return{'valid':![],'error':'Invalid\x20WTS\x20file\x20structure'};if(b['meta']['type']!=='wts')return{'valid':![],'error':'Invalid\x20meta.type:\x20'+b['meta']['type']};const {payload:c,meta:d}=b,e=[...c['messages']]['sort']((n,o)=>{if(n['leafIndex']===undefined||o['leafIndex']===undefined)return 0x0;return n['leafIndex']-o['leafIndex'];});for(let n=0x0;n<e['length'];n++){const o=e[n];if(!o)return{'valid':![],'error':'Message\x20'+n+':\x20Message\x20is\x20null\x20or\x20undefined'};if(!o['prevRoot'])return{'valid':![],'error':'Message\x20'+n+':\x20Missing\x20prevRoot'};if(!o['merkleRoot'])return{'valid':![],'error':'Message\x20'+n+':\x20Missing\x20merkleRoot'};if(!o['plaintextHash'])return{'valid':![],'error':'Message\x20'+n+':\x20Missing\x20plaintextHash'};if(o['timestamp']===undefined||o['timestamp']===null)return{'valid':![],'error':'Message\x20'+n+':\x20Missing\x20timestamp'};if(o['leafIndex']===undefined||o['leafIndex']===null)return{'valid':![],'error':'Message\x20'+n+':\x20Missing\x20leafIndex'};const p=verifySingleMerkleRoot(o['prevRoot'],o['merkleRoot'],o['plaintextHash'],o['timestamp'],o['leafIndex']);if(!p['valid'])return{'valid':![],'error':p['error']+'\x20at\x20message\x20'+n+',\x20leafIndex\x20'+o['leafIndex']};if(n>0x0){const q=e[n-0x1];if(o['leafIndex']!==q['leafIndex']+0x1)return{'valid':![],'error':'Merkle\x20chain\x20discontinuity:\x20leafIndex\x20'+q['leafIndex']+'\x20->\x20'+o['leafIndex']+'\x20(expected\x20'+(q['leafIndex']+0x1)+')'};if(o['prevRoot']['toLowerCase']()!==q['merkleRoot']['toLowerCase']())return{'valid':![],'error':'Merkle\x20root\x20mismatch\x20at\x20leafIndex\x20'+o['leafIndex']+':\x20expected\x20prevRoot='+q['merkleRoot']+',\x20got\x20'+o['prevRoot']};}}for(let r=0x0;r<c['messages']['length'];r++){const s=c['messages'][r];if(!s)return{'valid':![],'error':'Message\x20'+r+':\x20Message\x20is\x20null\x20or\x20undefined'};const t=!!s['zipMetadata'];if(!t){if(!s['plaintextHash']['startsWith']('0x')||s['plaintextHash']['length']!==0x42)return{'valid':![],'error':'Message\x20'+r+':\x20Invalid\x20plaintextHash\x20format'};if(s['plaintext']){const v=hashPlaintext(s['plaintext'],s['clientTimestamp'],s['guardAddress'],s['passportAddress'],s['lastReceivedLeafIndex']);if(v['toLowerCase']()!==s['plaintextHash']['toLowerCase']())return{'valid':![],'error':'Message\x20'+r+':\x20Plaintext\x20hash\x20mismatch'};}}const u=resolveServerPublicKey(s,d);if(s['serverSignature']&&u){if(!s['timestamp'])return{'valid':![],'error':'Message\x20'+r+':\x20Missing\x20timestamp\x20for\x20signature\x20verification'};if(!s['merkleRoot'])return{'valid':![],'error':'Message\x20'+r+':\x20Missing\x20merkleRoot\x20for\x20signature\x20verification'};if(!s['prevRoot'])return{'valid':![],'error':'Message\x20'+r+':\x20Missing\x20prevRoot\x20for\x20signature\x20verification'};const w=s['prevRoot']+':'+s['merkleRoot']+':'+s['timestamp']+':'+u,x=verifyFalcon512Signature(u,w,s['serverSignature']);if(!x)return{'valid':![],'error':'Message\x20'+r+':\x20Server\x20signature\x20verification\x20failed'};}}const {sha256:f}=await import('@noble/hashes/sha256'),{bytesToHex:g}=await import('@noble/hashes/utils'),h={'wts':b['wts'],...c},j=g(f(new TextEncoder()['encode'](canonicalizeJson(h))));if(j!==d['hash'])return{'valid':![],'error':'Hash\x20mismatch\x20-\x20content\x20has\x20been\x20tampered','hashValid':![],'hasSignature':!!d['signature']};if(d['messageCount']!==c['messages']['length'])return{'valid':![],'error':'messageCount\x20mismatch:\x20meta='+d['messageCount']+',\x20actual='+c['messages']['length'],'hashValid':!![],'hasSignature':!!d['signature']};const k=c['messages'][c['messages']['length']-0x1];if(d['merkleRoot']['toLowerCase']()!==k['merkleRoot']['toLowerCase']())return{'valid':![],'error':'merkleRoot\x20mismatch:\x20meta='+d['merkleRoot']+',\x20lastMessage='+k['merkleRoot'],'hashValid':!![],'hasSignature':!!d['signature']};const l=[];let m;if(d['signature']){const {Falcon512PublicKey:y}=await import('../../keypairs/falcon512/publickey.js'),{signature:z,...A}=d,B=g(f(new TextEncoder()['encode'](canonicalizeJson(A)))),C=Array['isArray'](d['signature'])?d['signature']:[d['signature']];let D=!![];for(const E of C){let F;const G=E['publicKey'];if(G['startsWith']('0x')){const H=Buffer['from'](G['slice'](0x2),'hex');if(H['length']===0x382)F=H['slice'](0x1);else{if(H['length']===0x381)F=H;else{let I;try{const J=new y(G['slice'](0x2));I=J['toWAddress']();}catch{}l['push']({'publicKey':G,'address':I,'valid':![]}),D=![];continue;}}}else try{const K=Buffer['from'](G,'base64');if(K['length']===0x382)F=K['slice'](0x1);else{if(K['length']===0x381)F=K;else{let L;try{const M=new y(G);L=M['toWAddress']();}catch{}l['push']({'publicKey':G,'address':L,'valid':![]}),D=![];continue;}}}catch{F=Buffer['from'](G,'base64');}try{const N=new y(F),O=Uint8Array['from'](Buffer['from'](E['value'],'base64')),P=await N['verify'](new TextEncoder()['encode'](B),O);let Q;try{Q=N['toWAddress']();}catch{}l['push']({'publicKey':G,'address':Q,'valid':P}),!P&&(D=![]);}catch{let R;try{const S=new y(F);R=S['toWAddress']();}catch{}l['push']({'publicKey':G,'address':R,'valid':![]}),D=![];}}m=D;if(!m){const T=l['filter'](U=>!U['valid']&&U['address'])['map'](U=>U['address']);return{'valid':![],'error':'Signatures\x20from\x20the\x20following\x20addresses\x20are\x20invalid:\x20'+T['join'](',\x20'),'hashValid':!![],'hasSignature':!![],'signatureValid':![],'signatures':l};}}return{'valid':!![],'hashValid':!![],'hasSignature':!!d['signature'],'signatureValid':m,'signatures':l['length']>0x0?l:undefined};}catch(U){return{'valid':![],'error':'Verification\x20error:\x20'+U,'hashValid':![],'hasSignature':![]};}}export async function sign_wts(a,b,c){const d=await verify_wts(a);if(!d['valid'])throw new MessengerError(MessengerErrorCode['INVALID_INPUT'],'WTS\x20file\x20verification\x20failed:\x20'+d['error']);const e=load_wts(a),f=await Account['Instance']()['get_address'](b);!f&&W_ERROR(WErrors['AccountNotFound'],'sign_wts.account\x20'+b);const {sha256:g}=await import('@noble/hashes/sha256'),{bytesToHex:h}=await import('@noble/hashes/utils'),{signature:i,...j}=e['meta'],k=h(g(new TextEncoder()['encode'](canonicalizeJson(j)))),l=await Account['Instance']()['signData'](f,k);let m;const n=l['publicKey'];if(n['startsWith']('0x')){const s=Buffer['from'](n['slice'](0x2),'hex');if(s['length']===0x382)m=s['slice'](0x1)['toString']('base64');else{if(s['length']===0x381)m=s['toString']('base64');else throw new MessengerError(MessengerErrorCode['INVALID_INPUT'],'Invalid\x20public\x20key\x20length:\x20'+s['length']+',\x20expected\x20897\x20or\x20898\x20bytes');}}else m=n;const o={'value':Buffer['from'](l['signature']['slice'](0x2),'hex')['toString']('base64'),'publicKey':m,'algorithm':'Falcon512','address':l['address']};let p;if(e['meta']['signature']){const t=Array['isArray'](e['meta']['signature'])?[...e['meta']['signature']]:[e['meta']['signature']],u=t['findIndex'](v=>v['publicKey']===m);u>=0x0?(t[u]=o,p=t):p=[...t,o];}else p=[o];const q={...e,'meta':{...e['meta'],'signature':p}};let r;if(c)r=c;else{const v=a183b['dirname'](a),w=a183b['extname'](a),x=a183b['basename'](a,w);r=a183b['join'](v,'signed_'+x+w);}return save_wts(q,r),r;}export async function wts2html(a,b={}){const c=await import('fs'),d=await import('path'),e=c['statSync'](a);if(e['isDirectory']()){const g=c['readdirSync'](a),h=g['filter'](j=>j['endsWith']('.wts'));if(h['length']===0x0)throw new MessengerError(MessengerErrorCode['INVALID_INPUT'],'No\x20.wts\x20files\x20found\x20in\x20directory:\x20'+a);const i=[];for(const j of h){const k=d['join'](a,j),l=await convertWtsToHtml(k,b),m=j['replace']('.wts','.html'),n=b['outputPath']?d['join'](b['outputPath'],m):d['join'](a,m),o=d['dirname'](n);!c['existsSync'](o)&&c['mkdirSync'](o,{'recursive':!![]}),c['writeFileSync'](n,l,'utf-8'),i['push'](n);}return i;}const f=await convertWtsToHtml(a,b);if(b['outputPath']){const p=d['basename'](a)['replace']('.wts','.html'),q=d['join'](b['outputPath'],p),r=d['dirname'](q);return!c['existsSync'](r)&&c['mkdirSync'](r,{'recursive':!![]}),c['writeFileSync'](q,f,'utf-8'),q;}return f;}async function convertWtsToHtml(a,b={}){const {title:title='WTS\x20Document',theme:theme='light'}=b,c=await verify_wts(a),d=load_wts(a),{payload:e,meta:f}=d,{bgColor:g,textColor:h,borderColor:i}=getThemeColors(theme),j=f['creator'];let k=-0x1;for(const l of e['messages']){l['to']['toLowerCase']()===j['toLowerCase']()&&(l['lastReceivedLeafIndex']!==undefined&&l['lastReceivedLeafIndex']>=0x0&&(l['lastReceivedLeafIndex']>k&&(k=l['lastReceivedLeafIndex'])));}return generateHtmlPage({'title':title,'theme':theme,'bgColor':g,'textColor':h,'borderColor':i,'meta':f,'payload':e,'verifyResult':c,'maxLastReceivedLeafIndex':k,'myAddress':j});}export async function proof_message(a,b,c){const d=await Account['Instance']()['get_address'](a);!d&&W_ERROR(WErrors['AccountNotFound'],'proof_message.account\x20'+a);const e=new MessageStorage(d),f=e['getMessageById'](b);if(!f)throw new MessengerError(MessengerErrorCode['INVALID_INPUT'],'Message\x20not\x20found:\x20'+b);if(f['fromAddress']['toLowerCase']()!==d['toLowerCase']()&&f['toAddress']['toLowerCase']()!==d['toLowerCase']())throw new MessengerError(MessengerErrorCode['INVALID_INPUT'],'Message\x20does\x20not\x20belong\x20to\x20account\x20'+d);if(!f['serverSignature'])throw new MessengerError(MessengerErrorCode['INVALID_PROOF'],'Message\x20does\x20not\x20have\x20server\x20signature');if(!f['serverPublicKey'])throw new MessengerError(MessengerErrorCode['INVALID_PROOF'],'Message\x20does\x20not\x20have\x20server\x20public\x20key');if(!f['plaintext'])throw new MessengerError(MessengerErrorCode['INVALID_PROOF'],'Message\x20does\x20not\x20have\x20plaintext');const {verifyMessage:g}=await import('./crypto.js'),h={'messageId':f['messageId'],'plaintext':f['plaintext'],'plaintextHash':f['plaintextHash'],'createdAt':f['createdAt'],'guardAddress':f['guardAddress'],'passportAddress':f['passportAddress'],'lastReceivedLeafIndex':f['lastReceivedLeafIndex'],'serverSignature':f['serverSignature'],'serverPublicKey':f['serverPublicKey']};if(f['newRoot']&&f['leafIndex']!==undefined){if(!f['serverTimestamp'])throw new MessengerError(MessengerErrorCode['INVALID_PROOF'],'Message\x20'+f['messageId']+'\x20missing\x20server\x20timestamp\x20for\x20verification');h['merkleMetadata']={'newRoot':f['newRoot'],'prevRoot':f['prevRoot'],'leafIndex':f['leafIndex'],'serverTimestamp':f['serverTimestamp']};}const i=g(h);if(!i['valid'])throw new MessengerError(MessengerErrorCode['INVALID_PROOF'],'Message\x20verification\x20failed:\x20'+i['error']);if(!f['serverPublicKey'])throw new MessengerError(MessengerErrorCode['INVALID_PROOF'],'Message\x20does\x20not\x20have\x20server\x20public\x20key');const {CallProof:j}=await import('../call/proof.js'),k=new j({'proof':f['newRoot'],'server_pubkey':f['serverPublicKey'],'server_signature':f['serverSignature'],'proof_type':CHAIN_PROOF_TYPE,'description':'Message\x20proof\x20for\x20'+b,'item_count':f['leafIndex']??0x1,'about_address':f['fromAddress']['toLowerCase']()===d['toLowerCase']()?f['toAddress']:f['fromAddress']}),l={'network':c,'account':d},m=await k['call'](l),{ResponseData:n}=await import('../call/base.js'),o=n(m),p=o['find'](q=>q['type']==='Proof');if(!p||!p['object'])throw new MessengerError(MessengerErrorCode['INVALID_PROOF'],'Failed\x20to\x20get\x20proof\x20address\x20from\x20transaction\x20result');return f['proof']=p['object'],e['saveMessage'](f),{'proofAddress':p['object']};}const MIN_PASSPORT_VALIDITY=0xa,MAX_PASSPORT_VALIDITY=0xa*0x16d*0x18*0x3c*0x3c,MAX_BLACKLIST_SIZE_ONCE=0x64,MAX_FRIENDS_SIZE_ONCE=0x64,MAX_GUARDS_SIZE_ONCE=0xa;export async function blacklist(a){const b=await Account['Instance']()['get_address'](a['account']);!b&&W_ERROR(WErrors['AccountNotFound'],'blacklist.account\x20'+a['account']);const c=getMessengerManager();startPromise&&await startPromise;await c['ensureAccountReady'](b);switch(a['op']){case'add':{let d=await GetManyAccountOrMark_Address(a['users']);d['length']===0x0&&W_ERROR(WErrors['InvalidParam'],'blacklist.add.users\x20'+a['users']+'\x20have\x20not\x20valid\x20addresses');d=[...new Set(d['map'](f=>f['toLowerCase']()))];d['length']>MAX_BLACKLIST_SIZE_ONCE&&W_ERROR(WErrors['InvalidParam'],'blacklist.add.users\x20'+a['users']+'\x20have\x20too\x20many\x20addresses,\x20max\x20'+MAX_BLACKLIST_SIZE_ONCE);const e=await c['addToBlacklist'](b,d);return{'op':'add','result':e};}case'remove':{let f=await GetManyAccountOrMark_Address(a['users']);f['length']===0x0&&W_ERROR(WErrors['InvalidParam'],'blacklist.remove.users\x20'+a['users']+'\x20have\x20not\x20valid\x20addresses');f=[...new Set(f['map'](h=>h['toLowerCase']()))];f['length']>MAX_BLACKLIST_SIZE_ONCE&&W_ERROR(WErrors['InvalidParam'],'blacklist.remove.users\x20'+a['users']+'\x20have\x20too\x20many\x20addresses,\x20max\x20'+MAX_BLACKLIST_SIZE_ONCE);const g=await c['removeFromBlacklist'](b,f);return{'op':'remove','result':g};}case'clear':{const h=await c['clearBlacklist'](b);return{'op':'clear','result':h};}case'get':{const i=await c['getBlacklist'](b);return{'op':'get','result':i};}case'exist':{let j=await GetManyAccountOrMark_Address(a['users']);j['length']===0x0&&W_ERROR(WErrors['InvalidParam'],'blacklist.exist.users\x20'+a['users']+'\x20have\x20not\x20valid\x20addresses');j=[...new Set(j['map'](l=>l['toLowerCase']()))];j['length']>MAX_BLACKLIST_SIZE_ONCE&&W_ERROR(WErrors['InvalidParam'],'blacklist.exist.users\x20'+a['users']+'\x20have\x20too\x20many\x20addresses,\x20max\x20'+MAX_BLACKLIST_SIZE_ONCE);const k=await c['existInBlacklist'](b,j);return{'op':'exist','result':k};}default:throw new MessengerError(MessengerErrorCode['INVALID_INPUT'],'blacklist.unknown\x20op:\x20'+a);}}export async function friendslist(a){const b=await Account['Instance']()['get_address'](a['account']);!b&&W_ERROR(WErrors['AccountNotFound'],'friendslist.account\x20'+a['account']);const c=getMessengerManager();startPromise&&await startPromise;await c['ensureAccountReady'](b);switch(a['op']){case'add':{let d=await GetManyAccountOrMark_Address(a['users']);d['length']===0x0&&W_ERROR(WErrors['InvalidParam'],'friendslist.add.users\x20'+a['users']+'\x20have\x20not\x20valid\x20addresses');d=[...new Set(d['map'](f=>f['toLowerCase']()))];const e=await c['addToFriendsList'](b,d);return{'op':'add','result':e};}case'remove':{let f=await GetManyAccountOrMark_Address(a['users']);f['length']===0x0&&W_ERROR(WErrors['InvalidParam'],'friendslist.remove.users\x20'+a['users']+'\x20have\x20not\x20valid\x20addresses');f=[...new Set(f['map'](h=>h['toLowerCase']()))];f['length']>MAX_FRIENDS_SIZE_ONCE&&W_ERROR(WErrors['InvalidParam'],'friendslist.remove.users\x20'+a['users']+'\x20have\x20too\x20many\x20addresses,\x20max\x20'+MAX_FRIENDS_SIZE_ONCE);const g=await c['removeFromFriendsList'](b,f);return{'op':'remove','result':g};}case'clear':{const h=await c['clearFriendsList'](b);return{'op':'clear','result':h};}case'get':{const i=await c['getFriendsList'](b);return{'op':'get','result':i};}case'exist':{let j=await GetManyAccountOrMark_Address(a['users']);j['length']===0x0&&W_ERROR(WErrors['InvalidParam'],'friendslist.exist.users\x20'+a['users']+'\x20have\x20not\x20valid\x20addresses');j=[...new Set(j['map'](l=>l['toLowerCase']()))];j['length']>MAX_FRIENDS_SIZE_ONCE&&W_ERROR(WErrors['InvalidParam'],'friendslist.exist.users\x20'+a['users']+'\x20have\x20too\x20many\x20addresses,\x20max\x20'+MAX_FRIENDS_SIZE_ONCE);const k=await c['existInFriendsList'](b,j);return{'op':'exist','result':k};}default:throw new MessengerError(MessengerErrorCode['INVALID_INPUT'],'friendslist.unknown\x20op:\x20'+a);}}export async function guardlist(a){const b=await Account['Instance']()['get_address'](a['account']);!b&&W_ERROR(WErrors['AccountNotFound'],'guardlist.account\x20'+a['account']);const c=getMessengerManager();startPromise&&await startPromise;await c['ensureAccountReady'](b);switch(a['op']){case'add':{const d=new Map();for(const k of a['guards']){d['set'](k['guard']['toLowerCase'](),k);}const e=Array['from'](d['values']());e['length']===0x0&&W_ERROR(WErrors['InvalidParam'],'guardlist.add.guards\x20'+a['guards']+'\x20have\x20not\x20valid\x20guards');e['length']>MAX_GUARDS_SIZE_ONCE&&W_ERROR(WErrors['InvalidParam'],'guardlist.add.guards\x20'+a['guards']+'\x20have\x20too\x20many\x20guards,\x20max\x20'+MAX_GUARDS_SIZE_ONCE);for(const l of e){(!isValidU64(l['passportValiditySeconds'])||l['passportValiditySeconds']<MIN_PASSPORT_VALIDITY||l['passportValiditySeconds']>MAX_PASSPORT_VALIDITY)&&W_ERROR(WErrors['InvalidParam'],'Guard\x20'+l['guard']+':\x20passport\x20validity\x20'+l['passportValiditySeconds']+'\x20must\x20be\x20between\x20'+MIN_PASSPORT_VALIDITY+'\x20and\x20'+MAX_PASSPORT_VALIDITY+'\x20seconds');}const f=await LocalMark['Instance']()['get_many_address'](e['map'](m=>m['guard']));if(f['length']!==e['length']){const m=new Set(f),n=[];for(const o of e){!m['has'](o['guard'])&&!o['guard']['startsWith']('0x')&&n['push'](o['guard']);}W_ERROR(WErrors['InvalidParam'],'Guard\x20not\x20found:\x20'+n['join'](',\x20'));}const h=await query_objects({'objects':f,'no_cache':![],'network':c['getConfig']()['network']});(!h||!h['objects']||h['objects']['length']===0x0)&&W_ERROR(WErrors['InvalidParam'],'Guard\x20not\x20found:\x20'+e['map'](p=>p['guard'])['join'](',\x20'));h['objects']['forEach'](p=>{p['type']!=='Guard'&&W_ERROR(WErrors['InvalidParam'],'Guard\x20'+p['object']+'\x20is\x20not\x20a\x20Guard');});const i=e['map']((p,q)=>({'guardAddress':f[q],'passportValiditySeconds':p['passportValiditySeconds']})),j=await c['addToGuardList'](b,i);return{'op':'add','result':j};}case'remove':{const p=[...new Set(a['guards']['map'](s=>s['toLowerCase']()))];p['length']===0x0&&W_ERROR(WErrors['InvalidParam'],'guardlist.remove.guards\x20'+a['guards']+'\x20have\x20not\x20valid\x20guards');p['length']>MAX_GUARDS_SIZE_ONCE&&W_ERROR(WErrors['InvalidParam'],'guardlist.remove.guards\x20'+a['guards']+'\x20have\x20too\x20many\x20guards,\x20max\x20'+MAX_GUARDS_SIZE_ONCE);const q=await LocalMark['Instance']()['get_many_address'](p);if(q['length']!==p['length']){const s=new Set(q),t=[];for(const u of p){!s['has'](u)&&!u['startsWith']('0x')&&t['push'](u);}W_ERROR(WErrors['InvalidParam'],'Guard\x20not\x20found:\x20'+t['join'](',\x20'));}const r=await c['removeFromGuardList'](b,q);return{'op':'remove','result':r};}case'get':{const v=await c['getGuardList'](b);return{'op':'get','result':v};}default:throw new MessengerError(MessengerErrorCode['INVALID_INPUT'],'guardlist.unknown\x20op:\x20'+a);}}export async function settings(a){const b=await Account['Instance']()['get_address'](a['account']);!b&&W_ERROR(WErrors['AccountNotFound'],'settings.account\x20'+a['account']);const c=getMessengerManager();startPromise&&await startPromise;await c['ensureAccountReady'](b);switch(a['op']){case'get':{const d=await c['getSettings'](b);return{'op':'get','result':d};}case'set':{const e={};a['allowStrangerMessages']!==undefined&&(e['allowStrangerMessages']=a['allowStrangerMessages']);a['maxInboxSize']!==undefined&&(e['maxInboxSize']=a['maxInboxSize']);const f=await c['setSettings'](b,e);return{'op':'set','result':f};}default:throw new MessengerError(MessengerErrorCode['INVALID_INPUT'],'settings.unknown\x20op:\x20'+a);}}
|