@swarm-tips/client 0.1.0 → 0.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 +5 -0
- package/SBOM.spdx.json +5 -5
- package/dist/contracts/index.js +1 -1
- package/dist/coordination-game/api.d.ts +276 -0
- package/dist/coordination-game/api.js +146 -0
- package/dist/coordination-game/evm/abi.d.ts +409 -0
- package/dist/coordination-game/evm/abi.js +371 -0
- package/dist/coordination-game/evm/cross-chain.d.ts +33 -0
- package/dist/coordination-game/evm/cross-chain.js +76 -0
- package/dist/coordination-game/evm/index.d.ts +6 -0
- package/dist/coordination-game/evm/index.js +6 -0
- package/dist/coordination-game/evm/rules.d.ts +112 -0
- package/dist/coordination-game/evm/rules.js +128 -0
- package/dist/coordination-game/evm/session-funding.d.ts +111 -0
- package/dist/coordination-game/evm/session-funding.js +407 -0
- package/dist/coordination-game/evm/session.d.ts +58 -0
- package/dist/coordination-game/evm/session.js +165 -0
- package/dist/coordination-game/evm/transactions.d.ts +137 -0
- package/dist/coordination-game/evm/transactions.js +211 -0
- package/dist/coordination-game/index.d.ts +1 -0
- package/dist/coordination-game/index.js +1 -0
- package/dist/coordination-game/protocol.d.ts +58 -0
- package/dist/coordination-game/protocol.js +120 -0
- package/dist/coordination-game/solana.d.ts +84 -0
- package/dist/coordination-game/solana.js +262 -0
- package/dist/errors.d.ts +19 -0
- package/dist/errors.js +20 -0
- package/dist/http.d.ts +21 -0
- package/dist/http.js +101 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/shillbot/api.d.ts +72 -0
- package/dist/shillbot/api.js +91 -0
- package/dist/swarm/index.d.ts +84 -0
- package/dist/swarm/index.js +71 -0
- package/package.json +40 -8
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal CrossChainGame ABI for client-side EVM-leg calls (viem
|
|
3
|
+
* encodeFunctionData). Vendored from the Foundry artifact
|
|
4
|
+
* (swarm-tips-repo/evm/out/CrossChainGame.sol/CrossChainGame.json) — only the
|
|
5
|
+
* functions the cross-chain match UX needs: fund (createMatch), refund
|
|
6
|
+
* (refundTimeout/refundNoCert), and the read views (stakeWei, CHAIN_TAG,
|
|
7
|
+
* matches). Settle is permissionless and operator/harness-driven, so it is not
|
|
8
|
+
* vendored here. Regenerate if the contract ABI changes.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CROSS_CHAIN_GAME_ABI: readonly [{
|
|
11
|
+
readonly type: "function";
|
|
12
|
+
readonly name: "CHAIN_TAG";
|
|
13
|
+
readonly inputs: readonly [];
|
|
14
|
+
readonly outputs: readonly [{
|
|
15
|
+
readonly name: "";
|
|
16
|
+
readonly type: "bytes32";
|
|
17
|
+
readonly internalType: "bytes32";
|
|
18
|
+
}];
|
|
19
|
+
readonly stateMutability: "view";
|
|
20
|
+
}, {
|
|
21
|
+
readonly type: "function";
|
|
22
|
+
readonly name: "createMatch";
|
|
23
|
+
readonly inputs: readonly [{
|
|
24
|
+
readonly name: "matchId";
|
|
25
|
+
readonly type: "bytes32";
|
|
26
|
+
readonly internalType: "bytes32";
|
|
27
|
+
}, {
|
|
28
|
+
readonly name: "sessionKey";
|
|
29
|
+
readonly type: "address";
|
|
30
|
+
readonly internalType: "address";
|
|
31
|
+
}, {
|
|
32
|
+
readonly name: "counterSessionKey";
|
|
33
|
+
readonly type: "address";
|
|
34
|
+
readonly internalType: "address";
|
|
35
|
+
}, {
|
|
36
|
+
readonly name: "playerIsP1";
|
|
37
|
+
readonly type: "bool";
|
|
38
|
+
readonly internalType: "bool";
|
|
39
|
+
}, {
|
|
40
|
+
readonly name: "fundDeadline";
|
|
41
|
+
readonly type: "uint64";
|
|
42
|
+
readonly internalType: "uint64";
|
|
43
|
+
}, {
|
|
44
|
+
readonly name: "matchDeadline";
|
|
45
|
+
readonly type: "uint64";
|
|
46
|
+
readonly internalType: "uint64";
|
|
47
|
+
}, {
|
|
48
|
+
readonly name: "operatorSig";
|
|
49
|
+
readonly type: "bytes";
|
|
50
|
+
readonly internalType: "bytes";
|
|
51
|
+
}];
|
|
52
|
+
readonly outputs: readonly [];
|
|
53
|
+
readonly stateMutability: "payable";
|
|
54
|
+
}, {
|
|
55
|
+
readonly type: "function";
|
|
56
|
+
readonly name: "matches";
|
|
57
|
+
readonly inputs: readonly [{
|
|
58
|
+
readonly name: "";
|
|
59
|
+
readonly type: "bytes32";
|
|
60
|
+
readonly internalType: "bytes32";
|
|
61
|
+
}];
|
|
62
|
+
readonly outputs: readonly [{
|
|
63
|
+
readonly name: "status";
|
|
64
|
+
readonly type: "uint8";
|
|
65
|
+
readonly internalType: "enum CrossChainGame.Status";
|
|
66
|
+
}, {
|
|
67
|
+
readonly name: "player";
|
|
68
|
+
readonly type: "address";
|
|
69
|
+
readonly internalType: "address";
|
|
70
|
+
}, {
|
|
71
|
+
readonly name: "sessionKey";
|
|
72
|
+
readonly type: "address";
|
|
73
|
+
readonly internalType: "address";
|
|
74
|
+
}, {
|
|
75
|
+
readonly name: "counterSessionKey";
|
|
76
|
+
readonly type: "address";
|
|
77
|
+
readonly internalType: "address";
|
|
78
|
+
}, {
|
|
79
|
+
readonly name: "playerIsP1";
|
|
80
|
+
readonly type: "bool";
|
|
81
|
+
readonly internalType: "bool";
|
|
82
|
+
}, {
|
|
83
|
+
readonly name: "localEquivocated";
|
|
84
|
+
readonly type: "bool";
|
|
85
|
+
readonly internalType: "bool";
|
|
86
|
+
}, {
|
|
87
|
+
readonly name: "counterEquivocated";
|
|
88
|
+
readonly type: "bool";
|
|
89
|
+
readonly internalType: "bool";
|
|
90
|
+
}, {
|
|
91
|
+
readonly name: "stakeWei";
|
|
92
|
+
readonly type: "uint128";
|
|
93
|
+
readonly internalType: "uint128";
|
|
94
|
+
}, {
|
|
95
|
+
readonly name: "trancheWei";
|
|
96
|
+
readonly type: "uint128";
|
|
97
|
+
readonly internalType: "uint128";
|
|
98
|
+
}, {
|
|
99
|
+
readonly name: "fundDeadline";
|
|
100
|
+
readonly type: "uint64";
|
|
101
|
+
readonly internalType: "uint64";
|
|
102
|
+
}, {
|
|
103
|
+
readonly name: "matchDeadline";
|
|
104
|
+
readonly type: "uint64";
|
|
105
|
+
readonly internalType: "uint64";
|
|
106
|
+
}, {
|
|
107
|
+
readonly name: "lockedAt";
|
|
108
|
+
readonly type: "uint64";
|
|
109
|
+
readonly internalType: "uint64";
|
|
110
|
+
}, {
|
|
111
|
+
readonly name: "claimWindowEnd";
|
|
112
|
+
readonly type: "uint64";
|
|
113
|
+
readonly internalType: "uint64";
|
|
114
|
+
}, {
|
|
115
|
+
readonly name: "matchLiveDigest";
|
|
116
|
+
readonly type: "bytes32";
|
|
117
|
+
readonly internalType: "bytes32";
|
|
118
|
+
}, {
|
|
119
|
+
readonly name: "bestStepCount";
|
|
120
|
+
readonly type: "uint8";
|
|
121
|
+
readonly internalType: "uint8";
|
|
122
|
+
}, {
|
|
123
|
+
readonly name: "bestOutcomeKind";
|
|
124
|
+
readonly type: "uint8";
|
|
125
|
+
readonly internalType: "uint8";
|
|
126
|
+
}];
|
|
127
|
+
readonly stateMutability: "view";
|
|
128
|
+
}, {
|
|
129
|
+
readonly type: "function";
|
|
130
|
+
readonly name: "refundNoCert";
|
|
131
|
+
readonly inputs: readonly [{
|
|
132
|
+
readonly name: "matchId";
|
|
133
|
+
readonly type: "bytes32";
|
|
134
|
+
readonly internalType: "bytes32";
|
|
135
|
+
}];
|
|
136
|
+
readonly outputs: readonly [];
|
|
137
|
+
readonly stateMutability: "nonpayable";
|
|
138
|
+
}, {
|
|
139
|
+
readonly type: "function";
|
|
140
|
+
readonly name: "refundTimeout";
|
|
141
|
+
readonly inputs: readonly [{
|
|
142
|
+
readonly name: "matchId";
|
|
143
|
+
readonly type: "bytes32";
|
|
144
|
+
readonly internalType: "bytes32";
|
|
145
|
+
}];
|
|
146
|
+
readonly outputs: readonly [];
|
|
147
|
+
readonly stateMutability: "nonpayable";
|
|
148
|
+
}, {
|
|
149
|
+
readonly type: "function";
|
|
150
|
+
readonly name: "stakeWei";
|
|
151
|
+
readonly inputs: readonly [];
|
|
152
|
+
readonly outputs: readonly [{
|
|
153
|
+
readonly name: "";
|
|
154
|
+
readonly type: "uint128";
|
|
155
|
+
readonly internalType: "uint128";
|
|
156
|
+
}];
|
|
157
|
+
readonly stateMutability: "view";
|
|
158
|
+
}];
|
|
159
|
+
/**
|
|
160
|
+
* Minimal CoordinationGame ABI for the same-chain EVM-vs-EVM /play flow. Vendored
|
|
161
|
+
* from swarm-tips-repo/evm/out/CoordinationGame.sol/CoordinationGame.json — only
|
|
162
|
+
* the gameplay functions the browser builds + sends itself (commitGuess,
|
|
163
|
+
* revealGuess). createGame/joinGame come pre-encoded from game-api (as
|
|
164
|
+
* create_call/join_call), so they aren't needed for client-side encoding, but
|
|
165
|
+
* are vendored for completeness/verification. Regenerate if the ABI changes.
|
|
166
|
+
*/
|
|
167
|
+
export declare const COORDINATION_GAME_ABI: readonly [{
|
|
168
|
+
readonly type: "function";
|
|
169
|
+
readonly name: "createGame";
|
|
170
|
+
readonly inputs: readonly [{
|
|
171
|
+
readonly name: "gameId";
|
|
172
|
+
readonly type: "bytes32";
|
|
173
|
+
readonly internalType: "bytes32";
|
|
174
|
+
}, {
|
|
175
|
+
readonly name: "matchupCommitment";
|
|
176
|
+
readonly type: "bytes32";
|
|
177
|
+
readonly internalType: "bytes32";
|
|
178
|
+
}, {
|
|
179
|
+
readonly name: "operatorSig";
|
|
180
|
+
readonly type: "bytes";
|
|
181
|
+
readonly internalType: "bytes";
|
|
182
|
+
}, {
|
|
183
|
+
readonly name: "player";
|
|
184
|
+
readonly type: "address";
|
|
185
|
+
readonly internalType: "address";
|
|
186
|
+
}];
|
|
187
|
+
readonly outputs: readonly [];
|
|
188
|
+
readonly stateMutability: "payable";
|
|
189
|
+
}, {
|
|
190
|
+
readonly type: "function";
|
|
191
|
+
readonly name: "joinGame";
|
|
192
|
+
readonly inputs: readonly [{
|
|
193
|
+
readonly name: "gameId";
|
|
194
|
+
readonly type: "bytes32";
|
|
195
|
+
readonly internalType: "bytes32";
|
|
196
|
+
}, {
|
|
197
|
+
readonly name: "player";
|
|
198
|
+
readonly type: "address";
|
|
199
|
+
readonly internalType: "address";
|
|
200
|
+
}];
|
|
201
|
+
readonly outputs: readonly [];
|
|
202
|
+
readonly stateMutability: "payable";
|
|
203
|
+
}, {
|
|
204
|
+
readonly type: "function";
|
|
205
|
+
readonly name: "openSession";
|
|
206
|
+
readonly inputs: readonly [{
|
|
207
|
+
readonly name: "sessionKey";
|
|
208
|
+
readonly type: "address";
|
|
209
|
+
readonly internalType: "address";
|
|
210
|
+
}, {
|
|
211
|
+
readonly name: "expiry";
|
|
212
|
+
readonly type: "uint64";
|
|
213
|
+
readonly internalType: "uint64";
|
|
214
|
+
}];
|
|
215
|
+
readonly outputs: readonly [];
|
|
216
|
+
readonly stateMutability: "payable";
|
|
217
|
+
}, {
|
|
218
|
+
readonly type: "function";
|
|
219
|
+
readonly name: "openSessionAndDeposit";
|
|
220
|
+
readonly inputs: readonly [{
|
|
221
|
+
readonly name: "sessionKey";
|
|
222
|
+
readonly type: "address";
|
|
223
|
+
readonly internalType: "address";
|
|
224
|
+
}, {
|
|
225
|
+
readonly name: "expiry";
|
|
226
|
+
readonly type: "uint64";
|
|
227
|
+
readonly internalType: "uint64";
|
|
228
|
+
}, {
|
|
229
|
+
readonly name: "gasAmount";
|
|
230
|
+
readonly type: "uint256";
|
|
231
|
+
readonly internalType: "uint256";
|
|
232
|
+
}];
|
|
233
|
+
readonly outputs: readonly [];
|
|
234
|
+
readonly stateMutability: "payable";
|
|
235
|
+
}, {
|
|
236
|
+
readonly type: "function";
|
|
237
|
+
readonly name: "deposit";
|
|
238
|
+
readonly inputs: readonly [];
|
|
239
|
+
readonly outputs: readonly [];
|
|
240
|
+
readonly stateMutability: "payable";
|
|
241
|
+
}, {
|
|
242
|
+
readonly type: "function";
|
|
243
|
+
readonly name: "withdrawFor";
|
|
244
|
+
readonly inputs: readonly [{
|
|
245
|
+
readonly name: "to";
|
|
246
|
+
readonly type: "address";
|
|
247
|
+
readonly internalType: "address";
|
|
248
|
+
}];
|
|
249
|
+
readonly outputs: readonly [];
|
|
250
|
+
readonly stateMutability: "nonpayable";
|
|
251
|
+
}, {
|
|
252
|
+
readonly type: "function";
|
|
253
|
+
readonly name: "commitGuess";
|
|
254
|
+
readonly inputs: readonly [{
|
|
255
|
+
readonly name: "gameId";
|
|
256
|
+
readonly type: "bytes32";
|
|
257
|
+
readonly internalType: "bytes32";
|
|
258
|
+
}, {
|
|
259
|
+
readonly name: "commitment";
|
|
260
|
+
readonly type: "bytes32";
|
|
261
|
+
readonly internalType: "bytes32";
|
|
262
|
+
}];
|
|
263
|
+
readonly outputs: readonly [];
|
|
264
|
+
readonly stateMutability: "nonpayable";
|
|
265
|
+
}, {
|
|
266
|
+
readonly type: "function";
|
|
267
|
+
readonly name: "revealGuess";
|
|
268
|
+
readonly inputs: readonly [{
|
|
269
|
+
readonly name: "gameId";
|
|
270
|
+
readonly type: "bytes32";
|
|
271
|
+
readonly internalType: "bytes32";
|
|
272
|
+
}, {
|
|
273
|
+
readonly name: "r";
|
|
274
|
+
readonly type: "bytes32";
|
|
275
|
+
readonly internalType: "bytes32";
|
|
276
|
+
}, {
|
|
277
|
+
readonly name: "rMatchup";
|
|
278
|
+
readonly type: "bytes32";
|
|
279
|
+
readonly internalType: "bytes32";
|
|
280
|
+
}];
|
|
281
|
+
readonly outputs: readonly [];
|
|
282
|
+
readonly stateMutability: "nonpayable";
|
|
283
|
+
}, {
|
|
284
|
+
readonly type: "function";
|
|
285
|
+
readonly name: "withdrawable";
|
|
286
|
+
readonly inputs: readonly [{
|
|
287
|
+
readonly name: "";
|
|
288
|
+
readonly type: "address";
|
|
289
|
+
readonly internalType: "address";
|
|
290
|
+
}];
|
|
291
|
+
readonly outputs: readonly [{
|
|
292
|
+
readonly name: "";
|
|
293
|
+
readonly type: "uint256";
|
|
294
|
+
readonly internalType: "uint256";
|
|
295
|
+
}];
|
|
296
|
+
readonly stateMutability: "view";
|
|
297
|
+
}, {
|
|
298
|
+
readonly type: "function";
|
|
299
|
+
readonly name: "sessions";
|
|
300
|
+
readonly inputs: readonly [{
|
|
301
|
+
readonly name: "";
|
|
302
|
+
readonly type: "address";
|
|
303
|
+
readonly internalType: "address";
|
|
304
|
+
}];
|
|
305
|
+
readonly outputs: readonly [{
|
|
306
|
+
readonly name: "sessionKey";
|
|
307
|
+
readonly type: "address";
|
|
308
|
+
readonly internalType: "address";
|
|
309
|
+
}, {
|
|
310
|
+
readonly name: "expiry";
|
|
311
|
+
readonly type: "uint64";
|
|
312
|
+
readonly internalType: "uint64";
|
|
313
|
+
}];
|
|
314
|
+
readonly stateMutability: "view";
|
|
315
|
+
}, {
|
|
316
|
+
readonly type: "function";
|
|
317
|
+
readonly name: "withdraw";
|
|
318
|
+
readonly inputs: readonly [];
|
|
319
|
+
readonly outputs: readonly [];
|
|
320
|
+
readonly stateMutability: "nonpayable";
|
|
321
|
+
}, {
|
|
322
|
+
readonly type: "function";
|
|
323
|
+
readonly name: "games";
|
|
324
|
+
readonly inputs: readonly [{
|
|
325
|
+
readonly name: "";
|
|
326
|
+
readonly type: "bytes32";
|
|
327
|
+
readonly internalType: "bytes32";
|
|
328
|
+
}];
|
|
329
|
+
readonly outputs: readonly [{
|
|
330
|
+
readonly name: "status";
|
|
331
|
+
readonly type: "uint8";
|
|
332
|
+
readonly internalType: "uint8";
|
|
333
|
+
}, {
|
|
334
|
+
readonly name: "player1";
|
|
335
|
+
readonly type: "address";
|
|
336
|
+
readonly internalType: "address";
|
|
337
|
+
}, {
|
|
338
|
+
readonly name: "player2";
|
|
339
|
+
readonly type: "address";
|
|
340
|
+
readonly internalType: "address";
|
|
341
|
+
}, {
|
|
342
|
+
readonly name: "p1Guess";
|
|
343
|
+
readonly type: "uint8";
|
|
344
|
+
readonly internalType: "uint8";
|
|
345
|
+
}, {
|
|
346
|
+
readonly name: "p2Guess";
|
|
347
|
+
readonly type: "uint8";
|
|
348
|
+
readonly internalType: "uint8";
|
|
349
|
+
}, {
|
|
350
|
+
readonly name: "firstCommitter";
|
|
351
|
+
readonly type: "uint8";
|
|
352
|
+
readonly internalType: "uint8";
|
|
353
|
+
}, {
|
|
354
|
+
readonly name: "matchupType";
|
|
355
|
+
readonly type: "uint8";
|
|
356
|
+
readonly internalType: "uint8";
|
|
357
|
+
}, {
|
|
358
|
+
readonly name: "stakeWei";
|
|
359
|
+
readonly type: "uint128";
|
|
360
|
+
readonly internalType: "uint128";
|
|
361
|
+
}, {
|
|
362
|
+
readonly name: "matchupCommitment";
|
|
363
|
+
readonly type: "bytes32";
|
|
364
|
+
readonly internalType: "bytes32";
|
|
365
|
+
}, {
|
|
366
|
+
readonly name: "p1Commit";
|
|
367
|
+
readonly type: "bytes32";
|
|
368
|
+
readonly internalType: "bytes32";
|
|
369
|
+
}, {
|
|
370
|
+
readonly name: "p2Commit";
|
|
371
|
+
readonly type: "bytes32";
|
|
372
|
+
readonly internalType: "bytes32";
|
|
373
|
+
}, {
|
|
374
|
+
readonly name: "activatedAt";
|
|
375
|
+
readonly type: "uint64";
|
|
376
|
+
readonly internalType: "uint64";
|
|
377
|
+
}, {
|
|
378
|
+
readonly name: "firstCommitAt";
|
|
379
|
+
readonly type: "uint64";
|
|
380
|
+
readonly internalType: "uint64";
|
|
381
|
+
}, {
|
|
382
|
+
readonly name: "bothCommitAt";
|
|
383
|
+
readonly type: "uint64";
|
|
384
|
+
readonly internalType: "uint64";
|
|
385
|
+
}, {
|
|
386
|
+
readonly name: "createdAt";
|
|
387
|
+
readonly type: "uint64";
|
|
388
|
+
readonly internalType: "uint64";
|
|
389
|
+
}, {
|
|
390
|
+
readonly name: "commitWindowSecs";
|
|
391
|
+
readonly type: "uint32";
|
|
392
|
+
readonly internalType: "uint32";
|
|
393
|
+
}, {
|
|
394
|
+
readonly name: "revealWindowSecs";
|
|
395
|
+
readonly type: "uint32";
|
|
396
|
+
readonly internalType: "uint32";
|
|
397
|
+
}];
|
|
398
|
+
readonly stateMutability: "view";
|
|
399
|
+
}, {
|
|
400
|
+
readonly type: "function";
|
|
401
|
+
readonly name: "resolveTimeout";
|
|
402
|
+
readonly inputs: readonly [{
|
|
403
|
+
readonly name: "gameId";
|
|
404
|
+
readonly type: "bytes32";
|
|
405
|
+
readonly internalType: "bytes32";
|
|
406
|
+
}];
|
|
407
|
+
readonly outputs: readonly [];
|
|
408
|
+
readonly stateMutability: "nonpayable";
|
|
409
|
+
}];
|