flash-sdk 2.9.4 → 2.10.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/PerpetualsClient.d.ts +24 -2
- package/dist/PerpetualsClient.js +183 -1
- package/dist/PoolConfig.d.ts +14 -1
- package/dist/PoolConfig.js +9 -2
- package/dist/PoolConfig.json +70 -0
- package/dist/idl/reward_distribution.d.ts +328 -0
- package/dist/idl/reward_distribution.js +330 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -8,11 +8,12 @@ import { OraclePrice } from "./OraclePrice";
|
|
8
8
|
import { CustodyAccount } from "./CustodyAccount";
|
9
9
|
import { Perpetuals } from "./idl/perpetuals";
|
10
10
|
import { PerpComposability } from "./idl/perp_composability";
|
11
|
+
import { FbnftRewards } from "./idl/fbnft_rewards";
|
12
|
+
import { RewardDistribution } from "./idl/reward_distribution";
|
11
13
|
import { SendTransactionOpts } from "./utils/rpc";
|
12
14
|
import { MarketConfig, PoolConfig, Token } from "./PoolConfig";
|
13
15
|
import { max } from "bn.js";
|
14
16
|
import { MarketAccount } from "./MarketAccount";
|
15
|
-
import { FbnftRewards } from "./idl/fbnft_rewards";
|
16
17
|
export type PerpClientOptions = {
|
17
18
|
postSendTxCallback?: ({ txid }: {
|
18
19
|
txid: string;
|
@@ -25,6 +26,7 @@ export declare class PerpetualsClient {
|
|
25
26
|
program: Program<Perpetuals>;
|
26
27
|
programPerpComposability: Program<PerpComposability>;
|
27
28
|
programFbnftReward: Program<FbnftRewards>;
|
29
|
+
programRewardDistribution: Program<RewardDistribution>;
|
28
30
|
admin: PublicKey;
|
29
31
|
programId: PublicKey;
|
30
32
|
composabilityProgramId: PublicKey;
|
@@ -45,17 +47,25 @@ export declare class PerpetualsClient {
|
|
45
47
|
publicKey: PublicKey;
|
46
48
|
bump: number;
|
47
49
|
};
|
50
|
+
eventAuthorityRewardDistribution: {
|
51
|
+
publicKey: PublicKey;
|
52
|
+
bump: number;
|
53
|
+
};
|
48
54
|
private postSendTxCallback?;
|
49
55
|
private prioritizationFee;
|
50
56
|
private useExtOracleAccount;
|
51
57
|
private txConfirmationCommitment;
|
52
|
-
constructor(provider: AnchorProvider, programId: PublicKey, composabilityProgramId: PublicKey, fbNftRewardProgramId: PublicKey, opts: PerpClientOptions, useExtOracleAccount?: boolean);
|
58
|
+
constructor(provider: AnchorProvider, programId: PublicKey, composabilityProgramId: PublicKey, fbNftRewardProgramId: PublicKey, rewardDistributionProgramId: PublicKey, opts: PerpClientOptions, useExtOracleAccount?: boolean);
|
53
59
|
setPrioritizationFee: (fee: number) => void;
|
54
60
|
loadAddressLookupTable: (poolConfig: PoolConfig) => Promise<void>;
|
55
61
|
findProgramAddress: (label: string, extraSeeds?: any) => {
|
56
62
|
publicKey: PublicKey;
|
57
63
|
bump: number;
|
58
64
|
};
|
65
|
+
findProgramAddressFromProgramId: (label: string, extraSeeds?: any, programId?: PublicKey) => {
|
66
|
+
publicKey: PublicKey;
|
67
|
+
bump: number;
|
68
|
+
};
|
59
69
|
adjustTokenRatios: (ratios: TokenRatios[]) => {
|
60
70
|
target: BN;
|
61
71
|
min: BN;
|
@@ -2405,5 +2415,17 @@ export declare class PerpetualsClient {
|
|
2405
2415
|
instructions: TransactionInstruction[];
|
2406
2416
|
additionalSigners: Signer[];
|
2407
2417
|
}>;
|
2418
|
+
initRewardDistribution: (rewardSymbol: string, poolConfig: PoolConfig) => Promise<{
|
2419
|
+
instructions: TransactionInstruction[];
|
2420
|
+
additionalSigners: Signer[];
|
2421
|
+
}>;
|
2422
|
+
rewardDistribution: (counter: BN, owner: PublicKey, rewardAmount: BN, rewardSymbol: string, poolConfig: PoolConfig) => Promise<{
|
2423
|
+
instructions: TransactionInstruction[];
|
2424
|
+
additionalSigners: Signer[];
|
2425
|
+
}>;
|
2426
|
+
collectReward: (counter: BN, owner: PublicKey, rewardSymbol: string, poolConfig: PoolConfig, createUserATA?: boolean) => Promise<{
|
2427
|
+
instructions: TransactionInstruction[];
|
2428
|
+
additionalSigners: Signer[];
|
2429
|
+
}>;
|
2408
2430
|
sendTransaction(ixs: TransactionInstruction[], opts?: SendTransactionOpts): Promise<string>;
|
2409
2431
|
}
|
package/dist/PerpetualsClient.js
CHANGED
@@ -71,13 +71,14 @@ var OraclePrice_1 = require("./OraclePrice");
|
|
71
71
|
var perpetuals_1 = require("./idl/perpetuals");
|
72
72
|
var perp_composability_1 = require("./idl/perp_composability");
|
73
73
|
var fbnft_rewards_1 = require("./idl/fbnft_rewards");
|
74
|
+
var reward_distribution_1 = require("./idl/reward_distribution");
|
74
75
|
var rpc_1 = require("./utils/rpc");
|
75
76
|
var utils_1 = require("./utils");
|
76
77
|
var constants_1 = require("./constants");
|
77
78
|
var bignumber_js_1 = __importDefault(require("bignumber.js"));
|
78
79
|
var getNftAccounts_1 = require("./utils/getNftAccounts");
|
79
80
|
var PerpetualsClient = (function () {
|
80
|
-
function PerpetualsClient(provider, programId, composabilityProgramId, fbNftRewardProgramId, opts, useExtOracleAccount) {
|
81
|
+
function PerpetualsClient(provider, programId, composabilityProgramId, fbNftRewardProgramId, rewardDistributionProgramId, opts, useExtOracleAccount) {
|
81
82
|
if (useExtOracleAccount === void 0) { useExtOracleAccount = false; }
|
82
83
|
var _this = this;
|
83
84
|
var _a;
|
@@ -132,6 +133,27 @@ var PerpetualsClient = (function () {
|
|
132
133
|
var res = web3_js_1.PublicKey.findProgramAddressSync(seeds, _this.program.programId);
|
133
134
|
return { publicKey: res[0], bump: res[1] };
|
134
135
|
};
|
136
|
+
this.findProgramAddressFromProgramId = function (label, extraSeeds, programId) {
|
137
|
+
if (extraSeeds === void 0) { extraSeeds = null; }
|
138
|
+
if (programId === void 0) { programId = _this.program.programId; }
|
139
|
+
var seeds = [Buffer.from(anchor_1.utils.bytes.utf8.encode(label))];
|
140
|
+
if (extraSeeds) {
|
141
|
+
for (var _i = 0, extraSeeds_2 = extraSeeds; _i < extraSeeds_2.length; _i++) {
|
142
|
+
var extraSeed = extraSeeds_2[_i];
|
143
|
+
if (typeof extraSeed === "string") {
|
144
|
+
seeds.push(Buffer.from(anchor_1.utils.bytes.utf8.encode(extraSeed)));
|
145
|
+
}
|
146
|
+
else if (Array.isArray(extraSeed)) {
|
147
|
+
seeds.push(Buffer.from(extraSeed));
|
148
|
+
}
|
149
|
+
else {
|
150
|
+
seeds.push(extraSeed.toBuffer());
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
var res = web3_js_1.PublicKey.findProgramAddressSync(seeds, programId);
|
155
|
+
return { publicKey: res[0], bump: res[1] };
|
156
|
+
};
|
135
157
|
this.adjustTokenRatios = function (ratios) {
|
136
158
|
if (ratios.length == 0) {
|
137
159
|
return ratios;
|
@@ -4474,11 +4496,170 @@ var PerpetualsClient = (function () {
|
|
4474
4496
|
}
|
4475
4497
|
});
|
4476
4498
|
}); };
|
4499
|
+
this.initRewardDistribution = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
4500
|
+
var publicKey, rewardMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, transferAuthority, initRewardVault, err_28;
|
4501
|
+
return __generator(this, function (_a) {
|
4502
|
+
switch (_a.label) {
|
4503
|
+
case 0:
|
4504
|
+
publicKey = this.provider.wallet.publicKey;
|
4505
|
+
rewardMint = poolConfig.getTokenFromSymbol(rewardSymbol).mintKey;
|
4506
|
+
instructions = [];
|
4507
|
+
additionalSigners = [];
|
4508
|
+
_a.label = 1;
|
4509
|
+
case 1:
|
4510
|
+
_a.trys.push([1, 3, , 4]);
|
4511
|
+
fbNftProgramData = web3_js_1.PublicKey.findProgramAddressSync([this.programRewardDistribution.programId.toBuffer()], new web3_js_1.PublicKey("BPFLoaderUpgradeab1e11111111111111111111111"))[0];
|
4512
|
+
rewardVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("reward_vault")], this.programRewardDistribution.programId)[0];
|
4513
|
+
rewardTokenAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("reward_token_account")], this.programRewardDistribution.programId)[0];
|
4514
|
+
transferAuthority = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("transfer_authority")], this.programRewardDistribution.programId)[0];
|
4515
|
+
return [4, this.programRewardDistribution.methods
|
4516
|
+
.initRewardVault()
|
4517
|
+
.accounts({
|
4518
|
+
admin: publicKey,
|
4519
|
+
transferAuthority: transferAuthority,
|
4520
|
+
rewardVault: rewardVault,
|
4521
|
+
rewardMint: rewardMint,
|
4522
|
+
rewardTokenAccount: rewardTokenAccount,
|
4523
|
+
programData: fbNftProgramData,
|
4524
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
4525
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
4526
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY
|
4527
|
+
})
|
4528
|
+
.instruction()];
|
4529
|
+
case 2:
|
4530
|
+
initRewardVault = _a.sent();
|
4531
|
+
instructions.push(initRewardVault);
|
4532
|
+
return [3, 4];
|
4533
|
+
case 3:
|
4534
|
+
err_28 = _a.sent();
|
4535
|
+
console.log("rewardDistribution InitRewardVault error:: ", err_28);
|
4536
|
+
throw err_28;
|
4537
|
+
case 4: return [2, {
|
4538
|
+
instructions: __spreadArray([], instructions, true),
|
4539
|
+
additionalSigners: additionalSigners
|
4540
|
+
}];
|
4541
|
+
}
|
4542
|
+
});
|
4543
|
+
}); };
|
4544
|
+
this.rewardDistribution = function (counter, owner, rewardAmount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
4545
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, rewardRecord, distributeReward, err_29;
|
4546
|
+
return __generator(this, function (_a) {
|
4547
|
+
switch (_a.label) {
|
4548
|
+
case 0:
|
4549
|
+
publicKey = this.provider.wallet.publicKey;
|
4550
|
+
rewardCustodyMint = poolConfig.getTokenFromSymbol(rewardSymbol).mintKey;
|
4551
|
+
instructions = [];
|
4552
|
+
additionalSigners = [];
|
4553
|
+
_a.label = 1;
|
4554
|
+
case 1:
|
4555
|
+
_a.trys.push([1, 4, , 5]);
|
4556
|
+
return [4, (0, spl_token_1.getAssociatedTokenAddress)(rewardCustodyMint, publicKey)];
|
4557
|
+
case 2:
|
4558
|
+
fundingAccount = _a.sent();
|
4559
|
+
rewardVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("reward_vault")], this.programRewardDistribution.programId)[0];
|
4560
|
+
rewardTokenAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("reward_token_account")], this.programRewardDistribution.programId)[0];
|
4561
|
+
rewardRecord = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("reward_record"), owner.toBuffer(), rewardVault.toBuffer(), counter.toArrayLike(Buffer, 'le', 8)], this.programRewardDistribution.programId)[0];
|
4562
|
+
console.log("event Authority: ", this.eventAuthorityRewardDistribution.publicKey.toBase58());
|
4563
|
+
return [4, this.programRewardDistribution.methods
|
4564
|
+
.distributeRewards({
|
4565
|
+
rewardAmount: rewardAmount
|
4566
|
+
})
|
4567
|
+
.accounts({
|
4568
|
+
admin: publicKey,
|
4569
|
+
owner: owner,
|
4570
|
+
fundingAccount: fundingAccount,
|
4571
|
+
rewardVault: rewardVault,
|
4572
|
+
rewardTokenAccount: rewardTokenAccount,
|
4573
|
+
rewardRecord: rewardRecord,
|
4574
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
4575
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
4576
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY,
|
4577
|
+
eventAuthority: this.eventAuthorityRewardDistribution.publicKey,
|
4578
|
+
program: this.programRewardDistribution.programId
|
4579
|
+
})
|
4580
|
+
.instruction()];
|
4581
|
+
case 3:
|
4582
|
+
distributeReward = _a.sent();
|
4583
|
+
instructions.push(distributeReward);
|
4584
|
+
return [3, 5];
|
4585
|
+
case 4:
|
4586
|
+
err_29 = _a.sent();
|
4587
|
+
console.log("rewardDistribution distributeReward error:: ", err_29);
|
4588
|
+
throw err_29;
|
4589
|
+
case 5: return [2, {
|
4590
|
+
instructions: __spreadArray([], instructions, true),
|
4591
|
+
additionalSigners: additionalSigners
|
4592
|
+
}];
|
4593
|
+
}
|
4594
|
+
});
|
4595
|
+
}); };
|
4596
|
+
this.collectReward = function (counter, owner, rewardSymbol, poolConfig, createUserATA) {
|
4597
|
+
if (createUserATA === void 0) { createUserATA = true; }
|
4598
|
+
return __awaiter(_this, void 0, void 0, function () {
|
4599
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, receivingTokenAccount, _a, rewardVault, rewardTokenAccount, rewardRecord, transferAuthority, collectNftReward, err_30;
|
4600
|
+
return __generator(this, function (_b) {
|
4601
|
+
switch (_b.label) {
|
4602
|
+
case 0:
|
4603
|
+
publicKey = this.provider.wallet.publicKey;
|
4604
|
+
rewardCustodyMint = poolConfig.getTokenFromSymbol(rewardSymbol).mintKey;
|
4605
|
+
instructions = [];
|
4606
|
+
additionalSigners = [];
|
4607
|
+
_b.label = 1;
|
4608
|
+
case 1:
|
4609
|
+
_b.trys.push([1, 6, , 7]);
|
4610
|
+
return [4, (0, spl_token_1.getAssociatedTokenAddress)(rewardCustodyMint, publicKey)];
|
4611
|
+
case 2:
|
4612
|
+
receivingTokenAccount = _b.sent();
|
4613
|
+
_a = createUserATA;
|
4614
|
+
if (!_a) return [3, 4];
|
4615
|
+
return [4, (0, utils_1.checkIfAccountExists)(receivingTokenAccount, this.provider.connection)];
|
4616
|
+
case 3:
|
4617
|
+
_a = !(_b.sent());
|
4618
|
+
_b.label = 4;
|
4619
|
+
case 4:
|
4620
|
+
if (_a) {
|
4621
|
+
instructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, receivingTokenAccount, publicKey, rewardCustodyMint));
|
4622
|
+
}
|
4623
|
+
rewardVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("reward_vault")], this.programRewardDistribution.programId)[0];
|
4624
|
+
rewardTokenAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("reward_token_account")], this.programRewardDistribution.programId)[0];
|
4625
|
+
rewardRecord = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("reward_record"), owner.toBuffer(), rewardVault.toBuffer(), counter.toArrayLike(Buffer, 'le', 8)], this.programRewardDistribution.programId)[0];
|
4626
|
+
transferAuthority = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("transfer_authority")], this.programRewardDistribution.programId)[0];
|
4627
|
+
return [4, this.programRewardDistribution.methods
|
4628
|
+
.collectReward()
|
4629
|
+
.accounts({
|
4630
|
+
admin: publicKey,
|
4631
|
+
owner: publicKey,
|
4632
|
+
receivingAccount: receivingTokenAccount,
|
4633
|
+
rewardVault: rewardVault,
|
4634
|
+
rewardTokenAccount: rewardTokenAccount,
|
4635
|
+
rewardRecord: rewardRecord,
|
4636
|
+
transferAuthority: transferAuthority,
|
4637
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
4638
|
+
eventAuthority: this.eventAuthorityRewardDistribution.publicKey,
|
4639
|
+
program: this.programRewardDistribution.programId
|
4640
|
+
})
|
4641
|
+
.instruction()];
|
4642
|
+
case 5:
|
4643
|
+
collectNftReward = _b.sent();
|
4644
|
+
instructions.push(collectNftReward);
|
4645
|
+
return [3, 7];
|
4646
|
+
case 6:
|
4647
|
+
err_30 = _b.sent();
|
4648
|
+
throw err_30;
|
4649
|
+
case 7: return [2, {
|
4650
|
+
instructions: __spreadArray([], instructions, true),
|
4651
|
+
additionalSigners: additionalSigners
|
4652
|
+
}];
|
4653
|
+
}
|
4654
|
+
});
|
4655
|
+
});
|
4656
|
+
};
|
4477
4657
|
this.provider = provider;
|
4478
4658
|
(0, anchor_1.setProvider)(provider);
|
4479
4659
|
this.program = new anchor_1.Program(perpetuals_1.IDL, programId);
|
4480
4660
|
this.programPerpComposability = new anchor_1.Program(perp_composability_1.IDL, composabilityProgramId);
|
4481
4661
|
this.programFbnftReward = new anchor_1.Program(fbnft_rewards_1.IDL, fbNftRewardProgramId);
|
4662
|
+
this.programRewardDistribution = new anchor_1.Program(reward_distribution_1.IDL, rewardDistributionProgramId);
|
4482
4663
|
this.programId = programId;
|
4483
4664
|
this.composabilityProgramId = composabilityProgramId;
|
4484
4665
|
this.admin = this.provider.wallet.publicKey;
|
@@ -4486,6 +4667,7 @@ var PerpetualsClient = (function () {
|
|
4486
4667
|
this.authority = this.findProgramAddress("transfer_authority");
|
4487
4668
|
this.perpetuals = this.findProgramAddress("perpetuals");
|
4488
4669
|
this.eventAuthority = this.findProgramAddress("__event_authority");
|
4670
|
+
this.eventAuthorityRewardDistribution = this.findProgramAddressFromProgramId("__event_authority", null, this.programRewardDistribution.programId);
|
4489
4671
|
this.prioritizationFee = (opts === null || opts === void 0 ? void 0 : opts.prioritizationFee) || 0;
|
4490
4672
|
this.useExtOracleAccount = useExtOracleAccount;
|
4491
4673
|
this.postSendTxCallback = opts === null || opts === void 0 ? void 0 : opts.postSendTxCallback;
|
package/dist/PoolConfig.d.ts
CHANGED
@@ -59,10 +59,23 @@ export declare class PoolConfig {
|
|
59
59
|
addressLookupTableAddresses: PublicKey[];
|
60
60
|
backupOracle: PublicKey;
|
61
61
|
nftCollectionAddress: PublicKey;
|
62
|
+
rewardDistributionProgram: {
|
63
|
+
programId: PublicKey;
|
64
|
+
transferAuthority: PublicKey;
|
65
|
+
rewardVault: PublicKey;
|
66
|
+
rewardMint: PublicKey;
|
67
|
+
rewardTokenAccount: PublicKey;
|
68
|
+
};
|
62
69
|
tokens: Token[];
|
63
70
|
custodies: CustodyConfig[];
|
64
71
|
markets: MarketConfig[];
|
65
|
-
constructor(programId: PublicKey, perpComposibilityProgramId: PublicKey, fbNftRewardProgramId: PublicKey, cluster: Cluster, poolName: string, poolAddress: PublicKey, lpTokenMint: PublicKey, flpTokenAccount: PublicKey, lpDecimals: number, lpTokenSymbol: string, perpetuals: PublicKey, transferAuthority: PublicKey, multisig: PublicKey, addressLookupTableAddresses: PublicKey[], backupOracle: PublicKey, nftCollectionAddress: PublicKey,
|
72
|
+
constructor(programId: PublicKey, perpComposibilityProgramId: PublicKey, fbNftRewardProgramId: PublicKey, cluster: Cluster, poolName: string, poolAddress: PublicKey, lpTokenMint: PublicKey, flpTokenAccount: PublicKey, lpDecimals: number, lpTokenSymbol: string, perpetuals: PublicKey, transferAuthority: PublicKey, multisig: PublicKey, addressLookupTableAddresses: PublicKey[], backupOracle: PublicKey, nftCollectionAddress: PublicKey, rewardDistributionProgram: {
|
73
|
+
programId: PublicKey;
|
74
|
+
transferAuthority: PublicKey;
|
75
|
+
rewardVault: PublicKey;
|
76
|
+
rewardMint: PublicKey;
|
77
|
+
rewardTokenAccount: PublicKey;
|
78
|
+
}, tokens: Token[], custodies: CustodyConfig[], markets: MarketConfig[]);
|
66
79
|
getAllTokenMints(): PublicKey[];
|
67
80
|
getMarketConfigByPk(marketAccountPk: PublicKey): MarketConfig;
|
68
81
|
getMarketConfig(targetCustody: PublicKey, collateralCustody: PublicKey, side: Side): MarketConfig | null;
|
package/dist/PoolConfig.js
CHANGED
@@ -19,7 +19,7 @@ var web3_js_1 = require("@solana/web3.js");
|
|
19
19
|
var PoolConfig_json_1 = __importDefault(require("./PoolConfig.json"));
|
20
20
|
var types_1 = require("./types");
|
21
21
|
var PoolConfig = (function () {
|
22
|
-
function PoolConfig(programId, perpComposibilityProgramId, fbNftRewardProgramId, cluster, poolName, poolAddress, lpTokenMint, flpTokenAccount, lpDecimals, lpTokenSymbol, perpetuals, transferAuthority, multisig, addressLookupTableAddresses, backupOracle, nftCollectionAddress, tokens, custodies, markets) {
|
22
|
+
function PoolConfig(programId, perpComposibilityProgramId, fbNftRewardProgramId, cluster, poolName, poolAddress, lpTokenMint, flpTokenAccount, lpDecimals, lpTokenSymbol, perpetuals, transferAuthority, multisig, addressLookupTableAddresses, backupOracle, nftCollectionAddress, rewardDistributionProgram, tokens, custodies, markets) {
|
23
23
|
var _this = this;
|
24
24
|
this.programId = programId;
|
25
25
|
this.perpComposibilityProgramId = perpComposibilityProgramId;
|
@@ -37,6 +37,7 @@ var PoolConfig = (function () {
|
|
37
37
|
this.addressLookupTableAddresses = addressLookupTableAddresses;
|
38
38
|
this.backupOracle = backupOracle;
|
39
39
|
this.nftCollectionAddress = nftCollectionAddress;
|
40
|
+
this.rewardDistributionProgram = rewardDistributionProgram;
|
40
41
|
this.tokens = tokens;
|
41
42
|
this.custodies = custodies;
|
42
43
|
this.markets = markets;
|
@@ -162,7 +163,13 @@ var PoolConfig = (function () {
|
|
162
163
|
catch (error) {
|
163
164
|
console.log("ERROR: buildPoolconfigFromJson unable to load markets ");
|
164
165
|
}
|
165
|
-
return new PoolConfig(new web3_js_1.PublicKey(poolConfig.programId), new web3_js_1.PublicKey(poolConfig.perpComposibilityProgramId), new web3_js_1.PublicKey(poolConfig.fbNftRewardProgramId), poolConfig.cluster, poolConfig.poolName, new web3_js_1.PublicKey(poolConfig.poolAddress), new web3_js_1.PublicKey(poolConfig.lpTokenMint), new web3_js_1.PublicKey(poolConfig.flpTokenAccount), poolConfig.lpDecimals, poolConfig.lpTokenSymbol, new web3_js_1.PublicKey(poolConfig.perpetuals), new web3_js_1.PublicKey(poolConfig.transferAuthority), new web3_js_1.PublicKey(poolConfig.multisig), addressLookupTableAddresses, new web3_js_1.PublicKey(poolConfig.backupOracle), new web3_js_1.PublicKey(poolConfig.nftCollectionAddress),
|
166
|
+
return new PoolConfig(new web3_js_1.PublicKey(poolConfig.programId), new web3_js_1.PublicKey(poolConfig.perpComposibilityProgramId), new web3_js_1.PublicKey(poolConfig.fbNftRewardProgramId), poolConfig.cluster, poolConfig.poolName, new web3_js_1.PublicKey(poolConfig.poolAddress), new web3_js_1.PublicKey(poolConfig.lpTokenMint), new web3_js_1.PublicKey(poolConfig.flpTokenAccount), poolConfig.lpDecimals, poolConfig.lpTokenSymbol, new web3_js_1.PublicKey(poolConfig.perpetuals), new web3_js_1.PublicKey(poolConfig.transferAuthority), new web3_js_1.PublicKey(poolConfig.multisig), addressLookupTableAddresses, new web3_js_1.PublicKey(poolConfig.backupOracle), new web3_js_1.PublicKey(poolConfig.nftCollectionAddress), {
|
167
|
+
programId: new web3_js_1.PublicKey(poolConfig.rewardDistributionProgram.programId),
|
168
|
+
rewardMint: new web3_js_1.PublicKey(poolConfig.rewardDistributionProgram.rewardMint),
|
169
|
+
rewardTokenAccount: new web3_js_1.PublicKey(poolConfig.rewardDistributionProgram.rewardTokenAccount),
|
170
|
+
rewardVault: new web3_js_1.PublicKey(poolConfig.rewardDistributionProgram.rewardVault),
|
171
|
+
transferAuthority: new web3_js_1.PublicKey(poolConfig.rewardDistributionProgram.transferAuthority),
|
172
|
+
}, tokens, custodies, markets);
|
166
173
|
};
|
167
174
|
PoolConfig.fromIdsByName = function (name, cluster) {
|
168
175
|
var poolConfig = PoolConfig_json_1.default.pools.find(function (pool) { return pool['poolName'] === name && cluster === pool['cluster']; });
|
package/dist/PoolConfig.json
CHANGED
@@ -26,6 +26,13 @@
|
|
26
26
|
],
|
27
27
|
"backupOracle": "AjAubETeBLhebBxLcErmzbavZfqF9bCxkpRAdyJtoi9G",
|
28
28
|
"nftCollectionAddress": "H4EQ8pcE7PQSQGG1WYW4hAA1nizU6ULYipHZcYk9b64u",
|
29
|
+
"rewardDistributionProgram": {
|
30
|
+
"programId": "FARTfzmezUtejeF42vfyvX96NWq1BuAcXFiAQuz6wZZg",
|
31
|
+
"transferAuthority": "4cgNvcrPFxmgJVyQNJqM8Sb6eJnDktr5mWA3gSkdNcyT",
|
32
|
+
"rewardVault": "DrXUtn8BRUYAo1i3ZTkPRXqU7w2KGbCjiskzH8wGExGK",
|
33
|
+
"rewardMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
34
|
+
"rewardTokenAccount": "6X9LbFxtvjGxBEgHiE3KLQjJtAqkThqrhCufLhrPfMEp"
|
35
|
+
},
|
29
36
|
"tokens": [
|
30
37
|
{
|
31
38
|
"symbol": "USDC",
|
@@ -250,6 +257,13 @@
|
|
250
257
|
],
|
251
258
|
"backupOracle": "AjAubETeBLhebBxLcErmzbavZfqF9bCxkpRAdyJtoi9G",
|
252
259
|
"nftCollectionAddress": "H4EQ8pcE7PQSQGG1WYW4hAA1nizU6ULYipHZcYk9b64u",
|
260
|
+
"rewardDistributionProgram": {
|
261
|
+
"programId": "FARTfzmezUtejeF42vfyvX96NWq1BuAcXFiAQuz6wZZg",
|
262
|
+
"transferAuthority": "4cgNvcrPFxmgJVyQNJqM8Sb6eJnDktr5mWA3gSkdNcyT",
|
263
|
+
"rewardVault": "DrXUtn8BRUYAo1i3ZTkPRXqU7w2KGbCjiskzH8wGExGK",
|
264
|
+
"rewardMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
265
|
+
"rewardTokenAccount": "6X9LbFxtvjGxBEgHiE3KLQjJtAqkThqrhCufLhrPfMEp"
|
266
|
+
},
|
253
267
|
"tokens": [
|
254
268
|
{
|
255
269
|
"symbol": "USDC",
|
@@ -569,6 +583,13 @@
|
|
569
583
|
],
|
570
584
|
"backupOracle": "AjAubETeBLhebBxLcErmzbavZfqF9bCxkpRAdyJtoi9G",
|
571
585
|
"nftCollectionAddress": "H4EQ8pcE7PQSQGG1WYW4hAA1nizU6ULYipHZcYk9b64u",
|
586
|
+
"rewardDistributionProgram": {
|
587
|
+
"programId": "FARTfzmezUtejeF42vfyvX96NWq1BuAcXFiAQuz6wZZg",
|
588
|
+
"transferAuthority": "4cgNvcrPFxmgJVyQNJqM8Sb6eJnDktr5mWA3gSkdNcyT",
|
589
|
+
"rewardVault": "DrXUtn8BRUYAo1i3ZTkPRXqU7w2KGbCjiskzH8wGExGK",
|
590
|
+
"rewardMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
591
|
+
"rewardTokenAccount": "6X9LbFxtvjGxBEgHiE3KLQjJtAqkThqrhCufLhrPfMEp"
|
592
|
+
},
|
572
593
|
"tokens": [
|
573
594
|
{
|
574
595
|
"symbol": "USDC",
|
@@ -941,6 +962,13 @@
|
|
941
962
|
],
|
942
963
|
"backupOracle": "AjAubETeBLhebBxLcErmzbavZfqF9bCxkpRAdyJtoi9G",
|
943
964
|
"nftCollectionAddress": "H4EQ8pcE7PQSQGG1WYW4hAA1nizU6ULYipHZcYk9b64u",
|
965
|
+
"rewardDistributionProgram": {
|
966
|
+
"programId": "FARTfzmezUtejeF42vfyvX96NWq1BuAcXFiAQuz6wZZg",
|
967
|
+
"transferAuthority": "4cgNvcrPFxmgJVyQNJqM8Sb6eJnDktr5mWA3gSkdNcyT",
|
968
|
+
"rewardVault": "DrXUtn8BRUYAo1i3ZTkPRXqU7w2KGbCjiskzH8wGExGK",
|
969
|
+
"rewardMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
970
|
+
"rewardTokenAccount": "6X9LbFxtvjGxBEgHiE3KLQjJtAqkThqrhCufLhrPfMEp"
|
971
|
+
},
|
944
972
|
"tokens": [
|
945
973
|
{
|
946
974
|
"symbol": "USDC",
|
@@ -1048,6 +1076,13 @@
|
|
1048
1076
|
],
|
1049
1077
|
"backupOracle": "AjAubETeBLhebBxLcErmzbavZfqF9bCxkpRAdyJtoi9G",
|
1050
1078
|
"nftCollectionAddress": "H4EQ8pcE7PQSQGG1WYW4hAA1nizU6ULYipHZcYk9b64u",
|
1079
|
+
"rewardDistributionProgram": {
|
1080
|
+
"programId": "FARTfzmezUtejeF42vfyvX96NWq1BuAcXFiAQuz6wZZg",
|
1081
|
+
"transferAuthority": "4cgNvcrPFxmgJVyQNJqM8Sb6eJnDktr5mWA3gSkdNcyT",
|
1082
|
+
"rewardVault": "DrXUtn8BRUYAo1i3ZTkPRXqU7w2KGbCjiskzH8wGExGK",
|
1083
|
+
"rewardMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
1084
|
+
"rewardTokenAccount": "6X9LbFxtvjGxBEgHiE3KLQjJtAqkThqrhCufLhrPfMEp"
|
1085
|
+
},
|
1051
1086
|
"tokens": [
|
1052
1087
|
{
|
1053
1088
|
"symbol": "USDC",
|
@@ -1155,6 +1190,13 @@
|
|
1155
1190
|
],
|
1156
1191
|
"backupOracle": "AHaKsRB4tsGSzFfFqAxUpfRRmsUj5EhwHSxSXK2UGRp5",
|
1157
1192
|
"nftCollectionAddress": "3rkRzHdN7dXy5CQfX3Lz6UBBJ2F9n58VEpvDSmbaVHt9",
|
1193
|
+
"rewardDistributionProgram": {
|
1194
|
+
"programId": "FARTfzmezUtejeF42vfyvX96NWq1BuAcXFiAQuz6wZZg",
|
1195
|
+
"transferAuthority": "4cgNvcrPFxmgJVyQNJqM8Sb6eJnDktr5mWA3gSkdNcyT",
|
1196
|
+
"rewardVault": "DrXUtn8BRUYAo1i3ZTkPRXqU7w2KGbCjiskzH8wGExGK",
|
1197
|
+
"rewardMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
1198
|
+
"rewardTokenAccount": "6X9LbFxtvjGxBEgHiE3KLQjJtAqkThqrhCufLhrPfMEp"
|
1199
|
+
},
|
1158
1200
|
"tokens": [
|
1159
1201
|
{
|
1160
1202
|
"symbol": "USDC",
|
@@ -1379,6 +1421,13 @@
|
|
1379
1421
|
],
|
1380
1422
|
"backupOracle": "AHaKsRB4tsGSzFfFqAxUpfRRmsUj5EhwHSxSXK2UGRp5",
|
1381
1423
|
"nftCollectionAddress": "3rkRzHdN7dXy5CQfX3Lz6UBBJ2F9n58VEpvDSmbaVHt9",
|
1424
|
+
"rewardDistributionProgram": {
|
1425
|
+
"programId": "FARTfzmezUtejeF42vfyvX96NWq1BuAcXFiAQuz6wZZg",
|
1426
|
+
"transferAuthority": "4cgNvcrPFxmgJVyQNJqM8Sb6eJnDktr5mWA3gSkdNcyT",
|
1427
|
+
"rewardVault": "DrXUtn8BRUYAo1i3ZTkPRXqU7w2KGbCjiskzH8wGExGK",
|
1428
|
+
"rewardMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
1429
|
+
"rewardTokenAccount": "6X9LbFxtvjGxBEgHiE3KLQjJtAqkThqrhCufLhrPfMEp"
|
1430
|
+
},
|
1382
1431
|
"tokens": [
|
1383
1432
|
{
|
1384
1433
|
"symbol": "USDC",
|
@@ -1698,6 +1747,13 @@
|
|
1698
1747
|
],
|
1699
1748
|
"backupOracle": "AHaKsRB4tsGSzFfFqAxUpfRRmsUj5EhwHSxSXK2UGRp5",
|
1700
1749
|
"nftCollectionAddress": "3rkRzHdN7dXy5CQfX3Lz6UBBJ2F9n58VEpvDSmbaVHt9",
|
1750
|
+
"rewardDistributionProgram": {
|
1751
|
+
"programId": "FARTfzmezUtejeF42vfyvX96NWq1BuAcXFiAQuz6wZZg",
|
1752
|
+
"transferAuthority": "4cgNvcrPFxmgJVyQNJqM8Sb6eJnDktr5mWA3gSkdNcyT",
|
1753
|
+
"rewardVault": "DrXUtn8BRUYAo1i3ZTkPRXqU7w2KGbCjiskzH8wGExGK",
|
1754
|
+
"rewardMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
1755
|
+
"rewardTokenAccount": "6X9LbFxtvjGxBEgHiE3KLQjJtAqkThqrhCufLhrPfMEp"
|
1756
|
+
},
|
1701
1757
|
"tokens": [
|
1702
1758
|
{
|
1703
1759
|
"symbol": "USDC",
|
@@ -2070,6 +2126,13 @@
|
|
2070
2126
|
],
|
2071
2127
|
"backupOracle": "AHaKsRB4tsGSzFfFqAxUpfRRmsUj5EhwHSxSXK2UGRp5",
|
2072
2128
|
"nftCollectionAddress": "3rkRzHdN7dXy5CQfX3Lz6UBBJ2F9n58VEpvDSmbaVHt9",
|
2129
|
+
"rewardDistributionProgram": {
|
2130
|
+
"programId": "FARTfzmezUtejeF42vfyvX96NWq1BuAcXFiAQuz6wZZg",
|
2131
|
+
"transferAuthority": "4cgNvcrPFxmgJVyQNJqM8Sb6eJnDktr5mWA3gSkdNcyT",
|
2132
|
+
"rewardVault": "DrXUtn8BRUYAo1i3ZTkPRXqU7w2KGbCjiskzH8wGExGK",
|
2133
|
+
"rewardMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
2134
|
+
"rewardTokenAccount": "6X9LbFxtvjGxBEgHiE3KLQjJtAqkThqrhCufLhrPfMEp"
|
2135
|
+
},
|
2073
2136
|
"tokens": [
|
2074
2137
|
{
|
2075
2138
|
"symbol": "USDC",
|
@@ -2177,6 +2240,13 @@
|
|
2177
2240
|
],
|
2178
2241
|
"backupOracle": "AHaKsRB4tsGSzFfFqAxUpfRRmsUj5EhwHSxSXK2UGRp5",
|
2179
2242
|
"nftCollectionAddress": "3rkRzHdN7dXy5CQfX3Lz6UBBJ2F9n58VEpvDSmbaVHt9",
|
2243
|
+
"rewardDistributionProgram": {
|
2244
|
+
"programId": "FARTfzmezUtejeF42vfyvX96NWq1BuAcXFiAQuz6wZZg",
|
2245
|
+
"transferAuthority": "4cgNvcrPFxmgJVyQNJqM8Sb6eJnDktr5mWA3gSkdNcyT",
|
2246
|
+
"rewardVault": "DrXUtn8BRUYAo1i3ZTkPRXqU7w2KGbCjiskzH8wGExGK",
|
2247
|
+
"rewardMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
2248
|
+
"rewardTokenAccount": "6X9LbFxtvjGxBEgHiE3KLQjJtAqkThqrhCufLhrPfMEp"
|
2249
|
+
},
|
2180
2250
|
"tokens": [
|
2181
2251
|
{
|
2182
2252
|
"symbol": "USDC",
|