@clawnch/clawncher-sdk 2.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 +331 -0
- package/dist/abis.d.ts +935 -0
- package/dist/abis.d.ts.map +1 -0
- package/dist/abis.js +486 -0
- package/dist/abis.js.map +1 -0
- package/dist/addresses.d.ts +45 -0
- package/dist/addresses.d.ts.map +1 -0
- package/dist/addresses.js +72 -0
- package/dist/addresses.js.map +1 -0
- package/dist/deployer.d.ts +255 -0
- package/dist/deployer.d.ts.map +1 -0
- package/dist/deployer.js +397 -0
- package/dist/deployer.js.map +1 -0
- package/dist/erc8004-types.d.ts +94 -0
- package/dist/erc8004-types.d.ts.map +1 -0
- package/dist/erc8004-types.js +8 -0
- package/dist/erc8004-types.js.map +1 -0
- package/dist/index.d.ts +192 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +340 -0
- package/dist/index.js.map +1 -0
- package/dist/molten-types.d.ts +282 -0
- package/dist/molten-types.d.ts.map +1 -0
- package/dist/molten-types.js +8 -0
- package/dist/molten-types.js.map +1 -0
- package/dist/molten.d.ts +336 -0
- package/dist/molten.d.ts.map +1 -0
- package/dist/molten.js +560 -0
- package/dist/molten.js.map +1 -0
- package/dist/reader.d.ts +248 -0
- package/dist/reader.d.ts.map +1 -0
- package/dist/reader.js +487 -0
- package/dist/reader.js.map +1 -0
- package/dist/types.d.ts +244 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/vanity.d.ts +115 -0
- package/dist/vanity.d.ts.map +1 -0
- package/dist/vanity.js +166 -0
- package/dist/vanity.js.map +1 -0
- package/package.json +63 -0
package/dist/reader.d.ts
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ClawnchReader - Read on-chain token data from Clawncher contracts
|
|
3
|
+
*
|
|
4
|
+
* This class provides read-only access to token deployment info, vault allocations,
|
|
5
|
+
* vested dev buy allocations, fee configurations, and reward info.
|
|
6
|
+
*
|
|
7
|
+
* Used by frontends to display token detail pages and admin functionality.
|
|
8
|
+
*/
|
|
9
|
+
import { type PublicClient, type Address, type Chain } from 'viem';
|
|
10
|
+
import { type NetworkName } from './addresses.js';
|
|
11
|
+
/**
|
|
12
|
+
* Vault allocation info
|
|
13
|
+
*/
|
|
14
|
+
export interface VaultAllocation {
|
|
15
|
+
token: Address;
|
|
16
|
+
amountTotal: bigint;
|
|
17
|
+
amountClaimed: bigint;
|
|
18
|
+
lockupEndTime: bigint;
|
|
19
|
+
vestingEndTime: bigint;
|
|
20
|
+
admin: Address;
|
|
21
|
+
/** Amount currently available to claim */
|
|
22
|
+
amountAvailable: bigint;
|
|
23
|
+
/** Whether lockup has ended */
|
|
24
|
+
isUnlocked: boolean;
|
|
25
|
+
/** Whether fully vested */
|
|
26
|
+
isFullyVested: boolean;
|
|
27
|
+
/** Percentage vested (0-100) */
|
|
28
|
+
percentVested: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Vested dev buy allocation info
|
|
32
|
+
*/
|
|
33
|
+
export interface VestedDevBuyAllocation {
|
|
34
|
+
token: Address;
|
|
35
|
+
amountTotal: bigint;
|
|
36
|
+
amountClaimed: bigint;
|
|
37
|
+
lockupEndTime: bigint;
|
|
38
|
+
vestingEndTime: bigint;
|
|
39
|
+
admin: Address;
|
|
40
|
+
/** Amount currently available to claim */
|
|
41
|
+
amountAvailable: bigint;
|
|
42
|
+
/** Whether lockup has ended */
|
|
43
|
+
isUnlocked: boolean;
|
|
44
|
+
/** Whether fully vested */
|
|
45
|
+
isFullyVested: boolean;
|
|
46
|
+
/** Percentage vested (0-100) */
|
|
47
|
+
percentVested: number;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Reward recipient info from LP locker (read result)
|
|
51
|
+
*/
|
|
52
|
+
export interface RewardRecipientInfo {
|
|
53
|
+
recipient: Address;
|
|
54
|
+
admin: Address;
|
|
55
|
+
bps: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Token deployment info
|
|
59
|
+
*/
|
|
60
|
+
export interface TokenDeploymentInfo {
|
|
61
|
+
token: Address;
|
|
62
|
+
hook: Address;
|
|
63
|
+
locker: Address;
|
|
64
|
+
extensions: Address[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Token reward info from LP locker
|
|
68
|
+
*/
|
|
69
|
+
export interface TokenRewardInfo {
|
|
70
|
+
token: Address;
|
|
71
|
+
poolKey: {
|
|
72
|
+
currency0: Address;
|
|
73
|
+
currency1: Address;
|
|
74
|
+
fee: number;
|
|
75
|
+
tickSpacing: number;
|
|
76
|
+
hooks: Address;
|
|
77
|
+
};
|
|
78
|
+
positionId: bigint;
|
|
79
|
+
numPositions: bigint;
|
|
80
|
+
rewardBps: number[];
|
|
81
|
+
rewardAdmins: Address[];
|
|
82
|
+
rewardRecipients: Address[];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* MEV protection config (read result)
|
|
86
|
+
*/
|
|
87
|
+
export interface MevConfigInfo {
|
|
88
|
+
startingFee: number;
|
|
89
|
+
endingFee: number;
|
|
90
|
+
secondsToDecay: bigint;
|
|
91
|
+
poolStartTime: bigint;
|
|
92
|
+
/** Computed: poolStartTime + secondsToDecay */
|
|
93
|
+
decayEndTime: bigint;
|
|
94
|
+
currentFee: number;
|
|
95
|
+
isDecayComplete: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Full token details for UI
|
|
99
|
+
*/
|
|
100
|
+
export interface TokenDetails {
|
|
101
|
+
address: Address;
|
|
102
|
+
name: string;
|
|
103
|
+
symbol: string;
|
|
104
|
+
decimals: number;
|
|
105
|
+
totalSupply: bigint;
|
|
106
|
+
tokenAdmin: Address;
|
|
107
|
+
originalAdmin: Address;
|
|
108
|
+
image: string;
|
|
109
|
+
metadata: string;
|
|
110
|
+
context: string;
|
|
111
|
+
deployment: TokenDeploymentInfo;
|
|
112
|
+
rewards: TokenRewardInfo | null;
|
|
113
|
+
vault: VaultAllocation | null;
|
|
114
|
+
vestedDevBuy: VestedDevBuyAllocation | null;
|
|
115
|
+
mev: MevConfigInfo | null;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Fee info for a wallet across tokens
|
|
119
|
+
*/
|
|
120
|
+
export interface WalletFeeInfo {
|
|
121
|
+
wallet: Address;
|
|
122
|
+
tokens: Array<{
|
|
123
|
+
token: Address;
|
|
124
|
+
symbol: string;
|
|
125
|
+
availableFees: bigint;
|
|
126
|
+
formattedFees: string;
|
|
127
|
+
}>;
|
|
128
|
+
totalWeth: bigint;
|
|
129
|
+
formattedTotalWeth: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Reader configuration
|
|
133
|
+
*/
|
|
134
|
+
export interface ReaderConfig {
|
|
135
|
+
/** Public client for reading chain data */
|
|
136
|
+
publicClient: PublicClient;
|
|
137
|
+
/** Network to read from */
|
|
138
|
+
network: NetworkName;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* ClawnchReader - Read on-chain token data
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```typescript
|
|
145
|
+
* import { ClawnchReader } from '@clawnch/clawncher-sdk';
|
|
146
|
+
* import { createPublicClient, http } from 'viem';
|
|
147
|
+
* import { baseSepolia } from 'viem/chains';
|
|
148
|
+
*
|
|
149
|
+
* const publicClient = createPublicClient({
|
|
150
|
+
* chain: baseSepolia,
|
|
151
|
+
* transport: http(),
|
|
152
|
+
* });
|
|
153
|
+
*
|
|
154
|
+
* const reader = new ClawnchReader({
|
|
155
|
+
* publicClient,
|
|
156
|
+
* network: 'sepolia',
|
|
157
|
+
* });
|
|
158
|
+
*
|
|
159
|
+
* // Get full token details
|
|
160
|
+
* const details = await reader.getTokenDetails('0x...');
|
|
161
|
+
*
|
|
162
|
+
* // Get vault allocation
|
|
163
|
+
* const vault = await reader.getVaultAllocation('0x...');
|
|
164
|
+
*
|
|
165
|
+
* // Get vested dev buy allocation
|
|
166
|
+
* const vested = await reader.getVestedDevBuyAllocation('0x...');
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
export declare class ClawnchReader {
|
|
170
|
+
readonly publicClient: PublicClient;
|
|
171
|
+
readonly network: NetworkName;
|
|
172
|
+
constructor(config: ReaderConfig);
|
|
173
|
+
/**
|
|
174
|
+
* Get contract addresses for configured network
|
|
175
|
+
*/
|
|
176
|
+
getAddresses(): import("./addresses.js").NetworkAddresses;
|
|
177
|
+
/**
|
|
178
|
+
* Get the chain for the configured network
|
|
179
|
+
*/
|
|
180
|
+
getChain(): Chain;
|
|
181
|
+
/**
|
|
182
|
+
* Get basic ERC20 token info
|
|
183
|
+
*/
|
|
184
|
+
getTokenInfo(token: Address): Promise<{
|
|
185
|
+
name: string;
|
|
186
|
+
symbol: string;
|
|
187
|
+
decimals: number;
|
|
188
|
+
totalSupply: bigint;
|
|
189
|
+
}>;
|
|
190
|
+
/**
|
|
191
|
+
* Get Clawncher token metadata using allData() single call
|
|
192
|
+
*
|
|
193
|
+
* Returns originalAdmin, admin, imageUrl, metadata, context in one RPC call.
|
|
194
|
+
*/
|
|
195
|
+
getTokenMetadata(token: Address): Promise<{
|
|
196
|
+
tokenAdmin: Address;
|
|
197
|
+
originalAdmin: Address;
|
|
198
|
+
image: string;
|
|
199
|
+
metadata: string;
|
|
200
|
+
context: string;
|
|
201
|
+
}>;
|
|
202
|
+
/**
|
|
203
|
+
* Get token deployment info from factory
|
|
204
|
+
*/
|
|
205
|
+
getDeploymentInfo(token: Address): Promise<TokenDeploymentInfo | null>;
|
|
206
|
+
/**
|
|
207
|
+
* Get vault allocation for a token
|
|
208
|
+
*/
|
|
209
|
+
getVaultAllocation(token: Address): Promise<VaultAllocation | null>;
|
|
210
|
+
/**
|
|
211
|
+
* Get vested dev buy allocation for a token
|
|
212
|
+
*/
|
|
213
|
+
getVestedDevBuyAllocation(token: Address): Promise<VestedDevBuyAllocation | null>;
|
|
214
|
+
/**
|
|
215
|
+
* Get token reward info (recipients, positions) from LP locker
|
|
216
|
+
*/
|
|
217
|
+
getTokenRewards(token: Address): Promise<TokenRewardInfo | null>;
|
|
218
|
+
/**
|
|
219
|
+
* Get available fees for a wallet on a specific token
|
|
220
|
+
*/
|
|
221
|
+
getAvailableFees(wallet: Address, token: Address): Promise<bigint>;
|
|
222
|
+
/**
|
|
223
|
+
* Get all available fees for a wallet across multiple tokens
|
|
224
|
+
*/
|
|
225
|
+
getWalletFees(wallet: Address, tokens: Address[]): Promise<WalletFeeInfo>;
|
|
226
|
+
/**
|
|
227
|
+
* Get MEV protection config for a pool by its poolId (bytes32)
|
|
228
|
+
*
|
|
229
|
+
* Use `getMevConfigForToken()` if you have a token address instead of poolId.
|
|
230
|
+
*/
|
|
231
|
+
getMevConfig(poolId: `0x${string}`): Promise<MevConfigInfo | null>;
|
|
232
|
+
/**
|
|
233
|
+
* Get MEV protection config for a token (resolves poolId via LP locker first)
|
|
234
|
+
*/
|
|
235
|
+
getMevConfigForToken(token: Address): Promise<MevConfigInfo | null>;
|
|
236
|
+
/**
|
|
237
|
+
* Get complete token details for UI display
|
|
238
|
+
*
|
|
239
|
+
* Combines basic token info, deployment info, vault, vested dev buy,
|
|
240
|
+
* reward recipients, and MEV config into a single response.
|
|
241
|
+
*/
|
|
242
|
+
getTokenDetails(token: Address): Promise<TokenDetails | null>;
|
|
243
|
+
/**
|
|
244
|
+
* Check if a token was deployed via Clawncher
|
|
245
|
+
*/
|
|
246
|
+
isClawnchToken(token: Address): Promise<boolean>;
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../src/reader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,KAAK,EAEX,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