@priors/mcp 0.13.0 → 0.14.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/CHANGELOG.md +42 -0
- package/README.md +74 -7
- package/deployments/stock-zap.4663.json +520 -0
- package/package.json +1 -1
- package/src/pt-usdg.mjs +22 -17
- package/src/server.mjs +75 -8
- package/src/stock-tools.mjs +182 -0
- package/src/stock-trade.mjs +361 -0
- package/src/stock-zap.mjs +299 -0
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_what": "Stock tokens bought with USDG in Go mode (web/account-zap.js, SITE_ZAP=on) and the gas gate's STOCK_ZAP rule (gas-worker/gate.mjs through sdk/stock-zap.mjs): the contracts, the bounds of one buy, and each offered token's pinned pools, chosen from the market scout's scan by docs/STOCK-ZAP-SPEC.md 7.2 (scripts/stock-zap-pools.mjs writes this file and web/zap-pools.js). A v3 pool is swapped through Uniswap's SwapRouter02 (multicall(deadline, [exactInputSingle])), a v4 pool through Priors' V4SwapOnce; the USDG approval is exactly the amount swapped, and the tokens go to the account itself. A token in notOffered has no pool deep enough: the page keeps its Uniswap link.",
|
|
3
|
+
"chainId": 4663,
|
|
4
|
+
"usdg": "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
|
|
5
|
+
"registry": "0xe10b6f6b275de231345c20d14ab812db62151b00",
|
|
6
|
+
"v4": {
|
|
7
|
+
"poolManager": "0x8366a39CC670B4001A1121B8F6A443A643e40951",
|
|
8
|
+
"swapper": "0x7Cd4E04E433E69e588728c86A3832753B5F846d4",
|
|
9
|
+
"quoter": "0x8dc178efb8111bb0973dd9d722ebeff267c98f94",
|
|
10
|
+
"stateView": "0xf3334192d15450cdd385c8b70e03f9a6bd9e673b"
|
|
11
|
+
},
|
|
12
|
+
"v3": {
|
|
13
|
+
"router": "0xCaf681a66D020601342297493863E78C959E5cb2",
|
|
14
|
+
"quoter": "0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7",
|
|
15
|
+
"factory": "0x1f7d7550B1b028f7571E69A784071F0205FD2EfA"
|
|
16
|
+
},
|
|
17
|
+
"minUsdgPerOp": "1000000",
|
|
18
|
+
"maxUsdgPerOp": "1000000000",
|
|
19
|
+
"slippageBps": [
|
|
20
|
+
50,
|
|
21
|
+
100,
|
|
22
|
+
200
|
|
23
|
+
],
|
|
24
|
+
"defaultSlippageBps": 100,
|
|
25
|
+
"maxSlippageBps": 200,
|
|
26
|
+
"deadlineS": 900,
|
|
27
|
+
"maxDeadlineS": 1800,
|
|
28
|
+
"impactWarnBps": 100,
|
|
29
|
+
"impactStopBps": 300,
|
|
30
|
+
"scan": {
|
|
31
|
+
"block": 90176571,
|
|
32
|
+
"at": "2026-10-16T15:14:19Z",
|
|
33
|
+
"rule": "7.2"
|
|
34
|
+
},
|
|
35
|
+
"tokens": [
|
|
36
|
+
{
|
|
37
|
+
"symbol": "AAPL",
|
|
38
|
+
"token": "0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9",
|
|
39
|
+
"pools": [
|
|
40
|
+
{
|
|
41
|
+
"v": 3,
|
|
42
|
+
"fee": 500,
|
|
43
|
+
"pool": "0xAae0d815EE56e4092a5E5C2911E676Fea50B2d6D"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"v": 4,
|
|
47
|
+
"fee": 3000,
|
|
48
|
+
"tickSpacing": 60,
|
|
49
|
+
"id": "0xc748f4671a867db48b552f6b7650bf3255e05f80f00e3f7aad1b17ccb7898fdb"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"v": 3,
|
|
53
|
+
"fee": 3000,
|
|
54
|
+
"pool": "0x783C9bbB765047CFdD2b84b92b2Ca9F11D34b7Ed"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"symbol": "AMD",
|
|
60
|
+
"token": "0x86923f96303D656E4aa86D9d42D1e57ad2023fdC",
|
|
61
|
+
"pools": [
|
|
62
|
+
{
|
|
63
|
+
"v": 3,
|
|
64
|
+
"fee": 3000,
|
|
65
|
+
"pool": "0x48D284A2A4d3DC1b3Da08231Fe44317e7e7Aa51f"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"symbol": "AMZN",
|
|
71
|
+
"token": "0x12f190a9F9d7D37a250758b26824B97CE941bF54",
|
|
72
|
+
"pools": [
|
|
73
|
+
{
|
|
74
|
+
"v": 3,
|
|
75
|
+
"fee": 3000,
|
|
76
|
+
"pool": "0x8AC92DA74AB5F3b1d024Dc1943Ad7e15Dc4179Ef"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"v": 4,
|
|
80
|
+
"fee": 2400,
|
|
81
|
+
"tickSpacing": 24,
|
|
82
|
+
"id": "0xefc94885c96b02696b9b45de43eeeb8ac53c0199cab42b4daae4911b96fb8825"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"symbol": "ASML",
|
|
88
|
+
"token": "0x47F93d52cBeC7C6D2CfC080e154002370a60dAEA",
|
|
89
|
+
"pools": [
|
|
90
|
+
{
|
|
91
|
+
"v": 3,
|
|
92
|
+
"fee": 10000,
|
|
93
|
+
"pool": "0xedb22516B14Eb2d1C86927Db373B0E8bF70F5cD1"
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"symbol": "BABA",
|
|
99
|
+
"token": "0xad25Ac6C84D497db898fa1E8387bf6Af3532a1c4",
|
|
100
|
+
"pools": [
|
|
101
|
+
{
|
|
102
|
+
"v": 4,
|
|
103
|
+
"fee": 1000,
|
|
104
|
+
"tickSpacing": 10,
|
|
105
|
+
"id": "0x1791fc651cc794a282e5dbcb56d0b2b38eff8754b677c8876e86901521ecc439"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"v": 3,
|
|
109
|
+
"fee": 3000,
|
|
110
|
+
"pool": "0xa57ab582b310dd6f9e934EA1EEEa152741545E6A"
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"symbol": "COIN",
|
|
116
|
+
"token": "0x6330D8C3178a418788dF01a47479c0ce7CCF450b",
|
|
117
|
+
"pools": [
|
|
118
|
+
{
|
|
119
|
+
"v": 4,
|
|
120
|
+
"fee": 2500,
|
|
121
|
+
"tickSpacing": 25,
|
|
122
|
+
"id": "0xe2e1a0e32205e854525e0fb1d3667a53bd3b4919f032b9bcd2a038b6b6dac314"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"v": 4,
|
|
126
|
+
"fee": 10000,
|
|
127
|
+
"tickSpacing": 200,
|
|
128
|
+
"id": "0x007a13fa152f6dc383cad20a8eaab4e1e2538b606936eae2a424f8aa47d6db31"
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"symbol": "CRCL",
|
|
134
|
+
"token": "0xdF0992E440dD0be65BD8439b609d6D4366bf1CB5",
|
|
135
|
+
"pools": [
|
|
136
|
+
{
|
|
137
|
+
"v": 3,
|
|
138
|
+
"fee": 3000,
|
|
139
|
+
"pool": "0x654E4143e82a5824445Ade0824351C2A9ACD95a8"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"v": 4,
|
|
143
|
+
"fee": 3000,
|
|
144
|
+
"tickSpacing": 30,
|
|
145
|
+
"id": "0x628c98ab436ee34a6a7decd606242890582591bdf7c9a35d90e0d08021c31ea0"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"v": 4,
|
|
149
|
+
"fee": 1500,
|
|
150
|
+
"tickSpacing": 15,
|
|
151
|
+
"id": "0x5177eac8c2176468bbf15e44081e151d35c2e7d068e96d3db94f496a4dc944b2"
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"symbol": "CRWV",
|
|
157
|
+
"token": "0x5f10A1C971B69e47e059e1dC91901B59b3fB49C3",
|
|
158
|
+
"pools": [
|
|
159
|
+
{
|
|
160
|
+
"v": 4,
|
|
161
|
+
"fee": 9000,
|
|
162
|
+
"tickSpacing": 90,
|
|
163
|
+
"id": "0x237014478f7ef98afbe7412ac35b6a3f96b8fb111de48b7c4dbf49dba4bd9c4b"
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"symbol": "DELL",
|
|
169
|
+
"token": "0x941AE714EC6D8130c7B75d67160Ca08f1e7d11Dd",
|
|
170
|
+
"pools": [
|
|
171
|
+
{
|
|
172
|
+
"v": 3,
|
|
173
|
+
"fee": 10000,
|
|
174
|
+
"pool": "0xc30c89cB7815A1488b7998D15eEC73961707Fc5a"
|
|
175
|
+
}
|
|
176
|
+
]
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"symbol": "GME",
|
|
180
|
+
"token": "0x1b0E319c6A659F002271B69dB8A7df2F911c153E",
|
|
181
|
+
"pools": [
|
|
182
|
+
{
|
|
183
|
+
"v": 3,
|
|
184
|
+
"fee": 500,
|
|
185
|
+
"pool": "0xE2b46c905E12Ab8E2f864e4821a4325884C1B126"
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"symbol": "GOOGL",
|
|
191
|
+
"token": "0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3",
|
|
192
|
+
"pools": [
|
|
193
|
+
{
|
|
194
|
+
"v": 3,
|
|
195
|
+
"fee": 500,
|
|
196
|
+
"pool": "0x34D0dC122CF9A8Eb296fC5e0D3A233625D7d19b7"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"v": 4,
|
|
200
|
+
"fee": 300,
|
|
201
|
+
"tickSpacing": 3,
|
|
202
|
+
"id": "0x43fe16b75cabbf38f5b185d16142b02d1d9200d8f1ba17cb6cf899f562c6197f"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"v": 4,
|
|
206
|
+
"fee": 3000,
|
|
207
|
+
"tickSpacing": 60,
|
|
208
|
+
"id": "0xd4ecb79fdc521d7725d22b33ed43cb4e47aa96bfad76aa29577e3151f723ac5e"
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"symbol": "INTC",
|
|
214
|
+
"token": "0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",
|
|
215
|
+
"pools": [
|
|
216
|
+
{
|
|
217
|
+
"v": 3,
|
|
218
|
+
"fee": 3000,
|
|
219
|
+
"pool": "0x2e5a92f5013a64661A49312111be2e8aBd33F56a"
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"symbol": "META",
|
|
225
|
+
"token": "0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35",
|
|
226
|
+
"pools": [
|
|
227
|
+
{
|
|
228
|
+
"v": 4,
|
|
229
|
+
"fee": 310,
|
|
230
|
+
"tickSpacing": 3,
|
|
231
|
+
"id": "0xc58bb68060bcb7b3ea0f6d4a4afef1e57f628722e808db12afb6d1733552872f"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"v": 3,
|
|
235
|
+
"fee": 3000,
|
|
236
|
+
"pool": "0x107a7Cb40d8665360ba10E59471Af06150A50922"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"v": 4,
|
|
240
|
+
"fee": 3000,
|
|
241
|
+
"tickSpacing": 60,
|
|
242
|
+
"id": "0x5875d407a42965b0e768c8925cea290e06fa50603ef34fc99eb92a1050e6ae36"
|
|
243
|
+
}
|
|
244
|
+
]
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"symbol": "MSFT",
|
|
248
|
+
"token": "0xe93237C50D904957Cf27E7B1133b510C669c2e74",
|
|
249
|
+
"pools": [
|
|
250
|
+
{
|
|
251
|
+
"v": 3,
|
|
252
|
+
"fee": 3000,
|
|
253
|
+
"pool": "0xeb60bCD1D920ad6E102690CCFC6fB488899E1510"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"v": 4,
|
|
257
|
+
"fee": 3000,
|
|
258
|
+
"tickSpacing": 60,
|
|
259
|
+
"id": "0x9194a557b6a6bb2236b49ea7e2bbccec5d3eeb705aef00903be4b3de1d949579"
|
|
260
|
+
}
|
|
261
|
+
]
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"symbol": "MSTR",
|
|
265
|
+
"token": "0xec262a75e413fAfD0dF80480274532C79D42da09",
|
|
266
|
+
"pools": [
|
|
267
|
+
{
|
|
268
|
+
"v": 4,
|
|
269
|
+
"fee": 2500,
|
|
270
|
+
"tickSpacing": 25,
|
|
271
|
+
"id": "0x319bac87e616a89e241c10aeb8afd4892a852cdd8b373cd9765ecddc40b87cfe"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"v": 4,
|
|
275
|
+
"fee": 2400,
|
|
276
|
+
"tickSpacing": 24,
|
|
277
|
+
"id": "0xc105b8300ff65d750a0e4e63c7a879e20504069b770713464a5315e797735326"
|
|
278
|
+
}
|
|
279
|
+
]
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"symbol": "MU",
|
|
283
|
+
"token": "0xfF080c8ce2E5feadaCa0Da81314Ae59D232d4afD",
|
|
284
|
+
"pools": [
|
|
285
|
+
{
|
|
286
|
+
"v": 3,
|
|
287
|
+
"fee": 3000,
|
|
288
|
+
"pool": "0xd057B1Bc54917855BBee58eAd58647f47caB35E5"
|
|
289
|
+
}
|
|
290
|
+
]
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"symbol": "NBIS",
|
|
294
|
+
"token": "0x9D9c6684F596F66a64C030B93A886D51Fd4D7931",
|
|
295
|
+
"pools": [
|
|
296
|
+
{
|
|
297
|
+
"v": 4,
|
|
298
|
+
"fee": 9900,
|
|
299
|
+
"tickSpacing": 99,
|
|
300
|
+
"id": "0x7c2f9ce1214ba9baf56d1b6a1fc640c1b63e9a711172c0c7d10e5a9c4a3d4f0c"
|
|
301
|
+
}
|
|
302
|
+
]
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"symbol": "NVDA",
|
|
306
|
+
"token": "0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC",
|
|
307
|
+
"pools": [
|
|
308
|
+
{
|
|
309
|
+
"v": 3,
|
|
310
|
+
"fee": 500,
|
|
311
|
+
"pool": "0xd4EB21209C4D6093f80B5b84f5C45cc093EA14a3"
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"v": 4,
|
|
315
|
+
"fee": 100,
|
|
316
|
+
"tickSpacing": 1,
|
|
317
|
+
"id": "0x6444a8e0b267406a15db74ca00c4a24bdfa81ed3180f5b6d0851f8ed6f4f29c5"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"v": 4,
|
|
321
|
+
"fee": 3000,
|
|
322
|
+
"tickSpacing": 60,
|
|
323
|
+
"id": "0x3bb34a44f1b2b5f32c034c38a53065a521a47b199700fa9bd19d60985ff24bf1"
|
|
324
|
+
}
|
|
325
|
+
]
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"symbol": "ORCL",
|
|
329
|
+
"token": "0xb0992820E760d836549ba69BC7598b4af75dEE03",
|
|
330
|
+
"pools": [
|
|
331
|
+
{
|
|
332
|
+
"v": 4,
|
|
333
|
+
"fee": 10000,
|
|
334
|
+
"tickSpacing": 200,
|
|
335
|
+
"id": "0xc2ce4784e1e72cf0221b51b30c8aaadf6c0b12863cf03ab3687854fb7b1d850a"
|
|
336
|
+
}
|
|
337
|
+
]
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"symbol": "PLTR",
|
|
341
|
+
"token": "0x894E1EC2D74FFE5AEF8Dc8A9e84686acCB964F2A",
|
|
342
|
+
"pools": [
|
|
343
|
+
{
|
|
344
|
+
"v": 4,
|
|
345
|
+
"fee": 1500,
|
|
346
|
+
"tickSpacing": 15,
|
|
347
|
+
"id": "0xc59eaeda6d1a6f031bc7e1d039772f2d675e7b4de2c8668610f4471bd60b3802"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"v": 3,
|
|
351
|
+
"fee": 3000,
|
|
352
|
+
"pool": "0x851680416A4f4E1c463d45171d61ACDdBc8554c0"
|
|
353
|
+
}
|
|
354
|
+
]
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
"symbol": "QQQ",
|
|
358
|
+
"token": "0xD5f3879160bc7c32ebb4dC785F8a4F505888de68",
|
|
359
|
+
"pools": [
|
|
360
|
+
{
|
|
361
|
+
"v": 3,
|
|
362
|
+
"fee": 500,
|
|
363
|
+
"pool": "0xD60A5d14dB690B7Afad71F76B108071D7175597d"
|
|
364
|
+
}
|
|
365
|
+
]
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"symbol": "SGOV",
|
|
369
|
+
"token": "0x92FD66527192E3e61d4DDd13322Aa222DE86F9B5",
|
|
370
|
+
"pools": [
|
|
371
|
+
{
|
|
372
|
+
"v": 3,
|
|
373
|
+
"fee": 500,
|
|
374
|
+
"pool": "0x6Ba50150B17Ffd0972915Aaf04fFd5E8f4Fa49b4"
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
"v": 3,
|
|
378
|
+
"fee": 3000,
|
|
379
|
+
"pool": "0xfAb520051f96F4D2a32c22B6a3dD7fFfdf231bFe"
|
|
380
|
+
}
|
|
381
|
+
]
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"symbol": "SLV",
|
|
385
|
+
"token": "0x411eFb0E7f985935DAec3D4C3ebaEa0d0AD7D89f",
|
|
386
|
+
"pools": [
|
|
387
|
+
{
|
|
388
|
+
"v": 3,
|
|
389
|
+
"fee": 3000,
|
|
390
|
+
"pool": "0x8cB787e6c315D464775289BaD00FDD67d53Ecb3D"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"v": 3,
|
|
394
|
+
"fee": 10000,
|
|
395
|
+
"pool": "0x0Fa7BC480885DCf58Ad2ef63eC7289cF2481D51c"
|
|
396
|
+
}
|
|
397
|
+
]
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"symbol": "SNDK",
|
|
401
|
+
"token": "0xB90A19fF0Af67f7779afF50A882A9CfF42446400",
|
|
402
|
+
"pools": [
|
|
403
|
+
{
|
|
404
|
+
"v": 4,
|
|
405
|
+
"fee": 10000,
|
|
406
|
+
"tickSpacing": 200,
|
|
407
|
+
"id": "0x2707cb88a6a40fa0f948f58958051ba097d6f6a3cf7f87929bd68ccc5becea24"
|
|
408
|
+
}
|
|
409
|
+
]
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"symbol": "SPCX",
|
|
413
|
+
"token": "0x4a0E65A3EcceC6dBe60AE065F2e7bb85Fae35eEa",
|
|
414
|
+
"pools": [
|
|
415
|
+
{
|
|
416
|
+
"v": 3,
|
|
417
|
+
"fee": 500,
|
|
418
|
+
"pool": "0xc61284332117c3FB23A2A56cceFFD07F7aF60029"
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
"v": 3,
|
|
422
|
+
"fee": 3000,
|
|
423
|
+
"pool": "0xEb07d9587eFD1778dFb9c385Ec43EF6d5F9fE401"
|
|
424
|
+
}
|
|
425
|
+
]
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
"symbol": "SPY",
|
|
429
|
+
"token": "0x117cc2133c37B721F49dE2A7a74833232B3B4C0C",
|
|
430
|
+
"pools": [
|
|
431
|
+
{
|
|
432
|
+
"v": 4,
|
|
433
|
+
"fee": 100,
|
|
434
|
+
"tickSpacing": 1,
|
|
435
|
+
"id": "0xe1ae6a4c6ccc9f037389a8d50a4f577bde1a9fe01d85d88ecbbd39955ce53288"
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
"v": 3,
|
|
439
|
+
"fee": 500,
|
|
440
|
+
"pool": "0xa7Bb1AC63BBaB0C44316E6c8C455213441689167"
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
"v": 4,
|
|
444
|
+
"fee": 500,
|
|
445
|
+
"tickSpacing": 5,
|
|
446
|
+
"id": "0xe5923c8a8be481ec89a2ca784a2bbfa4235de6d88f92260fd66b660c4babf907"
|
|
447
|
+
}
|
|
448
|
+
]
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
"symbol": "TSLA",
|
|
452
|
+
"token": "0x322F0929c4625eD5bAd873c95208D54E1c003b2d",
|
|
453
|
+
"pools": [
|
|
454
|
+
{
|
|
455
|
+
"v": 3,
|
|
456
|
+
"fee": 3000,
|
|
457
|
+
"pool": "0xf4ACdAEEB7022862A763C9B1B885e11191c889E3"
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
"v": 4,
|
|
461
|
+
"fee": 3000,
|
|
462
|
+
"tickSpacing": 60,
|
|
463
|
+
"id": "0x8517f8071ae5b831b738052f12125e8e3d6c158b78728aa44ce3b25e5104d32e"
|
|
464
|
+
}
|
|
465
|
+
]
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
"symbol": "TSM",
|
|
469
|
+
"token": "0x58FfE4a942d3885bAa22D7520691F611EF09e7AA",
|
|
470
|
+
"pools": [
|
|
471
|
+
{
|
|
472
|
+
"v": 4,
|
|
473
|
+
"fee": 7500,
|
|
474
|
+
"tickSpacing": 75,
|
|
475
|
+
"id": "0x0ba5d53d2f6255f334b7c8ead4f56b6aef5af3402c5e4d11180afd38c6b85fb1"
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
"v": 3,
|
|
479
|
+
"fee": 10000,
|
|
480
|
+
"pool": "0x07e8Ea83D4C1340774c8965125e26e12bf943bf1"
|
|
481
|
+
}
|
|
482
|
+
]
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
"symbol": "USAR",
|
|
486
|
+
"token": "0xd917B029C761D264c6A312BBbcDA868658eF86a6",
|
|
487
|
+
"pools": [
|
|
488
|
+
{
|
|
489
|
+
"v": 3,
|
|
490
|
+
"fee": 3000,
|
|
491
|
+
"pool": "0x04391780F519B7d3ba59c9590459D76e23d225C4"
|
|
492
|
+
}
|
|
493
|
+
]
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
"symbol": "USO",
|
|
497
|
+
"token": "0xa30FA36Db767ad9eD3f7a60fC79526fB4d56D344",
|
|
498
|
+
"pools": [
|
|
499
|
+
{
|
|
500
|
+
"v": 4,
|
|
501
|
+
"fee": 1200,
|
|
502
|
+
"tickSpacing": 15,
|
|
503
|
+
"id": "0x1f2ad5a274a776d8e1408292bde1d92d8fa7b6444acf14ad60b9c3e4e5b66420"
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
"v": 3,
|
|
507
|
+
"fee": 3000,
|
|
508
|
+
"pool": "0x02175608F1b5E6b5ed221cCFdC7Be197D111D915"
|
|
509
|
+
}
|
|
510
|
+
]
|
|
511
|
+
}
|
|
512
|
+
],
|
|
513
|
+
"notOffered": {
|
|
514
|
+
"CLSK": "thin",
|
|
515
|
+
"EWY": "thin",
|
|
516
|
+
"IONQ": "thin",
|
|
517
|
+
"RGTI": "thin",
|
|
518
|
+
"RKLB": "thin"
|
|
519
|
+
}
|
|
520
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@priors/mcp",
|
|
3
3
|
"mcpName": "io.github.priors-agents/priors",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.14.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "MCP server for Priors on Robinhood Chain: pay x402 URLs in USDG, read balances, credit lines and scores, borrow and repay, and buy, sell and redeem PT-USDG. Key from PRIORS_KEY_FILE (a file only you can read) or PRIORS_KEY, never the command line.",
|
|
7
7
|
"type": "module",
|
package/src/pt-usdg.mjs
CHANGED
|
@@ -188,10 +188,10 @@ async function accountOf(account, wallet) {
|
|
|
188
188
|
// wallet never said it), hashes (the steps that went through before), step }. Waiting is bounded by `waitTimeoutMs`.
|
|
189
189
|
|
|
190
190
|
/** TX_UNCONFIRMED: step `c` may have been sent and what it did is not known; running the trade again could trade twice. */
|
|
191
|
-
function unconfirmed(c, hash, cause, hashes, { awaiting = false } = {}) {
|
|
191
|
+
function unconfirmed(c, hash, cause, hashes, { awaiting = false, recheck = "the balances (ptPosition)" } = {}) {
|
|
192
192
|
const why = cause?.shortMessage || cause?.message || String(cause);
|
|
193
193
|
const what = awaiting ? "got no answer from the wallet in time: it may still be awaiting approval there, or it may have been sent" : "may have been sent";
|
|
194
|
-
return Object.assign(new Error(`${c.what || "a call"}${hash ? ` (tx ${hash})` : ""} ${what}, and what it did is not known (${why}): check
|
|
194
|
+
return Object.assign(new Error(`${c.what || "a call"}${hash ? ` (tx ${hash})` : ""} ${what}, and what it did is not known (${why}): check ${recheck} before trying again, since running the trade again could trade twice`),
|
|
195
195
|
{ code: "TX_UNCONFIRMED", unconfirmed: true, hash: hash ?? null, hashes: [...hashes], step: c.what || null, cause });
|
|
196
196
|
}
|
|
197
197
|
const causes = (e) => { const out = []; for (let x = e, i = 0; x && i < 8; x = x.cause, i++) out.push(x); return out; };
|
|
@@ -230,13 +230,13 @@ function checked(c, hash, rc, hashes) {
|
|
|
230
230
|
|
|
231
231
|
/** Wait, until `end`, for step `c`'s receipt: done when it succeeded, an ordinary error when it reverted (that step did
|
|
232
232
|
* nothing), TX_UNCONFIRMED when none came; a lookup that fails is asked again. */
|
|
233
|
-
async function receipt(client, c, hash, hashes, end) {
|
|
233
|
+
async function receipt(client, c, hash, hashes, end, recheck) {
|
|
234
234
|
let last = null;
|
|
235
235
|
for (;;) {
|
|
236
236
|
let rc;
|
|
237
237
|
try { rc = await within(rpc(client, "eth_getTransactionReceipt", [hash]), end - Date.now()); } catch (e) { last = e; }
|
|
238
238
|
if (rc) return checked(c, hash, rc, hashes);
|
|
239
|
-
if (Date.now() >= end) throw unconfirmed(c, hash, last || new Error("no receipt in time"), hashes);
|
|
239
|
+
if (Date.now() >= end) throw unconfirmed(c, hash, last || new Error("no receipt in time"), hashes, { recheck });
|
|
240
240
|
await sleep(Math.min(1500, Math.max(1, end - Date.now())));
|
|
241
241
|
}
|
|
242
242
|
}
|
|
@@ -246,19 +246,23 @@ async function receipt(client, c, hash, hashes, end) {
|
|
|
246
246
|
* only with a `signingKey` (a Wallet): a NonceManager counts its nonces in its own sendTransaction, and a
|
|
247
247
|
* JsonRpcSigner has the node sign, so both send themselves. */
|
|
248
248
|
async function signHere(wallet, c) {
|
|
249
|
+
const nonce = c.nonce != null ? { nonce: c.nonce } : {}; // a call's own nonce, when its caller names one
|
|
249
250
|
if (wallet.signingKey != null && typeof wallet.signTransaction === "function" && typeof wallet.populateTransaction === "function" && wallet.provider) {
|
|
250
|
-
return wallet.signTransaction(await wallet.populateTransaction({ to: c.to, data: c.data, value: c.value })); // ethers Wallet
|
|
251
|
+
return wallet.signTransaction(await wallet.populateTransaction({ to: c.to, data: c.data, value: c.value, ...nonce })); // ethers Wallet
|
|
251
252
|
}
|
|
252
253
|
if (wallet.account?.type === "local" && typeof wallet.prepareTransactionRequest === "function" && typeof wallet.signTransaction === "function") {
|
|
253
|
-
return wallet.signTransaction(await wallet.prepareTransactionRequest({ account: wallet.account, chain: wallet.chain ?? null, to: c.to, data: c.data, value: c.value }));
|
|
254
|
+
return wallet.signTransaction(await wallet.prepareTransactionRequest({ account: wallet.account, chain: wallet.chain ?? null, to: c.to, data: c.data, value: c.value, ...nonce }));
|
|
254
255
|
}
|
|
255
256
|
return null;
|
|
256
257
|
}
|
|
257
258
|
|
|
258
259
|
/** Send `calls` in order from `wallet`, each simulated first, each waited for: the hashes. `onSend(hash, what)` is told
|
|
259
260
|
* of each step as it leaves: signed here, just before its broadcast (if it throws, nothing is sent); with a wallet that
|
|
260
|
-
* sends itself, once the wallet answers (null when its answer was lost; if it throws, the step goes on).
|
|
261
|
-
|
|
261
|
+
* sends itself, once the wallet answers (null when its answer was lost; if it throws, the step goes on). `recheck`:
|
|
262
|
+
* what a TX_UNCONFIRMED says to check before trying again (default "the balances (ptPosition)"; sdk/stock-trade.mjs
|
|
263
|
+
* names its own). A call's `nonce`, when set, is the one it is signed or sent with (a wallet's provider that caches its
|
|
264
|
+
* nonce reads could give a step sent right after another that one's again). */
|
|
265
|
+
export async function sendCalls(client, wallet, calls, from, { waitTimeoutMs = 180_000, onSend, recheck } = {}) {
|
|
262
266
|
const hashes = [];
|
|
263
267
|
for (const c of calls) {
|
|
264
268
|
try { await rpc(client, "eth_call", [{ from, to: c.to, data: c.data }, "latest"]); } catch (e) { throw new Error(`${c.what || "the call"} would revert: ${e.shortMessage || e.message}`); }
|
|
@@ -275,36 +279,37 @@ export async function sendCalls(client, wallet, calls, from, { waitTimeoutMs = 1
|
|
|
275
279
|
let seen = null;
|
|
276
280
|
try {
|
|
277
281
|
const answer = await within(rpc(client, "eth_sendRawTransaction", [signed]), end - Date.now());
|
|
278
|
-
if (answer === undefined) throw unconfirmed(c, hash, new Error("no answer to the broadcast in time"), hashes);
|
|
282
|
+
if (answer === undefined) throw unconfirmed(c, hash, new Error("no answer to the broadcast in time"), hashes, { recheck });
|
|
279
283
|
} catch (e) {
|
|
280
284
|
if (e?.unconfirmed) throw e;
|
|
281
285
|
seen = await lookup(client, hash, end);
|
|
282
|
-
if (!seen) throw unconfirmed(c, hash, e, hashes);
|
|
286
|
+
if (!seen) throw unconfirmed(c, hash, e, hashes, { recheck });
|
|
283
287
|
if (seen.state === "unknown") {
|
|
284
288
|
if (noFunds(e)) throw Object.assign(new Error(`${c.what || "the call"} was refused: ${e.shortMessage || e.message}`), { code: "INSUFFICIENT_FUNDS", hashes: [...hashes], cause: e });
|
|
285
|
-
throw unconfirmed(c, hash, e, hashes);
|
|
289
|
+
throw unconfirmed(c, hash, e, hashes, { recheck });
|
|
286
290
|
}
|
|
287
291
|
// "mined" (its receipt in hand) or "pending" (waited for below): the node took it
|
|
288
292
|
}
|
|
289
293
|
if (seen?.state === "mined") checked(c, hash, seen.rc, hashes);
|
|
290
|
-
else await receipt(client, c, hash, hashes, end);
|
|
294
|
+
else await receipt(client, c, hash, hashes, end, recheck);
|
|
291
295
|
} else {
|
|
292
296
|
// a wallet that sends itself: one deadline from the moment it is asked (its user's approval included), over its
|
|
293
297
|
// send (an ethers JsonRpcSigner polls the node before it returns) and the receipt
|
|
294
298
|
const end = Date.now() + waitTimeoutMs;
|
|
295
299
|
try {
|
|
300
|
+
const nonce = c.nonce != null ? { nonce: c.nonce } : {};
|
|
296
301
|
const sending = wallet.account && typeof wallet.sendTransaction === "function" && !wallet.getAddress
|
|
297
|
-
? wallet.sendTransaction({ account: wallet.account, chain: wallet.chain ?? null, to: c.to, data: c.data, value: c.value })
|
|
298
|
-
: Promise.resolve(wallet.sendTransaction({ to: c.to, data: c.data, value: c.value })).then((tx) => tx.hash);
|
|
302
|
+
? wallet.sendTransaction({ account: wallet.account, chain: wallet.chain ?? null, to: c.to, data: c.data, value: c.value, ...nonce })
|
|
303
|
+
: Promise.resolve(wallet.sendTransaction({ to: c.to, data: c.data, value: c.value, ...nonce })).then((tx) => tx.hash);
|
|
299
304
|
hash = await within(sending, end - Date.now());
|
|
300
|
-
if (hash === undefined) throw unconfirmed(c, null, new Error("the wallet gave no answer in time"), hashes, { awaiting: true });
|
|
305
|
+
if (hash === undefined) throw unconfirmed(c, null, new Error("the wallet gave no answer in time"), hashes, { awaiting: true, recheck });
|
|
301
306
|
} catch (e) {
|
|
302
307
|
if (!e?.unconfirmed && declined(e)) throw e;
|
|
303
308
|
told(onSend, null, c.what);
|
|
304
|
-
throw e?.unconfirmed ? e : unconfirmed(c, null, e, hashes);
|
|
309
|
+
throw e?.unconfirmed ? e : unconfirmed(c, null, e, hashes, { recheck });
|
|
305
310
|
}
|
|
306
311
|
told(onSend, hash, c.what);
|
|
307
|
-
await receipt(client, c, hash, hashes, end);
|
|
312
|
+
await receipt(client, c, hash, hashes, end, recheck);
|
|
308
313
|
}
|
|
309
314
|
hashes.push(hash);
|
|
310
315
|
}
|