@lavarage/sdk 8.0.1 → 8.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.
- package/crossbar.ts +2 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/utils.ts +9 -1
package/crossbar.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { NATIVE_MINT } from "@solana/spl-token";
|
|
|
2
2
|
import { USDC_MINT } from "./constants";
|
|
3
3
|
import { Program } from "@coral-xyz/anchor";
|
|
4
4
|
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
5
|
-
import { getQueue } from "@switchboard-xyz/on-demand";
|
|
5
|
+
import { getQueue, isMainnetConnection, ON_DEMAND_DEVNET_QUEUE, ON_DEMAND_MAINNET_QUEUE } from "@switchboard-xyz/on-demand";
|
|
6
6
|
import { CrossbarClient } from "@switchboard-xyz/common";
|
|
7
7
|
import { retryWithBackoff } from "./utils";
|
|
8
8
|
import { Lavarage as LavarageSOL } from "./idl/lavarageSOL";
|
|
@@ -38,6 +38,7 @@ export async function getUpdateOracleIxs(program: Program<LavarageSOL | Lavarage
|
|
|
38
38
|
const queue = await getQueue({
|
|
39
39
|
// @ts-expect-error @coral-xyz/anchor versions mismatch
|
|
40
40
|
program,
|
|
41
|
+
queueAddress: await isMainnetConnection(program.provider.connection) ? ON_DEMAND_MAINNET_QUEUE : ON_DEMAND_DEVNET_QUEUE,
|
|
41
42
|
});
|
|
42
43
|
|
|
43
44
|
return await retryWithBackoff(async () => await queue.fetchManagedUpdateIxs(
|
package/dist/index.js
CHANGED
|
@@ -2253,7 +2253,12 @@ function retryWithBackoff(fn, maxRetries = 5, initialDelay = 1e3) {
|
|
|
2253
2253
|
function u8ArrayToString(input) {
|
|
2254
2254
|
const end = input.indexOf(0);
|
|
2255
2255
|
const bytes = new Uint8Array(end === -1 ? input : input.slice(0, end));
|
|
2256
|
-
|
|
2256
|
+
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
2257
|
+
try {
|
|
2258
|
+
return decoder.decode(bytes);
|
|
2259
|
+
} catch (e) {
|
|
2260
|
+
return "0x" + Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
2261
|
+
}
|
|
2257
2262
|
}
|
|
2258
2263
|
function isSolProgram(program) {
|
|
2259
2264
|
return program.programId.toBase58() === lavarageSOL_default.address;
|
|
@@ -2282,7 +2287,8 @@ function getUpdateOracleIxs(program, feedId, payer, apiKeys) {
|
|
|
2282
2287
|
return __async(this, null, function* () {
|
|
2283
2288
|
const queue = yield (0, import_on_demand2.getQueue)({
|
|
2284
2289
|
// @ts-expect-error @coral-xyz/anchor versions mismatch
|
|
2285
|
-
program
|
|
2290
|
+
program,
|
|
2291
|
+
queueAddress: (yield (0, import_on_demand2.isMainnetConnection)(program.provider.connection)) ? import_on_demand2.ON_DEMAND_MAINNET_QUEUE : import_on_demand2.ON_DEMAND_DEVNET_QUEUE
|
|
2286
2292
|
});
|
|
2287
2293
|
return yield retryWithBackoff(() => __async(null, null, function* () {
|
|
2288
2294
|
return yield queue.fetchManagedUpdateIxs(
|