浏览代码

[price-pusher] Use sui pyth client and change flow for hermes messages (#1084)

* Use sui pyth client and change flow for hermes messages
Amin Moghaddam 2 年之前
父节点
当前提交
879efe0e01
共有 4 个文件被更改,包括 101 次插入652 次删除
  1. 51 438
      package-lock.json
  2. 3 2
      price_pusher/package.json
  3. 1 9
      price_pusher/src/sui/command.ts
  4. 46 203
      price_pusher/src/sui/sui.ts

+ 51 - 438
package-lock.json

@@ -423,46 +423,6 @@
         "follow-redirects": "^1.14.0"
         "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": {
     "contract_manager/node_modules/@noble/curves": {
       "version": "1.1.0",
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz",
       "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz",
@@ -9690,18 +9650,18 @@
       }
       }
     },
     },
     "node_modules/@mysten/sui.js": {
     "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": {
       "dependencies": {
-        "@mysten/bcs": "0.7.1",
+        "@mysten/bcs": "0.7.3",
         "@noble/curves": "^1.0.0",
         "@noble/curves": "^1.0.0",
         "@noble/hashes": "^1.3.0",
         "@noble/hashes": "^1.3.0",
+        "@open-rpc/client-js": "^1.8.1",
         "@scure/bip32": "^1.3.0",
         "@scure/bip32": "^1.3.0",
         "@scure/bip39": "^1.2.0",
         "@scure/bip39": "^1.2.0",
         "@suchipi/femver": "^1.0.0",
         "@suchipi/femver": "^1.0.0",
-        "jayson": "^4.0.0",
-        "rpc-websockets": "^7.5.1",
+        "events": "^3.3.0",
         "superstruct": "^1.0.3",
         "superstruct": "^1.0.3",
         "tweetnacl": "^1.0.3"
         "tweetnacl": "^1.0.3"
       },
       },
@@ -9709,6 +9669,14 @@
         "node": ">=16"
         "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": {
     "node_modules/@mysten/sui.js/node_modules/@noble/hashes": {
       "version": "1.3.0",
       "version": "1.3.0",
       "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz",
       "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz",
@@ -9751,34 +9719,17 @@
         "@scure/base": "~1.1.0"
         "@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": {
       "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": {
     "node_modules/@mysten/sui.js/node_modules/superstruct": {
@@ -9789,26 +9740,6 @@
         "node": ">=14.0.0"
         "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": {
     "node_modules/@next/env": {
       "version": "12.2.5",
       "version": "12.2.5",
       "resolved": "https://registry.npmjs.org/@next/env/-/env-12.2.5.tgz",
       "resolved": "https://registry.npmjs.org/@next/env/-/env-12.2.5.tgz",
@@ -30588,7 +30519,6 @@
       "version": "4.0.5",
       "version": "4.0.5",
       "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz",
       "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz",
       "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==",
       "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==",
-      "hasInstallScript": true,
       "optional": true,
       "optional": true,
       "dependencies": {
       "dependencies": {
         "node-gyp-build": "^4.3.0"
         "node-gyp-build": "^4.3.0"
@@ -30918,7 +30848,6 @@
       "version": "5.0.7",
       "version": "5.0.7",
       "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz",
       "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz",
       "integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==",
       "integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==",
-      "hasInstallScript": true,
       "optional": true,
       "optional": true,
       "dependencies": {
       "dependencies": {
         "node-gyp-build": "^4.3.0"
         "node-gyp-build": "^4.3.0"
@@ -56011,13 +55940,14 @@
     },
     },
     "price_pusher": {
     "price_pusher": {
       "name": "@pythnetwork/price-pusher",
       "name": "@pythnetwork/price-pusher",
-      "version": "5.5.0",
+      "version": "5.6.0",
       "license": "Apache-2.0",
       "license": "Apache-2.0",
       "dependencies": {
       "dependencies": {
         "@injectivelabs/sdk-ts": "1.10.72",
         "@injectivelabs/sdk-ts": "1.10.72",
-        "@mysten/sui.js": "^0.34.0",
+        "@mysten/sui.js": "^0.37.1",
         "@pythnetwork/price-service-client": "*",
         "@pythnetwork/price-service-client": "*",
         "@pythnetwork/pyth-sdk-solidity": "*",
         "@pythnetwork/pyth-sdk-solidity": "*",
+        "@pythnetwork/pyth-sui-js": "*",
         "@truffle/hdwallet-provider": "^2.1.3",
         "@truffle/hdwallet-provider": "^2.1.3",
         "aptos": "^1.8.5",
         "aptos": "^1.8.5",
         "joi": "^17.6.0",
         "joi": "^17.6.0",
@@ -59990,54 +59920,6 @@
         "follow-redirects": "^1.14.0"
         "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": {
     "target_chains/sui/cli/node_modules/@noble/curves": {
       "version": "1.2.0",
       "version": "1.2.0",
       "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz",
       "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz",
@@ -60136,11 +60018,6 @@
         "follow-redirects": "^1.14.4"
         "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": {
     "target_chains/sui/cli/node_modules/buffer": {
       "version": "6.0.3",
       "version": "6.0.3",
       "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
       "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
@@ -60319,94 +60196,6 @@
         "yargs": "^17.0.20"
         "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": {
     "target_chains/sui/sdk/js/node_modules/buffer": {
       "version": "6.0.3",
       "version": "6.0.3",
       "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
       "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
@@ -60444,14 +60233,6 @@
         "node": ">=12"
         "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": {
     "target_chains/sui/sdk/js/node_modules/yargs": {
       "version": "17.7.2",
       "version": "17.7.2",
       "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
       "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
@@ -67149,22 +66930,30 @@
       }
       }
     },
     },
     "@mysten/sui.js": {
     "@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": {
       "requires": {
-        "@mysten/bcs": "0.7.1",
+        "@mysten/bcs": "0.7.3",
         "@noble/curves": "^1.0.0",
         "@noble/curves": "^1.0.0",
         "@noble/hashes": "^1.3.0",
         "@noble/hashes": "^1.3.0",
+        "@open-rpc/client-js": "^1.8.1",
         "@scure/bip32": "^1.3.0",
         "@scure/bip32": "^1.3.0",
         "@scure/bip39": "^1.2.0",
         "@scure/bip39": "^1.2.0",
         "@suchipi/femver": "^1.0.0",
         "@suchipi/femver": "^1.0.0",
-        "jayson": "^4.0.0",
-        "rpc-websockets": "^7.5.1",
+        "events": "^3.3.0",
         "superstruct": "^1.0.3",
         "superstruct": "^1.0.3",
         "tweetnacl": "^1.0.3"
         "tweetnacl": "^1.0.3"
       },
       },
       "dependencies": {
       "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": {
         "@noble/hashes": {
           "version": "1.3.0",
           "version": "1.3.0",
           "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz",
           "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz",
@@ -67189,40 +66978,23 @@
             "@scure/base": "~1.1.0"
             "@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": {
           "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": {
         "superstruct": {
           "version": "1.0.3",
           "version": "1.0.3",
           "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-1.0.3.tgz",
           "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-1.0.3.tgz",
           "integrity": "sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg=="
           "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",
       "version": "file:price_pusher",
       "requires": {
       "requires": {
         "@injectivelabs/sdk-ts": "1.10.72",
         "@injectivelabs/sdk-ts": "1.10.72",
-        "@mysten/sui.js": "^0.34.0",
+        "@mysten/sui.js": "^0.37.1",
         "@pythnetwork/price-service-client": "*",
         "@pythnetwork/price-service-client": "*",
         "@pythnetwork/pyth-sdk-solidity": "*",
         "@pythnetwork/pyth-sdk-solidity": "*",
+        "@pythnetwork/pyth-sui-js": "*",
         "@truffle/hdwallet-provider": "^2.1.3",
         "@truffle/hdwallet-provider": "^2.1.3",
         "@types/ethereum-protocol": "^1.0.2",
         "@types/ethereum-protocol": "^1.0.2",
         "@types/jest": "^27.4.1",
         "@types/jest": "^27.4.1",
@@ -72283,76 +72056,6 @@
         "yargs": "^17.0.20"
         "yargs": "^17.0.20"
       },
       },
       "dependencies": {
       "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": {
         "buffer": {
           "version": "6.0.3",
           "version": "6.0.3",
           "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
           "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
@@ -72373,11 +72076,6 @@
             "wrap-ansi": "^7.0.0"
             "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": {
         "yargs": {
           "version": "17.7.2",
           "version": "17.7.2",
           "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
           "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": {
         "@noble/curves": {
           "version": "1.1.0",
           "version": "1.1.0",
           "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz",
           "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": {
         "@noble/curves": {
           "version": "1.2.0",
           "version": "1.2.0",
           "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz",
           "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz",
@@ -99876,11 +99494,6 @@
             "follow-redirects": "^1.14.4"
             "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": {
         "buffer": {
           "version": "6.0.3",
           "version": "6.0.3",
           "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
           "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",

+ 3 - 2
price_pusher/package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "@pythnetwork/price-pusher",
   "name": "@pythnetwork/price-pusher",
-  "version": "5.5.0",
+  "version": "5.6.0",
   "description": "Pyth Price Pusher",
   "description": "Pyth Price Pusher",
   "homepage": "https://pyth.network",
   "homepage": "https://pyth.network",
   "main": "lib/index.js",
   "main": "lib/index.js",
@@ -52,9 +52,10 @@
   },
   },
   "dependencies": {
   "dependencies": {
     "@injectivelabs/sdk-ts": "1.10.72",
     "@injectivelabs/sdk-ts": "1.10.72",
-    "@mysten/sui.js": "^0.34.0",
+    "@mysten/sui.js": "^0.37.1",
     "@pythnetwork/price-service-client": "*",
     "@pythnetwork/price-service-client": "*",
     "@pythnetwork/pyth-sdk-solidity": "*",
     "@pythnetwork/pyth-sdk-solidity": "*",
+    "@pythnetwork/pyth-sui-js": "*",
     "@truffle/hdwallet-provider": "^2.1.3",
     "@truffle/hdwallet-provider": "^2.1.3",
     "aptos": "^1.8.5",
     "aptos": "^1.8.5",
     "joi": "^17.6.0",
     "joi": "^17.6.0",

+ 1 - 9
price_pusher/src/sui/command.ts

@@ -38,13 +38,6 @@ export default {
       type: "string",
       type: "string",
       required: true,
       required: true,
     } as Options,
     } 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": {
     "num-gas-objects": {
       description: "Number of gas objects in the pool.",
       description: "Number of gas objects in the pool.",
       type: "number",
       type: "number",
@@ -73,7 +66,6 @@ export default {
       pollingFrequency,
       pollingFrequency,
       pythStateId,
       pythStateId,
       wormholeStateId,
       wormholeStateId,
-      maxVaasPerPtb,
       numGasObjects,
       numGasObjects,
       gasBudget,
       gasBudget,
     } = argv;
     } = argv;
@@ -113,6 +105,7 @@ export default {
 
 
     const suiListener = new SuiPriceListener(
     const suiListener = new SuiPriceListener(
       pythStateId,
       pythStateId,
+      wormholeStateId,
       endpoint,
       endpoint,
       priceItems,
       priceItems,
       { pollingFrequency }
       { pollingFrequency }
@@ -121,7 +114,6 @@ export default {
       priceServiceConnection,
       priceServiceConnection,
       pythStateId,
       pythStateId,
       wormholeStateId,
       wormholeStateId,
-      maxVaasPerPtb,
       endpoint,
       endpoint,
       mnemonic,
       mnemonic,
       gasBudget,
       gasBudget,

+ 46 - 203
price_pusher/src/sui/sui.ts

@@ -12,7 +12,6 @@ import {
   Ed25519Keypair,
   Ed25519Keypair,
   RawSigner,
   RawSigner,
   TransactionBlock,
   TransactionBlock,
-  SUI_CLOCK_OBJECT_ID,
   getCreatedObjects,
   getCreatedObjects,
   SuiObjectRef,
   SuiObjectRef,
   getTransactionEffects,
   getTransactionEffects,
@@ -21,73 +20,46 @@ import {
   SuiAddress,
   SuiAddress,
   ObjectId,
   ObjectId,
 } from "@mysten/sui.js";
 } from "@mysten/sui.js";
+import { SuiPythClient } from "@pythnetwork/pyth-sui-js";
 
 
 const GAS_FEE_FOR_SPLIT = 2_000_000_000;
 const GAS_FEE_FOR_SPLIT = 2_000_000_000;
 // TODO: read this from on chain config
 // TODO: read this from on chain config
 const MAX_NUM_GAS_OBJECTS_IN_PTB = 256;
 const MAX_NUM_GAS_OBJECTS_IN_PTB = 256;
 const MAX_NUM_OBJECTS_IN_ARGUMENT = 510;
 const MAX_NUM_OBJECTS_IN_ARGUMENT = 510;
 
 
-type PriceTableInfo = {
-  id: ObjectId;
-  fieldType: ObjectId;
-};
-
-async function getPriceTableInfo(
-  provider: JsonRpcProvider,
-  pythStateId: ObjectId
-): Promise<PriceTableInfo> {
-  const result = await provider.getDynamicFieldObject({
-    parentId: pythStateId,
-    name: {
-      type: "vector<u8>",
-      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 {
 export class SuiPriceListener extends ChainPriceListener {
-  private priceTableInfo: PriceTableInfo | undefined;
+  private pythClient: SuiPythClient;
+  private provider: JsonRpcProvider;
 
 
   constructor(
   constructor(
-    private pythStateId: ObjectId,
-    private endpoint: string,
+    pythStateId: ObjectId,
+    wormholeStateId: ObjectId,
+    endpoint: string,
     priceItems: PriceItem[],
     priceItems: PriceItem[],
     config: {
     config: {
       pollingFrequency: DurationInSeconds;
       pollingFrequency: DurationInSeconds;
     }
     }
   ) {
   ) {
     super("sui", config.pollingFrequency, priceItems);
     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<PriceInfo | undefined> {
   async getOnChainPriceInfo(priceId: string): Promise<PriceInfo | undefined> {
     try {
     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
         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
       // Fetching the price info object for the above priceInfoObjectId
-      const priceInfoObject = await provider.getObject({
+      const priceInfoObject = await this.provider.getObject({
         id: priceInfoObjectId,
         id: priceInfoObjectId,
         options: { showContent: true },
         options: { showContent: true },
       });
       });
@@ -148,12 +120,11 @@ export class SuiPricePusher implements IPricePusher {
     private pythStateId: string,
     private pythStateId: string,
     private wormholePackageId: string,
     private wormholePackageId: string,
     private wormholeStateId: string,
     private wormholeStateId: string,
-    private priceTableInfo: PriceTableInfo,
-    private maxVaasPerPtb: number,
     endpoint: string,
     endpoint: string,
     mnemonic: string,
     mnemonic: string,
     private gasBudget: number,
     private gasBudget: number,
-    private gasPool: SuiObjectRef[]
+    private gasPool: SuiObjectRef[],
+    private pythClient: SuiPythClient
   ) {}
   ) {}
 
 
   /**
   /**
@@ -197,7 +168,6 @@ export class SuiPricePusher implements IPricePusher {
     priceServiceConnection: PriceServiceConnection,
     priceServiceConnection: PriceServiceConnection,
     pythStateId: string,
     pythStateId: string,
     wormholeStateId: string,
     wormholeStateId: string,
-    maxVaasPerPtb: number,
     endpoint: string,
     endpoint: string,
     mnemonic: string,
     mnemonic: string,
     gasBudget: number,
     gasBudget: number,
@@ -216,7 +186,6 @@ export class SuiPricePusher implements IPricePusher {
       Ed25519Keypair.deriveKeypair(mnemonic),
       Ed25519Keypair.deriveKeypair(mnemonic),
       provider
       provider
     );
     );
-    const priceTableInfo = await getPriceTableInfo(provider, pythStateId);
     const pythPackageId = await SuiPricePusher.getPackageId(
     const pythPackageId = await SuiPricePusher.getPackageId(
       provider,
       provider,
       pythStateId
       pythStateId
@@ -231,6 +200,12 @@ export class SuiPricePusher implements IPricePusher {
       numGasObjects
       numGasObjects
     );
     );
 
 
+    const pythClient = new SuiPythClient(
+      provider,
+      pythStateId,
+      wormholeStateId
+    );
+
     return new SuiPricePusher(
     return new SuiPricePusher(
       signer,
       signer,
       priceServiceConnection,
       priceServiceConnection,
@@ -238,12 +213,11 @@ export class SuiPricePusher implements IPricePusher {
       pythStateId,
       pythStateId,
       wormholePackageId,
       wormholePackageId,
       wormholeStateId,
       wormholeStateId,
-      priceTableInfo,
-      maxVaasPerPtb,
       endpoint,
       endpoint,
       mnemonic,
       mnemonic,
       gasBudget,
       gasBudget,
-      gasPool
+      gasPool,
+      pythClient
     );
     );
   }
   }
 
 
@@ -263,119 +237,31 @@ export class SuiPricePusher implements IPricePusher {
       return;
       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<string, string[]> = 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<TransactionBlock | undefined> {
-    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. */
   /** 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<T>(array: Array<T>, size: number): Array<Array<T>> {
 function chunkArray<T>(array: Array<T>, size: number): Array<Array<T>> {
   const chunked = [];
   const chunked = [];
   let index = 0;
   let index = 0;