diff --git a/.changeset/orange-plants-drum.md b/.changeset/orange-plants-drum.md new file mode 100644 index 00000000..215e1f49 --- /dev/null +++ b/.changeset/orange-plants-drum.md @@ -0,0 +1,5 @@ +--- +"@mysten/suins": patch +--- + +Update @mysten/sui.js dependency diff --git a/.github/workflows/sdk_test.yml b/.github/workflows/sdk_test.yml index 1507fed2..f59dc747 100644 --- a/.github/workflows/sdk_test.yml +++ b/.github/workflows/sdk_test.yml @@ -24,6 +24,14 @@ jobs: with: fetch-depth: 1 + - name: Install Homebrew + run: | + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + echo "/home/linuxbrew/.linuxbrew/bin" >> $GITHUB_PATH + + - name: Install Sui using Homebrew + run: brew install sui + - uses: actions/setup-node@v4 with: node-version: 20 @@ -36,18 +44,9 @@ jobs: run: | pnpm install - - name: Download & Extract latest SUI binary - run: | - url=$(curl -s https://api.github.com/repos/mystenlabs/sui/releases/latest | jq -r '.assets[] | select(.name | contains("ubuntu")) | .browser_download_url') - filename="sui-x86-64.tgz" - wget $url -O $filename - tar -xzf $filename - ls - ./sui -V - - name: Prepare local network & run SDK tests env: IS_CI_JOB: true NETWORK: localnet run: | - ./sui start --with-faucet --force-regenesis --epoch-duration-ms 10000000 > /dev/null 2>&1 & cd sdk && VITE_SUI_BIN="../sui" pnpm test:e2e + sui start --with-faucet --force-regenesis --epoch-duration-ms 120000 > /dev/null 2>&1 & cd sdk && VITE_SUI_BIN="sui" pnpm test:e2e diff --git a/.github/workflows/suins-build-tx.yaml b/.github/workflows/suins-build-tx.yaml index 1bad7082..292c712c 100644 --- a/.github/workflows/suins-build-tx.yaml +++ b/.github/workflows/suins-build-tx.yaml @@ -8,7 +8,6 @@ on: description: 'select transaction type to create' type: choice options: - - Create Deepbook Pools - Multi Purpose Operation - Profits to Treasury - Transfer Reserved Names @@ -62,16 +61,6 @@ jobs: run: | pnpm install - - name: Create Deepbook Pools - if: ${{ inputs.transaction_type == 'Create Deepbook Pools' }} - env: - NODE_ENV: production - GAS_OBJECT: ${{ inputs.gas_object_id }} - NETWORK: mainnet - ORIGIN: gh_action - run: | - cd scripts && pnpm create-deepbook-pools - - name: Profits to Treasury if: ${{ inputs.transaction_type == 'Profits to Treasury' }} env: diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6700e2a5..e602a8c7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -92,15 +92,12 @@ importers: scripts: dependencies: - '@mysten/bcs': - specifier: 0.11.1 - version: 0.11.1 '@mysten/kiosk': - specifier: 0.8.10 - version: 0.8.10(svelte@4.2.15)(typescript@5.4.5) - '@mysten/sui.js': - specifier: ^0.54.1 - version: 0.54.1(svelte@4.2.15)(typescript@5.4.5) + specifier: 0.9.21 + version: 0.9.21(svelte@4.2.15)(typescript@5.4.5) + '@mysten/sui': + specifier: ^1.12.0 + version: 1.12.0(svelte@4.2.15)(typescript@5.4.5) '@noble/hashes': specifier: ^1.4.0 version: 1.4.0 @@ -121,8 +118,8 @@ importers: sdk: dependencies: '@mysten/sui': - specifier: ^1.8.0 - version: 1.8.0(svelte@4.2.15)(typescript@5.4.5) + specifier: ^1.12.0 + version: 1.12.0(svelte@4.2.15)(typescript@5.4.5) devDependencies: '@types/tmp': specifier: ^0.2.3 @@ -1229,12 +1226,6 @@ packages: resolution: {integrity: sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - '@gql.tada/cli-utils@1.3.6': - resolution: {integrity: sha512-E0PX6CcDFJhNyhCXNFT2NNN5Op9VP4Etf+25pm+lDco0nqXn0Z7KL5TIl1b6QRBboUkQYOnXgEdgzxqKEL4DvA==} - peerDependencies: - graphql: ^15.5.0 || ^16.0.0 || ^17.0.0 - typescript: ^5.0.0 - '@gql.tada/cli-utils@1.5.1': resolution: {integrity: sha512-JVLpoXLa4msrE7MHnmW/7fYnIl8dncLom8T/Ghsxu+Kz5iMGnzK2joJN5cZt4ewCAqfCV3HZZ0VH189OalGd9g==} peerDependencies: @@ -1242,12 +1233,6 @@ packages: graphql: ^15.5.0 || ^16.0.0 || ^17.0.0 typescript: ^5.0.0 - '@gql.tada/internal@1.0.0': - resolution: {integrity: sha512-B55aIYyZn5ewdgMqoJciPAwF5DKYX6HBabTU+ap/dpNH3EgJrLomc8Y8w+MCxCyOx+dXL9OduT6eWnVr7J7Eyg==} - peerDependencies: - graphql: ^15.5.0 || ^16.0.0 || ^17.0.0 - typescript: ^5.0.0 - '@gql.tada/internal@1.0.4': resolution: {integrity: sha512-tq0rgoqjhdVqKWEsbrkiX7Qpp5gA4/Br9r9TVBeh3WpJIcuGh5U48UjB4IOxtXBePZdX8E0oc07GjOid/P60Wg==} peerDependencies: @@ -1346,26 +1331,20 @@ packages: '@mysten/bcs@0.10.1': resolution: {integrity: sha512-cQDb7Rhz2J82ZqgVQiHykuwKUlgiLWS2bjoajPPW0uvXlb75qrgKuaxh1UzsaRhHy3egk/APc0xjiZoqdbzB4w==} - '@mysten/bcs@0.11.1': - resolution: {integrity: sha512-xP85isNSYUCHd3O/g+TmZYmg4wK6cU8q/n/MebkIGP4CYVJZz2wU/G24xIZ3wI+0iTop4dfgA5kYrg/DQKCUzA==} + '@mysten/bcs@1.1.0': + resolution: {integrity: sha512-yy9/1Y4d0FlRywS1+9ze/T7refCbrvwFwJIOKs9M3QBK1njbcHZp+LkVeLqBvIJA5eZ3ZCzmhQ1Xq4Sed5mEBA==} - '@mysten/bcs@1.0.4': - resolution: {integrity: sha512-6JoQi59GN/dVEBCNq8Rj4uOR0niDrJqDx/2gNQWXANwJakHIGH0AMniHrXP41B2dF+mZ3HVmh9Hi3otiEVQTrQ==} - - '@mysten/kiosk@0.8.10': - resolution: {integrity: sha512-YiU1SiabdArNyHSKX1elQxNKtpwGthw/bg6wYmR0i+wE8q7ER4JnUeJVxQQg1smyklswqgiLsYa56JmKF1rIeg==} - engines: {node: '>=16'} + '@mysten/kiosk@0.9.21': + resolution: {integrity: sha512-W1X1oGzkB46gipyxlFs9qRnaiXW5jePgTjl0e4swQ6Ux0pZe2/B9TvCHeO9NYUVp2imSggqf2F6tQTdDzL3tvg==} + engines: {node: '>=18'} '@mysten/sui.js@0.49.1': resolution: {integrity: sha512-xMndhhlnlVYjMVmBkXnGs9wdw7/bh3R/QggD/DkqGG7Iq7RL2uldtAeIFYsPGfTua/TJW8RFX7q59RagIOwWdw==} engines: {node: '>=16'} + deprecated: This package has been renamed to @mysten/sui, please update to use the renamed package. - '@mysten/sui.js@0.54.1': - resolution: {integrity: sha512-TSmGIX7U9O/uS9EKIQdv7/S69KTbBhMJVelXCafJE6IJw8iB9cN9uLu0+uklkBSDrbRmLSEY70jMr3uRFjReIg==} - engines: {node: '>=16'} - - '@mysten/sui@1.8.0': - resolution: {integrity: sha512-iL7yztpePS/GWFZ7yiD/Pl7ciuOD2ySyogJZmLFu4WxZfiIcXJX+U/U+Egq9VHvELk8+m+Z1OvvPlNQfuowMIg==} + '@mysten/sui@1.12.0': + resolution: {integrity: sha512-DrSyja04xyGrTGlIQKMwZ6MywxNPkjyIcDLm915Zisoy1/uIgPoHc4cx53JyiG92z/HgowTVGGCCIzH53DIYXA==} engines: {node: '>=18'} '@napi-rs/simple-git-android-arm-eabi@0.1.16': @@ -1498,9 +1477,6 @@ packages: '@nicolo-ribaudo/eslint-scope-5-internals@5.1.1-v1': resolution: {integrity: sha512-54/JRvkLIzzDWshCWfuhadfrfZVPiElY8Fcgmg1HroEly/EDSszzhBAsarCux+D/kOslTRquNzuyGSmUSTTHGg==} - '@noble/curves@1.4.0': - resolution: {integrity: sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg==} - '@noble/curves@1.4.2': resolution: {integrity: sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==} @@ -1836,15 +1812,9 @@ packages: '@vitest/utils@0.33.0': resolution: {integrity: sha512-pF1w22ic965sv+EN6uoePkAOTkAPWM03Ri/jXNyMIKBb/XHLDPfhLvf/Fa9g0YECevAIz56oVYXhodLvLQ/awA==} - '@volar/language-core@2.2.0-alpha.12': - resolution: {integrity: sha512-zgWof8q02kADyb4lalVzoqnvTs/wJRDul5qHl0VC2ZVXwes6j2ZYumjXqAW+8W1CQp8lfJkEn9Z6a5jvU6S7Jw==} - '@volar/language-core@2.4.0-alpha.18': resolution: {integrity: sha512-JAYeJvYQQROmVRtSBIczaPjP3DX4QW1fOqW1Ebs0d3Y3EwSNRglz03dSv0Dm61dzd0Yx3WgTW3hndDnTQqgmyg==} - '@volar/source-map@2.2.0-alpha.12': - resolution: {integrity: sha512-d7vDWBE3Ijenff+f1GbWWvdXK4i0wsWsDnfry7G0Jwhbs2/q+NoQya27ZEc3Is0E5m7sOmgUOvRnLGLKEmWFBg==} - '@volar/source-map@2.4.0-alpha.18': resolution: {integrity: sha512-MTeCV9MUwwsH0sNFiZwKtFrrVZUK6p8ioZs3xFzHc2cvDXHWlYN3bChdQtwKX+FY2HG6H3CfAu1pKijolzIQ8g==} @@ -1854,14 +1824,6 @@ packages: '@vue/compiler-dom@3.4.26': resolution: {integrity: sha512-4CWbR5vR9fMg23YqFOhr6t6WB1Fjt62d6xdFPyj8pxrYub7d+OgZaObMsoxaF9yBUHPMiPFK303v61PwAuGvZA==} - '@vue/language-core@2.0.15': - resolution: {integrity: sha512-a2n5Oc+PkWPX5zhnTkddH/hzPCrQmwUz1EwmFje3mqd+c8Ux+yCVEnAE2XtGQZoELgSWvY7EmJfidRbs+nR19Q==} - peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - '@vue/language-core@2.0.28': resolution: {integrity: sha512-0z4tyCCaqqPbdyz0T4yTFQeLpCo4TOM/ZHAC3geGLHeCiFAjVbROB9PiEtrXR1AoLObqUPFHSmKZeWtEMssSqw==} peerDependencies: @@ -2840,6 +2802,7 @@ packages: eslint@8.57.0: resolution: {integrity: sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options. hasBin: true espree@9.6.1: @@ -3085,12 +3048,6 @@ packages: gopd@1.0.1: resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} - gql.tada@1.7.2: - resolution: {integrity: sha512-gwNmDoPmUrtpT/nxNwJtcxu6d56ZwA6Rg7ONpzRl4xY5vceKjafvyXAqQuJx+0t/Dcat8+CB50YzfmI19O3AEw==} - hasBin: true - peerDependencies: - typescript: ^5.0.0 - gql.tada@1.8.2: resolution: {integrity: sha512-LLt+2RcLY6i+Rq+LQQwx3uiEAPfA+pmEaAo/bJjUdaV1CVJBy3Wowds6GHeerW5kvekRM/XdbPTJw5OvnLq/DQ==} hasBin: true @@ -3106,10 +3063,6 @@ packages: graphemer@1.4.0: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} - graphql@16.8.1: - resolution: {integrity: sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==} - engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0} - graphql@16.9.0: resolution: {integrity: sha512-GGTKBX4SD7Wdb8mqeDLni2oaRGYQWjWHGKPQ24ZMnUtKfcsVoiv4uX8+LJr1K6U5VW2Lu1BwJnj7uiori0YtRw==} engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0} @@ -5218,20 +5171,10 @@ packages: snapshots: - '@0no-co/graphql.web@1.0.7(graphql@16.8.1)': - optionalDependencies: - graphql: 16.8.1 - '@0no-co/graphql.web@1.0.7(graphql@16.9.0)': optionalDependencies: graphql: 16.9.0 - '@0no-co/graphqlsp@1.12.12(graphql@16.8.1)(typescript@5.4.5)': - dependencies: - '@gql.tada/internal': 1.0.4(graphql@16.8.1)(typescript@5.4.5) - graphql: 16.8.1 - typescript: 5.4.5 - '@0no-co/graphqlsp@1.12.12(graphql@16.9.0)(typescript@5.4.5)': dependencies: '@gql.tada/internal': 1.0.4(graphql@16.9.0)(typescript@5.4.5) @@ -6410,18 +6353,6 @@ snapshots: '@eslint/js@8.57.0': {} - '@gql.tada/cli-utils@1.3.6(graphql@16.8.1)(svelte@4.2.15)(typescript@5.4.5)': - dependencies: - '@0no-co/graphqlsp': 1.12.12(graphql@16.8.1)(typescript@5.4.5) - '@gql.tada/internal': 1.0.0(graphql@16.8.1)(typescript@5.4.5) - '@vue/compiler-dom': 3.4.26 - '@vue/language-core': 2.0.15(typescript@5.4.5) - graphql: 16.8.1 - svelte2tsx: 0.7.7(svelte@4.2.15)(typescript@5.4.5) - typescript: 5.4.5 - transitivePeerDependencies: - - svelte - '@gql.tada/cli-utils@1.5.1(@0no-co/graphqlsp@1.12.12(graphql@16.9.0)(typescript@5.4.5))(graphql@16.9.0)(svelte@4.2.15)(typescript@5.4.5)': dependencies: '@0no-co/graphqlsp': 1.12.12(graphql@16.9.0)(typescript@5.4.5) @@ -6434,28 +6365,12 @@ snapshots: transitivePeerDependencies: - svelte - '@gql.tada/internal@1.0.0(graphql@16.8.1)(typescript@5.4.5)': - dependencies: - '@0no-co/graphql.web': 1.0.7(graphql@16.8.1) - graphql: 16.8.1 - typescript: 5.4.5 - - '@gql.tada/internal@1.0.4(graphql@16.8.1)(typescript@5.4.5)': - dependencies: - '@0no-co/graphql.web': 1.0.7(graphql@16.8.1) - graphql: 16.8.1 - typescript: 5.4.5 - '@gql.tada/internal@1.0.4(graphql@16.9.0)(typescript@5.4.5)': dependencies: '@0no-co/graphql.web': 1.0.7(graphql@16.9.0) graphql: 16.9.0 typescript: 5.4.5 - '@graphql-typed-document-node/core@3.2.0(graphql@16.8.1)': - dependencies: - graphql: 16.8.1 - '@graphql-typed-document-node/core@3.2.0(graphql@16.9.0)': dependencies: graphql: 16.9.0 @@ -6589,17 +6504,13 @@ snapshots: dependencies: bs58: 5.0.0 - '@mysten/bcs@0.11.1': - dependencies: - bs58: 5.0.0 - - '@mysten/bcs@1.0.4': + '@mysten/bcs@1.1.0': dependencies: bs58: 6.0.0 - '@mysten/kiosk@0.8.10(svelte@4.2.15)(typescript@5.4.5)': + '@mysten/kiosk@0.9.21(svelte@4.2.15)(typescript@5.4.5)': dependencies: - '@mysten/sui.js': 0.54.1(svelte@4.2.15)(typescript@5.4.5) + '@mysten/sui': 1.12.0(svelte@4.2.15)(typescript@5.4.5) transitivePeerDependencies: - svelte - typescript @@ -6615,28 +6526,10 @@ snapshots: superstruct: 1.0.4 tweetnacl: 1.0.3 - '@mysten/sui.js@0.54.1(svelte@4.2.15)(typescript@5.4.5)': - dependencies: - '@graphql-typed-document-node/core': 3.2.0(graphql@16.8.1) - '@mysten/bcs': 0.11.1 - '@noble/curves': 1.4.0 - '@noble/hashes': 1.4.0 - '@scure/bip32': 1.4.0 - '@scure/bip39': 1.3.0 - '@suchipi/femver': 1.0.0 - bech32: 2.0.0 - gql.tada: 1.7.2(graphql@16.8.1)(svelte@4.2.15)(typescript@5.4.5) - graphql: 16.8.1 - superstruct: 1.0.4 - tweetnacl: 1.0.3 - transitivePeerDependencies: - - svelte - - typescript - - '@mysten/sui@1.8.0(svelte@4.2.15)(typescript@5.4.5)': + '@mysten/sui@1.12.0(svelte@4.2.15)(typescript@5.4.5)': dependencies: '@graphql-typed-document-node/core': 3.2.0(graphql@16.9.0) - '@mysten/bcs': 1.0.4 + '@mysten/bcs': 1.1.0 '@noble/curves': 1.4.2 '@noble/hashes': 1.4.0 '@scure/bip32': 1.4.0 @@ -6731,10 +6624,6 @@ snapshots: dependencies: eslint-scope: 5.1.1 - '@noble/curves@1.4.0': - dependencies: - '@noble/hashes': 1.4.0 - '@noble/curves@1.4.2': dependencies: '@noble/hashes': 1.4.0 @@ -7144,18 +7033,10 @@ snapshots: loupe: 2.3.7 pretty-format: 29.7.0 - '@volar/language-core@2.2.0-alpha.12': - dependencies: - '@volar/source-map': 2.2.0-alpha.12 - '@volar/language-core@2.4.0-alpha.18': dependencies: '@volar/source-map': 2.4.0-alpha.18 - '@volar/source-map@2.2.0-alpha.12': - dependencies: - muggle-string: 0.4.1 - '@volar/source-map@2.4.0-alpha.18': {} '@vue/compiler-core@3.4.26': @@ -7171,18 +7052,6 @@ snapshots: '@vue/compiler-core': 3.4.26 '@vue/shared': 3.4.26 - '@vue/language-core@2.0.15(typescript@5.4.5)': - dependencies: - '@volar/language-core': 2.2.0-alpha.12 - '@vue/compiler-dom': 3.4.26 - '@vue/shared': 3.4.26 - computeds: 0.0.1 - minimatch: 9.0.4 - path-browserify: 1.0.1 - vue-template-compiler: 2.7.16 - optionalDependencies: - typescript: 5.4.5 - '@vue/language-core@2.0.28(typescript@5.4.5)': dependencies: '@volar/language-core': 2.4.0-alpha.18 @@ -8731,16 +8600,6 @@ snapshots: dependencies: get-intrinsic: 1.2.4 - gql.tada@1.7.2(graphql@16.8.1)(svelte@4.2.15)(typescript@5.4.5): - dependencies: - '@0no-co/graphql.web': 1.0.7(graphql@16.8.1) - '@gql.tada/cli-utils': 1.3.6(graphql@16.8.1)(svelte@4.2.15)(typescript@5.4.5) - '@gql.tada/internal': 1.0.0(graphql@16.8.1)(typescript@5.4.5) - typescript: 5.4.5 - transitivePeerDependencies: - - graphql - - svelte - gql.tada@1.8.2(graphql@16.9.0)(svelte@4.2.15)(typescript@5.4.5): dependencies: '@0no-co/graphql.web': 1.0.7(graphql@16.9.0) @@ -8758,8 +8617,6 @@ snapshots: graphemer@1.4.0: {} - graphql@16.8.1: {} - graphql@16.9.0: {} gray-matter@4.0.3: diff --git a/scripts/config/constants.ts b/scripts/config/constants.ts index 79780869..5b3a1b45 100644 --- a/scripts/config/constants.ts +++ b/scripts/config/constants.ts @@ -1,6 +1,6 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { normalizeSuiAddress } from '@mysten/sui.js/utils'; +import { normalizeSuiAddress } from '@mysten/sui/utils'; export type Network = 'mainnet' | 'testnet'; diff --git a/scripts/config/discounts.ts b/scripts/config/discounts.ts index 81059ca3..d405d42f 100644 --- a/scripts/config/discounts.ts +++ b/scripts/config/discounts.ts @@ -1,6 +1,6 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { TransactionBlock } from '@mysten/sui.js/transactions'; +import { Transaction } from '@mysten/sui/transactions'; import { Network, PackageInfo } from './constants'; @@ -37,7 +37,7 @@ export type Range = { // Sets up discount prices for type. export const setupDiscountForType = ( - txb: TransactionBlock, + txb: Transaction, setup: PackageInfo, type: string, prices: Discount, @@ -56,7 +56,7 @@ export const setupDiscountForType = ( }; // remove discount for type -export const removeDiscountForType = (txb: TransactionBlock, setup: PackageInfo, type: string) => { +export const removeDiscountForType = (txb: Transaction, setup: PackageInfo, type: string) => { txb.moveCall({ target: `${setup.discountsPackage.packageId}::discounts::deauthorize_type`, arguments: [txb.object(setup.adminCap), txb.object(setup.discountsPackage.discountHouseId)], @@ -66,7 +66,7 @@ export const removeDiscountForType = (txb: TransactionBlock, setup: PackageInfo, // Sets up free claims for type. export const setupFreeClaimsForType = ( - txb: TransactionBlock, + txb: Transaction, setup: PackageInfo, type: string, characters: Range, @@ -76,17 +76,13 @@ export const setupFreeClaimsForType = ( arguments: [ txb.object(setup.adminCap), txb.object(setup.discountsPackage.discountHouseId), - txb.pure([characters.from, characters.to], 'vector'), + txb.pure.vector('u8', [characters.from, characters.to]), ], typeArguments: [type], }); }; -export const removeFreeClaimsForType = ( - txb: TransactionBlock, - setup: PackageInfo, - type: string, -) => { +export const removeFreeClaimsForType = (txb: Transaction, setup: PackageInfo, type: string) => { txb.moveCall({ target: `${setup.discountsPackage.packageId}::free_claims::force_deauthorize_type`, arguments: [txb.object(setup.adminCap), txb.object(setup.discountsPackage.discountHouseId)], diff --git a/scripts/coupons/coupon.ts b/scripts/coupons/coupon.ts index 3dc1df02..59fd0909 100644 --- a/scripts/coupons/coupon.ts +++ b/scripts/coupons/coupon.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { TransactionArgument, TransactionBlock } from '@mysten/sui.js/transactions'; -import { isValidSuiAddress } from '@mysten/sui.js/utils'; +import { Transaction, TransactionArgument } from '@mysten/sui/transactions'; +import { isValidSuiAddress } from '@mysten/sui/utils'; import { PackageInfo } from '../config/constants'; @@ -64,11 +64,7 @@ export class CouponType { /** * Converts the coupon to a transaction. */ - toTransaction( - txb: TransactionBlock, - config: PackageInfo, - rules?: TransactionArgument, - ): TransactionBlock { + toTransaction(txb: Transaction, config: PackageInfo, rules?: TransactionArgument): Transaction { if (this.type === undefined) throw new Error('You have to define a type'); if (!this.name) throw new Error('Please define a name for the coupon'); @@ -79,7 +75,7 @@ export class CouponType { let lengthRule = rules ? null : optionalRangeConstructor(txb, config, this.rules.length); let yearsRule = hasRulesSet ? null : optionalRangeConstructor(txb, config, this.rules.years); - let ruleArg = rules || newCouponRules(txb, config, this.rules, lengthRule, yearsRule); + let ruleArg = rules || newCouponRules(txb, config, this.rules, lengthRule!, yearsRule!); txb.moveCall({ target: `${config.coupons.packageId}::coupon_house::admin_add_coupon`, @@ -118,26 +114,8 @@ export type CouponRules = { years?: number[]; }; -const emptyOption = (txb: TransactionBlock, type: string) => { - return txb.pure( - { - None: true, - }, - `Option<${type}>`, - ); -}; - -const filledOption = (txb: TransactionBlock, value: any, type: string) => { - return txb.pure( - { - Some: value, - }, - `Option<${type}>`, - ); -}; - export const optionalRangeConstructor = ( - txb: TransactionBlock, + txb: Transaction, config: PackageInfo, range?: number[], ) => { @@ -150,7 +128,7 @@ export const optionalRangeConstructor = ( let rangeArg = txb.moveCall({ target: `${config.coupons.packageId}::range::new`, - arguments: [txb.pure(range[0], 'u8'), txb.pure(range[1], 'u8')], + arguments: [txb.pure.u8(range[0]), txb.pure.u8(range[1])], }); return txb.moveCall({ @@ -161,7 +139,7 @@ export const optionalRangeConstructor = ( }; export const newCouponRules = ( - txb: TransactionBlock, + txb: Transaction, config: PackageInfo, rules: CouponRules, lengthRule: TransactionArgument, @@ -171,11 +149,9 @@ export const newCouponRules = ( target: `${config.coupons.packageId}::rules::new_coupon_rules`, arguments: [ lengthRule, - rules.availableClaims - ? filledOption(txb, rules.availableClaims, 'u64') - : emptyOption(txb, 'u64'), - rules.user ? filledOption(txb, rules.user, 'address') : emptyOption(txb, 'address'), - rules.expiration ? filledOption(txb, rules.expiration, 'u64') : emptyOption(txb, 'u64'), + txb.pure.option('u64', rules.availableClaims ?? null), + txb.pure.option('address', rules.user ?? null), + txb.pure.option('u64', rules.expiration ?? null), yearsRule, ], }); diff --git a/scripts/day_one/setup.ts b/scripts/day_one/setup.ts index d16b66bd..89641779 100644 --- a/scripts/day_one/setup.ts +++ b/scripts/day_one/setup.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 import { KioskClient, Network as KioskNetwork, TransferPolicyTransaction } from '@mysten/kiosk'; -import { TransactionBlock } from '@mysten/sui.js/transactions'; +import { Transaction } from '@mysten/sui/transactions'; import { mainPackage, Network } from '../config/constants'; import { addressConfig, AirdropConfig, mainnetConfig } from '../config/day_one'; @@ -9,7 +9,7 @@ import { getClient } from '../utils/utils'; export const dayOneType = (config: AirdropConfig) => `${config.packageId}::day_one::DayOne`; -export const createDayOneDisplay = async (tx: TransactionBlock, network: Network) => { +export const createDayOneDisplay = async (tx: Transaction, network: Network) => { const config = network === 'mainnet' ? mainnetConfig : addressConfig; const displayObject = { keys: ['name', 'description', 'link', 'image_url'], @@ -27,8 +27,8 @@ export const createDayOneDisplay = async (tx: TransactionBlock, network: Network target: '0x2::display::new_with_fields', arguments: [ tx.object(config.publisher), - tx.pure(displayObject.keys), - tx.pure(displayObject.values), + tx.pure.vector('string', displayObject.keys), + tx.pure.vector('string', displayObject.values), ], typeArguments: [dayOneType(config)], }); @@ -39,10 +39,10 @@ export const createDayOneDisplay = async (tx: TransactionBlock, network: Network typeArguments: [dayOneType(config)], }); - tx.transferObjects([display], tx.pure(mainPackageConfig.adminAddress)); + tx.transferObjects([display], tx.pure.address(mainPackageConfig.adminAddress)); }; -export const createDayOneTransferPolicy = async (tx: TransactionBlock, network: Network) => { +export const createDayOneTransferPolicy = async (tx: Transaction, network: Network) => { const config = network === 'mainnet' ? mainnetConfig : addressConfig; const mainPackageConfig = mainPackage[network]; @@ -59,7 +59,7 @@ export const createDayOneTransferPolicy = async (tx: TransactionBlock, network: } // create transfer policy - let tpTx = new TransferPolicyTransaction({ kioskClient, transactionBlock: tx }); + let tpTx = new TransferPolicyTransaction({ kioskClient, transaction: tx }); await tpTx.create({ type: `${dayOneType(config)}`, publisher: config.publisher, diff --git a/scripts/init/authorization.ts b/scripts/init/authorization.ts index 63f183bc..343532b7 100644 --- a/scripts/init/authorization.ts +++ b/scripts/init/authorization.ts @@ -1,6 +1,6 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { TransactionArgument, TransactionBlock } from '@mysten/sui.js/transactions'; +import { TransactionArgument, type Transaction } from '@mysten/sui/transactions'; /** * A helper to authorize any app in the SuiNS object. @@ -12,7 +12,7 @@ export const authorizeApp = ({ type, suinsPackageIdV1, }: { - txb: TransactionBlock; + txb: Transaction; adminCap: string; suins: string; type: string; @@ -35,7 +35,7 @@ export const deauthorizeApp = ({ type, suinsPackageIdV1, }: { - txb: TransactionBlock; + txb: Transaction; adminCap: string; suins: string; type: string; @@ -58,7 +58,7 @@ export const setupApp = ({ target, args, }: { - txb: TransactionBlock; + txb: Transaction; adminCap: string; suins: string; target: `${string}::${string}`; @@ -81,7 +81,7 @@ export const addConfig = ({ config, suinsPackageIdV1, }: { - txb: TransactionBlock; + txb: Transaction; adminCap: string; suins: string; suinsPackageIdV1: string; @@ -105,7 +105,7 @@ export const removeConfig = ({ type, suinsPackageIdV1, }: { - txb: TransactionBlock; + txb: Transaction; adminCap: string; suins: string; suinsPackageIdV1: string; @@ -127,7 +127,7 @@ export const newPriceConfig = ({ priceList, publicKey = [...Array(33).keys()], }: { - txb: TransactionBlock; + txb: Transaction; suinsPackageIdV1: string; priceList: { [key: string]: number }; publicKey?: number[]; @@ -135,10 +135,10 @@ export const newPriceConfig = ({ return txb.moveCall({ target: `${suinsPackageIdV1}::config::new`, arguments: [ - txb.pure(publicKey), - txb.pure(priceList.three), - txb.pure(priceList.four), - txb.pure(priceList.fivePlus), + txb.pure.vector('u8', publicKey), + txb.pure.u64(priceList.three), + txb.pure.u64(priceList.four), + txb.pure.u64(priceList.fivePlus), ], }); }; @@ -154,7 +154,7 @@ export const addRegistry = ({ registry, suinsPackageIdV1, }: { - txb: TransactionBlock; + txb: Transaction; adminCap: string; suins: string; suinsPackageIdV1: string; @@ -177,7 +177,7 @@ export const newLookupRegistry = ({ adminCap, suinsPackageIdV1, }: { - txb: TransactionBlock; + txb: Transaction; adminCap: string; suinsPackageIdV1: string; }): TransactionArgument => { diff --git a/scripts/init/display_tp.ts b/scripts/init/display_tp.ts index 5d8e05b2..154d1aeb 100644 --- a/scripts/init/display_tp.ts +++ b/scripts/init/display_tp.ts @@ -1,6 +1,6 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { TransactionBlock } from '@mysten/sui.js/transactions'; +import { Transaction } from '@mysten/sui/transactions'; export const getImageUrl = (isSubdomain: boolean, network: 'mainnet' | 'testnet') => { const name = `{${isSubdomain ? 'nft.' : ''}domain_name}`; @@ -18,7 +18,7 @@ export const createDisplay = ({ subdomainsPackageId, network = 'mainnet', }: { - txb: TransactionBlock; + txb: Transaction; publisher: string; isSubdomain: boolean; suinsPackageIdV1: string; @@ -38,8 +38,8 @@ export const createDisplay = ({ target: `0x2::display::add_multiple`, arguments: [ display, - txb.pure(['name', 'link', 'image_url', 'description', 'project_url']), - txb.pure([ + txb.pure.vector('string', ['name', 'link', 'image_url', 'description', 'project_url']), + txb.pure.vector('string', [ `{${isSubdomain ? 'nft.' : ''}domain_name}`, `https://{${isSubdomain ? 'nft.' : ''}domain_name}.id`, getImageUrl(isSubdomain, network), diff --git a/scripts/init/packages.ts b/scripts/init/packages.ts index bc1403ac..e21d9543 100644 --- a/scripts/init/packages.ts +++ b/scripts/init/packages.ts @@ -1,8 +1,9 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { SuiTransactionBlockResponse } from '@mysten/sui.js/client'; -import { TransactionBlock } from '@mysten/sui.js/transactions'; -import { MIST_PER_SUI } from '@mysten/sui.js/utils'; + +import { SuiTransactionBlockResponse } from '@mysten/sui/client'; +import { Transaction } from '@mysten/sui/transactions'; +import { MIST_PER_SUI } from '@mysten/sui/utils'; import { addConfig, @@ -58,7 +59,7 @@ export const Packages = (network: Network) => { }; }, setupFunction: ( - txb: TransactionBlock, + txb: Transaction, packageId: string, adminCap: string, suins: string, @@ -137,12 +138,7 @@ export const Packages = (network: Network) => { }; }, authorizationType: (packageId: string) => `${packageId}::denylist::DenyListAuth`, - setupFunction: ( - txb: TransactionBlock, - packageId: string, - adminCap: string, - suins: string, - ) => { + setupFunction: (txb: Transaction, packageId: string, adminCap: string, suins: string) => { setupApp({ txb, adminCap, suins, target: `${packageId}::denylist` }); }, }, @@ -181,7 +177,7 @@ export const Packages = (network: Network) => { suins, priceList, }: { - txb: TransactionBlock; + txb: Transaction; packageId: string; suinsPackageIdV1: string; adminCap: string; @@ -235,7 +231,7 @@ export const Packages = (network: Network) => { adminCap, suins, }: { - txb: TransactionBlock; + txb: Transaction; packageId: string; adminCap: string; suins: string; @@ -256,7 +252,7 @@ export const Packages = (network: Network) => { }; }, setupFunction: ( - txb: TransactionBlock, + txb: Transaction, packageId: string, adminCap: string, suins: string, diff --git a/scripts/init/publish.ts b/scripts/init/publish.ts index 43265c9d..f2627ed5 100644 --- a/scripts/init/publish.ts +++ b/scripts/init/publish.ts @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 import { existsSync, unlinkSync, writeFileSync } from 'fs'; import path from 'path'; -import { TransactionBlock } from '@mysten/sui.js/transactions'; +import { Transaction } from '@mysten/sui/transactions'; -import { publishPackage, signAndExecute } from '../utils/utils'; +import { getClient, publishPackage, signAndExecute } from '../utils/utils'; import { Network, Packages } from './packages'; import { PackageInfo } from './types'; @@ -35,10 +35,14 @@ export const publishPackages = async (network: Network, isCiJob = false, configP writeFileSync(manifestFile, pkg.manifest()); // save the manifest as is. - const txb = new TransactionBlock(); + const txb = new Transaction(); publishPackage(txb, packageFolder, configPath); const res = await signAndExecute(txb, network); + await getClient(network).waitForTransaction({ + digest: res.digest, + }); + // @ts-ignore-next-line const data = pkg.processPublish(res); results[key] = data; diff --git a/scripts/init/queries.ts b/scripts/init/queries.ts index aa078c69..0ae1746f 100644 --- a/scripts/init/queries.ts +++ b/scripts/init/queries.ts @@ -1,12 +1,18 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { SuiClient } from '@mysten/sui.js/client'; +import { SuiClient } from '@mysten/sui/client'; export const queryRegistryTable = async ( client: SuiClient, suins: string, suinsPackageId: string, ) => { + const allFields = await client.getDynamicFields({ + parentId: suins, + }); + + // just for testing.. + console.log(allFields); const table = await client.getDynamicFieldObject({ parentId: suins, name: { @@ -17,7 +23,11 @@ export const queryRegistryTable = async ( }, }); - if (table.data?.content?.dataType !== 'moveObject') throw new Error('Invalid data'); + console.log(table); + console.log(suins); + + if (table.data?.content?.dataType !== 'moveObject') + throw new Error(`Invalid data ${suinsPackageId}`); const data = table.data?.content.fields as Record; return data.value.fields.registry.fields.id.id; diff --git a/scripts/init/setup.ts b/scripts/init/setup.ts index a8664fd4..eb56097e 100644 --- a/scripts/init/setup.ts +++ b/scripts/init/setup.ts @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 import { readFileSync, writeFileSync } from 'fs'; import path from 'path'; -import { TransactionBlock } from '@mysten/sui.js/transactions'; -import { MIST_PER_SUI } from '@mysten/sui.js/utils'; +import { Transaction } from '@mysten/sui/transactions'; +import { MIST_PER_SUI } from '@mysten/sui/utils'; import { getClient, signAndExecute } from '../utils/utils'; import { authorizeApp } from './authorization'; @@ -11,13 +11,10 @@ import { Network, Packages } from './packages'; import { queryRegistryTable } from './queries'; import { PackageInfo } from './types'; -// create a sleep async function -const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); - export const setup = async (packageInfo: PackageInfo, network: Network) => { const packages = Packages(network); - const txb = new TransactionBlock(); + const txb = new Transaction(); for (const [key, pkg] of Object.entries(packageInfo)) { const data = packages[key as keyof typeof packages]; @@ -72,10 +69,29 @@ export const setup = async (packageInfo: PackageInfo, network: Network) => { packageId: packageInfo.Coupons.packageId, }); + let retries = 0; + try { - // TODO: Use "waitForTransaction" when we migrate to latest SDK. - await sleep(2000); - await signAndExecute(txb, network); + txb.setGasBudget(1_000_000_000); + + while (retries < 3) { + console.log('Retrying setup...'); + const res = await signAndExecute(txb, network); + + await getClient(network).waitForTransaction({ + digest: res.digest, + }); + + if (res.effects?.status.status === 'success') break; + console.log(res); + retries++; + + if (retries === 3) { + console.error('Failed to set up packages'); + return; + } + } + console.log('******* Packages set up successfully *******'); try { @@ -83,8 +99,12 @@ export const setup = async (packageInfo: PackageInfo, network: Network) => { const constants = JSON.parse( readFileSync(path.resolve(__dirname, '../constants.sdk.json'), 'utf8'), ); - // TODO: Use "waitForTransaction" when we migrate to latest SDK. - await sleep(2000); + + console.log(constants); + + // delay 3 seconds + await new Promise((resolve) => setTimeout(resolve, 3000)); + constants.registryTableId = await queryRegistryTable( getClient(network), packageInfo.SuiNS.suins, diff --git a/scripts/package.json b/scripts/package.json index 75b5f633..60fce9e8 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -25,9 +25,8 @@ "author": "", "license": "ISC", "dependencies": { - "@mysten/bcs": "0.11.1", - "@mysten/kiosk": "0.8.10", - "@mysten/sui.js": "^0.54.1", + "@mysten/kiosk": "0.9.21", + "@mysten/sui": "^1.12.0", "@noble/hashes": "^1.4.0", "@pythnetwork/pyth-sui-js": "2.0.0", "dotenv": "^16.3.1" diff --git a/scripts/reserved-names/objects.ts b/scripts/reserved-names/objects.ts index bb7f5196..e58fe7a6 100644 --- a/scripts/reserved-names/objects.ts +++ b/scripts/reserved-names/objects.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 import fs from 'fs'; -import { SuiObjectResponse } from '@mysten/sui.js/client'; +import { SuiObjectResponse } from '@mysten/sui/client'; import { mainPackage } from '../config/constants'; import { getClient } from '../utils/utils'; diff --git a/scripts/reserved-names/transfer-names.ts b/scripts/reserved-names/transfer-names.ts index 4ede74ee..091193b5 100644 --- a/scripts/reserved-names/transfer-names.ts +++ b/scripts/reserved-names/transfer-names.ts @@ -1,12 +1,12 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 import fs from 'fs'; -import { SuiObjectResponse } from '@mysten/sui.js/client'; -import { TransactionBlock } from '@mysten/sui.js/transactions'; -import { isValidSuiAddress } from '@mysten/sui.js/utils'; +import { SuiObjectResponse } from '@mysten/sui/client'; +import { Transaction } from '@mysten/sui/transactions'; +import { isValidSuiAddress } from '@mysten/sui/utils'; -import { prepareMultisigTx } from '../utils/utils'; import { mainPackage } from '../config/constants'; +import { prepareMultisigTx } from '../utils/utils'; // A {name: address} map const domains: Record = {}; @@ -82,12 +82,12 @@ const parseCsvFile = () => { }; const prepareTx = () => { - const txb = new TransactionBlock(); + const txb = new Transaction(); const pkg = mainPackage.mainnet; for (let recipient of Object.keys(recipients)) { const objects = [...recipients[recipient]].filter((x) => !!x); - txb.transferObjects([...objects.map((x) => txb.object(x))], txb.pure(recipient)); + txb.transferObjects([...objects.map((x) => txb.object(x))], txb.pure.address(recipient)); } return prepareMultisigTx(txb, 'mainnet', pkg.adminAddress); diff --git a/scripts/transactions/authorize-suilink-discount.ts b/scripts/transactions/authorize-suilink-discount.ts index 5c7c82c7..36cf0742 100644 --- a/scripts/transactions/authorize-suilink-discount.ts +++ b/scripts/transactions/authorize-suilink-discount.ts @@ -1,14 +1,14 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { TransactionBlock } from '@mysten/sui.js/transactions'; -import { MIST_PER_SUI } from '@mysten/sui.js/utils'; +import { Transaction } from '@mysten/sui/transactions'; +import { MIST_PER_SUI } from '@mysten/sui/utils'; import { mainPackage } from '../config/constants'; import { setupDiscountForType } from '../config/discounts'; import { prepareMultisigTx } from '../utils/utils'; export const run = async () => { - const txb = new TransactionBlock(); + const txb = new Transaction(); const suiLinkType = (innerType: string) => { return `0xf857fa9df5811e6df2a0240a1029d365db24b5026896776ddd1c3c70803bccd3::suilink::SuiLink<${innerType}>`; diff --git a/scripts/transactions/create-bulk-coupons.ts b/scripts/transactions/create-bulk-coupons.ts index 3eca19c8..b8357eca 100644 --- a/scripts/transactions/create-bulk-coupons.ts +++ b/scripts/transactions/create-bulk-coupons.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 import { writeFileSync } from 'fs'; -import { TransactionBlock } from '@mysten/sui.js/transactions'; +import { Transaction } from '@mysten/sui/transactions'; import { mainPackage } from '../config/constants'; import { newCouponRules, optionalRangeConstructor, PercentageOffCoupon } from '../coupons/coupon'; @@ -22,16 +22,16 @@ function generateRandomString(length: number) { const create = async () => { const pkg = mainPackage.mainnet; - const tx = new TransactionBlock(); + const tx = new Transaction(); - const freeCouponAddress = "0x11469060268ba1d611e3ad95f3134332f68e21198ce068a14f30975336be9ca1"; + const freeCouponAddress = '0x11469060268ba1d611e3ad95f3134332f68e21198ce068a14f30975336be9ca1'; - new PercentageOffCoupon(100) - .setName(freeCouponAddress) - .setAvailableClaims(200) - .setYears([1, 1]) - .setUser(freeCouponAddress) - .toTransaction(tx, pkg); + new PercentageOffCoupon(100) + .setName(freeCouponAddress) + .setAvailableClaims(200) + .setYears([1, 1]) + .setUser(freeCouponAddress) + .toTransaction(tx, pkg); const lengthRange = optionalRangeConstructor(tx, pkg, [3, 63]); const yearsRange = optionalRangeConstructor(tx, pkg, [1, 1]); @@ -48,7 +48,7 @@ const create = async () => { yearsRange, ); - const coupons80Off = []; + const coupons80Off = []; // create 300 80% coupons for (let i = 0; i < 300; i++) { @@ -71,25 +71,25 @@ const create = async () => { console.log('******** 25% Coupons ********'); console.dir(coupons25Off, { depth: null }); - const lengthRange2 = optionalRangeConstructor(tx, pkg, [3, 3]); + const lengthRange2 = optionalRangeConstructor(tx, pkg, [3, 3]); const yearsRange2 = optionalRangeConstructor(tx, pkg, [1, 1]); const rules2 = newCouponRules( tx, pkg, { - expiration: "1729656000000", + expiration: '1729656000000', }, lengthRange2, yearsRange2, ); - const unlimitedCoupon = []; + const unlimitedCoupon = []; // create 30% coupons for 3 length names - const coupon = generateRandomString(16); - unlimitedCoupon.push(coupon); - new PercentageOffCoupon(30).setName(coupon).toTransaction(tx, pkg, rules2); + const coupon = generateRandomString(16); + unlimitedCoupon.push(coupon); + new PercentageOffCoupon(30).setName(coupon).toTransaction(tx, pkg, rules2); writeFileSync( './tx/coupon-list.json', @@ -97,7 +97,7 @@ const create = async () => { { coupons80Off, coupons25Off, - unlimitedCoupon, + unlimitedCoupon, }, null, 2, diff --git a/scripts/transactions/deepbook/create_pools.ts b/scripts/transactions/deepbook/create_pools.ts deleted file mode 100644 index d2c4fa72..00000000 --- a/scripts/transactions/deepbook/create_pools.ts +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Mysten Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -import { TransactionBlock } from '@mysten/sui.js/transactions'; -import dotenv from 'dotenv'; - -import { Network, mainPackage } from '../../config/constants'; -import { prepareMultisigTx, signAndExecute } from '../../utils/utils'; - -dotenv.config(); - -// const SUI = '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI'; -// const USDY = '0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY'; -const WUSDC = '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN'; -const USDC = '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC'; - -export const CREATION_FEE = 100 * 1e9; -export const PACKAGE_ID = '0xdee9'; -export const MODULE_CLOB = 'clob_v2'; - -// 2 - 2 for fees on the more volatile assets -const DEFAULT_MAKER_FEE = 200000; -const DEFAULT_TAKER_FEE = 200000; - -// 1 - 1 for fees -const DEFAULT_STABLE_MAKER_FEE = 100000; -const DEFAULT_STABLE_TAKER_FEE = 100000; - -// Setup Deepbook Pool. -const setup = async (network: Network) => { - const txb = new TransactionBlock(); - const [coin] = txb.splitCoins(txb.gas, [txb.pure(CREATION_FEE)]); - - // Create USDY / USDC - txb.moveCall({ - typeArguments: [WUSDC, USDC], - target: `${PACKAGE_ID}::${MODULE_CLOB}::create_customized_pool`, - arguments: [ - txb.pure(100000), // tick - txb.pure(100000), // lot - txb.pure(0), // taker fee - txb.pure(0), // maker rebate - coin, // creation fee - ], - }); - - // for mainnet, we prepare the multi-sig tx. - if (network === 'mainnet') return prepareMultisigTx(txb, 'mainnet', mainPackage.mainnet.adminAddress); - - // For testnet, we execute the TX directly. - return signAndExecute(txb, network); -}; - -if (process.env.NETWORK === 'mainnet') setup('mainnet'); -else setup('testnet'); diff --git a/scripts/transactions/discord/discord.ts b/scripts/transactions/discord/discord.ts index 1a227018..44da02eb 100644 --- a/scripts/transactions/discord/discord.ts +++ b/scripts/transactions/discord/discord.ts @@ -1,12 +1,11 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { TransactionBlock } from '@mysten/sui.js/transactions'; +import { Transaction } from '@mysten/sui/transactions'; import { mainPackage, PackageInfo } from '../../config/constants'; import { signAndExecute } from '../../utils/utils'; import { attachRoles, setAddress } from './user'; -import { bcs } from '@mysten/sui.js/bcs'; export const discordRoles = { master: { @@ -51,7 +50,7 @@ export const discordRoles = { } }; -export const authorizeDiscordApp = (txb: TransactionBlock, config: PackageInfo) => { +export const authorizeDiscordApp = (txb: Transaction, config: PackageInfo) => { txb.moveCall({ target: `${config.coupons.packageId}::coupon_house::authorize_app`, arguments: [txb.object(config.adminCap), txb.object(config.suins)], @@ -61,7 +60,7 @@ export const authorizeDiscordApp = (txb: TransactionBlock, config: PackageInfo) // add role to discord. export const addDiscordRole = ( - txb: TransactionBlock, + txb: Transaction, role: { id: number; percentage: number; @@ -71,8 +70,8 @@ export const addDiscordRole = ( txb.moveCall({ target: `${config.discord?.packageId}::discord::add_discord_role`, arguments: [ - txb.object(config.discord?.discordCap), - txb.object(config.discord?.discordObjectId), + txb.object(config.discord!.discordCap), + txb.object(config.discord!.discordObjectId), txb.pure.u8(role.id), txb.pure.u8(role.percentage), ], @@ -80,7 +79,7 @@ export const addDiscordRole = ( }; export const setPublicKey = async ( - txb: TransactionBlock, + txb: Transaction, pubKey: Uint8Array, config: PackageInfo, ) => { @@ -89,9 +88,9 @@ export const setPublicKey = async ( txb.moveCall({ target: `${config.discord?.packageId}::discord::set_public_key`, arguments: [ - txb.object(config.discord?.discordCap), - txb.object(config.discord?.discordObjectId), - txb.pure(bcs.vector(bcs.U8).serialize([...pubKey])), + txb.object(config.discord!.discordCap), + txb.object(config.discord!.discordObjectId), + txb.pure.vector('u8', [...pubKey]), ], }); }; @@ -103,7 +102,7 @@ const prepareTestnetContract = async () => { 69, 39, 116, 176, 59, 114, 83, 28, 209, 143, 129, ]); - const tx = new TransactionBlock(); + const tx = new Transaction(); for (let role of Object.values(discordRoles)) { addDiscordRole(tx, role, config); @@ -118,7 +117,7 @@ const prepareTestnetContract = async () => { const demoTestnetUserCreation = async () => { const config = mainPackage.testnet; - const tx = new TransactionBlock(); + const tx = new Transaction(); // attachRoles( // tx, diff --git a/scripts/transactions/discord/mainnet-setup.ts b/scripts/transactions/discord/mainnet-setup.ts index 0b3fd58e..2f10bd1d 100644 --- a/scripts/transactions/discord/mainnet-setup.ts +++ b/scripts/transactions/discord/mainnet-setup.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { TransactionBlock } from '@mysten/sui.js/transactions'; +import { Transaction } from '@mysten/sui/transactions'; import { mainPackage } from '../../config/constants'; import { authorizeApp } from '../../init/authorization'; @@ -10,7 +10,7 @@ import { prepareMultisigTx } from '../../utils/utils'; import { authorizeDiscordApp } from './discord'; export const prepareMainnetSetupPTB = async () => { - const txb = new TransactionBlock(); + const txb = new Transaction(); const config = mainPackage.mainnet; Packages('mainnet').Coupons.setupFunction({ diff --git a/scripts/transactions/discord/user.ts b/scripts/transactions/discord/user.ts index 1180162b..a4e226d0 100644 --- a/scripts/transactions/discord/user.ts +++ b/scripts/transactions/discord/user.ts @@ -1,13 +1,12 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { bcs } from '@mysten/sui.js/bcs'; -import { TransactionBlock } from '@mysten/sui.js/transactions'; +import { Transaction } from '@mysten/sui/transactions'; import { PackageInfo } from '../../config/constants'; export const attachRoles = ( - tx: TransactionBlock, + tx: Transaction, discordId: string, roles: number[], signature: Uint8Array, @@ -16,17 +15,17 @@ export const attachRoles = ( tx.moveCall({ target: `${config.discord?.packageId}::discord::attach_roles`, arguments: [ - tx.object(config.discord?.discordObjectId), - tx.pure(bcs.vector(bcs.U8).serialize([...signature])), + tx.object(config.discord?.discordObjectId ?? ''), + tx.pure.vector('u8', [...signature]), tx.pure.string(discordId), - tx.pure(bcs.vector(bcs.U8).serialize([...roles])), + tx.pure.vector('u8', [...roles]), ], }); }; /** Set the address of a discord_id */ export const setAddress = ( - tx: TransactionBlock, + tx: Transaction, discordId: string, signature: Uint8Array, config: PackageInfo, @@ -34,8 +33,8 @@ export const setAddress = ( tx.moveCall({ target: `${config.discord?.packageId}::discord::set_address`, arguments: [ - tx.object(config.discord?.discordObjectId), - tx.pure(bcs.vector(bcs.U8).serialize([...signature])), + tx.object(config.discord?.discordObjectId ?? ''), + tx.pure.vector('u8', [...signature]), tx.pure.string(discordId), ], }); diff --git a/scripts/transactions/free-three-digit.ts b/scripts/transactions/free-three-digit.ts index 7c801745..5e007e64 100644 --- a/scripts/transactions/free-three-digit.ts +++ b/scripts/transactions/free-three-digit.ts @@ -1,6 +1,6 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { TransactionBlock } from '@mysten/sui.js/transactions'; +import { Transaction } from '@mysten/sui/transactions'; import { mainPackage } from '../config/constants'; import { PercentageOffCoupon } from '../coupons/coupon'; @@ -11,7 +11,7 @@ import addresses from './addresses.json'; /// with full price. const prepareCoupons = async () => { const pkg = mainPackage.mainnet; - const tx = new TransactionBlock(); + const tx = new Transaction(); const expiration = `1760691600000`; // 2025 Oct 17 09:00:00 UTC diff --git a/scripts/transactions/funds_to_treasury.ts b/scripts/transactions/funds_to_treasury.ts index c733d0b7..a18680af 100644 --- a/scripts/transactions/funds_to_treasury.ts +++ b/scripts/transactions/funds_to_treasury.ts @@ -1,13 +1,13 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { TransactionBlock } from '@mysten/sui.js/transactions'; +import { Transaction } from '@mysten/sui/transactions'; import { mainPackage } from '../config/constants'; import { prepareMultisigTx } from '../utils/utils'; const craftTx = async () => { - const txb = new TransactionBlock(); + const txb = new Transaction(); const config = mainPackage.mainnet; const adminCapObj = txb.object(config.adminCap); @@ -17,7 +17,7 @@ const craftTx = async () => { arguments: [adminCapObj, txb.object(config.suins)], }); - txb.transferObjects([generalProfits], txb.pure(config.treasuryAddress, 'address')); + txb.transferObjects([generalProfits], txb.pure.address(config.treasuryAddress!)); await prepareMultisigTx(txb, 'mainnet', config.adminAddress); }; diff --git a/scripts/transactions/mass-ops.ts b/scripts/transactions/mass-ops.ts index 606e49e6..5142a8b9 100644 --- a/scripts/transactions/mass-ops.ts +++ b/scripts/transactions/mass-ops.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { writeFileSync } from 'fs'; -import { TransactionBlock } from '@mysten/sui.js/transactions'; +import { Transaction } from '@mysten/sui/transactions'; import { mainPackage } from '../config/constants'; import { removeDiscountForType } from '../config/discounts'; @@ -53,7 +53,7 @@ const run = async () => { ]), ]; - const tx = new TransactionBlock(); + const tx = new Transaction(); const NS_TYPE = `${config.packageId}::suins_registration::SuinsRegistration`; diff --git a/scripts/transactions/renewals/authorize_renewals.ts b/scripts/transactions/renewals/authorize_renewals.ts index 8c700f71..3f030145 100644 --- a/scripts/transactions/renewals/authorize_renewals.ts +++ b/scripts/transactions/renewals/authorize_renewals.ts @@ -1,8 +1,8 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { TransactionBlock } from '@mysten/sui.js/transactions'; -import { MIST_PER_SUI } from '@mysten/sui.js/utils'; +import { Transaction } from '@mysten/sui/transactions'; +import { MIST_PER_SUI } from '@mysten/sui/utils'; import dotenv from 'dotenv'; import { mainPackage, Network } from '../../config/constants'; @@ -13,7 +13,7 @@ import { prepareMultisigTx, signAndExecute } from '../../utils/utils'; dotenv.config(); export const authorize = async (network: Network) => { - const txb = new TransactionBlock(); + const txb = new Transaction(); const config = mainPackage[network]; authorizeApp({ diff --git a/scripts/transactions/reserved_names/extend_reserved_names.ts b/scripts/transactions/reserved_names/extend_reserved_names.ts index 34479c43..6b8febf3 100644 --- a/scripts/transactions/reserved_names/extend_reserved_names.ts +++ b/scripts/transactions/reserved_names/extend_reserved_names.ts @@ -1,8 +1,8 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { SuiObjectRef } from '@mysten/sui.js/client'; -import { TransactionArgument, TransactionBlock } from '@mysten/sui.js/transactions'; -import { MIST_PER_SUI, SUI_CLOCK_OBJECT_ID } from '@mysten/sui.js/utils'; +import { SuiObjectRef } from '@mysten/sui/client'; +import { Transaction, TransactionArgument } from '@mysten/sui/transactions'; +import { MIST_PER_SUI, SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'; import { mainPackage, PackageInfo } from '../../config/constants'; import reservedObjects from '../../reserved-names/owned-objects.json'; @@ -62,7 +62,7 @@ const parseReservedObjects = () => { parseReservedObjects(); // Does withdraw from suins and returns the funds to be used in the PTB. -const withdrawTx = (txb: TransactionBlock, config: PackageInfo) => { +const withdrawTx = (txb: Transaction, config: PackageInfo) => { return txb.moveCall({ target: `${config.packageId}::suins::withdraw`, arguments: [txb.object(config.adminCap), txb.object(config.suins)], @@ -70,7 +70,7 @@ const withdrawTx = (txb: TransactionBlock, config: PackageInfo) => { }; const renewTx = ( - txb: TransactionBlock, + txb: Transaction, config: PackageInfo, name: SuiObjectRef, price: bigint, @@ -85,7 +85,7 @@ const renewTx = ( version: name.version, digest: name.digest, }), - txb.pure(5), + txb.pure.u8(5), splitFrom, txb.object(SUI_CLOCK_OBJECT_ID), ], @@ -94,7 +94,7 @@ const renewTx = ( /// First transaction will process 1K 5+ letter names. export const prepareFirstTransaction = async () => { - const txb = new TransactionBlock(); + const txb = new Transaction(); const config = mainPackage.mainnet; // let's work with the first batch of 5Plus names (so we need 10 SUI / name (2*5)) @@ -104,12 +104,12 @@ export const prepareFirstTransaction = async () => { // split 500 + 341 coins txb.splitCoins( coin, - [...Array(500).keys()].map((x) => txb.pure(YEARS_TO_RENEW * PRICE_LIST.fivePlus)), + [...Array(500).keys()].map((x) => txb.pure.u64(YEARS_TO_RENEW * PRICE_LIST.fivePlus)), ); txb.splitCoins( coin, [...Array(batchToWork.length - 500).keys()].map((x) => - txb.pure(YEARS_TO_RENEW * PRICE_LIST.fivePlus), + txb.pure.u64(YEARS_TO_RENEW * PRICE_LIST.fivePlus), ), ); @@ -130,7 +130,7 @@ export const prepareFirstTransaction = async () => { // merge as one and send to admin txb.mergeCoins(coin, [coin2]); - txb.transferObjects([coin], txb.pure(config.adminAddress, 'address')); + txb.transferObjects([coin], txb.pure.address(config.adminAddress)); return prepareMultisigTx(txb, 'mainnet'); }; @@ -139,7 +139,7 @@ export const prepareFirstTransaction = async () => { /// gas coin object ID. /// Both the second and the third are again operating on 1K 5+ letter names. export const prepareInbetweenTransactions = async (run: string) => { - const txb = new TransactionBlock(); + const txb = new Transaction(); const config = mainPackage.mainnet; const index = run === '2' ? 1 : run === '3' ? 2 : 3; @@ -152,16 +152,18 @@ export const prepareInbetweenTransactions = async (run: string) => { // split 500 txb.splitCoins( txb.gas, - [...Array(500).keys()].map((x) => txb.pure(YEARS_TO_RENEW * PRICE_LIST.fivePlus)), + [...Array(500).keys()].map((x) => txb.pure.u64(YEARS_TO_RENEW * PRICE_LIST.fivePlus)), ); txb.splitCoins( txb.gas, - [...Array(batchSize - 500).keys()].map((x) => txb.pure(YEARS_TO_RENEW * PRICE_LIST.fivePlus)), + [...Array(batchSize - 500).keys()].map((x) => + txb.pure.u64(YEARS_TO_RENEW * PRICE_LIST.fivePlus), + ), ); } else { txb.splitCoins( txb.gas, - [...Array(batchSize).keys()].map((x) => txb.pure(YEARS_TO_RENEW * PRICE_LIST.fivePlus)), + [...Array(batchSize).keys()].map((x) => txb.pure.u64(YEARS_TO_RENEW * PRICE_LIST.fivePlus)), ); } @@ -186,20 +188,16 @@ export const prepareInbetweenTransactions = async (run: string) => { }; export const prepareLastTransaction = async () => { - const txb = new TransactionBlock(); + const txb = new Transaction(); const config = mainPackage.mainnet; txb.splitCoins( txb.gas, - [...Array(names.four.length).keys()].map((x) => txb.pure(YEARS_TO_RENEW * PRICE_LIST.four)), + [...Array(names.four.length).keys()].map((x) => txb.pure.u64(YEARS_TO_RENEW * PRICE_LIST.four)), ); // now we shall handle 4 letter names (that's 50 sui / name) for (const [idx, name] of names.four.entries()) { - renewTx(txb, config, name, PRICE_LIST.four, { - kind: 'NestedResult', - index: 0, - resultIndex: idx, - }); + renewTx(txb, config, name, PRICE_LIST.four, { NestedResult: [0, idx] }); } const firstWithdrawal = withdrawTx(txb, config); @@ -215,7 +213,7 @@ export const prepareLastTransaction = async () => { config, name, PRICE_LIST.three, - txb.splitCoins(txb.gas, [txb.pure(YEARS_TO_RENEW * PRICE_LIST.three)]), + txb.splitCoins(txb.gas, [txb.pure.u64(YEARS_TO_RENEW * PRICE_LIST.three)]), ); } // we re-get some money to have enough balance for the last batch. @@ -226,8 +224,8 @@ export const prepareLastTransaction = async () => { // transfer profits to treasury in the same PTB :) // We transfer 47K from the SuiNS app profits. txb.transferObjects( - [txb.splitCoins(txb.gas, [txb.pure(47_350n * MIST_PER_SUI)])], - txb.pure(ADDRESS_TO_TRANSFER_FUNDS, 'address'), + [txb.splitCoins(txb.gas, [txb.pure.u64(47_350n * MIST_PER_SUI)])], + txb.pure.address(ADDRESS_TO_TRANSFER_FUNDS), ); return prepareMultisigTx(txb, 'mainnet'); diff --git a/scripts/utils/utils.ts b/scripts/utils/utils.ts index 9cf00b1c..d8add735 100644 --- a/scripts/utils/utils.ts +++ b/scripts/utils/utils.ts @@ -2,16 +2,15 @@ // SPDX-License-Identifier: Apache-2.0 import { execFileSync, execSync } from 'child_process'; import fs, { readFileSync } from 'fs'; -import { mkdtemp } from 'fs/promises'; -import { homedir, tmpdir } from 'os'; +import { homedir } from 'os'; import path from 'path'; -import { getFullnodeUrl, SuiClient } from '@mysten/sui.js/client'; -import { decodeSuiPrivateKey } from '@mysten/sui.js/cryptography'; -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 { TransactionBlock, UpgradePolicy } from '@mysten/sui.js/transactions'; -import { fromB64, toB64 } from '@mysten/sui.js/utils'; +import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import { decodeSuiPrivateKey } from '@mysten/sui/cryptography'; +import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519'; +import { Secp256k1Keypair } from '@mysten/sui/keypairs/secp256k1'; +import { Secp256r1Keypair } from '@mysten/sui/keypairs/secp256r1'; +import { Transaction, UpgradePolicy } from '@mysten/sui/transactions'; +import { fromBase64, toB64, toBase64 } from '@mysten/sui/utils'; import { Network } from '../init/packages'; @@ -21,7 +20,7 @@ export const getActiveAddress = () => { return execSync(`${SUI} client active-address`, { encoding: 'utf8' }).trim(); }; -export const publishPackage = (txb: TransactionBlock, path: string, configPath?: string) => { +export const publishPackage = (txb: Transaction, path: string, configPath?: string) => { const command = [ 'move', ...(configPath ? ['--client.config', configPath] : []), @@ -51,7 +50,7 @@ export const publishPackage = (txb: TransactionBlock, path: string, configPath?: }; export const upgradePackage = ( - txb: TransactionBlock, + txb: Transaction, path: string, packageId: string, upgradeCapId: string, @@ -72,7 +71,7 @@ export const upgradePackage = ( const receipt = txb.upgrade({ modules, dependencies, - packageId, + package: packageId, ticket, }); @@ -102,7 +101,7 @@ export const getSigner = () => { ); for (const priv of keystore) { - const raw = fromB64(priv); + const raw = fromBase64(priv); if (raw[0] !== 0) { continue; } @@ -123,12 +122,12 @@ export const getClient = (network: Network) => { }; /// A helper to sign & execute a transaction. -export const signAndExecute = async (txb: TransactionBlock, network: Network) => { +export const signAndExecute = async (txb: Transaction, network: Network) => { const client = getClient(network); const signer = getSigner(); - return client.signAndExecuteTransactionBlock({ - transactionBlock: txb, + return client.signAndExecuteTransaction({ + transaction: txb, signer, options: { showEffects: true, @@ -140,7 +139,7 @@ export const signAndExecute = async (txb: TransactionBlock, network: Network) => /// Builds a transaction (unsigned) and saves it on `setup/tx/tx-data.txt` (on production) /// or `setup/src/tx-data.local.txt` on mainnet. export const prepareMultisigTx = async ( - tx: TransactionBlock, + tx: Transaction, network: Network, address?: string, ) => { @@ -166,9 +165,9 @@ export const prepareMultisigTx = async ( if (!dryRun) throw new Error('This transaction failed.'); tx.build({ - client: client, + client, }).then((bytes) => { - let serializedBase64 = toB64(bytes); + let serializedBase64 = toBase64(bytes); const output_location = process.env.NODE_ENV === 'development' ? './tx/tx-data-local.txt' : './tx/tx-data.txt'; @@ -178,7 +177,7 @@ export const prepareMultisigTx = async ( }; /// Fetch the gas Object and setup the payment for the tx. -async function setupGasPayment(tx: TransactionBlock, gasObjectId: string, client: SuiClient) { +async function setupGasPayment(tx: Transaction, gasObjectId: string, client: SuiClient) { const gasObject = await client.getObject({ id: gasObjectId, }); @@ -196,7 +195,7 @@ async function setupGasPayment(tx: TransactionBlock, gasObjectId: string, client } /// A helper to dev inspect a transaction. -async function inspectTransaction(tx: TransactionBlock, client: SuiClient) { +async function inspectTransaction(tx: Transaction, client: SuiClient) { const result = await client.dryRunTransactionBlock({ transactionBlock: await tx.build({ client: client }), }); diff --git a/sdk/package.json b/sdk/package.json index 5d7bfcd7..b8c1994c 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -44,7 +44,7 @@ "node": ">=16" }, "dependencies": { - "@mysten/sui": "^1.8.0" + "@mysten/sui": "^1.12.0" }, "devDependencies": { "@types/tmp": "^0.2.3", diff --git a/sdk/test/live.test.ts b/sdk/test/live.test.ts index 7e9de21c..1f82cbae 100644 --- a/sdk/test/live.test.ts +++ b/sdk/test/live.test.ts @@ -8,7 +8,6 @@ import { e2eLiveNetworkDryRunFlow } from './pre-built'; describe('it should work on live networks', () => { it('should work on mainnet', async () => { const res = await e2eLiveNetworkDryRunFlow('mainnet'); - expect(res.effects.status.status).toEqual('success'); }); diff --git a/sdk/test/pre-built.ts b/sdk/test/pre-built.ts index a8c3de86..1756dbe1 100644 --- a/sdk/test/pre-built.ts +++ b/sdk/test/pre-built.ts @@ -111,6 +111,24 @@ export const e2eLiveNetworkDryRunFlow = async (network: 'mainnet' | 'testnet') = tx.setSender(sender); + if (network === 'mainnet') { + tx.setGasPayment([ + { + objectId: '0xc7fcf957faeb0cdd9809b2ab43e0a8bf7a945cfdac13e8cba527261fecefa4dd', + version: '86466933', + digest: '2F8iuFVJm55J96FnJ99Th493D254BaJkUccbwz5rHFDc', + }, + ]); + } else if (network === 'testnet') { + tx.setGasPayment([ + { + objectId: '0xeb709b97ca3e87e385d019ccb7da4a9bd99f9405f9b0d692f21c9d2e5714f27a', + version: '169261602', + digest: 'HJehhEV1N8rqjjHbwDgjeCZJkHPRavMmihTvyTJme2rA', + }, + ]); + } + return client.dryRunTransactionBlock({ transactionBlock: await tx.build({ client, diff --git a/sdk/test/setup.ts b/sdk/test/setup.ts index c3212d14..b5aaa3aa 100644 --- a/sdk/test/setup.ts +++ b/sdk/test/setup.ts @@ -28,7 +28,8 @@ export async function publishAndSetupSuinsContracts(toolbox: TestToolbox): Promi // we need to set this to a temp file, so that the client uses the correct config. CLIENT_CONFIG_FILE: toolbox.configPath, }, - // stdio: 'inherit', + // keep logs. + stdio: 'inherit', encoding: 'utf8', }); diff --git a/sdk/test/toolbox.ts b/sdk/test/toolbox.ts index 6ebfc48c..fc2539d6 100644 --- a/sdk/test/toolbox.ts +++ b/sdk/test/toolbox.ts @@ -43,7 +43,7 @@ export function getClient(): SuiClient { }); } -// TODO: expose these testing utils from @mysten/sui.js +// TODO: expose these testing utils from @mysten/sui export async function setupSuiClient() { const keypair = Ed25519Keypair.generate(); const address = keypair.getPublicKey().toSuiAddress();