@wireio/stake 1.2.69 → 1.4.69
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/README.md +3 -1
- package/lib/stake.browser.js +167 -78
- package/lib/stake.browser.js.map +1 -1
- package/lib/stake.d.ts +127 -68
- package/lib/stake.js +203 -93
- package/lib/stake.js.map +1 -1
- package/lib/stake.m.js +167 -78
- package/lib/stake.m.js.map +1 -1
- package/package.json +1 -1
- package/src/networks/ethereum/clients/instaswap.client.ts +8 -1
- package/src/networks/ethereum/clients/pretoken.client.ts +8 -3
- package/src/networks/ethereum/clients/stake.client.ts +33 -6
- package/src/networks/ethereum/utils.ts +53 -1
- package/src/networks/solana/clients/instaswap.client.ts +59 -47
- package/src/networks/solana/clients/outpost.client.ts +43 -24
package/lib/stake.d.ts
CHANGED
|
@@ -18971,73 +18971,6 @@ declare class DistributionClient {
|
|
|
18971
18971
|
getAverageScaledPayRate(windowSize?: number): Promise<BN>;
|
|
18972
18972
|
}
|
|
18973
18973
|
|
|
18974
|
-
type SolanaInstaswapSubmitParams = {
|
|
18975
|
-
amountLamports: bigint;
|
|
18976
|
-
destinationChain: number | string | bigint;
|
|
18977
|
-
destinationAddress: Uint8Array;
|
|
18978
|
-
minOutLamports: bigint;
|
|
18979
|
-
};
|
|
18980
|
-
type SolanaInstaswapSubmitHooks = {
|
|
18981
|
-
onSubmitted?: (signature: string) => void | Promise<void>;
|
|
18982
|
-
};
|
|
18983
|
-
type SolanaDepositToWireParams = {
|
|
18984
|
-
quantityLamports: bigint;
|
|
18985
|
-
recipient: string;
|
|
18986
|
-
};
|
|
18987
|
-
type SolanaInstaswapConnectedBalances = {
|
|
18988
|
-
nativeLamports: string;
|
|
18989
|
-
liqsolLamports: string;
|
|
18990
|
-
liqsolDecimals: number;
|
|
18991
|
-
};
|
|
18992
|
-
declare class SolanaInstaswapClient {
|
|
18993
|
-
private readonly provider;
|
|
18994
|
-
private readonly pgs;
|
|
18995
|
-
private readonly submitInstructions?;
|
|
18996
|
-
private readonly program;
|
|
18997
|
-
private readonly convertClient;
|
|
18998
|
-
constructor(provider: AnchorProvider, pgs: SolanaProgramService, submitInstructions?: ((ix: TransactionInstruction | TransactionInstruction[]) => Promise<string>) | undefined);
|
|
18999
|
-
submitCrossChain(params: SolanaInstaswapSubmitParams, hooks?: SolanaInstaswapSubmitHooks): Promise<string>;
|
|
19000
|
-
depositToWire(params: SolanaDepositToWireParams, hooks?: SolanaInstaswapSubmitHooks): Promise<string>;
|
|
19001
|
-
getConnectedBalances(owner?: PublicKey$1 | string): Promise<SolanaInstaswapConnectedBalances>;
|
|
19002
|
-
private finalizeReadyEpoch;
|
|
19003
|
-
private fetchPendingAttestations;
|
|
19004
|
-
private isEpochFinalizationRequired;
|
|
19005
|
-
private runRpcWithRecovery;
|
|
19006
|
-
private extractTimedOutSignature;
|
|
19007
|
-
private waitForSignatureSuccess;
|
|
19008
|
-
private resolveOwner;
|
|
19009
|
-
private toSafeNumber;
|
|
19010
|
-
private sleep;
|
|
19011
|
-
private sendInstructions;
|
|
19012
|
-
}
|
|
19013
|
-
|
|
19014
|
-
/**
|
|
19015
|
-
* Simple read client for the validator_leaderboard program.
|
|
19016
|
-
*
|
|
19017
|
-
* Adjust account names/fields to match your IDL (state, validatorRecord, etc).
|
|
19018
|
-
*/
|
|
19019
|
-
declare class LeaderboardClient {
|
|
19020
|
-
private readonly provider;
|
|
19021
|
-
private readonly pgs;
|
|
19022
|
-
private program;
|
|
19023
|
-
constructor(provider: AnchorProvider, pgs: SolanaProgramService);
|
|
19024
|
-
getState(): Promise<LeaderboardState | null>;
|
|
19025
|
-
getValidatorRecord(voteAccount: PublicKey$1): Promise<ValidatorRecord | null>;
|
|
19026
|
-
/**
|
|
19027
|
-
* Convenience helper to fetch and return top validators ordered
|
|
19028
|
-
* by the on-chain leaderboard scores.
|
|
19029
|
-
*
|
|
19030
|
-
* Uses:
|
|
19031
|
-
* - `leaderboardState.scores`
|
|
19032
|
-
* - `leaderboardState.sortedIndices`
|
|
19033
|
-
* - `validatorRecord.registryIndex`
|
|
19034
|
-
*
|
|
19035
|
-
* Fallback: if leaderboardState can't be fetched, we sort by
|
|
19036
|
-
* `creditsObserved` descending.
|
|
19037
|
-
*/
|
|
19038
|
-
getTopValidators(limit?: number): Promise<ValidatorRecord[]>;
|
|
19039
|
-
}
|
|
19040
|
-
|
|
19041
18974
|
/** BN | bigint -> bigint helper (keeps code readable) */
|
|
19042
18975
|
declare function toBigint(x: any): bigint;
|
|
19043
18976
|
/**
|
|
@@ -19153,6 +19086,132 @@ declare function ceilDiv(n: BN, d: BN): BN;
|
|
|
19153
19086
|
declare function normalizeToBigInt(x: any): bigint;
|
|
19154
19087
|
declare const safeFetch: <T>(promise: Promise<T>, label?: string) => Promise<T | null>;
|
|
19155
19088
|
|
|
19089
|
+
type SolanaInstaswapSubmitParams = {
|
|
19090
|
+
amountLamports: bigint;
|
|
19091
|
+
destinationChain: number | string | bigint;
|
|
19092
|
+
destinationAddress: Uint8Array;
|
|
19093
|
+
minOutLamports: bigint;
|
|
19094
|
+
};
|
|
19095
|
+
type SolanaInstaswapSubmitHooks = {
|
|
19096
|
+
onSubmitted?: (signature: string) => void | Promise<void>;
|
|
19097
|
+
};
|
|
19098
|
+
type SolanaDepositToWireParams = {
|
|
19099
|
+
quantityLamports: bigint;
|
|
19100
|
+
recipient: string;
|
|
19101
|
+
};
|
|
19102
|
+
type SolanaInstaswapConnectedBalances = {
|
|
19103
|
+
nativeLamports: string;
|
|
19104
|
+
liqsolLamports: string;
|
|
19105
|
+
liqsolDecimals: number;
|
|
19106
|
+
};
|
|
19107
|
+
declare function buildSolanaInstaswapCrossChainAccounts(params: {
|
|
19108
|
+
user: PublicKey$1;
|
|
19109
|
+
accounts: OutpostAccounts;
|
|
19110
|
+
liqsolCoreProgram: PublicKey$1;
|
|
19111
|
+
transferHookProgram: PublicKey$1;
|
|
19112
|
+
pendingAttestations: PublicKey$1;
|
|
19113
|
+
}): {
|
|
19114
|
+
user: PublicKey$1;
|
|
19115
|
+
globalState: PublicKey$1;
|
|
19116
|
+
liqsolMint: PublicKey$1;
|
|
19117
|
+
distributionState: PublicKey$1;
|
|
19118
|
+
userAta: PublicKey$1;
|
|
19119
|
+
senderUserRecord: PublicKey$1;
|
|
19120
|
+
bridgeAuthority: PublicKey$1;
|
|
19121
|
+
bridgeVaultAta: PublicKey$1;
|
|
19122
|
+
bridgeUserRecord: PublicKey$1;
|
|
19123
|
+
bridgeState: PublicKey$1;
|
|
19124
|
+
extraAccountMetaList: PublicKey$1;
|
|
19125
|
+
liqsolCoreProgram: PublicKey$1;
|
|
19126
|
+
transferHookProgram: PublicKey$1;
|
|
19127
|
+
bucketAuthority: PublicKey$1;
|
|
19128
|
+
bucketTokenAccount: PublicKey$1;
|
|
19129
|
+
bucketUserRecord: PublicKey$1;
|
|
19130
|
+
tokenProgram: PublicKey$1;
|
|
19131
|
+
systemProgram: PublicKey$1;
|
|
19132
|
+
globalConfig: PublicKey$1;
|
|
19133
|
+
oppEpochState: PublicKey$1;
|
|
19134
|
+
pendingAttestations: PublicKey$1;
|
|
19135
|
+
};
|
|
19136
|
+
declare class SolanaInstaswapClient {
|
|
19137
|
+
private readonly provider;
|
|
19138
|
+
private readonly pgs;
|
|
19139
|
+
private readonly submitInstructions?;
|
|
19140
|
+
private readonly program;
|
|
19141
|
+
private readonly convertClient;
|
|
19142
|
+
constructor(provider: AnchorProvider, pgs: SolanaProgramService, submitInstructions?: ((ix: TransactionInstruction | TransactionInstruction[]) => Promise<string>) | undefined);
|
|
19143
|
+
submitCrossChain(params: SolanaInstaswapSubmitParams, hooks?: SolanaInstaswapSubmitHooks): Promise<string>;
|
|
19144
|
+
depositToWire(params: SolanaDepositToWireParams, hooks?: SolanaInstaswapSubmitHooks): Promise<string>;
|
|
19145
|
+
getConnectedBalances(owner?: PublicKey$1 | string): Promise<SolanaInstaswapConnectedBalances>;
|
|
19146
|
+
private finalizeReadyEpoch;
|
|
19147
|
+
private fetchPendingAttestations;
|
|
19148
|
+
private isEpochFinalizationRequired;
|
|
19149
|
+
private runRpcWithRecovery;
|
|
19150
|
+
private extractTimedOutSignature;
|
|
19151
|
+
private waitForSignatureSuccess;
|
|
19152
|
+
private resolveOwner;
|
|
19153
|
+
private toSafeNumber;
|
|
19154
|
+
private sleep;
|
|
19155
|
+
private sendInstructions;
|
|
19156
|
+
}
|
|
19157
|
+
|
|
19158
|
+
/**
|
|
19159
|
+
* Simple read client for the validator_leaderboard program.
|
|
19160
|
+
*
|
|
19161
|
+
* Adjust account names/fields to match your IDL (state, validatorRecord, etc).
|
|
19162
|
+
*/
|
|
19163
|
+
declare class LeaderboardClient {
|
|
19164
|
+
private readonly provider;
|
|
19165
|
+
private readonly pgs;
|
|
19166
|
+
private program;
|
|
19167
|
+
constructor(provider: AnchorProvider, pgs: SolanaProgramService);
|
|
19168
|
+
getState(): Promise<LeaderboardState | null>;
|
|
19169
|
+
getValidatorRecord(voteAccount: PublicKey$1): Promise<ValidatorRecord | null>;
|
|
19170
|
+
/**
|
|
19171
|
+
* Convenience helper to fetch and return top validators ordered
|
|
19172
|
+
* by the on-chain leaderboard scores.
|
|
19173
|
+
*
|
|
19174
|
+
* Uses:
|
|
19175
|
+
* - `leaderboardState.scores`
|
|
19176
|
+
* - `leaderboardState.sortedIndices`
|
|
19177
|
+
* - `validatorRecord.registryIndex`
|
|
19178
|
+
*
|
|
19179
|
+
* Fallback: if leaderboardState can't be fetched, we sort by
|
|
19180
|
+
* `creditsObserved` descending.
|
|
19181
|
+
*/
|
|
19182
|
+
getTopValidators(limit?: number): Promise<ValidatorRecord[]>;
|
|
19183
|
+
}
|
|
19184
|
+
|
|
19185
|
+
declare function buildSolanaSyndicateAccounts(params: {
|
|
19186
|
+
user: PublicKey$1;
|
|
19187
|
+
accounts: OutpostAccounts;
|
|
19188
|
+
liqsolCoreProgram: PublicKey$1;
|
|
19189
|
+
transferHookProgram: PublicKey$1;
|
|
19190
|
+
}): {
|
|
19191
|
+
user: PublicKey$1;
|
|
19192
|
+
liqsolMint: PublicKey$1;
|
|
19193
|
+
distributionState: PublicKey$1;
|
|
19194
|
+
globalState: PublicKey$1;
|
|
19195
|
+
userAta: PublicKey$1;
|
|
19196
|
+
senderUserRecord: PublicKey$1;
|
|
19197
|
+
bridgeAuthority: PublicKey$1;
|
|
19198
|
+
bridgeVaultAta: PublicKey$1;
|
|
19199
|
+
bridgeUserRecord: PublicKey$1;
|
|
19200
|
+
bridgeState: PublicKey$1;
|
|
19201
|
+
outpostAccount: PublicKey$1;
|
|
19202
|
+
extraAccountMetaList: PublicKey$1;
|
|
19203
|
+
liqsolCoreProgram: PublicKey$1;
|
|
19204
|
+
transferHookProgram: PublicKey$1;
|
|
19205
|
+
bucketAuthority: PublicKey$1;
|
|
19206
|
+
bucketTokenAccount: PublicKey$1;
|
|
19207
|
+
bucketUserRecord: PublicKey$1;
|
|
19208
|
+
tokenProgram: PublicKey$1;
|
|
19209
|
+
associatedTokenProgram: PublicKey$1;
|
|
19210
|
+
systemProgram: PublicKey$1;
|
|
19211
|
+
globalConfig: PublicKey$1;
|
|
19212
|
+
oppEpochState: PublicKey$1;
|
|
19213
|
+
pendingAttestations: PublicKey$1;
|
|
19214
|
+
};
|
|
19156
19215
|
/**
|
|
19157
19216
|
* OutpostClient
|
|
19158
19217
|
*
|
|
@@ -19499,5 +19558,5 @@ declare class SolanaStakingClient implements IStakingClient {
|
|
|
19499
19558
|
private getSingleTxFeeLamports;
|
|
19500
19559
|
}
|
|
19501
19560
|
|
|
19502
|
-
export { ADDRESSES, ADDRESS_BOOK_BY_CHAIN, CHAINLINK_FEED, CHAINLINK_PROGRAM, CONTRACTS_BY_CHAIN, ConvertClient, DEFAULT_AVERAGE_PAY_RATE, DEFAULT_PAY_RATE_LOOKBACK, DistributionClient, EPHEMERAL_RENT_EXEMPTION, ERC1155Abi, ERC20Abi, ERC721Abi, types$1 as ETH, EthereumContractService, EthereumInstaswapClient, EthereumStakingClient, HOODI_ADDRESSES, INDEX_SCALE, INITIAL_TRANCHE_SUPPLY, LAMPORTS_PER_SOL, LeaderboardClient, MAINNET_ADDRESSES, OutpostClient, PAY_RATE_SCALE_FACTOR, PDA_SEEDS, PROGRAM_IDS_BY_CHAIN, PurchaseAsset, ReceiptNFTKind, SCALE, types as SOL, SolanaInstaswapClient, SolanaStakingClient, Staker, SupportedEvmChainID, SupportedSolChainID, TokenClient, airdropSol, buildOutpostAccounts, buildSolanaTrancheLadder, buildSolanaTrancheSnapshot, ceilDiv, deriveEphemeralStakeAddress, generateRandomDepositAmount, generateTestKeypair, getEpochSnapshot, getErrorMessage, getProgramIds, lamportsToSol, msToEpochEnd, normalizeToBigInt, safeFetch, scheduledInstruction, sleep, solToLamports, toBigint, tokensToShares, waitForConfirmation, waitUntilSafeToExecuteFunction };
|
|
19561
|
+
export { ADDRESSES, ADDRESS_BOOK_BY_CHAIN, CHAINLINK_FEED, CHAINLINK_PROGRAM, CONTRACTS_BY_CHAIN, ConvertClient, DEFAULT_AVERAGE_PAY_RATE, DEFAULT_PAY_RATE_LOOKBACK, DistributionClient, EPHEMERAL_RENT_EXEMPTION, ERC1155Abi, ERC20Abi, ERC721Abi, types$1 as ETH, EthereumContractService, EthereumInstaswapClient, EthereumStakingClient, HOODI_ADDRESSES, INDEX_SCALE, INITIAL_TRANCHE_SUPPLY, LAMPORTS_PER_SOL, LeaderboardClient, MAINNET_ADDRESSES, OutpostClient, PAY_RATE_SCALE_FACTOR, PDA_SEEDS, PROGRAM_IDS_BY_CHAIN, PurchaseAsset, ReceiptNFTKind, SCALE, types as SOL, SolanaInstaswapClient, SolanaStakingClient, Staker, SupportedEvmChainID, SupportedSolChainID, TokenClient, airdropSol, buildOutpostAccounts, buildSolanaInstaswapCrossChainAccounts, buildSolanaSyndicateAccounts, buildSolanaTrancheLadder, buildSolanaTrancheSnapshot, ceilDiv, deriveEphemeralStakeAddress, generateRandomDepositAmount, generateTestKeypair, getEpochSnapshot, getErrorMessage, getProgramIds, lamportsToSol, msToEpochEnd, normalizeToBigInt, safeFetch, scheduledInstruction, sleep, solToLamports, toBigint, tokensToShares, waitForConfirmation, waitUntilSafeToExecuteFunction };
|
|
19503
19562
|
export type { BalanceView, ChainSymbol, ContractConfig, ContractOptions, Contracts, EpochSnapshot, EthereumDepositToWireParams, EthereumEnsureLiqEthBalanceParams, EthereumInstaswapConnectedBalances, EthereumInstaswapOutpostAddresses, EthereumInstaswapSubmitHooks, EthereumInstaswapSubmitParams, IStakingClient, OPPAssertion, OutpostAccounts, Portfolio, PurchaseQuote, ScheduleConfig, SolanaDepositToWireParams, SolanaInstaswapConnectedBalances, SolanaInstaswapSubmitHooks, SolanaInstaswapSubmitParams, SolanaProgramIds, SquadsXConfig, StakerConfig, TrancheLadderItem, TrancheSnapshot, WithdrawReceipt$1 as WithdrawReceipt, WithdrawStatus, YieldView };
|
package/lib/stake.js
CHANGED
|
@@ -19375,6 +19375,38 @@ var __async$f = (__this, __arguments, generator) => {
|
|
|
19375
19375
|
};
|
|
19376
19376
|
const commitment$1 = "confirmed";
|
|
19377
19377
|
const DEFAULT_SOLANA_EPOCH_CAP = 32;
|
|
19378
|
+
function buildSolanaInstaswapCrossChainAccounts(params) {
|
|
19379
|
+
const {
|
|
19380
|
+
user,
|
|
19381
|
+
accounts,
|
|
19382
|
+
liqsolCoreProgram,
|
|
19383
|
+
transferHookProgram,
|
|
19384
|
+
pendingAttestations
|
|
19385
|
+
} = params;
|
|
19386
|
+
return {
|
|
19387
|
+
user,
|
|
19388
|
+
globalState: accounts.globalState,
|
|
19389
|
+
liqsolMint: accounts.liqsolMint,
|
|
19390
|
+
distributionState: accounts.distributionState,
|
|
19391
|
+
userAta: accounts.userAta,
|
|
19392
|
+
senderUserRecord: accounts.userUserRecord,
|
|
19393
|
+
bridgeAuthority: accounts.bridgeAuthority,
|
|
19394
|
+
bridgeVaultAta: accounts.bridgeVaultAta,
|
|
19395
|
+
bridgeUserRecord: accounts.bridgeUserRecord,
|
|
19396
|
+
bridgeState: accounts.bridgeState,
|
|
19397
|
+
extraAccountMetaList: accounts.extraAccountMetaList,
|
|
19398
|
+
liqsolCoreProgram,
|
|
19399
|
+
transferHookProgram,
|
|
19400
|
+
bucketAuthority: accounts.bucketAuthority,
|
|
19401
|
+
bucketTokenAccount: accounts.bucketTokenAccount,
|
|
19402
|
+
bucketUserRecord: accounts.bucketUserRecord,
|
|
19403
|
+
tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
|
|
19404
|
+
systemProgram: web3_js.SystemProgram.programId,
|
|
19405
|
+
globalConfig: accounts.globalConfig,
|
|
19406
|
+
oppEpochState: accounts.oppEpochState,
|
|
19407
|
+
pendingAttestations
|
|
19408
|
+
};
|
|
19409
|
+
}
|
|
19378
19410
|
class SolanaInstaswapClient {
|
|
19379
19411
|
constructor(provider, pgs, submitInstructions) {
|
|
19380
19412
|
this.provider = provider;
|
|
@@ -19405,29 +19437,15 @@ class SolanaInstaswapClient {
|
|
|
19405
19437
|
destinationChain,
|
|
19406
19438
|
destinationAddress,
|
|
19407
19439
|
minOut
|
|
19408
|
-
).accounts(
|
|
19409
|
-
|
|
19410
|
-
|
|
19411
|
-
|
|
19412
|
-
|
|
19413
|
-
|
|
19414
|
-
|
|
19415
|
-
|
|
19416
|
-
|
|
19417
|
-
poolUserRecord: accounts.liqsolPoolUserRecord,
|
|
19418
|
-
bridgeState: accounts.bridgeState,
|
|
19419
|
-
extraAccountMetaList: accounts.extraAccountMetaList,
|
|
19420
|
-
liqsolCoreProgram: this.program.programId,
|
|
19421
|
-
transferHookProgram: this.pgs.PROGRAM_IDS.TRANSFER_HOOK,
|
|
19422
|
-
bucketAuthority: accounts.bucketAuthority,
|
|
19423
|
-
bucketTokenAccount: accounts.bucketTokenAccount,
|
|
19424
|
-
bucketUserRecord: accounts.bucketUserRecord,
|
|
19425
|
-
tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
|
|
19426
|
-
systemProgram: web3_js.SystemProgram.programId,
|
|
19427
|
-
globalConfig: accounts.globalConfig,
|
|
19428
|
-
oppEpochState: accounts.oppEpochState,
|
|
19429
|
-
pendingAttestations
|
|
19430
|
-
}).preInstructions([
|
|
19440
|
+
).accounts(
|
|
19441
|
+
buildSolanaInstaswapCrossChainAccounts({
|
|
19442
|
+
user,
|
|
19443
|
+
accounts,
|
|
19444
|
+
liqsolCoreProgram: this.program.programId,
|
|
19445
|
+
transferHookProgram: this.pgs.PROGRAM_IDS.TRANSFER_HOOK,
|
|
19446
|
+
pendingAttestations
|
|
19447
|
+
})
|
|
19448
|
+
).preInstructions([
|
|
19431
19449
|
web3_js.ComputeBudgetProgram.setComputeUnitLimit({ units: 9e5 })
|
|
19432
19450
|
]).rpc()
|
|
19433
19451
|
);
|
|
@@ -19444,29 +19462,15 @@ class SolanaInstaswapClient {
|
|
|
19444
19462
|
destinationChain,
|
|
19445
19463
|
destinationAddress,
|
|
19446
19464
|
minOut
|
|
19447
|
-
).accounts(
|
|
19448
|
-
|
|
19449
|
-
|
|
19450
|
-
|
|
19451
|
-
|
|
19452
|
-
|
|
19453
|
-
|
|
19454
|
-
|
|
19455
|
-
|
|
19456
|
-
poolUserRecord: accounts.liqsolPoolUserRecord,
|
|
19457
|
-
bridgeState: accounts.bridgeState,
|
|
19458
|
-
extraAccountMetaList: accounts.extraAccountMetaList,
|
|
19459
|
-
liqsolCoreProgram: this.program.programId,
|
|
19460
|
-
transferHookProgram: this.pgs.PROGRAM_IDS.TRANSFER_HOOK,
|
|
19461
|
-
bucketAuthority: accounts.bucketAuthority,
|
|
19462
|
-
bucketTokenAccount: accounts.bucketTokenAccount,
|
|
19463
|
-
bucketUserRecord: accounts.bucketUserRecord,
|
|
19464
|
-
tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
|
|
19465
|
-
systemProgram: web3_js.SystemProgram.programId,
|
|
19466
|
-
globalConfig: accounts.globalConfig,
|
|
19467
|
-
oppEpochState: accounts.oppEpochState,
|
|
19468
|
-
pendingAttestations
|
|
19469
|
-
}).preInstructions([
|
|
19465
|
+
).accounts(
|
|
19466
|
+
buildSolanaInstaswapCrossChainAccounts({
|
|
19467
|
+
user,
|
|
19468
|
+
accounts,
|
|
19469
|
+
liqsolCoreProgram: this.program.programId,
|
|
19470
|
+
transferHookProgram: this.pgs.PROGRAM_IDS.TRANSFER_HOOK,
|
|
19471
|
+
pendingAttestations
|
|
19472
|
+
})
|
|
19473
|
+
).preInstructions([
|
|
19470
19474
|
web3_js.ComputeBudgetProgram.setComputeUnitLimit({ units: 9e5 })
|
|
19471
19475
|
]).rpc()
|
|
19472
19476
|
);
|
|
@@ -19854,6 +19858,34 @@ var __async$d = (__this, __arguments, generator) => {
|
|
|
19854
19858
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
19855
19859
|
});
|
|
19856
19860
|
};
|
|
19861
|
+
function buildSolanaSyndicateAccounts(params) {
|
|
19862
|
+
const { user, accounts, liqsolCoreProgram, transferHookProgram } = params;
|
|
19863
|
+
return {
|
|
19864
|
+
user,
|
|
19865
|
+
liqsolMint: accounts.liqsolMint,
|
|
19866
|
+
distributionState: accounts.distributionState,
|
|
19867
|
+
globalState: accounts.globalState,
|
|
19868
|
+
userAta: accounts.userAta,
|
|
19869
|
+
senderUserRecord: accounts.userUserRecord,
|
|
19870
|
+
bridgeAuthority: accounts.bridgeAuthority,
|
|
19871
|
+
bridgeVaultAta: accounts.bridgeVaultAta,
|
|
19872
|
+
bridgeUserRecord: accounts.bridgeUserRecord,
|
|
19873
|
+
bridgeState: accounts.bridgeState,
|
|
19874
|
+
outpostAccount: accounts.outpostAccount,
|
|
19875
|
+
extraAccountMetaList: accounts.extraAccountMetaList,
|
|
19876
|
+
liqsolCoreProgram,
|
|
19877
|
+
transferHookProgram,
|
|
19878
|
+
bucketAuthority: accounts.bucketAuthority,
|
|
19879
|
+
bucketTokenAccount: accounts.bucketTokenAccount,
|
|
19880
|
+
bucketUserRecord: accounts.bucketUserRecord,
|
|
19881
|
+
tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
|
|
19882
|
+
associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
19883
|
+
systemProgram: web3_js.SystemProgram.programId,
|
|
19884
|
+
globalConfig: accounts.globalConfig,
|
|
19885
|
+
oppEpochState: accounts.oppEpochState,
|
|
19886
|
+
pendingAttestations: accounts.pendingAttestations
|
|
19887
|
+
};
|
|
19888
|
+
}
|
|
19857
19889
|
class OutpostClient {
|
|
19858
19890
|
constructor(provider, pgs) {
|
|
19859
19891
|
this.provider = provider;
|
|
@@ -19944,30 +19976,14 @@ class OutpostClient {
|
|
|
19944
19976
|
throw new Error("OutpostClient.buildStakeIx: wireAccount is required");
|
|
19945
19977
|
}
|
|
19946
19978
|
const a = yield this.buildAccounts(user);
|
|
19947
|
-
return program.methods.syndicateLiqsolToWire(wireAccount.trim(), new anchor.BN(amountLamports.toString())).accounts(
|
|
19948
|
-
|
|
19949
|
-
|
|
19950
|
-
|
|
19951
|
-
|
|
19952
|
-
|
|
19953
|
-
|
|
19954
|
-
|
|
19955
|
-
liqsolPoolAta: a.liqsolPoolAta,
|
|
19956
|
-
poolUserRecord: a.liqsolPoolUserRecord,
|
|
19957
|
-
bridgeState: a.bridgeState,
|
|
19958
|
-
extraAccountMetaList: a.extraAccountMetaList,
|
|
19959
|
-
liqsolCoreProgram: this.pgs.PROGRAM_IDS.LIQSOL_CORE,
|
|
19960
|
-
transferHookProgram: this.pgs.PROGRAM_IDS.TRANSFER_HOOK,
|
|
19961
|
-
bucketAuthority: a.bucketAuthority,
|
|
19962
|
-
bucketTokenAccount: a.bucketTokenAccount,
|
|
19963
|
-
bucketUserRecord: a.bucketUserRecord,
|
|
19964
|
-
tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
|
|
19965
|
-
associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
19966
|
-
systemProgram: web3_js.SystemProgram.programId,
|
|
19967
|
-
globalConfig: a.globalConfig,
|
|
19968
|
-
oppEpochState: a.oppEpochState,
|
|
19969
|
-
pendingAttestations: a.pendingAttestations
|
|
19970
|
-
}).instruction();
|
|
19979
|
+
return program.methods.syndicateLiqsolToWire(wireAccount.trim(), new anchor.BN(amountLamports.toString())).accounts(
|
|
19980
|
+
buildSolanaSyndicateAccounts({
|
|
19981
|
+
user,
|
|
19982
|
+
accounts: a,
|
|
19983
|
+
liqsolCoreProgram: this.pgs.PROGRAM_IDS.LIQSOL_CORE,
|
|
19984
|
+
transferHookProgram: this.pgs.PROGRAM_IDS.TRANSFER_HOOK
|
|
19985
|
+
})
|
|
19986
|
+
).instruction();
|
|
19971
19987
|
});
|
|
19972
19988
|
}
|
|
19973
19989
|
buildUnstakeIx(amountLamports, user) {
|
|
@@ -20185,25 +20201,25 @@ class TokenClient {
|
|
|
20185
20201
|
}
|
|
20186
20202
|
}
|
|
20187
20203
|
|
|
20188
|
-
var __defProp = Object.defineProperty;
|
|
20189
|
-
var __defProps = Object.defineProperties;
|
|
20190
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
20191
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
20192
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
20193
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
20194
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
20195
|
-
var __spreadValues = (a, b) => {
|
|
20204
|
+
var __defProp$1 = Object.defineProperty;
|
|
20205
|
+
var __defProps$1 = Object.defineProperties;
|
|
20206
|
+
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
20207
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
20208
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
20209
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
20210
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
20211
|
+
var __spreadValues$1 = (a, b) => {
|
|
20196
20212
|
for (var prop in b || (b = {}))
|
|
20197
|
-
if (__hasOwnProp.call(b, prop))
|
|
20198
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20199
|
-
if (__getOwnPropSymbols)
|
|
20200
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
20201
|
-
if (__propIsEnum.call(b, prop))
|
|
20202
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20213
|
+
if (__hasOwnProp$1.call(b, prop))
|
|
20214
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
20215
|
+
if (__getOwnPropSymbols$1)
|
|
20216
|
+
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
20217
|
+
if (__propIsEnum$1.call(b, prop))
|
|
20218
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
20203
20219
|
}
|
|
20204
20220
|
return a;
|
|
20205
20221
|
};
|
|
20206
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20222
|
+
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
20207
20223
|
var __async$b = (__this, __arguments, generator) => {
|
|
20208
20224
|
return new Promise((resolve, reject) => {
|
|
20209
20225
|
var fulfilled = (value) => {
|
|
@@ -20285,7 +20301,7 @@ class SolanaProgramService {
|
|
|
20285
20301
|
}
|
|
20286
20302
|
getProgram(name) {
|
|
20287
20303
|
const { idl, address } = this.programs[name];
|
|
20288
|
-
const idlWithAddr = __spreadProps(__spreadValues({}, idl), { address });
|
|
20304
|
+
const idlWithAddr = __spreadProps$1(__spreadValues$1({}, idl), { address });
|
|
20289
20305
|
return new anchor.Program(idlWithAddr, this.provider);
|
|
20290
20306
|
}
|
|
20291
20307
|
listProgramNames() {
|
|
@@ -71693,6 +71709,25 @@ class EthereumContractService {
|
|
|
71693
71709
|
}
|
|
71694
71710
|
}
|
|
71695
71711
|
|
|
71712
|
+
var __defProp = Object.defineProperty;
|
|
71713
|
+
var __defProps = Object.defineProperties;
|
|
71714
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
71715
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
71716
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
71717
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
71718
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
71719
|
+
var __spreadValues = (a, b) => {
|
|
71720
|
+
for (var prop in b || (b = {}))
|
|
71721
|
+
if (__hasOwnProp.call(b, prop))
|
|
71722
|
+
__defNormalProp(a, prop, b[prop]);
|
|
71723
|
+
if (__getOwnPropSymbols)
|
|
71724
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
71725
|
+
if (__propIsEnum.call(b, prop))
|
|
71726
|
+
__defNormalProp(a, prop, b[prop]);
|
|
71727
|
+
}
|
|
71728
|
+
return a;
|
|
71729
|
+
};
|
|
71730
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
71696
71731
|
var __async$8 = (__this, __arguments, generator) => {
|
|
71697
71732
|
return new Promise((resolve, reject) => {
|
|
71698
71733
|
var fulfilled = (value) => {
|
|
@@ -71714,6 +71749,8 @@ var __async$8 = (__this, __arguments, generator) => {
|
|
|
71714
71749
|
});
|
|
71715
71750
|
};
|
|
71716
71751
|
BigInt(1e4);
|
|
71752
|
+
const DEFAULT_WRITE_GAS_PADDING_BPS = 2e3;
|
|
71753
|
+
const DEFAULT_WRITE_GAS_FALLBACK_LIMIT = ethers.ethers.BigNumber.from(8e6);
|
|
71717
71754
|
function formatContractErrors(err) {
|
|
71718
71755
|
if (err.errorName && err.errorArgs) {
|
|
71719
71756
|
const errorObj = {
|
|
@@ -71786,6 +71823,39 @@ function sendOPPFinalize(opp, gasLimit) {
|
|
|
71786
71823
|
}
|
|
71787
71824
|
});
|
|
71788
71825
|
}
|
|
71826
|
+
function resolveContractWriteOverrides(_0, _1) {
|
|
71827
|
+
return __async$8(this, arguments, function* (contract, method, args = [], overrides = {}, options) {
|
|
71828
|
+
var _a, _b, _c;
|
|
71829
|
+
if (overrides["gasLimit"] != null) {
|
|
71830
|
+
return overrides;
|
|
71831
|
+
}
|
|
71832
|
+
const paddingBps = (_a = options == null ? void 0 : options.paddingBps) != null ? _a : DEFAULT_WRITE_GAS_PADDING_BPS;
|
|
71833
|
+
const fallbackGasLimit = ethers.ethers.BigNumber.from(
|
|
71834
|
+
(_b = options == null ? void 0 : options.fallbackGasLimit) != null ? _b : DEFAULT_WRITE_GAS_FALLBACK_LIMIT
|
|
71835
|
+
);
|
|
71836
|
+
try {
|
|
71837
|
+
const estimateGas = (_c = contract.estimateGas) == null ? void 0 : _c[method];
|
|
71838
|
+
if (typeof estimateGas !== "function") {
|
|
71839
|
+
return __spreadProps(__spreadValues({}, overrides), {
|
|
71840
|
+
gasLimit: fallbackGasLimit
|
|
71841
|
+
});
|
|
71842
|
+
}
|
|
71843
|
+
const estimated = yield estimateGas(...args, overrides);
|
|
71844
|
+
const gasLimit = ethers.ethers.BigNumber.from(estimated).mul(1e4 + paddingBps).div(1e4);
|
|
71845
|
+
return __spreadProps(__spreadValues({}, overrides), {
|
|
71846
|
+
gasLimit
|
|
71847
|
+
});
|
|
71848
|
+
} catch (error) {
|
|
71849
|
+
console.warn(
|
|
71850
|
+
`[EthereumGas] estimateGas.${method} failed, using fallback gasLimit ${fallbackGasLimit.toString()}`,
|
|
71851
|
+
error
|
|
71852
|
+
);
|
|
71853
|
+
return __spreadProps(__spreadValues({}, overrides), {
|
|
71854
|
+
gasLimit: fallbackGasLimit
|
|
71855
|
+
});
|
|
71856
|
+
}
|
|
71857
|
+
});
|
|
71858
|
+
}
|
|
71789
71859
|
const BPS_DENOM = BigInt(1e4);
|
|
71790
71860
|
const USD_ONCHAIN_SCALE = BigInt(1e18);
|
|
71791
71861
|
const USD_CLIENT_SCALE = BigInt(1e8);
|
|
@@ -73254,11 +73324,17 @@ class EthereumInstaswapClient {
|
|
|
73254
73324
|
destinationAddress,
|
|
73255
73325
|
minOut
|
|
73256
73326
|
);
|
|
73327
|
+
const txOverrides = yield resolveContractWriteOverrides(
|
|
73328
|
+
depositorWrite,
|
|
73329
|
+
"instaswapCrossChain",
|
|
73330
|
+
[amountIn, destinationChain, destinationAddress, minOut]
|
|
73331
|
+
);
|
|
73257
73332
|
const swapTx = yield depositorWrite["instaswapCrossChain"](
|
|
73258
73333
|
amountIn,
|
|
73259
73334
|
destinationChain,
|
|
73260
73335
|
destinationAddress,
|
|
73261
|
-
minOut
|
|
73336
|
+
minOut,
|
|
73337
|
+
txOverrides
|
|
73262
73338
|
);
|
|
73263
73339
|
yield (_a = hooks == null ? void 0 : hooks.onSubmitted) == null ? void 0 : _a.call(hooks, swapTx.hash);
|
|
73264
73340
|
const receipt = yield swapTx.wait();
|
|
@@ -73598,7 +73674,12 @@ class StakeClient {
|
|
|
73598
73674
|
let errorObj = formatContractErrors(err);
|
|
73599
73675
|
throw new Error((_a = errorObj.name) != null ? _a : errorObj.raw);
|
|
73600
73676
|
}
|
|
73601
|
-
const
|
|
73677
|
+
const txOverrides = yield resolveContractWriteOverrides(
|
|
73678
|
+
this.contract.Depositor,
|
|
73679
|
+
"stakeLiqETH",
|
|
73680
|
+
[amountWei]
|
|
73681
|
+
);
|
|
73682
|
+
const tx = yield this.contract.Depositor.stakeLiqETH(amountWei, txOverrides);
|
|
73602
73683
|
const receipt = yield tx.wait(1);
|
|
73603
73684
|
let staked;
|
|
73604
73685
|
const ev = (_b = receipt.events) == null ? void 0 : _b.find((e) => e.event === "Staked");
|
|
@@ -73648,7 +73729,12 @@ class StakeClient {
|
|
|
73648
73729
|
let errorObj = formatContractErrors(err);
|
|
73649
73730
|
throw new Error(`StakeClient.performStakeToWire: ${(_a = errorObj.name) != null ? _a : errorObj.raw}`);
|
|
73650
73731
|
}
|
|
73651
|
-
const
|
|
73732
|
+
const txOverrides = yield resolveContractWriteOverrides(
|
|
73733
|
+
this.contract.Depositor,
|
|
73734
|
+
"stakeLiqETHToWire",
|
|
73735
|
+
[amountWei, wireAccount]
|
|
73736
|
+
);
|
|
73737
|
+
const tx = yield this.contract.Depositor.stakeLiqETHToWire(amountWei, wireAccount, txOverrides);
|
|
73652
73738
|
const receipt = yield tx.wait(1);
|
|
73653
73739
|
let staked;
|
|
73654
73740
|
const ev = (_b = receipt.events) == null ? void 0 : _b.find((e) => e.event === "Staked");
|
|
@@ -73699,7 +73785,13 @@ class StakeClient {
|
|
|
73699
73785
|
let errorObj = formatContractErrors(err);
|
|
73700
73786
|
throw new Error((_a = errorObj.name) != null ? _a : errorObj.raw);
|
|
73701
73787
|
}
|
|
73702
|
-
const
|
|
73788
|
+
const txOverrides = yield resolveContractWriteOverrides(
|
|
73789
|
+
this.contract.Depositor,
|
|
73790
|
+
"depositAndStake",
|
|
73791
|
+
[],
|
|
73792
|
+
{ value: amountWei }
|
|
73793
|
+
);
|
|
73794
|
+
const tx = yield this.contract.Depositor.depositAndStake(txOverrides);
|
|
73703
73795
|
const receipt = yield tx.wait(1);
|
|
73704
73796
|
let staked;
|
|
73705
73797
|
const ev = (_b = receipt.events) == null ? void 0 : _b.find((e) => e.event === "Staked");
|
|
@@ -73752,7 +73844,13 @@ class StakeClient {
|
|
|
73752
73844
|
let errorObj = formatContractErrors(err);
|
|
73753
73845
|
throw new Error((_a = errorObj.name) != null ? _a : errorObj.raw);
|
|
73754
73846
|
}
|
|
73755
|
-
const
|
|
73847
|
+
const txOverrides = yield resolveContractWriteOverrides(
|
|
73848
|
+
this.contract.Depositor,
|
|
73849
|
+
"depositAndPurchase",
|
|
73850
|
+
[],
|
|
73851
|
+
{ value: amountWei }
|
|
73852
|
+
);
|
|
73853
|
+
const tx = yield this.contract.Depositor.depositAndPurchase(txOverrides);
|
|
73756
73854
|
const receipt = yield tx.wait(1);
|
|
73757
73855
|
return { txHash: tx.hash, receipt };
|
|
73758
73856
|
});
|
|
@@ -73766,7 +73864,12 @@ class StakeClient {
|
|
|
73766
73864
|
let errorObj = formatContractErrors(err);
|
|
73767
73865
|
throw new Error((_a = errorObj.name) != null ? _a : errorObj.raw);
|
|
73768
73866
|
}
|
|
73769
|
-
const
|
|
73867
|
+
const txOverrides = yield resolveContractWriteOverrides(
|
|
73868
|
+
this.contract.Depositor,
|
|
73869
|
+
"unstakeAndRequestWithdraw",
|
|
73870
|
+
[tokenId]
|
|
73871
|
+
);
|
|
73872
|
+
const tx = yield this.contract.Depositor.unstakeAndRequestWithdraw(tokenId, txOverrides);
|
|
73770
73873
|
const receipt = yield tx.wait(1);
|
|
73771
73874
|
return { txHash: tx.hash, receipt };
|
|
73772
73875
|
});
|
|
@@ -73838,7 +73941,12 @@ class PretokenClient {
|
|
|
73838
73941
|
}
|
|
73839
73942
|
let tx, receipt;
|
|
73840
73943
|
try {
|
|
73841
|
-
|
|
73944
|
+
const txOverrides = yield resolveContractWriteOverrides(
|
|
73945
|
+
this.contract.Depositor,
|
|
73946
|
+
"purchasePretokensWithLiqETH",
|
|
73947
|
+
[amountLiq, buyer]
|
|
73948
|
+
);
|
|
73949
|
+
tx = yield this.contract.Depositor.purchasePretokensWithLiqETH(amountLiq, buyer, txOverrides);
|
|
73842
73950
|
receipt = yield tx.wait(1);
|
|
73843
73951
|
} catch (err) {
|
|
73844
73952
|
let errorObj = formatContractErrors(err);
|
|
@@ -74921,6 +75029,8 @@ exports.SupportedSolChainID = SupportedSolChainID;
|
|
|
74921
75029
|
exports.TokenClient = TokenClient;
|
|
74922
75030
|
exports.airdropSol = airdropSol;
|
|
74923
75031
|
exports.buildOutpostAccounts = buildOutpostAccounts;
|
|
75032
|
+
exports.buildSolanaInstaswapCrossChainAccounts = buildSolanaInstaswapCrossChainAccounts;
|
|
75033
|
+
exports.buildSolanaSyndicateAccounts = buildSolanaSyndicateAccounts;
|
|
74924
75034
|
exports.buildSolanaTrancheLadder = buildSolanaTrancheLadder;
|
|
74925
75035
|
exports.buildSolanaTrancheSnapshot = buildSolanaTrancheSnapshot;
|
|
74926
75036
|
exports.ceilDiv = ceilDiv;
|