@flaunch/sdk 0.8.3-beta.5 → 0.8.3-beta.6
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/clients/TokenImporter.d.ts +13 -3
- package/dist/clients/TokenImporter.d.ts.map +1 -1
- package/dist/index.cjs.js +40 -19
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +40 -19
- 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 +18 -5
- package/dist/sdk/FlaunchSDK.d.ts.map +1 -1
- package/dist/types.d.ts +15 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -31,17 +31,27 @@ export declare class ReadTokenImporter {
|
|
|
31
31
|
export declare class ReadWriteTokenImporter extends ReadTokenImporter {
|
|
32
32
|
contract: ReadWriteContract<TokenImporterABI>;
|
|
33
33
|
constructor(chainId: number, address: Address, drift?: Drift<ReadWriteAdapter>);
|
|
34
|
-
initialize(
|
|
34
|
+
initialize(params: {
|
|
35
35
|
coinAddress: Address;
|
|
36
36
|
creatorFeeAllocationPercent: number;
|
|
37
37
|
initialMarketCapUSD: number;
|
|
38
38
|
verifier?: Verifier;
|
|
39
|
+
} | {
|
|
40
|
+
coinAddress: Address;
|
|
41
|
+
creatorFeeAllocationPercent: number;
|
|
42
|
+
initialPriceUSD: number;
|
|
43
|
+
verifier?: Verifier;
|
|
39
44
|
}): Promise<`0x${string}`>;
|
|
40
|
-
getInitializeParams(
|
|
41
|
-
|
|
45
|
+
getInitializeParams(params: {
|
|
46
|
+
coinAddress: Address;
|
|
42
47
|
creatorFeeAllocationPercent: number;
|
|
43
48
|
initialMarketCapUSD: number;
|
|
44
49
|
verifier?: Verifier;
|
|
50
|
+
} | {
|
|
51
|
+
coinAddress: Address;
|
|
52
|
+
creatorFeeAllocationPercent: number;
|
|
53
|
+
initialPriceUSD: number;
|
|
54
|
+
verifier?: Verifier;
|
|
45
55
|
}): Promise<{
|
|
46
56
|
_memecoin: `0x${string}`;
|
|
47
57
|
_creatorFeeAllocation: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenImporter.d.ts","sourceRoot":"","sources":["../../src/clients/TokenImporter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,KAAK,EAEV,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAGtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"TokenImporter.d.ts","sourceRoot":"","sources":["../../src/clients/TokenImporter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,KAAK,EAEV,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAGtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAUpC,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAC;AAEvD;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAgB,QAAQ,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAC;gBAE7C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,GAAE,KAAqB;IAS3E;;;;OAIG;IACG,cAAc,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC;QAC/C,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC;IAWF;;OAEG;IACH,eAAe,CAAC,QAAQ,EAAE,QAAQ;CAgBnC;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,iBAAiB;IACnD,QAAQ,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;gBAGpD,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,KAAK,GAAE,KAAK,CAAC,gBAAgB,CAAiB;IAK1C,UAAU,CACd,MAAM,EACF;QACE,WAAW,EAAE,OAAO,CAAC;QACrB,2BAA2B,EAAE,MAAM,CAAC;QACpC,mBAAmB,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAC;KACrB,GACD;QACE,WAAW,EAAE,OAAO,CAAC;QACrB,2BAA2B,EAAE,MAAM,CAAC;QACpC,eAAe,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,EAAE,QAAQ,CAAC;KACrB;IAQD,mBAAmB,CACvB,MAAM,EACF;QACE,WAAW,EAAE,OAAO,CAAC;QACrB,2BAA2B,EAAE,MAAM,CAAC;QACpC,mBAAmB,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAC;KACrB,GACD;QACE,WAAW,EAAE,OAAO,CAAC;QACrB,2BAA2B,EAAE,MAAM,CAAC;QACpC,eAAe,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,EAAE,QAAQ,CAAC;KACrB;;;;;;CAiCR"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -19384,25 +19384,31 @@ class ReadWriteTokenImporter extends ReadTokenImporter {
|
|
|
19384
19384
|
constructor(chainId, address, drift$1 = drift.createDrift()) {
|
|
19385
19385
|
super(chainId, address, drift$1);
|
|
19386
19386
|
}
|
|
19387
|
-
async initialize(
|
|
19388
|
-
return this.contract.write("initialize", await this.getInitializeParams(
|
|
19389
|
-
memecoin: coinAddress,
|
|
19390
|
-
creatorFeeAllocationPercent,
|
|
19391
|
-
initialMarketCapUSD,
|
|
19392
|
-
verifier,
|
|
19393
|
-
}));
|
|
19387
|
+
async initialize(params) {
|
|
19388
|
+
return this.contract.write("initialize", await this.getInitializeParams(params));
|
|
19394
19389
|
}
|
|
19395
|
-
async getInitializeParams(
|
|
19390
|
+
async getInitializeParams(params) {
|
|
19391
|
+
let initialMarketCapUSD;
|
|
19392
|
+
if ("initialMarketCapUSD" in params) {
|
|
19393
|
+
initialMarketCapUSD = params.initialMarketCapUSD;
|
|
19394
|
+
}
|
|
19395
|
+
else {
|
|
19396
|
+
const memecoin = new ReadMemecoin(params.coinAddress, this.drift);
|
|
19397
|
+
const totalSupply = await memecoin.totalSupply();
|
|
19398
|
+
const decimals = await memecoin.decimals();
|
|
19399
|
+
const formattedTotalSupply = parseFloat(viem.formatUnits(totalSupply, decimals));
|
|
19400
|
+
initialMarketCapUSD = params.initialPriceUSD * formattedTotalSupply;
|
|
19401
|
+
}
|
|
19396
19402
|
const initialMCapInUSDCWei = viem.parseUnits(initialMarketCapUSD.toString(), 6);
|
|
19397
|
-
const creatorFeeAllocationInBps = creatorFeeAllocationPercent * 100;
|
|
19403
|
+
const creatorFeeAllocationInBps = params.creatorFeeAllocationPercent * 100;
|
|
19398
19404
|
// Passing in the verifier here, as drift doesn't recognize the other initialize function without the verifier param
|
|
19399
|
-
let _verifier = verifier
|
|
19400
|
-
? this.verifierAddress(verifier)
|
|
19405
|
+
let _verifier = params.verifier
|
|
19406
|
+
? this.verifierAddress(params.verifier)
|
|
19401
19407
|
: await this.contract.read("verifyMemecoin", {
|
|
19402
|
-
_memecoin:
|
|
19408
|
+
_memecoin: params.coinAddress,
|
|
19403
19409
|
});
|
|
19404
19410
|
return {
|
|
19405
|
-
_memecoin:
|
|
19411
|
+
_memecoin: params.coinAddress,
|
|
19406
19412
|
_creatorFeeAllocation: creatorFeeAllocationInBps,
|
|
19407
19413
|
_initialMarketCap: initialMCapInUSDCWei,
|
|
19408
19414
|
_verifier,
|
|
@@ -26106,16 +26112,31 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
26106
26112
|
}
|
|
26107
26113
|
else {
|
|
26108
26114
|
// Calculate the amounts
|
|
26115
|
+
let minMarketCap;
|
|
26116
|
+
let maxMarketCap;
|
|
26117
|
+
let initialMarketCapUSD;
|
|
26118
|
+
if ("minMarketCap" in params) {
|
|
26119
|
+
minMarketCap = params.minMarketCap;
|
|
26120
|
+
maxMarketCap = params.maxMarketCap;
|
|
26121
|
+
initialMarketCapUSD = params.initialMarketCapUSD;
|
|
26122
|
+
}
|
|
26123
|
+
else {
|
|
26124
|
+
const { totalSupply, decimals } = await this.getCoinInfo(coinAddress);
|
|
26125
|
+
const formattedTotalSupply = parseFloat(viem.formatUnits(totalSupply, decimals));
|
|
26126
|
+
minMarketCap = (parseFloat(params.minPriceUSD) * formattedTotalSupply).toString();
|
|
26127
|
+
maxMarketCap = (parseFloat(params.maxPriceUSD) * formattedTotalSupply).toString();
|
|
26128
|
+
if (params.initialPriceUSD) {
|
|
26129
|
+
initialMarketCapUSD = params.initialPriceUSD * formattedTotalSupply;
|
|
26130
|
+
}
|
|
26131
|
+
}
|
|
26109
26132
|
const calculated = await this.calculateAddLiquidityAmounts({
|
|
26110
26133
|
coinAddress,
|
|
26111
26134
|
liquidityMode: params.liquidityMode,
|
|
26112
26135
|
coinOrEthInputAmount: params.coinOrEthInputAmount,
|
|
26113
26136
|
inputToken: params.inputToken,
|
|
26114
|
-
minMarketCap
|
|
26115
|
-
maxMarketCap
|
|
26116
|
-
currentMarketCap:
|
|
26117
|
-
? params.initialMarketCapUSD.toString()
|
|
26118
|
-
: undefined,
|
|
26137
|
+
minMarketCap,
|
|
26138
|
+
maxMarketCap,
|
|
26139
|
+
currentMarketCap: initialMarketCapUSD?.toString(),
|
|
26119
26140
|
});
|
|
26120
26141
|
coinAmount = calculated.coinAmount;
|
|
26121
26142
|
flethAmount = calculated.ethAmount;
|
|
@@ -26424,7 +26445,7 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
26424
26445
|
*/
|
|
26425
26446
|
async getImportAndAddLiquidityCalls(params) {
|
|
26426
26447
|
const importParams = await this.readWriteTokenImporter.getInitializeParams({
|
|
26427
|
-
|
|
26448
|
+
coinAddress: params.coinAddress,
|
|
26428
26449
|
creatorFeeAllocationPercent: params.creatorFeeAllocationPercent,
|
|
26429
26450
|
initialMarketCapUSD: params.initialMarketCapUSD,
|
|
26430
26451
|
verifier: params.verifier,
|