@mysten/sui 2.39.0 → 3.0.0
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 +162 -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 +4 -2
- package/dist/client/index.mjs +5 -2
- 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 +12 -0
- package/dist/client/transaction-data.d.mts.map +1 -0
- package/dist/client/transaction-data.mjs +469 -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 +3 -1
- package/dist/client/utils.d.mts.map +1 -1
- package/dist/client/utils.mjs +91 -26
- 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 +293 -117
- 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.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.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 +14 -13
- 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 +135 -133
- 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/data/v1.d.mts +239 -239
- package/dist/transactions/data/v1.d.mts.map +1 -1
- package/dist/transactions/data/v2.d.mts +16 -16
- package/dist/transactions/data/v2.d.mts.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 +250 -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 +3 -4
- 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 -1
- 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 +587 -0
- package/src/client/transaction-resolver.ts +158 -69
- package/src/client/types.ts +530 -115
- package/src/client/utils.ts +147 -50
- 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
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# Migrate to 3.0
|
|
2
|
+
|
|
3
|
+
> Breaking changes in @mysten/sui 3.0, which removes the deprecated JSON-RPC transport
|
|
4
|
+
|
|
5
|
+
`@mysten/sui` 3.0 removes the JSON-RPC transport. If you still use `SuiJsonRpcClient`, move to
|
|
6
|
+
[`SuiGrpcClient`](/sui/clients/grpc) (recommended) or [`SuiGraphQLClient`](/sui/clients/graphql) by
|
|
7
|
+
following [Migrating from JSON-RPC](/sui/migrations/sui-2.0/json-rpc-migration), which maps every
|
|
8
|
+
JSON-RPC method to its replacement. Code that already runs on gRPC or GraphQL needs few or no
|
|
9
|
+
changes.
|
|
10
|
+
|
|
11
|
+
Every `@mysten/*` package with a peer dependency on `@mysten/sui`, except the legacy
|
|
12
|
+
`@mysten/dapp-kit`, gets a new release that requires `@mysten/sui@^3`: a major release, or a minor
|
|
13
|
+
release for packages still on 0.x. `@mysten/dapp-kit-react` also gets a major release, because it
|
|
14
|
+
depends on `@mysten/dapp-kit-core` 2.0. Apart from the items below, these releases have no breaking
|
|
15
|
+
changes: upgrade them together with `@mysten/sui`.
|
|
16
|
+
|
|
17
|
+
The legacy `@mysten/dapp-kit` has a peer dependency on `@mysten/sui` and uses JSON-RPC, so it can't
|
|
18
|
+
run on 3.0 or keep a 2.x copy of its own.
|
|
19
|
+
[Migrate to `@mysten/dapp-kit-react`](/sui/migrations/sui-2.0/dapp-kit) before upgrading.
|
|
20
|
+
|
|
21
|
+
## Breaking changes
|
|
22
|
+
|
|
23
|
+
### Removed JSON-RPC APIs
|
|
24
|
+
|
|
25
|
+
- **`@mysten/sui/jsonRpc` no longer supports JSON-RPC.** Code that imports it still loads, but
|
|
26
|
+
`SuiJsonRpcClient`, `JsonRpcHTTPTransport` and the JSON-RPC error classes throw when constructed,
|
|
27
|
+
and `isSuiJsonRpcClient` returns `false`. Its types, such as `ObjectOwner`, are deprecated aliases
|
|
28
|
+
of `any`. Follow [Migrating from JSON-RPC](/sui/migrations/sui-2.0/json-rpc-migration), and use
|
|
29
|
+
the `SuiClientTypes` equivalents from `@mysten/sui/client` for the types.
|
|
30
|
+
- **`getJsonRpcFullnodeUrl` throws.** Pass the full node URL (for example
|
|
31
|
+
`https://fullnode.mainnet.sui.io:443`) to `SuiGrpcClient`'s `baseUrl`.
|
|
32
|
+
- **`normalizedTypeToMoveTypeSignature` is removed.** `getMoveFunction` already returns
|
|
33
|
+
`OpenSignature`s.
|
|
34
|
+
- **Untyped pure values are no longer supported.** `SuiJsonRpcClient` serialized `UnresolvedPure`
|
|
35
|
+
inputs, such as raw Move call arguments in v1 transaction JSON restored with `Transaction.from`,
|
|
36
|
+
from the Move function signature; `SuiGrpcClient` and `SuiGraphQLClient` reject them. Pass typed
|
|
37
|
+
values such as `tx.pure.u64(...)` instead.
|
|
38
|
+
|
|
39
|
+
### Core API
|
|
40
|
+
|
|
41
|
+
- **`listDynamicFields` pagination loops may need a type annotation.** If a loop that passes the
|
|
42
|
+
cursor back in fails with `TS7022`, annotate the page as
|
|
43
|
+
`SuiClientTypes.ListDynamicFieldsResponse`.
|
|
44
|
+
- **On `SuiGrpcClient`, `listDynamicFields` with `include: { value: true }` returns a dynamic object
|
|
45
|
+
field's child object as its value**, matching `SuiGraphQLClient`: `value.bcs` is the child
|
|
46
|
+
object's BCS contents instead of its ID. Read the child's ID from `childId`.
|
|
47
|
+
- **On `SuiGraphQLClient`, an empty last page of `listTransactions` or `listEvents` has `null`
|
|
48
|
+
cursors**, as on `SuiGrpcClient`. When polling, keep your previous cursor
|
|
49
|
+
(`cursor = page.endCursor ?? cursor`).
|
|
50
|
+
- **On `SuiGraphQLClient`, a transaction's `events` take `packageId` and `module` from the Move call
|
|
51
|
+
that emitted the event**, as `listEvents` and `SuiGrpcClient` do, rather than from the event type.
|
|
52
|
+
|
|
53
|
+
### Transaction data and BCS
|
|
54
|
+
|
|
55
|
+
- **Transaction data (`include: { transaction: true }`) has a `kind`.** Inputs and commands carry
|
|
56
|
+
`$kind`, so narrow with `input.$kind === 'Pure'` rather than `'Pure' in input`. Decode transaction
|
|
57
|
+
bytes into this type with `parseTransactionDataBcs`. See
|
|
58
|
+
[transaction data](/sui/clients/executing#transaction-data). It is no longer the builder's
|
|
59
|
+
serialized type, so to rebuild a `Transaction` from a query result, request
|
|
60
|
+
`include: { bcs: true }` and pass the result's `bcs` to `Transaction.from`.
|
|
61
|
+
- **`bcs.Owner` has a `Party` variant, and `bcs.MoveObjectType`'s `AccumulatorBalanceWrapper` is
|
|
62
|
+
renamed to `SuiBalanceAccumulatorField`.**
|
|
63
|
+
- **System transaction kinds decoded with `bcs.TransactionKind` use named fields instead of
|
|
64
|
+
tuples**, and `authenticatorObjInitialSharedVersion` and `randomnessObjInitialSharedVersion` are
|
|
65
|
+
renamed to `authenticatorObjectInitialSharedVersion` and `randomnessObjectInitialSharedVersion`.
|
|
66
|
+
- **`SuiClientTypes.MoveLocation.function` (the function index) is removed.** Use
|
|
67
|
+
`location.functionName`.
|
|
68
|
+
- **`bcs.TransactionEffects` tuples are structs with named fields**, for example `changedObjects`
|
|
69
|
+
entries (`{ objectId, inputState, outputState, idOperation }`), `IntegerTuple`
|
|
70
|
+
(`{ first, second }`) and V1 `modifiedAtVersions` entries (`{ objectId, version }`).
|
|
71
|
+
`InsufficientBalanceForWithdraw` is renamed to `InsufficientFundsForWithdraw` and
|
|
72
|
+
`congested_objects` to `congestedObjects`. The encoded bytes are unchanged.
|
|
73
|
+
- **Multisig BCS fields are camelCase:** `multisigPk` instead of `multisig_pk` and `pkMap` instead
|
|
74
|
+
of `pk_map`. The old names still work on `parseSerializedSignature` results but are deprecated.
|
|
75
|
+
- **Execution error names in `effects.status` match `SuiGrpcClient` everywhere**, including
|
|
76
|
+
`SuiGraphQLClient` and dApp Kit wallet results: `InvalidBcsBytes`, `InvalidUsageOfPureArgument`,
|
|
77
|
+
`ConsensusObjectOperationNotAllowed` and `PackageIdDoesNotMatch` replace `InvalidBCSBytes`,
|
|
78
|
+
`InvalidUsageOfPureArg`, `SharedObjectOperationNotAllowed` and `PackageIDDoesNotMatch`.
|
|
79
|
+
- **`parseGrpcTransactionResponse` needs `transaction.sender` in the read mask.**
|
|
80
|
+
- **`parseTransactionBcs` returns the transaction builder's `TransactionData`** from
|
|
81
|
+
`@mysten/sui/transactions`, not `SuiClientTypes.TransactionData`. Use `parseTransactionDataBcs`
|
|
82
|
+
where you need the client type.
|
|
83
|
+
- **Building or serializing a transaction that calls `0x2::address_alias` throws.** Pass
|
|
84
|
+
`restrictedMoveCalls: []` to the client constructor, or to `build` or `toJSON`, to allow it. See
|
|
85
|
+
[Restricted Move calls](/sui/transactions/reference#restricted-move-calls).
|
|
86
|
+
|
|
87
|
+
### Transports
|
|
88
|
+
|
|
89
|
+
- **gRPC-web uses the binary format by default.** If a proxy in front of your full node only
|
|
90
|
+
supports `application/grpc-web-text`, pass `format: 'text'`.
|
|
91
|
+
- **Client URLs are checked at construction.** A GraphQL `url` or gRPC `baseUrl` that is neither an
|
|
92
|
+
absolute http(s) URL nor a path starting with `/` throws when the client is created.
|
|
93
|
+
- **Network errors changed.** `SuiGrpcClient` reports `UNAVAILABLE` instead of `INTERNAL`, and
|
|
94
|
+
`SuiGraphQLClient` throws `SuiGraphQLRequestError`, with the original error as `cause`, for
|
|
95
|
+
network failures and malformed or unreadable bodies.
|
|
96
|
+
- **The raw gRPC `GetPackageRequest` type requires a `selector`.** Existing
|
|
97
|
+
`client.movePackageService.getPackage({ packageId })` calls still work at runtime. To satisfy the
|
|
98
|
+
type, pass `selector: { oneofKind: undefined }` or build the request with
|
|
99
|
+
`GrpcTypes.GetPackageRequest.create({ packageId })`.
|
|
100
|
+
|
|
101
|
+
### Signature verification
|
|
102
|
+
|
|
103
|
+
- **`verifyPersonalMessageSignature`, `verifyTransactionSignature`,
|
|
104
|
+
`isValidPersonalMessageSignature` and `isValidTransactionSignature` require a `client` or
|
|
105
|
+
`offline: true`.** Without either it's a type error; at runtime they verify offline and log a
|
|
106
|
+
warning. With a client, the node verifies the signature and checks zkLogin signatures; with
|
|
107
|
+
`address`, it also accepts the address's [address aliases](/sui/cryptography#address-aliases), and
|
|
108
|
+
throws on nodes that can't check them unless you pass `checkAddressAliases: false`. With
|
|
109
|
+
`offline: true`, zkLogin signatures throw. See
|
|
110
|
+
[Online or offline](/sui/cryptography#online-or-offline) for which to choose.
|
|
111
|
+
- **With a client, the public key the verify helpers return may belong to one of the address's
|
|
112
|
+
aliases.** Use `address`, not `publicKey.toSuiAddress()`, as the account's identity.
|
|
113
|
+
- **`verifyZkLoginSignature` accepts signatures from the address's aliases** and throws on nodes
|
|
114
|
+
that can't check address aliases. It's deprecated: use `client.core.verifySignature`.
|
|
115
|
+
|
|
116
|
+
## Other packages
|
|
117
|
+
|
|
118
|
+
- **`@mysten-incubation/sponsor`'s `userSignatureMatchesSender` verifies on the node**, and fails
|
|
119
|
+
with `ANALYSIS_FAILED` if the node can't be reached.
|
|
120
|
+
- **`@mysten/wallet-sdk`'s `restrictedMoveCalls` and `@mysten-incubation/sponsor`'s
|
|
121
|
+
`noRestrictedMoveCalls` take `{ restrictedMoveCalls }`** (`package`, `package::module` or
|
|
122
|
+
`package::module::function` entries) instead of `addressAliases` and `targets`, and throw on any
|
|
123
|
+
other option. The list replaces the default, so keep `'0x2::address_alias'` in it to keep flagging
|
|
124
|
+
alias changes. Results no longer have a `level`, and `matchedBy` is a single entry instead of an
|
|
125
|
+
array.
|
|
126
|
+
- **`@mysten/wallet-standard` and `@mysten/kiosk` no longer use JSON-RPC types.** Import legacy
|
|
127
|
+
response types from the `SuiJsonRpcTypes` namespace in `@mysten/wallet-standard`.
|
|
128
|
+
`TransferPolicy.owner` in `@mysten/kiosk` is a `SuiClientTypes.ObjectOwner`.
|
|
129
|
+
|
|
130
|
+
Wallets that still implement the deprecated `sui:signAndExecuteTransactionBlock` feature can build
|
|
131
|
+
its legacy response from a gRPC or GraphQL execution with `@mysten/wallet-sdk/json-rpc-compat`:
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
|
|
135
|
+
mappableIncludeFor,
|
|
136
|
+
transactionBlockResponseFromExecution,
|
|
137
|
+
} from '@mysten/wallet-sdk/json-rpc-compat';
|
|
138
|
+
|
|
139
|
+
// `input` is the dApp's `sui:signAndExecuteTransactionBlock` input; `bytes` (a `Uint8Array`) and
|
|
140
|
+
// `signature` are what the wallet signed.
|
|
141
|
+
const result = await client.core.executeTransaction({
|
|
142
|
+
transaction: bytes,
|
|
143
|
+
signatures: [signature],
|
|
144
|
+
include: mappableIncludeFor(input.options),
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
return transactionBlockResponseFromExecution(result.Transaction ?? result.FailedTransaction, {
|
|
148
|
+
bytes,
|
|
149
|
+
signatures: [signature],
|
|
150
|
+
options: input.options,
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
For wallet code that still reads the JSON-RPC dry-run shape, `dryRunFromSimulation` builds a
|
|
155
|
+
`DryRunTransactionBlockResponse` from the simulated transaction
|
|
156
|
+
(`result.Transaction ?? result.FailedTransaction`) of a `simulateTransaction` call made with
|
|
157
|
+
`include: { balanceChanges: true, effects: true, events: true, objectTypes: true, transaction: true }`.
|
|
158
|
+
|
|
159
|
+
## Dependencies that still require 2.x
|
|
160
|
+
|
|
161
|
+
You can upgrade before your dependencies release versions for 3.0. How a dependency lists
|
|
162
|
+
`@mysten/sui` decides which copy it uses:
|
|
163
|
+
|
|
164
|
+
- **A regular dependency on 2.x:** it installs its own 2.x copy and keeps working on it.
|
|
165
|
+
`Transaction`s built by its copy skip the
|
|
166
|
+
[restricted Move calls](/sui/transactions/reference#restricted-move-calls) check.
|
|
167
|
+
- **A peer dependency on `^2`:** npm refuses to install it next to 3.0. pnpm and Yarn print a
|
|
168
|
+
warning and give it your 3.0 copy.
|
|
169
|
+
|
|
170
|
+
Run `npm ls @mysten/sui` or `pnpm why @mysten/sui` to see which copies you have.
|
|
171
|
+
|
|
172
|
+
Let packages keep their own 2.x copy where you can. Only values that cross between your code and the
|
|
173
|
+
package are affected:
|
|
174
|
+
|
|
175
|
+
- Clients, `Transaction`s and signers from your copy may not type-check where its API expects its
|
|
176
|
+
own, and fail its `instanceof` checks on SDK classes. A package that accepts `ClientWithCoreApi`
|
|
177
|
+
and doesn't use `instanceof` on SDK classes accepts them at runtime.
|
|
178
|
+
- A package that calls methods on your 3.0 client gets 3.0 results, with the [Core API](#core-api)
|
|
179
|
+
and [transaction data](#transaction-data-and-bcs) changes above.
|
|
180
|
+
|
|
181
|
+
If a package needs to use your copy, for example a peer dependency that npm won't install, add an
|
|
182
|
+
override:
|
|
183
|
+
|
|
184
|
+
```json title="package.json (npm)"
|
|
185
|
+
{
|
|
186
|
+
"overrides": {
|
|
187
|
+
"@mysten/sui": "$@mysten/sui"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
`$@mysten/sui` reuses the version in your own `dependencies`.
|
|
193
|
+
|
|
194
|
+
```yaml title="pnpm-workspace.yaml (pnpm 10.5 and later)"
|
|
195
|
+
overrides:
|
|
196
|
+
'@mysten/sui': '$@mysten/sui'
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Earlier pnpm versions ignore overrides in `pnpm-workspace.yaml`: put the same entry under
|
|
200
|
+
`pnpm.overrides` in `package.json` instead. pnpm resolves `$@mysten/sui` from the root
|
|
201
|
+
`package.json`, so if only a workspace package depends on `@mysten/sui`, write the range instead,
|
|
202
|
+
for example `^3.0.0`.
|
|
203
|
+
|
|
204
|
+
```json title="package.json (Yarn, Bun)"
|
|
205
|
+
{
|
|
206
|
+
"resolutions": {
|
|
207
|
+
"@mysten/sui": "^3.0.0"
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Yarn still prints a peer dependency warning, which you can ignore.
|
|
213
|
+
|
|
214
|
+
An override applies to every package, so all of them run on 3.0, as does a peer dependency that pnpm
|
|
215
|
+
or Yarn gives your copy. The breaking changes above affect these packages as they affect your code.
|
|
216
|
+
Most often, a package that imports `@mysten/sui/jsonRpc` loads, but throws when it uses JSON-RPC. It
|
|
217
|
+
needs a release for 3.0; until then, don't add an override, so that a regular dependency keeps its
|
|
218
|
+
own 2.x copy.
|
|
219
|
+
|
|
220
|
+
Test the flows that use each dependency, and remove the override once every dependency supports 3.0.
|
|
221
|
+
|
|
222
|
+
## Libraries built on `@mysten/sui`
|
|
223
|
+
|
|
224
|
+
If you publish a package that uses `@mysten/sui`, release a version for 3.0 that:
|
|
225
|
+
|
|
226
|
+
- **Lists `@mysten/sui@^3` in `peerDependencies`**, not `dependencies`, so apps keep a single copy.
|
|
227
|
+
See [Building SDKs](/sui/sdk-building#use-mysten-packages-as-peer-dependencies).
|
|
228
|
+
- **Doesn't import `@mysten/sui/jsonRpc`.** On 3.0 its classes and `getJsonRpcFullnodeUrl` throw,
|
|
229
|
+
and its types are `any`.
|
|
230
|
+
- **Accepts `ClientWithCoreApi`** from `@mysten/sui/client` instead of a specific client class, and
|
|
231
|
+
reads through `client.core`.
|
|
232
|
+
- **Doesn't use `instanceof` on SDK classes**, which fails for values from another copy of
|
|
233
|
+
`@mysten/sui`. Use `isTransaction` from `@mysten/sui/transactions`, `isSuiGrpcClient` from
|
|
234
|
+
`@mysten/sui/grpc` and `isSuiGraphQLClient` from `@mysten/sui/graphql`.
|
|
235
|
+
|
|
236
|
+
## New in 3.0
|
|
237
|
+
|
|
238
|
+
- `listTransactions` filters accept `affectedAddress` and `affectedObject`, and `sender` combines
|
|
239
|
+
with other predicates.
|
|
240
|
+
- `listTransactions` and `listEvents` accept `startCheckpoint` and `endCheckpoint`, and `after` and
|
|
241
|
+
`before` can be combined to read a window.
|
|
242
|
+
- `doGasSelection` is available on every client's `simulateTransaction`.
|
|
243
|
+
- A `listCheckpoints` method for paging through checkpoints.
|
|
244
|
+
- `SuiGraphQLClient.subscribe` runs GraphQL subscriptions; `subscriptionUrl` sets their endpoint.
|
|
245
|
+
- Resumable checkpoint, transaction, and event streams on `SuiGrpcClient` and `SuiGraphQLClient`.
|
|
246
|
+
See [Resumable ledger streams](/sui/clients/streaming).
|
|
247
|
+
- `client.core.listDynamicFields({ include: { value: true } })` returns each field's value with the
|
|
248
|
+
listing, on every client.
|
|
249
|
+
- `client.core.verifySignature`, which verifies a personal message or transaction signature on the
|
|
250
|
+
node and checks address aliases, and `client.core.getAddressAliases`.
|
package/docs/plugins.md
CHANGED
|
@@ -50,21 +50,21 @@ objects or Pure values and can be represented in several different ways:
|
|
|
50
50
|
`initialSharedVersion`, and whether the shared object is used mutably.
|
|
51
51
|
- `Receiving`: A reference to a receiving object, including the object's `id`, `version`, and
|
|
52
52
|
`digest`.
|
|
53
|
-
- `UnresolvedPure`: A
|
|
53
|
+
- `UnresolvedPure`: A pure value that has not been serialized to BCS. The built-in clients do not
|
|
54
|
+
support untyped pure values; use typed inputs such as `tx.pure.u64(value)`.
|
|
54
55
|
- `UnresolvedObject`: A partial reference to an object, often containing just the object's `id`, but
|
|
55
56
|
might also include a version, digest, or initialSharedVersion.
|
|
56
57
|
|
|
57
58
|
## Lifecycle of a transaction
|
|
58
59
|
|
|
59
|
-
Because transactions can contain `
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
BCS.
|
|
60
|
+
Because transactions can contain `UnresolvedObject` inputs, these values need to be resolved before
|
|
61
|
+
the transaction can be serialized to BCS. However, these unresolved inputs can be represented in
|
|
62
|
+
JSON. What might not be able to be represented in JSON are Transaction Intents. Transaction Intents
|
|
63
|
+
represent custom concepts added by plugins or third-party SDKs. To account for this, the build
|
|
64
|
+
process of a transaction is split into two phases: serialization and building. Serialization
|
|
65
|
+
prepares the transaction to be serialized to JSON by running serialization plugins, and resolving
|
|
66
|
+
any unsupported intents. The Build phase then runs, which runs build plugins and resolves any
|
|
67
|
+
`UnresolvedObject` inputs, before the transaction is serialized to BCS.
|
|
68
68
|
|
|
69
69
|
## Serialization plugins
|
|
70
70
|
|
package/docs/sdk-building.md
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
This guide covers recommended patterns for building TypeScript SDKs that integrate with the Sui SDK.
|
|
6
6
|
Following these patterns ensures your SDK integrates seamlessly with the ecosystem, works with
|
|
7
7
|
`SuiGrpcClient` and `SuiGraphQLClient` through the shared Core API, and composes well with other
|
|
8
|
-
SDKs.
|
|
9
|
-
Core API contract.
|
|
8
|
+
SDKs.
|
|
10
9
|
|
|
11
10
|
All SDKs should depend on [`ClientWithCoreApi`](./clients/core), which is the transport-agnostic
|
|
12
11
|
interface implemented by Sui clients. This lets application code choose one concrete client and use
|
|
@@ -24,11 +23,11 @@ duplicate code.
|
|
|
24
23
|
{
|
|
25
24
|
"name": "@your-org/your-sdk",
|
|
26
25
|
"peerDependencies": {
|
|
27
|
-
"@mysten/sui": "^
|
|
26
|
+
"@mysten/sui": "^3.0.0",
|
|
28
27
|
"@mysten/bcs": "^2.0.0"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
|
-
"@mysten/sui": "^
|
|
30
|
+
"@mysten/sui": "^3.0.0",
|
|
32
31
|
"@mysten/bcs": "^2.0.0"
|
|
33
32
|
}
|
|
34
33
|
}
|
|
@@ -254,10 +254,10 @@ Gasless transactions are limited to transactions that send funds as balances for
|
|
|
254
254
|
allowlisted stablecoins. Using `0x2::balance::send_funds` with `tx.balance()` is the recommended way
|
|
255
255
|
to build gasless transactions with the TypeScript SDK.
|
|
256
256
|
|
|
257
|
-
### SDK support
|
|
257
|
+
### SDK support
|
|
258
258
|
|
|
259
|
-
When
|
|
260
|
-
the gas price is set when the transaction is built.
|
|
259
|
+
When a transaction is built with `SuiGrpcClient` or `SuiGraphQLClient`, transactions that qualify
|
|
260
|
+
are automatically detected, and the gas price is set when the transaction is built.
|
|
261
261
|
|
|
262
262
|
```tsx
|
|
263
263
|
|
|
@@ -282,14 +282,9 @@ const result = await client.signAndExecuteTransaction({
|
|
|
282
282
|
});
|
|
283
283
|
```
|
|
284
284
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
and the PTB shape is eligible. Otherwise the transaction fails at validation.
|
|
289
|
-
|
|
290
|
-
> **Warning:** If your wallet builds transactions with gRPC but executes through a different transport (for
|
|
291
|
-
> example, dapp-kit wallets that still execute over JSON-RPC), pass the gRPC client to `build` so
|
|
292
|
-
> the gas price still gets set correctly:
|
|
285
|
+
> **Warning:** If your wallet builds transactions with one client but executes them somewhere else (for example,
|
|
286
|
+
> through its own backend), pass a gRPC or GraphQL client to `build` so the gas price still gets set
|
|
287
|
+
> correctly:
|
|
293
288
|
>
|
|
294
289
|
> ```tsx
|
|
295
290
|
> const bytes = await tx.build({ client: grpcClient });
|
|
@@ -377,4 +377,39 @@ const [a, b] = tx.moveCall({ target: '0xPkg::mod::returns_two' });
|
|
|
377
377
|
// or
|
|
378
378
|
const result = tx.moveCall({ target: '0xPkg::mod::returns_two' });
|
|
379
379
|
tx.transferObjects([result[0], result[1]], address);
|
|
380
|
-
```
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
## Restricted Move calls
|
|
383
|
+
|
|
384
|
+
Building or serializing a transaction that makes a restricted Move call throws. The default
|
|
385
|
+
(`DEFAULT_RESTRICTED_MOVE_CALLS`) is only `0x2::address_alias`: adding an alias lets another address
|
|
386
|
+
sign for the account.
|
|
387
|
+
|
|
388
|
+
Configure the list on the client; `[]` turns the check off:
|
|
389
|
+
|
|
390
|
+
```typescript
|
|
391
|
+
const client = new SuiGrpcClient({ network, baseUrl, restrictedMoveCalls: [] });
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
To restrict more calls, extend the default rather than replacing it:
|
|
395
|
+
|
|
396
|
+
```typescript
|
|
397
|
+
|
|
398
|
+
const client = new SuiGrpcClient({
|
|
399
|
+
network,
|
|
400
|
+
baseUrl,
|
|
401
|
+
restrictedMoveCalls: [...DEFAULT_RESTRICTED_MOVE_CALLS, '0xbad'],
|
|
402
|
+
});
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
`build()` and `toJSON()` also take `restrictedMoveCalls`, which takes precedence over the client's
|
|
406
|
+
list. Entries are `package`, `package::module` or `package::module::function`.
|
|
407
|
+
|
|
408
|
+
Entries only match top-level `moveCall` commands with that exact package ID, so they don't cover
|
|
409
|
+
upgraded package IDs or Move code that makes the call for you. `findRestrictedMoveCalls` from
|
|
410
|
+
`@mysten/sui/transactions` runs the same check on a transaction's data without throwing.
|
|
411
|
+
|
|
412
|
+
Anything that builds with a client, such as `signAndExecuteTransaction`, `simulateTransaction`, the
|
|
413
|
+
executors and dapp-kit, uses that client's list. Wallets that only support the legacy
|
|
414
|
+
`sui:signTransactionBlock` features apply the default list, so a client-level `[]` doesn't reach
|
|
415
|
+
them.
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "Mysten Labs <build@mystenlabs.com>",
|
|
4
4
|
"description": "Sui TypeScript API",
|
|
5
5
|
"homepage": "https://sdk.mystenlabs.com",
|
|
6
|
-
"version": "
|
|
6
|
+
"version": "3.0.0",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"files": [
|
|
@@ -136,7 +136,6 @@
|
|
|
136
136
|
"access": "public"
|
|
137
137
|
},
|
|
138
138
|
"devDependencies": {
|
|
139
|
-
"@0no-co/graphqlsp": "^1.17.3",
|
|
140
139
|
"@graphql-codegen/add": "^7.1.0",
|
|
141
140
|
"@graphql-codegen/cli": "^7.4.6",
|
|
142
141
|
"@graphql-codegen/typed-document-node": "^7.1.0",
|
|
@@ -164,7 +163,7 @@
|
|
|
164
163
|
"@noble/curves": "^2.3.0",
|
|
165
164
|
"@noble/hashes": "^2.3.0",
|
|
166
165
|
"@noble/post-quantum": "^0.7.1",
|
|
167
|
-
"@protobuf-ts/grpcweb-transport": "
|
|
166
|
+
"@protobuf-ts/grpcweb-transport": "~2.11.1",
|
|
168
167
|
"@protobuf-ts/runtime": "^2.11.1",
|
|
169
168
|
"@protobuf-ts/runtime-rpc": "^2.11.1",
|
|
170
169
|
"@scure/base": "^2.3.0",
|
|
@@ -174,7 +173,7 @@
|
|
|
174
173
|
"graphql": "^17.0.2",
|
|
175
174
|
"poseidon-lite": "0.3.0",
|
|
176
175
|
"valibot": "^1.4.2",
|
|
177
|
-
"@mysten/bcs": "^2.1.
|
|
176
|
+
"@mysten/bcs": "^2.1.4",
|
|
178
177
|
"@mysten/utils": "^0.4.2"
|
|
179
178
|
},
|
|
180
179
|
"scripts": {
|
package/src/bcs/bcs.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { bcs, fromBase58, fromBase64, toBase58, toBase64, toHex } from '@mysten/
|
|
|
6
6
|
|
|
7
7
|
import { isValidSuiAddress, normalizeSuiAddress, SUI_ADDRESS_LENGTH } from '../utils/sui-types.js';
|
|
8
8
|
import { TypeTagSerializer } from './type-tag-serializer.js';
|
|
9
|
-
import type { TypeTag as TypeTagType } from './types.js';
|
|
9
|
+
import type { SharedObjectAccess, TypeTag as TypeTagType } from './types.js';
|
|
10
10
|
|
|
11
11
|
function unsafe_u64(options?: BcsTypeOptions<number>) {
|
|
12
12
|
return bcs
|
|
@@ -111,10 +111,45 @@ export const SuiObjectRef = bcs.struct('SuiObjectRef', {
|
|
|
111
111
|
digest: ObjectDigest,
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
// Rust: crates/sui-types/src/transaction.rs
|
|
115
|
+
// `Immutable` and `Mutable` encode as the bytes `false` and `true` do.
|
|
116
|
+
export const SharedObjectMutability = bcs.enum('SharedObjectMutability', {
|
|
117
|
+
Immutable: null,
|
|
118
|
+
Mutable: null,
|
|
119
|
+
NonExclusiveWrite: null,
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
const SharedObjectRefStruct = bcs.struct('SharedObjectRef', {
|
|
115
123
|
objectId: Address,
|
|
116
124
|
initialSharedVersion: bcs.u64(),
|
|
117
|
-
|
|
125
|
+
mutability: SharedObjectMutability,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* A shared object input. Non-exclusive write access, used only by system transactions, parses as
|
|
130
|
+
* `mutable: false` with `mutability: 'NonExclusiveWrite'`.
|
|
131
|
+
*/
|
|
132
|
+
export const SharedObjectRef = SharedObjectRefStruct.transform({
|
|
133
|
+
name: 'SharedObjectRef',
|
|
134
|
+
validate: ({ mutable }) => bcs.bool().validate(mutable),
|
|
135
|
+
input: ({
|
|
136
|
+
mutable,
|
|
137
|
+
mutability,
|
|
138
|
+
...ref
|
|
139
|
+
}: Omit<typeof SharedObjectRefStruct.$inferInput, 'mutability'> &
|
|
140
|
+
SharedObjectAccess): typeof SharedObjectRefStruct.$inferInput => ({
|
|
141
|
+
...ref,
|
|
142
|
+
mutability: {
|
|
143
|
+
[mutability ?? (mutable ? 'Mutable' : 'Immutable')]: true,
|
|
144
|
+
} as typeof SharedObjectMutability.$inferInput,
|
|
145
|
+
}),
|
|
146
|
+
output: ({
|
|
147
|
+
mutability,
|
|
148
|
+
...ref
|
|
149
|
+
}): { objectId: string; initialSharedVersion: string } & SharedObjectAccess =>
|
|
150
|
+
mutability.$kind === 'NonExclusiveWrite'
|
|
151
|
+
? { ...ref, mutable: false, mutability: 'NonExclusiveWrite' }
|
|
152
|
+
: { ...ref, mutable: mutability.$kind === 'Mutable' },
|
|
118
153
|
});
|
|
119
154
|
|
|
120
155
|
export const ObjectArg = bcs.enum('ObjectArg', {
|
|
@@ -135,6 +170,20 @@ export const Owner = bcs.enum('Owner', {
|
|
|
135
170
|
startVersion: bcs.u64(),
|
|
136
171
|
owner: Address,
|
|
137
172
|
}),
|
|
173
|
+
Party: bcs.struct('PartyOwner', {
|
|
174
|
+
startVersion: bcs.u64(),
|
|
175
|
+
permissions: bcs.struct('Party', {
|
|
176
|
+
// `ObjectPermissions` bitflags
|
|
177
|
+
defaultPermissions: bcs.u64(),
|
|
178
|
+
members: bcs.vector(
|
|
179
|
+
bcs.struct('PartyMember', {
|
|
180
|
+
address: Address,
|
|
181
|
+
// `ObjectPermissions` bitflags
|
|
182
|
+
permissions: bcs.u64(),
|
|
183
|
+
}),
|
|
184
|
+
),
|
|
185
|
+
}),
|
|
186
|
+
}),
|
|
138
187
|
});
|
|
139
188
|
|
|
140
189
|
// Rust: crates/sui-types/src/transaction.rs
|
|
@@ -164,12 +213,14 @@ export const FundsWithdrawal = bcs.struct('FundsWithdrawal', {
|
|
|
164
213
|
withdrawFrom: WithdrawFrom,
|
|
165
214
|
});
|
|
166
215
|
|
|
216
|
+
export const base64String = bcs.byteVector().transform({
|
|
217
|
+
input: (val: string | Uint8Array) => (typeof val === 'string' ? fromBase64(val) : val),
|
|
218
|
+
output: (val) => toBase64(val),
|
|
219
|
+
});
|
|
220
|
+
|
|
167
221
|
export const CallArg = bcs.enum('CallArg', {
|
|
168
222
|
Pure: bcs.struct('Pure', {
|
|
169
|
-
bytes:
|
|
170
|
-
input: (val: string | Uint8Array) => (typeof val === 'string' ? fromBase64(val) : val),
|
|
171
|
-
output: (val) => toBase64(val),
|
|
172
|
-
}),
|
|
223
|
+
bytes: base64String,
|
|
173
224
|
}),
|
|
174
225
|
Object: ObjectArg,
|
|
175
226
|
FundsWithdrawal: FundsWithdrawal,
|
|
@@ -224,37 +275,31 @@ export const Command = bcs.enum('Command', {
|
|
|
224
275
|
objects: bcs.vector(Argument),
|
|
225
276
|
address: Argument,
|
|
226
277
|
}),
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
278
|
+
/**
|
|
279
|
+
* Split `amounts` from a `coin`.
|
|
280
|
+
*/
|
|
230
281
|
SplitCoins: bcs.struct('SplitCoins', {
|
|
231
282
|
coin: Argument,
|
|
232
283
|
amounts: bcs.vector(Argument),
|
|
233
284
|
}),
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
285
|
+
/**
|
|
286
|
+
* Merge `sources` coins into a `destination` coin.
|
|
287
|
+
*/
|
|
237
288
|
MergeCoins: bcs.struct('MergeCoins', {
|
|
238
289
|
destination: Argument,
|
|
239
290
|
sources: bcs.vector(Argument),
|
|
240
291
|
}),
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
292
|
+
/**
|
|
293
|
+
* Publish a Move package.
|
|
294
|
+
*/
|
|
244
295
|
Publish: bcs.struct('Publish', {
|
|
245
|
-
modules: bcs.vector(
|
|
246
|
-
bcs.byteVector().transform({
|
|
247
|
-
input: (val: string | Uint8Array) => (typeof val === 'string' ? fromBase64(val) : val),
|
|
248
|
-
output: (val) => toBase64(val),
|
|
249
|
-
}),
|
|
250
|
-
),
|
|
296
|
+
modules: bcs.vector(base64String),
|
|
251
297
|
dependencies: bcs.vector(Address),
|
|
252
298
|
}),
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
// */
|
|
299
|
+
/**
|
|
300
|
+
* Build a vector from the input arguments. This is the only way to construct a
|
|
301
|
+
* `vector<T: key>` in a transaction.
|
|
302
|
+
*/
|
|
258
303
|
MakeMoveVec: bcs.struct('MakeMoveVec', {
|
|
259
304
|
type: optionEnum(TypeTag).transform({
|
|
260
305
|
input: (val: string | null) =>
|
|
@@ -269,13 +314,11 @@ export const Command = bcs.enum('Command', {
|
|
|
269
314
|
}),
|
|
270
315
|
elements: bcs.vector(Argument),
|
|
271
316
|
}),
|
|
317
|
+
/**
|
|
318
|
+
* Upgrade a Move package.
|
|
319
|
+
*/
|
|
272
320
|
Upgrade: bcs.struct('Upgrade', {
|
|
273
|
-
modules: bcs.vector(
|
|
274
|
-
bcs.byteVector().transform({
|
|
275
|
-
input: (val: string | Uint8Array) => (typeof val === 'string' ? fromBase64(val) : val),
|
|
276
|
-
output: (val) => toBase64(val),
|
|
277
|
-
}),
|
|
278
|
-
),
|
|
321
|
+
modules: bcs.vector(base64String),
|
|
279
322
|
dependencies: bcs.vector(Address),
|
|
280
323
|
package: Address,
|
|
281
324
|
ticket: Argument,
|
|
@@ -416,19 +459,14 @@ export const MultiSigPkMap = bcs.struct('MultiSigPkMap', {
|
|
|
416
459
|
});
|
|
417
460
|
|
|
418
461
|
export const MultiSigPublicKey = bcs.struct('MultiSigPublicKey', {
|
|
419
|
-
|
|
462
|
+
pkMap: bcs.vector(MultiSigPkMap),
|
|
420
463
|
threshold: bcs.u16(),
|
|
421
464
|
});
|
|
422
465
|
|
|
423
466
|
export const MultiSig = bcs.struct('MultiSig', {
|
|
424
467
|
sigs: bcs.vector(CompressedSignature),
|
|
425
468
|
bitmap: bcs.u16(),
|
|
426
|
-
|
|
427
|
-
});
|
|
428
|
-
|
|
429
|
-
export const base64String = bcs.byteVector().transform({
|
|
430
|
-
input: (val: string | Uint8Array) => (typeof val === 'string' ? fromBase64(val) : val),
|
|
431
|
-
output: (val) => toBase64(val),
|
|
469
|
+
multisigPk: MultiSigPublicKey,
|
|
432
470
|
});
|
|
433
471
|
|
|
434
472
|
export const PasskeyAuthenticator = bcs.struct('PasskeyAuthenticator', {
|
|
@@ -443,7 +481,8 @@ export const MoveObjectType = bcs.enum('MoveObjectType', {
|
|
|
443
481
|
GasCoin: null,
|
|
444
482
|
StakedSui: null,
|
|
445
483
|
Coin: TypeTag,
|
|
446
|
-
|
|
484
|
+
SuiBalanceAccumulatorField: null,
|
|
485
|
+
BalanceAccumulatorField: TypeTag,
|
|
447
486
|
});
|
|
448
487
|
|
|
449
488
|
// Rust: crates/sui-types/src/object.rs
|