@flaunch/sdk 0.9.0 → 0.9.2

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/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createDrift as createDrift$1 } from '@delvtech/drift';
2
- import { zeroAddress, parseEther, encodeAbiParameters as encodeAbiParameters$1, maxUint256 as maxUint256$1, encodeFunctionData, maxUint160, maxUint48, parseUnits, hexToBigInt as hexToBigInt$1, pad as pad$1, keccak256 as keccak256$1, encodePacked, stringToHex as stringToHex$1, zeroHash, formatUnits as formatUnits$1, createPublicClient, http, parseEventLogs, concat as concat$1, toHex as toHex$1, formatEther, erc721Abi, erc20Abi, parseAbi, createWalletClient, decodeFunctionData } from 'viem';
2
+ import { zeroAddress, parseEther, encodeAbiParameters as encodeAbiParameters$1, maxUint256 as maxUint256$1, encodeFunctionData, maxUint160, maxUint48, parseUnits, hexToBigInt as hexToBigInt$1, pad as pad$1, keccak256 as keccak256$1, encodePacked, stringToHex as stringToHex$1, zeroHash, formatUnits as formatUnits$1, parseEventLogs, concat as concat$1, toHex as toHex$1, formatEther, erc721Abi, erc20Abi, parseAbi, createWalletClient, http, decodeFunctionData } from 'viem';
3
3
  import axios from 'axios';
4
4
  import { viemAdapter } from '@delvtech/drift-viem';
5
5
 
@@ -5742,16 +5742,16 @@ const TreasuryManagerFactoryAddress = {
5742
5742
  [baseSepolia.id]: "0xD2F3C6185e06925dCBE794C6574315b2202E9CcD",
5743
5743
  };
5744
5744
  const RevenueManagerAddress = {
5745
- [base.id]: "0x712fa8ddc7347b4b6b029aa21710f365cd02d898",
5746
- [baseSepolia.id]: "0x17E02501dE3e420347e7C5fCAe3AD787C5aea690",
5745
+ [base.id]: "0xb6c0cca8b3a354fa0f348c121657f4a952e92b3d",
5746
+ [baseSepolia.id]: "0xd32b7236f45b787d808a65bb3e2160aa3a9ced09",
5747
5747
  };
5748
5748
  const AddressFeeSplitManagerAddress = {
5749
- [base.id]: "0x6baa4ec493a9698dc7388c0f290e29ea3d149f99",
5750
- [baseSepolia.id]: "0xf72dcdee692c188de6b14c6213e849982e04069b",
5749
+ [base.id]: "0xabde686e8a710ade941189d634596215ba78334b",
5750
+ [baseSepolia.id]: "0x3e0edadf33085d47e53212aff8a85ed292fe201c",
5751
5751
  };
5752
5752
  const StakingManagerAddress = {
5753
- [base.id]: "0xB5dD2Fbca9b746a56cF9e5e2ADaBf8BEF0BAdBEA",
5754
- [baseSepolia.id]: "0x8Ea4074c38cA7a596C740DD9E9D7122ea8E78c3c",
5753
+ [base.id]: "0x540677596a3aa2d75f2eb1e791b8f27ec4a9622d",
5754
+ [baseSepolia.id]: "0xfaff975c1cf48767e053d0777309578c6b3ae44c",
5755
5755
  };
5756
5756
  /** Verifiers */
