@amadeus-protocol/sdk 1.0.7 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/dist/api/chain.d.ts +144 -117
  2. package/dist/api/chain.d.ts.map +1 -1
  3. package/dist/api/chain.js +175 -146
  4. package/dist/api/chain.js.map +1 -1
  5. package/dist/api/contract.d.ts +78 -60
  6. package/dist/api/contract.d.ts.map +1 -1
  7. package/dist/api/contract.js +102 -75
  8. package/dist/api/contract.js.map +1 -1
  9. package/dist/api/epoch.d.ts +65 -66
  10. package/dist/api/epoch.d.ts.map +1 -1
  11. package/dist/api/epoch.js +90 -98
  12. package/dist/api/epoch.js.map +1 -1
  13. package/dist/api/peer.d.ts +77 -78
  14. package/dist/api/peer.d.ts.map +1 -1
  15. package/dist/api/peer.js +93 -94
  16. package/dist/api/peer.js.map +1 -1
  17. package/dist/api/proof.d.ts +44 -23
  18. package/dist/api/proof.d.ts.map +1 -1
  19. package/dist/api/proof.js +56 -29
  20. package/dist/api/proof.js.map +1 -1
  21. package/dist/api/transaction.d.ts +68 -69
  22. package/dist/api/transaction.d.ts.map +1 -1
  23. package/dist/api/transaction.js +84 -84
  24. package/dist/api/transaction.js.map +1 -1
  25. package/dist/api/wallet.d.ts +36 -37
  26. package/dist/api/wallet.d.ts.map +1 -1
  27. package/dist/api/wallet.js +47 -50
  28. package/dist/api/wallet.js.map +1 -1
  29. package/dist/client.d.ts +66 -68
  30. package/dist/client.d.ts.map +1 -1
  31. package/dist/client.js +231 -276
  32. package/dist/client.js.map +1 -1
  33. package/dist/constants.d.ts +13 -10
  34. package/dist/constants.d.ts.map +1 -1
  35. package/dist/constants.js +49 -45
  36. package/dist/constants.js.map +1 -1
  37. package/dist/contract-state.d.ts +6 -3
  38. package/dist/contract-state.d.ts.map +1 -1
  39. package/dist/contract-state.js +88 -106
  40. package/dist/contract-state.js.map +1 -1
  41. package/dist/contracts/abi-types.d.ts +32 -32
  42. package/dist/contracts/abi-types.d.ts.map +1 -1
  43. package/dist/contracts/coin.d.ts +13 -20
  44. package/dist/contracts/coin.d.ts.map +1 -1
  45. package/dist/contracts/coin.js +42 -38
  46. package/dist/contracts/coin.js.map +1 -1
  47. package/dist/contracts/contract-call.d.ts +14 -16
  48. package/dist/contracts/contract-call.d.ts.map +1 -1
  49. package/dist/contracts/contract-call.js +45 -54
  50. package/dist/contracts/contract-call.js.map +1 -1
  51. package/dist/contracts/contract.d.ts +24 -55
  52. package/dist/contracts/contract.d.ts.map +1 -1
  53. package/dist/contracts/contract.js +63 -101
  54. package/dist/contracts/contract.js.map +1 -1
  55. package/dist/contracts/lockup/abi.d.ts +54 -51
  56. package/dist/contracts/lockup/abi.d.ts.map +1 -1
  57. package/dist/contracts/lockup/abi.js +65 -74
  58. package/dist/contracts/lockup/abi.js.map +1 -1
  59. package/dist/contracts/lockup/helpers.d.ts +22 -18
  60. package/dist/contracts/lockup/helpers.d.ts.map +1 -1
  61. package/dist/contracts/lockup/helpers.js +44 -47
  62. package/dist/contracts/lockup/helpers.js.map +1 -1
  63. package/dist/contracts/lockup/parsers.d.ts +7 -3
  64. package/dist/contracts/lockup/parsers.d.ts.map +1 -1
  65. package/dist/contracts/lockup/parsers.js +51 -55
  66. package/dist/contracts/lockup/parsers.js.map +1 -1
  67. package/dist/contracts/lockup/storage-keys.d.ts +5 -2
  68. package/dist/contracts/lockup/storage-keys.d.ts.map +1 -1
  69. package/dist/contracts/lockup/storage-keys.js +54 -70
  70. package/dist/contracts/lockup/storage-keys.js.map +1 -1
  71. package/dist/contracts/lockup/types.d.ts +73 -70
  72. package/dist/contracts/lockup/types.d.ts.map +1 -1
  73. package/dist/contracts/lockup-prime/abi.d.ts +328 -325
  74. package/dist/contracts/lockup-prime/abi.d.ts.map +1 -1
  75. package/dist/contracts/lockup-prime/abi.js +397 -417
  76. package/dist/contracts/lockup-prime/abi.js.map +1 -1
  77. package/dist/contracts/lockup-prime/helpers.d.ts +35 -31
  78. package/dist/contracts/lockup-prime/helpers.d.ts.map +1 -1
  79. package/dist/contracts/lockup-prime/helpers.js +131 -137
  80. package/dist/contracts/lockup-prime/helpers.js.map +1 -1
  81. package/dist/contracts/lockup-prime/parsers.d.ts +9 -5
  82. package/dist/contracts/lockup-prime/parsers.d.ts.map +1 -1
  83. package/dist/contracts/lockup-prime/parsers.js +61 -61
  84. package/dist/contracts/lockup-prime/parsers.js.map +1 -1
  85. package/dist/contracts/lockup-prime/storage-keys.d.ts +7 -4
  86. package/dist/contracts/lockup-prime/storage-keys.d.ts.map +1 -1
  87. package/dist/contracts/lockup-prime/storage-keys.js +64 -80
  88. package/dist/contracts/lockup-prime/storage-keys.js.map +1 -1
  89. package/dist/contracts/lockup-prime/types.d.ts +92 -89
  90. package/dist/contracts/lockup-prime/types.d.ts.map +1 -1
  91. package/dist/contracts/lockup-prime/types.js +12 -13
  92. package/dist/contracts/lockup-prime/types.js.map +1 -1
  93. package/dist/contracts/nft/abi.d.ts +104 -0
  94. package/dist/contracts/nft/abi.d.ts.map +1 -0
  95. package/dist/contracts/nft/abi.js +135 -0
  96. package/dist/contracts/nft/abi.js.map +1 -0
  97. package/dist/contracts/nft/helpers.d.ts +21 -0
  98. package/dist/contracts/nft/helpers.d.ts.map +1 -0
  99. package/dist/contracts/nft/helpers.js +61 -0
  100. package/dist/contracts/nft/helpers.js.map +1 -0
  101. package/dist/contracts/nft/types.d.ts +47 -0
  102. package/dist/contracts/nft/types.d.ts.map +1 -0
  103. package/dist/conversion.d.ts +5 -2
  104. package/dist/conversion.d.ts.map +1 -1
  105. package/dist/conversion.js +45 -50
  106. package/dist/conversion.js.map +1 -1
  107. package/dist/crypto.d.ts +14 -16
  108. package/dist/crypto.d.ts.map +1 -1
  109. package/dist/crypto.js +121 -140
  110. package/dist/crypto.js.map +1 -1
  111. package/dist/encoding.d.ts +11 -8
  112. package/dist/encoding.d.ts.map +1 -1
  113. package/dist/encoding.js +123 -144
  114. package/dist/encoding.js.map +1 -1
  115. package/dist/encryption.d.ts +15 -12
  116. package/dist/encryption.d.ts.map +1 -1
  117. package/dist/encryption.js +119 -117
  118. package/dist/encryption.js.map +1 -1
  119. package/dist/explorer.d.ts +10 -7
  120. package/dist/explorer.d.ts.map +1 -1
  121. package/dist/explorer.js +51 -48
  122. package/dist/explorer.js.map +1 -1
  123. package/dist/formatters.d.ts +8 -5
  124. package/dist/formatters.d.ts.map +1 -1
  125. package/dist/formatters.js +67 -68
  126. package/dist/formatters.js.map +1 -1
  127. package/dist/index.d.ts +42 -54
  128. package/dist/index.js +39 -54
  129. package/dist/mnemonic.d.ts +99 -0
  130. package/dist/mnemonic.d.ts.map +1 -0
  131. package/dist/mnemonic.js +119 -0
  132. package/dist/mnemonic.js.map +1 -0
  133. package/dist/networks.d.ts +14 -17
  134. package/dist/networks.d.ts.map +1 -1
  135. package/dist/networks.js +40 -36
  136. package/dist/networks.js.map +1 -1
  137. package/dist/schemas.js +75 -79
  138. package/dist/schemas.js.map +1 -1
  139. package/dist/sdk.d.ts +69 -65
  140. package/dist/sdk.d.ts.map +1 -1
  141. package/dist/sdk.js +126 -117
  142. package/dist/sdk.js.map +1 -1
  143. package/dist/serialization.d.ts +8 -18
  144. package/dist/serialization.d.ts.map +1 -1
  145. package/dist/serialization.js +207 -260
  146. package/dist/serialization.js.map +1 -1
  147. package/dist/signing.js +67 -67
  148. package/dist/signing.js.map +1 -1
  149. package/dist/transaction-builder.d.ts +175 -184
  150. package/dist/transaction-builder.d.ts.map +1 -1
  151. package/dist/transaction-builder.js +295 -344
  152. package/dist/transaction-builder.js.map +1 -1
  153. package/dist/transaction-errors.d.ts +10 -12
  154. package/dist/transaction-errors.d.ts.map +1 -1
  155. package/dist/transaction-errors.js +145 -166
  156. package/dist/transaction-errors.js.map +1 -1
  157. package/dist/types.d.ts +530 -450
  158. package/dist/types.d.ts.map +1 -1
  159. package/dist/types.js +169 -183
  160. package/dist/types.js.map +1 -1
  161. package/dist/validation.d.ts +24 -26
  162. package/dist/validation.d.ts.map +1 -1
  163. package/dist/validation.js +194 -192
  164. package/dist/validation.js.map +1 -1
  165. package/package.json +5 -3
  166. package/dist/api/index.d.ts +0 -8
  167. package/dist/api/index.d.ts.map +0 -1
  168. package/dist/api/index.js +0 -8
  169. package/dist/api/index.js.map +0 -1
  170. package/dist/contracts/abi-types.js +0 -8
  171. package/dist/contracts/abi-types.js.map +0 -1
  172. package/dist/contracts/index.d.ts +0 -7
  173. package/dist/contracts/index.d.ts.map +0 -1
  174. package/dist/contracts/index.js +0 -7
  175. package/dist/contracts/index.js.map +0 -1
  176. package/dist/contracts/lockup/calls.d.ts +0 -23
  177. package/dist/contracts/lockup/calls.d.ts.map +0 -1
  178. package/dist/contracts/lockup/calls.js +0 -25
  179. package/dist/contracts/lockup/calls.js.map +0 -1
  180. package/dist/contracts/lockup/index.d.ts +0 -6
  181. package/dist/contracts/lockup/index.d.ts.map +0 -1
  182. package/dist/contracts/lockup/index.js +0 -6
  183. package/dist/contracts/lockup/index.js.map +0 -1
  184. package/dist/contracts/lockup/types.js +0 -7
  185. package/dist/contracts/lockup/types.js.map +0 -1
  186. package/dist/contracts/lockup-prime/calls.d.ts +0 -53
  187. package/dist/contracts/lockup-prime/calls.d.ts.map +0 -1
  188. package/dist/contracts/lockup-prime/calls.js +0 -60
  189. package/dist/contracts/lockup-prime/calls.js.map +0 -1
  190. package/dist/contracts/lockup-prime/index.d.ts +0 -6
  191. package/dist/contracts/lockup-prime/index.d.ts.map +0 -1
  192. package/dist/contracts/lockup-prime/index.js +0 -6
  193. package/dist/contracts/lockup-prime/index.js.map +0 -1
  194. package/dist/index.d.ts.map +0 -1
  195. package/dist/index.js.map +0 -1
  196. package/dist/schemas.d.ts +0 -67
  197. package/dist/schemas.d.ts.map +0 -1
  198. package/dist/signing.d.ts +0 -39
  199. package/dist/signing.d.ts.map +0 -1
