gyro-sdk 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 +151 -0
- package/dist/abi.d.ts +380 -0
- package/dist/abi.d.ts.map +1 -0
- package/dist/abi.js +151 -0
- package/dist/abi.js.map +1 -0
- package/dist/client.d.ts +17 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +163 -0
- package/dist/client.js.map +1 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +12 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +24 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +6 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +19 -0
- package/dist/utils.js.map +1 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# gyro-sdk
|
|
2
|
+
|
|
3
|
+
JavaScript/TypeScript SDK for **GyroBoard** — a competitive spin game on [Celo](https://celo.org/) with USDm (Mento Dollar).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install gyro-sdk viem
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### Read rooms and players
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { getRoomIds, getRoom, getAllRooms, getRoundPlayers } from 'gyro-sdk';
|
|
17
|
+
|
|
18
|
+
// Get all room IDs
|
|
19
|
+
const ids = await getRoomIds();
|
|
20
|
+
|
|
21
|
+
// Get a specific room
|
|
22
|
+
const room = await getRoom(1n);
|
|
23
|
+
console.log(room.entryFee, room.playerCount, room.currentRound);
|
|
24
|
+
|
|
25
|
+
// Get all rooms with their IDs
|
|
26
|
+
const rooms = await getAllRooms();
|
|
27
|
+
|
|
28
|
+
// Get players in a round
|
|
29
|
+
const players = await getRoundPlayers(1n, 1n);
|
|
30
|
+
players.forEach(p => console.log(p.player, p.spin));
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Check balances and allowances
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { getUsdmBalance, getUsdmAllowance } from 'gyro-sdk';
|
|
37
|
+
|
|
38
|
+
const balance = await getUsdmBalance('0x...');
|
|
39
|
+
const allowance = await getUsdmAllowance('0x...');
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Play a spin (browser wallet)
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { createWalletClient, custom } from 'viem';
|
|
46
|
+
import { celo } from 'viem/chains';
|
|
47
|
+
import { approveUsdm, play } from 'gyro-sdk';
|
|
48
|
+
|
|
49
|
+
const walletClient = createWalletClient({
|
|
50
|
+
chain: celo,
|
|
51
|
+
transport: custom(window.ethereum),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Approve USDm spending (once)
|
|
55
|
+
const approveTx = await approveUsdm(walletClient);
|
|
56
|
+
|
|
57
|
+
// Play spin 7 in room 1
|
|
58
|
+
const playTx = await play(walletClient, 1n, 7);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Create a room
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
import { createRoom, parseUsdm } from 'gyro-sdk';
|
|
65
|
+
|
|
66
|
+
// Create room #5 with 0.5 USDm entry fee
|
|
67
|
+
const tx = await createRoom(walletClient, 5n, parseUsdm('0.5'));
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Server-side with private key
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import { createWalletClient, http } from 'viem';
|
|
74
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
75
|
+
import { celo } from 'viem/chains';
|
|
76
|
+
import { play, approveUsdm } from 'gyro-sdk';
|
|
77
|
+
|
|
78
|
+
const account = privateKeyToAccount('0x...');
|
|
79
|
+
const walletClient = createWalletClient({
|
|
80
|
+
account,
|
|
81
|
+
chain: celo,
|
|
82
|
+
transport: http('https://forno.celo.org'),
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
await approveUsdm(walletClient);
|
|
86
|
+
await play(walletClient, 1n, 5);
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Configuration
|
|
90
|
+
|
|
91
|
+
Override defaults by passing config:
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
import { getRoom } from 'gyro-sdk';
|
|
95
|
+
|
|
96
|
+
const room = await getRoom(1n, {
|
|
97
|
+
contractAddress: '0xYOUR_CONTRACT',
|
|
98
|
+
rpcUrl: 'https://your-rpc.example.com',
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## API Reference
|
|
103
|
+
|
|
104
|
+
### Read-only
|
|
105
|
+
|
|
106
|
+
| Function | Returns | Description |
|
|
107
|
+
|----------|---------|-------------|
|
|
108
|
+
| `getRoomIds(opts?)` | `bigint[]` | All created room IDs |
|
|
109
|
+
| `getRoom(roomId, opts?)` | `Room` | Room state (entryFee, round, players, pot, highestSpin, exists) |
|
|
110
|
+
| `getAllRooms(opts?)` | `RoomWithId[]` | All rooms with their IDs |
|
|
111
|
+
| `getRoundPlayers(roomId, round, opts?)` | `Player[]` | Players and spins in a round |
|
|
112
|
+
| `hasPlayed(roomId, round, player, opts?)` | `boolean` | Whether player already played |
|
|
113
|
+
| `getPlayerSpin(roomId, round, player, opts?)` | `bigint` | Player's spin value |
|
|
114
|
+
| `getCreator(opts?)` | `Address` | Contract creator address |
|
|
115
|
+
| `getMentoDollar(opts?)` | `Address` | USDm token address |
|
|
116
|
+
| `getUsdmBalance(account, opts?)` | `bigint` | USDm balance |
|
|
117
|
+
| `getUsdmAllowance(owner, opts?)` | `bigint` | USDm allowance for GyroBoard |
|
|
118
|
+
|
|
119
|
+
### Write (require viem walletClient)
|
|
120
|
+
|
|
121
|
+
| Function | Parameters | Description |
|
|
122
|
+
|----------|-----------|-------------|
|
|
123
|
+
| `play(walletClient, roomId, spin, opts?)` | spin: 1-10 | Submit a spin in a room |
|
|
124
|
+
| `createRoom(walletClient, roomId, entryFee, opts?)` | entryFee in wei | Create a new room |
|
|
125
|
+
| `approveUsdm(walletClient, amount?, opts?)` | defaults to max | Approve USDm spending |
|
|
126
|
+
| `transferUsdm(walletClient, to, amount)` | recipient, amount | Transfer USDm tokens |
|
|
127
|
+
|
|
128
|
+
### Utilities
|
|
129
|
+
|
|
130
|
+
| Function | Description |
|
|
131
|
+
|----------|-------------|
|
|
132
|
+
| `formatUsdm(amount)` | Format wei to USDm string |
|
|
133
|
+
| `parseUsdm(amount)` | Parse USDm string to wei |
|
|
134
|
+
| `formatAddress(address)` | Shorten address for display |
|
|
135
|
+
| `explorerUrl(txHash)` | CeloScan transaction link |
|
|
136
|
+
| `addressExplorerUrl(address)` | CeloScan address link |
|
|
137
|
+
|
|
138
|
+
### Constants
|
|
139
|
+
|
|
140
|
+
| Constant | Value |
|
|
141
|
+
|----------|-------|
|
|
142
|
+
| `DEFAULT_CONTRACT_ADDRESS` | `0xa0C01234FEEA3401dE13598b3ef823afe0a9672B` |
|
|
143
|
+
| `USDM_ADDRESS` | `0x765DE816845861e75A25fCA122bb6898B8B1282a` |
|
|
144
|
+
| `CELO_CHAIN_ID` | `42220` |
|
|
145
|
+
| `MIN_SPIN` / `MAX_SPIN` | 1 / 10 |
|
|
146
|
+
| `MAX_PLAYERS` | 10 |
|
|
147
|
+
| `WINNER_SHARE` / `CREATOR_SHARE` | 90% / 10% |
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
MIT
|
package/dist/abi.d.ts
ADDED
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
export declare const GYROBOARD_ABI: readonly [{
|
|
2
|
+
readonly inputs: readonly [{
|
|
3
|
+
readonly name: "usdMToken";
|
|
4
|
+
readonly type: "address";
|
|
5
|
+
}, {
|
|
6
|
+
readonly name: "creatorAddress";
|
|
7
|
+
readonly type: "address";
|
|
8
|
+
}];
|
|
9
|
+
readonly stateMutability: "nonpayable";
|
|
10
|
+
readonly type: "constructor";
|
|
11
|
+
}, {
|
|
12
|
+
readonly inputs: readonly [];
|
|
13
|
+
readonly name: "AlreadyPlayed";
|
|
14
|
+
readonly type: "error";
|
|
15
|
+
}, {
|
|
16
|
+
readonly inputs: readonly [];
|
|
17
|
+
readonly name: "InvalidEntryFee";
|
|
18
|
+
readonly type: "error";
|
|
19
|
+
}, {
|
|
20
|
+
readonly inputs: readonly [];
|
|
21
|
+
readonly name: "InvalidSpin";
|
|
22
|
+
readonly type: "error";
|
|
23
|
+
}, {
|
|
24
|
+
readonly inputs: readonly [];
|
|
25
|
+
readonly name: "NoWinners";
|
|
26
|
+
readonly type: "error";
|
|
27
|
+
}, {
|
|
28
|
+
readonly inputs: readonly [];
|
|
29
|
+
readonly name: "ReentrancyGuardReentrantCall";
|
|
30
|
+
readonly type: "error";
|
|
31
|
+
}, {
|
|
32
|
+
readonly inputs: readonly [];
|
|
33
|
+
readonly name: "RoomAlreadyExists";
|
|
34
|
+
readonly type: "error";
|
|
35
|
+
}, {
|
|
36
|
+
readonly inputs: readonly [];
|
|
37
|
+
readonly name: "RoomDoesNotExist";
|
|
38
|
+
readonly type: "error";
|
|
39
|
+
}, {
|
|
40
|
+
readonly inputs: readonly [];
|
|
41
|
+
readonly name: "RoundFull";
|
|
42
|
+
readonly type: "error";
|
|
43
|
+
}, {
|
|
44
|
+
readonly inputs: readonly [{
|
|
45
|
+
readonly name: "token";
|
|
46
|
+
readonly type: "address";
|
|
47
|
+
}];
|
|
48
|
+
readonly name: "SafeERC20FailedOperation";
|
|
49
|
+
readonly type: "error";
|
|
50
|
+
}, {
|
|
51
|
+
readonly anonymous: false;
|
|
52
|
+
readonly inputs: readonly [{
|
|
53
|
+
readonly indexed: true;
|
|
54
|
+
readonly name: "recipient";
|
|
55
|
+
readonly type: "address";
|
|
56
|
+
}, {
|
|
57
|
+
readonly indexed: false;
|
|
58
|
+
readonly name: "amount";
|
|
59
|
+
readonly type: "uint256";
|
|
60
|
+
}, {
|
|
61
|
+
readonly indexed: false;
|
|
62
|
+
readonly name: "roomId";
|
|
63
|
+
readonly type: "uint256";
|
|
64
|
+
}];
|
|
65
|
+
readonly name: "Payout";
|
|
66
|
+
readonly type: "event";
|
|
67
|
+
}, {
|
|
68
|
+
readonly anonymous: false;
|
|
69
|
+
readonly inputs: readonly [{
|
|
70
|
+
readonly indexed: true;
|
|
71
|
+
readonly name: "player";
|
|
72
|
+
readonly type: "address";
|
|
73
|
+
}, {
|
|
74
|
+
readonly indexed: false;
|
|
75
|
+
readonly name: "roomId";
|
|
76
|
+
readonly type: "uint256";
|
|
77
|
+
}, {
|
|
78
|
+
readonly indexed: false;
|
|
79
|
+
readonly name: "round";
|
|
80
|
+
readonly type: "uint256";
|
|
81
|
+
}, {
|
|
82
|
+
readonly indexed: false;
|
|
83
|
+
readonly name: "spin";
|
|
84
|
+
readonly type: "uint256";
|
|
85
|
+
}];
|
|
86
|
+
readonly name: "Played";
|
|
87
|
+
readonly type: "event";
|
|
88
|
+
}, {
|
|
89
|
+
readonly anonymous: false;
|
|
90
|
+
readonly inputs: readonly [{
|
|
91
|
+
readonly indexed: false;
|
|
92
|
+
readonly name: "roomId";
|
|
93
|
+
readonly type: "uint256";
|
|
94
|
+
}, {
|
|
95
|
+
readonly indexed: false;
|
|
96
|
+
readonly name: "entryFee";
|
|
97
|
+
readonly type: "uint256";
|
|
98
|
+
}];
|
|
99
|
+
readonly name: "RoomCreated";
|
|
100
|
+
readonly type: "event";
|
|
101
|
+
}, {
|
|
102
|
+
readonly anonymous: false;
|
|
103
|
+
readonly inputs: readonly [{
|
|
104
|
+
readonly indexed: false;
|
|
105
|
+
readonly name: "roomId";
|
|
106
|
+
readonly type: "uint256";
|
|
107
|
+
}, {
|
|
108
|
+
readonly indexed: false;
|
|
109
|
+
readonly name: "round";
|
|
110
|
+
readonly type: "uint256";
|
|
111
|
+
}, {
|
|
112
|
+
readonly indexed: false;
|
|
113
|
+
readonly name: "highestSpin";
|
|
114
|
+
readonly type: "uint256";
|
|
115
|
+
}, {
|
|
116
|
+
readonly indexed: false;
|
|
117
|
+
readonly name: "winnerCount";
|
|
118
|
+
readonly type: "uint256";
|
|
119
|
+
}];
|
|
120
|
+
readonly name: "RoundCompleted";
|
|
121
|
+
readonly type: "event";
|
|
122
|
+
}, {
|
|
123
|
+
readonly inputs: readonly [];
|
|
124
|
+
readonly name: "CREATOR_SHARE";
|
|
125
|
+
readonly outputs: readonly [{
|
|
126
|
+
readonly name: "";
|
|
127
|
+
readonly type: "uint256";
|
|
128
|
+
}];
|
|
129
|
+
readonly stateMutability: "view";
|
|
130
|
+
readonly type: "function";
|
|
131
|
+
}, {
|
|
132
|
+
readonly inputs: readonly [];
|
|
133
|
+
readonly name: "MAX_ENTRY_FEE";
|
|
134
|
+
readonly outputs: readonly [{
|
|
135
|
+
readonly name: "";
|
|
136
|
+
readonly type: "uint256";
|
|
137
|
+
}];
|
|
138
|
+
readonly stateMutability: "view";
|
|
139
|
+
readonly type: "function";
|
|
140
|
+
}, {
|
|
141
|
+
readonly inputs: readonly [];
|
|
142
|
+
readonly name: "MAX_PLAYERS";
|
|
143
|
+
readonly outputs: readonly [{
|
|
144
|
+
readonly name: "";
|
|
145
|
+
readonly type: "uint256";
|
|
146
|
+
}];
|
|
147
|
+
readonly stateMutability: "view";
|
|
148
|
+
readonly type: "function";
|
|
149
|
+
}, {
|
|
150
|
+
readonly inputs: readonly [];
|
|
151
|
+
readonly name: "MAX_SPIN";
|
|
152
|
+
readonly outputs: readonly [{
|
|
153
|
+
readonly name: "";
|
|
154
|
+
readonly type: "uint256";
|
|
155
|
+
}];
|
|
156
|
+
readonly stateMutability: "view";
|
|
157
|
+
readonly type: "function";
|
|
158
|
+
}, {
|
|
159
|
+
readonly inputs: readonly [];
|
|
160
|
+
readonly name: "MIN_ENTRY_FEE";
|
|
161
|
+
readonly outputs: readonly [{
|
|
162
|
+
readonly name: "";
|
|
163
|
+
readonly type: "uint256";
|
|
164
|
+
}];
|
|
165
|
+
readonly stateMutability: "view";
|
|
166
|
+
readonly type: "function";
|
|
167
|
+
}, {
|
|
168
|
+
readonly inputs: readonly [];
|
|
169
|
+
readonly name: "MIN_SPIN";
|
|
170
|
+
readonly outputs: readonly [{
|
|
171
|
+
readonly name: "";
|
|
172
|
+
readonly type: "uint256";
|
|
173
|
+
}];
|
|
174
|
+
readonly stateMutability: "view";
|
|
175
|
+
readonly type: "function";
|
|
176
|
+
}, {
|
|
177
|
+
readonly inputs: readonly [];
|
|
178
|
+
readonly name: "WINNER_SHARE";
|
|
179
|
+
readonly outputs: readonly [{
|
|
180
|
+
readonly name: "";
|
|
181
|
+
readonly type: "uint256";
|
|
182
|
+
}];
|
|
183
|
+
readonly stateMutability: "view";
|
|
184
|
+
readonly type: "function";
|
|
185
|
+
}, {
|
|
186
|
+
readonly inputs: readonly [{
|
|
187
|
+
readonly name: "roomId";
|
|
188
|
+
readonly type: "uint256";
|
|
189
|
+
}, {
|
|
190
|
+
readonly name: "entryFee";
|
|
191
|
+
readonly type: "uint256";
|
|
192
|
+
}];
|
|
193
|
+
readonly name: "createRoom";
|
|
194
|
+
readonly outputs: readonly [];
|
|
195
|
+
readonly stateMutability: "nonpayable";
|
|
196
|
+
readonly type: "function";
|
|
197
|
+
}, {
|
|
198
|
+
readonly inputs: readonly [];
|
|
199
|
+
readonly name: "creator";
|
|
200
|
+
readonly outputs: readonly [{
|
|
201
|
+
readonly name: "";
|
|
202
|
+
readonly type: "address";
|
|
203
|
+
}];
|
|
204
|
+
readonly stateMutability: "view";
|
|
205
|
+
readonly type: "function";
|
|
206
|
+
}, {
|
|
207
|
+
readonly inputs: readonly [];
|
|
208
|
+
readonly name: "getRoomIds";
|
|
209
|
+
readonly outputs: readonly [{
|
|
210
|
+
readonly name: "";
|
|
211
|
+
readonly type: "uint256[]";
|
|
212
|
+
}];
|
|
213
|
+
readonly stateMutability: "view";
|
|
214
|
+
readonly type: "function";
|
|
215
|
+
}, {
|
|
216
|
+
readonly inputs: readonly [{
|
|
217
|
+
readonly name: "roomId";
|
|
218
|
+
readonly type: "uint256";
|
|
219
|
+
}, {
|
|
220
|
+
readonly name: "round";
|
|
221
|
+
readonly type: "uint256";
|
|
222
|
+
}];
|
|
223
|
+
readonly name: "getRoundPlayers";
|
|
224
|
+
readonly outputs: readonly [{
|
|
225
|
+
readonly components: readonly [{
|
|
226
|
+
readonly name: "player";
|
|
227
|
+
readonly type: "address";
|
|
228
|
+
}, {
|
|
229
|
+
readonly name: "spin";
|
|
230
|
+
readonly type: "uint256";
|
|
231
|
+
}];
|
|
232
|
+
readonly name: "players";
|
|
233
|
+
readonly type: "tuple[]";
|
|
234
|
+
}];
|
|
235
|
+
readonly stateMutability: "view";
|
|
236
|
+
readonly type: "function";
|
|
237
|
+
}, {
|
|
238
|
+
readonly inputs: readonly [{
|
|
239
|
+
readonly name: "";
|
|
240
|
+
readonly type: "uint256";
|
|
241
|
+
}, {
|
|
242
|
+
readonly name: "";
|
|
243
|
+
readonly type: "uint256";
|
|
244
|
+
}, {
|
|
245
|
+
readonly name: "";
|
|
246
|
+
readonly type: "address";
|
|
247
|
+
}];
|
|
248
|
+
readonly name: "hasPlayed";
|
|
249
|
+
readonly outputs: readonly [{
|
|
250
|
+
readonly name: "";
|
|
251
|
+
readonly type: "bool";
|
|
252
|
+
}];
|
|
253
|
+
readonly stateMutability: "view";
|
|
254
|
+
readonly type: "function";
|
|
255
|
+
}, {
|
|
256
|
+
readonly inputs: readonly [];
|
|
257
|
+
readonly name: "mentoDollar";
|
|
258
|
+
readonly outputs: readonly [{
|
|
259
|
+
readonly name: "";
|
|
260
|
+
readonly type: "address";
|
|
261
|
+
}];
|
|
262
|
+
readonly stateMutability: "view";
|
|
263
|
+
readonly type: "function";
|
|
264
|
+
}, {
|
|
265
|
+
readonly inputs: readonly [{
|
|
266
|
+
readonly name: "roomId";
|
|
267
|
+
readonly type: "uint256";
|
|
268
|
+
}, {
|
|
269
|
+
readonly name: "spin";
|
|
270
|
+
readonly type: "uint256";
|
|
271
|
+
}];
|
|
272
|
+
readonly name: "play";
|
|
273
|
+
readonly outputs: readonly [];
|
|
274
|
+
readonly stateMutability: "nonpayable";
|
|
275
|
+
readonly type: "function";
|
|
276
|
+
}, {
|
|
277
|
+
readonly inputs: readonly [{
|
|
278
|
+
readonly name: "";
|
|
279
|
+
readonly type: "uint256";
|
|
280
|
+
}, {
|
|
281
|
+
readonly name: "";
|
|
282
|
+
readonly type: "uint256";
|
|
283
|
+
}, {
|
|
284
|
+
readonly name: "";
|
|
285
|
+
readonly type: "address";
|
|
286
|
+
}];
|
|
287
|
+
readonly name: "playerSpins";
|
|
288
|
+
readonly outputs: readonly [{
|
|
289
|
+
readonly name: "";
|
|
290
|
+
readonly type: "uint256";
|
|
291
|
+
}];
|
|
292
|
+
readonly stateMutability: "view";
|
|
293
|
+
readonly type: "function";
|
|
294
|
+
}, {
|
|
295
|
+
readonly inputs: readonly [{
|
|
296
|
+
readonly name: "";
|
|
297
|
+
readonly type: "uint256";
|
|
298
|
+
}];
|
|
299
|
+
readonly name: "rooms";
|
|
300
|
+
readonly outputs: readonly [{
|
|
301
|
+
readonly name: "entryFee";
|
|
302
|
+
readonly type: "uint256";
|
|
303
|
+
}, {
|
|
304
|
+
readonly name: "currentRound";
|
|
305
|
+
readonly type: "uint256";
|
|
306
|
+
}, {
|
|
307
|
+
readonly name: "playerCount";
|
|
308
|
+
readonly type: "uint256";
|
|
309
|
+
}, {
|
|
310
|
+
readonly name: "totalPot";
|
|
311
|
+
readonly type: "uint256";
|
|
312
|
+
}, {
|
|
313
|
+
readonly name: "highestSpin";
|
|
314
|
+
readonly type: "uint256";
|
|
315
|
+
}, {
|
|
316
|
+
readonly name: "exists";
|
|
317
|
+
readonly type: "bool";
|
|
318
|
+
}];
|
|
319
|
+
readonly stateMutability: "view";
|
|
320
|
+
readonly type: "function";
|
|
321
|
+
}];
|
|
322
|
+
export declare const ERC20_ABI: readonly [{
|
|
323
|
+
readonly inputs: readonly [{
|
|
324
|
+
readonly name: "spender";
|
|
325
|
+
readonly type: "address";
|
|
326
|
+
}, {
|
|
327
|
+
readonly name: "amount";
|
|
328
|
+
readonly type: "uint256";
|
|
329
|
+
}];
|
|
330
|
+
readonly name: "approve";
|
|
331
|
+
readonly outputs: readonly [{
|
|
332
|
+
readonly name: "";
|
|
333
|
+
readonly type: "bool";
|
|
334
|
+
}];
|
|
335
|
+
readonly stateMutability: "nonpayable";
|
|
336
|
+
readonly type: "function";
|
|
337
|
+
}, {
|
|
338
|
+
readonly inputs: readonly [{
|
|
339
|
+
readonly name: "owner";
|
|
340
|
+
readonly type: "address";
|
|
341
|
+
}, {
|
|
342
|
+
readonly name: "spender";
|
|
343
|
+
readonly type: "address";
|
|
344
|
+
}];
|
|
345
|
+
readonly name: "allowance";
|
|
346
|
+
readonly outputs: readonly [{
|
|
347
|
+
readonly name: "";
|
|
348
|
+
readonly type: "uint256";
|
|
349
|
+
}];
|
|
350
|
+
readonly stateMutability: "view";
|
|
351
|
+
readonly type: "function";
|
|
352
|
+
}, {
|
|
353
|
+
readonly inputs: readonly [{
|
|
354
|
+
readonly name: "account";
|
|
355
|
+
readonly type: "address";
|
|
356
|
+
}];
|
|
357
|
+
readonly name: "balanceOf";
|
|
358
|
+
readonly outputs: readonly [{
|
|
359
|
+
readonly name: "";
|
|
360
|
+
readonly type: "uint256";
|
|
361
|
+
}];
|
|
362
|
+
readonly stateMutability: "view";
|
|
363
|
+
readonly type: "function";
|
|
364
|
+
}, {
|
|
365
|
+
readonly inputs: readonly [{
|
|
366
|
+
readonly name: "to";
|
|
367
|
+
readonly type: "address";
|
|
368
|
+
}, {
|
|
369
|
+
readonly name: "amount";
|
|
370
|
+
readonly type: "uint256";
|
|
371
|
+
}];
|
|
372
|
+
readonly name: "transfer";
|
|
373
|
+
readonly outputs: readonly [{
|
|
374
|
+
readonly name: "";
|
|
375
|
+
readonly type: "bool";
|
|
376
|
+
}];
|
|
377
|
+
readonly stateMutability: "nonpayable";
|
|
378
|
+
readonly type: "function";
|
|
379
|
+
}];
|
|
380
|
+
//# sourceMappingURL=abi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abi.d.ts","sourceRoot":"","sources":["../src/abi.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuHhB,CAAC;AAEX,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BZ,CAAC"}
|
package/dist/abi.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
export const GYROBOARD_ABI = [
|
|
2
|
+
{
|
|
3
|
+
inputs: [{ name: 'usdMToken', type: 'address' }, { name: 'creatorAddress', type: 'address' }],
|
|
4
|
+
stateMutability: 'nonpayable',
|
|
5
|
+
type: 'constructor',
|
|
6
|
+
},
|
|
7
|
+
{ inputs: [], name: 'AlreadyPlayed', type: 'error' },
|
|
8
|
+
{ inputs: [], name: 'InvalidEntryFee', type: 'error' },
|
|
9
|
+
{ inputs: [], name: 'InvalidSpin', type: 'error' },
|
|
10
|
+
{ inputs: [], name: 'NoWinners', type: 'error' },
|
|
11
|
+
{ inputs: [], name: 'ReentrancyGuardReentrantCall', type: 'error' },
|
|
12
|
+
{ inputs: [], name: 'RoomAlreadyExists', type: 'error' },
|
|
13
|
+
{ inputs: [], name: 'RoomDoesNotExist', type: 'error' },
|
|
14
|
+
{ inputs: [], name: 'RoundFull', type: 'error' },
|
|
15
|
+
{ inputs: [{ name: 'token', type: 'address' }], name: 'SafeERC20FailedOperation', type: 'error' },
|
|
16
|
+
{
|
|
17
|
+
anonymous: false,
|
|
18
|
+
inputs: [
|
|
19
|
+
{ indexed: true, name: 'recipient', type: 'address' },
|
|
20
|
+
{ indexed: false, name: 'amount', type: 'uint256' },
|
|
21
|
+
{ indexed: false, name: 'roomId', type: 'uint256' },
|
|
22
|
+
],
|
|
23
|
+
name: 'Payout',
|
|
24
|
+
type: 'event',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
anonymous: false,
|
|
28
|
+
inputs: [
|
|
29
|
+
{ indexed: true, name: 'player', type: 'address' },
|
|
30
|
+
{ indexed: false, name: 'roomId', type: 'uint256' },
|
|
31
|
+
{ indexed: false, name: 'round', type: 'uint256' },
|
|
32
|
+
{ indexed: false, name: 'spin', type: 'uint256' },
|
|
33
|
+
],
|
|
34
|
+
name: 'Played',
|
|
35
|
+
type: 'event',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
anonymous: false,
|
|
39
|
+
inputs: [
|
|
40
|
+
{ indexed: false, name: 'roomId', type: 'uint256' },
|
|
41
|
+
{ indexed: false, name: 'entryFee', type: 'uint256' },
|
|
42
|
+
],
|
|
43
|
+
name: 'RoomCreated',
|
|
44
|
+
type: 'event',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
anonymous: false,
|
|
48
|
+
inputs: [
|
|
49
|
+
{ indexed: false, name: 'roomId', type: 'uint256' },
|
|
50
|
+
{ indexed: false, name: 'round', type: 'uint256' },
|
|
51
|
+
{ indexed: false, name: 'highestSpin', type: 'uint256' },
|
|
52
|
+
{ indexed: false, name: 'winnerCount', type: 'uint256' },
|
|
53
|
+
],
|
|
54
|
+
name: 'RoundCompleted',
|
|
55
|
+
type: 'event',
|
|
56
|
+
},
|
|
57
|
+
{ inputs: [], name: 'CREATOR_SHARE', outputs: [{ name: '', type: 'uint256' }], stateMutability: 'view', type: 'function' },
|
|
58
|
+
{ inputs: [], name: 'MAX_ENTRY_FEE', outputs: [{ name: '', type: 'uint256' }], stateMutability: 'view', type: 'function' },
|
|
59
|
+
{ inputs: [], name: 'MAX_PLAYERS', outputs: [{ name: '', type: 'uint256' }], stateMutability: 'view', type: 'function' },
|
|
60
|
+
{ inputs: [], name: 'MAX_SPIN', outputs: [{ name: '', type: 'uint256' }], stateMutability: 'view', type: 'function' },
|
|
61
|
+
{ inputs: [], name: 'MIN_ENTRY_FEE', outputs: [{ name: '', type: 'uint256' }], stateMutability: 'view', type: 'function' },
|
|
62
|
+
{ inputs: [], name: 'MIN_SPIN', outputs: [{ name: '', type: 'uint256' }], stateMutability: 'view', type: 'function' },
|
|
63
|
+
{ inputs: [], name: 'WINNER_SHARE', outputs: [{ name: '', type: 'uint256' }], stateMutability: 'view', type: 'function' },
|
|
64
|
+
{
|
|
65
|
+
inputs: [{ name: 'roomId', type: 'uint256' }, { name: 'entryFee', type: 'uint256' }],
|
|
66
|
+
name: 'createRoom',
|
|
67
|
+
outputs: [],
|
|
68
|
+
stateMutability: 'nonpayable',
|
|
69
|
+
type: 'function',
|
|
70
|
+
},
|
|
71
|
+
{ inputs: [], name: 'creator', outputs: [{ name: '', type: 'address' }], stateMutability: 'view', type: 'function' },
|
|
72
|
+
{ inputs: [], name: 'getRoomIds', outputs: [{ name: '', type: 'uint256[]' }], stateMutability: 'view', type: 'function' },
|
|
73
|
+
{
|
|
74
|
+
inputs: [{ name: 'roomId', type: 'uint256' }, { name: 'round', type: 'uint256' }],
|
|
75
|
+
name: 'getRoundPlayers',
|
|
76
|
+
outputs: [{
|
|
77
|
+
components: [{ name: 'player', type: 'address' }, { name: 'spin', type: 'uint256' }],
|
|
78
|
+
name: 'players',
|
|
79
|
+
type: 'tuple[]',
|
|
80
|
+
}],
|
|
81
|
+
stateMutability: 'view',
|
|
82
|
+
type: 'function',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
inputs: [{ name: '', type: 'uint256' }, { name: '', type: 'uint256' }, { name: '', type: 'address' }],
|
|
86
|
+
name: 'hasPlayed',
|
|
87
|
+
outputs: [{ name: '', type: 'bool' }],
|
|
88
|
+
stateMutability: 'view',
|
|
89
|
+
type: 'function',
|
|
90
|
+
},
|
|
91
|
+
{ inputs: [], name: 'mentoDollar', outputs: [{ name: '', type: 'address' }], stateMutability: 'view', type: 'function' },
|
|
92
|
+
{
|
|
93
|
+
inputs: [{ name: 'roomId', type: 'uint256' }, { name: 'spin', type: 'uint256' }],
|
|
94
|
+
name: 'play',
|
|
95
|
+
outputs: [],
|
|
96
|
+
stateMutability: 'nonpayable',
|
|
97
|
+
type: 'function',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
inputs: [{ name: '', type: 'uint256' }, { name: '', type: 'uint256' }, { name: '', type: 'address' }],
|
|
101
|
+
name: 'playerSpins',
|
|
102
|
+
outputs: [{ name: '', type: 'uint256' }],
|
|
103
|
+
stateMutability: 'view',
|
|
104
|
+
type: 'function',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
inputs: [{ name: '', type: 'uint256' }],
|
|
108
|
+
name: 'rooms',
|
|
109
|
+
outputs: [
|
|
110
|
+
{ name: 'entryFee', type: 'uint256' },
|
|
111
|
+
{ name: 'currentRound', type: 'uint256' },
|
|
112
|
+
{ name: 'playerCount', type: 'uint256' },
|
|
113
|
+
{ name: 'totalPot', type: 'uint256' },
|
|
114
|
+
{ name: 'highestSpin', type: 'uint256' },
|
|
115
|
+
{ name: 'exists', type: 'bool' },
|
|
116
|
+
],
|
|
117
|
+
stateMutability: 'view',
|
|
118
|
+
type: 'function',
|
|
119
|
+
},
|
|
120
|
+
];
|
|
121
|
+
export const ERC20_ABI = [
|
|
122
|
+
{
|
|
123
|
+
inputs: [{ name: 'spender', type: 'address' }, { name: 'amount', type: 'uint256' }],
|
|
124
|
+
name: 'approve',
|
|
125
|
+
outputs: [{ name: '', type: 'bool' }],
|
|
126
|
+
stateMutability: 'nonpayable',
|
|
127
|
+
type: 'function',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
inputs: [{ name: 'owner', type: 'address' }, { name: 'spender', type: 'address' }],
|
|
131
|
+
name: 'allowance',
|
|
132
|
+
outputs: [{ name: '', type: 'uint256' }],
|
|
133
|
+
stateMutability: 'view',
|
|
134
|
+
type: 'function',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
inputs: [{ name: 'account', type: 'address' }],
|
|
138
|
+
name: 'balanceOf',
|
|
139
|
+
outputs: [{ name: '', type: 'uint256' }],
|
|
140
|
+
stateMutability: 'view',
|
|
141
|
+
type: 'function',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
inputs: [{ name: 'to', type: 'address' }, { name: 'amount', type: 'uint256' }],
|
|
145
|
+
name: 'transfer',
|
|
146
|
+
outputs: [{ name: '', type: 'bool' }],
|
|
147
|
+
stateMutability: 'nonpayable',
|
|
148
|
+
type: 'function',
|
|
149
|
+
},
|
|
150
|
+
];
|
|
151
|
+
//# sourceMappingURL=abi.js.map
|
package/dist/abi.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abi.js","sourceRoot":"","sources":["../src/abi.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;QACE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC7F,eAAe,EAAE,YAAY;QAC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AI,EAAE,SAAS,EAAE,CAAC;QACxC,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC9E,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACrC,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;CACO,CAAC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Address } from 'viem';
|
|
2
|
+
import type { GyroSDKConfig, Room, Player, RoomWithId } from './types.js';
|
|
3
|
+
export declare function getRoomIds(opts?: GyroSDKConfig): Promise<bigint[]>;
|
|
4
|
+
export declare function getRoom(roomId: bigint | number, opts?: GyroSDKConfig): Promise<Room>;
|
|
5
|
+
export declare function getAllRooms(opts?: GyroSDKConfig): Promise<RoomWithId[]>;
|
|
6
|
+
export declare function getRoundPlayers(roomId: bigint | number, round: bigint | number, opts?: GyroSDKConfig): Promise<Player[]>;
|
|
7
|
+
export declare function hasPlayed(roomId: bigint | number, round: bigint | number, player: Address, opts?: GyroSDKConfig): Promise<boolean>;
|
|
8
|
+
export declare function getPlayerSpin(roomId: bigint | number, round: bigint | number, player: Address, opts?: GyroSDKConfig): Promise<bigint>;
|
|
9
|
+
export declare function getCreator(opts?: GyroSDKConfig): Promise<Address>;
|
|
10
|
+
export declare function getMentoDollar(opts?: GyroSDKConfig): Promise<Address>;
|
|
11
|
+
export declare function getUsdmBalance(account: Address, opts?: GyroSDKConfig): Promise<bigint>;
|
|
12
|
+
export declare function getUsdmAllowance(owner: Address, opts?: GyroSDKConfig): Promise<bigint>;
|
|
13
|
+
export declare function play(walletClient: any, roomId: bigint | number, spin: number, opts?: GyroSDKConfig): Promise<`0x${string}`>;
|
|
14
|
+
export declare function createRoom(walletClient: any, roomId: bigint | number, entryFee: bigint, opts?: GyroSDKConfig): Promise<`0x${string}`>;
|
|
15
|
+
export declare function approveUsdm(walletClient: any, amount?: bigint, opts?: GyroSDKConfig): Promise<`0x${string}`>;
|
|
16
|
+
export declare function transferUsdm(walletClient: any, to: Address, amount: bigint): Promise<`0x${string}`>;
|
|
17
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,OAAO,EAKb,MAAM,MAAM,CAAC;AAId,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAiB1E,wBAAsB,UAAU,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CASxE;AAED,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB1F;AAED,wBAAsB,WAAW,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAO7E;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,IAAI,CAAC,EAAE,aAAa,GACnB,OAAO,CAAC,MAAM,EAAE,CAAC,CAUnB;AAED,wBAAsB,SAAS,CAC7B,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,MAAM,EAAE,OAAO,EACf,IAAI,CAAC,EAAE,aAAa,GACnB,OAAO,CAAC,OAAO,CAAC,CASlB;AAED,wBAAsB,aAAa,CACjC,MAA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
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { createPublicClient, http, maxUint256, } from 'viem';
|
|
2
|
+
import { celo } from 'viem/chains';
|
|
3
|
+
import { GYROBOARD_ABI, ERC20_ABI } from './abi.js';
|
|
4
|
+
import { DEFAULT_CONTRACT_ADDRESS, USDM_ADDRESS, CELO_RPC } from './constants.js';
|
|
5
|
+
function resolveConfig(opts) {
|
|
6
|
+
return {
|
|
7
|
+
contractAddress: opts?.contractAddress ?? DEFAULT_CONTRACT_ADDRESS,
|
|
8
|
+
rpcUrl: opts?.rpcUrl ?? CELO_RPC,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function getPublicClient(rpcUrl) {
|
|
12
|
+
return createPublicClient({ chain: celo, transport: http(rpcUrl) });
|
|
13
|
+
}
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Read-only: GyroBoard
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
export async function getRoomIds(opts) {
|
|
18
|
+
const { contractAddress, rpcUrl } = resolveConfig(opts);
|
|
19
|
+
const client = getPublicClient(rpcUrl);
|
|
20
|
+
const ids = await client.readContract({
|
|
21
|
+
address: contractAddress,
|
|
22
|
+
abi: GYROBOARD_ABI,
|
|
23
|
+
functionName: 'getRoomIds',
|
|
24
|
+
});
|
|
25
|
+
return [...ids];
|
|
26
|
+
}
|
|
27
|
+
export async function getRoom(roomId, opts) {
|
|
28
|
+
const { contractAddress, rpcUrl } = resolveConfig(opts);
|
|
29
|
+
const client = getPublicClient(rpcUrl);
|
|
30
|
+
const result = await client.readContract({
|
|
31
|
+
address: contractAddress,
|
|
32
|
+
abi: GYROBOARD_ABI,
|
|
33
|
+
functionName: 'rooms',
|
|
34
|
+
args: [BigInt(roomId)],
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
entryFee: result[0],
|
|
38
|
+
currentRound: result[1],
|
|
39
|
+
playerCount: result[2],
|
|
40
|
+
totalPot: result[3],
|
|
41
|
+
highestSpin: result[4],
|
|
42
|
+
exists: result[5],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export async function getAllRooms(opts) {
|
|
46
|
+
const ids = await getRoomIds(opts);
|
|
47
|
+
const rooms = await Promise.all(ids.map(async (id) => {
|
|
48
|
+
const room = await getRoom(id, opts);
|
|
49
|
+
return { ...room, roomId: id };
|
|
50
|
+
}));
|
|
51
|
+
return rooms;
|
|
52
|
+
}
|
|
53
|
+
export async function getRoundPlayers(roomId, round, opts) {
|
|
54
|
+
const { contractAddress, rpcUrl } = resolveConfig(opts);
|
|
55
|
+
const client = getPublicClient(rpcUrl);
|
|
56
|
+
const players = await client.readContract({
|
|
57
|
+
address: contractAddress,
|
|
58
|
+
abi: GYROBOARD_ABI,
|
|
59
|
+
functionName: 'getRoundPlayers',
|
|
60
|
+
args: [BigInt(roomId), BigInt(round)],
|
|
61
|
+
});
|
|
62
|
+
return players.map((p) => ({ player: p.player, spin: p.spin }));
|
|
63
|
+
}
|
|
64
|
+
export async function hasPlayed(roomId, round, player, opts) {
|
|
65
|
+
const { contractAddress, rpcUrl } = resolveConfig(opts);
|
|
66
|
+
const client = getPublicClient(rpcUrl);
|
|
67
|
+
return client.readContract({
|
|
68
|
+
address: contractAddress,
|
|
69
|
+
abi: GYROBOARD_ABI,
|
|
70
|
+
functionName: 'hasPlayed',
|
|
71
|
+
args: [BigInt(roomId), BigInt(round), player],
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
export async function getPlayerSpin(roomId, round, player, opts) {
|
|
75
|
+
const { contractAddress, rpcUrl } = resolveConfig(opts);
|
|
76
|
+
const client = getPublicClient(rpcUrl);
|
|
77
|
+
return client.readContract({
|
|
78
|
+
address: contractAddress,
|
|
79
|
+
abi: GYROBOARD_ABI,
|
|
80
|
+
functionName: 'playerSpins',
|
|
81
|
+
args: [BigInt(roomId), BigInt(round), player],
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
export async function getCreator(opts) {
|
|
85
|
+
const { contractAddress, rpcUrl } = resolveConfig(opts);
|
|
86
|
+
const client = getPublicClient(rpcUrl);
|
|
87
|
+
return client.readContract({
|
|
88
|
+
address: contractAddress,
|
|
89
|
+
abi: GYROBOARD_ABI,
|
|
90
|
+
functionName: 'creator',
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
export async function getMentoDollar(opts) {
|
|
94
|
+
const { contractAddress, rpcUrl } = resolveConfig(opts);
|
|
95
|
+
const client = getPublicClient(rpcUrl);
|
|
96
|
+
return client.readContract({
|
|
97
|
+
address: contractAddress,
|
|
98
|
+
abi: GYROBOARD_ABI,
|
|
99
|
+
functionName: 'mentoDollar',
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
103
|
+
// Read-only: USDm (ERC20)
|
|
104
|
+
// ---------------------------------------------------------------------------
|
|
105
|
+
export async function getUsdmBalance(account, opts) {
|
|
106
|
+
const { rpcUrl } = resolveConfig(opts);
|
|
107
|
+
const client = getPublicClient(rpcUrl);
|
|
108
|
+
return client.readContract({
|
|
109
|
+
address: USDM_ADDRESS,
|
|
110
|
+
abi: ERC20_ABI,
|
|
111
|
+
functionName: 'balanceOf',
|
|
112
|
+
args: [account],
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
export async function getUsdmAllowance(owner, opts) {
|
|
116
|
+
const { contractAddress, rpcUrl } = resolveConfig(opts);
|
|
117
|
+
const client = getPublicClient(rpcUrl);
|
|
118
|
+
return client.readContract({
|
|
119
|
+
address: USDM_ADDRESS,
|
|
120
|
+
abi: ERC20_ABI,
|
|
121
|
+
functionName: 'allowance',
|
|
122
|
+
args: [owner, contractAddress],
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
// ---------------------------------------------------------------------------
|
|
126
|
+
// Write operations (require walletClient)
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
export async function play(walletClient, roomId, spin, opts) {
|
|
129
|
+
const { contractAddress } = resolveConfig(opts);
|
|
130
|
+
return walletClient.writeContract({
|
|
131
|
+
address: contractAddress,
|
|
132
|
+
abi: GYROBOARD_ABI,
|
|
133
|
+
functionName: 'play',
|
|
134
|
+
args: [BigInt(roomId), BigInt(spin)],
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
export async function createRoom(walletClient, roomId, entryFee, opts) {
|
|
138
|
+
const { contractAddress } = resolveConfig(opts);
|
|
139
|
+
return walletClient.writeContract({
|
|
140
|
+
address: contractAddress,
|
|
141
|
+
abi: GYROBOARD_ABI,
|
|
142
|
+
functionName: 'createRoom',
|
|
143
|
+
args: [BigInt(roomId), entryFee],
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
export async function approveUsdm(walletClient, amount = maxUint256, opts) {
|
|
147
|
+
const { contractAddress } = resolveConfig(opts);
|
|
148
|
+
return walletClient.writeContract({
|
|
149
|
+
address: USDM_ADDRESS,
|
|
150
|
+
abi: ERC20_ABI,
|
|
151
|
+
functionName: 'approve',
|
|
152
|
+
args: [contractAddress, amount],
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
export async function transferUsdm(walletClient, to, amount) {
|
|
156
|
+
return walletClient.writeContract({
|
|
157
|
+
address: USDM_ADDRESS,
|
|
158
|
+
abi: ERC20_ABI,
|
|
159
|
+
functionName: 'transfer',
|
|
160
|
+
args: [to, amount],
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,IAAI,EAKJ,UAAU,GACX,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,QAAQ,EAAE,MAA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B,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Address } from 'viem';
|
|
2
|
+
export declare const CELO_CHAIN_ID = 42220;
|
|
3
|
+
export declare const CELO_RPC = "https://forno.celo.org";
|
|
4
|
+
export declare const USDM_ADDRESS: Address;
|
|
5
|
+
export declare const DEFAULT_CONTRACT_ADDRESS: Address;
|
|
6
|
+
export declare const MIN_SPIN = 1;
|
|
7
|
+
export declare const MAX_SPIN = 10;
|
|
8
|
+
export declare const MAX_PLAYERS = 10;
|
|
9
|
+
export declare const WINNER_SHARE = 90;
|
|
10
|
+
export declare const CREATOR_SHARE = 10;
|
|
11
|
+
export declare const MIN_ENTRY_FEE = 20000000000000000n;
|
|
12
|
+
export declare const MAX_ENTRY_FEE = 100000000000000000000n;
|
|
13
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,eAAO,MAAM,aAAa,QAAQ,CAAC;AACnC,eAAO,MAAM,QAAQ,2BAA2B,CAAC;AAEjD,eAAO,MAAM,YAAY,EAAE,OAAsD,CAAC;AAElF,eAAO,MAAM,wBAAwB,EAAE,OAAsD,CAAC;AAE9F,eAAO,MAAM,QAAQ,IAAI,CAAC;AAC1B,eAAO,MAAM,QAAQ,KAAK,CAAC;AAC3B,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,aAAa,KAAK,CAAC;AAChC,eAAO,MAAM,aAAa,qBAA0B,CAAC;AACrD,eAAO,MAAM,aAAa,yBAA+B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const CELO_CHAIN_ID = 42220;
|
|
2
|
+
export const CELO_RPC = 'https://forno.celo.org';
|
|
3
|
+
export const USDM_ADDRESS = '0x765DE816845861e75A25fCA122bb6898B8B1282a';
|
|
4
|
+
export const DEFAULT_CONTRACT_ADDRESS = '0xa0C01234FEEA3401dE13598b3ef823afe0a9672B';
|
|
5
|
+
export const MIN_SPIN = 1;
|
|
6
|
+
export const MAX_SPIN = 10;
|
|
7
|
+
export const MAX_PLAYERS = 10;
|
|
8
|
+
export const WINNER_SHARE = 90;
|
|
9
|
+
export const CREATOR_SHARE = 10;
|
|
10
|
+
export const MIN_ENTRY_FEE = 20000000000000000n; // 0.02 USDm (18 decimals)
|
|
11
|
+
export const MAX_ENTRY_FEE = 100000000000000000000n; // 100 USDm
|
|
12
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC;AACnC,MAAM,CAAC,MAAM,QAAQ,GAAG,wBAAwB,CAAC;AAEjD,MAAM,CAAC,MAAM,YAAY,GAAY,4CAA4C,CAAC;AAElF,MAAM,CAAC,MAAM,wBAAwB,GAAY,4CAA4C,CAAC;AAE9F,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC;AAC1B,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAC;AAC3B,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAC9B,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAC/B,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAChC,MAAM,CAAC,MAAM,aAAa,GAAG,kBAAuB,CAAC,CAAC,0BAA0B;AAChF,MAAM,CAAC,MAAM,aAAa,GAAG,sBAA4B,CAAC,CAAC,WAAW"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { CELO_CHAIN_ID, CELO_RPC, USDM_ADDRESS, DEFAULT_CONTRACT_ADDRESS, MIN_SPIN, MAX_SPIN, MAX_PLAYERS, WINNER_SHARE, CREATOR_SHARE, MIN_ENTRY_FEE, MAX_ENTRY_FEE, } from './constants.js';
|
|
2
|
+
export { GYROBOARD_ABI, ERC20_ABI } from './abi.js';
|
|
3
|
+
export type { GyroSDKConfig, Room, Player, RoomWithId, TxResult } from './types.js';
|
|
4
|
+
export { getRoomIds, getRoom, getAllRooms, getRoundPlayers, hasPlayed, getPlayerSpin, getCreator, getMentoDollar, getUsdmBalance, getUsdmAllowance, } from './client.js';
|
|
5
|
+
export { play, createRoom, approveUsdm, transferUsdm, } from './client.js';
|
|
6
|
+
export { formatUsdm, parseUsdm, formatAddress, explorerUrl, addressExplorerUrl, } from './utils.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,wBAAwB,EACxB,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,aAAa,EACb,aAAa,EACb,aAAa,GACd,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGpD,YAAY,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGpF,OAAO,EACL,UAAU,EACV,OAAO,EACP,WAAW,EACX,eAAe,EACf,SAAS,EACT,aAAa,EACb,UAAU,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,IAAI,EACJ,UAAU,EACV,WAAW,EACX,YAAY,GACb,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,UAAU,EACV,SAAS,EACT,aAAa,EACb,WAAW,EACX,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Constants
|
|
2
|
+
export { CELO_CHAIN_ID, CELO_RPC, USDM_ADDRESS, DEFAULT_CONTRACT_ADDRESS, MIN_SPIN, MAX_SPIN, MAX_PLAYERS, WINNER_SHARE, CREATOR_SHARE, MIN_ENTRY_FEE, MAX_ENTRY_FEE, } from './constants.js';
|
|
3
|
+
// ABI
|
|
4
|
+
export { GYROBOARD_ABI, ERC20_ABI } from './abi.js';
|
|
5
|
+
// Read-only
|
|
6
|
+
export { getRoomIds, getRoom, getAllRooms, getRoundPlayers, hasPlayed, getPlayerSpin, getCreator, getMentoDollar, getUsdmBalance, getUsdmAllowance, } from './client.js';
|
|
7
|
+
// Write operations
|
|
8
|
+
export { play, createRoom, approveUsdm, transferUsdm, } from './client.js';
|
|
9
|
+
// Utilities
|
|
10
|
+
export { formatUsdm, parseUsdm, formatAddress, explorerUrl, addressExplorerUrl, } from './utils.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY;AACZ,OAAO,EACL,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,wBAAwB,EACxB,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,aAAa,EACb,aAAa,EACb,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB,MAAM;AACN,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAKpD,YAAY;AACZ,OAAO,EACL,UAAU,EACV,OAAO,EACP,WAAW,EACX,eAAe,EACf,SAAS,EACT,aAAa,EACb,UAAU,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,mBAAmB;AACnB,OAAO,EACL,IAAI,EACJ,UAAU,EACV,WAAW,EACX,YAAY,GACb,MAAM,aAAa,CAAC;AAErB,YAAY;AACZ,OAAO,EACL,UAAU,EACV,SAAS,EACT,aAAa,EACb,WAAW,EACX,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Address } from 'viem';
|
|
2
|
+
export interface GyroSDKConfig {
|
|
3
|
+
contractAddress?: Address;
|
|
4
|
+
rpcUrl?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface Room {
|
|
7
|
+
entryFee: bigint;
|
|
8
|
+
currentRound: bigint;
|
|
9
|
+
playerCount: bigint;
|
|
10
|
+
totalPot: bigint;
|
|
11
|
+
highestSpin: bigint;
|
|
12
|
+
exists: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface Player {
|
|
15
|
+
player: Address;
|
|
16
|
+
spin: bigint;
|
|
17
|
+
}
|
|
18
|
+
export interface RoomWithId extends Room {
|
|
19
|
+
roomId: bigint;
|
|
20
|
+
}
|
|
21
|
+
export interface TxResult {
|
|
22
|
+
hash: `0x${string}`;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,MAAM,WAAW,aAAa;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,IAAI;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAW,SAAQ,IAAI;IACtC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,KAAK,MAAM,EAAE,CAAC;CACrB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function formatUsdm(amount: bigint): string;
|
|
2
|
+
export declare function parseUsdm(amount: string | number): bigint;
|
|
3
|
+
export declare function formatAddress(address: string, chars?: number): string;
|
|
4
|
+
export declare function explorerUrl(txHash: string): string;
|
|
5
|
+
export declare function addressExplorerUrl(address: string): string;
|
|
6
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,MAAM,CAGhE;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1D"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { formatEther, parseEther } from 'viem';
|
|
2
|
+
export function formatUsdm(amount) {
|
|
3
|
+
return formatEther(amount);
|
|
4
|
+
}
|
|
5
|
+
export function parseUsdm(amount) {
|
|
6
|
+
return parseEther(String(amount));
|
|
7
|
+
}
|
|
8
|
+
export function formatAddress(address, chars = 4) {
|
|
9
|
+
if (address.length <= chars * 2 + 3)
|
|
10
|
+
return address;
|
|
11
|
+
return `${address.slice(0, chars + 2)}...${address.slice(-chars)}`;
|
|
12
|
+
}
|
|
13
|
+
export function explorerUrl(txHash) {
|
|
14
|
+
return `https://celoscan.io/tx/${txHash}`;
|
|
15
|
+
}
|
|
16
|
+
export function addressExplorerUrl(address) {
|
|
17
|
+
return `https://celoscan.io/address/${address}`;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAE/C,MAAM,UAAU,UAAU,CAAC,MAAc;IACvC,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,MAAuB;IAC/C,OAAO,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,KAAK,GAAG,CAAC;IACtD,IAAI,OAAO,CAAC,MAAM,IAAI,KAAK,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO,OAAO,CAAC;IACpD,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,OAAO,0BAA0B,MAAM,EAAE,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,OAAO,+BAA+B,OAAO,EAAE,CAAC;AAClD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gyro-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "JavaScript/TypeScript SDK for GyroBoard — competitive spin game on Celo with USDm",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"dev": "tsc --watch",
|
|
21
|
+
"prepublishOnly": "npm run build"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"celo",
|
|
25
|
+
"blockchain",
|
|
26
|
+
"game",
|
|
27
|
+
"gyroboard",
|
|
28
|
+
"minipay",
|
|
29
|
+
"usdm",
|
|
30
|
+
"defi"
|
|
31
|
+
],
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"viem": ">=2.0.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"viem": "^2.23.5",
|
|
38
|
+
"typescript": "^5.7.0"
|
|
39
|
+
}
|
|
40
|
+
}
|