@rareprotocol/rare-cli 1.2.0 → 1.2.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/README.md +21 -10
- package/dist/client.js +213 -205
- package/dist/contracts.js +11 -5
- package/dist/index.js +467 -302
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -53,12 +53,18 @@ var contractAddresses = {
|
|
|
53
53
|
base: {
|
|
54
54
|
factory: getAddress("0xf776204233bfb52ba0ddff24810cbdbf3dbf94dd"),
|
|
55
55
|
auction: getAddress("0x51c36ffb05e17ed80ee5c02fa83d7677c5613de2"),
|
|
56
|
-
rareBridge: getAddress("0x3b41e21094611d152a08d3691a70837f1a077dae")
|
|
56
|
+
rareBridge: getAddress("0x3b41e21094611d152a08d3691a70837f1a077dae"),
|
|
57
|
+
liquidFactory: getAddress("0x54016106A92895a38E54cA286216416750e517b1"),
|
|
58
|
+
swapRouter: getAddress("0x6d078A410ee2AD08cACD8d22b486365433e98b7b"),
|
|
59
|
+
v4Quoter: getAddress("0x0d5e0f971ed27fbff6c2837bf31316121532048d")
|
|
57
60
|
},
|
|
58
61
|
"base-sepolia": {
|
|
59
62
|
factory: getAddress("0x2b181ae0f1aea6fed75591b04991b1a3f9868d51"),
|
|
60
63
|
auction: getAddress("0x1f0c946f0ee87acb268d50ede6c9b4d010af65d2"),
|
|
61
|
-
rareBridge: getAddress("0xca491bb62A7730E97F500510132C47633DDD0229")
|
|
64
|
+
rareBridge: getAddress("0xca491bb62A7730E97F500510132C47633DDD0229"),
|
|
65
|
+
liquidFactory: getAddress("0x912ecC55445d87149d09d83426D0aC41379bB643"),
|
|
66
|
+
swapRouter: getAddress("0x92438008608949E2C7eCef34c474792bAFe8a971"),
|
|
67
|
+
v4Quoter: getAddress("0x4a6513c898fe1b2d0e78d3b0e0a4a151589b1cba")
|
|
62
68
|
}
|
|
63
69
|
};
|
|
64
70
|
var ccipChainSelectors = {
|
|
@@ -4749,7 +4755,7 @@ function createListingNamespace(publicClient, config, chain, addresses) {
|
|
|
4749
4755
|
}
|
|
4750
4756
|
|
|
4751
4757
|
// src/sdk/batch-listing.ts
|
|
4752
|
-
import { isAddressEqual as
|
|
4758
|
+
import { isAddressEqual as isAddressEqual10 } from "viem";
|
|
4753
4759
|
|
|
4754
4760
|
// src/contracts/abis/batch-listing.ts
|
|
4755
4761
|
var batchListingAbi = [
|
|
@@ -5454,10 +5460,158 @@ function uniqueRoots(roots) {
|
|
|
5454
5460
|
}
|
|
5455
5461
|
|
|
5456
5462
|
// src/sdk/batch-listing-core.ts
|
|
5457
|
-
import { isAddressEqual as
|
|
5463
|
+
import { isAddressEqual as isAddressEqual9 } from "viem";
|
|
5464
|
+
|
|
5465
|
+
// src/sdk/merkle-core.ts
|
|
5466
|
+
import { Buffer } from "buffer";
|
|
5467
|
+
import { MerkleTree } from "merkletreejs";
|
|
5468
|
+
import {
|
|
5469
|
+
encodePacked as encodePacked2,
|
|
5470
|
+
getAddress as getAddress6,
|
|
5471
|
+
isAddress as isAddress5,
|
|
5472
|
+
isAddressEqual as isAddressEqual8,
|
|
5473
|
+
isHex as isHex3,
|
|
5474
|
+
keccak256 as keccak2562
|
|
5475
|
+
} from "viem";
|
|
5476
|
+
function hexBuffer(hex) {
|
|
5477
|
+
return Buffer.from(hex.startsWith("0x") ? hex.slice(2) : hex, "hex");
|
|
5478
|
+
}
|
|
5479
|
+
function tokenLeaf(contract, tokenId) {
|
|
5480
|
+
const packed = encodePacked2(["address", "uint256"], [contract, tokenId]);
|
|
5481
|
+
return hexBuffer(keccak2562(packed));
|
|
5482
|
+
}
|
|
5483
|
+
function addressLeaf(address) {
|
|
5484
|
+
return hexBuffer(keccak2562(address));
|
|
5485
|
+
}
|
|
5486
|
+
function parseBytes32(value, field) {
|
|
5487
|
+
if (!isHex3(value, { strict: true }) || value.length !== 66) {
|
|
5488
|
+
throw new Error(`${field} must be a 0x-prefixed bytes32 hex string`);
|
|
5489
|
+
}
|
|
5490
|
+
const normalized = value.toLowerCase();
|
|
5491
|
+
if (!isHex3(normalized, { strict: true }) || normalized.length !== 66) {
|
|
5492
|
+
throw new Error(`${field} must be a 0x-prefixed bytes32 hex string`);
|
|
5493
|
+
}
|
|
5494
|
+
return normalized;
|
|
5495
|
+
}
|
|
5496
|
+
function parseBytes32Array(values, field) {
|
|
5497
|
+
return values.map((value, index) => parseBytes32(value, `${field}[${index}]`));
|
|
5498
|
+
}
|
|
5499
|
+
function compareTokenEntries(a, b) {
|
|
5500
|
+
if (!isAddressEqual8(a.contract, b.contract)) {
|
|
5501
|
+
return a.contract.localeCompare(b.contract);
|
|
5502
|
+
}
|
|
5503
|
+
return a.tokenId.localeCompare(b.tokenId);
|
|
5504
|
+
}
|
|
5505
|
+
function normalizeTokenEntry(token) {
|
|
5506
|
+
if (!isAddress5(token.contract)) {
|
|
5507
|
+
throw new Error(`Invalid token contract address: ${token.contract}`);
|
|
5508
|
+
}
|
|
5509
|
+
return {
|
|
5510
|
+
contract: getAddress6(token.contract),
|
|
5511
|
+
tokenId: String(token.tokenId),
|
|
5512
|
+
tokenIdBigInt: toInteger(token.tokenId, "tokenId")
|
|
5513
|
+
};
|
|
5514
|
+
}
|
|
5515
|
+
function buildBatchListingTree(tokens) {
|
|
5516
|
+
if (tokens.length < 2) {
|
|
5517
|
+
throw new Error("buildBatchListingTree requires at least two tokens");
|
|
5518
|
+
}
|
|
5519
|
+
const sorted = tokens.map(normalizeTokenEntry).sort(compareTokenEntries);
|
|
5520
|
+
const leaves = sorted.map((token) => tokenLeaf(token.contract, token.tokenIdBigInt));
|
|
5521
|
+
const tree = new MerkleTree(leaves, (data) => hexBuffer(keccak2562(data)), {
|
|
5522
|
+
sortPairs: true
|
|
5523
|
+
});
|
|
5524
|
+
return {
|
|
5525
|
+
root: parseBytes32(tree.getHexRoot(), "root"),
|
|
5526
|
+
tree,
|
|
5527
|
+
sortedTokens: sorted.map(({ contract, tokenId }) => ({ contract, tokenId }))
|
|
5528
|
+
};
|
|
5529
|
+
}
|
|
5530
|
+
function buildAllowListTree(addresses) {
|
|
5531
|
+
if (addresses.length < 2) {
|
|
5532
|
+
throw new Error("buildAllowListTree requires at least two addresses");
|
|
5533
|
+
}
|
|
5534
|
+
const sorted = addresses.map((address) => {
|
|
5535
|
+
if (!isAddress5(address)) throw new Error(`Invalid allowlist address: ${address}`);
|
|
5536
|
+
return getAddress6(address);
|
|
5537
|
+
}).sort((a, b) => a.localeCompare(b));
|
|
5538
|
+
const leaves = sorted.map(addressLeaf);
|
|
5539
|
+
const tree = new MerkleTree(leaves, (data) => hexBuffer(keccak2562(data)), {
|
|
5540
|
+
sortPairs: true
|
|
5541
|
+
});
|
|
5542
|
+
return {
|
|
5543
|
+
root: parseBytes32(tree.getHexRoot(), "root"),
|
|
5544
|
+
tree,
|
|
5545
|
+
sortedAddresses: sorted
|
|
5546
|
+
};
|
|
5547
|
+
}
|
|
5548
|
+
function getTokenProof(tree, contract, tokenId) {
|
|
5549
|
+
const leaf = tokenLeaf(getAddress6(contract), tokenId);
|
|
5550
|
+
return parseBytes32Array(tree.getHexProof(leaf), "proof");
|
|
5551
|
+
}
|
|
5552
|
+
function getAddressProof(tree, address) {
|
|
5553
|
+
const leaf = addressLeaf(getAddress6(address));
|
|
5554
|
+
return parseBytes32Array(tree.getHexProof(leaf), "proof");
|
|
5555
|
+
}
|
|
5556
|
+
function buildMerkleProofArtifact(artifact, contract, tokenId, buyer) {
|
|
5557
|
+
const tokenIdBig = toInteger(tokenId, "tokenId");
|
|
5558
|
+
const contractChecksum = getAddress6(contract);
|
|
5559
|
+
const found = artifact.tokens.find(
|
|
5560
|
+
(token) => isAddressEqual8(token.contract, contractChecksum) && BigInt(token.tokenId) === tokenIdBig
|
|
5561
|
+
);
|
|
5562
|
+
if (found === void 0) {
|
|
5563
|
+
throw new Error(
|
|
5564
|
+
`Token ${contractChecksum}/${tokenIdBig.toString()} is not in this root artifact's token set`
|
|
5565
|
+
);
|
|
5566
|
+
}
|
|
5567
|
+
const { tree, root } = buildBatchListingTree(
|
|
5568
|
+
artifact.tokens.map((token) => ({ contract: token.contract, tokenId: token.tokenId }))
|
|
5569
|
+
);
|
|
5570
|
+
const artifactRoot = parseBytes32(artifact.root, "artifact.root");
|
|
5571
|
+
if (root !== artifactRoot) {
|
|
5572
|
+
throw new Error(
|
|
5573
|
+
`Recomputed NFT tree root (${root}) does not match artifact root (${artifact.root}). Artifact is corrupt or tree encoding has drifted.`
|
|
5574
|
+
);
|
|
5575
|
+
}
|
|
5576
|
+
const allowListProofFields = buildAllowListProofFields(artifact, buyer);
|
|
5577
|
+
return {
|
|
5578
|
+
root: artifactRoot,
|
|
5579
|
+
contract: contractChecksum,
|
|
5580
|
+
tokenId: tokenIdBig.toString(),
|
|
5581
|
+
proof: getTokenProof(tree, contractChecksum, tokenIdBig),
|
|
5582
|
+
...allowListProofFields ?? {}
|
|
5583
|
+
};
|
|
5584
|
+
}
|
|
5585
|
+
function buildAllowListProofFields(artifact, buyer) {
|
|
5586
|
+
if (artifact.allowList === void 0) return void 0;
|
|
5587
|
+
if (buyer === void 0) {
|
|
5588
|
+
throw new Error(
|
|
5589
|
+
"This root has an allowlist; pass buyer address to buildMerkleProofArtifact to include allowListProof"
|
|
5590
|
+
);
|
|
5591
|
+
}
|
|
5592
|
+
if (!isAddress5(buyer)) throw new Error(`Invalid buyer address: ${buyer}`);
|
|
5593
|
+
const buyerChecksum = getAddress6(buyer);
|
|
5594
|
+
const inAllowList = artifact.allowList.addresses.some((address) => isAddressEqual8(address, buyerChecksum));
|
|
5595
|
+
if (!inAllowList) {
|
|
5596
|
+
throw new Error(`Buyer ${buyerChecksum} is not in the allowlist`);
|
|
5597
|
+
}
|
|
5598
|
+
const { tree, root } = buildAllowListTree(artifact.allowList.addresses);
|
|
5599
|
+
const artifactAllowListRoot = parseBytes32(artifact.allowList.root, "allowList.root");
|
|
5600
|
+
if (root !== artifactAllowListRoot) {
|
|
5601
|
+
throw new Error(
|
|
5602
|
+
`Recomputed allowlist root (${root}) does not match artifact (${artifact.allowList.root})`
|
|
5603
|
+
);
|
|
5604
|
+
}
|
|
5605
|
+
return {
|
|
5606
|
+
allowListProof: getAddressProof(tree, buyerChecksum),
|
|
5607
|
+
allowListAddress: buyerChecksum
|
|
5608
|
+
};
|
|
5609
|
+
}
|
|
5610
|
+
|
|
5611
|
+
// src/sdk/batch-listing-core.ts
|
|
5458
5612
|
function uniqueAddresses(addresses) {
|
|
5459
5613
|
return addresses.reduce(
|
|
5460
|
-
(unique, address) => unique.some((existing) =>
|
|
5614
|
+
(unique, address) => unique.some((existing) => isAddressEqual9(existing, address)) ? unique : [...unique, address],
|
|
5461
5615
|
[]
|
|
5462
5616
|
);
|
|
5463
5617
|
}
|
|
@@ -5501,7 +5655,7 @@ function shapeBatchListingStatus(params) {
|
|
|
5501
5655
|
splitRecipients: [...params.listingConfig.splitRecipients],
|
|
5502
5656
|
splitRatios: [...params.listingConfig.splitRatios],
|
|
5503
5657
|
nonce: params.listingConfig.nonce,
|
|
5504
|
-
isEth:
|
|
5658
|
+
isEth: isAddressEqual9(params.listingConfig.currency, ETH_ADDRESS),
|
|
5505
5659
|
hasListing,
|
|
5506
5660
|
allowList: params.allowList,
|
|
5507
5661
|
...params.tokenStatus
|
|
@@ -5532,7 +5686,7 @@ function createBatchListingNamespace(publicClient, config, addresses) {
|
|
|
5532
5686
|
functionName: "ownerOf",
|
|
5533
5687
|
args: [BigInt(token.tokenId)]
|
|
5534
5688
|
});
|
|
5535
|
-
if (!
|
|
5689
|
+
if (!isAddressEqual10(owner, accountAddress)) {
|
|
5536
5690
|
throw new Error(
|
|
5537
5691
|
`Token ${token.contract}/${token.tokenId} is owned by ${owner}, not the configured account ${accountAddress}. Re-check the token set before registering this batch listing.`
|
|
5538
5692
|
);
|
|
@@ -5980,7 +6134,7 @@ async function readTokenStatus(publicClient, batchListingAddress, params) {
|
|
|
5980
6134
|
|
|
5981
6135
|
// src/sdk/batch-auction.ts
|
|
5982
6136
|
import {
|
|
5983
|
-
isAddressEqual as
|
|
6137
|
+
isAddressEqual as isAddressEqual12,
|
|
5984
6138
|
parseUnits as parseUnits3,
|
|
5985
6139
|
parseEventLogs as parseEventLogs3
|
|
5986
6140
|
} from "viem";
|
|
@@ -6212,7 +6366,7 @@ var batchAuctionHouseAbi = [
|
|
|
6212
6366
|
];
|
|
6213
6367
|
|
|
6214
6368
|
// src/sdk/batch-auction-core.ts
|
|
6215
|
-
import { isAddressEqual as
|
|
6369
|
+
import { isAddressEqual as isAddressEqual11 } from "viem";
|
|
6216
6370
|
var zeroAddress3 = ETH_ADDRESS;
|
|
6217
6371
|
var marketplaceFeePercentage = 3n;
|
|
6218
6372
|
function planBatchAuctionCreateLocalInputs(params, nowSeconds) {
|
|
@@ -6297,7 +6451,7 @@ function planBatchAuctionStatus(params) {
|
|
|
6297
6451
|
};
|
|
6298
6452
|
}
|
|
6299
6453
|
function shapeBatchAuctionStatus(details, currentBid, rootContext, nowSeconds) {
|
|
6300
|
-
const hasAuction = details.startingTime > 0n && !
|
|
6454
|
+
const hasAuction = details.startingTime > 0n && !isAddressEqual11(details.seller, zeroAddress3);
|
|
6301
6455
|
const hasCurrentRootConfig = rootContext !== void 0 && rootContext.config.duration > 0n && rootContext.rootNonce === rootContext.config.nonce;
|
|
6302
6456
|
const currentRootConfig = hasCurrentRootConfig ? rootContext.config : void 0;
|
|
6303
6457
|
const hasRootConfig = currentRootConfig !== void 0;
|
|
@@ -6305,7 +6459,7 @@ function shapeBatchAuctionStatus(details, currentBid, rootContext, nowSeconds) {
|
|
|
6305
6459
|
const startingTime = hasAuction ? details.startingTime : 0n;
|
|
6306
6460
|
const endTime = hasAuction ? startingTime + duration : null;
|
|
6307
6461
|
const ended = endTime !== null && nowSeconds >= endTime;
|
|
6308
|
-
const currentBidder = currentBid.amount > 0n && !
|
|
6462
|
+
const currentBidder = currentBid.amount > 0n && !isAddressEqual11(currentBid.bidder, zeroAddress3) ? currentBid.bidder : null;
|
|
6309
6463
|
const seller = hasAuction ? details.seller : rootContext?.creator ?? zeroAddress3;
|
|
6310
6464
|
const currency = hasAuction ? details.currency : currentRootConfig?.currency ?? ETH_ADDRESS;
|
|
6311
6465
|
const reserveAmount = hasAuction ? details.reserveAmount : currentRootConfig?.reserveAmount ?? 0n;
|
|
@@ -6340,7 +6494,7 @@ function shapeBatchAuctionStatus(details, currentBid, rootContext, nowSeconds) {
|
|
|
6340
6494
|
hasRootConfig,
|
|
6341
6495
|
tokenNonceConsumed
|
|
6342
6496
|
}),
|
|
6343
|
-
isEth:
|
|
6497
|
+
isEth: isAddressEqual11(currency, ETH_ADDRESS)
|
|
6344
6498
|
};
|
|
6345
6499
|
}
|
|
6346
6500
|
function shapeBatchAuctionDetailsRead(details) {
|
|
@@ -6451,7 +6605,7 @@ function planSplitRecipients(splitAddresses, splitRatios, accountAddress) {
|
|
|
6451
6605
|
};
|
|
6452
6606
|
}
|
|
6453
6607
|
function uniqueAddresses2(addresses) {
|
|
6454
|
-
return addresses.reduce((unique, address) => unique.some((candidate) =>
|
|
6608
|
+
return addresses.reduce((unique, address) => unique.some((candidate) => isAddressEqual11(candidate, address)) ? unique : [...unique, address], []);
|
|
6455
6609
|
}
|
|
6456
6610
|
function addMinimumBidIncrease(amount) {
|
|
6457
6611
|
return amount + amount * marketplaceFeePercentage / 100n;
|
|
@@ -6625,7 +6779,7 @@ function createBatchAuctionNamespace(publicClient, config, chain) {
|
|
|
6625
6779
|
const price = requireInput(resolvedParams.price, "price");
|
|
6626
6780
|
const amount = typeof price === "bigint" ? price : parseUnits3(stringifyAmountInput(price, "price"), await resolveCurrencyDecimals(publicClient, chain, currency));
|
|
6627
6781
|
const plan = planBatchAuctionBid({ ...resolvedParams, currency, price: amount });
|
|
6628
|
-
const erc20ApprovalManager =
|
|
6782
|
+
const erc20ApprovalManager = isAddressEqual12(plan.currency, ETH_ADDRESS) ? batchAuctionHouse : requireContractAddress(chain, "erc20ApprovalManager");
|
|
6629
6783
|
const payment = await preparePaymentAmountForSpender({
|
|
6630
6784
|
publicClient,
|
|
6631
6785
|
walletClient,
|
|
@@ -6984,7 +7138,7 @@ async function resolveRootContext(opts) {
|
|
|
6984
7138
|
|
|
6985
7139
|
// src/sdk/batch-offer.ts
|
|
6986
7140
|
import {
|
|
6987
|
-
isAddressEqual as
|
|
7141
|
+
isAddressEqual as isAddressEqual14,
|
|
6988
7142
|
parseUnits as parseUnits4,
|
|
6989
7143
|
parseEventLogs as parseEventLogs4
|
|
6990
7144
|
} from "viem";
|
|
@@ -7091,7 +7245,7 @@ var batchOfferAbi = [
|
|
|
7091
7245
|
];
|
|
7092
7246
|
|
|
7093
7247
|
// src/sdk/batch-offer-core.ts
|
|
7094
|
-
import { isAddressEqual as
|
|
7248
|
+
import { isAddressEqual as isAddressEqual13 } from "viem";
|
|
7095
7249
|
var zeroAddress4 = ETH_ADDRESS;
|
|
7096
7250
|
var zeroBytes322 = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
7097
7251
|
function planBatchOfferCreateLocalInputs(params, nowSeconds) {
|
|
@@ -7148,7 +7302,7 @@ function planBatchOfferAccept(params, accountAddress) {
|
|
|
7148
7302
|
};
|
|
7149
7303
|
}
|
|
7150
7304
|
function shapeBatchOfferStatus(offer, expected, nowSeconds) {
|
|
7151
|
-
const hasOffer = !
|
|
7305
|
+
const hasOffer = !isAddressEqual13(offer.creator, zeroAddress4) && offer.rootHash !== zeroBytes322 && offer.amount > 0n;
|
|
7152
7306
|
const expired = hasOffer && offer.expiry <= nowSeconds;
|
|
7153
7307
|
const state = !hasOffer ? "NONE" : expired ? "EXPIRED" : "ACTIVE";
|
|
7154
7308
|
return {
|
|
@@ -7163,7 +7317,7 @@ function shapeBatchOfferStatus(offer, expected, nowSeconds) {
|
|
|
7163
7317
|
revoked: hasOffer ? false : null,
|
|
7164
7318
|
fillable: hasOffer && !expired,
|
|
7165
7319
|
state,
|
|
7166
|
-
isEth:
|
|
7320
|
+
isEth: isAddressEqual13(offer.currency, ETH_ADDRESS)
|
|
7167
7321
|
};
|
|
7168
7322
|
}
|
|
7169
7323
|
function shapeBatchOfferRead(value) {
|
|
@@ -7353,7 +7507,7 @@ function createBatchOfferNamespace(publicClient, config, chain) {
|
|
|
7353
7507
|
functionName: "ownerOf",
|
|
7354
7508
|
args: [plan.tokenId]
|
|
7355
7509
|
});
|
|
7356
|
-
if (!
|
|
7510
|
+
if (!isAddressEqual14(owner, accountAddress)) {
|
|
7357
7511
|
throw new Error(`Connected wallet ${accountAddress} does not own token ${plan.contract} #${plan.tokenId.toString()}.`);
|
|
7358
7512
|
}
|
|
7359
7513
|
const approvalTxHash = await approveNftContractIfNeeded({
|
|
@@ -9392,7 +9546,7 @@ var liquidRouterAbi = [
|
|
|
9392
9546
|
];
|
|
9393
9547
|
|
|
9394
9548
|
// src/swap/known-pools.ts
|
|
9395
|
-
import { getAddress as
|
|
9549
|
+
import { getAddress as getAddress7 } from "viem";
|
|
9396
9550
|
|
|
9397
9551
|
// src/swap/pool-core.ts
|
|
9398
9552
|
function normalizeAddress(value) {
|
|
@@ -9411,10 +9565,10 @@ function inferBaseCurrencyAddress(poolKey, token) {
|
|
|
9411
9565
|
|
|
9412
9566
|
// src/swap/known-pools.ts
|
|
9413
9567
|
var wrappedEthAddresses = {
|
|
9414
|
-
mainnet:
|
|
9415
|
-
sepolia:
|
|
9416
|
-
base:
|
|
9417
|
-
"base-sepolia":
|
|
9568
|
+
mainnet: getAddress7("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),
|
|
9569
|
+
sepolia: getAddress7("0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14"),
|
|
9570
|
+
base: getAddress7("0x4200000000000000000000000000000000000006"),
|
|
9571
|
+
"base-sepolia": getAddress7("0x4200000000000000000000000000000000000006")
|
|
9418
9572
|
};
|
|
9419
9573
|
function poolToKey(pool) {
|
|
9420
9574
|
return {
|
|
@@ -9729,8 +9883,8 @@ async function quoteRouteSteps(publicClient, quoterAddress, routeSteps, currentA
|
|
|
9729
9883
|
// src/swap/route-encoding.ts
|
|
9730
9884
|
import {
|
|
9731
9885
|
encodeAbiParameters as encodeAbiParameters2,
|
|
9732
|
-
encodePacked as
|
|
9733
|
-
getAddress as
|
|
9886
|
+
encodePacked as encodePacked3,
|
|
9887
|
+
getAddress as getAddress8,
|
|
9734
9888
|
parseAbiParameters
|
|
9735
9889
|
} from "viem";
|
|
9736
9890
|
var ROUTER_COMMANDS = {
|
|
@@ -9747,8 +9901,8 @@ var V4_ACTIONS = {
|
|
|
9747
9901
|
TAKE_ALL: 15
|
|
9748
9902
|
};
|
|
9749
9903
|
var ROUTER_RECIPIENTS = {
|
|
9750
|
-
msgSender:
|
|
9751
|
-
addressThis:
|
|
9904
|
+
msgSender: getAddress8("0x0000000000000000000000000000000000000001"),
|
|
9905
|
+
addressThis: getAddress8("0x0000000000000000000000000000000000000002")
|
|
9752
9906
|
};
|
|
9753
9907
|
var ROUTER_AMOUNT_CONSTANTS = {
|
|
9754
9908
|
openDelta: 0n,
|
|
@@ -9760,7 +9914,7 @@ function encodeRoute(quote, amountIn, currencyIn, currencyOut) {
|
|
|
9760
9914
|
}
|
|
9761
9915
|
const { commandBytes, inputs } = encodeRouteParts(quote, amountIn, currencyIn, currencyOut, 0);
|
|
9762
9916
|
return {
|
|
9763
|
-
commands:
|
|
9917
|
+
commands: encodePacked3(commandBytes.map(() => "uint8"), [...commandBytes]),
|
|
9764
9918
|
inputs
|
|
9765
9919
|
};
|
|
9766
9920
|
}
|
|
@@ -9891,7 +10045,7 @@ function encodeV4ExactIn({
|
|
|
9891
10045
|
if (singleStep === void 0) {
|
|
9892
10046
|
throw new Error("Missing V4 exact input single step.");
|
|
9893
10047
|
}
|
|
9894
|
-
const actions2 =
|
|
10048
|
+
const actions2 = encodePacked3(
|
|
9895
10049
|
["uint8", "uint8", "uint8"],
|
|
9896
10050
|
[settleAction, V4_ACTIONS.SWAP_EXACT_IN_SINGLE, takeAction]
|
|
9897
10051
|
);
|
|
@@ -9907,7 +10061,7 @@ function encodeV4ExactIn({
|
|
|
9907
10061
|
]
|
|
9908
10062
|
);
|
|
9909
10063
|
}
|
|
9910
|
-
const actions =
|
|
10064
|
+
const actions = encodePacked3(
|
|
9911
10065
|
["uint8", "uint8", "uint8"],
|
|
9912
10066
|
[V4_ACTIONS.SWAP_EXACT_IN, settleAction, takeAction]
|
|
9913
10067
|
);
|
|
@@ -9937,10 +10091,10 @@ function encodeV4ExactInSingle(step, amountIn, minAmountOut) {
|
|
|
9937
10091
|
}
|
|
9938
10092
|
|
|
9939
10093
|
// src/swap/uniswap-api.ts
|
|
9940
|
-
import { getAddress as
|
|
10094
|
+
import { getAddress as getAddress9, isHex as isHex4 } from "viem";
|
|
9941
10095
|
|
|
9942
10096
|
// src/swap/trade-core.ts
|
|
9943
|
-
import { isAddressEqual as
|
|
10097
|
+
import { isAddressEqual as isAddressEqual15 } from "viem";
|
|
9944
10098
|
function toTradeInteger(value, field) {
|
|
9945
10099
|
if (typeof value === "bigint") return value;
|
|
9946
10100
|
if (typeof value === "number") {
|
|
@@ -10008,7 +10162,7 @@ function buildLiquidRouterTradeQuote(params) {
|
|
|
10008
10162
|
}
|
|
10009
10163
|
function getQuotedRecipientAmount(quote, recipient) {
|
|
10010
10164
|
const recipientOutput = quote.aggregatedOutputs?.find(
|
|
10011
|
-
(output) =>
|
|
10165
|
+
(output) => isAddressEqual15(output.recipient, recipient)
|
|
10012
10166
|
);
|
|
10013
10167
|
if (recipientOutput) {
|
|
10014
10168
|
return {
|
|
@@ -10027,7 +10181,7 @@ function assertSupportedUniswapRouting(routing) {
|
|
|
10027
10181
|
}
|
|
10028
10182
|
}
|
|
10029
10183
|
function assertRecipientSupportedForUniswapFallback(recipient, accountAddress) {
|
|
10030
|
-
if (recipient !== void 0 && !
|
|
10184
|
+
if (recipient !== void 0 && !isAddressEqual15(recipient, accountAddress)) {
|
|
10031
10185
|
throw new Error("recipient override is not supported for Uniswap API fallback routes.");
|
|
10032
10186
|
}
|
|
10033
10187
|
}
|
|
@@ -10107,7 +10261,7 @@ function parseNumber(value, field) {
|
|
|
10107
10261
|
function parseAddress2(value, field) {
|
|
10108
10262
|
const raw = parseString(value, field);
|
|
10109
10263
|
try {
|
|
10110
|
-
return
|
|
10264
|
+
return getAddress9(raw);
|
|
10111
10265
|
} catch {
|
|
10112
10266
|
throw new Error(`Uniswap API response field "${field}" must be a valid EVM address.`);
|
|
10113
10267
|
}
|
|
@@ -10117,7 +10271,7 @@ function parseOptionalAddress(value, field) {
|
|
|
10117
10271
|
}
|
|
10118
10272
|
function parseHex(value, field) {
|
|
10119
10273
|
const raw = parseString(value, field);
|
|
10120
|
-
if (!
|
|
10274
|
+
if (!isHex4(raw)) {
|
|
10121
10275
|
throw new Error(`Uniswap API response field "${field}" must be a hex string.`);
|
|
10122
10276
|
}
|
|
10123
10277
|
return raw;
|
|
@@ -10969,7 +11123,7 @@ function createSwapNamespace(config, chain, chainId, addresses) {
|
|
|
10969
11123
|
import {
|
|
10970
11124
|
erc20Abi as erc20Abi2,
|
|
10971
11125
|
hexToBigInt as hexToBigInt2,
|
|
10972
|
-
isAddressEqual as
|
|
11126
|
+
isAddressEqual as isAddressEqual17,
|
|
10973
11127
|
parseEventLogs as parseEventLogs6
|
|
10974
11128
|
} from "viem";
|
|
10975
11129
|
|
|
@@ -11474,11 +11628,11 @@ function toRoyaltyPercentage(value) {
|
|
|
11474
11628
|
|
|
11475
11629
|
// src/sdk/release-core.ts
|
|
11476
11630
|
import {
|
|
11477
|
-
getAddress as
|
|
11478
|
-
isAddress as
|
|
11479
|
-
isAddressEqual as
|
|
11480
|
-
isHex as
|
|
11481
|
-
keccak256 as
|
|
11631
|
+
getAddress as getAddress10,
|
|
11632
|
+
isAddress as isAddress6,
|
|
11633
|
+
isAddressEqual as isAddressEqual16,
|
|
11634
|
+
isHex as isHex5,
|
|
11635
|
+
keccak256 as keccak2563,
|
|
11482
11636
|
parseEther as parseEther2,
|
|
11483
11637
|
parseUnits as parseUnits7
|
|
11484
11638
|
} from "viem";
|
|
@@ -11495,7 +11649,7 @@ function requireRareMinterAddress(address) {
|
|
|
11495
11649
|
}
|
|
11496
11650
|
function assertReleaseContractOwner(opts) {
|
|
11497
11651
|
const { contract, accountAddress, owner } = opts;
|
|
11498
|
-
if (!
|
|
11652
|
+
if (!isAddressEqual16(owner, accountAddress)) {
|
|
11499
11653
|
throw new Error(
|
|
11500
11654
|
`Connected wallet ${accountAddress} is not the owner of collection ${contract}. Contract owner is ${owner}.`
|
|
11501
11655
|
);
|
|
@@ -11684,7 +11838,7 @@ function parseReleaseAllowlistCsv(input) {
|
|
|
11684
11838
|
throw new Error("CSV allowlist is empty.");
|
|
11685
11839
|
}
|
|
11686
11840
|
const headerColumn = findAllowlistAddressColumn(firstRow.fields);
|
|
11687
|
-
if (headerColumn === -1 && !
|
|
11841
|
+
if (headerColumn === -1 && !isAddress6(firstRow.fields[0]?.trim() ?? "")) {
|
|
11688
11842
|
throw new Error("CSV allowlist must put wallet addresses in the first column or include an address/wallet header.");
|
|
11689
11843
|
}
|
|
11690
11844
|
const addressColumn = headerColumn === -1 ? 0 : headerColumn;
|
|
@@ -11743,27 +11897,27 @@ function buildReleaseAllowlistArtifact(wallets) {
|
|
|
11743
11897
|
};
|
|
11744
11898
|
}
|
|
11745
11899
|
function getReleaseAllowlistProof(opts) {
|
|
11746
|
-
const address =
|
|
11900
|
+
const address = getAddress10(opts.address);
|
|
11747
11901
|
return opts.artifact.wallets.find((entry) => addressesEqual(entry.address, address)) ?? null;
|
|
11748
11902
|
}
|
|
11749
11903
|
function verifyReleaseAllowlistProof(opts) {
|
|
11750
11904
|
const root = normalizeBytes322(opts.root, "allowlist root");
|
|
11751
11905
|
const hash = opts.proof.reduce(
|
|
11752
11906
|
(current, sibling) => hashMerklePair(current, normalizeBytes322(sibling, "allowlist proof item")),
|
|
11753
|
-
hashAllowlistAddress(
|
|
11907
|
+
hashAllowlistAddress(getAddress10(opts.address))
|
|
11754
11908
|
);
|
|
11755
11909
|
return hexEquals(hash, root);
|
|
11756
11910
|
}
|
|
11757
11911
|
function preflightReleaseDirectSaleMint(params) {
|
|
11758
11912
|
const { status, plan, buyer, nowSeconds } = params;
|
|
11759
11913
|
const quantity = BigInt(plan.quantity);
|
|
11760
|
-
if (!
|
|
11914
|
+
if (!isAddressEqual16(status.contract, plan.contract)) {
|
|
11761
11915
|
throw new Error(`Release status is for ${status.contract}, but mint plan is for ${plan.contract}.`);
|
|
11762
11916
|
}
|
|
11763
11917
|
if (!status.configured) {
|
|
11764
11918
|
throw new Error("RareMinter direct sale is not configured for this contract.");
|
|
11765
11919
|
}
|
|
11766
|
-
if (plan.recipient !== void 0 && !
|
|
11920
|
+
if (plan.recipient !== void 0 && !isAddressEqual16(plan.recipient, buyer)) {
|
|
11767
11921
|
throw new Error("RareMinter direct sale mint does not support a separate recipient; it mints to the connected wallet.");
|
|
11768
11922
|
}
|
|
11769
11923
|
if (status.startTime > nowSeconds) {
|
|
@@ -11787,7 +11941,7 @@ function preflightReleaseDirectSaleMint(params) {
|
|
|
11787
11941
|
throw new Error("buyer has reached the per-wallet transaction limit.");
|
|
11788
11942
|
}
|
|
11789
11943
|
}
|
|
11790
|
-
if (plan.currency !== void 0 && !
|
|
11944
|
+
if (plan.currency !== void 0 && !isAddressEqual16(plan.currency, status.currencyAddress)) {
|
|
11791
11945
|
throw new Error(`expected currency ${plan.currency} does not match configured currency ${status.currencyAddress}.`);
|
|
11792
11946
|
}
|
|
11793
11947
|
const price = plan.price === void 0 ? status.price : normalizeReleasePrice({
|
|
@@ -11921,11 +12075,11 @@ function requireReleaseAccountCounter(value, label) {
|
|
|
11921
12075
|
return value;
|
|
11922
12076
|
}
|
|
11923
12077
|
function normalizeBytes322(value, field) {
|
|
11924
|
-
if (typeof value !== "string" || !
|
|
12078
|
+
if (typeof value !== "string" || !isHex5(value) || value.length !== 66) {
|
|
11925
12079
|
throw new Error(`${field} must be a 32-byte hex string.`);
|
|
11926
12080
|
}
|
|
11927
12081
|
const normalized = value.toLocaleLowerCase();
|
|
11928
|
-
if (!
|
|
12082
|
+
if (!isHex5(normalized) || normalized.length !== 66) {
|
|
11929
12083
|
throw new Error(`${field} must be a 32-byte hex string.`);
|
|
11930
12084
|
}
|
|
11931
12085
|
return normalized;
|
|
@@ -11995,11 +12149,11 @@ function normalizeAllowlistRows(rows) {
|
|
|
11995
12149
|
throw new Error(`Invalid allowlist address at ${row.label}: expected a string.`);
|
|
11996
12150
|
}
|
|
11997
12151
|
const raw = row.value.trim();
|
|
11998
|
-
if (!
|
|
12152
|
+
if (!isAddress6(raw)) {
|
|
11999
12153
|
throw new Error(`Invalid allowlist address at ${row.label}: "${raw}".`);
|
|
12000
12154
|
}
|
|
12001
|
-
const address =
|
|
12002
|
-
const duplicate = state.seen.find((seen) =>
|
|
12155
|
+
const address = getAddress10(raw);
|
|
12156
|
+
const duplicate = state.seen.find((seen) => isAddressEqual16(seen.address, address));
|
|
12003
12157
|
if (duplicate !== void 0) {
|
|
12004
12158
|
throw new Error(`Duplicate allowlist address at ${row.label}: "${address}" duplicates ${duplicate.label}.`);
|
|
12005
12159
|
}
|
|
@@ -12055,11 +12209,11 @@ function getMerkleRoot(layers) {
|
|
|
12055
12209
|
return root;
|
|
12056
12210
|
}
|
|
12057
12211
|
function hashAllowlistAddress(address) {
|
|
12058
|
-
return
|
|
12212
|
+
return keccak2563(address);
|
|
12059
12213
|
}
|
|
12060
12214
|
function hashMerklePair(a, b) {
|
|
12061
12215
|
const [left, right] = compareHex(a, b) <= 0 ? [a, b] : [b, a];
|
|
12062
|
-
return
|
|
12216
|
+
return keccak2563(`0x${left.slice(2)}${right.slice(2)}`);
|
|
12063
12217
|
}
|
|
12064
12218
|
function compareAddress(a, b) {
|
|
12065
12219
|
return a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase());
|
|
@@ -12068,7 +12222,7 @@ function compareHex(a, b) {
|
|
|
12068
12222
|
return a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase());
|
|
12069
12223
|
}
|
|
12070
12224
|
function addressesEqual(a, b) {
|
|
12071
|
-
return
|
|
12225
|
+
return isAddressEqual16(a, b);
|
|
12072
12226
|
}
|
|
12073
12227
|
function hexEquals(a, b) {
|
|
12074
12228
|
return a.toLocaleLowerCase() === b.toLocaleLowerCase();
|
|
@@ -12323,7 +12477,7 @@ function readMintDirectSaleTokenRange(opts) {
|
|
|
12323
12477
|
eventName: "MintDirectSale",
|
|
12324
12478
|
logs: opts.receipt.logs
|
|
12325
12479
|
}).filter(
|
|
12326
|
-
(log) =>
|
|
12480
|
+
(log) => isAddressEqual17(log.args._contractAddress, opts.contract) && isAddressEqual17(log.args._buyer, opts.buyer)
|
|
12327
12481
|
);
|
|
12328
12482
|
if (event === void 0) {
|
|
12329
12483
|
throw new Error(`MintDirectSale event was not found for ${opts.contract} and buyer ${opts.buyer}.`);
|
|
@@ -13691,152 +13845,6 @@ function contractSupportError(operation, contract, cause) {
|
|
|
13691
13845
|
);
|
|
13692
13846
|
}
|
|
13693
13847
|
|
|
13694
|
-
// src/sdk/merkle-core.ts
|
|
13695
|
-
import { Buffer } from "buffer";
|
|
13696
|
-
import { MerkleTree } from "merkletreejs";
|
|
13697
|
-
import {
|
|
13698
|
-
encodePacked as encodePacked3,
|
|
13699
|
-
getAddress as getAddress10,
|
|
13700
|
-
isAddress as isAddress6,
|
|
13701
|
-
isAddressEqual as isAddressEqual17,
|
|
13702
|
-
isHex as isHex5,
|
|
13703
|
-
keccak256 as keccak2563
|
|
13704
|
-
} from "viem";
|
|
13705
|
-
function hexBuffer(hex) {
|
|
13706
|
-
return Buffer.from(hex.startsWith("0x") ? hex.slice(2) : hex, "hex");
|
|
13707
|
-
}
|
|
13708
|
-
function tokenLeaf(contract, tokenId) {
|
|
13709
|
-
const packed = encodePacked3(["address", "uint256"], [contract, tokenId]);
|
|
13710
|
-
return hexBuffer(keccak2563(packed));
|
|
13711
|
-
}
|
|
13712
|
-
function addressLeaf(address) {
|
|
13713
|
-
return hexBuffer(keccak2563(address));
|
|
13714
|
-
}
|
|
13715
|
-
function parseBytes32(value, field) {
|
|
13716
|
-
if (!isHex5(value, { strict: true }) || value.length !== 66) {
|
|
13717
|
-
throw new Error(`${field} must be a 0x-prefixed bytes32 hex string`);
|
|
13718
|
-
}
|
|
13719
|
-
const normalized = value.toLowerCase();
|
|
13720
|
-
if (!isHex5(normalized, { strict: true }) || normalized.length !== 66) {
|
|
13721
|
-
throw new Error(`${field} must be a 0x-prefixed bytes32 hex string`);
|
|
13722
|
-
}
|
|
13723
|
-
return normalized;
|
|
13724
|
-
}
|
|
13725
|
-
function parseBytes32Array(values, field) {
|
|
13726
|
-
return values.map((value, index) => parseBytes32(value, `${field}[${index}]`));
|
|
13727
|
-
}
|
|
13728
|
-
function compareTokenEntries(a, b) {
|
|
13729
|
-
if (!isAddressEqual17(a.contract, b.contract)) {
|
|
13730
|
-
return a.contract.localeCompare(b.contract);
|
|
13731
|
-
}
|
|
13732
|
-
return a.tokenId.localeCompare(b.tokenId);
|
|
13733
|
-
}
|
|
13734
|
-
function normalizeTokenEntry(token) {
|
|
13735
|
-
if (!isAddress6(token.contract)) {
|
|
13736
|
-
throw new Error(`Invalid token contract address: ${token.contract}`);
|
|
13737
|
-
}
|
|
13738
|
-
return {
|
|
13739
|
-
contract: getAddress10(token.contract),
|
|
13740
|
-
tokenId: String(token.tokenId),
|
|
13741
|
-
tokenIdBigInt: toInteger(token.tokenId, "tokenId")
|
|
13742
|
-
};
|
|
13743
|
-
}
|
|
13744
|
-
function buildBatchListingTree(tokens) {
|
|
13745
|
-
if (tokens.length < 2) {
|
|
13746
|
-
throw new Error("buildBatchListingTree requires at least two tokens");
|
|
13747
|
-
}
|
|
13748
|
-
const sorted = tokens.map(normalizeTokenEntry).sort(compareTokenEntries);
|
|
13749
|
-
const leaves = sorted.map((token) => tokenLeaf(token.contract, token.tokenIdBigInt));
|
|
13750
|
-
const tree = new MerkleTree(leaves, (data) => hexBuffer(keccak2563(data)), {
|
|
13751
|
-
sortPairs: true
|
|
13752
|
-
});
|
|
13753
|
-
return {
|
|
13754
|
-
root: parseBytes32(tree.getHexRoot(), "root"),
|
|
13755
|
-
tree,
|
|
13756
|
-
sortedTokens: sorted.map(({ contract, tokenId }) => ({ contract, tokenId }))
|
|
13757
|
-
};
|
|
13758
|
-
}
|
|
13759
|
-
function buildAllowListTree(addresses) {
|
|
13760
|
-
if (addresses.length < 2) {
|
|
13761
|
-
throw new Error("buildAllowListTree requires at least two addresses");
|
|
13762
|
-
}
|
|
13763
|
-
const sorted = addresses.map((address) => {
|
|
13764
|
-
if (!isAddress6(address)) throw new Error(`Invalid allowlist address: ${address}`);
|
|
13765
|
-
return getAddress10(address);
|
|
13766
|
-
}).sort((a, b) => a.localeCompare(b));
|
|
13767
|
-
const leaves = sorted.map(addressLeaf);
|
|
13768
|
-
const tree = new MerkleTree(leaves, (data) => hexBuffer(keccak2563(data)), {
|
|
13769
|
-
sortPairs: true
|
|
13770
|
-
});
|
|
13771
|
-
return {
|
|
13772
|
-
root: parseBytes32(tree.getHexRoot(), "root"),
|
|
13773
|
-
tree,
|
|
13774
|
-
sortedAddresses: sorted
|
|
13775
|
-
};
|
|
13776
|
-
}
|
|
13777
|
-
function getTokenProof(tree, contract, tokenId) {
|
|
13778
|
-
const leaf = tokenLeaf(getAddress10(contract), tokenId);
|
|
13779
|
-
return parseBytes32Array(tree.getHexProof(leaf), "proof");
|
|
13780
|
-
}
|
|
13781
|
-
function getAddressProof(tree, address) {
|
|
13782
|
-
const leaf = addressLeaf(getAddress10(address));
|
|
13783
|
-
return parseBytes32Array(tree.getHexProof(leaf), "proof");
|
|
13784
|
-
}
|
|
13785
|
-
function buildMerkleProofArtifact(artifact, contract, tokenId, buyer) {
|
|
13786
|
-
const tokenIdBig = toInteger(tokenId, "tokenId");
|
|
13787
|
-
const contractChecksum = getAddress10(contract);
|
|
13788
|
-
const found = artifact.tokens.find(
|
|
13789
|
-
(token) => isAddressEqual17(token.contract, contractChecksum) && BigInt(token.tokenId) === tokenIdBig
|
|
13790
|
-
);
|
|
13791
|
-
if (found === void 0) {
|
|
13792
|
-
throw new Error(
|
|
13793
|
-
`Token ${contractChecksum}/${tokenIdBig.toString()} is not in this root artifact's token set`
|
|
13794
|
-
);
|
|
13795
|
-
}
|
|
13796
|
-
const { tree, root } = buildBatchListingTree(
|
|
13797
|
-
artifact.tokens.map((token) => ({ contract: token.contract, tokenId: token.tokenId }))
|
|
13798
|
-
);
|
|
13799
|
-
const artifactRoot = parseBytes32(artifact.root, "artifact.root");
|
|
13800
|
-
if (root !== artifactRoot) {
|
|
13801
|
-
throw new Error(
|
|
13802
|
-
`Recomputed NFT tree root (${root}) does not match artifact root (${artifact.root}). Artifact is corrupt or tree encoding has drifted.`
|
|
13803
|
-
);
|
|
13804
|
-
}
|
|
13805
|
-
const allowListProofFields = buildAllowListProofFields(artifact, buyer);
|
|
13806
|
-
return {
|
|
13807
|
-
root: artifactRoot,
|
|
13808
|
-
contract: contractChecksum,
|
|
13809
|
-
tokenId: tokenIdBig.toString(),
|
|
13810
|
-
proof: getTokenProof(tree, contractChecksum, tokenIdBig),
|
|
13811
|
-
...allowListProofFields ?? {}
|
|
13812
|
-
};
|
|
13813
|
-
}
|
|
13814
|
-
function buildAllowListProofFields(artifact, buyer) {
|
|
13815
|
-
if (artifact.allowList === void 0) return void 0;
|
|
13816
|
-
if (buyer === void 0) {
|
|
13817
|
-
throw new Error(
|
|
13818
|
-
"This root has an allowlist; pass buyer address to buildMerkleProofArtifact to include allowListProof"
|
|
13819
|
-
);
|
|
13820
|
-
}
|
|
13821
|
-
if (!isAddress6(buyer)) throw new Error(`Invalid buyer address: ${buyer}`);
|
|
13822
|
-
const buyerChecksum = getAddress10(buyer);
|
|
13823
|
-
const inAllowList = artifact.allowList.addresses.some((address) => isAddressEqual17(address, buyerChecksum));
|
|
13824
|
-
if (!inAllowList) {
|
|
13825
|
-
throw new Error(`Buyer ${buyerChecksum} is not in the allowlist`);
|
|
13826
|
-
}
|
|
13827
|
-
const { tree, root } = buildAllowListTree(artifact.allowList.addresses);
|
|
13828
|
-
const artifactAllowListRoot = parseBytes32(artifact.allowList.root, "allowList.root");
|
|
13829
|
-
if (root !== artifactAllowListRoot) {
|
|
13830
|
-
throw new Error(
|
|
13831
|
-
`Recomputed allowlist root (${root}) does not match artifact (${artifact.allowList.root})`
|
|
13832
|
-
);
|
|
13833
|
-
}
|
|
13834
|
-
return {
|
|
13835
|
-
allowListProof: getAddressProof(tree, buyerChecksum),
|
|
13836
|
-
allowListAddress: buyerChecksum
|
|
13837
|
-
};
|
|
13838
|
-
}
|
|
13839
|
-
|
|
13840
13848
|
// src/sdk/utils.ts
|
|
13841
13849
|
function createUtilsNamespace() {
|
|
13842
13850
|
return {
|