@@ -1,62 +1,80 @@
1
- /**
2
- * Contract API
3
- *
4
- * Provides methods for interacting with smart contracts
5
- */
6
- import type { AmadeusClient } from '../client';
7
- import type { ValidateBytecodeResponse, GetRichlistResponse, ContractDataValue } from '../types';
8
- export declare class ContractAPI {
9
- private client;
10
- constructor(client: AmadeusClient);
11
- /**
12
- * Validate contract bytecode
13
- *
14
- * @param bytecode - Contract bytecode as Uint8Array or ArrayBuffer
15
- * @returns Promise resolving to validation result
16
- * @throws {AmadeusSDKError} If bytecode is invalid or empty
17
- *
18
- * @example
19
- * ```ts
20
- * const result = await sdk.contract.validateBytecode(wasmBytecode)
21
- * ```
22
- */
23
- validateBytecode(bytecode: Uint8Array | ArrayBuffer): Promise<ValidateBytecodeResponse>;
24
- /**
25
- * Get contract data by key
26
- *
27
- * @param key - Contract key as Uint8Array or Base58 string
28
- * @returns Promise resolving to contract data value (JSON-serializable)
29
- * @throws {AmadeusSDKError} If key is invalid
30
- *
31
- * @example
32
- * ```ts
33
- * const data = await sdk.contract.get(keyBytes)
34
- * ```
35
- */
36
- get(key: Uint8Array | string): Promise<ContractDataValue>;
37
- /**
38
- * Get contract data by key prefix
39
- *
40
- * @param key - Contract key prefix as Uint8Array or Base58 string
41
- * @returns Promise resolving to contract data matching the prefix (array of key-value pairs)
42
- * @throws {AmadeusSDKError} If key is invalid
43
- *
44
- * @example
45
- * ```ts
46
- * const data = await sdk.contract.getPrefix(keyPrefix)
47
- * ```
48
- */
49
- getPrefix(key: Uint8Array | string): Promise<ContractDataValue[]>;
50
- /**
51
- * Get contract richlist (token holders)
52
- *
53
- * @returns Promise resolving to richlist entries
54
- *
55
- * @example
56
- * ```ts
57
- * const { richlist } = await sdk.contract.getRichlist()
58
- * ```
59
- */
60
- getRichlist(): Promise<GetRichlistResponse>;
1
+ import { ContractDataValue, ContractViewParams, ContractViewResponse, GetRichlistResponse, ValidateBytecodeResponse } from "../types.js";
2
+ import { AmadeusClient } from "../client.js";
3
+
4
+ //#region src/api/contract.d.ts
5
+ declare class ContractAPI {
6
+ private client;
7
+ constructor(client: AmadeusClient);
8
+ /**
9
+ * Validate contract bytecode
10
+ *
11
+ * @param bytecode - Contract bytecode as Uint8Array or ArrayBuffer
12
+ * @returns Promise resolving to validation result
13
+ * @throws {AmadeusSDKError} If bytecode is invalid or empty
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const result = await sdk.contract.validateBytecode(wasmBytecode)
18
+ * ```
19
+ */
20
+ validateBytecode(bytecode: Uint8Array | ArrayBuffer): Promise<ValidateBytecodeResponse>;
21
+ /**
22
+ * Get contract data by key
23
+ *
24
+ * @param key - Contract key as Uint8Array or Base58 string
25
+ * @returns Promise resolving to contract data value (JSON-serializable)
26
+ * @throws {AmadeusSDKError} If key is invalid
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const data = await sdk.contract.get(keyBytes)
31
+ * ```
32
+ */
33
+ get(key: Uint8Array | string): Promise<ContractDataValue>;
34
+ /**
35
+ * Get contract data by key prefix
36
+ *
37
+ * @param key - Contract key prefix as Uint8Array or Base58 string
38
+ * @returns Promise resolving to contract data matching the prefix (array of key-value pairs)
39
+ * @throws {AmadeusSDKError} If key is invalid
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * const data = await sdk.contract.getPrefix(keyPrefix)
44
+ * ```
45
+ */
46
+ getPrefix(key: Uint8Array | string): Promise<ContractDataValue[]>;
47
+ /**
48
+ * Get contract richlist (token holders)
49
+ *
50
+ * @returns Promise resolving to richlist entries
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * const { richlist } = await sdk.contract.getRichlist()
55
+ * ```
56
+ */
57
+ getRichlist(): Promise<GetRichlistResponse>;
58
+ /**
59
+ * Execute a contract function in read-only (view) mode against the current chain tip.
60
+ *
61
+ * No transaction is created and no state is mutated. Useful for querying contract
62
+ * state through the contract's own logic (e.g. computed balances, vault status).
63
+ *
64
+ * @param params - Contract, function, args, and optional caller pk
65
+ * @returns Promise resolving to `{ success, result, logs }`
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * const { success, result } = await sdk.contract.view({
70
+ * contract: 'LockupPrime',
71
+ * function: 'view_balance',
72
+ * args: ['my_vault']
73
+ * })
74
+ * ```
75
+ */
76
+ view(params: ContractViewParams): Promise<ContractViewResponse>;
61
77
  }
78
+ //#endregion
79
+ export { ContractAPI };
62
80
  //# sourceMappingURL=contract.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/api/contract.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,KAAK,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAIhG,qBAAa,WAAW;IACX,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAEzC;;;;;;;;;;;OAWG;IACG,gBAAgB,CAAC,QAAQ,EAAE,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAM7F;;;;;;;;;;;OAWG;IACG,GAAG,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAK/D;;;;;;;;;;;OAWG;IACG,SAAS,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAKvE;;;;;;;;;OASG;IACG,WAAW,IAAI,OAAO,CAAC,mBAAmB,CAAC;CAGjD"}
1
+ {"version":3,"file":"contract.d.ts","names":[],"sources":["../../src/api/contract.ts"],"mappings":";;;;cAmBa,WAAA;EAAA,QACQ,MAAA;cAAA,MAAA,EAAQ,aAAA;EAcwC;;;;;;;;;;;;EAA9D,gBAAA,CAAiB,QAAA,EAAU,UAAA,GAAa,WAAA,GAAc,OAAA,CAAQ,wBAAA;EAwErB;;;;;;;;;;;;EAtDzC,GAAA,CAAI,GAAA,EAAK,UAAA,YAAsB,OAAA,CAAQ,iBAAA;EAA9B;;;;;;;;;;;;EAiBT,SAAA,CAAU,GAAA,EAAK,UAAA,YAAsB,OAAA,CAAQ,iBAAA;EAqChC;;;;;;;;;;EAtBb,WAAA,CAAA,GAAe,OAAA,CAAQ,mBAAA;;;;;;;;;;;;;;;;;;;EAsBvB,IAAA,CAAK,MAAA,EAAQ,kBAAA,GAAqB,OAAA,CAAQ,oBAAA;AAAA"}
@@ -1,76 +1,103 @@
1
- /**
2
- * Contract API
3
- *
4
- * Provides methods for interacting with smart contracts
5
- */
6
- import { BytecodeSchema, ContractKeySchema } from '../schemas';
7
- import { validate } from '../validation';
8
- export class ContractAPI {
9
- client;
10
- constructor(client) {
11
- this.client = client;
12
- }
13
- /**
14
- * Validate contract bytecode
15
- *
16
- * @param bytecode - Contract bytecode as Uint8Array or ArrayBuffer
17
- * @returns Promise resolving to validation result
18
- * @throws {AmadeusSDKError} If bytecode is invalid or empty
19
- *
20
- * @example
21
- * ```ts
22
- * const result = await sdk.contract.validateBytecode(wasmBytecode)
23
- * ```
24
- */
25
- async validateBytecode(bytecode) {
26
- validate(BytecodeSchema, bytecode);
27
- const body = bytecode instanceof ArrayBuffer ? new Uint8Array(bytecode) : bytecode;
28
- return this.client.post('/api/contract/validate_bytecode', body);
29
- }
30
- /**
31
- * Get contract data by key
32
- *
33
- * @param key - Contract key as Uint8Array or Base58 string
34
- * @returns Promise resolving to contract data value (JSON-serializable)
35
- * @throws {AmadeusSDKError} If key is invalid
36
- *
37
- * @example
38
- * ```ts
39
- * const data = await sdk.contract.get(keyBytes)
40
- * ```
41
- */
42
- async get(key) {
43
- validate(ContractKeySchema, key);
44
- return this.client.post('/api/contract/get', key);
45
- }
46
- /**
47
- * Get contract data by key prefix
48
- *
49
- * @param key - Contract key prefix as Uint8Array or Base58 string
50
- * @returns Promise resolving to contract data matching the prefix (array of key-value pairs)
51
- * @throws {AmadeusSDKError} If key is invalid
52
- *
53
- * @example
54
- * ```ts
55
- * const data = await sdk.contract.getPrefix(keyPrefix)
56
- * ```
57
- */
58
- async getPrefix(key) {
59
- validate(ContractKeySchema, key);
60
- return this.client.post('/api/contract/get_prefix', key);
61
- }
62
- /**
63
- * Get contract richlist (token holders)
64
- *
65
- * @returns Promise resolving to richlist entries
66
- *
67
- * @example
68
- * ```ts
69
- * const { richlist } = await sdk.contract.getRichlist()
70
- * ```
71
- */
72
- async getRichlist() {
73
- return this.client.get('/api/contract/richlist');
74
- }
75
- }
1
+ import { encode } from "../serialization.js";
2
+ import { validate } from "../validation.js";
3
+ import { BytecodeSchema, ContractKeySchema } from "../schemas.js";
4
+ //#region src/api/contract.ts
5
+ var ContractAPI = class {
6
+ client;
7
+ constructor(client) {
8
+ this.client = client;
9
+ }
10
+ /**
11
+ * Validate contract bytecode
12
+ *
13
+ * @param bytecode - Contract bytecode as Uint8Array or ArrayBuffer
14
+ * @returns Promise resolving to validation result
15
+ * @throws {AmadeusSDKError} If bytecode is invalid or empty
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const result = await sdk.contract.validateBytecode(wasmBytecode)
20
+ * ```
21
+ */
22
+ async validateBytecode(bytecode) {
23
+ validate(BytecodeSchema, bytecode);
24
+ const body = bytecode instanceof ArrayBuffer ? new Uint8Array(bytecode) : bytecode;
25
+ return this.client.post("/api/contract/validate_bytecode", body);
26
+ }
27
+ /**
28
+ * Get contract data by key
29
+ *
30
+ * @param key - Contract key as Uint8Array or Base58 string
31
+ * @returns Promise resolving to contract data value (JSON-serializable)
32
+ * @throws {AmadeusSDKError} If key is invalid
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const data = await sdk.contract.get(keyBytes)
37
+ * ```
38
+ */
39
+ async get(key) {
40
+ validate(ContractKeySchema, key);
41
+ return this.client.post("/api/contract/get", key);
42
+ }
43
+ /**
44
+ * Get contract data by key prefix
45
+ *
46
+ * @param key - Contract key prefix as Uint8Array or Base58 string
47
+ * @returns Promise resolving to contract data matching the prefix (array of key-value pairs)
48
+ * @throws {AmadeusSDKError} If key is invalid
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * const data = await sdk.contract.getPrefix(keyPrefix)
53
+ * ```
54
+ */
55
+ async getPrefix(key) {
56
+ validate(ContractKeySchema, key);
57
+ return this.client.post("/api/contract/get_prefix", key);
58
+ }
59
+ /**
60
+ * Get contract richlist (token holders)
61
+ *
62
+ * @returns Promise resolving to richlist entries
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * const { richlist } = await sdk.contract.getRichlist()
67
+ * ```
68
+ */
69
+ async getRichlist() {
70
+ return this.client.get("/api/contract/richlist");
71
+ }
72
+ /**
73
+ * Execute a contract function in read-only (view) mode against the current chain tip.
74
+ *
75
+ * No transaction is created and no state is mutated. Useful for querying contract
76
+ * state through the contract's own logic (e.g. computed balances, vault status).
77
+ *
78
+ * @param params - Contract, function, args, and optional caller pk
79
+ * @returns Promise resolving to `{ success, result, logs }`
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * const { success, result } = await sdk.contract.view({
84
+ * contract: 'LockupPrime',
85
+ * function: 'view_balance',
86
+ * args: ['my_vault']
87
+ * })
88
+ * ```
89
+ */
90
+ async view(params) {
91
+ const body = {
92
+ contract: params.contract,
93
+ function: params.function,
94
+ args: params.args ?? []
95
+ };
96
+ if (params.pk) body.pk = params.pk;
97
+ return this.client.post("/api/contract/view", encode(body));
98
+ }
99
+ };
100
+ //#endregion
101
+ export { ContractAPI };
102
+
76
103
  //# sourceMappingURL=contract.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/api/contract.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,MAAM,OAAO,WAAW;IACH;IAApB,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,gBAAgB,CAAC,QAAkC;QACxD,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAA;QAClC,MAAM,IAAI,GAAG,QAAQ,YAAY,WAAW,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;QAClF,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAA2B,iCAAiC,EAAE,IAAI,CAAC,CAAA;IAC3F,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,GAAG,CAAC,GAAwB;QACjC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAA;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAoB,mBAAmB,EAAE,GAAG,CAAC,CAAA;IACrE,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,SAAS,CAAC,GAAwB;QACvC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAA;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAsB,0BAA0B,EAAE,GAAG,CAAC,CAAA;IAC9E,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,WAAW;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAsB,wBAAwB,CAAC,CAAA;IACtE,CAAC;CACD"}
1
+ {"version":3,"file":"contract.js","names":[],"sources":["../../src/api/contract.ts"],"sourcesContent":["/**\n * Contract API\n *\n * Provides methods for interacting with smart contracts\n */\n\nimport type { AmadeusClient } from '../client'\nimport type {\n\tValidateBytecodeResponse,\n\tGetRichlistResponse,\n\tContractDataValue,\n\tContractViewParams,\n\tContractViewResponse,\n\tSerializableValue\n} from '../types'\nimport { BytecodeSchema, ContractKeySchema } from '../schemas'\nimport { validate } from '../validation'\nimport { encode } from '../serialization'\n\nexport class ContractAPI {\n\tconstructor(private client: AmadeusClient) {}\n\n\t/**\n\t * Validate contract bytecode\n\t *\n\t * @param bytecode - Contract bytecode as Uint8Array or ArrayBuffer\n\t * @returns Promise resolving to validation result\n\t * @throws {AmadeusSDKError} If bytecode is invalid or empty\n\t *\n\t * @example\n\t * ```ts\n\t * const result = await sdk.contract.validateBytecode(wasmBytecode)\n\t * ```\n\t */\n\tasync validateBytecode(bytecode: Uint8Array | ArrayBuffer): Promise<ValidateBytecodeResponse> {\n\t\tvalidate(BytecodeSchema, bytecode)\n\t\tconst body = bytecode instanceof ArrayBuffer ? new Uint8Array(bytecode) : bytecode\n\t\treturn this.client.post<ValidateBytecodeResponse>('/api/contract/validate_bytecode', body)\n\t}\n\n\t/**\n\t * Get contract data by key\n\t *\n\t * @param key - Contract key as Uint8Array or Base58 string\n\t * @returns Promise resolving to contract data value (JSON-serializable)\n\t * @throws {AmadeusSDKError} If key is invalid\n\t *\n\t * @example\n\t * ```ts\n\t * const data = await sdk.contract.get(keyBytes)\n\t * ```\n\t */\n\tasync get(key: Uint8Array | string): Promise<ContractDataValue> {\n\t\tvalidate(ContractKeySchema, key)\n\t\treturn this.client.post<ContractDataValue>('/api/contract/get', key)\n\t}\n\n\t/**\n\t * Get contract data by key prefix\n\t *\n\t * @param key - Contract key prefix as Uint8Array or Base58 string\n\t * @returns Promise resolving to contract data matching the prefix (array of key-value pairs)\n\t * @throws {AmadeusSDKError} If key is invalid\n\t *\n\t * @example\n\t * ```ts\n\t * const data = await sdk.contract.getPrefix(keyPrefix)\n\t * ```\n\t */\n\tasync getPrefix(key: Uint8Array | string): Promise<ContractDataValue[]> {\n\t\tvalidate(ContractKeySchema, key)\n\t\treturn this.client.post<ContractDataValue[]>('/api/contract/get_prefix', key)\n\t}\n\n\t/**\n\t * Get contract richlist (token holders)\n\t *\n\t * @returns Promise resolving to richlist entries\n\t *\n\t * @example\n\t * ```ts\n\t * const { richlist } = await sdk.contract.getRichlist()\n\t * ```\n\t */\n\tasync getRichlist(): Promise<GetRichlistResponse> {\n\t\treturn this.client.get<GetRichlistResponse>('/api/contract/richlist')\n\t}\n\n\t/**\n\t * Execute a contract function in read-only (view) mode against the current chain tip.\n\t *\n\t * No transaction is created and no state is mutated. Useful for querying contract\n\t * state through the contract's own logic (e.g. computed balances, vault status).\n\t *\n\t * @param params - Contract, function, args, and optional caller pk\n\t * @returns Promise resolving to `{ success, result, logs }`\n\t *\n\t * @example\n\t * ```ts\n\t * const { success, result } = await sdk.contract.view({\n\t * contract: 'LockupPrime',\n\t * function: 'view_balance',\n\t * args: ['my_vault']\n\t * })\n\t * ```\n\t */\n\tasync view(params: ContractViewParams): Promise<ContractViewResponse> {\n\t\tconst body: Record<string, SerializableValue> = {\n\t\t\tcontract: params.contract,\n\t\t\tfunction: params.function,\n\t\t\targs: params.args ?? []\n\t\t}\n\t\tif (params.pk) body.pk = params.pk\n\t\treturn this.client.post<ContractViewResponse>('/api/contract/view', encode(body))\n\t}\n}\n"],"mappings":";;;;AAmBA,IAAa,cAAb,MAAyB;CACJ;CAApB,YAAY,QAA+B;EAAvB,KAAA,SAAA;;;;;;;;;;;;;;CAcpB,MAAM,iBAAiB,UAAuE;EAC7F,SAAS,gBAAgB,SAAS;EAClC,MAAM,OAAO,oBAAoB,cAAc,IAAI,WAAW,SAAS,GAAG;EAC1E,OAAO,KAAK,OAAO,KAA+B,mCAAmC,KAAK;;;;;;;;;;;;;;CAe3F,MAAM,IAAI,KAAsD;EAC/D,SAAS,mBAAmB,IAAI;EAChC,OAAO,KAAK,OAAO,KAAwB,qBAAqB,IAAI;;;;;;;;;;;;;;CAerE,MAAM,UAAU,KAAwD;EACvE,SAAS,mBAAmB,IAAI;EAChC,OAAO,KAAK,OAAO,KAA0B,4BAA4B,IAAI;;;;;;;;;;;;CAa9E,MAAM,cAA4C;EACjD,OAAO,KAAK,OAAO,IAAyB,yBAAyB;;;;;;;;;;;;;;;;;;;;CAqBtE,MAAM,KAAK,QAA2D;EACrE,MAAM,OAA0C;GAC/C,UAAU,OAAO;GACjB,UAAU,OAAO;GACjB,MAAM,OAAO,QAAQ,EAAE;GACvB;EACD,IAAI,OAAO,IAAI,KAAK,KAAK,OAAO;EAChC,OAAO,KAAK,OAAO,KAA2B,sBAAsB,OAAO,KAAK,CAAC"}
@@ -1,68 +1,67 @@
1
- /**
2
- * Epoch API
3
- *
4
- * Provides methods for querying epoch and validator information
5
- */
6
- import type { AmadeusClient } from '../client';
7
- import type { EpochScore, GetEmissionAddressResponse, GetSolInEpochResponse } from '../types';
8
- export declare class EpochAPI {
9
- private client;
10
- constructor(client: AmadeusClient);
11
- /**
12
- * Get epoch score for all validators or a specific validator
13
- *
14
- * @param publicKey - Optional validator public key (Base58 encoded)
15
- * @returns Promise resolving to epoch score(s)
16
- * @throws {Error} If public key is invalid
17
- *
18
- * @example
19
- * ```ts
20
- * // Get all scores
21
- * const scores = await sdk.epoch.getScore()
22
- *
23
- * // Get specific validator score
24
- * const score = await sdk.epoch.getScore('5Kd3N...')
25
- * ```
26
- */
27
- getScore(publicKey?: string): Promise<EpochScore>;
28
- /**
29
- * Get emission address for a public key
30
- *
31
- * @param publicKey - Validator public key (Base58 encoded)
32
- * @returns Promise resolving to emission address
33
- * @throws {Error} If public key is invalid
34
- *
35
- * @example
36
- * ```ts
37
- * const { emission_address } = await sdk.epoch.getEmissionAddress('5Kd3N...')
38
- * ```
39
- */
40
- getEmissionAddress(publicKey: string): Promise<GetEmissionAddressResponse>;
41
- /**
42
- * Get solution in epoch
43
- *
44
- * @param epoch - Epoch number (must be >= 0)
45
- * @param solHash - Solution hash as string or Uint8Array
46
- * @returns Promise resolving to solution data
47
- * @throws {Error} If parameters are invalid
48
- *
49
- * @example
50
- * ```ts
51
- * const sol = await sdk.epoch.getSolInEpoch(100, '5Kd3N...')
52
- * ```
53
- */
54
- getSolInEpoch(epoch: number, solHash: string | Uint8Array): Promise<GetSolInEpochResponse>;
55
- /**
56
- * Get all epoch scores as array of [pk, score] tuples
57
- */
58
- getAllScores(): Promise<[string, number][]>;
59
- /**
60
- * Get epoch score for a specific validator
61
- */
62
- getValidatorScore(publicKey: string): Promise<number>;
63
- /**
64
- * Get top validators by score
65
- */
66
- getTopValidators(limit?: number): Promise<[string, number][]>;
1
+ import { EpochScore, GetEmissionAddressResponse, GetSolInEpochResponse } from "../types.js";
2
+ import { AmadeusClient } from "../client.js";
3
+
4
+ //#region src/api/epoch.d.ts
5
+ declare class EpochAPI {
6
+ private client;
7
+ constructor(client: AmadeusClient);
8
+ /**
9
+ * Get epoch score for all validators or a specific validator
10
+ *
11
+ * @param publicKey - Optional validator public key (Base58 encoded)
12
+ * @returns Promise resolving to epoch score(s)
13
+ * @throws {Error} If public key is invalid
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * // Get all scores
18
+ * const scores = await sdk.epoch.getScore()
19
+ *
20
+ * // Get specific validator score
21
+ * const score = await sdk.epoch.getScore('5Kd3N...')
22
+ * ```
23
+ */
24
+ getScore(publicKey?: string): Promise<EpochScore>;
25
+ /**
26
+ * Get emission address for a public key
27
+ *
28
+ * @param publicKey - Validator public key (Base58 encoded)
29
+ * @returns Promise resolving to emission address
30
+ * @throws {Error} If public key is invalid
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const { emission_address } = await sdk.epoch.getEmissionAddress('5Kd3N...')
35
+ * ```
36
+ */
37
+ getEmissionAddress(publicKey: string): Promise<GetEmissionAddressResponse>;
38
+ /**
39
+ * Get solution in epoch
40
+ *
41
+ * @param epoch - Epoch number (must be >= 0)
42
+ * @param solHash - Solution hash as string or Uint8Array
43
+ * @returns Promise resolving to solution data
44
+ * @throws {Error} If parameters are invalid
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * const sol = await sdk.epoch.getSolInEpoch(100, '5Kd3N...')
49
+ * ```
50
+ */
51
+ getSolInEpoch(epoch: number, solHash: string | Uint8Array): Promise<GetSolInEpochResponse>;
52
+ /**
53
+ * Get all epoch scores as array of [pk, score] tuples
54
+ */
55
+ getAllScores(): Promise<[string, number][]>;
56
+ /**
57
+ * Get epoch score for a specific validator
58
+ */
59
+ getValidatorScore(publicKey: string): Promise<number>;
60
+ /**
61
+ * Get top validators by score
62
+ */
63
+ getTopValidators(limit?: number): Promise<[string, number][]>;
67
64
  }
65
+ //#endregion
66
+ export { EpochAPI };
68
67
  //# sourceMappingURL=epoch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"epoch.d.ts","sourceRoot":"","sources":["../../src/api/epoch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAK7F,qBAAa,QAAQ;IACR,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAEzC;;;;;;;;;;;;;;;OAeG;IACG,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAQvD;;;;;;;;;;;OAWG;IACG,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAOhF;;;;;;;;;;;;OAYG;IACG,aAAa,CAClB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GAAG,UAAU,GAC1B,OAAO,CAAC,qBAAqB,CAAC;IAWjC;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAKjD;;OAEG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ3D;;OAEG;IACG,gBAAgB,CAAC,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;CAIvE"}
1
+ {"version":3,"file":"epoch.d.ts","names":[],"sources":["../../src/api/epoch.ts"],"mappings":";;;;cAYa,QAAA;EAAA,QACQ,MAAA;cAAA,MAAA,EAAQ,aAAA;EAsCyB;;;;;;;;;;;;;;;;EApB/C,QAAA,CAAS,SAAA,YAAqB,OAAA,CAAQ,UAAA;EAAA;;;;;;;;;;;;EAoBtC,kBAAA,CAAmB,SAAA,WAAoB,OAAA,CAAQ,0BAAA;EA6C/C;;;;;;;;;;;;;EAzBA,aAAA,CACL,KAAA,UACA,OAAA,WAAkB,UAAA,GAChB,OAAA,CAAQ,qBAAA;;;;EAcL,YAAA,CAAA,GAAgB,OAAA;;;;EAQhB,iBAAA,CAAkB,SAAA,WAAoB,OAAA;;;;EAWtC,gBAAA,CAAiB,KAAA,YAAqB,OAAA;AAAA"}