@flaunch/sdk 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -6929,9 +6929,22 @@ const FlaunchPositionManagerAbi = [
6929
6929
  { stateMutability: "payable", type: "receive" },
6930
6930
  ];
6931
6931
 
6932
+ // List of public IPFS gateways to cycle through
6933
+ const IPFS_GATEWAYS = [
6934
+ "https://gateway.pinata.cloud/ipfs/",
6935
+ "https://ipfs.io/ipfs/",
6936
+ "https://dweb.link/ipfs/",
6937
+ ];
6938
+ // Counter to track the current gateway index
6939
+ let currentGatewayIndex = 0;
6932
6940
  const resolveIPFS = (value) => {
6933
6941
  if (value.startsWith("ipfs://")) {
6934
- return `https://gateway.pinata.cloud/ipfs/${value.slice(7)}`;
6942
+ const cid = value.slice(7);
6943
+ // Get the next gateway and increment the counter
6944
+ const gateway = IPFS_GATEWAYS[currentGatewayIndex];
6945
+ // Update the counter, cycling back to 0 when we reach the end
6946
+ currentGatewayIndex = (currentGatewayIndex + 1) % IPFS_GATEWAYS.length;
6947
+ return `${gateway}${cid}`;
6935
6948
  }
6936
6949
  return value;
6937
6950
  };
@@ -10204,6 +10217,16 @@ class ReadFlaunch {
10204
10217
  _tokenId: tokenId,
10205
10218
  });
10206
10219
  }
10220
+ /**
10221
+ * Gets the memecoin address for a given token ID
10222
+ * @param tokenId - The ID of the token
10223
+ * @returns Promise<Address> - The address of the memecoin
10224
+ */
10225
+ memecoin(tokenId) {
10226
+ return this.contract.read("memecoin", {
10227
+ _tokenId: tokenId,
10228
+ });
10229
+ }
10207
10230
  }
10208
10231
 
