@symmetry-hq/temp-v3-sdk 0.0.1 → 0.0.2
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/dist/src/index.d.ts +2 -2
- package/dist/src/index.js +2 -2
- package/dist/src/states/oracles/pythOracle.d.ts +3 -3
- package/dist/src/txUtils.d.ts +13 -2
- package/dist/src/txUtils.js +5 -7
- package/package.json +3 -3
- package/src/index.ts +4 -4
- package/src/states/oracles/pythOracle.ts +3 -4
- package/src/txUtils.ts +18 -11
- package/dist/idl/idl.d.ts +0 -8
- package/dist/idl/idl.js +0 -4958
- package/dist/idl/types.d.ts +0 -4955
- package/dist/idl/types.js +0 -2
- package/dist/index.d.ts +0 -24
- package/dist/index.js +0 -60
- package/dist/layouts/basket.d.ts +0 -42
- package/dist/layouts/basket.js +0 -43
- package/dist/layouts/config.d.ts +0 -97
- package/dist/layouts/config.js +0 -102
- package/dist/layouts/fraction.d.ts +0 -6
- package/dist/layouts/fraction.js +0 -9
- package/dist/layouts/oracle.d.ts +0 -36
- package/dist/layouts/oracle.js +0 -37
- package/dist/src/idl/idl.d.ts +0 -8
- package/dist/src/idl/idl.js +0 -4958
- package/dist/src/idl/types.d.ts +0 -4955
- package/dist/src/idl/types.js +0 -2
- package/dist/src/instructions/accounts.d.ts +0 -27
- package/dist/src/instructions/accounts.js +0 -110
- package/dist/src/instructions/auction.d.ts +0 -7
- package/dist/src/instructions/auction.js +0 -43
- package/dist/src/instructions/basket.d.ts +0 -120
- package/dist/src/instructions/basket.js +0 -622
- package/dist/src/instructions/bounty.d.ts +0 -18
- package/dist/src/instructions/bounty.js +0 -81
- package/dist/src/instructions/fee.d.ts +0 -8
- package/dist/src/instructions/fee.js +0 -46
- package/dist/src/instructions/globalConfig.d.ts +0 -11
- package/dist/src/instructions/globalConfig.js +0 -43
- package/dist/src/instructions/luts.d.ts +0 -33
- package/dist/src/instructions/luts.js +0 -91
- package/dist/src/instructions/price.d.ts +0 -17
- package/dist/src/instructions/price.js +0 -47
- package/dist/src/states/oracles/clmm_oracle.d.ts +0 -178
- package/dist/src/states/oracles/clmm_oracle.js +0 -546
- package/dist/src/states/oracles/pyth_oracle.d.ts +0 -39
- package/dist/src/states/oracles/pyth_oracle.js +0 -202
- package/dist/src/states/oracles/raydium_cpmm_oracle.d.ts +0 -139
- package/dist/src/states/oracles/raydium_cpmm_oracle.js +0 -420
- package/dist/src/states/oracles/switchboard_oracle.d.ts +0 -0
- package/dist/src/states/oracles/switchboard_oracle.js +0 -1
- package/dist/states/basket.d.ts +0 -8
- package/dist/states/basket.js +0 -57
package/dist/src/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { BN
|
|
1
|
+
import { BN } from '@coral-xyz/anchor';
|
|
2
2
|
import { Connection, PublicKey, TransactionSignature } from '@solana/web3.js';
|
|
3
3
|
import { Basket } from './layouts/basket';
|
|
4
4
|
import { Fraction } from './layouts/fraction';
|
|
5
5
|
import { EditData, HostFees, Intent, MetadataParams, TaskType } from './layouts/intents/intent';
|
|
6
6
|
import { RebalanceIntent } from './layouts/intents/rebalanceIntent';
|
|
7
|
-
import { VersionedTxs } from './txUtils';
|
|
7
|
+
import { VersionedTxs, Wallet } from './txUtils';
|
|
8
8
|
export declare const COMPUTE_UNITS = 1000000;
|
|
9
9
|
export declare const PRIORITY_FEE = 100000;
|
|
10
10
|
export declare const JUPITER_API_KEY = "https://quote-api.jup.ag/v6/";
|
package/dist/src/index.js
CHANGED
|
@@ -190,8 +190,8 @@ class BasketsSdk {
|
|
|
190
190
|
}
|
|
191
191
|
signAndSendVersionedTxs(params) {
|
|
192
192
|
return __awaiter(this, void 0, void 0, function* () {
|
|
193
|
-
|
|
194
|
-
vtxs
|
|
193
|
+
let { vtxs, wallet } = params;
|
|
194
|
+
vtxs = yield (0, txUtils_1.signedVersionedTxs)({ wallet, vtxs });
|
|
195
195
|
return yield (0, txUtils_1.sendV0Transactions)(this.sdkParams.connection, vtxs, false);
|
|
196
196
|
});
|
|
197
197
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Decimal } from 'decimal.js';
|
|
2
|
-
import { AnchorProvider, BN
|
|
2
|
+
import { AnchorProvider, BN } from '@coral-xyz/anchor';
|
|
3
3
|
import { HermesClient } from '@pythnetwork/hermes-client';
|
|
4
4
|
import { Connection, PublicKey, Signer, TransactionSignature, VersionedTransaction } from '@solana/web3.js';
|
|
5
5
|
import { Oracle, OracleResult } from './oracle';
|
|
@@ -17,7 +17,7 @@ export declare class PythOracle extends Oracle {
|
|
|
17
17
|
priceFeedId: string;
|
|
18
18
|
private constructor();
|
|
19
19
|
static create(connection: Connection | undefined, priceFeedAccount: PublicKey, weight: number, priceClient?: HermesClient, confThreshBps?: number, stalenessThresh?: number, volatilityThresh?: Decimal, minLiquidity?: Decimal, stalenessConfRateBps?: number): Promise<PythOracle>;
|
|
20
|
-
static createWithId(connection: Connection | undefined, priceFeedId: string, wallet:
|
|
20
|
+
static createWithId(connection: Connection | undefined, priceFeedId: string, wallet: any, weight: number, priceClient?: HermesClient, confThreshBps?: number, stalenessThresh?: number, volatilityThresh?: Decimal, minLiquidity?: Decimal, stalenessConfRateBps?: number): Promise<PythOracle>;
|
|
21
21
|
getConfidence(): Decimal;
|
|
22
22
|
setPriceFeedId(priceFeedId: string): void;
|
|
23
23
|
fetch(): Promise<OracleResult>;
|
|
@@ -27,7 +27,7 @@ export declare class PythOracle extends Oracle {
|
|
|
27
27
|
* @param {number} shardId - between 0-2^64, default is 0
|
|
28
28
|
* @param {number} [computeUnitPrice] - compute unit price in microlamports, default is 100_000
|
|
29
29
|
*/
|
|
30
|
-
updateFeedTx(wallet:
|
|
30
|
+
updateFeedTx(wallet: any, shardId?: number, computeUnitPrice?: number): Promise<{
|
|
31
31
|
tx: VersionedTransaction;
|
|
32
32
|
signers: Signer[];
|
|
33
33
|
}[]>;
|
package/dist/src/txUtils.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Transaction } from '@solana/web3.js';
|
|
2
|
+
import { AddressLookupTableAccount, Connection, Keypair, PublicKey, TransactionInstruction, VersionedTransaction } from '@solana/web3.js';
|
|
2
3
|
export declare const COMPUTE_UNITS = 1000000;
|
|
3
4
|
type TransactionSignature = string;
|
|
5
|
+
export interface Wallet {
|
|
6
|
+
signTransaction<T extends Transaction | VersionedTransaction>(tx: T): Promise<T>;
|
|
7
|
+
signAllTransactions<T extends Transaction | VersionedTransaction>(txs: T[]): Promise<T[]>;
|
|
8
|
+
publicKey: PublicKey;
|
|
9
|
+
/** Keypair of the configured payer (Node only) */
|
|
10
|
+
payer?: Keypair;
|
|
11
|
+
}
|
|
4
12
|
export interface VersionedTxs {
|
|
5
13
|
blockhash: string;
|
|
6
14
|
lastValidBlockHeight: number;
|
|
@@ -22,5 +30,8 @@ export declare function prepareV0Transactions(params: {
|
|
|
22
30
|
batches: number[];
|
|
23
31
|
}): Promise<VersionedTxs>;
|
|
24
32
|
export declare function sendV0Transactions(connection: Connection, txParams: VersionedTxs, simulateTransactions: boolean): Promise<TransactionSignature[]>;
|
|
25
|
-
export declare function
|
|
33
|
+
export declare function signedVersionedTxs(params: {
|
|
34
|
+
wallet: Wallet;
|
|
35
|
+
vtxs: VersionedTxs;
|
|
36
|
+
}): Promise<VersionedTxs>;
|
|
26
37
|
export {};
|
package/dist/src/txUtils.js
CHANGED
|
@@ -17,7 +17,7 @@ exports.wrapV0Transaction = wrapV0Transaction;
|
|
|
17
17
|
exports.sendV0Transaction = sendV0Transaction;
|
|
18
18
|
exports.prepareV0Transactions = prepareV0Transactions;
|
|
19
19
|
exports.sendV0Transactions = sendV0Transactions;
|
|
20
|
-
exports.
|
|
20
|
+
exports.signedVersionedTxs = signedVersionedTxs;
|
|
21
21
|
const web3_js_1 = require("@solana/web3.js");
|
|
22
22
|
exports.COMPUTE_UNITS = 1000000;
|
|
23
23
|
function delay(ms) {
|
|
@@ -172,12 +172,10 @@ function sendV0Transactions(connection, txParams, simulateTransactions) {
|
|
|
172
172
|
return txIds;
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function signedVersionedTxs(params) {
|
|
176
176
|
return __awaiter(this, void 0, void 0, function* () {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
let tx = yield sendV0Transactions(connection, txs, false);
|
|
181
|
-
return tx;
|
|
177
|
+
const { wallet, vtxs } = params;
|
|
178
|
+
vtxs.versionedTxs = yield wallet.signAllTransactions(vtxs.versionedTxs);
|
|
179
|
+
return vtxs;
|
|
182
180
|
});
|
|
183
181
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symmetry-hq/temp-v3-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Symmetry Baskets V3 SDK",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
5
|
+
"main": "dist/src/index.js",
|
|
6
|
+
"types": "dist/src/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"prepare": "npm run build",
|
|
9
9
|
"build": "tsc",
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BN } from '@coral-xyz/anchor';
|
|
2
2
|
import { Connection, Keypair, PublicKey, TransactionSignature } from '@solana/web3.js';
|
|
3
3
|
|
|
4
4
|
import { BOUNTY_MINT } from './constants';
|
|
@@ -17,7 +17,7 @@ import { RebalanceIntent } from './layouts/intents/rebalanceIntent';
|
|
|
17
17
|
import { fetchBasket, fetchBaskets } from './states/basket';
|
|
18
18
|
import { fetchIntents } from './states/intents/intent';
|
|
19
19
|
import { fetchRebalanceIntents } from './states/intents/rebalanceIntent';
|
|
20
|
-
import { prepareV0Transactions, sendV0Transactions, VersionedTxs } from './txUtils';
|
|
20
|
+
import { prepareV0Transactions, sendV0Transactions, signedVersionedTxs, VersionedTxs, Wallet } from './txUtils';
|
|
21
21
|
|
|
22
22
|
export const COMPUTE_UNITS = 1_000_000;
|
|
23
23
|
export const PRIORITY_FEE = 100_000;
|
|
@@ -252,8 +252,8 @@ export class BasketsSdk {
|
|
|
252
252
|
vtxs: VersionedTxs,
|
|
253
253
|
wallet: Wallet,
|
|
254
254
|
}): Promise<TransactionSignature[]> {
|
|
255
|
-
|
|
256
|
-
vtxs
|
|
255
|
+
let { vtxs, wallet } = params;
|
|
256
|
+
vtxs = await signedVersionedTxs({ wallet, vtxs });
|
|
257
257
|
return await sendV0Transactions(this.sdkParams.connection, vtxs, false);
|
|
258
258
|
}
|
|
259
259
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Decimal } from 'decimal.js';
|
|
2
|
-
|
|
3
|
-
import { AnchorProvider, BN, Provider, Wallet } from '@coral-xyz/anchor';
|
|
2
|
+
import { AnchorProvider, BN } from '@coral-xyz/anchor';
|
|
4
3
|
import { HermesClient } from '@pythnetwork/hermes-client';
|
|
5
4
|
import { PythSolanaReceiver } from '@pythnetwork/pyth-solana-receiver';
|
|
6
5
|
import {
|
|
@@ -103,7 +102,7 @@ export class PythOracle extends Oracle {
|
|
|
103
102
|
static async createWithId(
|
|
104
103
|
connection: Connection = new Connection(SOLANA_DEVNET_ENDPOINT),
|
|
105
104
|
priceFeedId: string,
|
|
106
|
-
wallet:
|
|
105
|
+
wallet: any,
|
|
107
106
|
weight: number,
|
|
108
107
|
priceClient?: HermesClient,
|
|
109
108
|
confThreshBps?: number,
|
|
@@ -223,7 +222,7 @@ export class PythOracle extends Oracle {
|
|
|
223
222
|
* @param {number} shardId - between 0-2^64, default is 0
|
|
224
223
|
* @param {number} [computeUnitPrice] - compute unit price in microlamports, default is 100_000
|
|
225
224
|
*/
|
|
226
|
-
async updateFeedTx(wallet:
|
|
225
|
+
async updateFeedTx(wallet: any, shardId: number = 0, computeUnitPrice: number = 100000) {
|
|
227
226
|
if(!shardId) shardId = 0;
|
|
228
227
|
if(!computeUnitPrice) computeUnitPrice = 100000;
|
|
229
228
|
let priceUpdate = await this.priceClient.getLatestPriceUpdates([this.priceFeedId], {encoding: "base64"});
|
package/src/txUtils.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Transaction } from '@solana/web3.js';
|
|
1
2
|
import {
|
|
2
3
|
AddressLookupTableAccount, ComputeBudgetProgram, Connection, Keypair, PublicKey, Signer,
|
|
3
4
|
TransactionInstruction, TransactionMessage, VersionedTransaction
|
|
@@ -6,6 +7,14 @@ import {
|
|
|
6
7
|
export const COMPUTE_UNITS = 1_000_000;
|
|
7
8
|
type TransactionSignature = string;
|
|
8
9
|
|
|
10
|
+
export interface Wallet {
|
|
11
|
+
signTransaction<T extends Transaction | VersionedTransaction>(tx: T): Promise<T>;
|
|
12
|
+
signAllTransactions<T extends Transaction | VersionedTransaction>(txs: T[]): Promise<T[]>;
|
|
13
|
+
publicKey: PublicKey;
|
|
14
|
+
/** Keypair of the configured payer (Node only) */
|
|
15
|
+
payer?: Keypair;
|
|
16
|
+
}
|
|
17
|
+
|
|
9
18
|
export interface VersionedTxs {
|
|
10
19
|
blockhash: string;
|
|
11
20
|
lastValidBlockHeight: number;
|
|
@@ -237,14 +246,12 @@ export async function sendV0Transactions(
|
|
|
237
246
|
return txIds;
|
|
238
247
|
}
|
|
239
248
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
): Promise<
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
return tx;
|
|
250
|
-
}
|
|
249
|
+
|
|
250
|
+
export async function signedVersionedTxs(params: {
|
|
251
|
+
wallet: Wallet,
|
|
252
|
+
vtxs: VersionedTxs,
|
|
253
|
+
}): Promise<VersionedTxs> {
|
|
254
|
+
const { wallet, vtxs } = params;
|
|
255
|
+
vtxs.versionedTxs = await wallet.signAllTransactions(vtxs.versionedTxs);
|
|
256
|
+
return vtxs;
|
|
257
|
+
}
|
package/dist/idl/idl.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { BasketsProgram } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
* Program IDL in camelCase format in order to be used in JS/TS.
|
|
4
|
-
*
|
|
5
|
-
* Note that this is only a type helper and is not the actual IDL. The original
|
|
6
|
-
* IDL can be found at `target/idl/baskets_v3.json`.
|
|
7
|
-
*/
|
|
8
|
-
export declare const IDL: BasketsProgram;
|