@amadeus-protocol/sdk 1.0.3 → 1.0.5

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.
@@ -38,7 +38,7 @@ export declare const EXPLORER_URL = "https://explorer.ama.one";
38
38
  /**
39
39
  * Default node API URL
40
40
  */
41
- export declare const NODE_API_URL = "https://nodes.amadeus.bot/api";
41
+ export declare const NODE_API_URL = "https://mainnet-rpc.ama.one/api";
42
42
  /**
43
43
  * Default request timeout in milliseconds
44
44
  */
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,WAAW,UAAU,CAAA;AAElC;;GAEG;AACH,eAAO,MAAM,8BAA8B,KAAK,CAAA;AAEhD;;GAEG;AACH,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAE1C;;GAEG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAA;AAEnC;;GAEG;AACH,eAAO,MAAM,6BAA6B,QAA2B,CAAA;AAErE;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAAoC,CAAA;AAExE;;GAEG;AACH,eAAO,MAAM,gBAAgB,OAAO,CAAA;AAEpC;;GAEG;AACH,eAAO,MAAM,YAAY,6BAA6B,CAAA;AAEtD;;GAEG;AACH,eAAO,MAAM,YAAY,kCAAkC,CAAA;AAE3D;;GAEG;AACH,eAAO,MAAM,eAAe,QAAQ,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,WAAW,UAAU,CAAA;AAElC;;GAEG;AACH,eAAO,MAAM,8BAA8B,KAAK,CAAA;AAEhD;;GAEG;AACH,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAE1C;;GAEG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAA;AAEnC;;GAEG;AACH,eAAO,MAAM,6BAA6B,QAA2B,CAAA;AAErE;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAAoC,CAAA;AAExE;;GAEG;AACH,eAAO,MAAM,gBAAgB,OAAO,CAAA;AAEpC;;GAEG;AACH,eAAO,MAAM,YAAY,6BAA6B,CAAA;AAEtD;;GAEG;AACH,eAAO,MAAM,YAAY,oCAAoC,CAAA;AAE7D;;GAEG;AACH,eAAO,MAAM,eAAe,QAAQ,CAAA"}
package/dist/constants.js CHANGED
@@ -38,7 +38,7 @@ export const EXPLORER_URL = 'https://explorer.ama.one';
38
38
  /**
39
39
  * Default node API URL
40
40
  */
41
- export const NODE_API_URL = 'https://nodes.amadeus.bot/api';
41
+ export const NODE_API_URL = 'https://mainnet-rpc.ama.one/api';
42
42
  /**
43
43
  * Default request timeout in milliseconds
44
44
  */
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAA;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,CAAA;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAA;AAE1C;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAA;AAEnC;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,IAAI,kBAAkB,CAAA;AAErE;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAAG,6BAA6B,CAAA;AAExE;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAA;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,0BAA0B,CAAA;AAEtD;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,+BAA+B,CAAA;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAA"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAA;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,CAAA;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAA;AAE1C;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAA;AAEnC;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,IAAI,kBAAkB,CAAA;AAErE;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAAG,6BAA6B,CAAA;AAExE;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAA;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,0BAA0B,CAAA;AAEtD;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,iCAAiC,CAAA;AAE7D;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAA"}
@@ -20,15 +20,17 @@ export declare function fromAtomicAma(atomicAma: number | string): number;
20
20
  /**
21
21
  * Convert human-readable AMA amount to atomic units
22
22
  *
23
- * Uses Math.trunc to avoid floating-point precision issues.
23
+ * Uses string splitting to avoid floating-point precision issues
24
+ * while preserving truncation (never rounds up) for safety.
24
25
  *
25
- * @param ama - Human-readable AMA amount
26
+ * @param ama - Human-readable AMA amount (number or string)
26
27
  * @returns Atomic units (integer)
27
28
  *
28
29
  * @example
29
30
  * ```ts
30
- * const atomic = toAtomicAma(1.5) // Returns 1500000000
31
+ * const atomic = toAtomicAma(1.5) // Returns 1500000000
32
+ * const atomic = toAtomicAma('1.00000001') // Returns 1000000010
31
33
  * ```
32
34
  */
33
- export declare function toAtomicAma(ama: number): number;
35
+ export declare function toAtomicAma(ama: number | string): number;
34
36
  //# sourceMappingURL=conversion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"conversion.d.ts","sourceRoot":"","sources":["../src/conversion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAgBhE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C"}
