@haven-fi/solauto-sdk 1.0.805 → 1.0.807
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.
@@ -1,10 +1,10 @@
|
|
1
1
|
import { Connection, PublicKey } from "@solana/web3.js";
|
2
2
|
import { Signer } from "@metaplex-foundation/umi";
|
3
|
-
import
|
3
|
+
import { PullFeed } from "@switchboard-xyz/on-demand";
|
4
4
|
import { TransactionItemInputs } from "../types";
|
5
5
|
export declare function getPullFeed(conn: Connection, mint: PublicKey, wallet?: PublicKey): Promise<{
|
6
|
-
gateway:
|
7
|
-
feed:
|
6
|
+
gateway: import("@switchboard-xyz/on-demand").Gateway;
|
7
|
+
feed: PullFeed;
|
8
8
|
}>;
|
9
9
|
export declare function buildSwbSubmitResponseTx(conn: Connection, signer: Signer, mint: PublicKey): Promise<TransactionItemInputs | undefined>;
|
10
10
|
export declare function getSwitchboardFeedData(conn: Connection, mints: PublicKey[]): Promise<{
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"switchboardUtils.d.ts","sourceRoot":"","sources":["../../src/utils/switchboardUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAGV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAsB,MAAM,0BAA0B,CAAC;AAGtE,OAAO,
|
1
|
+
{"version":3,"file":"switchboardUtils.d.ts","sourceRoot":"","sources":["../../src/utils/switchboardUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAGV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAsB,MAAM,0BAA0B,CAAC;AAGtE,OAAO,EACL,QAAQ,EAGT,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AASjD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,SAAS,EACf,MAAM,CAAC,EAAE,SAAS;;;GAiCnB;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAmD5C;AAED,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,SAAS,EAAE,GACjB,OAAO,CAAC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,EAAE,CAAC,CAuB/D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,WAEzD"}
|
@@ -1,37 +1,4 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
19
|
-
var ownKeys = function(o) {
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
21
|
-
var ar = [];
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
23
|
-
return ar;
|
24
|
-
};
|
25
|
-
return ownKeys(o);
|
26
|
-
};
|
27
|
-
return function (mod) {
|
28
|
-
if (mod && mod.__esModule) return mod;
|
29
|
-
var result = {};
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
31
|
-
__setModuleDefault(result, mod);
|
32
|
-
return result;
|
33
|
-
};
|
34
|
-
})();
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
36
3
|
exports.getPullFeed = getPullFeed;
|
37
4
|
exports.buildSwbSubmitResponseTx = buildSwbSubmitResponseTx;
|
@@ -41,7 +8,7 @@ const web3_js_1 = require("@solana/web3.js");
|
|
41
8
|
const umi_1 = require("@metaplex-foundation/umi");
|
42
9
|
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
43
10
|
const anchor_1 = require("@coral-xyz/anchor");
|
44
|
-
const
|
11
|
+
const on_demand_1 = require("@switchboard-xyz/on-demand");
|
45
12
|
const constants_1 = require("../constants");
|
46
13
|
const generalUtils_1 = require("./generalUtils");
|
47
14
|
const solanaUtils_1 = require("./solanaUtils");
|
@@ -54,16 +21,15 @@ async function getPullFeed(conn, mint, wallet) {
|
|
54
21
|
};
|
55
22
|
const provider = new anchor_1.AnchorProvider(conn, dummyWallet, anchor_1.AnchorProvider.defaultOptions());
|
56
23
|
(0, generalUtils_1.consoleLog)("Pulling SWB program...");
|
57
|
-
const
|
58
|
-
const sbProgram = await anchor_1.Program.at(ON_DEMAND_MAINNET_PID, provider);
|
24
|
+
const sbProgram = await anchor_1.Program.at(on_demand_1.ON_DEMAND_MAINNET_PID, provider);
|
59
25
|
const crossbar = new common_1.CrossbarClient("https://integrator-crossbar.mrgn.app/");
|
60
|
-
const queue = await Queue.loadDefault(sbProgram);
|
26
|
+
const queue = await on_demand_1.Queue.loadDefault(sbProgram);
|
61
27
|
const gateway = await queue.fetchGatewayFromCrossbar(crossbar);
|
62
28
|
(0, generalUtils_1.consoleLog)("Pulled SWB program!");
|
63
29
|
(0, generalUtils_1.consoleLog)("Feed id:", constants_1.SWITCHBOARD_PRICE_FEED_IDS[mint.toString()].feedId);
|
64
30
|
return {
|
65
31
|
gateway,
|
66
|
-
feed: new PullFeed(sbProgram, new web3_js_1.PublicKey(constants_1.SWITCHBOARD_PRICE_FEED_IDS[mint.toString()].feedId)),
|
32
|
+
feed: new on_demand_1.PullFeed(sbProgram, new web3_js_1.PublicKey(constants_1.SWITCHBOARD_PRICE_FEED_IDS[mint.toString()].feedId)),
|
67
33
|
};
|
68
34
|
}
|
69
35
|
async function buildSwbSubmitResponseTx(conn, signer, mint) {
|
@@ -100,7 +66,7 @@ async function buildSwbSubmitResponseTx(conn, signer, mint) {
|
|
100
66
|
lookupTableAddresses: responses
|
101
67
|
.filter((x) => Boolean(x.oracle.lut?.key))
|
102
68
|
.map((x) => x.oracle.lut.key.toString()),
|
103
|
-
orderPrio: -
|
69
|
+
orderPrio: -2,
|
104
70
|
};
|
105
71
|
}
|
106
72
|
async function getSwitchboardFeedData(conn, mints) {
|
package/local/txSandbox.ts
CHANGED
@@ -32,7 +32,7 @@ import {
|
|
32
32
|
import { getSecretKey } from "./shared";
|
33
33
|
import { NATIVE_MINT } from "@solana/spl-token";
|
34
34
|
|
35
|
-
const payForTransaction =
|
35
|
+
const payForTransaction = false;
|
36
36
|
const testProgram = false;
|
37
37
|
const lpEnv: ProgramEnv = "Prod";
|
38
38
|
|
@@ -64,17 +64,17 @@ export async function main() {
|
|
64
64
|
// lpPoolAccount: getMarginfiAccounts("Prod").defaultGroup,
|
65
65
|
});
|
66
66
|
|
67
|
-
// const transactionItems = [
|
68
|
-
// rebalance(client, 3000),
|
69
|
-
// ];
|
70
67
|
const transactionItems = [
|
71
|
-
|
72
|
-
async () => await buildSwbSubmitResponseTx(conn, signer, new PublicKey(NATIVE_MINT)),
|
73
|
-
// async () => await buildSwbSubmitResponseTx(conn, signer, new PublicKey(JUP_SOL)),
|
74
|
-
// async () => await buildSwbSubmitResponseTx(conn, signer, new PublicKey(JITO_SOL))
|
75
|
-
// async () => await buildSwbSubmitResponseTx(conn, signer, new PublicKey(H_SOL))
|
76
|
-
),
|
68
|
+
rebalance(client, 3000),
|
77
69
|
];
|
70
|
+
// const transactionItems = [
|
71
|
+
// new TransactionItem(
|
72
|
+
// async () => await buildSwbSubmitResponseTx(conn, signer, new PublicKey(NATIVE_MINT)),
|
73
|
+
// // async () => await buildSwbSubmitResponseTx(conn, signer, new PublicKey(JUP_SOL)),
|
74
|
+
// // async () => await buildSwbSubmitResponseTx(conn, signer, new PublicKey(JITO_SOL))
|
75
|
+
// // async () => await buildSwbSubmitResponseTx(conn, signer, new PublicKey(H_SOL))
|
76
|
+
// ),
|
77
|
+
// ];
|
78
78
|
|
79
79
|
const txManager = new ClientTransactionsManager({
|
80
80
|
txHandler: client,
|
package/package.json
CHANGED
@@ -6,8 +6,12 @@ import {
|
|
6
6
|
} from "@solana/web3.js";
|
7
7
|
import { Signer, transactionBuilder } from "@metaplex-foundation/umi";
|
8
8
|
import { toWeb3JsPublicKey } from "@metaplex-foundation/umi-web3js-adapters";
|
9
|
-
import { AnchorProvider,
|
10
|
-
import
|
9
|
+
import { AnchorProvider, Program } from "@coral-xyz/anchor";
|
10
|
+
import {
|
11
|
+
PullFeed,
|
12
|
+
Queue,
|
13
|
+
ON_DEMAND_MAINNET_PID,
|
14
|
+
} from "@switchboard-xyz/on-demand";
|
11
15
|
import Big from "big.js";
|
12
16
|
import { PRICES, SWITCHBOARD_PRICE_FEED_IDS } from "../constants";
|
13
17
|
import { TransactionItemInputs } from "../types";
|
@@ -40,7 +44,6 @@ export async function getPullFeed(
|
|
40
44
|
);
|
41
45
|
|
42
46
|
consoleLog("Pulling SWB program...");
|
43
|
-
const { PullFeed, Queue, ON_DEMAND_MAINNET_PID } = OnDemand;
|
44
47
|
const sbProgram = await Program.at(ON_DEMAND_MAINNET_PID, provider);
|
45
48
|
|
46
49
|
const crossbar = new CrossbarClient("https://integrator-crossbar.mrgn.app/");
|
@@ -111,7 +114,7 @@ export async function buildSwbSubmitResponseTx(
|
|
111
114
|
lookupTableAddresses: responses
|
112
115
|
.filter((x) => Boolean(x.oracle.lut?.key))
|
113
116
|
.map((x) => x.oracle.lut!.key.toString()),
|
114
|
-
orderPrio: -
|
117
|
+
orderPrio: -2,
|
115
118
|
};
|
116
119
|
}
|
117
120
|
|