10209
10232
  const MemecoinAbi = [
@@ -16326,8 +16349,470 @@ const RevenueManagerAbi = [
16326
16349
  { stateMutability: "payable", type: "receive" },
16327
16350
  ];
16328
16351
 
16352
+ const MulticallAbi = [
16353
+ {
16354
+ inputs: [
16355
+ {
16356
+ components: [
16357
+ {
16358
+ internalType: "address",
16359
+ name: "target",
16360
+ type: "address",
16361
+ },
16362
+ {
16363
+ internalType: "bytes",
16364
+ name: "callData",
16365
+ type: "bytes",
16366
+ },
16367
+ ],
16368
+ internalType: "struct Multicall3.Call[]",
16369
+ name: "calls",
16370
+ type: "tuple[]",
16371
+ },
16372
+ ],
16373
+ name: "aggregate",
16374
+ outputs: [
16375
+ {
16376
+ internalType: "uint256",
16377
+ name: "blockNumber",
16378
+ type: "uint256",
16379
+ },
16380
+ {
16381
+ internalType: "bytes[]",
16382
+ name: "returnData",
16383
+ type: "bytes[]",
16384
+ },
16385
+ ],
16386
+ stateMutability: "payable",
16387
+ type: "function",
16388
+ },
16389
+ {
16390
+ inputs: [
16391
+ {
16392
+ components: [
16393
+ {
16394
+ internalType: "address",
16395
+ name: "target",
16396
+ type: "address",
16397
+ },
16398
+ {
16399
+ internalType: "bool",
16400
+ name: "allowFailure",
16401
+ type: "bool",
16402
+ },
16403
+ {
16404
+ internalType: "bytes",
16405
+ name: "callData",
16406
+ type: "bytes",
16407
+ },
16408
+ ],
16409
+ internalType: "struct Multicall3.Call3[]",
16410
+ name: "calls",
16411
+ type: "tuple[]",
16412
+ },
16413
+ ],
16414
+ name: "aggregate3",
16415
+ outputs: [
16416
+ {
16417
+ components: [
16418
+ {
16419
+ internalType: "bool",
16420
+ name: "success",
16421
+ type: "bool",
16422
+ },
16423
+ {
16424
+ internalType: "bytes",
16425
+ name: "returnData",
16426
+ type: "bytes",
16427
+ },
16428
+ ],
16429
+ internalType: "struct Multicall3.Result[]",
16430
+ name: "returnData",
16431
+ type: "tuple[]",
16432
+ },
16433
+ ],
16434
+ stateMutability: "payable",
16435
+ type: "function",
16436
+ },
16437
+ {
16438
+ inputs: [
16439
+ {
16440
+ components: [
16441
+ {
16442
+ internalType: "address",
16443
+ name: "target",
16444
+ type: "address",
16445
+ },
16446
+ {
16447
+ internalType: "bool",
16448
+ name: "allowFailure",
16449
+ type: "bool",
16450
+ },
16451
+ {
16452
+ internalType: "uint256",
16453
+ name: "value",
16454
+ type: "uint256",
16455
+ },
16456
+ {
16457
+ internalType: "bytes",
16458
+ name: "callData",
16459
+ type: "bytes",
16460
+ },
16461
+ ],
16462
+ internalType: "struct Multicall3.Call3Value[]",
16463
+ name: "calls",
16464
+ type: "tuple[]",
16465
+ },
16466
+ ],
16467
+ name: "aggregate3Value",
16468
+ outputs: [
16469
+ {
16470
+ components: [
16471
+ {
16472
+ internalType: "bool",
16473
+ name: "success",
16474
+ type: "bool",
16475
+ },
16476
+ {
16477
+ internalType: "bytes",
16478
+ name: "returnData",
16479
+ type: "bytes",
16480
+ },
16481
+ ],
16482
+ internalType: "struct Multicall3.Result[]",
16483
+ name: "returnData",
16484
+ type: "tuple[]",
16485
+ },
16486
+ ],
16487
+ stateMutability: "payable",
16488
+ type: "function",
16489
+ },
16490
+ {
16491
+ inputs: [
16492
+ {
16493
+ components: [
16494
+ {
16495
+ internalType: "address",
16496
+ name: "target",
16497
+ type: "address",
16498
+ },
16499
+ {
16500
+ internalType: "bytes",
16501
+ name: "callData",
16502
+ type: "bytes",
16503
+ },
16504
+ ],
16505
+ internalType: "struct Multicall3.Call[]",
16506
+ name: "calls",
16507
+ type: "tuple[]",
16508
+ },
16509
+ ],
16510
+ name: "blockAndAggregate",
16511
+ outputs: [
16512
+ {
16513
+ internalType: "uint256",
16514
+ name: "blockNumber",
16515
+ type: "uint256",
16516
+ },
16517
+ {
16518
+ internalType: "bytes32",
16519
+ name: "blockHash",
16520
+ type: "bytes32",
16521
+ },
16522
+ {
16523
+ components: [
16524
+ {
16525
+ internalType: "bool",
16526
+ name: "success",
16527
+ type: "bool",
16528
+ },
16529
+ {
16530
+ internalType: "bytes",
16531
+ name: "returnData",
16532
+ type: "bytes",
16533
+ },
16534
+ ],
16535
+ internalType: "struct Multicall3.Result[]",
16536
+ name: "returnData",
16537
+ type: "tuple[]",
16538
+ },
16539
+ ],
16540
+ stateMutability: "payable",
16541
+ type: "function",
16542
+ },
16543
+ {
16544
+ inputs: [],
16545
+ name: "getBasefee",
16546
+ outputs: [
16547
+ {
16548
+ internalType: "uint256",
16549
+ name: "basefee",
16550
+ type: "uint256",
16551
+ },
16552
+ ],
16553
+ stateMutability: "view",
16554
+ type: "function",
16555
+ },
16556
+ {
16557
+ inputs: [
16558
+ {
16559
+ internalType: "uint256",
16560
+ name: "blockNumber",
16561
+ type: "uint256",
16562
+ },
16563
+ ],
16564
+ name: "getBlockHash",
16565
+ outputs: [
16566
+ {
16567
+ internalType: "bytes32",
16568
+ name: "blockHash",
16569
+ type: "bytes32",
16570
+ },
16571
+ ],
16572
+ stateMutability: "view",
16573
+ type: "function",
16574
+ },
16575
+ {
16576
+ inputs: [],
16577
+ name: "getBlockNumber",
16578
+ outputs: [
16579
+ {
16580
+ internalType: "uint256",
16581
+ name: "blockNumber",
16582
+ type: "uint256",
16583
+ },
16584
+ ],
16585
+ stateMutability: "view",
16586
+ type: "function",
16587
+ },
16588
+ {
16589
+ inputs: [],
16590
+ name: "getChainId",
16591
+ outputs: [
16592
+ {
16593
+ internalType: "uint256",
16594
+ name: "chainid",
16595
+ type: "uint256",
16596
+ },
16597
+ ],
16598
+ stateMutability: "view",
16599
+ type: "function",
16600
+ },
16601
+ {
16602
+ inputs: [],
16603
+ name: "getCurrentBlockCoinbase",
16604
+ outputs: [
16605
+ {
16606
+ internalType: "address",
16607
+ name: "coinbase",
16608
+ type: "address",
16609
+ },
16610
+ ],
16611
+ stateMutability: "view",
16612
+ type: "function",
16613
+ },
16614
+ {
16615
+ inputs: [],
16616
+ name: "getCurrentBlockDifficulty",
16617
+ outputs: [
16618
+ {
16619
+ internalType: "uint256",
16620
+ name: "difficulty",
16621
+ type: "uint256",
16622
+ },
16623
+ ],
16624
+ stateMutability: "view",
16625
+ type: "function",
16626
+ },
16627
+ {
16628
+ inputs: [],
16629
+ name: "getCurrentBlockGasLimit",
16630
+ outputs: [
16631
+ {
16632
+ internalType: "uint256",
16633
+ name: "gaslimit",
16634
+ type: "uint256",
16635
+ },
16636
+ ],
16637
+ stateMutability: "view",
16638
+ type: "function",
16639
+ },
16640
+ {
16641
+ inputs: [],
16642
+ name: "getCurrentBlockTimestamp",
16643
+ outputs: [
16644
+ {
16645
+ internalType: "uint256",
16646
+ name: "timestamp",
16647
+ type: "uint256",
16648
+ },
16649
+ ],
16650
+ stateMutability: "view",
16651
+ type: "function",
16652
+ },
16653
+ {
16654
+ inputs: [
16655
+ {
16656
+ internalType: "address",
16657
+ name: "addr",
16658
+ type: "address",
16659
+ },
16660
+ ],
16661
+ name: "getEthBalance",
16662
+ outputs: [
16663
+ {
16664
+ internalType: "uint256",
16665
+ name: "balance",
16666
+ type: "uint256",
16667
+ },
16668
+ ],
16669
+ stateMutability: "view",
16670
+ type: "function",
16671
+ },
16672
+ {
16673
+ inputs: [],
16674
+ name: "getLastBlockHash",
16675
+ outputs: [
16676
+ {
16677
+ internalType: "bytes32",
16678
+ name: "blockHash",
16679
+ type: "bytes32",
16680
+ },
16681
+ ],
16682
+ stateMutability: "view",
16683
+ type: "function",
16684
+ },
16685
+ {
16686
+ inputs: [
16687
+ {
16688
+ internalType: "bool",
16689
+ name: "requireSuccess",
16690
+ type: "bool",
16691
+ },
16692
+ {
16693
+ components: [
16694
+ {
16695
+ internalType: "address",
16696
+ name: "target",
16697
+ type: "address",
16698
+ },
16699
+ {
16700
+ internalType: "bytes",
16701
+ name: "callData",
16702
+ type: "bytes",
16703
+ },
16704
+ ],
16705
+ internalType: "struct Multicall3.Call[]",
16706
+ name: "calls",
16707
+ type: "tuple[]",
16708
+ },
16709
+ ],
16710
+ name: "tryAggregate",
16711
+ outputs: [
16712
+ {
16713
+ components: [
16714
+ {
16715
+ internalType: "bool",
16716
+ name: "success",
16717
+ type: "bool",
16718
+ },
16719
+ {
16720
+ internalType: "bytes",
16721
+ name: "returnData",
16722
+ type: "bytes",
16723
+ },
16724
+ ],
16725
+ internalType: "struct Multicall3.Result[]",
16726
+ name: "returnData",
16727
+ type: "tuple[]",
16728
+ },
16729
+ ],
16730
+ stateMutability: "payable",
16731
+ type: "function",
16732
+ },
16733
+ {
16734
+ inputs: [
16735
+ {
16736
+ internalType: "bool",
16737
+ name: "requireSuccess",
16738
+ type: "bool",
16739
+ },
16740
+ {
16741
+ components: [
16742
+ {
16743
+ internalType: "address",
16744
+ name: "target",
16745
+ type: "address",
16746
+ },
16747
+ {
16748
+ internalType: "bytes",
16749
+ name: "callData",
16750
+ type: "bytes",
16751
+ },
16752
+ ],
16753
+ internalType: "struct Multicall3.Call[]",
16754
+ name: "calls",
16755
+ type: "tuple[]",
16756
+ },
16757
+ ],
16758
+ name: "tryBlockAndAggregate",
16759
+ outputs: [
16760
+ {
16761
+ internalType: "uint256",
16762
+ name: "blockNumber",
16763
+ type: "uint256",
16764
+ },
16765
+ {
16766
+ internalType: "bytes32",
16767
+ name: "blockHash",
16768
+ type: "bytes32",
16769
+ },
16770
+ {
16771
+ components: [
16772
+ {
16773
+ internalType: "bool",
16774
+ name: "success",
16775
+ type: "bool",
16776
+ },
16777
+ {
16778
+ internalType: "bytes",
16779
+ name: "returnData",
16780
+ type: "bytes",
16781
+ },
16782
+ ],
16783
+ internalType: "struct Multicall3.Result[]",
16784
+ name: "returnData",
16785
+ type: "tuple[]",
16786
+ },
16787
+ ],
16788
+ stateMutability: "payable",
16789
+ type: "function",
16790
+ },
16791
+ ];
16792
+
16793
+ class ReadMulticall {
16794
+ constructor(drift) {
16795
+ // same address across all chains
16796
+ this.address = "0xcA11bde05977b3631167028862bE2a173976CA11";
16797
+ this.contract = drift.contract({
16798
+ abi: MulticallAbi,
16799
+ address: this.address,
16800
+ });
16801
+ }
16802
+ aggregate3(calls) {
16803
+ return this.contract.simulateWrite("aggregate3", {
16804
+ calls: calls.map((call) => ({
16805
+ target: call.target,
16806
+ allowFailure: true,
16807
+ callData: call.callData,
16808
+ })),
16809
+ });
16810
+ }
16811
+ }
16812
+
16329
16813
  class ReadRevenueManager {
16330
16814
  constructor(address, drift$1 = drift.createDrift()) {
16815
+ this.drift = drift$1;
16331
16816
  this.contract = drift$1.contract({
16332
16817
  abi: RevenueManagerAbi,
16333
16818
  address,
@@ -16350,6 +16835,51 @@ class ReadRevenueManager {
16350
16835
  protocolRecipient() {
16351
16836
  return this.contract.read("protocolRecipient");
16352
16837
  }
16838
+ /**
16839
+ * Gets the total number of tokens managed by the revenue manager
16840
+ * @returns Promise<bigint> - The total count of tokens
16841
+ */
16842
+ async tokensCount() {
16843
+ const nextInternalId = await this.contract.read("nextInternalId");
16844
+ return nextInternalId - 1n;
16845
+ }
16846
+ /**
16847
+ * Gets all tokens created by a specific creator address
16848
+ * @param creator - The address of the creator to query tokens for
16849
+ * @param sortByDesc - Optional boolean to sort tokens in descending order (default: false)
16850
+ * @returns Promise<Array<{flaunch: Address, tokenId: bigint}>> - Array of token objects containing flaunch address and token ID
16851
+ */
16852
+ async allTokensByCreator(creator, sortByDesc = false) {
16853
+ const tokens = await this.contract.read("tokens", {
16854
+ _creator: creator,
16855
+ });
16856
+ if (sortByDesc) {
16857
+ return [...tokens].reverse();
16858
+ }
16859
+ return tokens;
16860
+ }
16861
+ /**
16862
+ * Gets all tokens currently managed by the revenue manager contract
16863
+ * @dev Uses multicall to batch requests for better performance
16864
+ * @param sortByDesc - Optional boolean to sort tokens in descending order (default: false)
16865
+ * @returns Promise<Array<{flaunch: Address, tokenId: bigint}>> - Array of token objects containing flaunch address and token ID
16866
+ */
16867
+ async allTokensInManager(sortByDesc = false) {
16868
+ const count = await this.tokensCount();
16869
+ const multicall = new ReadMulticall(this.drift);
16870
+ let calldatas = Array.from({ length: Number(count) }, (_, i) => this.contract.encodeFunctionData("internalIds", {
16871
+ _internalId: BigInt(i + 1),
16872
+ }));
16873
+ // Reverse the array if sortByDesc is true
16874
+ if (sortByDesc) {
16875
+ calldatas = calldatas.reverse();
16876
+ }
16877
+ const result = await multicall.aggregate3(calldatas.map((calldata) => ({
16878
+ target: this.contract.address,
16879
+ callData: calldata,
16880
+ })));
16881
+ return result.map((r) => this.contract.decodeFunctionReturn("internalIds", r.returnData));
16882
+ }
16353
16883
  }
16354
16884
  class ReadWriteRevenueManager extends ReadRevenueManager {
16355
16885
  constructor(address, drift$1 = drift.createDrift()) {
@@ -17049,6 +17579,7 @@ class ReadFlaunchSDK {
17049
17579
  this.TICK_SPACING = TICK_SPACING;
17050
17580
  this.chainId = chainId;
17051
17581
  this.drift = drift$1;
17582
+ this.resolveIPFS = resolveIPFS;
17052
17583
  this.readPositionManager = new ReadFlaunchPositionManager(FlaunchPositionManagerAddress[this.chainId], drift$1);
17053
17584
  this.readPositionManagerV1_1 = new ReadFlaunchPositionManagerV1_1(FlaunchPositionManagerV1_1Address[this.chainId], drift$1);
17054
17585
  this.readPoolManager = new ReadPoolManager(PoolManagerAddress[this.chainId], drift$1);
@@ -17090,12 +17621,12 @@ class ReadFlaunchSDK {
17090
17621
  const symbol = await memecoin.symbol();
17091
17622
  const tokenURI = await memecoin.tokenURI();
17092
17623
  // get metadata from tokenURI
17093
- const metadata = (await axios__default["default"].get(resolveIPFS(tokenURI))).data;
17624
+ const metadata = (await axios__default["default"].get(this.resolveIPFS(tokenURI))).data;
17094
17625
  return {
17095
17626
  name,
17096
17627
  symbol,
17097
17628
  description: metadata.description ?? "",
17098
- image: metadata.image ? resolveIPFS(metadata.image) : "",
17629
+ image: metadata.image ? this.resolveIPFS(metadata.image) : "",
17099
17630
  external_link: metadata.websiteUrl ?? "",
17100
17631
  collaborators: metadata.collaborators ?? [],
17101
17632
  discordUrl: metadata.discordUrl ?? "",
@@ -17103,6 +17634,103 @@ class ReadFlaunchSDK {
17103
17634
  telegramUrl: metadata.telegramUrl ?? "",
17104
17635
  };
17105
17636
  }
17637
+ /**
17638
+ * Retrieves metadata for a given Flaunch coin using its token ID & Flaunch contract address
17639
+ * @param flaunch - The address of the Flaunch contract
17640
+ * @param tokenId - The token ID of the coin
17641
+ * @returns The coin's metadata including name, symbol, description, and social links
17642
+ */
17643
+ async getCoinMetadataFromTokenId(flaunch, tokenId) {
17644
+ const _flaunch = new ReadFlaunch(flaunch, this.drift);
17645
+ const coinAddress = await _flaunch.memecoin(tokenId);
17646
+ return this.getCoinMetadata(coinAddress);
17647
+ }
17648
+ /**
17649
+ * Retrieves metadata for multiple Flaunch coins using their token IDs & Flaunch contract addresses
17650
+ * @param params - An array of objects containing flaunch contract address and token ID
17651
+ * @param batchSize - Optional, the number of ipfs requests to process in each batch
17652
+ * @param batchDelay - Optional, the delay in milliseconds between batches
17653
+ * @returns An array of objects containing coin address, name, symbol, description, and social links
17654
+ */
17655
+ async getCoinMetadataFromTokenIds(params, batchSize = 9, batchDelay = 500) {
17656
+ const multicall = new ReadMulticall(this.drift);
17657
+ // get coin addresses via multicall
17658
+ const coinAddresses_calldata = params.map((p) => this.readFlaunch.contract.encodeFunctionData("memecoin", {
17659
+ _tokenId: p.tokenId,
17660
+ }));
17661
+ const coinAddresses_result = await multicall.aggregate3(coinAddresses_calldata.map((calldata, i) => ({
17662
+ target: params[i].flaunch,
17663
+ callData: calldata,
17664
+ })));
17665
+ const coinAddresses = coinAddresses_result.map((r) => this.readFlaunch.contract.decodeFunctionReturn("memecoin", r.returnData));
17666
+ /// get coin metadata for each coin address via multicall
17667
+ const coinMetadata_calldata = [];
17668
+ // name, symbol, tokenURI for each coin
17669
+ coinAddresses.forEach(() => {
17670
+ coinMetadata_calldata.push(this.drift.adapter.encodeFunctionData({
17671
+ abi: MemecoinAbi,
17672
+ fn: "name",
17673
+ }));
17674
+ coinMetadata_calldata.push(this.drift.adapter.encodeFunctionData({
17675
+ abi: MemecoinAbi,
17676
+ fn: "symbol",
17677
+ }));
17678
+ coinMetadata_calldata.push(this.drift.adapter.encodeFunctionData({
17679
+ abi: MemecoinAbi,
17680
+ fn: "tokenURI",
17681
+ }));
17682
+ });
17683
+ const coinMetadata_result = await multicall.aggregate3(coinMetadata_calldata.map((calldata, i) => ({
17684
+ target: coinAddresses[Math.floor(i / 3)],
17685
+ callData: calldata,
17686
+ })));
17687
+ // First decode all the results
17688
+ const results = [];
17689
+ for (let i = 0; i < coinAddresses.length; i++) {
17690
+ const name = this.drift.adapter.decodeFunctionReturn({
17691
+ abi: MemecoinAbi,
17692
+ fn: "name",
17693
+ data: coinMetadata_result[i * 3].returnData,
17694
+ });
17695
+ const symbol = this.drift.adapter.decodeFunctionReturn({
17696
+ abi: MemecoinAbi,
17697
+ fn: "symbol",
17698
+ data: coinMetadata_result[i * 3 + 1].returnData,
17699
+ });
17700
+ const tokenURI = this.drift.adapter.decodeFunctionReturn({
17701
+ abi: MemecoinAbi,
17702
+ fn: "tokenURI",
17703
+ data: coinMetadata_result[i * 3 + 2].returnData,
17704
+ });
17705
+ results.push({ name, symbol, tokenURI, coinAddress: coinAddresses[i] });
17706
+ }
17707
+ // Process IPFS requests in batches to avoid rate limiting
17708
+ const processedResults = [];
17709
+ for (let i = 0; i < results.length; i += batchSize) {
17710
+ const batch = results.slice(i, i + batchSize);
17711
+ const batchResults = await Promise.all(batch.map(async ({ name, symbol, tokenURI, coinAddress }) => {
17712
+ const metadata = (await axios__default["default"].get(this.resolveIPFS(tokenURI))).data;
17713
+ return {
17714
+ coinAddress,
17715
+ name,
17716
+ symbol,
17717
+ description: metadata.description ?? "",
17718
+ image: metadata.image ? this.resolveIPFS(metadata.image) : "",
17719
+ external_link: metadata.websiteUrl ?? "",
17720
+ collaborators: metadata.collaborators ?? [],
17721
+ discordUrl: metadata.discordUrl ?? "",
17722
+ twitterUrl: metadata.twitterUrl ?? "",
17723
+ telegramUrl: metadata.telegramUrl ?? "",
17724
+ };
17725
+ }));
17726
+ processedResults.push(...batchResults);
17727
+ // Add a small delay between batches to avoid rate limiting
17728
+ if (i + batchSize < results.length) {
17729
+ await new Promise((resolve) => setTimeout(resolve, batchDelay));
17730
+ }
17731
+ }
17732
+ return processedResults;
17733
+ }
17106
17734
  /**
17107
17735
  * Watches for pool creation events on V1 contracts
17108
17736
  * @param params - Parameters for watching pool creation
@@ -17464,6 +18092,38 @@ class ReadFlaunchSDK {
17464
18092
  const protocolRecipient = await readRevenueManager.protocolRecipient();
17465
18093
  return readRevenueManager.balances(protocolRecipient);
17466
18094
  }
18095
+ /**
18096
+ * Gets the total number of tokens managed by a revenue manager
18097
+ * @param revenueManagerAddress - The address of the revenue manager
18098
+ * @returns Promise<bigint> - The total count of tokens
18099
+ */
18100
+ async revenueManagerTokensCount(revenueManagerAddress) {
18101
+ const readRevenueManager = new ReadRevenueManager(revenueManagerAddress, this.drift);
18102
+ return readRevenueManager.tokensCount();
18103
+ }
18104
+ /**
18105
+ * Gets all tokens created by a specific creator address
18106
+ * @param params - Parameters for querying tokens by creator
18107
+ * @param params.revenueManagerAddress - The address of the revenue manager
18108
+ * @param params.creator - The address of the creator to query tokens for
18109
+ * @param params.sortByDesc - Whether to sort the tokens by descending order
18110
+ * @returns Promise<Array<{flaunch: Address, tokenId: bigint}>> - Array of token objects containing flaunch address and token ID
18111
+ */
18112
+ async revenueManagerAllTokensByCreator(params) {
18113
+ const readRevenueManager = new ReadRevenueManager(params.revenueManagerAddress, this.drift);
18114
+ return readRevenueManager.allTokensByCreator(params.creator, params.sortByDesc);
18115
+ }
18116
+ /**
18117
+ * Gets all tokens currently managed by a revenue manager
18118
+ * @param params - Parameters for querying tokens in manager
18119
+ * @param params.revenueManagerAddress - The address of the revenue manager
18120
+ * @param params.sortByDesc - Optional boolean to sort tokens in descending order (default: false)
18121
+ * @returns Promise<Array<{flaunch: Address, tokenId: bigint}>> - Array of token objects containing flaunch address and token ID
18122
+ */
18123
+ async revenueManagerAllTokensInManager(params) {
18124
+ const readRevenueManager = new ReadRevenueManager(params.revenueManagerAddress, this.drift);
18125
+ return readRevenueManager.allTokensInManager(params.sortByDesc);
18126
+ }
17467
18127
  /**
17468
18128
  * Gets the pool ID for a given coin
17469
18129
  * @param coinAddress - The address of the coin
@@ -17492,6 +18152,14 @@ class ReadFlaunchSDK {
17492
18152
  flETHIsCurrencyZero(coinAddress) {
17493
18153
  return coinAddress > FLETHAddress[this.chainId];
17494
18154
  }
18155
+ /**
18156
+ * Sets a custom IPFS resolver function
18157
+ * @dev this is used to resolve IPFS hash to a gateway URL
18158
+ * @param resolverFn - Custom function to resolve IPFS URIs
18159
+ */
18160
+ setIPFSResolver(resolverFn) {
18161
+ this.resolveIPFS = resolverFn;
18162
+ }
17495
18163
  }
17496
18164
  class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
17497
18165
  constructor(chainId, drift$1 = drift.createDrift()) {