@wireio/stake 0.2.2 → 0.2.4
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/lib/stake.browser.js +488 -92
- package/lib/stake.browser.js.map +1 -1
- package/lib/stake.d.ts +267 -84
- package/lib/stake.js +596 -145
- package/lib/stake.js.map +1 -1
- package/lib/stake.m.js +488 -92
- package/lib/stake.m.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/solana/idl/liqsol_core.json +3 -53
- package/src/assets/solana/idl/liqsol_token.json +1 -1
- package/src/assets/solana/idl/validator_leaderboard.json +1 -1
- package/src/assets/solana/types/liqsol_core.ts +3 -53
- package/src/assets/solana/types/liqsol_token.ts +1 -1
- package/src/assets/solana/types/validator_leaderboard.ts +1 -1
- package/src/index.ts +4 -3
- package/src/networks/ethereum/ethereum.ts +25 -1
- package/src/networks/ethereum/types.ts +1 -1
- package/src/networks/solana/clients/token.client.ts +225 -0
- package/src/networks/solana/constants.ts +9 -0
- package/src/networks/solana/solana.ts +372 -74
- package/src/networks/solana/types.ts +11 -1
- package/src/networks/solana/utils.ts +223 -5
- package/src/{staker/staker.ts → staker.ts} +2 -2
- package/src/types.ts +143 -0
- package/src/staker/types.ts +0 -51
package/lib/stake.m.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import { PublicKey as PublicKey$1, KeyType,
|
|
2
|
-
import { PublicKey, StakeProgram, SystemProgram, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_CLOCK_PUBKEY, SYSVAR_STAKE_HISTORY_PUBKEY, SYSVAR_RENT_PUBKEY, Transaction, Keypair, Connection } from '@solana/web3.js';
|
|
1
|
+
import { PublicKey as PublicKey$1, KeyType, SolChainID, EvmChainID } from '@wireio/core';
|
|
2
|
+
import { PublicKey, StakeProgram, SystemProgram, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_CLOCK_PUBKEY, SYSVAR_STAKE_HISTORY_PUBKEY, SYSVAR_RENT_PUBKEY, Transaction, Keypair, Connection, LAMPORTS_PER_SOL as LAMPORTS_PER_SOL$1 } from '@solana/web3.js';
|
|
3
3
|
import { Program, BN, AnchorProvider } from '@coral-xyz/anchor';
|
|
4
4
|
import { getAssociatedTokenAddressSync, TOKEN_2022_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddress, createAssociatedTokenAccountInstruction } from '@solana/spl-token';
|
|
5
5
|
import { ethers, Contract, BigNumber } from 'ethers';
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var PurchaseAsset = ((PurchaseAsset2) => {
|
|
8
|
+
PurchaseAsset2["SOL"] = "SOL";
|
|
9
|
+
PurchaseAsset2["LIQSOL"] = "LIQSOL";
|
|
10
|
+
PurchaseAsset2["ETH"] = "ETH";
|
|
11
|
+
PurchaseAsset2["LIQETH"] = "LIQETH";
|
|
12
|
+
PurchaseAsset2["YIELD"] = "YIELD";
|
|
13
|
+
return PurchaseAsset2;
|
|
14
|
+
})(PurchaseAsset || {});
|
|
15
|
+
|
|
16
|
+
var address$2 = "BBkVcNWNQz1vZ6esv5US4QnNFWPRqxWbdpJHur9GVXSu";
|
|
8
17
|
var metadata$2 = {
|
|
9
18
|
name: "liqsol_core",
|
|
10
19
|
version: "0.1.0",
|
|
@@ -3184,58 +3193,8 @@ var events = [
|
|
|
3184
3193
|
var errors$2 = [
|
|
3185
3194
|
{
|
|
3186
3195
|
code: 6000,
|
|
3187
|
-
name: "
|
|
3188
|
-
msg: "
|
|
3189
|
-
},
|
|
3190
|
-
{
|
|
3191
|
-
code: 6001,
|
|
3192
|
-
name: "InsufficientBalance",
|
|
3193
|
-
msg: "Insufficient balance"
|
|
3194
|
-
},
|
|
3195
|
-
{
|
|
3196
|
-
code: 6002,
|
|
3197
|
-
name: "InsufficientFunds",
|
|
3198
|
-
msg: "Insufficient funds"
|
|
3199
|
-
},
|
|
3200
|
-
{
|
|
3201
|
-
code: 6003,
|
|
3202
|
-
name: "Unauthorized",
|
|
3203
|
-
msg: "Unauthorized - caller is not the distribution authority"
|
|
3204
|
-
},
|
|
3205
|
-
{
|
|
3206
|
-
code: 6004,
|
|
3207
|
-
name: "InvalidMint",
|
|
3208
|
-
msg: "Invalid mint"
|
|
3209
|
-
},
|
|
3210
|
-
{
|
|
3211
|
-
code: 6005,
|
|
3212
|
-
name: "InvalidOwner",
|
|
3213
|
-
msg: "Invalid owner"
|
|
3214
|
-
},
|
|
3215
|
-
{
|
|
3216
|
-
code: 6006,
|
|
3217
|
-
name: "InvalidUserRecord",
|
|
3218
|
-
msg: "Invalid user record"
|
|
3219
|
-
},
|
|
3220
|
-
{
|
|
3221
|
-
code: 6007,
|
|
3222
|
-
name: "InvalidWithdrawal",
|
|
3223
|
-
msg: "Invalid withdrawal - balance increased instead of decreased"
|
|
3224
|
-
},
|
|
3225
|
-
{
|
|
3226
|
-
code: 6008,
|
|
3227
|
-
name: "InvalidProgramId",
|
|
3228
|
-
msg: "Invalid program ID"
|
|
3229
|
-
},
|
|
3230
|
-
{
|
|
3231
|
-
code: 6009,
|
|
3232
|
-
name: "InstructionIntrospectionFailed",
|
|
3233
|
-
msg: "Instruction introspection failed"
|
|
3234
|
-
},
|
|
3235
|
-
{
|
|
3236
|
-
code: 6010,
|
|
3237
|
-
name: "ReceiptFulfilled",
|
|
3238
|
-
msg: "Receipt already fulfilled"
|
|
3196
|
+
name: "AccountBorrowFailed",
|
|
3197
|
+
msg: "Util Acc borrow Failed"
|
|
3239
3198
|
}
|
|
3240
3199
|
];
|
|
3241
3200
|
var types$4 = [
|
|
@@ -4519,7 +4478,7 @@ var liqsolCoreIDL = {
|
|
|
4519
4478
|
types: types$4
|
|
4520
4479
|
};
|
|
4521
4480
|
|
|
4522
|
-
var address$1 = "
|
|
4481
|
+
var address$1 = "6cDoerqdV6UQDsGvUEq5Qj5HRxxyDxSuUaB2J6iK8cio";
|
|
4523
4482
|
var metadata$1 = {
|
|
4524
4483
|
name: "liqsol_token",
|
|
4525
4484
|
version: "0.1.0",
|
|
@@ -4708,7 +4667,7 @@ var liqsolTokenJson = {
|
|
|
4708
4667
|
types: types$3
|
|
4709
4668
|
};
|
|
4710
4669
|
|
|
4711
|
-
var address = "
|
|
4670
|
+
var address = "C4ddPrB1ALYpW4G1Qz4ffvETBA8YGUL7TVZaLiE6bb1q";
|
|
4712
4671
|
var metadata = {
|
|
4713
4672
|
name: "validator_leaderboard",
|
|
4714
4673
|
version: "0.1.0",
|
|
@@ -5326,7 +5285,8 @@ const PDA_SEEDS = {
|
|
|
5326
5285
|
USER_WARRANT_RECORD: "user_warrant_record",
|
|
5327
5286
|
BAR_STATE_SEED: "bar_state",
|
|
5328
5287
|
BONDED_ACTOR_SEED: "bonded_actor",
|
|
5329
|
-
BOND_LEVEL_SEED: "bond_level"
|
|
5288
|
+
BOND_LEVEL_SEED: "bond_level",
|
|
5289
|
+
PRICE_HISTORY: "price_history"
|
|
5330
5290
|
};
|
|
5331
5291
|
const deriveLiqsolMintPda = () => PublicKey.findProgramAddressSync(
|
|
5332
5292
|
[Buffer.from(PDA_SEEDS.LIQSOL_MINT)],
|
|
@@ -5428,6 +5388,10 @@ const deriveBondedActorPda = (actor) => PublicKey.findProgramAddressSync(
|
|
|
5428
5388
|
[Buffer.from(PDA_SEEDS.BONDED_ACTOR_SEED), actor.toBuffer()],
|
|
5429
5389
|
LIQSOL_CORE
|
|
5430
5390
|
)[0];
|
|
5391
|
+
const derivePriceHistoryPda = () => PublicKey.findProgramAddressSync(
|
|
5392
|
+
[Buffer.from(PDA_SEEDS.PRICE_HISTORY)],
|
|
5393
|
+
LIQSOL_CORE
|
|
5394
|
+
)[0];
|
|
5431
5395
|
const deriveEphemeralStakeAddress = async (user, seed) => {
|
|
5432
5396
|
const seedStr = `ephemeral_${seed}`;
|
|
5433
5397
|
return await PublicKey.createWithSeed(user, seedStr, StakeProgram.programId);
|
|
@@ -5775,6 +5739,129 @@ class LeaderboardClient {
|
|
|
5775
5739
|
}
|
|
5776
5740
|
}
|
|
5777
5741
|
|
|
5742
|
+
const INDEX_SCALE = BigInt(1e12);
|
|
5743
|
+
BigInt(1e8);
|
|
5744
|
+
const BPS = BigInt(1e4);
|
|
5745
|
+
function toBigint(x) {
|
|
5746
|
+
if (typeof x === "bigint") return x;
|
|
5747
|
+
if (typeof x === "number") return BigInt(x);
|
|
5748
|
+
return BigInt(x.toString());
|
|
5749
|
+
}
|
|
5750
|
+
function tokensToShares(amount, currentIndex) {
|
|
5751
|
+
if (amount === BigInt(0)) return BigInt(0);
|
|
5752
|
+
const num = amount * INDEX_SCALE;
|
|
5753
|
+
const q = num / currentIndex;
|
|
5754
|
+
const r = num % currentIndex;
|
|
5755
|
+
return r === BigInt(0) ? q : q + BigInt(1);
|
|
5756
|
+
}
|
|
5757
|
+
function growOnce(value, growthBps) {
|
|
5758
|
+
const g = BigInt(growthBps);
|
|
5759
|
+
return (value * (BPS + g) + BPS / BigInt(2)) / BPS;
|
|
5760
|
+
}
|
|
5761
|
+
function shrinkOnce(value, growthBps) {
|
|
5762
|
+
const g = BigInt(growthBps);
|
|
5763
|
+
return (value * BPS + (BPS + g) / BigInt(2)) / (BPS + g);
|
|
5764
|
+
}
|
|
5765
|
+
function buildSolanaTrancheLadder(options) {
|
|
5766
|
+
const {
|
|
5767
|
+
currentTranche,
|
|
5768
|
+
initialTrancheSupply,
|
|
5769
|
+
currentTrancheSupply,
|
|
5770
|
+
currentPriceUsd,
|
|
5771
|
+
supplyGrowthBps,
|
|
5772
|
+
priceGrowthBps,
|
|
5773
|
+
windowBefore = 5,
|
|
5774
|
+
windowAfter = 5
|
|
5775
|
+
} = options;
|
|
5776
|
+
const startId = Math.max(0, currentTranche - windowBefore);
|
|
5777
|
+
const endId = currentTranche + windowAfter;
|
|
5778
|
+
const capacity = new Map();
|
|
5779
|
+
const price = new Map();
|
|
5780
|
+
capacity.set(currentTranche, initialTrancheSupply);
|
|
5781
|
+
price.set(currentTranche, currentPriceUsd);
|
|
5782
|
+
for (let id = currentTranche + 1; id <= endId; id++) {
|
|
5783
|
+
const prevCap = capacity.get(id - 1);
|
|
5784
|
+
const prevPrice = price.get(id - 1);
|
|
5785
|
+
capacity.set(id, growOnce(prevCap, supplyGrowthBps));
|
|
5786
|
+
price.set(id, growOnce(prevPrice, priceGrowthBps));
|
|
5787
|
+
}
|
|
5788
|
+
for (let id = currentTranche - 1; id >= startId; id--) {
|
|
5789
|
+
const nextCap = capacity.get(id + 1);
|
|
5790
|
+
const nextPrice = price.get(id + 1);
|
|
5791
|
+
capacity.set(id, shrinkOnce(nextCap, supplyGrowthBps));
|
|
5792
|
+
price.set(id, shrinkOnce(nextPrice, priceGrowthBps));
|
|
5793
|
+
}
|
|
5794
|
+
const ladder = [];
|
|
5795
|
+
for (let id = startId; id <= endId; id++) {
|
|
5796
|
+
const cap = capacity.get(id);
|
|
5797
|
+
let sold;
|
|
5798
|
+
if (id < currentTranche) {
|
|
5799
|
+
sold = cap;
|
|
5800
|
+
} else if (id === currentTranche) {
|
|
5801
|
+
sold = cap - currentTrancheSupply;
|
|
5802
|
+
} else {
|
|
5803
|
+
sold = BigInt(0);
|
|
5804
|
+
}
|
|
5805
|
+
ladder.push({
|
|
5806
|
+
id,
|
|
5807
|
+
capacity: cap,
|
|
5808
|
+
sold,
|
|
5809
|
+
remaining: cap - sold,
|
|
5810
|
+
priceUsd: price.get(id)
|
|
5811
|
+
});
|
|
5812
|
+
}
|
|
5813
|
+
return ladder;
|
|
5814
|
+
}
|
|
5815
|
+
function buildSolanaTrancheSnapshot(options) {
|
|
5816
|
+
const {
|
|
5817
|
+
chainID,
|
|
5818
|
+
globalState,
|
|
5819
|
+
trancheState,
|
|
5820
|
+
solPriceUsd,
|
|
5821
|
+
nativePriceTimestamp,
|
|
5822
|
+
ladderWindowBefore,
|
|
5823
|
+
ladderWindowAfter
|
|
5824
|
+
} = options;
|
|
5825
|
+
const currentIndex = toBigint(globalState.currentIndex);
|
|
5826
|
+
const totalShares = toBigint(globalState.totalShares);
|
|
5827
|
+
const currentTranche = trancheState.currentTrancheNumber.toNumber();
|
|
5828
|
+
const currentTrancheSupply = toBigint(trancheState.currentTrancheSupply);
|
|
5829
|
+
const initialTrancheSupply = toBigint(trancheState.initialTrancheSupply);
|
|
5830
|
+
const totalWarrantsSold = toBigint(trancheState.totalWarrantsSold);
|
|
5831
|
+
const currentPriceUsd = toBigint(trancheState.currentTranchePriceUsd);
|
|
5832
|
+
const supplyGrowthBps = trancheState.supplyGrowthBps;
|
|
5833
|
+
const priceGrowthBps = trancheState.priceGrowthBps;
|
|
5834
|
+
const minPriceUsd = trancheState.minPriceUsd ? toBigint(trancheState.minPriceUsd) : void 0;
|
|
5835
|
+
const maxPriceUsd = trancheState.maxPriceUsd ? toBigint(trancheState.maxPriceUsd) : void 0;
|
|
5836
|
+
const ladder = buildSolanaTrancheLadder({
|
|
5837
|
+
currentTranche,
|
|
5838
|
+
initialTrancheSupply,
|
|
5839
|
+
currentTrancheSupply,
|
|
5840
|
+
totalWarrantsSold,
|
|
5841
|
+
currentPriceUsd,
|
|
5842
|
+
supplyGrowthBps,
|
|
5843
|
+
priceGrowthBps,
|
|
5844
|
+
windowBefore: ladderWindowBefore,
|
|
5845
|
+
windowAfter: ladderWindowAfter
|
|
5846
|
+
});
|
|
5847
|
+
return {
|
|
5848
|
+
chainID,
|
|
5849
|
+
currentIndex,
|
|
5850
|
+
totalShares,
|
|
5851
|
+
currentTranche,
|
|
5852
|
+
currentPriceUsd,
|
|
5853
|
+
minPriceUsd,
|
|
5854
|
+
maxPriceUsd,
|
|
5855
|
+
supplyGrowthBps,
|
|
5856
|
+
priceGrowthBps,
|
|
5857
|
+
currentTrancheSupply,
|
|
5858
|
+
initialTrancheSupply,
|
|
5859
|
+
totalWarrantsSold,
|
|
5860
|
+
nativePriceUsd: solPriceUsd,
|
|
5861
|
+
nativePriceTimestamp,
|
|
5862
|
+
ladder
|
|
5863
|
+
};
|
|
5864
|
+
}
|
|
5778
5865
|
let _liqsolCoreProgram = null;
|
|
5779
5866
|
function getLiqsolCoreProgram(connection) {
|
|
5780
5867
|
if (_liqsolCoreProgram && _liqsolCoreProgram.provider.connection === connection) {
|
|
@@ -5948,8 +6035,17 @@ async function buildOutpostAccounts(connection, user) {
|
|
|
5948
6035
|
false,
|
|
5949
6036
|
TOKEN_2022_PROGRAM_ID
|
|
5950
6037
|
);
|
|
5951
|
-
|
|
5952
|
-
|
|
6038
|
+
let chainLinkFeed = CHAINLINK_FEED;
|
|
6039
|
+
let chainLinkProgram = CHAINLINK_PROGRAM;
|
|
6040
|
+
try {
|
|
6041
|
+
const program = getLiqsolCoreProgram(connection);
|
|
6042
|
+
const ts = await program.account.trancheState.fetch(trancheState);
|
|
6043
|
+
if (ts.chainlinkFeed && ts.chainlinkProgram) {
|
|
6044
|
+
chainLinkFeed = ts.chainlinkFeed;
|
|
6045
|
+
chainLinkProgram = ts.chainlinkProgram;
|
|
6046
|
+
}
|
|
6047
|
+
} catch {
|
|
6048
|
+
}
|
|
5953
6049
|
return {
|
|
5954
6050
|
user,
|
|
5955
6051
|
globalState,
|
|
@@ -6354,6 +6450,134 @@ const _OutpostClient = class _OutpostClient {
|
|
|
6354
6450
|
_OutpostClient.INDEX_SCALE = new BN("1000000000000");
|
|
6355
6451
|
let OutpostClient = _OutpostClient;
|
|
6356
6452
|
|
|
6453
|
+
class TokenClient {
|
|
6454
|
+
constructor(provider) {
|
|
6455
|
+
this.provider = provider;
|
|
6456
|
+
const svc = new SolanaProgramService(provider);
|
|
6457
|
+
this.program = svc.getProgram("liqsolCore");
|
|
6458
|
+
}
|
|
6459
|
+
get wallet() {
|
|
6460
|
+
return this.provider.wallet;
|
|
6461
|
+
}
|
|
6462
|
+
async getAccounts(user) {
|
|
6463
|
+
return buildOutpostAccounts(this.provider.connection, user);
|
|
6464
|
+
}
|
|
6465
|
+
async fetchGlobalState() {
|
|
6466
|
+
const { globalState } = await this.getAccounts(this.wallet.publicKey);
|
|
6467
|
+
return this.program.account.globalState.fetch(globalState);
|
|
6468
|
+
}
|
|
6469
|
+
async fetchTrancheState() {
|
|
6470
|
+
const { trancheState } = await this.getAccounts(this.wallet.publicKey);
|
|
6471
|
+
return this.program.account.trancheState.fetch(trancheState);
|
|
6472
|
+
}
|
|
6473
|
+
async fetchWireReceipt(user) {
|
|
6474
|
+
const { wireReceipt } = await this.getAccounts(user);
|
|
6475
|
+
return this.program.account.wireReceipt.fetch(wireReceipt);
|
|
6476
|
+
}
|
|
6477
|
+
async fetchUserWarrantRecord(user) {
|
|
6478
|
+
const { userWarrantRecord } = await this.getAccounts(user);
|
|
6479
|
+
return this.program.account.userWarrantRecord.fetch(userWarrantRecord);
|
|
6480
|
+
}
|
|
6481
|
+
async buildPurchaseWithSolIx(amountLamports, user = this.wallet.publicKey) {
|
|
6482
|
+
const a = await this.getAccounts(user);
|
|
6483
|
+
return this.program.methods.purchaseWithSol(new BN(amountLamports.toString())).accounts({
|
|
6484
|
+
user: a.user,
|
|
6485
|
+
liqsolMint: a.liqsolMint,
|
|
6486
|
+
globalState: a.globalState,
|
|
6487
|
+
poolAuthority: a.poolAuthority,
|
|
6488
|
+
liqsolPoolAta: a.liqsolPoolAta,
|
|
6489
|
+
liqsolPoolUserRecord: a.poolUserRecord,
|
|
6490
|
+
distributionState: a.distributionState,
|
|
6491
|
+
payRateHistory: a.payRateHistory,
|
|
6492
|
+
bucketAuthority: a.bucketAuthority,
|
|
6493
|
+
bucketTokenAccount: a.bucketTokenAccount,
|
|
6494
|
+
solBucket: a.solBucket,
|
|
6495
|
+
warrantDepositRecord: a.wireReceipt,
|
|
6496
|
+
trancheState: a.trancheState,
|
|
6497
|
+
userWarrantRecord: a.userWarrantRecord,
|
|
6498
|
+
chainlinkFeed: a.chainLinkFeed,
|
|
6499
|
+
chainlinkProgram: a.chainLinkProgram,
|
|
6500
|
+
tokenProgram: TOKEN_2022_PROGRAM_ID,
|
|
6501
|
+
systemProgram: SystemProgram.programId
|
|
6502
|
+
}).instruction();
|
|
6503
|
+
}
|
|
6504
|
+
async buildPurchaseWithLiqsolIx(amountLamports, user = this.wallet.publicKey) {
|
|
6505
|
+
const a = await this.getAccounts(user);
|
|
6506
|
+
return this.program.methods.purchaseWithLiqsol(new BN(amountLamports.toString())).accounts({
|
|
6507
|
+
user: a.user,
|
|
6508
|
+
liqsolMint: a.liqsolMint,
|
|
6509
|
+
globalState: a.globalState,
|
|
6510
|
+
buyerAta: a.userAta,
|
|
6511
|
+
poolAuthority: a.poolAuthority,
|
|
6512
|
+
liqsolPoolAta: a.liqsolPoolAta,
|
|
6513
|
+
warrantDepositRecord: a.wireReceipt,
|
|
6514
|
+
liqsolPoolUserRecord: a.poolUserRecord,
|
|
6515
|
+
distributionState: a.distributionState,
|
|
6516
|
+
payRateHistory: a.payRateHistory,
|
|
6517
|
+
bucketAuthority: a.bucketAuthority,
|
|
6518
|
+
bucketTokenAccount: a.bucketTokenAccount,
|
|
6519
|
+
solBucket: a.solBucket,
|
|
6520
|
+
trancheState: a.trancheState,
|
|
6521
|
+
userWarrantRecord: a.userWarrantRecord,
|
|
6522
|
+
chainlinkFeed: a.chainLinkFeed,
|
|
6523
|
+
chainlinkProgram: a.chainLinkProgram,
|
|
6524
|
+
tokenProgram: TOKEN_2022_PROGRAM_ID,
|
|
6525
|
+
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
6526
|
+
systemProgram: SystemProgram.programId
|
|
6527
|
+
}).instruction();
|
|
6528
|
+
}
|
|
6529
|
+
async buildPurchaseFromYieldIx(user = this.wallet.publicKey) {
|
|
6530
|
+
const a = await this.getAccounts(user);
|
|
6531
|
+
return this.program.methods.purchaseWarrantsFromYield().accounts({
|
|
6532
|
+
user: a.user,
|
|
6533
|
+
globalState: a.globalState,
|
|
6534
|
+
liqsolMint: a.liqsolMint,
|
|
6535
|
+
poolAuthority: a.poolAuthority,
|
|
6536
|
+
liqsolPoolAta: a.liqsolPoolAta,
|
|
6537
|
+
solBucket: a.solBucket,
|
|
6538
|
+
liqsolPoolUserRecord: a.poolUserRecord,
|
|
6539
|
+
distributionState: a.distributionState,
|
|
6540
|
+
payRateHistory: a.payRateHistory,
|
|
6541
|
+
bucketAuthority: a.bucketAuthority,
|
|
6542
|
+
bucketTokenAccount: a.bucketTokenAccount,
|
|
6543
|
+
trancheState: a.trancheState,
|
|
6544
|
+
userWarrantRecord: a.userWarrantRecord,
|
|
6545
|
+
chainlinkFeed: a.chainLinkFeed,
|
|
6546
|
+
chainlinkProgram: a.chainLinkProgram,
|
|
6547
|
+
tokenProgram: TOKEN_2022_PROGRAM_ID,
|
|
6548
|
+
systemProgram: SystemProgram.programId
|
|
6549
|
+
}).instruction();
|
|
6550
|
+
}
|
|
6551
|
+
async getSolPriceUsdSafe() {
|
|
6552
|
+
try {
|
|
6553
|
+
const price = await this.getSolPriceUsd();
|
|
6554
|
+
return { price, timestamp: void 0 };
|
|
6555
|
+
} catch {
|
|
6556
|
+
return { price: void 0, timestamp: void 0 };
|
|
6557
|
+
}
|
|
6558
|
+
}
|
|
6559
|
+
async getSolPriceUsd() {
|
|
6560
|
+
const priceHistoryPda = derivePriceHistoryPda();
|
|
6561
|
+
const history = await this.program.account.priceHistory.fetch(
|
|
6562
|
+
priceHistoryPda
|
|
6563
|
+
);
|
|
6564
|
+
const { prices, nextIndex, count, windowSize } = history;
|
|
6565
|
+
if (!prices || prices.length === 0 || !count) {
|
|
6566
|
+
throw new Error("Price history is empty \u2013 no SOL price available");
|
|
6567
|
+
}
|
|
6568
|
+
const capacity = prices.length || windowSize;
|
|
6569
|
+
if (!capacity) {
|
|
6570
|
+
throw new Error("Price history capacity is zero \u2013 check account layout");
|
|
6571
|
+
}
|
|
6572
|
+
const lastIndex = nextIndex === 0 ? capacity - 1 : nextIndex - 1;
|
|
6573
|
+
const latest = prices[lastIndex];
|
|
6574
|
+
if (!BN.isBN(latest)) {
|
|
6575
|
+
throw new Error("Latest price entry is not a BN \u2013 check IDL/decoder");
|
|
6576
|
+
}
|
|
6577
|
+
return BigInt(latest.toString());
|
|
6578
|
+
}
|
|
6579
|
+
}
|
|
6580
|
+
|
|
6357
6581
|
const commitment = "confirmed";
|
|
6358
6582
|
class SolanaStakingClient {
|
|
6359
6583
|
constructor(config) {
|
|
@@ -6386,6 +6610,8 @@ class SolanaStakingClient {
|
|
|
6386
6610
|
this.distributionClient = new DistributionClient(this.anchor);
|
|
6387
6611
|
this.leaderboardClient = new LeaderboardClient(this.anchor);
|
|
6388
6612
|
this.outpostClient = new OutpostClient(this.anchor);
|
|
6613
|
+
this.tokenClient = new TokenClient(this.anchor);
|
|
6614
|
+
this.tokenClient = new TokenClient(this.anchor);
|
|
6389
6615
|
}
|
|
6390
6616
|
get solPubKey() {
|
|
6391
6617
|
return new PublicKey(this.pubKey.data.array);
|
|
@@ -6394,36 +6620,94 @@ class SolanaStakingClient {
|
|
|
6394
6620
|
return this.config.network;
|
|
6395
6621
|
}
|
|
6396
6622
|
async deposit(amountLamports) {
|
|
6397
|
-
if (amountLamports <= BigInt(0))
|
|
6623
|
+
if (amountLamports <= BigInt(0)) {
|
|
6624
|
+
throw new Error("Deposit amount must be greater than zero.");
|
|
6625
|
+
}
|
|
6398
6626
|
const tx = await this.depositClient.buildDepositTx(amountLamports);
|
|
6399
|
-
const { tx: prepared, blockhash, lastValidBlockHeight } = await this.prepareTx(
|
|
6627
|
+
const { tx: prepared, blockhash, lastValidBlockHeight } = await this.prepareTx(
|
|
6628
|
+
tx
|
|
6629
|
+
);
|
|
6400
6630
|
const signed = await this.signTransaction(prepared);
|
|
6401
|
-
|
|
6402
|
-
|
|
6631
|
+
return await this.sendAndConfirmHttp(signed, {
|
|
6632
|
+
blockhash,
|
|
6633
|
+
lastValidBlockHeight
|
|
6634
|
+
});
|
|
6403
6635
|
}
|
|
6404
|
-
async withdraw(
|
|
6636
|
+
async withdraw(_amountLamports) {
|
|
6405
6637
|
throw new Error("Withdraw method not yet implemented.");
|
|
6406
6638
|
}
|
|
6407
6639
|
async stake(amountLamports) {
|
|
6408
|
-
if (amountLamports <= BigInt(0))
|
|
6409
|
-
|
|
6640
|
+
if (amountLamports <= BigInt(0)) {
|
|
6641
|
+
throw new Error("Stake amount must be greater than zero.");
|
|
6642
|
+
}
|
|
6643
|
+
const preIxs = await this.outpostClient.maybeBuildCreateUserAtaIx(
|
|
6644
|
+
this.solPubKey
|
|
6645
|
+
);
|
|
6410
6646
|
const stakeIx = await this.outpostClient.buildStakeLiqsolIx(amountLamports);
|
|
6411
6647
|
const tx = new Transaction().add(...preIxs, stakeIx);
|
|
6412
6648
|
const prepared = await this.prepareTx(tx);
|
|
6413
6649
|
const signed = await this.signTransaction(prepared.tx);
|
|
6414
|
-
|
|
6415
|
-
return result.signature;
|
|
6650
|
+
return await this.sendAndConfirmHttp(signed, prepared);
|
|
6416
6651
|
}
|
|
6417
6652
|
async unstake(amountLamports) {
|
|
6418
|
-
if (amountLamports <= BigInt(0))
|
|
6653
|
+
if (amountLamports <= BigInt(0)) {
|
|
6654
|
+
throw new Error("Unstake amount must be greater than zero.");
|
|
6655
|
+
}
|
|
6419
6656
|
const user = this.solPubKey;
|
|
6420
6657
|
const preIxs = await this.outpostClient.maybeBuildCreateUserAtaIx(user);
|
|
6421
6658
|
const withdrawIx = await this.outpostClient.buildWithdrawStakeIx(amountLamports);
|
|
6422
6659
|
const tx = new Transaction().add(...preIxs, withdrawIx);
|
|
6423
6660
|
const prepared = await this.prepareTx(tx);
|
|
6424
6661
|
const signed = await this.signTransaction(prepared.tx);
|
|
6425
|
-
|
|
6426
|
-
|
|
6662
|
+
return await this.sendAndConfirmHttp(signed, prepared);
|
|
6663
|
+
}
|
|
6664
|
+
async buy(amountLamports, purchaseAsset) {
|
|
6665
|
+
const user = this.solPubKey;
|
|
6666
|
+
let ix;
|
|
6667
|
+
let preIxs = [];
|
|
6668
|
+
switch (purchaseAsset) {
|
|
6669
|
+
case PurchaseAsset.SOL: {
|
|
6670
|
+
if (!amountLamports || amountLamports <= BigInt(0)) {
|
|
6671
|
+
throw new Error("SOL pretoken purchase requires a positive amount.");
|
|
6672
|
+
}
|
|
6673
|
+
ix = await this.tokenClient.buildPurchaseWithSolIx(
|
|
6674
|
+
amountLamports,
|
|
6675
|
+
user
|
|
6676
|
+
);
|
|
6677
|
+
break;
|
|
6678
|
+
}
|
|
6679
|
+
case PurchaseAsset.LIQSOL: {
|
|
6680
|
+
if (!amountLamports || amountLamports <= BigInt(0)) {
|
|
6681
|
+
throw new Error(
|
|
6682
|
+
"liqSOL pretoken purchase requires a positive amount."
|
|
6683
|
+
);
|
|
6684
|
+
}
|
|
6685
|
+
preIxs = await this.outpostClient.maybeBuildCreateUserAtaIx(user);
|
|
6686
|
+
ix = await this.tokenClient.buildPurchaseWithLiqsolIx(
|
|
6687
|
+
amountLamports,
|
|
6688
|
+
user
|
|
6689
|
+
);
|
|
6690
|
+
break;
|
|
6691
|
+
}
|
|
6692
|
+
case PurchaseAsset.YIELD: {
|
|
6693
|
+
ix = await this.tokenClient.buildPurchaseFromYieldIx(user);
|
|
6694
|
+
break;
|
|
6695
|
+
}
|
|
6696
|
+
case PurchaseAsset.ETH:
|
|
6697
|
+
case PurchaseAsset.LIQETH: {
|
|
6698
|
+
throw new Error(
|
|
6699
|
+
"ETH / LIQETH pretoken purchases are not supported on Solana."
|
|
6700
|
+
);
|
|
6701
|
+
}
|
|
6702
|
+
default:
|
|
6703
|
+
throw new Error(`Unsupported pretoken purchase asset: ${String(
|
|
6704
|
+
purchaseAsset
|
|
6705
|
+
)}`);
|
|
6706
|
+
}
|
|
6707
|
+
const tx = new Transaction().add(...preIxs, ix);
|
|
6708
|
+
const prepared = await this.prepareTx(tx);
|
|
6709
|
+
const signed = await this.signTransaction(prepared.tx);
|
|
6710
|
+
return await this.sendAndConfirmHttp(signed, prepared);
|
|
6427
6711
|
}
|
|
6428
6712
|
async getPortfolio() {
|
|
6429
6713
|
const user = this.solPubKey;
|
|
@@ -6437,7 +6721,12 @@ class SolanaStakingClient {
|
|
|
6437
6721
|
TOKEN_2022_PROGRAM_ID,
|
|
6438
6722
|
ASSOCIATED_TOKEN_PROGRAM_ID
|
|
6439
6723
|
);
|
|
6440
|
-
const [
|
|
6724
|
+
const [
|
|
6725
|
+
nativeLamports,
|
|
6726
|
+
actualBalResp,
|
|
6727
|
+
userRecord,
|
|
6728
|
+
snapshot
|
|
6729
|
+
] = await Promise.all([
|
|
6441
6730
|
this.connection.getBalance(user, "confirmed"),
|
|
6442
6731
|
this.connection.getTokenAccountBalance(userLiqsolAta, "confirmed").catch(() => null),
|
|
6443
6732
|
this.distributionClient.getUserRecord(user).catch(() => null),
|
|
@@ -6445,9 +6734,13 @@ class SolanaStakingClient {
|
|
|
6445
6734
|
]);
|
|
6446
6735
|
const LIQSOL_DECIMALS = 9;
|
|
6447
6736
|
const actualAmountStr = actualBalResp?.value?.amount ?? "0";
|
|
6448
|
-
const trackedAmountStr = userRecord?.trackedBalance
|
|
6737
|
+
const trackedAmountStr = userRecord?.trackedBalance?.toString() ?? "0";
|
|
6449
6738
|
const wireReceipt = snapshot?.wireReceipt ?? null;
|
|
6450
|
-
const
|
|
6739
|
+
const userWarrantRecord = snapshot?.userWarrantRecord ?? null;
|
|
6740
|
+
const trancheState = snapshot?.trancheState ?? null;
|
|
6741
|
+
const globalState = snapshot?.globalState ?? null;
|
|
6742
|
+
const stakedAmountStr = wireReceipt?.stakedLiqsol?.toString() ?? "0";
|
|
6743
|
+
const wireSharesStr = userWarrantRecord?.totalWarrantsPurchased?.toString() ?? "0";
|
|
6451
6744
|
return {
|
|
6452
6745
|
native: {
|
|
6453
6746
|
amount: BigInt(nativeLamports),
|
|
@@ -6465,6 +6758,11 @@ class SolanaStakingClient {
|
|
|
6465
6758
|
symbol: "LiqSOL",
|
|
6466
6759
|
decimals: LIQSOL_DECIMALS
|
|
6467
6760
|
},
|
|
6761
|
+
wire: {
|
|
6762
|
+
amount: BigInt(wireSharesStr),
|
|
6763
|
+
symbol: "$WIRE",
|
|
6764
|
+
decimals: 8
|
|
6765
|
+
},
|
|
6468
6766
|
tracked: {
|
|
6469
6767
|
amount: BigInt(trackedAmountStr),
|
|
6470
6768
|
symbol: "LiqSOL",
|
|
@@ -6474,40 +6772,124 @@ class SolanaStakingClient {
|
|
|
6474
6772
|
userLiqsolAta: userLiqsolAta.toBase58(),
|
|
6475
6773
|
reservePoolPDA: reservePoolPDA.toBase58(),
|
|
6476
6774
|
vaultPDA: vaultPDA.toBase58(),
|
|
6477
|
-
wireReceipt
|
|
6775
|
+
wireReceipt,
|
|
6776
|
+
userWarrantRecord,
|
|
6777
|
+
globalIndex: globalState?.currentIndex?.toString(),
|
|
6778
|
+
totalShares: globalState?.totalShares?.toString(),
|
|
6779
|
+
currentTrancheNumber: trancheState?.currentTrancheNumber?.toString(),
|
|
6780
|
+
currentTranchePriceUsd: trancheState?.currentTranchePriceUsd?.toString()
|
|
6478
6781
|
},
|
|
6479
6782
|
chainID: this.network.chainId
|
|
6480
6783
|
};
|
|
6481
6784
|
}
|
|
6785
|
+
async getTrancheSnapshot(options) {
|
|
6786
|
+
const {
|
|
6787
|
+
chainID = SolChainID.WireTestnet,
|
|
6788
|
+
windowBefore,
|
|
6789
|
+
windowAfter
|
|
6790
|
+
} = options ?? {};
|
|
6791
|
+
const [globalState, trancheState] = await Promise.all([
|
|
6792
|
+
this.tokenClient.fetchGlobalState(),
|
|
6793
|
+
this.tokenClient.fetchTrancheState()
|
|
6794
|
+
]);
|
|
6795
|
+
const { price: solPriceUsd, timestamp } = await this.tokenClient.getSolPriceUsdSafe();
|
|
6796
|
+
return buildSolanaTrancheSnapshot({
|
|
6797
|
+
chainID,
|
|
6798
|
+
globalState,
|
|
6799
|
+
trancheState,
|
|
6800
|
+
solPriceUsd,
|
|
6801
|
+
nativePriceTimestamp: timestamp,
|
|
6802
|
+
ladderWindowBefore: windowBefore,
|
|
6803
|
+
ladderWindowAfter: windowAfter
|
|
6804
|
+
});
|
|
6805
|
+
}
|
|
6806
|
+
async getBuyQuote(amount, asset, opts) {
|
|
6807
|
+
if (asset !== PurchaseAsset.YIELD && amount <= BigInt(0)) {
|
|
6808
|
+
throw new Error("amount must be > 0 for non-YIELD purchases");
|
|
6809
|
+
}
|
|
6810
|
+
const snapshot = await this.getTrancheSnapshot({
|
|
6811
|
+
chainID: opts?.chainID
|
|
6812
|
+
});
|
|
6813
|
+
const wirePriceUsd = snapshot.currentPriceUsd;
|
|
6814
|
+
const solPriceUsd = snapshot.nativePriceUsd;
|
|
6815
|
+
if (!wirePriceUsd || wirePriceUsd <= BigInt(0)) {
|
|
6816
|
+
throw new Error("Invalid WIRE price in tranche snapshot");
|
|
6817
|
+
}
|
|
6818
|
+
if (!solPriceUsd || solPriceUsd <= BigInt(0)) {
|
|
6819
|
+
throw new Error("No SOL/USD price available");
|
|
6820
|
+
}
|
|
6821
|
+
const ONE_E9 = BigInt(LAMPORTS_PER_SOL$1);
|
|
6822
|
+
const ONE_E8 = BigInt(1e8);
|
|
6823
|
+
let notionalUsd;
|
|
6824
|
+
switch (asset) {
|
|
6825
|
+
case PurchaseAsset.SOL: {
|
|
6826
|
+
notionalUsd = amount * solPriceUsd / ONE_E9;
|
|
6827
|
+
break;
|
|
6828
|
+
}
|
|
6829
|
+
case PurchaseAsset.LIQSOL: {
|
|
6830
|
+
notionalUsd = amount * solPriceUsd / ONE_E9;
|
|
6831
|
+
break;
|
|
6832
|
+
}
|
|
6833
|
+
case PurchaseAsset.YIELD: {
|
|
6834
|
+
notionalUsd = amount * solPriceUsd / ONE_E9;
|
|
6835
|
+
break;
|
|
6836
|
+
}
|
|
6837
|
+
case PurchaseAsset.ETH:
|
|
6838
|
+
case PurchaseAsset.LIQETH:
|
|
6839
|
+
throw new Error("getBuyQuote for ETH/LIQETH is not supported on Solana");
|
|
6840
|
+
default:
|
|
6841
|
+
throw new Error(`Unsupported purchase asset: ${String(asset)}`);
|
|
6842
|
+
}
|
|
6843
|
+
const numerator = notionalUsd * ONE_E8;
|
|
6844
|
+
const wireShares = numerator === BigInt(0) ? BigInt(0) : (numerator + wirePriceUsd - BigInt(1)) / wirePriceUsd;
|
|
6845
|
+
return {
|
|
6846
|
+
purchaseAsset: asset,
|
|
6847
|
+
amountIn: amount,
|
|
6848
|
+
wireShares,
|
|
6849
|
+
wireDecimals: 8,
|
|
6850
|
+
wirePriceUsd,
|
|
6851
|
+
notionalUsd
|
|
6852
|
+
};
|
|
6853
|
+
}
|
|
6482
6854
|
async getUserRecord() {
|
|
6483
6855
|
return this.distributionClient.getUserRecord(this.solPubKey);
|
|
6484
6856
|
}
|
|
6485
|
-
getProtocolFee() {
|
|
6486
|
-
}
|
|
6487
6857
|
async correctBalance(amount) {
|
|
6488
6858
|
const build = await this.distributionClient.buildCorrectRegisterTx({ amount });
|
|
6489
6859
|
if (!build.canSucceed || !build.transaction) {
|
|
6490
6860
|
throw new Error(build.reason ?? "Unable to build Correct&Register transaction");
|
|
6491
6861
|
}
|
|
6492
|
-
const { tx, blockhash, lastValidBlockHeight } = await this.prepareTx(
|
|
6862
|
+
const { tx, blockhash, lastValidBlockHeight } = await this.prepareTx(
|
|
6863
|
+
build.transaction
|
|
6864
|
+
);
|
|
6493
6865
|
const signed = await this.signTransaction(tx);
|
|
6494
|
-
const
|
|
6495
|
-
|
|
6866
|
+
const signature = await this.sendAndConfirmHttp(signed, {
|
|
6867
|
+
blockhash,
|
|
6868
|
+
lastValidBlockHeight
|
|
6869
|
+
});
|
|
6870
|
+
return signature;
|
|
6496
6871
|
}
|
|
6497
6872
|
async sendAndConfirmHttp(signed, ctx) {
|
|
6498
|
-
const signature = await this.connection.sendRawTransaction(
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6873
|
+
const signature = await this.connection.sendRawTransaction(
|
|
6874
|
+
signed.serialize(),
|
|
6875
|
+
{
|
|
6876
|
+
skipPreflight: false,
|
|
6877
|
+
preflightCommitment: commitment,
|
|
6878
|
+
maxRetries: 3
|
|
6879
|
+
}
|
|
6880
|
+
);
|
|
6503
6881
|
const conf = await this.connection.confirmTransaction(
|
|
6504
|
-
{
|
|
6882
|
+
{
|
|
6883
|
+
signature,
|
|
6884
|
+
blockhash: ctx.blockhash,
|
|
6885
|
+
lastValidBlockHeight: ctx.lastValidBlockHeight
|
|
6886
|
+
},
|
|
6505
6887
|
commitment
|
|
6506
6888
|
);
|
|
6507
6889
|
if (conf.value.err) {
|
|
6508
6890
|
throw new Error(`Transaction failed: ${JSON.stringify(conf.value.err)}`);
|
|
6509
6891
|
}
|
|
6510
|
-
return
|
|
6892
|
+
return signature;
|
|
6511
6893
|
}
|
|
6512
6894
|
async signTransaction(tx) {
|
|
6513
6895
|
return this.anchor.wallet.signTransaction(tx);
|
|
@@ -24317,6 +24699,12 @@ class EthereumStakingClient {
|
|
|
24317
24699
|
rewardCooldown
|
|
24318
24700
|
};
|
|
24319
24701
|
}
|
|
24702
|
+
buy(amount, purchaseAsset) {
|
|
24703
|
+
throw new Error("Method not yet implemented.");
|
|
24704
|
+
}
|
|
24705
|
+
getBuyQuote(amount, purchaseAsset) {
|
|
24706
|
+
throw new Error("Method not yet implemented.");
|
|
24707
|
+
}
|
|
24320
24708
|
async getPortfolio() {
|
|
24321
24709
|
const walletAddress = await this.signer.getAddress();
|
|
24322
24710
|
const nativeBalance = await this.provider.getBalance(walletAddress);
|
|
@@ -24346,10 +24734,18 @@ class EthereumStakingClient {
|
|
|
24346
24734
|
decimals: nativeDecimals,
|
|
24347
24735
|
symbol: liqSymbol
|
|
24348
24736
|
},
|
|
24737
|
+
wire: {
|
|
24738
|
+
amount: BigInt(0),
|
|
24739
|
+
decimals: 0,
|
|
24740
|
+
symbol: "$WIRE"
|
|
24741
|
+
},
|
|
24349
24742
|
chainID: this.network.chainId
|
|
24350
24743
|
};
|
|
24351
24744
|
return portfolio;
|
|
24352
24745
|
}
|
|
24746
|
+
async getTrancheSnapshot() {
|
|
24747
|
+
return null;
|
|
24748
|
+
}
|
|
24353
24749
|
async requestWithdraw(amountWei) {
|
|
24354
24750
|
const deadline = Math.floor(Date.now() / 1e3) + 3600;
|
|
24355
24751
|
const liqEth = this.contract.LiqEth;
|
|
@@ -24461,13 +24857,13 @@ const CONTRACT_NAMES = [
|
|
|
24461
24857
|
];
|
|
24462
24858
|
|
|
24463
24859
|
var types$1 = /*#__PURE__*/Object.freeze({
|
|
24464
|
-
|
|
24465
|
-
|
|
24860
|
+
__proto__: null,
|
|
24861
|
+
CONTRACT_NAMES: CONTRACT_NAMES
|
|
24466
24862
|
});
|
|
24467
24863
|
|
|
24468
24864
|
var types = /*#__PURE__*/Object.freeze({
|
|
24469
|
-
|
|
24865
|
+
__proto__: null
|
|
24470
24866
|
});
|
|
24471
24867
|
|
|
24472
|
-
export { ADDRESSES, CHAINLINK_FEED, CHAINLINK_PROGRAM, CONTRACTS, DEFAULT_AVERAGE_PAY_RATE, DEFAULT_PAY_RATE_LOOKBACK, DepositClient$1 as DepositClient, DistributionClient, EPHEMERAL_RENT_EXEMPTION, ERC1155Abi, ERC20Abi, ERC721Abi, types$1 as ETH, EthereumContractService, EthereumStakingClient, LAMPORTS_PER_SOL, LIQSOL_CORE, LIQSOL_TOKEN, LeaderboardClient, OutpostClient, PAY_RATE_SCALE_FACTOR, PDA_SEEDS, PROGRAM_IDS, types as SOL, SolanaStakingClient, Staker, VALIDATOR_LEADERBOARD, airdropSol, buildOutpostAccounts, calculateExpectedFee, deriveBarConfigPda, deriveBondLevelPda, deriveBondedActorPda, deriveBucketAuthorityPda, deriveDepositAuthorityPda, deriveDistributionStatePda, deriveEphemeralStakeAddress, deriveLeaderboardStatePda, deriveLiqsolMintAuthorityPda, deriveLiqsolMintPda, deriveOutpostGlobalStatePda, deriveOutpostPoolAuthorityPda, derivePayRateHistoryPda, derivePayoutStatePda, derivePoolUserRecordPda, deriveReservePoolPda, deriveSolBucketPda, deriveStakeControllerStatePda, deriveStakeControllerVaultPda, deriveTrancheStatePda, deriveUserRecordPda, deriveUserUserRecordPda, deriveUserWarrantRecordPda, deriveValidatorRecordPda, deriveVaultPda, deriveWireReceiptPda, generateRandomDepositAmount, generateTestKeypair, getAveragePayRate, getBucketLiqSolBalance, getEpochSnapshot, getErrorMessage, getLiqsolCoreProgram, getPayoutStateRaw, getReservePoolBalance, getStakeControllerStateRaw, getUserLiqSolBalance, getUserRecordRaw, lamportsToSol, msToEpochEnd, previewDepositEffects, scheduledInstruction, sleep, solToLamports, waitForConfirmation, waitUntilSafeToExecuteFunction };
|
|
24868
|
+
export { ADDRESSES, CHAINLINK_FEED, CHAINLINK_PROGRAM, CONTRACTS, DEFAULT_AVERAGE_PAY_RATE, DEFAULT_PAY_RATE_LOOKBACK, DepositClient$1 as DepositClient, DistributionClient, EPHEMERAL_RENT_EXEMPTION, ERC1155Abi, ERC20Abi, ERC721Abi, types$1 as ETH, EthereumContractService, EthereumStakingClient, LAMPORTS_PER_SOL, LIQSOL_CORE, LIQSOL_TOKEN, LeaderboardClient, OutpostClient, PAY_RATE_SCALE_FACTOR, PDA_SEEDS, PROGRAM_IDS, PurchaseAsset, types as SOL, SolanaStakingClient, Staker, TokenClient, VALIDATOR_LEADERBOARD, airdropSol, buildOutpostAccounts, buildSolanaTrancheLadder, buildSolanaTrancheSnapshot, calculateExpectedFee, deriveBarConfigPda, deriveBondLevelPda, deriveBondedActorPda, deriveBucketAuthorityPda, deriveDepositAuthorityPda, deriveDistributionStatePda, deriveEphemeralStakeAddress, deriveLeaderboardStatePda, deriveLiqsolMintAuthorityPda, deriveLiqsolMintPda, deriveOutpostGlobalStatePda, deriveOutpostPoolAuthorityPda, derivePayRateHistoryPda, derivePayoutStatePda, derivePoolUserRecordPda, derivePriceHistoryPda, deriveReservePoolPda, deriveSolBucketPda, deriveStakeControllerStatePda, deriveStakeControllerVaultPda, deriveTrancheStatePda, deriveUserRecordPda, deriveUserUserRecordPda, deriveUserWarrantRecordPda, deriveValidatorRecordPda, deriveVaultPda, deriveWireReceiptPda, generateRandomDepositAmount, generateTestKeypair, getAveragePayRate, getBucketLiqSolBalance, getEpochSnapshot, getErrorMessage, getLiqsolCoreProgram, getPayoutStateRaw, getReservePoolBalance, getStakeControllerStateRaw, getUserLiqSolBalance, getUserRecordRaw, lamportsToSol, msToEpochEnd, previewDepositEffects, scheduledInstruction, sleep, solToLamports, toBigint, tokensToShares, waitForConfirmation, waitUntilSafeToExecuteFunction };
|
|
24473
24869
|
//# sourceMappingURL=stake.m.js.map
|