@flaunch/sdk 0.9.0-beta.3 → 0.9.1
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 +631 -73
- package/dist/addresses/index.cjs +6 -6
- package/dist/addresses/index.js +6 -6
- package/dist/clients/TreasuryManagerFactoryClient.d.ts +4 -2
- package/dist/clients/TreasuryManagerFactoryClient.d.ts.map +1 -1
- package/dist/index.cjs.js +28 -28
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +29 -29
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/sdk/FlaunchSDK.d.ts +5 -4
- package/dist/sdk/FlaunchSDK.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/addresses/index.cjs
CHANGED
|
@@ -5372,16 +5372,16 @@ const TreasuryManagerFactoryAddress = {
|
|
|
5372
5372
|
[baseSepolia.id]: "0xD2F3C6185e06925dCBE794C6574315b2202E9CcD",
|
|
5373
5373
|
};
|
|
5374
5374
|
const RevenueManagerAddress = {
|
|
5375
|
-
[base.id]: "
|
|
5376
|
-
[baseSepolia.id]: "
|
|
5375
|
+
[base.id]: "0x4Fb9dE6bbe970A49C19fB967F937351728C01b8f",
|
|
5376
|
+
[baseSepolia.id]: "0x34077816CC8EAb21FF8E87FDC35b95F1602A2221",
|
|
5377
5377
|
};
|
|
5378
5378
|
const AddressFeeSplitManagerAddress = {
|
|
5379
|
-
[base.id]: "
|
|
5380
|
-
[baseSepolia.id]: "
|
|
5379
|
+
[base.id]: "0xC3F4E72DE4D37988F12C101b0766Fd8462F6Faf9",
|
|
5380
|
+
[baseSepolia.id]: "0x487583E8543ac9D68f11824ED611645Ca088c07F",
|
|
5381
5381
|
};
|
|
5382
5382
|
const StakingManagerAddress = {
|
|
5383
|
-
[base.id]: "
|
|
5384
|
-
[baseSepolia.id]: "
|
|
5383
|
+
[base.id]: "0x3C3BC8e63DF9CCd5cdaa01F6833B2e4dCdB40bF0",
|
|
5384
|
+
[baseSepolia.id]: "0x9ebBe3f8b72494aB00144a8844dbeA8B8817c323",
|
|
5385
5385
|
};
|
|
5386
5386
|
/** Verifiers */
|
|
5387
5387
|
const TokenImporterAddress = {
|
package/dist/addresses/index.js
CHANGED
|
@@ -5368,16 +5368,16 @@ const TreasuryManagerFactoryAddress = {
|
|
|
5368
5368
|
[baseSepolia.id]: "0xD2F3C6185e06925dCBE794C6574315b2202E9CcD",
|
|
5369
5369
|
};
|
|
5370
5370
|
const RevenueManagerAddress = {
|
|
5371
|
-
[base.id]: "
|
|
5372
|
-
[baseSepolia.id]: "
|
|
5371
|
+
[base.id]: "0x4Fb9dE6bbe970A49C19fB967F937351728C01b8f",
|
|
5372
|
+
[baseSepolia.id]: "0x34077816CC8EAb21FF8E87FDC35b95F1602A2221",
|
|
5373
5373
|
};
|
|
5374
5374
|
const AddressFeeSplitManagerAddress = {
|
|
5375
|
-
[base.id]: "
|
|
5376
|
-
[baseSepolia.id]: "
|
|
5375
|
+
[base.id]: "0xC3F4E72DE4D37988F12C101b0766Fd8462F6Faf9",
|
|
5376
|
+
[baseSepolia.id]: "0x487583E8543ac9D68f11824ED611645Ca088c07F",
|
|
5377
5377
|
};
|
|
5378
5378
|
const StakingManagerAddress = {
|
|
5379
|
-
[base.id]: "
|
|
5380
|
-
[baseSepolia.id]: "
|
|
5379
|
+
[base.id]: "0x3C3BC8e63DF9CCd5cdaa01F6833B2e4dCdB40bF0",
|
|
5380
|
+
[baseSepolia.id]: "0x9ebBe3f8b72494aB00144a8844dbeA8B8817c323",
|
|
5381
5381
|
};
|
|
5382
5382
|
/** Verifiers */
|
|
5383
5383
|
const TokenImporterAddress = {
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { type ReadContract, type Address, type Drift, type ReadWriteContract, type HexString } from "@delvtech/drift";
|
|
2
|
+
import { type PublicClient } from "viem";
|
|
2
3
|
import { TreasuryManagerFactoryAbi } from "../abi/TreasuryManagerFactory";
|
|
3
4
|
export type TreasuryManagerFactoryABI = typeof TreasuryManagerFactoryAbi;
|
|
4
5
|
export declare class ReadTreasuryManagerFactory {
|
|
5
6
|
chainId: number;
|
|
6
7
|
readonly contract: ReadContract<TreasuryManagerFactoryABI>;
|
|
7
|
-
|
|
8
|
+
readonly publicClient: PublicClient | undefined;
|
|
9
|
+
constructor(chainId: number, address: Address, drift?: Drift, publicClient?: PublicClient);
|
|
8
10
|
getManagerDeployedAddressFromTx(hash: HexString): Promise<`0x${string}`>;
|
|
9
11
|
}
|
|
10
12
|
export declare class ReadWriteTreasuryManagerFactory extends ReadTreasuryManagerFactory {
|
|
11
13
|
contract: ReadWriteContract<TreasuryManagerFactoryABI>;
|
|
12
|
-
constructor(chainId: number, address: Address, drift?: Drift);
|
|
14
|
+
constructor(chainId: number, address: Address, drift?: Drift, publicClient?: PublicClient);
|
|
13
15
|
}
|
|
14
16
|
//# sourceMappingURL=TreasuryManagerFactoryClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreasuryManagerFactoryClient.d.ts","sourceRoot":"","sources":["../../src/clients/TreasuryManagerFactoryClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,KAAK,EAEV,KAAK,iBAAiB,EAEtB,KAAK,SAAS,EAEf,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"TreasuryManagerFactoryClient.d.ts","sourceRoot":"","sources":["../../src/clients/TreasuryManagerFactoryClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,KAAK,EAEV,KAAK,iBAAiB,EAEtB,KAAK,SAAS,EAEf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,KAAK,YAAY,EAIlB,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAG1E,MAAM,MAAM,yBAAyB,GAAG,OAAO,yBAAyB,CAAC;AAEzE,qBAAa,0BAA0B;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAgB,QAAQ,EAAE,YAAY,CAAC,yBAAyB,CAAC,CAAC;IAClE,SAAgB,YAAY,EAAE,YAAY,GAAG,SAAS,CAAC;gBAGrD,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,KAAK,GAAE,KAAqB,EAC5B,YAAY,CAAC,EAAE,YAAY;IAavB,+BAA+B,CAAC,IAAI,EAAE,SAAS;CAyBtD;AAED,qBAAa,+BAAgC,SAAQ,0BAA0B;IACrE,QAAQ,EAAE,iBAAiB,CAAC,yBAAyB,CAAC,CAAC;gBAG7D,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,KAAK,GAAE,KAAqB,EAC5B,YAAY,CAAC,EAAE,YAAY;CAI9B"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -5750,16 +5750,16 @@ const TreasuryManagerFactoryAddress = {
|
|
|
5750
5750
|
[baseSepolia.id]: "0xD2F3C6185e06925dCBE794C6574315b2202E9CcD",
|
|
5751
5751
|
};
|
|
5752
5752
|
const RevenueManagerAddress = {
|
|
5753
|
-
[base.id]: "
|
|
5754
|
-
[baseSepolia.id]: "
|
|
5753
|
+
[base.id]: "0x4Fb9dE6bbe970A49C19fB967F937351728C01b8f",
|
|
5754
|
+
[baseSepolia.id]: "0x34077816CC8EAb21FF8E87FDC35b95F1602A2221",
|
|
5755
5755
|
};
|
|
5756
5756
|
const AddressFeeSplitManagerAddress = {
|
|
5757
|
-
[base.id]: "
|
|
5758
|
-
[baseSepolia.id]: "
|
|
5757
|
+
[base.id]: "0xC3F4E72DE4D37988F12C101b0766Fd8462F6Faf9",
|
|
5758
|
+
[baseSepolia.id]: "0x487583E8543ac9D68f11824ED611645Ca088c07F",
|
|
5759
5759
|
};
|
|
5760
5760
|
const StakingManagerAddress = {
|
|
5761
|
-
[base.id]: "
|
|
5762
|
-
[baseSepolia.id]: "
|
|
5761
|
+
[base.id]: "0x3C3BC8e63DF9CCd5cdaa01F6833B2e4dCdB40bF0",
|
|
5762
|
+
[baseSepolia.id]: "0x9ebBe3f8b72494aB00144a8844dbeA8B8817c323",
|
|
5763
5763
|
};
|
|
5764
5764
|
/** Verifiers */
|
|
5765
5765
|
const TokenImporterAddress = {
|
|
@@ -23884,13 +23884,8 @@ const TreasuryManagerFactoryAbi = [
|
|
|
23884
23884
|
{ type: "error", name: "UnknownManagerImplemention", inputs: [] },
|
|
23885
23885
|
];
|
|
23886
23886
|
|
|
23887
|
-
const chainIdToChain = {
|
|
23888
|
-
[base.id]: base,
|
|
23889
|
-
[baseSepolia.id]: baseSepolia,
|
|
23890
|
-
};
|
|
23891
|
-
|
|
23892
23887
|
class ReadTreasuryManagerFactory {
|
|
23893
|
-
constructor(chainId, address, drift$1 = drift.createDrift()) {
|
|
23888
|
+
constructor(chainId, address, drift$1 = drift.createDrift(), publicClient) {
|
|
23894
23889
|
if (!address) {
|
|
23895
23890
|
throw new Error("Address is required");
|
|
23896
23891
|
}
|
|
@@ -23899,15 +23894,14 @@ class ReadTreasuryManagerFactory {
|
|
|
23899
23894
|
address,
|
|
23900
23895
|
});
|
|
23901
23896
|
this.chainId = chainId;
|
|
23897
|
+
this.publicClient = publicClient;
|
|
23902
23898
|
}
|
|
23903
23899
|
async getManagerDeployedAddressFromTx(hash) {
|
|
23904
|
-
// Create a public client to get the transaction receipt with logs
|
|
23905
|
-
const publicClient = viem.createPublicClient({
|
|
23906
|
-
chain: chainIdToChain[this.chainId],
|
|
23907
|
-
transport: viem.http(),
|
|
23908
|
-
});
|
|
23909
23900
|
// Wait for transaction receipt
|
|
23910
|
-
|
|
23901
|
+
if (!this.publicClient) {
|
|
23902
|
+
throw new Error("Public client is required");
|
|
23903
|
+
}
|
|
23904
|
+
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
23911
23905
|
// Parse the ManagerDeployed event from receipt logs
|
|
23912
23906
|
const parsedLogs = viem.parseEventLogs({
|
|
23913
23907
|
abi: TreasuryManagerFactoryAbi,
|
|
@@ -23923,8 +23917,8 @@ class ReadTreasuryManagerFactory {
|
|
|
23923
23917
|
}
|
|
23924
23918
|
}
|
|
23925
23919
|
class ReadWriteTreasuryManagerFactory extends ReadTreasuryManagerFactory {
|
|
23926
|
-
constructor(chainId, address, drift$1 = drift.createDrift()) {
|
|
23927
|
-
super(chainId, address, drift$1);
|
|
23920
|
+
constructor(chainId, address, drift$1 = drift.createDrift(), publicClient) {
|
|
23921
|
+
super(chainId, address, drift$1, publicClient);
|
|
23928
23922
|
}
|
|
23929
23923
|
}
|
|
23930
23924
|
|
|
@@ -25522,6 +25516,11 @@ const getAmountsForLiquidity = (params) => {
|
|
|
25522
25516
|
return { amount0, amount1 };
|
|
25523
25517
|
};
|
|
25524
25518
|
|
|
25519
|
+
const chainIdToChain = {
|
|
25520
|
+
[base.id]: base,
|
|
25521
|
+
[baseSepolia.id]: baseSepolia,
|
|
25522
|
+
};
|
|
25523
|
+
|
|
25525
25524
|
const FastFlaunchZapAbi = [
|
|
25526
25525
|
{
|
|
25527
25526
|
inputs: [
|
|
@@ -26055,10 +26054,11 @@ class ReadTrustedSignerFeeCalculator {
|
|
|
26055
26054
|
* Base class for interacting with Flaunch protocol in read-only mode
|
|
26056
26055
|
*/
|
|
26057
26056
|
class ReadFlaunchSDK {
|
|
26058
|
-
constructor(chainId, drift$1 = drift.createDrift()) {
|
|
26057
|
+
constructor(chainId, drift$1 = drift.createDrift(), publicClient) {
|
|
26059
26058
|
this.TICK_SPACING = TICK_SPACING;
|
|
26060
26059
|
this.chainId = chainId;
|
|
26061
26060
|
this.drift = drift$1;
|
|
26061
|
+
this.publicClient = publicClient;
|
|
26062
26062
|
this.resolveIPFS = resolveIPFS;
|
|
26063
26063
|
this.readPositionManager = new ReadFlaunchPositionManager(FlaunchPositionManagerAddress[this.chainId], drift$1);
|
|
26064
26064
|
this.readPositionManagerV1_1 = new ReadFlaunchPositionManagerV1_1(FlaunchPositionManagerV1_1Address[this.chainId], drift$1);
|
|
@@ -26420,13 +26420,13 @@ class ReadFlaunchSDK {
|
|
|
26420
26420
|
* Calculates the coin price in USD based on the current ETH/USDC price
|
|
26421
26421
|
* @param coinAddress - The address of the coin
|
|
26422
26422
|
* @param version - Optional specific version to use. If not provided, will be determined automatically
|
|
26423
|
-
* @returns Promise<string> - The price of the coin in USD with
|
|
26423
|
+
* @returns Promise<string> - The price of the coin in USD with 18 decimal precision
|
|
26424
26424
|
*/
|
|
26425
26425
|
async coinPriceInUSD({ coinAddress, version, drift, }) {
|
|
26426
26426
|
const coinVersion = version || (await this.getCoinVersion(coinAddress));
|
|
26427
26427
|
const ethPerCoin = await this.coinPriceInETH(coinAddress, coinVersion);
|
|
26428
26428
|
const ethPrice = await this.getETHUSDCPrice(drift);
|
|
26429
|
-
return (parseFloat(ethPerCoin) * ethPrice).toFixed(
|
|
26429
|
+
return (parseFloat(ethPerCoin) * ethPrice).toFixed(18);
|
|
26430
26430
|
}
|
|
26431
26431
|
async coinMarketCapInUSD({ coinAddress, version, drift, }) {
|
|
26432
26432
|
const totalSupply = 100000000000; // 100 Billion tokens
|
|
@@ -27327,8 +27327,8 @@ class ReadFlaunchSDK {
|
|
|
27327
27327
|
}
|
|
27328
27328
|
}
|
|
27329
27329
|
class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
27330
|
-
constructor(chainId, drift$1 = drift.createDrift()) {
|
|
27331
|
-
super(chainId, drift$1);
|
|
27330
|
+
constructor(chainId, drift$1 = drift.createDrift(), publicClient) {
|
|
27331
|
+
super(chainId, drift$1, publicClient);
|
|
27332
27332
|
this.readWritePositionManager = new ReadWriteFlaunchPositionManager(FlaunchPositionManagerAddress[this.chainId], drift$1);
|
|
27333
27333
|
this.readWritePositionManagerV1_1 = new ReadWriteFlaunchPositionManagerV1_1(FlaunchPositionManagerV1_1Address[this.chainId], drift$1);
|
|
27334
27334
|
this.readWriteAnyPositionManager = new ReadWriteAnyPositionManager(AnyPositionManagerAddress[this.chainId], drift$1);
|
|
@@ -27336,7 +27336,7 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
27336
27336
|
this.readWriteFeeEscrow = new ReadWriteFeeEscrow(FeeEscrowAddress[this.chainId], drift$1);
|
|
27337
27337
|
this.readWriteReferralEscrow = new ReadWriteReferralEscrow(ReferralEscrowAddress[this.chainId], drift$1);
|
|
27338
27338
|
this.readWriteFlaunchZap = new ReadWriteFlaunchZap(this.chainId, FlaunchZapAddress[this.chainId], drift$1);
|
|
27339
|
-
this.readWriteTreasuryManagerFactory = new ReadWriteTreasuryManagerFactory(this.chainId, TreasuryManagerFactoryAddress[this.chainId], drift$1);
|
|
27339
|
+
this.readWriteTreasuryManagerFactory = new ReadWriteTreasuryManagerFactory(this.chainId, TreasuryManagerFactoryAddress[this.chainId], drift$1, this.publicClient);
|
|
27340
27340
|
this.readWritePermit2 = new ReadWritePermit2(Permit2Address[this.chainId], drift$1);
|
|
27341
27341
|
}
|
|
27342
27342
|
/**
|
|
@@ -28180,8 +28180,8 @@ function createFlaunch(params) {
|
|
|
28180
28180
|
const chainId = publicClient.chain.id;
|
|
28181
28181
|
// Return appropriate SDK type based on whether walletClient is provided
|
|
28182
28182
|
return walletClient
|
|
28183
|
-
? new ReadWriteFlaunchSDK(chainId, createDrift({ publicClient, walletClient }))
|
|
28184
|
-
: new ReadFlaunchSDK(chainId, createDrift({ publicClient }));
|
|
28183
|
+
? new ReadWriteFlaunchSDK(chainId, createDrift({ publicClient, walletClient }), publicClient)
|
|
28184
|
+
: new ReadFlaunchSDK(chainId, createDrift({ publicClient }), publicClient);
|
|
28185
28185
|
}
|
|
28186
28186
|
|
|
28187
28187
|
// ABI for encoding the call data
|