@exponent-labs/meteora-idl 0.1.7 → 0.9.0
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/build/index.d.ts +123 -3
- package/build/index.js +18 -10
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +17 -10
package/build/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
1
3
|
/// <reference types="bn.js" />
|
|
4
|
+
import { BorshCoder, IdlAccounts, IdlTypes, web3 } from "@coral-xyz/anchor";
|
|
2
5
|
import { Amm } from "./meteora_amm";
|
|
3
6
|
import { Vault } from "./meteora_vault";
|
|
4
|
-
import { IdlAccounts, IdlTypes, web3 } from "@coral-xyz/anchor";
|
|
5
7
|
export declare const POOLS_IDL: {
|
|
6
8
|
version: string;
|
|
7
9
|
name: string;
|
|
@@ -235,6 +237,7 @@ export declare const POOLS_IDL: {
|
|
|
235
237
|
msg: string;
|
|
236
238
|
}[];
|
|
237
239
|
};
|
|
240
|
+
export declare const POOLS_IDL_CODER: BorshCoder<string, string>;
|
|
238
241
|
export declare const VAULT_IDL: {
|
|
239
242
|
version: string;
|
|
240
243
|
name: string;
|
|
@@ -353,13 +356,109 @@ export declare const VAULT_IDL: {
|
|
|
353
356
|
msg: string;
|
|
354
357
|
}[];
|
|
355
358
|
};
|
|
359
|
+
export declare const VAULT_IDL_CODER: BorshCoder<string, string>;
|
|
356
360
|
export declare const POOLS_PROGRAM: string;
|
|
357
361
|
export declare const VAULT_PROGRAM: string;
|
|
358
362
|
export type PoolState = IdlAccounts<Amm>["pool"];
|
|
359
363
|
export type VaultState = IdlAccounts<Vault>["vault"];
|
|
360
364
|
export type CurveType = IdlTypes<Amm>["CurveType"];
|
|
361
365
|
export type LockedProfitTracker = IdlTypes<Vault>["LockedProfitTracker"];
|
|
362
|
-
export declare const
|
|
366
|
+
export declare const decodePool: (data: Buffer) => {
|
|
367
|
+
lpMint: web3.PublicKey;
|
|
368
|
+
tokenAMint: web3.PublicKey;
|
|
369
|
+
tokenBMint: web3.PublicKey;
|
|
370
|
+
aVault: web3.PublicKey;
|
|
371
|
+
bVault: web3.PublicKey;
|
|
372
|
+
aVaultLp: web3.PublicKey;
|
|
373
|
+
bVaultLp: web3.PublicKey;
|
|
374
|
+
aVaultLpBump: number;
|
|
375
|
+
enabled: boolean;
|
|
376
|
+
protocolTokenAFee: web3.PublicKey;
|
|
377
|
+
protocolTokenBFee: web3.PublicKey;
|
|
378
|
+
feeLastUpdatedAt: import("bn.js");
|
|
379
|
+
padding0: number[];
|
|
380
|
+
fees: {
|
|
381
|
+
tradeFeeNumerator: import("bn.js");
|
|
382
|
+
tradeFeeDenominator: import("bn.js");
|
|
383
|
+
protocolTradeFeeNumerator: import("bn.js");
|
|
384
|
+
protocolTradeFeeDenominator: import("bn.js");
|
|
385
|
+
};
|
|
386
|
+
poolType: ({
|
|
387
|
+
permissionless?: never;
|
|
388
|
+
} & {
|
|
389
|
+
permissioned: Record<string, never>;
|
|
390
|
+
}) | ({
|
|
391
|
+
permissioned?: never;
|
|
392
|
+
} & {
|
|
393
|
+
permissionless: Record<string, never>;
|
|
394
|
+
});
|
|
395
|
+
stake: web3.PublicKey;
|
|
396
|
+
totalLockedLp: import("bn.js");
|
|
397
|
+
bootstrapping: {
|
|
398
|
+
activationPoint: import("bn.js");
|
|
399
|
+
whitelistedVault: web3.PublicKey;
|
|
400
|
+
poolCreator: web3.PublicKey;
|
|
401
|
+
activationType: number;
|
|
402
|
+
};
|
|
403
|
+
partnerInfo: {
|
|
404
|
+
feeNumerator: import("bn.js");
|
|
405
|
+
partnerAuthority: web3.PublicKey;
|
|
406
|
+
pendingFeeA: import("bn.js");
|
|
407
|
+
pendingFeeB: import("bn.js");
|
|
408
|
+
};
|
|
409
|
+
padding: {
|
|
410
|
+
padding0: number[];
|
|
411
|
+
padding1: import("bn.js")[];
|
|
412
|
+
padding2: import("bn.js")[];
|
|
413
|
+
};
|
|
414
|
+
curveType: ({
|
|
415
|
+
stable?: never;
|
|
416
|
+
} & {
|
|
417
|
+
constantProduct: Record<string, never>;
|
|
418
|
+
}) | ({
|
|
419
|
+
constantProduct?: never;
|
|
420
|
+
} & {
|
|
421
|
+
stable: {
|
|
422
|
+
amp: import("bn.js");
|
|
423
|
+
tokenMultiplier: {
|
|
424
|
+
tokenAMultiplier: import("bn.js");
|
|
425
|
+
tokenBMultiplier: import("bn.js");
|
|
426
|
+
precisionFactor: number;
|
|
427
|
+
};
|
|
428
|
+
depeg: {
|
|
429
|
+
baseVirtualPrice: import("bn.js");
|
|
430
|
+
baseCacheUpdated: import("bn.js");
|
|
431
|
+
depegType: ({
|
|
432
|
+
marinade?: never;
|
|
433
|
+
lido?: never;
|
|
434
|
+
splStake?: never;
|
|
435
|
+
} & {
|
|
436
|
+
none: Record<string, never>;
|
|
437
|
+
}) | ({
|
|
438
|
+
none?: never;
|
|
439
|
+
lido?: never;
|
|
440
|
+
splStake?: never;
|
|
441
|
+
} & {
|
|
442
|
+
marinade: Record<string, never>;
|
|
443
|
+
}) | ({
|
|
444
|
+
none?: never;
|
|
445
|
+
marinade?: never;
|
|
446
|
+
splStake?: never;
|
|
447
|
+
} & {
|
|
448
|
+
lido: Record<string, never>;
|
|
449
|
+
}) | ({
|
|
450
|
+
none?: never;
|
|
451
|
+
marinade?: never;
|
|
452
|
+
lido?: never;
|
|
453
|
+
} & {
|
|
454
|
+
splStake: Record<string, never>;
|
|
455
|
+
});
|
|
456
|
+
};
|
|
457
|
+
lastAmpUpdatedTimestamp: import("bn.js");
|
|
458
|
+
};
|
|
459
|
+
});
|
|
460
|
+
};
|
|
461
|
+
export declare const fetchPoolAccount: (connection: web3.Connection, accountPubkey: web3.PublicKey) => Promise<{
|
|
363
462
|
lpMint: web3.PublicKey;
|
|
364
463
|
tokenAMint: web3.PublicKey;
|
|
365
464
|
tokenBMint: web3.PublicKey;
|
|
@@ -454,7 +553,28 @@ export declare const decodePoolAccount: (connection: web3.Connection, accountPub
|
|
|
454
553
|
};
|
|
455
554
|
});
|
|
456
555
|
}>;
|
|
457
|
-
export declare const
|
|
556
|
+
export declare const decodeVault: (data: Buffer) => {
|
|
557
|
+
enabled: number;
|
|
558
|
+
bumps: {
|
|
559
|
+
vaultBump: number;
|
|
560
|
+
tokenVaultBump: number;
|
|
561
|
+
};
|
|
562
|
+
totalAmount: import("bn.js");
|
|
563
|
+
tokenVault: web3.PublicKey;
|
|
564
|
+
feeVault: web3.PublicKey;
|
|
565
|
+
tokenMint: web3.PublicKey;
|
|
566
|
+
lpMint: web3.PublicKey;
|
|
567
|
+
strategies: web3.PublicKey[];
|
|
568
|
+
base: web3.PublicKey;
|
|
569
|
+
admin: web3.PublicKey;
|
|
570
|
+
operator: web3.PublicKey;
|
|
571
|
+
lockedProfitTracker: {
|
|
572
|
+
lastUpdatedLockedProfit: import("bn.js");
|
|
573
|
+
lastReport: import("bn.js");
|
|
574
|
+
lockedProfitDegradation: import("bn.js");
|
|
575
|
+
};
|
|
576
|
+
};
|
|
577
|
+
export declare const fetchVaultAccount: (connection: web3.Connection, accountPubkey: web3.PublicKey) => Promise<{
|
|
458
578
|
enabled: number;
|
|
459
579
|
bumps: {
|
|
460
580
|
vaultBump: number;
|
package/build/index.js
CHANGED
|
@@ -23,24 +23,32 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.fetchVaultAccount = exports.decodeVault = exports.fetchPoolAccount = exports.decodePool = exports.VAULT_PROGRAM = exports.POOLS_PROGRAM = exports.VAULT_IDL_CODER = exports.VAULT_IDL = exports.POOLS_IDL_CODER = exports.POOLS_IDL = void 0;
|
|
27
|
+
const anchor_1 = require("@coral-xyz/anchor");
|
|
27
28
|
const pools_idl = __importStar(require("./meteora_amm.json"));
|
|
28
29
|
const vault_idl = __importStar(require("./meteora_vault.json"));
|
|
29
|
-
const anchor_1 = require("@coral-xyz/anchor");
|
|
30
30
|
exports.POOLS_IDL = pools_idl;
|
|
31
|
+
exports.POOLS_IDL_CODER = new anchor_1.BorshCoder(exports.POOLS_IDL);
|
|
31
32
|
exports.VAULT_IDL = vault_idl;
|
|
33
|
+
exports.VAULT_IDL_CODER = new anchor_1.BorshCoder(exports.VAULT_IDL);
|
|
32
34
|
exports.POOLS_PROGRAM = "Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB";
|
|
33
35
|
exports.VAULT_PROGRAM = "24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi";
|
|
34
|
-
const
|
|
36
|
+
const decodePool = (data) => {
|
|
37
|
+
return exports.POOLS_IDL_CODER.accounts.decode("pool", data);
|
|
38
|
+
};
|
|
39
|
+
exports.decodePool = decodePool;
|
|
40
|
+
const fetchPoolAccount = async (connection, accountPubkey) => {
|
|
35
41
|
const account = await connection.getAccountInfo(accountPubkey);
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
return (0, exports.decodePool)(account.data);
|
|
43
|
+
};
|
|
44
|
+
exports.fetchPoolAccount = fetchPoolAccount;
|
|
45
|
+
const decodeVault = (data) => {
|
|
46
|
+
return exports.VAULT_IDL_CODER.accounts.decode("Vault", data);
|
|
38
47
|
};
|
|
39
|
-
exports.
|
|
40
|
-
const
|
|
48
|
+
exports.decodeVault = decodeVault;
|
|
49
|
+
const fetchVaultAccount = async (connection, accountPubkey) => {
|
|
41
50
|
const account = await connection.getAccountInfo(accountPubkey);
|
|
42
|
-
|
|
43
|
-
return coder.accounts.decode("Vault", account.data);
|
|
51
|
+
return (0, exports.decodeVault)(account.data);
|
|
44
52
|
};
|
|
45
|
-
exports.
|
|
53
|
+
exports.fetchVaultAccount = fetchVaultAccount;
|
|
46
54
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAA+C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAgF;AAGhF,8DAA+C;AAE/C,gEAAiD;AAEpC,QAAA,SAAS,GAAG,SAAS,CAAA;AACrB,QAAA,eAAe,GAAG,IAAI,mBAAU,CAAC,iBAAgB,CAAC,CAAA;AAClD,QAAA,SAAS,GAAG,SAAS,CAAA;AACrB,QAAA,eAAe,GAAG,IAAI,mBAAU,CAAC,iBAAgB,CAAC,CAAA;AAClD,QAAA,aAAa,GAAW,8CAA8C,CAAA;AACtE,QAAA,aAAa,GAAW,8CAA8C,CAAA;AAO5E,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE;IACzC,OAAO,uBAAe,CAAC,QAAQ,CAAC,MAAM,CAAY,MAAM,EAAE,IAAI,CAAC,CAAA;AACjE,CAAC,CAAA;AAFY,QAAA,UAAU,cAEtB;AAEM,MAAM,gBAAgB,GAAG,KAAK,EAAE,UAA2B,EAAE,aAA6B,EAAE,EAAE;IACnG,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,cAAc,CAAC,aAAa,CAAC,CAAA;IAC9D,OAAO,IAAA,kBAAU,EAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AACjC,CAAC,CAAA;AAHY,QAAA,gBAAgB,oBAG5B;AAEM,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,EAAE;IAC1C,OAAO,uBAAe,CAAC,QAAQ,CAAC,MAAM,CAAa,OAAO,EAAE,IAAI,CAAC,CAAA;AACnE,CAAC,CAAA;AAFY,QAAA,WAAW,eAEvB;AAEM,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAA2B,EAAE,aAA6B,EAAE,EAAE;IACpG,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,cAAc,CAAC,aAAa,CAAC,CAAA;IAC9D,OAAO,IAAA,mBAAW,EAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAClC,CAAC,CAAA;AAHY,QAAA,iBAAiB,qBAG7B"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as vault_idl from "./meteora_vault.json"
|
|
1
|
+
import { BorshCoder, Idl, IdlAccounts, IdlTypes, web3 } from "@coral-xyz/anchor"
|
|
3
2
|
|
|
4
3
|
import { Amm } from "./meteora_amm"
|
|
4
|
+
import * as pools_idl from "./meteora_amm.json"
|
|
5
5
|
import { Vault } from "./meteora_vault"
|
|
6
|
-
|
|
7
|
-
import { IdlAccounts, IdlTypes, BorshCoder, Idl, web3 } from "@coral-xyz/anchor"
|
|
6
|
+
import * as vault_idl from "./meteora_vault.json"
|
|
8
7
|
|
|
9
8
|
export const POOLS_IDL = pools_idl
|
|
9
|
+
export const POOLS_IDL_CODER = new BorshCoder(POOLS_IDL as Idl)
|
|
10
10
|
export const VAULT_IDL = vault_idl
|
|
11
|
+
export const VAULT_IDL_CODER = new BorshCoder(VAULT_IDL as Idl)
|
|
11
12
|
export const POOLS_PROGRAM: string = "Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB"
|
|
12
13
|
export const VAULT_PROGRAM: string = "24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi"
|
|
13
14
|
|
|
@@ -16,14 +17,20 @@ export type VaultState = IdlAccounts<Vault>["vault"]
|
|
|
16
17
|
export type CurveType = IdlTypes<Amm>["CurveType"]
|
|
17
18
|
export type LockedProfitTracker = IdlTypes<Vault>["LockedProfitTracker"]
|
|
18
19
|
|
|
19
|
-
export const
|
|
20
|
+
export const decodePool = (data: Buffer) => {
|
|
21
|
+
return POOLS_IDL_CODER.accounts.decode<PoolState>("pool", data)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const fetchPoolAccount = async (connection: web3.Connection, accountPubkey: web3.PublicKey) => {
|
|
20
25
|
const account = await connection.getAccountInfo(accountPubkey)
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
return decodePool(account.data)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const decodeVault = (data: Buffer) => {
|
|
30
|
+
return VAULT_IDL_CODER.accounts.decode<VaultState>("Vault", data)
|
|
23
31
|
}
|
|
24
32
|
|
|
25
|
-
export const
|
|
33
|
+
export const fetchVaultAccount = async (connection: web3.Connection, accountPubkey: web3.PublicKey) => {
|
|
26
34
|
const account = await connection.getAccountInfo(accountPubkey)
|
|
27
|
-
|
|
28
|
-
return coder.accounts.decode("Vault", account.data) as VaultState
|
|
35
|
+
return decodeVault(account.data)
|
|
29
36
|
}
|