@flaunch/sdk 0.5.1 → 0.7.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/README.md +25 -41
- package/dist/addresses/index.cjs +2 -3
- package/dist/addresses/index.cjs.map +1 -1
- package/dist/addresses/index.js +2 -3
- package/dist/addresses/index.js.map +1 -1
- package/dist/clients/FlaunchPositionManagerClient.d.ts.map +1 -1
- package/dist/clients/FlaunchPositionManagerV1_1Client.d.ts.map +1 -1
- package/dist/clients/Permit2Client.d.ts +16 -1
- package/dist/clients/Permit2Client.d.ts.map +1 -1
- package/dist/helpers/index.cjs +6 -7
- package/dist/helpers/index.cjs.map +1 -1
- package/dist/helpers/index.js +6 -7
- package/dist/helpers/index.js.map +1 -1
- package/dist/index.cjs.js +62 -25
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +62 -26
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/sdk/FlaunchSDK.d.ts +7 -6
- package/dist/sdk/FlaunchSDK.d.ts.map +1 -1
- package/dist/sdk/factory.d.ts +21 -0
- package/dist/sdk/factory.d.ts.map +1 -0
- package/dist/utils/univ4.d.ts +1 -1
- package/package.json +6 -7
package/dist/index.cjs.js
CHANGED
|
@@ -6,6 +6,7 @@ var drift = require('@delvtech/drift');
|
|
|
6
6
|
var viem = require('viem');
|
|
7
7
|
var axios = require('axios');
|
|
8
8
|
var v3Sdk = require('@uniswap/v3-sdk');
|
|
9
|
+
var driftViem = require('@delvtech/drift-viem');
|
|
9
10
|
|
|
10
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
12
|
|
|
@@ -20,7 +21,7 @@ function defineChain(chain) {
|
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
const version = '2.
|
|
24
|
+
const version = '2.29.2';
|
|
24
25
|
|
|
25
26
|
let errorConfig = {
|
|
26
27
|
getDocsUrl: ({ docsBaseUrl, docsPath = '', docsSlug, }) => docsPath
|
|
@@ -3252,7 +3253,6 @@ const formatters = {
|
|
|
3252
3253
|
});
|
|
3253
3254
|
return {
|
|
3254
3255
|
transactions,
|
|
3255
|
-
...(args.randomness ? { randomness: args.randomness } : {}),
|
|
3256
3256
|
};
|
|
3257
3257
|
},
|
|
3258
3258
|
}),
|
|
@@ -5155,7 +5155,7 @@ const sourceId$3 = 11_155_111; // sepolia
|
|
|
5155
5155
|
},
|
|
5156
5156
|
disputeGameFactory: {
|
|
5157
5157
|
[sourceId$3]: {
|
|
5158
|
-
address: '
|
|
5158
|
+
address: '0x8Ec1111f67Dad6b6A93B3F42DfBC92D81c98449A',
|
|
5159
5159
|
},
|
|
5160
5160
|
},
|
|
5161
5161
|
l2OutputOracle: {
|
|
@@ -7094,11 +7094,11 @@ const generateTokenUri = async (name, params) => {
|
|
|
7094
7094
|
name,
|
|
7095
7095
|
description: params.metadata.description,
|
|
7096
7096
|
image: `ipfs://${imageRes.IpfsHash}`,
|
|
7097
|
-
external_link: params.metadata.websiteUrl,
|
|
7097
|
+
external_link: params.metadata.websiteUrl || "",
|
|
7098
7098
|
collaborators: [],
|
|
7099
|
-
discordUrl: params.metadata.discordUrl,
|
|
7100
|
-
twitterUrl: params.metadata.twitterUrl,
|
|
7101
|
-
telegramUrl: params.metadata.telegramUrl,
|
|
7099
|
+
discordUrl: params.metadata.discordUrl || "",
|
|
7100
|
+
twitterUrl: params.metadata.twitterUrl || "",
|
|
7101
|
+
telegramUrl: params.metadata.telegramUrl || "",
|
|
7102
7102
|
};
|
|
7103
7103
|
const metadataRes = await uploadJsonToIPFS({
|
|
7104
7104
|
pinataConfig: params.pinataConfig,
|
|
@@ -8019,9 +8019,7 @@ class ReadFlaunchPositionManager {
|
|
|
8019
8019
|
});
|
|
8020
8020
|
// Get timestamps for each log
|
|
8021
8021
|
const logsWithTimestamps = await Promise.all([..._logs].reverse().map(async (log) => {
|
|
8022
|
-
const block = await this.drift.getBlock(
|
|
8023
|
-
blockNumber: log.blockNumber,
|
|
8024
|
-
});
|
|
8022
|
+
const block = await this.drift.getBlock(log.blockNumber);
|
|
8025
8023
|
return {
|
|
8026
8024
|
...log,
|
|
8027
8025
|
timestamp: Number(block?.timestamp) * 1000, // convert to ms for js
|
|
@@ -8084,9 +8082,7 @@ class ReadFlaunchPositionManager {
|
|
|
8084
8082
|
});
|
|
8085
8083
|
// Get timestamps for each log
|
|
8086
8084
|
const logsWithTimestamps = await Promise.all([..._logs].reverse().map(async (log) => {
|
|
8087
|
-
const block = await this.drift.getBlock(
|
|
8088
|
-
blockNumber: log.blockNumber,
|
|
8089
|
-
});
|
|
8085
|
+
const block = await this.drift.getBlock(log.blockNumber);
|
|
8090
8086
|
const timestamp = Number(block?.timestamp) * 1000; // convert to ms for js
|
|
8091
8087
|
if (flETHIsCurrencyZero === undefined) {
|
|
8092
8088
|
return {
|
|
@@ -11953,9 +11949,7 @@ class ReadFlaunchPositionManagerV1_1 {
|
|
|
11953
11949
|
});
|
|
11954
11950
|
// Get timestamps for each log
|
|
11955
11951
|
const logsWithTimestamps = await Promise.all([..._logs].reverse().map(async (log) => {
|
|
11956
|
-
const block = await this.drift.getBlock(
|
|
11957
|
-
blockNumber: log.blockNumber,
|
|
11958
|
-
});
|
|
11952
|
+
const block = await this.drift.getBlock(log.blockNumber);
|
|
11959
11953
|
return {
|
|
11960
11954
|
...log,
|
|
11961
11955
|
timestamp: Number(block?.timestamp) * 1000, // convert to ms for js
|
|
@@ -12018,9 +12012,7 @@ class ReadFlaunchPositionManagerV1_1 {
|
|
|
12018
12012
|
});
|
|
12019
12013
|
// Get timestamps for each log
|
|
12020
12014
|
const logsWithTimestamps = await Promise.all([..._logs].reverse().map(async (log) => {
|
|
12021
|
-
const block = await this.drift.getBlock(
|
|
12022
|
-
blockNumber: log.blockNumber,
|
|
12023
|
-
});
|
|
12015
|
+
const block = await this.drift.getBlock(log.blockNumber);
|
|
12024
12016
|
const timestamp = Number(block?.timestamp) * 1000; // convert to ms for js
|
|
12025
12017
|
if (flETHIsCurrencyZero === undefined) {
|
|
12026
12018
|
return {
|
|
@@ -12146,8 +12138,12 @@ class ReadWriteFlaunchPositionManagerV1_1 extends ReadFlaunchPositionManagerV1_1
|
|
|
12146
12138
|
], [initialMCapInUSDCWei]);
|
|
12147
12139
|
const fairLaunchInBps = BigInt(fairLaunchPercent * 100);
|
|
12148
12140
|
const creatorFeeAllocationInBps = creatorFeeAllocationPercent * 100;
|
|
12141
|
+
let sender = viem.zeroAddress;
|
|
12142
|
+
if (this.drift.adapter.getSignerAddress) {
|
|
12143
|
+
sender = await this.drift.adapter.getSignerAddress();
|
|
12144
|
+
}
|
|
12149
12145
|
const flaunchingFee = await this.getFlaunchingFee({
|
|
12150
|
-
sender
|
|
12146
|
+
sender,
|
|
12151
12147
|
initialPriceParams,
|
|
12152
12148
|
slippagePercent: 5,
|
|
12153
12149
|
});
|
|
@@ -13569,7 +13565,7 @@ class ReadMemecoin {
|
|
|
13569
13565
|
* @returns Promise<string> - The name of the token
|
|
13570
13566
|
*/
|
|
13571
13567
|
name() {
|
|
13572
|
-
return this.contract.read("name");
|
|
13568
|
+
return this.contract.read("name", {});
|
|
13573
13569
|
}
|
|
13574
13570
|
/**
|
|
13575
13571
|
* Gets the symbol of the token
|
|
@@ -14644,6 +14640,19 @@ class ReadPermit2 {
|
|
|
14644
14640
|
});
|
|
14645
14641
|
}
|
|
14646
14642
|
}
|
|
14643
|
+
class ReadWritePermit2 extends ReadPermit2 {
|
|
14644
|
+
constructor(address, drift$1 = drift.createDrift()) {
|
|
14645
|
+
super(address, drift$1);
|
|
14646
|
+
}
|
|
14647
|
+
/**
|
|
14648
|
+
* Approves a spender to spend a token via transaction
|
|
14649
|
+
* @param params - The parameters for the approval
|
|
14650
|
+
* @returns The transaction response
|
|
14651
|
+
*/
|
|
14652
|
+
approve(params) {
|
|
14653
|
+
return this.contract.write("approve", params);
|
|
14654
|
+
}
|
|
14655
|
+
}
|
|
14647
14656
|
|
|
14648
14657
|
const BidWallV1_1Abi = [
|
|
14649
14658
|
{
|
|
@@ -18216,7 +18225,9 @@ class ReadFlaunchSDK {
|
|
|
18216
18225
|
filterByPoolId: params.filterByCoin
|
|
18217
18226
|
? await this.poolId(params.filterByCoin, true)
|
|
18218
18227
|
: undefined,
|
|
18219
|
-
flETHIsCurrencyZero:
|
|
18228
|
+
flETHIsCurrencyZero: params.filterByCoin
|
|
18229
|
+
? this.flETHIsCurrencyZero(params.filterByCoin)
|
|
18230
|
+
: undefined,
|
|
18220
18231
|
});
|
|
18221
18232
|
}
|
|
18222
18233
|
/**
|
|
@@ -18230,7 +18241,9 @@ class ReadFlaunchSDK {
|
|
|
18230
18241
|
filterByPoolId: params.filterByCoin
|
|
18231
18242
|
? await this.poolId(params.filterByCoin)
|
|
18232
18243
|
: undefined,
|
|
18233
|
-
flETHIsCurrencyZero:
|
|
18244
|
+
flETHIsCurrencyZero: params.filterByCoin
|
|
18245
|
+
? this.flETHIsCurrencyZero(params.filterByCoin)
|
|
18246
|
+
: undefined,
|
|
18234
18247
|
});
|
|
18235
18248
|
}
|
|
18236
18249
|
/**
|
|
@@ -18684,6 +18697,7 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
18684
18697
|
this.readWriteFastFlaunchZap = new ReadWriteFastFlaunchZap(FastFlaunchZapAddress[this.chainId], drift$1);
|
|
18685
18698
|
this.readWriteFlaunchZap = new ReadWriteFlaunchZap(this.chainId, FlaunchZapAddress[this.chainId], drift$1);
|
|
18686
18699
|
this.readWriteTreasuryManagerFactory = new ReadWriteTreasuryManagerFactory(this.chainId, TreasuryManagerFactoryAddress[this.chainId], drift$1);
|
|
18700
|
+
this.readWritePermit2 = new ReadWritePermit2(Permit2Address[this.chainId], drift$1);
|
|
18687
18701
|
}
|
|
18688
18702
|
/**
|
|
18689
18703
|
* Deploys a new revenue manager
|
|
@@ -18829,7 +18843,7 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
18829
18843
|
sender: sender,
|
|
18830
18844
|
memecoin: params.coinAddress,
|
|
18831
18845
|
chainId: this.chainId,
|
|
18832
|
-
referrer: params.referrer,
|
|
18846
|
+
referrer: params.referrer ?? null,
|
|
18833
18847
|
swapType: params.swapType,
|
|
18834
18848
|
amountIn: amountIn,
|
|
18835
18849
|
amountOutMin: amountOutMin,
|
|
@@ -18874,7 +18888,7 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
18874
18888
|
ethOutMin,
|
|
18875
18889
|
permitSingle: params.permitSingle,
|
|
18876
18890
|
signature: params.signature,
|
|
18877
|
-
referrer: params.referrer,
|
|
18891
|
+
referrer: params.referrer ?? null,
|
|
18878
18892
|
isV1Coin: isV1Coin,
|
|
18879
18893
|
});
|
|
18880
18894
|
return this.drift.write({
|
|
@@ -18945,6 +18959,28 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
18945
18959
|
}
|
|
18946
18960
|
}
|
|
18947
18961
|
|
|
18962
|
+
/**
|
|
18963
|
+
* Creates a Flaunch SDK instance with the provided clients
|
|
18964
|
+
* @param params - Parameters for creating the SDK
|
|
18965
|
+
* @returns ReadFlaunchSDK if only publicClient is provided, ReadWriteFlaunchSDK if walletClient is also provided
|
|
18966
|
+
* @throws Error if publicClient.chain is not configured
|
|
18967
|
+
*/
|
|
18968
|
+
function createFlaunch(params) {
|
|
18969
|
+
const { publicClient, walletClient } = params;
|
|
18970
|
+
if (!publicClient.chain) {
|
|
18971
|
+
throw new Error("publicClient must be configured with a chain");
|
|
18972
|
+
}
|
|
18973
|
+
const chainId = publicClient.chain.id;
|
|
18974
|
+
// Return appropriate SDK type based on whether walletClient is provided
|
|
18975
|
+
return walletClient
|
|
18976
|
+
? new ReadWriteFlaunchSDK(chainId, drift.createDrift({
|
|
18977
|
+
adapter: driftViem.viemAdapter({ publicClient, walletClient }),
|
|
18978
|
+
}))
|
|
18979
|
+
: new ReadFlaunchSDK(chainId, drift.createDrift({
|
|
18980
|
+
adapter: driftViem.viemAdapter({ publicClient }),
|
|
18981
|
+
}));
|
|
18982
|
+
}
|
|
18983
|
+
|
|
18948
18984
|
const FlaunchSDK = {
|
|
18949
18985
|
ReadFlaunchSDK,
|
|
18950
18986
|
ReadWriteFlaunchSDK,
|
|
@@ -18983,6 +19019,7 @@ exports.UniversalRouterAddress = UniversalRouterAddress;
|
|
|
18983
19019
|
exports.bytes32ToUint256 = bytes32ToUint256;
|
|
18984
19020
|
exports.calculateUnderlyingTokenBalances = calculateUnderlyingTokenBalances;
|
|
18985
19021
|
exports.chainIdToChain = chainIdToChain;
|
|
19022
|
+
exports.createFlaunch = createFlaunch;
|
|
18986
19023
|
exports.generateTokenUri = generateTokenUri;
|
|
18987
19024
|
exports.getPoolId = getPoolId;
|
|
18988
19025
|
exports.getSqrtPriceX96FromTick = getSqrtPriceX96FromTick;
|