1
+ {"version":3,"file":"conversion.d.ts","sourceRoot":"","sources":["../src/conversion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAgBhE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAIxD"}
@@ -4,7 +4,7 @@
4
4
  * This module provides functions for converting between atomic units
5
5
  * and human-readable token amounts for the AMA token.
6
6
  */
7
- import { AMA_TOKEN_DECIMALS_MULTIPLIER } from './constants';
7
+ import { AMA_TOKEN_DECIMALS, AMA_TOKEN_DECIMALS_MULTIPLIER } from './constants';
8
8
  /**
9
9
  * Convert atomic AMA units to human-readable AMA amount
10
10
  *
@@ -36,17 +36,21 @@ export function fromAtomicAma(atomicAma) {
36
36
  /**
37
37
  * Convert human-readable AMA amount to atomic units
38
38
  *
39
- * Uses Math.trunc to avoid floating-point precision issues.
39
+ * Uses string splitting to avoid floating-point precision issues
40
+ * while preserving truncation (never rounds up) for safety.
40
41
  *
41
- * @param ama - Human-readable AMA amount
42
+ * @param ama - Human-readable AMA amount (number or string)
42
43
  * @returns Atomic units (integer)
43
44
  *
44
45
  * @example
45
46
  * ```ts
46
- * const atomic = toAtomicAma(1.5) // Returns 1500000000
47
+ * const atomic = toAtomicAma(1.5) // Returns 1500000000
48
+ * const atomic = toAtomicAma('1.00000001') // Returns 1000000010
47
49
  * ```
48
50
  */
49
51
  export function toAtomicAma(ama) {
50
- return Math.trunc(ama * AMA_TOKEN_DECIMALS_MULTIPLIER);
52
+ const num = typeof ama === 'string' ? parseFloat(ama) : ama;
53
+ const [int, frac = ''] = num.toFixed(AMA_TOKEN_DECIMALS).split('.');
54
+ return parseInt(int + frac, 10);
51
55
  }
52
56
  //# sourceMappingURL=conversion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"conversion.js","sourceRoot":"","sources":["../src/conversion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAE3D;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa,CAAC,SAA0B;IACvD,MAAM,eAAe,GAAG,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAEzF,IAAI,KAAK,CAAC,eAAe,CAAC,IAAI,eAAe,KAAK,CAAC,EAAE,CAAC;QACrD,OAAO,CAAC,CAAA;IACT,CAAC;IACD,IAAI,eAAe,GAAG,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;IAC9C,CAAC;IACD,IAAI,eAAe,GAAG,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;IACxC,CAAC;IACD,IAAI,eAAe,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;IACtD,CAAC;IACD,OAAO,eAAe,GAAG,6BAA6B,CAAA;AACvD,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACtC,OAAO,IAAI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G,GAAG,IAAI,EAAE,EAAE,CAAC,CAAA;AAChC,CAAC"}
package/dist/networks.js CHANGED
@@ -16,7 +16,7 @@ export var NetworkType;
16
16
  * Network API URLs
17
17
  */
18
18
  export const NETWORK_URLS = {
19
- [NetworkType.MAINNET]: 'https://nodes.amadeus.bot',
19
+ [NetworkType.MAINNET]: 'https://mainnet-rpc.ama.one',
20
20
  [NetworkType.TESTNET]: 'https://testnet-rpc.ama.one'
21
21
  };
22
22
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"networks.js","sourceRoot":"","sources":["../src/networks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACtB,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,gCAAiB,CAAA;AAClB,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAUD;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAkE;IAC1F,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,2BAA2B;IAClD,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,6BAA6B;CACpD,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAkE;IACnG,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,0BAA0B;IACjD,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,kCAAkC;CACzD,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAC3B;IACC,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;QACtB,MAAM,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC;QACzC,WAAW,EAAE,qBAAqB,CAAC,WAAW,CAAC,OAAO,CAAC;KACvD;IACD,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;QACtB,MAAM,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC;QACzC,WAAW,EAAE,qBAAqB,CAAC,WAAW,CAAC,OAAO,CAAC;KACvD;CACD,CAAA;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,oCAAoC,CAAA"}
1
+ {"version":3,"file":"networks.js","sourceRoot":"","sources":["../src/networks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACtB,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,gCAAiB,CAAA;AAClB,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAUD;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAkE;IAC1F,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,6BAA6B;IACpD,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,6BAA6B;CACpD,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAkE;IACnG,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,0BAA0B;IACjD,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,kCAAkC;CACzD,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAC3B;IACC,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;QACtB,MAAM,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC;QACzC,WAAW,EAAE,qBAAqB,CAAC,WAAW,CAAC,OAAO,CAAC;KACvD;IACD,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;QACtB,MAAM,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC;QACzC,WAAW,EAAE,qBAAqB,CAAC,WAAW,CAAC,OAAO,CAAC;KACvD;CACD,CAAA;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,oCAAoC,CAAA"}
package/dist/sdk.d.ts CHANGED
@@ -19,7 +19,7 @@ import { ChainAPI, PeerAPI, TransactionAPI, WalletAPI, ContractAPI, EpochAPI, Pr
19
19
  *
20
20
  * // Initialize SDK with default node URL
21
21
  * const sdk = new AmadeusSDK({
22
- * baseUrl: 'https://nodes.amadeus.bot/api'
22
+ * baseUrl: 'https://mainnet-rpc.ama.one/api'
23
23
  * })
24
24
  *
25
25
  * // Query chain
package/dist/sdk.js CHANGED
@@ -19,7 +19,7 @@ import { SDK_VERSION, NODE_API_URL } from './constants';
19
19
  *
20
20
  * // Initialize SDK with default node URL
21
21
  * const sdk = new AmadeusSDK({
22
- * baseUrl: 'https://nodes.amadeus.bot/api'
22
+ * baseUrl: 'https://mainnet-rpc.ama.one/api'
23
23
  * })
24
24
  *
25
25
  * // Query chain
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amadeus-protocol/sdk",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Official TypeScript/JavaScript SDK for Amadeus Protocol - Core utilities for serialization, cryptography, transaction building, and API client",
5
5
  "repository": {
6
6
  "type": "git",