@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/bcs/effects.ts
CHANGED
|
@@ -84,7 +84,10 @@ const ExecutionFailureStatus = bcs.enum('ExecutionFailureStatus', {
|
|
|
84
84
|
PublishErrorNonZeroAddress: null,
|
|
85
85
|
SuiMoveVerificationError: null,
|
|
86
86
|
MovePrimitiveRuntimeError: bcs.option(MoveLocation),
|
|
87
|
-
MoveAbort: bcs.
|
|
87
|
+
MoveAbort: bcs.struct('MoveAbort', {
|
|
88
|
+
location: MoveLocation,
|
|
89
|
+
abortCode: bcs.u64(),
|
|
90
|
+
}),
|
|
88
91
|
VMVerificationOrDeserializationError: null,
|
|
89
92
|
VMInvariantViolation: null,
|
|
90
93
|
FunctionNotFound: null,
|
|
@@ -122,7 +125,7 @@ const ExecutionFailureStatus = bcs.enum('ExecutionFailureStatus', {
|
|
|
122
125
|
ExecutionCancelledDueToSharedObjectCongestion: bcs.struct(
|
|
123
126
|
'ExecutionCancelledDueToSharedObjectCongestion',
|
|
124
127
|
{
|
|
125
|
-
|
|
128
|
+
congestedObjects: bcs.vector(Address),
|
|
126
129
|
},
|
|
127
130
|
),
|
|
128
131
|
AddressDeniedForCoin: bcs.struct('AddressDeniedForCoin', {
|
|
@@ -140,9 +143,7 @@ const ExecutionFailureStatus = bcs.enum('ExecutionFailureStatus', {
|
|
|
140
143
|
maxScaledSize: bcs.u64(),
|
|
141
144
|
}),
|
|
142
145
|
InvalidLinkage: null,
|
|
143
|
-
|
|
144
|
-
// break the public API, and the wire representation is unchanged either way.
|
|
145
|
-
InsufficientBalanceForWithdraw: null,
|
|
146
|
+
InsufficientFundsForWithdraw: null,
|
|
146
147
|
NonExclusiveWriteInputObjectModified: bcs.struct('NonExclusiveWriteInputObjectModified', {
|
|
147
148
|
id: Address,
|
|
148
149
|
}),
|
|
@@ -166,38 +167,56 @@ const GasCostSummary = bcs.struct('GasCostSummary', {
|
|
|
166
167
|
nonRefundableStorageFee: bcs.u64(),
|
|
167
168
|
});
|
|
168
169
|
|
|
170
|
+
// Rust: crates/sui-types/src/effects/effects_v1.rs (`(ObjectRef, Owner)`)
|
|
171
|
+
const ObjectReferenceWithOwner = bcs.struct('ObjectReferenceWithOwner', {
|
|
172
|
+
reference: SuiObjectRef,
|
|
173
|
+
owner: Owner,
|
|
174
|
+
});
|
|
175
|
+
|
|
169
176
|
// Rust: crates/sui-types/src/effects/effects_v1.rs
|
|
170
177
|
const TransactionEffectsV1 = bcs.struct('TransactionEffectsV1', {
|
|
171
178
|
status: ExecutionStatus,
|
|
172
179
|
executedEpoch: bcs.u64(),
|
|
173
180
|
gasUsed: GasCostSummary,
|
|
174
|
-
modifiedAtVersions: bcs.vector(
|
|
181
|
+
modifiedAtVersions: bcs.vector(
|
|
182
|
+
bcs.struct('ModifiedAtVersion', {
|
|
183
|
+
objectId: Address,
|
|
184
|
+
version: bcs.u64(),
|
|
185
|
+
}),
|
|
186
|
+
),
|
|
175
187
|
sharedObjects: bcs.vector(SuiObjectRef),
|
|
176
188
|
transactionDigest: ObjectDigest,
|
|
177
|
-
created: bcs.vector(
|
|
178
|
-
mutated: bcs.vector(
|
|
179
|
-
unwrapped: bcs.vector(
|
|
189
|
+
created: bcs.vector(ObjectReferenceWithOwner),
|
|
190
|
+
mutated: bcs.vector(ObjectReferenceWithOwner),
|
|
191
|
+
unwrapped: bcs.vector(ObjectReferenceWithOwner),
|
|
180
192
|
deleted: bcs.vector(SuiObjectRef),
|
|
181
193
|
unwrappedThenDeleted: bcs.vector(SuiObjectRef),
|
|
182
194
|
wrapped: bcs.vector(SuiObjectRef),
|
|
183
|
-
gasObject:
|
|
195
|
+
gasObject: ObjectReferenceWithOwner,
|
|
184
196
|
eventsDigest: bcs.option(ObjectDigest),
|
|
185
197
|
dependencies: bcs.vector(ObjectDigest),
|
|
186
198
|
});
|
|
187
199
|
|
|
188
200
|
// Rust: crates/sui-types/src/base_types.rs
|
|
189
|
-
const VersionDigest = bcs.
|
|
201
|
+
const VersionDigest = bcs.struct('VersionDigest', {
|
|
202
|
+
version: bcs.u64(),
|
|
203
|
+
digest: ObjectDigest,
|
|
204
|
+
});
|
|
190
205
|
|
|
191
206
|
// Rust: crates/sui-types/src/effects/object_change.rs
|
|
192
207
|
const ObjectIn = bcs.enum('ObjectIn', {
|
|
193
208
|
NotExist: null,
|
|
194
|
-
|
|
209
|
+
// Rust nests `(VersionDigest, Owner)`; flattening keeps the same bytes.
|
|
210
|
+
Exist: bcs.struct('ObjectInExist', {
|
|
211
|
+
version: bcs.u64(),
|
|
212
|
+
digest: ObjectDigest,
|
|
213
|
+
owner: Owner,
|
|
214
|
+
}),
|
|
195
215
|
});
|
|
196
216
|
|
|
197
217
|
// Rust: crates/sui-types/src/effects/object_change.rs
|
|
198
218
|
const AccumulatorAddress = bcs.struct('AccumulatorAddress', {
|
|
199
219
|
address: Address,
|
|
200
|
-
// TODO: ask why this is the name
|
|
201
220
|
ty: TypeTag,
|
|
202
221
|
});
|
|
203
222
|
|
|
@@ -210,9 +229,17 @@ const AccumulatorOperation = bcs.enum('AccumulatorOperation', {
|
|
|
210
229
|
// Rust: crates/sui-types/src/effects/object_change.rs
|
|
211
230
|
const AccumulatorValue = bcs.enum('AccumulatorValue', {
|
|
212
231
|
Integer: bcs.u64(),
|
|
213
|
-
IntegerTuple: bcs.
|
|
232
|
+
IntegerTuple: bcs.struct('IntegerTuple', {
|
|
233
|
+
first: bcs.u64(),
|
|
234
|
+
second: bcs.u64(),
|
|
235
|
+
}),
|
|
214
236
|
// NonEmpty<(u64, Digest)> in Rust - vector must have at least one element
|
|
215
|
-
EventDigest: bcs.vector(
|
|
237
|
+
EventDigest: bcs.vector(
|
|
238
|
+
bcs.struct('EventDigestEntry', {
|
|
239
|
+
eventIndex: bcs.u64(),
|
|
240
|
+
digest: ObjectDigest,
|
|
241
|
+
}),
|
|
242
|
+
),
|
|
216
243
|
});
|
|
217
244
|
|
|
218
245
|
// Rust: crates/sui-types/src/effects/object_change.rs
|
|
@@ -225,7 +252,10 @@ const AccumulatorWriteV1 = bcs.struct('AccumulatorWriteV1', {
|
|
|
225
252
|
// Rust: crates/sui-types/src/effects/object_change.rs
|
|
226
253
|
const ObjectOut = bcs.enum('ObjectOut', {
|
|
227
254
|
NotExist: null,
|
|
228
|
-
ObjectWrite: bcs.
|
|
255
|
+
ObjectWrite: bcs.struct('ObjectWrite', {
|
|
256
|
+
digest: ObjectDigest,
|
|
257
|
+
owner: Owner,
|
|
258
|
+
}),
|
|
229
259
|
PackageWrite: VersionDigest,
|
|
230
260
|
AccumulatorWriteV1: AccumulatorWriteV1,
|
|
231
261
|
});
|
|
@@ -237,13 +267,6 @@ const IDOperation = bcs.enum('IDOperation', {
|
|
|
237
267
|
Deleted: null,
|
|
238
268
|
});
|
|
239
269
|
|
|
240
|
-
// Rust: crates/sui-types/src/effects/object_change.rs
|
|
241
|
-
const EffectsObjectChange = bcs.struct('EffectsObjectChange', {
|
|
242
|
-
inputState: ObjectIn,
|
|
243
|
-
outputState: ObjectOut,
|
|
244
|
-
idOperation: IDOperation,
|
|
245
|
-
});
|
|
246
|
-
|
|
247
270
|
// Rust: crates/sui-types/src/effects/effects_v2.rs
|
|
248
271
|
const UnchangedConsensusKind = bcs.enum('UnchangedConsensusKind', {
|
|
249
272
|
ReadOnlyRoot: VersionDigest,
|
|
@@ -263,8 +286,21 @@ const TransactionEffectsV2 = bcs.struct('TransactionEffectsV2', {
|
|
|
263
286
|
eventsDigest: bcs.option(ObjectDigest),
|
|
264
287
|
dependencies: bcs.vector(ObjectDigest),
|
|
265
288
|
lamportVersion: bcs.u64(),
|
|
266
|
-
changedObjects: bcs.vector(
|
|
267
|
-
|
|
289
|
+
changedObjects: bcs.vector(
|
|
290
|
+
// Rust pairs the ID with an `EffectsObjectChange`; flattening keeps the same bytes.
|
|
291
|
+
bcs.struct('ChangedObject', {
|
|
292
|
+
objectId: Address,
|
|
293
|
+
inputState: ObjectIn,
|
|
294
|
+
outputState: ObjectOut,
|
|
295
|
+
idOperation: IDOperation,
|
|
296
|
+
}),
|
|
297
|
+
),
|
|
298
|
+
unchangedConsensusObjects: bcs.vector(
|
|
299
|
+
bcs.struct('UnchangedConsensusObject', {
|
|
300
|
+
objectId: Address,
|
|
301
|
+
kind: UnchangedConsensusKind,
|
|
302
|
+
}),
|
|
303
|
+
),
|
|
268
304
|
auxDataDigest: bcs.option(ObjectDigest),
|
|
269
305
|
});
|
|
270
306
|
|
package/src/bcs/index.ts
CHANGED
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
ProgrammableMoveCall,
|
|
31
31
|
ProgrammableTransaction,
|
|
32
32
|
PublicKey,
|
|
33
|
+
SharedObjectMutability,
|
|
33
34
|
SharedObjectRef,
|
|
34
35
|
StructTag,
|
|
35
36
|
SuiObjectRef,
|
|
@@ -98,6 +99,7 @@ const suiBcs = {
|
|
|
98
99
|
PublicKey,
|
|
99
100
|
SenderSignedData,
|
|
100
101
|
SenderSignedTransaction,
|
|
102
|
+
SharedObjectMutability,
|
|
101
103
|
SharedObjectRef,
|
|
102
104
|
StructTag,
|
|
103
105
|
SuiObjectRef,
|
package/src/bcs/transactions.ts
CHANGED
|
@@ -26,7 +26,11 @@ export const ChangeEpoch = bcs.struct('ChangeEpoch', {
|
|
|
26
26
|
nonRefundableStorageFee: bcs.u64(),
|
|
27
27
|
epochStartTimestampMs: bcs.u64(),
|
|
28
28
|
systemPackages: bcs.vector(
|
|
29
|
-
bcs.
|
|
29
|
+
bcs.struct('SystemPackage', {
|
|
30
|
+
version: bcs.u64(),
|
|
31
|
+
modules: bcs.vector(bcs.byteVector()),
|
|
32
|
+
dependencies: bcs.vector(Address),
|
|
33
|
+
}),
|
|
30
34
|
),
|
|
31
35
|
});
|
|
32
36
|
|
|
@@ -63,13 +67,28 @@ export const ConsensusDeterminedVersionAssignments = bcs.enum(
|
|
|
63
67
|
'ConsensusDeterminedVersionAssignments',
|
|
64
68
|
{
|
|
65
69
|
CancelledTransactions: bcs.vector(
|
|
66
|
-
bcs.
|
|
70
|
+
bcs.struct('CancelledTransaction', {
|
|
71
|
+
digest: ObjectDigest,
|
|
72
|
+
assignments: bcs.vector(
|
|
73
|
+
bcs.struct('VersionAssignment', {
|
|
74
|
+
objectId: Address,
|
|
75
|
+
version: bcs.u64(),
|
|
76
|
+
}),
|
|
77
|
+
),
|
|
78
|
+
}),
|
|
67
79
|
),
|
|
68
80
|
CancelledTransactionsV2: bcs.vector(
|
|
69
|
-
bcs.
|
|
70
|
-
ObjectDigest,
|
|
71
|
-
bcs.vector(
|
|
72
|
-
|
|
81
|
+
bcs.struct('CancelledTransactionV2', {
|
|
82
|
+
digest: ObjectDigest,
|
|
83
|
+
assignments: bcs.vector(
|
|
84
|
+
// Rust nests `(ObjectID, start version)` in a tuple; flattening keeps the same bytes.
|
|
85
|
+
bcs.struct('VersionAssignmentV2', {
|
|
86
|
+
objectId: Address,
|
|
87
|
+
startVersion: bcs.u64(),
|
|
88
|
+
version: bcs.u64(),
|
|
89
|
+
}),
|
|
90
|
+
),
|
|
91
|
+
}),
|
|
73
92
|
),
|
|
74
93
|
},
|
|
75
94
|
);
|
|
@@ -115,7 +134,7 @@ export const AuthenticatorStateUpdate = bcs.struct('AuthenticatorStateUpdate', {
|
|
|
115
134
|
epoch: bcs.u64(),
|
|
116
135
|
round: bcs.u64(),
|
|
117
136
|
newActiveJwks: bcs.vector(ActiveJwk),
|
|
118
|
-
|
|
137
|
+
authenticatorObjectInitialSharedVersion: bcs.u64(),
|
|
119
138
|
});
|
|
120
139
|
|
|
121
140
|
// Rust: crates/sui-types/src/transaction.rs
|
|
@@ -123,13 +142,13 @@ export const RandomnessStateUpdate = bcs.struct('RandomnessStateUpdate', {
|
|
|
123
142
|
epoch: bcs.u64(),
|
|
124
143
|
randomnessRound: bcs.u64(),
|
|
125
144
|
randomBytes: bcs.byteVector(),
|
|
126
|
-
|
|
145
|
+
randomnessObjectInitialSharedVersion: bcs.u64(),
|
|
127
146
|
});
|
|
128
147
|
|
|
129
148
|
// Rust: crates/sui-types/src/transaction.rs
|
|
130
149
|
export const AuthenticatorStateExpire = bcs.struct('AuthenticatorStateExpire', {
|
|
131
150
|
minEpoch: bcs.u64(),
|
|
132
|
-
|
|
151
|
+
authenticatorObjectInitialSharedVersion: bcs.u64(),
|
|
133
152
|
});
|
|
134
153
|
|
|
135
154
|
// Rust: crates/sui-types/src/execution.rs
|
|
@@ -151,19 +170,19 @@ export const ExecutionTimeObservationKey = bcs.enum('ExecutionTimeObservationKey
|
|
|
151
170
|
// Rust: crates/sui-types/src/transaction.rs
|
|
152
171
|
export const StoredExecutionTimeObservations = bcs.enum('StoredExecutionTimeObservations', {
|
|
153
172
|
V1: bcs.vector(
|
|
154
|
-
bcs.
|
|
155
|
-
ExecutionTimeObservationKey,
|
|
156
|
-
bcs.vector(
|
|
157
|
-
bcs.
|
|
173
|
+
bcs.struct('ExecutionTimeObservation', {
|
|
174
|
+
key: ExecutionTimeObservationKey,
|
|
175
|
+
observations: bcs.vector(
|
|
176
|
+
bcs.struct('ValidatorExecutionTimeObservation', {
|
|
158
177
|
// AuthorityName (BLS public key bytes)
|
|
159
|
-
bcs.byteVector(),
|
|
160
|
-
bcs.struct('Duration', {
|
|
178
|
+
validator: bcs.byteVector(),
|
|
179
|
+
duration: bcs.struct('Duration', {
|
|
161
180
|
secs: bcs.u64(),
|
|
162
181
|
nanos: bcs.u32(),
|
|
163
182
|
}),
|
|
164
|
-
|
|
183
|
+
}),
|
|
165
184
|
),
|
|
166
|
-
|
|
185
|
+
}),
|
|
167
186
|
),
|
|
168
187
|
});
|
|
169
188
|
|
package/src/bcs/types.ts
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
// Copyright (c) Mysten Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/** How a transaction accesses a shared object input. */
|
|
5
|
+
export type SharedObjectAccess = {
|
|
6
|
+
/** Whether reference is mutable */
|
|
7
|
+
mutable: boolean;
|
|
8
|
+
|
|
9
|
+
/** Set for the non-exclusive write access that system transactions take (`mutable` is false). */
|
|
10
|
+
mutability?: 'NonExclusiveWrite';
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type SharedObjectRef = SharedObjectAccess & {
|
|
5
14
|
/** Hex code as string representing the object id */
|
|
6
15
|
objectId: string;
|
|
7
16
|
|
|
8
17
|
/** The version the object was shared at */
|
|
9
18
|
initialSharedVersion: number | string;
|
|
10
|
-
|
|
11
|
-
/** Whether reference is mutable */
|
|
12
|
-
mutable: boolean;
|
|
13
19
|
};
|
|
14
20
|
|
|
15
21
|
export type SuiObjectRef = {
|
|
@@ -30,7 +30,7 @@ const GAS_SAFE_OVERHEAD = 1000n;
|
|
|
30
30
|
const MAX_GAS = 50_000_000_000;
|
|
31
31
|
|
|
32
32
|
/** Compute a gas budget from gasUsed effects data. */
|
|
33
|
-
|
|
33
|
+
function computeGasBudget(
|
|
34
34
|
gasUsed: { computationCost: string; storageCost: string; storageRebate: string },
|
|
35
35
|
gasPrice: bigint | string = 1n,
|
|
36
36
|
): string {
|
|
@@ -169,11 +169,9 @@ async function setGasBudget(
|
|
|
169
169
|
},
|
|
170
170
|
}),
|
|
171
171
|
include: { effects: true },
|
|
172
|
-
//
|
|
173
|
-
// balance payment, so the server must simulate with a mocked gas coin rather than
|
|
174
|
-
// selecting gas. gRPC and GraphQL support this option, and JSON-RPC always mocks gas.
|
|
172
|
+
// Placeholder payment for budget estimation; the server must not select gas.
|
|
175
173
|
doGasSelection: false,
|
|
176
|
-
}
|
|
174
|
+
});
|
|
177
175
|
|
|
178
176
|
if (simulateResult.$kind === 'FailedTransaction') {
|
|
179
177
|
const executionError = simulateResult.FailedTransaction.status.error ?? undefined;
|
package/src/client/core.ts
CHANGED
|
@@ -1,14 +1,60 @@
|
|
|
1
1
|
// Copyright (c) Mysten Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import { fromBase64 } from '@mysten/utils';
|
|
5
|
+
|
|
4
6
|
import { TypeTagSerializer } from '../bcs/type-tag-serializer.js';
|
|
5
7
|
import type { TransactionPlugin } from '../transactions/index.js';
|
|
8
|
+
import {
|
|
9
|
+
DEFAULT_RESTRICTED_MOVE_CALLS,
|
|
10
|
+
validateRestrictedMoveCalls,
|
|
11
|
+
} from '../transactions/restricted-move-calls.js';
|
|
12
|
+
import { deriveObjectID } from '../utils/derived-objects.js';
|
|
6
13
|
import { deriveDynamicFieldID } from '../utils/dynamic-fields.js';
|
|
7
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
normalizeStructTag,
|
|
16
|
+
normalizeSuiAddress,
|
|
17
|
+
parseStructTag,
|
|
18
|
+
SUI_ADDRESS_LENGTH,
|
|
19
|
+
} from '../utils/sui-types.js';
|
|
8
20
|
import { BaseClient } from './client.js';
|
|
9
21
|
import type { ClientWithExtensions, SuiClientTypes } from './types.js';
|
|
10
22
|
import { MvrClient } from './mvr.js';
|
|
11
23
|
import { bcs } from '../bcs/index.js';
|
|
24
|
+
import type { AnyLedgerStreamAdapter } from './stream/adapter.js';
|
|
25
|
+
import { SuiStreamError } from './stream/errors.js';
|
|
26
|
+
import { validateStreamFilter } from './stream/filter.js';
|
|
27
|
+
import { createLedgerStream } from './stream/run.js';
|
|
28
|
+
import { ObjectError } from './errors.js';
|
|
29
|
+
|
|
30
|
+
/** The shared `0x2::address_alias::AddressAliasState`, the parent of every alias set. */
|
|
31
|
+
const ADDRESS_ALIAS_STATE_ID = '0xa';
|
|
32
|
+
const ADDRESS_ALIAS_KEY_TYPE = '0x2::address_alias::AliasKey';
|
|
33
|
+
|
|
34
|
+
/** `0x2::address_alias::AddressAliases`: its ID and a `VecSet<address>`. */
|
|
35
|
+
const AddressAliasesBcs = bcs.struct('AddressAliases', {
|
|
36
|
+
id: bcs.Address,
|
|
37
|
+
aliases: bcs.struct('VecSet<address>', { contents: bcs.vector(bcs.Address) }),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/** What `CoreClient.createLedgerStreamAdapter` is asked to stream. */
|
|
41
|
+
export type LedgerStreamRequest =
|
|
42
|
+
| {
|
|
43
|
+
family: 'checkpoints';
|
|
44
|
+
options: SuiClientTypes.StreamCheckpointsOptions<
|
|
45
|
+
SuiClientTypes.StreamCheckpointInclude,
|
|
46
|
+
StreamFrames
|
|
47
|
+
>;
|
|
48
|
+
}
|
|
49
|
+
| {
|
|
50
|
+
family: 'transactions';
|
|
51
|
+
options: SuiClientTypes.StreamTransactionsOptions<
|
|
52
|
+
SuiClientTypes.TransactionInclude,
|
|
53
|
+
StreamFrames
|
|
54
|
+
>;
|
|
55
|
+
}
|
|
56
|
+
| { family: 'events'; options: SuiClientTypes.StreamEventsOptions<StreamFrames> };
|
|
57
|
+
type StreamFrames = SuiClientTypes.StreamFrameOptions;
|
|
12
58
|
|
|
13
59
|
export type ClientWithCoreApi = ClientWithExtensions<{
|
|
14
60
|
core: CoreClient;
|
|
@@ -17,6 +63,7 @@ export type ClientWithCoreApi = ClientWithExtensions<{
|
|
|
17
63
|
export interface CoreClientOptions extends SuiClientTypes.SuiClientOptions {
|
|
18
64
|
base: BaseClient;
|
|
19
65
|
mvr?: SuiClientTypes.MvrOptions;
|
|
66
|
+
restrictedMoveCalls?: readonly string[];
|
|
20
67
|
}
|
|
21
68
|
|
|
22
69
|
const DEFAULT_MVR_URLS: Record<string, string> = {
|
|
@@ -27,10 +74,17 @@ const DEFAULT_MVR_URLS: Record<string, string> = {
|
|
|
27
74
|
export abstract class CoreClient extends BaseClient implements SuiClientTypes.TransportMethods {
|
|
28
75
|
core = this;
|
|
29
76
|
mvr: SuiClientTypes.MvrMethods;
|
|
77
|
+
readonly restrictedMoveCalls: readonly string[];
|
|
30
78
|
|
|
31
79
|
constructor(options: CoreClientOptions) {
|
|
32
80
|
super(options);
|
|
33
81
|
|
|
82
|
+
this.restrictedMoveCalls = Object.freeze([
|
|
83
|
+
...(options.restrictedMoveCalls ?? DEFAULT_RESTRICTED_MOVE_CALLS),
|
|
84
|
+
]);
|
|
85
|
+
// Validate entries now rather than on the first build.
|
|
86
|
+
validateRestrictedMoveCalls(this.restrictedMoveCalls);
|
|
87
|
+
|
|
34
88
|
this.mvr = new MvrClient({
|
|
35
89
|
cache: this.cache.scope('core.mvr'),
|
|
36
90
|
url: options.mvr?.url ?? DEFAULT_MVR_URLS[this.network],
|
|
@@ -108,9 +162,9 @@ export abstract class CoreClient extends BaseClient implements SuiClientTypes.Tr
|
|
|
108
162
|
options?: SuiClientTypes.GetChainIdentifierOptions,
|
|
109
163
|
): Promise<SuiClientTypes.GetChainIdentifierResponse>;
|
|
110
164
|
|
|
111
|
-
abstract listDynamicFields(
|
|
112
|
-
options: SuiClientTypes.ListDynamicFieldsOptions
|
|
113
|
-
): Promise<SuiClientTypes.ListDynamicFieldsResponse
|
|
165
|
+
abstract listDynamicFields<Include extends SuiClientTypes.DynamicFieldInclude = {}>(
|
|
166
|
+
options: SuiClientTypes.ListDynamicFieldsOptions<Include>,
|
|
167
|
+
): Promise<SuiClientTypes.ListDynamicFieldsResponse<Include>>;
|
|
114
168
|
|
|
115
169
|
abstract listTransactions<Include extends SuiClientTypes.TransactionInclude = {}>(
|
|
116
170
|
options: SuiClientTypes.ListTransactionsOptions<Include>,
|
|
@@ -120,11 +174,39 @@ export abstract class CoreClient extends BaseClient implements SuiClientTypes.Tr
|
|
|
120
174
|
options: SuiClientTypes.ListEventsOptions,
|
|
121
175
|
): Promise<SuiClientTypes.ListEventsResponse>;
|
|
122
176
|
|
|
177
|
+
abstract listCheckpoints(
|
|
178
|
+
options: SuiClientTypes.ListCheckpointsOptions,
|
|
179
|
+
): Promise<SuiClientTypes.ListCheckpointsResponse>;
|
|
180
|
+
|
|
123
181
|
abstract resolveTransactionPlugin(): TransactionPlugin;
|
|
124
182
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
183
|
+
/**
|
|
184
|
+
* Verifies a personal message or transaction signature on the node; see the top-level
|
|
185
|
+
* `client.verifySignature`. `valid: false` means invalid, malformed or not authorized for
|
|
186
|
+
* `address`; network and protocol errors throw.
|
|
187
|
+
*/
|
|
188
|
+
abstract verifySignature(
|
|
189
|
+
options: SuiClientTypes.VerifySignatureOptions,
|
|
190
|
+
): Promise<SuiClientTypes.VerifySignatureResponse>;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @deprecated Use `verifySignature`. This method accepts signatures from the address's aliases,
|
|
194
|
+
* like `verifySignature` does by default.
|
|
195
|
+
*/
|
|
196
|
+
async verifyZkLoginSignature({
|
|
197
|
+
bytes,
|
|
198
|
+
intentScope,
|
|
199
|
+
...options
|
|
200
|
+
}: SuiClientTypes.VerifyZkLoginSignatureOptions): Promise<SuiClientTypes.ZkLoginVerifyResponse> {
|
|
201
|
+
const message = fromBase64(bytes);
|
|
202
|
+
const { valid, reason } = await this.verifySignature({
|
|
203
|
+
...options,
|
|
204
|
+
...(intentScope === 'TransactionData'
|
|
205
|
+
? { transaction: message }
|
|
206
|
+
: { personalMessage: message }),
|
|
207
|
+
});
|
|
208
|
+
return { success: valid, errors: reason ? [reason] : [] };
|
|
209
|
+
}
|
|
128
210
|
|
|
129
211
|
abstract getMoveFunction(
|
|
130
212
|
options: SuiClientTypes.GetMoveFunctionOptions,
|
|
@@ -138,6 +220,95 @@ export abstract class CoreClient extends BaseClient implements SuiClientTypes.Tr
|
|
|
138
220
|
options: SuiClientTypes.ResolveNameServiceAddressOptions,
|
|
139
221
|
): Promise<SuiClientTypes.ResolveNameServiceAddressResponse>;
|
|
140
222
|
|
|
223
|
+
/**
|
|
224
|
+
* Streams checkpoints in ledger order, resumable from any delivered frame's `resumeToken`.
|
|
225
|
+
* Follows new checkpoints by default; see `SuiClientTypes.StreamOptions`.
|
|
226
|
+
*/
|
|
227
|
+
streamCheckpoints<
|
|
228
|
+
Include extends SuiClientTypes.StreamCheckpointInclude = {},
|
|
229
|
+
Frames extends SuiClientTypes.StreamFrameOptions = {},
|
|
230
|
+
>(
|
|
231
|
+
options: SuiClientTypes.StreamCheckpointsOptions<Include, Frames> = {},
|
|
232
|
+
): AsyncGenerator<SuiClientTypes.StreamCheckpointFrame<Include, Frames>> {
|
|
233
|
+
return this.#ledgerStream({ family: 'checkpoints', options });
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/** Streams transactions matching `filter` in ledger order. See `streamCheckpoints`. */
|
|
237
|
+
streamTransactions<
|
|
238
|
+
Include extends SuiClientTypes.TransactionInclude = {},
|
|
239
|
+
Frames extends SuiClientTypes.StreamFrameOptions = {},
|
|
240
|
+
>(
|
|
241
|
+
options: SuiClientTypes.StreamTransactionsOptions<Include, Frames> = {},
|
|
242
|
+
): AsyncGenerator<SuiClientTypes.StreamTransactionFrame<Include, Frames>> {
|
|
243
|
+
return this.#ledgerStream({ family: 'transactions', options });
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** Streams events matching `filter` in ledger order. See `streamCheckpoints`. */
|
|
247
|
+
streamEvents<Frames extends SuiClientTypes.StreamFrameOptions = {}>(
|
|
248
|
+
options: SuiClientTypes.StreamEventsOptions<Frames> = {},
|
|
249
|
+
): AsyncGenerator<SuiClientTypes.StreamEventFrame<Frames>> {
|
|
250
|
+
return this.#ledgerStream({ family: 'events', options });
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Returns the transport's stream adapter. Called on the stream's first `next()`; must not do I/O.
|
|
255
|
+
* The default throws, for transports without stream support.
|
|
256
|
+
* @internal
|
|
257
|
+
*/
|
|
258
|
+
protected createLedgerStreamAdapter(_request: LedgerStreamRequest): AnyLedgerStreamAdapter {
|
|
259
|
+
throw new SuiStreamError(
|
|
260
|
+
'InvalidOptions',
|
|
261
|
+
`${this.constructor.name} does not support ledger streams`,
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
#ledgerStream<Result>(request: LedgerStreamRequest): AsyncGenerator<Result> {
|
|
266
|
+
return createLedgerStream(request.options, () => {
|
|
267
|
+
validateStreamFilter(request);
|
|
268
|
+
return this.createLedgerStreamAdapter(request);
|
|
269
|
+
}) as AsyncGenerator<Result>;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* The current alias set of `address`: the addresses whose signatures are accepted for it. An
|
|
274
|
+
* address that never enabled aliases has none on chain and is only its own alias.
|
|
275
|
+
*/
|
|
276
|
+
async getAddressAliases(
|
|
277
|
+
options: SuiClientTypes.GetAddressAliasesOptions,
|
|
278
|
+
): Promise<SuiClientTypes.GetAddressAliasesResponse> {
|
|
279
|
+
const address = normalizeSuiAddress(options.address);
|
|
280
|
+
const objectId = deriveObjectID(
|
|
281
|
+
ADDRESS_ALIAS_STATE_ID,
|
|
282
|
+
ADDRESS_ALIAS_KEY_TYPE,
|
|
283
|
+
bcs.Address.serialize(address).toBytes(),
|
|
284
|
+
);
|
|
285
|
+
const {
|
|
286
|
+
objects: [object],
|
|
287
|
+
} = await this.getObjects({
|
|
288
|
+
objectIds: [objectId],
|
|
289
|
+
signal: options.signal,
|
|
290
|
+
include: { content: true },
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
if (object instanceof ObjectError && object.reason === 'notFound') {
|
|
294
|
+
return {
|
|
295
|
+
addressAliases: { address, enabled: false, aliases: [address], objectId },
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
if (object instanceof Error) {
|
|
299
|
+
throw object;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return {
|
|
303
|
+
addressAliases: {
|
|
304
|
+
address,
|
|
305
|
+
enabled: true,
|
|
306
|
+
aliases: AddressAliasesBcs.parse(object.content).aliases.contents,
|
|
307
|
+
objectId,
|
|
308
|
+
},
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
|
|
141
312
|
async getDynamicField(
|
|
142
313
|
options: SuiClientTypes.GetDynamicFieldOptions,
|
|
143
314
|
): Promise<SuiClientTypes.GetDynamicFieldResponse> {
|
|
@@ -194,6 +365,7 @@ export abstract class CoreClient extends BaseClient implements SuiClientTypes.Tr
|
|
|
194
365
|
typeof nameTypeParam === 'string' ? nameTypeParam : normalizeStructTag(nameTypeParam),
|
|
195
366
|
bcs: options.name.bcs,
|
|
196
367
|
},
|
|
368
|
+
valueType,
|
|
197
369
|
value: {
|
|
198
370
|
type: valueType,
|
|
199
371
|
bcs: valueBcs,
|
|
@@ -255,7 +427,7 @@ export abstract class CoreClient extends BaseClient implements SuiClientTypes.Tr
|
|
|
255
427
|
});
|
|
256
428
|
|
|
257
429
|
// Default schedule tuned to testnet measurements:
|
|
258
|
-
// - Fullnode (gRPC
|
|
430
|
+
// - Fullnode (gRPC): p50=130ms, p95=330ms
|
|
259
431
|
// - GraphQL indexer: p50=1300ms, p95=1430ms
|
|
260
432
|
// After schedule exhausted, repeats the last interval.
|
|
261
433
|
const schedule = pollSchedule ?? [0, 300, 600, 1500, 3500];
|
package/src/client/errors.ts
CHANGED
|
@@ -64,3 +64,15 @@ export class TransactionError extends SuiClientError {
|
|
|
64
64
|
this.digest = digest;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The retry reason for an HTTP error status: 429 is `RateLimited`, 503 is `Unavailable`, 408 and
|
|
70
|
+
* other 5xx except 501 are `ServerError`, and anything else is not retryable.
|
|
71
|
+
*/
|
|
72
|
+
export function httpStatusReason(status: number): SuiClientTypes.RetryReason | undefined {
|
|
73
|
+
if (status === 429) return 'RateLimited';
|
|
74
|
+
if (status === 503) return 'Unavailable';
|
|
75
|
+
if (status === 501) return undefined;
|
|
76
|
+
if (status === 408 || status >= 500) return 'ServerError';
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
package/src/client/index.ts
CHANGED
|
@@ -8,9 +8,9 @@ import type { ClientWithExtensions, SuiClientTypes, SuiClientRegistration } from
|
|
|
8
8
|
export {
|
|
9
9
|
extractStatusFromEffectsBcs,
|
|
10
10
|
formatMoveAbortMessage,
|
|
11
|
-
parseTransactionBcs,
|
|
12
11
|
parseTransactionEffectsBcs,
|
|
13
12
|
} from './utils.js';
|
|
13
|
+
export { parseTransactionBcs, parseTransactionDataBcs } from './transaction-data.js';
|
|
14
14
|
|
|
15
15
|
export {
|
|
16
16
|
BaseClient,
|
|
@@ -32,5 +32,7 @@ export {
|
|
|
32
32
|
type TransactionErrorReason,
|
|
33
33
|
} from './errors.js';
|
|
34
34
|
|
|
35
|
+
export { SuiStreamError, type SuiStreamErrorCode } from './stream/errors.js';
|
|
36
|
+
|
|
35
37
|
export { ClientCache, type ClientCacheOptions } from './cache.js';
|
|
36
|
-
export { type NamedPackagesOverrides } from './mvr.js';
|
|
38
|
+
export { MvrRequestError, type NamedPackagesOverrides } from './mvr.js';
|