@rareprotocol/rare-cli 1.0.2 → 1.2.0
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 +31 -2
- package/dist/{addresses-BE3luaB3.d.ts → addresses-CcGI_7v1.d.ts} +5 -1
- package/dist/{batch-listing-Cu5Hoqxs.d.ts → batch-listing-C1CtPTD5.d.ts} +1 -1
- package/dist/client.d.ts +56 -5
- package/dist/client.js +1213 -462
- package/dist/contracts.d.ts +90 -2
- package/dist/contracts.js +140 -3
- package/dist/index.js +4434 -2986
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +11 -5
- package/package.json +4 -2
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { h as UtilsMerkleProofParams, i as UtilsMerkleProofArtifact, d as BuildUtilsTreeParams, U as UtilsTreeArtifact, e as UtilsTreeProofParams, f as UtilsTreeProofArtifact, g as UtilsTreeProofVerifyParams } from './batch-listing-
|
|
1
|
+
import { h as UtilsMerkleProofParams, i as UtilsMerkleProofArtifact, d as BuildUtilsTreeParams, U as UtilsTreeArtifact, e as UtilsTreeProofParams, f as UtilsTreeProofArtifact, g as UtilsTreeProofVerifyParams } from './batch-listing-C1CtPTD5.js';
|
|
2
2
|
import 'viem';
|
|
3
|
-
import './addresses-
|
|
3
|
+
import './addresses-CcGI_7v1.js';
|
|
4
4
|
|
|
5
5
|
declare function buildUtilsTree(params: BuildUtilsTreeParams): UtilsTreeArtifact;
|
|
6
6
|
declare function getUtilsTreeProof(params: UtilsTreeProofParams): UtilsTreeProofArtifact;
|
package/dist/utils.js
CHANGED
|
@@ -415,10 +415,14 @@ function addressLeaf(address) {
|
|
|
415
415
|
return hexBuffer(keccak2562(address));
|
|
416
416
|
}
|
|
417
417
|
function parseBytes32(value, field) {
|
|
418
|
-
if (!isHex2(value) || value.length !== 66) {
|
|
418
|
+
if (!isHex2(value, { strict: true }) || value.length !== 66) {
|
|
419
419
|
throw new Error(`${field} must be a 0x-prefixed bytes32 hex string`);
|
|
420
420
|
}
|
|
421
|
-
|
|
421
|
+
const normalized = value.toLowerCase();
|
|
422
|
+
if (!isHex2(normalized, { strict: true }) || normalized.length !== 66) {
|
|
423
|
+
throw new Error(`${field} must be a 0x-prefixed bytes32 hex string`);
|
|
424
|
+
}
|
|
425
|
+
return normalized;
|
|
422
426
|
}
|
|
423
427
|
function parseBytes32Array(values, field) {
|
|
424
428
|
return values.map((value, index) => parseBytes32(value, `${field}[${index}]`));
|
|
@@ -494,14 +498,15 @@ function buildMerkleProofArtifact(artifact, contract, tokenId, buyer) {
|
|
|
494
498
|
const { tree, root } = buildBatchListingTree(
|
|
495
499
|
artifact.tokens.map((token) => ({ contract: token.contract, tokenId: token.tokenId }))
|
|
496
500
|
);
|
|
497
|
-
|
|
501
|
+
const artifactRoot = parseBytes32(artifact.root, "artifact.root");
|
|
502
|
+
if (root !== artifactRoot) {
|
|
498
503
|
throw new Error(
|
|
499
504
|
`Recomputed NFT tree root (${root}) does not match artifact root (${artifact.root}). Artifact is corrupt or tree encoding has drifted.`
|
|
500
505
|
);
|
|
501
506
|
}
|
|
502
507
|
const allowListProofFields = buildAllowListProofFields(artifact, buyer);
|
|
503
508
|
return {
|
|
504
|
-
root:
|
|
509
|
+
root: artifactRoot,
|
|
505
510
|
contract: contractChecksum,
|
|
506
511
|
tokenId: tokenIdBig.toString(),
|
|
507
512
|
proof: getTokenProof(tree, contractChecksum, tokenIdBig),
|
|
@@ -522,7 +527,8 @@ function buildAllowListProofFields(artifact, buyer) {
|
|
|
522
527
|
throw new Error(`Buyer ${buyerChecksum} is not in the allowlist`);
|
|
523
528
|
}
|
|
524
529
|
const { tree, root } = buildAllowListTree(artifact.allowList.addresses);
|
|
525
|
-
|
|
530
|
+
const artifactAllowListRoot = parseBytes32(artifact.allowList.root, "allowList.root");
|
|
531
|
+
if (root !== artifactAllowListRoot) {
|
|
526
532
|
throw new Error(
|
|
527
533
|
`Recomputed allowlist root (${root}) does not match artifact (${artifact.allowList.root})`
|
|
528
534
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rareprotocol/rare-cli",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "CLI tool for interacting with the RARE protocol smart contracts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -79,10 +79,12 @@
|
|
|
79
79
|
"prepublishOnly": "npm run build"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
82
83
|
"commander": "12.1.0",
|
|
83
84
|
"merkletreejs": "0.6.0",
|
|
84
85
|
"openapi-fetch": "0.17.0",
|
|
85
|
-
"viem": "2.48.8"
|
|
86
|
+
"viem": "2.48.8",
|
|
87
|
+
"zod": "^4.4.3"
|
|
86
88
|
},
|
|
87
89
|
"devDependencies": {
|
|
88
90
|
"@docusaurus/core": "^3.10.1",
|