@amadeus-protocol/sdk 1.1.0 → 1.1.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 +216 -31
- package/dist/api/chain.d.ts +2 -2
- package/dist/api/chain.js +2 -2
- package/dist/api/chain.js.map +1 -1
- package/dist/api/transaction.d.ts +5 -3
- package/dist/api/transaction.d.ts.map +1 -1
- package/dist/api/transaction.js +5 -3
- package/dist/api/transaction.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/types.d.ts +145 -65
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,6 +20,19 @@ pnpm add @amadeus-protocol/sdk
|
|
|
20
20
|
bun add @amadeus-protocol/sdk
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
> **ESM-only**: this package is published as pure ESM (`"type": "module"`). Use Node.js 20+ with `"type": "module"` in your `package.json`, or any modern bundler (Vite, webpack, esbuild, Metro). For CommonJS consumers, run via [`tsx`](https://github.com/privatenumber/tsx). See [Troubleshooting](https://docs.ama.one/sdk/9.-troubleshooting.md) for the `1.0.x` `ERR_MODULE_NOT_FOUND` issue and upgrade path.
|
|
24
|
+
|
|
25
|
+
## What's New in 1.1.0
|
|
26
|
+
|
|
27
|
+
- **`contract.view()`** — read-only contract execution
|
|
28
|
+
- **`chain.getByFilter()`** / **`chain.getKpi()`** — filtered tx queries + protocol KPIs
|
|
29
|
+
- **`proof.getContractStateProof()`** — merkle proofs for contract state
|
|
30
|
+
- **`submitAndWait(txPacked, { finalized: true })`** — wait for finality instead of confirmation
|
|
31
|
+
- **NFT contract** — `NFT_ABI`, `buildNftTransfer/Mint/CreateCollection`, `TransactionBuilder.nftTransfer/nftMint/nftCreateCollection`
|
|
32
|
+
- **ESM fix** — published `dist/*.js` now resolves correctly under raw `node` (the `1.0.x` `ERR_MODULE_NOT_FOUND` bug)
|
|
33
|
+
|
|
34
|
+
See the [CHANGELOG](./CHANGELOG.md) for full release history.
|
|
35
|
+
|
|
23
36
|
## Features
|
|
24
37
|
|
|
25
38
|
- **Canonical Serialization (VecPack)**: Deterministic encoding/decoding for cryptographic operations
|
|
@@ -46,7 +59,7 @@ const sdk = new AmadeusSDK({
|
|
|
46
59
|
|
|
47
60
|
// Query chain
|
|
48
61
|
const tip = await sdk.chain.getTip()
|
|
49
|
-
console.log('Current height:', tip.entry.height)
|
|
62
|
+
console.log('Current height:', tip.entry.header.height)
|
|
50
63
|
|
|
51
64
|
// Query wallet balance
|
|
52
65
|
const balance = await sdk.wallet.getBalance('5Kd3N...', 'AMA')
|
|
@@ -72,6 +85,8 @@ const sdk = new AmadeusSDK({
|
|
|
72
85
|
const stats = await sdk.chain.getStats()
|
|
73
86
|
const tip = await sdk.chain.getTip()
|
|
74
87
|
const entry = await sdk.chain.getByHash('5Kd3N...')
|
|
88
|
+
const { txs, cursor } = await sdk.chain.getByFilter({ contract: 'Coin', function: 'transfer' })
|
|
89
|
+
const { kpi } = await sdk.chain.getKpi()
|
|
75
90
|
|
|
76
91
|
// Wallet API
|
|
77
92
|
const balance = await sdk.wallet.getBalance('5Kd3N...', 'AMA')
|
|
@@ -79,12 +94,18 @@ const allBalances = await sdk.wallet.getAllBalances('5Kd3N...')
|
|
|
79
94
|
|
|
80
95
|
// Transaction API
|
|
81
96
|
const result = await sdk.transaction.submit(txPacked)
|
|
82
|
-
const
|
|
97
|
+
const confirmed = await sdk.transaction.submitAndWait(txPacked)
|
|
98
|
+
const finalized = await sdk.transaction.submitAndWait(txPacked, { finalized: true })
|
|
83
99
|
const tx = await sdk.transaction.get('5Kd3N...')
|
|
84
100
|
|
|
85
101
|
// Contract API
|
|
86
102
|
const contractData = await sdk.contract.get(key)
|
|
87
103
|
const richlist = await sdk.contract.getRichlist()
|
|
104
|
+
const { success, result } = await sdk.contract.view({
|
|
105
|
+
contract: 'LockupPrime',
|
|
106
|
+
function: 'view_balance',
|
|
107
|
+
args: ['my_vault']
|
|
108
|
+
})
|
|
88
109
|
|
|
89
110
|
// Epoch API
|
|
90
111
|
const scores = await sdk.epoch.getScore()
|
|
@@ -93,6 +114,10 @@ const emission = await sdk.epoch.getEmissionAddress('5Kd3N...')
|
|
|
93
114
|
// Peer API
|
|
94
115
|
const nodes = await sdk.peer.getNodes()
|
|
95
116
|
const trainers = await sdk.peer.getTrainers()
|
|
117
|
+
|
|
118
|
+
// Proof API
|
|
119
|
+
const validatorProof = await sdk.proof.getValidators(entryHash)
|
|
120
|
+
const stateProof = await sdk.proof.getContractStateProof(stateKey)
|
|
96
121
|
```
|
|
97
122
|
|
|
98
123
|
### Key Generation
|
|
@@ -151,6 +176,137 @@ const { txHash, txPacked } = builder.buildAndSign('Coin', 'transfer', [
|
|
|
151
176
|
])
|
|
152
177
|
```
|
|
153
178
|
|
|
179
|
+
#### ABI-Driven (Lockup, LockupPrime, etc.)
|
|
180
|
+
|
|
181
|
+
The recommended pattern for built-in contracts. Pass any ABI to `builder.contract(abi)` and get fully-typed function calls:
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
import {
|
|
185
|
+
TransactionBuilder,
|
|
186
|
+
LOCKUP_PRIME_ABI,
|
|
187
|
+
LOCKUP_ABI,
|
|
188
|
+
toAtomicAma
|
|
189
|
+
} from '@amadeus-protocol/sdk'
|
|
190
|
+
|
|
191
|
+
const builder = new TransactionBuilder('5Kd3N...')
|
|
192
|
+
|
|
193
|
+
// LockupPrime — auto-typed methods derived from the ABI
|
|
194
|
+
builder.contract(LOCKUP_PRIME_ABI).lock({ amount: toAtomicAma(100).toString(), tier: '30d' })
|
|
195
|
+
builder.contract(LOCKUP_PRIME_ABI).unlock({ vaultIndex: '3' })
|
|
196
|
+
builder.contract(LOCKUP_PRIME_ABI).daily_checkin({ vaultIndex: '7' })
|
|
197
|
+
|
|
198
|
+
// Lockup
|
|
199
|
+
builder.contract(LOCKUP_ABI).unlock({ vaultIndex: '5' })
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
#### NFT (transfer, mint, create_collection)
|
|
203
|
+
|
|
204
|
+
The `Nft` built-in contract has dedicated builder methods. NFT amounts are integer counts, **not** AMA atomic units.
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
const builder = new TransactionBuilder(privateKey)
|
|
208
|
+
|
|
209
|
+
// Create a collection (caller becomes owner)
|
|
210
|
+
builder.nftCreateCollection({ collection: 'AGENTIC', soulbound: false })
|
|
211
|
+
|
|
212
|
+
// Mint tokens (collection owner only)
|
|
213
|
+
builder.nftMint({ recipient: '5Kd3N...', amount: 10, collection: 'AGENTIC', token: '1' })
|
|
214
|
+
|
|
215
|
+
// Transfer
|
|
216
|
+
builder.nftTransfer({ recipient: '5Kd3N...', amount: 1, collection: 'AGENTIC', token: '1' })
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Static variants: `TransactionBuilder.buildSignedNftTransfer/Mint/CreateCollection(input)` — each takes the same params plus `senderPrivkey`.
|
|
220
|
+
|
|
221
|
+
### Signing Transactions
|
|
222
|
+
|
|
223
|
+
The SDK supports two patterns. Pick whichever fits your workflow.
|
|
224
|
+
|
|
225
|
+
#### Pattern 1 — Auto-signed (high-level, recommended)
|
|
226
|
+
|
|
227
|
+
The `TransactionBuilder` instance methods build **and** sign in one call. Best for app code where you have the private key in hand.
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
import { TransactionBuilder, LOCKUP_PRIME_ABI, toAtomicAma } from '@amadeus-protocol/sdk'
|
|
231
|
+
|
|
232
|
+
const builder = new TransactionBuilder('5Kd3N...') // Base58 seed
|
|
233
|
+
|
|
234
|
+
// Coin transfer
|
|
235
|
+
const a = builder.transfer({ recipient: '5Kd3N...', amount: 10.5, symbol: 'AMA' })
|
|
236
|
+
|
|
237
|
+
// ABI-driven (any contract)
|
|
238
|
+
const b = builder.contract(LOCKUP_PRIME_ABI).lock({
|
|
239
|
+
amount: toAtomicAma(100).toString(),
|
|
240
|
+
tier: '30d'
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
// NFT
|
|
244
|
+
const c = builder.nftTransfer({
|
|
245
|
+
recipient: '5Kd3N...',
|
|
246
|
+
amount: 1,
|
|
247
|
+
collection: 'AGENTIC',
|
|
248
|
+
token: '1'
|
|
249
|
+
})
|
|
250
|
+
|
|
251
|
+
// All return { txHash, txPacked } ready for sdk.transaction.submit(txPacked)
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
#### Pattern 2 — Manual: build a `ContractCall`, sign separately
|
|
255
|
+
|
|
256
|
+
Build a `ContractCall` with a standalone helper or `createContract(ABI)`, then sign it independently with `TransactionBuilder.signCall(privkey, call)`. Useful when:
|
|
257
|
+
|
|
258
|
+
- You want to inspect or log the call before signing
|
|
259
|
+
- The signing key lives somewhere else (HSM, separate process, separate machine)
|
|
260
|
+
- You want to batch-build and sign at the end
|
|
261
|
+
|
|
262
|
+
```typescript
|
|
263
|
+
import {
|
|
264
|
+
TransactionBuilder,
|
|
265
|
+
createContract,
|
|
266
|
+
LOCKUP_PRIME_ABI,
|
|
267
|
+
buildCoinTransfer,
|
|
268
|
+
buildNftTransfer,
|
|
269
|
+
toAtomicAma
|
|
270
|
+
} from '@amadeus-protocol/sdk'
|
|
271
|
+
|
|
272
|
+
// Build a ContractCall — three ways:
|
|
273
|
+
|
|
274
|
+
// A. Standalone helper (Coin)
|
|
275
|
+
const callA = buildCoinTransfer({ recipient: '5Kd3N...', amount: 10.5, symbol: 'AMA' })
|
|
276
|
+
|
|
277
|
+
// B. Standalone helper (NFT)
|
|
278
|
+
const callB = buildNftTransfer({
|
|
279
|
+
recipient: '5Kd3N...',
|
|
280
|
+
amount: 1,
|
|
281
|
+
collection: 'AGENTIC',
|
|
282
|
+
token: '1'
|
|
283
|
+
})
|
|
284
|
+
|
|
285
|
+
// C. ABI-driven, any contract
|
|
286
|
+
const lockupPrime = createContract(LOCKUP_PRIME_ABI)
|
|
287
|
+
const callC = lockupPrime.lock({ amount: toAtomicAma(100).toString(), tier: '30d' })
|
|
288
|
+
|
|
289
|
+
// Inspect if you want
|
|
290
|
+
console.log('Will call:', callC.contract, callC.method, callC.args)
|
|
291
|
+
|
|
292
|
+
// Sign with any private key (no builder instance needed)
|
|
293
|
+
const { txHash, txPacked } = TransactionBuilder.signCall('5Kd3N...', callC)
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
#### Build-unsigned-then-sign (debugging)
|
|
297
|
+
|
|
298
|
+
If you need to inspect the full unsigned transaction (nonce, signer, action) before signing:
|
|
299
|
+
|
|
300
|
+
```typescript
|
|
301
|
+
const builder = new TransactionBuilder('5Kd3N...')
|
|
302
|
+
|
|
303
|
+
const unsigned = builder.buildTransfer({ recipient: '5Kd3N...', amount: 10.5, symbol: 'AMA' })
|
|
304
|
+
console.log('Nonce:', unsigned.tx.nonce)
|
|
305
|
+
console.log('Action:', unsigned.tx.action)
|
|
306
|
+
|
|
307
|
+
const { txHash, txPacked } = builder.sign(unsigned)
|
|
308
|
+
```
|
|
309
|
+
|
|
154
310
|
#### Using Static Methods
|
|
155
311
|
|
|
156
312
|
```typescript
|
|
@@ -229,22 +385,19 @@ const atomic = toAtomicAma(1.5) // Returns 1500000000
|
|
|
229
385
|
const ama = fromAtomicAma(1500000000) // Returns 1.5
|
|
230
386
|
```
|
|
231
387
|
|
|
232
|
-
###
|
|
388
|
+
### Mnemonics (BIP39)
|
|
233
389
|
|
|
234
390
|
```typescript
|
|
235
|
-
import {
|
|
391
|
+
import { generateMnemonic, validateMnemonic, mnemonicToSeedBase58 } from '@amadeus-protocol/sdk'
|
|
236
392
|
|
|
237
|
-
//
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
// Build unsigned transaction
|
|
241
|
-
const unsignedTx = builder.build('Coin', 'transfer', args)
|
|
393
|
+
// Generate a 12-word mnemonic
|
|
394
|
+
const mnemonic = generateMnemonic()
|
|
242
395
|
|
|
243
|
-
//
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
396
|
+
// Validate a mnemonic
|
|
397
|
+
if (validateMnemonic(mnemonic)) {
|
|
398
|
+
// Derive a Base58 seed (compatible with TransactionBuilder)
|
|
399
|
+
const seedBase58 = mnemonicToSeedBase58(mnemonic)
|
|
400
|
+
}
|
|
248
401
|
```
|
|
249
402
|
|
|
250
403
|
### Encoding Utilities
|
|
@@ -300,6 +453,13 @@ const decrypted = await decryptWithPassword(encrypted, 'my-password')
|
|
|
300
453
|
- `derivePublicKeyFromSeedBase58(base58Seed: string): string` - Derive public key from Base58 seed
|
|
301
454
|
- `deriveSkAndSeed64FromBase58Seed(base58Seed64: string)` - Derive secret key and seed
|
|
302
455
|
|
|
456
|
+
### Mnemonics (BIP39)
|
|
457
|
+
|
|
458
|
+
- `generateMnemonic(): string` - Generate a 12-word BIP39 mnemonic
|
|
459
|
+
- `validateMnemonic(mnemonic: string): boolean` - Validate a BIP39 mnemonic
|
|
460
|
+
- `mnemonicToSeedBase58(mnemonic: string): string` - Derive a Base58 seed from a mnemonic
|
|
461
|
+
- `encodeVaultSecret`, `decodeVaultSecret`, `detectInputType` - Vault helpers
|
|
462
|
+
|
|
303
463
|
### Encoding
|
|
304
464
|
|
|
305
465
|
- `toBase58(buf: Uint8Array): string` - Encode bytes to Base58
|
|
@@ -311,11 +471,6 @@ const decrypted = await decryptWithPassword(encrypted, 'my-password')
|
|
|
311
471
|
- `uint8ArrayToArrayBuffer(bytes: Uint8Array): ArrayBuffer` - Convert Uint8Array to ArrayBuffer
|
|
312
472
|
- `arrayBufferToUint8Array(buffer: ArrayBuffer): Uint8Array` - Convert ArrayBuffer to Uint8Array
|
|
313
473
|
|
|
314
|
-
### Signing
|
|
315
|
-
|
|
316
|
-
- `signTx(hash: Uint8Array, sk: PrivKey): Uint8Array` - Sign a transaction hash
|
|
317
|
-
- `signOOB(sk: string, msg: Uint8Array): Uint8Array` - Sign an out-of-band message
|
|
318
|
-
|
|
319
474
|
### Conversion
|
|
320
475
|
|
|
321
476
|
- `toAtomicAma(ama: number): number` - Convert AMA to atomic units
|
|
@@ -333,18 +488,48 @@ const decrypted = await decryptWithPassword(encrypted, 'my-password')
|
|
|
333
488
|
|
|
334
489
|
- `TransactionBuilder` - Class for building and signing transactions
|
|
335
490
|
- **Constructor:** `new TransactionBuilder(privateKey?: string)` - Create a new builder instance
|
|
336
|
-
- **
|
|
337
|
-
- `
|
|
338
|
-
|
|
339
|
-
- `
|
|
340
|
-
- `
|
|
341
|
-
- `
|
|
342
|
-
|
|
343
|
-
- `
|
|
344
|
-
|
|
345
|
-
- `
|
|
346
|
-
- `
|
|
347
|
-
|
|
491
|
+
- **ABI-driven (recommended):**
|
|
492
|
+
- `contract(abi)` - Returns a typed, signer-bound contract interface; each ABI function becomes a method that builds and signs in one step
|
|
493
|
+
- **Generic instance methods:**
|
|
494
|
+
- `build(contract, method, args, signerPk?): UnsignedTransactionWithHash`
|
|
495
|
+
- `sign(unsignedTx, signerSk?): BuildTransactionResult`
|
|
496
|
+
- `buildAndSign(contract, method, args, signerPk?, signerSk?): BuildTransactionResult`
|
|
497
|
+
- `buildFromCall(call): UnsignedTransactionWithHash`
|
|
498
|
+
- `buildAndSignCall(call): BuildTransactionResult`
|
|
499
|
+
- **Coin transfer:**
|
|
500
|
+
- `buildTransfer(input, signerPk?): UnsignedTransactionWithHash`
|
|
501
|
+
- `transfer(input): BuildTransactionResult`
|
|
502
|
+
- **NFT (Nft contract):**
|
|
503
|
+
- `nftTransfer({ recipient, amount, collection, token }): BuildTransactionResult`
|
|
504
|
+
- `nftMint({ recipient, amount, collection, token }): BuildTransactionResult`
|
|
505
|
+
- `nftCreateCollection({ collection, soulbound? }): BuildTransactionResult`
|
|
506
|
+
- **Lockup / LockupPrime convenience methods:**
|
|
507
|
+
- `lockupUnlock({ vaultIndex }): BuildTransactionResult`
|
|
508
|
+
- `lockupPrimeLock({ amount, tier }): BuildTransactionResult`
|
|
509
|
+
- `lockupPrimeUnlock({ vaultIndex }): BuildTransactionResult`
|
|
510
|
+
- `lockupPrimeDailyCheckin({ vaultIndex }): BuildTransactionResult`
|
|
511
|
+
- **Static methods:** `signCall`, `buildFromCall`, `buildAndSignCall`, `buildSignedTransfer`, `buildSignedNft{Transfer,Mint,CreateCollection}`, `buildSignedLockup{Unlock}`, `buildSignedLockupPrime{Lock,Unlock,DailyCheckin}`
|
|
512
|
+
|
|
513
|
+
### Contract ABIs
|
|
514
|
+
|
|
515
|
+
`as const` ABI definitions for built-in contracts. Pass any ABI to `createContract(abi)` or `builder.contract(abi)` for fully-typed function calls.
|
|
516
|
+
|
|
517
|
+
- `LOCKUP_ABI` - `Lockup` (vesting) — `unlock(vaultIndex)`
|
|
518
|
+
- `LOCKUP_PRIME_ABI` - `LockupPrime` — `lock(amount, tier)`, `unlock(vaultIndex)`, `daily_checkin(vaultIndex)`
|
|
519
|
+
- `NFT_ABI` - `Nft` — `transfer`, `mint`, `create_collection`
|
|
520
|
+
|
|
521
|
+
Standalone builders that return a `ContractCall`:
|
|
522
|
+
|
|
523
|
+
- `buildCoinTransfer({ recipient, amount, symbol })`
|
|
524
|
+
- `buildNftTransfer({ recipient, amount, collection, token })`
|
|
525
|
+
- `buildNftMint({ recipient, amount, collection, token })`
|
|
526
|
+
- `buildNftCreateCollection({ collection, soulbound? })`
|
|
527
|
+
- `createContract(abi).fn(params)` - generic ABI-driven builder
|
|
528
|
+
- `buildContractCall(abi, fn, params)` - lower-level ABI-driven builder
|
|
529
|
+
|
|
530
|
+
### Full API Reference
|
|
531
|
+
|
|
532
|
+
For complete documentation including request/response types, error handling, and end-to-end examples, see [docs.ama.one/sdk](https://docs.ama.one/sdk/1.-introduction.md).
|
|
348
533
|
|
|
349
534
|
## Examples
|
|
350
535
|
|
package/dist/api/chain.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ declare class ChainAPI {
|
|
|
13
13
|
* @example
|
|
14
14
|
* ```ts
|
|
15
15
|
* const { entry } = await sdk.chain.getTip()
|
|
16
|
-
* console.log('Current height:', entry.height)
|
|
16
|
+
* console.log('Current height:', entry.header.height)
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
19
|
getTip(): Promise<GetTipResponse>;
|
|
@@ -25,7 +25,7 @@ declare class ChainAPI {
|
|
|
25
25
|
* @example
|
|
26
26
|
* ```ts
|
|
27
27
|
* const { stats } = await sdk.chain.getStats()
|
|
28
|
-
* console.log('
|
|
28
|
+
* console.log('Tip height:', stats.height)
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
getStats(): Promise<GetStatsResponse>;
|
package/dist/api/chain.js
CHANGED
|
@@ -15,7 +15,7 @@ var ChainAPI = class {
|
|
|
15
15
|
* @example
|
|
16
16
|
* ```ts
|
|
17
17
|
* const { entry } = await sdk.chain.getTip()
|
|
18
|
-
* console.log('Current height:', entry.height)
|
|
18
|
+
* console.log('Current height:', entry.header.height)
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
21
|
async getTip() {
|
|
@@ -29,7 +29,7 @@ var ChainAPI = class {
|
|
|
29
29
|
* @example
|
|
30
30
|
* ```ts
|
|
31
31
|
* const { stats } = await sdk.chain.getStats()
|
|
32
|
-
* console.log('
|
|
32
|
+
* console.log('Tip height:', stats.height)
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
35
|
async getStats() {
|
package/dist/api/chain.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain.js","names":[],"sources":["../../src/api/chain.ts"],"sourcesContent":["/**\n * Chain API\n *\n * Provides methods for querying blockchain data\n */\n\nimport type { AmadeusClient } from '../client'\nimport type {\n\tTransactionFilters,\n\tGetTipResponse,\n\tGetStatsResponse,\n\tGetByHashResponse,\n\tGetByHeightResponse,\n\tGetTransactionsInEntryResponse,\n\tGetTransactionEventsByAccountResponse,\n\tTransaction,\n\tTxByFilterParams,\n\tTxByFilterResponse,\n\tGetKpiResponse\n} from '../types'\nimport { Base58HashSchema, TransactionFiltersSchema } from '../schemas'\nimport { Schema } from 'effect'\nimport { validate } from '../validation'\n\nexport class ChainAPI {\n\tconstructor(private client: AmadeusClient) {}\n\n\t/**\n\t * Get the current chain tip (latest entry)\n\t *\n\t * @returns Promise resolving to the latest chain entry\n\t *\n\t * @example\n\t * ```ts\n\t * const { entry } = await sdk.chain.getTip()\n\t * console.log('Current height:', entry.height)\n\t * ```\n\t */\n\tasync getTip(): Promise<GetTipResponse> {\n\t\treturn this.client.get<GetTipResponse>('/api/chain/tip')\n\t}\n\n\t/**\n\t * Get chain statistics\n\t *\n\t * @returns Promise resolving to chain statistics\n\t *\n\t * @example\n\t * ```ts\n\t * const { stats } = await sdk.chain.getStats()\n\t * console.log('
|
|
1
|
+
{"version":3,"file":"chain.js","names":[],"sources":["../../src/api/chain.ts"],"sourcesContent":["/**\n * Chain API\n *\n * Provides methods for querying blockchain data\n */\n\nimport type { AmadeusClient } from '../client'\nimport type {\n\tTransactionFilters,\n\tGetTipResponse,\n\tGetStatsResponse,\n\tGetByHashResponse,\n\tGetByHeightResponse,\n\tGetTransactionsInEntryResponse,\n\tGetTransactionEventsByAccountResponse,\n\tTransaction,\n\tTxByFilterParams,\n\tTxByFilterResponse,\n\tGetKpiResponse\n} from '../types'\nimport { Base58HashSchema, TransactionFiltersSchema } from '../schemas'\nimport { Schema } from 'effect'\nimport { validate } from '../validation'\n\nexport class ChainAPI {\n\tconstructor(private client: AmadeusClient) {}\n\n\t/**\n\t * Get the current chain tip (latest entry)\n\t *\n\t * @returns Promise resolving to the latest chain entry\n\t *\n\t * @example\n\t * ```ts\n\t * const { entry } = await sdk.chain.getTip()\n\t * console.log('Current height:', entry.header.height)\n\t * ```\n\t */\n\tasync getTip(): Promise<GetTipResponse> {\n\t\treturn this.client.get<GetTipResponse>('/api/chain/tip')\n\t}\n\n\t/**\n\t * Get chain statistics\n\t *\n\t * @returns Promise resolving to chain statistics\n\t *\n\t * @example\n\t * ```ts\n\t * const { stats } = await sdk.chain.getStats()\n\t * console.log('Tip height:', stats.height)\n\t * ```\n\t */\n\tasync getStats(): Promise<GetStatsResponse> {\n\t\treturn this.client.get<GetStatsResponse>('/api/chain/stats')\n\t}\n\n\t/**\n\t * Get entry by hash\n\t *\n\t * @param hash - Entry hash (Base58 encoded)\n\t * @param filterOnFunction - Optional function filter\n\t * @returns Promise resolving to chain entry\n\t * @throws {Error} If hash is invalid\n\t *\n\t * @example\n\t * ```ts\n\t * const { entry } = await sdk.chain.getByHash('5Kd3N...')\n\t * ```\n\t */\n\tasync getByHash(hash: string, filterOnFunction?: string): Promise<GetByHashResponse> {\n\t\tvalidate(Base58HashSchema, hash)\n\t\treturn this.client.get<GetByHashResponse>(`/api/chain/hash/${hash}`, {\n\t\t\tfilter_on_function: filterOnFunction\n\t\t})\n\t}\n\n\t/**\n\t * Get entries by height\n\t *\n\t * @param height - Block height (must be >= 0)\n\t * @returns Promise resolving to chain entries at the specified height\n\t * @throws {Error} If height is invalid\n\t *\n\t * @example\n\t * ```ts\n\t * const { entries } = await sdk.chain.getByHeight(1000)\n\t * ```\n\t */\n\tasync getByHeight(height: number): Promise<GetByHeightResponse> {\n\t\tvalidate(Schema.NonNegativeInt, height)\n\t\treturn this.client.get<GetByHeightResponse>(`/api/chain/height/${height}`)\n\t}\n\n\t/**\n\t * Get entries by height with transactions\n\t *\n\t * @param height - Block height (must be >= 0)\n\t * @returns Promise resolving to chain entries with transactions at the specified height\n\t * @throws {Error} If height is invalid\n\t *\n\t * @example\n\t * ```ts\n\t * const { entries } = await sdk.chain.getByHeightWithTxs(1000)\n\t * ```\n\t */\n\tasync getByHeightWithTxs(height: number): Promise<GetByHeightResponse> {\n\t\tvalidate(Schema.NonNegativeInt, height)\n\t\treturn this.client.get<GetByHeightResponse>(`/api/chain/height_with_txs/${height}`)\n\t}\n\n\t/**\n\t * Get a specific transaction by ID\n\t *\n\t * @param txid - Transaction ID (Base58 encoded)\n\t * @returns Promise resolving to transaction data\n\t * @throws {Error} If transaction ID is invalid\n\t *\n\t * @example\n\t * ```ts\n\t * const tx = await sdk.chain.getTransaction('5Kd3N...')\n\t * ```\n\t */\n\tasync getTransaction(txid: string): Promise<Transaction> {\n\t\tvalidate(Base58HashSchema, txid)\n\t\treturn this.client.get<Transaction>(`/api/chain/tx/${txid}`)\n\t}\n\n\t/**\n\t * Get transactions in a specific entry\n\t *\n\t * @param entryHash - Entry hash (Base58 encoded)\n\t * @returns Promise resolving to transactions in the entry\n\t * @throws {Error} If entry hash is invalid\n\t *\n\t * @example\n\t * ```ts\n\t * const { txs } = await sdk.chain.getTransactionsInEntry('5Kd3N...')\n\t * ```\n\t */\n\tasync getTransactionsInEntry(entryHash: string): Promise<GetTransactionsInEntryResponse> {\n\t\tvalidate(Base58HashSchema, entryHash)\n\t\treturn this.client.get<GetTransactionsInEntryResponse>(\n\t\t\t`/api/chain/txs_in_entry/${entryHash}`\n\t\t)\n\t}\n\n\t/**\n\t * Get transaction events by account with filtering\n\t *\n\t * @param account - Account address (Base58 encoded)\n\t * @param filters - Optional filters for transactions\n\t * @returns Promise resolving to transaction events\n\t * @throws {Error} If account address is invalid\n\t *\n\t * @example\n\t * ```ts\n\t * const { txs, cursor } = await sdk.chain.getTransactionEventsByAccount('5Kd3N...', {\n\t * limit: 10,\n\t * sort: 'desc'\n\t * })\n\t * ```\n\t */\n\tasync getTransactionEventsByAccount(\n\t\taccount: string,\n\t\tfilters: TransactionFilters = {}\n\t): Promise<GetTransactionEventsByAccountResponse> {\n\t\tvalidate(Base58HashSchema, account)\n\t\tvalidate(TransactionFiltersSchema, filters)\n\n\t\treturn this.client.get<GetTransactionEventsByAccountResponse>(\n\t\t\t`/api/chain/tx_events_by_account/${account}`,\n\t\t\tfilters as Record<string, unknown>\n\t\t)\n\t}\n\n\t/**\n\t * Query transactions by arbitrary filter (signer, receiver, contract, function).\n\t *\n\t * All filter fields are optional; provide only the ones you want to constrain.\n\t * Returns a cursor for pagination — pass it back as `cursor` in a subsequent call.\n\t *\n\t * @example\n\t * ```ts\n\t * const { txs, cursor } = await sdk.chain.getByFilter({\n\t * signer: '5Kd3N...',\n\t * contract: 'Coin',\n\t * function: 'transfer',\n\t * limit: 50,\n\t * sort: 'desc'\n\t * })\n\t * ```\n\t */\n\tasync getByFilter(filters: TxByFilterParams = {}): Promise<TxByFilterResponse> {\n\t\treturn this.client.get<TxByFilterResponse>(\n\t\t\t'/api/chain/tx_by_filter',\n\t\t\tfilters as Record<string, unknown>\n\t\t)\n\t}\n\n\t/**\n\t * Get protocol-level KPIs (burned, fees, active validators/peers, total tx, UAW, etc.).\n\t *\n\t * @example\n\t * ```ts\n\t * const { kpi } = await sdk.chain.getKpi()\n\t * console.log('Total tx:', kpi.total_tx)\n\t * ```\n\t */\n\tasync getKpi(): Promise<GetKpiResponse> {\n\t\treturn this.client.get<GetKpiResponse>('/api/chain/kpi')\n\t}\n}\n"],"mappings":";;;;AAwBA,IAAa,WAAb,MAAsB;CACD;CAApB,YAAY,QAA+B;EAAvB,KAAA,SAAA;;;;;;;;;;;;;CAapB,MAAM,SAAkC;EACvC,OAAO,KAAK,OAAO,IAAoB,iBAAiB;;;;;;;;;;;;;CAczD,MAAM,WAAsC;EAC3C,OAAO,KAAK,OAAO,IAAsB,mBAAmB;;;;;;;;;;;;;;;CAgB7D,MAAM,UAAU,MAAc,kBAAuD;EACpF,SAAS,kBAAkB,KAAK;EAChC,OAAO,KAAK,OAAO,IAAuB,mBAAmB,QAAQ,EACpE,oBAAoB,kBACpB,CAAC;;;;;;;;;;;;;;CAeH,MAAM,YAAY,QAA8C;EAC/D,SAAS,OAAO,gBAAgB,OAAO;EACvC,OAAO,KAAK,OAAO,IAAyB,qBAAqB,SAAS;;;;;;;;;;;;;;CAe3E,MAAM,mBAAmB,QAA8C;EACtE,SAAS,OAAO,gBAAgB,OAAO;EACvC,OAAO,KAAK,OAAO,IAAyB,8BAA8B,SAAS;;;;;;;;;;;;;;CAepF,MAAM,eAAe,MAAoC;EACxD,SAAS,kBAAkB,KAAK;EAChC,OAAO,KAAK,OAAO,IAAiB,iBAAiB,OAAO;;;;;;;;;;;;;;CAe7D,MAAM,uBAAuB,WAA4D;EACxF,SAAS,kBAAkB,UAAU;EACrC,OAAO,KAAK,OAAO,IAClB,2BAA2B,YAC3B;;;;;;;;;;;;;;;;;;CAmBF,MAAM,8BACL,SACA,UAA8B,EAAE,EACiB;EACjD,SAAS,kBAAkB,QAAQ;EACnC,SAAS,0BAA0B,QAAQ;EAE3C,OAAO,KAAK,OAAO,IAClB,mCAAmC,WACnC,QACA;;;;;;;;;;;;;;;;;;;CAoBF,MAAM,YAAY,UAA4B,EAAE,EAA+B;EAC9E,OAAO,KAAK,OAAO,IAClB,2BACA,QACA;;;;;;;;;;;CAYF,MAAM,SAAkC;EACvC,OAAO,KAAK,OAAO,IAAoB,iBAAiB"}
|
|
@@ -14,9 +14,11 @@ declare class TransactionAPI {
|
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
16
|
* ```ts
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* console.log('Transaction hash:',
|
|
17
|
+
* try {
|
|
18
|
+
* const { hash } = await sdk.transaction.submit(txPacked)
|
|
19
|
+
* console.log('Transaction hash:', hash)
|
|
20
|
+
* } catch (err) {
|
|
21
|
+
* console.error('Submission failed:', err.message)
|
|
20
22
|
* }
|
|
21
23
|
* ```
|
|
22
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","names":[],"sources":["../../src/api/transaction.ts"],"mappings":";;;;cAiBa,cAAA;EAAA,QACQ,MAAA;cAAA,MAAA,EAAQ,aAAA;
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","names":[],"sources":["../../src/api/transaction.ts"],"mappings":";;;;cAiBa,cAAA;EAAA,QACQ,MAAA;cAAA,MAAA,EAAQ,aAAA;EAmBiB;;;;;;;;;;;;;;;;;EAAvC,MAAA,CAAO,QAAA,EAAU,UAAA,YAAsB,OAAA,CAAQ,yBAAA;EAAR;;;;;;;;;;;;;;;;EAqBvC,aAAA,CACL,QAAA,EAAU,UAAA,WACV,OAAA,GAAS,oBAAA,GACP,OAAA,CAAQ,gCAAA;EAqCgE;;;;;;;;;;;;EAjBrE,GAAA,CAAI,IAAA,WAAe,OAAA,CAAQ,WAAA;;;;;;;;;;;;;EAiB3B,UAAA,CAAW,SAAA,WAAoB,OAAA,CAAQ,8BAAA;AAAA"}
|
package/dist/api/transaction.js
CHANGED
|
@@ -15,9 +15,11 @@ var TransactionAPI = class {
|
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
17
|
* ```ts
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* console.log('Transaction hash:',
|
|
18
|
+
* try {
|
|
19
|
+
* const { hash } = await sdk.transaction.submit(txPacked)
|
|
20
|
+
* console.log('Transaction hash:', hash)
|
|
21
|
+
* } catch (err) {
|
|
22
|
+
* console.error('Submission failed:', err.message)
|
|
21
23
|
* }
|
|
22
24
|
* ```
|
|
23
25
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","names":[],"sources":["../../src/api/transaction.ts"],"sourcesContent":["/**\n * Transaction API\n *\n * Provides methods for submitting transactions and querying transaction data\n */\n\nimport type { AmadeusClient } from '../client'\nimport type {\n\tSubmitTransactionResponse,\n\tSubmitAndWaitTransactionResponse,\n\tSubmitAndWaitOptions,\n\tGetTransactionsInEntryResponse,\n\tTransaction\n} from '../types'\nimport { Base58HashSchema, TransactionDataSchema } from '../schemas'\nimport { validate } from '../validation'\n\nexport class TransactionAPI {\n\tconstructor(private client: AmadeusClient) {}\n\n\t/**\n\t * Submit a transaction to the network\n\t *\n\t * @param txPacked - Packed transaction as Uint8Array or Base58 string\n\t * @returns Promise resolving to submission result\n\t * @throws {AmadeusSDKError} If transaction data is invalid\n\t *\n\t * @example\n\t * ```ts\n\t * const
|
|
1
|
+
{"version":3,"file":"transaction.js","names":[],"sources":["../../src/api/transaction.ts"],"sourcesContent":["/**\n * Transaction API\n *\n * Provides methods for submitting transactions and querying transaction data\n */\n\nimport type { AmadeusClient } from '../client'\nimport type {\n\tSubmitTransactionResponse,\n\tSubmitAndWaitTransactionResponse,\n\tSubmitAndWaitOptions,\n\tGetTransactionsInEntryResponse,\n\tTransaction\n} from '../types'\nimport { Base58HashSchema, TransactionDataSchema } from '../schemas'\nimport { validate } from '../validation'\n\nexport class TransactionAPI {\n\tconstructor(private client: AmadeusClient) {}\n\n\t/**\n\t * Submit a transaction to the network\n\t *\n\t * @param txPacked - Packed transaction as Uint8Array or Base58 string\n\t * @returns Promise resolving to submission result\n\t * @throws {AmadeusSDKError} If transaction data is invalid\n\t *\n\t * @example\n\t * ```ts\n\t * try {\n\t * const { hash } = await sdk.transaction.submit(txPacked)\n\t * console.log('Transaction hash:', hash)\n\t * } catch (err) {\n\t * console.error('Submission failed:', err.message)\n\t * }\n\t * ```\n\t */\n\tasync submit(txPacked: Uint8Array | string): Promise<SubmitTransactionResponse> {\n\t\tvalidate(TransactionDataSchema, txPacked)\n\t\treturn this.client.post<SubmitTransactionResponse>('/api/tx/submit', txPacked)\n\t}\n\n\t/**\n\t * Submit a transaction and wait for confirmation.\n\t *\n\t * Pass `{ finalized: true }` to wait for finality (consensus reached) instead\n\t * of just confirmation. Default behavior is to return as soon as the tx is\n\t * included in an entry.\n\t *\n\t * @example\n\t * ```ts\n\t * // Wait for confirmation only (fast)\n\t * const result = await sdk.transaction.submitAndWait(txPacked)\n\t *\n\t * // Wait for finality (slower but stronger guarantee)\n\t * const finalized = await sdk.transaction.submitAndWait(txPacked, { finalized: true })\n\t * ```\n\t */\n\tasync submitAndWait(\n\t\ttxPacked: Uint8Array | string,\n\t\toptions: SubmitAndWaitOptions = {}\n\t): Promise<SubmitAndWaitTransactionResponse> {\n\t\tvalidate(TransactionDataSchema, txPacked)\n\t\tconst endpoint = options.finalized\n\t\t\t? '/api/tx/submit_and_wait?finalized=true'\n\t\t\t: '/api/tx/submit_and_wait'\n\t\treturn this.client.post<SubmitAndWaitTransactionResponse>(endpoint, txPacked)\n\t}\n\n\t/**\n\t * Get transaction by ID\n\t *\n\t * @param txid - Transaction ID (Base58 encoded)\n\t * @returns Promise resolving to transaction data\n\t * @throws {AmadeusSDKError} If transaction ID is invalid\n\t *\n\t * @example\n\t * ```ts\n\t * const tx = await sdk.transaction.get('5Kd3N...')\n\t * ```\n\t */\n\tasync get(txid: string): Promise<Transaction> {\n\t\tvalidate(Base58HashSchema, txid)\n\t\treturn this.client.get<Transaction>(`/api/chain/tx/${txid}`)\n\t}\n\n\t/**\n\t * Get transactions by entry hash\n\t *\n\t * @param entryHash - Entry hash (Base58 encoded)\n\t * @returns Promise resolving to transactions in the entry\n\t * @throws {AmadeusSDKError} If entry hash is invalid\n\t *\n\t * @example\n\t * ```ts\n\t * const { txs } = await sdk.transaction.getByEntry('5Kd3N...')\n\t * ```\n\t */\n\tasync getByEntry(entryHash: string): Promise<GetTransactionsInEntryResponse> {\n\t\tvalidate(Base58HashSchema, entryHash)\n\t\treturn this.client.get<GetTransactionsInEntryResponse>(\n\t\t\t`/api/chain/txs_in_entry/${entryHash}`\n\t\t)\n\t}\n}\n"],"mappings":";;;AAiBA,IAAa,iBAAb,MAA4B;CACP;CAApB,YAAY,QAA+B;EAAvB,KAAA,SAAA;;;;;;;;;;;;;;;;;;;CAmBpB,MAAM,OAAO,UAAmE;EAC/E,SAAS,uBAAuB,SAAS;EACzC,OAAO,KAAK,OAAO,KAAgC,kBAAkB,SAAS;;;;;;;;;;;;;;;;;;CAmB/E,MAAM,cACL,UACA,UAAgC,EAAE,EACU;EAC5C,SAAS,uBAAuB,SAAS;EACzC,MAAM,WAAW,QAAQ,YACtB,2CACA;EACH,OAAO,KAAK,OAAO,KAAuC,UAAU,SAAS;;;;;;;;;;;;;;CAe9E,MAAM,IAAI,MAAoC;EAC7C,SAAS,kBAAkB,KAAK;EAChC,OAAO,KAAK,OAAO,IAAiB,iBAAiB,OAAO;;;;;;;;;;;;;;CAe7D,MAAM,WAAW,WAA4D;EAC5E,SAAS,kBAAkB,UAAU;EACrC,OAAO,KAAK,OAAO,IAClB,2BAA2B,YAC3B"}
|
package/dist/constants.d.ts
CHANGED
package/dist/constants.js
CHANGED
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Amadeus Protocol Constants\n *\n * This module contains all protocol-level constants used throughout the SDK.\n */\n\n/**\n * SDK version\n */\nexport const SDK_VERSION = '1.
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Amadeus Protocol Constants\n *\n * This module contains all protocol-level constants used throughout the SDK.\n */\n\n/**\n * SDK version\n */\nexport const SDK_VERSION = '1.1.2'\n\n/**\n * Byte length of an Amadeus public key (BLS12-381 public key)\n */\nexport const AMADEUS_PUBLIC_KEY_BYTE_LENGTH = 48\n\n/**\n * Byte length of an Amadeus seed (private key seed)\n */\nexport const AMADEUS_SEED_BYTE_LENGTH = 64\n\n/**\n * Number of decimal places for AMA token\n */\nexport const AMA_TOKEN_DECIMALS = 9\n\n/**\n * Multiplier for converting between atomic units and AMA tokens\n */\nexport const AMA_TOKEN_DECIMALS_MULTIPLIER = 10 ** AMA_TOKEN_DECIMALS\n\n/**\n * Minimum transferable amount in AMA (1 atomic unit)\n */\nexport const MIN_TRANSFERABLE_AMOUNT = 1 / AMA_TOKEN_DECIMALS_MULTIPLIER\n\n/**\n * Flat network transfer fee in AMA for standard transfers\n */\nexport const AMA_TRANSFER_FEE = 0.02\n\n/**\n * Default explorer URL\n */\nexport const EXPLORER_URL = 'https://explorer.ama.one'\n\n/**\n * Default node API URL\n */\nexport const NODE_API_URL = 'https://mainnet-rpc.ama.one/api'\n\n/**\n * Default request timeout in milliseconds\n */\nexport const DEFAULT_TIMEOUT = 30000\n"],"mappings":";;;;;;;;;AASA,MAAa,cAAc;;;;AAK3B,MAAa,iCAAiC;;;;AAK9C,MAAa,2BAA2B;;;;AAKxC,MAAa,qBAAqB;;;;AAKlC,MAAa,gCAAgC,MAAA;;;;AAK7C,MAAa,0BAA0B,IAAI;;;;AAK3C,MAAa,mBAAmB;;;;AAKhC,MAAa,eAAe;;;;AAK5B,MAAa,eAAe;;;;AAK5B,MAAa,kBAAkB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ANRInfo, AmadeusSDKConfig, AmadeusSDKError, ApiResponse, BuildTransactionResult, ChainEntry, ChainEntryHeader, ChainKpi, ChainStats, Contract, ContractData, ContractDataValue, ContractFunction, ContractStateProof, ContractViewParams, ContractViewResponse, DecodedValue, EmissionAddress, EpochScore, EpochScoreAll, EpochScoreSingle, GetANRByPkResponse, GetANRsResponse, GetAllBalancesResponse, GetByHashResponse, GetByHeightResponse, GetEmissionAddressResponse, GetKpiResponse, GetNodesResponse, GetRemovedTrainersResponse, GetRichlistResponse, GetSolInEpochResponse, GetStatsResponse, GetTipResponse, GetTokenBalanceQuery, GetTokenBalanceResponse, GetTrainersResponse, GetTransactionEventsByAccountResponse, GetTransactionsInEntryResponse, GetWalletTransactionsQuery, GetWalletTransactionsResponse, KeyPair, LockupPrimeDailyCheckinInput, LockupPrimeLockInput, LockupPrimeUnlockInput, LockupUnlockInput, PeerInfo, ProofValidators, RichlistEntry, SerializableValue, SubmitAndWaitOptions, SubmitAndWaitTransactionResponse, SubmitTransactionRequestQuery, SubmitTransactionResponse, TokenBalance, Transaction, TransactionAction, TransactionActionBody, TransactionActionResponse, TransactionBody, TransactionEvent, TransactionEventType, TransactionExecutionError, TransactionFilters, TransactionMetadata, TransactionPacked, TransactionReceipt, TransactionResult, TransactionUnpacked, TransactionValidationError, TransactionValidationResult, TransferTransactionInput, TxByFilterParams, TxByFilterResponse, UnsignedTransaction, UnsignedTransactionWithHash, ValidateBytecodeResponse, ValidatorProofData, ValidatorProofNode, WalletBalance
|
|
1
|
+
import { ANRInfo, AmadeusSDKConfig, AmadeusSDKError, ApiResponse, BuildTransactionResult, ChainEntry, ChainEntryHeader, ChainKpi, ChainStats, Contract, ContractData, ContractDataValue, ContractFunction, ContractStateProof, ContractViewParams, ContractViewResponse, DecodedValue, EmissionAddress, EpochScore, EpochScoreAll, EpochScoreSingle, GetANRByPkResponse, GetANRsResponse, GetAllBalancesResponse, GetByHashResponse, GetByHeightResponse, GetEmissionAddressResponse, GetKpiResponse, GetNodesResponse, GetRemovedTrainersResponse, GetRichlistResponse, GetSolInEpochResponse, GetStatsResponse, GetTipResponse, GetTokenBalanceQuery, GetTokenBalanceResponse, GetTrainersResponse, GetTransactionEventsByAccountResponse, GetTransactionsInEntryResponse, GetWalletTransactionsQuery, GetWalletTransactionsResponse, KeyPair, LockupPrimeDailyCheckinInput, LockupPrimeLockInput, LockupPrimeUnlockInput, LockupUnlockInput, PeerInfo, ProofValidators, RichlistEntry, SerializableValue, SubmitAndWaitOptions, SubmitAndWaitTransactionResponse, SubmitTransactionRequestQuery, SubmitTransactionResponse, TokenBalance, Transaction, TransactionAction, TransactionActionBody, TransactionActionResponse, TransactionBody, TransactionEvent, TransactionEventType, TransactionExecutionError, TransactionFilters, TransactionMetadata, TransactionPacked, TransactionReceipt, TransactionResult, TransactionUnpacked, TransactionValidationError, TransactionValidationResult, TransferTransactionInput, TxByFilterParams, TxByFilterResponse, UnsignedTransaction, UnsignedTransactionWithHash, ValidateBytecodeResponse, ValidatorProofData, ValidatorProofNode, WalletBalance } from "./types.js";
|
|
2
2
|
import { AMADEUS_PUBLIC_KEY_BYTE_LENGTH, AMADEUS_SEED_BYTE_LENGTH, AMA_TOKEN_DECIMALS, AMA_TOKEN_DECIMALS_MULTIPLIER, AMA_TRANSFER_FEE, DEFAULT_TIMEOUT, EXPLORER_URL, MIN_TRANSFERABLE_AMOUNT, NODE_API_URL, SDK_VERSION } from "./constants.js";
|
|
3
3
|
import { NETWORK_CONFIGS, NETWORK_EXPLORER_URLS, NETWORK_URLS, NetworkConfig, NetworkType, TESTNET_FAUCET_URL } from "./networks.js";
|
|
4
4
|
import { decode, decodeContractState, encode } from "./serialization.js";
|
|
@@ -39,4 +39,4 @@ import { parseLockupVaultData, parseRawLockupVaultData } from "./contracts/locku
|
|
|
39
39
|
import { buildLockupVaultKeyPrefix, extractLockupVaultIndexFromKey } from "./contracts/lockup/storage-keys.js";
|
|
40
40
|
import { NFT_ABI } from "./contracts/nft/abi.js";
|
|
41
41
|
import { buildNftCreateCollection, buildNftMint, buildNftTransfer } from "./contracts/nft/helpers.js";
|
|
42
|
-
export { AMADEUS_PUBLIC_KEY_BYTE_LENGTH, AMADEUS_SEED_BYTE_LENGTH, AMA_TOKEN_DECIMALS, AMA_TOKEN_DECIMALS_MULTIPLIER, AMA_TRANSFER_FEE, ANRInfo, AbiDefinition, AbiFunction, AbiInput, AmadeusClient, AmadeusSDK, AmadeusSDKConfig, AmadeusSDKError, ApiResponse, BuildTransactionResult, ChainAPI, ChainEntry, ChainEntryHeader, ChainKpi, ChainStats, CoinTransferParams, Contract, ContractAPI, ContractCall, ContractData, ContractDataValue, ContractFunction, ContractStateProof, ContractViewParams, ContractViewResponse, DEFAULT_TIMEOUT, DecodedValue, EXPLORER_URL, EmissionAddress, EncryptedPayload, EpochAPI, EpochScore, EpochScoreAll, EpochScoreSingle, ExplorerType, ExtractContractName, ExtractFunctionNames, FunctionParams, GetANRByPkResponse, GetANRsResponse, GetAllBalancesResponse, GetByHashResponse, GetByHeightResponse, GetEmissionAddressResponse, GetKpiResponse, GetNodesResponse, GetRemovedTrainersResponse, GetRichlistResponse, GetSolInEpochResponse, GetStatsResponse, GetTipResponse, GetTokenBalanceQuery, GetTokenBalanceResponse, GetTrainersResponse, GetTransactionEventsByAccountResponse, GetTransactionsInEntryResponse, GetWalletTransactionsQuery, GetWalletTransactionsResponse, KeyPair, LOCKUP_ABI, LOCKUP_PRIME_ABI, LOCKUP_PRIME_TIER_KEYS, Lockup, LockupAbiError, LockupAbiFunction, LockupAbiInput, LockupAbiOutput, LockupAbiStorage, LockupAbiStorageKey, LockupAbiStorageRead, LockupAbiStorageWrite, LockupPrime, LockupPrimeAbiConstant, LockupPrimeAbiError, LockupPrimeAbiFunction, LockupPrimeAbiInput, LockupPrimeAbiOutput, LockupPrimeAbiStorage, LockupPrimeAbiStorageKey, LockupPrimeAbiStorageRead, LockupPrimeAbiStorageWrite, LockupPrimeDailyCheckinInput, LockupPrimeLockInput, LockupPrimeTierKey, LockupPrimeUnlockInput, LockupPrimeVault, LockupPrimeVaultSchema, LockupTier, LockupTiersSchema, LockupUnlockInput, LockupVault, LockupVaultSchema, MIN_TRANSFERABLE_AMOUNT, NETWORK_CONFIGS, NETWORK_EXPLORER_URLS, NETWORK_URLS, NFT_ABI, NODE_API_URL, NetworkConfig, NetworkType, NftCreateCollectionInput, NftCreateCollectionParams, NftMintInput, NftMintParams, NftTransferInput, NftTransferParams, PeerAPI, PeerInfo, ProofAPI, ProofValidators, RATE_MAP, RawLockupPrimeVaultData, RawLockupVaultData, RichlistEntry, SDK_VERSION, SerializableValue, SignedContract, SubmitAndWaitOptions, SubmitAndWaitTransactionResponse, SubmitTransactionRequestQuery, SubmitTransactionResponse, TESTNET_FAUCET_URL, TRANSACTION_EXECUTION_ERROR_MESSAGES, TRANSACTION_VALIDATION_ERROR_MESSAGES, TokenBalance, Transaction, TransactionAPI, TransactionAction, TransactionActionBody, TransactionActionResponse, TransactionBody, TransactionBuilder, TransactionEvent, TransactionEventType, TransactionExecutionError, TransactionFilters, TransactionMetadata, TransactionPacked, TransactionReceipt, TransactionResult, TransactionUnpacked, TransactionValidationError, TransactionValidationResult, TransferTransactionInput, TxByFilterParams, TxByFilterResponse, TypedContract, UnsignedTransaction, UnsignedTransactionWithHash, ValidateBytecodeResponse, ValidationResult, ValidatorProofData, ValidatorProofNode, VaultSecretData, WalletAPI, WalletBalance,
|
|
42
|
+
export { AMADEUS_PUBLIC_KEY_BYTE_LENGTH, AMADEUS_SEED_BYTE_LENGTH, AMA_TOKEN_DECIMALS, AMA_TOKEN_DECIMALS_MULTIPLIER, AMA_TRANSFER_FEE, ANRInfo, AbiDefinition, AbiFunction, AbiInput, AmadeusClient, AmadeusSDK, AmadeusSDKConfig, AmadeusSDKError, ApiResponse, BuildTransactionResult, ChainAPI, ChainEntry, ChainEntryHeader, ChainKpi, ChainStats, CoinTransferParams, Contract, ContractAPI, ContractCall, ContractData, ContractDataValue, ContractFunction, ContractStateProof, ContractViewParams, ContractViewResponse, DEFAULT_TIMEOUT, DecodedValue, EXPLORER_URL, EmissionAddress, EncryptedPayload, EpochAPI, EpochScore, EpochScoreAll, EpochScoreSingle, ExplorerType, ExtractContractName, ExtractFunctionNames, FunctionParams, GetANRByPkResponse, GetANRsResponse, GetAllBalancesResponse, GetByHashResponse, GetByHeightResponse, GetEmissionAddressResponse, GetKpiResponse, GetNodesResponse, GetRemovedTrainersResponse, GetRichlistResponse, GetSolInEpochResponse, GetStatsResponse, GetTipResponse, GetTokenBalanceQuery, GetTokenBalanceResponse, GetTrainersResponse, GetTransactionEventsByAccountResponse, GetTransactionsInEntryResponse, GetWalletTransactionsQuery, GetWalletTransactionsResponse, KeyPair, LOCKUP_ABI, LOCKUP_PRIME_ABI, LOCKUP_PRIME_TIER_KEYS, Lockup, LockupAbiError, LockupAbiFunction, LockupAbiInput, LockupAbiOutput, LockupAbiStorage, LockupAbiStorageKey, LockupAbiStorageRead, LockupAbiStorageWrite, LockupPrime, LockupPrimeAbiConstant, LockupPrimeAbiError, LockupPrimeAbiFunction, LockupPrimeAbiInput, LockupPrimeAbiOutput, LockupPrimeAbiStorage, LockupPrimeAbiStorageKey, LockupPrimeAbiStorageRead, LockupPrimeAbiStorageWrite, LockupPrimeDailyCheckinInput, LockupPrimeLockInput, LockupPrimeTierKey, LockupPrimeUnlockInput, LockupPrimeVault, LockupPrimeVaultSchema, LockupTier, LockupTiersSchema, LockupUnlockInput, LockupVault, LockupVaultSchema, MIN_TRANSFERABLE_AMOUNT, NETWORK_CONFIGS, NETWORK_EXPLORER_URLS, NETWORK_URLS, NFT_ABI, NODE_API_URL, NetworkConfig, NetworkType, NftCreateCollectionInput, NftCreateCollectionParams, NftMintInput, NftMintParams, NftTransferInput, NftTransferParams, PeerAPI, PeerInfo, ProofAPI, ProofValidators, RATE_MAP, RawLockupPrimeVaultData, RawLockupVaultData, RichlistEntry, SDK_VERSION, SerializableValue, SignedContract, SubmitAndWaitOptions, SubmitAndWaitTransactionResponse, SubmitTransactionRequestQuery, SubmitTransactionResponse, TESTNET_FAUCET_URL, TRANSACTION_EXECUTION_ERROR_MESSAGES, TRANSACTION_VALIDATION_ERROR_MESSAGES, TokenBalance, Transaction, TransactionAPI, TransactionAction, TransactionActionBody, TransactionActionResponse, TransactionBody, TransactionBuilder, TransactionEvent, TransactionEventType, TransactionExecutionError, TransactionFilters, TransactionMetadata, TransactionPacked, TransactionReceipt, TransactionResult, TransactionUnpacked, TransactionValidationError, TransactionValidationResult, TransferTransactionInput, TxByFilterParams, TxByFilterResponse, TypedContract, UnsignedTransaction, UnsignedTransactionWithHash, ValidateBytecodeResponse, ValidationResult, ValidatorProofData, ValidatorProofNode, VaultSecretData, WalletAPI, WalletBalance, arrayBufferToBase64, arrayBufferToUint8Array, base64ToArrayBuffer, base64ToUint8Array, buildCoinTransfer, buildContractCall, buildDailyStreakKey, buildLockupPrimeVaultKeyPrefix, buildLockupVaultKeyPrefix, buildNextCheckinEpochKey, buildNftCreateCollection, buildNftMint, buildNftTransfer, createContract, decode, decodeContractState, decodeContractStateToBase64, decodeVaultSecret, decryptWithPassword, deriveKey, derivePublicKeyFromSeedBase58, deriveSkAndSeed64FromBase58Seed, detectInputType, encode, encodeVaultSecret, encryptWithPassword, extractLockupPrimeVaultIndexFromKey, extractLockupVaultIndexFromKey, formatAMAAmount, formatBalance, formatBalanceWithPrivacy, formatNumber, formatShortAddress, fromAtomicAma, fromBase58, generateIV, generateKeypair, generateMnemonic, generatePrivateKey, generateSalt, getExecutionErrorMessage, getPublicKey, getTransactionErrorMessage, getValidationErrorMessage, isValidAddress, isValidAmount, isValidLockupPrimeTierKey, isValidSeed, makeAddressUrl, makeExplorerUrl, makeTransactionUrl, mnemonicToSeedBase58, parseContractStateNumber, parseLockupVaultData, parseRawLockupVaultData, parseRawVaultData, parseStateNumber, parseStateString, parseVaultData, reduce512To256LE, seed64ToKeypair, toAtomicAma, toBase58, uint8ArrayToArrayBuffer, uint8ArrayToBase64, validate, validateAddress, validateAmount, validateMnemonic, validatePassword, validateSeed, validateTokenSymbol };
|
package/dist/types.d.ts
CHANGED
|
@@ -324,19 +324,24 @@ interface LockupUnlockInput {
|
|
|
324
324
|
vaultIndex: number;
|
|
325
325
|
}
|
|
326
326
|
/**
|
|
327
|
-
* Transaction metadata
|
|
327
|
+
* Transaction metadata (as returned by tx query endpoints).
|
|
328
328
|
*/
|
|
329
329
|
interface TransactionMetadata {
|
|
330
|
+
/** Hash of the entry containing this tx (Base58) */
|
|
330
331
|
entry_hash: string;
|
|
332
|
+
/** Height of the entry containing this tx */
|
|
331
333
|
entry_height: number;
|
|
334
|
+
/** Finality status — present on `chain.getTransaction` once the tx is rooted */
|
|
335
|
+
status?: 'finalized' | string;
|
|
336
|
+
/** Direction — only present on `chain.getTransactionEventsByAccount` results */
|
|
332
337
|
tx_event?: TransactionEventType;
|
|
333
338
|
}
|
|
334
339
|
/**
|
|
335
340
|
* Transaction receipt structure
|
|
336
341
|
*/
|
|
337
342
|
interface TransactionReceipt {
|
|
338
|
-
/** Execution result
|
|
339
|
-
result: TransactionExecutionError | string;
|
|
343
|
+
/** Execution result — `null` for successful txs without a return value */
|
|
344
|
+
result: TransactionExecutionError | string | null;
|
|
340
345
|
/** Execution logs (array of ASCII dump strings) */
|
|
341
346
|
logs: string[];
|
|
342
347
|
/** Success flag */
|
|
@@ -345,10 +350,12 @@ interface TransactionReceipt {
|
|
|
345
350
|
exec_used: string;
|
|
346
351
|
}
|
|
347
352
|
/**
|
|
348
|
-
* Transaction result
|
|
353
|
+
* Transaction result (legacy field — `receipt` is preferred).
|
|
354
|
+
*
|
|
355
|
+
* `error` is `null` for successful txs.
|
|
349
356
|
*/
|
|
350
357
|
interface TransactionResult {
|
|
351
|
-
error: TransactionValidationError | string;
|
|
358
|
+
error: TransactionValidationError | string | null;
|
|
352
359
|
}
|
|
353
360
|
/**
|
|
354
361
|
* Transaction data returned from the API
|
|
@@ -396,56 +403,101 @@ interface TransactionFilters {
|
|
|
396
403
|
type?: TransactionEventType;
|
|
397
404
|
}
|
|
398
405
|
/**
|
|
399
|
-
* Chain entry header structure
|
|
406
|
+
* Chain entry header structure (as returned by the node).
|
|
407
|
+
*
|
|
408
|
+
* Source of truth: `format_entry_for_client/1` in `ex/lib/api/api_chain.ex`.
|
|
400
409
|
*/
|
|
401
410
|
interface ChainEntryHeader {
|
|
402
|
-
|
|
403
|
-
timestamp: number;
|
|
404
|
-
mutations_hash: string;
|
|
411
|
+
/** Slot number — strictly increasing, time-based */
|
|
405
412
|
slot: number;
|
|
413
|
+
/** Block height (canonical chain position) */
|
|
414
|
+
height: number;
|
|
415
|
+
/** Previous slot number */
|
|
406
416
|
prev_slot: number;
|
|
417
|
+
/** Previous entry hash (Base58) */
|
|
407
418
|
prev_hash: string;
|
|
419
|
+
/** Data-randomness (Base58) */
|
|
408
420
|
dr: string;
|
|
421
|
+
/** VRF output (Base58) */
|
|
409
422
|
vr: string;
|
|
423
|
+
/** Signer's public key (Base58) */
|
|
410
424
|
signer: string;
|
|
411
|
-
|
|
425
|
+
/** Root transaction hash (Base58, optional) */
|
|
412
426
|
root_tx?: string;
|
|
427
|
+
/** Root validator (Base58, optional) */
|
|
413
428
|
root_validator?: string;
|
|
414
429
|
}
|
|
415
430
|
/**
|
|
416
|
-
* Chain entry structure
|
|
431
|
+
* Chain entry structure (as returned by the node).
|
|
432
|
+
*
|
|
433
|
+
* The `height` lives at `entry.header.height`, NOT at the top level.
|
|
417
434
|
*/
|
|
418
435
|
interface ChainEntry {
|
|
436
|
+
/** Header — height, slot, signer, etc. live here */
|
|
437
|
+
header: ChainEntryHeader;
|
|
438
|
+
/** Entry hash (Base58) */
|
|
419
439
|
hash: string;
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
tx_count?: number;
|
|
440
|
+
/** Number of transactions in this entry */
|
|
441
|
+
tx_count: number;
|
|
442
|
+
/** Validator participation mask (Base58, optional) */
|
|
424
443
|
mask?: string;
|
|
444
|
+
/** Number of validators reflected in `mask` */
|
|
445
|
+
mask_size?: number;
|
|
446
|
+
/** Consensus state — present once a validator quorum is reached */
|
|
425
447
|
consensus?: {
|
|
426
|
-
score: number;
|
|
427
|
-
finality_reached: boolean;
|
|
448
|
+
/** Fraction of validator weight that has signed (0–1) */score: number; /** True once score ≥ 0.67 (finalized) */
|
|
449
|
+
finality_reached: boolean; /** Mutations-hash Base58 — hash of state mutations applied by this entry */
|
|
428
450
|
mut_hash: string;
|
|
429
451
|
};
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
452
|
+
/**
|
|
453
|
+
* Hash of the next entry once finality has been reached on it.
|
|
454
|
+
* Only set on `chain.getByHash` responses.
|
|
455
|
+
*/
|
|
456
|
+
next_entry_hash_finality_reached?: string;
|
|
457
|
+
/**
|
|
458
|
+
* Filtered transactions — only set on `chain.getByHash` when called with
|
|
459
|
+
* `filterOnFunction`.
|
|
460
|
+
*/
|
|
461
|
+
txs_filtered?: Transaction[];
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Chain statistics (as returned by `/api/chain/stats`).
|
|
465
|
+
*
|
|
466
|
+
* Source of truth: `API.Chain.stats/1` in `ex/lib/api/api_chain.ex`.
|
|
434
467
|
*/
|
|
435
468
|
interface ChainStats {
|
|
469
|
+
/** Current tip height */
|
|
436
470
|
height: number;
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
471
|
+
/** Most recent finalized (rooted) height */
|
|
472
|
+
rooted_height: number;
|
|
473
|
+
/** Hash of the tip entry (Base58) */
|
|
474
|
+
tip_hash: string;
|
|
475
|
+
/** Full tip entry */
|
|
476
|
+
tip: ChainEntry;
|
|
477
|
+
/** Number of pending transactions in the mempool */
|
|
478
|
+
tx_pool_size: number;
|
|
479
|
+
/** Validator scheduled to produce the current entry (Base58) */
|
|
480
|
+
cur_validator: string;
|
|
481
|
+
/** Validator scheduled to produce the next entry (Base58) */
|
|
482
|
+
next_validator: string;
|
|
483
|
+
/** Emission for the current epoch (AMA float) */
|
|
484
|
+
emission_for_epoch: number;
|
|
485
|
+
/** Circulating supply (AMA float) */
|
|
486
|
+
circulating: number;
|
|
487
|
+
/** Total AMA burned (float) */
|
|
488
|
+
burned: number;
|
|
489
|
+
/** Projected total supply at year 3 */
|
|
490
|
+
total_supply_y3: number;
|
|
491
|
+
/** Projected total supply at year 30 */
|
|
492
|
+
total_supply_y30: number;
|
|
493
|
+
/** Current difficulty bits */
|
|
494
|
+
diff_bits: number;
|
|
495
|
+
/** Estimated PFLOPS across the validator set */
|
|
496
|
+
pflops: number;
|
|
497
|
+
/** Recent throughput estimate (transactions per second) */
|
|
498
|
+
txs_per_sec: number;
|
|
499
|
+
/** Current segment VRF hash (Base58) */
|
|
500
|
+
segment_vr_hash: string;
|
|
449
501
|
}
|
|
450
502
|
/**
|
|
451
503
|
* Token balance structure
|
|
@@ -465,16 +517,6 @@ interface WalletBalance {
|
|
|
465
517
|
symbol: string;
|
|
466
518
|
};
|
|
467
519
|
}
|
|
468
|
-
/**
|
|
469
|
-
* Wallet balances map
|
|
470
|
-
*/
|
|
471
|
-
interface WalletBalances {
|
|
472
|
-
[symbol: string]: {
|
|
473
|
-
float: number;
|
|
474
|
-
flat: number;
|
|
475
|
-
symbol: string;
|
|
476
|
-
};
|
|
477
|
-
}
|
|
478
520
|
/**
|
|
479
521
|
* Contract data value can be any JSON-serializable value
|
|
480
522
|
*/
|
|
@@ -490,20 +532,28 @@ interface ContractData {
|
|
|
490
532
|
value: ContractDataValue;
|
|
491
533
|
}
|
|
492
534
|
/**
|
|
493
|
-
* Richlist entry structure
|
|
535
|
+
* Richlist entry structure (as returned by `/api/contract/richlist`).
|
|
536
|
+
* Source of truth: `API.Contract.richlist/0` in `ex/lib/api/api_contract.ex`.
|
|
494
537
|
*/
|
|
495
538
|
interface RichlistEntry {
|
|
496
|
-
|
|
497
|
-
|
|
539
|
+
/** Account public key (Base58) */
|
|
540
|
+
pk: string;
|
|
541
|
+
/** Token symbol (always 'AMA' for now) */
|
|
498
542
|
symbol: string;
|
|
499
|
-
|
|
543
|
+
/** Balance in atomic units */
|
|
544
|
+
flat: number;
|
|
545
|
+
/** Balance in human-readable units */
|
|
546
|
+
float: number;
|
|
500
547
|
}
|
|
501
548
|
/**
|
|
502
|
-
* Epoch score structure
|
|
549
|
+
* Epoch score structure.
|
|
550
|
+
*
|
|
551
|
+
* The all-validators variant returns a tuple array `[pk, score][]`.
|
|
552
|
+
* The single-pk variant returns `{ score }` (the SDK strips the `error: 'ok'`
|
|
553
|
+
* wrapper).
|
|
503
554
|
*/
|
|
504
555
|
type EpochScoreAll = [string, number][];
|
|
505
556
|
type EpochScoreSingle = {
|
|
506
|
-
error: 'ok';
|
|
507
557
|
score: number;
|
|
508
558
|
};
|
|
509
559
|
type EpochScore = EpochScoreAll | EpochScoreSingle;
|
|
@@ -613,26 +663,45 @@ interface GetWalletTransactionsResponse {
|
|
|
613
663
|
cursor: string;
|
|
614
664
|
txs: Transaction[];
|
|
615
665
|
}
|
|
666
|
+
/**
|
|
667
|
+
* Response from `/api/wallet/balance_all/{pk}`.
|
|
668
|
+
* The node returns balances as an array of `{ float, symbol, flat }` entries.
|
|
669
|
+
*/
|
|
616
670
|
interface GetAllBalancesResponse {
|
|
617
|
-
|
|
618
|
-
balances: TokenBalance[] | WalletBalances;
|
|
671
|
+
balances: TokenBalance[];
|
|
619
672
|
}
|
|
673
|
+
/**
|
|
674
|
+
* Response from `/api/contract/validate`.
|
|
675
|
+
*
|
|
676
|
+
* Always returns the validation result and any logs emitted by the validator.
|
|
677
|
+
* Note: the node currently returns `error: 'ok'` on success, which the SDK
|
|
678
|
+
* strips — making `error` undefined when validation succeeds. Check `logs`
|
|
679
|
+
* for diagnostic output regardless.
|
|
680
|
+
*/
|
|
620
681
|
interface ValidateBytecodeResponse {
|
|
621
|
-
error
|
|
682
|
+
/** Validation error code, if any (undefined on success after SDK strips `:ok`) */
|
|
683
|
+
error?: string;
|
|
684
|
+
/** Validator logs (ASCII-dumped) */
|
|
685
|
+
logs?: string[];
|
|
622
686
|
}
|
|
623
687
|
interface GetRichlistResponse {
|
|
624
688
|
richlist: RichlistEntry[];
|
|
625
689
|
}
|
|
690
|
+
/**
|
|
691
|
+
* Response from `/api/epoch/get_emission_address/{pk}`.
|
|
692
|
+
* The `error: 'ok'` envelope is stripped by the SDK.
|
|
693
|
+
*/
|
|
626
694
|
interface GetEmissionAddressResponse {
|
|
627
|
-
|
|
695
|
+
/** Configured emission address (Base58), or `null` if not set */
|
|
628
696
|
emission_address: string | null;
|
|
629
697
|
}
|
|
630
698
|
/**
|
|
631
|
-
* Response
|
|
699
|
+
* Response from `/api/epoch/sol_in_epoch/{epoch}/{solHash}`.
|
|
700
|
+
*
|
|
701
|
+
* Empty object on success. The SDK throws `AmadeusSDKError` for
|
|
702
|
+
* `invalid_epoch` / `sol_not_found` (caller can distinguish by `error.message`).
|
|
632
703
|
*/
|
|
633
|
-
|
|
634
|
-
error: 'ok' | 'invalid_epoch' | 'sol_not_found';
|
|
635
|
-
}
|
|
704
|
+
type GetSolInEpochResponse = Record<string, never>;
|
|
636
705
|
interface GetNodesResponse {
|
|
637
706
|
nodes: PeerInfo[];
|
|
638
707
|
}
|
|
@@ -654,18 +723,29 @@ interface GetANRByPkResponse {
|
|
|
654
723
|
interface SubmitTransactionRequestQuery {
|
|
655
724
|
txPacked: Uint8Array;
|
|
656
725
|
}
|
|
726
|
+
/**
|
|
727
|
+
* Response from `/api/tx/submit` on success.
|
|
728
|
+
*
|
|
729
|
+
* The SDK strips the `error: 'ok'` envelope and throws `AmadeusSDKError`
|
|
730
|
+
* on validation failure — so this success type contains only the hash.
|
|
731
|
+
*/
|
|
657
732
|
interface SubmitTransactionResponse {
|
|
658
|
-
|
|
659
|
-
hash
|
|
733
|
+
/** Submitted transaction hash (Base58) */
|
|
734
|
+
hash: string;
|
|
660
735
|
}
|
|
661
736
|
/**
|
|
662
|
-
* Response
|
|
737
|
+
* Response from `/api/tx/submit_and_wait` on success.
|
|
738
|
+
*
|
|
739
|
+
* The SDK strips the `error: 'ok'` envelope and throws `AmadeusSDKError`
|
|
740
|
+
* on validation failure or wait timeout.
|
|
663
741
|
*/
|
|
664
742
|
interface SubmitAndWaitTransactionResponse {
|
|
665
|
-
|
|
666
|
-
hash
|
|
667
|
-
|
|
668
|
-
|
|
743
|
+
/** Submitted transaction hash (Base58) */
|
|
744
|
+
hash: string;
|
|
745
|
+
/** Metadata about the entry containing the tx */
|
|
746
|
+
metadata: TransactionMetadata;
|
|
747
|
+
/** Execution receipt */
|
|
748
|
+
receipt: TransactionReceipt;
|
|
669
749
|
}
|
|
670
750
|
/**
|
|
671
751
|
* Validator proof response structure
|
|
@@ -757,5 +837,5 @@ interface SubmitAndWaitOptions {
|
|
|
757
837
|
finalized?: boolean;
|
|
758
838
|
}
|
|
759
839
|
//#endregion
|
|
760
|
-
export { ANRInfo, AmadeusSDKConfig, AmadeusSDKError, ApiResponse, BuildTransactionResult, ChainEntry, ChainEntryHeader, ChainKpi, ChainStats, Contract, ContractData, ContractDataValue, ContractFunction, ContractStateProof, ContractViewParams, ContractViewResponse, DecodedValue, EmissionAddress, EpochScore, EpochScoreAll, EpochScoreSingle, GetANRByPkResponse, GetANRsResponse, GetAllBalancesResponse, GetByHashResponse, GetByHeightResponse, GetEmissionAddressResponse, GetKpiResponse, GetNodesResponse, GetRemovedTrainersResponse, GetRichlistResponse, GetSolInEpochResponse, GetStatsResponse, GetTipResponse, GetTokenBalanceQuery, GetTokenBalanceResponse, GetTrainersResponse, GetTransactionEventsByAccountResponse, GetTransactionsInEntryResponse, GetWalletTransactionsQuery, GetWalletTransactionsResponse, KeyPair, LockupPrimeDailyCheckinInput, LockupPrimeLockInput, LockupPrimeUnlockInput, LockupUnlockInput, PeerInfo, ProofValidators, RichlistEntry, SerializableValue, SubmitAndWaitOptions, SubmitAndWaitTransactionResponse, SubmitTransactionRequestQuery, SubmitTransactionResponse, TokenBalance, Transaction, TransactionAction, TransactionActionBody, TransactionActionResponse, TransactionBody, TransactionEvent, TransactionEventType, TransactionExecutionError, TransactionFilters, TransactionMetadata, TransactionPacked, TransactionReceipt, TransactionResult, TransactionUnpacked, TransactionValidationError, TransactionValidationResult, TransferTransactionInput, TxByFilterParams, TxByFilterResponse, UnsignedTransaction, UnsignedTransactionWithHash, ValidateBytecodeResponse, ValidatorProofData, ValidatorProofNode, WalletBalance
|
|
840
|
+
export { ANRInfo, AmadeusSDKConfig, AmadeusSDKError, ApiResponse, BuildTransactionResult, ChainEntry, ChainEntryHeader, ChainKpi, ChainStats, Contract, ContractData, ContractDataValue, ContractFunction, ContractStateProof, ContractViewParams, ContractViewResponse, DecodedValue, EmissionAddress, EpochScore, EpochScoreAll, EpochScoreSingle, GetANRByPkResponse, GetANRsResponse, GetAllBalancesResponse, GetByHashResponse, GetByHeightResponse, GetEmissionAddressResponse, GetKpiResponse, GetNodesResponse, GetRemovedTrainersResponse, GetRichlistResponse, GetSolInEpochResponse, GetStatsResponse, GetTipResponse, GetTokenBalanceQuery, GetTokenBalanceResponse, GetTrainersResponse, GetTransactionEventsByAccountResponse, GetTransactionsInEntryResponse, GetWalletTransactionsQuery, GetWalletTransactionsResponse, KeyPair, LockupPrimeDailyCheckinInput, LockupPrimeLockInput, LockupPrimeUnlockInput, LockupUnlockInput, PeerInfo, ProofValidators, RichlistEntry, SerializableValue, SubmitAndWaitOptions, SubmitAndWaitTransactionResponse, SubmitTransactionRequestQuery, SubmitTransactionResponse, TokenBalance, Transaction, TransactionAction, TransactionActionBody, TransactionActionResponse, TransactionBody, TransactionEvent, TransactionEventType, TransactionExecutionError, TransactionFilters, TransactionMetadata, TransactionPacked, TransactionReceipt, TransactionResult, TransactionUnpacked, TransactionValidationError, TransactionValidationResult, TransferTransactionInput, TxByFilterParams, TxByFilterResponse, UnsignedTransaction, UnsignedTransactionWithHash, ValidateBytecodeResponse, ValidatorProofData, ValidatorProofNode, WalletBalance };
|
|
761
841
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";;AAiBA;;;;;;;KAAY,iBAAA,+CAMT,UAAA,GACA,iBAAA,KACA,GAAA,CAAI,iBAAA,EAAmB,iBAAA;EAAA,CACpB,GAAA,WAAc,iBAAA;AAAA;;;;KAKR,YAAA,6BAIT,UAAA,GACA,YAAA,KACA,GAAA,CAAI,YAAA,EAAc,YAAA;;;;UASJ,OAAA;EApBoB;EAsBpC,SAAA;EAjBW;EAmBX,UAAA;AAAA;;;;UAUgB,gBAAA;EAvBd;EAyBF,OAAA;EAzBK;EA2BL,OAAA;EA5BE;EA8BF,OAAA,GAAU,MAAA;AAAA;;;;AApBX;UA2BiB,WAAA;EAChB,KAAA;EAAA,CACC,GAAA;AAAA;AAfF;;;AAAA,cAqBa,eAAA,SAAwB,KAAA;EAG5B,MAAA;EACA,QAAA,GAAW,MAAA;cAFlB,OAAA,UACO,MAAA,uBACA,QAAA,GAAW,MAAA;AAAA;;;AAZpB;aA0BY,0BAAA;EACX,EAAA;EACA,SAAA;EACA,gBAAA;EACA,YAAA;EACA,iBAAA;EACA,iBAAA;EACA,cAAA;EACA,oBAAA;EACA,wBAAA;EACA,eAAA;EACA,uBAAA;EACA,uBAAA;EACA,iBAAA;EACA,kBAAA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A2DA,MAAA;AAAA;AAAA,UAGgB,kBAAA;EAChB,MAAA;EACA,GAAA,EAAK,WAAA;AAAA;;AApDN;;UA8DiB,oBAAA;EA9DoB;EAgEpC,SAAA;AAAA"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["/**\n * Type Definitions\n *\n * This module contains all TypeScript type definitions used throughout the SDK.\n */\n\n// ============================================================================\n// Core Types\n// ============================================================================\n\n// ----------------------------------------------------------------------------\n// Serialization Types\n// ----------------------------------------------------------------------------\n\n/**\n * Serializable value types for canonical encoding (VecPack)\n */\nexport type SerializableValue =\n\t| null\n\t| boolean\n\t| number\n\t| bigint\n\t| string\n\t| Uint8Array\n\t| SerializableValue[]\n\t| Map<SerializableValue, SerializableValue>\n\t| { [key: string]: SerializableValue }\n\n/**\n * Decoded value types (Map is returned for objects during decode)\n */\nexport type DecodedValue =\n\t| null\n\t| boolean\n\t| bigint\n\t| Uint8Array\n\t| DecodedValue[]\n\t| Map<DecodedValue, DecodedValue>\n\n// ----------------------------------------------------------------------------\n// Cryptographic Types\n// ----------------------------------------------------------------------------\n\n/**\n * Key pair structure containing public and private keys as Base58 strings\n */\nexport interface KeyPair {\n\t/** Base58 encoded public key */\n\tpublicKey: string\n\t/** Base58 encoded private key (seed) */\n\tprivateKey: string\n}\n\n// ----------------------------------------------------------------------------\n// API Client Types\n// ----------------------------------------------------------------------------\n\n/**\n * SDK configuration\n */\nexport interface AmadeusSDKConfig {\n\t/** Base URL of the Amadeus node API (defaults to NODE_API_URL) */\n\tbaseUrl?: string\n\t/** Request timeout in milliseconds (default: 30000) */\n\ttimeout?: number\n\t/** Custom headers to include in requests */\n\theaders?: Record<string, string>\n}\n\n/**\n * API response wrapper\n * Note: Index signature needed for dynamic response properties\n */\nexport interface ApiResponse {\n\terror: 'ok' | 'not_found' | string\n\t[key: string]: unknown\n}\n\n/**\n * SDK error class\n */\nexport class AmadeusSDKError extends Error {\n\tconstructor(\n\t\tmessage: string,\n\t\tpublic status?: number,\n\t\tpublic response?: Record<string, unknown>\n\t) {\n\t\tsuper(message)\n\t\tthis.name = 'AmadeusSDKError'\n\t}\n}\n\n// ============================================================================\n// Enums\n// ============================================================================\n\n/**\n * Transaction validation error codes\n */\nexport enum TransactionValidationError {\n\tOK = 'ok',\n\tTOO_LARGE = 'too_large',\n\tTX_NOT_CANONICAL = 'tx_not_canonical',\n\tINVALID_HASH = 'invalid_hash',\n\tINVALID_SIGNATURE = 'invalid_signature',\n\tNONCE_NOT_INTEGER = 'nonce_not_integer',\n\tNONCE_TOO_HIGH = 'nonce_too_high',\n\tACTIONS_MUST_BE_LIST = 'actions_must_be_list',\n\tACTIONS_LENGTH_MUST_BE_1 = 'actions_length_must_be_1',\n\tOP_MUST_BE_CALL = 'op_must_be_call',\n\tCONTRACT_MUST_BE_BINARY = 'contract_must_be_binary',\n\tFUNCTION_MUST_BE_BINARY = 'function_must_be_binary',\n\tARGS_MUST_BE_LIST = 'args_must_be_list',\n\tARG_MUST_BE_BINARY = 'arg_must_be_binary',\n\tINVALID_MODULE = 'invalid_module',\n\tINVALID_FUNCTION = 'invalid_function',\n\tINVALID_MODULE_FOR_SPECIAL_MEETING = 'invalid_module_for_special_meeting',\n\tINVALID_FUNCTION_FOR_SPECIAL_MEETING = 'invalid_function_for_special_meeting',\n\tUNKNOWN = 'unknown'\n}\n\n/**\n * Transaction execution error codes.\n * These are returned when contract execution fails.\n */\nexport enum TransactionExecutionError {\n\t/** Success - execution completed successfully */\n\tOK = 'ok',\n\t/** Unknown error (when panic payload cannot be converted to string) */\n\tUNKNOWN = 'unknown',\n\t/** Contract execution was aborted */\n\tAS_ABORT = 'as_abort',\n\n\t// Execution budget errors\n\tEXEC_INVALID_AMOUNT_NEGATIVE = 'exec_invalid_amount_negative',\n\tEXEC_INSUFFICIENT_EXEC_BUDGET = 'exec_insufficient_exec_budget',\n\tEXEC_CRITICAL_UNDERFLOW = 'exec_critical_underflow',\n\n\t// Storage budget errors\n\tEXEC_STORAGE_INVALID_AMOUNT_NEGATIVE = 'exec_storage_invalid_amount_negative',\n\tEXEC_INSUFFICIENT_STORAGE_BUDGET = 'exec_insufficient_storage_budget',\n\tEXEC_STORAGE_CRITICAL_UNDERFLOW = 'exec_storage_critical_underflow',\n\n\t// KV operation errors\n\tEXEC_TOO_LARGE_KEY_SIZE = 'exec_too_large_key_size',\n\tEXEC_TOO_LARGE_VALUE_SIZE = 'exec_too_large_value_size',\n\tEXEC_KV_PUT_FAILED = 'exec_kv_put_failed',\n\tEXEC_KV_INCREMENT_FAILED = 'exec_kv_increment_failed',\n\tEXEC_KV_INCREMENT_INVALID_INTEGER = 'exec_kv_increment_invalid_integer',\n\tEXEC_KV_INCREMENT_INTEGER_OVERFLOW = 'exec_kv_increment_integer_overflow',\n\tKV_PUT_FAILED = 'kv_put_failed',\n\tEXEC_KV_DELETE_FAILED = 'exec_kv_delete_failed',\n\tEXEC_KV_SET_BIT_FAILED = 'exec_kv_set_bit_failed',\n\tEXEC_CANNOT_WRITE_DURING_VIEW = 'exec_cannot_write_during_view',\n\n\t// WASM execution errors\n\tEXEC_RETURN_VALUE_TOO_LARGE = 'exec_return_value_too_large',\n\tEXEC_INSTANCE_NOT_INJECTED = 'exec_instance_not_injected',\n\tEXEC_PTR_TERM_TOO_SHORT = 'exec_ptr_term_too_short',\n\tEXEC_PTR_TERM_TOO_LONG = 'exec_ptr_term_too_long',\n\tEXEC_LOG_INVALID_PTR = 'exec_log_invalid_ptr',\n\tEXEC_CALL_TABLE_INVALID_PTR = 'exec_call_table_invalid_ptr',\n\tEXEC_CALL_TOO_MANY_ARGS = 'exec_call_too_many_args',\n\tEXEC_READ_CALL_TABLE_ERROR = 'exec_read_call_table_error',\n\tEXEC_CALL_PTR_TERM_TOO_LONG = 'exec_call_ptr_term_too_long',\n\tEXEC_READ_CALL_TABLE_DATA_ERROR = 'exec_read_call_table_data_error',\n\tEXEC_CALL_EXTRA_INVALID = 'exec_call_extra_invalid',\n\tEXEC_CALL_EXTRA_TOO_MANY = 'exec_call_extra_too_many',\n\tEXEC_READ_EXTRA_ROW = 'exec_read_extra_row',\n\tEXEC_READ_EXTRA_DATA = 'exec_read_extra_data',\n\tEXEC_CALL_MISSING_ARGS = 'exec_call_missing_args',\n\tEXEC_MEMWRITE = 'exec_memwrite',\n\tEXEC_LOG_MSG_SIZE_EXCEEDED = 'exec_log_msg_size_exceeded',\n\tEXEC_LOGS_TOTAL_SIZE_EXCEEDED = 'exec_logs_total_size_exceeded',\n\tEXEC_LOGS_TOTAL_ELEMENTS_EXCEEDED = 'exec_logs_total_elements_exceeded',\n\tEXEC_INVALID_MODULE = 'exec_invalid_module',\n\tEXEC_MEMORY_ALLOC = 'exec_memory_alloc',\n\tEXEC_ARG_LEN_WRITE = 'exec_arg_len_write',\n\tEXEC_ARG_WRITE = 'exec_arg_write',\n\tEXEC_INSTANCE = 'exec_instance',\n\tEXEC_INIT_MEMWRITE = 'exec_init_memwrite',\n\tEXEC_DESERIALIZE_ERR = 'exec_deserialize_err',\n\tEXEC_SERIALIZE_ERR = 'exec_serialize_err',\n\tEXEC_FUNCTION_NOT_FOUND = 'exec_function_not_found',\n\tEXEC_ERROR = 'exec_error',\n\n\t// Contract/action errors\n\tINVALID_EPOCH = 'invalid_epoch',\n\tINVALID_BIC_ACTION = 'invalid_bic_action',\n\tINVALID_FUNCTION = 'invalid_function',\n\tACCOUNT_HAS_NO_BYTECODE = 'account_has_no_bytecode',\n\tINVALID_ATTACHED_AMOUNT = 'invalid_attached_amount',\n\tATTACHED_AMOUNT_INSUFFICIENT_FUNDS = 'attached_amount_insufficient_funds',\n\tWASM_NOOP = 'wasm_noop',\n\tINVALID_BYTECODE = 'invalid_bytecode',\n\n\t// Coin contract errors\n\tINVALID_ARGS = 'invalid_args',\n\tINVALID_AMOUNT = 'invalid_amount',\n\tINVALID_RECEIVER_PK = 'invalid_receiver_pk',\n\tINSUFFICIENT_FUNDS = 'insufficient_funds',\n\tPAUSED = 'paused',\n\tSOULBOUND = 'soulbound',\n\tINVALID_BALANCE = 'invalid_balance',\n\tINVALID_TOTAL_SUPPLY = 'invalid_total_supply',\n\tINVALID_SYMBOL = 'invalid_symbol',\n\tSYMBOL_TOO_SHORT = 'symbol_too_short',\n\tSYMBOL_TOO_LONG = 'symbol_too_long',\n\tSYMBOL_RESERVED = 'symbol_reserved',\n\tSYMBOL_EXISTS = 'symbol_exists',\n\tINVALID_DECIMALS = 'invalid_decimals',\n\tNO_PERMISSIONS = 'no_permissions',\n\tSYMBOL_DOESNT_EXIST = 'symbol_doesnt_exist',\n\tNOT_MINTABLE = 'not_mintable',\n\tINVALID_DIRECTION = 'invalid_direction',\n\tNOT_PAUSABLE = 'not_pausable',\n\n\t// Lockup contract errors\n\tINVALID_DURATION = 'invalid_duration',\n\tINVALID_VAULT = 'invalid_vault',\n\tINVALID_UNLOCK_HEIGHT = 'invalid_unlock_height',\n\tINVALID_UNLOCK_AMOUNT = 'invalid_unlock_amount',\n\tVAULT_IS_LOCKED = 'vault_is_locked',\n\n\t// Lockup Prime contract errors\n\tINVALID_TIER = 'invalid_tier',\n\tINVALID_MULTIPLIER = 'invalid_multiplier',\n\tINVALID_UNLOCK_EPOCH = 'invalid_unlock_epoch',\n\tINVALID_NEXT_CHECKIN_EPOCH = 'invalid_next_checkin_epoch',\n\n\t// NFT contract errors\n\tINSUFFICIENT_TOKENS = 'insufficient_tokens',\n\tINVALID_COLLECTION = 'invalid_collection',\n\tCOLLECTION_TOO_SHORT = 'collection_too_short',\n\tCOLLECTION_TOO_LONG = 'collection_too_long',\n\tCOLLECTION_RESERVED = 'collection_reserved',\n\tCOLLECTION_EXISTS = 'collection_exists',\n\tCOLLECTION_DOESNT_EXIST = 'collection_doesnt_exist',\n\n\t// Integer parsing errors\n\tINVALID_INTEGER = 'invalid_integer'\n}\n\n/**\n * Transaction event type\n */\nexport enum TransactionEventType {\n\tSENT = 'sent',\n\tRECEIVED = 'recv'\n}\n\n/**\n * Contract names\n */\nexport enum Contract {\n\tEPOCH = 'Epoch',\n\tCOIN = 'Coin',\n\tCONTRACT = 'Contract'\n}\n\n/**\n * Contract function names\n */\nexport enum ContractFunction {\n\tTRANSFER = 'transfer',\n\tSUBMIT_SOL = 'submit_sol',\n\tSET_EMISSION_ADDRESS = 'set_emission_address',\n\tSLASH_TRAINER = 'slash_trainer',\n\tDEPLOY = 'deploy',\n\tCREATE_AND_MINT = 'create_and_mint',\n\tMINT = 'mint',\n\tPAUSE = 'pause'\n}\n\n// ============================================================================\n// Domain Types\n// ============================================================================\n\n// ----------------------------------------------------------------------------\n// Transaction Types\n// ----------------------------------------------------------------------------\n\n/**\n * Transaction action structure (for building transactions)\n */\nexport interface TransactionAction extends Record<string, SerializableValue> {\n\top: 'call'\n\tcontract: string\n\tfunction: string\n\targs: SerializableValue[]\n}\n\n/**\n * Transaction action structure (as returned by API)\n */\nexport interface TransactionActionResponse {\n\top: 'call'\n\tcontract: string\n\tfunction: string | ContractFunction\n\targs: (string | number | boolean)[]\n\tattached_symbol?: string\n\tattached_amount?: string\n}\n\n/**\n * Transaction action structure (legacy/alternative format)\n */\nexport interface TransactionActionBody {\n\top: 'call'\n\tcontract: string\n\tfunction: ContractFunction\n\targs: (string | Uint8Array)[]\n}\n\n/**\n * Transaction body structure\n */\nexport interface TransactionBody {\n\tsigner: Uint8Array | string\n\tnonce: number\n\taction: TransactionActionBody\n}\n\n/**\n * Unsigned transaction structure\n */\nexport interface UnsignedTransaction extends Record<string, SerializableValue> {\n\tsigner: Uint8Array\n\tnonce: bigint\n\taction: TransactionAction\n}\n\n/**\n * Unsigned transaction with its hash\n */\nexport interface UnsignedTransactionWithHash {\n\t/** Unsigned transaction structure */\n\ttx: UnsignedTransaction\n\t/** Transaction hash as Uint8Array */\n\thash: Uint8Array\n}\n\n/**\n * Packed transaction type\n */\nexport type TransactionPacked = Uint8Array\n\n/**\n * Unpacked transaction structure\n */\nexport interface TransactionUnpacked {\n\ttx: TransactionBody\n\ttx_encoded: Uint8Array\n\thash: Uint8Array\n\tsignature: Uint8Array\n\tmetadata?: {\n\t\tentry_hash: Uint8Array | string\n\t\tentry_height: number\n\t\ttx_event?: TransactionEventType\n\t}\n}\n\n/**\n * Transaction validation result\n */\nexport type TransactionValidationResult =\n\t| { error: 'ok'; txu: TransactionUnpacked }\n\t| { error: TransactionValidationError }\n\n/**\n * Result of building a transaction\n */\nexport interface BuildTransactionResult {\n\t/** Transaction hash as Base58 string */\n\ttxHash: string\n\t/** Packed transaction ready for submission */\n\ttxPacked: Uint8Array\n}\n\n/**\n * Input parameters for building a transfer transaction\n */\nexport interface TransferTransactionInput {\n\t/** Base58 encoded sender private key (seed) */\n\tsenderPrivkey: string\n\t/** Base58 encoded recipient address */\n\trecipient: string\n\t/** Amount in human-readable format */\n\tamount: number\n\t/** Token symbol (e.g., 'AMA') */\n\tsymbol: string\n}\n\nexport interface LockupPrimeLockInput {\n\tsenderPrivkey: string\n\tamount: number | string\n\ttier: string\n}\n\nexport interface LockupPrimeUnlockInput {\n\tsenderPrivkey: string\n\tvaultIndex: number\n}\n\nexport interface LockupPrimeDailyCheckinInput {\n\tsenderPrivkey: string\n\tvaultIndex: number\n}\n\nexport interface LockupUnlockInput {\n\tsenderPrivkey: string\n\tvaultIndex: number\n}\n\n/**\n * Transaction metadata\n */\nexport interface TransactionMetadata {\n\tentry_hash: string\n\tentry_height: number\n\ttx_event?: TransactionEventType\n}\n\n/**\n * Transaction receipt structure\n */\nexport interface TransactionReceipt {\n\t/** Execution result */\n\tresult: TransactionExecutionError | string\n\t/** Execution logs (array of ASCII dump strings) */\n\tlogs: string[]\n\t/** Success flag */\n\tsuccess: boolean\n\t/** Execution cost used */\n\texec_used: string\n}\n\n/**\n * Transaction result\n */\nexport interface TransactionResult {\n\terror: TransactionValidationError | string\n}\n\n/**\n * Transaction data returned from the API\n */\nexport interface Transaction {\n\t/** Transaction hash (Base58 encoded) */\n\thash: string\n\t/** Transaction signature (Base58 encoded) */\n\tsignature: string\n\t/** Transaction data */\n\ttx: {\n\t\t/** Signer's public key (Base58 encoded) */\n\t\tsigner: string\n\t\t/** Transaction nonce */\n\t\tnonce: number\n\t\t/** Transaction action */\n\t\taction: TransactionActionResponse\n\t}\n\t/** Transaction metadata */\n\tmetadata: TransactionMetadata\n\t/** Transaction result @deprecated use receipt instead */\n\tresult: TransactionResult\n\t/** Transaction receipt (execution result and logs) */\n\treceipt: TransactionReceipt\n}\n\n/**\n * Transaction event structure\n */\nexport interface TransactionEvent {\n\ttype: TransactionEventType\n\ttxid: string\n\tamount: string\n\tsymbol: string\n\ttimestamp: number\n}\n\n/**\n * Transaction filters for querying transactions\n */\nexport interface TransactionFilters {\n\tlimit?: number\n\toffset?: number\n\tsort?: 'asc' | 'desc'\n\tcursor?: string\n\tcursor_b58?: string\n\tcontract?: string | Contract\n\tcontract_b58?: string\n\tfunction?: string | ContractFunction\n\ttype?: TransactionEventType\n}\n\n// ----------------------------------------------------------------------------\n// Chain Types\n// ----------------------------------------------------------------------------\n\n/**\n * Chain entry header structure\n */\nexport interface ChainEntryHeader {\n\theight: number\n\ttimestamp: number\n\tmutations_hash: string\n\tslot: number\n\tprev_slot: number\n\tprev_hash: string\n\tdr: string\n\tvr: string\n\tsigner: string\n\ttxs_hash: string\n\troot_tx?: string\n\troot_validator?: string\n}\n\n/**\n * Chain entry structure\n */\nexport interface ChainEntry {\n\thash: string\n\theight: number\n\ttimestamp: number\n\tmutations_hash: string\n\ttx_count?: number\n\tmask?: string\n\tconsensus?: {\n\t\tscore: number\n\t\tfinality_reached: boolean\n\t\tmut_hash: string\n\t}\n\theader_unpacked: ChainEntryHeader\n}\n\n/**\n * Chain statistics\n */\nexport interface ChainStats {\n\theight: number\n\ttotal_entries: number\n\ttotal_transactions: number\n\ttip_hash?: string\n\ttip?: ChainEntry\n\ttx_pool_size?: number\n\tcur_validator?: string\n\tnext_validator?: string\n\temission_for_epoch?: number\n\tcirculating?: number\n\ttotal_supply_y3?: number\n\ttotal_supply_y30?: number\n\tpflops?: number\n}\n\n// ----------------------------------------------------------------------------\n// Wallet Types\n// ----------------------------------------------------------------------------\n\n/**\n * Token balance structure\n */\nexport interface TokenBalance {\n\tfloat: number\n\tsymbol: string\n\tflat: number\n}\n\n/**\n * Wallet balance wrapper\n */\nexport interface WalletBalance {\n\tbalance: {\n\t\tfloat: number\n\t\tflat: number\n\t\tsymbol: string\n\t}\n}\n\n/**\n * Wallet balances map\n */\nexport interface WalletBalances {\n\t[symbol: string]: {\n\t\tfloat: number\n\t\tflat: number\n\t\tsymbol: string\n\t}\n}\n\n// ----------------------------------------------------------------------------\n// Contract Types\n// ----------------------------------------------------------------------------\n\n/**\n * Contract data value can be any JSON-serializable value\n */\nexport type ContractDataValue =\n\t| string\n\t| number\n\t| boolean\n\t| null\n\t| ContractDataValue[]\n\t| { [key: string]: ContractDataValue }\n\n/**\n * Contract data structure\n */\nexport interface ContractData {\n\tcontract: string\n\tkey: string\n\tvalue: ContractDataValue\n}\n\n/**\n * Richlist entry structure\n */\nexport interface RichlistEntry {\n\taddress: string\n\tbalance: string\n\tsymbol: string\n\trank: number\n}\n\n// ----------------------------------------------------------------------------\n// Epoch Types\n// ----------------------------------------------------------------------------\n\n/**\n * Epoch score structure\n */\nexport type EpochScoreAll = [string, number][]\nexport type EpochScoreSingle = { error: 'ok'; score: number }\nexport type EpochScore = EpochScoreAll | EpochScoreSingle\n\n/**\n * Emission address structure\n */\nexport interface EmissionAddress {\n\taddress: string\n\tpk: string\n}\n\n// ----------------------------------------------------------------------------\n// Peer Types\n// ----------------------------------------------------------------------------\n\n/**\n * Peer information structure\n */\nexport interface PeerInfo {\n\tpk: string\n\tversion: string\n\tlatency?: number\n\ttemporal_height?: number\n\ttemporal_hash?: string\n\trooted_height?: number\n\trooted_hash?: string\n\tis_trainer?: boolean\n\tslot_speed?: number\n\tonline?: boolean\n\tin_slot?: boolean\n}\n\n/**\n * ANR (Autonomous Network Registry) information structure\n */\nexport interface ANRInfo {\n\tpk: string\n\tpop: string\n\tsignature: string\n\tip4: string\n\tport: number\n\thandshaked: boolean\n\tisChainPop: boolean\n\tversion: string\n\tts: number\n}\n\n// ----------------------------------------------------------------------------\n// Proof Types\n// ----------------------------------------------------------------------------\n\n/**\n * Validator proof node structure\n */\nexport interface ValidatorProofNode {\n\tdirection: string\n\thash: string\n}\n\n/**\n * Validator proof data structure\n */\nexport interface ValidatorProofData {\n\troot: string\n\tpath: string\n\thash: string\n\tnodes: ValidatorProofNode[]\n}\n\n// ============================================================================\n// API Response Types\n// ============================================================================\n\n// ----------------------------------------------------------------------------\n// Chain API Response Types\n// ----------------------------------------------------------------------------\n\nexport interface GetTipResponse {\n\tentry: ChainEntry\n}\n\nexport interface GetStatsResponse {\n\tstats: ChainStats\n}\n\nexport interface GetByHashResponse {\n\tentry: ChainEntry\n}\n\nexport interface GetByHeightResponse {\n\tentries: ChainEntry[]\n}\n\nexport interface GetTransactionEventsByAccountResponse {\n\tcursor: string\n\ttxs: TransactionEvent[]\n}\n\nexport interface GetTransactionsInEntryResponse {\n\ttxs: Transaction[]\n}\n\n// ----------------------------------------------------------------------------\n// Wallet API Response Types\n// ----------------------------------------------------------------------------\n\n/**\n * Query parameters for getting token balance\n */\nexport interface GetTokenBalanceQuery {\n\taddress: string\n\tsymbol?: string\n}\n\n/**\n * Response for getting token balance\n */\nexport interface GetTokenBalanceResponse {\n\terror: string\n\tdata: TokenBalance\n}\n\n/**\n * Query parameters for getting wallet transactions\n */\nexport interface GetWalletTransactionsQuery {\n\taddress: string\n\tcontract?: Contract\n\tfunction?: ContractFunction\n\ttype?: TransactionEventType\n\tsort?: 'asc' | 'desc'\n\tlimit?: number\n\toffset?: number\n\tcursor?: string\n}\n\n/**\n * Response for getting wallet transactions\n */\nexport interface GetWalletTransactionsResponse {\n\tcursor: string\n\ttxs: Transaction[]\n}\n\nexport interface GetAllBalancesResponse {\n\terror?: string\n\tbalances: TokenBalance[] | WalletBalances\n}\n\n// ----------------------------------------------------------------------------\n// Contract API Response Types\n// ----------------------------------------------------------------------------\n\nexport interface ValidateBytecodeResponse {\n\terror: string\n}\n\nexport interface GetRichlistResponse {\n\trichlist: RichlistEntry[]\n}\n\n// ----------------------------------------------------------------------------\n// Epoch API Response Types\n// ----------------------------------------------------------------------------\n\nexport interface GetEmissionAddressResponse {\n\terror: 'ok'\n\temission_address: string | null\n}\n\n/**\n * Response for checking if solution is in epoch\n */\nexport interface GetSolInEpochResponse {\n\terror: 'ok' | 'invalid_epoch' | 'sol_not_found'\n}\n\n// ----------------------------------------------------------------------------\n// Peer API Response Types\n// ----------------------------------------------------------------------------\n\nexport interface GetNodesResponse {\n\tnodes: PeerInfo[]\n}\n\nexport interface GetTrainersResponse {\n\ttrainers: PeerInfo[]\n}\n\nexport interface GetRemovedTrainersResponse {\n\tremoved_trainers: PeerInfo[]\n}\n\nexport interface GetANRsResponse {\n\tanrs: ANRInfo[]\n}\n\nexport interface GetANRByPkResponse {\n\tanr: ANRInfo\n}\n\n// ----------------------------------------------------------------------------\n// Transaction API Response Types\n// ----------------------------------------------------------------------------\n\n/**\n * Query parameters for submitting a transaction\n */\nexport interface SubmitTransactionRequestQuery {\n\ttxPacked: Uint8Array\n}\n\nexport interface SubmitTransactionResponse {\n\terror: TransactionValidationError | string\n\thash?: string\n}\n\n/**\n * Response for submit and wait transaction\n */\nexport interface SubmitAndWaitTransactionResponse {\n\terror: TransactionValidationError | string\n\thash?: string\n\tmetadata?: TransactionMetadata\n\treceipt?: TransactionReceipt\n}\n\n// ----------------------------------------------------------------------------\n// Proof API Response Types\n// ----------------------------------------------------------------------------\n\n/**\n * Validator proof response structure\n */\nexport interface ProofValidators {\n\tkey: string\n\tvalue: string\n\tvalidators: string[]\n\tproof: ValidatorProofData\n}\n\n/**\n * Contract state proof response structure (`/api/proof/contractstate`).\n * `value` and `result` are present only when a value is supplied for verification.\n */\nexport interface ContractStateProof {\n\tnamespace: string\n\tkey: string\n\tproof: ValidatorProofData\n\tvalue?: string\n\tresult?: boolean\n}\n\n// ----------------------------------------------------------------------------\n// Contract View Types\n// ----------------------------------------------------------------------------\n\n/**\n * Parameters for `/api/contract/view` (read-only on-chain function execution).\n */\nexport interface ContractViewParams {\n\t/** Contract name (e.g. 'Coin', 'Lockup') or Base58-encoded contract address */\n\tcontract: string\n\t/** Function name to invoke */\n\tfunction: string\n\t/** Function args (strings or raw bytes) */\n\targs?: SerializableValue[]\n\t/** Optional caller public key as 48-byte raw bytes; defaults to 48 zero bytes */\n\tpk?: Uint8Array\n}\n\n/**\n * Response from `/api/contract/view`.\n */\nexport interface ContractViewResponse {\n\tsuccess: boolean\n\tresult: string\n\tlogs: string[]\n}\n\n// ----------------------------------------------------------------------------\n// Chain KPI / Filter Types\n// ----------------------------------------------------------------------------\n\n/**\n * Protocol-level KPIs returned by `/api/chain/kpi`.\n */\nexport interface ChainKpi {\n\tama_burned: number\n\tfees_paid: number\n\tactive_validator_keys: number\n\tactive_peers: number\n\tblock_time: number\n\ttotal_tx: number\n\tuaw: number\n}\n\nexport interface GetKpiResponse {\n\tkpi: ChainKpi\n}\n\n/**\n * Filters accepted by `/api/chain/tx_by_filter`.\n * All fields are optional. `signer`/`arg0`/`cursor` are Base58-encoded strings.\n */\nexport interface TxByFilterParams {\n\t/** Base58 signer public key (also accepted as `sender` or `pk` aliases on the node) */\n\tsigner?: string\n\t/** Base58 first-arg value — typically the receiver address */\n\targ0?: string\n\t/** Contract name (ASCII) — for Base58-encoded contracts use `contract_b58` */\n\tcontract?: string\n\t/** Base58-encoded contract address (mutually exclusive with `contract`) */\n\tcontract_b58?: string\n\t/** Function name */\n\tfunction?: string\n\t/** Page size (default 100, max 1000 enforced server-side) */\n\tlimit?: number\n\t/** Sort order (default 'asc') */\n\tsort?: 'asc' | 'desc'\n\t/** Base58-encoded cursor from a previous response */\n\tcursor?: string\n}\n\nexport interface TxByFilterResponse {\n\tcursor: string | null\n\ttxs: Transaction[]\n}\n\n// ----------------------------------------------------------------------------\n// Submit-and-wait options\n// ----------------------------------------------------------------------------\n\n/**\n * Optional flags for `/api/tx/submit_and_wait`.\n */\nexport interface SubmitAndWaitOptions {\n\t/** Wait until the transaction is finalized (consensus reached) instead of just confirmed */\n\tfinalized?: boolean\n}\n"],"mappings":";;;;AAiFA,IAAa,kBAAb,cAAqC,MAAM;CAGlC;CACA;CAHR,YACC,SACA,QACA,UACC;EACD,MAAM,QAAQ;EAHP,KAAA,SAAA;EACA,KAAA,WAAA;EAGP,KAAK,OAAO;;;;;;AAWd,IAAY,6BAAL,yBAAA,4BAAA;CACN,2BAAA,QAAA;CACA,2BAAA,eAAA;CACA,2BAAA,sBAAA;CACA,2BAAA,kBAAA;CACA,2BAAA,uBAAA;CACA,2BAAA,uBAAA;CACA,2BAAA,oBAAA;CACA,2BAAA,0BAAA;CACA,2BAAA,8BAAA;CACA,2BAAA,qBAAA;CACA,2BAAA,6BAAA;CACA,2BAAA,6BAAA;CACA,2BAAA,uBAAA;CACA,2BAAA,wBAAA;CACA,2BAAA,oBAAA;CACA,2BAAA,sBAAA;CACA,2BAAA,wCAAA;CACA,2BAAA,0CAAA;CACA,2BAAA,aAAA;;KACA;;;;;AAMD,IAAY,4BAAL,yBAAA,2BAAA;;CAEN,0BAAA,QAAA;;CAEA,0BAAA,aAAA;;CAEA,0BAAA,cAAA;CAGA,0BAAA,kCAAA;CACA,0BAAA,mCAAA;CACA,0BAAA,6BAAA;CAGA,0BAAA,0CAAA;CACA,0BAAA,sCAAA;CACA,0BAAA,qCAAA;CAGA,0BAAA,6BAAA;CACA,0BAAA,+BAAA;CACA,0BAAA,wBAAA;CACA,0BAAA,8BAAA;CACA,0BAAA,uCAAA;CACA,0BAAA,wCAAA;CACA,0BAAA,mBAAA;CACA,0BAAA,2BAAA;CACA,0BAAA,4BAAA;CACA,0BAAA,mCAAA;CAGA,0BAAA,iCAAA;CACA,0BAAA,gCAAA;CACA,0BAAA,6BAAA;CACA,0BAAA,4BAAA;CACA,0BAAA,0BAAA;CACA,0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,0BAAA,yBAAA;CACA,0BAAA,uBAAA;CACA,0BAAA,6BAAA;CAGA,0BAAA,qBAAA;;KACA;;;;AAKD,IAAY,uBAAL,yBAAA,sBAAA;CACN,qBAAA,UAAA;CACA,qBAAA,cAAA;;KACA;;;;AAKD,IAAY,WAAL,yBAAA,UAAA;CACN,SAAA,WAAA;CACA,SAAA,UAAA;CACA,SAAA,cAAA;;KACA;;;;AAKD,IAAY,mBAAL,yBAAA,kBAAA;CACN,iBAAA,cAAA;CACA,iBAAA,gBAAA;CACA,iBAAA,0BAAA;CACA,iBAAA,mBAAA;CACA,iBAAA,YAAA;CACA,iBAAA,qBAAA;CACA,iBAAA,UAAA;CACA,iBAAA,WAAA;;KACA"}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["/**\n * Type Definitions\n *\n * This module contains all TypeScript type definitions used throughout the SDK.\n */\n\n// ============================================================================\n// Core Types\n// ============================================================================\n\n// ----------------------------------------------------------------------------\n// Serialization Types\n// ----------------------------------------------------------------------------\n\n/**\n * Serializable value types for canonical encoding (VecPack)\n */\nexport type SerializableValue =\n\t| null\n\t| boolean\n\t| number\n\t| bigint\n\t| string\n\t| Uint8Array\n\t| SerializableValue[]\n\t| Map<SerializableValue, SerializableValue>\n\t| { [key: string]: SerializableValue }\n\n/**\n * Decoded value types (Map is returned for objects during decode)\n */\nexport type DecodedValue =\n\t| null\n\t| boolean\n\t| bigint\n\t| Uint8Array\n\t| DecodedValue[]\n\t| Map<DecodedValue, DecodedValue>\n\n// ----------------------------------------------------------------------------\n// Cryptographic Types\n// ----------------------------------------------------------------------------\n\n/**\n * Key pair structure containing public and private keys as Base58 strings\n */\nexport interface KeyPair {\n\t/** Base58 encoded public key */\n\tpublicKey: string\n\t/** Base58 encoded private key (seed) */\n\tprivateKey: string\n}\n\n// ----------------------------------------------------------------------------\n// API Client Types\n// ----------------------------------------------------------------------------\n\n/**\n * SDK configuration\n */\nexport interface AmadeusSDKConfig {\n\t/** Base URL of the Amadeus node API (defaults to NODE_API_URL) */\n\tbaseUrl?: string\n\t/** Request timeout in milliseconds (default: 30000) */\n\ttimeout?: number\n\t/** Custom headers to include in requests */\n\theaders?: Record<string, string>\n}\n\n/**\n * API response wrapper\n * Note: Index signature needed for dynamic response properties\n */\nexport interface ApiResponse {\n\terror: 'ok' | 'not_found' | string\n\t[key: string]: unknown\n}\n\n/**\n * SDK error class\n */\nexport class AmadeusSDKError extends Error {\n\tconstructor(\n\t\tmessage: string,\n\t\tpublic status?: number,\n\t\tpublic response?: Record<string, unknown>\n\t) {\n\t\tsuper(message)\n\t\tthis.name = 'AmadeusSDKError'\n\t}\n}\n\n// ============================================================================\n// Enums\n// ============================================================================\n\n/**\n * Transaction validation error codes\n */\nexport enum TransactionValidationError {\n\tOK = 'ok',\n\tTOO_LARGE = 'too_large',\n\tTX_NOT_CANONICAL = 'tx_not_canonical',\n\tINVALID_HASH = 'invalid_hash',\n\tINVALID_SIGNATURE = 'invalid_signature',\n\tNONCE_NOT_INTEGER = 'nonce_not_integer',\n\tNONCE_TOO_HIGH = 'nonce_too_high',\n\tACTIONS_MUST_BE_LIST = 'actions_must_be_list',\n\tACTIONS_LENGTH_MUST_BE_1 = 'actions_length_must_be_1',\n\tOP_MUST_BE_CALL = 'op_must_be_call',\n\tCONTRACT_MUST_BE_BINARY = 'contract_must_be_binary',\n\tFUNCTION_MUST_BE_BINARY = 'function_must_be_binary',\n\tARGS_MUST_BE_LIST = 'args_must_be_list',\n\tARG_MUST_BE_BINARY = 'arg_must_be_binary',\n\tINVALID_MODULE = 'invalid_module',\n\tINVALID_FUNCTION = 'invalid_function',\n\tINVALID_MODULE_FOR_SPECIAL_MEETING = 'invalid_module_for_special_meeting',\n\tINVALID_FUNCTION_FOR_SPECIAL_MEETING = 'invalid_function_for_special_meeting',\n\tUNKNOWN = 'unknown'\n}\n\n/**\n * Transaction execution error codes.\n * These are returned when contract execution fails.\n */\nexport enum TransactionExecutionError {\n\t/** Success - execution completed successfully */\n\tOK = 'ok',\n\t/** Unknown error (when panic payload cannot be converted to string) */\n\tUNKNOWN = 'unknown',\n\t/** Contract execution was aborted */\n\tAS_ABORT = 'as_abort',\n\n\t// Execution budget errors\n\tEXEC_INVALID_AMOUNT_NEGATIVE = 'exec_invalid_amount_negative',\n\tEXEC_INSUFFICIENT_EXEC_BUDGET = 'exec_insufficient_exec_budget',\n\tEXEC_CRITICAL_UNDERFLOW = 'exec_critical_underflow',\n\n\t// Storage budget errors\n\tEXEC_STORAGE_INVALID_AMOUNT_NEGATIVE = 'exec_storage_invalid_amount_negative',\n\tEXEC_INSUFFICIENT_STORAGE_BUDGET = 'exec_insufficient_storage_budget',\n\tEXEC_STORAGE_CRITICAL_UNDERFLOW = 'exec_storage_critical_underflow',\n\n\t// KV operation errors\n\tEXEC_TOO_LARGE_KEY_SIZE = 'exec_too_large_key_size',\n\tEXEC_TOO_LARGE_VALUE_SIZE = 'exec_too_large_value_size',\n\tEXEC_KV_PUT_FAILED = 'exec_kv_put_failed',\n\tEXEC_KV_INCREMENT_FAILED = 'exec_kv_increment_failed',\n\tEXEC_KV_INCREMENT_INVALID_INTEGER = 'exec_kv_increment_invalid_integer',\n\tEXEC_KV_INCREMENT_INTEGER_OVERFLOW = 'exec_kv_increment_integer_overflow',\n\tKV_PUT_FAILED = 'kv_put_failed',\n\tEXEC_KV_DELETE_FAILED = 'exec_kv_delete_failed',\n\tEXEC_KV_SET_BIT_FAILED = 'exec_kv_set_bit_failed',\n\tEXEC_CANNOT_WRITE_DURING_VIEW = 'exec_cannot_write_during_view',\n\n\t// WASM execution errors\n\tEXEC_RETURN_VALUE_TOO_LARGE = 'exec_return_value_too_large',\n\tEXEC_INSTANCE_NOT_INJECTED = 'exec_instance_not_injected',\n\tEXEC_PTR_TERM_TOO_SHORT = 'exec_ptr_term_too_short',\n\tEXEC_PTR_TERM_TOO_LONG = 'exec_ptr_term_too_long',\n\tEXEC_LOG_INVALID_PTR = 'exec_log_invalid_ptr',\n\tEXEC_CALL_TABLE_INVALID_PTR = 'exec_call_table_invalid_ptr',\n\tEXEC_CALL_TOO_MANY_ARGS = 'exec_call_too_many_args',\n\tEXEC_READ_CALL_TABLE_ERROR = 'exec_read_call_table_error',\n\tEXEC_CALL_PTR_TERM_TOO_LONG = 'exec_call_ptr_term_too_long',\n\tEXEC_READ_CALL_TABLE_DATA_ERROR = 'exec_read_call_table_data_error',\n\tEXEC_CALL_EXTRA_INVALID = 'exec_call_extra_invalid',\n\tEXEC_CALL_EXTRA_TOO_MANY = 'exec_call_extra_too_many',\n\tEXEC_READ_EXTRA_ROW = 'exec_read_extra_row',\n\tEXEC_READ_EXTRA_DATA = 'exec_read_extra_data',\n\tEXEC_CALL_MISSING_ARGS = 'exec_call_missing_args',\n\tEXEC_MEMWRITE = 'exec_memwrite',\n\tEXEC_LOG_MSG_SIZE_EXCEEDED = 'exec_log_msg_size_exceeded',\n\tEXEC_LOGS_TOTAL_SIZE_EXCEEDED = 'exec_logs_total_size_exceeded',\n\tEXEC_LOGS_TOTAL_ELEMENTS_EXCEEDED = 'exec_logs_total_elements_exceeded',\n\tEXEC_INVALID_MODULE = 'exec_invalid_module',\n\tEXEC_MEMORY_ALLOC = 'exec_memory_alloc',\n\tEXEC_ARG_LEN_WRITE = 'exec_arg_len_write',\n\tEXEC_ARG_WRITE = 'exec_arg_write',\n\tEXEC_INSTANCE = 'exec_instance',\n\tEXEC_INIT_MEMWRITE = 'exec_init_memwrite',\n\tEXEC_DESERIALIZE_ERR = 'exec_deserialize_err',\n\tEXEC_SERIALIZE_ERR = 'exec_serialize_err',\n\tEXEC_FUNCTION_NOT_FOUND = 'exec_function_not_found',\n\tEXEC_ERROR = 'exec_error',\n\n\t// Contract/action errors\n\tINVALID_EPOCH = 'invalid_epoch',\n\tINVALID_BIC_ACTION = 'invalid_bic_action',\n\tINVALID_FUNCTION = 'invalid_function',\n\tACCOUNT_HAS_NO_BYTECODE = 'account_has_no_bytecode',\n\tINVALID_ATTACHED_AMOUNT = 'invalid_attached_amount',\n\tATTACHED_AMOUNT_INSUFFICIENT_FUNDS = 'attached_amount_insufficient_funds',\n\tWASM_NOOP = 'wasm_noop',\n\tINVALID_BYTECODE = 'invalid_bytecode',\n\n\t// Coin contract errors\n\tINVALID_ARGS = 'invalid_args',\n\tINVALID_AMOUNT = 'invalid_amount',\n\tINVALID_RECEIVER_PK = 'invalid_receiver_pk',\n\tINSUFFICIENT_FUNDS = 'insufficient_funds',\n\tPAUSED = 'paused',\n\tSOULBOUND = 'soulbound',\n\tINVALID_BALANCE = 'invalid_balance',\n\tINVALID_TOTAL_SUPPLY = 'invalid_total_supply',\n\tINVALID_SYMBOL = 'invalid_symbol',\n\tSYMBOL_TOO_SHORT = 'symbol_too_short',\n\tSYMBOL_TOO_LONG = 'symbol_too_long',\n\tSYMBOL_RESERVED = 'symbol_reserved',\n\tSYMBOL_EXISTS = 'symbol_exists',\n\tINVALID_DECIMALS = 'invalid_decimals',\n\tNO_PERMISSIONS = 'no_permissions',\n\tSYMBOL_DOESNT_EXIST = 'symbol_doesnt_exist',\n\tNOT_MINTABLE = 'not_mintable',\n\tINVALID_DIRECTION = 'invalid_direction',\n\tNOT_PAUSABLE = 'not_pausable',\n\n\t// Lockup contract errors\n\tINVALID_DURATION = 'invalid_duration',\n\tINVALID_VAULT = 'invalid_vault',\n\tINVALID_UNLOCK_HEIGHT = 'invalid_unlock_height',\n\tINVALID_UNLOCK_AMOUNT = 'invalid_unlock_amount',\n\tVAULT_IS_LOCKED = 'vault_is_locked',\n\n\t// Lockup Prime contract errors\n\tINVALID_TIER = 'invalid_tier',\n\tINVALID_MULTIPLIER = 'invalid_multiplier',\n\tINVALID_UNLOCK_EPOCH = 'invalid_unlock_epoch',\n\tINVALID_NEXT_CHECKIN_EPOCH = 'invalid_next_checkin_epoch',\n\n\t// NFT contract errors\n\tINSUFFICIENT_TOKENS = 'insufficient_tokens',\n\tINVALID_COLLECTION = 'invalid_collection',\n\tCOLLECTION_TOO_SHORT = 'collection_too_short',\n\tCOLLECTION_TOO_LONG = 'collection_too_long',\n\tCOLLECTION_RESERVED = 'collection_reserved',\n\tCOLLECTION_EXISTS = 'collection_exists',\n\tCOLLECTION_DOESNT_EXIST = 'collection_doesnt_exist',\n\n\t// Integer parsing errors\n\tINVALID_INTEGER = 'invalid_integer'\n}\n\n/**\n * Transaction event type\n */\nexport enum TransactionEventType {\n\tSENT = 'sent',\n\tRECEIVED = 'recv'\n}\n\n/**\n * Contract names\n */\nexport enum Contract {\n\tEPOCH = 'Epoch',\n\tCOIN = 'Coin',\n\tCONTRACT = 'Contract'\n}\n\n/**\n * Contract function names\n */\nexport enum ContractFunction {\n\tTRANSFER = 'transfer',\n\tSUBMIT_SOL = 'submit_sol',\n\tSET_EMISSION_ADDRESS = 'set_emission_address',\n\tSLASH_TRAINER = 'slash_trainer',\n\tDEPLOY = 'deploy',\n\tCREATE_AND_MINT = 'create_and_mint',\n\tMINT = 'mint',\n\tPAUSE = 'pause'\n}\n\n// ============================================================================\n// Domain Types\n// ============================================================================\n\n// ----------------------------------------------------------------------------\n// Transaction Types\n// ----------------------------------------------------------------------------\n\n/**\n * Transaction action structure (for building transactions)\n */\nexport interface TransactionAction extends Record<string, SerializableValue> {\n\top: 'call'\n\tcontract: string\n\tfunction: string\n\targs: SerializableValue[]\n}\n\n/**\n * Transaction action structure (as returned by API)\n */\nexport interface TransactionActionResponse {\n\top: 'call'\n\tcontract: string\n\tfunction: string | ContractFunction\n\targs: (string | number | boolean)[]\n\tattached_symbol?: string\n\tattached_amount?: string\n}\n\n/**\n * Transaction action structure (legacy/alternative format)\n */\nexport interface TransactionActionBody {\n\top: 'call'\n\tcontract: string\n\tfunction: ContractFunction\n\targs: (string | Uint8Array)[]\n}\n\n/**\n * Transaction body structure\n */\nexport interface TransactionBody {\n\tsigner: Uint8Array | string\n\tnonce: number\n\taction: TransactionActionBody\n}\n\n/**\n * Unsigned transaction structure\n */\nexport interface UnsignedTransaction extends Record<string, SerializableValue> {\n\tsigner: Uint8Array\n\tnonce: bigint\n\taction: TransactionAction\n}\n\n/**\n * Unsigned transaction with its hash\n */\nexport interface UnsignedTransactionWithHash {\n\t/** Unsigned transaction structure */\n\ttx: UnsignedTransaction\n\t/** Transaction hash as Uint8Array */\n\thash: Uint8Array\n}\n\n/**\n * Packed transaction type\n */\nexport type TransactionPacked = Uint8Array\n\n/**\n * Unpacked transaction structure\n */\nexport interface TransactionUnpacked {\n\ttx: TransactionBody\n\ttx_encoded: Uint8Array\n\thash: Uint8Array\n\tsignature: Uint8Array\n\tmetadata?: {\n\t\tentry_hash: Uint8Array | string\n\t\tentry_height: number\n\t\ttx_event?: TransactionEventType\n\t}\n}\n\n/**\n * Transaction validation result\n */\nexport type TransactionValidationResult =\n\t| { error: 'ok'; txu: TransactionUnpacked }\n\t| { error: TransactionValidationError }\n\n/**\n * Result of building a transaction\n */\nexport interface BuildTransactionResult {\n\t/** Transaction hash as Base58 string */\n\ttxHash: string\n\t/** Packed transaction ready for submission */\n\ttxPacked: Uint8Array\n}\n\n/**\n * Input parameters for building a transfer transaction\n */\nexport interface TransferTransactionInput {\n\t/** Base58 encoded sender private key (seed) */\n\tsenderPrivkey: string\n\t/** Base58 encoded recipient address */\n\trecipient: string\n\t/** Amount in human-readable format */\n\tamount: number\n\t/** Token symbol (e.g., 'AMA') */\n\tsymbol: string\n}\n\nexport interface LockupPrimeLockInput {\n\tsenderPrivkey: string\n\tamount: number | string\n\ttier: string\n}\n\nexport interface LockupPrimeUnlockInput {\n\tsenderPrivkey: string\n\tvaultIndex: number\n}\n\nexport interface LockupPrimeDailyCheckinInput {\n\tsenderPrivkey: string\n\tvaultIndex: number\n}\n\nexport interface LockupUnlockInput {\n\tsenderPrivkey: string\n\tvaultIndex: number\n}\n\n/**\n * Transaction metadata (as returned by tx query endpoints).\n */\nexport interface TransactionMetadata {\n\t/** Hash of the entry containing this tx (Base58) */\n\tentry_hash: string\n\t/** Height of the entry containing this tx */\n\tentry_height: number\n\t/** Finality status — present on `chain.getTransaction` once the tx is rooted */\n\tstatus?: 'finalized' | string\n\t/** Direction — only present on `chain.getTransactionEventsByAccount` results */\n\ttx_event?: TransactionEventType\n}\n\n/**\n * Transaction receipt structure\n */\nexport interface TransactionReceipt {\n\t/** Execution result — `null` for successful txs without a return value */\n\tresult: TransactionExecutionError | string | null\n\t/** Execution logs (array of ASCII dump strings) */\n\tlogs: string[]\n\t/** Success flag */\n\tsuccess: boolean\n\t/** Execution cost used */\n\texec_used: string\n}\n\n/**\n * Transaction result (legacy field — `receipt` is preferred).\n *\n * `error` is `null` for successful txs.\n */\nexport interface TransactionResult {\n\terror: TransactionValidationError | string | null\n}\n\n/**\n * Transaction data returned from the API\n */\nexport interface Transaction {\n\t/** Transaction hash (Base58 encoded) */\n\thash: string\n\t/** Transaction signature (Base58 encoded) */\n\tsignature: string\n\t/** Transaction data */\n\ttx: {\n\t\t/** Signer's public key (Base58 encoded) */\n\t\tsigner: string\n\t\t/** Transaction nonce */\n\t\tnonce: number\n\t\t/** Transaction action */\n\t\taction: TransactionActionResponse\n\t}\n\t/** Transaction metadata */\n\tmetadata: TransactionMetadata\n\t/** Transaction result @deprecated use receipt instead */\n\tresult: TransactionResult\n\t/** Transaction receipt (execution result and logs) */\n\treceipt: TransactionReceipt\n}\n\n/**\n * Transaction event structure\n */\nexport interface TransactionEvent {\n\ttype: TransactionEventType\n\ttxid: string\n\tamount: string\n\tsymbol: string\n\ttimestamp: number\n}\n\n/**\n * Transaction filters for querying transactions\n */\nexport interface TransactionFilters {\n\tlimit?: number\n\toffset?: number\n\tsort?: 'asc' | 'desc'\n\tcursor?: string\n\tcursor_b58?: string\n\tcontract?: string | Contract\n\tcontract_b58?: string\n\tfunction?: string | ContractFunction\n\ttype?: TransactionEventType\n}\n\n// ----------------------------------------------------------------------------\n// Chain Types\n// ----------------------------------------------------------------------------\n\n/**\n * Chain entry header structure (as returned by the node).\n *\n * Source of truth: `format_entry_for_client/1` in `ex/lib/api/api_chain.ex`.\n */\nexport interface ChainEntryHeader {\n\t/** Slot number — strictly increasing, time-based */\n\tslot: number\n\t/** Block height (canonical chain position) */\n\theight: number\n\t/** Previous slot number */\n\tprev_slot: number\n\t/** Previous entry hash (Base58) */\n\tprev_hash: string\n\t/** Data-randomness (Base58) */\n\tdr: string\n\t/** VRF output (Base58) */\n\tvr: string\n\t/** Signer's public key (Base58) */\n\tsigner: string\n\t/** Root transaction hash (Base58, optional) */\n\troot_tx?: string\n\t/** Root validator (Base58, optional) */\n\troot_validator?: string\n}\n\n/**\n * Chain entry structure (as returned by the node).\n *\n * The `height` lives at `entry.header.height`, NOT at the top level.\n */\nexport interface ChainEntry {\n\t/** Header — height, slot, signer, etc. live here */\n\theader: ChainEntryHeader\n\t/** Entry hash (Base58) */\n\thash: string\n\t/** Number of transactions in this entry */\n\ttx_count: number\n\t/** Validator participation mask (Base58, optional) */\n\tmask?: string\n\t/** Number of validators reflected in `mask` */\n\tmask_size?: number\n\t/** Consensus state — present once a validator quorum is reached */\n\tconsensus?: {\n\t\t/** Fraction of validator weight that has signed (0–1) */\n\t\tscore: number\n\t\t/** True once score ≥ 0.67 (finalized) */\n\t\tfinality_reached: boolean\n\t\t/** Mutations-hash Base58 — hash of state mutations applied by this entry */\n\t\tmut_hash: string\n\t}\n\t/**\n\t * Hash of the next entry once finality has been reached on it.\n\t * Only set on `chain.getByHash` responses.\n\t */\n\tnext_entry_hash_finality_reached?: string\n\t/**\n\t * Filtered transactions — only set on `chain.getByHash` when called with\n\t * `filterOnFunction`.\n\t */\n\ttxs_filtered?: Transaction[]\n}\n\n/**\n * Chain statistics (as returned by `/api/chain/stats`).\n *\n * Source of truth: `API.Chain.stats/1` in `ex/lib/api/api_chain.ex`.\n */\nexport interface ChainStats {\n\t/** Current tip height */\n\theight: number\n\t/** Most recent finalized (rooted) height */\n\trooted_height: number\n\t/** Hash of the tip entry (Base58) */\n\ttip_hash: string\n\t/** Full tip entry */\n\ttip: ChainEntry\n\t/** Number of pending transactions in the mempool */\n\ttx_pool_size: number\n\t/** Validator scheduled to produce the current entry (Base58) */\n\tcur_validator: string\n\t/** Validator scheduled to produce the next entry (Base58) */\n\tnext_validator: string\n\t/** Emission for the current epoch (AMA float) */\n\temission_for_epoch: number\n\t/** Circulating supply (AMA float) */\n\tcirculating: number\n\t/** Total AMA burned (float) */\n\tburned: number\n\t/** Projected total supply at year 3 */\n\ttotal_supply_y3: number\n\t/** Projected total supply at year 30 */\n\ttotal_supply_y30: number\n\t/** Current difficulty bits */\n\tdiff_bits: number\n\t/** Estimated PFLOPS across the validator set */\n\tpflops: number\n\t/** Recent throughput estimate (transactions per second) */\n\ttxs_per_sec: number\n\t/** Current segment VRF hash (Base58) */\n\tsegment_vr_hash: string\n}\n\n// ----------------------------------------------------------------------------\n// Wallet Types\n// ----------------------------------------------------------------------------\n\n/**\n * Token balance structure\n */\nexport interface TokenBalance {\n\tfloat: number\n\tsymbol: string\n\tflat: number\n}\n\n/**\n * Wallet balance wrapper\n */\nexport interface WalletBalance {\n\tbalance: {\n\t\tfloat: number\n\t\tflat: number\n\t\tsymbol: string\n\t}\n}\n\n// ----------------------------------------------------------------------------\n// Contract Types\n// ----------------------------------------------------------------------------\n\n/**\n * Contract data value can be any JSON-serializable value\n */\nexport type ContractDataValue =\n\t| string\n\t| number\n\t| boolean\n\t| null\n\t| ContractDataValue[]\n\t| { [key: string]: ContractDataValue }\n\n/**\n * Contract data structure\n */\nexport interface ContractData {\n\tcontract: string\n\tkey: string\n\tvalue: ContractDataValue\n}\n\n/**\n * Richlist entry structure (as returned by `/api/contract/richlist`).\n * Source of truth: `API.Contract.richlist/0` in `ex/lib/api/api_contract.ex`.\n */\nexport interface RichlistEntry {\n\t/** Account public key (Base58) */\n\tpk: string\n\t/** Token symbol (always 'AMA' for now) */\n\tsymbol: string\n\t/** Balance in atomic units */\n\tflat: number\n\t/** Balance in human-readable units */\n\tfloat: number\n}\n\n// ----------------------------------------------------------------------------\n// Epoch Types\n// ----------------------------------------------------------------------------\n\n/**\n * Epoch score structure.\n *\n * The all-validators variant returns a tuple array `[pk, score][]`.\n * The single-pk variant returns `{ score }` (the SDK strips the `error: 'ok'`\n * wrapper).\n */\nexport type EpochScoreAll = [string, number][]\nexport type EpochScoreSingle = { score: number }\nexport type EpochScore = EpochScoreAll | EpochScoreSingle\n\n/**\n * Emission address structure\n */\nexport interface EmissionAddress {\n\taddress: string\n\tpk: string\n}\n\n// ----------------------------------------------------------------------------\n// Peer Types\n// ----------------------------------------------------------------------------\n\n/**\n * Peer information structure\n */\nexport interface PeerInfo {\n\tpk: string\n\tversion: string\n\tlatency?: number\n\ttemporal_height?: number\n\ttemporal_hash?: string\n\trooted_height?: number\n\trooted_hash?: string\n\tis_trainer?: boolean\n\tslot_speed?: number\n\tonline?: boolean\n\tin_slot?: boolean\n}\n\n/**\n * ANR (Autonomous Network Registry) information structure\n */\nexport interface ANRInfo {\n\tpk: string\n\tpop: string\n\tsignature: string\n\tip4: string\n\tport: number\n\thandshaked: boolean\n\tisChainPop: boolean\n\tversion: string\n\tts: number\n}\n\n// ----------------------------------------------------------------------------\n// Proof Types\n// ----------------------------------------------------------------------------\n\n/**\n * Validator proof node structure\n */\nexport interface ValidatorProofNode {\n\tdirection: string\n\thash: string\n}\n\n/**\n * Validator proof data structure\n */\nexport interface ValidatorProofData {\n\troot: string\n\tpath: string\n\thash: string\n\tnodes: ValidatorProofNode[]\n}\n\n// ============================================================================\n// API Response Types\n// ============================================================================\n\n// ----------------------------------------------------------------------------\n// Chain API Response Types\n// ----------------------------------------------------------------------------\n\nexport interface GetTipResponse {\n\tentry: ChainEntry\n}\n\nexport interface GetStatsResponse {\n\tstats: ChainStats\n}\n\nexport interface GetByHashResponse {\n\tentry: ChainEntry\n}\n\nexport interface GetByHeightResponse {\n\tentries: ChainEntry[]\n}\n\nexport interface GetTransactionEventsByAccountResponse {\n\tcursor: string\n\ttxs: TransactionEvent[]\n}\n\nexport interface GetTransactionsInEntryResponse {\n\ttxs: Transaction[]\n}\n\n// ----------------------------------------------------------------------------\n// Wallet API Response Types\n// ----------------------------------------------------------------------------\n\n/**\n * Query parameters for getting token balance\n */\nexport interface GetTokenBalanceQuery {\n\taddress: string\n\tsymbol?: string\n}\n\n/**\n * Response for getting token balance\n */\nexport interface GetTokenBalanceResponse {\n\terror: string\n\tdata: TokenBalance\n}\n\n/**\n * Query parameters for getting wallet transactions\n */\nexport interface GetWalletTransactionsQuery {\n\taddress: string\n\tcontract?: Contract\n\tfunction?: ContractFunction\n\ttype?: TransactionEventType\n\tsort?: 'asc' | 'desc'\n\tlimit?: number\n\toffset?: number\n\tcursor?: string\n}\n\n/**\n * Response for getting wallet transactions\n */\nexport interface GetWalletTransactionsResponse {\n\tcursor: string\n\ttxs: Transaction[]\n}\n\n/**\n * Response from `/api/wallet/balance_all/{pk}`.\n * The node returns balances as an array of `{ float, symbol, flat }` entries.\n */\nexport interface GetAllBalancesResponse {\n\tbalances: TokenBalance[]\n}\n\n// ----------------------------------------------------------------------------\n// Contract API Response Types\n// ----------------------------------------------------------------------------\n\n/**\n * Response from `/api/contract/validate`.\n *\n * Always returns the validation result and any logs emitted by the validator.\n * Note: the node currently returns `error: 'ok'` on success, which the SDK\n * strips — making `error` undefined when validation succeeds. Check `logs`\n * for diagnostic output regardless.\n */\nexport interface ValidateBytecodeResponse {\n\t/** Validation error code, if any (undefined on success after SDK strips `:ok`) */\n\terror?: string\n\t/** Validator logs (ASCII-dumped) */\n\tlogs?: string[]\n}\n\nexport interface GetRichlistResponse {\n\trichlist: RichlistEntry[]\n}\n\n// ----------------------------------------------------------------------------\n// Epoch API Response Types\n// ----------------------------------------------------------------------------\n\n/**\n * Response from `/api/epoch/get_emission_address/{pk}`.\n * The `error: 'ok'` envelope is stripped by the SDK.\n */\nexport interface GetEmissionAddressResponse {\n\t/** Configured emission address (Base58), or `null` if not set */\n\temission_address: string | null\n}\n\n/**\n * Response from `/api/epoch/sol_in_epoch/{epoch}/{solHash}`.\n *\n * Empty object on success. The SDK throws `AmadeusSDKError` for\n * `invalid_epoch` / `sol_not_found` (caller can distinguish by `error.message`).\n */\nexport type GetSolInEpochResponse = Record<string, never>\n\n// ----------------------------------------------------------------------------\n// Peer API Response Types\n// ----------------------------------------------------------------------------\n\nexport interface GetNodesResponse {\n\tnodes: PeerInfo[]\n}\n\nexport interface GetTrainersResponse {\n\ttrainers: PeerInfo[]\n}\n\nexport interface GetRemovedTrainersResponse {\n\tremoved_trainers: PeerInfo[]\n}\n\nexport interface GetANRsResponse {\n\tanrs: ANRInfo[]\n}\n\nexport interface GetANRByPkResponse {\n\tanr: ANRInfo\n}\n\n// ----------------------------------------------------------------------------\n// Transaction API Response Types\n// ----------------------------------------------------------------------------\n\n/**\n * Query parameters for submitting a transaction\n */\nexport interface SubmitTransactionRequestQuery {\n\ttxPacked: Uint8Array\n}\n\n/**\n * Response from `/api/tx/submit` on success.\n *\n * The SDK strips the `error: 'ok'` envelope and throws `AmadeusSDKError`\n * on validation failure — so this success type contains only the hash.\n */\nexport interface SubmitTransactionResponse {\n\t/** Submitted transaction hash (Base58) */\n\thash: string\n}\n\n/**\n * Response from `/api/tx/submit_and_wait` on success.\n *\n * The SDK strips the `error: 'ok'` envelope and throws `AmadeusSDKError`\n * on validation failure or wait timeout.\n */\nexport interface SubmitAndWaitTransactionResponse {\n\t/** Submitted transaction hash (Base58) */\n\thash: string\n\t/** Metadata about the entry containing the tx */\n\tmetadata: TransactionMetadata\n\t/** Execution receipt */\n\treceipt: TransactionReceipt\n}\n\n// ----------------------------------------------------------------------------\n// Proof API Response Types\n// ----------------------------------------------------------------------------\n\n/**\n * Validator proof response structure\n */\nexport interface ProofValidators {\n\tkey: string\n\tvalue: string\n\tvalidators: string[]\n\tproof: ValidatorProofData\n}\n\n/**\n * Contract state proof response structure (`/api/proof/contractstate`).\n * `value` and `result` are present only when a value is supplied for verification.\n */\nexport interface ContractStateProof {\n\tnamespace: string\n\tkey: string\n\tproof: ValidatorProofData\n\tvalue?: string\n\tresult?: boolean\n}\n\n// ----------------------------------------------------------------------------\n// Contract View Types\n// ----------------------------------------------------------------------------\n\n/**\n * Parameters for `/api/contract/view` (read-only on-chain function execution).\n */\nexport interface ContractViewParams {\n\t/** Contract name (e.g. 'Coin', 'Lockup') or Base58-encoded contract address */\n\tcontract: string\n\t/** Function name to invoke */\n\tfunction: string\n\t/** Function args (strings or raw bytes) */\n\targs?: SerializableValue[]\n\t/** Optional caller public key as 48-byte raw bytes; defaults to 48 zero bytes */\n\tpk?: Uint8Array\n}\n\n/**\n * Response from `/api/contract/view`.\n */\nexport interface ContractViewResponse {\n\tsuccess: boolean\n\tresult: string\n\tlogs: string[]\n}\n\n// ----------------------------------------------------------------------------\n// Chain KPI / Filter Types\n// ----------------------------------------------------------------------------\n\n/**\n * Protocol-level KPIs returned by `/api/chain/kpi`.\n */\nexport interface ChainKpi {\n\tama_burned: number\n\tfees_paid: number\n\tactive_validator_keys: number\n\tactive_peers: number\n\tblock_time: number\n\ttotal_tx: number\n\tuaw: number\n}\n\nexport interface GetKpiResponse {\n\tkpi: ChainKpi\n}\n\n/**\n * Filters accepted by `/api/chain/tx_by_filter`.\n * All fields are optional. `signer`/`arg0`/`cursor` are Base58-encoded strings.\n */\nexport interface TxByFilterParams {\n\t/** Base58 signer public key (also accepted as `sender` or `pk` aliases on the node) */\n\tsigner?: string\n\t/** Base58 first-arg value — typically the receiver address */\n\targ0?: string\n\t/** Contract name (ASCII) — for Base58-encoded contracts use `contract_b58` */\n\tcontract?: string\n\t/** Base58-encoded contract address (mutually exclusive with `contract`) */\n\tcontract_b58?: string\n\t/** Function name */\n\tfunction?: string\n\t/** Page size (default 100, max 1000 enforced server-side) */\n\tlimit?: number\n\t/** Sort order (default 'asc') */\n\tsort?: 'asc' | 'desc'\n\t/** Base58-encoded cursor from a previous response */\n\tcursor?: string\n}\n\nexport interface TxByFilterResponse {\n\tcursor: string | null\n\ttxs: Transaction[]\n}\n\n// ----------------------------------------------------------------------------\n// Submit-and-wait options\n// ----------------------------------------------------------------------------\n\n/**\n * Optional flags for `/api/tx/submit_and_wait`.\n */\nexport interface SubmitAndWaitOptions {\n\t/** Wait until the transaction is finalized (consensus reached) instead of just confirmed */\n\tfinalized?: boolean\n}\n"],"mappings":";;;;AAiFA,IAAa,kBAAb,cAAqC,MAAM;CAGlC;CACA;CAHR,YACC,SACA,QACA,UACC;EACD,MAAM,QAAQ;EAHP,KAAA,SAAA;EACA,KAAA,WAAA;EAGP,KAAK,OAAO;;;;;;AAWd,IAAY,6BAAL,yBAAA,4BAAA;CACN,2BAAA,QAAA;CACA,2BAAA,eAAA;CACA,2BAAA,sBAAA;CACA,2BAAA,kBAAA;CACA,2BAAA,uBAAA;CACA,2BAAA,uBAAA;CACA,2BAAA,oBAAA;CACA,2BAAA,0BAAA;CACA,2BAAA,8BAAA;CACA,2BAAA,qBAAA;CACA,2BAAA,6BAAA;CACA,2BAAA,6BAAA;CACA,2BAAA,uBAAA;CACA,2BAAA,wBAAA;CACA,2BAAA,oBAAA;CACA,2BAAA,sBAAA;CACA,2BAAA,wCAAA;CACA,2BAAA,0CAAA;CACA,2BAAA,aAAA;;KACA;;;;;AAMD,IAAY,4BAAL,yBAAA,2BAAA;;CAEN,0BAAA,QAAA;;CAEA,0BAAA,aAAA;;CAEA,0BAAA,cAAA;CAGA,0BAAA,kCAAA;CACA,0BAAA,mCAAA;CACA,0BAAA,6BAAA;CAGA,0BAAA,0CAAA;CACA,0BAAA,sCAAA;CACA,0BAAA,qCAAA;CAGA,0BAAA,6BAAA;CACA,0BAAA,+BAAA;CACA,0BAAA,wBAAA;CACA,0BAAA,8BAAA;CACA,0BAAA,uCAAA;CACA,0BAAA,wCAAA;CACA,0BAAA,mBAAA;CACA,0BAAA,2BAAA;CACA,0BAAA,4BAAA;CACA,0BAAA,mCAAA;CAGA,0BAAA,iCAAA;CACA,0BAAA,gCAAA;CACA,0BAAA,6BAAA;CACA,0BAAA,4BAAA;CACA,0BAAA,0BAAA;CACA,0BAAA,iCAAA;CACA,0BAAA,6BA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BAAA;CACA,0BAAA,6BAAA;CAGA,0BAAA,qBAAA;;KACA;;;;AAKD,IAAY,uBAAL,yBAAA,sBAAA;CACN,qBAAA,UAAA;CACA,qBAAA,cAAA;;KACA;;;;AAKD,IAAY,WAAL,yBAAA,UAAA;CACN,SAAA,WAAA;CACA,SAAA,UAAA;CACA,SAAA,cAAA;;KACA;;;;AAKD,IAAY,mBAAL,yBAAA,kBAAA;CACN,iBAAA,cAAA;CACA,iBAAA,gBAAA;CACA,iBAAA,0BAAA;CACA,iBAAA,mBAAA;CACA,iBAAA,YAAA;CACA,iBAAA,qBAAA;CACA,iBAAA,UAAA;CACA,iBAAA,WAAA;;KACA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amadeus-protocol/sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Official TypeScript/JavaScript SDK for Amadeus Protocol - Core utilities for serialization, cryptography, transaction building, and API client",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|