@amadeus-protocol/sdk 1.0.8 → 1.1.1

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 (200) hide show
  1. package/README.md +215 -30
  2. package/dist/api/chain.d.ts +144 -117
  3. package/dist/api/chain.d.ts.map +1 -1
  4. package/dist/api/chain.js +175 -146
  5. package/dist/api/chain.js.map +1 -1
  6. package/dist/api/contract.d.ts +78 -60
  7. package/dist/api/contract.d.ts.map +1 -1
  8. package/dist/api/contract.js +102 -75
  9. package/dist/api/contract.js.map +1 -1
  10. package/dist/api/epoch.d.ts +65 -66
  11. package/dist/api/epoch.d.ts.map +1 -1
  12. package/dist/api/epoch.js +90 -98
  13. package/dist/api/epoch.js.map +1 -1
  14. package/dist/api/peer.d.ts +77 -78
  15. package/dist/api/peer.d.ts.map +1 -1
  16. package/dist/api/peer.js +93 -94
  17. package/dist/api/peer.js.map +1 -1
  18. package/dist/api/proof.d.ts +44 -23
  19. package/dist/api/proof.d.ts.map +1 -1
  20. package/dist/api/proof.js +56 -29
  21. package/dist/api/proof.js.map +1 -1
  22. package/dist/api/transaction.d.ts +68 -69
  23. package/dist/api/transaction.d.ts.map +1 -1
  24. package/dist/api/transaction.js +84 -84
  25. package/dist/api/transaction.js.map +1 -1
  26. package/dist/api/wallet.d.ts +36 -37
  27. package/dist/api/wallet.d.ts.map +1 -1
  28. package/dist/api/wallet.js +47 -50
  29. package/dist/api/wallet.js.map +1 -1
  30. package/dist/client.d.ts +66 -68
  31. package/dist/client.d.ts.map +1 -1
  32. package/dist/client.js +231 -276
  33. package/dist/client.js.map +1 -1
  34. package/dist/constants.d.ts +13 -10
  35. package/dist/constants.d.ts.map +1 -1
  36. package/dist/constants.js +49 -45
  37. package/dist/constants.js.map +1 -1
  38. package/dist/contract-state.d.ts +6 -3
  39. package/dist/contract-state.d.ts.map +1 -1
  40. package/dist/contract-state.js +88 -106
  41. package/dist/contract-state.js.map +1 -1
  42. package/dist/contracts/abi-types.d.ts +32 -32
  43. package/dist/contracts/abi-types.d.ts.map +1 -1
  44. package/dist/contracts/coin.d.ts +13 -20
  45. package/dist/contracts/coin.d.ts.map +1 -1
  46. package/dist/contracts/coin.js +42 -38
  47. package/dist/contracts/coin.js.map +1 -1
  48. package/dist/contracts/contract-call.d.ts +14 -16
  49. package/dist/contracts/contract-call.d.ts.map +1 -1
  50. package/dist/contracts/contract-call.js +45 -54
  51. package/dist/contracts/contract-call.js.map +1 -1
  52. package/dist/contracts/contract.d.ts +24 -55
  53. package/dist/contracts/contract.d.ts.map +1 -1
  54. package/dist/contracts/contract.js +63 -101
  55. package/dist/contracts/contract.js.map +1 -1
  56. package/dist/contracts/lockup/abi.d.ts +54 -51
  57. package/dist/contracts/lockup/abi.d.ts.map +1 -1
  58. package/dist/contracts/lockup/abi.js +65 -74
  59. package/dist/contracts/lockup/abi.js.map +1 -1
  60. package/dist/contracts/lockup/helpers.d.ts +22 -18
  61. package/dist/contracts/lockup/helpers.d.ts.map +1 -1
  62. package/dist/contracts/lockup/helpers.js +44 -47
  63. package/dist/contracts/lockup/helpers.js.map +1 -1
  64. package/dist/contracts/lockup/parsers.d.ts +7 -3
  65. package/dist/contracts/lockup/parsers.d.ts.map +1 -1
  66. package/dist/contracts/lockup/parsers.js +51 -55
  67. package/dist/contracts/lockup/parsers.js.map +1 -1
  68. package/dist/contracts/lockup/storage-keys.d.ts +5 -2
  69. package/dist/contracts/lockup/storage-keys.d.ts.map +1 -1
  70. package/dist/contracts/lockup/storage-keys.js +54 -70
  71. package/dist/contracts/lockup/storage-keys.js.map +1 -1
  72. package/dist/contracts/lockup/types.d.ts +73 -70
  73. package/dist/contracts/lockup/types.d.ts.map +1 -1
  74. package/dist/contracts/lockup-prime/abi.d.ts +328 -325
  75. package/dist/contracts/lockup-prime/abi.d.ts.map +1 -1
  76. package/dist/contracts/lockup-prime/abi.js +397 -417
  77. package/dist/contracts/lockup-prime/abi.js.map +1 -1
  78. package/dist/contracts/lockup-prime/helpers.d.ts +35 -31
  79. package/dist/contracts/lockup-prime/helpers.d.ts.map +1 -1
  80. package/dist/contracts/lockup-prime/helpers.js +131 -137
  81. package/dist/contracts/lockup-prime/helpers.js.map +1 -1
  82. package/dist/contracts/lockup-prime/parsers.d.ts +9 -5
  83. package/dist/contracts/lockup-prime/parsers.d.ts.map +1 -1
  84. package/dist/contracts/lockup-prime/parsers.js +61 -61
  85. package/dist/contracts/lockup-prime/parsers.js.map +1 -1
  86. package/dist/contracts/lockup-prime/storage-keys.d.ts +7 -4
  87. package/dist/contracts/lockup-prime/storage-keys.d.ts.map +1 -1
  88. package/dist/contracts/lockup-prime/storage-keys.js +64 -80
  89. package/dist/contracts/lockup-prime/storage-keys.js.map +1 -1
  90. package/dist/contracts/lockup-prime/types.d.ts +92 -89
  91. package/dist/contracts/lockup-prime/types.d.ts.map +1 -1
  92. package/dist/contracts/lockup-prime/types.js +12 -13
  93. package/dist/contracts/lockup-prime/types.js.map +1 -1
  94. package/dist/contracts/nft/abi.d.ts +104 -0
  95. package/dist/contracts/nft/abi.d.ts.map +1 -0
  96. package/dist/contracts/nft/abi.js +135 -0
  97. package/dist/contracts/nft/abi.js.map +1 -0
  98. package/dist/contracts/nft/helpers.d.ts +21 -0
  99. package/dist/contracts/nft/helpers.d.ts.map +1 -0
  100. package/dist/contracts/nft/helpers.js +61 -0
  101. package/dist/contracts/nft/helpers.js.map +1 -0
  102. package/dist/contracts/nft/types.d.ts +47 -0
  103. package/dist/contracts/nft/types.d.ts.map +1 -0
  104. package/dist/conversion.d.ts +5 -2
  105. package/dist/conversion.d.ts.map +1 -1
  106. package/dist/conversion.js +45 -50
  107. package/dist/conversion.js.map +1 -1
  108. package/dist/crypto.d.ts +14 -16
  109. package/dist/crypto.d.ts.map +1 -1
  110. package/dist/crypto.js +121 -140
  111. package/dist/crypto.js.map +1 -1
  112. package/dist/encoding.d.ts +11 -8
  113. package/dist/encoding.d.ts.map +1 -1
  114. package/dist/encoding.js +123 -144
  115. package/dist/encoding.js.map +1 -1
  116. package/dist/encryption.d.ts +15 -12
  117. package/dist/encryption.d.ts.map +1 -1
  118. package/dist/encryption.js +119 -117
  119. package/dist/encryption.js.map +1 -1
  120. package/dist/explorer.d.ts +10 -7
  121. package/dist/explorer.d.ts.map +1 -1
  122. package/dist/explorer.js +51 -48
  123. package/dist/explorer.js.map +1 -1
  124. package/dist/formatters.d.ts +8 -5
  125. package/dist/formatters.d.ts.map +1 -1
  126. package/dist/formatters.js +67 -68
  127. package/dist/formatters.js.map +1 -1
  128. package/dist/index.d.ts +42 -55
  129. package/dist/index.js +39 -55
  130. package/dist/mnemonic.d.ts +12 -9
  131. package/dist/mnemonic.d.ts.map +1 -1
  132. package/dist/mnemonic.js +105 -114
  133. package/dist/mnemonic.js.map +1 -1
  134. package/dist/networks.d.ts +14 -17
  135. package/dist/networks.d.ts.map +1 -1
  136. package/dist/networks.js +40 -36
  137. package/dist/networks.js.map +1 -1
  138. package/dist/schemas.js +75 -79
  139. package/dist/schemas.js.map +1 -1
  140. package/dist/sdk.d.ts +69 -65
  141. package/dist/sdk.d.ts.map +1 -1
  142. package/dist/sdk.js +126 -117
  143. package/dist/sdk.js.map +1 -1
  144. package/dist/serialization.d.ts +8 -18
  145. package/dist/serialization.d.ts.map +1 -1
  146. package/dist/serialization.js +207 -260
  147. package/dist/serialization.js.map +1 -1
  148. package/dist/signing.js +67 -67
  149. package/dist/signing.js.map +1 -1
  150. package/dist/transaction-builder.d.ts +175 -184
  151. package/dist/transaction-builder.d.ts.map +1 -1
  152. package/dist/transaction-builder.js +295 -344
  153. package/dist/transaction-builder.js.map +1 -1
  154. package/dist/transaction-errors.d.ts +10 -12
  155. package/dist/transaction-errors.d.ts.map +1 -1
  156. package/dist/transaction-errors.js +145 -166
  157. package/dist/transaction-errors.js.map +1 -1
  158. package/dist/types.d.ts +530 -450
  159. package/dist/types.d.ts.map +1 -1
  160. package/dist/types.js +169 -183
  161. package/dist/types.js.map +1 -1
  162. package/dist/validation.d.ts +24 -26
  163. package/dist/validation.d.ts.map +1 -1
  164. package/dist/validation.js +194 -192
  165. package/dist/validation.js.map +1 -1
  166. package/package.json +4 -3
  167. package/dist/api/index.d.ts +0 -8
  168. package/dist/api/index.d.ts.map +0 -1
  169. package/dist/api/index.js +0 -8
  170. package/dist/api/index.js.map +0 -1
  171. package/dist/contracts/abi-types.js +0 -8
  172. package/dist/contracts/abi-types.js.map +0 -1
  173. package/dist/contracts/index.d.ts +0 -7
  174. package/dist/contracts/index.d.ts.map +0 -1
  175. package/dist/contracts/index.js +0 -7
  176. package/dist/contracts/index.js.map +0 -1
  177. package/dist/contracts/lockup/calls.d.ts +0 -23
  178. package/dist/contracts/lockup/calls.d.ts.map +0 -1
  179. package/dist/contracts/lockup/calls.js +0 -25
  180. package/dist/contracts/lockup/calls.js.map +0 -1
  181. package/dist/contracts/lockup/index.d.ts +0 -6
  182. package/dist/contracts/lockup/index.d.ts.map +0 -1
  183. package/dist/contracts/lockup/index.js +0 -6
  184. package/dist/contracts/lockup/index.js.map +0 -1
  185. package/dist/contracts/lockup/types.js +0 -7
  186. package/dist/contracts/lockup/types.js.map +0 -1
  187. package/dist/contracts/lockup-prime/calls.d.ts +0 -53
  188. package/dist/contracts/lockup-prime/calls.d.ts.map +0 -1
  189. package/dist/contracts/lockup-prime/calls.js +0 -60
  190. package/dist/contracts/lockup-prime/calls.js.map +0 -1
  191. package/dist/contracts/lockup-prime/index.d.ts +0 -6
  192. package/dist/contracts/lockup-prime/index.d.ts.map +0 -1
  193. package/dist/contracts/lockup-prime/index.js +0 -6
  194. package/dist/contracts/lockup-prime/index.js.map +0 -1
  195. package/dist/index.d.ts.map +0 -1
  196. package/dist/index.js.map +0 -1
  197. package/dist/schemas.d.ts +0 -67
  198. package/dist/schemas.d.ts.map +0 -1
  199. package/dist/signing.d.ts +0 -39
  200. package/dist/signing.d.ts.map +0 -1
