@bigmaxwatermelon/sdk 0.4.0 → 0.4.2
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 +91 -24
- package/dist/cli.js +79 -467
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +26 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @bigmaxwatermelon/sdk
|
|
2
2
|
|
|
3
3
|
> TypeScript SDK for the Isometry DeFi protocol — Ethereum Sepolia.
|
|
4
4
|
|
|
5
|
-
**npm:** `@
|
|
5
|
+
**npm:** `@bigmaxwatermelon/sdk`
|
|
6
6
|
**version:** `0.4.0`
|
|
7
7
|
**network:** Ethereum Sepolia (chain ID 11155111)
|
|
8
8
|
**registry:** npm
|
|
@@ -12,17 +12,84 @@
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
npm
|
|
15
|
+
# npm (recommended)
|
|
16
|
+
npm install @bigmaxwatermelon/sdk
|
|
17
|
+
|
|
18
|
+
# 国内镜像未同步时,使用 tarball 直装
|
|
19
|
+
npm install https://registry.npmjs.org/@bigmaxwatermelon/sdk/-/sdk-0.4.0.tgz
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Requires:**
|
|
23
|
+
- Node.js ≥ 18
|
|
24
|
+
- ESM only (`type: module` in your project)
|
|
25
|
+
|
|
26
|
+
> ⚠️ This package is ESM-only. Use `import`, not `require`. If you use TypeScript, set `"module": "NodeNext"` or `"moduleResolution": "Bundler"`.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Quick Start — SDK
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { createClient } from '@bigmaxwatermelon/sdk'
|
|
34
|
+
|
|
35
|
+
const client = createClient({
|
|
36
|
+
rpcUrl: process.env.SEPOLIA_RPC_URL ?? 'https://ethereum-sepolia.publicnode.com',
|
|
37
|
+
graphUrl: 'https://console.isometry.network/graph/subgraphs/name/isometry',
|
|
38
|
+
addresses: {
|
|
39
|
+
platform: '0x062B11C5Ed0F2b1f9B7dFaa7B95737dD221863F7',
|
|
40
|
+
factory: '0x73D6BC64f4f54F9dF05851216F70F42135d56864',
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
// Read platform info
|
|
45
|
+
const info = await client.rpc.platform.getPlatformInfo()
|
|
46
|
+
console.log(info)
|
|
16
47
|
```
|
|
17
48
|
|
|
18
|
-
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Quick Start — CLI
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Check version / connectivity
|
|
55
|
+
npx @bigmaxwatermelon/sdk isometry system version
|
|
56
|
+
|
|
57
|
+
# Read data
|
|
58
|
+
npx @bigmaxwatermelon/sdk isometry platform info --json
|
|
59
|
+
npx @bigmaxwatermelon/sdk isometry token info <token-address> --json
|
|
60
|
+
|
|
61
|
+
# Simulate a write (dry-run, no signer needed)
|
|
62
|
+
npx @bigmaxwatermelon/sdk isometry token mint <token> <to> <amount> --simulate --json
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
> 💡 All CLI commands support `--json` for machine-readable output.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Write Operations
|
|
70
|
+
|
|
71
|
+
Write operations (mint, burn, pause, etc.) require a signer.
|
|
72
|
+
|
|
73
|
+
**Environment variable:**
|
|
74
|
+
```bash
|
|
75
|
+
export ISOMETRY_PRIVATE_KEY=0x_your_private_key_here
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Always simulate before executing:**
|
|
79
|
+
```bash
|
|
80
|
+
isometry token mint <token> <to> <amount> --simulate --json
|
|
81
|
+
# → Confirms the transaction looks correct, then:
|
|
82
|
+
isometry token mint <token> <to> <amount> --json
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
19
86
|
|
|
20
87
|
---
|
|
21
88
|
|
|
22
89
|
## Quick Start
|
|
23
90
|
|
|
24
91
|
```typescript
|
|
25
|
-
import { createClient } from '@
|
|
92
|
+
import { createClient } from '@bigmaxwatermelon/sdk'
|
|
26
93
|
|
|
27
94
|
const client = createClient({
|
|
28
95
|
rpcUrl: process.env.SEPOLIA_RPC_URL,
|
|
@@ -42,7 +109,7 @@ console.log(info)
|
|
|
42
109
|
### Initialize Client
|
|
43
110
|
|
|
44
111
|
```typescript
|
|
45
|
-
import { createClient } from '@
|
|
112
|
+
import { createClient } from '@bigmaxwatermelon/sdk'
|
|
46
113
|
|
|
47
114
|
const client = createClient({
|
|
48
115
|
// Required for RPC calls
|
|
@@ -105,7 +172,7 @@ const platformStats = await client.graph.analytics.platformStats()
|
|
|
105
172
|
### Write — Simulate Before Execute
|
|
106
173
|
|
|
107
174
|
```typescript
|
|
108
|
-
import { WriteExecutor } from '@
|
|
175
|
+
import { WriteExecutor } from '@bigmaxwatermelon/sdk'
|
|
109
176
|
|
|
110
177
|
// Create client with private key for signing
|
|
111
178
|
const writeClient = createClient({
|
|
@@ -153,14 +220,14 @@ The CLI is included in the same package.
|
|
|
153
220
|
### Install globally
|
|
154
221
|
|
|
155
222
|
```bash
|
|
156
|
-
npm install -g @
|
|
223
|
+
npm install -g @bigmaxwatermelon/sdk
|
|
157
224
|
isometry --version
|
|
158
225
|
```
|
|
159
226
|
|
|
160
227
|
### Or run via npx
|
|
161
228
|
|
|
162
229
|
```bash
|
|
163
|
-
npx @
|
|
230
|
+
npx @bigmaxwatermelon/sdk token info 0xd0473e07c68797f387fbe6c23981f7997d3ed5e3
|
|
164
231
|
```
|
|
165
232
|
|
|
166
233
|
### Or link locally
|
|
@@ -216,32 +283,32 @@ Full API reference at [docs/API.md](docs/API.md).
|
|
|
216
283
|
|
|
217
284
|
```typescript
|
|
218
285
|
// Client
|
|
219
|
-
import { createClient } from '@
|
|
220
|
-
import type { IsometryClient, IsometryConfig } from '@
|
|
286
|
+
import { createClient } from '@bigmaxwatermelon/sdk'
|
|
287
|
+
import type { IsometryClient, IsometryConfig } from '@bigmaxwatermelon/sdk'
|
|
221
288
|
|
|
222
289
|
// Wallet
|
|
223
|
-
import { createWallet, ReadOnlyWallet, PrivateKeyWallet } from '@
|
|
224
|
-
import type { IWallet, WalletMode } from '@
|
|
290
|
+
import { createWallet, ReadOnlyWallet, PrivateKeyWallet } from '@bigmaxwatermelon/sdk'
|
|
291
|
+
import type { IWallet, WalletMode } from '@bigmaxwatermelon/sdk'
|
|
225
292
|
|
|
226
293
|
// Write executor
|
|
227
|
-
import { WriteExecutor, makeWriteMeta } from '@
|
|
228
|
-
import type { WriteResult, SimulateResult, ExecuteResult, WriteError, WriteOpts, WriteMeta, TxReceipt } from '@
|
|
294
|
+
import { WriteExecutor, makeWriteMeta } from '@bigmaxwatermelon/sdk'
|
|
295
|
+
import type { WriteResult, SimulateResult, ExecuteResult, WriteError, WriteOpts, WriteMeta, TxReceipt } from '@bigmaxwatermelon/sdk'
|
|
229
296
|
|
|
230
297
|
// Error decoding
|
|
231
|
-
import { decodeError, ERROR_SELECTOR_MAP } from '@
|
|
232
|
-
import type { DecodedError } from '@
|
|
298
|
+
import { decodeError, ERROR_SELECTOR_MAP } from '@bigmaxwatermelon/sdk'
|
|
299
|
+
import type { DecodedError } from '@bigmaxwatermelon/sdk'
|
|
233
300
|
|
|
234
301
|
// Graph
|
|
235
|
-
import { createGraphClient, GraphClient, GraphError } from '@
|
|
236
|
-
import type { IsometryGraphConfig } from '@
|
|
237
|
-
import { TokenHistoryService, PlatformHistoryService, AnalyticsService } from '@
|
|
302
|
+
import { createGraphClient, GraphClient, GraphError } from '@bigmaxwatermelon/sdk'
|
|
303
|
+
import type { IsometryGraphConfig } from '@bigmaxwatermelon/sdk'
|
|
304
|
+
import { TokenHistoryService, PlatformHistoryService, AnalyticsService } from '@bigmaxwatermelon/sdk'
|
|
238
305
|
|
|
239
306
|
// Contract helpers
|
|
240
|
-
import { getContracts, getStableCoin } from '@
|
|
241
|
-
import type { ContractAddresses } from '@
|
|
307
|
+
import { getContracts, getStableCoin } from '@bigmaxwatermelon/sdk'
|
|
308
|
+
import type { ContractAddresses } from '@bigmaxwatermelon/sdk'
|
|
242
309
|
|
|
243
310
|
// Types
|
|
244
|
-
import type { PlatformInfo, PlatformRoles, TokenInfo, TokenStats, TokenRoles } from '@
|
|
311
|
+
import type { PlatformInfo, PlatformRoles, TokenInfo, TokenStats, TokenRoles } from '@bigmaxwatermelon/sdk'
|
|
245
312
|
```
|
|
246
313
|
|
|
247
314
|
---
|
|
@@ -304,7 +371,7 @@ All write operations return a typed `WriteResult`:
|
|
|
304
371
|
## Architecture
|
|
305
372
|
|
|
306
373
|
```
|
|
307
|
-
@
|
|
374
|
+
@bigmaxwatermelon/sdk
|
|
308
375
|
├── dist/index.js # SDK entry
|
|
309
376
|
├── dist/cli.js # CLI entry (bin: isometry)
|
|
310
377
|
└── docs/
|