flash-sdk 12.0.3-alpha.0 → 12.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2272,7 +2272,7 @@
2272
2272
  "tokenPrecision": 4,
2273
2273
  "isStable": false,
2274
2274
  "isVirtual": false,
2275
- "lazerId": 7,
2275
+ "lazerId": 1435,
2276
2276
  "pythTicker": "Equity.US.TSLA/USD",
2277
2277
  "pythPriceId": "0x16dad506d7db8da01c87581c87ca897a012a153557d4d578c3b9c9e1bc0632f1",
2278
2278
  "isToken2022": true
@@ -2285,7 +2285,7 @@
2285
2285
  "tokenPrecision": 4,
2286
2286
  "isStable": false,
2287
2287
  "isVirtual": false,
2288
- "lazerId": 182,
2288
+ "lazerId": 1314,
2289
2289
  "pythTicker": "Equity.US.NVDA/USD",
2290
2290
  "pythPriceId": "0xb1073854ed24cbc755dc527418f52b7d271f6cc967bbf8d8129112b18860a593",
2291
2291
  "isToken2022": true
@@ -2298,7 +2298,7 @@
2298
2298
  "tokenPrecision": 4,
2299
2299
  "isStable": false,
2300
2300
  "isVirtual": false,
2301
- "lazerId": 182,
2301
+ "lazerId": 1683,
2302
2302
  "pythTicker": "Equity.US.CRCL/USD",
2303
2303
  "pythPriceId": "0x92b8527aabe59ea2b12230f7b532769b133ffb118dfbd48ff676f14b273f1365",
2304
2304
  "isToken2022": true
@@ -2311,7 +2311,7 @@
2311
2311
  "tokenPrecision": 4,
2312
2312
  "isStable": false,
2313
2313
  "isVirtual": false,
2314
- "lazerId": 182,
2314
+ "lazerId": 1294,
2315
2315
  "pythTicker": "Equity.US.MSTR/USD",
2316
2316
  "pythPriceId": "0xe1e80251e5f5184f2195008382538e847fafc36f751896889dd3d1b1f6111f09",
2317
2317
  "isToken2022": true
@@ -2324,7 +2324,7 @@
2324
2324
  "tokenPrecision": 4,
2325
2325
  "isStable": false,
2326
2326
  "isVirtual": false,
2327
- "lazerId": 182,
2327
+ "lazerId": 1398,
2328
2328
  "pythTicker": "Equity.US.SPY/USD",
2329
2329
  "pythPriceId": "0x19e09bb805456ada3979a7d1cbb4b6d63babc3a0f8e8a9509f68afa5c4c11cd5",
2330
2330
  "isToken2022": true
@@ -2412,7 +2412,7 @@
2412
2412
  "isVirtual": false,
2413
2413
  "intOracleAddress": "GGCsvBtvBQrongLKGsMDTz9E4YeGmomrRDuZXwrTaWrS",
2414
2414
  "extOracleAddress": "HJGvGyWrAXdZPG4Q7LNkkKja72FDkJW7ixuyg3u6vZyP",
2415
- "lazerId": 1717,
2415
+ "lazerId": 1294,
2416
2416
  "pythTicker": "Equity.US.MSTR/USD",
2417
2417
  "pythPriceId": "0xe1e80251e5f5184f2195008382538e847fafc36f751896889dd3d1b1f6111f09"
2418
2418
  },
@@ -3755,9 +3755,9 @@
3755
3755
  "tokenPrecision": 4,
3756
3756
  "isStable": false,
3757
3757
  "isVirtual": false,
3758
- "lazerId": 102,
3759
- "pythTicker": "Crypto.W/USD",
3760
- "pythPriceId": "0xeff7446475e218517566ea99e72a4abec2e1bd8498b43b7d8331e29dcb059389",
3758
+ "lazerId": 2382,
3759
+ "pythTicker": "Crypto.MET/USD",
3760
+ "pythPriceId": "0x0292e0f405bcd4a496d34e48307f6787349ad2bcd8505c3d3a9f77d81a67a682",
3761
3761
  "isToken2022": false
