@wireio/stake 1.3.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/lib/stake.d.ts CHANGED
@@ -19182,6 +19182,36 @@ declare class LeaderboardClient {
19182
19182
  getTopValidators(limit?: number): Promise<ValidatorRecord[]>;
19183
19183
  }
19184
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
+ };
19185
19215
  /**
19186
19216
  * OutpostClient
19187
19217
  *
@@ -19528,5 +19558,5 @@ declare class SolanaStakingClient implements IStakingClient {
19528
19558
  private getSingleTxFeeLamports;
19529
19559
  }
19530
19560
 
19531
- 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, 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 };
19532
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
@@ -19858,6 +19858,34 @@ var __async$d = (__this, __arguments, generator) => {
19858
19858
  step((generator = generator.apply(__this, __arguments)).next());
19859
19859
  });
19860
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
+ }
19861
19889
  class OutpostClient {
19862
19890
  constructor(provider, pgs) {
19863
19891
  this.provider = provider;
@@ -19948,30 +19976,14 @@ class OutpostClient {
19948
19976
  throw new Error("OutpostClient.buildStakeIx: wireAccount is required");
19949
19977
  }
19950
19978
  const a = yield this.buildAccounts(user);
19951
- return program.methods.syndicateLiqsolToWire(wireAccount.trim(), new anchor.BN(amountLamports.toString())).accounts({
19952
- user,
19953
- liqsolMint: a.liqsolMint,
19954
- distributionState: a.distributionState,
19955
- globalState: a.globalState,
19956
- userAta: a.userAta,
19957
- senderUserRecord: a.userUserRecord,
19958
- poolAuthority: a.poolAuthority,
19959
- liqsolPoolAta: a.liqsolPoolAta,
19960
- poolUserRecord: a.liqsolPoolUserRecord,
19961
- bridgeState: a.bridgeState,
19962
- extraAccountMetaList: a.extraAccountMetaList,
19963
- liqsolCoreProgram: this.pgs.PROGRAM_IDS.LIQSOL_CORE,
19964
- transferHookProgram: this.pgs.PROGRAM_IDS.TRANSFER_HOOK,
19965
- bucketAuthority: a.bucketAuthority,
19966
- bucketTokenAccount: a.bucketTokenAccount,
19967
- bucketUserRecord: a.bucketUserRecord,
19968
- tokenProgram: splToken.TOKEN_2022_PROGRAM_ID,
19969
- associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
19970
- systemProgram: web3_js.SystemProgram.programId,
19971
- globalConfig: a.globalConfig,
19972
- oppEpochState: a.oppEpochState,
19973
- pendingAttestations: a.pendingAttestations
19974
- }).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();
19975
19987
  });
19976
19988
  }
19977
19989
  buildUnstakeIx(amountLamports, user) {
@@ -20189,25 +20201,25 @@ class TokenClient {
20189
20201
  }
20190
20202
  }
20191
20203
 
20192
- var __defProp = Object.defineProperty;
20193
- var __defProps = Object.defineProperties;
20194
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
20195
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
20196
- var __hasOwnProp = Object.prototype.hasOwnProperty;
20197
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
20198
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20199
- 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) => {
20200
20212
  for (var prop in b || (b = {}))
20201
- if (__hasOwnProp.call(b, prop))
20202
- __defNormalProp(a, prop, b[prop]);
20203
- if (__getOwnPropSymbols)
20204
- for (var prop of __getOwnPropSymbols(b)) {
20205
- if (__propIsEnum.call(b, prop))
20206
- __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]);
20207
20219
  }
20208
20220
  return a;
20209
20221
  };
20210
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20222
+ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
20211
20223
  var __async$b = (__this, __arguments, generator) => {
20212
20224
  return new Promise((resolve, reject) => {
20213
20225
  var fulfilled = (value) => {
@@ -20289,7 +20301,7 @@ class SolanaProgramService {
20289
20301
  }
20290
20302
  getProgram(name) {
20291
20303
  const { idl, address } = this.programs[name];
20292
- const idlWithAddr = __spreadProps(__spreadValues({}, idl), { address });
20304
+ const idlWithAddr = __spreadProps$1(__spreadValues$1({}, idl), { address });
20293
20305
  return new anchor.Program(idlWithAddr, this.provider);
20294
20306
  }
20295
20307
  listProgramNames() {
@@ -71697,6 +71709,25 @@ class EthereumContractService {
71697
71709
  }
71698
71710
  }
71699
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));
71700
71731
  var __async$8 = (__this, __arguments, generator) => {
71701
71732
  return new Promise((resolve, reject) => {
71702
71733
  var fulfilled = (value) => {
@@ -71718,6 +71749,8 @@ var __async$8 = (__this, __arguments, generator) => {
71718
71749
  });
71719
71750
  };
71720
71751
  BigInt(1e4);
71752
+ const DEFAULT_WRITE_GAS_PADDING_BPS = 2e3;
71753
+ const DEFAULT_WRITE_GAS_FALLBACK_LIMIT = ethers.ethers.BigNumber.from(8e6);
71721
71754
  function formatContractErrors(err) {
71722
71755
  if (err.errorName && err.errorArgs) {
71723
71756
  const errorObj = {
@@ -71790,6 +71823,39 @@ function sendOPPFinalize(opp, gasLimit) {
71790
71823
  }
71791
71824
  });
71792
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
+ }
71793
71859
  const BPS_DENOM = BigInt(1e4);
71794
71860
  const USD_ONCHAIN_SCALE = BigInt(1e18);
71795
71861
  const USD_CLIENT_SCALE = BigInt(1e8);
@@ -73258,11 +73324,17 @@ class EthereumInstaswapClient {
73258
73324
  destinationAddress,
73259
73325
  minOut
73260
73326
  );
73327
+ const txOverrides = yield resolveContractWriteOverrides(
73328
+ depositorWrite,
73329
+ "instaswapCrossChain",
73330
+ [amountIn, destinationChain, destinationAddress, minOut]
73331
+ );
73261
73332
  const swapTx = yield depositorWrite["instaswapCrossChain"](
73262
73333
  amountIn,
73263
73334
  destinationChain,
73264
73335
  destinationAddress,
73265
- minOut
73336
+ minOut,
73337
+ txOverrides
73266
73338
  );
73267
73339
  yield (_a = hooks == null ? void 0 : hooks.onSubmitted) == null ? void 0 : _a.call(hooks, swapTx.hash);
73268
73340
  const receipt = yield swapTx.wait();
@@ -73602,7 +73674,12 @@ class StakeClient {
73602
73674
  let errorObj = formatContractErrors(err);
73603
73675
  throw new Error((_a = errorObj.name) != null ? _a : errorObj.raw);
73604
73676
  }
73605
- const tx = yield this.contract.Depositor.stakeLiqETH(amountWei);
73677
+ const txOverrides = yield resolveContractWriteOverrides(
73678
+ this.contract.Depositor,
73679
+ "stakeLiqETH",
73680
+ [amountWei]
73681
+ );
73682
+ const tx = yield this.contract.Depositor.stakeLiqETH(amountWei, txOverrides);
73606
73683
  const receipt = yield tx.wait(1);
73607
73684
  let staked;
73608
73685
  const ev = (_b = receipt.events) == null ? void 0 : _b.find((e) => e.event === "Staked");
@@ -73652,7 +73729,12 @@ class StakeClient {
73652
73729
  let errorObj = formatContractErrors(err);
73653
73730
  throw new Error(`StakeClient.performStakeToWire: ${(_a = errorObj.name) != null ? _a : errorObj.raw}`);
73654
73731
  }
73655
- const tx = yield this.contract.Depositor.stakeLiqETHToWire(amountWei, wireAccount);
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);
73656
73738
  const receipt = yield tx.wait(1);
73657
73739
  let staked;
73658
73740
  const ev = (_b = receipt.events) == null ? void 0 : _b.find((e) => e.event === "Staked");
@@ -73703,7 +73785,13 @@ class StakeClient {
73703
73785
  let errorObj = formatContractErrors(err);
73704
73786
  throw new Error((_a = errorObj.name) != null ? _a : errorObj.raw);
73705
73787
  }
73706
- const tx = yield this.contract.Depositor.depositAndStake({ value: amountWei });
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);
73707
73795
  const receipt = yield tx.wait(1);
73708
73796
  let staked;
73709
73797
  const ev = (_b = receipt.events) == null ? void 0 : _b.find((e) => e.event === "Staked");
@@ -73756,7 +73844,13 @@ class StakeClient {
73756
73844
  let errorObj = formatContractErrors(err);
73757
73845
  throw new Error((_a = errorObj.name) != null ? _a : errorObj.raw);
73758
73846
  }
73759
- const tx = yield this.contract.Depositor.depositAndPurchase({ value: amountWei });
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);
73760
73854
  const receipt = yield tx.wait(1);
73761
73855
  return { txHash: tx.hash, receipt };
73762
73856
  });
@@ -73770,7 +73864,12 @@ class StakeClient {
73770
73864
  let errorObj = formatContractErrors(err);
73771
73865
  throw new Error((_a = errorObj.name) != null ? _a : errorObj.raw);
73772
73866
  }
73773
- const tx = yield this.contract.Depositor.unstakeAndRequestWithdraw(tokenId);
73867
+ const txOverrides = yield resolveContractWriteOverrides(
73868
+ this.contract.Depositor,
73869
+ "unstakeAndRequestWithdraw",
73870
+ [tokenId]
73871
+ );
73872
+ const tx = yield this.contract.Depositor.unstakeAndRequestWithdraw(tokenId, txOverrides);
73774
73873
  const receipt = yield tx.wait(1);
73775
73874
  return { txHash: tx.hash, receipt };
73776
73875
  });
@@ -73842,7 +73941,12 @@ class PretokenClient {
73842
73941
  }
73843
73942
  let tx, receipt;
73844
73943
  try {
73845
- tx = yield this.contract.Depositor.purchasePretokensWithLiqETH(amountLiq, buyer);
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);
73846
73950
  receipt = yield tx.wait(1);
73847
73951
  } catch (err) {
73848
73952
  let errorObj = formatContractErrors(err);
@@ -74926,6 +75030,7 @@ exports.TokenClient = TokenClient;
74926
75030
  exports.airdropSol = airdropSol;
74927
75031
  exports.buildOutpostAccounts = buildOutpostAccounts;
74928
75032
  exports.buildSolanaInstaswapCrossChainAccounts = buildSolanaInstaswapCrossChainAccounts;
75033
+ exports.buildSolanaSyndicateAccounts = buildSolanaSyndicateAccounts;
74929
75034
  exports.buildSolanaTrancheLadder = buildSolanaTrancheLadder;
74930
75035
  exports.buildSolanaTrancheSnapshot = buildSolanaTrancheSnapshot;
74931
75036
  exports.ceilDiv = ceilDiv;