@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
package/dist/schemas.js CHANGED
@@ -1,103 +1,99 @@
1
+ import { Schema } from "effect";
2
+ //#region src/schemas.ts
1
3
  /**
2
- * Effect Schema definitions for validation
3
- *
4
- * Provides reusable schemas for validating common data types used throughout the SDK
5
- */
6
- import { Schema } from 'effect';
4
+ * Effect Schema definitions for validation
5
+ *
6
+ * Provides reusable schemas for validating common data types used throughout the SDK
7
+ */
7
8
  /**
8
- * Base58 character set regex pattern
9
- * Base58 excludes 0, O, I, l to avoid visual confusion
10
- */
9
+ * Base58 character set regex pattern
10
+ * Base58 excludes 0, O, I, l to avoid visual confusion
11
+ */
11
12
  const BASE58_PATTERN = /^[1-9A-HJ-NP-Za-km-z]+$/;
12
13
  /**
13
- * Schema for Base58 encoded hash (used for transaction IDs, entry hashes, etc.)
14
- */
15
- export const Base58HashSchema = Schema.String.pipe(Schema.nonEmptyString(), Schema.pattern(BASE58_PATTERN, {
16
- identifier: 'Base58Hash',
17
- description: 'Base58 encoded hash string'
14
+ * Schema for Base58 encoded hash (used for transaction IDs, entry hashes, etc.)
15
+ */
16
+ const Base58HashSchema = Schema.String.pipe(Schema.nonEmptyString(), Schema.pattern(BASE58_PATTERN, {
17
+ identifier: "Base58Hash",
18
+ description: "Base58 encoded hash string"
18
19
  }));
19
20
  /**
20
- * Schema for Base58 encoded address
21
- */
22
- export const Base58AddressSchema = Schema.String.pipe(Schema.nonEmptyString(), Schema.pattern(BASE58_PATTERN, {
23
- identifier: 'Base58Address',
24
- description: 'Base58 encoded address string'
21
+ * Schema for Base58 encoded address
22
+ */
23
+ const Base58AddressSchema = Schema.String.pipe(Schema.nonEmptyString(), Schema.pattern(BASE58_PATTERN, {
24
+ identifier: "Base58Address",
25
+ description: "Base58 encoded address string"
25
26
  }));
26
27
  /**
27
- * Schema for Base58 encoded public key
28
- */
29
- export const Base58PublicKeySchema = Schema.String.pipe(Schema.nonEmptyString(), Schema.pattern(BASE58_PATTERN, {
30
- identifier: 'Base58PublicKey',
31
- description: 'Base58 encoded public key string'
28
+ * Schema for Base58 encoded public key
29
+ */
30
+ const Base58PublicKeySchema = Schema.String.pipe(Schema.nonEmptyString(), Schema.pattern(BASE58_PATTERN, {
31
+ identifier: "Base58PublicKey",
32
+ description: "Base58 encoded public key string"
32
33
  }));
33
34
  /**
34
- * Schema for transaction sort order
35
- */
36
- export const TransactionSortSchema = Schema.Literal('asc', 'desc').annotations({
37
- identifier: 'TransactionSort'
38
- });
35
+ * Schema for transaction sort order
36
+ */
37
+ const TransactionSortSchema = Schema.Literal("asc", "desc").annotations({ identifier: "TransactionSort" });
39
38
  /**
40
- * Schema for transaction filters
41
- * Validates optional fields when they are present
42
- */
43
- export const TransactionFiltersSchema = Schema.Struct({
44
- limit: Schema.optional(Schema.NonNegativeInt),
45
- offset: Schema.optional(Schema.NonNegativeInt),
46
- sort: Schema.optional(TransactionSortSchema),
47
- cursor: Schema.optional(Schema.String),
48
- cursor_b58: Schema.optional(Schema.String),
49
- contract: Schema.optional(Schema.String),
50
- contract_b58: Schema.optional(Schema.String),
51
- function: Schema.optional(Schema.String),
52
- type: Schema.optional(Schema.Literal('sent', 'recv'))
53
- }).annotations({
54
- identifier: 'TransactionFilters'
55
- });
39
+ * Schema for transaction filters
40
+ * Validates optional fields when they are present
41
+ */
42
+ const TransactionFiltersSchema = Schema.Struct({
43
+ limit: Schema.optional(Schema.NonNegativeInt),
44
+ offset: Schema.optional(Schema.NonNegativeInt),
45
+ sort: Schema.optional(TransactionSortSchema),
46
+ cursor: Schema.optional(Schema.String),
47
+ cursor_b58: Schema.optional(Schema.String),
48
+ contract: Schema.optional(Schema.String),
49
+ contract_b58: Schema.optional(Schema.String),
50
+ function: Schema.optional(Schema.String),
51
+ type: Schema.optional(Schema.Literal("sent", "recv"))
52
+ }).annotations({ identifier: "TransactionFilters" });
56
53
  /**
57
- * Schema for non-empty string
58
- */
59
- export const NonEmptyStringSchema = Schema.String.pipe(Schema.nonEmptyString());
54
+ * Schema for non-empty string
55
+ */
56
+ const NonEmptyStringSchema = Schema.String.pipe(Schema.nonEmptyString());
60
57
  /**
61
- * Schema for non-empty Uint8Array
62
- */
63
- export const NonEmptyUint8ArraySchema = Schema.instanceOf(Uint8Array).pipe(Schema.filter((arr) => arr.length > 0, {
64
- identifier: 'NonEmptyUint8Array',
65
- description: 'Non-empty Uint8Array'
58
+ * Schema for non-empty Uint8Array
59
+ */
60
+ const NonEmptyUint8ArraySchema = Schema.instanceOf(Uint8Array).pipe(Schema.filter((arr) => arr.length > 0, {
61
+ identifier: "NonEmptyUint8Array",
62
+ description: "Non-empty Uint8Array"
66
63
  }));
67
64
  /**
68
- * Schema for ArrayBuffer (can be converted to Uint8Array)
69
- */
70
- export const NonEmptyArrayBufferSchema = Schema.instanceOf(ArrayBuffer).pipe(Schema.filter((buf) => buf.byteLength > 0, {
71
- identifier: 'NonEmptyArrayBuffer',
72
- description: 'Non-empty ArrayBuffer'
65
+ * Schema for ArrayBuffer (can be converted to Uint8Array)
66
+ */
67
+ const NonEmptyArrayBufferSchema = Schema.instanceOf(ArrayBuffer).pipe(Schema.filter((buf) => buf.byteLength > 0, {
68
+ identifier: "NonEmptyArrayBuffer",
69
+ description: "Non-empty ArrayBuffer"
73
70
  }));
74
71
  /**
75
- * Schema for transaction data (Uint8Array or non-empty Base58 string)
76
- */
77
- export const TransactionDataSchema = Schema.Union(NonEmptyUint8ArraySchema, Base58HashSchema).annotations({
78
- identifier: 'TransactionData',
79
- description: 'Transaction data as Uint8Array or Base58 encoded string'
72
+ * Schema for transaction data (Uint8Array or non-empty Base58 string)
73
+ */
74
+ const TransactionDataSchema = Schema.Union(NonEmptyUint8ArraySchema, Base58HashSchema).annotations({
75
+ identifier: "TransactionData",
76
+ description: "Transaction data as Uint8Array or Base58 encoded string"
80
77
  });
81
78
  /**
82
- * Schema for contract key (Uint8Array or Base58 string)
83
- */
84
- export const ContractKeySchema = Schema.Union(NonEmptyUint8ArraySchema, Base58HashSchema).annotations({
85
- identifier: 'ContractKey',
86
- description: 'Contract key as Uint8Array or Base58 encoded string'
79
+ * Schema for contract key (Uint8Array or Base58 string)
80
+ */
81
+ const ContractKeySchema = Schema.Union(NonEmptyUint8ArraySchema, Base58HashSchema).annotations({
82
+ identifier: "ContractKey",
83
+ description: "Contract key as Uint8Array or Base58 encoded string"
87
84
  });
88
85
  /**
89
- * Schema for bytecode (Uint8Array or ArrayBuffer)
90
- */
91
- export const BytecodeSchema = Schema.Union(NonEmptyUint8ArraySchema, NonEmptyArrayBufferSchema).annotations({
92
- identifier: 'Bytecode',
93
- description: 'Contract bytecode as Uint8Array or ArrayBuffer'
86
+ * Schema for bytecode (Uint8Array or ArrayBuffer)
87
+ */
88
+ const BytecodeSchema = Schema.Union(NonEmptyUint8ArraySchema, NonEmptyArrayBufferSchema).annotations({
89
+ identifier: "Bytecode",
90
+ description: "Contract bytecode as Uint8Array or ArrayBuffer"
94
91
  });
95
- /**
96
- * Schema for safe positive integer (>= 1, within safe integer range)
97
- * Uses built-in Schema.Int and Schema.positive() with MAX_SAFE_INTEGER constraint
98
- */
99
- export const SafePositiveNumberSchema = Schema.Int.pipe(Schema.positive(), Schema.filter((n) => n <= Number.MAX_SAFE_INTEGER, {
100
- identifier: 'SafePositiveNumber',
101
- description: 'Positive integer within safe integer range'
92
+ Schema.Int.pipe(Schema.positive(), Schema.filter((n) => n <= Number.MAX_SAFE_INTEGER, {
93
+ identifier: "SafePositiveNumber",
94
+ description: "Positive integer within safe integer range"
102
95
  }));
96
+ //#endregion
97
+ export { Base58AddressSchema, Base58HashSchema, Base58PublicKeySchema, BytecodeSchema, ContractKeySchema, NonEmptyStringSchema, TransactionDataSchema, TransactionFiltersSchema };
98
+
103
99
  //# sourceMappingURL=schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B;;;GAGG;AACH,MAAM,cAAc,GAAG,yBAAyB,CAAA;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA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AM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,KAAK,CAC5C,wBAAwB,EACxB,gBAAgB,CAChB,CAAC,WAAW,CAAC;IACb,UAAU,EAAE,aAAa;IACzB,WAAW,EAAE,qDAAqD;CAClE,CAAC,CAAA;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CACzC,wBAAwB,EACxB,yBAAyB,CACzB,CAAC,WAAW,CAAC;IACb,UAAU,EAAE,UAAU;IACtB,WAAW,EAAE,gDAAgD;CAC7D,CAAC,CAAA;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CACtD,MAAM,CAAC,QAAQ,EAAE,EACjB,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,gBAAgB,EAAE;IAClD,UAAU,EAAE,oBAAoB;IAChC,WAAW,EAAE,4CAA4C;CACzD,CAAC,CACF,CAAA"}
1
+ {"version":3,"file":"schemas.js","names":[],"sources":["../src/schemas.ts"],"sourcesContent":["/**\n * Effect Schema definitions for validation\n *\n * Provides reusable schemas for validating common data types used throughout the SDK\n */\n\nimport { Schema } from 'effect'\n\n/**\n * Base58 character set regex pattern\n * Base58 excludes 0, O, I, l to avoid visual confusion\n */\nconst BASE58_PATTERN = /^[1-9A-HJ-NP-Za-km-z]+$/\n\n/**\n * Schema for Base58 encoded hash (used for transaction IDs, entry hashes, etc.)\n */\nexport const Base58HashSchema = Schema.String.pipe(\n\tSchema.nonEmptyString(),\n\tSchema.pattern(BASE58_PATTERN, {\n\t\tidentifier: 'Base58Hash',\n\t\tdescription: 'Base58 encoded hash string'\n\t})\n)\n\n/**\n * Schema for Base58 encoded address\n */\nexport const Base58AddressSchema = Schema.String.pipe(\n\tSchema.nonEmptyString(),\n\tSchema.pattern(BASE58_PATTERN, {\n\t\tidentifier: 'Base58Address',\n\t\tdescription: 'Base58 encoded address string'\n\t})\n)\n\n/**\n * Schema for Base58 encoded public key\n */\nexport const Base58PublicKeySchema = Schema.String.pipe(\n\tSchema.nonEmptyString(),\n\tSchema.pattern(BASE58_PATTERN, {\n\t\tidentifier: 'Base58PublicKey',\n\t\tdescription: 'Base58 encoded public key string'\n\t})\n)\n\n/**\n * Schema for transaction sort order\n */\nexport const TransactionSortSchema = Schema.Literal('asc', 'desc').annotations({\n\tidentifier: 'TransactionSort'\n})\n\n/**\n * Schema for transaction filters\n * Validates optional fields when they are present\n */\nexport const TransactionFiltersSchema = Schema.Struct({\n\tlimit: Schema.optional(Schema.NonNegativeInt),\n\toffset: Schema.optional(Schema.NonNegativeInt),\n\tsort: Schema.optional(TransactionSortSchema),\n\tcursor: Schema.optional(Schema.String),\n\tcursor_b58: Schema.optional(Schema.String),\n\tcontract: Schema.optional(Schema.String),\n\tcontract_b58: Schema.optional(Schema.String),\n\tfunction: Schema.optional(Schema.String),\n\ttype: Schema.optional(Schema.Literal('sent', 'recv'))\n}).annotations({\n\tidentifier: 'TransactionFilters'\n})\n\n/**\n * Schema for non-empty string\n */\nexport const NonEmptyStringSchema = Schema.String.pipe(Schema.nonEmptyString())\n\n/**\n * Schema for non-empty Uint8Array\n */\nexport const NonEmptyUint8ArraySchema = Schema.instanceOf(Uint8Array).pipe(\n\tSchema.filter((arr) => arr.length > 0, {\n\t\tidentifier: 'NonEmptyUint8Array',\n\t\tdescription: 'Non-empty Uint8Array'\n\t})\n)\n\n/**\n * Schema for ArrayBuffer (can be converted to Uint8Array)\n */\nexport const NonEmptyArrayBufferSchema = Schema.instanceOf(ArrayBuffer).pipe(\n\tSchema.filter((buf) => buf.byteLength > 0, {\n\t\tidentifier: 'NonEmptyArrayBuffer',\n\t\tdescription: 'Non-empty ArrayBuffer'\n\t})\n)\n\n/**\n * Schema for transaction data (Uint8Array or non-empty Base58 string)\n */\nexport const TransactionDataSchema = Schema.Union(\n\tNonEmptyUint8ArraySchema,\n\tBase58HashSchema\n).annotations({\n\tidentifier: 'TransactionData',\n\tdescription: 'Transaction data as Uint8Array or Base58 encoded string'\n})\n\n/**\n * Schema for contract key (Uint8Array or Base58 string)\n */\nexport const ContractKeySchema = Schema.Union(\n\tNonEmptyUint8ArraySchema,\n\tBase58HashSchema\n).annotations({\n\tidentifier: 'ContractKey',\n\tdescription: 'Contract key as Uint8Array or Base58 encoded string'\n})\n\n/**\n * Schema for bytecode (Uint8Array or ArrayBuffer)\n */\nexport const BytecodeSchema = Schema.Union(\n\tNonEmptyUint8ArraySchema,\n\tNonEmptyArrayBufferSchema\n).annotations({\n\tidentifier: 'Bytecode',\n\tdescription: 'Contract bytecode as Uint8Array or ArrayBuffer'\n})\n\n/**\n * Schema for safe positive integer (>= 1, within safe integer range)\n * Uses built-in Schema.Int and Schema.positive() with MAX_SAFE_INTEGER constraint\n */\nexport const SafePositiveNumberSchema = Schema.Int.pipe(\n\tSchema.positive(),\n\tSchema.filter((n) => n <= Number.MAX_SAFE_INTEGER, {\n\t\tidentifier: 'SafePositiveNumber',\n\t\tdescription: 'Positive integer within safe integer range'\n\t})\n)\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,iBAAiB;;;;AAKvB,MAAa,mBAAmB,OAAO,OAAO,KAC7C,OAAO,gBAAgB,EACvB,OAAO,QAAQ,gBAAgB;CAC9B,YAAY;CACZ,aAAa;CACb,CAAC,CACF;;;;AAKD,MAAa,sBAAsB,OAAO,OAAO,KAChD,OAAO,gBAAgB,EACvB,OAAO,QAAQ,gBAAgB;CAC9B,YAAY;CACZ,aAAa;CACb,CAAC,CACF;;;;AAKD,MAAa,wBAAwB,OAAO,OAAO,KAClD,OAAO,gBAAgB,EACvB,OAAO,QAAQ,gBAAgB;CAC9B,YAAY;CACZ,aAAa;CACb,CAAC,CACF;;;;AAKD,MAAa,wBAAwB,OAAO,QAAQ,OAAO,OAAO,CAAC,YAAY,EAC9E,YAAY,mBACZ,CAAC;;;;;AAMF,MAAa,2BAA2B,OAAO,OAAO;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ilities.
5
- * This is the primary entry point for interacting with the Amadeus Protocol.
6
- */
7
- import { AmadeusClient } from './client';
8
- import type { AmadeusSDKConfig } from './types';
9
- import { ChainAPI, PeerAPI, TransactionAPI, WalletAPI, ContractAPI, EpochAPI, ProofAPI } from './api';
1
+ import { AmadeusSDKConfig } from "./types.js";
2
+ import { AmadeusClient } from "./client.js";
3
+ import { ChainAPI } from "./api/chain.js";
4
+ import { ContractAPI } from "./api/contract.js";
5
+ import { EpochAPI } from "./api/epoch.js";
6
+ import { PeerAPI } from "./api/peer.js";
7
+ import { ProofAPI } from "./api/proof.js";
8
+ import { TransactionAPI } from "./api/transaction.js";
9
+ import { WalletAPI } from "./api/wallet.js";
10
+
11
+ //#region src/sdk.d.ts
10
12
  /**
11
13
  * Main Amadeus SDK class
12
14
  *
@@ -40,61 +42,63 @@ import { ChainAPI, PeerAPI, TransactionAPI, WalletAPI, ContractAPI, EpochAPI, Pr
40
42
  * const scores = await sdk.epoch.getScore()
41
43
  * ```
42
44
  */
43
- export declare class AmadeusSDK {
44
- /** HTTP client instance */
45
- readonly client: AmadeusClient;
46
- /** Chain API module for blockchain queries */
47
- readonly chain: ChainAPI;
48
- /** Peer API module for network information */
49
- readonly peer: PeerAPI;
50
- /** Transaction API module for submitting transactions */
51
- readonly transaction: TransactionAPI;
52
- /** Wallet API module for balance queries */
53
- readonly wallet: WalletAPI;
54
- /** Contract API module for smart contract interactions */
55
- readonly contract: ContractAPI;
56
- /** Epoch API module for epoch and validator data */
57
- readonly epoch: EpochAPI;
58
- /** Proof API module for validator proofs */
59
- readonly proof: ProofAPI;
60
- /**
61
- * Create a new AmadeusSDK instance
62
- *
63
- * @param config - SDK configuration
64
- * @throws {AmadeusSDKError} If configuration is invalid
65
- *
66
- * @example
67
- * ```ts
68
- * // Use default node URL
69
- * const sdk = new AmadeusSDK({})
70
- *
71
- * // Use custom node URL
72
- * const sdk = new AmadeusSDK({
73
- * baseUrl: 'https://custom-node.com/api',
74
- * timeout: 60000
75
- * })
76
- * ```
77
- */
78
- constructor(config?: AmadeusSDKConfig);
79
- /**
80
- * Get SDK version
81
- */
82
- static getVersion(): string;
83
- /**
84
- * Get the current configuration
85
- */
86
- getConfig(): AmadeusSDKConfig;
87
- /**
88
- * Update the base URL
89
- */
90
- setBaseUrl(url: string): void;
91
- /**
92
- * Update headers
93
- */
94
- setHeaders(headers: Record<string, string>): void;
95
- /**
96
- * Cancel ongoing requests
97
- */
98
- cancel(): void;
45
+ declare class AmadeusSDK {
46
+ /** HTTP client instance */
47
+ readonly client: AmadeusClient;
48
+ /** Chain API module for blockchain queries */
49
+ readonly chain: ChainAPI;
50
+ /** Peer API module for network information */
51
+ readonly peer: PeerAPI;
52
+ /** Transaction API module for submitting transactions */
53
+ readonly transaction: TransactionAPI;
54
+ /** Wallet API module for balance queries */
55
+ readonly wallet: WalletAPI;
56
+ /** Contract API module for smart contract interactions */
57
+ readonly contract: ContractAPI;
58
+ /** Epoch API module for epoch and validator data */
59
+ readonly epoch: EpochAPI;
60
+ /** Proof API module for validator proofs */
61
+ readonly proof: ProofAPI;
62
+ /**
63
+ * Create a new AmadeusSDK instance
64
+ *
65
+ * @param config - SDK configuration
66
+ * @throws {AmadeusSDKError} If configuration is invalid
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * // Use default node URL
71
+ * const sdk = new AmadeusSDK({})
72
+ *
73
+ * // Use custom node URL
74
+ * const sdk = new AmadeusSDK({
75
+ * baseUrl: 'https://custom-node.com/api',
76
+ * timeout: 60000
77
+ * })
78
+ * ```
79
+ */
80
+ constructor(config?: AmadeusSDKConfig);
81
+ /**
82
+ * Get SDK version
83
+ */
84
+ static getVersion(): string;
85
+ /**
86
+ * Get the current configuration
87
+ */
88
+ getConfig(): AmadeusSDKConfig;
89
+ /**
90
+ * Update the base URL
91
+ */
92
+ setBaseUrl(url: string): void;
93
+ /**
94
+ * Update headers
95
+ */
96
+ setHeaders(headers: Record<string, string>): void;
97
+ /**
98
+ * Cancel ongoing requests
99
+ */
100
+ cancel(): void;
99
101
  }
102
+ //#endregion
103
+ export { AmadeusSDK };
100
104
  //# sourceMappingURL=sdk.d.ts.map
package/dist/sdk.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EACN,QAAQ,EACR,OAAO,EACP,cAAc,EACd,SAAS,EACT,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,MAAM,OAAO,CAAA;AAGd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qBAAa,UAAU;IACtB,2BAA2B;IAC3B,SAAgB,MAAM,EAAE,aAAa,CAAA;IAErC,8CAA8C;IAC9C,SAAgB,KAAK,EAAE,QAAQ,CAAA;IAE/B,8CAA8C;IAC9C,SAAgB,IAAI,EAAE,OAAO,CAAA;IAE7B,yDAAyD;IACzD,SAAgB,WAAW,EAAE,cAAc,CAAA;IAE3C,4CAA4C;IAC5C,SAAgB,MAAM,EAAE,SAAS,CAAA;IAEjC,0DAA0D;IAC1D,SAAgB,QAAQ,EAAE,WAAW,CAAA;IAErC,oDAAoD;IACpD,SAAgB,KAAK,EAAE,QAAQ,CAAA;IAE/B,4CAA4C;IAC5C,SAAgB,KAAK,EAAE,QAAQ,CAAA;IAE/B;;;;;;;;;;;;;;;;;OAiBG;gBACS,MAAM,GAAE,gBAA4C;IAahE;;OAEG;IACH,MAAM,CAAC,UAAU,IAAI,MAAM;IAI3B;;OAEG;IACH,SAAS,IAAI,gBAAgB;IAI7B;;OAEG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI7B;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAIjD;;OAEG;IACH,MAAM,IAAI,IAAI;CAGd"}
1
+ {"version":3,"file":"sdk.d.ts","names":[],"sources":["../src/sdk.ts"],"mappings":";;;;;;;;;;;;;AAqDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,UAAA;;WAEI,MAAA,EAAQ,aAAA;EAyCZ;EAAA,SAtCI,KAAA,EAAO,QAAA;EA6DvB;EAAA,SA1DgB,IAAA,EAAM,OAAA;EAiEtB;EAAA,SA9DgB,WAAA,EAAa,cAAA;EAqE7B;EAAA,SAlEgB,MAAA,EAAQ,SAAA;EAkEb;EAAA,SA/DK,QAAA,EAAU,WAAA;EAsEpB;EAAA,SAnEU,KAAA,EAAO,QAAA;;WAGP,KAAA,EAAO,QAAA;;;;;;;;;;;;;;;;;;;cAoBX,MAAA,GAAQ,gBAAA;;;;SAgBb,UAAA,CAAA;;;;EAOP,SAAA,CAAA,GAAa,gBAAA;;;;EAOb,UAAA,CAAW,GAAA;;;;EAOX,UAAA,CAAW,OAAA,EAAS,MAAA;;;;EAOpB,MAAA,CAAA;AAAA"}
package/dist/sdk.js CHANGED
@@ -1,120 +1,129 @@
1
+ import { NODE_API_URL, SDK_VERSION } from "./constants.js";
2
+ import { AmadeusClient } from "./client.js";
3
+ import { ChainAPI } from "./api/chain.js";
4
+ import { ContractAPI } from "./api/contract.js";
5
+ import { EpochAPI } from "./api/epoch.js";
6
+ import { PeerAPI } from "./api/peer.js";
7
+ import { ProofAPI } from "./api/proof.js";
8
+ import { TransactionAPI } from "./api/transaction.js";
9
+ import { WalletAPI } from "./api/wallet.js";
10
+ //#region src/sdk.ts
1
11
  /**
2
- * Amadeus SDK
3
- *
4
- * Main SDK class that provides access to all API modules and utilities.
5
- * This is the primary entry point for interacting with the Amadeus Protocol.
6
- */
7
- import { AmadeusClient } from './client';
8
- import { ChainAPI, PeerAPI, TransactionAPI, WalletAPI, ContractAPI, EpochAPI, ProofAPI } from './api';
9
- import { SDK_VERSION, NODE_API_URL } from './constants';
12
+ * Amadeus SDK
13
+ *
14
+ * Main SDK class that provides access to all API modules and utilities.
15
+ * This is the primary entry point for interacting with the Amadeus Protocol.
16
+ */
10
17
  /**
11
- * Main Amadeus SDK class
12
- *
13
- * Provides a unified interface to interact with the Amadeus Protocol.
14
- * All API modules are accessible through this class instance.
15
- *
16
- * @example
17
- * ```ts
18
- * import { AmadeusSDK } from '@amadeus-protocol/sdk'
19
- *
20
- * // Initialize SDK with default node URL
21
- * const sdk = new AmadeusSDK({
22
- * baseUrl: 'https://mainnet-rpc.ama.one/api'
23
- * })
24
- *
25
- * // Query chain
26
- * const tip = await sdk.chain.getTip()
27
- * const stats = await sdk.chain.getStats()
28
- *
29
- * // Query wallet balances
30
- * const balance = await sdk.wallet.getBalance('5Kd3N...', 'AMA')
31
- * const allBalances = await sdk.wallet.getAllBalances('5Kd3N...')
32
- *
33
- * // Submit transaction
34
- * const result = await sdk.transaction.submit(txPacked)
35
- *
36
- * // Query contracts
37
- * const contractData = await sdk.contract.get(key)
38
- *
39
- * // Query epoch data
40
- * const scores = await sdk.epoch.getScore()
41
- * ```
42
- */
43
- export class AmadeusSDK {
44
- /** HTTP client instance */
45
- client;
46
- /** Chain API module for blockchain queries */
47
- chain;
48
- /** Peer API module for network information */
49
- peer;
50
- /** Transaction API module for submitting transactions */
51
- transaction;
52
- /** Wallet API module for balance queries */
53
- wallet;
54
- /** Contract API module for smart contract interactions */
55
- contract;
56
- /** Epoch API module for epoch and validator data */
57
- epoch;
58
- /** Proof API module for validator proofs */
59
- proof;
60
- /**
61
- * Create a new AmadeusSDK instance
62
- *
63
- * @param config - SDK configuration
64
- * @throws {AmadeusSDKError} If configuration is invalid
65
- *
66
- * @example
67
- * ```ts
68
- * // Use default node URL
69
- * const sdk = new AmadeusSDK({})
70
- *
71
- * // Use custom node URL
72
- * const sdk = new AmadeusSDK({
73
- * baseUrl: 'https://custom-node.com/api',
74
- * timeout: 60000
75
- * })
76
- * ```
77
- */
78
- constructor(config = { baseUrl: NODE_API_URL }) {
79
- this.client = new AmadeusClient(config);
80
- // Initialize API modules
81
- this.chain = new ChainAPI(this.client);
82
- this.peer = new PeerAPI(this.client);
83
- this.transaction = new TransactionAPI(this.client);
84
- this.wallet = new WalletAPI(this.client);
85
- this.contract = new ContractAPI(this.client);
86
- this.epoch = new EpochAPI(this.client);
87
- this.proof = new ProofAPI(this.client);
88
- }
89
- /**
90
- * Get SDK version
91
- */
92
- static getVersion() {
93
- return SDK_VERSION;
94
- }
95
- /**
96
- * Get the current configuration
97
- */
98
- getConfig() {
99
- return this.client.getConfig();
100
- }
101
- /**
102
- * Update the base URL
103
- */
104
- setBaseUrl(url) {
105
- this.client.setBaseUrl(url);
106
- }
107
- /**
108
- * Update headers
109
- */
110
- setHeaders(headers) {
111
- this.client.setHeaders(headers);
112
- }
113
- /**
114
- * Cancel ongoing requests
115
- */
116
- cancel() {
117
- this.client.cancel();
118
- }
119
- }
18
+ * Main Amadeus SDK class
19
+ *
20
+ * Provides a unified interface to interact with the Amadeus Protocol.
21
+ * All API modules are accessible through this class instance.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * import { AmadeusSDK } from '@amadeus-protocol/sdk'
26
+ *
27
+ * // Initialize SDK with default node URL
28
+ * const sdk = new AmadeusSDK({
29
+ * baseUrl: 'https://mainnet-rpc.ama.one/api'
30
+ * })
31
+ *
32
+ * // Query chain
33
+ * const tip = await sdk.chain.getTip()
34
+ * const stats = await sdk.chain.getStats()
35
+ *
36
+ * // Query wallet balances
37
+ * const balance = await sdk.wallet.getBalance('5Kd3N...', 'AMA')
38
+ * const allBalances = await sdk.wallet.getAllBalances('5Kd3N...')
39
+ *
40
+ * // Submit transaction
41
+ * const result = await sdk.transaction.submit(txPacked)
42
+ *
43
+ * // Query contracts
44
+ * const contractData = await sdk.contract.get(key)
45
+ *
46
+ * // Query epoch data
47
+ * const scores = await sdk.epoch.getScore()
48
+ * ```
49
+ */
50
+ var AmadeusSDK = class {
51
+ /** HTTP client instance */
52
+ client;
53
+ /** Chain API module for blockchain queries */
54
+ chain;
55
+ /** Peer API module for network information */
56
+ peer;
57
+ /** Transaction API module for submitting transactions */
58
+ transaction;
59
+ /** Wallet API module for balance queries */
60
+ wallet;
61
+ /** Contract API module for smart contract interactions */
62
+ contract;
63
+ /** Epoch API module for epoch and validator data */
64
+ epoch;
65
+ /** Proof API module for validator proofs */
66
+ proof;
67
+ /**
68
+ * Create a new AmadeusSDK instance
69
+ *
70
+ * @param config - SDK configuration
71
+ * @throws {AmadeusSDKError} If configuration is invalid
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * // Use default node URL
76
+ * const sdk = new AmadeusSDK({})
77
+ *
78
+ * // Use custom node URL
79
+ * const sdk = new AmadeusSDK({
80
+ * baseUrl: 'https://custom-node.com/api',
81
+ * timeout: 60000
82
+ * })
83
+ * ```
84
+ */
85
+ constructor(config = { baseUrl: NODE_API_URL }) {
86
+ this.client = new AmadeusClient(config);
87
+ this.chain = new ChainAPI(this.client);
88
+ this.peer = new PeerAPI(this.client);
89
+ this.transaction = new TransactionAPI(this.client);
90
+ this.wallet = new WalletAPI(this.client);
91
+ this.contract = new ContractAPI(this.client);
92
+ this.epoch = new EpochAPI(this.client);
93
+ this.proof = new ProofAPI(this.client);
94
+ }
95
+ /**
96
+ * Get SDK version
97
+ */
98
+ static getVersion() {
99
+ return SDK_VERSION;
100
+ }
101
+ /**
102
+ * Get the current configuration
103
+ */
104
+ getConfig() {
105
+ return this.client.getConfig();
106
+ }
107
+ /**
108
+ * Update the base URL
109
+ */
110
+ setBaseUrl(url) {
111
+ this.client.setBaseUrl(url);
112
+ }
113
+ /**
114
+ * Update headers
115
+ */
116
+ setHeaders(headers) {
117
+ this.client.setHeaders(headers);
118
+ }
119
+ /**
120
+ * Cancel ongoing requests
121
+ */
122
+ cancel() {
123
+ this.client.cancel();
124
+ }
125
+ };
126
+ //#endregion
127
+ export { AmadeusSDK };
128
+
120
129
  //# sourceMappingURL=sdk.js.map
package/dist/sdk.js.map C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C5C,IAAI,CAAC,KAAK,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACtC,IAAI,CAAC,KAAK,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACvC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU;QAChB,OAAO,WAAW,CAAA;IACnB,CAAC;IAED;;OAEG;IACH,SAAS;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAA;IAC/B,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,GAAW;QACrB,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;IAC5B,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,OAA+B;QACzC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;IAChC,CAAC;IAED;;OAEG;IACH,MAAM;QACL,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAA;IACrB,CAAC;CACD"}
1
+ {"version":3,"file":"sdk.js","names":[],"sources":["../src/sdk.ts"],"sourcesContent":["/**\n * Amadeus SDK\n *\n * Main SDK class that provides access to all API modules and utilities.\n * This is the primary entry point for interacting with the Amadeus Protocol.\n */\n\nimport { AmadeusClient } from './client'\nimport type { AmadeusSDKConfig } from './types'\nimport {\n\tChainAPI,\n\tPeerAPI,\n\tTransactionAPI,\n\tWalletAPI,\n\tContractAPI,\n\tEpochAPI,\n\tProofAPI\n} from './api'\nimport { SDK_VERSION, NODE_API_URL } from './constants'\n\n/**\n * Main Amadeus SDK class\n *\n * Provides a unified interface to interact with the Amadeus Protocol.\n * All API modules are accessible through this class instance.\n *\n * @example\n * ```ts\n * import { AmadeusSDK } from '@amadeus-protocol/sdk'\n *\n * // Initialize SDK with default node URL\n * const sdk = new AmadeusSDK({\n * baseUrl: 'https://mainnet-rpc.ama.one/api'\n * })\n *\n * // Query chain\n * const tip = await sdk.chain.getTip()\n * const stats = await sdk.chain.getStats()\n *\n * // Query wallet balances\n * const balance = await sdk.wallet.getBalance('5Kd3N...', 'AMA')\n * const allBalances = await sdk.wallet.getAllBalances('5Kd3N...')\n *\n * // Submit transaction\n * const result = await sdk.transaction.submit(txPacked)\n *\n * // Query contracts\n * const contractData = await sdk.contract.get(key)\n *\n * // Query epoch data\n * const scores = await sdk.epoch.getScore()\n * ```\n */\nexport class AmadeusSDK {\n\t/** HTTP client instance */\n\tpublic readonly client: AmadeusClient\n\n\t/** Chain API module for blockchain queries */\n\tpublic readonly chain: ChainAPI\n\n\t/** Peer API module for network information */\n\tpublic readonly peer: PeerAPI\n\n\t/** Transaction API module for submitting transactions */\n\tpublic readonly transaction: TransactionAPI\n\n\t/** Wallet API module for balance queries */\n\tpublic readonly wallet: WalletAPI\n\n\t/** Contract API module for smart contract interactions */\n\tpublic readonly contract: ContractAPI\n\n\t/** Epoch API module for epoch and validator data */\n\tpublic readonly epoch: EpochAPI\n\n\t/** Proof API module for validator proofs */\n\tpublic readonly proof: ProofAPI\n\n\t/**\n\t * Create a new AmadeusSDK instance\n\t *\n\t * @param config - SDK configuration\n\t * @throws {AmadeusSDKError} If configuration is invalid\n\t *\n\t * @example\n\t * ```ts\n\t * // Use default node URL\n\t * const sdk = new AmadeusSDK({})\n\t *\n\t * // Use custom node URL\n\t * const sdk = new AmadeusSDK({\n\t * baseUrl: 'https://custom-node.com/api',\n\t * timeout: 60000\n\t * })\n\t * ```\n\t */\n\tconstructor(config: AmadeusSDKConfig = { baseUrl: NODE_API_URL }) {\n\t\tthis.client = new AmadeusClient(config)\n\n\t\t// Initialize API modules\n\t\tthis.chain = new ChainAPI(this.client)\n\t\tthis.peer = new PeerAPI(this.client)\n\t\tthis.transaction = new TransactionAPI(this.client)\n\t\tthis.wallet = new WalletAPI(this.client)\n\t\tthis.contract = new ContractAPI(this.client)\n\t\tthis.epoch = new EpochAPI(this.client)\n\t\tthis.proof = new ProofAPI(this.client)\n\t}\n\n\t/**\n\t * Get SDK version\n\t */\n\tstatic getVersion(): string {\n\t\treturn SDK_VERSION\n\t}\n\n\t/**\n\t * Get the current configuration\n\t */\n\tgetConfig(): AmadeusSDKConfig {\n\t\treturn this.client.getConfig()\n\t}\n\n\t/**\n\t * Update the base URL\n\t */\n\tsetBaseUrl(url: string): void {\n\t\tthis.client.setBaseUrl(url)\n\t}\n\n\t/**\n\t * Update headers\n\t */\n\tsetHeaders(headers: Record<string, string>): void {\n\t\tthis.client.setHeaders(headers)\n\t}\n\n\t/**\n\t * Cancel ongoing requests\n\t */\n\tcancel(): void {\n\t\tthis.client.cancel()\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,IAAa,aAAb,MAAwB;;CAEvB;;CAGA;;CAGA;;CAGA;;CAGA;;CAGA;;CAGA;;CAGA;;;;;;;;;;;;;;;;;;;CAoBA,YAAY,SAA2B,EAAE,SAAS,cAAc,EAAE;EACjE,KAAK,SAAS,IAAI,cAAc,OAAO;EAGvC,KAAK,QAAQ,IAAI,SAAS,KAAK,OAAO;EACtC,KAAK,OAAO,IAAI,QAAQ,KAAK,OAAO;EACpC,KAAK,cAAc,IAAI,eAAe,KAAK,OAAO;EAClD,KAAK,SAAS,IAAI,UAAU,KAAK,OAAO;EACxC,KAAK,WAAW,IAAI,YAAY,KAAK,OAAO;EAC5C,KAAK,QAAQ,IAAI,SAAS,KAAK,OAAO;EACtC,KAAK,QAAQ,IAAI,SAAS,KAAK,OAAO;;;;;CAMvC,OAAO,aAAqB;EAC3B,OAAO;;;;;CAMR,YAA8B;EAC7B,OAAO,KAAK,OAAO,WAAW;;;;;CAM/B,WAAW,KAAmB;EAC7B,KAAK,OAAO,WAAW,IAAI;;;;;CAM5B,WAAW,SAAuC;EACjD,KAAK,OAAO,WAAW,QAAQ;;;;;CAMhC,SAAe;EACd,KAAK,OAAO,QAAQ"}