3762
3762
  }
3763
3763
  ],
@@ -3894,9 +3894,9 @@
3894
3894
  "isVirtual": false,
3895
3895
  "intOracleAddress": "792tp3W9dzvfofq65LgtoJdfCdb9cRoXm1pAT3nxNEbG",
3896
3896
  "extOracleAddress": "BEMsCSQEGi2kwPA4mKnGjxnreijhMki7L4eeb96ypzF9",
3897
- "lazerId": 102,
3898
- "pythTicker": "Crypto.W/USD",
3899
- "pythPriceId": "0xeff7446475e218517566ea99e72a4abec2e1bd8498b43b7d8331e29dcb059389"
3897
+ "lazerId": 2382,
3898
+ "pythTicker": "Crypto.MET/USD",
3899
+ "pythPriceId": "0x0292e0f405bcd4a496d34e48307f6787349ad2bcd8505c3d3a9f77d81a67a682"
3900
3900
  }
3901
3901
  ],
3902
3902
  "markets": [
@@ -4725,7 +4725,7 @@
4725
4725
  "tokenPrecision": 4,
4726
4726
  "isStable": false,
4727
4727
  "isVirtual": false,
4728
- "lazerId": 7,
4728
+ "lazerId": 1435,
4729
4729
  "pythTicker": "Equity.US.TSLA/USD",
4730
4730
  "pythPriceId": "0x16dad506d7db8da01c87581c87ca897a012a153557d4d578c3b9c9e1bc0632f1",
4731
4731
  "isToken2022": true
@@ -4738,7 +4738,7 @@
4738
4738
  "tokenPrecision": 4,
4739
4739
  "isStable": false,
4740
4740
  "isVirtual": false,
4741
- "lazerId": 182,
4741
+ "lazerId": 1314,
4742
4742
  "pythTicker": "Equity.US.NVDA/USD",
4743
4743
  "pythPriceId": "0xb1073854ed24cbc755dc527418f52b7d271f6cc967bbf8d8129112b18860a593",
4744
4744
  "isToken2022": true
@@ -4751,7 +4751,7 @@
4751
4751
  "tokenPrecision": 4,
4752
4752
  "isStable": false,
4753
4753
  "isVirtual": false,
4754
- "lazerId": 182,
4754
+ "lazerId": 1683,
4755
4755
  "pythTicker": "Equity.US.CRCL/USD",
4756
4756
  "pythPriceId": "0x92b8527aabe59ea2b12230f7b532769b133ffb118dfbd48ff676f14b273f1365",
4757
4757
  "isToken2022": true
@@ -4764,7 +4764,7 @@
4764
4764
  "tokenPrecision": 4,
4765
4765
  "isStable": false,
4766
4766
  "isVirtual": false,
4767
- "lazerId": 182,
4767
+ "lazerId": 1294,
4768
4768
  "pythTicker": "Equity.US.MSTR/USD",
4769
4769
  "pythPriceId": "0xe1e80251e5f5184f2195008382538e847fafc36f751896889dd3d1b1f6111f09",
4770
4770
  "isToken2022": true
@@ -4777,7 +4777,7 @@
4777
4777
  "tokenPrecision": 4,
4778
4778
  "isStable": false,
4779
4779
  "isVirtual": false,
4780
- "lazerId": 182,
4780
+ "lazerId": 1398,
4781
4781
  "pythTicker": "Equity.US.SPY/USD",
4782
4782
  "pythPriceId": "0x19e09bb805456ada3979a7d1cbb4b6d63babc3a0f8e8a9509f68afa5c4c11cd5",
4783
4783
  "isToken2022": true
@@ -4865,7 +4865,7 @@
4865
4865
  "isVirtual": false,
4866
4866
  "intOracleAddress": "GYVGX3GvNr4peg1Ny8M5nouno8Hqq41VE9pwAbTzNTZV",
4867
4867
  "extOracleAddress": "HJGvGyWrAXdZPG4Q7LNkkKja72FDkJW7ixuyg3u6vZyP",
4868
- "lazerId": 1717,
4868
+ "lazerId": 1294,
4869
4869
  "pythTicker": "Equity.US.MSTR/USD",
4870
4870
  "pythPriceId": "0xe1e80251e5f5184f2195008382538e847fafc36f751896889dd3d1b1f6111f09"
4871
4871
  },