@@ -1,80 +1,79 @@
1
- /**
2
- * Peer API
3
- *
4
- * Provides methods for querying network peer information
5
- */
6
- import type { AmadeusClient } from '../client';
7
- import type { GetNodesResponse, GetTrainersResponse, GetRemovedTrainersResponse, GetANRsResponse, GetANRByPkResponse } from '../types';
8
- export declare class PeerAPI {
9
- private client;
10
- constructor(client: AmadeusClient);
11
- /**
12
- * Get all nodes in the network
13
- *
14
- * @returns Promise resolving to network nodes
15
- *
16
- * @example
17
- * ```ts
18
- * const { nodes } = await sdk.peer.getNodes()
19
- * ```
20
- */
21
- getNodes(): Promise<GetNodesResponse>;
22
- /**
23
- * Get all trainers (validators)
24
- *
25
- * @returns Promise resolving to trainer nodes
26
- *
27
- * @example
28
- * ```ts
29
- * const { trainers } = await sdk.peer.getTrainers()
30
- * ```
31
- */
32
- getTrainers(): Promise<GetTrainersResponse>;
33
- /**
34
- * Get removed trainers
35
- *
36
- * @returns Promise resolving to removed trainer nodes
37
- *
38
- * @example
39
- * ```ts
40
- * const { removed_trainers } = await sdk.peer.getRemovedTrainers()
41
- * ```
42
- */
43
- getRemovedTrainers(): Promise<GetRemovedTrainersResponse>;
44
- /**
45
- * Get all ANR (Autonomous Network Registry) entries
46
- *
47
- * @returns Promise resolving to ANR entries
48
- *
49
- * @example
50
- * ```ts
51
- * const { anrs } = await sdk.peer.getANRs()
52
- * ```
53
- */
54
- getANRs(): Promise<GetANRsResponse>;
55
- /**
56
- * Get ANR validators only
57
- *
58
- * @returns Promise resolving to ANR validator entries
59
- *
60
- * @example
61
- * ```ts
62
- * const { anrs } = await sdk.peer.getANRValidators()
63
- * ```
64
- */
65
- getANRValidators(): Promise<GetANRsResponse>;
66
- /**
67
- * Get ANR entry by public key
68
- *
69
- * @param publicKey - Public key (Base58 encoded)
70
- * @returns Promise resolving to ANR entry
71
- * @throws {Error} If public key is invalid
72
- *
73
- * @example
74
- * ```ts
75
- * const { anr } = await sdk.peer.getANRByPk('5Kd3N...')
76
- * ```
77
- */
78
- getANRByPk(publicKey: string): Promise<GetANRByPkResponse>;
1
+ import { GetANRByPkResponse, GetANRsResponse, GetNodesResponse, GetRemovedTrainersResponse, GetTrainersResponse } from "../types.js";
2
+ import { AmadeusClient } from "../client.js";
3
+
4
+ //#region src/api/peer.d.ts
5
+ declare class PeerAPI {
6
+ private client;
7
+ constructor(client: AmadeusClient);
8
+ /**
9
+ * Get all nodes in the network
10
+ *
11
+ * @returns Promise resolving to network nodes
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const { nodes } = await sdk.peer.getNodes()
16
+ * ```
17
+ */
18
+ getNodes(): Promise<GetNodesResponse>;
19
+ /**
20
+ * Get all trainers (validators)
21
+ *
22
+ * @returns Promise resolving to trainer nodes
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const { trainers } = await sdk.peer.getTrainers()
27
+ * ```
28
+ */
29
+ getTrainers(): Promise<GetTrainersResponse>;
30
+ /**
31
+ * Get removed trainers
32
+ *
33
+ * @returns Promise resolving to removed trainer nodes
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const { removed_trainers } = await sdk.peer.getRemovedTrainers()
38
+ * ```
39
+ */
40
+ getRemovedTrainers(): Promise<GetRemovedTrainersResponse>;
41
+ /**
42
+ * Get all ANR (Autonomous Network Registry) entries
43
+ *
44
+ * @returns Promise resolving to ANR entries
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * const { anrs } = await sdk.peer.getANRs()
49
+ * ```
50
+ */
51
+ getANRs(): Promise<GetANRsResponse>;
52
+ /**
53
+ * Get ANR validators only
54
+ *
55
+ * @returns Promise resolving to ANR validator entries
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * const { anrs } = await sdk.peer.getANRValidators()
60
+ * ```
61
+ */
62
+ getANRValidators(): Promise<GetANRsResponse>;
63
+ /**
64
+ * Get ANR entry by public key
65
+ *
66
+ * @param publicKey - Public key (Base58 encoded)
67
+ * @returns Promise resolving to ANR entry
68
+ * @throws {Error} If public key is invalid
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const { anr } = await sdk.peer.getANRByPk('5Kd3N...')
73
+ * ```
74
+ */
75
+ getANRByPk(publicKey: string): Promise<GetANRByPkResponse>;
79
76
  }
77
+ //#endregion
78
+ export { PeerAPI };
80
79
  //# sourceMappingURL=peer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"peer.d.ts","sourceRoot":"","sources":["../../src/api/peer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,KAAK,EACX,gBAAgB,EAChB,mBAAmB,EACnB,0BAA0B,EAC1B,eAAe,EACf,kBAAkB,EAClB,MAAM,UAAU,CAAA;AAIjB,qBAAa,OAAO;IACP,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAEzC;;;;;;;;;OASG;IACG,QAAQ,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAI3C;;;;;;;;;OASG;IACG,WAAW,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAIjD;;;;;;;;;OASG;IACG,kBAAkB,IAAI,OAAO,CAAC,0BAA0B,CAAC;IAI/D;;;;;;;;;OASG;IACG,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC;IAIzC;;;;;;;;;OASG;IACG,gBAAgB,IAAI,OAAO,CAAC,eAAe,CAAC;IAIlD;;;;;;;;;;;OAWG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAIhE"}
1
+ {"version":3,"file":"peer.d.ts","names":[],"sources":["../../src/api/peer.ts"],"mappings":";;;;cAiBa,OAAA;EAAA,QACQ,MAAA;cAAA,MAAA,EAAQ,aAAA;EA0BC;;;;;;;;;;EAdvB,QAAA,CAAA,GAAY,OAAA,CAAQ,gBAAA;EAwEkB;;;;;;;;;;EA1DtC,WAAA,CAAA,GAAe,OAAA,CAAQ,mBAAA;EAcvB;;;;;;;;;;EAAA,kBAAA,CAAA,GAAsB,OAAA,CAAQ,0BAAA;EA4CC;;;;;;;;;;EA9B/B,OAAA,CAAA,GAAW,OAAA,CAAQ,eAAA;;;;;;;;;;;EAcnB,gBAAA,CAAA,GAAoB,OAAA,CAAQ,eAAA;;;;;;;;;;;;;EAgB5B,UAAA,CAAW,SAAA,WAAoB,OAAA,CAAQ,kBAAA;AAAA"}
package/dist/api/peer.js CHANGED
@@ -1,95 +1,94 @@
1
- /**
2
- * Peer API
3
- *
4
- * Provides methods for querying network peer information
5
- */
6
- import { Base58PublicKeySchema } from '../schemas';
7
- import { validate } from '../validation';
8
- export class PeerAPI {
9
- client;
10
- constructor(client) {
11
- this.client = client;
12
- }
13
- /**
14
- * Get all nodes in the network
15
- *
16
- * @returns Promise resolving to network nodes
17
- *
18
- * @example
19
- * ```ts
20
- * const { nodes } = await sdk.peer.getNodes()
21
- * ```
22
- */
23
- async getNodes() {
24
- return this.client.get('/api/peer/nodes');
25
- }
26
- /**
27
- * Get all trainers (validators)
28
- *
29
- * @returns Promise resolving to trainer nodes
30
- *
31
- * @example
32
- * ```ts
33
- * const { trainers } = await sdk.peer.getTrainers()
34
- * ```
35
- */
36
- async getTrainers() {
37
- return this.client.get('/api/peer/trainers');
38
- }
39
- /**
40
- * Get removed trainers
41
- *
42
- * @returns Promise resolving to removed trainer nodes
43
- *
44
- * @example
45
- * ```ts
46
- * const { removed_trainers } = await sdk.peer.getRemovedTrainers()
47
- * ```
48
- */
49
- async getRemovedTrainers() {
50
- return this.client.get('/api/peer/removed_trainers');
51
- }
52
- /**
53
- * Get all ANR (Autonomous Network Registry) entries
54
- *
55
- * @returns Promise resolving to ANR entries
56
- *
57
- * @example
58
- * ```ts
59
- * const { anrs } = await sdk.peer.getANRs()
60
- * ```
61
- */
62
- async getANRs() {
63
- return this.client.get('/api/peer/anr');
64
- }
65
- /**
66
- * Get ANR validators only
67
- *
68
- * @returns Promise resolving to ANR validator entries
69
- *
70
- * @example
71
- * ```ts
72
- * const { anrs } = await sdk.peer.getANRValidators()
73
- * ```
74
- */
75
- async getANRValidators() {
76
- return this.client.get('/api/peer/anr_validators');
77
- }
78
- /**
79
- * Get ANR entry by public key
80
- *
81
- * @param publicKey - Public key (Base58 encoded)
82
- * @returns Promise resolving to ANR entry
83
- * @throws {Error} If public key is invalid
84
- *
85
- * @example
86
- * ```ts
87
- * const { anr } = await sdk.peer.getANRByPk('5Kd3N...')
88
- * ```
89
- */
90
- async getANRByPk(publicKey) {
91
- validate(Base58PublicKeySchema, publicKey);
92
- return this.client.get(`/api/peer/anr/${publicKey}`);
93
- }
94
- }
1
+ import { validate } from "../validation.js";
2
+ import { Base58PublicKeySchema } from "../schemas.js";
3
+ //#region src/api/peer.ts
4
+ var PeerAPI = class {
5
+ client;
6
+ constructor(client) {
7
+ this.client = client;
8
+ }
9
+ /**
10
+ * Get all nodes in the network
11
+ *
12
+ * @returns Promise resolving to network nodes
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const { nodes } = await sdk.peer.getNodes()
17
+ * ```
18
+ */
19
+ async getNodes() {
20
+ return this.client.get("/api/peer/nodes");
21
+ }
22
+ /**
23
+ * Get all trainers (validators)
24
+ *
25
+ * @returns Promise resolving to trainer nodes
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const { trainers } = await sdk.peer.getTrainers()
30
+ * ```
31
+ */
32
+ async getTrainers() {
33
+ return this.client.get("/api/peer/trainers");
34
+ }
35
+ /**
36
+ * Get removed trainers
37
+ *
38
+ * @returns Promise resolving to removed trainer nodes
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const { removed_trainers } = await sdk.peer.getRemovedTrainers()
43
+ * ```
44
+ */
45
+ async getRemovedTrainers() {
46
+ return this.client.get("/api/peer/removed_trainers");
47
+ }
48
+ /**
49
+ * Get all ANR (Autonomous Network Registry) entries
50
+ *
51
+ * @returns Promise resolving to ANR entries
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * const { anrs } = await sdk.peer.getANRs()
56
+ * ```
57
+ */
58
+ async getANRs() {
59
+ return this.client.get("/api/peer/anr");
60
+ }
61
+ /**
62
+ * Get ANR validators only
63
+ *
64
+ * @returns Promise resolving to ANR validator entries
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * const { anrs } = await sdk.peer.getANRValidators()
69
+ * ```
70
+ */
71
+ async getANRValidators() {
72
+ return this.client.get("/api/peer/anr_validators");
73
+ }
74
+ /**
75
+ * Get ANR entry by public key
76
+ *
77
+ * @param publicKey - Public key (Base58 encoded)
78
+ * @returns Promise resolving to ANR entry
79
+ * @throws {Error} If public key is invalid
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * const { anr } = await sdk.peer.getANRByPk('5Kd3N...')
84
+ * ```
85
+ */
86
+ async getANRByPk(publicKey) {
87
+ validate(Base58PublicKeySchema, publicKey);
88
+ return this.client.get(`/api/peer/anr/${publicKey}`);
89
+ }
90
+ };
91
+ //#endregion
92
+ export { PeerAPI };
93
+
95
94
  //# sourceMappingURL=peer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"peer.js","sourceRoot":"","sources":["../../src/api/peer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,MAAM,OAAO,OAAO;IACC;IAApB,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C;;;;;;;;;OASG;IACH,KAAK,CAAC,QAAQ;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAmB,iBAAiB,CAAC,CAAA;IAC5D,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,WAAW;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAsB,oBAAoB,CAAC,CAAA;IAClE,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,kBAAkB;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAA6B,4BAA4B,CAAC,CAAA;IACjF,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,OAAO;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAkB,eAAe,CAAC,CAAA;IACzD,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,gBAAgB;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAkB,0BAA0B,CAAC,CAAA;IACpE,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,UAAU,CAAC,SAAiB;QACjC,QAAQ,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAA;QAC1C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAqB,iBAAiB,SAAS,EAAE,CAAC,CAAA;IACzE,CAAC;CACD"}
1
+ {"version":3,"file":"peer.js","names":[],"sources":["../../src/api/peer.ts"],"sourcesContent":["/**\n * Peer API\n *\n * Provides methods for querying network peer information\n */\n\nimport type { AmadeusClient } from '../client'\nimport type {\n\tGetNodesResponse,\n\tGetTrainersResponse,\n\tGetRemovedTrainersResponse,\n\tGetANRsResponse,\n\tGetANRByPkResponse\n} from '../types'\nimport { Base58PublicKeySchema } from '../schemas'\nimport { validate } from '../validation'\n\nexport class PeerAPI {\n\tconstructor(private client: AmadeusClient) {}\n\n\t/**\n\t * Get all nodes in the network\n\t *\n\t * @returns Promise resolving to network nodes\n\t *\n\t * @example\n\t * ```ts\n\t * const { nodes } = await sdk.peer.getNodes()\n\t * ```\n\t */\n\tasync getNodes(): Promise<GetNodesResponse> {\n\t\treturn this.client.get<GetNodesResponse>('/api/peer/nodes')\n\t}\n\n\t/**\n\t * Get all trainers (validators)\n\t *\n\t * @returns Promise resolving to trainer nodes\n\t *\n\t * @example\n\t * ```ts\n\t * const { trainers } = await sdk.peer.getTrainers()\n\t * ```\n\t */\n\tasync getTrainers(): Promise<GetTrainersResponse> {\n\t\treturn this.client.get<GetTrainersResponse>('/api/peer/trainers')\n\t}\n\n\t/**\n\t * Get removed trainers\n\t *\n\t * @returns Promise resolving to removed trainer nodes\n\t *\n\t * @example\n\t * ```ts\n\t * const { removed_trainers } = await sdk.peer.getRemovedTrainers()\n\t * ```\n\t */\n\tasync getRemovedTrainers(): Promise<GetRemovedTrainersResponse> {\n\t\treturn this.client.get<GetRemovedTrainersResponse>('/api/peer/removed_trainers')\n\t}\n\n\t/**\n\t * Get all ANR (Autonomous Network Registry) entries\n\t *\n\t * @returns Promise resolving to ANR entries\n\t *\n\t * @example\n\t * ```ts\n\t * const { anrs } = await sdk.peer.getANRs()\n\t * ```\n\t */\n\tasync getANRs(): Promise<GetANRsResponse> {\n\t\treturn this.client.get<GetANRsResponse>('/api/peer/anr')\n\t}\n\n\t/**\n\t * Get ANR validators only\n\t *\n\t * @returns Promise resolving to ANR validator entries\n\t *\n\t * @example\n\t * ```ts\n\t * const { anrs } = await sdk.peer.getANRValidators()\n\t * ```\n\t */\n\tasync getANRValidators(): Promise<GetANRsResponse> {\n\t\treturn this.client.get<GetANRsResponse>('/api/peer/anr_validators')\n\t}\n\n\t/**\n\t * Get ANR entry by public key\n\t *\n\t * @param publicKey - Public key (Base58 encoded)\n\t * @returns Promise resolving to ANR entry\n\t * @throws {Error} If public key is invalid\n\t *\n\t * @example\n\t * ```ts\n\t * const { anr } = await sdk.peer.getANRByPk('5Kd3N...')\n\t * ```\n\t */\n\tasync getANRByPk(publicKey: string): Promise<GetANRByPkResponse> {\n\t\tvalidate(Base58PublicKeySchema, publicKey)\n\t\treturn this.client.get<GetANRByPkResponse>(`/api/peer/anr/${publicKey}`)\n\t}\n}\n"],"mappings":";;;AAiBA,IAAa,UAAb,MAAqB;CACA;CAApB,YAAY,QAA+B;EAAvB,KAAA,SAAA;;;;;;;;;;;;CAYpB,MAAM,WAAsC;EAC3C,OAAO,KAAK,OAAO,IAAsB,kBAAkB;;;;;;;;;;;;CAa5D,MAAM,cAA4C;EACjD,OAAO,KAAK,OAAO,IAAyB,qBAAqB;;;;;;;;;;;;CAalE,MAAM,qBAA0D;EAC/D,OAAO,KAAK,OAAO,IAAgC,6BAA6B;;;;;;;;;;;;CAajF,MAAM,UAAoC;EACzC,OAAO,KAAK,OAAO,IAAqB,gBAAgB;;;;;;;;;;;;CAazD,MAAM,mBAA6C;EAClD,OAAO,KAAK,OAAO,IAAqB,2BAA2B;;;;;;;;;;;;;;CAepE,MAAM,WAAW,WAAgD;EAChE,SAAS,uBAAuB,UAAU;EAC1C,OAAO,KAAK,OAAO,IAAwB,iBAAiB,YAAY"}
@@ -1,25 +1,46 @@
1
- /**
2
- * Proof API
3
- *
4
- * Provides methods for querying validator proofs
5
- */
6
- import type { AmadeusClient } from '../client';
7
- import type { ProofValidators } from '../types';
8
- export declare class ProofAPI {
9
- private client;
10
- constructor(client: AmadeusClient);
11
- /**
12
- * Get validator proof for an entry hash
13
- *
14
- * @param entryHash - Entry hash (Base58 encoded)
15
- * @returns Promise resolving to validator proof data
16
- * @throws {Error} If entry hash is invalid
17
- *
18
- * @example
19
- * ```ts
20
- * const proof = await sdk.proof.getValidators('5Kd3N...')
21
- * ```
22
- */
23
- getValidators(entryHash: string): Promise<ProofValidators>;
1
+ import { ContractStateProof, ProofValidators } from "../types.js";
2
+ import { AmadeusClient } from "../client.js";
3
+
4
+ //#region src/api/proof.d.ts
5
+ declare class ProofAPI {
6
+ private client;
7
+ constructor(client: AmadeusClient);
8
+ /**
9
+ * Get validator proof for an entry hash
10
+ *
11
+ * @param entryHash - Entry hash (Base58 encoded)
12
+ * @returns Promise resolving to validator proof data
13
+ * @throws {Error} If entry hash is invalid
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const proof = await sdk.proof.getValidators('5Kd3N...')
18
+ * ```
19
+ */
20
+ getValidators(entryHash: string): Promise<ProofValidators>;
21
+ /**
22
+ * Get a merkle proof for a contract state entry.
23
+ *
24
+ * If `value` is supplied the node also verifies the proof and returns
25
+ * `result: true | false` indicating whether the value matches the proof.
26
+ *
27
+ * @param key - Contract state key, either raw bytes or already-Base58-encoded
28
+ * @param value - Optional value to verify against the proof (raw bytes or Base58)
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * // Just fetch the proof
33
+ * const proof = await sdk.proof.getContractStateProof(
34
+ * new TextEncoder().encode('account:5Kd3N...:balance:AMA')
35
+ * )
36
+ *
37
+ * // Fetch and verify the value
38
+ * const verified = await sdk.proof.getContractStateProof(key, expectedValueBytes)
39
+ * if (verified.result) console.log('matches')
40
+ * ```
41
+ */
42
+ getContractStateProof(key: Uint8Array | string, value?: Uint8Array | string): Promise<ContractStateProof>;
24
43
  }
44
+ //#endregion
45
+ export { ProofAPI };
25
46
  //# sourceMappingURL=proof.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"proof.d.ts","sourceRoot":"","sources":["../../src/api/proof.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAI/C,qBAAa,QAAQ;IACR,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAEzC;;;;;;;;;;;OAWG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAIhE"}
1
+ {"version":3,"file":"proof.d.ts","names":[],"sources":["../../src/api/proof.ts"],"mappings":";;;;cAYa,QAAA;EAAA,QACQ,MAAA;cAAA,MAAA,EAAQ,aAAA;EAyCtB;;;;;;;;;;;;EA3BA,aAAA,CAAc,SAAA,WAAoB,OAAA,CAAQ,eAAA;EAAA;;;;;;;;;;;;;;;;;;;;;EA0B1C,qBAAA,CACL,GAAA,EAAK,UAAA,WACL,KAAA,GAAQ,UAAA,YACN,OAAA,CAAQ,kBAAA;AAAA"}
package/dist/api/proof.js CHANGED
@@ -1,30 +1,57 @@
1
- /**
2
- * Proof API
3
- *
4
- * Provides methods for querying validator proofs
5
- */
6
- import { Base58HashSchema } from '../schemas';
7
- import { validate } from '../validation';
8
- export class ProofAPI {
9
- client;
10
- constructor(client) {
11
- this.client = client;
12
- }
13
- /**
14
- * Get validator proof for an entry hash
15
- *
16
- * @param entryHash - Entry hash (Base58 encoded)
17
- * @returns Promise resolving to validator proof data
18
- * @throws {Error} If entry hash is invalid
19
- *
20
- * @example
21
- * ```ts
22
- * const proof = await sdk.proof.getValidators('5Kd3N...')
23
- * ```
24
- */
25
- async getValidators(entryHash) {
26
- validate(Base58HashSchema, entryHash);
27
- return this.client.get(`/api/proof/validators/${entryHash}`);
28
- }
29
- }
1
+ import { toBase58 } from "../encoding.js";
2
+ import { validate } from "../validation.js";
3
+ import { Base58HashSchema } from "../schemas.js";
4
+ //#region src/api/proof.ts
5
+ var ProofAPI = class {
6
+ client;
7
+ constructor(client) {
8
+ this.client = client;
9
+ }
10
+ /**
11
+ * Get validator proof for an entry hash
12
+ *
13
+ * @param entryHash - Entry hash (Base58 encoded)
14
+ * @returns Promise resolving to validator proof data
15
+ * @throws {Error} If entry hash is invalid
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const proof = await sdk.proof.getValidators('5Kd3N...')
20
+ * ```
21
+ */
22
+ async getValidators(entryHash) {
23
+ validate(Base58HashSchema, entryHash);
24
+ return this.client.get(`/api/proof/validators/${entryHash}`);
25
+ }
26
+ /**
27
+ * Get a merkle proof for a contract state entry.
28
+ *
29
+ * If `value` is supplied the node also verifies the proof and returns
30
+ * `result: true | false` indicating whether the value matches the proof.
31
+ *
32
+ * @param key - Contract state key, either raw bytes or already-Base58-encoded
33
+ * @param value - Optional value to verify against the proof (raw bytes or Base58)
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * // Just fetch the proof
38
+ * const proof = await sdk.proof.getContractStateProof(
39
+ * new TextEncoder().encode('account:5Kd3N...:balance:AMA')
40
+ * )
41
+ *
42
+ * // Fetch and verify the value
43
+ * const verified = await sdk.proof.getContractStateProof(key, expectedValueBytes)
44
+ * if (verified.result) console.log('matches')
45
+ * ```
46
+ */
47
+ async getContractStateProof(key, value) {
48
+ const path = `/api/proof/contractstate/${typeof key === "string" ? key : toBase58(key)}`;
49
+ if (value === void 0) return this.client.get(path);
50
+ const valueB58 = typeof value === "string" ? value : toBase58(value);
51
+ return this.client.get(`${path}/${valueB58}`);
52
+ }
53
+ };
54
+ //#endregion
55
+ export { ProofAPI };
56
+
30
57
  //# sourceMappingURL=proof.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"proof.js","sourceRoot":"","sources":["../../src/api/proof.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,MAAM,OAAO,QAAQ;IACA;IAApB,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,aAAa,CAAC,SAAiB;QACpC,QAAQ,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAA;QACrC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAkB,yBAAyB,SAAS,EAAE,CAAC,CAAA;IAC9E,CAAC;CACD"}
1
+ {"version":3,"file":"proof.js","names":[],"sources":["../../src/api/proof.ts"],"sourcesContent":["/**\n * Proof API\n *\n * Provides methods for querying validator proofs\n */\n\nimport type { AmadeusClient } from '../client'\nimport type { ProofValidators, ContractStateProof } from '../types'\nimport { Base58HashSchema } from '../schemas'\nimport { toBase58 } from '../encoding'\nimport { validate } from '../validation'\n\nexport class ProofAPI {\n\tconstructor(private client: AmadeusClient) {}\n\n\t/**\n\t * Get validator proof for an entry hash\n\t *\n\t * @param entryHash - Entry hash (Base58 encoded)\n\t * @returns Promise resolving to validator proof data\n\t * @throws {Error} If entry hash is invalid\n\t *\n\t * @example\n\t * ```ts\n\t * const proof = await sdk.proof.getValidators('5Kd3N...')\n\t * ```\n\t */\n\tasync getValidators(entryHash: string): Promise<ProofValidators> {\n\t\tvalidate(Base58HashSchema, entryHash)\n\t\treturn this.client.get<ProofValidators>(`/api/proof/validators/${entryHash}`)\n\t}\n\n\t/**\n\t * Get a merkle proof for a contract state entry.\n\t *\n\t * If `value` is supplied the node also verifies the proof and returns\n\t * `result: true | false` indicating whether the value matches the proof.\n\t *\n\t * @param key - Contract state key, either raw bytes or already-Base58-encoded\n\t * @param value - Optional value to verify against the proof (raw bytes or Base58)\n\t *\n\t * @example\n\t * ```ts\n\t * // Just fetch the proof\n\t * const proof = await sdk.proof.getContractStateProof(\n\t * new TextEncoder().encode('account:5Kd3N...:balance:AMA')\n\t * )\n\t *\n\t * // Fetch and verify the value\n\t * const verified = await sdk.proof.getContractStateProof(key, expectedValueBytes)\n\t * if (verified.result) console.log('matches')\n\t * ```\n\t */\n\tasync getContractStateProof(\n\t\tkey: Uint8Array | string,\n\t\tvalue?: Uint8Array | string\n\t): Promise<ContractStateProof> {\n\t\tconst keyB58 = typeof key === 'string' ? key : toBase58(key)\n\t\tconst path = `/api/proof/contractstate/${keyB58}`\n\t\tif (value === undefined) {\n\t\t\treturn this.client.get<ContractStateProof>(path)\n\t\t}\n\t\tconst valueB58 = typeof value === 'string' ? value : toBase58(value)\n\t\treturn this.client.get<ContractStateProof>(`${path}/${valueB58}`)\n\t}\n}\n"],"mappings":";;;;AAYA,IAAa,WAAb,MAAsB;CACD;CAApB,YAAY,QAA+B;EAAvB,KAAA,SAAA;;;;;;;;;;;;;;CAcpB,MAAM,cAAc,WAA6C;EAChE,SAAS,kBAAkB,UAAU;EACrC,OAAO,KAAK,OAAO,IAAqB,yBAAyB,YAAY;;;;;;;;;;;;;;;;;;;;;;;CAwB9E,MAAM,sBACL,KACA,OAC8B;EAE9B,MAAM,OAAO,4BADE,OAAO,QAAQ,WAAW,MAAM,SAAS,IAAI;EAE5D,IAAI,UAAU,KAAA,GACb,OAAO,KAAK,OAAO,IAAwB,KAAK;EAEjD,MAAM,WAAW,OAAO,UAAU,WAAW,QAAQ,SAAS,MAAM;EACpE,OAAO,KAAK,OAAO,IAAwB,GAAG,KAAK,GAAG,WAAW"}