From 666a2f1864f5aa40873b6004a14d931c1c1093cd Mon Sep 17 00:00:00 2001 From: Fuyao Zhao Date: Mon, 18 Sep 2023 23:46:02 -0700 Subject: [PATCH] chore(deps): upgrade with new typemove package (#620) --- package.json | 2 +- packages/sdk/package.json | 10 +-- packages/sdk/src/aptos/move-coder.ts | 6 +- packages/sdk/src/aptos/network.ts | 10 +++ packages/sdk/src/sui/move-coder.ts | 6 +- packages/sdk/src/sui/network.ts | 7 +- pnpm-lock.yaml | 123 ++++++--------------------- 7 files changed, 50 insertions(+), 114 deletions(-) diff --git a/package.json b/package.json index 5275993a01..4c8eae77fd 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "eslint": "^8.48.0", "eslint-config-prettier": "^9.0.0", "eslint-import-resolver-typescript": "^3.6.0", - "eslint-plugin-deprecation": "^1.5.0", + "eslint-plugin-deprecation": "^2.0.0", "eslint-plugin-import": "^2.28.1", "eslint-plugin-unused-imports": "^3.0.0", "jest": "^29.6.4", diff --git a/packages/sdk/package.json b/packages/sdk/package.json index fd9b2d6b9e..8e868e7970 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -57,7 +57,7 @@ }, "dependencies": { "@coral-xyz/borsh": "^0.28.0", - "@mysten/sui.js": "^0.41.0", + "@mysten/sui.js": "~0.41.0", "@project-serum/anchor": "^0.26.0", "@sentio/bigdecimal": "^9.1.1-patch.3", "@sentio/chain": "^1.0.4", @@ -65,10 +65,10 @@ "@sentio/protos": "workspace:*", "@sentio/runtime": "workspace:^", "@solana/web3.js": "^1.78.3", - "@typemove/aptos": "^1.1.0", - "@typemove/move": "^1.1.0", - "@typemove/sui": "^1.1.0", - "aptos": "^1.19.0", + "@typemove/aptos": "~1.2.0", + "@typemove/move": "~1.2.0", + "@typemove/sui": "~1.2.0", + "aptos": "~1.19.0", "aptos-sdk": "npm:aptos@^1.19.0", "bs58": "^5.0.0", "chalk": "^5.2.0", diff --git a/packages/sdk/src/aptos/move-coder.ts b/packages/sdk/src/aptos/move-coder.ts index fe2c9a156b..78c610413c 100644 --- a/packages/sdk/src/aptos/move-coder.ts +++ b/packages/sdk/src/aptos/move-coder.ts @@ -1,8 +1,8 @@ -import { AptosNetwork, getRpcEndpoint } from './network.js' +import { AptosNetwork, getClient } from './network.js' import { MoveCoder } from '@typemove/aptos' -const MOVE_CODER = new MoveCoder(getRpcEndpoint(AptosNetwork.MAIN_NET)) -const TESTNET_MOVE_CODER = new MoveCoder(getRpcEndpoint(AptosNetwork.TEST_NET)) +const MOVE_CODER = new MoveCoder(getClient(AptosNetwork.MAIN_NET)) +const TESTNET_MOVE_CODER = new MoveCoder(getClient(AptosNetwork.TEST_NET)) export function defaultMoveCoder(network: AptosNetwork = AptosNetwork.MAIN_NET): MoveCoder { if (network == AptosNetwork.MAIN_NET) { diff --git a/packages/sdk/src/aptos/network.ts b/packages/sdk/src/aptos/network.ts index 26ef73b1e3..170fc9f3ff 100644 --- a/packages/sdk/src/aptos/network.ts +++ b/packages/sdk/src/aptos/network.ts @@ -1,6 +1,7 @@ import { AptosChainId } from '@sentio/chain' import { AptosClient } from 'aptos-sdk' import { Labels } from '../core/index.js' +import { Endpoints } from '@sentio/runtime' export type AptosNetwork = AptosChainId export const AptosNetwork = { @@ -24,3 +25,12 @@ export function getRpcEndpoint(network: AptosNetwork): string { } return 'https://mainnet.aptoslabs.com/' } + +export function getClient(network: AptosNetwork): AptosClient { + let chainServer = Endpoints.INSTANCE.chainServer.get(network) + if (!chainServer) { + chainServer = getRpcEndpoint(network) + // throw new ServerError(Status.INTERNAL, 'RPC endpoint not provided') + } + return new AptosClient(chainServer) +} diff --git a/packages/sdk/src/sui/move-coder.ts b/packages/sdk/src/sui/move-coder.ts index 4350780e59..0871d901c5 100644 --- a/packages/sdk/src/sui/move-coder.ts +++ b/packages/sdk/src/sui/move-coder.ts @@ -1,9 +1,9 @@ import { MoveCoder } from '@typemove/sui' -import { getRpcEndpoint, SuiNetwork } from './network.js' +import { getClient, SuiNetwork } from './network.js' -const MOVE_CODER = new MoveCoder(getRpcEndpoint(SuiNetwork.MAIN_NET)) -const TESTNET_MOVE_CODER = new MoveCoder(getRpcEndpoint(SuiNetwork.TEST_NET)) +const MOVE_CODER = new MoveCoder(getClient(SuiNetwork.MAIN_NET)) +const TESTNET_MOVE_CODER = new MoveCoder(getClient(SuiNetwork.TEST_NET)) export function defaultMoveCoder(network: SuiNetwork = SuiNetwork.MAIN_NET): MoveCoder { if (network == SuiNetwork.MAIN_NET) { diff --git a/packages/sdk/src/sui/network.ts b/packages/sdk/src/sui/network.ts index 67a10e5c71..5a300d6719 100644 --- a/packages/sdk/src/sui/network.ts +++ b/packages/sdk/src/sui/network.ts @@ -1,6 +1,6 @@ import { SuiChainId } from '@sentio/chain' import { Endpoints } from '@sentio/runtime' -import { ServerError, Status } from 'nice-grpc' +// import { ServerError, Status } from 'nice-grpc' import { SuiClient } from '@mysten/sui.js/client' export type SuiNetwork = SuiChainId @@ -11,9 +11,10 @@ export const SuiNetwork = { } export function getClient(network: SuiNetwork): SuiClient { - const chainServer = Endpoints.INSTANCE.chainServer.get(network) + let chainServer = Endpoints.INSTANCE.chainServer.get(network) if (!chainServer) { - throw new ServerError(Status.INTERNAL, 'RPC endpoint not provided') + chainServer = getRpcEndpoint(network) + // throw new ServerError(Status.INTERNAL, 'RPC endpoint not provided') } return new SuiClient({ url: chainServer }) } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d09dfa6157..7d67bb3f37 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -53,8 +53,8 @@ importers: specifier: ^3.6.0 version: 3.6.0(@typescript-eslint/parser@6.5.0)(eslint-plugin-import@2.28.1)(eslint@8.48.0) eslint-plugin-deprecation: - specifier: ^1.5.0 - version: 1.5.0(eslint@8.48.0)(typescript@5.2.2) + specifier: ^2.0.0 + version: 2.0.0(eslint@8.48.0)(typescript@5.2.2) eslint-plugin-import: specifier: ^2.28.1 version: 2.28.1(@typescript-eslint/parser@6.5.0)(eslint-import-resolver-typescript@3.6.0)(eslint@8.48.0) @@ -414,8 +414,8 @@ importers: specifier: ^0.28.0 version: 0.28.0(@solana/web3.js@1.78.3) '@mysten/sui.js': - specifier: ^0.41.0 - version: 0.41.1 + specifier: ~0.41.0 + version: 0.41.2 '@project-serum/anchor': specifier: ^0.26.0 version: 0.26.0 @@ -438,16 +438,16 @@ importers: specifier: ^1.78.3 version: 1.78.3 '@typemove/aptos': - specifier: ^1.1.0 - version: 1.1.0 + specifier: ~1.2.0 + version: 1.2.0 '@typemove/move': - specifier: ^1.1.0 - version: 1.1.0 + specifier: ~1.2.0 + version: 1.2.0 '@typemove/sui': - specifier: ^1.1.0 - version: 1.1.0 + specifier: ~1.2.0 + version: 1.2.0 aptos: - specifier: ^1.19.0 + specifier: ~1.19.0 version: 1.19.0 aptos-sdk: specifier: npm:aptos@^1.19.0 @@ -3527,11 +3527,11 @@ packages: resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} dev: true - /@typemove/aptos@1.1.0: - resolution: {integrity: sha512-+yX7YdswP/P0SBzrnooFRwpXbRqMWFlaGwYgc0C5mzH7UeeXQC+L3zCFmVrD0qJC1r0oAGgS9bewKXk1jkMcsQ==} + /@typemove/aptos@1.2.0: + resolution: {integrity: sha512-wvKvgqAAySm4NPA+95EIiP/0lcmjxITtRTgE5DTRzIra/5NFcuGEdaUhhxI6voonDygCmHEQO2+4jHqx4l9LpA==} hasBin: true dependencies: - '@typemove/move': 1.1.0 + '@typemove/move': 1.2.0 aptos: 1.19.0 chalk: 5.3.0 radash: 11.0.0 @@ -3539,20 +3539,20 @@ packages: - debug dev: false - /@typemove/move@1.1.0: - resolution: {integrity: sha512-nuu7G2YLBaR6TTUXrpCGCxb939Veq1onIsN3Ck6ImAEENNNUPbk+oBChMAfV7SxQR9RW9MWJG7ukSXbIe/KmBA==} + /@typemove/move@1.2.0: + resolution: {integrity: sha512-hihFr9ZUFTVto7J0NxhvqeSozNNoU1tNofFBYqgTdi5UwzqIiS9DDvTdHnKZsWa46y/wy2ne+7aF27IDEvyaZA==} dependencies: chalk: 5.3.0 radash: 11.0.0 dev: false - /@typemove/sui@1.1.0: - resolution: {integrity: sha512-giPwIBGjcMqnlauH87pUkN+RYSZ46HKdRVwAdlPCtAMSkja46/l0ykijv5xjLsXFrQvytV2di7OgPDaE/JyZ0A==} + /@typemove/sui@1.2.0: + resolution: {integrity: sha512-0JWCoSOmmcY27FnEWXgtIh1CrRUAb/3MXWeaKqF6h5Xo/slBR/4uqS2euef/KrLY/MbY9jiYyIELOGC0PV61Kw==} hasBin: true dependencies: '@mysten/bcs': 0.7.4 '@mysten/sui.js': 0.41.2 - '@typemove/move': 1.1.0 + '@typemove/move': 1.2.0 chalk: 5.3.0 radash: 11.0.0 transitivePeerDependencies: @@ -3912,14 +3912,6 @@ packages: - supports-color dev: true - /@typescript-eslint/scope-manager@5.62.0: - resolution: {integrity: sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dependencies: - '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/visitor-keys': 5.62.0 - dev: true - /@typescript-eslint/scope-manager@6.5.0: resolution: {integrity: sha512-A8hZ7OlxURricpycp5kdPTH3XnjG85UpJS6Fn4VzeoH4T388gQJ/PGP4ole5NfKt4WDVhmLaQ/dBLNDC4Xl/Kw==} engines: {node: ^16.0.0 || >=18.0.0} @@ -3948,37 +3940,11 @@ packages: - supports-color dev: true - /@typescript-eslint/types@5.62.0: - resolution: {integrity: sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dev: true - /@typescript-eslint/types@6.5.0: resolution: {integrity: sha512-eqLLOEF5/lU8jW3Bw+8auf4lZSbbljHR2saKnYqON12G/WsJrGeeDHWuQePoEf9ro22+JkbPfWQwKEC5WwLQ3w==} engines: {node: ^16.0.0 || >=18.0.0} dev: true - /@typescript-eslint/typescript-estree@5.62.0(typescript@5.2.2): - resolution: {integrity: sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/visitor-keys': 5.62.0 - debug: 4.3.4 - globby: 11.1.0 - is-glob: 4.0.3 - semver: 7.5.4 - tsutils: 3.21.0(typescript@5.2.2) - typescript: 5.2.2 - transitivePeerDependencies: - - supports-color - dev: true - /@typescript-eslint/typescript-estree@6.5.0(typescript@5.2.2): resolution: {integrity: sha512-q0rGwSe9e5Kk/XzliB9h2LBc9tmXX25G0833r7kffbl5437FPWb2tbpIV9wAATebC/018pGa9fwPDuvGN+LxWQ==} engines: {node: ^16.0.0 || >=18.0.0} @@ -4000,26 +3966,6 @@ packages: - supports-color dev: true - /@typescript-eslint/utils@5.62.0(eslint@8.48.0)(typescript@5.2.2): - resolution: {integrity: sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.48.0) - '@types/json-schema': 7.0.12 - '@types/semver': 7.5.1 - '@typescript-eslint/scope-manager': 5.62.0 - '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.2.2) - eslint: 8.48.0 - eslint-scope: 5.1.1 - semver: 7.5.4 - transitivePeerDependencies: - - supports-color - - typescript - dev: true - /@typescript-eslint/utils@6.5.0(eslint@8.48.0)(typescript@5.2.2): resolution: {integrity: sha512-9nqtjkNykFzeVtt9Pj6lyR9WEdd8npPhhIPM992FWVkZuS6tmxHfGVnlUcjpUP2hv8r4w35nT33mlxd+Be1ACQ==} engines: {node: ^16.0.0 || >=18.0.0} @@ -4039,14 +3985,6 @@ packages: - typescript dev: true - /@typescript-eslint/visitor-keys@5.62.0: - resolution: {integrity: sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dependencies: - '@typescript-eslint/types': 5.62.0 - eslint-visitor-keys: 3.4.3 - dev: true - /@typescript-eslint/visitor-keys@6.5.0: resolution: {integrity: sha512-yCB/2wkbv3hPsh02ZS8dFQnij9VVQXJMN/gbQsaaY+zxALkZnxa/wagvLEFsAWMPv7d7lxQmNsIzGU1w/T/WyA==} engines: {node: ^16.0.0 || >=18.0.0} @@ -6019,13 +5957,13 @@ packages: - supports-color dev: true - /eslint-plugin-deprecation@1.5.0(eslint@8.48.0)(typescript@5.2.2): - resolution: {integrity: sha512-mRcssI/tLROueBQ6yf4LnnGTijbMsTCPIpbRbPj5R5wGYVCpk1zDmAS0SEkgcUDXOPc22qMNFR24Qw7vSPrlTA==} + /eslint-plugin-deprecation@2.0.0(eslint@8.48.0)(typescript@5.2.2): + resolution: {integrity: sha512-OAm9Ohzbj11/ZFyICyR5N6LbOIvQMp7ZU2zI7Ej0jIc8kiGUERXPNMfw2QqqHD1ZHtjMub3yPZILovYEYucgoQ==} peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - typescript: ^3.7.5 || ^4.0.0 || ^5.0.0 + eslint: ^7.0.0 || ^8.0.0 + typescript: ^4.2.4 || ^5.0.0 dependencies: - '@typescript-eslint/utils': 5.62.0(eslint@8.48.0)(typescript@5.2.2) + '@typescript-eslint/utils': 6.5.0(eslint@8.48.0)(typescript@5.2.2) eslint: 8.48.0 tslib: 2.6.2 tsutils: 3.21.0(typescript@5.2.2) @@ -6089,14 +6027,6 @@ packages: engines: {node: '>=4.0.0'} dev: true - /eslint-scope@5.1.1: - resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} - engines: {node: '>=8.0.0'} - dependencies: - esrecurse: 4.3.0 - estraverse: 4.3.0 - dev: true - /eslint-scope@7.2.2: resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -6184,11 +6114,6 @@ packages: estraverse: 5.3.0 dev: true - /estraverse@4.3.0: - resolution: {integrity: sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==} - engines: {node: '>=4.0'} - dev: true - /estraverse@5.3.0: resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} engines: {node: '>=4.0'}