@@ -47,6 +47,27 @@ var web3_js_1 = require("@solana/web3.js");
47
47
  var bn_js_1 = __importDefault(require("bn.js"));
48
48
  var bs58_1 = __importDefault(require("bs58"));
49
49
  var tweetnacl_1 = __importDefault(require("tweetnacl"));
50
+ var BACKUP_ORACLE_SIZE = 36;
51
+ function encodePermissionlessPythCache(cache) {
52
+ var backupCache = cache.backupCache;
53
+ var buf = Buffer.alloc(4 + backupCache.length * BACKUP_ORACLE_SIZE);
54
+ buf.writeUInt32LE(backupCache.length, 0);
55
+ var offset = 4;
56
+ for (var _i = 0, backupCache_1 = backupCache; _i < backupCache_1.length; _i++) {
57
+ var oracle = backupCache_1[_i];
58
+ buf.writeBigInt64LE(BigInt(oracle.price.toString()), offset);
59
+ offset += 8;
60
+ buf.writeInt32LE(oracle.expo, offset);
61
+ offset += 4;
62
+ buf.writeBigInt64LE(BigInt(oracle.conf.toString()), offset);
63
+ offset += 8;
64
+ buf.writeBigInt64LE(BigInt(oracle.emaPrice.toString()), offset);
65
+ offset += 8;
66
+ buf.writeBigInt64LE(BigInt(oracle.publishTime.toString()), offset);
67
+ offset += 8;
68
+ }
69
+ return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
70
+ }
50
71
  var API_ENDPOINT = (_a = process.env.NEXT_PUBLIC_API_ENDPOINT) !== null && _a !== void 0 ? _a : 'https://api.prod.flash.trade';
51
72
  exports.pythPriceServiceConnection = new price_service_client_1.PriceServiceConnection('https://hermes.pyth.network', {
52
73
  priceFeedRequestConfig: {},
@@ -89,7 +110,7 @@ var getPythnetOraclePrices = function (program, poolConfig, backupOracleSecretKe
89
110
  permissionlessPythCache = {
90
111
  backupCache: caches_1
91
112
  };
92
- message = program._coder.types.encode('PermissionlessPythCache', permissionlessPythCache);
113
+ message = encodePermissionlessPythCache(permissionlessPythCache);
93
114
  signature = tweetnacl_1.default.sign.detached(message, backupOracleAccount.secretKey);
94
115
  preInstruction = web3_js_1.Ed25519Program.createInstructionWithPublicKey({
95
116
  publicKey: backupOracleAccount.publicKey.toBytes(),
@@ -115,7 +136,7 @@ var getBackupOracleInstruction = function (program, poolConfig, backupOracleSecr
115
136
  var permissionlessPythCache = {
116
137
  backupCache: backupCaches
117
138
  };
118
- var message = program._coder.types.encode('PermissionlessPythCache', permissionlessPythCache);
139
+ var message = encodePermissionlessPythCache(permissionlessPythCache);
119
140
  var signature = tweetnacl_1.default.sign.detached(message, backupOracleAccount.secretKey);
120
141
  var preInstruction = web3_js_1.Ed25519Program.createInstructionWithPublicKey({
121
142
  publicKey: backupOracleAccount.publicKey.toBytes(),