Skip to content

Commit

Permalink
[ts-sdk] deprecate getters in /types (MystenLabs#13148)
Browse files Browse the repository at this point in the history
## 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 not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### 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
  • Loading branch information
hayes-mysten authored Jul 26, 2023
1 parent 1688231 commit 1b4ed77
Show file tree
Hide file tree
Showing 107 changed files with 594 additions and 181 deletions.
2 changes: 1 addition & 1 deletion apps/core/src/hooks/useGetAllBalances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { useRpcClient } from '../api/RpcClientContext';
import { CoinBalance } from '@mysten/sui.js';
import { CoinBalance } from '@mysten/sui.js/client';
import { useQuery } from '@tanstack/react-query';

export function useGetAllBalances<TResult = CoinBalance[]>(
Expand Down
2 changes: 1 addition & 1 deletion apps/core/src/hooks/useGetKioskContents.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { type SuiObjectResponse } from '@mysten/sui.js';
import { type SuiObjectResponse } from '@mysten/sui.js/client';
import { KIOSK_ITEM, KioskData, KioskItem, fetchKiosk, getOwnedKiosks } from '@mysten/kiosk';
import { useQuery } from '@tanstack/react-query';
import { useRpcClient } from '../api/RpcClientContext';
Expand Down
2 changes: 1 addition & 1 deletion apps/core/src/hooks/useGetNormalizedMoveStruct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { useRpcClient } from '../api/RpcClientContext';
import { type SuiMoveNormalizedStruct } from '@mysten/sui.js';
import { type SuiMoveNormalizedStruct } from '@mysten/sui.js/client';
import { normalizeSuiObjectId } from '@mysten/sui.js/utils';
import { useQuery, type UseQueryOptions } from '@tanstack/react-query';

Expand Down
2 changes: 1 addition & 1 deletion apps/core/src/hooks/useMultiGetObjects.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { SuiObjectDataOptions } from '@mysten/sui.js';
import { SuiObjectDataOptions } from '@mysten/sui.js/client';
import { useRpcClient } from '../api/RpcClientContext';
import { useQuery } from '@tanstack/react-query';
import { chunkArray } from '../utils/chunkArray';
Expand Down
2 changes: 1 addition & 1 deletion apps/core/src/utils/getRefGasPrice.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { SuiValidatorSummary } from '@mysten/sui.js';
import { SuiValidatorSummary } from '@mysten/sui.js/client';
import { calculateStakeShare } from './calculateStakeShare';

const REF_THRESHOLD = 66.67;
Expand Down
4 changes: 2 additions & 2 deletions apps/core/src/utils/transaction/getBalanceChangeSummary.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
import {
ObjectOwner,
type ObjectOwner,
type DryRunTransactionBlockResponse,
type SuiTransactionBlockResponse,
} from '@mysten/sui.js';
} from '@mysten/sui.js/client';
import { normalizeSuiObjectId, parseStructTag } from '@mysten/sui.js/utils';

export type BalanceChange = {
Expand Down
2 changes: 1 addition & 1 deletion apps/core/src/utils/transaction/getObjectChangeSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
DisplayFieldsResponse,
SuiObjectChangeDeleted,
SuiObjectChangeWrapped,
} from '@mysten/sui.js';
} from '@mysten/sui.js/client';
import { groupByOwner } from './groupByOwner';
import { SuiObjectChangeTypes } from './types';

Expand Down
2 changes: 1 addition & 1 deletion apps/core/src/utils/transaction/getObjectDisplayLookup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
import { DisplayFieldsResponse, SuiObjectResponse } from '@mysten/sui.js';
import { DisplayFieldsResponse, SuiObjectResponse } from '@mysten/sui.js/client';
import { hasDisplayData } from '../hasDisplayData';

