mint-day 0.3.0 → 0.3.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.
@@ -10,7 +10,7 @@ const MINT_FACTORY_ABI = [
10
10
  ];
11
11
  // Deploy blocks per chain to avoid scanning from genesis
12
12
  const DEPLOY_BLOCKS = {
13
- 8453: 28000000, // Base mainnet (approximate, update after deploy)
13
+ 8453: 43460000, // Base mainnet (MintFactory deploy block)
14
14
  84532: 22000000, // Base Sepolia (approximate)
15
15
  };
16
16
  export const mintCheckSchema = {
@@ -128,7 +128,14 @@ export async function handleMintCheck(params, calldataService, provider, contrac
128
128
  const contract = new ethers.Contract(contractAddress, MINT_FACTORY_ABI, provider);
129
129
  const fromBlock = DEPLOY_BLOCKS[chainId] || 0;
130
130
  const filter = contract.filters.Minted(null, address);
131
- const events = await contract.queryFilter(filter, fromBlock, "latest");
131
+ const latestBlock = await provider.getBlockNumber();
132
+ const CHUNK_SIZE = 9999;
133
+ const events = [];
134
+ for (let start = fromBlock; start <= latestBlock; start += CHUNK_SIZE + 1) {
135
+ const end = Math.min(start + CHUNK_SIZE, latestBlock);
136
+ const chunk = await contract.queryFilter(filter, start, end);
137
+ events.push(...chunk);
138
+ }
132
139
  if (events.length === 0) {
133
140
  return {
134
141
  content: [{
@@ -9,7 +9,7 @@ const MINT_FACTORY_ABI = [
9
9
  "function ownerOf(uint256 tokenId) view returns (address)",
10
10
  ];
11
11
  const DEPLOY_BLOCKS = {
12
- 8453: 28000000,
12
+ 8453: 43460000,
13
13
  84532: 22000000,
14
14
  };
15
15
  export const mintResolveSchema = {
@@ -42,9 +42,16 @@ export async function handleMintResolve(params, provider, contractAddress, chain
42
42
  }
43
43
  const contract = new ethers.Contract(contractAddress, MINT_FACTORY_ABI, provider);
44
44
  const fromBlock = DEPLOY_BLOCKS[chainId] || 0;
45
- // Query all Minted events to this address
45
+ // Query all Minted events to this address (chunked to avoid RPC limits)
46
46
  const filter = contract.filters.Minted(null, address);
47
- const events = await contract.queryFilter(filter, fromBlock, "latest");
47
+ const latestBlock = await provider.getBlockNumber();
48
+ const CHUNK_SIZE = 9999;
49
+ const events = [];
50
+ for (let start = fromBlock; start <= latestBlock; start += CHUNK_SIZE + 1) {
51
+ const end = Math.min(start + CHUNK_SIZE, latestBlock);
52
+ const chunk = await contract.queryFilter(filter, start, end);
53
+ events.push(...chunk);
54
+ }
48
55
  // Find Identity tokens (tokenType === 0)
49
56
  let identityEvent = null;
50
57
  for (const event of events) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mint-day",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Agent-native minting on Base. One tool call, any token type.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {