@longdotxyz/shared 0.0.12 → 0.0.13
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/package.json +1 -1
- package/readme.md +66 -21
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -107,14 +107,25 @@ if (auctionResponse.status === 200) {
|
|
|
107
107
|
// Create dynamic auction
|
|
108
108
|
const createResponse = await apiClient.auctions.createDynamicAuction({
|
|
109
109
|
body: {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
chain_id: 8453, // Base
|
|
111
|
+
template_id: 'template_123',
|
|
112
|
+
metadata: {
|
|
113
|
+
token_name: 'My Token',
|
|
114
|
+
token_symbol: 'MTK',
|
|
115
|
+
token_uri: 'ipfs://...',
|
|
116
|
+
migration_duration: 86400,
|
|
117
|
+
migration_beneficiaries: [
|
|
118
|
+
{ address: '0xabc...', percentage: 100 }
|
|
119
|
+
],
|
|
120
|
+
user_address: '0xdef...'
|
|
121
|
+
}
|
|
116
122
|
}
|
|
117
123
|
});
|
|
124
|
+
|
|
125
|
+
if (createResponse.status === 200) {
|
|
126
|
+
const { governance_factory, pool_initializer, liquidity_migrator } = createResponse.body.result;
|
|
127
|
+
console.log('Auction created with factories:', { governance_factory, pool_initializer });
|
|
128
|
+
}
|
|
118
129
|
```
|
|
119
130
|
|
|
120
131
|
### Quote Endpoints (Uniswap V3/V4)
|
|
@@ -141,8 +152,24 @@ if (v4Quote.status === 200) {
|
|
|
141
152
|
console.log(`Gas estimate: ${v4Quote.body.result.gasEstimate}`);
|
|
142
153
|
}
|
|
143
154
|
|
|
155
|
+
// V3 Exact Input Quote
|
|
156
|
+
const v3InputQuote = await apiClient.quotes.v3ExactInputSingle({
|
|
157
|
+
body: {
|
|
158
|
+
chainId: 1,
|
|
159
|
+
tokenIn: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // WETH
|
|
160
|
+
tokenOut: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
|
|
161
|
+
amountIn: '1000000000000000000', // 1 WETH
|
|
162
|
+
fee: 500 // 0.05%
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
if (v3InputQuote.status === 200) {
|
|
167
|
+
console.log(`Output amount: ${v3InputQuote.body.result.amountOut}`);
|
|
168
|
+
console.log(`Price after: ${v3InputQuote.body.result.sqrtPriceX96After}`);
|
|
169
|
+
}
|
|
170
|
+
|
|
144
171
|
// V3 Exact Output Quote
|
|
145
|
-
const
|
|
172
|
+
const v3OutputQuote = await apiClient.quotes.v3ExactOutputSingle({
|
|
146
173
|
body: {
|
|
147
174
|
chainId: 1,
|
|
148
175
|
tokenIn: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // WETH
|
|
@@ -152,8 +179,8 @@ const v3Quote = await apiClient.quotes.v3ExactOutputSingle({
|
|
|
152
179
|
}
|
|
153
180
|
});
|
|
154
181
|
|
|
155
|
-
if (
|
|
156
|
-
console.log(`Input required: ${
|
|
182
|
+
if (v3OutputQuote.status === 200) {
|
|
183
|
+
console.log(`Input required: ${v3OutputQuote.body.result.amountIn}`);
|
|
157
184
|
}
|
|
158
185
|
```
|
|
159
186
|
|
|
@@ -179,22 +206,40 @@ const community = await apiClient.communities.getCommunity({
|
|
|
179
206
|
### IPFS Endpoints
|
|
180
207
|
|
|
181
208
|
```typescript
|
|
182
|
-
//
|
|
183
|
-
const
|
|
209
|
+
// Upload an image to IPFS
|
|
210
|
+
const formData = new FormData();
|
|
211
|
+
formData.append('image', imageFile); // imageFile is a File object
|
|
212
|
+
|
|
213
|
+
const imageUpload = await apiClient.ipfs.uploadImage({
|
|
214
|
+
body: formData
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
if (imageUpload.status === 200) {
|
|
218
|
+
const imageHash = imageUpload.body.result;
|
|
219
|
+
console.log(`Image IPFS hash: ${imageHash}`);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Upload metadata to IPFS
|
|
223
|
+
const metadataUpload = await apiClient.ipfs.uploadMetadata({
|
|
184
224
|
body: {
|
|
185
|
-
name: 'Token
|
|
186
|
-
description: '
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
225
|
+
name: 'My Token',
|
|
226
|
+
description: 'Token description',
|
|
227
|
+
image_hash: imageHash, // From previous upload
|
|
228
|
+
social_links: [
|
|
229
|
+
{ label: 'Twitter', url: 'https://twitter.com/mytoken' },
|
|
230
|
+
{ label: 'Discord', url: 'https://discord.gg/mytoken' }
|
|
231
|
+
],
|
|
232
|
+
vesting_recipients: [
|
|
233
|
+
{ address: '0xabc...', percentage: 50 },
|
|
234
|
+
{ address: '0xdef...', percentage: 50 }
|
|
235
|
+
],
|
|
236
|
+
fee_receiver: '0x123...'
|
|
192
237
|
}
|
|
193
238
|
});
|
|
194
239
|
|
|
195
|
-
if (
|
|
196
|
-
|
|
197
|
-
console.log(`
|
|
240
|
+
if (metadataUpload.status === 200) {
|
|
241
|
+
const metadataHash = metadataUpload.body.result;
|
|
242
|
+
console.log(`Metadata IPFS hash: ${metadataHash}`);
|
|
198
243
|
}
|
|
199
244
|
```
|
|
200
245
|
|