@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.cjs.js CHANGED
@@ -20,7 +20,7 @@ function defineChain(chain) {
20
20
  };
21
21
  }
22
22
 
23
- const version = '2.28.3';
23
+ const version = '2.29.2';
24
24
 
25
25
  let errorConfig = {
26
26
  getDocsUrl: ({ docsBaseUrl, docsPath = '', docsSlug, }) => docsPath
@@ -3252,7 +3252,6 @@ const formatters = {
3252
3252
  });
3253
3253
  return {
3254
3254
  transactions,
3255
- ...(args.randomness ? { randomness: args.randomness } : {}),
3256
3255
  };
3257
3256
  },
3258
3257
  }),
@@ -5155,7 +5154,7 @@ const sourceId$3 = 11_155_111; // sepolia
5155
5154
  },
5156
5155
  disputeGameFactory: {
5157
5156
  [sourceId$3]: {
5158
- address: '0x8cF97Ee616C986a070F5020d973b456D0120C253',
5157
+ address: '0x8Ec1111f67Dad6b6A93B3F42DfBC92D81c98449A',
5159
5158
  },
5160
5159
  },
5161
5160
  l2OutputOracle: {
@@ -7094,11 +7093,11 @@ const generateTokenUri = async (name, params) => {
7094
7093
  name,
7095
7094
  description: params.metadata.description,
7096
7095
  image: `ipfs://${imageRes.IpfsHash}`,
7097
- external_link: params.metadata.websiteUrl,
7096
+ external_link: params.metadata.websiteUrl || "",
7098
7097
  collaborators: [],
7099
- discordUrl: params.metadata.discordUrl,
7100
- twitterUrl: params.metadata.twitterUrl,
7101
- telegramUrl: params.metadata.telegramUrl,
7098
+ discordUrl: params.metadata.discordUrl || "",
7099
+ twitterUrl: params.metadata.twitterUrl || "",
7100
+ telegramUrl: params.metadata.telegramUrl || "",
7102
7101
  };
7103
7102
  const metadataRes = await uploadJsonToIPFS({
7104
7103
  pinataConfig: params.pinataConfig,
@@ -8019,9 +8018,7 @@ class ReadFlaunchPositionManager {
8019
8018
  });
8020
8019
  // Get timestamps for each log
8021
8020
  const logsWithTimestamps = await Promise.all([..._logs].reverse().map(async (log) => {
8022
- const block = await this.drift.getBlock({
8023
- blockNumber: log.blockNumber,
8024
- });
8021
+ const block = await this.drift.getBlock(log.blockNumber);
8025
8022
  return {
8026
8023
  ...log,
8027
8024
  timestamp: Number(block?.timestamp) * 1000, // convert to ms for js
@@ -8084,9 +8081,7 @@ class ReadFlaunchPositionManager {
8084
8081
  });
8085
8082
  // Get timestamps for each log
8086
8083
  const logsWithTimestamps = await Promise.all([..._logs].reverse().map(async (log) => {
8087
- const block = await this.drift.getBlock({
8088
- blockNumber: log.blockNumber,
8089
- });
8084
+ const block = await this.drift.getBlock(log.blockNumber);
8090
8085
  const timestamp = Number(block?.timestamp) * 1000; // convert to ms for js
8091
8086
  if (flETHIsCurrencyZero === undefined) {
8092
8087
  return {
@@ -11953,9 +11948,7 @@ class ReadFlaunchPositionManagerV1_1 {
11953
11948
  });
11954
11949
  // Get timestamps for each log
11955
11950
  const logsWithTimestamps = await Promise.all([..._logs].reverse().map(async (log) => {
11956
- const block = await this.drift.getBlock({
11957
- blockNumber: log.blockNumber,
11958
- });
11951
+ const block = await this.drift.getBlock(log.blockNumber);
11959
11952
  return {
11960
11953
  ...log,
11961
11954
  timestamp: Number(block?.timestamp) * 1000, // convert to ms for js
@@ -12018,9 +12011,7 @@ class ReadFlaunchPositionManagerV1_1 {
12018
12011
  });
12019
12012
  // Get timestamps for each log
12020
12013
  const logsWithTimestamps = await Promise.all([..._logs].reverse().map(async (log) => {
12021
- const block = await this.drift.getBlock({
12022
- blockNumber: log.blockNumber,
12023
- });
12014
+ const block = await this.drift.getBlock(log.blockNumber);
12024
12015
  const timestamp = Number(block?.timestamp) * 1000; // convert to ms for js
12025
12016
  if (flETHIsCurrencyZero === undefined) {
12026
12017
  return {
@@ -12146,8 +12137,12 @@ class ReadWriteFlaunchPositionManagerV1_1 extends ReadFlaunchPositionManagerV1_1
12146
12137
  ], [initialMCapInUSDCWei]);
12147
12138
  const fairLaunchInBps = BigInt(fairLaunchPercent * 100);
12148
12139
  const creatorFeeAllocationInBps = creatorFeeAllocationPercent * 100;
12140
+ let sender = viem.zeroAddress;
12141
+ if (this.drift.adapter.getSignerAddress) {
12142
+ sender = await this.drift.adapter.getSignerAddress();
12143
+ }
12149
12144
  const flaunchingFee = await this.getFlaunchingFee({
12150
- sender: await this.drift.adapter.getSignerAddress(),
12145
+ sender,
12151
12146
  initialPriceParams,
12152
12147
  slippagePercent: 5,
12153
12148
  });
@@ -13569,7 +13564,7 @@ class ReadMemecoin {
13569
13564
  * @returns Promise<string> - The name of the token
13570
13565
  */
13571
13566
  name() {
13572
- return this.contract.read("name");
13567
+ return this.contract.read("name", {});
13573
13568
  }
13574
13569
  /**
13575
13570
  * Gets the symbol of the token
@@ -14644,6 +14639,19 @@ class ReadPermit2 {
14644
14639
  });
14645
14640
  }
14646
14641
  }
14642
+ class ReadWritePermit2 extends ReadPermit2 {
14643
+ constructor(address, drift$1 = drift.createDrift()) {
14644
+ super(address, drift$1);
14645
+ }
14646
+ /**
14647
+ * Approves a spender to spend a token via transaction
14648
+ * @param params - The parameters for the approval
14649
+ * @returns The transaction response
14650
+ */
14651
+ approve(params) {
14652
+ return this.contract.write("approve", params);
14653
+ }
14654
+ }
14647
14655
 
14648
14656
  const BidWallV1_1Abi = [
14649
14657
  {
@@ -18216,7 +18224,9 @@ class ReadFlaunchSDK {
18216
18224
  filterByPoolId: params.filterByCoin
18217
18225
  ? await this.poolId(params.filterByCoin, true)
18218
18226
  : undefined,
18219
- flETHIsCurrencyZero: this.flETHIsCurrencyZero(params.filterByCoin),
18227
+ flETHIsCurrencyZero: params.filterByCoin
18228
+ ? this.flETHIsCurrencyZero(params.filterByCoin)
18229
+ : undefined,
18220
18230
  });
18221
18231
  }
18222
18232
  /**
@@ -18230,7 +18240,9 @@ class ReadFlaunchSDK {
18230
18240
  filterByPoolId: params.filterByCoin
18231
18241
  ? await this.poolId(params.filterByCoin)
18232
18242
  : undefined,
18233
- flETHIsCurrencyZero: this.flETHIsCurrencyZero(params.filterByCoin),
18243
+ flETHIsCurrencyZero: params.filterByCoin
18244
+ ? this.flETHIsCurrencyZero(params.filterByCoin)
18245
+ : undefined,
18234
18246
  });
18235
18247
  }
18236
18248
  /**
@@ -18684,6 +18696,7 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
18684
18696
  this.readWriteFastFlaunchZap = new ReadWriteFastFlaunchZap(FastFlaunchZapAddress[this.chainId], drift$1);
18685
18697
  this.readWriteFlaunchZap = new ReadWriteFlaunchZap(this.chainId, FlaunchZapAddress[this.chainId], drift$1);
18686
18698
  this.readWriteTreasuryManagerFactory = new ReadWriteTreasuryManagerFactory(this.chainId, TreasuryManagerFactoryAddress[this.chainId], drift$1);
18699
+ this.readWritePermit2 = new ReadWritePermit2(Permit2Address[this.chainId], drift$1);
18687
18700
  }
18688
18701
  /**
18689
18702
  * Deploys a new revenue manager
@@ -18829,7 +18842,7 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
18829
18842
  sender: sender,
18830
18843
  memecoin: params.coinAddress,
18831
18844
  chainId: this.chainId,
18832
- referrer: params.referrer,
18845
+ referrer: params.referrer ?? null,
18833
18846
  swapType: params.swapType,
18834
18847
  amountIn: amountIn,
18835
18848
  amountOutMin: amountOutMin,
@@ -18874,7 +18887,7 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
18874
18887
  ethOutMin,
18875
18888
  permitSingle: params.permitSingle,
18876
18889
  signature: params.signature,
18877
- referrer: params.referrer,
18890
+ referrer: params.referrer ?? null,
18878
18891
  isV1Coin: isV1Coin,
18879
18892
  });
18880
18893
  return this.drift.write({