diff --git a/.changeset/weak-kings-marry.md b/.changeset/weak-kings-marry.md new file mode 100644 index 00000000..5f877fc4 --- /dev/null +++ b/.changeset/weak-kings-marry.md @@ -0,0 +1,5 @@ +--- +'@axelar-network/axelar-cgp-sui': minor +--- + +Update to the new Sui SDK diff --git a/package-lock.json b/package-lock.json index 66b268d2..d41e9dae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,17 @@ { "name": "@axelar-network/axelar-cgp-sui", - "version": "0.1.0", + "version": "0.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@axelar-network/axelar-cgp-sui", - "version": "0.1.0", + "version": "0.2.0", "hasInstallScript": true, "license": "MIT", "dependencies": { "@cosmjs/cosmwasm-stargate": "^0.32.2", - "@mysten/sui.js": "^0.54.1", + "@mysten/sui": "^1.3.0", "@types/tmp": "^0.2.6", "child_process": "^1.0.2", "ethers": "^5.0.0", @@ -1716,12 +1716,12 @@ } }, "node_modules/@gql.tada/cli-utils": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@gql.tada/cli-utils/-/cli-utils-1.5.0.tgz", - "integrity": "sha512-BqbrcpKmE2FyM3tQgK3vzTIn1ghCOf+lH9MThPow7NbtS9K2+bH4u/1fPAhZMR1Zg5GExKsDvij+zLP64Ge6Ig==", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@gql.tada/cli-utils/-/cli-utils-1.5.1.tgz", + "integrity": "sha512-JVLpoXLa4msrE7MHnmW/7fYnIl8dncLom8T/Ghsxu+Kz5iMGnzK2joJN5cZt4ewCAqfCV3HZZ0VH189OalGd9g==", "dependencies": { "@0no-co/graphqlsp": "^1.12.9", - "@gql.tada/internal": "1.0.3", + "@gql.tada/internal": "1.0.4", "@vue/compiler-dom": "^3.4.23", "@vue/language-core": "^2.0.17", "graphql": "^15.5.0 || ^16.0.0 || ^17.0.0", @@ -1734,9 +1734,9 @@ } }, "node_modules/@gql.tada/internal": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@gql.tada/internal/-/internal-1.0.3.tgz", - "integrity": "sha512-n52/OjAkoPsX4ZyEufFBnncjnv0UrbXKs4OUG66db8gxtV5437EkLjI4MTAI1M6dsaj+VLi0unpraPPPbFR59A==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@gql.tada/internal/-/internal-1.0.4.tgz", + "integrity": "sha512-tq0rgoqjhdVqKWEsbrkiX7Qpp5gA4/Br9r9TVBeh3WpJIcuGh5U48UjB4IOxtXBePZdX8E0oc07GjOid/P60Wg==", "dependencies": { "@0no-co/graphql.web": "^1.0.5" }, @@ -1995,36 +1995,36 @@ } }, "node_modules/@mysten/bcs": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.11.1.tgz", - "integrity": "sha512-xP85isNSYUCHd3O/g+TmZYmg4wK6cU8q/n/MebkIGP4CYVJZz2wU/G24xIZ3wI+0iTop4dfgA5kYrg/DQKCUzA==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-1.0.3.tgz", + "integrity": "sha512-fc2xDj8eteP18zCNr6WStlE0Hxi7kYeY9yAzAN8oyz5EYOLas0JwScR9pAd9VR61BfIThJ+5vxQ6K7Y22lHDVQ==", "dependencies": { - "bs58": "^5.0.0" + "bs58": "^6.0.0" } }, - "node_modules/@mysten/sui.js": { - "version": "0.54.1", - "resolved": "https://registry.npmjs.org/@mysten/sui.js/-/sui.js-0.54.1.tgz", - "integrity": "sha512-TSmGIX7U9O/uS9EKIQdv7/S69KTbBhMJVelXCafJE6IJw8iB9cN9uLu0+uklkBSDrbRmLSEY70jMr3uRFjReIg==", + "node_modules/@mysten/sui": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@mysten/sui/-/sui-1.3.0.tgz", + "integrity": "sha512-KBEM+nzY30i+S1meWage5jU+upNBGSrZxY5v+oz68gj1VluldWwiaf/LtcZ3RnMcnNtkyMkeYpDL9eiMxTBTbQ==", "dependencies": { "@graphql-typed-document-node/core": "^3.2.0", - "@mysten/bcs": "0.11.1", - "@noble/curves": "^1.1.0", - "@noble/hashes": "^1.3.1", - "@scure/bip32": "^1.3.1", - "@scure/bip39": "^1.2.1", + "@mysten/bcs": "1.0.3", + "@noble/curves": "^1.4.2", + "@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.0", - "graphql": "^16.8.1", - "superstruct": "^1.0.3", - "tweetnacl": "^1.0.3" + "gql.tada": "^1.8.2", + "graphql": "^16.9.0", + "tweetnacl": "^1.0.3", + "valibot": "^0.36.0" }, "engines": { - "node": ">=16" + "node": ">=18" } }, - "node_modules/@mysten/sui.js/node_modules/bech32": { + "node_modules/@mysten/sui/node_modules/bech32": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz", "integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==" @@ -2406,37 +2406,37 @@ "dev": true }, "node_modules/@volar/language-core": { - "version": "2.4.0-alpha.15", - "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.0-alpha.15.tgz", - "integrity": "sha512-mt8z4Fm2WxfQYoQHPcKVjLQV6PgPqyKLbkCVY2cr5RSaamqCHjhKEpsFX66aL4D/7oYguuaUw9Bx03Vt0TpIIA==", + "version": "2.4.0-alpha.16", + "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.0-alpha.16.tgz", + "integrity": "sha512-oOTnIZlx0P/idFwVw+W0NbzKDtZAQMzXSdIFfTePCKcXlb4Ys12GaGkx8NF9dsvPYV3nbv3ZsSxnkZWBmNKd7A==", "dependencies": { - "@volar/source-map": "2.4.0-alpha.15" + "@volar/source-map": "2.4.0-alpha.16" } }, "node_modules/@volar/source-map": { - "version": "2.4.0-alpha.15", - "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.0-alpha.15.tgz", - "integrity": "sha512-8Htngw5TmBY4L3ClDqBGyfLhsB8EmoEXUH1xydyEtEoK0O6NX5ur4Jw8jgvscTlwzizyl/wsN1vn0cQXVbbXYg==" + "version": "2.4.0-alpha.16", + "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.0-alpha.16.tgz", + "integrity": "sha512-sL9vNG7iR2hiKZor7UkD5Sufu3QCia4cbp2gX/nGRNSdaPbhOpdAoavwlBm0PrVkpiA19NZuavZoobD8krviFg==" }, "node_modules/@vue/compiler-core": { - "version": "3.4.31", - "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.31.tgz", - "integrity": "sha512-skOiodXWTV3DxfDhB4rOf3OGalpITLlgCeOwb+Y9GJpfQ8ErigdBUHomBzvG78JoVE8MJoQsb+qhZiHfKeNeEg==", + "version": "3.4.33", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.33.tgz", + "integrity": "sha512-MoIREbkdPQlnGfSKDMgzTqzqx5nmEjIc0ydLVYlTACGBsfvOJ4tHSbZXKVF536n6fB+0eZaGEOqsGThPpdvF5A==", "dependencies": { "@babel/parser": "^7.24.7", - "@vue/shared": "3.4.31", + "@vue/shared": "3.4.33", "entities": "^4.5.0", "estree-walker": "^2.0.2", "source-map-js": "^1.2.0" } }, "node_modules/@vue/compiler-dom": { - "version": "3.4.31", - "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.31.tgz", - "integrity": "sha512-wK424WMXsG1IGMyDGyLqB+TbmEBFM78hIsOJ9QwUVLGrcSk0ak6zYty7Pj8ftm7nEtdU/DGQxAXp0/lM/2cEpQ==", + "version": "3.4.33", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.33.tgz", + "integrity": "sha512-GzB8fxEHKw0gGet5BKlpfXEqoBnzSVWwMnT+dc25wE7pFEfrU/QsvjZMP9rD4iVXHBBoemTct8mN0GJEI6ZX5A==", "dependencies": { - "@vue/compiler-core": "3.4.31", - "@vue/shared": "3.4.31" + "@vue/compiler-core": "3.4.33", + "@vue/shared": "3.4.33" } }, "node_modules/@vue/language-core": { @@ -2463,9 +2463,9 @@ } }, "node_modules/@vue/shared": { - "version": "3.4.31", - "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.31.tgz", - "integrity": "sha512-Yp3wtJk//8cO4NItOPpi3QkLExAr/aLBGZMmTtW9WpdwBCJpRM6zj9WgWktXAl8IDIozwNMByT45JP3tO3ACWA==" + "version": "3.4.33", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.33.tgz", + "integrity": "sha512-aoRY0jQk3A/cuvdkodTrM4NMfxco8n55eG4H7ML/CRy7OryHfiqvug4xrCBBMbbN+dvXAetDDwZW9DXWWjBntA==" }, "node_modules/acorn": { "version": "8.12.1", @@ -2729,12 +2729,12 @@ } }, "node_modules/axobject-query": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.0.0.tgz", - "integrity": "sha512-+60uv1hiVFhHZeO+Lz0RYzsVHy5Wr1ayX0mwda9KPDVLNJgZ1T9Ny7VmFbLDzxsH0D87I86vgj3gFrjTJUYznw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", + "integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==", "peer": true, - "dependencies": { - "dequal": "^2.0.3" + "engines": { + "node": ">= 0.4" } }, "node_modules/balanced-match": { @@ -2743,9 +2743,9 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "node_modules/base-x": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", - "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-5.0.0.tgz", + "integrity": "sha512-sMW3VGSX1QWVFA6l8U62MLKz29rRfpTlYdCqLdpLo1/Yd4zZwSbnUaDfciIAowAqvq7YFnWq9hrhdg1KYgc1lQ==" }, "node_modules/base64-js": { "version": "1.5.1", @@ -2864,11 +2864,11 @@ } }, "node_modules/bs58": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", - "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-6.0.0.tgz", + "integrity": "sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw==", "dependencies": { - "base-x": "^4.0.0" + "base-x": "^5.0.0" } }, "node_modules/call-bind": { @@ -4652,14 +4652,14 @@ } }, "node_modules/gql.tada": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/gql.tada/-/gql.tada-1.8.1.tgz", - "integrity": "sha512-SKiWid+21JP1rCqXsWJr+A+fPcEUY2kz4XcQ6marzbMaFyXaf8LSLdYQPaZAFfqQ6tP2ZabG6Al7RFYByAsZwg==", + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/gql.tada/-/gql.tada-1.8.2.tgz", + "integrity": "sha512-LLt+2RcLY6i+Rq+LQQwx3uiEAPfA+pmEaAo/bJjUdaV1CVJBy3Wowds6GHeerW5kvekRM/XdbPTJw5OvnLq/DQ==", "dependencies": { "@0no-co/graphql.web": "^1.0.5", "@0no-co/graphqlsp": "^1.12.9", - "@gql.tada/cli-utils": "1.5.0", - "@gql.tada/internal": "1.0.3" + "@gql.tada/cli-utils": "1.5.1", + "@gql.tada/internal": "1.0.4" }, "bin": { "gql-tada": "bin/cli.js", @@ -6881,14 +6881,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/superstruct": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-1.0.4.tgz", - "integrity": "sha512-7JpaAoX2NGyoFlI9NBh66BQXGONc+uE+MRS5i2iOBKuS4e+ccgMDjATgZldkah+33DakBxDHiss9kvUcGAO8UQ==", - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -7247,6 +7239,11 @@ "punycode": "^2.1.0" } }, + "node_modules/valibot": { + "version": "0.36.0", + "resolved": "https://registry.npmjs.org/valibot/-/valibot-0.36.0.tgz", + "integrity": "sha512-CjF1XN4sUce8sBK9TixrDqFM7RwNkuXdJu174/AwmQUB62QbCQADg5lLe8ldBalFgtj1uKj+pKwDJiNo4Mn+eQ==" + }, "node_modules/vue-template-compiler": { "version": "2.7.16", "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.7.16.tgz", diff --git a/package.json b/package.json index 620b65ed..a7dd70d9 100644 --- a/package.json +++ b/package.json @@ -37,13 +37,13 @@ }, "dependencies": { "@cosmjs/cosmwasm-stargate": "^0.32.2", - "@mysten/sui.js": "^0.54.1", + "@mysten/sui": "^1.3.0", + "@types/tmp": "^0.2.6", "child_process": "^1.0.2", "ethers": "^5.0.0", "fs": "^0.0.1-security", "secp256k1": "^5.0.0", - "tmp": "^0.2.1", - "@types/tmp": "^0.2.6" + "tmp": "^0.2.1" }, "devDependencies": { "@changesets/cli": "^2.27.6", diff --git a/src/bcs.ts b/src/bcs.ts index fc1f3def..f9c480df 100644 --- a/src/bcs.ts +++ b/src/bcs.ts @@ -1,4 +1,4 @@ -import { bcs } from '@mysten/sui.js/bcs'; +import { bcs } from '@mysten/sui/bcs'; function getAxelarStructs() { const Bytes32 = bcs.Address; diff --git a/src/tx-builder.ts b/src/tx-builder.ts index 0827a4c8..a20fbc6f 100644 --- a/src/tx-builder.ts +++ b/src/tx-builder.ts @@ -8,9 +8,9 @@ import { SuiObjectChange, SuiTransactionBlockResponse, SuiTransactionBlockResponseOptions, -} from '@mysten/sui.js/client'; -import { Keypair } from '@mysten/sui.js/dist/cjs/cryptography'; -import { TransactionBlock, TransactionObjectInput, TransactionResult } from '@mysten/sui.js/transactions'; +} from '@mysten/sui/client'; +import { Keypair } from '@mysten/sui/dist/cjs/cryptography'; +import { Transaction, TransactionObjectInput, TransactionResult } from '@mysten/sui/transactions'; import { Bytes, utils as ethersUtils } from 'ethers'; import tmp from 'tmp'; import { updateMoveToml } from './utils'; @@ -32,7 +32,7 @@ function updateCache(objectChanges: SuiObjectChange[]) { } } -function getObject(tx: TransactionBlock, object: TransactionObjectInput): TransactionObjectInput { +function getObject(tx: Transaction, object: TransactionObjectInput): TransactionObjectInput { if (Array.isArray(object)) { object = hexlify(object); } @@ -78,7 +78,7 @@ function getTypeName(type: SuiMoveNormalizedType): string { return (type as string).toLowerCase(); } -function getNestedStruct(tx: TransactionBlock, type: SuiMoveNormalizedType, arg: TransactionObjectInput): null | TransactionObjectInput { +function getNestedStruct(tx: Transaction, type: SuiMoveNormalizedType, arg: TransactionObjectInput): null | TransactionObjectInput { // eslint-disable-next-line @typescript-eslint/no-explicit-any let inside = type as any; @@ -105,12 +105,12 @@ function getNestedStruct(tx: TransactionBlock, type: SuiMoveNormalizedType, arg: const typeName = getTypeName((type as { Vector: SuiMoveNormalizedType }).Vector); return tx.makeMoveVec({ type: typeName, - objects: nested, + elements: nested, }); } function serialize( - tx: TransactionBlock, + tx: Transaction, type: SuiMoveNormalizedType, arg: TransactionObjectInput, ): @@ -199,10 +199,10 @@ function isString(parameter: SuiMoveNormalizedType): boolean { export class TxBuilder { client: SuiClient; - tx: TransactionBlock; + tx: Transaction; constructor(client: SuiClient) { this.client = client; - this.tx = new TransactionBlock(); + this.tx = new Transaction(); } async moveCall(moveCallInfo: { @@ -283,8 +283,8 @@ export class TxBuilder { } async signAndExecute(keypair: Keypair, options: SuiTransactionBlockResponseOptions): Promise<SuiTransactionBlockResponse> { - let result = await this.client.signAndExecuteTransactionBlock({ - transactionBlock: this.tx, + let result = await this.client.signAndExecuteTransaction({ + transaction: this.tx, signer: keypair, options: { showEffects: true, diff --git a/src/types.ts b/src/types.ts index 4a33ed47..9fb91713 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,4 +1,4 @@ -const { bcs } = require('@mysten/sui.js/bcs'); +const { bcs } = require('@mysten/sui/bcs'); const { fromHEX, toHEX } = require('@mysten/bcs'); export const UID = bcs.fixedArray(32, bcs.u8()).transform({ diff --git a/src/utils.ts b/src/utils.ts index 17e0a920..a51005ae 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,5 +1,5 @@ import fs from 'fs'; -import { getFullnodeUrl } from '@mysten/sui.js/client'; +import { getFullnodeUrl } from '@mysten/sui/client'; export function getModuleNameFromSymbol(symbol: string) { function isNumber(char: string) { diff --git a/test/axelar-gateway.js b/test/axelar-gateway.js index c454ccb5..93182a4a 100644 --- a/test/axelar-gateway.js +++ b/test/axelar-gateway.js @@ -1,7 +1,7 @@ -const { SuiClient, getFullnodeUrl } = require('@mysten/sui.js/client'); -const { Ed25519Keypair } = require('@mysten/sui.js/keypairs/ed25519'); -const { Secp256k1Keypair } = require('@mysten/sui.js/keypairs/secp256k1'); -const { requestSuiFromFaucetV0, getFaucetHost } = require('@mysten/sui.js/faucet'); +const { SuiClient, getFullnodeUrl } = require('@mysten/sui/client'); +const { Ed25519Keypair } = require('@mysten/sui/keypairs/ed25519'); +const { Secp256k1Keypair } = require('@mysten/sui/keypairs/secp256k1'); +const { requestSuiFromFaucetV0, getFaucetHost } = require('@mysten/sui/faucet'); const { publishPackage, getRandomBytes32, expectRevert, expectEvent } = require('./utils'); const { TxBuilder } = require('../dist/tx-builder'); const {