5757
5757
  const TokenImporterAddress = {
@@ -23876,13 +23876,8 @@ const TreasuryManagerFactoryAbi = [
23876
23876
  { type: "error", name: "UnknownManagerImplemention", inputs: [] },
23877
23877
  ];
23878
23878
 
23879
- const chainIdToChain = {
23880
- [base.id]: base,
23881
- [baseSepolia.id]: baseSepolia,
23882
- };
23883
-
23884
23879
  class ReadTreasuryManagerFactory {
23885
- constructor(chainId, address, drift = createDrift$1()) {
23880
+ constructor(chainId, address, drift = createDrift$1(), publicClient) {
23886
23881
  if (!address) {
23887
23882
  throw new Error("Address is required");
23888
23883
  }
@@ -23891,15 +23886,14 @@ class ReadTreasuryManagerFactory {
23891
23886
  address,
23892
23887
  });
23893
23888
  this.chainId = chainId;
23889
+ this.publicClient = publicClient;
23894
23890
  }
23895
23891
  async getManagerDeployedAddressFromTx(hash) {
23896
- // Create a public client to get the transaction receipt with logs
23897
- const publicClient = createPublicClient({
23898
- chain: chainIdToChain[this.chainId],
23899
- transport: http(),
23900
- });
23901
23892
  // Wait for transaction receipt
23902
- const receipt = await publicClient.waitForTransactionReceipt({ hash });
23893
+ if (!this.publicClient) {
23894
+ throw new Error("Public client is required");
23895
+ }
23896
+ const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
23903
23897
  // Parse the ManagerDeployed event from receipt logs
23904
23898
  const parsedLogs = parseEventLogs({
23905
23899
  abi: TreasuryManagerFactoryAbi,
@@ -23915,8 +23909,8 @@ class ReadTreasuryManagerFactory {
23915
23909
  }
23916
23910
  }
23917
23911
  class ReadWriteTreasuryManagerFactory extends ReadTreasuryManagerFactory {
23918
- constructor(chainId, address, drift = createDrift$1()) {
23919
- super(chainId, address, drift);
23912
+ constructor(chainId, address, drift = createDrift$1(), publicClient) {
23913
+ super(chainId, address, drift, publicClient);
23920
23914
  }
23921
23915
  }
23922
23916
 
@@ -25514,6 +25508,11 @@ const getAmountsForLiquidity = (params) => {
25514
25508
  return { amount0, amount1 };
25515
25509
  };
25516
25510
 
25511
+ const chainIdToChain = {
25512
+ [base.id]: base,
25513
+ [baseSepolia.id]: baseSepolia,
25514
+ };
25515
+
25517
25516
  const FastFlaunchZapAbi = [
25518
25517
  {
25519
25518
  inputs: [
@@ -26047,10 +26046,11 @@ class ReadTrustedSignerFeeCalculator {
26047
26046
  * Base class for interacting with Flaunch protocol in read-only mode
26048
26047
  */
26049
26048
  class ReadFlaunchSDK {
26050
- constructor(chainId, drift = createDrift$1()) {
26049
+ constructor(chainId, drift = createDrift$1(), publicClient) {
26051
26050
  this.TICK_SPACING = TICK_SPACING;
26052
26051
  this.chainId = chainId;
26053
26052
  this.drift = drift;
26053
+ this.publicClient = publicClient;
26054
26054
  this.resolveIPFS = resolveIPFS;
26055
26055
  this.readPositionManager = new ReadFlaunchPositionManager(FlaunchPositionManagerAddress[this.chainId], drift);
26056
26056
  this.readPositionManagerV1_1 = new ReadFlaunchPositionManagerV1_1(FlaunchPositionManagerV1_1Address[this.chainId], drift);
@@ -27319,8 +27319,8 @@ class ReadFlaunchSDK {
27319
27319
  }
27320
27320
  }
27321
27321
  class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
27322
- constructor(chainId, drift = createDrift$1()) {
27323
- super(chainId, drift);
27322
+ constructor(chainId, drift = createDrift$1(), publicClient) {
27323
+ super(chainId, drift, publicClient);
27324
27324
  this.readWritePositionManager = new ReadWriteFlaunchPositionManager(FlaunchPositionManagerAddress[this.chainId], drift);
27325
27325
  this.readWritePositionManagerV1_1 = new ReadWriteFlaunchPositionManagerV1_1(FlaunchPositionManagerV1_1Address[this.chainId], drift);
27326
27326
  this.readWriteAnyPositionManager = new ReadWriteAnyPositionManager(AnyPositionManagerAddress[this.chainId], drift);
@@ -27328,7 +27328,7 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
27328
27328
  this.readWriteFeeEscrow = new ReadWriteFeeEscrow(FeeEscrowAddress[this.chainId], drift);
27329
27329
  this.readWriteReferralEscrow = new ReadWriteReferralEscrow(ReferralEscrowAddress[this.chainId], drift);
27330
27330
  this.readWriteFlaunchZap = new ReadWriteFlaunchZap(this.chainId, FlaunchZapAddress[this.chainId], drift);
27331
- this.readWriteTreasuryManagerFactory = new ReadWriteTreasuryManagerFactory(this.chainId, TreasuryManagerFactoryAddress[this.chainId], drift);
27331
+ this.readWriteTreasuryManagerFactory = new ReadWriteTreasuryManagerFactory(this.chainId, TreasuryManagerFactoryAddress[this.chainId], drift, this.publicClient);
27332
27332
  this.readWritePermit2 = new ReadWritePermit2(Permit2Address[this.chainId], drift);
27333
27333
  }
27334
27334
  /**
@@ -28172,8 +28172,8 @@ function createFlaunch(params) {
28172
28172
  const chainId = publicClient.chain.id;
28173
28173
  // Return appropriate SDK type based on whether walletClient is provided
28174
28174
  return walletClient
28175
- ? new ReadWriteFlaunchSDK(chainId, createDrift({ publicClient, walletClient }))
28176
- : new ReadFlaunchSDK(chainId, createDrift({ publicClient }));
28175
+ ? new ReadWriteFlaunchSDK(chainId, createDrift({ publicClient, walletClient }), publicClient)
28176
+ : new ReadFlaunchSDK(chainId, createDrift({ publicClient }), publicClient);
28177
28177
  }
28178
28178
 
28179
28179
  // ABI for encoding the call data