diff --git a/lazer/js/package.json b/lazer/js/package.json index 94c2d3f..3ce9f90 100644 --- a/lazer/js/package.json +++ b/lazer/js/package.json @@ -6,6 +6,7 @@ "type": "module", "scripts": { "start": "node --loader ts-node/esm src/index.js", + "start:publish": "node --loader ts-node/esm src/publish.js", "test": "pnpm run test:format && pnpm run build:cjs && pnpm run build:esm", "build:cjs": "tsc --project tsconfig.json --verbatimModuleSyntax false --module commonjs --outDir ./dist/cjs && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json", "build:esm": "tsc --project tsconfig.json --outDir ./dist/esm && echo '{\"type\":\"module\"}' > dist/esm/package.json", @@ -15,7 +16,8 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "@pythnetwork/pyth-lazer-sdk": "^0.1.1" + "@pythnetwork/pyth-lazer-sdk": "^0.3.1", + "@solana/web3.js": "^1.98.0" }, "devDependencies": { "@cprussin/tsconfig": "^3.0.1", diff --git a/lazer/js/pnpm-lock.yaml b/lazer/js/pnpm-lock.yaml index 3bf0f3c..09ad7cb 100644 --- a/lazer/js/pnpm-lock.yaml +++ b/lazer/js/pnpm-lock.yaml @@ -1,21 +1,23 @@ -lockfileVersion: '9.0' +lockfileVersion: "9.0" settings: autoInstallPeers: true excludeLinksFromLockfile: false importers: - .: dependencies: - '@pythnetwork/pyth-lazer-sdk': - specifier: ^0.1.1 - version: 0.1.1 + "@pythnetwork/pyth-lazer-sdk": + specifier: ^0.3.1 + version: 0.3.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + "@solana/web3.js": + specifier: ^1.98.0 + version: 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) devDependencies: - '@cprussin/tsconfig': + "@cprussin/tsconfig": specifier: ^3.0.1 version: 3.0.1 - '@types/node': + "@types/node": specifier: ^22.10.0 version: 22.10.0 prettier: @@ -29,105 +31,542 @@ importers: version: 5.7.2 packages: - - '@cprussin/tsconfig@3.0.1': - resolution: {integrity: sha512-OBS2ew/pNjiWBI12kEt++8xKFE1rwZhitHOLHmqhNUs/1b4noi6k8nN0ZriV5ltTDP1l1jzYuaA69gwujaR28A==} - - '@cspotcode/source-map-support@0.8.1': - resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} - engines: {node: '>=12'} - - '@jridgewell/resolve-uri@3.1.2': - resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} - engines: {node: '>=6.0.0'} - - '@jridgewell/sourcemap-codec@1.5.0': - resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} - - '@jridgewell/trace-mapping@0.3.9': - resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} - - '@pythnetwork/pyth-lazer-sdk@0.1.1': - resolution: {integrity: sha512-/Zr9qbNi9YZb9Nl3ilkUKgeSQovevsXV57pIGrw04NFUmK4Ua92o2SyK8RRaqcw8zYtiDbseU1CgWHCfGYjRRQ==} - - '@tsconfig/node10@1.0.11': - resolution: {integrity: sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==} - - '@tsconfig/node12@1.0.11': - resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} - - '@tsconfig/node14@1.0.3': - resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} - - '@tsconfig/node16@1.0.4': - resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} - - '@types/node@22.10.0': - resolution: {integrity: sha512-XC70cRZVElFHfIUB40FgZOBbgJYFKKMa5nb9lxcwYstFG/Mi+/Y0bGS+rs6Dmhmkpq4pnNiLiuZAbc02YCOnmA==} + "@babel/runtime@7.26.0": + resolution: + { + integrity: sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==, + } + engines: { node: ">=6.9.0" } + + "@cprussin/tsconfig@3.0.1": + resolution: + { + integrity: sha512-OBS2ew/pNjiWBI12kEt++8xKFE1rwZhitHOLHmqhNUs/1b4noi6k8nN0ZriV5ltTDP1l1jzYuaA69gwujaR28A==, + } + + "@cspotcode/source-map-support@0.8.1": + resolution: + { + integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==, + } + engines: { node: ">=12" } + + "@isaacs/ttlcache@1.4.1": + resolution: + { + integrity: sha512-RQgQ4uQ+pLbqXfOmieB91ejmLwvSgv9nLx6sT6sD83s7umBypgg+OIBOBbEUiJXrfpnp9j0mRhYYdzp9uqq3lA==, + } + engines: { node: ">=12" } + + "@jridgewell/resolve-uri@3.1.2": + resolution: + { + integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==, + } + engines: { node: ">=6.0.0" } + + "@jridgewell/sourcemap-codec@1.5.0": + resolution: + { + integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==, + } + + "@jridgewell/trace-mapping@0.3.9": + resolution: + { + integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==, + } + + "@noble/curves@1.7.0": + resolution: + { + integrity: sha512-UTMhXK9SeDhFJVrHeUJ5uZlI6ajXg10O6Ddocf9S6GjbSBVZsJo88HzKwXznNfGpMTRDyJkqMjNDPYgf0qFWnw==, + } + engines: { node: ^14.21.3 || >=16 } + + "@noble/hashes@1.6.0": + resolution: + { + integrity: sha512-YUULf0Uk4/mAA89w+k3+yUYh6NrEvxZa5T6SY3wlMvE2chHkxFUUIDI8/XW1QSC357iA5pSnqt7XEhvFOqmDyQ==, + } + engines: { node: ^14.21.3 || >=16 } + + "@noble/hashes@1.6.1": + resolution: + { + integrity: sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w==, + } + engines: { node: ^14.21.3 || >=16 } + + "@pythnetwork/pyth-lazer-sdk@0.3.1": + resolution: + { + integrity: sha512-Zfk/PnGt8d+L4kklR+4AalKrhvqMFw7uP2/wzvFmLXU9G/vRUJiGaqQM2tbMTxQDWevUqVF2p6kNg306kd1C9g==, + } + + "@solana/buffer-layout@4.0.1": + resolution: + { + integrity: sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==, + } + engines: { node: ">=5.10" } + + "@solana/web3.js@1.98.0": + resolution: + { + integrity: sha512-nz3Q5OeyGFpFCR+erX2f6JPt3sKhzhYcSycBCSPkWjzSVDh/Rr1FqTVMRe58FKO16/ivTUcuJjeS5MyBvpkbzA==, + } + + "@swc/helpers@0.5.15": + resolution: + { + integrity: sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==, + } + + "@tsconfig/node10@1.0.11": + resolution: + { + integrity: sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==, + } + + "@tsconfig/node12@1.0.11": + resolution: + { + integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==, + } + + "@tsconfig/node14@1.0.3": + resolution: + { + integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==, + } + + "@tsconfig/node16@1.0.4": + resolution: + { + integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==, + } + + "@types/connect@3.4.38": + resolution: + { + integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==, + } + + "@types/node@12.20.55": + resolution: + { + integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==, + } + + "@types/node@22.10.0": + resolution: + { + integrity: sha512-XC70cRZVElFHfIUB40FgZOBbgJYFKKMa5nb9lxcwYstFG/Mi+/Y0bGS+rs6Dmhmkpq4pnNiLiuZAbc02YCOnmA==, + } + + "@types/uuid@8.3.4": + resolution: + { + integrity: sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==, + } + + "@types/ws@7.4.7": + resolution: + { + integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==, + } + + "@types/ws@8.5.13": + resolution: + { + integrity: sha512-osM/gWBTPKgHV8XkTunnegTRIsvF6owmf5w+JtAfOw472dptdm0dlGv4xCt6GwQRcC2XVOvvRE/0bAoQcL2QkA==, + } + + JSONStream@1.3.5: + resolution: + { + integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==, + } + hasBin: true acorn-walk@8.3.4: - resolution: {integrity: sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==} - engines: {node: '>=0.4.0'} + resolution: + { + integrity: sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==, + } + engines: { node: ">=0.4.0" } acorn@8.14.0: - resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==} - engines: {node: '>=0.4.0'} + resolution: + { + integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==, + } + engines: { node: ">=0.4.0" } hasBin: true + agentkeepalive@4.5.0: + resolution: + { + integrity: sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==, + } + engines: { node: ">= 8.0.0" } + arg@4.1.3: - resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} + resolution: + { + integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==, + } + + base-x@3.0.10: + resolution: + { + integrity: sha512-7d0s06rR9rYaIWHkpfLIFICM/tkSVdoPC9qYAQRpxn9DdKNWNsKC0uk++akckyLq16Tx2WIinnZ6WRriAt6njQ==, + } + + base64-js@1.5.1: + resolution: + { + integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==, + } + + bigint-buffer@1.1.5: + resolution: + { + integrity: sha512-trfYco6AoZ+rKhKnxA0hgX0HAbVP/s808/EuDSe2JDzUnCp/xAsli35Orvk67UrTEcwuxZqYZDmfA2RXJgxVvA==, + } + engines: { node: ">= 10.0.0" } + + bindings@1.5.0: + resolution: + { + integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==, + } + + bn.js@5.2.1: + resolution: + { + integrity: sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==, + } + + borsh@0.7.0: + resolution: + { + integrity: sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==, + } + + bs58@4.0.1: + resolution: + { + integrity: sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==, + } + + buffer@6.0.3: + resolution: + { + integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==, + } + + bufferutil@4.0.8: + resolution: + { + integrity: sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==, + } + engines: { node: ">=6.14.2" } + + commander@2.20.3: + resolution: + { + integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==, + } create-require@1.1.1: - resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} + resolution: + { + integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==, + } + + delay@5.0.0: + resolution: + { + integrity: sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==, + } + engines: { node: ">=10" } diff@4.0.2: - resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} - engines: {node: '>=0.3.1'} + resolution: + { + integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==, + } + engines: { node: ">=0.3.1" } + + es6-promise@4.2.8: + resolution: + { + integrity: sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==, + } + + es6-promisify@5.0.0: + resolution: + { + integrity: sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==, + } + + eventemitter3@5.0.1: + resolution: + { + integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==, + } + + eyes@0.1.8: + resolution: + { + integrity: sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==, + } + engines: { node: "> 0.1.90" } + + fast-stable-stringify@1.0.0: + resolution: + { + integrity: sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==, + } + + file-uri-to-path@1.0.0: + resolution: + { + integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==, + } + + humanize-ms@1.2.1: + resolution: + { + integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==, + } + + ieee754@1.2.1: + resolution: + { + integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==, + } + + isomorphic-ws@4.0.1: + resolution: + { + integrity: sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==, + } + peerDependencies: + ws: "*" isomorphic-ws@5.0.0: - resolution: {integrity: sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==} + resolution: + { + integrity: sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==, + } peerDependencies: - ws: '*' + ws: "*" + + jayson@4.1.3: + resolution: + { + integrity: sha512-LtXh5aYZodBZ9Fc3j6f2w+MTNcnxteMOrb+QgIouguGOulWi0lieEkOUg+HkjjFs0DGoWDds6bi4E9hpNFLulQ==, + } + engines: { node: ">=8" } + hasBin: true + + json-stringify-safe@5.0.1: + resolution: + { + integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==, + } + + jsonparse@1.3.1: + resolution: + { + integrity: sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==, + } + engines: { "0": node >= 0.2.0 } make-error@1.3.6: - resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} + resolution: + { + integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==, + } + + ms@2.1.3: + resolution: + { + integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==, + } + + node-fetch@2.7.0: + resolution: + { + integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==, + } + engines: { node: 4.x || >=6.0.0 } + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + + node-gyp-build@4.8.4: + resolution: + { + integrity: sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==, + } + hasBin: true prettier@3.4.1: - resolution: {integrity: sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==} - engines: {node: '>=14'} + resolution: + { + integrity: sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==, + } + engines: { node: ">=14" } hasBin: true + regenerator-runtime@0.14.1: + resolution: + { + integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==, + } + + rpc-websockets@9.0.4: + resolution: + { + integrity: sha512-yWZWN0M+bivtoNLnaDbtny4XchdAIF5Q4g/ZsC5UC61Ckbp0QczwO8fg44rV3uYmY4WHd+EZQbn90W1d8ojzqQ==, + } + + safe-buffer@5.2.1: + resolution: + { + integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==, + } + + superstruct@2.0.2: + resolution: + { + integrity: sha512-uV+TFRZdXsqXTL2pRvujROjdZQ4RAlBUS5BTh9IGm+jTqQntYThciG/qu57Gs69yjnVUSqdxF9YLmSnpupBW9A==, + } + engines: { node: ">=14.0.0" } + + text-encoding-utf-8@1.0.2: + resolution: + { + integrity: sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==, + } + + through@2.3.8: + resolution: + { + integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==, + } + + tr46@0.0.3: + resolution: + { + integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==, + } + + ts-log@2.2.7: + resolution: + { + integrity: sha512-320x5Ggei84AxzlXp91QkIGSw5wgaLT6GeAH0KsqDmRZdVWW2OiSeVvElVoatk3f7nicwXlElXsoFkARiGE2yg==, + } + ts-node@10.9.2: - resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} + resolution: + { + integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==, + } hasBin: true peerDependencies: - '@swc/core': '>=1.2.50' - '@swc/wasm': '>=1.2.50' - '@types/node': '*' - typescript: '>=2.7' + "@swc/core": ">=1.2.50" + "@swc/wasm": ">=1.2.50" + "@types/node": "*" + typescript: ">=2.7" peerDependenciesMeta: - '@swc/core': + "@swc/core": optional: true - '@swc/wasm': + "@swc/wasm": optional: true + tslib@2.8.1: + resolution: + { + integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==, + } + typescript@5.7.2: - resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} - engines: {node: '>=14.17'} + resolution: + { + integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==, + } + engines: { node: ">=14.17" } hasBin: true undici-types@6.20.0: - resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==} + resolution: + { + integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==, + } + + utf-8-validate@5.0.10: + resolution: + { + integrity: sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==, + } + engines: { node: ">=6.14.2" } + + uuid@8.3.2: + resolution: + { + integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==, + } + hasBin: true v8-compile-cache-lib@3.0.1: - resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} + resolution: + { + integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==, + } + + webidl-conversions@3.0.1: + resolution: + { + integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==, + } + + whatwg-url@5.0.0: + resolution: + { + integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==, + } + + ws@7.5.10: + resolution: + { + integrity: sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==, + } + 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 ws@8.18.0: - resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==} - engines: {node: '>=10.0.0'} + resolution: + { + integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==, + } + engines: { node: ">=10.0.0" } peerDependencies: bufferutil: ^4.0.1 - utf-8-validate: '>=5.0.2' + utf-8-validate: ">=5.0.2" peerDependenciesMeta: bufferutil: optional: true @@ -135,74 +574,272 @@ packages: optional: true yn@3.1.1: - resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} - engines: {node: '>=6'} + resolution: + { + integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==, + } + engines: { node: ">=6" } snapshots: + "@babel/runtime@7.26.0": + dependencies: + regenerator-runtime: 0.14.1 - '@cprussin/tsconfig@3.0.1': {} + "@cprussin/tsconfig@3.0.1": {} - '@cspotcode/source-map-support@0.8.1': + "@cspotcode/source-map-support@0.8.1": dependencies: - '@jridgewell/trace-mapping': 0.3.9 + "@jridgewell/trace-mapping": 0.3.9 + + "@isaacs/ttlcache@1.4.1": {} - '@jridgewell/resolve-uri@3.1.2': {} + "@jridgewell/resolve-uri@3.1.2": {} - '@jridgewell/sourcemap-codec@1.5.0': {} + "@jridgewell/sourcemap-codec@1.5.0": {} - '@jridgewell/trace-mapping@0.3.9': + "@jridgewell/trace-mapping@0.3.9": dependencies: - '@jridgewell/resolve-uri': 3.1.2 - '@jridgewell/sourcemap-codec': 1.5.0 + "@jridgewell/resolve-uri": 3.1.2 + "@jridgewell/sourcemap-codec": 1.5.0 - '@pythnetwork/pyth-lazer-sdk@0.1.1': + "@noble/curves@1.7.0": dependencies: - isomorphic-ws: 5.0.0(ws@8.18.0) - ws: 8.18.0 + "@noble/hashes": 1.6.0 + + "@noble/hashes@1.6.0": {} + + "@noble/hashes@1.6.1": {} + + "@pythnetwork/pyth-lazer-sdk@0.3.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)": + dependencies: + "@isaacs/ttlcache": 1.4.1 + "@solana/buffer-layout": 4.0.1 + "@solana/web3.js": 1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + isomorphic-ws: 5.0.0(ws@8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)) + ts-log: 2.2.7 + ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) transitivePeerDependencies: - bufferutil + - encoding - utf-8-validate - '@tsconfig/node10@1.0.11': {} + "@solana/buffer-layout@4.0.1": + dependencies: + buffer: 6.0.3 - '@tsconfig/node12@1.0.11': {} + "@solana/web3.js@1.98.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)": + dependencies: + "@babel/runtime": 7.26.0 + "@noble/curves": 1.7.0 + "@noble/hashes": 1.6.1 + "@solana/buffer-layout": 4.0.1 + agentkeepalive: 4.5.0 + bigint-buffer: 1.1.5 + bn.js: 5.2.1 + borsh: 0.7.0 + bs58: 4.0.1 + buffer: 6.0.3 + fast-stable-stringify: 1.0.0 + jayson: 4.1.3(bufferutil@4.0.8)(utf-8-validate@5.0.10) + node-fetch: 2.7.0 + rpc-websockets: 9.0.4 + superstruct: 2.0.2 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate - '@tsconfig/node14@1.0.3': {} + "@swc/helpers@0.5.15": + dependencies: + tslib: 2.8.1 + + "@tsconfig/node10@1.0.11": {} + + "@tsconfig/node12@1.0.11": {} + + "@tsconfig/node14@1.0.3": {} + + "@tsconfig/node16@1.0.4": {} + + "@types/connect@3.4.38": + dependencies: + "@types/node": 22.10.0 - '@tsconfig/node16@1.0.4': {} + "@types/node@12.20.55": {} - '@types/node@22.10.0': + "@types/node@22.10.0": dependencies: undici-types: 6.20.0 + "@types/uuid@8.3.4": {} + + "@types/ws@7.4.7": + dependencies: + "@types/node": 22.10.0 + + "@types/ws@8.5.13": + dependencies: + "@types/node": 22.10.0 + + JSONStream@1.3.5: + dependencies: + jsonparse: 1.3.1 + through: 2.3.8 + acorn-walk@8.3.4: dependencies: acorn: 8.14.0 acorn@8.14.0: {} + agentkeepalive@4.5.0: + dependencies: + humanize-ms: 1.2.1 + arg@4.1.3: {} + base-x@3.0.10: + dependencies: + safe-buffer: 5.2.1 + + base64-js@1.5.1: {} + + bigint-buffer@1.1.5: + dependencies: + bindings: 1.5.0 + + bindings@1.5.0: + dependencies: + file-uri-to-path: 1.0.0 + + bn.js@5.2.1: {} + + borsh@0.7.0: + dependencies: + bn.js: 5.2.1 + bs58: 4.0.1 + text-encoding-utf-8: 1.0.2 + + bs58@4.0.1: + dependencies: + base-x: 3.0.10 + + buffer@6.0.3: + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + + bufferutil@4.0.8: + dependencies: + node-gyp-build: 4.8.4 + optional: true + + commander@2.20.3: {} + create-require@1.1.1: {} + delay@5.0.0: {} + diff@4.0.2: {} - isomorphic-ws@5.0.0(ws@8.18.0): + es6-promise@4.2.8: {} + + es6-promisify@5.0.0: + dependencies: + es6-promise: 4.2.8 + + eventemitter3@5.0.1: {} + + eyes@0.1.8: {} + + fast-stable-stringify@1.0.0: {} + + file-uri-to-path@1.0.0: {} + + humanize-ms@1.2.1: + dependencies: + ms: 2.1.3 + + ieee754@1.2.1: {} + + isomorphic-ws@4.0.1(ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10)): + dependencies: + ws: 7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10) + + isomorphic-ws@5.0.0(ws@8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)): + dependencies: + ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + + jayson@4.1.3(bufferutil@4.0.8)(utf-8-validate@5.0.10): dependencies: - ws: 8.18.0 + "@types/connect": 3.4.38 + "@types/node": 12.20.55 + "@types/ws": 7.4.7 + JSONStream: 1.3.5 + commander: 2.20.3 + delay: 5.0.0 + es6-promisify: 5.0.0 + eyes: 0.1.8 + isomorphic-ws: 4.0.1(ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10)) + json-stringify-safe: 5.0.1 + uuid: 8.3.2 + ws: 7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10) + transitivePeerDependencies: + - bufferutil + - utf-8-validate + + json-stringify-safe@5.0.1: {} + + jsonparse@1.3.1: {} make-error@1.3.6: {} + ms@2.1.3: {} + + node-fetch@2.7.0: + dependencies: + whatwg-url: 5.0.0 + + node-gyp-build@4.8.4: + optional: true + prettier@3.4.1: {} + regenerator-runtime@0.14.1: {} + + rpc-websockets@9.0.4: + dependencies: + "@swc/helpers": 0.5.15 + "@types/uuid": 8.3.4 + "@types/ws": 8.5.13 + buffer: 6.0.3 + eventemitter3: 5.0.1 + uuid: 8.3.2 + ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + optionalDependencies: + bufferutil: 4.0.8 + utf-8-validate: 5.0.10 + + safe-buffer@5.2.1: {} + + superstruct@2.0.2: {} + + text-encoding-utf-8@1.0.2: {} + + through@2.3.8: {} + + tr46@0.0.3: {} + + ts-log@2.2.7: {} + ts-node@10.9.2(@types/node@22.10.0)(typescript@5.7.2): dependencies: - '@cspotcode/source-map-support': 0.8.1 - '@tsconfig/node10': 1.0.11 - '@tsconfig/node12': 1.0.11 - '@tsconfig/node14': 1.0.3 - '@tsconfig/node16': 1.0.4 - '@types/node': 22.10.0 + "@cspotcode/source-map-support": 0.8.1 + "@tsconfig/node10": 1.0.11 + "@tsconfig/node12": 1.0.11 + "@tsconfig/node14": 1.0.3 + "@tsconfig/node16": 1.0.4 + "@types/node": 22.10.0 acorn: 8.14.0 acorn-walk: 8.3.4 arg: 4.1.3 @@ -213,12 +850,36 @@ snapshots: v8-compile-cache-lib: 3.0.1 yn: 3.1.1 + tslib@2.8.1: {} + typescript@5.7.2: {} undici-types@6.20.0: {} + utf-8-validate@5.0.10: + dependencies: + node-gyp-build: 4.8.4 + optional: true + + uuid@8.3.2: {} + v8-compile-cache-lib@3.0.1: {} - ws@8.18.0: {} + webidl-conversions@3.0.1: {} + + whatwg-url@5.0.0: + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + + ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10): + optionalDependencies: + bufferutil: 4.0.8 + utf-8-validate: 5.0.10 + + ws@8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10): + optionalDependencies: + bufferutil: 4.0.8 + utf-8-validate: 5.0.10 yn@3.1.1: {} diff --git a/lazer/js/src/index.ts b/lazer/js/src/index.ts index 752820e..7723e66 100644 --- a/lazer/js/src/index.ts +++ b/lazer/js/src/index.ts @@ -1,37 +1,42 @@ import { PythLazerClient } from "@pythnetwork/pyth-lazer-sdk"; -/* eslint-disable no-console */ -const client = new PythLazerClient( - "wss://pyth-lazer-staging.dourolabs.app/v1/stream", - "my_token", -); -client.addMessageListener((message) => { - console.log("got message:", message); - switch (message.type) { - case "json": { - if (message.value.type == "streamUpdated") { - console.log( - "stream updated for subscription", - message.value.subscriptionId, - ":", - message.value.parsed?.priceFeeds, - ); - } - break; - } - case "binary": { - if ("solana" in message.value) { - console.log("solana message:", message.value.solana?.toString("hex")); +const main = async () => { + const client = await PythLazerClient.create( + ["wss://pyth-lazer-staging.dourolabs.app/v1/stream"], + "my_token", + ); + + client.addMessageListener((message) => { + console.log("got message:", message); + switch (message.type) { + case "json": { + if (message.value.type == "streamUpdated") { + console.log( + "stream updated for subscription", + message.value.subscriptionId, + ":", + message.value.parsed?.priceFeeds, + ); + } + break; } - if ("evm" in message.value) { - console.log("evm message:", message.value.evm?.toString("hex")); + case "binary": { + if ("solana" in message.value) { + console.log("solana message:", message.value.solana?.toString("hex")); + } + if ("evm" in message.value) { + console.log("evm message:", message.value.evm?.toString("hex")); + } + break; } - break; } - } -}); -client.ws.addEventListener("open", () => { - client.send({ + }); + + client.addAllConnectionsDownListener(() => { + console.log("All connections are down"); + }); + + client.subscribe({ type: "subscribe", subscriptionId: 1, priceFeedIds: [1, 2], @@ -41,4 +46,9 @@ client.ws.addEventListener("open", () => { channel: "fixed_rate@200ms", jsonBinaryEncoding: "hex", }); -}); + + // shutdown client after 10 seconds + setTimeout(() => client.shutdown(), 10000); +}; + +main(); diff --git a/lazer/js/src/publish.ts b/lazer/js/src/publish.ts new file mode 100644 index 0000000..20ef367 --- /dev/null +++ b/lazer/js/src/publish.ts @@ -0,0 +1,176 @@ +import { + PythLazerClient, + createEd25519Instruction, +} from "@pythnetwork/pyth-lazer-sdk"; +import fs from "fs"; + +import { + Connection, + Keypair, + Transaction, + sendAndConfirmTransaction, + TransactionInstruction, + PublicKey, + SystemProgram, +} from "@solana/web3.js"; +import { SYSVAR_INSTRUCTIONS_PUBKEY } from "@solana/web3.js"; + +const SOLANA_RPC_URL = "https://api.devnet.solana.com"; +const PAYER_SECRET_KEY = Uint8Array.from( + JSON.parse(fs.readFileSync("/path/to/private-key.json", "utf8")) as number[], +); +// Program ID of the example contract on devnet +const PROGRAM_ID = "HU64YGK66e1wdxD83D3snGuZEvfhM4YDdYShTfQvf6nm"; +// DATA PDA KEY of the example contract on devnet +const DATA_PDA_KEY = "7ndsKX3b8Jy8SScUPWvAtT4sir5JQpNrTBKxksfVVSuD"; +const PYTH_LAZER_SOLANA_CONTRACT_ID = + "pytd2yyk641x7ak7mkaasSJVXh6YYZnC7wTmtgAyxPt"; +const PYTH_LAZER_SOLANA_CONTRACT_STORAGE_ID = + "3rdJbqfnagQ4yx9HXJViD4zc4xpiSqmFsKpPuSCQVyQL"; +const PYTH_LAZER_SOLANA_CONTRACT_TREASURY_ID = + "opsLibxVY7Vz5eYMmSfX8cLFCFVYTtH6fr6MiifMpA7"; + +// Create a connection to the Solana cluster +const connection = new Connection(SOLANA_RPC_URL, "confirmed"); + +// Load the payer's keypair +const payer = Keypair.fromSecretKey(PAYER_SECRET_KEY); +const main = async () => { + const client = await PythLazerClient.create( + ["wss://pyth-lazer-staging.dourolabs.app/v1/stream"], + "my_token", + ); + + // data received from pyth lazer + let rawData: string | undefined = undefined; + + client.addMessageListener(async (message) => { + // avoid processing multiple messages + if (rawData) { + return; + } + + // received message from server + console.log("got message:", message); + + // We are expecting a JSON messages + if (message.type !== "json") { + console.log("unexpected message type:", message.type); + return; + } + + // ignore the subscribed message + if (message.value.type === "subscribed") { + return; + } + + // close the ws connection + // we only need 1 message + client.shutdown(); + + // We are expecting a streamUpdated message + if (message.value.type !== "streamUpdated") { + console.log("unexpected message value type:", message.value.type); + return; + } + + // Extract the base64 encoded data + rawData = message.value.solana?.data; + console.log("rawData:", rawData); + + // Decode the base64 encoded data + const instructionMessage = Buffer.from(rawData!, "hex"); + console.log("instructionMessage:", instructionMessage); + + // Create the ed25519 instruction + // The instruction index is 1 + // the starting offset is 9 (1 byte for the instruction index, 8 bytes for the program data) + // the rest of the data is the message + const ed25519Instr = createEd25519Instruction(instructionMessage, 1, 9); + console.log("ed25519Instr:", ed25519Instr); + + // concatenate the message to the end of the instruction + const verifyMessageData = Buffer.from([ + 1, + 42, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ...instructionMessage, + ]); + console.log("verifyMessageData:", verifyMessageData); + + // Create the verify message instruction + const verifyMessageInstr = new TransactionInstruction({ + keys: [ + { pubkey: payer.publicKey, isSigner: true, isWritable: true }, + { + pubkey: new PublicKey(DATA_PDA_KEY), + isSigner: false, + isWritable: true, + }, + { + pubkey: new PublicKey(PYTH_LAZER_SOLANA_CONTRACT_ID), + isSigner: false, + isWritable: true, + }, + { + pubkey: new PublicKey(PYTH_LAZER_SOLANA_CONTRACT_STORAGE_ID), + isSigner: false, + isWritable: false, + }, + { + pubkey: new PublicKey(PYTH_LAZER_SOLANA_CONTRACT_TREASURY_ID), + isSigner: false, + isWritable: true, + }, + // system program + { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }, + // sysvar + { + pubkey: SYSVAR_INSTRUCTIONS_PUBKEY, + isSigner: false, + isWritable: false, + }, + ], + programId: new PublicKey(PROGRAM_ID), + data: verifyMessageData, + }); + console.log("verifyMessageInstr:", verifyMessageInstr); + + // Create the transaction + // 1st instruction is the ed25519 instruction + // 2nd instruction is the verify message instruction + const transaction = new Transaction().add(ed25519Instr, verifyMessageInstr); + console.log("transaction:", transaction); + + const signature = await sendAndConfirmTransaction( + connection, + transaction, + [payer], + { + skipPreflight: true, + }, + ); + + console.log("Transaction confirmed with signature:", signature); + }); + + client.subscribe({ + type: "subscribe", + subscriptionId: 1, + // Example contract receives ETH/USD price + priceFeedIds: [2], + properties: ["price"], + chains: ["solana"], + deliveryFormat: "json", + channel: "real_time", + jsonBinaryEncoding: "hex", + }); +}; + +main(); diff --git a/lazer/js/tsconfig.json b/lazer/js/tsconfig.json index 0c7ef3c..32a3705 100644 --- a/lazer/js/tsconfig.json +++ b/lazer/js/tsconfig.json @@ -1,7 +1,4 @@ { "extends": "@cprussin/tsconfig/base.json", - "exclude": [ - "node_modules", - "dist" - ] + "exclude": ["node_modules", "dist"] }