@mysten/sui 2.39.1 → 3.0.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/CHANGELOG.md +169 -0
- package/README.md +5 -188
- package/dist/bcs/bcs.d.mts +6 -6
- package/dist/bcs/bcs.d.mts.map +1 -1
- package/dist/bcs/bcs.mjs +49 -22
- package/dist/bcs/bcs.mjs.map +1 -1
- package/dist/bcs/effects.mjs +49 -20
- package/dist/bcs/effects.mjs.map +1 -1
- package/dist/bcs/index.d.mts +1441 -624
- package/dist/bcs/index.d.mts.map +1 -1
- package/dist/bcs/index.mjs +2 -1
- package/dist/bcs/index.mjs.map +1 -1
- package/dist/bcs/transactions.d.mts +1059 -0
- package/dist/bcs/transactions.d.mts.map +1 -0
- package/dist/bcs/transactions.mjs +33 -14
- package/dist/bcs/transactions.mjs.map +1 -1
- package/dist/bcs/types.d.mts +6 -1
- package/dist/bcs/types.d.mts.map +1 -1
- package/dist/client/core-resolver.mjs +4 -4
- package/dist/client/core-resolver.mjs.map +1 -1
- package/dist/client/core.d.mts +55 -4
- package/dist/client/core.d.mts.map +1 -1
- package/dist/client/core.mjs +98 -1
- package/dist/client/core.mjs.map +1 -1
- package/dist/client/errors.mjs +11 -1
- package/dist/client/errors.mjs.map +1 -1
- package/dist/client/index.d.mts +5 -3
- package/dist/client/index.mjs +6 -3
- package/dist/client/mvr.d.mts +12 -2
- package/dist/client/mvr.d.mts.map +1 -1
- package/dist/client/mvr.mjs +34 -13
- package/dist/client/mvr.mjs.map +1 -1
- package/dist/client/query-filters.mjs +80 -76
- package/dist/client/query-filters.mjs.map +1 -1
- package/dist/client/stream/adapter.d.mts +102 -0
- package/dist/client/stream/adapter.d.mts.map +1 -0
- package/dist/client/stream/errors.d.mts +14 -0
- package/dist/client/stream/errors.d.mts.map +1 -0
- package/dist/client/stream/errors.mjs +25 -0
- package/dist/client/stream/errors.mjs.map +1 -0
- package/dist/client/stream/filter.mjs +18 -0
- package/dist/client/stream/filter.mjs.map +1 -0
- package/dist/client/stream/follow.mjs +48 -0
- package/dist/client/stream/follow.mjs.map +1 -0
- package/dist/client/stream/index.d.mts +4 -0
- package/dist/client/stream/pager.mjs +123 -0
- package/dist/client/stream/pager.mjs.map +1 -0
- package/dist/client/stream/plan.mjs +79 -0
- package/dist/client/stream/plan.mjs.map +1 -0
- package/dist/client/stream/position.d.mts +30 -0
- package/dist/client/stream/position.d.mts.map +1 -0
- package/dist/client/stream/position.mjs +121 -0
- package/dist/client/stream/position.mjs.map +1 -0
- package/dist/client/stream/run.d.mts +2 -0
- package/dist/client/stream/run.mjs +99 -0
- package/dist/client/stream/run.mjs.map +1 -0
- package/dist/client/stream/session.mjs +205 -0
- package/dist/client/stream/session.mjs.map +1 -0
- package/dist/client/stream/status.mjs +47 -0
- package/dist/client/stream/status.mjs.map +1 -0
- package/dist/client/stream/token.mjs +80 -0
- package/dist/client/stream/token.mjs.map +1 -0
- package/dist/client/transaction-data.d.mts +17 -0
- package/dist/client/transaction-data.d.mts.map +1 -0
- package/dist/client/transaction-data.mjs +472 -0
- package/dist/client/transaction-data.mjs.map +1 -0
- package/dist/client/transaction-resolver.mjs +102 -58
- package/dist/client/transaction-resolver.mjs.map +1 -1
- package/dist/client/types.d.mts +560 -240
- package/dist/client/types.d.mts.map +1 -1
- package/dist/client/utils.d.mts +2 -2
- package/dist/client/utils.d.mts.map +1 -1
- package/dist/client/utils.mjs +91 -30
- package/dist/client/utils.mjs.map +1 -1
- package/dist/cryptography/index.d.mts +1 -1
- package/dist/cryptography/keypair.d.mts +1 -1
- package/dist/cryptography/publickey.d.mts +11 -0
- package/dist/cryptography/publickey.d.mts.map +1 -1
- package/dist/cryptography/publickey.mjs +12 -1
- package/dist/cryptography/publickey.mjs.map +1 -1
- package/dist/cryptography/signature.d.mts +8 -8
- package/dist/cryptography/signature.mjs +18 -7
- package/dist/cryptography/signature.mjs.map +1 -1
- package/dist/graphql/client.d.mts +51 -35
- package/dist/graphql/client.d.mts.map +1 -1
- package/dist/graphql/client.mjs +125 -69
- package/dist/graphql/client.mjs.map +1 -1
- package/dist/graphql/core.d.mts +14 -9
- package/dist/graphql/core.d.mts.map +1 -1
- package/dist/graphql/core.mjs +294 -118
- package/dist/graphql/core.mjs.map +1 -1
- package/dist/graphql/errors.d.mts +20 -0
- package/dist/graphql/errors.d.mts.map +1 -0
- package/dist/graphql/errors.mjs +19 -0
- package/dist/graphql/errors.mjs.map +1 -0
- package/dist/graphql/filters.mjs +32 -0
- package/dist/graphql/filters.mjs.map +1 -0
- package/dist/graphql/generated/queries.d.mts.map +1 -1
- package/dist/graphql/generated/queries.mjs +1216 -208
- package/dist/graphql/generated/queries.mjs.map +1 -1
- package/dist/graphql/generated/tada-env.d.mts +820 -11
- package/dist/graphql/index.d.mts +2 -1
- package/dist/graphql/index.mjs +2 -1
- package/dist/graphql/sse-parser.mjs +82 -0
- package/dist/graphql/sse-parser.mjs.map +1 -0
- package/dist/graphql/stream/families.mjs +306 -0
- package/dist/graphql/stream/families.mjs.map +1 -0
- package/dist/graphql/stream/index.mjs +38 -0
- package/dist/graphql/stream/index.mjs.map +1 -0
- package/dist/graphql/stream/live.mjs +60 -0
- package/dist/graphql/stream/live.mjs.map +1 -0
- package/dist/graphql/stream/page.mjs +38 -0
- package/dist/graphql/stream/page.mjs.map +1 -0
- package/dist/graphql/stream/query.mjs +47 -0
- package/dist/graphql/stream/query.mjs.map +1 -0
- package/dist/graphql/subscribe.mjs +70 -0
- package/dist/graphql/subscribe.mjs.map +1 -0
- package/dist/grpc/client.d.mts +31 -27
- package/dist/grpc/client.d.mts.map +1 -1
- package/dist/grpc/client.mjs +42 -46
- package/dist/grpc/client.mjs.map +1 -1
- package/dist/grpc/core.d.mts +13 -6
- package/dist/grpc/core.d.mts.map +1 -1
- package/dist/grpc/core.mjs +254 -166
- package/dist/grpc/core.mjs.map +1 -1
- package/dist/grpc/filters.mjs +44 -34
- package/dist/grpc/filters.mjs.map +1 -1
- package/dist/grpc/grpc-web-pull.mjs +245 -0
- package/dist/grpc/grpc-web-pull.mjs.map +1 -0
- package/dist/grpc/index.d.mts +2 -1
- package/dist/grpc/index.mjs +1 -1
- package/dist/grpc/network-error.mjs +31 -0
- package/dist/grpc/network-error.mjs.map +1 -0
- package/dist/grpc/proto/google/rpc/error_details.mjs +306 -0
- package/dist/grpc/proto/google/rpc/error_details.mjs.map +1 -0
- package/dist/grpc/proto/sui/forking/v1alpha/forking_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/error_reason.d.mts +176 -1
- package/dist/grpc/proto/sui/rpc/v2/error_reason.d.mts.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/error_reason.mjs +175 -0
- package/dist/grpc/proto/sui/rpc/v2/error_reason.mjs.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/executed_transaction.d.mts +2 -2
- package/dist/grpc/proto/sui/rpc/v2/ledger_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/ledger_service.d.mts +111 -0
- package/dist/grpc/proto/sui/rpc/v2/ledger_service.d.mts.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/ledger_service.mjs +46 -0
- package/dist/grpc/proto/sui/rpc/v2/ledger_service.mjs.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/move_package_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/move_package_service.d.mts +24 -1
- package/dist/grpc/proto/sui/rpc/v2/move_package_service.d.mts.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/move_package_service.mjs +25 -7
- package/dist/grpc/proto/sui/rpc/v2/move_package_service.mjs.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/name_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/object.mjs +1 -1
- package/dist/grpc/proto/sui/rpc/v2/query_options.d.mts +111 -9
- package/dist/grpc/proto/sui/rpc/v2/query_options.d.mts.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/query_options.mjs +63 -19
- package/dist/grpc/proto/sui/rpc/v2/query_options.mjs.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/signature.d.mts +5 -5
- package/dist/grpc/proto/sui/rpc/v2/signature.mjs.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/signature_scheme.d.mts +5 -1
- package/dist/grpc/proto/sui/rpc/v2/signature_scheme.d.mts.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/signature_scheme.mjs +4 -0
- package/dist/grpc/proto/sui/rpc/v2/signature_scheme.mjs.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.d.mts +20 -1
- package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.d.mts.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.mjs +30 -13
- package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.mjs.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/state_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts +20 -14
- package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.mjs +8 -5
- package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.mjs.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/transaction.d.mts +11 -5
- package/dist/grpc/proto/sui/rpc/v2/transaction.d.mts.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/transaction.mjs +6 -0
- package/dist/grpc/proto/sui/rpc/v2/transaction.mjs.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.d.mts +6 -2
- package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.d.mts.map +1 -1
- package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.mjs.map +1 -1
- package/dist/grpc/proto/types.d.mts +7 -7
- package/dist/grpc/proto/types.mjs +3 -2
- package/dist/grpc/pull-call.d.mts +20 -0
- package/dist/grpc/pull-call.d.mts.map +1 -0
- package/dist/grpc/pull-call.mjs +28 -0
- package/dist/grpc/pull-call.mjs.map +1 -0
- package/dist/grpc/stream/call.mjs +238 -0
- package/dist/grpc/stream/call.mjs.map +1 -0
- package/dist/grpc/stream/families.d.mts +26 -0
- package/dist/grpc/stream/families.d.mts.map +1 -0
- package/dist/grpc/stream/families.mjs +145 -0
- package/dist/grpc/stream/families.mjs.map +1 -0
- package/dist/grpc/stream/index.d.mts +41 -0
- package/dist/grpc/stream/index.d.mts.map +1 -0
- package/dist/grpc/stream/index.mjs +127 -0
- package/dist/grpc/stream/index.mjs.map +1 -0
- package/dist/grpc/stream/live.mjs +31 -0
- package/dist/grpc/stream/live.mjs.map +1 -0
- package/dist/grpc/stream/page.mjs +120 -0
- package/dist/grpc/stream/page.mjs.map +1 -0
- package/dist/grpc/stream-types.d.mts +28 -0
- package/dist/grpc/stream-types.d.mts.map +1 -0
- package/dist/grpc/transport.d.mts +8 -3
- package/dist/grpc/transport.d.mts.map +1 -1
- package/dist/grpc/transport.mjs +88 -45
- package/dist/grpc/transport.mjs.map +1 -1
- package/dist/jsonRpc/index.d.mts +34 -12
- package/dist/jsonRpc/index.d.mts.map +1 -0
- package/dist/jsonRpc/index.mjs +39 -5
- package/dist/jsonRpc/index.mjs.map +1 -0
- package/dist/jsonRpc/types.d.mts +420 -0
- package/dist/jsonRpc/types.d.mts.map +1 -0
- package/dist/keypairs/passkey/keypair.d.mts +1 -1
- package/dist/multisig/publickey.d.mts +12 -4
- package/dist/multisig/publickey.d.mts.map +1 -1
- package/dist/multisig/publickey.mjs +5 -5
- package/dist/multisig/publickey.mjs.map +1 -1
- package/dist/multisig/signer.d.mts +1 -1
- package/dist/transactions/ObjectCache.d.mts +1 -1
- package/dist/transactions/ObjectCache.mjs +5 -5
- package/dist/transactions/ObjectCache.mjs.map +1 -1
- package/dist/transactions/Transaction.d.mts +10 -9
- package/dist/transactions/Transaction.d.mts.map +1 -1
- package/dist/transactions/Transaction.mjs +17 -6
- package/dist/transactions/Transaction.mjs.map +1 -1
- package/dist/transactions/data/internal.d.mts +2 -0
- package/dist/transactions/data/internal.d.mts.map +1 -1
- package/dist/transactions/data/internal.mjs +2 -1
- package/dist/transactions/data/internal.mjs.map +1 -1
- package/dist/transactions/executor/parallel.d.mts +2 -2
- package/dist/transactions/executor/serial.d.mts +1 -1
- package/dist/transactions/executor/serial.mjs +2 -2
- package/dist/transactions/executor/serial.mjs.map +1 -1
- package/dist/transactions/index.d.mts +3 -2
- package/dist/transactions/index.mjs +4 -3
- package/dist/transactions/intents/AllowanceBalance.mjs +1 -1
- package/dist/transactions/intents/CoinWithBalance.mjs +1 -1
- package/dist/transactions/resolve.d.mts +6 -0
- package/dist/transactions/resolve.d.mts.map +1 -1
- package/dist/transactions/resolve.mjs.map +1 -1
- package/dist/transactions/restricted-move-calls.d.mts +25 -0
- package/dist/transactions/restricted-move-calls.d.mts.map +1 -0
- package/dist/transactions/restricted-move-calls.mjs +47 -0
- package/dist/transactions/restricted-move-calls.mjs.map +1 -0
- package/dist/transactions/serializer.d.mts +1 -4
- package/dist/transactions/serializer.d.mts.map +1 -1
- package/dist/transactions/serializer.mjs +1 -44
- package/dist/transactions/serializer.mjs.map +1 -1
- package/dist/transactions/utils.d.mts +0 -1
- package/dist/transactions/utils.d.mts.map +1 -1
- package/dist/transactions/utils.mjs.map +1 -1
- package/dist/utils/abort.mjs +89 -0
- package/dist/utils/abort.mjs.map +1 -0
- package/dist/utils/coin-reservation.mjs +1 -4
- package/dist/utils/coin-reservation.mjs.map +1 -1
- package/dist/utils/index.mjs +1 -1
- package/dist/utils/sui-types.mjs +1 -1
- package/dist/verify/index.d.mts +2 -2
- package/dist/verify/verify.d.mts +74 -24
- package/dist/verify/verify.d.mts.map +1 -1
- package/dist/verify/verify.mjs +128 -42
- package/dist/verify/verify.mjs.map +1 -1
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/dist/zklogin/bcs.d.mts +14 -14
- package/dist/zklogin/publickey.d.mts.map +1 -1
- package/dist/zklogin/publickey.mjs +15 -20
- package/dist/zklogin/publickey.mjs.map +1 -1
- package/docs/bcs.md +2 -2
- package/docs/clients/core.md +19 -18
- package/docs/clients/executing.md +53 -8
- package/docs/clients/graphql.md +81 -11
- package/docs/clients/grpc.md +31 -15
- package/docs/clients/index.md +8 -7
- package/docs/clients/querying.md +134 -30
- package/docs/clients/streaming.md +324 -0
- package/docs/cryptography/index.md +85 -58
- package/docs/llms-index.md +4 -2
- package/docs/migrations/sui-2.0/dapp-kit.md +3 -2
- package/docs/migrations/sui-2.0/json-rpc-migration.md +106 -79
- package/docs/migrations/sui-3.0/index.md +247 -0
- package/docs/plugins.md +10 -10
- package/docs/sdk-building.md +3 -4
- package/docs/transactions/coins-and-balances.md +6 -11
- package/docs/transactions/reference.md +36 -1
- package/package.json +4 -5
- package/src/bcs/bcs.ts +80 -41
- package/src/bcs/effects.ts +61 -25
- package/src/bcs/index.ts +2 -0
- package/src/bcs/transactions.ts +36 -17
- package/src/bcs/types.ts +10 -4
- package/src/client/core-resolver.ts +3 -5
- package/src/client/core.ts +180 -8
- package/src/client/errors.ts +12 -0
- package/src/client/index.ts +4 -2
- package/src/client/mvr.ts +37 -10
- package/src/client/query-filters.ts +151 -97
- package/src/client/stream/adapter.ts +110 -0
- package/src/client/stream/errors.ts +40 -0
- package/src/client/stream/filter.ts +17 -0
- package/src/client/stream/follow.ts +63 -0
- package/src/client/stream/index.ts +9 -0
- package/src/client/stream/pager.ts +158 -0
- package/src/client/stream/plan.ts +147 -0
- package/src/client/stream/position.ts +143 -0
- package/src/client/stream/run.ts +147 -0
- package/src/client/stream/session.ts +259 -0
- package/src/client/stream/status.ts +44 -0
- package/src/client/stream/token.ts +104 -0
- package/src/client/transaction-data.ts +610 -0
- package/src/client/transaction-resolver.ts +158 -69
- package/src/client/types.ts +530 -115
- package/src/client/utils.ts +146 -61
- package/src/cryptography/publickey.ts +12 -1
- package/src/cryptography/signature.ts +6 -3
- package/src/graphql/client.ts +204 -135
- package/src/graphql/core.ts +446 -139
- package/src/graphql/errors.ts +24 -0
- package/src/graphql/filters.ts +48 -0
- package/src/graphql/generated/queries.ts +1455 -277
- package/src/graphql/generated/schema.graphql +282 -9
- package/src/graphql/generated/tada-env.ts +933 -4
- package/src/graphql/queries/checkpoints.graphql +34 -0
- package/src/graphql/queries/getDynamicFields.graphql +1 -0
- package/src/graphql/queries/listEvents.graphql +16 -24
- package/src/graphql/queries/streams.graphql +212 -0
- package/src/graphql/queries/transactions.graphql +71 -28
- package/src/graphql/queries/verifySignature.graphql +17 -0
- package/src/graphql/sse-parser.ts +99 -0
- package/src/graphql/stream/families.ts +515 -0
- package/src/graphql/stream/index.ts +55 -0
- package/src/graphql/stream/live.ts +70 -0
- package/src/graphql/stream/page.ts +47 -0
- package/src/graphql/stream/query.ts +52 -0
- package/src/graphql/subscribe.ts +83 -0
- package/src/grpc/client.ts +81 -79
- package/src/grpc/core.ts +388 -274
- package/src/grpc/filters.ts +59 -60
- package/src/grpc/grpc-web-pull.ts +360 -0
- package/src/grpc/index.ts +5 -0
- package/src/grpc/network-error.ts +33 -0
- package/src/grpc/proto/sui/rpc/v2/error_reason.ts +175 -0
- package/src/grpc/proto/sui/rpc/v2/ledger_service.ts +145 -0
- package/src/grpc/proto/sui/rpc/v2/move_package_service.ts +43 -1
- package/src/grpc/proto/sui/rpc/v2/query_options.ts +132 -8
- package/src/grpc/proto/sui/rpc/v2/signature.ts +4 -4
- package/src/grpc/proto/sui/rpc/v2/signature_scheme.ts +4 -0
- package/src/grpc/proto/sui/rpc/v2/signature_verification_service.ts +30 -0
- package/src/grpc/proto/sui/rpc/v2/subscription_service.client.ts +16 -10
- package/src/grpc/proto/sui/rpc/v2/transaction.ts +6 -0
- package/src/grpc/proto/sui/rpc/v2/transaction_execution_service.ts +5 -1
- package/src/grpc/pull-call.ts +54 -0
- package/src/grpc/stream/call.ts +317 -0
- package/src/grpc/stream/families.ts +228 -0
- package/src/grpc/stream/index.ts +182 -0
- package/src/grpc/stream/live.ts +33 -0
- package/src/grpc/stream/page.ts +161 -0
- package/src/grpc/stream-types.ts +33 -0
- package/src/grpc/transport.ts +116 -59
- package/src/jsonRpc/index.ts +60 -17
- package/src/jsonRpc/types.ts +421 -0
- package/src/multisig/publickey.ts +19 -7
- package/src/transactions/ObjectCache.ts +6 -6
- package/src/transactions/Transaction.ts +30 -6
- package/src/transactions/data/internal.ts +2 -0
- package/src/transactions/executor/serial.ts +2 -2
- package/src/transactions/index.ts +8 -1
- package/src/transactions/resolve.ts +6 -0
- package/src/transactions/restricted-move-calls.ts +87 -0
- package/src/transactions/serializer.ts +0 -70
- package/src/transactions/utils.ts +0 -37
- package/src/utils/abort.ts +101 -0
- package/src/verify/index.ts +1 -0
- package/src/verify/verify.ts +190 -62
- package/src/version.ts +1 -1
- package/src/zklogin/publickey.ts +18 -34
- package/dist/client/core-resolver.d.mts +0 -9
- package/dist/client/core-resolver.d.mts.map +0 -1
- package/dist/jsonRpc/client.d.mts +0 -507
- package/dist/jsonRpc/client.d.mts.map +0 -1
- package/dist/jsonRpc/client.mjs +0 -868
- package/dist/jsonRpc/client.mjs.map +0 -1
- package/dist/jsonRpc/core.d.mts +0 -168
- package/dist/jsonRpc/core.d.mts.map +0 -1
- package/dist/jsonRpc/core.mjs +0 -1054
- package/dist/jsonRpc/core.mjs.map +0 -1
- package/dist/jsonRpc/errors.d.mts +0 -27
- package/dist/jsonRpc/errors.d.mts.map +0 -1
- package/dist/jsonRpc/errors.mjs +0 -50
- package/dist/jsonRpc/errors.mjs.map +0 -1
- package/dist/jsonRpc/http-transport.d.mts +0 -62
- package/dist/jsonRpc/http-transport.d.mts.map +0 -1
- package/dist/jsonRpc/http-transport.mjs +0 -60
- package/dist/jsonRpc/http-transport.mjs.map +0 -1
- package/dist/jsonRpc/network.d.mts +0 -9
- package/dist/jsonRpc/network.d.mts.map +0 -1
- package/dist/jsonRpc/network.mjs +0 -18
- package/dist/jsonRpc/network.mjs.map +0 -1
- package/dist/jsonRpc/types/chain.d.mts +0 -169
- package/dist/jsonRpc/types/chain.d.mts.map +0 -1
- package/dist/jsonRpc/types/changes.d.mts +0 -48
- package/dist/jsonRpc/types/changes.d.mts.map +0 -1
- package/dist/jsonRpc/types/coins.d.mts +0 -15
- package/dist/jsonRpc/types/coins.d.mts.map +0 -1
- package/dist/jsonRpc/types/common.d.mts +0 -9
- package/dist/jsonRpc/types/common.d.mts.map +0 -1
- package/dist/jsonRpc/types/generated.d.mts +0 -1976
- package/dist/jsonRpc/types/generated.d.mts.map +0 -1
- package/dist/jsonRpc/types/index.d.mts +0 -6
- package/dist/jsonRpc/types/params.d.mts +0 -898
- package/dist/jsonRpc/types/params.d.mts.map +0 -1
- package/src/graphql/generated/tsconfig.tada.json +0 -11
- package/src/graphql/queries/verifyZkLoginSignature.graphql +0 -15
- package/src/jsonRpc/client.ts +0 -1252
- package/src/jsonRpc/core.ts +0 -1557
- package/src/jsonRpc/errors.ts +0 -57
- package/src/jsonRpc/http-transport.ts +0 -118
- package/src/jsonRpc/network.ts +0 -21
- package/src/jsonRpc/types/chain.ts +0 -190
- package/src/jsonRpc/types/changes.ts +0 -35
- package/src/jsonRpc/types/coins.ts +0 -14
- package/src/jsonRpc/types/common.ts +0 -8
- package/src/jsonRpc/types/generated.ts +0 -2165
- package/src/jsonRpc/types/index.ts +0 -9
- package/src/jsonRpc/types/params.ts +0 -908
package/src/verify/verify.ts
CHANGED
|
@@ -13,96 +13,219 @@ import { Secp256r1PublicKey } from '../keypairs/secp256r1/publickey.js';
|
|
|
13
13
|
import { MultiSigPublicKey } from '../multisig/publickey.js';
|
|
14
14
|
import { ZkLoginPublicIdentifier } from '../zklogin/publickey.js';
|
|
15
15
|
import type { ClientWithCoreApi } from '../client/core.js';
|
|
16
|
+
import { normalizeSuiAddress } from '../utils/sui-types.js';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
19
|
+
* How to verify a signature: on a Sui node through `client`, or locally with `offline: true`.
|
|
20
|
+
*
|
|
21
|
+
* Pass `address` when checking a signature for an account; without it, any valid signature passes.
|
|
22
|
+
*
|
|
23
|
+
* With a client, the node checks the signature and, when `address` is given, that the signer is
|
|
24
|
+
* `address` or one of its current address aliases (`checkAddressAliases`, default `true`; ignored
|
|
25
|
+
* without `address`). Use a client for the network the account is on.
|
|
26
|
+
*
|
|
27
|
+
* Offline verification checks that the signer is `address` itself and can't verify zkLogin
|
|
28
|
+
* signatures. It also accepts `address`'s own key after the account removed it from its alias set,
|
|
29
|
+
* so use a client when that matters.
|
|
30
|
+
*
|
|
31
|
+
* Without `client` or `offline: true`, the helpers verify offline and log a warning.
|
|
32
|
+
*/
|
|
33
|
+
export type VerifyOptions =
|
|
34
|
+
| { client: ClientWithCoreApi; offline?: false; address?: string; checkAddressAliases?: boolean }
|
|
35
|
+
| { offline: true; address?: string };
|
|
36
|
+
|
|
37
|
+
type Scope = 'PersonalMessage' | 'TransactionData' | 'Raw';
|
|
38
|
+
|
|
39
|
+
const SCOPE_LABEL: Record<Scope, string> = {
|
|
40
|
+
PersonalMessage: 'message',
|
|
41
|
+
TransactionData: 'Transaction',
|
|
42
|
+
Raw: 'data',
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Whether `signature` is a valid signature over `bytes`, verified locally. It can't check address
|
|
47
|
+
* aliases or zkLogin signatures (it throws for zkLogin): for account checks, use
|
|
48
|
+
* `client.verifySignature`.
|
|
49
|
+
*
|
|
50
|
+
* Returns `false` for an invalid signature or one not from `address`.
|
|
23
51
|
*/
|
|
24
52
|
export async function isValidSignature(
|
|
25
53
|
bytes: Uint8Array,
|
|
26
54
|
signature: string,
|
|
27
55
|
options: { address?: string } = {},
|
|
28
56
|
): Promise<boolean> {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return options.address ? parsed.publicKey.verifyAddress(options.address) : true;
|
|
57
|
+
return (
|
|
58
|
+
'publicKey' in (await checkSignature(bytes, signature, 'Raw', { ...options, offline: true }))
|
|
59
|
+
);
|
|
33
60
|
}
|
|
34
61
|
|
|
35
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* Whether `signature` is a valid signature over the personal message `message` (a string is UTF-8
|
|
64
|
+
* encoded, as in `client.verifySignature`). Returns `false` for an invalid signature, or one from a
|
|
65
|
+
* signer not authorized for `address`. Throws for a network error, when the node can't check
|
|
66
|
+
* address aliases, or for a zkLogin signature offline. `checkAddressAliases` is ignored without
|
|
67
|
+
* `address`.
|
|
68
|
+
*/
|
|
36
69
|
export async function isValidPersonalMessageSignature(
|
|
37
|
-
message: Uint8Array,
|
|
70
|
+
message: Uint8Array | string,
|
|
38
71
|
signature: string,
|
|
39
|
-
options:
|
|
72
|
+
options: VerifyOptions,
|
|
40
73
|
): Promise<boolean> {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
return options.address ? parsed.publicKey.verifyAddress(options.address) : true;
|
|
74
|
+
return (
|
|
75
|
+
'publicKey' in
|
|
76
|
+
(await checkSignature(messageBytes(message), signature, 'PersonalMessage', options))
|
|
77
|
+
);
|
|
47
78
|
}
|
|
48
79
|
|
|
49
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* Whether `signature` is a valid signature over the transaction bytes. Returns `false` for an
|
|
82
|
+
* invalid signature, or one from a signer not authorized for `address`. Throws for a network error,
|
|
83
|
+
* when the node can't check address aliases, or for a zkLogin signature offline.
|
|
84
|
+
* `checkAddressAliases` is ignored without `address`.
|
|
85
|
+
*/
|
|
50
86
|
export async function isValidTransactionSignature(
|
|
51
87
|
transaction: Uint8Array,
|
|
52
88
|
signature: string,
|
|
53
|
-
options:
|
|
89
|
+
options: VerifyOptions,
|
|
54
90
|
): Promise<boolean> {
|
|
55
|
-
|
|
56
|
-
if (!parsed) return false;
|
|
57
|
-
if (!(await parsed.publicKey.verifyTransaction(transaction, parsed.serializedSignature))) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
return options.address ? parsed.publicKey.verifyAddress(options.address) : true;
|
|
91
|
+
return 'publicKey' in (await checkSignature(transaction, signature, 'TransactionData', options));
|
|
61
92
|
}
|
|
62
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Verifies `signature` over `bytes` locally and returns the signer's public key. It can't check
|
|
96
|
+
* address aliases or zkLogin signatures (it throws for zkLogin): for account checks, use
|
|
97
|
+
* `client.verifySignature`, or {@link verifyPersonalMessageSignature} or
|
|
98
|
+
* {@link verifyTransactionSignature} with a client.
|
|
99
|
+
*/
|
|
63
100
|
export async function verifySignature(
|
|
64
101
|
bytes: Uint8Array,
|
|
65
102
|
signature: string,
|
|
66
103
|
options: { address?: string } = {},
|
|
67
104
|
): Promise<PublicKey> {
|
|
68
|
-
|
|
69
|
-
if (!(await isValidSignature(bytes, signature))) {
|
|
70
|
-
throw new Error(`Signature is not valid for the provided data`);
|
|
71
|
-
}
|
|
72
|
-
if (options.address && !publicKey.verifyAddress(options.address)) {
|
|
73
|
-
throw new Error(`Signature is not valid for the provided address`);
|
|
74
|
-
}
|
|
75
|
-
return publicKey;
|
|
105
|
+
return expectValid(await checkSignature(bytes, signature, 'Raw', { ...options, offline: true }));
|
|
76
106
|
}
|
|
77
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Verifies a personal message signature and returns the signer's public key. A string `message` is
|
|
110
|
+
* UTF-8 encoded, as in `client.verifySignature`. Throws if the signature is invalid or its signer is
|
|
111
|
+
* not authorized for `address`, and for the errors listed on
|
|
112
|
+
* {@link isValidPersonalMessageSignature}. The returned key may belong to one of `address`'s
|
|
113
|
+
* aliases, so use `address`, not `publicKey.toSuiAddress()`, as the account's identity.
|
|
114
|
+
*/
|
|
78
115
|
export async function verifyPersonalMessageSignature(
|
|
79
|
-
message: Uint8Array,
|
|
116
|
+
message: Uint8Array | string,
|
|
80
117
|
signature: string,
|
|
81
|
-
options:
|
|
118
|
+
options: VerifyOptions,
|
|
82
119
|
): Promise<PublicKey> {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
if (options.address && !publicKey.verifyAddress(options.address)) {
|
|
88
|
-
throw new Error(`Signature is not valid for the provided address`);
|
|
89
|
-
}
|
|
90
|
-
return publicKey;
|
|
120
|
+
return expectValid(
|
|
121
|
+
await checkSignature(messageBytes(message), signature, 'PersonalMessage', options),
|
|
122
|
+
);
|
|
91
123
|
}
|
|
92
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Verifies a transaction signature and returns the signer's public key. Throws if the signature is
|
|
127
|
+
* invalid or its signer is not authorized for `address`, and for the errors listed on
|
|
128
|
+
* {@link isValidTransactionSignature}. The returned key may belong to one of `address`'s aliases,
|
|
129
|
+
* so use `address`, not `publicKey.toSuiAddress()`, as the account's identity.
|
|
130
|
+
*/
|
|
93
131
|
export async function verifyTransactionSignature(
|
|
94
132
|
transaction: Uint8Array,
|
|
95
133
|
signature: string,
|
|
96
|
-
options:
|
|
134
|
+
options: VerifyOptions,
|
|
97
135
|
): Promise<PublicKey> {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
136
|
+
return expectValid(await checkSignature(transaction, signature, 'TransactionData', options));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function messageBytes(message: Uint8Array | string): Uint8Array {
|
|
140
|
+
return typeof message === 'string' ? new TextEncoder().encode(message) : message;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
type CheckResult = { publicKey: PublicKey } | { error: string };
|
|
144
|
+
|
|
145
|
+
function expectValid(result: CheckResult): PublicKey {
|
|
146
|
+
if ('error' in result) {
|
|
147
|
+
throw new Error(result.error);
|
|
101
148
|
}
|
|
102
|
-
|
|
103
|
-
|
|
149
|
+
return result.publicKey;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
let warnedNoClient = false;
|
|
153
|
+
|
|
154
|
+
async function checkSignature(
|
|
155
|
+
bytes: Uint8Array,
|
|
156
|
+
signature: string,
|
|
157
|
+
scope: Scope,
|
|
158
|
+
options: VerifyOptions,
|
|
159
|
+
): Promise<CheckResult> {
|
|
160
|
+
// 2.x verified offline without a client; keep that for callers not yet migrated.
|
|
161
|
+
if (options?.offline !== true && !options?.client) {
|
|
162
|
+
if (!warnedNoClient) {
|
|
163
|
+
warnedNoClient = true;
|
|
164
|
+
console.warn(
|
|
165
|
+
'@mysten/sui/verify: no client given, verifying offline. Pass a client to check address aliases and zkLogin signatures, or `offline: true` to silence this warning.',
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
options = { offline: true, address: options?.address };
|
|
104
169
|
}
|
|
105
|
-
|
|
170
|
+
|
|
171
|
+
const invalid = { error: `Signature is not valid for the provided ${SCOPE_LABEL[scope]}` };
|
|
172
|
+
const parsed = tryParseSignature(signature, options.offline ? {} : { client: options.client });
|
|
173
|
+
if (!parsed) return invalid;
|
|
174
|
+
const address = options.address ? normalizeSuiAddress(options.address) : undefined;
|
|
175
|
+
|
|
176
|
+
if (options.offline) {
|
|
177
|
+
if (
|
|
178
|
+
parsed.signatureScheme === 'ZkLogin' ||
|
|
179
|
+
(parsed.signatureScheme === 'MultiSig' &&
|
|
180
|
+
parsed.multisig.sigs.some((sig) => 'ZkLogin' in sig))
|
|
181
|
+
) {
|
|
182
|
+
throw new Error('zkLogin signatures cannot be verified offline: pass a client instead.');
|
|
183
|
+
}
|
|
184
|
+
const { publicKey, serializedSignature } = parsed;
|
|
185
|
+
const valid =
|
|
186
|
+
scope === 'PersonalMessage'
|
|
187
|
+
? await publicKey.verifyPersonalMessage(bytes, serializedSignature)
|
|
188
|
+
: scope === 'TransactionData'
|
|
189
|
+
? await publicKey.verifyTransaction(bytes, serializedSignature)
|
|
190
|
+
: await publicKey.verify(bytes, serializedSignature);
|
|
191
|
+
if (!valid) return invalid;
|
|
192
|
+
if (address && !publicKey.verifyAddress(address)) {
|
|
193
|
+
return { error: 'Signature is not valid for the provided address' };
|
|
194
|
+
}
|
|
195
|
+
return { publicKey };
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const { publicKey } = parsed;
|
|
199
|
+
// Without an address, check the signature against its own signer.
|
|
200
|
+
const account = address
|
|
201
|
+
? { address, checkAddressAliases: options.checkAddressAliases }
|
|
202
|
+
: { address: publicKey.toSuiAddress(), checkAddressAliases: false };
|
|
203
|
+
const result = await options.client.core.verifySignature(
|
|
204
|
+
scope === 'PersonalMessage'
|
|
205
|
+
? { personalMessage: bytes, signature, ...account }
|
|
206
|
+
: { transaction: bytes, signature, ...account },
|
|
207
|
+
);
|
|
208
|
+
if (!result.valid) {
|
|
209
|
+
return { error: `${invalid.error}${result.reason ? `: ${result.reason}` : ''}` };
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// A zkLogin signature parses to the current address derivation; return the legacy one when
|
|
213
|
+
// that is the address being verified.
|
|
214
|
+
if (
|
|
215
|
+
address &&
|
|
216
|
+
publicKey instanceof ZkLoginPublicIdentifier &&
|
|
217
|
+
publicKey.toSuiAddress() !== address &&
|
|
218
|
+
publicKey.verifyAddress(address)
|
|
219
|
+
) {
|
|
220
|
+
return {
|
|
221
|
+
publicKey: ZkLoginPublicIdentifier.fromBytes(publicKey.toRawBytes(), {
|
|
222
|
+
client: options.client,
|
|
223
|
+
legacyAddress: true,
|
|
224
|
+
}),
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return { publicKey };
|
|
106
229
|
}
|
|
107
230
|
|
|
108
231
|
function parseSignature(signature: string, options: { client?: ClientWithCoreApi } = {}) {
|
|
@@ -111,20 +234,19 @@ function parseSignature(signature: string, options: { client?: ClientWithCoreApi
|
|
|
111
234
|
if (parsedSignature.signatureScheme === 'MultiSig') {
|
|
112
235
|
return {
|
|
113
236
|
...parsedSignature,
|
|
114
|
-
publicKey: new MultiSigPublicKey(parsedSignature.multisig.
|
|
237
|
+
publicKey: new MultiSigPublicKey(parsedSignature.multisig.multisigPk, {
|
|
115
238
|
client: options.client,
|
|
116
239
|
}),
|
|
117
240
|
};
|
|
118
241
|
}
|
|
119
242
|
|
|
120
|
-
const publicKey = publicKeyFromRawBytes(
|
|
121
|
-
parsedSignature.signatureScheme,
|
|
122
|
-
parsedSignature.publicKey,
|
|
123
|
-
options,
|
|
124
|
-
);
|
|
125
243
|
return {
|
|
126
244
|
...parsedSignature,
|
|
127
|
-
publicKey
|
|
245
|
+
publicKey: publicKeyFromRawBytes(
|
|
246
|
+
parsedSignature.signatureScheme,
|
|
247
|
+
parsedSignature.publicKey,
|
|
248
|
+
options,
|
|
249
|
+
),
|
|
128
250
|
};
|
|
129
251
|
}
|
|
130
252
|
|
|
@@ -137,11 +259,16 @@ function tryParseSignature(signature: string, options: { client?: ClientWithCore
|
|
|
137
259
|
}
|
|
138
260
|
}
|
|
139
261
|
|
|
262
|
+
/**
|
|
263
|
+
* Parses a public key. It doesn't verify a signature; `address` only asserts that the key derives
|
|
264
|
+
* that address, with no address alias check.
|
|
265
|
+
*/
|
|
140
266
|
export function publicKeyFromRawBytes(
|
|
141
267
|
signatureScheme: SignatureScheme,
|
|
142
268
|
bytes: Uint8Array,
|
|
143
|
-
|
|
269
|
+
{ client, address }: { client?: ClientWithCoreApi; address?: string } = {},
|
|
144
270
|
): PublicKey {
|
|
271
|
+
address = address ? normalizeSuiAddress(address) : undefined;
|
|
145
272
|
let publicKey: PublicKey;
|
|
146
273
|
switch (signatureScheme) {
|
|
147
274
|
case 'ED25519':
|
|
@@ -154,10 +281,10 @@ export function publicKeyFromRawBytes(
|
|
|
154
281
|
publicKey = new Secp256r1PublicKey(bytes);
|
|
155
282
|
break;
|
|
156
283
|
case 'MultiSig':
|
|
157
|
-
publicKey = new MultiSigPublicKey(bytes, { client
|
|
284
|
+
publicKey = new MultiSigPublicKey(bytes, { client });
|
|
158
285
|
break;
|
|
159
286
|
case 'ZkLogin':
|
|
160
|
-
publicKey = ZkLoginPublicIdentifier.fromBytes(bytes,
|
|
287
|
+
publicKey = ZkLoginPublicIdentifier.fromBytes(bytes, { client, address });
|
|
161
288
|
break;
|
|
162
289
|
case 'Passkey':
|
|
163
290
|
publicKey = new PasskeyPublicKey(bytes);
|
|
@@ -169,13 +296,14 @@ export function publicKeyFromRawBytes(
|
|
|
169
296
|
throw new Error(`Unsupported signature scheme ${signatureScheme}`);
|
|
170
297
|
}
|
|
171
298
|
|
|
172
|
-
if (
|
|
299
|
+
if (address && publicKey.toSuiAddress() !== address) {
|
|
173
300
|
throw new Error(`Public key bytes do not match the provided address`);
|
|
174
301
|
}
|
|
175
302
|
|
|
176
303
|
return publicKey;
|
|
177
304
|
}
|
|
178
305
|
|
|
306
|
+
/** Parses a Sui-encoded (flag-prefixed) public key. See {@link publicKeyFromRawBytes}. */
|
|
179
307
|
export function publicKeyFromSuiBytes(
|
|
180
308
|
publicKey: string | Uint8Array,
|
|
181
309
|
options: { client?: ClientWithCoreApi; address?: string } = {},
|
package/src/version.ts
CHANGED
package/src/zklogin/publickey.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { extractClaimValue } from './jwt-utils.js';
|
|
|
14
14
|
import { parseZkLoginSignature } from './signature.js';
|
|
15
15
|
import { normalizeZkLoginIssuer, toBigEndianBytes, toPaddedBigEndianBytes } from './utils.js';
|
|
16
16
|
import type { ClientWithCoreApi } from '../client/core.js';
|
|
17
|
+
import type { SuiClientTypes } from '../client/types.js';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* A zkLogin public identifier
|
|
@@ -160,7 +161,9 @@ export class ZkLoginPublicIdentifier extends PublicKey {
|
|
|
160
161
|
* Verifies that the signature is valid for for the provided message
|
|
161
162
|
*/
|
|
162
163
|
async verify(_message: Uint8Array, _signature: Uint8Array | string): Promise<boolean> {
|
|
163
|
-
throw Error(
|
|
164
|
+
throw new Error(
|
|
165
|
+
'zkLogin signatures can only be verified for personal messages and transactions',
|
|
166
|
+
);
|
|
164
167
|
}
|
|
165
168
|
|
|
166
169
|
/**
|
|
@@ -169,14 +172,12 @@ export class ZkLoginPublicIdentifier extends PublicKey {
|
|
|
169
172
|
verifyPersonalMessage(message: Uint8Array, signature: Uint8Array | string): Promise<boolean> {
|
|
170
173
|
const parsedSignature = parseSerializedZkLoginSignature(signature);
|
|
171
174
|
|
|
172
|
-
return
|
|
175
|
+
return verifyOnNode(this.#client, {
|
|
173
176
|
// Verify against this identifier's address, not one derived from the signature, so a
|
|
174
177
|
// signature from a different zkLogin identity is rejected (as the chain does for multisig).
|
|
175
178
|
address: this.toSuiAddress(),
|
|
176
|
-
|
|
179
|
+
personalMessage: message,
|
|
177
180
|
signature: parsedSignature.serializedSignature,
|
|
178
|
-
intentScope: 'PersonalMessage',
|
|
179
|
-
client: this.#client,
|
|
180
181
|
});
|
|
181
182
|
}
|
|
182
183
|
|
|
@@ -185,12 +186,10 @@ export class ZkLoginPublicIdentifier extends PublicKey {
|
|
|
185
186
|
*/
|
|
186
187
|
verifyTransaction(transaction: Uint8Array, signature: Uint8Array | string): Promise<boolean> {
|
|
187
188
|
const parsedSignature = parseSerializedZkLoginSignature(signature);
|
|
188
|
-
return
|
|
189
|
+
return verifyOnNode(this.#client, {
|
|
189
190
|
address: this.toSuiAddress(),
|
|
190
|
-
|
|
191
|
+
transaction,
|
|
191
192
|
signature: parsedSignature.serializedSignature,
|
|
192
|
-
intentScope: 'TransactionData',
|
|
193
|
-
client: this.#client,
|
|
194
193
|
});
|
|
195
194
|
}
|
|
196
195
|
|
|
@@ -198,7 +197,8 @@ export class ZkLoginPublicIdentifier extends PublicKey {
|
|
|
198
197
|
* Verifies that the public key is associated with the provided address
|
|
199
198
|
*/
|
|
200
199
|
override verifyAddress(address: string): boolean {
|
|
201
|
-
|
|
200
|
+
const normalized = normalizeSuiAddress(address);
|
|
201
|
+
return normalized === super.toSuiAddress() || normalized === this.#toLegacyAddress();
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
|
|
@@ -236,32 +236,16 @@ function normalizeZkLoginPublicKeyBytes(bytes: Uint8Array, legacyAddress: boolea
|
|
|
236
236
|
return data;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
async function
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
intentScope,
|
|
244
|
-
client,
|
|
245
|
-
}: {
|
|
246
|
-
address: string;
|
|
247
|
-
bytes: string;
|
|
248
|
-
signature: string;
|
|
249
|
-
intentScope: 'PersonalMessage' | 'TransactionData';
|
|
250
|
-
client?: ClientWithCoreApi;
|
|
251
|
-
}) {
|
|
239
|
+
async function verifyOnNode(
|
|
240
|
+
client: ClientWithCoreApi | undefined,
|
|
241
|
+
options: SuiClientTypes.VerifySignatureOptions,
|
|
242
|
+
) {
|
|
252
243
|
if (!client) {
|
|
253
|
-
throw new Error(
|
|
254
|
-
'A Sui Client (GRPC, GraphQL, or JSON RPC) is required to verify zkLogin signatures',
|
|
255
|
-
);
|
|
244
|
+
throw new Error('A Sui Client (gRPC or GraphQL) is required to verify zkLogin signatures');
|
|
256
245
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
intentScope,
|
|
261
|
-
address: address,
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
return resp.success === true && resp.errors.length === 0;
|
|
246
|
+
// A public key checks its own signatures, not an account's alias set.
|
|
247
|
+
const { valid } = await client.core.verifySignature({ ...options, checkAddressAliases: false });
|
|
248
|
+
return valid;
|
|
265
249
|
}
|
|
266
250
|
|
|
267
251
|
export function parseSerializedZkLoginSignature(signature: Uint8Array | string) {
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { TransactionDataBuilder } from "../transactions/TransactionData.mjs";
|
|
2
|
-
import { BuildTransactionOptions } from "../transactions/resolve.mjs";
|
|
3
|
-
import "../transactions/index.mjs";
|
|
4
|
-
|
|
5
|
-
//#region src/client/core-resolver.d.ts
|
|
6
|
-
declare function coreClientResolveTransactionPlugin(transactionData: TransactionDataBuilder, options: BuildTransactionOptions, next: () => Promise<void>): Promise<void>;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { coreClientResolveTransactionPlugin };
|
|
9
|
-
//# sourceMappingURL=core-resolver.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"core-resolver.d.mts","names":[],"sources":["../../src/client/core-resolver.ts"],"mappings":";;;;;iBAsDsB,kCAAA,CACrB,eAAA,EAAiB,sBAAA,EACjB,OAAA,EAAS,uBAAA,EACT,IAAA,QAAY,OAAA,SAAa,OAAA"}
|