diff --git a/package-lock.json b/package-lock.json index 3528913dda..22311e1ce3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -423,46 +423,6 @@ "follow-redirects": "^1.14.0" } }, - "contract_manager/node_modules/@mysten/sui.js": { - "version": "0.37.1", - "resolved": "https://registry.npmjs.org/@mysten/sui.js/-/sui.js-0.37.1.tgz", - "integrity": "sha512-nEOqnjUqb/VJcVk23LgZOX1FmBib/mBCwAWaJhtsCHLwv2jIAfCPY/fpB9lJ62QHrM8UFclpWxsLkqcUkKyPgA==", - "dependencies": { - "@mysten/bcs": "0.7.3", - "@noble/curves": "^1.0.0", - "@noble/hashes": "^1.3.0", - "@open-rpc/client-js": "^1.8.1", - "@scure/bip32": "^1.3.0", - "@scure/bip39": "^1.2.0", - "@suchipi/femver": "^1.0.0", - "events": "^3.3.0", - "superstruct": "^1.0.3", - "tweetnacl": "^1.0.3" - }, - "engines": { - "node": ">=16" - } - }, - "contract_manager/node_modules/@mysten/sui.js/node_modules/@mysten/bcs": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.7.3.tgz", - "integrity": "sha512-fbusBfsyc2MpTACi72H5edWJ670T84va+qn9jSPpb5BzZ+pzUM1Q0ApPrF5OT+mB1o5Ng+mxPQpBCZQkfiV2TA==", - "dependencies": { - "bs58": "^5.0.0" - } - }, - "contract_manager/node_modules/@mysten/sui.js/node_modules/@scure/bip39": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", - "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", - "dependencies": { - "@noble/hashes": "~1.3.0", - "@scure/base": "~1.1.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, "contract_manager/node_modules/@noble/curves": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz", @@ -9690,18 +9650,18 @@ } }, "node_modules/@mysten/sui.js": { - "version": "0.34.0", - "resolved": "https://registry.npmjs.org/@mysten/sui.js/-/sui.js-0.34.0.tgz", - "integrity": "sha512-mNb4vX+HSm/Y2oJSDeCNOUV7L7IXW1fRQ0zU7fFUAeJdNgf1ObFmxiItVCA7GU0EXoSPtYnpxcdJFiBcSnQtbA==", + "version": "0.37.1", + "resolved": "https://registry.npmjs.org/@mysten/sui.js/-/sui.js-0.37.1.tgz", + "integrity": "sha512-nEOqnjUqb/VJcVk23LgZOX1FmBib/mBCwAWaJhtsCHLwv2jIAfCPY/fpB9lJ62QHrM8UFclpWxsLkqcUkKyPgA==", "dependencies": { - "@mysten/bcs": "0.7.1", + "@mysten/bcs": "0.7.3", "@noble/curves": "^1.0.0", "@noble/hashes": "^1.3.0", + "@open-rpc/client-js": "^1.8.1", "@scure/bip32": "^1.3.0", "@scure/bip39": "^1.2.0", "@suchipi/femver": "^1.0.0", - "jayson": "^4.0.0", - "rpc-websockets": "^7.5.1", + "events": "^3.3.0", "superstruct": "^1.0.3", "tweetnacl": "^1.0.3" }, @@ -9709,6 +9669,14 @@ "node": ">=16" } }, + "node_modules/@mysten/sui.js/node_modules/@mysten/bcs": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.7.3.tgz", + "integrity": "sha512-fbusBfsyc2MpTACi72H5edWJ670T84va+qn9jSPpb5BzZ+pzUM1Q0ApPrF5OT+mB1o5Ng+mxPQpBCZQkfiV2TA==", + "dependencies": { + "bs58": "^5.0.0" + } + }, "node_modules/@mysten/sui.js/node_modules/@noble/hashes": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz", @@ -9751,34 +9719,17 @@ "@scure/base": "~1.1.0" } }, - "node_modules/@mysten/sui.js/node_modules/@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" + "node_modules/@mysten/sui.js/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==" }, - "node_modules/@mysten/sui.js/node_modules/jayson": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/jayson/-/jayson-4.1.0.tgz", - "integrity": "sha512-R6JlbyLN53Mjku329XoRT2zJAE6ZgOQ8f91ucYdMCD4nkGCF9kZSrcGXpHIU4jeKj58zUZke2p+cdQchU7Ly7A==", + "node_modules/@mysten/sui.js/node_modules/bs58": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", + "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", "dependencies": { - "@types/connect": "^3.4.33", - "@types/node": "^12.12.54", - "@types/ws": "^7.4.4", - "commander": "^2.20.3", - "delay": "^5.0.0", - "es6-promisify": "^5.0.0", - "eyes": "^0.1.8", - "isomorphic-ws": "^4.0.1", - "json-stringify-safe": "^5.0.1", - "JSONStream": "^1.3.5", - "uuid": "^8.3.2", - "ws": "^7.4.5" - }, - "bin": { - "jayson": "bin/jayson.js" - }, - "engines": { - "node": ">=8" + "base-x": "^4.0.0" } }, "node_modules/@mysten/sui.js/node_modules/superstruct": { @@ -9789,26 +9740,6 @@ "node": ">=14.0.0" } }, - "node_modules/@mysten/sui.js/node_modules/ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/@next/env": { "version": "12.2.5", "resolved": "https://registry.npmjs.org/@next/env/-/env-12.2.5.tgz", @@ -30588,7 +30519,6 @@ "version": "4.0.5", "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz", "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==", - "hasInstallScript": true, "optional": true, "dependencies": { "node-gyp-build": "^4.3.0" @@ -30918,7 +30848,6 @@ "version": "5.0.7", "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz", "integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==", - "hasInstallScript": true, "optional": true, "dependencies": { "node-gyp-build": "^4.3.0" @@ -56011,13 +55940,14 @@ }, "price_pusher": { "name": "@pythnetwork/price-pusher", - "version": "5.5.0", + "version": "5.6.0", "license": "Apache-2.0", "dependencies": { "@injectivelabs/sdk-ts": "1.10.72", - "@mysten/sui.js": "^0.34.0", + "@mysten/sui.js": "^0.37.1", "@pythnetwork/price-service-client": "*", "@pythnetwork/pyth-sdk-solidity": "*", + "@pythnetwork/pyth-sui-js": "*", "@truffle/hdwallet-provider": "^2.1.3", "aptos": "^1.8.5", "joi": "^17.6.0", @@ -59990,54 +59920,6 @@ "follow-redirects": "^1.14.0" } }, - "target_chains/sui/cli/node_modules/@mysten/sui.js": { - "version": "0.37.1", - "resolved": "https://registry.npmjs.org/@mysten/sui.js/-/sui.js-0.37.1.tgz", - "integrity": "sha512-nEOqnjUqb/VJcVk23LgZOX1FmBib/mBCwAWaJhtsCHLwv2jIAfCPY/fpB9lJ62QHrM8UFclpWxsLkqcUkKyPgA==", - "dependencies": { - "@mysten/bcs": "0.7.3", - "@noble/curves": "^1.0.0", - "@noble/hashes": "^1.3.0", - "@open-rpc/client-js": "^1.8.1", - "@scure/bip32": "^1.3.0", - "@scure/bip39": "^1.2.0", - "@suchipi/femver": "^1.0.0", - "events": "^3.3.0", - "superstruct": "^1.0.3", - "tweetnacl": "^1.0.3" - }, - "engines": { - "node": ">=16" - } - }, - "target_chains/sui/cli/node_modules/@mysten/sui.js/node_modules/@mysten/bcs": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.7.3.tgz", - "integrity": "sha512-fbusBfsyc2MpTACi72H5edWJ670T84va+qn9jSPpb5BzZ+pzUM1Q0ApPrF5OT+mB1o5Ng+mxPQpBCZQkfiV2TA==", - "dependencies": { - "bs58": "^5.0.0" - } - }, - "target_chains/sui/cli/node_modules/@mysten/sui.js/node_modules/@scure/bip39": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", - "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", - "dependencies": { - "@noble/hashes": "~1.3.0", - "@scure/base": "~1.1.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "target_chains/sui/cli/node_modules/@mysten/sui.js/node_modules/bs58": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", - "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", - "dependencies": { - "base-x": "^4.0.0" - } - }, "target_chains/sui/cli/node_modules/@noble/curves": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", @@ -60136,11 +60018,6 @@ "follow-redirects": "^1.14.4" } }, - "target_chains/sui/cli/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==" - }, "target_chains/sui/cli/node_modules/buffer": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", @@ -60319,94 +60196,6 @@ "yargs": "^17.0.20" } }, - "target_chains/sui/sdk/js/node_modules/@mysten/bcs": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.7.3.tgz", - "integrity": "sha512-fbusBfsyc2MpTACi72H5edWJ670T84va+qn9jSPpb5BzZ+pzUM1Q0ApPrF5OT+mB1o5Ng+mxPQpBCZQkfiV2TA==", - "dependencies": { - "bs58": "^5.0.0" - } - }, - "target_chains/sui/sdk/js/node_modules/@mysten/sui.js": { - "version": "0.37.1", - "resolved": "https://registry.npmjs.org/@mysten/sui.js/-/sui.js-0.37.1.tgz", - "integrity": "sha512-nEOqnjUqb/VJcVk23LgZOX1FmBib/mBCwAWaJhtsCHLwv2jIAfCPY/fpB9lJ62QHrM8UFclpWxsLkqcUkKyPgA==", - "dependencies": { - "@mysten/bcs": "0.7.3", - "@noble/curves": "^1.0.0", - "@noble/hashes": "^1.3.0", - "@open-rpc/client-js": "^1.8.1", - "@scure/bip32": "^1.3.0", - "@scure/bip39": "^1.2.0", - "@suchipi/femver": "^1.0.0", - "events": "^3.3.0", - "superstruct": "^1.0.3", - "tweetnacl": "^1.0.3" - }, - "engines": { - "node": ">=16" - } - }, - "target_chains/sui/sdk/js/node_modules/@noble/curves": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz", - "integrity": "sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==", - "dependencies": { - "@noble/hashes": "1.3.1" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "target_chains/sui/sdk/js/node_modules/@noble/hashes": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz", - "integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "target_chains/sui/sdk/js/node_modules/@scure/bip32": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.1.tgz", - "integrity": "sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A==", - "dependencies": { - "@noble/curves": "~1.1.0", - "@noble/hashes": "~1.3.1", - "@scure/base": "~1.1.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "target_chains/sui/sdk/js/node_modules/@scure/bip39": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", - "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", - "dependencies": { - "@noble/hashes": "~1.3.0", - "@scure/base": "~1.1.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "target_chains/sui/sdk/js/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==" - }, - "target_chains/sui/sdk/js/node_modules/bs58": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", - "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", - "dependencies": { - "base-x": "^4.0.0" - } - }, "target_chains/sui/sdk/js/node_modules/buffer": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", @@ -60444,14 +60233,6 @@ "node": ">=12" } }, - "target_chains/sui/sdk/js/node_modules/superstruct": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-1.0.3.tgz", - "integrity": "sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg==", - "engines": { - "node": ">=14.0.0" - } - }, "target_chains/sui/sdk/js/node_modules/yargs": { "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", @@ -67149,22 +66930,30 @@ } }, "@mysten/sui.js": { - "version": "0.34.0", - "resolved": "https://registry.npmjs.org/@mysten/sui.js/-/sui.js-0.34.0.tgz", - "integrity": "sha512-mNb4vX+HSm/Y2oJSDeCNOUV7L7IXW1fRQ0zU7fFUAeJdNgf1ObFmxiItVCA7GU0EXoSPtYnpxcdJFiBcSnQtbA==", + "version": "0.37.1", + "resolved": "https://registry.npmjs.org/@mysten/sui.js/-/sui.js-0.37.1.tgz", + "integrity": "sha512-nEOqnjUqb/VJcVk23LgZOX1FmBib/mBCwAWaJhtsCHLwv2jIAfCPY/fpB9lJ62QHrM8UFclpWxsLkqcUkKyPgA==", "requires": { - "@mysten/bcs": "0.7.1", + "@mysten/bcs": "0.7.3", "@noble/curves": "^1.0.0", "@noble/hashes": "^1.3.0", + "@open-rpc/client-js": "^1.8.1", "@scure/bip32": "^1.3.0", "@scure/bip39": "^1.2.0", "@suchipi/femver": "^1.0.0", - "jayson": "^4.0.0", - "rpc-websockets": "^7.5.1", + "events": "^3.3.0", "superstruct": "^1.0.3", "tweetnacl": "^1.0.3" }, "dependencies": { + "@mysten/bcs": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.7.3.tgz", + "integrity": "sha512-fbusBfsyc2MpTACi72H5edWJ670T84va+qn9jSPpb5BzZ+pzUM1Q0ApPrF5OT+mB1o5Ng+mxPQpBCZQkfiV2TA==", + "requires": { + "bs58": "^5.0.0" + } + }, "@noble/hashes": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz", @@ -67189,40 +66978,23 @@ "@scure/base": "~1.1.0" } }, - "@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" + "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==" }, - "jayson": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/jayson/-/jayson-4.1.0.tgz", - "integrity": "sha512-R6JlbyLN53Mjku329XoRT2zJAE6ZgOQ8f91ucYdMCD4nkGCF9kZSrcGXpHIU4jeKj58zUZke2p+cdQchU7Ly7A==", + "bs58": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", + "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", "requires": { - "@types/connect": "^3.4.33", - "@types/node": "^12.12.54", - "@types/ws": "^7.4.4", - "commander": "^2.20.3", - "delay": "^5.0.0", - "es6-promisify": "^5.0.0", - "eyes": "^0.1.8", - "isomorphic-ws": "^4.0.1", - "json-stringify-safe": "^5.0.1", - "JSONStream": "^1.3.5", - "uuid": "^8.3.2", - "ws": "^7.4.5" + "base-x": "^4.0.0" } }, "superstruct": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-1.0.3.tgz", "integrity": "sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg==" - }, - "ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", - "requires": {} } } }, @@ -69434,9 +69206,10 @@ "version": "file:price_pusher", "requires": { "@injectivelabs/sdk-ts": "1.10.72", - "@mysten/sui.js": "^0.34.0", + "@mysten/sui.js": "^0.37.1", "@pythnetwork/price-service-client": "*", "@pythnetwork/pyth-sdk-solidity": "*", + "@pythnetwork/pyth-sui-js": "*", "@truffle/hdwallet-provider": "^2.1.3", "@types/ethereum-protocol": "^1.0.2", "@types/jest": "^27.4.1", @@ -72283,76 +72056,6 @@ "yargs": "^17.0.20" }, "dependencies": { - "@mysten/bcs": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.7.3.tgz", - "integrity": "sha512-fbusBfsyc2MpTACi72H5edWJ670T84va+qn9jSPpb5BzZ+pzUM1Q0ApPrF5OT+mB1o5Ng+mxPQpBCZQkfiV2TA==", - "requires": { - "bs58": "^5.0.0" - } - }, - "@mysten/sui.js": { - "version": "0.37.1", - "resolved": "https://registry.npmjs.org/@mysten/sui.js/-/sui.js-0.37.1.tgz", - "integrity": "sha512-nEOqnjUqb/VJcVk23LgZOX1FmBib/mBCwAWaJhtsCHLwv2jIAfCPY/fpB9lJ62QHrM8UFclpWxsLkqcUkKyPgA==", - "requires": { - "@mysten/bcs": "0.7.3", - "@noble/curves": "^1.0.0", - "@noble/hashes": "^1.3.0", - "@open-rpc/client-js": "^1.8.1", - "@scure/bip32": "^1.3.0", - "@scure/bip39": "^1.2.0", - "@suchipi/femver": "^1.0.0", - "events": "^3.3.0", - "superstruct": "^1.0.3", - "tweetnacl": "^1.0.3" - } - }, - "@noble/curves": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz", - "integrity": "sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==", - "requires": { - "@noble/hashes": "1.3.1" - } - }, - "@noble/hashes": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz", - "integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==" - }, - "@scure/bip32": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.1.tgz", - "integrity": "sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A==", - "requires": { - "@noble/curves": "~1.1.0", - "@noble/hashes": "~1.3.1", - "@scure/base": "~1.1.0" - } - }, - "@scure/bip39": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", - "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", - "requires": { - "@noble/hashes": "~1.3.0", - "@scure/base": "~1.1.0" - } - }, - "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==" - }, - "bs58": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", - "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", - "requires": { - "base-x": "^4.0.0" - } - }, "buffer": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", @@ -72373,11 +72076,6 @@ "wrap-ansi": "^7.0.0" } }, - "superstruct": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-1.0.3.tgz", - "integrity": "sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg==" - }, "yargs": { "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", @@ -83081,42 +82779,6 @@ } } }, - "@mysten/sui.js": { - "version": "0.37.1", - "resolved": "https://registry.npmjs.org/@mysten/sui.js/-/sui.js-0.37.1.tgz", - "integrity": "sha512-nEOqnjUqb/VJcVk23LgZOX1FmBib/mBCwAWaJhtsCHLwv2jIAfCPY/fpB9lJ62QHrM8UFclpWxsLkqcUkKyPgA==", - "requires": { - "@mysten/bcs": "0.7.3", - "@noble/curves": "^1.0.0", - "@noble/hashes": "^1.3.0", - "@open-rpc/client-js": "^1.8.1", - "@scure/bip32": "^1.3.0", - "@scure/bip39": "^1.2.0", - "@suchipi/femver": "^1.0.0", - "events": "^3.3.0", - "superstruct": "^1.0.3", - "tweetnacl": "^1.0.3" - }, - "dependencies": { - "@mysten/bcs": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.7.3.tgz", - "integrity": "sha512-fbusBfsyc2MpTACi72H5edWJ670T84va+qn9jSPpb5BzZ+pzUM1Q0ApPrF5OT+mB1o5Ng+mxPQpBCZQkfiV2TA==", - "requires": { - "bs58": "^5.0.0" - } - }, - "@scure/bip39": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", - "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", - "requires": { - "@noble/hashes": "~1.3.0", - "@scure/base": "~1.1.0" - } - } - } - }, "@noble/curves": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz", @@ -99756,50 +99418,6 @@ } } }, - "@mysten/sui.js": { - "version": "0.37.1", - "resolved": "https://registry.npmjs.org/@mysten/sui.js/-/sui.js-0.37.1.tgz", - "integrity": "sha512-nEOqnjUqb/VJcVk23LgZOX1FmBib/mBCwAWaJhtsCHLwv2jIAfCPY/fpB9lJ62QHrM8UFclpWxsLkqcUkKyPgA==", - "requires": { - "@mysten/bcs": "0.7.3", - "@noble/curves": "^1.0.0", - "@noble/hashes": "^1.3.0", - "@open-rpc/client-js": "^1.8.1", - "@scure/bip32": "^1.3.0", - "@scure/bip39": "^1.2.0", - "@suchipi/femver": "^1.0.0", - "events": "^3.3.0", - "superstruct": "^1.0.3", - "tweetnacl": "^1.0.3" - }, - "dependencies": { - "@mysten/bcs": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.7.3.tgz", - "integrity": "sha512-fbusBfsyc2MpTACi72H5edWJ670T84va+qn9jSPpb5BzZ+pzUM1Q0ApPrF5OT+mB1o5Ng+mxPQpBCZQkfiV2TA==", - "requires": { - "bs58": "^5.0.0" - } - }, - "@scure/bip39": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", - "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", - "requires": { - "@noble/hashes": "~1.3.0", - "@scure/base": "~1.1.0" - } - }, - "bs58": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", - "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", - "requires": { - "base-x": "^4.0.0" - } - } - } - }, "@noble/curves": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", @@ -99876,11 +99494,6 @@ "follow-redirects": "^1.14.4" } }, - "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==" - }, "buffer": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", diff --git a/price_pusher/package.json b/price_pusher/package.json index 7d3244f6a2..a137c10a47 100644 --- a/price_pusher/package.json +++ b/price_pusher/package.json @@ -1,6 +1,6 @@ { "name": "@pythnetwork/price-pusher", - "version": "5.5.0", + "version": "5.6.0", "description": "Pyth Price Pusher", "homepage": "https://pyth.network", "main": "lib/index.js", @@ -52,9 +52,10 @@ }, "dependencies": { "@injectivelabs/sdk-ts": "1.10.72", - "@mysten/sui.js": "^0.34.0", + "@mysten/sui.js": "^0.37.1", "@pythnetwork/price-service-client": "*", "@pythnetwork/pyth-sdk-solidity": "*", + "@pythnetwork/pyth-sui-js": "*", "@truffle/hdwallet-provider": "^2.1.3", "aptos": "^1.8.5", "joi": "^17.6.0", diff --git a/price_pusher/src/sui/command.ts b/price_pusher/src/sui/command.ts index ed7a3bae02..61ecce871b 100644 --- a/price_pusher/src/sui/command.ts +++ b/price_pusher/src/sui/command.ts @@ -38,13 +38,6 @@ export default { type: "string", required: true, } as Options, - "max-vaas-per-ptb": { - description: - "Maximum number of VAAs that can be included in a single PTB.", - type: "number", - required: true, - default: 1, - } as Options, "num-gas-objects": { description: "Number of gas objects in the pool.", type: "number", @@ -73,7 +66,6 @@ export default { pollingFrequency, pythStateId, wormholeStateId, - maxVaasPerPtb, numGasObjects, gasBudget, } = argv; @@ -113,6 +105,7 @@ export default { const suiListener = new SuiPriceListener( pythStateId, + wormholeStateId, endpoint, priceItems, { pollingFrequency } @@ -121,7 +114,6 @@ export default { priceServiceConnection, pythStateId, wormholeStateId, - maxVaasPerPtb, endpoint, mnemonic, gasBudget, diff --git a/price_pusher/src/sui/sui.ts b/price_pusher/src/sui/sui.ts index 54afd4ae87..d996429da3 100644 --- a/price_pusher/src/sui/sui.ts +++ b/price_pusher/src/sui/sui.ts @@ -12,7 +12,6 @@ import { Ed25519Keypair, RawSigner, TransactionBlock, - SUI_CLOCK_OBJECT_ID, getCreatedObjects, SuiObjectRef, getTransactionEffects, @@ -21,73 +20,46 @@ import { SuiAddress, ObjectId, } from "@mysten/sui.js"; +import { SuiPythClient } from "@pythnetwork/pyth-sui-js"; const GAS_FEE_FOR_SPLIT = 2_000_000_000; // TODO: read this from on chain config const MAX_NUM_GAS_OBJECTS_IN_PTB = 256; const MAX_NUM_OBJECTS_IN_ARGUMENT = 510; -type PriceTableInfo = { - id: ObjectId; - fieldType: ObjectId; -}; - -async function getPriceTableInfo( - provider: JsonRpcProvider, - pythStateId: ObjectId -): Promise { - const result = await provider.getDynamicFieldObject({ - parentId: pythStateId, - name: { - type: "vector", - value: "price_info", - }, - }); - if (!result.data || !result.data.type) { - throw new Error("Price Table not found, contract may not be initialized"); - } - let type = result.data.type.replace("0x2::table::Table<", ""); - type = type.replace( - "::price_identifier::PriceIdentifier, 0x2::object::ID>", - "" - ); - return { id: result.data.objectId, fieldType: type }; -} - export class SuiPriceListener extends ChainPriceListener { - private priceTableInfo: PriceTableInfo | undefined; + private pythClient: SuiPythClient; + private provider: JsonRpcProvider; constructor( - private pythStateId: ObjectId, - private endpoint: string, + pythStateId: ObjectId, + wormholeStateId: ObjectId, + endpoint: string, priceItems: PriceItem[], config: { pollingFrequency: DurationInSeconds; } ) { super("sui", config.pollingFrequency, priceItems); + this.provider = new JsonRpcProvider(new Connection({ fullnode: endpoint })); + this.pythClient = new SuiPythClient( + this.provider, + pythStateId, + wormholeStateId + ); } async getOnChainPriceInfo(priceId: string): Promise { try { - const provider = new JsonRpcProvider( - new Connection({ fullnode: this.endpoint }) - ); - if (this.priceTableInfo === undefined) { - this.priceTableInfo = await getPriceTableInfo( - provider, - this.pythStateId - ); - } - - const priceInfoObjectId = await priceIdToPriceInfoObjectId( - provider, - this.priceTableInfo, + const priceInfoObjectId = await this.pythClient.getPriceFeedObjectId( priceId ); + if (priceInfoObjectId === undefined) { + throw new Error("Price not found on chain for price id " + priceId); + } // Fetching the price info object for the above priceInfoObjectId - const priceInfoObject = await provider.getObject({ + const priceInfoObject = await this.provider.getObject({ id: priceInfoObjectId, options: { showContent: true }, }); @@ -148,12 +120,11 @@ export class SuiPricePusher implements IPricePusher { private pythStateId: string, private wormholePackageId: string, private wormholeStateId: string, - private priceTableInfo: PriceTableInfo, - private maxVaasPerPtb: number, endpoint: string, mnemonic: string, private gasBudget: number, - private gasPool: SuiObjectRef[] + private gasPool: SuiObjectRef[], + private pythClient: SuiPythClient ) {} /** @@ -197,7 +168,6 @@ export class SuiPricePusher implements IPricePusher { priceServiceConnection: PriceServiceConnection, pythStateId: string, wormholeStateId: string, - maxVaasPerPtb: number, endpoint: string, mnemonic: string, gasBudget: number, @@ -216,7 +186,6 @@ export class SuiPricePusher implements IPricePusher { Ed25519Keypair.deriveKeypair(mnemonic), provider ); - const priceTableInfo = await getPriceTableInfo(provider, pythStateId); const pythPackageId = await SuiPricePusher.getPackageId( provider, pythStateId @@ -231,6 +200,12 @@ export class SuiPricePusher implements IPricePusher { numGasObjects ); + const pythClient = new SuiPythClient( + provider, + pythStateId, + wormholeStateId + ); + return new SuiPricePusher( signer, priceServiceConnection, @@ -238,12 +213,11 @@ export class SuiPricePusher implements IPricePusher { pythStateId, wormholePackageId, wormholeStateId, - priceTableInfo, - maxVaasPerPtb, endpoint, mnemonic, gasBudget, - gasPool + gasPool, + pythClient ); } @@ -263,119 +237,31 @@ export class SuiPricePusher implements IPricePusher { return; } - const priceFeeds = await this.priceServiceConnection.getLatestPriceFeeds( - priceIds - ); - if (priceFeeds === undefined) { - console.warn("Failed to fetch price updates. Skipping push."); - return; - } + // 3 price feeds per transaction is the optimal number for gas cost. + const priceIdChunks = chunkArray(priceIds, 3); - const vaaToPriceFeedIds: Map = new Map(); - for (const priceFeed of priceFeeds) { - // The ! will succeed as long as the priceServiceConnection is configured to return binary vaa data (which it is). - const vaa = priceFeed.getVAA()!; - if (!vaaToPriceFeedIds.has(vaa)) { - vaaToPriceFeedIds.set(vaa, []); - } - vaaToPriceFeedIds.get(vaa)!.push(priceFeed.id); - } + const txBlocks: TransactionBlock[] = []; - const txs = []; - let currentBatchVaas = []; - let currentBatchPriceFeedIds = []; - for (const [vaa, priceFeedIds] of vaaToPriceFeedIds.entries()) { - currentBatchVaas.push(vaa); - currentBatchPriceFeedIds.push(...priceFeedIds); - if (currentBatchVaas.length >= this.maxVaasPerPtb) { - const tx = await this.createPriceUpdateTransaction( - currentBatchVaas, - currentBatchPriceFeedIds + await Promise.all( + priceIdChunks.map(async (priceIdChunk) => { + const vaas = await this.priceServiceConnection.getLatestVaas( + priceIdChunk ); - if (tx !== undefined) { - txs.push(tx); + if (vaas.length !== 1) { + throw new Error("Expected a single VAA for all priceIds"); } - - currentBatchVaas = []; - currentBatchPriceFeedIds = []; - } - } - - await this.sendTransactionBlocks(txs); - } - - private async createPriceUpdateTransaction( - vaas: string[], - priceIds: string[] - ): Promise { - const tx = new TransactionBlock(); - // Parse our batch price attestation VAA bytes using Wormhole. - // Check out the Wormhole cross-chain bridge and generic messaging protocol here: - // https://github.com/wormhole-foundation/wormhole - let verified_vaas: any = []; - for (const vaa of vaas) { - const [verified_vaa] = tx.moveCall({ - target: `${this.wormholePackageId}::vaa::parse_and_verify`, - arguments: [ - tx.object(this.wormholeStateId), - tx.pure([...Buffer.from(vaa, "base64")]), - tx.object(SUI_CLOCK_OBJECT_ID), - ], - }); - verified_vaas = verified_vaas.concat(verified_vaa); - } - - // Create a hot potato vector of price feed updates that will - // be used to update price feeds. - let [price_updates_hot_potato] = tx.moveCall({ - target: `${this.pythPackageId}::pyth::create_price_infos_hot_potato`, - arguments: [ - tx.object(this.pythStateId), - tx.makeMoveVec({ - type: `${this.wormholePackageId}::vaa::VAA`, - objects: verified_vaas, - }), - tx.object(SUI_CLOCK_OBJECT_ID), - ], - }); - - // Update each price info object (containing our price feeds of interest) - // using the hot potato vector. - for (const priceId of priceIds) { - let priceInfoObjectId; - try { - priceInfoObjectId = await priceIdToPriceInfoObjectId( - this.signer.provider, - this.priceTableInfo, - priceId + const vaa = vaas[0]; + const tx = new TransactionBlock(); + await this.pythClient.updatePriceFeeds( + tx, + [Buffer.from(vaa, "base64")], + priceIdChunk ); - } catch (e) { - console.log("Error fetching price info object id for ", priceId); - console.error(e); - return undefined; - } - const coin = tx.splitCoins(tx.gas, [tx.pure(1)]); - [price_updates_hot_potato] = tx.moveCall({ - target: `${this.pythPackageId}::pyth::update_single_price_feed`, - arguments: [ - tx.object(this.pythStateId), - price_updates_hot_potato, - tx.object(priceInfoObjectId), - coin, - tx.object(SUI_CLOCK_OBJECT_ID), - ], - }); - } - - // Explicitly destroy the hot potato vector, since it can't be dropped - // automatically. - tx.moveCall({ - target: `${this.pythPackageId}::hot_potato_vector::destroy`, - arguments: [price_updates_hot_potato], - typeArguments: [`${this.pythPackageId}::price_info::PriceInfo`], - }); + txBlocks.push(tx); + }) + ); - return tx; + await this.sendTransactionBlocks(txBlocks); } /** Send every transaction in txs in parallel, returning when all transactions have completed. */ @@ -635,49 +521,6 @@ export class SuiPricePusher implements IPricePusher { } } -// We are calculating stored price info object id for given price id -// The mapping between which is static. Hence, we are caching it here. -const CACHE: { [priceId: string]: string } = {}; - -// For given priceid, this method will fetch the price info object id -// where the price information for the corresponding price feed is stored -async function priceIdToPriceInfoObjectId( - provider: JsonRpcProvider, - priceTableInfo: PriceTableInfo, - priceId: string -) { - // Check if this was fetched before. - if (CACHE[priceId] !== undefined) return CACHE[priceId]; - - const storedObjectID = await provider.getDynamicFieldObject({ - parentId: priceTableInfo.id, - name: { - type: `${priceTableInfo.fieldType}::price_identifier::PriceIdentifier`, - value: { - bytes: "0x" + priceId, - }, - }, - }); - - if (storedObjectID.error !== undefined) throw storedObjectID.error; - - if ( - storedObjectID.data === undefined || - storedObjectID.data.content === undefined - ) - throw new Error("Price not found on chain for price id " + priceId); - - if (storedObjectID.data.content.dataType !== "moveObject") - throw new Error("fetched object datatype should be moveObject"); - // This ID points to the price info object for the given price id stored on chain - const priceInfoObjectId = storedObjectID.data.content.fields.value; - - // cache the price info object id - CACHE[priceId] = priceInfoObjectId; - - return priceInfoObjectId; -} - function chunkArray(array: Array, size: number): Array> { const chunked = []; let index = 0;