From a92b03de425f04d1fb7797a347a1e0f1c512f3e0 Mon Sep 17 00:00:00 2001 From: hayes-mysten <135670682+hayes-mysten@users.noreply.github.com> Date: Tue, 28 May 2024 20:59:52 -0700 Subject: [PATCH] TS SDK 1.0 (#16735) ## Description Describe the changes or additions included in this PR. ## Test Plan How did you test the new or updated feature? --- If your changes are not user-facing and do not break anything, you can skip the following section. Otherwise, please briefly describe what has changed under the Release Notes section. ### Type of Change (Check all that apply) - [ ] protocol change - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes --- .changeset/bright-wombats-try.md | 2 +- .changeset/witty-llamas-smile.md | 18 + .github/actions/ts-e2e/action.yml | 2 +- .github/workflows/e2e.yml | 4 +- apps/core/package.json | 4 +- apps/core/src/api/SentryHttpTransport.ts | 2 +- apps/core/src/hooks/useFormatCoin.ts | 4 +- apps/core/src/hooks/useGetCoins.ts | 2 +- apps/core/src/hooks/useGetDelegatedStake.tsx | 2 +- apps/core/src/hooks/useGetDynamicFields.ts | 4 +- apps/core/src/hooks/useGetKioskContents.ts | 2 +- apps/core/src/hooks/useGetObject.ts | 2 +- apps/core/src/hooks/useGetOwnedObjects.ts | 2 +- apps/core/src/hooks/useGetTransferAmount.ts | 4 +- apps/core/src/hooks/useGetValidatorsEvents.ts | 2 +- apps/core/src/hooks/useMultiGetObjects.ts | 2 +- apps/core/src/hooks/useTransactionSummary.ts | 2 +- apps/core/src/utils/getRefGasPrice.ts | 2 +- apps/core/src/utils/hasDisplayData.ts | 2 +- apps/core/src/utils/kiosk.ts | 2 +- .../transaction/getBalanceChangeSummary.ts | 4 +- .../src/utils/transaction/getGasSummary.ts | 2 +- apps/core/src/utils/transaction/getLabel.ts | 2 +- .../transaction/getObjectChangeSummary.ts | 2 +- .../transaction/getObjectDisplayLookup.ts | 2 +- .../src/utils/transaction/getOwnerType.ts | 2 +- apps/wallet/configs/ts/tsconfig.common.json | 4 +- .../configs/webpack/webpack.config.common.ts | 2 +- apps/wallet/package.json | 6 +- apps/wallet/src/background/Transactions.ts | 2 +- .../account-sources/MnemonicAccountSource.ts | 4 +- .../wallet/src/background/accounts/Account.ts | 12 +- .../background/accounts/MnemonicAccount.ts | 2 +- apps/wallet/src/background/accounts/index.ts | 2 +- .../accounts/zklogin/ZkLoginAccount.ts | 8 +- .../src/background/accounts/zklogin/utils.ts | 4 +- .../connections/ContentScriptConnection.ts | 2 +- .../background/legacy-accounts/LegacyVault.ts | 2 +- .../dapp-interface/WalletStandardInterface.ts | 78 +- .../messages/payloads/MethodPayload.ts | 3 +- .../payloads/transactions/ApprovalRequest.ts | 2 +- .../ExecuteTransactionResponse.ts | 2 +- .../ui/TransactionRequestResponse.ts | 2 +- apps/wallet/src/shared/sui-client.ts | 2 +- .../src/shared/utils/from-exported-keypair.ts | 12 +- apps/wallet/src/shared/utils/index.ts | 2 +- apps/wallet/src/ui/app/ApiProvider.ts | 2 +- apps/wallet/src/ui/app/LedgerSigner.ts | 12 +- apps/wallet/src/ui/app/QredoSigner.ts | 23 +- apps/wallet/src/ui/app/WalletSigner.ts | 29 +- .../BackgroundServiceSigner.ts | 5 +- .../src/ui/app/background-client/index.ts | 7 +- .../src/ui/app/components/AccountListItem.tsx | 2 +- .../app/components/WalletListSelectItem.tsx | 2 +- .../app/components/accounts/AccountItem.tsx | 2 +- .../accounts/AccountItemApproveConnection.tsx | 2 +- .../components/active-coins-card/index.tsx | 2 +- .../ui/app/components/address-input/index.tsx | 2 +- .../components/address-input/validation.ts | 4 +- .../src/ui/app/components/coin-icon/index.tsx | 2 +- .../ui/app/components/explorer-link/index.tsx | 2 +- .../components/ledger/LedgerAccountRow.tsx | 2 +- .../ledger/useDeriveLedgerAccounts.ts | 2 +- .../content/VerifyLedgerConnectionStatus.tsx | 2 +- .../ui/app/components/nft-display/Kiosk.tsx | 2 +- .../ui/app/components/nft-display/index.tsx | 2 +- .../components/receipt-card/StakeTxnCard.tsx | 4 +- .../receipt-card/TxnAddressLink.tsx | 2 +- .../components/receipt-card/TxnGasSummary.tsx | 2 +- .../receipt-card/UnstakeTxnCard.tsx | 4 +- .../ui/app/components/receipt-card/index.tsx | 2 +- .../app/components/sui-apps/DisconnectApp.tsx | 2 +- .../transactions-card/TxnActionLabel.tsx | 2 +- .../components/transactions-card/index.tsx | 2 +- .../src/ui/app/helpers/checkStakingTxn.ts | 2 +- .../app/helpers/filterAndSortTokenBalances.ts | 2 +- apps/wallet/src/ui/app/helpers/getAmount.ts | 2 +- .../src/ui/app/helpers/getEventsSummary.ts | 2 +- .../validation/privateKeyValidation.ts | 2 +- .../ui/app/hooks/deepbook/useGetEstimate.ts | 6 +- .../app/hooks/deepbook/useRecognizedCoins.ts | 2 +- .../ui/app/hooks/useAppResolveSuinsName.ts | 2 +- .../wallet/src/ui/app/hooks/useGetAllCoins.ts | 2 +- apps/wallet/src/ui/app/hooks/useGetNFTs.ts | 2 +- .../src/ui/app/hooks/useGetTransferAmount.ts | 4 +- .../ui/app/hooks/useGetTxnRecipientAddress.ts | 2 +- apps/wallet/src/ui/app/hooks/useMediaUrl.ts | 2 +- .../src/ui/app/hooks/useNFTBasicData.ts | 2 +- .../hooks/useQueryTransactionsByAddress.ts | 2 +- .../src/ui/app/hooks/useRecognizedPackages.ts | 2 +- .../src/ui/app/hooks/useResolveVideo.ts | 2 +- .../app/hooks/useSortedCoinsByCategories.ts | 4 +- .../src/ui/app/hooks/useTransactionData.ts | 17 +- .../src/ui/app/hooks/useTransactionDryRun.ts | 7 +- apps/wallet/src/ui/app/index.tsx | 2 +- .../transaction-request/GasFees.tsx | 10 +- .../TransactionDetails/Command.tsx | 108 +- .../TransactionDetails/Input.tsx | 20 +- .../TransactionDetails/index.tsx | 12 +- .../transaction-request/index.tsx | 6 +- .../transaction-request/utils/normalize.ts | 2 +- .../ui/app/pages/home/kiosk-details/index.tsx | 2 +- .../ui/app/pages/home/nft-details/index.tsx | 2 +- .../home/nft-transfer/TransferNFTForm.tsx | 4 +- .../home/nft-transfer/useTransferKioskItem.ts | 12 +- .../app/pages/home/nft-transfer/validation.ts | 2 +- .../app/pages/home/nfts/NonVisualAssets.tsx | 4 +- .../ui/app/pages/home/nfts/VisualAssets.tsx | 2 +- .../src/ui/app/pages/home/receipt/index.tsx | 2 +- .../app/pages/home/tokens/TokenIconLink.tsx | 2 +- .../ui/app/pages/home/tokens/TokenLink.tsx | 4 +- .../app/pages/home/tokens/TokensDetails.tsx | 4 +- .../pages/home/tokens/coin-balance/index.tsx | 2 +- .../home/transactions/QredoTransaction.tsx | 11 +- .../pages/home/transfer-coin/CoinSelector.tsx | 2 +- .../home/transfer-coin/SendTokenForm.tsx | 4 +- .../home/transfer-coin/utils/transaction.ts | 8 +- .../pages/home/transfer-coin/validation.ts | 2 +- .../components/QredoAccountItem.tsx | 2 +- .../src/ui/app/pages/swap/GasFeeSection.tsx | 2 +- .../src/ui/app/pages/swap/ToAssetSection.tsx | 4 +- apps/wallet/src/ui/app/pages/swap/index.tsx | 4 +- apps/wallet/src/ui/app/pages/swap/utils.ts | 2 +- .../ui/app/redux/slices/sui-objects/Coin.ts | 2 +- .../slices/transaction-requests/index.ts | 8 +- .../src/ui/app/shared/coin-balance/index.tsx | 2 +- .../app/shared/faucet/FaucetRequestButton.tsx | 2 +- .../ui/app/shared/faucet/useFaucetMutation.ts | 2 +- .../transaction-summary/OwnerFooter.tsx | 2 +- .../transaction-summary/cards/GasSummary.tsx | 2 +- .../cards/ObjectChanges.tsx | 2 +- .../objectSummary/ObjectChangeDisplay.tsx | 2 +- .../DelegationDetailCard.tsx | 4 +- .../src/ui/app/staking/getAllStakeSui.ts | 2 +- .../ui/app/staking/getDelegationByStakeId.ts | 2 +- .../src/ui/app/staking/getStakeSuiBySuiId.ts | 2 +- .../staking/getTokenStakeSuiForValidator.ts | 2 +- .../src/ui/app/staking/home/StakeAmount.tsx | 2 +- .../src/ui/app/staking/home/StakedCard.tsx | 4 +- .../src/ui/app/staking/stake/StakingCard.tsx | 4 +- .../src/ui/app/staking/stake/UnstakeForm.tsx | 2 +- .../ui/app/staking/stake/utils/transaction.ts | 8 +- .../app/staking/validators/ValidatorLogo.tsx | 2 +- .../app/staking/validators/ValidatorsCard.tsx | 2 +- apps/wallet/tests/demo-app/src/index.tsx | 12 +- apps/wallet/tests/utils/localnet.ts | 4 +- .../data/entry_point_types/Move.lock | 7 +- .../data/entry_point_vector/Move.lock | 7 +- dapps/kiosk-cli/index.js | 70 +- dapps/kiosk-cli/package.json | 2 +- dapps/kiosk/package.json | 2 +- dapps/kiosk/src/Root.tsx | 2 +- .../kiosk/src/components/Kiosk/FindKiosk.tsx | 2 +- .../kiosk/src/components/Kiosk/KioskData.tsx | 2 +- .../kiosk/src/components/Kiosk/KioskItems.tsx | 2 +- .../src/components/Kiosk/KioskSelector.tsx | 2 +- .../kiosk/src/components/Modals/ListPrice.tsx | 2 +- dapps/kiosk/src/hooks/kiosk.ts | 2 +- dapps/kiosk/src/hooks/useOwnedObjects.ts | 2 +- .../src/hooks/useTransactionExecution.ts | 17 +- dapps/kiosk/src/mutations/kiosk.ts | 44 +- dapps/kiosk/src/utils/utils.ts | 4 +- dapps/multisig-toolkit/package.json | 2 +- .../src/components/connect.tsx | 2 +- .../preview-effects/EffectsPreview.tsx | 2 +- .../components/preview-effects/ObjectLink.tsx | 2 +- .../preview-effects/PreviewCard.tsx | 2 +- .../partials/BalanceChanges.tsx | 2 +- .../preview-effects/partials/Events.tsx | 2 +- .../partials/ObjectChanges.tsx | 2 +- .../preview-effects/partials/Overview.tsx | 2 +- .../preview-effects/partials/Transactions.tsx | 7 +- dapps/multisig-toolkit/src/main.tsx | 2 +- .../src/routes/combine-sigs.tsx | 7 +- .../src/routes/execute-transaction.tsx | 4 +- .../src/routes/multisig-address.tsx | 5 +- .../src/routes/offline-signer.tsx | 10 +- .../src/routes/signature-analyzer.tsx | 8 +- dapps/sponsored-transactions/package.json | 2 +- dapps/sponsored-transactions/src/App.tsx | 24 +- dapps/sponsored-transactions/src/main.tsx | 2 +- dapps/sponsored-transactions/src/utils/rpc.ts | 2 +- .../src/utils/sponsorTransaction.ts | 12 +- .../transaction-auth/intent-signing.mdx | 35 +- .../packages/custom-policies.mdx | 276 +- .../concepts/transfers/transfer-to-object.mdx | 33 +- .../developer/advanced/asset-tokenization.mdx | 933 ++-- .../developer/advanced/randomness-onchain.mdx | 22 +- .../developer/app-examples/blackjack.mdx | 23 +- .../developer/app-examples/coin-flip.mdx | 36 +- .../developer/app-examples/e2e-counter.mdx | 127 +- .../developer/app-examples/recaptcha.mdx | 429 +- .../developer/app-examples/reviews-rating.mdx | 238 +- .../app-examples/trustless-swap/frontend.mdx | 42 +- .../trustless-swap/indexer-api.mdx | 14 +- .../developer/app-examples/weather-oracle.mdx | 390 +- .../cryptography/zklogin-integration.mdx | 150 +- .../developer/first-app/client-tssdk.mdx | 12 +- .../developer/getting-started/get-coins.mdx | 8 +- .../getting-started/local-network.mdx | 11 +- .../guides/developer/sui-101/building-ptb.mdx | 73 +- .../developer/sui-101/sign-and-send-txn.mdx | 138 +- .../developer/sui-101/simulating-refs.mdx | 21 +- .../guides/developer/sui-101/using-events.mdx | 120 +- .../closed-loop-token/action-request.mdx | 58 +- docs/content/standards/coin.mdx | 129 +- docs/content/standards/kiosk.mdx | 191 +- docs/content/standards/wallet-standard.mdx | 87 +- examples/mev_bot/package.json | 3 +- examples/mev_bot/src/index.ts | 416 +- examples/trading/api/helpers/cancel-escrow.ts | 2 +- .../trading/api/helpers/create-demo-data.ts | 2 +- .../api/helpers/create-demo-escrows.ts | 2 +- .../trading/api/indexer/escrow-handler.ts | 2 +- examples/trading/api/indexer/event-indexer.ts | 2 +- .../trading/api/indexer/locked-handler.ts | 2 +- examples/trading/api/package.json | 2 +- examples/trading/api/pnpm-lock.yaml | 1058 ---- examples/trading/api/sui-utils.ts | 10 +- examples/trading/frontend/package.json | 6 +- examples/trading/frontend/pnpm-lock.yaml | 4824 ----------------- .../frontend/src/components/ExplorerLink.tsx | 2 +- .../src/components/SuiObjectDisplay.tsx | 2 +- .../src/components/escrows/CreateEscrow.tsx | 2 +- .../src/components/locked/LockedObject.tsx | 2 +- examples/trading/frontend/src/constants.ts | 2 + .../src/hooks/useTransactionExecution.ts | 6 +- examples/trading/frontend/src/main.tsx | 2 +- .../trading/frontend/src/mutations/demo.ts | 2 +- .../trading/frontend/src/mutations/escrow.ts | 4 +- .../trading/frontend/src/mutations/locked.ts | 4 +- package.json | 2 +- pnpm-lock.yaml | 1539 ++++-- pnpm-workspace.yaml | 1 + sdk/bcs/README.md | 2 +- sdk/bcs/package.json | 2 +- sdk/bcs/src/bcs-type.ts | 29 +- sdk/bcs/src/bcs.ts | 82 +- sdk/bcs/src/index.ts | 13 +- sdk/bcs/src/legacy-registry.ts | 1144 ---- sdk/bcs/src/types.ts | 79 +- sdk/bcs/src/writer.ts | 14 +- sdk/bcs/tests/alias.test.ts | 42 - sdk/bcs/tests/array.type.test.ts | 112 - sdk/bcs/tests/bcs.test.ts | 156 +- sdk/bcs/tests/builder.test.ts | 12 +- sdk/bcs/tests/config.test.ts | 58 - sdk/bcs/tests/encodings.test.ts | 53 +- sdk/bcs/tests/generics.test.ts | 49 - sdk/bcs/tests/inline-definition.test.ts | 50 - sdk/bcs/tests/nested.object.test.ts | 77 - sdk/bcs/tests/parse-type-name.test.ts | 19 - sdk/bcs/tests/readme.test.ts | 276 - sdk/bcs/tests/serde.test.ts | 186 - sdk/bcs/tests/vector.generics.test.ts | 21 - sdk/build-scripts/package.json | 2 +- sdk/create-dapp/package.json | 2 +- sdk/create-dapp/src/index.ts | 2 +- .../templates/react-client-dapp/package.json | 2 +- .../templates/react-client-dapp/src/main.tsx | 2 +- .../templates/react-e2e-counter/package.json | 2 +- .../templates/react-e2e-counter/src/App.tsx | 2 +- .../react-e2e-counter/src/Counter.tsx | 26 +- .../react-e2e-counter/src/CreateCounter.tsx | 30 +- .../react-e2e-counter/src/networkConfig.ts | 2 +- sdk/dapp-kit/README.md | 4 +- sdk/dapp-kit/package.json | 6 +- .../src/components/AccountDropdownMenu.tsx | 2 +- .../src/components/SuiClientProvider.tsx | 4 +- .../src/components/WalletProvider.tsx | 18 +- sdk/dapp-kit/src/constants/walletDefaults.ts | 10 +- .../src/constants/walletMutationKeys.ts | 5 +- sdk/dapp-kit/src/hooks/networkConfig.ts | 2 +- .../src/hooks/useResolveSuiNSNames.ts | 2 +- sdk/dapp-kit/src/hooks/useSuiClient.ts | 2 +- .../src/hooks/useSuiClientInfiniteQuery.ts | 2 +- sdk/dapp-kit/src/hooks/useSuiClientQuery.ts | 2 +- .../src/hooks/wallet/useConnectWallet.ts | 7 +- .../src/hooks/wallet/useCurrentWallet.ts | 4 + .../wallet/useReportTransactionEffects.ts | 82 + .../wallet/useSignAndExecuteTransaction.ts | 167 + .../useSignAndExecuteTransactionBlock.ts | 116 - .../src/hooks/wallet/useSignTransaction.ts | 119 + .../hooks/wallet/useSignTransactionBlock.ts | 84 - .../src/hooks/wallet/useUnsafeBurnerWallet.ts | 75 +- .../src/hooks/wallet/useWalletsChanged.ts | 10 +- sdk/dapp-kit/src/index.ts | 5 +- sdk/dapp-kit/src/types.ts | 2 +- sdk/dapp-kit/src/utils/walletUtils.ts | 5 +- sdk/dapp-kit/src/walletStore.ts | 8 +- .../components/SuiClientProvider.test.tsx | 2 +- .../test/components/WalletProvider.test.tsx | 2 +- .../useSignAndExecuteTransaction.test.tsx | 239 + ...useSignAndExecuteTransactionBlock.test.tsx | 107 - ...k.test.tsx => useSignTransaction.test.tsx} | 47 +- sdk/dapp-kit/test/hooks/useSuiClient.test.tsx | 2 +- .../hooks/useSuiClientInfiniteQuery.test.tsx | 2 +- .../test/hooks/useSuiClientMutation.test.tsx | 2 +- .../test/hooks/useSuiClientQueries.test.tsx | 2 +- .../test/hooks/useSuiClientQuery.test.tsx | 2 +- sdk/dapp-kit/test/mocks/mockAccount.ts | 9 +- sdk/dapp-kit/test/mocks/mockFeatures.ts | 12 + sdk/dapp-kit/test/test-utils.tsx | 2 +- sdk/dapp-kit/vitest.config.ts | 14 +- sdk/deepbook/package.json | 6 +- sdk/deepbook/src/client.ts | 357 +- sdk/deepbook/src/types/bcs.ts | 24 +- sdk/deepbook/src/types/index.ts | 2 +- sdk/deepbook/src/utils/constants.ts | 2 +- sdk/deepbook/test/e2e/client.test.ts | 46 +- sdk/deepbook/test/e2e/setup.ts | 56 +- sdk/docs/examples/wallet-components.tsx | 2 +- sdk/docs/examples/wallet-hooks.tsx | 30 +- sdk/docs/package.json | 3 +- sdk/docs/pages/bcs/index.mdx | 2 +- sdk/docs/pages/dapp-kit/index.mdx | 4 +- sdk/docs/pages/dapp-kit/rpc-hooks.mdx | 2 +- .../pages/dapp-kit/sui-client-provider.mdx | 8 +- .../pages/dapp-kit/wallet-hooks/_meta.json | 5 +- .../useReportTransactionEffects.mdx | 56 + .../useSignAndExecuteTransaction.mdx | 61 + .../useSignAndExecuteTransactionBlock.mdx | 65 - .../wallet-hooks/useSignTransaction.mdx | 77 + .../wallet-hooks/useSignTransactionBlock.mdx | 62 - sdk/docs/pages/dapp-kit/wallet-provider.mdx | 4 +- sdk/docs/pages/kiosk/advanced-examples.mdx | 20 +- sdk/docs/pages/kiosk/from-v1.mdx | 34 +- .../pages/kiosk/kiosk-client/introduction.mdx | 2 +- .../kiosk-transaction/examples.mdx | 36 +- .../kiosk-transaction/kiosk-transaction.mdx | 26 +- .../kiosk-transaction/managing.mdx | 78 +- .../kiosk-transaction/purchasing.mdx | 24 +- .../introduction.mdx | 22 +- sdk/docs/pages/typescript/_meta.json | 7 +- sdk/docs/pages/typescript/bcs.mdx | 8 +- .../typescript/cryptography/keypairs.mdx | 56 +- .../typescript/cryptography/multisig.mdx | 12 +- sdk/docs/pages/typescript/executors.mdx | 131 + sdk/docs/pages/typescript/faucet.mdx | 4 +- sdk/docs/pages/typescript/graphql.mdx | 93 + sdk/docs/pages/typescript/hello-sui.mdx | 14 +- sdk/docs/pages/typescript/index.mdx | 43 +- sdk/docs/pages/typescript/install.mdx | 4 +- .../pages/typescript/migrations/_meta.json | 3 + .../pages/typescript/migrations/sui-1.0.mdx | 450 ++ .../custom-split-strategy.mdx | 15 +- .../typescript/owned-object-pool/examples.mdx | 79 +- .../typescript/owned-object-pool/index.mdx | 17 +- .../owned-object-pool/local-development.mdx | 13 +- .../typescript/owned-object-pool/overview.mdx | 49 +- sdk/docs/pages/typescript/plugins.mdx | 264 + sdk/docs/pages/typescript/sui-client.mdx | 62 +- .../transaction-building/_meta.json | 7 +- .../transaction-building/basics.mdx | 155 +- .../typescript/transaction-building/gas.mdx | 26 +- .../transaction-building/intents.mdx | 58 + .../transaction-building/offline.mdx | 17 +- .../sponsored-transactions.mdx | 18 +- sdk/docs/pages/typescript/utils.mdx | 2 +- sdk/docs/pages/typescript/zklogin.mdx | 6 +- sdk/docs/pages/zksend/dapp.mdx | 10 +- sdk/docs/pages/zksend/link-builder.mdx | 56 +- sdk/docs/theme.config.jsx | 9 + sdk/docs/typedoc.json | 3 +- sdk/enoki/demo/App.tsx | 14 +- sdk/enoki/package.json | 2 +- sdk/enoki/src/EnokiClient/index.ts | 18 +- sdk/enoki/src/EnokiClient/type.ts | 14 +- sdk/enoki/src/EnokiFlow.ts | 51 +- sdk/enoki/src/EnokiKeypair.ts | 16 +- sdk/enoki/src/encryption.ts | 2 +- sdk/graphql-transport/README.md | 2 +- sdk/graphql-transport/package.json | 6 +- .../src/generated/queries.ts | 830 +-- sdk/graphql-transport/src/mappers/bcs.ts | 2 +- .../src/mappers/checkpint.ts | 2 +- sdk/graphql-transport/src/mappers/display.ts | 2 +- sdk/graphql-transport/src/mappers/move.ts | 4 +- sdk/graphql-transport/src/mappers/object.ts | 2 +- sdk/graphql-transport/src/mappers/owner.ts | 2 +- sdk/graphql-transport/src/mappers/stakes.ts | 2 +- .../src/mappers/transaction-block.ts | 599 +- .../src/mappers/validator.ts | 2 +- sdk/graphql-transport/src/methods.ts | 35 +- .../devInspectTransactionBlock.graphql | 1 + .../queries/dryRunTransactionBlock.graphql | 1 + .../queries/executeTransactionBlock.graphql | 1 + .../src/queries/getCurrentEpoch.graphql | 2 +- .../queries/getLatestSuiSystemState.graphql | 9 +- .../src/queries/stakes.graphql | 1 + .../src/queries/transactions.graphql | 108 +- sdk/graphql-transport/src/transport.ts | 4 +- .../test/compatability.test.ts | 114 +- sdk/graphql-transport/tsconfig.json | 4 +- sdk/graphql-transport/vitest.config.ts | 10 +- sdk/kiosk/package.json | 6 +- sdk/kiosk/src/bcs.ts | 38 +- sdk/kiosk/src/client/kiosk-client.ts | 2 +- sdk/kiosk/src/client/kiosk-transaction.ts | 110 +- sdk/kiosk/src/client/tp-transaction.ts | 51 +- sdk/kiosk/src/query/kiosk.ts | 4 +- sdk/kiosk/src/query/transfer-policy.ts | 10 +- sdk/kiosk/src/tx/kiosk.ts | 32 +- sdk/kiosk/src/tx/personal-kiosk.ts | 6 +- sdk/kiosk/src/tx/rules/attach.ts | 10 +- sdk/kiosk/src/tx/rules/resolve.ts | 32 +- sdk/kiosk/src/tx/transfer-policy.ts | 18 +- sdk/kiosk/src/types/index.ts | 4 +- sdk/kiosk/src/types/kiosk.ts | 4 +- sdk/kiosk/src/types/transfer-policy.ts | 8 +- sdk/kiosk/src/utils.ts | 17 +- sdk/kiosk/test/e2e/e2e.test.ts | 26 +- sdk/kiosk/test/e2e/helper.ts | 52 +- sdk/kiosk/test/e2e/setup.ts | 76 +- sdk/ledgerjs-hw-app-sui/package.json | 2 +- sdk/move-bytecode-template/package.json | 2 +- sdk/move-bytecode-template/src/lib.rs | 2 +- sdk/suins-toolkit/README.md | 2 +- sdk/suins-toolkit/package.json | 8 +- sdk/suins-toolkit/src/client.ts | 2 +- sdk/suins-toolkit/src/utils/parser.ts | 4 +- sdk/suins-toolkit/src/utils/queries.ts | 2 +- sdk/suins-toolkit/tests/app.test.ts | 2 +- sdk/suins-toolkit/vitest.config.ts | 4 +- sdk/typescript/README.md | 82 +- sdk/typescript/package.json | 14 +- sdk/typescript/src/bcs/bcs.ts | 300 + sdk/typescript/src/bcs/effects.ts | 200 + sdk/typescript/src/bcs/index.ts | 513 +- sdk/typescript/src/bcs/type-tag-serializer.ts | 3 +- sdk/typescript/src/bcs/types.ts | 113 + sdk/typescript/src/client/client.ts | 28 +- sdk/typescript/src/client/http-transport.ts | 10 +- sdk/typescript/src/client/index.ts | 21 +- sdk/typescript/src/client/types/common.ts | 2 - sdk/typescript/src/client/types/generated.ts | 61 +- sdk/typescript/src/client/types/params.ts | 6 +- sdk/typescript/src/cryptography/index.ts | 36 +- sdk/typescript/src/cryptography/intent.ts | 39 +- sdk/typescript/src/cryptography/keypair.ts | 46 +- sdk/typescript/src/cryptography/publickey.ts | 24 +- sdk/typescript/src/cryptography/signature.ts | 10 +- sdk/typescript/src/faucet/faucet.ts | 130 + sdk/typescript/src/faucet/index.ts | 134 +- sdk/typescript/src/graphql/index.ts | 10 +- sdk/typescript/src/keypairs/ed25519/index.ts | 8 +- .../src/keypairs/ed25519/keypair.ts | 6 +- .../src/keypairs/ed25519/publickey.ts | 3 +- .../src/keypairs/secp256k1/index.ts | 8 +- .../src/keypairs/secp256k1/keypair.ts | 6 +- .../src/keypairs/secp256k1/publickey.ts | 3 +- .../src/keypairs/secp256r1/index.ts | 8 +- .../src/keypairs/secp256r1/keypair.ts | 6 +- .../src/keypairs/secp256r1/publickey.ts | 3 +- sdk/typescript/src/multisig/index.ts | 19 +- sdk/typescript/src/multisig/publickey.ts | 17 +- sdk/typescript/src/multisig/signer.ts | 8 +- sdk/typescript/src/signers/raw-signer.ts | 40 - .../src/signers/signer-with-provider.ts | 183 - sdk/typescript/src/signers/signer.ts | 22 - sdk/typescript/src/signers/types.ts | 14 - sdk/typescript/src/transactions/Commands.ts | 178 + sdk/typescript/src/transactions/Inputs.ts | 107 +- .../src/transactions/ObjectCache.ts | 296 + .../src/transactions/Transaction.ts | 553 ++ .../src/transactions/TransactionBlock.ts | 865 --- .../src/transactions/TransactionBlockData.ts | 242 - .../src/transactions/TransactionData.ts | 296 + .../src/transactions/Transactions.ts | 256 - .../__tests__/Transaction.test.ts | 69 +- .../src/transactions/__tests__/bcs.test.ts | 224 +- sdk/typescript/src/transactions/bcs.ts | 33 - .../src/transactions/data/internal.ts | 321 ++ sdk/typescript/src/transactions/data/v1.ts | 501 ++ sdk/typescript/src/transactions/data/v2.ts | 146 + .../src/transactions/executor/caching.ts | 94 + .../src/transactions/executor/parallel.ts | 335 ++ .../src/transactions/executor/queue.ts | 65 + .../src/transactions/executor/serial.ts | 131 + sdk/typescript/src/transactions/export.ts | 22 - sdk/typescript/src/transactions/index.ts | 43 +- .../transactions/intents/CoinWithBalance.ts | 204 + .../src/transactions/json-rpc-resolver.ts | 482 ++ sdk/typescript/src/transactions/pure.ts | 30 +- sdk/typescript/src/transactions/serializer.ts | 249 +- sdk/typescript/src/transactions/utils.ts | 33 +- sdk/typescript/src/utils/constants.ts | 15 + sdk/typescript/src/utils/index.ts | 40 +- sdk/typescript/src/verify/index.ts | 110 +- sdk/typescript/src/verify/verify.ts | 111 + sdk/typescript/src/version.ts | 2 +- sdk/typescript/src/zklogin/publickey.ts | 17 +- .../test/e2e/coin-with-balance.test.ts | 574 ++ .../test/e2e/data/coin_metadata/Move.lock | 7 +- .../test/e2e/data/dynamic_fields/Move.lock | 2 +- .../test/e2e/data/id_entry_args/Move.lock | 7 +- .../test/e2e/data/serializer/Move.lock | 6 +- .../data/serializer/sources/serializer.move | 18 +- .../sources/serializer.move | 18 +- sdk/typescript/test/e2e/dev-inspect.test.ts | 30 +- .../test/e2e/entry-point-string.test.ts | 14 +- sdk/typescript/test/e2e/id-entry-args.test.ts | 18 +- sdk/typescript/test/e2e/invalid-ids.test.ts | 8 + sdk/typescript/test/e2e/keypairs.test.ts | 19 +- sdk/typescript/test/e2e/multisig.test.ts | 18 +- sdk/typescript/test/e2e/object-cache.test.ts | 212 + sdk/typescript/test/e2e/object-vector.test.ts | 26 +- sdk/typescript/test/e2e/objects.test.ts | 10 +- .../test/e2e/parallel-executor.test.ts | 181 + sdk/typescript/test/e2e/read-events.test.ts | 7 +- .../test/e2e/read-transactions.test.ts | 24 +- .../test/e2e/receive-object.test.ts | 24 +- .../test/e2e/serial-executor.test.ts | 105 + sdk/typescript/test/e2e/subscribe.test.ts | 12 +- sdk/typescript/test/e2e/txn-builder.test.ts | 35 +- .../test/e2e/txn-serializer.test.ts | 443 +- sdk/typescript/test/e2e/utils/setup.ts | 41 +- .../test/e2e/zklogin-signature.test.ts | 2 +- .../unit/cryptography/ed25519-keypair.test.ts | 47 +- .../test/unit/cryptography/intent.test.ts | 15 +- .../test/unit/cryptography/keypair.test.ts | 31 +- .../cryptography/multisig.publickey.test.ts | 16 +- .../test/unit/cryptography/multisig.test.ts | 76 +- .../test/unit/cryptography/publickey.test.ts | 25 +- .../cryptography/secp256k1-keypair.test.ts | 43 +- .../cryptography/secp256r1-keypair.test.ts | 41 +- sdk/typescript/transactions/package.json | 4 +- sdk/typescript/vitest.config.ts | 2 +- sdk/wallet-standard/package.json | 2 +- sdk/wallet-standard/src/detect.ts | 11 +- sdk/wallet-standard/src/features/index.ts | 31 +- .../features/suiReportTransactionEffects.ts | 30 + .../features/suiSignAndExecuteTransaction.ts | 35 + .../suiSignAndExecuteTransactionBlock.ts | 6 +- .../src/features/suiSignMessage.ts | 2 + .../src/features/suiSignPersonalMessage.ts | 2 + .../src/features/suiSignTransaction.ts | 41 + .../src/features/suiSignTransactionBlock.ts | 10 +- sdk/wallet-standard/src/index.ts | 3 +- sdk/wallet-standard/src/types.ts | 170 + sdk/wallet-standard/src/wallet.ts | 83 + sdk/wallet-standard/typedoc.json | 6 + sdk/zklogin/package.json | 6 +- sdk/zklogin/src/address.ts | 2 +- sdk/zklogin/src/index.ts | 2 +- sdk/zklogin/src/nonce.ts | 4 +- sdk/zklogin/src/utils.ts | 2 +- sdk/zklogin/vitest.config.ts | 4 +- sdk/zksend/package.json | 4 +- sdk/zksend/src/index.test.ts | 108 +- sdk/zksend/src/index.ts | 2 +- sdk/zksend/src/links/builder.ts | 119 +- sdk/zksend/src/links/claim.ts | 134 +- ...ion-blocks.ts => get-sent-transactions.ts} | 26 +- sdk/zksend/src/links/list-created-links.ts | 30 +- sdk/zksend/src/links/utils.ts | 40 +- sdk/zksend/src/links/zk-bag.ts | 84 +- sdk/zksend/src/wallet/channel/index.ts | 122 +- sdk/zksend/src/wallet/index.ts | 56 +- 559 files changed, 15531 insertions(+), 17470 deletions(-) create mode 100644 .changeset/witty-llamas-smile.md delete mode 100644 examples/trading/api/pnpm-lock.yaml delete mode 100644 examples/trading/frontend/pnpm-lock.yaml delete mode 100644 sdk/bcs/src/legacy-registry.ts delete mode 100644 sdk/bcs/tests/alias.test.ts delete mode 100644 sdk/bcs/tests/array.type.test.ts delete mode 100644 sdk/bcs/tests/config.test.ts delete mode 100644 sdk/bcs/tests/generics.test.ts delete mode 100644 sdk/bcs/tests/inline-definition.test.ts delete mode 100644 sdk/bcs/tests/nested.object.test.ts delete mode 100644 sdk/bcs/tests/parse-type-name.test.ts delete mode 100644 sdk/bcs/tests/readme.test.ts delete mode 100644 sdk/bcs/tests/serde.test.ts delete mode 100644 sdk/bcs/tests/vector.generics.test.ts create mode 100644 sdk/dapp-kit/src/hooks/wallet/useReportTransactionEffects.ts create mode 100644 sdk/dapp-kit/src/hooks/wallet/useSignAndExecuteTransaction.ts delete mode 100644 sdk/dapp-kit/src/hooks/wallet/useSignAndExecuteTransactionBlock.ts create mode 100644 sdk/dapp-kit/src/hooks/wallet/useSignTransaction.ts delete mode 100644 sdk/dapp-kit/src/hooks/wallet/useSignTransactionBlock.ts create mode 100644 sdk/dapp-kit/test/hooks/useSignAndExecuteTransaction.test.tsx delete mode 100644 sdk/dapp-kit/test/hooks/useSignAndExecuteTransactionBlock.test.tsx rename sdk/dapp-kit/test/hooks/{useSignTransactionBlock.test.tsx => useSignTransaction.test.tsx} (51%) create mode 100644 sdk/docs/pages/dapp-kit/wallet-hooks/useReportTransactionEffects.mdx create mode 100644 sdk/docs/pages/dapp-kit/wallet-hooks/useSignAndExecuteTransaction.mdx delete mode 100644 sdk/docs/pages/dapp-kit/wallet-hooks/useSignAndExecuteTransactionBlock.mdx create mode 100644 sdk/docs/pages/dapp-kit/wallet-hooks/useSignTransaction.mdx delete mode 100644 sdk/docs/pages/dapp-kit/wallet-hooks/useSignTransactionBlock.mdx create mode 100644 sdk/docs/pages/typescript/executors.mdx create mode 100644 sdk/docs/pages/typescript/graphql.mdx create mode 100644 sdk/docs/pages/typescript/migrations/_meta.json create mode 100644 sdk/docs/pages/typescript/migrations/sui-1.0.mdx create mode 100644 sdk/docs/pages/typescript/plugins.mdx create mode 100644 sdk/docs/pages/typescript/transaction-building/intents.mdx create mode 100644 sdk/typescript/src/bcs/bcs.ts create mode 100644 sdk/typescript/src/bcs/effects.ts create mode 100644 sdk/typescript/src/bcs/types.ts create mode 100644 sdk/typescript/src/faucet/faucet.ts delete mode 100644 sdk/typescript/src/signers/raw-signer.ts delete mode 100644 sdk/typescript/src/signers/signer-with-provider.ts delete mode 100644 sdk/typescript/src/signers/signer.ts delete mode 100644 sdk/typescript/src/signers/types.ts create mode 100644 sdk/typescript/src/transactions/Commands.ts create mode 100644 sdk/typescript/src/transactions/ObjectCache.ts create mode 100644 sdk/typescript/src/transactions/Transaction.ts delete mode 100644 sdk/typescript/src/transactions/TransactionBlock.ts delete mode 100644 sdk/typescript/src/transactions/TransactionBlockData.ts create mode 100644 sdk/typescript/src/transactions/TransactionData.ts delete mode 100644 sdk/typescript/src/transactions/Transactions.ts delete mode 100644 sdk/typescript/src/transactions/bcs.ts create mode 100644 sdk/typescript/src/transactions/data/internal.ts create mode 100644 sdk/typescript/src/transactions/data/v1.ts create mode 100644 sdk/typescript/src/transactions/data/v2.ts create mode 100644 sdk/typescript/src/transactions/executor/caching.ts create mode 100644 sdk/typescript/src/transactions/executor/parallel.ts create mode 100644 sdk/typescript/src/transactions/executor/queue.ts create mode 100644 sdk/typescript/src/transactions/executor/serial.ts delete mode 100644 sdk/typescript/src/transactions/export.ts create mode 100644 sdk/typescript/src/transactions/intents/CoinWithBalance.ts create mode 100644 sdk/typescript/src/transactions/json-rpc-resolver.ts create mode 100644 sdk/typescript/src/utils/constants.ts create mode 100644 sdk/typescript/src/verify/verify.ts create mode 100644 sdk/typescript/test/e2e/coin-with-balance.test.ts create mode 100644 sdk/typescript/test/e2e/object-cache.test.ts create mode 100644 sdk/typescript/test/e2e/parallel-executor.test.ts create mode 100644 sdk/typescript/test/e2e/serial-executor.test.ts create mode 100644 sdk/wallet-standard/src/features/suiReportTransactionEffects.ts create mode 100644 sdk/wallet-standard/src/features/suiSignAndExecuteTransaction.ts create mode 100644 sdk/wallet-standard/src/features/suiSignTransaction.ts create mode 100644 sdk/wallet-standard/src/types.ts create mode 100644 sdk/wallet-standard/typedoc.json rename sdk/zksend/src/links/{get-sent-transaction-blocks.ts => get-sent-transactions.ts} (82%) diff --git a/.changeset/bright-wombats-try.md b/.changeset/bright-wombats-try.md index f0a8016810e5d..4a6e6e01d6838 100644 --- a/.changeset/bright-wombats-try.md +++ b/.changeset/bright-wombats-try.md @@ -1,5 +1,5 @@ --- -'@mysten/sui.js': patch +'@mysten/sui': patch --- Add support for more JSON RPC error codes diff --git a/.changeset/witty-llamas-smile.md b/.changeset/witty-llamas-smile.md new file mode 100644 index 0000000000000..cd5179574f1c8 --- /dev/null +++ b/.changeset/witty-llamas-smile.md @@ -0,0 +1,18 @@ +--- +'@mysten/sui': major +'@mysten/bcs': major +'@mysten/ledgerjs-hw-app-sui': minor +'@mysten/graphql-transport': minor +'@mysten/wallet-standard': minor +'@mysten/suins-toolkit': minor +'@mysten/create-dapp': minor +'@mysten/dapp-kit': minor +'@mysten/deepbook': minor +'@mysten/zklogin': minor +'@mysten/zksend': minor +'@mysten/enoki': minor +'@mysten/kiosk': minor +--- + +The Typescript SDK has been renamed to `@mysten/sui` and includes many new features and breaking changes. +See the [full migration guide](https://sdk.mystenlabs.com/typescript/migrations/sui-1.0) for details on how to upgrade. diff --git a/.github/actions/ts-e2e/action.yml b/.github/actions/ts-e2e/action.yml index 4d4856c76d18a..c2f4cf6258ccf 100644 --- a/.github/actions/ts-e2e/action.yml +++ b/.github/actions/ts-e2e/action.yml @@ -64,5 +64,5 @@ runs: shell: bash - name: Run TS SDK e2e tests - run: pnpm dlx concurrently --kill-others --success command-1 "$E2E_RUN_LOCAL_NET_CMD" 'pnpm --filter @mysten/sui.js --filter @mysten/graphql-transport test:e2e' + run: pnpm dlx concurrently --kill-others --success command-1 "$E2E_RUN_LOCAL_NET_CMD" 'pnpm --filter @mysten/sui --filter @mysten/graphql-transport test:e2e' shell: bash diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index a371c0aa2f984..9bcc57e9c5e80 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest outputs: isWallet: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), 'sui-wallet')) }} - isTypescriptSDK: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), '@mysten/sui.js')) }} + isTypescriptSDK: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), '@mysten/sui')) }} isGraphQlTransport: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), '@mysten/graphql-transport')) }} isRust: ${{ steps.diff.outputs.isRust }} steps: @@ -66,7 +66,7 @@ jobs: - name: Run TS SDK e2e tests if: ${{ needs.diff.outputs.isTypescriptSDK == 'true' || needs.diff.outputs.isRust == 'true'}} - run: pnpm dlx concurrently --kill-others --success command-1 "$E2E_RUN_LOCAL_NET_CMD" 'pnpm --filter @mysten/sui.js test:e2e' + run: pnpm dlx concurrently --kill-others --success command-1 "$E2E_RUN_LOCAL_NET_CMD" 'pnpm --filter @mysten/sui test:e2e' - name: Run RPC/GrpahQL comaptability e2e tests if: ${{ needs.diff.outputs.isGraphQlTransport == 'true' || needs.diff.outputs.isRust == 'true'}} diff --git a/apps/core/package.json b/apps/core/package.json index ddf387f8b9fc1..65ba4e3296424 100644 --- a/apps/core/package.json +++ b/apps/core/package.json @@ -28,7 +28,7 @@ "@hookform/resolvers": "^3.1.1", "@mysten/dapp-kit": "workspace:*", "@mysten/kiosk": "workspace:*", - "@mysten/sui.js": "workspace:*", + "@mysten/sui": "workspace:*", "@sentry/react": "^7.59.2", "@tanstack/react-query": "^5.0.0", "bignumber.js": "^9.1.1", @@ -48,6 +48,6 @@ "tailwindcss": "^3.3.3", "typescript": "^5.3.3", "vite": "^4.4.4", - "vitest": "^0.33.0" + "vitest": "^1.6.0" } } diff --git a/apps/core/src/api/SentryHttpTransport.ts b/apps/core/src/api/SentryHttpTransport.ts index 262eddd68a790..0663523c77bf3 100644 --- a/apps/core/src/api/SentryHttpTransport.ts +++ b/apps/core/src/api/SentryHttpTransport.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { SuiHTTPTransport } from '@mysten/sui.js/client'; +import { SuiHTTPTransport } from '@mysten/sui/client'; import * as Sentry from '@sentry/react'; const IGNORED_METHODS = ['suix_resolveNameServiceNames', 'suix_resolveNameServiceAddresses']; diff --git a/apps/core/src/hooks/useFormatCoin.ts b/apps/core/src/hooks/useFormatCoin.ts index fac9c65b332b3..bd7b1317c765f 100644 --- a/apps/core/src/hooks/useFormatCoin.ts +++ b/apps/core/src/hooks/useFormatCoin.ts @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 import { useSuiClient } from '@mysten/dapp-kit'; -import { CoinMetadata } from '@mysten/sui.js/client'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { CoinMetadata } from '@mysten/sui/client'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; import { useQuery, type UseQueryResult } from '@tanstack/react-query'; import BigNumber from 'bignumber.js'; import { useMemo } from 'react'; diff --git a/apps/core/src/hooks/useGetCoins.ts b/apps/core/src/hooks/useGetCoins.ts index f0e09553fb177..42ae6125c7dfb 100644 --- a/apps/core/src/hooks/useGetCoins.ts +++ b/apps/core/src/hooks/useGetCoins.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { useSuiClient } from '@mysten/dapp-kit'; -import { PaginatedCoins } from '@mysten/sui.js/client'; +import { PaginatedCoins } from '@mysten/sui/client'; import { useInfiniteQuery } from '@tanstack/react-query'; const MAX_COINS_PER_REQUEST = 10; diff --git a/apps/core/src/hooks/useGetDelegatedStake.tsx b/apps/core/src/hooks/useGetDelegatedStake.tsx index 72cb32d48f066..eca438fd4d808 100644 --- a/apps/core/src/hooks/useGetDelegatedStake.tsx +++ b/apps/core/src/hooks/useGetDelegatedStake.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { useSuiClient } from '@mysten/dapp-kit'; -import type { DelegatedStake } from '@mysten/sui.js/client'; +import type { DelegatedStake } from '@mysten/sui/client'; import { useQuery, type UseQueryOptions } from '@tanstack/react-query'; type UseGetDelegatedStakesOptions = { diff --git a/apps/core/src/hooks/useGetDynamicFields.ts b/apps/core/src/hooks/useGetDynamicFields.ts index 4c53bdc4f3aec..144d831995fe4 100644 --- a/apps/core/src/hooks/useGetDynamicFields.ts +++ b/apps/core/src/hooks/useGetDynamicFields.ts @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 import { useSuiClient } from '@mysten/dapp-kit'; -import { DynamicFieldPage } from '@mysten/sui.js/client'; -import { normalizeSuiAddress } from '@mysten/sui.js/utils'; +import { DynamicFieldPage } from '@mysten/sui/client'; +import { normalizeSuiAddress } from '@mysten/sui/utils'; import { useInfiniteQuery } from '@tanstack/react-query'; const MAX_PAGE_SIZE = 10; diff --git a/apps/core/src/hooks/useGetKioskContents.ts b/apps/core/src/hooks/useGetKioskContents.ts index db52f247d308c..c5d6e42c741e3 100644 --- a/apps/core/src/hooks/useGetKioskContents.ts +++ b/apps/core/src/hooks/useGetKioskContents.ts @@ -3,7 +3,7 @@ import { useSuiClientContext } from '@mysten/dapp-kit'; import { KIOSK_ITEM, KioskClient, KioskItem, KioskOwnerCap } from '@mysten/kiosk'; -import { SuiClient } from '@mysten/sui.js/client'; +import { SuiClient } from '@mysten/sui/client'; import { useQuery } from '@tanstack/react-query'; import { getKioskIdFromOwnerCap, ORIGINBYTE_KIOSK_OWNER_TOKEN } from '../utils/kiosk'; diff --git a/apps/core/src/hooks/useGetObject.ts b/apps/core/src/hooks/useGetObject.ts index d474496c7735e..dcafed16752f5 100644 --- a/apps/core/src/hooks/useGetObject.ts +++ b/apps/core/src/hooks/useGetObject.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { useSuiClient } from '@mysten/dapp-kit'; -import { normalizeSuiAddress } from '@mysten/sui.js/utils'; +import { normalizeSuiAddress } from '@mysten/sui/utils'; import { useQuery } from '@tanstack/react-query'; const defaultOptions = { diff --git a/apps/core/src/hooks/useGetOwnedObjects.ts b/apps/core/src/hooks/useGetOwnedObjects.ts index e0a87d1203008..d43629f19d328 100644 --- a/apps/core/src/hooks/useGetOwnedObjects.ts +++ b/apps/core/src/hooks/useGetOwnedObjects.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { useSuiClient } from '@mysten/dapp-kit'; -import { PaginatedObjectsResponse, type SuiObjectDataFilter } from '@mysten/sui.js/client'; +import { PaginatedObjectsResponse, type SuiObjectDataFilter } from '@mysten/sui/client'; import { useInfiniteQuery } from '@tanstack/react-query'; const MAX_OBJECTS_PER_REQ = 6; diff --git a/apps/core/src/hooks/useGetTransferAmount.ts b/apps/core/src/hooks/useGetTransferAmount.ts index 1bfab3b336cfa..ca9776808a32d 100644 --- a/apps/core/src/hooks/useGetTransferAmount.ts +++ b/apps/core/src/hooks/useGetTransferAmount.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { SuiTransactionBlockResponse } from '@mysten/sui.js/client'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { SuiTransactionBlockResponse } from '@mysten/sui/client'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; import { useMemo } from 'react'; import { getTotalGasUsed } from '../utils/transaction'; diff --git a/apps/core/src/hooks/useGetValidatorsEvents.ts b/apps/core/src/hooks/useGetValidatorsEvents.ts index ca7ad07064037..3948757fe649e 100644 --- a/apps/core/src/hooks/useGetValidatorsEvents.ts +++ b/apps/core/src/hooks/useGetValidatorsEvents.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 import { useSuiClient } from '@mysten/dapp-kit'; -import { SuiEvent, type EventId } from '@mysten/sui.js/client'; +import { SuiEvent, type EventId } from '@mysten/sui/client'; import { useQuery } from '@tanstack/react-query'; type GetValidatorsEvent = { diff --git a/apps/core/src/hooks/useMultiGetObjects.ts b/apps/core/src/hooks/useMultiGetObjects.ts index 6d04fea411562..f01804576b26c 100644 --- a/apps/core/src/hooks/useMultiGetObjects.ts +++ b/apps/core/src/hooks/useMultiGetObjects.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { useSuiClient } from '@mysten/dapp-kit'; -import { SuiObjectDataOptions, SuiObjectResponse } from '@mysten/sui.js/client'; +import { SuiObjectDataOptions, SuiObjectResponse } from '@mysten/sui/client'; import { useQuery, UseQueryOptions } from '@tanstack/react-query'; import { chunkArray } from '../utils/chunkArray'; diff --git a/apps/core/src/hooks/useTransactionSummary.ts b/apps/core/src/hooks/useTransactionSummary.ts index a09b0f134e289..4bceaa214f89a 100644 --- a/apps/core/src/hooks/useTransactionSummary.ts +++ b/apps/core/src/hooks/useTransactionSummary.ts @@ -3,7 +3,7 @@ import { DryRunTransactionBlockResponse, type SuiTransactionBlockResponse, -} from '@mysten/sui.js/client'; +} from '@mysten/sui/client'; import { useMemo } from 'react'; import { getBalanceChangeSummary } from '../utils/transaction/getBalanceChangeSummary'; diff --git a/apps/core/src/utils/getRefGasPrice.ts b/apps/core/src/utils/getRefGasPrice.ts index 9b6f964395947..f20f82b87ad43 100644 --- a/apps/core/src/utils/getRefGasPrice.ts +++ b/apps/core/src/utils/getRefGasPrice.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { SuiValidatorSummary } from '@mysten/sui.js/client'; +import { SuiValidatorSummary } from '@mysten/sui/client'; import { calculateStakeShare } from './calculateStakeShare'; diff --git a/apps/core/src/utils/hasDisplayData.ts b/apps/core/src/utils/hasDisplayData.ts index 034382eccf41d..02e944e25c353 100644 --- a/apps/core/src/utils/hasDisplayData.ts +++ b/apps/core/src/utils/hasDisplayData.ts @@ -1,6 +1,6 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { SuiObjectResponse } from '@mysten/sui.js/client'; +import { SuiObjectResponse } from '@mysten/sui/client'; export const hasDisplayData = (obj: SuiObjectResponse) => !!obj.data?.display?.data; diff --git a/apps/core/src/utils/kiosk.ts b/apps/core/src/utils/kiosk.ts index 73ce1a6047672..2c56824e8ad15 100644 --- a/apps/core/src/utils/kiosk.ts +++ b/apps/core/src/utils/kiosk.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { KIOSK_OWNER_CAP, Network, PERSONAL_KIOSK_RULE_ADDRESS } from '@mysten/kiosk'; -import { SuiObjectData, SuiObjectResponse } from '@mysten/sui.js/client'; +import { SuiObjectData, SuiObjectResponse } from '@mysten/sui/client'; export const ORIGINBYTE_KIOSK_MODULE = '0x95a441d389b07437d00dd07e0b6f05f513d7659b13fd7c5d3923c7d9d847199b::ob_kiosk'; diff --git a/apps/core/src/utils/transaction/getBalanceChangeSummary.ts b/apps/core/src/utils/transaction/getBalanceChangeSummary.ts index 4707d99f0a483..9f89165a2c367 100644 --- a/apps/core/src/utils/transaction/getBalanceChangeSummary.ts +++ b/apps/core/src/utils/transaction/getBalanceChangeSummary.ts @@ -4,8 +4,8 @@ import { type DryRunTransactionBlockResponse, type ObjectOwner, type SuiTransactionBlockResponse, -} from '@mysten/sui.js/client'; -import { normalizeSuiObjectId, parseStructTag } from '@mysten/sui.js/utils'; +} from '@mysten/sui/client'; +import { normalizeSuiObjectId, parseStructTag } from '@mysten/sui/utils'; export type BalanceChange = { coinType: string; diff --git a/apps/core/src/utils/transaction/getGasSummary.ts b/apps/core/src/utils/transaction/getGasSummary.ts index a2086f874f207..36e428ac00e2a 100644 --- a/apps/core/src/utils/transaction/getGasSummary.ts +++ b/apps/core/src/utils/transaction/getGasSummary.ts @@ -6,7 +6,7 @@ import { SuiGasData, SuiTransactionBlockResponse, TransactionEffects, -} from '@mysten/sui.js/client'; +} from '@mysten/sui/client'; type Optional = { [K in keyof T]?: T[K]; diff --git a/apps/core/src/utils/transaction/getLabel.ts b/apps/core/src/utils/transaction/getLabel.ts index 9b1b1d65679c5..81fd79a6334c9 100644 --- a/apps/core/src/utils/transaction/getLabel.ts +++ b/apps/core/src/utils/transaction/getLabel.ts @@ -1,6 +1,6 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { SuiTransactionBlockResponse } from '@mysten/sui.js/client'; +import { SuiTransactionBlockResponse } from '@mysten/sui/client'; // todo: add more logic for deriving transaction label export const getLabel = (transaction: SuiTransactionBlockResponse, currentAddress?: string) => { diff --git a/apps/core/src/utils/transaction/getObjectChangeSummary.ts b/apps/core/src/utils/transaction/getObjectChangeSummary.ts index 57e865750f15a..91247eb5c1232 100644 --- a/apps/core/src/utils/transaction/getObjectChangeSummary.ts +++ b/apps/core/src/utils/transaction/getObjectChangeSummary.ts @@ -9,7 +9,7 @@ import { SuiObjectChangePublished, SuiObjectChangeTransferred, SuiObjectChangeWrapped, -} from '@mysten/sui.js/client'; +} from '@mysten/sui/client'; import { groupByOwner } from './groupByOwner'; import { SuiObjectChangeTypes } from './types'; diff --git a/apps/core/src/utils/transaction/getObjectDisplayLookup.ts b/apps/core/src/utils/transaction/getObjectDisplayLookup.ts index ed683189122a3..c7b8166f6b384 100644 --- a/apps/core/src/utils/transaction/getObjectDisplayLookup.ts +++ b/apps/core/src/utils/transaction/getObjectDisplayLookup.ts @@ -1,6 +1,6 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { DisplayFieldsResponse, SuiObjectResponse } from '@mysten/sui.js/client'; +import { DisplayFieldsResponse, SuiObjectResponse } from '@mysten/sui/client'; import { hasDisplayData } from '../hasDisplayData'; diff --git a/apps/core/src/utils/transaction/getOwnerType.ts b/apps/core/src/utils/transaction/getOwnerType.ts index a400905201bbf..4dc63d2dc3880 100644 --- a/apps/core/src/utils/transaction/getOwnerType.ts +++ b/apps/core/src/utils/transaction/getOwnerType.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import type { SuiObjectChange } from '@mysten/sui.js/client'; +import type { SuiObjectChange } from '@mysten/sui/client'; export const getOwnerType = (change: SuiObjectChange) => { if (!('owner' in change)) return ''; diff --git a/apps/wallet/configs/ts/tsconfig.common.json b/apps/wallet/configs/ts/tsconfig.common.json index 2daa3e85bccea..030d33a1f8708 100644 --- a/apps/wallet/configs/ts/tsconfig.common.json +++ b/apps/wallet/configs/ts/tsconfig.common.json @@ -43,8 +43,8 @@ "_values/*": ["./src/ui/styles/values/*"], "_utils": ["./src/ui/styles/utils"], "_utils/*": ["./src/ui/styles/utils/*"], - "@mysten/sui.js/*": ["../../sdk/typescript/src/*"], - "@mysten/sui.js": ["../../sdk/typescript/src/"], + "@mysten/sui/*": ["../../sdk/typescript/src/*"], + "@mysten/sui": ["../../sdk/typescript/src/"], "@mysten/kiosk": ["../../sdk/kiosk/src/index.ts"], "@mysten/bcs": ["../../sdk/bcs/src/"], "@mysten/dapp-kit": ["../../sdk/dapp-kit/src/"], diff --git a/apps/wallet/configs/webpack/webpack.config.common.ts b/apps/wallet/configs/webpack/webpack.config.common.ts index 2af5fdf3f051c..4ca0a7776b2b6 100644 --- a/apps/wallet/configs/webpack/webpack.config.common.ts +++ b/apps/wallet/configs/webpack/webpack.config.common.ts @@ -110,7 +110,7 @@ const commonConfig: () => Promise = async () => { }, resolve: { extensions: ['.ts', '.tsx', '.js'], - // Fix .js imports from @mysten/sui.js since we are importing it from source + // Fix .js imports from @mysten/sui since we are importing it from source extensionAlias: { '.js': ['.js', '.ts', '.tsx', '.jsx'], '.mjs': ['.mjs', '.mts'], diff --git a/apps/wallet/package.json b/apps/wallet/package.json index cd99cc81a6411..c09bd878db308 100644 --- a/apps/wallet/package.json +++ b/apps/wallet/package.json @@ -77,7 +77,7 @@ "dotenv-webpack": "^8.0.0", "eslint-webpack-plugin": "^4.0.1", "git-rev-sync": "^3.0.2", - "happy-dom": "^10.5.1", + "happy-dom": "^14.11.0", "html-webpack-plugin": "^5.5.3", "mini-css-extract-plugin": "^2.7.6", "onchange": "^7.1.0", @@ -95,7 +95,7 @@ "typescript": "^5.3.3", "vite": "^4.4.4", "vite-tsconfig-paths": "^4.2.0", - "vitest": "^0.33.0", + "vitest": "^1.6.0", "web-ext": "^7.6.2", "webpack": "^5.79.0", "webpack-cli": "^5.0.1", @@ -120,7 +120,7 @@ "@mysten/icons": "workspace:*", "@mysten/kiosk": "workspace:*", "@mysten/ledgerjs-hw-app-sui": "workspace:*", - "@mysten/sui.js": "workspace:*", + "@mysten/sui": "workspace:*", "@mysten/wallet-standard": "workspace:*", "@mysten/zklogin": "workspace:*", "@noble/hashes": "^1.3.1", diff --git a/apps/wallet/src/background/Transactions.ts b/apps/wallet/src/background/Transactions.ts index 894309572d95b..51f9c24aad4fd 100644 --- a/apps/wallet/src/background/Transactions.ts +++ b/apps/wallet/src/background/Transactions.ts @@ -10,7 +10,7 @@ import { type SignMessageRequest } from '_payloads/transactions/SignMessage'; import type { TransactionRequestResponse } from '_payloads/transactions/ui/TransactionRequestResponse'; import type { ContentScriptConnection } from '_src/background/connections/ContentScriptConnection'; import { type SignedTransaction } from '_src/ui/app/WalletSigner'; -import { type SuiTransactionBlockResponse } from '@mysten/sui.js/client'; +import { type SuiTransactionBlockResponse } from '@mysten/sui/client'; import { type SuiSignMessageOutput } from '@mysten/wallet-standard'; import { filter, lastValueFrom, map, race, Subject, take } from 'rxjs'; import { v4 as uuidV4 } from 'uuid'; diff --git a/apps/wallet/src/background/account-sources/MnemonicAccountSource.ts b/apps/wallet/src/background/account-sources/MnemonicAccountSource.ts index fb8c3f50baf6b..4a6f712b14450 100644 --- a/apps/wallet/src/background/account-sources/MnemonicAccountSource.ts +++ b/apps/wallet/src/background/account-sources/MnemonicAccountSource.ts @@ -9,8 +9,8 @@ import { validateEntropy, } from '_shared/utils/bip39'; import { decrypt, encrypt } from '_src/shared/cryptography/keystore'; -import { mnemonicToSeedHex } from '@mysten/sui.js/cryptography'; -import { Ed25519Keypair } from '@mysten/sui.js/keypairs/ed25519'; +import { mnemonicToSeedHex } from '@mysten/sui/cryptography'; +import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519'; import { sha256 } from '@noble/hashes/sha256'; import { bytesToHex } from '@noble/hashes/utils'; import Dexie from 'dexie'; diff --git a/apps/wallet/src/background/accounts/Account.ts b/apps/wallet/src/background/accounts/Account.ts index 39e6b0615c81d..d41aff29e1d2f 100644 --- a/apps/wallet/src/background/accounts/Account.ts +++ b/apps/wallet/src/background/accounts/Account.ts @@ -2,11 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { type Serializable } from '_src/shared/cryptography/keystore'; -import { - toSerializedSignature, - type Keypair, - type SerializedSignature, -} from '@mysten/sui.js/cryptography'; +import { toSerializedSignature, type Keypair } from '@mysten/sui/cryptography'; import { blake2b } from '@noble/hashes/blake2b'; import { setupAutoLockAlarm } from '../auto-lock-accounts'; @@ -71,10 +67,10 @@ export abstract class Account< return data as T; } - protected generateSignature(data: Uint8Array, keyPair: Keypair) { + protected async generateSignature(data: Uint8Array, keyPair: Keypair) { const digest = blake2b(data, { dkLen: 32 }); const pubkey = keyPair.getPublicKey(); - const signature = keyPair.signData(digest); + const signature = await keyPair.sign(digest); const signatureScheme = keyPair.getKeyScheme(); return toSerializedSignature({ signature, @@ -176,7 +172,7 @@ export function isPasswordUnLockable(account: unknown): account is PasswordUnloc export interface SigningAccount { readonly canSign: true; - signData(data: Uint8Array): Promise; + signData(data: Uint8Array): Promise; } export function isSigningAccount(account: any): account is SigningAccount { diff --git a/apps/wallet/src/background/accounts/MnemonicAccount.ts b/apps/wallet/src/background/accounts/MnemonicAccount.ts index a641a8980f803..e949877f07d71 100644 --- a/apps/wallet/src/background/accounts/MnemonicAccount.ts +++ b/apps/wallet/src/background/accounts/MnemonicAccount.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { fromExportedKeypair } from '_src/shared/utils/from-exported-keypair'; -import { type Keypair } from '@mysten/sui.js/cryptography'; +import { type Keypair } from '@mysten/sui/cryptography'; import { MnemonicAccountSource } from '../account-sources/MnemonicAccountSource'; import { diff --git a/apps/wallet/src/background/accounts/index.ts b/apps/wallet/src/background/accounts/index.ts index b9ee836173b3b..a8feb5089c961 100644 --- a/apps/wallet/src/background/accounts/index.ts +++ b/apps/wallet/src/background/accounts/index.ts @@ -7,7 +7,7 @@ import { type MethodPayload, } from '_src/shared/messaging/messages/payloads/MethodPayload'; import { type WalletStatusChange } from '_src/shared/messaging/messages/payloads/wallet-status-change'; -import { fromB64 } from '@mysten/sui.js/utils'; +import { fromB64 } from '@mysten/sui/utils'; import Dexie from 'dexie'; import { getAccountSourceByID } from '../account-sources'; diff --git a/apps/wallet/src/background/accounts/zklogin/ZkLoginAccount.ts b/apps/wallet/src/background/accounts/zklogin/ZkLoginAccount.ts index 3d05685a8cd70..9cedb3a0f5c85 100644 --- a/apps/wallet/src/background/accounts/zklogin/ZkLoginAccount.ts +++ b/apps/wallet/src/background/accounts/zklogin/ZkLoginAccount.ts @@ -5,11 +5,7 @@ import networkEnv from '_src/background/NetworkEnv'; import { type NetworkEnvType } from '_src/shared/api-env'; import { deobfuscate, obfuscate } from '_src/shared/cryptography/keystore'; import { fromExportedKeypair } from '_src/shared/utils/from-exported-keypair'; -import { - toSerializedSignature, - type PublicKey, - type SerializedSignature, -} from '@mysten/sui.js/cryptography'; +import { toSerializedSignature, type PublicKey } from '@mysten/sui/cryptography'; import { computeZkLoginAddress, genAddressSeed, getZkLoginSignature } from '@mysten/zklogin'; import { blake2b } from '@noble/hashes/blake2b'; import { decodeJwt } from 'jose'; @@ -196,7 +192,7 @@ export class ZkLoginAccount }; } - async signData(data: Uint8Array): Promise { + async signData(data: Uint8Array): Promise { const digest = blake2b(data, { dkLen: 32 }); if (await this.isLocked()) { throw new Error('Account is locked'); diff --git a/apps/wallet/src/background/accounts/zklogin/utils.ts b/apps/wallet/src/background/accounts/zklogin/utils.ts index 8ced1343b48d8..1b937090ed32d 100644 --- a/apps/wallet/src/background/accounts/zklogin/utils.ts +++ b/apps/wallet/src/background/accounts/zklogin/utils.ts @@ -3,8 +3,8 @@ import { API_ENV, type NetworkEnvType } from '_src/shared/api-env'; import { fetchWithSentry } from '_src/shared/utils'; -import { type PublicKey } from '@mysten/sui.js/cryptography'; -import { Ed25519Keypair } from '@mysten/sui.js/keypairs/ed25519'; +import { type PublicKey } from '@mysten/sui/cryptography'; +import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519'; import { generateNonce, generateRandomness, diff --git a/apps/wallet/src/background/connections/ContentScriptConnection.ts b/apps/wallet/src/background/connections/ContentScriptConnection.ts index 36aa34c6d6c31..4eb296c0a428d 100644 --- a/apps/wallet/src/background/connections/ContentScriptConnection.ts +++ b/apps/wallet/src/background/connections/ContentScriptConnection.ts @@ -31,7 +31,7 @@ import { type SignMessageRequest, } from '_src/shared/messaging/messages/payloads/transactions/SignMessage'; import { type SignedTransaction } from '_src/ui/app/WalletSigner'; -import { type SuiTransactionBlockResponse } from '@mysten/sui.js/client'; +import { type SuiTransactionBlockResponse } from '@mysten/sui/client'; import type { Runtime } from 'webextension-polyfill'; import { getAccountsStatusData } from '../accounts'; diff --git a/apps/wallet/src/background/legacy-accounts/LegacyVault.ts b/apps/wallet/src/background/legacy-accounts/LegacyVault.ts index ef187d72c1dfd..34253c129ec54 100644 --- a/apps/wallet/src/background/legacy-accounts/LegacyVault.ts +++ b/apps/wallet/src/background/legacy-accounts/LegacyVault.ts @@ -12,7 +12,7 @@ import { fromExportedKeypair, type LegacyExportedKeyPair, } from '_shared/utils/from-exported-keypair'; -import { mnemonicToSeedHex, type Keypair } from '@mysten/sui.js/cryptography'; +import { mnemonicToSeedHex, type Keypair } from '@mysten/sui/cryptography'; import { getFromLocalStorage } from '../storage-utils'; diff --git a/apps/wallet/src/dapp-interface/WalletStandardInterface.ts b/apps/wallet/src/dapp-interface/WalletStandardInterface.ts index 74c3ef6b52533..3c74b905dd490 100644 --- a/apps/wallet/src/dapp-interface/WalletStandardInterface.ts +++ b/apps/wallet/src/dapp-interface/WalletStandardInterface.ts @@ -28,8 +28,9 @@ import { } from '_src/shared/messaging/messages/payloads/QredoConnect'; import { type SignMessageRequest } from '_src/shared/messaging/messages/payloads/transactions/SignMessage'; import { isWalletStatusChangePayload } from '_src/shared/messaging/messages/payloads/wallet-status-change'; -import { isTransactionBlock } from '@mysten/sui.js/transactions'; -import { fromB64, toB64 } from '@mysten/sui.js/utils'; +import { bcs } from '@mysten/sui/bcs'; +import { isTransaction } from '@mysten/sui/transactions'; +import { fromB64, toB64 } from '@mysten/sui/utils'; import { ReadonlyWalletAccount, SUI_CHAINS, @@ -44,9 +45,11 @@ import { type StandardEventsOnMethod, type SuiFeatures, type SuiSignAndExecuteTransactionBlockMethod, + type SuiSignAndExecuteTransactionMethod, type SuiSignMessageMethod, type SuiSignPersonalMessageMethod, type SuiSignTransactionBlockMethod, + type SuiSignTransactionMethod, type Wallet, } from '@mysten/wallet-standard'; import mitt, { type Emitter } from 'mitt'; @@ -131,10 +134,18 @@ export class SuiWallet implements Wallet { version: '1.0.0', signTransactionBlock: this.#signTransactionBlock, }, + 'sui:signTransaction': { + version: '2.0.0', + signTransaction: this.#signTransaction, + }, 'sui:signAndExecuteTransactionBlock': { version: '1.0.0', signAndExecuteTransactionBlock: this.#signAndExecuteTransactionBlock, }, + 'sui:signAndExecuteTransaction': { + version: '2.0.0', + signAndExecuteTransaction: this.#signAndExecuteTransaction, + }, 'sui:signMessage': { version: '1.0.0', signMessage: this.#signMessage, @@ -238,9 +249,9 @@ export class SuiWallet implements Wallet { account, ...input }) => { - if (!isTransactionBlock(transactionBlock)) { + if (!isTransaction(transactionBlock)) { throw new Error( - 'Unexpect transaction format found. Ensure that you are using the `Transaction` class.', + 'Unexpected transaction format found. Ensure that you are using the `Transaction` class.', ); } @@ -259,10 +270,29 @@ export class SuiWallet implements Wallet { ); }; + #signTransaction: SuiSignTransactionMethod = async ({ transaction, account, ...input }) => { + return mapToPromise( + this.#send({ + type: 'sign-transaction-request', + transaction: { + ...input, + // account might be undefined if previous version of adapters is used + // in that case use the first account address + account: account?.address || this.#accounts[0]?.address || '', + transaction: await transaction.toJSON(), + }, + }), + ({ result: { signature, transactionBlockBytes: bytes } }) => ({ + signature, + bytes, + }), + ); + }; + #signAndExecuteTransactionBlock: SuiSignAndExecuteTransactionBlockMethod = async (input) => { - if (!isTransactionBlock(input.transactionBlock)) { + if (!isTransaction(input.transactionBlock)) { throw new Error( - 'Unexpect transaction format found. Ensure that you are using the `Transaction` class.', + 'Unexpected transaction format found. Ensure that you are using the `Transaction` class.', ); } @@ -282,6 +312,42 @@ export class SuiWallet implements Wallet { ); }; + #signAndExecuteTransaction: SuiSignAndExecuteTransactionMethod = async (input) => { + return mapToPromise( + this.#send({ + type: 'execute-transaction-request', + transaction: { + type: 'transaction', + data: await input.transaction.toJSON(), + options: { + showRawEffects: true, + showRawInput: true, + }, + // account might be undefined if previous version of adapters is used + // in that case use the first account address + account: input.account?.address || this.#accounts[0]?.address || '', + }, + }), + ({ result: { rawEffects, rawTransaction, digest } }) => { + const [ + { + txSignatures: [signature], + intentMessage: { value: bcsTransaction }, + }, + ] = bcs.SenderSignedData.parse(fromB64(rawTransaction!)); + + const bytes = bcs.TransactionData.serialize(bcsTransaction).toBase64(); + + return { + digest, + signature, + bytes, + effects: toB64(new Uint8Array(rawEffects!)), + }; + }, + ); + }; + #signMessage: SuiSignMessageMethod = async ({ message, account }) => { return mapToPromise( this.#send({ diff --git a/apps/wallet/src/shared/messaging/messages/payloads/MethodPayload.ts b/apps/wallet/src/shared/messaging/messages/payloads/MethodPayload.ts index 63204b3fb5361..6704cc582cd79 100644 --- a/apps/wallet/src/shared/messaging/messages/payloads/MethodPayload.ts +++ b/apps/wallet/src/shared/messaging/messages/payloads/MethodPayload.ts @@ -5,7 +5,6 @@ import { type AccountSourceSerializedUI } from '_src/background/account-sources/ import { type SerializedUIAccount } from '_src/background/accounts/Account'; import { type ZkLoginProvider } from '_src/background/accounts/zklogin/providers'; import { type Status } from '_src/background/legacy-accounts/storage-migration'; -import { type SerializedSignature } from '@mysten/sui.js/cryptography'; import { isBasePayload } from './BasePayload'; import type { Payload } from './Payload'; @@ -44,7 +43,7 @@ type MethodPayloads = { }; accountsCreatedResponse: { accounts: SerializedUIAccount[] }; signData: { data: string; id: string }; - signDataResponse: { signature: SerializedSignature }; + signDataResponse: { signature: string }; entitiesUpdated: { type: UIAccessibleEntityType }; getStorageMigrationStatus: null; storageMigrationStatus: { status: Status }; diff --git a/apps/wallet/src/shared/messaging/messages/payloads/transactions/ApprovalRequest.ts b/apps/wallet/src/shared/messaging/messages/payloads/transactions/ApprovalRequest.ts index 9d73093667c4d..588b0a69b61ad 100644 --- a/apps/wallet/src/shared/messaging/messages/payloads/transactions/ApprovalRequest.ts +++ b/apps/wallet/src/shared/messaging/messages/payloads/transactions/ApprovalRequest.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { type SignedTransaction } from '_src/ui/app/WalletSigner'; -import type { SuiTransactionBlockResponse } from '@mysten/sui.js/client'; +import type { SuiTransactionBlockResponse } from '@mysten/sui/client'; import { type SuiSignAndExecuteTransactionBlockInput, type SuiSignMessageOutput, diff --git a/apps/wallet/src/shared/messaging/messages/payloads/transactions/ExecuteTransactionResponse.ts b/apps/wallet/src/shared/messaging/messages/payloads/transactions/ExecuteTransactionResponse.ts index bf268075a8584..7681c5bbe5462 100644 --- a/apps/wallet/src/shared/messaging/messages/payloads/transactions/ExecuteTransactionResponse.ts +++ b/apps/wallet/src/shared/messaging/messages/payloads/transactions/ExecuteTransactionResponse.ts @@ -3,7 +3,7 @@ import { isBasePayload } from '_payloads'; import type { BasePayload, Payload } from '_payloads'; -import type { SuiTransactionBlockResponse } from '@mysten/sui.js/client'; +import type { SuiTransactionBlockResponse } from '@mysten/sui/client'; import { type SuiSignTransactionBlockOutput } from '@mysten/wallet-standard'; export interface ExecuteTransactionResponse extends BasePayload { diff --git a/apps/wallet/src/shared/messaging/messages/payloads/transactions/ui/TransactionRequestResponse.ts b/apps/wallet/src/shared/messaging/messages/payloads/transactions/ui/TransactionRequestResponse.ts index 7c24a9e7c70e1..94aa701f19b6c 100644 --- a/apps/wallet/src/shared/messaging/messages/payloads/transactions/ui/TransactionRequestResponse.ts +++ b/apps/wallet/src/shared/messaging/messages/payloads/transactions/ui/TransactionRequestResponse.ts @@ -4,7 +4,7 @@ import { isBasePayload } from '_payloads'; import type { BasePayload, Payload } from '_payloads'; import { type SignedTransaction } from '_src/ui/app/WalletSigner'; -import type { SuiTransactionBlockResponse } from '@mysten/sui.js/client'; +import type { SuiTransactionBlockResponse } from '@mysten/sui/client'; import { type SuiSignMessageOutput } from '@mysten/wallet-standard'; export interface TransactionRequestResponse extends BasePayload { diff --git a/apps/wallet/src/shared/sui-client.ts b/apps/wallet/src/shared/sui-client.ts index 284225e8959ff..50fe95b12f2b0 100644 --- a/apps/wallet/src/shared/sui-client.ts +++ b/apps/wallet/src/shared/sui-client.ts @@ -4,7 +4,7 @@ import networkEnv from '_src/background/NetworkEnv'; import { API_ENV, ENV_TO_API, type NetworkEnvType } from '_src/shared/api-env'; import { SentryHttpTransport } from '@mysten/core'; -import { SuiClient, SuiHTTPTransport } from '@mysten/sui.js/client'; +import { SuiClient, SuiHTTPTransport } from '@mysten/sui/client'; const suiClientPerNetwork = new Map(); const SENTRY_MONITORED_ENVS = [API_ENV.mainnet]; diff --git a/apps/wallet/src/shared/utils/from-exported-keypair.ts b/apps/wallet/src/shared/utils/from-exported-keypair.ts index a3e7cd667de19..868a4cd62dfa5 100644 --- a/apps/wallet/src/shared/utils/from-exported-keypair.ts +++ b/apps/wallet/src/shared/utils/from-exported-keypair.ts @@ -1,16 +1,16 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { type Keypair, type SignatureScheme } from '@mysten/sui.js/cryptography'; +import { type Keypair, type SignatureScheme } from '@mysten/sui/cryptography'; import { decodeSuiPrivateKey, LEGACY_PRIVATE_KEY_SIZE, PRIVATE_KEY_SIZE, -} from '@mysten/sui.js/cryptography/keypair'; -import { Ed25519Keypair } from '@mysten/sui.js/keypairs/ed25519'; -import { Secp256k1Keypair } from '@mysten/sui.js/keypairs/secp256k1'; -import { Secp256r1Keypair } from '@mysten/sui.js/keypairs/secp256r1'; -import { fromB64 } from '@mysten/sui.js/utils'; +} from '@mysten/sui/cryptography/keypair'; +import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519'; +import { Secp256k1Keypair } from '@mysten/sui/keypairs/secp256k1'; +import { Secp256r1Keypair } from '@mysten/sui/keypairs/secp256r1'; +import { fromB64 } from '@mysten/sui/utils'; /** * Wallet stored data might contain imported accounts with their keys stored in the previous format. diff --git a/apps/wallet/src/shared/utils/index.ts b/apps/wallet/src/shared/utils/index.ts index d47ca5869c790..04bdea8fbc6d7 100644 --- a/apps/wallet/src/shared/utils/index.ts +++ b/apps/wallet/src/shared/utils/index.ts @@ -4,7 +4,7 @@ import { useAppSelector } from '_hooks'; import { setAttributes } from '_src/shared/experimentation/features'; import { useGrowthBook } from '@growthbook/growthbook-react'; -import { fromB64, toB64 } from '@mysten/sui.js/utils'; +import { fromB64, toB64 } from '@mysten/sui/utils'; import * as Sentry from '@sentry/browser'; import { useEffect } from 'react'; import Browser from 'webextension-polyfill'; diff --git a/apps/wallet/src/ui/app/ApiProvider.ts b/apps/wallet/src/ui/app/ApiProvider.ts index 4f79d29c43b46..0b1fc004b3217 100644 --- a/apps/wallet/src/ui/app/ApiProvider.ts +++ b/apps/wallet/src/ui/app/ApiProvider.ts @@ -4,7 +4,7 @@ import { type AccountType, type SerializedUIAccount } from '_src/background/accounts/Account'; import { API_ENV } from '_src/shared/api-env'; import { getSuiClient } from '_src/shared/sui-client'; -import { type SuiClient } from '@mysten/sui.js/client'; +import { type SuiClient } from '@mysten/sui/client'; import type { BackgroundClient } from './background-client'; import { BackgroundServiceSigner } from './background-client/BackgroundServiceSigner'; diff --git a/apps/wallet/src/ui/app/LedgerSigner.ts b/apps/wallet/src/ui/app/LedgerSigner.ts index 84dc8a7ff9493..02fd9886f7749 100644 --- a/apps/wallet/src/ui/app/LedgerSigner.ts +++ b/apps/wallet/src/ui/app/LedgerSigner.ts @@ -2,13 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 import type SuiLedgerClient from '@mysten/ledgerjs-hw-app-sui'; -import { type SuiClient } from '@mysten/sui.js/client'; -import { - toSerializedSignature, - type SerializedSignature, - type SignatureScheme, -} from '@mysten/sui.js/cryptography'; -import { Ed25519PublicKey } from '@mysten/sui.js/keypairs/ed25519'; +import { type SuiClient } from '@mysten/sui/client'; +import { toSerializedSignature, type SignatureScheme } from '@mysten/sui/cryptography'; +import { Ed25519PublicKey } from '@mysten/sui/keypairs/ed25519'; import { WalletSigner } from './WalletSigner'; @@ -51,7 +47,7 @@ export class LedgerSigner extends WalletSigner { return new Ed25519PublicKey(publicKey); } - async signData(data: Uint8Array): Promise { + async signData(data: Uint8Array): Promise { const ledgerClient = await this.#initializeSuiLedgerClient(); const { signature } = await ledgerClient.signTransaction(this.#derivationPath, data); const publicKey = await this.getPublicKey(); diff --git a/apps/wallet/src/ui/app/QredoSigner.ts b/apps/wallet/src/ui/app/QredoSigner.ts index 3841cda34c4c6..3858baefed41f 100644 --- a/apps/wallet/src/ui/app/QredoSigner.ts +++ b/apps/wallet/src/ui/app/QredoSigner.ts @@ -8,13 +8,9 @@ import { type QredoAPI, type TransactionInfoResponse, } from '_src/shared/qredo-api'; -import { type SuiClient } from '@mysten/sui.js/client'; -import { - IntentScope, - messageWithIntent, - type SerializedSignature, -} from '@mysten/sui.js/cryptography'; -import { toB64 } from '@mysten/sui.js/utils'; +import { type SuiClient } from '@mysten/sui/client'; +import { messageWithIntent } from '@mysten/sui/cryptography'; +import { toB64 } from '@mysten/sui/utils'; import mitt from 'mitt'; import { WalletSigner } from './WalletSigner'; @@ -55,7 +51,7 @@ export class QredoSigner extends WalletSigner { return this.#qredoAccount.address; } - async signData(data: Uint8Array, clientIdentifier?: string): Promise { + async signData(data: Uint8Array, clientIdentifier?: string): Promise { let txInfo = await this.#createQredoTransaction(data, false, clientIdentifier); try { txInfo = await this.#pollForQredoTransaction( @@ -86,7 +82,7 @@ export class QredoSigner extends WalletSigner { signMessage: WalletSigner['signMessage'] = async (input, clientIdentifier) => { const signature = await this.signData( - messageWithIntent(IntentScope.PersonalMessage, input.message), + messageWithIntent('PersonalMessage', input.message), clientIdentifier, ); return { @@ -98,7 +94,7 @@ export class QredoSigner extends WalletSigner { signTransactionBlock: WalletSigner['signTransactionBlock'] = async (input, clientIdentifier) => { const transactionBlockBytes = await this.prepareTransactionBlock(input.transactionBlock); const signature = await this.signData( - messageWithIntent(IntentScope.TransactionData, transactionBlockBytes), + messageWithIntent('TransactionData', transactionBlockBytes), clientIdentifier, ); return { @@ -112,10 +108,7 @@ export class QredoSigner extends WalletSigner { clientIdentifier, ) => { let txInfo = await this.#createQredoTransaction( - messageWithIntent( - IntentScope.TransactionData, - await this.prepareTransactionBlock(transactionBlock), - ), + messageWithIntent('TransactionData', await this.prepareTransactionBlock(transactionBlock)), true, clientIdentifier, ); @@ -149,7 +142,7 @@ export class QredoSigner extends WalletSigner { if (!txInfo.txHash) { throw new Error(`Digest is not set in Qredo transaction ${txInfo.txID}`); } - return this.client.waitForTransactionBlock({ + return this.client.waitForTransaction({ digest: txInfo.txHash, options: options, }); diff --git a/apps/wallet/src/ui/app/WalletSigner.ts b/apps/wallet/src/ui/app/WalletSigner.ts index 2889a7eef0070..d5df590a6b0ab 100644 --- a/apps/wallet/src/ui/app/WalletSigner.ts +++ b/apps/wallet/src/ui/app/WalletSigner.ts @@ -1,17 +1,17 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { bcs } from '@mysten/sui.js/bcs'; +import { bcs } from '@mysten/sui/bcs'; import { type DryRunTransactionBlockResponse, type ExecuteTransactionRequestType, type SuiClient, type SuiTransactionBlockResponse, type SuiTransactionBlockResponseOptions, -} from '@mysten/sui.js/client'; -import { IntentScope, messageWithIntent } from '@mysten/sui.js/cryptography'; -import { isTransactionBlock, type TransactionBlock } from '@mysten/sui.js/transactions'; -import { fromB64, toB64 } from '@mysten/sui.js/utils'; +} from '@mysten/sui/client'; +import { messageWithIntent } from '@mysten/sui/cryptography'; +import { isTransaction, type Transaction } from '@mysten/sui/transactions'; +import { fromB64, toB64 } from '@mysten/sui/utils'; export type SignedTransaction = { transactionBlockBytes: string; @@ -39,10 +39,7 @@ export abstract class WalletSigner { clientIdentifier?: string, ): Promise { const signature = await this.signData( - messageWithIntent( - IntentScope.PersonalMessage, - bcs.ser(['vector', 'u8'], input.message).toBytes(), - ), + messageWithIntent('PersonalMessage', bcs.vector(bcs.u8()).serialize(input.message).toBytes()), ); return { @@ -51,10 +48,8 @@ export abstract class WalletSigner { }; } - protected async prepareTransactionBlock( - transactionBlock: Uint8Array | TransactionBlock | string, - ) { - if (isTransactionBlock(transactionBlock)) { + protected async prepareTransactionBlock(transactionBlock: Uint8Array | Transaction | string) { + if (isTransaction(transactionBlock)) { // If the sender has not yet been set on the transaction, then set it. // NOTE: This allows for signing transactions with mis-matched senders, which is important for sponsored transactions. transactionBlock.setSenderIfNotSet(await this.getAddress()); @@ -75,12 +70,12 @@ export abstract class WalletSigner { async signTransactionBlock( input: { - transactionBlock: Uint8Array | TransactionBlock; + transactionBlock: Uint8Array | Transaction; }, clientIdentifier?: string, ): Promise { const bytes = await this.prepareTransactionBlock(input.transactionBlock); - const signature = await this.signData(messageWithIntent(IntentScope.TransactionData, bytes)); + const signature = await this.signData(messageWithIntent('TransactionData', bytes)); return { transactionBlockBytes: toB64(bytes), @@ -90,7 +85,7 @@ export abstract class WalletSigner { async signAndExecuteTransactionBlock( input: { - transactionBlock: Uint8Array | TransactionBlock; + transactionBlock: Uint8Array | Transaction; options?: SuiTransactionBlockResponseOptions; requestType?: ExecuteTransactionRequestType; }, @@ -110,7 +105,7 @@ export abstract class WalletSigner { } async dryRunTransactionBlock(input: { - transactionBlock: TransactionBlock | string | Uint8Array; + transactionBlock: Transaction | string | Uint8Array; }): Promise { return this.client.dryRunTransactionBlock({ transactionBlock: await this.prepareTransactionBlock(input.transactionBlock), diff --git a/apps/wallet/src/ui/app/background-client/BackgroundServiceSigner.ts b/apps/wallet/src/ui/app/background-client/BackgroundServiceSigner.ts index 2e999d24959bc..7fec7c0fe1cda 100644 --- a/apps/wallet/src/ui/app/background-client/BackgroundServiceSigner.ts +++ b/apps/wallet/src/ui/app/background-client/BackgroundServiceSigner.ts @@ -2,8 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { type SerializedUIAccount } from '_src/background/accounts/Account'; -import { type SuiClient } from '@mysten/sui.js/client'; -import type { SerializedSignature } from '@mysten/sui.js/cryptography'; +import { type SuiClient } from '@mysten/sui/client'; import type { BackgroundClient } from '.'; import { WalletSigner } from '../WalletSigner'; @@ -22,7 +21,7 @@ export class BackgroundServiceSigner extends WalletSigner { return this.#account.address; } - signData(data: Uint8Array): Promise { + signData(data: Uint8Array): Promise { return this.#backgroundClient.signData(this.#account.id, data); } diff --git a/apps/wallet/src/ui/app/background-client/index.ts b/apps/wallet/src/ui/app/background-client/index.ts index 445458929488b..669dbcbcc1ae6 100644 --- a/apps/wallet/src/ui/app/background-client/index.ts +++ b/apps/wallet/src/ui/app/background-client/index.ts @@ -30,9 +30,8 @@ import { } from '_src/shared/messaging/messages/payloads/QredoConnect'; import { type SignedMessage, type SignedTransaction } from '_src/ui/app/WalletSigner'; import type { AppDispatch } from '_store'; -import { type SuiTransactionBlockResponse } from '@mysten/sui.js/client'; -import { type SerializedSignature } from '@mysten/sui.js/cryptography'; -import { toB64 } from '@mysten/sui.js/utils'; +import { type SuiTransactionBlockResponse } from '@mysten/sui/client'; +import { toB64 } from '@mysten/sui/utils'; import { type QueryKey } from '@tanstack/react-query'; import { lastValueFrom, map, take } from 'rxjs'; @@ -151,7 +150,7 @@ export class BackgroundClient { ); } - public signData(addressOrID: string, data: Uint8Array): Promise { + public signData(addressOrID: string, data: Uint8Array): Promise { return lastValueFrom( this.sendMessage( createMessage>({ diff --git a/apps/wallet/src/ui/app/components/AccountListItem.tsx b/apps/wallet/src/ui/app/components/AccountListItem.tsx index 37dd27cdcf9f4..9052cffdb3546 100644 --- a/apps/wallet/src/ui/app/components/AccountListItem.tsx +++ b/apps/wallet/src/ui/app/components/AccountListItem.tsx @@ -4,7 +4,7 @@ import { useResolveSuiNSName } from '_app/hooks/useAppResolveSuinsName'; import { type SerializedUIAccount } from '_src/background/accounts/Account'; import { Check12, Copy12 } from '@mysten/icons'; -import { formatAddress } from '@mysten/sui.js/utils'; +import { formatAddress } from '@mysten/sui/utils'; import { useCopyToClipboard } from '../hooks/useCopyToClipboard'; import { Text } from '../shared/text'; diff --git a/apps/wallet/src/ui/app/components/WalletListSelectItem.tsx b/apps/wallet/src/ui/app/components/WalletListSelectItem.tsx index 2799d695ba624..fe583136f5000 100644 --- a/apps/wallet/src/ui/app/components/WalletListSelectItem.tsx +++ b/apps/wallet/src/ui/app/components/WalletListSelectItem.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { CheckFill16, XFill16 } from '@mysten/icons'; -import { formatAddress } from '@mysten/sui.js/utils'; +import { formatAddress } from '@mysten/sui/utils'; import { cva, cx, type VariantProps } from 'class-variance-authority'; import { useEffect, useRef } from 'react'; diff --git a/apps/wallet/src/ui/app/components/accounts/AccountItem.tsx b/apps/wallet/src/ui/app/components/accounts/AccountItem.tsx index b4f77f33de03a..629920e34da76 100644 --- a/apps/wallet/src/ui/app/components/accounts/AccountItem.tsx +++ b/apps/wallet/src/ui/app/components/accounts/AccountItem.tsx @@ -4,7 +4,7 @@ import { useResolveSuiNSName } from '_app/hooks/useAppResolveSuinsName'; import { Text } from '_src/ui/app/shared/text'; import { ArrowUpRight12, Copy12 } from '@mysten/icons'; -import { formatAddress } from '@mysten/sui.js/utils'; +import { formatAddress } from '@mysten/sui/utils'; import cn from 'clsx'; import { forwardRef, type ReactNode } from 'react'; diff --git a/apps/wallet/src/ui/app/components/accounts/AccountItemApproveConnection.tsx b/apps/wallet/src/ui/app/components/accounts/AccountItemApproveConnection.tsx index e42c0b20b1810..1972a4ce62e7b 100644 --- a/apps/wallet/src/ui/app/components/accounts/AccountItemApproveConnection.tsx +++ b/apps/wallet/src/ui/app/components/accounts/AccountItemApproveConnection.tsx @@ -7,7 +7,7 @@ import { LockUnlockButton } from '_components/accounts/LockUnlockButton'; import { useUnlockAccount } from '_components/accounts/UnlockAccountContext'; import { type SerializedUIAccount } from '_src/background/accounts/Account'; import { CheckFill16 } from '@mysten/icons'; -import { formatAddress } from '@mysten/sui.js/utils'; +import { formatAddress } from '@mysten/sui/utils'; import clsx from 'clsx'; interface Props { diff --git a/apps/wallet/src/ui/app/components/active-coins-card/index.tsx b/apps/wallet/src/ui/app/components/active-coins-card/index.tsx index 6844385876a7d..3608c1f72cf9b 100644 --- a/apps/wallet/src/ui/app/components/active-coins-card/index.tsx +++ b/apps/wallet/src/ui/app/components/active-coins-card/index.tsx @@ -6,7 +6,7 @@ import Loading from '_components/loading'; import { filterAndSortTokenBalances } from '_helpers'; import { useCoinsReFetchingConfig } from '_hooks'; import { useSuiClientQuery } from '@mysten/dapp-kit'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; import { Link } from 'react-router-dom'; import { CoinItem } from './CoinItem'; diff --git a/apps/wallet/src/ui/app/components/address-input/index.tsx b/apps/wallet/src/ui/app/components/address-input/index.tsx index c448f44ae6f4d..b4aa1cc01ed0d 100644 --- a/apps/wallet/src/ui/app/components/address-input/index.tsx +++ b/apps/wallet/src/ui/app/components/address-input/index.tsx @@ -5,7 +5,7 @@ import { Text } from '_app/shared/text'; import Alert from '_src/ui/app/components/alert'; import { useSuiClient } from '@mysten/dapp-kit'; import { QrCode, X12 } from '@mysten/icons'; -import { isValidSuiAddress } from '@mysten/sui.js/utils'; +import { isValidSuiAddress } from '@mysten/sui/utils'; import { useQuery } from '@tanstack/react-query'; import { cx } from 'class-variance-authority'; import { useField, useFormikContext } from 'formik'; diff --git a/apps/wallet/src/ui/app/components/address-input/validation.ts b/apps/wallet/src/ui/app/components/address-input/validation.ts index fde86dcd6e749..6cd654249013d 100644 --- a/apps/wallet/src/ui/app/components/address-input/validation.ts +++ b/apps/wallet/src/ui/app/components/address-input/validation.ts @@ -3,8 +3,8 @@ import { isSuiNSName, useSuiNSEnabled } from '@mysten/core'; import { useSuiClient } from '@mysten/dapp-kit'; -import { type SuiClient } from '@mysten/sui.js/client'; -import { isValidSuiAddress } from '@mysten/sui.js/utils'; +import { type SuiClient } from '@mysten/sui/client'; +import { isValidSuiAddress } from '@mysten/sui/utils'; import { useMemo } from 'react'; import * as Yup from 'yup'; diff --git a/apps/wallet/src/ui/app/components/coin-icon/index.tsx b/apps/wallet/src/ui/app/components/coin-icon/index.tsx index 280a8077b1d7f..4f11b17f47b26 100644 --- a/apps/wallet/src/ui/app/components/coin-icon/index.tsx +++ b/apps/wallet/src/ui/app/components/coin-icon/index.tsx @@ -4,7 +4,7 @@ import { ImageIcon } from '_app/shared/image-icon'; import { useCoinMetadata } from '@mysten/core'; import { Sui, Unstaked } from '@mysten/icons'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; import { cva, type VariantProps } from 'class-variance-authority'; const imageStyle = cva(['rounded-full flex'], { diff --git a/apps/wallet/src/ui/app/components/explorer-link/index.tsx b/apps/wallet/src/ui/app/components/explorer-link/index.tsx index fcfa9f16ee614..a1f9244e5c4dd 100644 --- a/apps/wallet/src/ui/app/components/explorer-link/index.tsx +++ b/apps/wallet/src/ui/app/components/explorer-link/index.tsx @@ -3,7 +3,7 @@ import ExternalLink from '_components/external-link'; import { ArrowUpRight16 } from '@mysten/icons'; -import { formatAddress } from '@mysten/sui.js/utils'; +import { formatAddress } from '@mysten/sui/utils'; import type { ReactNode } from 'react'; import { useExplorerLink, type ExplorerLinkConfig } from '../../hooks/useExplorerLink'; diff --git a/apps/wallet/src/ui/app/components/ledger/LedgerAccountRow.tsx b/apps/wallet/src/ui/app/components/ledger/LedgerAccountRow.tsx index 9aec96bc82fb7..b494572f48a89 100644 --- a/apps/wallet/src/ui/app/components/ledger/LedgerAccountRow.tsx +++ b/apps/wallet/src/ui/app/components/ledger/LedgerAccountRow.tsx @@ -6,7 +6,7 @@ import { Text } from '_src/ui/app/shared/text'; import { useFormatCoin } from '@mysten/core'; import { useSuiClientQuery } from '@mysten/dapp-kit'; import { CheckFill16 } from '@mysten/icons'; -import { formatAddress, SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { formatAddress, SUI_TYPE_ARG } from '@mysten/sui/utils'; import cl from 'clsx'; import { useCoinsReFetchingConfig } from '../../hooks'; diff --git a/apps/wallet/src/ui/app/components/ledger/useDeriveLedgerAccounts.ts b/apps/wallet/src/ui/app/components/ledger/useDeriveLedgerAccounts.ts index 0e733390312fe..c67a9e3216955 100644 --- a/apps/wallet/src/ui/app/components/ledger/useDeriveLedgerAccounts.ts +++ b/apps/wallet/src/ui/app/components/ledger/useDeriveLedgerAccounts.ts @@ -3,7 +3,7 @@ import { type LedgerAccountSerializedUI } from '_src/background/accounts/LedgerAccount'; import type SuiLedgerClient from '@mysten/ledgerjs-hw-app-sui'; -import { Ed25519PublicKey } from '@mysten/sui.js/keypairs/ed25519'; +import { Ed25519PublicKey } from '@mysten/sui/keypairs/ed25519'; import { useQuery, type UseQueryOptions } from '@tanstack/react-query'; import { useSuiLedgerClient } from './SuiLedgerClientProvider'; diff --git a/apps/wallet/src/ui/app/components/menu/content/VerifyLedgerConnectionStatus.tsx b/apps/wallet/src/ui/app/components/menu/content/VerifyLedgerConnectionStatus.tsx index 6e014d3d76b86..c78faa1af2f16 100644 --- a/apps/wallet/src/ui/app/components/menu/content/VerifyLedgerConnectionStatus.tsx +++ b/apps/wallet/src/ui/app/components/menu/content/VerifyLedgerConnectionStatus.tsx @@ -8,7 +8,7 @@ import { import { Link } from '_src/ui/app/shared/Link'; import { Text } from '_src/ui/app/shared/text'; import { Check12, X12 } from '@mysten/icons'; -import { Ed25519PublicKey } from '@mysten/sui.js/keypairs/ed25519'; +import { Ed25519PublicKey } from '@mysten/sui/keypairs/ed25519'; import { useState } from 'react'; import toast from 'react-hot-toast'; diff --git a/apps/wallet/src/ui/app/components/nft-display/Kiosk.tsx b/apps/wallet/src/ui/app/components/nft-display/Kiosk.tsx index a435ee88f755b..39ee906e1a2c6 100644 --- a/apps/wallet/src/ui/app/components/nft-display/Kiosk.tsx +++ b/apps/wallet/src/ui/app/components/nft-display/Kiosk.tsx @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 import { getKioskIdFromOwnerCap, hasDisplayData, useGetKioskContents } from '@mysten/core'; -import { type SuiObjectResponse } from '@mysten/sui.js/client'; +import { type SuiObjectResponse } from '@mysten/sui/client'; import cl from 'clsx'; import { useActiveAddress } from '../../hooks'; diff --git a/apps/wallet/src/ui/app/components/nft-display/index.tsx b/apps/wallet/src/ui/app/components/nft-display/index.tsx index 4e776f441c95e..bfbaee0e4e1c0 100644 --- a/apps/wallet/src/ui/app/components/nft-display/index.tsx +++ b/apps/wallet/src/ui/app/components/nft-display/index.tsx @@ -7,7 +7,7 @@ import { NftImage, type NftImageProps } from '_components/nft-display/NftImage'; import { useFileExtensionType, useGetNFTMeta } from '_hooks'; import { isKioskOwnerToken, useGetObject } from '@mysten/core'; import { useKioskClient } from '@mysten/core/src/hooks/useKioskClient'; -import { formatAddress } from '@mysten/sui.js/utils'; +import { formatAddress } from '@mysten/sui/utils'; import { cva } from 'class-variance-authority'; import type { VariantProps } from 'class-variance-authority'; diff --git a/apps/wallet/src/ui/app/components/receipt-card/StakeTxnCard.tsx b/apps/wallet/src/ui/app/components/receipt-card/StakeTxnCard.tsx index a39d455be9618..e660bb49d4b15 100644 --- a/apps/wallet/src/ui/app/components/receipt-card/StakeTxnCard.tsx +++ b/apps/wallet/src/ui/app/components/receipt-card/StakeTxnCard.tsx @@ -15,8 +15,8 @@ import { useGetTimeBeforeEpochNumber, useGetValidatorsApy, } from '@mysten/core'; -import type { SuiEvent } from '@mysten/sui.js/client'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import type { SuiEvent } from '@mysten/sui/client'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; import { Card } from '../../shared/transaction-summary/Card'; diff --git a/apps/wallet/src/ui/app/components/receipt-card/TxnAddressLink.tsx b/apps/wallet/src/ui/app/components/receipt-card/TxnAddressLink.tsx index ceae6c4a6019f..92880053f96c9 100644 --- a/apps/wallet/src/ui/app/components/receipt-card/TxnAddressLink.tsx +++ b/apps/wallet/src/ui/app/components/receipt-card/TxnAddressLink.tsx @@ -4,7 +4,7 @@ import ExplorerLink from '_components/explorer-link'; import { ExplorerLinkType } from '_components/explorer-link/ExplorerLinkType'; import { isSuiNSName } from '@mysten/core'; -import { formatAddress } from '@mysten/sui.js/utils'; +import { formatAddress } from '@mysten/sui/utils'; type TxnAddressLinkProps = { address: string; diff --git a/apps/wallet/src/ui/app/components/receipt-card/TxnGasSummary.tsx b/apps/wallet/src/ui/app/components/receipt-card/TxnGasSummary.tsx index 3a6dea22374fa..e8fc1b6b482c8 100644 --- a/apps/wallet/src/ui/app/components/receipt-card/TxnGasSummary.tsx +++ b/apps/wallet/src/ui/app/components/receipt-card/TxnGasSummary.tsx @@ -4,7 +4,7 @@ import { GAS_TYPE_ARG } from '_redux/slices/sui-objects/Coin'; import { Text } from '_src/ui/app/shared/text'; import { useFormatCoin } from '@mysten/core'; -import type { GasCostSummary } from '@mysten/sui.js/client'; +import type { GasCostSummary } from '@mysten/sui/client'; type TxnGasSummaryProps = { gasSummary?: GasCostSummary; diff --git a/apps/wallet/src/ui/app/components/receipt-card/UnstakeTxnCard.tsx b/apps/wallet/src/ui/app/components/receipt-card/UnstakeTxnCard.tsx index d6326937373c5..14fee4c651a4f 100644 --- a/apps/wallet/src/ui/app/components/receipt-card/UnstakeTxnCard.tsx +++ b/apps/wallet/src/ui/app/components/receipt-card/UnstakeTxnCard.tsx @@ -5,8 +5,8 @@ import { ValidatorLogo } from '_app/staking/validators/ValidatorLogo'; import { TxnAmount } from '_components/receipt-card/TxnAmount'; import { Text } from '_src/ui/app/shared/text'; import { useFormatCoin } from '@mysten/core'; -import type { SuiEvent } from '@mysten/sui.js/client'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import type { SuiEvent } from '@mysten/sui/client'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; import { Card } from '../../shared/transaction-summary/Card'; diff --git a/apps/wallet/src/ui/app/components/receipt-card/index.tsx b/apps/wallet/src/ui/app/components/receipt-card/index.tsx index ac59bcbf6efc4..e0c78ff5c921d 100644 --- a/apps/wallet/src/ui/app/components/receipt-card/index.tsx +++ b/apps/wallet/src/ui/app/components/receipt-card/index.tsx @@ -3,7 +3,7 @@ import { useRecognizedPackages } from '_src/ui/app/hooks/useRecognizedPackages'; import { useTransactionSummary } from '@mysten/core'; -import { type SuiTransactionBlockResponse } from '@mysten/sui.js/client'; +import { type SuiTransactionBlockResponse } from '@mysten/sui/client'; import { DateCard } from '../../shared/date-card'; import { TransactionSummary } from '../../shared/transaction-summary'; diff --git a/apps/wallet/src/ui/app/components/sui-apps/DisconnectApp.tsx b/apps/wallet/src/ui/app/components/sui-apps/DisconnectApp.tsx index 89cea26104dd8..98db8d2093eab 100644 --- a/apps/wallet/src/ui/app/components/sui-apps/DisconnectApp.tsx +++ b/apps/wallet/src/ui/app/components/sui-apps/DisconnectApp.tsx @@ -5,7 +5,7 @@ import Overlay from '_components/overlay'; import { useAppSelector } from '_hooks'; import { permissionsSelectors } from '_redux/slices/permissions'; import { ampli } from '_src/shared/analytics/ampli'; -import { formatAddress } from '@mysten/sui.js/utils'; +import { formatAddress } from '@mysten/sui/utils'; import { useMutation } from '@tanstack/react-query'; import { useEffect, useMemo, useState } from 'react'; import { toast } from 'react-hot-toast'; diff --git a/apps/wallet/src/ui/app/components/transactions-card/TxnActionLabel.tsx b/apps/wallet/src/ui/app/components/transactions-card/TxnActionLabel.tsx index f88be8c5b35da..566a119ca3980 100644 --- a/apps/wallet/src/ui/app/components/transactions-card/TxnActionLabel.tsx +++ b/apps/wallet/src/ui/app/components/transactions-card/TxnActionLabel.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { Text } from '_app/shared/text'; -import { formatAddress } from '@mysten/sui.js/utils'; +import { formatAddress } from '@mysten/sui/utils'; type TxnTypeProps = { address: string; diff --git a/apps/wallet/src/ui/app/components/transactions-card/index.tsx b/apps/wallet/src/ui/app/components/transactions-card/index.tsx index 3a4d4f7bd75ab..fcf767842d5a7 100644 --- a/apps/wallet/src/ui/app/components/transactions-card/index.tsx +++ b/apps/wallet/src/ui/app/components/transactions-card/index.tsx @@ -6,7 +6,7 @@ import { Text } from '_app/shared/text'; import { useGetTxnRecipientAddress } from '_hooks'; import { useRecognizedPackages } from '_src/ui/app/hooks/useRecognizedPackages'; import { getLabel, useTransactionSummary } from '@mysten/core'; -import type { SuiTransactionBlockResponse } from '@mysten/sui.js/client'; +import type { SuiTransactionBlockResponse } from '@mysten/sui/client'; import { Link } from 'react-router-dom'; import { TxnTypeLabel } from './TxnActionLabel'; diff --git a/apps/wallet/src/ui/app/helpers/checkStakingTxn.ts b/apps/wallet/src/ui/app/helpers/checkStakingTxn.ts index 7ed326dab8750..940ed4faed293 100644 --- a/apps/wallet/src/ui/app/helpers/checkStakingTxn.ts +++ b/apps/wallet/src/ui/app/helpers/checkStakingTxn.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import type { SuiTransactionBlockResponse } from '@mysten/sui.js/client'; +import type { SuiTransactionBlockResponse } from '@mysten/sui/client'; // TODO: Support programmable transactions: export function checkStakingTxn(_txn: SuiTransactionBlockResponse) { diff --git a/apps/wallet/src/ui/app/helpers/filterAndSortTokenBalances.ts b/apps/wallet/src/ui/app/helpers/filterAndSortTokenBalances.ts index 576a1d12acbf5..47ae3b0f3ad9b 100644 --- a/apps/wallet/src/ui/app/helpers/filterAndSortTokenBalances.ts +++ b/apps/wallet/src/ui/app/helpers/filterAndSortTokenBalances.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { type CoinBalance } from '@mysten/sui.js/client'; +import { type CoinBalance } from '@mysten/sui/client'; // Sort tokens by symbol and total balance // Move this to the API backend diff --git a/apps/wallet/src/ui/app/helpers/getAmount.ts b/apps/wallet/src/ui/app/helpers/getAmount.ts index b6bc94e1e5b06..d88c1026f1e35 100644 --- a/apps/wallet/src/ui/app/helpers/getAmount.ts +++ b/apps/wallet/src/ui/app/helpers/getAmount.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import type { SuiEvent, SuiTransactionBlockKind, TransactionEffects } from '@mysten/sui.js/client'; +import type { SuiEvent, SuiTransactionBlockKind, TransactionEffects } from '@mysten/sui/client'; type FormattedBalance = { amount?: number | null; diff --git a/apps/wallet/src/ui/app/helpers/getEventsSummary.ts b/apps/wallet/src/ui/app/helpers/getEventsSummary.ts index 16744e090bd6d..db984b2469dee 100644 --- a/apps/wallet/src/ui/app/helpers/getEventsSummary.ts +++ b/apps/wallet/src/ui/app/helpers/getEventsSummary.ts @@ -8,7 +8,7 @@ export {}; // getTransferObjectEvent, // isEventType, // type TransactionEvents, -// } from '@mysten/sui.js'; +// } from '@mysten/sui'; // export type CoinsMetaProps = { // amount: number; diff --git a/apps/wallet/src/ui/app/helpers/validation/privateKeyValidation.ts b/apps/wallet/src/ui/app/helpers/validation/privateKeyValidation.ts index 69f4c53dbe764..694ca95df664c 100644 --- a/apps/wallet/src/ui/app/helpers/validation/privateKeyValidation.ts +++ b/apps/wallet/src/ui/app/helpers/validation/privateKeyValidation.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { decodeSuiPrivateKey } from '@mysten/sui.js/cryptography/keypair'; +import { decodeSuiPrivateKey } from '@mysten/sui/cryptography/keypair'; import { z } from 'zod'; export const privateKeyValidation = z diff --git a/apps/wallet/src/ui/app/hooks/deepbook/useGetEstimate.ts b/apps/wallet/src/ui/app/hooks/deepbook/useGetEstimate.ts index c4822df88d03c..2810a6396cfb2 100644 --- a/apps/wallet/src/ui/app/hooks/deepbook/useGetEstimate.ts +++ b/apps/wallet/src/ui/app/hooks/deepbook/useGetEstimate.ts @@ -7,8 +7,8 @@ import { DEEPBOOK_KEY, WALLET_FEES_PERCENTAGE } from '_pages/swap/constants'; import { useDeepBookContext } from '_shared/deepBook/context'; import { useSuiClient } from '@mysten/dapp-kit'; import { type DeepBookClient } from '@mysten/deepbook'; -import { type CoinStruct, type SuiClient } from '@mysten/sui.js/client'; -import { TransactionBlock } from '@mysten/sui.js/transactions'; +import { type CoinStruct, type SuiClient } from '@mysten/sui/client'; +import { Transaction } from '@mysten/sui/transactions'; import * as Sentry from '@sentry/react'; import { useQuery, useQueryClient } from '@tanstack/react-query'; import BigNumber from 'bignumber.js'; @@ -144,7 +144,7 @@ async function getPlaceMarketOrderTxn({ quoteConversionRate: number; lotSize: string; }) { - const txb = new TransactionBlock(); + const txb = new Transaction(); const accountCap = accountCapId || deepBookClient.createAccountCap(txb); let walletFeeCoin; diff --git a/apps/wallet/src/ui/app/hooks/deepbook/useRecognizedCoins.ts b/apps/wallet/src/ui/app/hooks/deepbook/useRecognizedCoins.ts index b0f6dafbb7fd8..7280d199ce6dc 100644 --- a/apps/wallet/src/ui/app/hooks/deepbook/useRecognizedCoins.ts +++ b/apps/wallet/src/ui/app/hooks/deepbook/useRecognizedCoins.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { useDeepBookConfigs } from '_app/hooks/deepbook/useDeepBookConfigs'; import { useDeepBookContext } from '_shared/deepBook/context'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; export function useRecognizedCoins() { const coinsMap = useDeepBookContext().configs.coinsMap; diff --git a/apps/wallet/src/ui/app/hooks/useAppResolveSuinsName.ts b/apps/wallet/src/ui/app/hooks/useAppResolveSuinsName.ts index 052709eb549b6..44f8e1813179e 100644 --- a/apps/wallet/src/ui/app/hooks/useAppResolveSuinsName.ts +++ b/apps/wallet/src/ui/app/hooks/useAppResolveSuinsName.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 import { useFeatureIsOn } from '@growthbook/growthbook-react'; -import { normalizeSuiNSName } from '@mysten/sui.js/utils'; +import { normalizeSuiNSName } from '@mysten/sui/utils'; import { useResolveSuiNSName as useResolveSuiNSNameCore } from '../../../../../core'; diff --git a/apps/wallet/src/ui/app/hooks/useGetAllCoins.ts b/apps/wallet/src/ui/app/hooks/useGetAllCoins.ts index 795513a78f525..6e9608111669b 100644 --- a/apps/wallet/src/ui/app/hooks/useGetAllCoins.ts +++ b/apps/wallet/src/ui/app/hooks/useGetAllCoins.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { useSuiClient } from '@mysten/dapp-kit'; -import type { CoinStruct, PaginatedCoins } from '@mysten/sui.js/client'; +import type { CoinStruct, PaginatedCoins } from '@mysten/sui/client'; import { useQuery } from '@tanstack/react-query'; const MAX_COINS_PER_REQUEST = 100; diff --git a/apps/wallet/src/ui/app/hooks/useGetNFTs.ts b/apps/wallet/src/ui/app/hooks/useGetNFTs.ts index 19fbfd2da647e..d958890366d12 100644 --- a/apps/wallet/src/ui/app/hooks/useGetNFTs.ts +++ b/apps/wallet/src/ui/app/hooks/useGetNFTs.ts @@ -3,7 +3,7 @@ import { hasDisplayData, isKioskOwnerToken, useGetOwnedObjects } from '@mysten/core'; import { useKioskClient } from '@mysten/core/src/hooks/useKioskClient'; -import { type SuiObjectData } from '@mysten/sui.js/client'; +import { type SuiObjectData } from '@mysten/sui/client'; import { useMemo } from 'react'; import { useBuyNLargeAsset } from '../components/buynlarge/useBuyNLargeAsset'; diff --git a/apps/wallet/src/ui/app/hooks/useGetTransferAmount.ts b/apps/wallet/src/ui/app/hooks/useGetTransferAmount.ts index 01046876538be..aa42cc850e1d4 100644 --- a/apps/wallet/src/ui/app/hooks/useGetTransferAmount.ts +++ b/apps/wallet/src/ui/app/hooks/useGetTransferAmount.ts @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 import { getAmount } from '_helpers'; -import type { SuiTransactionBlockResponse } from '@mysten/sui.js/client'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import type { SuiTransactionBlockResponse } from '@mysten/sui/client'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; import { useMemo } from 'react'; export function useGetTransferAmount({ diff --git a/apps/wallet/src/ui/app/hooks/useGetTxnRecipientAddress.ts b/apps/wallet/src/ui/app/hooks/useGetTxnRecipientAddress.ts index 0809910bf2319..45f5607cc7800 100644 --- a/apps/wallet/src/ui/app/hooks/useGetTxnRecipientAddress.ts +++ b/apps/wallet/src/ui/app/hooks/useGetTxnRecipientAddress.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { getAmount } from '_helpers'; -import { type SuiTransactionBlockResponse } from '@mysten/sui.js/client'; +import { type SuiTransactionBlockResponse } from '@mysten/sui/client'; import { useMemo } from 'react'; type Props = { diff --git a/apps/wallet/src/ui/app/hooks/useMediaUrl.ts b/apps/wallet/src/ui/app/hooks/useMediaUrl.ts index dd151fc7264f2..407ea1164d609 100644 --- a/apps/wallet/src/ui/app/hooks/useMediaUrl.ts +++ b/apps/wallet/src/ui/app/hooks/useMediaUrl.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import type { SuiParsedData } from '@mysten/sui.js/client'; +import type { SuiParsedData } from '@mysten/sui/client'; import { useMemo } from 'react'; export const parseIpfsUrl = (ipfsUrl: string) => diff --git a/apps/wallet/src/ui/app/hooks/useNFTBasicData.ts b/apps/wallet/src/ui/app/hooks/useNFTBasicData.ts index 8cd78e4faa65f..67973a7548913 100644 --- a/apps/wallet/src/ui/app/hooks/useNFTBasicData.ts +++ b/apps/wallet/src/ui/app/hooks/useNFTBasicData.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import type { SuiObjectData } from '@mysten/sui.js/client'; +import type { SuiObjectData } from '@mysten/sui/client'; import useFileExtensionType from './useFileExtensionType'; import useMediaUrl from './useMediaUrl'; diff --git a/apps/wallet/src/ui/app/hooks/useQueryTransactionsByAddress.ts b/apps/wallet/src/ui/app/hooks/useQueryTransactionsByAddress.ts index 571046865a9e9..f493a18fcb61e 100644 --- a/apps/wallet/src/ui/app/hooks/useQueryTransactionsByAddress.ts +++ b/apps/wallet/src/ui/app/hooks/useQueryTransactionsByAddress.ts @@ -4,7 +4,7 @@ import { FEATURES } from '_src/shared/experimentation/features'; import { useFeatureValue } from '@growthbook/growthbook-react'; import { useSuiClient } from '@mysten/dapp-kit'; -import { type SuiTransactionBlockResponse } from '@mysten/sui.js/client'; +import { type SuiTransactionBlockResponse } from '@mysten/sui/client'; import { useQuery } from '@tanstack/react-query'; export function useQueryTransactionsByAddress(address: string | null) { diff --git a/apps/wallet/src/ui/app/hooks/useRecognizedPackages.ts b/apps/wallet/src/ui/app/hooks/useRecognizedPackages.ts index c8215015794ad..f66a38d5dcad6 100644 --- a/apps/wallet/src/ui/app/hooks/useRecognizedPackages.ts +++ b/apps/wallet/src/ui/app/hooks/useRecognizedPackages.ts @@ -3,7 +3,7 @@ import { API_ENV } from '_src/shared/api-env'; import { useFeatureValue } from '@growthbook/growthbook-react'; -import { SUI_FRAMEWORK_ADDRESS, SUI_SYSTEM_ADDRESS } from '@mysten/sui.js/utils'; +import { SUI_FRAMEWORK_ADDRESS, SUI_SYSTEM_ADDRESS } from '@mysten/sui/utils'; import useAppSelector from './useAppSelector'; diff --git a/apps/wallet/src/ui/app/hooks/useResolveVideo.ts b/apps/wallet/src/ui/app/hooks/useResolveVideo.ts index cd66425535fbf..99f01ce8be090 100644 --- a/apps/wallet/src/ui/app/hooks/useResolveVideo.ts +++ b/apps/wallet/src/ui/app/hooks/useResolveVideo.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { type SuiObjectResponse } from '@mysten/sui.js/client'; +import { type SuiObjectResponse } from '@mysten/sui/client'; import { useRecognizedPackages } from './useRecognizedPackages'; diff --git a/apps/wallet/src/ui/app/hooks/useSortedCoinsByCategories.ts b/apps/wallet/src/ui/app/hooks/useSortedCoinsByCategories.ts index ddc860dc31178..3f5c543dfb696 100644 --- a/apps/wallet/src/ui/app/hooks/useSortedCoinsByCategories.ts +++ b/apps/wallet/src/ui/app/hooks/useSortedCoinsByCategories.ts @@ -3,8 +3,8 @@ import { usePinnedCoinTypes } from '_app/hooks/usePinnedCoinTypes'; import { useRecognizedPackages } from '_app/hooks/useRecognizedPackages'; -import { type CoinBalance as CoinBalanceType } from '@mysten/sui.js/client'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { type CoinBalance as CoinBalanceType } from '@mysten/sui/client'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; import { useMemo } from 'react'; function sortCoins(balances: CoinBalanceType[]) { diff --git a/apps/wallet/src/ui/app/hooks/useTransactionData.ts b/apps/wallet/src/ui/app/hooks/useTransactionData.ts index 56d17b389d0c8..ccb3d61074311 100644 --- a/apps/wallet/src/ui/app/hooks/useTransactionData.ts +++ b/apps/wallet/src/ui/app/hooks/useTransactionData.ts @@ -3,35 +3,32 @@ import { useFormatCoin } from '@mysten/core'; import { useSuiClient } from '@mysten/dapp-kit'; -import { TransactionBlock } from '@mysten/sui.js/transactions'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { Transaction } from '@mysten/sui/transactions'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; import { useQuery } from '@tanstack/react-query'; -export function useTransactionData(sender?: string | null, transaction?: TransactionBlock | null) { +export function useTransactionData(sender?: string | null, transaction?: Transaction | null) { const client = useSuiClient(); return useQuery({ // eslint-disable-next-line @tanstack/query/exhaustive-deps queryKey: ['transaction-data', transaction?.serialize()], queryFn: async () => { - const clonedTransaction = new TransactionBlock(transaction!); + const clonedTransaction = Transaction.from(transaction!); if (sender) { clonedTransaction.setSenderIfNotSet(sender); } // Build the transaction to bytes, which will ensure that the transaction data is fully populated: await clonedTransaction!.build({ client }); - return clonedTransaction!.blockData; + return clonedTransaction!.getData(); }, enabled: !!transaction, }); } -export function useTransactionGasBudget( - sender?: string | null, - transaction?: TransactionBlock | null, -) { +export function useTransactionGasBudget(sender?: string | null, transaction?: Transaction | null) { const { data, ...rest } = useTransactionData(sender, transaction); - const [formattedGas] = useFormatCoin(data?.gasConfig.budget, SUI_TYPE_ARG); + const [formattedGas] = useFormatCoin(data?.gasData.budget, SUI_TYPE_ARG); return { data: formattedGas, diff --git a/apps/wallet/src/ui/app/hooks/useTransactionDryRun.ts b/apps/wallet/src/ui/app/hooks/useTransactionDryRun.ts index 9bcf576d1a9ac..0f75567bded2b 100644 --- a/apps/wallet/src/ui/app/hooks/useTransactionDryRun.ts +++ b/apps/wallet/src/ui/app/hooks/useTransactionDryRun.ts @@ -1,16 +1,13 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { type TransactionBlock } from '@mysten/sui.js/transactions'; +import { type Transaction } from '@mysten/sui/transactions'; import { useQuery } from '@tanstack/react-query'; import { useAccountByAddress } from './useAccountByAddress'; import { useSigner } from './useSigner'; -export function useTransactionDryRun( - sender: string | undefined, - transactionBlock: TransactionBlock, -) { +export function useTransactionDryRun(sender: string | undefined, transactionBlock: Transaction) { const { data: account } = useAccountByAddress(sender); const signer = useSigner(account || null); const response = useQuery({ diff --git a/apps/wallet/src/ui/app/index.tsx b/apps/wallet/src/ui/app/index.tsx index ef573e75488d2..2c289f192bcef 100644 --- a/apps/wallet/src/ui/app/index.tsx +++ b/apps/wallet/src/ui/app/index.tsx @@ -8,7 +8,7 @@ import { setNavVisibility } from '_redux/slices/app'; import { isLedgerAccountSerializedUI } from '_src/background/accounts/LedgerAccount'; import { persistableStorage } from '_src/shared/analytics/amplitude'; import { type LedgerAccountsPublicKeys } from '_src/shared/messaging/messages/payloads/MethodPayload'; -import { toB64 } from '@mysten/sui.js/utils'; +import { toB64 } from '@mysten/sui/utils'; import { useEffect, useMemo } from 'react'; import { Navigate, Outlet, Route, Routes, useLocation } from 'react-router-dom'; import { throttle } from 'throttle-debounce'; diff --git a/apps/wallet/src/ui/app/pages/approval-request/transaction-request/GasFees.tsx b/apps/wallet/src/ui/app/pages/approval-request/transaction-request/GasFees.tsx index 87c48268a3a79..1cc0cdfdb56b6 100644 --- a/apps/wallet/src/ui/app/pages/approval-request/transaction-request/GasFees.tsx +++ b/apps/wallet/src/ui/app/pages/approval-request/transaction-request/GasFees.tsx @@ -3,22 +3,22 @@ import { useTransactionData, useTransactionGasBudget } from '_src/ui/app/hooks'; import { GAS_SYMBOL } from '_src/ui/app/redux/slices/sui-objects/Coin'; -import { type TransactionBlock } from '@mysten/sui.js/transactions'; -import { formatAddress } from '@mysten/sui.js/utils'; +import { type Transaction } from '@mysten/sui/transactions'; +import { formatAddress } from '@mysten/sui/utils'; import { DescriptionItem, DescriptionList } from './DescriptionList'; import { SummaryCard } from './SummaryCard'; interface Props { sender?: string; - transaction: TransactionBlock; + transaction: Transaction; } export function GasFees({ sender, transaction }: Props) { const { data: transactionData } = useTransactionData(sender, transaction); const { data: gasBudget, isPending, isError } = useTransactionGasBudget(sender, transaction); const isSponsored = - transactionData?.gasConfig.owner && transactionData.sender !== transactionData.gasConfig.owner; + transactionData?.gasData.owner && transactionData.sender !== transactionData.gasData.owner; return ( - {formatAddress(transactionData!.gasConfig.owner!)} + {formatAddress(transactionData!.gasData.owner!)} )} diff --git a/apps/wallet/src/ui/app/pages/approval-request/transaction-request/TransactionDetails/Command.tsx b/apps/wallet/src/ui/app/pages/approval-request/transaction-request/TransactionDetails/Command.tsx index 251be0f0add1f..4ea1f50afa5b8 100644 --- a/apps/wallet/src/ui/app/pages/approval-request/transaction-request/TransactionDetails/Command.tsx +++ b/apps/wallet/src/ui/app/pages/approval-request/transaction-request/TransactionDetails/Command.tsx @@ -3,25 +3,25 @@ import { Text } from '_src/ui/app/shared/text'; import { ChevronDown12, ChevronRight12 } from '@mysten/icons'; -import { TypeTagSerializer, type TypeTag } from '@mysten/sui.js/bcs'; -import { type TransactionArgument, type Transactions } from '@mysten/sui.js/transactions'; -import { formatAddress, normalizeSuiAddress, toB64 } from '@mysten/sui.js/utils'; +import { type Argument, type Commands, type TransactionData } from '@mysten/sui/transactions'; +import { toB64 } from '@mysten/sui/utils'; import { useState } from 'react'; -type TransactionType = ReturnType<(typeof Transactions)[keyof typeof Transactions]>; -type MakeMoveVecTransaction = ReturnType<(typeof Transactions)['MakeMoveVec']>; -type PublishTransaction = ReturnType<(typeof Transactions)['Publish']>; +type TransactionType = TransactionData['commands'][0]; +type MakeMoveVecTransaction = ReturnType<(typeof Commands)['MakeMoveVec']>; +type PublishTransaction = ReturnType<(typeof Commands)['Publish']>; function convertCommandArgumentToString( arg: + | null | string | number | string[] | number[] - | TransactionArgument - | TransactionArgument[] - | MakeMoveVecTransaction['type'] - | PublishTransaction['modules'], + | Argument + | Argument[] + | MakeMoveVecTransaction['MakeMoveVec']['type'] + | PublishTransaction['Publish']['modules'], ): string | null { if (!arg) return null; @@ -31,14 +31,6 @@ function convertCommandArgumentToString( return null; } - if (typeof arg === 'object' && 'Some' in arg) { - if (typeof arg.Some === 'object') { - // MakeMoveVecTransaction['type'] is TypeTag type - return TypeTagSerializer.tagToString(arg.Some as TypeTag); - } - return arg.Some; - } - if (Array.isArray(arg)) { // Publish transaction special casing: if (typeof arg[0] === 'number') { @@ -48,15 +40,15 @@ function convertCommandArgumentToString( return `[${arg.map((argVal) => convertCommandArgumentToString(argVal)).join(', ')}]`; } - switch (arg.kind) { + switch (arg.$kind) { case 'GasCoin': return 'GasCoin'; case 'Input': - return `Input(${arg.index})`; + return `Input(${arg.Input})`; case 'Result': - return `Result(${arg.index})`; + return `Result(${arg.Result})`; case 'NestedResult': - return `NestedResult(${arg.index}, ${arg.resultIndex})`; + return `NestedResult(${arg.NestedResult[0]}, ${arg.NestedResult[1]})`; default: // eslint-disable-next-line no-console console.warn('Unexpected command argument type.', arg); @@ -64,20 +56,68 @@ function convertCommandArgumentToString( } } -function convertCommandToString({ kind, ...command }: TransactionType) { - const commandArguments = Object.entries(command); +function convertCommandToString(command: TransactionType) { + let normalizedCommand; + switch (command.$kind) { + case 'MoveCall': + normalizedCommand = { + kind: 'MoveCall', + ...command.MoveCall, + typeArguments: command.MoveCall.typeArguments, + }; + break; + case 'MakeMoveVec': + normalizedCommand = { + kind: 'MakeMoveVec', + type: command.MakeMoveVec.type, + elements: command.MakeMoveVec.elements, + }; + break; + case 'MergeCoins': + normalizedCommand = { + kind: 'MergeCoins', + destination: command.MergeCoins.destination, + sources: command.MergeCoins.sources, + }; + break; + case 'TransferObjects': + normalizedCommand = { + kind: 'TransferObjects', + objects: command.TransferObjects.objects, + address: command.TransferObjects.address, + }; + break; + case 'SplitCoins': + normalizedCommand = { + kind: 'SplitCoins', + coin: command.SplitCoins.coin, + amounts: command.SplitCoins.amounts, + }; + break; + case 'Publish': + normalizedCommand = { + kind: 'Publish', + modules: command.Publish.modules, + dependencies: command.Publish.dependencies, + }; + break; + case 'Upgrade': + normalizedCommand = { + kind: 'Upgrade', + modules: command.Upgrade.modules, + dependencies: command.Upgrade.dependencies, + packageId: command.Upgrade.package, + ticket: command.Upgrade.ticket, + }; + break; + case '$Intent': { + throw new Error('TransactionIntent is not supported'); + } + } + const commandArguments = Object.entries(normalizedCommand); return commandArguments .map(([key, value]) => { - if (key === 'target') { - const [packageId, moduleName, functionName] = value.split('::'); - return [ - `package: ${formatAddress(normalizeSuiAddress(packageId))}`, - `module: ${moduleName}`, - `function: ${functionName}`, - ].join(', '); - } - const stringValue = convertCommandArgumentToString(value); if (!stringValue) return null; @@ -102,7 +142,7 @@ export function Command({ command }: CommandProps) { className="flex items-center gap-2 w-full bg-transparent border-none p-0" > - {command.kind} + {command.$kind}
{expanded ? : }
diff --git a/apps/wallet/src/ui/app/pages/approval-request/transaction-request/TransactionDetails/Input.tsx b/apps/wallet/src/ui/app/pages/approval-request/transaction-request/TransactionDetails/Input.tsx index 43df87859299f..1e35d77928f0e 100644 --- a/apps/wallet/src/ui/app/pages/approval-request/transaction-request/TransactionDetails/Input.tsx +++ b/apps/wallet/src/ui/app/pages/approval-request/transaction-request/TransactionDetails/Input.tsx @@ -4,23 +4,27 @@ import ExplorerLink from '_src/ui/app/components/explorer-link'; import { ExplorerLinkType } from '_src/ui/app/components/explorer-link/ExplorerLinkType'; import { Text } from '_src/ui/app/shared/text'; -import { type TransactionBlockInput } from '@mysten/sui.js/transactions'; -import { formatAddress, toB64 } from '@mysten/sui.js/utils'; +import { type TransactionInput } from '@mysten/sui/transactions'; +import { formatAddress } from '@mysten/sui/utils'; interface InputProps { - input: TransactionBlockInput; + input: TransactionInput; } export function Input({ input }: InputProps) { - const { objectId } = input.value?.Object?.ImmOrOwned || input.value?.Object?.Shared || {}; + const { objectId } = + input?.Object?.ImmOrOwnedObject ?? + input?.Object?.SharedObject ?? + input.Object?.Receiving! ?? + {}; return (
- {'Pure' in input.value ? ( - `${toB64(new Uint8Array(input.value.Pure))}` - ) : 'Object' in input.value ? ( - + {input.Pure ? ( + `${input.Pure.bytes}` + ) : input.Object ? ( + {formatAddress(objectId)} ) : ( diff --git a/apps/wallet/src/ui/app/pages/approval-request/transaction-request/TransactionDetails/index.tsx b/apps/wallet/src/ui/app/pages/approval-request/transaction-request/TransactionDetails/index.tsx index d833ededa11b9..4511c059d1463 100644 --- a/apps/wallet/src/ui/app/pages/approval-request/transaction-request/TransactionDetails/index.tsx +++ b/apps/wallet/src/ui/app/pages/approval-request/transaction-request/TransactionDetails/index.tsx @@ -3,7 +3,7 @@ import { useTransactionData } from '_src/ui/app/hooks'; import { Tab as HeadlessTab, type TabProps } from '@headlessui/react'; -import { type TransactionBlock } from '@mysten/sui.js/transactions'; +import { type Transaction } from '@mysten/sui/transactions'; import { SummaryCard } from '../SummaryCard'; import { Command } from './Command'; @@ -11,7 +11,7 @@ import { Input } from './Input'; interface Props { sender?: string; - transaction: TransactionBlock; + transaction: Transaction; } const Tab = (props: TabProps<'div'>) => ( @@ -23,7 +23,7 @@ const Tab = (props: TabProps<'div'>) => ( export function TransactionDetails({ sender, transaction }: Props) { const { data: transactionData, isPending, isError } = useTransactionData(sender, transaction); - if (transactionData?.transactions.length === 0 && transactionData.inputs.length === 0) { + if (transactionData?.commands.length === 0 && transactionData.inputs.length === 0) { return null; } return ( @@ -36,14 +36,14 @@ export function TransactionDetails({ sender, transaction }: Props) {
- {!!transactionData.transactions.length && Transactions} + {!!transactionData.commands.length && Commands} {!!transactionData.inputs.length && Inputs} - {!!transactionData.transactions.length && ( + {!!transactionData.commands.length && ( {/* TODO: Rename components: */} - {transactionData.transactions.map((command, index) => ( + {transactionData.commands.map((command, index) => ( ))} diff --git a/apps/wallet/src/ui/app/pages/approval-request/transaction-request/index.tsx b/apps/wallet/src/ui/app/pages/approval-request/transaction-request/index.tsx index 03c01a14da4d2..dfef80b7ae59c 100644 --- a/apps/wallet/src/ui/app/pages/approval-request/transaction-request/index.tsx +++ b/apps/wallet/src/ui/app/pages/approval-request/transaction-request/index.tsx @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -// import { Transaction } from '@mysten/sui.js'; +// import { Transaction } from '@mysten/sui'; import { UserApproveContainer } from '_components/user-approve-container'; import { useAppDispatch, useTransactionData, useTransactionDryRun } from '_hooks'; import { type TransactionApprovalRequest } from '_payloads/transactions/ApprovalRequest'; @@ -14,7 +14,7 @@ import { useSigner } from '_src/ui/app/hooks/useSigner'; import { PageMainLayoutTitle } from '_src/ui/app/shared/page-main-layout/PageMainLayoutTitle'; import { TransactionSummary } from '_src/ui/app/shared/transaction-summary'; import { useTransactionSummary } from '@mysten/core'; -import { TransactionBlock } from '@mysten/sui.js/transactions'; +import { Transaction } from '@mysten/sui/transactions'; import { useMemo, useState } from 'react'; import { ConfirmationModal } from '../../../shared/ConfirmationModal'; @@ -37,7 +37,7 @@ export function TransactionRequest({ txRequest }: TransactionRequestProps) { const signer = useSigner(accountForTransaction); const dispatch = useAppDispatch(); const transaction = useMemo(() => { - const tx = TransactionBlock.from(txRequest.tx.data); + const tx = Transaction.from(txRequest.tx.data); if (addressForTransaction) { tx.setSenderIfNotSet(addressForTransaction); } diff --git a/apps/wallet/src/ui/app/pages/approval-request/transaction-request/utils/normalize.ts b/apps/wallet/src/ui/app/pages/approval-request/transaction-request/utils/normalize.ts index 0430e896e80d3..589b35ce40cdd 100644 --- a/apps/wallet/src/ui/app/pages/approval-request/transaction-request/utils/normalize.ts +++ b/apps/wallet/src/ui/app/pages/approval-request/transaction-request/utils/normalize.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { type SuiMoveNormalizedType } from '@mysten/sui.js/client'; +import { type SuiMoveNormalizedType } from '@mysten/sui/client'; export interface TypeReference { address: string; diff --git a/apps/wallet/src/ui/app/pages/home/kiosk-details/index.tsx b/apps/wallet/src/ui/app/pages/home/kiosk-details/index.tsx index 517acce8d01ea..58bfa561c1a85 100644 --- a/apps/wallet/src/ui/app/pages/home/kiosk-details/index.tsx +++ b/apps/wallet/src/ui/app/pages/home/kiosk-details/index.tsx @@ -13,7 +13,7 @@ import { useUnlockedGuard } from '_src/ui/app/hooks/useUnlockedGuard'; import { Collapsible } from '_src/ui/app/shared/collapse'; import PageTitle from '_src/ui/app/shared/PageTitle'; import { useGetKioskContents } from '@mysten/core'; -import { formatAddress } from '@mysten/sui.js/utils'; +import { formatAddress } from '@mysten/sui/utils'; import { Link, useSearchParams } from 'react-router-dom'; function KioskDetailsPage() { diff --git a/apps/wallet/src/ui/app/pages/home/nft-details/index.tsx b/apps/wallet/src/ui/app/pages/home/nft-details/index.tsx index 4a713869d53f8..04fe0b8dd3551 100644 --- a/apps/wallet/src/ui/app/pages/home/nft-details/index.tsx +++ b/apps/wallet/src/ui/app/pages/home/nft-details/index.tsx @@ -19,7 +19,7 @@ import PageTitle from '_src/ui/app/shared/PageTitle'; import { Text } from '_src/ui/app/shared/text'; import { useGetKioskContents } from '@mysten/core'; import { ArrowRight16, ArrowUpRight12 } from '@mysten/icons'; -import { formatAddress } from '@mysten/sui.js/utils'; +import { formatAddress } from '@mysten/sui/utils'; import cl from 'clsx'; import { Navigate, useNavigate, useSearchParams } from 'react-router-dom'; diff --git a/apps/wallet/src/ui/app/pages/home/nft-transfer/TransferNFTForm.tsx b/apps/wallet/src/ui/app/pages/home/nft-transfer/TransferNFTForm.tsx index ac4f800fef8af..769a72c211c67 100644 --- a/apps/wallet/src/ui/app/pages/home/nft-transfer/TransferNFTForm.tsx +++ b/apps/wallet/src/ui/app/pages/home/nft-transfer/TransferNFTForm.tsx @@ -15,7 +15,7 @@ import { QredoActionIgnoredByUser } from '_src/ui/app/QredoSigner'; import { isSuiNSName, useGetKioskContents, useSuiNSEnabled } from '@mysten/core'; import { useSuiClient } from '@mysten/dapp-kit'; import { ArrowRight16 } from '@mysten/icons'; -import { TransactionBlock } from '@mysten/sui.js/transactions'; +import { Transaction } from '@mysten/sui/transactions'; import { useMutation, useQueryClient } from '@tanstack/react-query'; import { Field, Form, Formik } from 'formik'; import { toast } from 'react-hot-toast'; @@ -64,7 +64,7 @@ export function TransferNFTForm({ return transferKioskItem.mutateAsync({ to, clientIdentifier }); } - const tx = new TransactionBlock(); + const tx = new Transaction(); tx.transferObjects([tx.object(objectId)], to); return signer.signAndExecuteTransactionBlock( diff --git a/apps/wallet/src/ui/app/pages/home/nft-transfer/useTransferKioskItem.ts b/apps/wallet/src/ui/app/pages/home/nft-transfer/useTransferKioskItem.ts index 7073487ccc437..ea2c046c0d677 100644 --- a/apps/wallet/src/ui/app/pages/home/nft-transfer/useTransferKioskItem.ts +++ b/apps/wallet/src/ui/app/pages/home/nft-transfer/useTransferKioskItem.ts @@ -14,7 +14,7 @@ import { import { useKioskClient } from '@mysten/core/src/hooks/useKioskClient'; import { useSuiClient } from '@mysten/dapp-kit'; import { KioskTransaction } from '@mysten/kiosk'; -import { TransactionBlock } from '@mysten/sui.js/transactions'; +import { Transaction } from '@mysten/sui/transactions'; import { useMutation } from '@tanstack/react-query'; const ORIGINBYTE_PACKAGE_ID = '0x083b02db943238dcea0ff0938a54a17d7575f5b48034506446e501e963391480'; @@ -49,9 +49,9 @@ export function useTransferKioskItem({ } if (kiosk.type === KioskTypes.SUI && objectData?.data?.data?.type && kiosk?.ownerCap) { - const txb = new TransactionBlock(); + const txb = new Transaction(); - new KioskTransaction({ transactionBlock: txb, kioskClient, cap: kiosk.ownerCap }) + new KioskTransaction({ transaction: txb, kioskClient, cap: kiosk.ownerCap }) .transfer({ itemType: objectData.data.data.type as string, itemId: objectId, @@ -73,7 +73,7 @@ export function useTransferKioskItem({ } if (kiosk.type === KioskTypes.ORIGINBYTE && objectData?.data?.data?.type) { - const tx = new TransactionBlock(); + const tx = new Transaction(); const recipientKiosks = await client.getOwnedObjects({ owner: to, options: { showContent: true }, @@ -86,13 +86,13 @@ export function useTransferKioskItem({ tx.moveCall({ target: `${obPackageId}::ob_kiosk::p2p_transfer`, typeArguments: [objectType], - arguments: [tx.object(kioskId), tx.object(recipientKioskId), tx.pure(objectId)], + arguments: [tx.object(kioskId), tx.object(recipientKioskId), tx.pure.id(objectId)], }); } else { tx.moveCall({ target: `${obPackageId}::ob_kiosk::p2p_transfer_and_create_target_kiosk`, typeArguments: [objectType], - arguments: [tx.object(kioskId), tx.pure(to), tx.pure(objectId)], + arguments: [tx.object(kioskId), tx.pure.address(to), tx.pure.id(objectId)], }); } return signer.signAndExecuteTransactionBlock( diff --git a/apps/wallet/src/ui/app/pages/home/nft-transfer/validation.ts b/apps/wallet/src/ui/app/pages/home/nft-transfer/validation.ts index 91d3b47eff25e..24fcf27f75afb 100644 --- a/apps/wallet/src/ui/app/pages/home/nft-transfer/validation.ts +++ b/apps/wallet/src/ui/app/pages/home/nft-transfer/validation.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { createSuiAddressValidation } from '_components/address-input/validation'; -import { type SuiClient } from '@mysten/sui.js/client'; +import { type SuiClient } from '@mysten/sui/client'; import * as Yup from 'yup'; export function createValidationSchema( diff --git a/apps/wallet/src/ui/app/pages/home/nfts/NonVisualAssets.tsx b/apps/wallet/src/ui/app/pages/home/nfts/NonVisualAssets.tsx index 801ad9a1089c4..f61d15c475ece 100644 --- a/apps/wallet/src/ui/app/pages/home/nfts/NonVisualAssets.tsx +++ b/apps/wallet/src/ui/app/pages/home/nfts/NonVisualAssets.tsx @@ -4,8 +4,8 @@ import ExplorerLink from '_src/ui/app/components/explorer-link'; import { ExplorerLinkType } from '_src/ui/app/components/explorer-link/ExplorerLinkType'; import { Text } from '_src/ui/app/shared/text'; -import { type SuiObjectData } from '@mysten/sui.js/client'; -import { formatAddress, parseStructTag } from '@mysten/sui.js/utils'; +import { type SuiObjectData } from '@mysten/sui/client'; +import { formatAddress, parseStructTag } from '@mysten/sui/utils'; export default function NonVisualAssets({ items }: { items: SuiObjectData[] }) { return ( diff --git a/apps/wallet/src/ui/app/pages/home/nfts/VisualAssets.tsx b/apps/wallet/src/ui/app/pages/home/nfts/VisualAssets.tsx index 1e092b5877d91..004cc88e6422c 100644 --- a/apps/wallet/src/ui/app/pages/home/nfts/VisualAssets.tsx +++ b/apps/wallet/src/ui/app/pages/home/nfts/VisualAssets.tsx @@ -9,7 +9,7 @@ import { Button } from '_src/ui/app/shared/ButtonUI'; import { getKioskIdFromOwnerCap, isKioskOwnerToken } from '@mysten/core'; import { useKioskClient } from '@mysten/core/src/hooks/useKioskClient'; import { EyeClose16 } from '@mysten/icons'; -import { type SuiObjectData } from '@mysten/sui.js/client'; +import { type SuiObjectData } from '@mysten/sui/client'; import { Link } from 'react-router-dom'; import { useHiddenAssets } from '../hidden-assets/HiddenAssetsProvider'; diff --git a/apps/wallet/src/ui/app/pages/home/receipt/index.tsx b/apps/wallet/src/ui/app/pages/home/receipt/index.tsx index 054cac0051eaf..1355252e3f404 100644 --- a/apps/wallet/src/ui/app/pages/home/receipt/index.tsx +++ b/apps/wallet/src/ui/app/pages/home/receipt/index.tsx @@ -9,7 +9,7 @@ import { useActiveAddress } from '_src/ui/app/hooks/useActiveAddress'; import { useUnlockedGuard } from '_src/ui/app/hooks/useUnlockedGuard'; import { useSuiClient } from '@mysten/dapp-kit'; import { Check32 } from '@mysten/icons'; -import { type SuiTransactionBlockResponse } from '@mysten/sui.js/client'; +import { type SuiTransactionBlockResponse } from '@mysten/sui/client'; import { useQuery } from '@tanstack/react-query'; import { useCallback, useMemo, useState } from 'react'; import { Navigate, useLocation, useNavigate, useSearchParams } from 'react-router-dom'; diff --git a/apps/wallet/src/ui/app/pages/home/tokens/TokenIconLink.tsx b/apps/wallet/src/ui/app/pages/home/tokens/TokenIconLink.tsx index ddceeccb8e761..5195507018769 100644 --- a/apps/wallet/src/ui/app/pages/home/tokens/TokenIconLink.tsx +++ b/apps/wallet/src/ui/app/pages/home/tokens/TokenIconLink.tsx @@ -10,7 +10,7 @@ import { import { Text } from '_src/ui/app/shared/text'; import { useFormatCoin, useGetDelegatedStake } from '@mysten/core'; import { WalletActionStake24 } from '@mysten/icons'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; import { useMemo } from 'react'; export function TokenIconLink({ diff --git a/apps/wallet/src/ui/app/pages/home/tokens/TokenLink.tsx b/apps/wallet/src/ui/app/pages/home/tokens/TokenLink.tsx index ee4c50374497a..9e6bf99805d57 100644 --- a/apps/wallet/src/ui/app/pages/home/tokens/TokenLink.tsx +++ b/apps/wallet/src/ui/app/pages/home/tokens/TokenLink.tsx @@ -3,8 +3,8 @@ import { CoinItem } from '_components/active-coins-card/CoinItem'; import { ampli } from '_src/shared/analytics/ampli'; -import { type CoinBalance } from '@mysten/sui.js/client'; -import { MIST_PER_SUI } from '@mysten/sui.js/utils'; +import { type CoinBalance } from '@mysten/sui/client'; +import { MIST_PER_SUI } from '@mysten/sui/utils'; import { type ReactNode } from 'react'; import { Link } from 'react-router-dom'; diff --git a/apps/wallet/src/ui/app/pages/home/tokens/TokensDetails.tsx b/apps/wallet/src/ui/app/pages/home/tokens/TokensDetails.tsx index c57c4f41bdc0b..03f749e12463d 100644 --- a/apps/wallet/src/ui/app/pages/home/tokens/TokensDetails.tsx +++ b/apps/wallet/src/ui/app/pages/home/tokens/TokensDetails.tsx @@ -40,8 +40,8 @@ import { } from '@mysten/core'; import { useSuiClientQuery } from '@mysten/dapp-kit'; import { Info12, Pin16, Unpin16 } from '@mysten/icons'; -import { type CoinBalance as CoinBalanceType } from '@mysten/sui.js/client'; -import { formatAddress, parseStructTag, SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { type CoinBalance as CoinBalanceType } from '@mysten/sui/client'; +import { formatAddress, parseStructTag, SUI_TYPE_ARG } from '@mysten/sui/utils'; import { useQuery } from '@tanstack/react-query'; import clsx from 'clsx'; import { useEffect, useState, type ReactNode } from 'react'; diff --git a/apps/wallet/src/ui/app/pages/home/tokens/coin-balance/index.tsx b/apps/wallet/src/ui/app/pages/home/tokens/coin-balance/index.tsx index f3703d3f76eed..84086917249f5 100644 --- a/apps/wallet/src/ui/app/pages/home/tokens/coin-balance/index.tsx +++ b/apps/wallet/src/ui/app/pages/home/tokens/coin-balance/index.tsx @@ -6,7 +6,7 @@ import { API_ENV } from '_shared/api-env'; import { Heading } from '_src/ui/app/shared/heading'; import { Text } from '_src/ui/app/shared/text'; import { useBalanceInUSD, useFormatCoin } from '@mysten/core'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; import { useMemo } from 'react'; export type CoinProps = { diff --git a/apps/wallet/src/ui/app/pages/home/transactions/QredoTransaction.tsx b/apps/wallet/src/ui/app/pages/home/transactions/QredoTransaction.tsx index 9c289827c557a..148498a8dbcb6 100644 --- a/apps/wallet/src/ui/app/pages/home/transactions/QredoTransaction.tsx +++ b/apps/wallet/src/ui/app/pages/home/transactions/QredoTransaction.tsx @@ -7,8 +7,8 @@ import { TxnIcon } from '_src/ui/app/components/transactions-card/TxnIcon'; import { useGetQredoTransaction } from '_src/ui/app/hooks/useGetQredoTransaction'; import { Text } from '_src/ui/app/shared/text'; import { formatDate, useOnScreen } from '@mysten/core'; -import { IntentScope } from '@mysten/sui.js/cryptography'; -import { fromB64 } from '@mysten/sui.js/utils'; +import { bcs } from '@mysten/sui/bcs'; +import { fromB64 } from '@mysten/sui/utils'; import { useMemo, useRef } from 'react'; export type QredoTransactionProps = { @@ -30,8 +30,11 @@ export function QredoTransaction({ qredoID, qredoTransactionID }: QredoTransacti } return null; }, [data?.MessageWithIntent]); - const scope = messageWithIntent?.[0]; - const isSignMessage = scope === IntentScope.PersonalMessage; + + const isSignMessage = messageWithIntent + ? bcs.IntentScope.parse(messageWithIntent).PersonalMessage + : false; + const transactionBytes = useMemo(() => messageWithIntent?.slice(3) || null, [messageWithIntent]); const messageToSign = useMemo( diff --git a/apps/wallet/src/ui/app/pages/home/transfer-coin/CoinSelector.tsx b/apps/wallet/src/ui/app/pages/home/transfer-coin/CoinSelector.tsx index ec2cabe2dc3c3..a3ab73764b3a8 100644 --- a/apps/wallet/src/ui/app/pages/home/transfer-coin/CoinSelector.tsx +++ b/apps/wallet/src/ui/app/pages/home/transfer-coin/CoinSelector.tsx @@ -4,7 +4,7 @@ import { ActiveCoinsCard } from '_components/active-coins-card'; import Overlay from '_components/overlay'; import { useUnlockedGuard } from '_src/ui/app/hooks/useUnlockedGuard'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; import { useNavigate, useSearchParams } from 'react-router-dom'; function CoinsSelectorPage() { diff --git a/apps/wallet/src/ui/app/pages/home/transfer-coin/SendTokenForm.tsx b/apps/wallet/src/ui/app/pages/home/transfer-coin/SendTokenForm.tsx index f9dac7b138de4..1bda434c96b3a 100644 --- a/apps/wallet/src/ui/app/pages/home/transfer-coin/SendTokenForm.tsx +++ b/apps/wallet/src/ui/app/pages/home/transfer-coin/SendTokenForm.tsx @@ -21,8 +21,8 @@ import { } from '@mysten/core'; import { useSuiClient } from '@mysten/dapp-kit'; import { ArrowRight16 } from '@mysten/icons'; -import { type CoinStruct } from '@mysten/sui.js/client'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { type CoinStruct } from '@mysten/sui/client'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; import { useQuery } from '@tanstack/react-query'; import { Field, Form, Formik, useFormikContext } from 'formik'; import { useEffect, useMemo } from 'react'; diff --git a/apps/wallet/src/ui/app/pages/home/transfer-coin/utils/transaction.ts b/apps/wallet/src/ui/app/pages/home/transfer-coin/utils/transaction.ts index 6d4dcaa8ab7a8..2a593b63ed836 100644 --- a/apps/wallet/src/ui/app/pages/home/transfer-coin/utils/transaction.ts +++ b/apps/wallet/src/ui/app/pages/home/transfer-coin/utils/transaction.ts @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 import { parseAmount } from '_src/ui/app/helpers'; -import { type CoinStruct } from '@mysten/sui.js/client'; -import { TransactionBlock } from '@mysten/sui.js/transactions'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { type CoinStruct } from '@mysten/sui/client'; +import { Transaction } from '@mysten/sui/transactions'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; interface Options { coinType: string; @@ -23,7 +23,7 @@ export function createTokenTransferTransaction({ coinDecimals, isPayAllSui, }: Options) { - const tx = new TransactionBlock(); + const tx = new Transaction(); if (isPayAllSui && coinType === SUI_TYPE_ARG) { tx.transferObjects([tx.gas], to); diff --git a/apps/wallet/src/ui/app/pages/home/transfer-coin/validation.ts b/apps/wallet/src/ui/app/pages/home/transfer-coin/validation.ts index da4dc437abfa4..3686d5f76d6f5 100644 --- a/apps/wallet/src/ui/app/pages/home/transfer-coin/validation.ts +++ b/apps/wallet/src/ui/app/pages/home/transfer-coin/validation.ts @@ -3,7 +3,7 @@ import { createSuiAddressValidation } from '_components/address-input/validation'; import { createTokenValidation } from '_src/shared/validation'; -import { type SuiClient } from '@mysten/sui.js/client'; +import { type SuiClient } from '@mysten/sui/client'; import * as Yup from 'yup'; export function createValidationSchemaStepOne( diff --git a/apps/wallet/src/ui/app/pages/qredo-connect/components/QredoAccountItem.tsx b/apps/wallet/src/ui/app/pages/qredo-connect/components/QredoAccountItem.tsx index ed81d17ffe129..adcb7b814f001 100644 --- a/apps/wallet/src/ui/app/pages/qredo-connect/components/QredoAccountItem.tsx +++ b/apps/wallet/src/ui/app/pages/qredo-connect/components/QredoAccountItem.tsx @@ -5,7 +5,7 @@ import { type Wallet } from '_src/shared/qredo-api'; import { BadgeLabel } from '_src/ui/app/components/BadgeLabel'; import { Text } from '_src/ui/app/shared/text'; import { CheckFill16 } from '@mysten/icons'; -import { formatAddress } from '@mysten/sui.js/utils'; +import { formatAddress } from '@mysten/sui/utils'; import cn from 'clsx'; export type QredoAccountItemProps = Wallet & { diff --git a/apps/wallet/src/ui/app/pages/swap/GasFeeSection.tsx b/apps/wallet/src/ui/app/pages/swap/GasFeeSection.tsx index 26d499fc842c1..c6052c6925b77 100644 --- a/apps/wallet/src/ui/app/pages/swap/GasFeeSection.tsx +++ b/apps/wallet/src/ui/app/pages/swap/GasFeeSection.tsx @@ -8,7 +8,7 @@ import { GAS_TYPE_ARG } from '_redux/slices/sui-objects/Coin'; import { FEATURES } from '_shared/experimentation/features'; import { useFeatureValue } from '@growthbook/growthbook-react'; import { useBalanceInUSD, useFormatCoin } from '@mysten/core'; -import { type BalanceChange } from '@mysten/sui.js/client'; +import { type BalanceChange } from '@mysten/sui/client'; export function GasFeeSection({ activeCoinType, diff --git a/apps/wallet/src/ui/app/pages/swap/ToAssetSection.tsx b/apps/wallet/src/ui/app/pages/swap/ToAssetSection.tsx index a4e063bfff016..c35b3d67bbf50 100644 --- a/apps/wallet/src/ui/app/pages/swap/ToAssetSection.tsx +++ b/apps/wallet/src/ui/app/pages/swap/ToAssetSection.tsx @@ -16,8 +16,8 @@ import { MaxSlippage, MaxSlippageModal } from '_pages/swap/MaxSlippage'; import { ToAssets } from '_pages/swap/ToAssets'; import { getUSDCurrency, useSwapData } from '_pages/swap/utils'; import { useDeepBookContext } from '_shared/deepBook/context'; -import { type BalanceChange } from '@mysten/sui.js/client'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { type BalanceChange } from '@mysten/sui/client'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; import BigNumber from 'bignumber.js'; import clsx from 'clsx'; import { useEffect, useState } from 'react'; diff --git a/apps/wallet/src/ui/app/pages/swap/index.tsx b/apps/wallet/src/ui/app/pages/swap/index.tsx index f6eb0e4ff28db..f33c3d26a8e80 100644 --- a/apps/wallet/src/ui/app/pages/swap/index.tsx +++ b/apps/wallet/src/ui/app/pages/swap/index.tsx @@ -40,8 +40,8 @@ import { DeepBookContextProvider, useDeepBookContext } from '_shared/deepBook/co import { useTransactionSummary, useZodForm } from '@mysten/core'; import { useSuiClientQuery } from '@mysten/dapp-kit'; import { ArrowDown12, ArrowRight16 } from '@mysten/icons'; -import { type DryRunTransactionBlockResponse } from '@mysten/sui.js/client'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { type DryRunTransactionBlockResponse } from '@mysten/sui/client'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; import { useMutation, useQueryClient } from '@tanstack/react-query'; import BigNumber from 'bignumber.js'; import clsx from 'clsx'; diff --git a/apps/wallet/src/ui/app/pages/swap/utils.ts b/apps/wallet/src/ui/app/pages/swap/utils.ts index 33d28bd227d0d..571817989fcfe 100644 --- a/apps/wallet/src/ui/app/pages/swap/utils.ts +++ b/apps/wallet/src/ui/app/pages/swap/utils.ts @@ -5,7 +5,7 @@ import { useCoinsReFetchingConfig } from '_hooks'; import { roundFloat, useFormatCoin } from '@mysten/core'; import { useSuiClientQuery } from '@mysten/dapp-kit'; import { type DeepBookClient } from '@mysten/deepbook'; -import { type BalanceChange } from '@mysten/sui.js/client'; +import { type BalanceChange } from '@mysten/sui/client'; import BigNumber from 'bignumber.js'; export function useSwapData({ diff --git a/apps/wallet/src/ui/app/redux/slices/sui-objects/Coin.ts b/apps/wallet/src/ui/app/redux/slices/sui-objects/Coin.ts index bd8437761387e..a84da3a45428b 100644 --- a/apps/wallet/src/ui/app/redux/slices/sui-objects/Coin.ts +++ b/apps/wallet/src/ui/app/redux/slices/sui-objects/Coin.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import type { SuiMoveObject, SuiObjectData } from '@mysten/sui.js/client'; +import type { SuiMoveObject, SuiObjectData } from '@mysten/sui/client'; const COIN_TYPE = '0x2::coin::Coin'; const COIN_TYPE_ARG_REGEX = /^0x2::coin::Coin<(.+)>$/; diff --git a/apps/wallet/src/ui/app/redux/slices/transaction-requests/index.ts b/apps/wallet/src/ui/app/redux/slices/transaction-requests/index.ts index 88d60baf97634..082ba7a8e6ab7 100644 --- a/apps/wallet/src/ui/app/redux/slices/transaction-requests/index.ts +++ b/apps/wallet/src/ui/app/redux/slices/transaction-requests/index.ts @@ -10,9 +10,9 @@ import { type WalletSigner, } from '_src/ui/app/WalletSigner'; import type { AppThunkConfig } from '_store/thunk-extras'; -import { type SuiTransactionBlockResponse } from '@mysten/sui.js/client'; -import { TransactionBlock } from '@mysten/sui.js/transactions'; -import { fromB64 } from '@mysten/sui.js/utils'; +import { type SuiTransactionBlockResponse } from '@mysten/sui/client'; +import { Transaction } from '@mysten/sui/transactions'; +import { fromB64 } from '@mysten/sui/utils'; import { createAsyncThunk, createEntityAdapter, createSlice } from '@reduxjs/toolkit'; import type { PayloadAction } from '@reduxjs/toolkit'; @@ -61,7 +61,7 @@ export const respondToTransactionRequest = createAsyncThunk< clientIdentifier, ); } else if (txRequest.tx.type === 'transaction') { - const tx = TransactionBlock.from(txRequest.tx.data); + const tx = Transaction.from(txRequest.tx.data); if (txRequest.tx.justSign) { // Just a signing request, do not submit txSigned = await signer.signTransactionBlock( diff --git a/apps/wallet/src/ui/app/shared/coin-balance/index.tsx b/apps/wallet/src/ui/app/shared/coin-balance/index.tsx index 3bb66b4de7866..97f74b2fa2af0 100644 --- a/apps/wallet/src/ui/app/shared/coin-balance/index.tsx +++ b/apps/wallet/src/ui/app/shared/coin-balance/index.tsx @@ -3,7 +3,7 @@ import { Text } from '_app/shared/text'; import { useFormatCoin } from '@mysten/core'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; //TODO create variant for different use cases like heading4, subtitle, bodySmall and different symbols color interface CoinBalanceProps { diff --git a/apps/wallet/src/ui/app/shared/faucet/FaucetRequestButton.tsx b/apps/wallet/src/ui/app/shared/faucet/FaucetRequestButton.tsx index b741fffbb08ca..b4fc0bd3c041a 100644 --- a/apps/wallet/src/ui/app/shared/faucet/FaucetRequestButton.tsx +++ b/apps/wallet/src/ui/app/shared/faucet/FaucetRequestButton.tsx @@ -5,7 +5,7 @@ import { API_ENV_TO_INFO } from '_app/ApiProvider'; import { Button, type ButtonProps } from '_app/shared/ButtonUI'; import { useAppSelector } from '_hooks'; import { API_ENV } from '_src/shared/api-env'; -import { FaucetRateLimitError, getFaucetHost } from '@mysten/sui.js/faucet'; +import { FaucetRateLimitError, getFaucetHost } from '@mysten/sui/faucet'; import { toast } from 'react-hot-toast'; import FaucetMessageInfo from './FaucetMessageInfo'; diff --git a/apps/wallet/src/ui/app/shared/faucet/useFaucetMutation.ts b/apps/wallet/src/ui/app/shared/faucet/useFaucetMutation.ts index d2bd5b7575319..dda33111ede27 100644 --- a/apps/wallet/src/ui/app/shared/faucet/useFaucetMutation.ts +++ b/apps/wallet/src/ui/app/shared/faucet/useFaucetMutation.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { getFaucetRequestStatus, requestSuiFromFaucetV1 } from '@mysten/sui.js/faucet'; +import { getFaucetRequestStatus, requestSuiFromFaucetV1 } from '@mysten/sui/faucet'; import { useIsMutating, useMutation, type UseMutationOptions } from '@tanstack/react-query'; import { useActiveAccount } from '../../hooks/useActiveAccount'; diff --git a/apps/wallet/src/ui/app/shared/transaction-summary/OwnerFooter.tsx b/apps/wallet/src/ui/app/shared/transaction-summary/OwnerFooter.tsx index 0c0b3814ca66a..f8248f1f9e878 100644 --- a/apps/wallet/src/ui/app/shared/transaction-summary/OwnerFooter.tsx +++ b/apps/wallet/src/ui/app/shared/transaction-summary/OwnerFooter.tsx @@ -4,7 +4,7 @@ import ExplorerLink from '_src/ui/app/components/explorer-link'; import { ExplorerLinkType } from '_src/ui/app/components/explorer-link/ExplorerLinkType'; import { useActiveAddress } from '_src/ui/app/hooks'; -import { formatAddress, isValidSuiAddress } from '@mysten/sui.js/utils'; +import { formatAddress, isValidSuiAddress } from '@mysten/sui/utils'; import { Text } from '../text'; import { SummaryCardFooter } from './Card'; diff --git a/apps/wallet/src/ui/app/shared/transaction-summary/cards/GasSummary.tsx b/apps/wallet/src/ui/app/shared/transaction-summary/cards/GasSummary.tsx index 85e7657cfbab8..976d9410976aa 100644 --- a/apps/wallet/src/ui/app/shared/transaction-summary/cards/GasSummary.tsx +++ b/apps/wallet/src/ui/app/shared/transaction-summary/cards/GasSummary.tsx @@ -5,7 +5,7 @@ import { ExplorerLinkType } from '_src/ui/app/components/explorer-link/ExplorerL import { useActiveAddress } from '_src/ui/app/hooks'; import { GAS_TYPE_ARG } from '_src/ui/app/redux/slices/sui-objects/Coin'; import { useFormatCoin, type GasSummaryType } from '@mysten/core'; -import { formatAddress } from '@mysten/sui.js/utils'; +import { formatAddress } from '@mysten/sui/utils'; import { Text } from '../../text'; diff --git a/apps/wallet/src/ui/app/shared/transaction-summary/cards/ObjectChanges.tsx b/apps/wallet/src/ui/app/shared/transaction-summary/cards/ObjectChanges.tsx index e71be6b7bc37f..4c64b5c94087e 100644 --- a/apps/wallet/src/ui/app/shared/transaction-summary/cards/ObjectChanges.tsx +++ b/apps/wallet/src/ui/app/shared/transaction-summary/cards/ObjectChanges.tsx @@ -12,7 +12,7 @@ import { type SuiObjectChangeWithDisplay, } from '@mysten/core'; import { ChevronDown12, ChevronRight12 } from '@mysten/icons'; -import { formatAddress } from '@mysten/sui.js/utils'; +import { formatAddress } from '@mysten/sui/utils'; import cx from 'clsx'; import { ExpandableList } from '../../ExpandableList'; diff --git a/apps/wallet/src/ui/app/shared/transaction-summary/cards/objectSummary/ObjectChangeDisplay.tsx b/apps/wallet/src/ui/app/shared/transaction-summary/cards/objectSummary/ObjectChangeDisplay.tsx index b28657b6db6a2..d15b95d8fd4b5 100644 --- a/apps/wallet/src/ui/app/shared/transaction-summary/cards/objectSummary/ObjectChangeDisplay.tsx +++ b/apps/wallet/src/ui/app/shared/transaction-summary/cards/objectSummary/ObjectChangeDisplay.tsx @@ -5,7 +5,7 @@ import ExplorerLink from '_src/ui/app/components/explorer-link'; import { ExplorerLinkType } from '_src/ui/app/components/explorer-link/ExplorerLinkType'; import { NftImage } from '_src/ui/app/components/nft-display/NftImage'; import { type SuiObjectChangeWithDisplay } from '@mysten/core'; -import { formatAddress } from '@mysten/sui.js/utils'; +import { formatAddress } from '@mysten/sui/utils'; import { Text } from '../../../text'; diff --git a/apps/wallet/src/ui/app/staking/delegation-detail/DelegationDetailCard.tsx b/apps/wallet/src/ui/app/staking/delegation-detail/DelegationDetailCard.tsx index 00622b79630af..82f0b1f695698 100644 --- a/apps/wallet/src/ui/app/staking/delegation-detail/DelegationDetailCard.tsx +++ b/apps/wallet/src/ui/app/staking/delegation-detail/DelegationDetailCard.tsx @@ -21,8 +21,8 @@ import FaucetRequestButton from '_src/ui/app/shared/faucet/FaucetRequestButton'; import { useCoinMetadata, useGetDelegatedStake, useGetValidatorsApy } from '@mysten/core'; import { useSuiClientQuery } from '@mysten/dapp-kit'; import { ArrowLeft16, StakeAdd16, StakeRemove16 } from '@mysten/icons'; -import type { StakeObject } from '@mysten/sui.js/client'; -import { MIST_PER_SUI, SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import type { StakeObject } from '@mysten/sui/client'; +import { MIST_PER_SUI, SUI_TYPE_ARG } from '@mysten/sui/utils'; import BigNumber from 'bignumber.js'; import { useMemo } from 'react'; diff --git a/apps/wallet/src/ui/app/staking/getAllStakeSui.ts b/apps/wallet/src/ui/app/staking/getAllStakeSui.ts index 1c7db94dbb87c..ddbffaf7b9180 100644 --- a/apps/wallet/src/ui/app/staking/getAllStakeSui.ts +++ b/apps/wallet/src/ui/app/staking/getAllStakeSui.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { type DelegatedStake } from '@mysten/sui.js/client'; +import { type DelegatedStake } from '@mysten/sui/client'; // Get staked Sui export const getAllStakeSui = (allDelegation: DelegatedStake[]) => { diff --git a/apps/wallet/src/ui/app/staking/getDelegationByStakeId.ts b/apps/wallet/src/ui/app/staking/getDelegationByStakeId.ts index 0083fa6771e11..4407255f59afd 100644 --- a/apps/wallet/src/ui/app/staking/getDelegationByStakeId.ts +++ b/apps/wallet/src/ui/app/staking/getDelegationByStakeId.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import type { DelegatedStake } from '@mysten/sui.js/client'; +import type { DelegatedStake } from '@mysten/sui/client'; // Helper function to get the delegation by stakedSuiId export const getDelegationDataByStakeId = ( diff --git a/apps/wallet/src/ui/app/staking/getStakeSuiBySuiId.ts b/apps/wallet/src/ui/app/staking/getStakeSuiBySuiId.ts index dd655c6ca3f84..859c1a70012f4 100644 --- a/apps/wallet/src/ui/app/staking/getStakeSuiBySuiId.ts +++ b/apps/wallet/src/ui/app/staking/getStakeSuiBySuiId.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { type DelegatedStake } from '@mysten/sui.js/client'; +import { type DelegatedStake } from '@mysten/sui/client'; // Get Stake SUI by stakeSuiId export const getStakeSuiBySuiId = (allDelegation: DelegatedStake[], stakeSuiId?: string | null) => { diff --git a/apps/wallet/src/ui/app/staking/getTokenStakeSuiForValidator.ts b/apps/wallet/src/ui/app/staking/getTokenStakeSuiForValidator.ts index 9f18fb409ab49..1c5873cf7bdc1 100644 --- a/apps/wallet/src/ui/app/staking/getTokenStakeSuiForValidator.ts +++ b/apps/wallet/src/ui/app/staking/getTokenStakeSuiForValidator.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { type DelegatedStake } from '@mysten/sui.js/client'; +import { type DelegatedStake } from '@mysten/sui/client'; // Get total Stake SUI for a specific validator address export const getTokenStakeSuiForValidator = ( diff --git a/apps/wallet/src/ui/app/staking/home/StakeAmount.tsx b/apps/wallet/src/ui/app/staking/home/StakeAmount.tsx index 8f727392b670c..0b23942376cac 100644 --- a/apps/wallet/src/ui/app/staking/home/StakeAmount.tsx +++ b/apps/wallet/src/ui/app/staking/home/StakeAmount.tsx @@ -4,7 +4,7 @@ import { Heading } from '_app/shared/heading'; import { Text } from '_app/shared/text'; import { useFormatCoin } from '@mysten/core'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; //TODO unify StakeAmount and CoinBalance interface StakeAmountProps { diff --git a/apps/wallet/src/ui/app/staking/home/StakedCard.tsx b/apps/wallet/src/ui/app/staking/home/StakedCard.tsx index ae74dfae9dfac..61410aa189843 100644 --- a/apps/wallet/src/ui/app/staking/home/StakedCard.tsx +++ b/apps/wallet/src/ui/app/staking/home/StakedCard.tsx @@ -6,8 +6,8 @@ import { CountDownTimer } from '_src/ui/app/shared/countdown-timer'; import { Text } from '_src/ui/app/shared/text'; import { IconTooltip } from '_src/ui/app/shared/tooltip'; import { useFormatCoin, useGetTimeBeforeEpochNumber } from '@mysten/core'; -import { type StakeObject } from '@mysten/sui.js/client'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { type StakeObject } from '@mysten/sui/client'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; import { cva, cx, type VariantProps } from 'class-variance-authority'; import type { ReactNode } from 'react'; import { Link } from 'react-router-dom'; diff --git a/apps/wallet/src/ui/app/staking/stake/StakingCard.tsx b/apps/wallet/src/ui/app/staking/stake/StakingCard.tsx index b64d1f2aa29cd..16cc11a26b4c0 100644 --- a/apps/wallet/src/ui/app/staking/stake/StakingCard.tsx +++ b/apps/wallet/src/ui/app/staking/stake/StakingCard.tsx @@ -20,8 +20,8 @@ import { useFeatureIsOn } from '@growthbook/growthbook-react'; import { useCoinMetadata, useGetDelegatedStake } from '@mysten/core'; import { useSuiClientQuery } from '@mysten/dapp-kit'; import { ArrowLeft16 } from '@mysten/icons'; -import type { StakeObject } from '@mysten/sui.js/client'; -import { MIST_PER_SUI, SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import type { StakeObject } from '@mysten/sui/client'; +import { MIST_PER_SUI, SUI_TYPE_ARG } from '@mysten/sui/utils'; import * as Sentry from '@sentry/react'; import { useMutation, useQueryClient } from '@tanstack/react-query'; import { Formik } from 'formik'; diff --git a/apps/wallet/src/ui/app/staking/stake/UnstakeForm.tsx b/apps/wallet/src/ui/app/staking/stake/UnstakeForm.tsx index 6c6f77009308a..22ef123157801 100644 --- a/apps/wallet/src/ui/app/staking/stake/UnstakeForm.tsx +++ b/apps/wallet/src/ui/app/staking/stake/UnstakeForm.tsx @@ -5,7 +5,7 @@ import { Card } from '_app/shared/card'; import { Text } from '_app/shared/text'; import { CountDownTimer } from '_src/ui/app/shared/countdown-timer'; import { useFormatCoin, useGetTimeBeforeEpochNumber } from '@mysten/core'; -import { SUI_TYPE_ARG } from '@mysten/sui.js/utils'; +import { SUI_TYPE_ARG } from '@mysten/sui/utils'; import { Form } from 'formik'; import { useMemo } from 'react'; diff --git a/apps/wallet/src/ui/app/staking/stake/utils/transaction.ts b/apps/wallet/src/ui/app/staking/stake/utils/transaction.ts index 70f24b14169b9..c1d4e643fd8c7 100644 --- a/apps/wallet/src/ui/app/staking/stake/utils/transaction.ts +++ b/apps/wallet/src/ui/app/staking/stake/utils/transaction.ts @@ -1,11 +1,11 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { TransactionBlock } from '@mysten/sui.js/transactions'; -import { SUI_SYSTEM_STATE_OBJECT_ID } from '@mysten/sui.js/utils'; +import { Transaction } from '@mysten/sui/transactions'; +import { SUI_SYSTEM_STATE_OBJECT_ID } from '@mysten/sui/utils'; export function createStakeTransaction(amount: bigint, validator: string) { - const tx = new TransactionBlock(); + const tx = new Transaction(); const stakeCoin = tx.splitCoins(tx.gas, [amount]); tx.moveCall({ target: '0x3::sui_system::request_add_stake', @@ -23,7 +23,7 @@ export function createStakeTransaction(amount: bigint, validator: string) { } export function createUnstakeTransaction(stakedSuiId: string) { - const tx = new TransactionBlock(); + const tx = new Transaction(); tx.moveCall({ target: '0x3::sui_system::request_withdraw_stake', arguments: [tx.object(SUI_SYSTEM_STATE_OBJECT_ID), tx.object(stakedSuiId)], diff --git a/apps/wallet/src/ui/app/staking/validators/ValidatorLogo.tsx b/apps/wallet/src/ui/app/staking/validators/ValidatorLogo.tsx index d73408263818c..9fbe8b8d8564b 100644 --- a/apps/wallet/src/ui/app/staking/validators/ValidatorLogo.tsx +++ b/apps/wallet/src/ui/app/staking/validators/ValidatorLogo.tsx @@ -5,7 +5,7 @@ import { ImageIcon } from '_app/shared/image-icon'; import { Text } from '_app/shared/text'; import { Badge } from '_src/ui/app/shared/Badge'; import { useSuiClientQuery } from '@mysten/dapp-kit'; -import { formatAddress } from '@mysten/sui.js/utils'; +import { formatAddress } from '@mysten/sui/utils'; import cl from 'clsx'; import { useMemo } from 'react'; diff --git a/apps/wallet/src/ui/app/staking/validators/ValidatorsCard.tsx b/apps/wallet/src/ui/app/staking/validators/ValidatorsCard.tsx index e0e940a39d5b4..2fd519b42a7ab 100644 --- a/apps/wallet/src/ui/app/staking/validators/ValidatorsCard.tsx +++ b/apps/wallet/src/ui/app/staking/validators/ValidatorsCard.tsx @@ -15,7 +15,7 @@ import { import { useGetDelegatedStake } from '@mysten/core'; import { useSuiClientQuery } from '@mysten/dapp-kit'; import { Plus12 } from '@mysten/icons'; -import type { StakeObject } from '@mysten/sui.js/client'; +import type { StakeObject } from '@mysten/sui/client'; import { useMemo } from 'react'; import { useActiveAddress } from '../../hooks/useActiveAddress'; diff --git a/apps/wallet/tests/demo-app/src/index.tsx b/apps/wallet/tests/demo-app/src/index.tsx index f2529770a9f92..15fb58f123b16 100644 --- a/apps/wallet/tests/demo-app/src/index.tsx +++ b/apps/wallet/tests/demo-app/src/index.tsx @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 import { type SuiWallet } from '_src/dapp-interface/WalletStandardInterface'; -import { TransactionBlock } from '@mysten/sui.js/transactions'; +import { Transaction } from '@mysten/sui/transactions'; import { getWallets, ReadonlyWalletAccount, type Wallet } from '@mysten/wallet-standard'; import { useEffect, useState } from 'react'; import ReactDOM from 'react-dom/client'; function getDemoTransaction(address: string) { - const txb = new TransactionBlock(); + const txb = new Transaction(); const [coin] = txb.splitCoins(txb.gas, [1]); txb.transferObjects([coin], address); return txb; @@ -93,11 +93,11 @@ function App() {