@flaunch/sdk 0.8.0 → 0.8.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/dist/abi/AnyBidWall.d.ts +740 -0
- package/dist/abi/AnyBidWall.d.ts.map +1 -0
- package/dist/abi/AnyPositionManager.d.ts +27 -27
- package/dist/abi/index.cjs +25 -25
- package/dist/abi/index.cjs.map +1 -1
- package/dist/abi/index.js +25 -25
- package/dist/abi/index.js.map +1 -1
- package/dist/addresses/index.cjs +21 -3
- package/dist/addresses/index.cjs.map +1 -1
- package/dist/addresses/index.js +19 -4
- package/dist/addresses/index.js.map +1 -1
- package/dist/addresses.d.ts +3 -0
- package/dist/addresses.d.ts.map +1 -1
- package/dist/clients/AnyBidWall.d.ts +46 -0
- package/dist/clients/AnyBidWall.d.ts.map +1 -0
- package/dist/clients/AnyPositionManagerClient.d.ts +8 -0
- package/dist/clients/AnyPositionManagerClient.d.ts.map +1 -1
- package/dist/clients/FlaunchPositionManagerClient.d.ts +8 -0
- package/dist/clients/FlaunchPositionManagerClient.d.ts.map +1 -1
- package/dist/clients/FlaunchPositionManagerV1_1Client.d.ts +8 -0
- package/dist/clients/FlaunchPositionManagerV1_1Client.d.ts.map +1 -1
- package/dist/clients/FlaunchZapClient.d.ts +35 -0
- package/dist/clients/FlaunchZapClient.d.ts.map +1 -1
- package/dist/index.cjs.js +1062 -221
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1059 -222
- 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 +60 -2
- package/dist/sdk/FlaunchSDK.d.ts.map +1 -1
- package/dist/utils/parseSwap.d.ts +43 -0
- package/dist/utils/parseSwap.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -5317,8 +5317,9 @@ const FlaunchPositionManagerV1_1Address = {
|
|
|
5317
5317
|
[baseSepolia.id]: "0x24347e0dd16357059abfc1b321df354873552fdc",
|
|
5318
5318
|
};
|
|
5319
5319
|
const AnyPositionManagerAddress = {
|
|
5320
|
-
|
|
5321
|
-
[
|
|
5320
|
+
// TODO: update with actual address
|
|
5321
|
+
[base.id]: zeroAddress,
|
|
5322
|
+
[baseSepolia.id]: "0xB4A535B9D35851972736495CC52FBfDaCF32e5dc",
|
|
5322
5323
|
};
|
|
5323
5324
|
const FeeEscrowAddress = {
|
|
5324
5325
|
[base.id]: "0x72e6f7948b1B1A343B477F39aAbd2E35E6D27dde",
|
|
@@ -5326,7 +5327,7 @@ const FeeEscrowAddress = {
|
|
|
5326
5327
|
};
|
|
5327
5328
|
const ReferralEscrowAddress = {
|
|
5328
5329
|
[base.id]: "0xBD39c7Be6D98BD1a3e4Ad482baF99d738947fE55",
|
|
5329
|
-
[baseSepolia.id]: "
|
|
5330
|
+
[baseSepolia.id]: "0xd3d9047CaBE3346C70b510435866565176e8CE12",
|
|
5330
5331
|
};
|
|
5331
5332
|
const FLETHAddress = {
|
|
5332
5333
|
[base.id]: "0x000000000D564D5be76f7f0d28fE52605afC7Cf8",
|
|
@@ -5354,6 +5355,11 @@ const FlaunchV1_1Address = {
|
|
|
5354
5355
|
[base.id]: "0xb4512bf57d50fbcb64a3adf8b17a79b2a204c18c",
|
|
5355
5356
|
[baseSepolia.id]: "0x96be8ff5e244294a34bfa507a39190dc7a839baa",
|
|
5356
5357
|
};
|
|
5358
|
+
const AnyFlaunchAddress = {
|
|
5359
|
+
// FIXME: update with actual address
|
|
5360
|
+
[base.id]: zeroAddress,
|
|
5361
|
+
[baseSepolia.id]: "0x67Ee6C83956a75f67bD3Fc8Ca4080D95a145c7C9",
|
|
5362
|
+
};
|
|
5357
5363
|
const BidWallAddress = {
|
|
5358
5364
|
[base.id]: "0x66681f10BA90496241A25e33380004f30Dfd8aa8",
|
|
5359
5365
|
[baseSepolia.id]: "0xa2107050ACEf4809c88Ab744F8e667605db5ACDB",
|
|
@@ -5363,6 +5369,11 @@ const BidWallV1_1Address = {
|
|
|
5363
5369
|
[base.id]: "0x7f22353d1634223a802D1c1Ea5308Ddf5DD0ef9c",
|
|
5364
5370
|
[baseSepolia.id]: "0x6f2fa01a05ff8b6efbfefd91a3b85aaf19265a00",
|
|
5365
5371
|
};
|
|
5372
|
+
const AnyBidWallAddress = {
|
|
5373
|
+
// FIXME: update with actual address
|
|
5374
|
+
[base.id]: zeroAddress,
|
|
5375
|
+
[baseSepolia.id]: "0xcfF222eA42E43F46A98755db237E4c9C2CA9B772",
|
|
5376
|
+
};
|
|
5366
5377
|
const FastFlaunchZapAddress = {
|
|
5367
5378
|
[base.id]: "0x68d967d25806fef4aa134db031cdcc55d3e20f92",
|
|
5368
5379
|
[baseSepolia.id]: "0x821d9f6075e7971cc71c379081de9d532f5f9957",
|
|
@@ -5375,6 +5386,10 @@ const RevenueManagerAddress = {
|
|
|
5375
5386
|
[base.id]: "0x712fa8ddc7347b4b6b029aa21710f365cd02d898",
|
|
5376
5387
|
[baseSepolia.id]: "0x17E02501dE3e420347e7C5fCAe3AD787C5aea690",
|
|
5377
5388
|
};
|
|
5389
|
+
const AddressFeeSplitManagerAddress = {
|
|
5390
|
+
[base.id]: "0x6baa4ec493a9698dc7388c0f290e29ea3d149f99",
|
|
5391
|
+
[baseSepolia.id]: "0xf72dcdee692c188de6b14c6213e849982e04069b",
|
|
5392
|
+
};
|
|
5378
5393
|
const TreasuryManagerFactoryAddress = {
|
|
5379
5394
|
[base.id]: "0x48af8b28DDC5e5A86c4906212fc35Fa808CA8763",
|
|
5380
5395
|
[baseSepolia.id]: "0xd2f3c6185e06925dcbe794c6574315b2202e9ccd",
|
|
@@ -7675,6 +7690,72 @@ const getPermit2TypedData = ({ chainId, coinAddress, nonce, deadline, }) => {
|
|
|
7675
7690
|
};
|
|
7676
7691
|
};
|
|
7677
7692
|
|
|
7693
|
+
/**
|
|
7694
|
+
* Parses raw swap log arguments into structured swap data
|
|
7695
|
+
* @param args - The swap log arguments
|
|
7696
|
+
* @param flETHIsCurrencyZero - Whether flETH is currency 0 in the pool
|
|
7697
|
+
* @returns Parsed swap data with type and delta information
|
|
7698
|
+
*/
|
|
7699
|
+
function parseSwapData(args, flETHIsCurrencyZero) {
|
|
7700
|
+
const { flAmount0, flAmount1, flFee0, flFee1, ispAmount0, ispAmount1, ispFee0, ispFee1, uniAmount0, uniAmount1, uniFee0, uniFee1, } = args;
|
|
7701
|
+
const currency0Delta = flAmount0 + ispAmount0 + uniAmount0;
|
|
7702
|
+
const currency1Delta = flAmount1 + ispAmount1 + uniAmount1;
|
|
7703
|
+
const currency0Fees = flFee0 + ispFee0 + uniFee0;
|
|
7704
|
+
const currency1Fees = flFee1 + ispFee1 + uniFee1;
|
|
7705
|
+
let feesIsInFLETH;
|
|
7706
|
+
let swapType;
|
|
7707
|
+
if (flETHIsCurrencyZero) {
|
|
7708
|
+
swapType = currency0Delta < 0 ? "BUY" : "SELL";
|
|
7709
|
+
feesIsInFLETH = currency0Fees < 0;
|
|
7710
|
+
}
|
|
7711
|
+
else {
|
|
7712
|
+
swapType = currency1Delta < 0 ? "BUY" : "SELL";
|
|
7713
|
+
feesIsInFLETH = currency1Fees < 0;
|
|
7714
|
+
}
|
|
7715
|
+
const absCurrency0Delta = currency0Delta < 0 ? -currency0Delta : currency0Delta;
|
|
7716
|
+
const absCurrency1Delta = currency1Delta < 0 ? -currency1Delta : currency1Delta;
|
|
7717
|
+
const absCurrency0Fees = currency0Fees < 0 ? -currency0Fees : currency0Fees;
|
|
7718
|
+
const absCurrency1Fees = currency1Fees < 0 ? -currency1Fees : currency1Fees;
|
|
7719
|
+
const fees = {
|
|
7720
|
+
isInFLETH: feesIsInFLETH,
|
|
7721
|
+
amount: flETHIsCurrencyZero
|
|
7722
|
+
? feesIsInFLETH
|
|
7723
|
+
? absCurrency0Fees
|
|
7724
|
+
: absCurrency1Fees
|
|
7725
|
+
: feesIsInFLETH
|
|
7726
|
+
? absCurrency1Fees
|
|
7727
|
+
: absCurrency0Fees,
|
|
7728
|
+
};
|
|
7729
|
+
if (swapType === "BUY") {
|
|
7730
|
+
return {
|
|
7731
|
+
type: swapType,
|
|
7732
|
+
delta: {
|
|
7733
|
+
coinsBought: flETHIsCurrencyZero
|
|
7734
|
+
? absCurrency1Delta - (!fees.isInFLETH ? fees.amount : 0n)
|
|
7735
|
+
: absCurrency0Delta - (!fees.isInFLETH ? fees.amount : 0n),
|
|
7736
|
+
flETHSold: flETHIsCurrencyZero
|
|
7737
|
+
? absCurrency0Delta - (fees.isInFLETH ? fees.amount : 0n)
|
|
7738
|
+
: absCurrency1Delta - (fees.isInFLETH ? fees.amount : 0n),
|
|
7739
|
+
fees,
|
|
7740
|
+
},
|
|
7741
|
+
};
|
|
7742
|
+
}
|
|
7743
|
+
else {
|
|
7744
|
+
return {
|
|
7745
|
+
type: swapType,
|
|
7746
|
+
delta: {
|
|
7747
|
+
coinsSold: flETHIsCurrencyZero
|
|
7748
|
+
? absCurrency1Delta - (!fees.isInFLETH ? fees.amount : 0n)
|
|
7749
|
+
: absCurrency0Delta - (!fees.isInFLETH ? fees.amount : 0n),
|
|
7750
|
+
flETHBought: flETHIsCurrencyZero
|
|
7751
|
+
? absCurrency0Delta - (fees.isInFLETH ? fees.amount : 0n)
|
|
7752
|
+
: absCurrency1Delta - (fees.isInFLETH ? fees.amount : 0n),
|
|
7753
|
+
fees,
|
|
7754
|
+
},
|
|
7755
|
+
};
|
|
7756
|
+
}
|
|
7757
|
+
}
|
|
7758
|
+
|
|
7678
7759
|
const InitialPriceAbi = [
|
|
7679
7760
|
{
|
|
7680
7761
|
inputs: [
|
|
@@ -8076,6 +8157,53 @@ class ReadFlaunchPositionManager {
|
|
|
8076
8157
|
pollPoolCreatedNow: pollEvents,
|
|
8077
8158
|
};
|
|
8078
8159
|
}
|
|
8160
|
+
/**
|
|
8161
|
+
* Parses a transaction hash to extract PoolSwap events and return parsed swap data
|
|
8162
|
+
* @param txHash - The transaction hash to parse
|
|
8163
|
+
* @param flETHIsCurrencyZero - Whether flETH is currency 0 in the pool (optional)
|
|
8164
|
+
* @returns Parsed swap log or undefined if no PoolSwap event found
|
|
8165
|
+
*/
|
|
8166
|
+
async parseSwapTx(txHash, flETHIsCurrencyZero) {
|
|
8167
|
+
try {
|
|
8168
|
+
// Get transaction to get block number
|
|
8169
|
+
const tx = await this.drift.getTransaction({ hash: txHash });
|
|
8170
|
+
if (!tx) {
|
|
8171
|
+
return undefined;
|
|
8172
|
+
}
|
|
8173
|
+
// Get block to get timestamp
|
|
8174
|
+
const block = await this.drift.getBlock(tx.blockNumber);
|
|
8175
|
+
const timestamp = Number(block?.timestamp) * 1000; // convert to ms for js
|
|
8176
|
+
// Get PoolSwap events from the specific transaction
|
|
8177
|
+
const swapLogs = await this.contract.getEvents("PoolSwap", {
|
|
8178
|
+
fromBlock: tx.blockNumber,
|
|
8179
|
+
toBlock: tx.blockNumber,
|
|
8180
|
+
});
|
|
8181
|
+
// Find the first swap log that matches our transaction hash
|
|
8182
|
+
const targetLog = swapLogs.find((log) => log.transactionHash === txHash);
|
|
8183
|
+
if (!targetLog) {
|
|
8184
|
+
return undefined;
|
|
8185
|
+
}
|
|
8186
|
+
// If flETHIsCurrencyZero is not provided, return basic log
|
|
8187
|
+
if (flETHIsCurrencyZero === undefined) {
|
|
8188
|
+
return {
|
|
8189
|
+
...targetLog,
|
|
8190
|
+
timestamp,
|
|
8191
|
+
};
|
|
8192
|
+
}
|
|
8193
|
+
// Parse the swap data using the utility function
|
|
8194
|
+
const swapData = parseSwapData(targetLog.args, flETHIsCurrencyZero);
|
|
8195
|
+
return {
|
|
8196
|
+
...targetLog,
|
|
8197
|
+
timestamp,
|
|
8198
|
+
type: swapData.type,
|
|
8199
|
+
delta: swapData.delta,
|
|
8200
|
+
};
|
|
8201
|
+
}
|
|
8202
|
+
catch (error) {
|
|
8203
|
+
console.error("Error parsing swap transaction:", error);
|
|
8204
|
+
return undefined;
|
|
8205
|
+
}
|
|
8206
|
+
}
|
|
8079
8207
|
async watchPoolSwap({ onPoolSwap, flETHIsCurrencyZero, startBlockNumber, filterByPoolId, }) {
|
|
8080
8208
|
let intervalId;
|
|
8081
8209
|
if (startBlockNumber !== undefined) {
|
|
@@ -8108,69 +8236,14 @@ class ReadFlaunchPositionManager {
|
|
|
8108
8236
|
timestamp,
|
|
8109
8237
|
};
|
|
8110
8238
|
}
|
|
8111
|
-
|
|
8112
|
-
const
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
if (flETHIsCurrencyZero) {
|
|
8119
|
-
swapType = currency0Delta < 0 ? "BUY" : "SELL";
|
|
8120
|
-
feesIsInFLETH = currency0Fees < 0;
|
|
8121
|
-
}
|
|
8122
|
-
else {
|
|
8123
|
-
swapType = currency1Delta < 0 ? "BUY" : "SELL";
|
|
8124
|
-
feesIsInFLETH = currency1Fees < 0;
|
|
8125
|
-
}
|
|
8126
|
-
const absCurrency0Delta = currency0Delta < 0 ? -currency0Delta : currency0Delta;
|
|
8127
|
-
const absCurrency1Delta = currency1Delta < 0 ? -currency1Delta : currency1Delta;
|
|
8128
|
-
const absCurrency0Fees = currency0Fees < 0 ? -currency0Fees : currency0Fees;
|
|
8129
|
-
const absCurrency1Fees = currency1Fees < 0 ? -currency1Fees : currency1Fees;
|
|
8130
|
-
const fees = {
|
|
8131
|
-
isInFLETH: feesIsInFLETH,
|
|
8132
|
-
amount: flETHIsCurrencyZero
|
|
8133
|
-
? feesIsInFLETH
|
|
8134
|
-
? absCurrency0Fees
|
|
8135
|
-
: absCurrency1Fees
|
|
8136
|
-
: feesIsInFLETH
|
|
8137
|
-
? absCurrency1Fees
|
|
8138
|
-
: absCurrency0Fees,
|
|
8239
|
+
// parse swap data
|
|
8240
|
+
const swapData = parseSwapData(log.args, flETHIsCurrencyZero);
|
|
8241
|
+
return {
|
|
8242
|
+
...log,
|
|
8243
|
+
timestamp,
|
|
8244
|
+
type: swapData.type,
|
|
8245
|
+
delta: swapData.delta,
|
|
8139
8246
|
};
|
|
8140
|
-
if (swapType === "BUY") {
|
|
8141
|
-
return {
|
|
8142
|
-
...log,
|
|
8143
|
-
timestamp,
|
|
8144
|
-
type: swapType,
|
|
8145
|
-
delta: {
|
|
8146
|
-
coinsBought: flETHIsCurrencyZero
|
|
8147
|
-
? absCurrency1Delta - (!fees.isInFLETH ? fees.amount : 0n)
|
|
8148
|
-
: absCurrency0Delta -
|
|
8149
|
-
(!fees.isInFLETH ? fees.amount : 0n),
|
|
8150
|
-
flETHSold: flETHIsCurrencyZero
|
|
8151
|
-
? absCurrency0Delta - (fees.isInFLETH ? fees.amount : 0n)
|
|
8152
|
-
: absCurrency1Delta - (fees.isInFLETH ? fees.amount : 0n),
|
|
8153
|
-
fees,
|
|
8154
|
-
},
|
|
8155
|
-
};
|
|
8156
|
-
}
|
|
8157
|
-
else {
|
|
8158
|
-
return {
|
|
8159
|
-
...log,
|
|
8160
|
-
timestamp,
|
|
8161
|
-
type: swapType,
|
|
8162
|
-
delta: {
|
|
8163
|
-
coinsSold: flETHIsCurrencyZero
|
|
8164
|
-
? absCurrency1Delta - (!fees.isInFLETH ? fees.amount : 0n)
|
|
8165
|
-
: absCurrency0Delta -
|
|
8166
|
-
(!fees.isInFLETH ? fees.amount : 0n),
|
|
8167
|
-
flETHBought: flETHIsCurrencyZero
|
|
8168
|
-
? absCurrency0Delta - (fees.isInFLETH ? fees.amount : 0n)
|
|
8169
|
-
: absCurrency1Delta - (fees.isInFLETH ? fees.amount : 0n),
|
|
8170
|
-
fees,
|
|
8171
|
-
},
|
|
8172
|
-
};
|
|
8173
|
-
}
|
|
8174
8247
|
}));
|
|
8175
8248
|
if (logsWithTimestamps.length > 0) {
|
|
8176
8249
|
onPoolSwap({
|
|
@@ -9973,7 +10046,595 @@ const BidwallAbi = [
|
|
|
9973
10046
|
inputs: [],
|
|
9974
10047
|
name: "positionManager",
|
|
9975
10048
|
outputs: [
|
|
9976
|
-
{ internalType: "contract PositionManager", name: "", type: "address" },
|
|
10049
|
+
{ internalType: "contract PositionManager", name: "", type: "address" },
|
|
10050
|
+
],
|
|
10051
|
+
stateMutability: "view",
|
|
10052
|
+
type: "function",
|
|
10053
|
+
},
|
|
10054
|
+
{
|
|
10055
|
+
inputs: [],
|
|
10056
|
+
name: "renounceOwnership",
|
|
10057
|
+
outputs: [],
|
|
10058
|
+
stateMutability: "payable",
|
|
10059
|
+
type: "function",
|
|
10060
|
+
},
|
|
10061
|
+
{
|
|
10062
|
+
inputs: [],
|
|
10063
|
+
name: "requestOwnershipHandover",
|
|
10064
|
+
outputs: [],
|
|
10065
|
+
stateMutability: "payable",
|
|
10066
|
+
type: "function",
|
|
10067
|
+
},
|
|
10068
|
+
{
|
|
10069
|
+
inputs: [
|
|
10070
|
+
{
|
|
10071
|
+
components: [
|
|
10072
|
+
{ internalType: "Currency", name: "currency0", type: "address" },
|
|
10073
|
+
{ internalType: "Currency", name: "currency1", type: "address" },
|
|
10074
|
+
{ internalType: "uint24", name: "fee", type: "uint24" },
|
|
10075
|
+
{ internalType: "int24", name: "tickSpacing", type: "int24" },
|
|
10076
|
+
{ internalType: "contract IHooks", name: "hooks", type: "address" },
|
|
10077
|
+
],
|
|
10078
|
+
internalType: "struct PoolKey",
|
|
10079
|
+
name: "_key",
|
|
10080
|
+
type: "tuple",
|
|
10081
|
+
},
|
|
10082
|
+
{ internalType: "bool", name: "_disable", type: "bool" },
|
|
10083
|
+
],
|
|
10084
|
+
name: "setDisabledState",
|
|
10085
|
+
outputs: [],
|
|
10086
|
+
stateMutability: "nonpayable",
|
|
10087
|
+
type: "function",
|
|
10088
|
+
},
|
|
10089
|
+
{
|
|
10090
|
+
inputs: [
|
|
10091
|
+
{ internalType: "uint256", name: "swapFeeThreshold", type: "uint256" },
|
|
10092
|
+
],
|
|
10093
|
+
name: "setSwapFeeThreshold",
|
|
10094
|
+
outputs: [],
|
|
10095
|
+
stateMutability: "nonpayable",
|
|
10096
|
+
type: "function",
|
|
10097
|
+
},
|
|
10098
|
+
{
|
|
10099
|
+
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
|
|
10100
|
+
name: "transferOwnership",
|
|
10101
|
+
outputs: [],
|
|
10102
|
+
stateMutability: "payable",
|
|
10103
|
+
type: "function",
|
|
10104
|
+
},
|
|
10105
|
+
];
|
|
10106
|
+
|
|
10107
|
+
/**
|
|
10108
|
+
* Client for interacting with the BidWall V1 contract in read-only mode
|
|
10109
|
+
* Provides methods to query bid wall positions and pool information
|
|
10110
|
+
*/
|
|
10111
|
+
class ReadBidWall {
|
|
10112
|
+
/**
|
|
10113
|
+
* Creates a new ReadBidWall instance
|
|
10114
|
+
* @param address - The address of the BidWall contract
|
|
10115
|
+
* @param drift - Optional drift instance for contract interactions (creates new instance if not provided)
|
|
10116
|
+
* @throws Error if address is not provided
|
|
10117
|
+
*/
|
|
10118
|
+
constructor(address, drift = createDrift$1()) {
|
|
10119
|
+
if (!address) {
|
|
10120
|
+
throw new Error("Address is required");
|
|
10121
|
+
}
|
|
10122
|
+
this.contract = drift.contract({
|
|
10123
|
+
abi: BidwallAbi,
|
|
10124
|
+
address,
|
|
10125
|
+
});
|
|
10126
|
+
}
|
|
10127
|
+
/**
|
|
10128
|
+
* Gets information about a bid wall position for a specific pool
|
|
10129
|
+
* @param poolId - The ID of the pool
|
|
10130
|
+
* @returns Promise<{amount0_: bigint, amount1_: bigint, pendingEth_: bigint}> - Position details including token amounts and pending ETH
|
|
10131
|
+
*/
|
|
10132
|
+
position({ poolId }) {
|
|
10133
|
+
return this.contract.read("position", {
|
|
10134
|
+
_poolId: poolId,
|
|
10135
|
+
});
|
|
10136
|
+
}
|
|
10137
|
+
/**
|
|
10138
|
+
* Gets configuration information about a pool's bid wall
|
|
10139
|
+
* @param poolId - The ID of the pool
|
|
10140
|
+
* @returns Promise<{tickLower: number, tickUpper: number}> - Pool configuration including tick range
|
|
10141
|
+
*/
|
|
10142
|
+
poolInfo({ poolId }) {
|
|
10143
|
+
return this.contract.read("poolInfo", {
|
|
10144
|
+
_poolId: poolId,
|
|
10145
|
+
});
|
|
10146
|
+
}
|
|
10147
|
+
}
|
|
10148
|
+
|
|
10149
|
+
const AnyBidWallAbi = [
|
|
10150
|
+
{
|
|
10151
|
+
inputs: [
|
|
10152
|
+
{ internalType: "address", name: "_nativeToken", type: "address" },
|
|
10153
|
+
{ internalType: "address", name: "_poolManager", type: "address" },
|
|
10154
|
+
{ internalType: "address", name: "_protocolOwner", type: "address" },
|
|
10155
|
+
],
|
|
10156
|
+
stateMutability: "nonpayable",
|
|
10157
|
+
type: "constructor",
|
|
10158
|
+
},
|
|
10159
|
+
{ inputs: [], name: "AccessControlBadConfirmation", type: "error" },
|
|
10160
|
+
{
|
|
10161
|
+
inputs: [
|
|
10162
|
+
{ internalType: "address", name: "account", type: "address" },
|
|
10163
|
+
{ internalType: "bytes32", name: "neededRole", type: "bytes32" },
|
|
10164
|
+
],
|
|
10165
|
+
name: "AccessControlUnauthorizedAccount",
|
|
10166
|
+
type: "error",
|
|
10167
|
+
},
|
|
10168
|
+
{ inputs: [], name: "AlreadyInitialized", type: "error" },
|
|
10169
|
+
{ inputs: [], name: "CallerIsNotCreator", type: "error" },
|
|
10170
|
+
{ inputs: [], name: "NewOwnerIsZeroAddress", type: "error" },
|
|
10171
|
+
{ inputs: [], name: "NoHandoverRequest", type: "error" },
|
|
10172
|
+
{ inputs: [], name: "NotPositionManager", type: "error" },
|
|
10173
|
+
{ inputs: [], name: "Unauthorized", type: "error" },
|
|
10174
|
+
{
|
|
10175
|
+
anonymous: false,
|
|
10176
|
+
inputs: [
|
|
10177
|
+
{
|
|
10178
|
+
indexed: true,
|
|
10179
|
+
internalType: "PoolId",
|
|
10180
|
+
name: "_poolId",
|
|
10181
|
+
type: "bytes32",
|
|
10182
|
+
},
|
|
10183
|
+
{
|
|
10184
|
+
indexed: false,
|
|
10185
|
+
internalType: "address",
|
|
10186
|
+
name: "_recipient",
|
|
10187
|
+
type: "address",
|
|
10188
|
+
},
|
|
10189
|
+
{
|
|
10190
|
+
indexed: false,
|
|
10191
|
+
internalType: "uint256",
|
|
10192
|
+
name: "_eth",
|
|
10193
|
+
type: "uint256",
|
|
10194
|
+
},
|
|
10195
|
+
],
|
|
10196
|
+
name: "BidWallClosed",
|
|
10197
|
+
type: "event",
|
|
10198
|
+
},
|
|
10199
|
+
{
|
|
10200
|
+
anonymous: false,
|
|
10201
|
+
inputs: [
|
|
10202
|
+
{
|
|
10203
|
+
indexed: true,
|
|
10204
|
+
internalType: "PoolId",
|
|
10205
|
+
name: "_poolId",
|
|
10206
|
+
type: "bytes32",
|
|
10207
|
+
},
|
|
10208
|
+
{
|
|
10209
|
+
indexed: false,
|
|
10210
|
+
internalType: "uint256",
|
|
10211
|
+
name: "_added",
|
|
10212
|
+
type: "uint256",
|
|
10213
|
+
},
|
|
10214
|
+
{
|
|
10215
|
+
indexed: false,
|
|
10216
|
+
internalType: "uint256",
|
|
10217
|
+
name: "_pending",
|
|
10218
|
+
type: "uint256",
|
|
10219
|
+
},
|
|
10220
|
+
],
|
|
10221
|
+
name: "BidWallDeposit",
|
|
10222
|
+
type: "event",
|
|
10223
|
+
},
|
|
10224
|
+
{
|
|
10225
|
+
anonymous: false,
|
|
10226
|
+
inputs: [
|
|
10227
|
+
{
|
|
10228
|
+
indexed: true,
|
|
10229
|
+
internalType: "PoolId",
|
|
10230
|
+
name: "_poolId",
|
|
10231
|
+
type: "bytes32",
|
|
10232
|
+
},
|
|
10233
|
+
{ indexed: false, internalType: "bool", name: "_disabled", type: "bool" },
|
|
10234
|
+
],
|
|
10235
|
+
name: "BidWallDisabledStateUpdated",
|
|
10236
|
+
type: "event",
|
|
10237
|
+
},
|
|
10238
|
+
{
|
|
10239
|
+
anonymous: false,
|
|
10240
|
+
inputs: [
|
|
10241
|
+
{
|
|
10242
|
+
indexed: true,
|
|
10243
|
+
internalType: "PoolId",
|
|
10244
|
+
name: "_poolId",
|
|
10245
|
+
type: "bytes32",
|
|
10246
|
+
},
|
|
10247
|
+
{
|
|
10248
|
+
indexed: false,
|
|
10249
|
+
internalType: "uint256",
|
|
10250
|
+
name: "_eth",
|
|
10251
|
+
type: "uint256",
|
|
10252
|
+
},
|
|
10253
|
+
{
|
|
10254
|
+
indexed: false,
|
|
10255
|
+
internalType: "int24",
|
|
10256
|
+
name: "_tickLower",
|
|
10257
|
+
type: "int24",
|
|
10258
|
+
},
|
|
10259
|
+
{
|
|
10260
|
+
indexed: false,
|
|
10261
|
+
internalType: "int24",
|
|
10262
|
+
name: "_tickUpper",
|
|
10263
|
+
type: "int24",
|
|
10264
|
+
},
|
|
10265
|
+
],
|
|
10266
|
+
name: "BidWallInitialized",
|
|
10267
|
+
type: "event",
|
|
10268
|
+
},
|
|
10269
|
+
{
|
|
10270
|
+
anonymous: false,
|
|
10271
|
+
inputs: [
|
|
10272
|
+
{
|
|
10273
|
+
indexed: true,
|
|
10274
|
+
internalType: "PoolId",
|
|
10275
|
+
name: "_poolId",
|
|
10276
|
+
type: "bytes32",
|
|
10277
|
+
},
|
|
10278
|
+
{
|
|
10279
|
+
indexed: false,
|
|
10280
|
+
internalType: "uint256",
|
|
10281
|
+
name: "_eth",
|
|
10282
|
+
type: "uint256",
|
|
10283
|
+
},
|
|
10284
|
+
{
|
|
10285
|
+
indexed: false,
|
|
10286
|
+
internalType: "int24",
|
|
10287
|
+
name: "_tickLower",
|
|
10288
|
+
type: "int24",
|
|
10289
|
+
},
|
|
10290
|
+
{
|
|
10291
|
+
indexed: false,
|
|
10292
|
+
internalType: "int24",
|
|
10293
|
+
name: "_tickUpper",
|
|
10294
|
+
type: "int24",
|
|
10295
|
+
},
|
|
10296
|
+
],
|
|
10297
|
+
name: "BidWallRepositioned",
|
|
10298
|
+
type: "event",
|
|
10299
|
+
},
|
|
10300
|
+
{
|
|
10301
|
+
anonymous: false,
|
|
10302
|
+
inputs: [
|
|
10303
|
+
{
|
|
10304
|
+
indexed: true,
|
|
10305
|
+
internalType: "PoolId",
|
|
10306
|
+
name: "_poolId",
|
|
10307
|
+
type: "bytes32",
|
|
10308
|
+
},
|
|
10309
|
+
{
|
|
10310
|
+
indexed: false,
|
|
10311
|
+
internalType: "address",
|
|
10312
|
+
name: "_recipient",
|
|
10313
|
+
type: "address",
|
|
10314
|
+
},
|
|
10315
|
+
{
|
|
10316
|
+
indexed: false,
|
|
10317
|
+
internalType: "uint256",
|
|
10318
|
+
name: "_tokens",
|
|
10319
|
+
type: "uint256",
|
|
10320
|
+
},
|
|
10321
|
+
],
|
|
10322
|
+
name: "BidWallRewardsTransferred",
|
|
10323
|
+
type: "event",
|
|
10324
|
+
},
|
|
10325
|
+
{
|
|
10326
|
+
anonymous: false,
|
|
10327
|
+
inputs: [
|
|
10328
|
+
{
|
|
10329
|
+
indexed: false,
|
|
10330
|
+
internalType: "uint256",
|
|
10331
|
+
name: "_newSwapFeeThreshold",
|
|
10332
|
+
type: "uint256",
|
|
10333
|
+
},
|
|
10334
|
+
],
|
|
10335
|
+
name: "FixedSwapFeeThresholdUpdated",
|
|
10336
|
+
type: "event",
|
|
10337
|
+
},
|
|
10338
|
+
{
|
|
10339
|
+
anonymous: false,
|
|
10340
|
+
inputs: [
|
|
10341
|
+
{
|
|
10342
|
+
indexed: true,
|
|
10343
|
+
internalType: "address",
|
|
10344
|
+
name: "pendingOwner",
|
|
10345
|
+
type: "address",
|
|
10346
|
+
},
|
|
10347
|
+
],
|
|
10348
|
+
name: "OwnershipHandoverCanceled",
|
|
10349
|
+
type: "event",
|
|
10350
|
+
},
|
|
10351
|
+
{
|
|
10352
|
+
anonymous: false,
|
|
10353
|
+
inputs: [
|
|
10354
|
+
{
|
|
10355
|
+
indexed: true,
|
|
10356
|
+
internalType: "address",
|
|
10357
|
+
name: "pendingOwner",
|
|
10358
|
+
type: "address",
|
|
10359
|
+
},
|
|
10360
|
+
],
|
|
10361
|
+
name: "OwnershipHandoverRequested",
|
|
10362
|
+
type: "event",
|
|
10363
|
+
},
|
|
10364
|
+
{
|
|
10365
|
+
anonymous: false,
|
|
10366
|
+
inputs: [
|
|
10367
|
+
{
|
|
10368
|
+
indexed: true,
|
|
10369
|
+
internalType: "address",
|
|
10370
|
+
name: "oldOwner",
|
|
10371
|
+
type: "address",
|
|
10372
|
+
},
|
|
10373
|
+
{
|
|
10374
|
+
indexed: true,
|
|
10375
|
+
internalType: "address",
|
|
10376
|
+
name: "newOwner",
|
|
10377
|
+
type: "address",
|
|
10378
|
+
},
|
|
10379
|
+
],
|
|
10380
|
+
name: "OwnershipTransferred",
|
|
10381
|
+
type: "event",
|
|
10382
|
+
},
|
|
10383
|
+
{
|
|
10384
|
+
anonymous: false,
|
|
10385
|
+
inputs: [
|
|
10386
|
+
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
10387
|
+
{
|
|
10388
|
+
indexed: true,
|
|
10389
|
+
internalType: "bytes32",
|
|
10390
|
+
name: "previousAdminRole",
|
|
10391
|
+
type: "bytes32",
|
|
10392
|
+
},
|
|
10393
|
+
{
|
|
10394
|
+
indexed: true,
|
|
10395
|
+
internalType: "bytes32",
|
|
10396
|
+
name: "newAdminRole",
|
|
10397
|
+
type: "bytes32",
|
|
10398
|
+
},
|
|
10399
|
+
],
|
|
10400
|
+
name: "RoleAdminChanged",
|
|
10401
|
+
type: "event",
|
|
10402
|
+
},
|
|
10403
|
+
{
|
|
10404
|
+
anonymous: false,
|
|
10405
|
+
inputs: [
|
|
10406
|
+
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
10407
|
+
{
|
|
10408
|
+
indexed: true,
|
|
10409
|
+
internalType: "address",
|
|
10410
|
+
name: "account",
|
|
10411
|
+
type: "address",
|
|
10412
|
+
},
|
|
10413
|
+
{
|
|
10414
|
+
indexed: true,
|
|
10415
|
+
internalType: "address",
|
|
10416
|
+
name: "sender",
|
|
10417
|
+
type: "address",
|
|
10418
|
+
},
|
|
10419
|
+
],
|
|
10420
|
+
name: "RoleGranted",
|
|
10421
|
+
type: "event",
|
|
10422
|
+
},
|
|
10423
|
+
{
|
|
10424
|
+
anonymous: false,
|
|
10425
|
+
inputs: [
|
|
10426
|
+
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
10427
|
+
{
|
|
10428
|
+
indexed: true,
|
|
10429
|
+
internalType: "address",
|
|
10430
|
+
name: "account",
|
|
10431
|
+
type: "address",
|
|
10432
|
+
},
|
|
10433
|
+
{
|
|
10434
|
+
indexed: true,
|
|
10435
|
+
internalType: "address",
|
|
10436
|
+
name: "sender",
|
|
10437
|
+
type: "address",
|
|
10438
|
+
},
|
|
10439
|
+
],
|
|
10440
|
+
name: "RoleRevoked",
|
|
10441
|
+
type: "event",
|
|
10442
|
+
},
|
|
10443
|
+
{
|
|
10444
|
+
anonymous: false,
|
|
10445
|
+
inputs: [
|
|
10446
|
+
{
|
|
10447
|
+
indexed: false,
|
|
10448
|
+
internalType: "uint256",
|
|
10449
|
+
name: "_staleTimeWindow",
|
|
10450
|
+
type: "uint256",
|
|
10451
|
+
},
|
|
10452
|
+
],
|
|
10453
|
+
name: "StaleTimeWindowUpdated",
|
|
10454
|
+
type: "event",
|
|
10455
|
+
},
|
|
10456
|
+
{
|
|
10457
|
+
inputs: [],
|
|
10458
|
+
name: "DEFAULT_ADMIN_ROLE",
|
|
10459
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
10460
|
+
stateMutability: "view",
|
|
10461
|
+
type: "function",
|
|
10462
|
+
},
|
|
10463
|
+
{
|
|
10464
|
+
inputs: [],
|
|
10465
|
+
name: "cancelOwnershipHandover",
|
|
10466
|
+
outputs: [],
|
|
10467
|
+
stateMutability: "payable",
|
|
10468
|
+
type: "function",
|
|
10469
|
+
},
|
|
10470
|
+
{
|
|
10471
|
+
inputs: [
|
|
10472
|
+
{
|
|
10473
|
+
components: [
|
|
10474
|
+
{ internalType: "Currency", name: "currency0", type: "address" },
|
|
10475
|
+
{ internalType: "Currency", name: "currency1", type: "address" },
|
|
10476
|
+
{ internalType: "uint24", name: "fee", type: "uint24" },
|
|
10477
|
+
{ internalType: "int24", name: "tickSpacing", type: "int24" },
|
|
10478
|
+
{ internalType: "contract IHooks", name: "hooks", type: "address" },
|
|
10479
|
+
],
|
|
10480
|
+
internalType: "struct PoolKey",
|
|
10481
|
+
name: "_poolKey",
|
|
10482
|
+
type: "tuple",
|
|
10483
|
+
},
|
|
10484
|
+
{ internalType: "int24", name: "_currentTick", type: "int24" },
|
|
10485
|
+
{ internalType: "bool", name: "_nativeIsZero", type: "bool" },
|
|
10486
|
+
],
|
|
10487
|
+
name: "checkStalePosition",
|
|
10488
|
+
outputs: [],
|
|
10489
|
+
stateMutability: "nonpayable",
|
|
10490
|
+
type: "function",
|
|
10491
|
+
},
|
|
10492
|
+
{
|
|
10493
|
+
inputs: [
|
|
10494
|
+
{
|
|
10495
|
+
components: [
|
|
10496
|
+
{ internalType: "Currency", name: "currency0", type: "address" },
|
|
10497
|
+
{ internalType: "Currency", name: "currency1", type: "address" },
|
|
10498
|
+
{ internalType: "uint24", name: "fee", type: "uint24" },
|
|
10499
|
+
{ internalType: "int24", name: "tickSpacing", type: "int24" },
|
|
10500
|
+
{ internalType: "contract IHooks", name: "hooks", type: "address" },
|
|
10501
|
+
],
|
|
10502
|
+
internalType: "struct PoolKey",
|
|
10503
|
+
name: "_key",
|
|
10504
|
+
type: "tuple",
|
|
10505
|
+
},
|
|
10506
|
+
],
|
|
10507
|
+
name: "closeBidWall",
|
|
10508
|
+
outputs: [],
|
|
10509
|
+
stateMutability: "nonpayable",
|
|
10510
|
+
type: "function",
|
|
10511
|
+
},
|
|
10512
|
+
{
|
|
10513
|
+
inputs: [
|
|
10514
|
+
{ internalType: "address", name: "pendingOwner", type: "address" },
|
|
10515
|
+
],
|
|
10516
|
+
name: "completeOwnershipHandover",
|
|
10517
|
+
outputs: [],
|
|
10518
|
+
stateMutability: "payable",
|
|
10519
|
+
type: "function",
|
|
10520
|
+
},
|
|
10521
|
+
{
|
|
10522
|
+
inputs: [
|
|
10523
|
+
{
|
|
10524
|
+
components: [
|
|
10525
|
+
{ internalType: "Currency", name: "currency0", type: "address" },
|
|
10526
|
+
{ internalType: "Currency", name: "currency1", type: "address" },
|
|
10527
|
+
{ internalType: "uint24", name: "fee", type: "uint24" },
|
|
10528
|
+
{ internalType: "int24", name: "tickSpacing", type: "int24" },
|
|
10529
|
+
{ internalType: "contract IHooks", name: "hooks", type: "address" },
|
|
10530
|
+
],
|
|
10531
|
+
internalType: "struct PoolKey",
|
|
10532
|
+
name: "_poolKey",
|
|
10533
|
+
type: "tuple",
|
|
10534
|
+
},
|
|
10535
|
+
{ internalType: "uint256", name: "_ethSwapAmount", type: "uint256" },
|
|
10536
|
+
{ internalType: "int24", name: "_currentTick", type: "int24" },
|
|
10537
|
+
{ internalType: "bool", name: "_nativeIsZero", type: "bool" },
|
|
10538
|
+
],
|
|
10539
|
+
name: "deposit",
|
|
10540
|
+
outputs: [],
|
|
10541
|
+
stateMutability: "nonpayable",
|
|
10542
|
+
type: "function",
|
|
10543
|
+
},
|
|
10544
|
+
{
|
|
10545
|
+
inputs: [{ internalType: "bytes32", name: "role", type: "bytes32" }],
|
|
10546
|
+
name: "getRoleAdmin",
|
|
10547
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
10548
|
+
stateMutability: "view",
|
|
10549
|
+
type: "function",
|
|
10550
|
+
},
|
|
10551
|
+
{
|
|
10552
|
+
inputs: [
|
|
10553
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
10554
|
+
{ internalType: "address", name: "account", type: "address" },
|
|
10555
|
+
],
|
|
10556
|
+
name: "grantRole",
|
|
10557
|
+
outputs: [],
|
|
10558
|
+
stateMutability: "nonpayable",
|
|
10559
|
+
type: "function",
|
|
10560
|
+
},
|
|
10561
|
+
{
|
|
10562
|
+
inputs: [
|
|
10563
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
10564
|
+
{ internalType: "address", name: "account", type: "address" },
|
|
10565
|
+
],
|
|
10566
|
+
name: "hasRole",
|
|
10567
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
10568
|
+
stateMutability: "view",
|
|
10569
|
+
type: "function",
|
|
10570
|
+
},
|
|
10571
|
+
{
|
|
10572
|
+
inputs: [{ internalType: "PoolId", name: "_poolId", type: "bytes32" }],
|
|
10573
|
+
name: "isBidWallEnabled",
|
|
10574
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
10575
|
+
stateMutability: "view",
|
|
10576
|
+
type: "function",
|
|
10577
|
+
},
|
|
10578
|
+
{
|
|
10579
|
+
inputs: [{ internalType: "PoolId", name: "_poolId", type: "bytes32" }],
|
|
10580
|
+
name: "lastPoolTransaction",
|
|
10581
|
+
outputs: [{ internalType: "uint256", name: "_timestamp", type: "uint256" }],
|
|
10582
|
+
stateMutability: "view",
|
|
10583
|
+
type: "function",
|
|
10584
|
+
},
|
|
10585
|
+
{
|
|
10586
|
+
inputs: [],
|
|
10587
|
+
name: "nativeToken",
|
|
10588
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
10589
|
+
stateMutability: "view",
|
|
10590
|
+
type: "function",
|
|
10591
|
+
},
|
|
10592
|
+
{
|
|
10593
|
+
inputs: [],
|
|
10594
|
+
name: "owner",
|
|
10595
|
+
outputs: [{ internalType: "address", name: "result", type: "address" }],
|
|
10596
|
+
stateMutability: "view",
|
|
10597
|
+
type: "function",
|
|
10598
|
+
},
|
|
10599
|
+
{
|
|
10600
|
+
inputs: [
|
|
10601
|
+
{ internalType: "address", name: "pendingOwner", type: "address" },
|
|
10602
|
+
],
|
|
10603
|
+
name: "ownershipHandoverExpiresAt",
|
|
10604
|
+
outputs: [{ internalType: "uint256", name: "result", type: "uint256" }],
|
|
10605
|
+
stateMutability: "view",
|
|
10606
|
+
type: "function",
|
|
10607
|
+
},
|
|
10608
|
+
{
|
|
10609
|
+
inputs: [{ internalType: "PoolId", name: "_poolId", type: "bytes32" }],
|
|
10610
|
+
name: "poolInfo",
|
|
10611
|
+
outputs: [
|
|
10612
|
+
{ internalType: "bool", name: "disabled", type: "bool" },
|
|
10613
|
+
{ internalType: "bool", name: "initialized", type: "bool" },
|
|
10614
|
+
{ internalType: "int24", name: "tickLower", type: "int24" },
|
|
10615
|
+
{ internalType: "int24", name: "tickUpper", type: "int24" },
|
|
10616
|
+
{ internalType: "uint256", name: "pendingETHFees", type: "uint256" },
|
|
10617
|
+
{ internalType: "uint256", name: "cumulativeSwapFees", type: "uint256" },
|
|
10618
|
+
],
|
|
10619
|
+
stateMutability: "view",
|
|
10620
|
+
type: "function",
|
|
10621
|
+
},
|
|
10622
|
+
{
|
|
10623
|
+
inputs: [],
|
|
10624
|
+
name: "poolManager",
|
|
10625
|
+
outputs: [
|
|
10626
|
+
{ internalType: "contract IPoolManager", name: "", type: "address" },
|
|
10627
|
+
],
|
|
10628
|
+
stateMutability: "view",
|
|
10629
|
+
type: "function",
|
|
10630
|
+
},
|
|
10631
|
+
{
|
|
10632
|
+
inputs: [{ internalType: "PoolId", name: "_poolId", type: "bytes32" }],
|
|
10633
|
+
name: "position",
|
|
10634
|
+
outputs: [
|
|
10635
|
+
{ internalType: "uint256", name: "amount0_", type: "uint256" },
|
|
10636
|
+
{ internalType: "uint256", name: "amount1_", type: "uint256" },
|
|
10637
|
+
{ internalType: "uint256", name: "pendingEth_", type: "uint256" },
|
|
9977
10638
|
],
|
|
9978
10639
|
stateMutability: "view",
|
|
9979
10640
|
type: "function",
|
|
@@ -9985,6 +10646,16 @@ const BidwallAbi = [
|
|
|
9985
10646
|
stateMutability: "payable",
|
|
9986
10647
|
type: "function",
|
|
9987
10648
|
},
|
|
10649
|
+
{
|
|
10650
|
+
inputs: [
|
|
10651
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
10652
|
+
{ internalType: "address", name: "callerConfirmation", type: "address" },
|
|
10653
|
+
],
|
|
10654
|
+
name: "renounceRole",
|
|
10655
|
+
outputs: [],
|
|
10656
|
+
stateMutability: "nonpayable",
|
|
10657
|
+
type: "function",
|
|
10658
|
+
},
|
|
9988
10659
|
{
|
|
9989
10660
|
inputs: [],
|
|
9990
10661
|
name: "requestOwnershipHandover",
|
|
@@ -9992,6 +10663,16 @@ const BidwallAbi = [
|
|
|
9992
10663
|
stateMutability: "payable",
|
|
9993
10664
|
type: "function",
|
|
9994
10665
|
},
|
|
10666
|
+
{
|
|
10667
|
+
inputs: [
|
|
10668
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
10669
|
+
{ internalType: "address", name: "account", type: "address" },
|
|
10670
|
+
],
|
|
10671
|
+
name: "revokeRole",
|
|
10672
|
+
outputs: [],
|
|
10673
|
+
stateMutability: "nonpayable",
|
|
10674
|
+
type: "function",
|
|
10675
|
+
},
|
|
9995
10676
|
{
|
|
9996
10677
|
inputs: [
|
|
9997
10678
|
{
|
|
@@ -10013,6 +10694,15 @@ const BidwallAbi = [
|
|
|
10013
10694
|
stateMutability: "nonpayable",
|
|
10014
10695
|
type: "function",
|
|
10015
10696
|
},
|
|
10697
|
+
{
|
|
10698
|
+
inputs: [
|
|
10699
|
+
{ internalType: "uint256", name: "_staleTimeWindow", type: "uint256" },
|
|
10700
|
+
],
|
|
10701
|
+
name: "setStaleTimeWindow",
|
|
10702
|
+
outputs: [],
|
|
10703
|
+
stateMutability: "nonpayable",
|
|
10704
|
+
type: "function",
|
|
10705
|
+
},
|
|
10016
10706
|
{
|
|
10017
10707
|
inputs: [
|
|
10018
10708
|
{ internalType: "uint256", name: "swapFeeThreshold", type: "uint256" },
|
|
@@ -10022,6 +10712,20 @@ const BidwallAbi = [
|
|
|
10022
10712
|
stateMutability: "nonpayable",
|
|
10023
10713
|
type: "function",
|
|
10024
10714
|
},
|
|
10715
|
+
{
|
|
10716
|
+
inputs: [],
|
|
10717
|
+
name: "staleTimeWindow",
|
|
10718
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
10719
|
+
stateMutability: "view",
|
|
10720
|
+
type: "function",
|
|
10721
|
+
},
|
|
10722
|
+
{
|
|
10723
|
+
inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
|
|
10724
|
+
name: "supportsInterface",
|
|
10725
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
10726
|
+
stateMutability: "view",
|
|
10727
|
+
type: "function",
|
|
10728
|
+
},
|
|
10025
10729
|
{
|
|
10026
10730
|
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
|
|
10027
10731
|
name: "transferOwnership",
|
|
@@ -10032,13 +10736,14 @@ const BidwallAbi = [
|
|
|
10032
10736
|
];
|
|
10033
10737
|
|
|
10034
10738
|
/**
|
|
10035
|
-
* Client for interacting with the
|
|
10739
|
+
* Client for interacting with the AnyBidWall contract in read-only mode
|
|
10036
10740
|
* Provides methods to query bid wall positions and pool information
|
|
10741
|
+
* Enhanced version of the V1 contract with additional features
|
|
10037
10742
|
*/
|
|
10038
|
-
class
|
|
10743
|
+
class AnyBidWall {
|
|
10039
10744
|
/**
|
|
10040
|
-
* Creates a new
|
|
10041
|
-
* @param address - The address of the BidWall contract
|
|
10745
|
+
* Creates a new ReadBidWallV1_1 instance
|
|
10746
|
+
* @param address - The address of the BidWall V1.1 contract
|
|
10042
10747
|
* @param drift - Optional drift instance for contract interactions (creates new instance if not provided)
|
|
10043
10748
|
* @throws Error if address is not provided
|
|
10044
10749
|
*/
|
|
@@ -10047,7 +10752,7 @@ class ReadBidWall {
|
|
|
10047
10752
|
throw new Error("Address is required");
|
|
10048
10753
|
}
|
|
10049
10754
|
this.contract = drift.contract({
|
|
10050
|
-
abi:
|
|
10755
|
+
abi: AnyBidWallAbi,
|
|
10051
10756
|
address,
|
|
10052
10757
|
});
|
|
10053
10758
|
}
|
|
@@ -11950,6 +12655,53 @@ class ReadFlaunchPositionManagerV1_1 {
|
|
|
11950
12655
|
pollPoolCreatedNow: pollEvents,
|
|
11951
12656
|
};
|
|
11952
12657
|
}
|
|
12658
|
+
/**
|
|
12659
|
+
* Parses a transaction hash to extract PoolSwap events and return parsed swap data
|
|
12660
|
+
* @param txHash - The transaction hash to parse
|
|
12661
|
+
* @param flETHIsCurrencyZero - Whether flETH is currency 0 in the pool (optional)
|
|
12662
|
+
* @returns Parsed swap log or undefined if no PoolSwap event found
|
|
12663
|
+
*/
|
|
12664
|
+
async parseSwapTx(txHash, flETHIsCurrencyZero) {
|
|
12665
|
+
try {
|
|
12666
|
+
// Get transaction to get block number
|
|
12667
|
+
const tx = await this.drift.getTransaction({ hash: txHash });
|
|
12668
|
+
if (!tx) {
|
|
12669
|
+
return undefined;
|
|
12670
|
+
}
|
|
12671
|
+
// Get block to get timestamp
|
|
12672
|
+
const block = await this.drift.getBlock(tx.blockNumber);
|
|
12673
|
+
const timestamp = Number(block?.timestamp) * 1000; // convert to ms for js
|
|
12674
|
+
// Get PoolSwap events from the specific transaction
|
|
12675
|
+
const swapLogs = await this.contract.getEvents("PoolSwap", {
|
|
12676
|
+
fromBlock: tx.blockNumber,
|
|
12677
|
+
toBlock: tx.blockNumber,
|
|
12678
|
+
});
|
|
12679
|
+
// Find the first swap log that matches our transaction hash
|
|
12680
|
+
const targetLog = swapLogs.find((log) => log.transactionHash === txHash);
|
|
12681
|
+
if (!targetLog) {
|
|
12682
|
+
return undefined;
|
|
12683
|
+
}
|
|
12684
|
+
// If flETHIsCurrencyZero is not provided, return basic log
|
|
12685
|
+
if (flETHIsCurrencyZero === undefined) {
|
|
12686
|
+
return {
|
|
12687
|
+
...targetLog,
|
|
12688
|
+
timestamp,
|
|
12689
|
+
};
|
|
12690
|
+
}
|
|
12691
|
+
// Parse the swap data using the utility function
|
|
12692
|
+
const swapData = parseSwapData(targetLog.args, flETHIsCurrencyZero);
|
|
12693
|
+
return {
|
|
12694
|
+
...targetLog,
|
|
12695
|
+
timestamp,
|
|
12696
|
+
type: swapData.type,
|
|
12697
|
+
delta: swapData.delta,
|
|
12698
|
+
};
|
|
12699
|
+
}
|
|
12700
|
+
catch (error) {
|
|
12701
|
+
console.error("Error parsing swap transaction:", error);
|
|
12702
|
+
return undefined;
|
|
12703
|
+
}
|
|
12704
|
+
}
|
|
11953
12705
|
async watchPoolSwap({ onPoolSwap, flETHIsCurrencyZero, startBlockNumber, filterByPoolId, }) {
|
|
11954
12706
|
let intervalId;
|
|
11955
12707
|
if (startBlockNumber !== undefined) {
|
|
@@ -11982,69 +12734,14 @@ class ReadFlaunchPositionManagerV1_1 {
|
|
|
11982
12734
|
timestamp,
|
|
11983
12735
|
};
|
|
11984
12736
|
}
|
|
11985
|
-
|
|
11986
|
-
const
|
|
11987
|
-
|
|
11988
|
-
|
|
11989
|
-
|
|
11990
|
-
|
|
11991
|
-
|
|
11992
|
-
if (flETHIsCurrencyZero) {
|
|
11993
|
-
swapType = currency0Delta < 0 ? "BUY" : "SELL";
|
|
11994
|
-
feesIsInFLETH = currency0Fees < 0;
|
|
11995
|
-
}
|
|
11996
|
-
else {
|
|
11997
|
-
swapType = currency1Delta < 0 ? "BUY" : "SELL";
|
|
11998
|
-
feesIsInFLETH = currency1Fees < 0;
|
|
11999
|
-
}
|
|
12000
|
-
const absCurrency0Delta = currency0Delta < 0 ? -currency0Delta : currency0Delta;
|
|
12001
|
-
const absCurrency1Delta = currency1Delta < 0 ? -currency1Delta : currency1Delta;
|
|
12002
|
-
const absCurrency0Fees = currency0Fees < 0 ? -currency0Fees : currency0Fees;
|
|
12003
|
-
const absCurrency1Fees = currency1Fees < 0 ? -currency1Fees : currency1Fees;
|
|
12004
|
-
const fees = {
|
|
12005
|
-
isInFLETH: feesIsInFLETH,
|
|
12006
|
-
amount: flETHIsCurrencyZero
|
|
12007
|
-
? feesIsInFLETH
|
|
12008
|
-
? absCurrency0Fees
|
|
12009
|
-
: absCurrency1Fees
|
|
12010
|
-
: feesIsInFLETH
|
|
12011
|
-
? absCurrency1Fees
|
|
12012
|
-
: absCurrency0Fees,
|
|
12737
|
+
// parse swap data
|
|
12738
|
+
const swapData = parseSwapData(log.args, flETHIsCurrencyZero);
|
|
12739
|
+
return {
|
|
12740
|
+
...log,
|
|
12741
|
+
timestamp,
|
|
12742
|
+
type: swapData.type,
|
|
12743
|
+
delta: swapData.delta,
|
|
12013
12744
|
};
|
|
12014
|
-
if (swapType === "BUY") {
|
|
12015
|
-
return {
|
|
12016
|
-
...log,
|
|
12017
|
-
timestamp,
|
|
12018
|
-
type: swapType,
|
|
12019
|
-
delta: {
|
|
12020
|
-
coinsBought: flETHIsCurrencyZero
|
|
12021
|
-
? absCurrency1Delta - (!fees.isInFLETH ? fees.amount : 0n)
|
|
12022
|
-
: absCurrency0Delta -
|
|
12023
|
-
(!fees.isInFLETH ? fees.amount : 0n),
|
|
12024
|
-
flETHSold: flETHIsCurrencyZero
|
|
12025
|
-
? absCurrency0Delta - (fees.isInFLETH ? fees.amount : 0n)
|
|
12026
|
-
: absCurrency1Delta - (fees.isInFLETH ? fees.amount : 0n),
|
|
12027
|
-
fees,
|
|
12028
|
-
},
|
|
12029
|
-
};
|
|
12030
|
-
}
|
|
12031
|
-
else {
|
|
12032
|
-
return {
|
|
12033
|
-
...log,
|
|
12034
|
-
timestamp,
|
|
12035
|
-
type: swapType,
|
|
12036
|
-
delta: {
|
|
12037
|
-
coinsSold: flETHIsCurrencyZero
|
|
12038
|
-
? absCurrency1Delta - (!fees.isInFLETH ? fees.amount : 0n)
|
|
12039
|
-
: absCurrency0Delta -
|
|
12040
|
-
(!fees.isInFLETH ? fees.amount : 0n),
|
|
12041
|
-
flETHBought: flETHIsCurrencyZero
|
|
12042
|
-
? absCurrency0Delta - (fees.isInFLETH ? fees.amount : 0n)
|
|
12043
|
-
: absCurrency1Delta - (fees.isInFLETH ? fees.amount : 0n),
|
|
12044
|
-
fees,
|
|
12045
|
-
},
|
|
12046
|
-
};
|
|
12047
|
-
}
|
|
12048
12745
|
}));
|
|
12049
12746
|
if (logsWithTimestamps.length > 0) {
|
|
12050
12747
|
onPoolSwap({
|
|
@@ -12360,6 +13057,123 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
|
|
|
12360
13057
|
tokenUri,
|
|
12361
13058
|
});
|
|
12362
13059
|
}
|
|
13060
|
+
/**
|
|
13061
|
+
* Flaunches a new token that splits the creator fees to the creator and a list of recipients
|
|
13062
|
+
* @param params - Parameters for the flaunch with split manager
|
|
13063
|
+
* @param params.name - The name of the token
|
|
13064
|
+
* @param params.symbol - The symbol of the token
|
|
13065
|
+
* @param params.tokenUri - The URI containing the token metadata
|
|
13066
|
+
* @param params.fairLaunchPercent - Percentage of total supply to be used in fair launch (0-100)
|
|
13067
|
+
* @param params.fairLaunchDuration - Duration of fair launch in seconds
|
|
13068
|
+
* @param params.initialMarketCapUSD - Initial market cap in USD
|
|
13069
|
+
* @param params.creator - Address of the token creator
|
|
13070
|
+
* @param params.creatorFeeAllocationPercent - Percentage of fees allocated to creator (0-100)
|
|
13071
|
+
* @param params.creatorSplitPercent - Percentage of fees allocated to creator (0-100)
|
|
13072
|
+
* @param params.splitReceivers - List of recipients and their percentage of the fees
|
|
13073
|
+
* @param params.flaunchAt - Optional timestamp when the flaunch should start
|
|
13074
|
+
* @param params.premineAmount - Optional amount of tokens to premine
|
|
13075
|
+
* @param params.creatorSplitPercent - Split percentage of the fees for the creator (0-100)
|
|
13076
|
+
* @param params.splitReceivers - List of recipients and their percentage of the fees
|
|
13077
|
+
* @returns Transaction response for the flaunch creation
|
|
13078
|
+
*/
|
|
13079
|
+
async flaunchWithSplitManager(params) {
|
|
13080
|
+
const initialMCapInUSDCWei = parseUnits(params.initialMarketCapUSD.toString(), 6);
|
|
13081
|
+
const initialPriceParams = encodeAbiParameters([
|
|
13082
|
+
{
|
|
13083
|
+
type: "uint256",
|
|
13084
|
+
},
|
|
13085
|
+
], [initialMCapInUSDCWei]);
|
|
13086
|
+
const fairLaunchInBps = BigInt(params.fairLaunchPercent * 100);
|
|
13087
|
+
const creatorFeeAllocationInBps = params.creatorFeeAllocationPercent * 100;
|
|
13088
|
+
const ethRequired = await this.ethRequiredToFlaunch({
|
|
13089
|
+
premineAmount: params.premineAmount ?? 0n,
|
|
13090
|
+
initialPriceParams,
|
|
13091
|
+
slippagePercent: 5,
|
|
13092
|
+
});
|
|
13093
|
+
const VALID_SHARE_TOTAL = 10000000n; // 5 decimals as BigInt
|
|
13094
|
+
let creatorShare = (BigInt(params.creatorSplitPercent) * VALID_SHARE_TOTAL) / 100n;
|
|
13095
|
+
const recipientShares = params.splitReceivers.map((receiver) => {
|
|
13096
|
+
return {
|
|
13097
|
+
recipient: receiver.address,
|
|
13098
|
+
share: (BigInt(receiver.percent) * VALID_SHARE_TOTAL) / 100n,
|
|
13099
|
+
};
|
|
13100
|
+
});
|
|
13101
|
+
const totalRecipientShares = recipientShares.reduce((acc, curr) => acc + curr.share, 0n);
|
|
13102
|
+
// if there's a remainder (due to rounding errors), add it to the creator share
|
|
13103
|
+
const remainderShares = VALID_SHARE_TOTAL - totalRecipientShares;
|
|
13104
|
+
creatorShare += remainderShares;
|
|
13105
|
+
const initializeData = encodeAbiParameters([
|
|
13106
|
+
{
|
|
13107
|
+
type: "tuple",
|
|
13108
|
+
name: "params",
|
|
13109
|
+
components: [
|
|
13110
|
+
{ type: "uint256", name: "creatorShare" },
|
|
13111
|
+
{
|
|
13112
|
+
type: "tuple[]",
|
|
13113
|
+
name: "recipientShares",
|
|
13114
|
+
components: [
|
|
13115
|
+
{ type: "address", name: "recipient" },
|
|
13116
|
+
{ type: "uint256", name: "share" },
|
|
13117
|
+
],
|
|
13118
|
+
},
|
|
13119
|
+
],
|
|
13120
|
+
},
|
|
13121
|
+
], [
|
|
13122
|
+
{
|
|
13123
|
+
creatorShare,
|
|
13124
|
+
recipientShares,
|
|
13125
|
+
},
|
|
13126
|
+
]);
|
|
13127
|
+
return this.contract.write("flaunch", {
|
|
13128
|
+
_flaunchParams: {
|
|
13129
|
+
name: params.name,
|
|
13130
|
+
symbol: params.symbol,
|
|
13131
|
+
tokenUri: params.tokenUri,
|
|
13132
|
+
initialTokenFairLaunch: (this.TOTAL_SUPPLY * fairLaunchInBps) / 10000n,
|
|
13133
|
+
fairLaunchDuration: BigInt(params.fairLaunchDuration),
|
|
13134
|
+
premineAmount: params.premineAmount ?? 0n,
|
|
13135
|
+
creator: params.creator,
|
|
13136
|
+
creatorFeeAllocation: creatorFeeAllocationInBps,
|
|
13137
|
+
flaunchAt: params.flaunchAt ?? 0n,
|
|
13138
|
+
initialPriceParams,
|
|
13139
|
+
feeCalculatorParams: "0x",
|
|
13140
|
+
},
|
|
13141
|
+
_treasuryManagerParams: {
|
|
13142
|
+
manager: AddressFeeSplitManagerAddress[this.chainId],
|
|
13143
|
+
initializeData,
|
|
13144
|
+
depositData: "0x",
|
|
13145
|
+
},
|
|
13146
|
+
_whitelistParams: {
|
|
13147
|
+
merkleRoot: zeroHash,
|
|
13148
|
+
merkleIPFSHash: "",
|
|
13149
|
+
maxTokens: 0n,
|
|
13150
|
+
},
|
|
13151
|
+
_airdropParams: {
|
|
13152
|
+
airdropIndex: 0n,
|
|
13153
|
+
airdropAmount: 0n,
|
|
13154
|
+
airdropEndTime: 0n,
|
|
13155
|
+
merkleRoot: zeroHash,
|
|
13156
|
+
merkleIPFSHash: "",
|
|
13157
|
+
},
|
|
13158
|
+
}, {
|
|
13159
|
+
value: ethRequired,
|
|
13160
|
+
});
|
|
13161
|
+
}
|
|
13162
|
+
/**
|
|
13163
|
+
* Flaunches a new token that splits the creator fees to the creator and a list of recipients, storing the token metadata on IPFS
|
|
13164
|
+
* @param params - Parameters for the flaunch with split manager including all IPFS metadata
|
|
13165
|
+
* @returns Promise resolving to the transaction response for the flaunch creation
|
|
13166
|
+
*/
|
|
13167
|
+
async flaunchIPFSWithSplitManager(params) {
|
|
13168
|
+
const tokenUri = await generateTokenUri(params.name, {
|
|
13169
|
+
metadata: params.metadata,
|
|
13170
|
+
pinataConfig: params.pinataConfig,
|
|
13171
|
+
});
|
|
13172
|
+
return this.flaunchWithSplitManager({
|
|
13173
|
+
...params,
|
|
13174
|
+
tokenUri,
|
|
13175
|
+
});
|
|
13176
|
+
}
|
|
12363
13177
|
}
|
|
12364
13178
|
|
|
12365
13179
|
const FlaunchAbi = [
|
|
@@ -14674,8 +15488,8 @@ const AnyPositionManagerAbi = [
|
|
|
14674
15488
|
},
|
|
14675
15489
|
{ inputs: [], name: "AlreadyFlaunched", type: "error" },
|
|
14676
15490
|
{ inputs: [], name: "AlreadyInitialized", type: "error" },
|
|
15491
|
+
{ inputs: [], name: "CallerIsNotApprovedCreator", type: "error" },
|
|
14677
15492
|
{ inputs: [], name: "CallerIsNotBidWall", type: "error" },
|
|
14678
|
-
{ inputs: [], name: "CallerIsNotCreator", type: "error" },
|
|
14679
15493
|
{
|
|
14680
15494
|
inputs: [{ internalType: "address", name: "_caller", type: "address" }],
|
|
14681
15495
|
name: "CallerNotCreator",
|
|
@@ -14699,6 +15513,25 @@ const AnyPositionManagerAbi = [
|
|
|
14699
15513
|
name: "UnknownPool",
|
|
14700
15514
|
type: "error",
|
|
14701
15515
|
},
|
|
15516
|
+
{
|
|
15517
|
+
anonymous: false,
|
|
15518
|
+
inputs: [
|
|
15519
|
+
{
|
|
15520
|
+
indexed: false,
|
|
15521
|
+
internalType: "address",
|
|
15522
|
+
name: "_creator",
|
|
15523
|
+
type: "address",
|
|
15524
|
+
},
|
|
15525
|
+
{
|
|
15526
|
+
indexed: false,
|
|
15527
|
+
internalType: "bool",
|
|
15528
|
+
name: "_isApproved",
|
|
15529
|
+
type: "bool",
|
|
15530
|
+
},
|
|
15531
|
+
],
|
|
15532
|
+
name: "CreatorApproved",
|
|
15533
|
+
type: "event",
|
|
15534
|
+
},
|
|
14702
15535
|
{
|
|
14703
15536
|
anonymous: false,
|
|
14704
15537
|
inputs: [
|
|
@@ -14840,25 +15673,6 @@ const AnyPositionManagerAbi = [
|
|
|
14840
15673
|
name: "InitialPriceUpdated",
|
|
14841
15674
|
type: "event",
|
|
14842
15675
|
},
|
|
14843
|
-
{
|
|
14844
|
-
anonymous: false,
|
|
14845
|
-
inputs: [
|
|
14846
|
-
{
|
|
14847
|
-
indexed: false,
|
|
14848
|
-
internalType: "address",
|
|
14849
|
-
name: "_memecoin",
|
|
14850
|
-
type: "address",
|
|
14851
|
-
},
|
|
14852
|
-
{
|
|
14853
|
-
indexed: false,
|
|
14854
|
-
internalType: "address",
|
|
14855
|
-
name: "_creator",
|
|
14856
|
-
type: "address",
|
|
14857
|
-
},
|
|
14858
|
-
],
|
|
14859
|
-
name: "MemecoinApproved",
|
|
14860
|
-
type: "event",
|
|
14861
|
-
},
|
|
14862
15676
|
{
|
|
14863
15677
|
anonymous: false,
|
|
14864
15678
|
inputs: [
|
|
@@ -15441,18 +16255,18 @@ const AnyPositionManagerAbi = [
|
|
|
15441
16255
|
},
|
|
15442
16256
|
{
|
|
15443
16257
|
inputs: [
|
|
15444
|
-
{ internalType: "address", name: "_memecoin", type: "address" },
|
|
15445
16258
|
{ internalType: "address", name: "_creator", type: "address" },
|
|
16259
|
+
{ internalType: "bool", name: "_isApproved", type: "bool" },
|
|
15446
16260
|
],
|
|
15447
|
-
name: "
|
|
16261
|
+
name: "approveCreator",
|
|
15448
16262
|
outputs: [],
|
|
15449
16263
|
stateMutability: "nonpayable",
|
|
15450
16264
|
type: "function",
|
|
15451
16265
|
},
|
|
15452
16266
|
{
|
|
15453
|
-
inputs: [{ internalType: "address", name: "
|
|
15454
|
-
name: "
|
|
15455
|
-
outputs: [{ internalType: "
|
|
16267
|
+
inputs: [{ internalType: "address", name: "_creator", type: "address" }],
|
|
16268
|
+
name: "approvedMemecoinCreator",
|
|
16269
|
+
outputs: [{ internalType: "bool", name: "isApproved", type: "bool" }],
|
|
15456
16270
|
stateMutability: "view",
|
|
15457
16271
|
type: "function",
|
|
15458
16272
|
},
|
|
@@ -16141,6 +16955,53 @@ class ReadAnyPositionManager {
|
|
|
16141
16955
|
pollPoolCreatedNow: pollEvents,
|
|
16142
16956
|
};
|
|
16143
16957
|
}
|
|
16958
|
+
/**
|
|
16959
|
+
* Parses a transaction hash to extract PoolSwap events and return parsed swap data
|
|
16960
|
+
* @param txHash - The transaction hash to parse
|
|
16961
|
+
* @param flETHIsCurrencyZero - Whether flETH is currency 0 in the pool (optional)
|
|
16962
|
+
* @returns Parsed swap log or undefined if no PoolSwap event found
|
|
16963
|
+
*/
|
|
16964
|
+
async parseSwapTx(txHash, flETHIsCurrencyZero) {
|
|
16965
|
+
try {
|
|
16966
|
+
// Get transaction to get block number
|
|
16967
|
+
const tx = await this.drift.getTransaction({ hash: txHash });
|
|
16968
|
+
if (!tx) {
|
|
16969
|
+
return undefined;
|
|
16970
|
+
}
|
|
16971
|
+
// Get block to get timestamp
|
|
16972
|
+
const block = await this.drift.getBlock(tx.blockNumber);
|
|
16973
|
+
const timestamp = Number(block?.timestamp) * 1000; // convert to ms for js
|
|
16974
|
+
// Get PoolSwap events from the specific transaction
|
|
16975
|
+
const swapLogs = await this.contract.getEvents("PoolSwap", {
|
|
16976
|
+
fromBlock: tx.blockNumber,
|
|
16977
|
+
toBlock: tx.blockNumber,
|
|
16978
|
+
});
|
|
16979
|
+
// Find the first swap log that matches our transaction hash
|
|
16980
|
+
const targetLog = swapLogs.find((log) => log.transactionHash === txHash);
|
|
16981
|
+
if (!targetLog) {
|
|
16982
|
+
return undefined;
|
|
16983
|
+
}
|
|
16984
|
+
// If flETHIsCurrencyZero is not provided, return basic log
|
|
16985
|
+
if (flETHIsCurrencyZero === undefined) {
|
|
16986
|
+
return {
|
|
16987
|
+
...targetLog,
|
|
16988
|
+
timestamp,
|
|
16989
|
+
};
|
|
16990
|
+
}
|
|
16991
|
+
// Parse the swap data using the utility function
|
|
16992
|
+
const swapData = parseSwapData(targetLog.args, flETHIsCurrencyZero);
|
|
16993
|
+
return {
|
|
16994
|
+
...targetLog,
|
|
16995
|
+
timestamp,
|
|
16996
|
+
type: swapData.type,
|
|
16997
|
+
delta: swapData.delta,
|
|
16998
|
+
};
|
|
16999
|
+
}
|
|
17000
|
+
catch (error) {
|
|
17001
|
+
console.error("Error parsing swap transaction:", error);
|
|
17002
|
+
return undefined;
|
|
17003
|
+
}
|
|
17004
|
+
}
|
|
16144
17005
|
async watchPoolSwap({ onPoolSwap, flETHIsCurrencyZero, startBlockNumber, filterByPoolId, }) {
|
|
16145
17006
|
let intervalId;
|
|
16146
17007
|
if (startBlockNumber !== undefined) {
|
|
@@ -16173,69 +17034,14 @@ class ReadAnyPositionManager {
|
|
|
16173
17034
|
timestamp,
|
|
16174
17035
|
};
|
|
16175
17036
|
}
|
|
16176
|
-
|
|
16177
|
-
const
|
|
16178
|
-
|
|
16179
|
-
|
|
16180
|
-
|
|
16181
|
-
|
|
16182
|
-
|
|
16183
|
-
if (flETHIsCurrencyZero) {
|
|
16184
|
-
swapType = currency0Delta < 0 ? "BUY" : "SELL";
|
|
16185
|
-
feesIsInFLETH = currency0Fees < 0;
|
|
16186
|
-
}
|
|
16187
|
-
else {
|
|
16188
|
-
swapType = currency1Delta < 0 ? "BUY" : "SELL";
|
|
16189
|
-
feesIsInFLETH = currency1Fees < 0;
|
|
16190
|
-
}
|
|
16191
|
-
const absCurrency0Delta = currency0Delta < 0 ? -currency0Delta : currency0Delta;
|
|
16192
|
-
const absCurrency1Delta = currency1Delta < 0 ? -currency1Delta : currency1Delta;
|
|
16193
|
-
const absCurrency0Fees = currency0Fees < 0 ? -currency0Fees : currency0Fees;
|
|
16194
|
-
const absCurrency1Fees = currency1Fees < 0 ? -currency1Fees : currency1Fees;
|
|
16195
|
-
const fees = {
|
|
16196
|
-
isInFLETH: feesIsInFLETH,
|
|
16197
|
-
amount: flETHIsCurrencyZero
|
|
16198
|
-
? feesIsInFLETH
|
|
16199
|
-
? absCurrency0Fees
|
|
16200
|
-
: absCurrency1Fees
|
|
16201
|
-
: feesIsInFLETH
|
|
16202
|
-
? absCurrency1Fees
|
|
16203
|
-
: absCurrency0Fees,
|
|
17037
|
+
// parse swap data
|
|
17038
|
+
const swapData = parseSwapData(log.args, flETHIsCurrencyZero);
|
|
17039
|
+
return {
|
|
17040
|
+
...log,
|
|
17041
|
+
timestamp,
|
|
17042
|
+
type: swapData.type,
|
|
17043
|
+
delta: swapData.delta,
|
|
16204
17044
|
};
|
|
16205
|
-
if (swapType === "BUY") {
|
|
16206
|
-
return {
|
|
16207
|
-
...log,
|
|
16208
|
-
timestamp,
|
|
16209
|
-
type: swapType,
|
|
16210
|
-
delta: {
|
|
16211
|
-
coinsBought: flETHIsCurrencyZero
|
|
16212
|
-
? absCurrency1Delta - (!fees.isInFLETH ? fees.amount : 0n)
|
|
16213
|
-
: absCurrency0Delta -
|
|
16214
|
-
(!fees.isInFLETH ? fees.amount : 0n),
|
|
16215
|
-
flETHSold: flETHIsCurrencyZero
|
|
16216
|
-
? absCurrency0Delta - (fees.isInFLETH ? fees.amount : 0n)
|
|
16217
|
-
: absCurrency1Delta - (fees.isInFLETH ? fees.amount : 0n),
|
|
16218
|
-
fees,
|
|
16219
|
-
},
|
|
16220
|
-
};
|
|
16221
|
-
}
|
|
16222
|
-
else {
|
|
16223
|
-
return {
|
|
16224
|
-
...log,
|
|
16225
|
-
timestamp,
|
|
16226
|
-
type: swapType,
|
|
16227
|
-
delta: {
|
|
16228
|
-
coinsSold: flETHIsCurrencyZero
|
|
16229
|
-
? absCurrency1Delta - (!fees.isInFLETH ? fees.amount : 0n)
|
|
16230
|
-
: absCurrency0Delta -
|
|
16231
|
-
(!fees.isInFLETH ? fees.amount : 0n),
|
|
16232
|
-
flETHBought: flETHIsCurrencyZero
|
|
16233
|
-
? absCurrency0Delta - (fees.isInFLETH ? fees.amount : 0n)
|
|
16234
|
-
: absCurrency1Delta - (fees.isInFLETH ? fees.amount : 0n),
|
|
16235
|
-
fees,
|
|
16236
|
-
},
|
|
16237
|
-
};
|
|
16238
|
-
}
|
|
16239
17045
|
}));
|
|
16240
17046
|
if (logsWithTimestamps.length > 0) {
|
|
16241
17047
|
onPoolSwap({
|
|
@@ -20385,6 +21191,7 @@ class ReadFlaunchSDK {
|
|
|
20385
21191
|
this.readFairLaunchV1_1 = new ReadFairLaunchV1_1(FairLaunchV1_1Address[this.chainId], drift);
|
|
20386
21192
|
this.readBidWall = new ReadBidWall(BidWallAddress[this.chainId], drift);
|
|
20387
21193
|
this.readBidWallV1_1 = new ReadBidWallV1_1(BidWallV1_1Address[this.chainId], drift);
|
|
21194
|
+
this.readAnyBidWall = new AnyBidWall(AnyBidWallAddress[this.chainId], drift);
|
|
20388
21195
|
this.readFlaunch = new ReadFlaunch(FlaunchAddress[this.chainId], drift);
|
|
20389
21196
|
this.readFlaunchV1_1 = new ReadFlaunchV1_1(FlaunchV1_1Address[this.chainId], drift);
|
|
20390
21197
|
this.readQuoter = new ReadQuoter(this.chainId, QuoterAddress[this.chainId], drift);
|
|
@@ -20461,7 +21268,7 @@ class ReadFlaunchSDK {
|
|
|
20461
21268
|
case FlaunchVersion.V1_1:
|
|
20462
21269
|
return this.readBidWallV1_1;
|
|
20463
21270
|
case FlaunchVersion.ANY:
|
|
20464
|
-
return this.
|
|
21271
|
+
return this.readAnyBidWall;
|
|
20465
21272
|
default:
|
|
20466
21273
|
return this.readBidWallV1_1;
|
|
20467
21274
|
}
|
|
@@ -21098,6 +21905,20 @@ class ReadFlaunchSDK {
|
|
|
21098
21905
|
setIPFSResolver(resolverFn) {
|
|
21099
21906
|
this.resolveIPFS = resolverFn;
|
|
21100
21907
|
}
|
|
21908
|
+
/**
|
|
21909
|
+
* Parses a transaction hash to extract PoolSwap events and return parsed swap data
|
|
21910
|
+
* @param params - Object containing parsing parameters
|
|
21911
|
+
* @param params.txHash - The transaction hash to parse
|
|
21912
|
+
* @param params.version - The Flaunch version to use for parsing
|
|
21913
|
+
* @param params.flETHIsCurrencyZero - Whether flETH is currency 0 in the pool (optional)
|
|
21914
|
+
* @returns Parsed swap log or undefined if no PoolSwap event found.
|
|
21915
|
+
* If flETHIsCurrencyZero is provided, returns typed swap data with BUY/SELL information.
|
|
21916
|
+
* If flETHIsCurrencyZero is undefined, returns basic swap log without parsed delta.
|
|
21917
|
+
*/
|
|
21918
|
+
async parseSwapTx(params) {
|
|
21919
|
+
const positionManager = this.getPositionManager(params.version);
|
|
21920
|
+
return positionManager.parseSwapTx(params.txHash, params.flETHIsCurrencyZero);
|
|
21921
|
+
}
|
|
21101
21922
|
}
|
|
21102
21923
|
class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
21103
21924
|
constructor(chainId, drift = createDrift$1()) {
|
|
@@ -21182,6 +22003,22 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
21182
22003
|
}
|
|
21183
22004
|
return this.readWriteFlaunchZap.flaunchIPFSWithRevenueManager(params);
|
|
21184
22005
|
}
|
|
22006
|
+
/**
|
|
22007
|
+
* Creates a new Flaunch that splits the creator fees to the creator and a list of recipients
|
|
22008
|
+
* @param params - Parameters for creating the Flaunch with split manager
|
|
22009
|
+
* @returns Transaction response
|
|
22010
|
+
*/
|
|
22011
|
+
flaunchWithSplitManager(params) {
|
|
22012
|
+
return this.readWriteFlaunchZap.flaunchWithSplitManager(params);
|
|
22013
|
+
}
|
|
22014
|
+
/**
|
|
22015
|
+
* Creates a new Flaunch that splits the creator fees to the creator and a list of recipients, storing the token metadata on IPFS
|
|
22016
|
+
* @param params - Parameters for creating the Flaunch with split manager including all IPFS metadata
|
|
22017
|
+
* @returns Transaction response
|
|
22018
|
+
*/
|
|
22019
|
+
flaunchIPFSWithSplitManager(params) {
|
|
22020
|
+
return this.readWriteFlaunchZap.flaunchIPFSWithSplitManager(params);
|
|
22021
|
+
}
|
|
21185
22022
|
/**
|
|
21186
22023
|
* Creates a new Flaunch with AnyPositionManager for external coins
|
|
21187
22024
|
* @param params - Parameters for creating the Flaunch with AnyPositionManager
|
|
@@ -21424,5 +22261,5 @@ const FlaunchSDK = {
|
|
|
21424
22261
|
ReadWriteFlaunchSDK,
|
|
21425
22262
|
};
|
|
21426
22263
|
|
|
21427
|
-
export { AnyPositionManagerAbi, AnyPositionManagerAddress, BidWallAddress, BidWallV1_1Abi, BidWallV1_1Address, BidwallAbi, FLETHAddress, FLETHHooksAddress, FairLaunchAbi, FairLaunchAddress, FairLaunchV1_1Abi, FairLaunchV1_1Address, FastFlaunchZapAbi, FastFlaunchZapAddress, FeeEscrowAbi, FeeEscrowAddress, FlaunchAbi, FlaunchAddress, FlaunchPositionManagerAbi, FlaunchPositionManagerAddress, FlaunchPositionManagerV1_1Abi, FlaunchPositionManagerV1_1Address, FlaunchSDK, FlaunchV1_1Abi, FlaunchV1_1Address, FlaunchVersion, FlaunchZapAbi, FlaunchZapAddress, InitialPriceAbi, MemecoinAbi, MulticallAbi, Permit2Abi, Permit2Address, PoolManagerAbi, PoolManagerAddress, QuoterAbi, QuoterAddress, ReadFlaunchSDK, ReadWriteFlaunchSDK, ReferralEscrowAbi, ReferralEscrowAddress, RevenueManagerAbi, RevenueManagerAddress, StateViewAbi, StateViewAddress, TICK_SPACING, TickFinder, TreasuryManagerFactoryAbi, TreasuryManagerFactoryAddress, USDCETHPoolKeys, UniversalRouterAbi, UniversalRouterAddress, bytes32ToUint256, calculateUnderlyingTokenBalances, chainIdToChain, createDrift, createFlaunch, generateTokenUri, getPoolId, getSqrtPriceX96FromTick, getValidTick, orderPoolKey, resolveIPFS, uint256ToBytes32, uploadFileToIPFS, uploadImageToIPFS, uploadJsonToIPFS };
|
|
22264
|
+
export { AddressFeeSplitManagerAddress, AnyBidWallAddress, AnyFlaunchAddress, AnyPositionManagerAbi, AnyPositionManagerAddress, BidWallAddress, BidWallV1_1Abi, BidWallV1_1Address, BidwallAbi, FLETHAddress, FLETHHooksAddress, FairLaunchAbi, FairLaunchAddress, FairLaunchV1_1Abi, FairLaunchV1_1Address, FastFlaunchZapAbi, FastFlaunchZapAddress, FeeEscrowAbi, FeeEscrowAddress, FlaunchAbi, FlaunchAddress, FlaunchPositionManagerAbi, FlaunchPositionManagerAddress, FlaunchPositionManagerV1_1Abi, FlaunchPositionManagerV1_1Address, FlaunchSDK, FlaunchV1_1Abi, FlaunchV1_1Address, FlaunchVersion, FlaunchZapAbi, FlaunchZapAddress, InitialPriceAbi, MemecoinAbi, MulticallAbi, Permit2Abi, Permit2Address, PoolManagerAbi, PoolManagerAddress, QuoterAbi, QuoterAddress, ReadFlaunchSDK, ReadWriteFlaunchSDK, ReferralEscrowAbi, ReferralEscrowAddress, RevenueManagerAbi, RevenueManagerAddress, StateViewAbi, StateViewAddress, TICK_SPACING, TickFinder, TreasuryManagerFactoryAbi, TreasuryManagerFactoryAddress, USDCETHPoolKeys, UniversalRouterAbi, UniversalRouterAddress, bytes32ToUint256, calculateUnderlyingTokenBalances, chainIdToChain, createDrift, createFlaunch, generateTokenUri, getPoolId, getSqrtPriceX96FromTick, getValidTick, orderPoolKey, parseSwapData, resolveIPFS, uint256ToBytes32, uploadFileToIPFS, uploadImageToIPFS, uploadJsonToIPFS };
|
|
21428
22265
|
//# sourceMappingURL=index.esm.js.map
|