@flaunch/sdk 0.5.1 → 0.6.0

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
@@ -12,7 +12,7 @@ function defineChain(chain) {
12
12
  };
13
13
  }
14
14
 
15
- const version = '2.28.3';
15
+ const version = '2.29.2';
16
16
 
17
17
  let errorConfig = {
18
18
  getDocsUrl: ({ docsBaseUrl, docsPath = '', docsSlug, }) => docsPath
@@ -3244,7 +3244,6 @@ const formatters = {
3244
3244
  });
3245
3245
  return {
3246
3246
  transactions,
3247
- ...(args.randomness ? { randomness: args.randomness } : {}),
3248
3247
  };
3249
3248
  },
3250
3249
  }),
@@ -5147,7 +5146,7 @@ const sourceId$3 = 11_155_111; // sepolia
5147
5146
  },
5148
5147
  disputeGameFactory: {
5149
5148
  [sourceId$3]: {
5150
- address: '0x8cF97Ee616C986a070F5020d973b456D0120C253',
5149
+ address: '0x8Ec1111f67Dad6b6A93B3F42DfBC92D81c98449A',
5151
5150
  },
5152
5151
  },
5153
5152
  l2OutputOracle: {
@@ -7086,11 +7085,11 @@ const generateTokenUri = async (name, params) => {
7086
7085
  name,
7087
7086
  description: params.metadata.description,
7088
7087
  image: `ipfs://${imageRes.IpfsHash}`,
7089
- external_link: params.metadata.websiteUrl,
7088
+ external_link: params.metadata.websiteUrl || "",
7090
7089
  collaborators: [],
7091
- discordUrl: params.metadata.discordUrl,
7092
- twitterUrl: params.metadata.twitterUrl,
7093
- telegramUrl: params.metadata.telegramUrl,
7090
+ discordUrl: params.metadata.discordUrl || "",
7091
+ twitterUrl: params.metadata.twitterUrl || "",
7092
+ telegramUrl: params.metadata.telegramUrl || "",
7094
7093
  };
7095
7094
  const metadataRes = await uploadJsonToIPFS({
7096
7095
  pinataConfig: params.pinataConfig,
@@ -8011,9 +8010,7 @@ class ReadFlaunchPositionManager {
8011
8010
  });
8012
8011
  // Get timestamps for each log
8013
8012
  const logsWithTimestamps = await Promise.all([..._logs].reverse().map(async (log) => {
8014
- const block = await this.drift.getBlock({
8015
- blockNumber: log.blockNumber,
8016
- });
8013
+ const block = await this.drift.getBlock(log.blockNumber);
8017
8014
  return {
8018
8015
  ...log,
8019
8016
  timestamp: Number(block?.timestamp) * 1000, // convert to ms for js
@@ -8076,9 +8073,7 @@ class ReadFlaunchPositionManager {
8076
8073
  });
8077
8074
  // Get timestamps for each log
8078
8075
  const logsWithTimestamps = await Promise.all([..._logs].reverse().map(async (log) => {
8079
- const block = await this.drift.getBlock({
8080
- blockNumber: log.blockNumber,
8081
- });
8076
+ const block = await this.drift.getBlock(log.blockNumber);
8082
8077
  const timestamp = Number(block?.timestamp) * 1000; // convert to ms for js
8083
8078
  if (flETHIsCurrencyZero === undefined) {
8084
8079
  return {
@@ -11945,9 +11940,7 @@ class ReadFlaunchPositionManagerV1_1 {
11945
11940
  });
11946
11941
  // Get timestamps for each log
11947
11942
  const logsWithTimestamps = await Promise.all([..._logs].reverse().map(async (log) => {
11948
- const block = await this.drift.getBlock({
11949
- blockNumber: log.blockNumber,
11950
- });
11943
+ const block = await this.drift.getBlock(log.blockNumber);
11951
11944
  return {
11952
11945
  ...log,
11953
11946
  timestamp: Number(block?.timestamp) * 1000, // convert to ms for js
@@ -12010,9 +12003,7 @@ class ReadFlaunchPositionManagerV1_1 {
12010
12003
  });
12011
12004
  // Get timestamps for each log
12012
12005
  const logsWithTimestamps = await Promise.all([..._logs].reverse().map(async (log) => {
12013
- const block = await this.drift.getBlock({
12014
- blockNumber: log.blockNumber,
12015
- });
12006
+ const block = await this.drift.getBlock(log.blockNumber);
12016
12007
  const timestamp = Number(block?.timestamp) * 1000; // convert to ms for js
12017
12008
  if (flETHIsCurrencyZero === undefined) {
12018
12009
  return {
@@ -12138,8 +12129,12 @@ class ReadWriteFlaunchPositionManagerV1_1 extends ReadFlaunchPositionManagerV1_1
12138
12129
  ], [initialMCapInUSDCWei]);
12139
12130
  const fairLaunchInBps = BigInt(fairLaunchPercent * 100);
12140
12131
  const creatorFeeAllocationInBps = creatorFeeAllocationPercent * 100;
12132
+ let sender = zeroAddress;
12133
+ if (this.drift.adapter.getSignerAddress) {
12134
+ sender = await this.drift.adapter.getSignerAddress();
12135
+ }
12141
12136
  const flaunchingFee = await this.getFlaunchingFee({
12142
- sender: await this.drift.adapter.getSignerAddress(),
12137
+ sender,
12143
12138
  initialPriceParams,
12144
12139
  slippagePercent: 5,
12145
12140
  });
@@ -13561,7 +13556,7 @@ class ReadMemecoin {
13561
13556
  * @returns Promise<string> - The name of the token
13562
13557
  */
13563
13558
  name() {
13564
- return this.contract.read("name");
13559
+ return this.contract.read("name", {});
13565
13560
  }
13566
13561
  /**
13567
13562
  * Gets the symbol of the token
@@ -14636,6 +14631,19 @@ class ReadPermit2 {
14636
14631
  });
14637
14632
  }
14638
14633
  }
14634
+ class ReadWritePermit2 extends ReadPermit2 {
14635
+ constructor(address, drift = createDrift()) {
14636
+ super(address, drift);
14637
+ }
14638
+ /**
14639
+ * Approves a spender to spend a token via transaction
14640
+ * @param params - The parameters for the approval
14641
+ * @returns The transaction response
14642
+ */
14643
+ approve(params) {
14644
+ return this.contract.write("approve", params);
14645
+ }
14646
+ }
14639
14647
 
14640
14648
  const BidWallV1_1Abi = [
14641
14649
  {
@@ -18208,7 +18216,9 @@ class ReadFlaunchSDK {
18208
18216
  filterByPoolId: params.filterByCoin
18209
18217
  ? await this.poolId(params.filterByCoin, true)
18210
18218
  : undefined,
18211
- flETHIsCurrencyZero: this.flETHIsCurrencyZero(params.filterByCoin),
18219
+ flETHIsCurrencyZero: params.filterByCoin
18220
+ ? this.flETHIsCurrencyZero(params.filterByCoin)
18221
+ : undefined,
18212
18222
  });
18213
18223
  }
18214
18224
  /**
@@ -18222,7 +18232,9 @@ class ReadFlaunchSDK {
18222
18232
  filterByPoolId: params.filterByCoin
18223
18233
  ? await this.poolId(params.filterByCoin)
18224
18234
  : undefined,
18225
- flETHIsCurrencyZero: this.flETHIsCurrencyZero(params.filterByCoin),
18235
+ flETHIsCurrencyZero: params.filterByCoin
18236
+ ? this.flETHIsCurrencyZero(params.filterByCoin)
18237
+ : undefined,
18226
18238
  });
18227
18239
  }
18228
18240
  /**
@@ -18676,6 +18688,7 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
18676
18688
  this.readWriteFastFlaunchZap = new ReadWriteFastFlaunchZap(FastFlaunchZapAddress[this.chainId], drift);
18677
18689
  this.readWriteFlaunchZap = new ReadWriteFlaunchZap(this.chainId, FlaunchZapAddress[this.chainId], drift);
18678
18690
  this.readWriteTreasuryManagerFactory = new ReadWriteTreasuryManagerFactory(this.chainId, TreasuryManagerFactoryAddress[this.chainId], drift);
18691
+ this.readWritePermit2 = new ReadWritePermit2(Permit2Address[this.chainId], drift);
18679
18692
  }
18680
18693
  /**
18681
18694
  * Deploys a new revenue manager
@@ -18821,7 +18834,7 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
18821
18834
  sender: sender,
18822
18835
  memecoin: params.coinAddress,
18823
18836
  chainId: this.chainId,
18824
- referrer: params.referrer,
18837
+ referrer: params.referrer ?? null,
18825
18838
  swapType: params.swapType,
18826
18839
  amountIn: amountIn,
18827
18840
  amountOutMin: amountOutMin,
@@ -18866,7 +18879,7 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
18866
18879
  ethOutMin,
18867
18880
  permitSingle: params.permitSingle,
18868
18881
  signature: params.signature,
18869
- referrer: params.referrer,
18882
+ referrer: params.referrer ?? null,
18870
18883
  isV1Coin: isV1Coin,
18871
18884
  });
18872
18885
  return this.drift.write({