export function getObjectDisplayLookup(objects: SuiObjectResponse[] = []) {
Expand Down
2 changes: 1 addition & 1 deletion apps/explorer/src/components/AccountCardGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { formatAmount, formatDate } from '@mysten/core';
import { type AllEpochsAddressMetrics } from '@mysten/sui.js';
import { type AllEpochsAddressMetrics } from '@mysten/sui.js/client';
import { Heading, LoadingIndicator, Text } from '@mysten/ui';
import { ParentSize } from '@visx/responsive';
import clsx from 'clsx';
Expand Down
2 changes: 1 addition & 1 deletion apps/explorer/src/components/Object/FieldItem.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { type SuiMoveNormalizedType } from '@mysten/sui.js';
import { type SuiMoveNormalizedType } from '@mysten/sui.js/client';
import { Text } from '@mysten/ui';

import { getFieldTypeValue } from './utils';
Expand Down
2 changes: 1 addition & 1 deletion apps/explorer/src/components/Object/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { type SuiMoveNormalizedType } from '@mysten/sui.js';
import { type SuiMoveNormalizedType } from '@mysten/sui.js/client';

type TypeReference =
| {
Expand Down
2 changes: 1 addition & 1 deletion apps/explorer/src/components/OwnedCoins/CoinItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { useFormatCoin } from '@mysten/core';
import { type CoinStruct } from '@mysten/sui.js';
import { type CoinStruct } from '@mysten/sui.js/client';
import { Text } from '@mysten/ui';

import { ObjectLink } from '~/ui/InternalLink';
Expand Down
2 changes: 1 addition & 1 deletion apps/explorer/src/components/OwnedCoins/OwnedCoinView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { useFormatCoin } from '@mysten/core';
import { ArrowShowAndHideRight12 } from '@mysten/icons';
import { type CoinBalance } from '@mysten/sui.js';
import { type CoinBalance } from '@mysten/sui.js/client';
import { Text } from '@mysten/ui';
import * as Collapsible from '@radix-ui/react-collapsible';
import clsx from 'clsx';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { type TransactionFilter } from '@mysten/sui.js';
import { type TransactionFilter } from '@mysten/sui.js/client';
import { Heading, RadioGroup, RadioGroupItem } from '@mysten/ui';
import { useReducer, useState } from 'react';

Expand Down
2 changes: 1 addition & 1 deletion apps/explorer/src/components/checkpoints/utils.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { type CheckpointPage } from '@mysten/sui.js';
import { type CheckpointPage } from '@mysten/sui.js/client';
import { Text } from '@mysten/ui';

import { TxTimeType } from '../tx-time/TxTimeType';
Expand Down
3 changes: 2 additions & 1 deletion apps/explorer/src/components/module/ModuleView.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { normalizeSuiAddress, type SuiMoveNormalizedType } from '@mysten/sui.js';
import { type SuiMoveNormalizedType } from '@mysten/sui.js/client';
import { normalizeSuiAddress } from '@mysten/sui.js/utils';
import cl from 'clsx';
import Highlight, { defaultProps, Prism } from 'prism-react-renderer';
import 'prism-themes/themes/prism-one-light.css';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import { LinkGroup } from './LinkGroup';
import { Banner } from '~/ui/Banner';

import type { SuiTransactionBlockResponse, OwnedObjectRef } from '@mysten/sui.js';
import type { SuiTransactionBlockResponse, OwnedObjectRef } from '@mysten/sui.js/client';

function toObjectLink(object: OwnedObjectRef) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { useZodForm } from '~/hooks/useZodForm';
import { DisclosureBox } from '~/ui/DisclosureBox';
import { Input } from '~/ui/Input';

import type { SuiMoveNormalizedFunction } from '@mysten/sui.js';
import type { SuiMoveNormalizedFunction } from '@mysten/sui.js/client';
import type { TypeOf } from 'zod';

const argsSchema = z.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useMemo } from 'react';

import { getNormalizedFunctionParameterTypeDetails } from '../utils';

import type { SuiMoveNormalizedType } from '@mysten/sui.js';
import type { SuiMoveNormalizedType } from '@mysten/sui.js/client';

export function useFunctionParamsDetails(
params: SuiMoveNormalizedType[],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
import { type MoveCallMetric } from '@mysten/sui.js';
import { type MoveCallMetric } from '@mysten/sui.js/client';
import { Text } from '@mysten/ui';
import { useMemo } from 'react';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { useGetSystemState } from '@mysten/core';
import { ArrowRight12 } from '@mysten/icons';
import { type SuiValidatorSummary } from '@mysten/sui.js';
import { type SuiValidatorSummary } from '@mysten/sui.js/client';
import { Text } from '@mysten/ui';
import { useMemo } from 'react';

Expand Down
2 changes: 1 addition & 1 deletion apps/explorer/src/components/validator/ValidatorMeta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { ArrowUpRight12 } from '@mysten/icons';
import { type SuiValidatorSummary } from '@mysten/sui.js';
import { type SuiValidatorSummary } from '@mysten/sui.js/client';
import { Heading, Text } from '@mysten/ui';

import { StakeButton } from './StakeButton';
Expand Down
2 changes: 1 addition & 1 deletion apps/explorer/src/hooks/useGetTransactionBlocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { useRpcClient } from '@mysten/core';
import { useInfiniteQuery } from '@tanstack/react-query';

import type { TransactionFilter } from '@mysten/sui.js';
import type { TransactionFilter } from '@mysten/sui.js/client';

export const DEFAULT_TRANSACTIONS_LIMIT = 20;

Expand Down
2 changes: 1 addition & 1 deletion apps/explorer/src/pages/object-result/ObjectResultType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {

import { parseObjectType } from '../../utils/objectUtils';

import type { SuiObjectResponse, ObjectOwner } from '@mysten/sui.js';
import type { SuiObjectResponse, ObjectOwner } from '@mysten/sui.js/client';

export type DataType = {
id: string;
Expand Down
10 changes: 3 additions & 7 deletions apps/explorer/src/pages/transaction-result/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
// SPDX-License-Identifier: Apache-2.0

import { ChevronRight12 } from '@mysten/icons';
import {
formatAddress,
parseStructTag,
type SuiEvent,
type TransactionEvents,
} from '@mysten/sui.js';
import { type SuiEvent } from '@mysten/sui.js/client';
import { parseStructTag, formatAddress } from '@mysten/sui.js/utils';
import { Text } from '@mysten/ui';
import * as Collapsible from '@radix-ui/react-collapsible';
import clsx from 'clsx';
Expand Down Expand Up @@ -71,7 +67,7 @@ function Event({ event, divider }: { event: SuiEvent; divider: boolean }) {
}

interface EventsProps {
events: TransactionEvents;
events: SuiEvent[];
}

export function Events({ events }: EventsProps) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { type SuiCallArg } from '@mysten/sui.js';
import { type SuiCallArg } from '@mysten/sui.js/client';
import { Text } from '@mysten/ui';

import { ProgrammableTxnBlockCard } from '~/components/transactions/ProgTxnBlockCard';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { type SuiTransaction } from '@mysten/sui.js';
import { type SuiTransaction } from '@mysten/sui.js/client';

import { Transaction } from './Transaction';
import { ProgrammableTxnBlockCard } from '~/components/transactions/ProgTxnBlockCard';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
type SuiObjectChangePublished,
type SuiObjectChange,
type DisplayFieldsResponse,
parseStructTag,
} from '@mysten/sui.js';
} from '@mysten/sui.js/client';
import { parseStructTag } from '@mysten/sui.js/utils';
import { Text } from '@mysten/ui';
import * as Collapsible from '@radix-ui/react-collapsible';
import clsx from 'clsx';
Expand Down
2 changes: 1 addition & 1 deletion apps/explorer/src/pages/validator/ValidatorDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { useGetValidatorsApy, useGetValidatorsEvents, useGetSystemState } from '@mysten/core';
import { type SuiSystemStateSummary } from '@mysten/sui.js';
import { type SuiSystemStateSummary } from '@mysten/sui.js/client';
import { LoadingIndicator, Text } from '@mysten/ui';
import React, { useMemo } from 'react';
import { useParams } from 'react-router-dom';
Expand Down
2 changes: 1 addition & 1 deletion apps/explorer/src/ui/InternalLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { isSuiNSName } from '@mysten/core';
import { formatAddress, formatDigest } from '@mysten/sui.js';
import { formatAddress, formatDigest } from '@mysten/sui.js/utils';

import { Link, type LinkProps } from '~/ui/Link';

Expand Down
2 changes: 1 addition & 1 deletion apps/explorer/src/utils/getValidatorMoveEvent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { type SuiEvent } from '@mysten/sui.js';
import { type SuiEvent } from '@mysten/sui.js/client';

export function getValidatorMoveEvent(validatorsEvent: SuiEvent[], validatorAddress: string) {
const event = validatorsEvent.find(
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/test-utils/vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { mnemonicToSeedHex } from '@mysten/sui.js/cryptography';
import { EPHEMERAL_PASSWORD_KEY, EPHEMERAL_VAULT_KEY } from '_src/background/keyring/VaultStorage';
import { toEntropy } from '_src/shared/utils/bip39';

import type { Keypair } from '@mysten/sui.js';
import type { Keypair } from '@mysten/sui.js/cryptography';

export const testMnemonic =
'loud eye weather change muffin brisk episode dance mirror smart image energy';
Expand Down
6 changes: 2 additions & 4 deletions apps/wallet/src/ui/app/WalletSigner.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { type SignedMessage, type SignedTransaction, SignerWithProvider } from '@mysten/sui.js';
import {
type ExecuteTransactionRequestType,
type SignedMessage,
type SignedTransaction,
SignerWithProvider,
type SuiTransactionBlockResponse,
type SuiTransactionBlockResponseOptions,
} from '@mysten/sui.js';
} from '@mysten/sui.js/client';
import { type SerializedSignature } from '@mysten/sui.js/cryptography';
import { type TransactionBlock } from '@mysten/sui.js/transactions';

Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/ui/app/components/AccountAddress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { useResolveSuiNSName } from '@mysten/core';
import { Copy12 } from '@mysten/icons';
import { formatAddress } from '@mysten/sui.js';
import { formatAddress } from '@mysten/sui.js/utils';

import { useActiveAddress } from '../hooks/useActiveAddress';
import { useCopyToClipboard } from '../hooks/useCopyToClipboard';
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/ui/app/components/AccountSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { Popover, Transition } from '@headlessui/react';
import { useResolveSuiNSName } from '@mysten/core';
import { ChevronDown12, Copy12 } from '@mysten/icons';
import { formatAddress } from '@mysten/sui.js';
import { formatAddress } from '@mysten/sui.js/utils';

import { AccountList } from './AccountList';
import { useAccounts } from '../hooks/useAccounts';
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/ui/app/components/address-input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { useRpcClient } from '@mysten/core';
import { X12, QrCode } from '@mysten/icons';
import { isValidSuiAddress } from '@mysten/sui.js';
import { isValidSuiAddress } from '@mysten/sui.js/utils';
import { useQuery } from '@tanstack/react-query';
import { cx } from 'class-variance-authority';
import { useField, useFormikContext } from 'formik';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

import { useFormatCoin, useGetCoinBalance, useResolveSuiNSName } from '@mysten/core';
import { CheckFill16 } from '@mysten/icons';
import { formatAddress, SUI_TYPE_ARG } from '@mysten/sui.js';
import { SUI_TYPE_ARG } from '@mysten/sui.js';
import { formatAddress } from '@mysten/sui.js/utils';
import cl from 'classnames';

import { useCoinsReFetchingConfig } from '../../hooks';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { fromB64 } from '@mysten/sui.js';
import { fromB64 } from '@mysten/sui.js/utils';
import { bytesToHex } from '@noble/hashes/utils';
import { useMutation } from '@tanstack/react-query';
import { useMemo } from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Version24,
CopyArchiveDoNotUse24,
} from '@mysten/icons';
import { formatAddress } from '@mysten/sui.js';
import { formatAddress } from '@mysten/sui.js/utils';
import { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import Browser from 'webextension-polyfill';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ 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 type { SuiEvent } from '@mysten/sui.js';
import type { SuiEvent } from '@mysten/sui.js/client';

type StakeTxnCardProps = {
event: SuiEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { isSuiNSName } from '@mysten/core';
import { formatAddress } from '@mysten/sui.js';
import { formatAddress } from '@mysten/sui.js/utils';

import ExplorerLink from '_components/explorer-link';
import { ExplorerLinkType } from '_components/explorer-link/ExplorerLinkType';
Expand Down
Loading

0 comments on commit 1b4ed77

Please sign in to comment.