@rareprotocol/rare-cli 0.4.1 → 1.0.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 +616 -46
- package/dist/addresses-BE3luaB3.d.ts +87 -0
- package/dist/batch-listing-Cu5Hoqxs.d.ts +183 -0
- package/dist/client.d.ts +2789 -2122
- package/dist/client.js +12322 -2958
- package/dist/contracts.d.ts +4448 -0
- package/dist/contracts.js +4333 -0
- package/dist/index.js +18569 -3943
- package/dist/utils.d.ts +10 -0
- package/dist/utils.js +554 -0
- package/package.json +55 -9
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Address, Chain } from 'viem';
|
|
2
|
+
|
|
3
|
+
declare const supportedChains: readonly ["mainnet", "sepolia", "base", "base-sepolia"];
|
|
4
|
+
type SupportedChain = (typeof supportedChains)[number];
|
|
5
|
+
declare const viemChains: Record<SupportedChain, Chain>;
|
|
6
|
+
declare const chainIds: Record<SupportedChain, number>;
|
|
7
|
+
declare const defaultRpcUrls: Partial<Record<SupportedChain, string>>;
|
|
8
|
+
type CanonicalV4Pool = {
|
|
9
|
+
currency0: Address;
|
|
10
|
+
currency1: Address;
|
|
11
|
+
fee: number;
|
|
12
|
+
tickSpacing: number;
|
|
13
|
+
hooks: Address;
|
|
14
|
+
poolId?: `0x${string}`;
|
|
15
|
+
};
|
|
16
|
+
type ContractAddresses = {
|
|
17
|
+
factory: Address;
|
|
18
|
+
auction: Address;
|
|
19
|
+
sovereignFactory?: Address;
|
|
20
|
+
lazySovereignFactory?: Address;
|
|
21
|
+
rareMinter?: Address;
|
|
22
|
+
lazyBatchMintFactory?: Address;
|
|
23
|
+
batchListing?: Address;
|
|
24
|
+
batchOfferCreator?: Address;
|
|
25
|
+
batchAuctionHouse?: Address;
|
|
26
|
+
marketplaceSettings?: Address;
|
|
27
|
+
erc20ApprovalManager?: Address;
|
|
28
|
+
erc721ApprovalManager?: Address;
|
|
29
|
+
liquidFactory?: Address;
|
|
30
|
+
swapRouter?: Address;
|
|
31
|
+
v4Quoter?: Address;
|
|
32
|
+
};
|
|
33
|
+
type CanonicalV4Pools = {
|
|
34
|
+
rareEthPool?: CanonicalV4Pool;
|
|
35
|
+
usdcEthPool?: CanonicalV4Pool;
|
|
36
|
+
};
|
|
37
|
+
declare const contractAddresses: Partial<Record<SupportedChain, ContractAddresses>>;
|
|
38
|
+
declare const canonicalV4Pools: Partial<Record<SupportedChain, CanonicalV4Pools>>;
|
|
39
|
+
declare const currencyNames: readonly ["eth", "rare", "usdc"];
|
|
40
|
+
type CurrencyName = (typeof currencyNames)[number];
|
|
41
|
+
type CurrencyInput = CurrencyName | Uppercase<CurrencyName> | Address;
|
|
42
|
+
type CurrencyInfo = {
|
|
43
|
+
name: CurrencyName;
|
|
44
|
+
symbol: Uppercase<CurrencyName>;
|
|
45
|
+
chain: SupportedChain;
|
|
46
|
+
chainId: number;
|
|
47
|
+
address: Address;
|
|
48
|
+
decimals: number;
|
|
49
|
+
isNative: boolean;
|
|
50
|
+
};
|
|
51
|
+
type CustomCurrencyInfo = {
|
|
52
|
+
name: null;
|
|
53
|
+
symbol: null;
|
|
54
|
+
chain: SupportedChain;
|
|
55
|
+
chainId: number;
|
|
56
|
+
address: Address;
|
|
57
|
+
decimals: null;
|
|
58
|
+
isNative: false;
|
|
59
|
+
};
|
|
60
|
+
type ResolvedCurrency = CurrencyInfo | CustomCurrencyInfo;
|
|
61
|
+
type CurrencyResolveResult = {
|
|
62
|
+
isValid: true;
|
|
63
|
+
currency: ResolvedCurrency;
|
|
64
|
+
} | {
|
|
65
|
+
isValid: false;
|
|
66
|
+
error: 'unknown_currency' | 'unavailable_currency';
|
|
67
|
+
errorMessage: string;
|
|
68
|
+
};
|
|
69
|
+
declare const ETH_ADDRESS: Address;
|
|
70
|
+
declare const PUBLIC_LISTING_TARGET: Address;
|
|
71
|
+
declare function listCurrencies(chain: SupportedChain): CurrencyInfo[];
|
|
72
|
+
declare function resolveCurrencyInfo(input: string, chain: SupportedChain): CurrencyResolveResult;
|
|
73
|
+
declare function resolveCurrency(input: string, chain: SupportedChain): Address;
|
|
74
|
+
declare function getContractAddresses(chain: SupportedChain): ContractAddresses;
|
|
75
|
+
declare function getBatchListingAddress(chain: SupportedChain): Address;
|
|
76
|
+
declare function getErc721ApprovalManagerAddress(chain: SupportedChain): Address;
|
|
77
|
+
declare function getCanonicalV4Pools(chain: SupportedChain): CanonicalV4Pools;
|
|
78
|
+
declare function getRareMinterAddress(chain: SupportedChain): Address;
|
|
79
|
+
declare function isSupportedChain(value: string): value is SupportedChain;
|
|
80
|
+
declare function getLiquidFactoryAddress(chain: SupportedChain): Address;
|
|
81
|
+
declare function getSwapRouterAddress(chain: SupportedChain): Address;
|
|
82
|
+
declare function getV4QuoterAddress(chain: SupportedChain): Address;
|
|
83
|
+
declare function getCanonicalRareEthPool(chain: SupportedChain): CanonicalV4Pool;
|
|
84
|
+
declare function getCanonicalUsdcEthPool(chain: SupportedChain): CanonicalV4Pool;
|
|
85
|
+
declare function requireContractAddress(chain: SupportedChain, contractName: keyof ContractAddresses): Address;
|
|
86
|
+
|
|
87
|
+
export { resolveCurrencyInfo as A, supportedChains as B, type CurrencyInput as C, viemChains as D, ETH_ADDRESS as E, PUBLIC_LISTING_TARGET as P, type ResolvedCurrency as R, type SupportedChain as S, type CurrencyInfo as a, type CurrencyName as b, type CustomCurrencyInfo as c, type CanonicalV4Pool as d, type CanonicalV4Pools as e, type ContractAddresses as f, type CurrencyResolveResult as g, canonicalV4Pools as h, chainIds as i, contractAddresses as j, currencyNames as k, defaultRpcUrls as l, getBatchListingAddress as m, getCanonicalRareEthPool as n, getCanonicalUsdcEthPool as o, getCanonicalV4Pools as p, getContractAddresses as q, getErc721ApprovalManagerAddress as r, getLiquidFactoryAddress as s, getRareMinterAddress as t, getSwapRouterAddress as u, getV4QuoterAddress as v, isSupportedChain as w, listCurrencies as x, requireContractAddress as y, resolveCurrency as z };
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { Hash, TransactionReceipt, WalletClient, Hex, Address } from 'viem';
|
|
2
|
+
import { a as CurrencyInfo, c as CustomCurrencyInfo, C as CurrencyInput } from './addresses-BE3luaB3.js';
|
|
3
|
+
|
|
4
|
+
type IntegerInput = bigint | number | string;
|
|
5
|
+
type AmountInput = bigint | number | string;
|
|
6
|
+
type TimestampInput = IntegerInput | Date;
|
|
7
|
+
type WalletAccount = NonNullable<WalletClient['account']>;
|
|
8
|
+
|
|
9
|
+
type ResolvedCurrencyWithDecimals = CurrencyInfo | (Omit<CustomCurrencyInfo, 'decimals'> & {
|
|
10
|
+
decimals: number;
|
|
11
|
+
});
|
|
12
|
+
type TransactionResult = {
|
|
13
|
+
txHash: Hash;
|
|
14
|
+
receipt: TransactionReceipt;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type BatchTokenListInputFormat = 'csv' | 'json';
|
|
18
|
+
type BatchToken = {
|
|
19
|
+
contractAddress: Address;
|
|
20
|
+
tokenId: string;
|
|
21
|
+
chainId?: number;
|
|
22
|
+
};
|
|
23
|
+
type BatchTokenTreeEntry = BatchToken & {
|
|
24
|
+
leaf: Hex;
|
|
25
|
+
proof: Hex[];
|
|
26
|
+
};
|
|
27
|
+
type BatchTokenListArtifact = {
|
|
28
|
+
version: 1;
|
|
29
|
+
type: 'rare-batch-token-list';
|
|
30
|
+
root: Hex;
|
|
31
|
+
count: number;
|
|
32
|
+
chainId?: number;
|
|
33
|
+
tokens: BatchToken[];
|
|
34
|
+
entries: BatchTokenTreeEntry[];
|
|
35
|
+
};
|
|
36
|
+
type BatchTokenProofArtifact = {
|
|
37
|
+
version: 1;
|
|
38
|
+
type: 'rare-batch-token-proof';
|
|
39
|
+
root: Hex;
|
|
40
|
+
contractAddress: Address;
|
|
41
|
+
tokenId: string;
|
|
42
|
+
chainId?: number;
|
|
43
|
+
leaf: Hex;
|
|
44
|
+
proof: Hex[];
|
|
45
|
+
valid: boolean;
|
|
46
|
+
};
|
|
47
|
+
type BuildBatchTokenTreeParams = {
|
|
48
|
+
content: string;
|
|
49
|
+
format?: BatchTokenListInputFormat;
|
|
50
|
+
sourceName?: string;
|
|
51
|
+
chainId?: IntegerInput;
|
|
52
|
+
};
|
|
53
|
+
type BatchTokenProofParams = {
|
|
54
|
+
artifact: BatchTokenListArtifact;
|
|
55
|
+
contractAddress: Address;
|
|
56
|
+
tokenId: IntegerInput;
|
|
57
|
+
chainId?: IntegerInput;
|
|
58
|
+
};
|
|
59
|
+
type BatchTokenProofVerifyParams = {
|
|
60
|
+
root: Hex;
|
|
61
|
+
contractAddress: Address;
|
|
62
|
+
tokenId: IntegerInput;
|
|
63
|
+
proof: readonly Hex[];
|
|
64
|
+
};
|
|
65
|
+
type UtilsTreeArtifact = BatchTokenListArtifact;
|
|
66
|
+
type UtilsTreeProofArtifact = BatchTokenProofArtifact;
|
|
67
|
+
type BuildUtilsTreeParams = BuildBatchTokenTreeParams;
|
|
68
|
+
type UtilsTreeProofParams = BatchTokenProofParams;
|
|
69
|
+
type UtilsTreeProofVerifyParams = BatchTokenProofVerifyParams;
|
|
70
|
+
|
|
71
|
+
type BatchListingTokenEntry = {
|
|
72
|
+
contract: Address;
|
|
73
|
+
tokenId: IntegerInput;
|
|
74
|
+
};
|
|
75
|
+
type BatchListingRootArtifact = {
|
|
76
|
+
root: `0x${string}`;
|
|
77
|
+
currency: Address;
|
|
78
|
+
amount: string;
|
|
79
|
+
splitAddresses: Address[];
|
|
80
|
+
splitRatios: number[];
|
|
81
|
+
tokens: {
|
|
82
|
+
contract: Address;
|
|
83
|
+
tokenId: string;
|
|
84
|
+
}[];
|
|
85
|
+
allowList?: {
|
|
86
|
+
root: `0x${string}`;
|
|
87
|
+
addresses: Address[];
|
|
88
|
+
endTimestamp?: string;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
type BatchListingProofArtifact = {
|
|
92
|
+
root: `0x${string}`;
|
|
93
|
+
contract: Address;
|
|
94
|
+
tokenId: string;
|
|
95
|
+
proof: `0x${string}`[];
|
|
96
|
+
allowListProof?: `0x${string}`[];
|
|
97
|
+
allowListAddress?: Address;
|
|
98
|
+
};
|
|
99
|
+
type UtilsMerkleTokenEntry = BatchListingTokenEntry;
|
|
100
|
+
type UtilsMerkleRootArtifact = BatchListingRootArtifact;
|
|
101
|
+
type UtilsMerkleProofArtifact = BatchListingProofArtifact;
|
|
102
|
+
type UtilsMerkleProofParams = {
|
|
103
|
+
artifact: UtilsMerkleRootArtifact;
|
|
104
|
+
contract: Address;
|
|
105
|
+
tokenId: IntegerInput;
|
|
106
|
+
buyer?: Address;
|
|
107
|
+
};
|
|
108
|
+
type BatchListingCreateParams = {
|
|
109
|
+
artifact: BatchListingRootArtifact;
|
|
110
|
+
autoApprove?: boolean;
|
|
111
|
+
};
|
|
112
|
+
type BatchListingCreateResult = {
|
|
113
|
+
root: `0x${string}`;
|
|
114
|
+
approvalTxHashes?: Hash[];
|
|
115
|
+
} & TransactionResult;
|
|
116
|
+
type BatchListingCancelParams = {
|
|
117
|
+
root?: `0x${string}`;
|
|
118
|
+
artifact?: BatchListingRootArtifact;
|
|
119
|
+
contract?: Address;
|
|
120
|
+
tokenId?: IntegerInput;
|
|
121
|
+
};
|
|
122
|
+
type BatchListingCancelResult = {
|
|
123
|
+
root: `0x${string}`;
|
|
124
|
+
} & TransactionResult;
|
|
125
|
+
type BatchListingBuyParams = {
|
|
126
|
+
proofArtifact?: BatchListingProofArtifact;
|
|
127
|
+
root?: `0x${string}`;
|
|
128
|
+
contract?: Address;
|
|
129
|
+
tokenId?: IntegerInput;
|
|
130
|
+
creator: Address;
|
|
131
|
+
currency: CurrencyInput;
|
|
132
|
+
price: AmountInput;
|
|
133
|
+
autoApprove?: boolean;
|
|
134
|
+
};
|
|
135
|
+
type BatchListingBuyResult = TransactionResult & {
|
|
136
|
+
approvalTxHash?: Hash;
|
|
137
|
+
};
|
|
138
|
+
type BatchListingSetAllowListParams = {
|
|
139
|
+
root?: `0x${string}`;
|
|
140
|
+
artifact?: BatchListingRootArtifact;
|
|
141
|
+
contract?: Address;
|
|
142
|
+
tokenId?: IntegerInput;
|
|
143
|
+
allowListRoot?: `0x${string}`;
|
|
144
|
+
endTime?: TimestampInput;
|
|
145
|
+
};
|
|
146
|
+
type BatchListingSetAllowListResult = {
|
|
147
|
+
root: `0x${string}`;
|
|
148
|
+
allowListRoot: `0x${string}`;
|
|
149
|
+
endTime: bigint;
|
|
150
|
+
} & TransactionResult;
|
|
151
|
+
type BatchListingStatusParams = {
|
|
152
|
+
root?: `0x${string}`;
|
|
153
|
+
creator: Address;
|
|
154
|
+
contract?: Address;
|
|
155
|
+
tokenId?: IntegerInput;
|
|
156
|
+
proof?: `0x${string}`[];
|
|
157
|
+
};
|
|
158
|
+
type BatchListingStatus = {
|
|
159
|
+
root: `0x${string}`;
|
|
160
|
+
seller: Address;
|
|
161
|
+
currencyAddress: Address;
|
|
162
|
+
amount: bigint;
|
|
163
|
+
splitRecipients: Address[];
|
|
164
|
+
splitRatios: number[];
|
|
165
|
+
nonce: bigint;
|
|
166
|
+
isEth: boolean;
|
|
167
|
+
hasListing: boolean;
|
|
168
|
+
allowList?: {
|
|
169
|
+
root: `0x${string}`;
|
|
170
|
+
endTimestamp: bigint;
|
|
171
|
+
};
|
|
172
|
+
tokenInRoot?: boolean;
|
|
173
|
+
tokenNonce?: bigint;
|
|
174
|
+
};
|
|
175
|
+
type BatchListingNamespace = {
|
|
176
|
+
create: (params: BatchListingCreateParams) => Promise<BatchListingCreateResult>;
|
|
177
|
+
cancel: (params: BatchListingCancelParams) => Promise<BatchListingCancelResult>;
|
|
178
|
+
buy: (params: BatchListingBuyParams) => Promise<BatchListingBuyResult>;
|
|
179
|
+
setAllowlist: (params: BatchListingSetAllowListParams) => Promise<BatchListingSetAllowListResult>;
|
|
180
|
+
status: (params: BatchListingStatusParams) => Promise<BatchListingStatus>;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export type { AmountInput as A, BatchTokenListArtifact as B, IntegerInput as I, ResolvedCurrencyWithDecimals as R, TimestampInput as T, UtilsTreeArtifact as U, WalletAccount as W, TransactionResult as a, BatchTokenProofArtifact as b, BatchListingNamespace as c, BuildUtilsTreeParams as d, UtilsTreeProofParams as e, UtilsTreeProofArtifact as f, UtilsTreeProofVerifyParams as g, UtilsMerkleProofParams as h, UtilsMerkleProofArtifact as i, BatchListingBuyParams as j, BatchListingBuyResult as k, BatchListingCancelParams as l, BatchListingCancelResult as m, BatchListingCreateParams as n, BatchListingCreateResult as o, BatchListingProofArtifact as p, BatchListingRootArtifact as q, BatchListingSetAllowListParams as r, BatchListingSetAllowListResult as s, BatchListingStatus as t, BatchListingStatusParams as u, BatchListingTokenEntry as v, UtilsMerkleRootArtifact as w, UtilsMerkleTokenEntry as x };
|