@amadeus-protocol/sdk 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -0
- package/dist/constants.js.map +1 -1
- package/dist/conversion.d.ts +3 -1
- package/dist/conversion.d.ts.map +1 -1
- package/dist/conversion.js +4 -2
- package/dist/conversion.js.map +1 -1
- package/dist/explorer.d.ts +48 -0
- package/dist/explorer.d.ts.map +1 -0
- package/dist/explorer.js +57 -0
- package/dist/explorer.js.map +1 -0
- package/dist/formatters.d.ts +56 -0
- package/dist/formatters.d.ts.map +1 -0
- package/dist/formatters.js +80 -0
- package/dist/formatters.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/networks.d.ts +43 -0
- package/dist/networks.d.ts.map +1 -0
- package/dist/networks.js +46 -0
- package/dist/networks.js.map +1 -0
- package/dist/transaction-errors.d.ts +37 -0
- package/dist/transaction-errors.d.ts.map +1 -0
- package/dist/transaction-errors.js +177 -0
- package/dist/transaction-errors.js.map +1 -0
- package/dist/types.d.ts +121 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +112 -0
- package/dist/types.js.map +1 -1
- package/dist/validation.d.ts +83 -1
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +177 -1
- package/dist/validation.js.map +1 -1
- package/package.json +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -23,6 +23,10 @@ export declare const AMA_TOKEN_DECIMALS = 9;
|
|
|
23
23
|
* Multiplier for converting between atomic units and AMA tokens
|
|
24
24
|
*/
|
|
25
25
|
export declare const AMA_TOKEN_DECIMALS_MULTIPLIER: number;
|
|
26
|
+
/**
|
|
27
|
+
* Minimum transferable amount in AMA (1 atomic unit)
|
|
28
|
+
*/
|
|
29
|
+
export declare const MIN_TRANSFERABLE_AMOUNT: number;
|
|
26
30
|
/**
|
|
27
31
|
* Flat network transfer fee in AMA for standard transfers
|
|
28
32
|
*/
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -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,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,kCAAkC,CAAA;AAE3D;;GAEG;AACH,eAAO,MAAM,eAAe,QAAQ,CAAA"}
|
package/dist/constants.js
CHANGED
|
@@ -23,6 +23,10 @@ export const AMA_TOKEN_DECIMALS = 9;
|
|
|
23
23
|
* Multiplier for converting between atomic units and AMA tokens
|
|
24
24
|
*/
|
|
25
25
|
export const AMA_TOKEN_DECIMALS_MULTIPLIER = 10 ** AMA_TOKEN_DECIMALS;
|
|
26
|
+
/**
|
|
27
|
+
* Minimum transferable amount in AMA (1 atomic unit)
|
|
28
|
+
*/
|
|
29
|
+
export const MIN_TRANSFERABLE_AMOUNT = 1 / AMA_TOKEN_DECIMALS_MULTIPLIER;
|
|
26
30
|
/**
|
|
27
31
|
* Flat network transfer fee in AMA for standard transfers
|
|
28
32
|
*/
|
package/dist/constants.js.map
CHANGED
|
@@ -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,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,+BAA+B,CAAA;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAA"}
|
package/dist/conversion.d.ts
CHANGED
|
@@ -20,8 +20,10 @@ 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.
|
|
24
|
+
*
|
|
23
25
|
* @param ama - Human-readable AMA amount
|
|
24
|
-
* @returns Atomic units
|
|
26
|
+
* @returns Atomic units (integer)
|
|
25
27
|
*
|
|
26
28
|
* @example
|
|
27
29
|
* ```ts
|
package/dist/conversion.d.ts.map
CHANGED
|
@@ -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
|
|
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"}
|
package/dist/conversion.js
CHANGED
|
@@ -36,8 +36,10 @@ 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.
|
|
40
|
+
*
|
|
39
41
|
* @param ama - Human-readable AMA amount
|
|
40
|
-
* @returns Atomic units
|
|
42
|
+
* @returns Atomic units (integer)
|
|
41
43
|
*
|
|
42
44
|
* @example
|
|
43
45
|
* ```ts
|
|
@@ -45,6 +47,6 @@ export function fromAtomicAma(atomicAma) {
|
|
|
45
47
|
* ```
|
|
46
48
|
*/
|
|
47
49
|
export function toAtomicAma(ama) {
|
|
48
|
-
return ama * AMA_TOKEN_DECIMALS_MULTIPLIER;
|
|
50
|
+
return Math.trunc(ama * AMA_TOKEN_DECIMALS_MULTIPLIER);
|
|
49
51
|
}
|
|
50
52
|
//# sourceMappingURL=conversion.js.map
|
package/dist/conversion.js.map
CHANGED
|
@@ -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
|
|
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,CAAC,KAAK,CAAC,GAAG,GAAG,6BAA6B,CAAC,CAAA;AACvD,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Explorer URL Utilities
|
|
3
|
+
*
|
|
4
|
+
* This module provides utilities for generating Amadeus explorer URLs.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Types of explorer links
|
|
8
|
+
*/
|
|
9
|
+
export declare enum ExplorerType {
|
|
10
|
+
TRANSACTION = "tx",
|
|
11
|
+
ADDRESS = "address",
|
|
12
|
+
TIP = "tip"
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Constructs an explorer URL for a given type and ID
|
|
16
|
+
*
|
|
17
|
+
* @param type - The type of entity (transaction, address, tip)
|
|
18
|
+
* @param id - The ID/hash/address of the entity
|
|
19
|
+
* @param baseUrl - Optional base explorer URL (defaults to mainnet explorer URL)
|
|
20
|
+
* @returns The full explorer URL
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* makeExplorerUrl(ExplorerType.TRANSACTION, 'abc123')
|
|
25
|
+
* // Returns: "https://explorer.ama.one/network/tx/abc123"
|
|
26
|
+
*
|
|
27
|
+
* makeExplorerUrl(ExplorerType.ADDRESS, 'xyz789', 'https://testnet.explorer.ama.one')
|
|
28
|
+
* // Returns: "https://testnet.explorer.ama.one/network/address/xyz789"
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function makeExplorerUrl(type: ExplorerType, id: string, baseUrl?: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Create a transaction explorer URL
|
|
34
|
+
*
|
|
35
|
+
* @param txHash - Transaction hash
|
|
36
|
+
* @param baseUrl - Optional base explorer URL
|
|
37
|
+
* @returns Transaction explorer URL
|
|
38
|
+
*/
|
|
39
|
+
export declare function makeTransactionUrl(txHash: string, baseUrl?: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Create an address explorer URL
|
|
42
|
+
*
|
|
43
|
+
* @param address - Wallet address
|
|
44
|
+
* @param baseUrl - Optional base explorer URL
|
|
45
|
+
* @returns Address explorer URL
|
|
46
|
+
*/
|
|
47
|
+
export declare function makeAddressUrl(address: string, baseUrl?: string): string;
|
|
48
|
+
//# sourceMappingURL=explorer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explorer.d.ts","sourceRoot":"","sources":["../src/explorer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,oBAAY,YAAY;IACvB,WAAW,OAAO;IAClB,OAAO,YAAY;IACnB,GAAG,QAAQ;CACX;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAGxF;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAExE"}
|
package/dist/explorer.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Explorer URL Utilities
|
|
3
|
+
*
|
|
4
|
+
* This module provides utilities for generating Amadeus explorer URLs.
|
|
5
|
+
*/
|
|
6
|
+
import { NETWORK_EXPLORER_URLS, NetworkType } from './networks';
|
|
7
|
+
/**
|
|
8
|
+
* Types of explorer links
|
|
9
|
+
*/
|
|
10
|
+
export var ExplorerType;
|
|
11
|
+
(function (ExplorerType) {
|
|
12
|
+
ExplorerType["TRANSACTION"] = "tx";
|
|
13
|
+
ExplorerType["ADDRESS"] = "address";
|
|
14
|
+
ExplorerType["TIP"] = "tip";
|
|
15
|
+
})(ExplorerType || (ExplorerType = {}));
|
|
16
|
+
/**
|
|
17
|
+
* Constructs an explorer URL for a given type and ID
|
|
18
|
+
*
|
|
19
|
+
* @param type - The type of entity (transaction, address, tip)
|
|
20
|
+
* @param id - The ID/hash/address of the entity
|
|
21
|
+
* @param baseUrl - Optional base explorer URL (defaults to mainnet explorer URL)
|
|
22
|
+
* @returns The full explorer URL
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* makeExplorerUrl(ExplorerType.TRANSACTION, 'abc123')
|
|
27
|
+
* // Returns: "https://explorer.ama.one/network/tx/abc123"
|
|
28
|
+
*
|
|
29
|
+
* makeExplorerUrl(ExplorerType.ADDRESS, 'xyz789', 'https://testnet.explorer.ama.one')
|
|
30
|
+
* // Returns: "https://testnet.explorer.ama.one/network/address/xyz789"
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export function makeExplorerUrl(type, id, baseUrl) {
|
|
34
|
+
const explorerBase = baseUrl || NETWORK_EXPLORER_URLS[NetworkType.MAINNET];
|
|
35
|
+
return `${explorerBase}/network/${type}/${id}`;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create a transaction explorer URL
|
|
39
|
+
*
|
|
40
|
+
* @param txHash - Transaction hash
|
|
41
|
+
* @param baseUrl - Optional base explorer URL
|
|
42
|
+
* @returns Transaction explorer URL
|
|
43
|
+
*/
|
|
44
|
+
export function makeTransactionUrl(txHash, baseUrl) {
|
|
45
|
+
return makeExplorerUrl(ExplorerType.TRANSACTION, txHash, baseUrl);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create an address explorer URL
|
|
49
|
+
*
|
|
50
|
+
* @param address - Wallet address
|
|
51
|
+
* @param baseUrl - Optional base explorer URL
|
|
52
|
+
* @returns Address explorer URL
|
|
53
|
+
*/
|
|
54
|
+
export function makeAddressUrl(address, baseUrl) {
|
|
55
|
+
return makeExplorerUrl(ExplorerType.ADDRESS, address, baseUrl);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=explorer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explorer.js","sourceRoot":"","sources":["../src/explorer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE/D;;GAEG;AACH,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACvB,kCAAkB,CAAA;IAClB,mCAAmB,CAAA;IACnB,2BAAW,CAAA;AACZ,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,eAAe,CAAC,IAAkB,EAAE,EAAU,EAAE,OAAgB;IAC/E,MAAM,YAAY,GAAG,OAAO,IAAI,qBAAqB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;IAC1E,OAAO,GAAG,YAAY,YAAY,IAAI,IAAI,EAAE,EAAE,CAAA;AAC/C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc,EAAE,OAAgB;IAClE,OAAO,eAAe,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;AAClE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe,EAAE,OAAgB;IAC/D,OAAO,eAAe,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;AAC/D,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatting Utilities
|
|
3
|
+
*
|
|
4
|
+
* This module provides common formatting functions for amounts, addresses, and dates.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Format a number with locale-aware commas and specified decimal places
|
|
8
|
+
*
|
|
9
|
+
* @param num - The number to format
|
|
10
|
+
* @param digits - Maximum fraction digits (default: 8)
|
|
11
|
+
* @returns Formatted number string
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* formatNumber(1234567.89) // "1,234,567.89"
|
|
16
|
+
* formatNumber(1.123456789, 4) // "1.1235"
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function formatNumber(num: number, digits?: number): string;
|
|
20
|
+
/**
|
|
21
|
+
* Format an amount with the AMA suffix
|
|
22
|
+
*
|
|
23
|
+
* @param amount - The amount to format
|
|
24
|
+
* @returns Formatted string like "1,234.56 AMA"
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatAMAAmount(amount: number): string;
|
|
27
|
+
/**
|
|
28
|
+
* Format a balance value with proper AMA token decimals
|
|
29
|
+
*
|
|
30
|
+
* @param amount - The balance amount (string, number, or undefined)
|
|
31
|
+
* @returns Formatted balance string
|
|
32
|
+
*/
|
|
33
|
+
export declare function formatBalance(amount: string | number | undefined): string;
|
|
34
|
+
/**
|
|
35
|
+
* Format balance with privacy mode support
|
|
36
|
+
*
|
|
37
|
+
* @param amount - The balance amount
|
|
38
|
+
* @param hideBalances - Whether to hide the balance
|
|
39
|
+
* @returns Formatted balance or masked string
|
|
40
|
+
*/
|
|
41
|
+
export declare function formatBalanceWithPrivacy(amount: string | number | undefined, hideBalances: boolean): string;
|
|
42
|
+
/**
|
|
43
|
+
* Truncate an address for display (e.g., "abc123...xyz789")
|
|
44
|
+
*
|
|
45
|
+
* @param address - The full address
|
|
46
|
+
* @param chars - Number of characters to show on each side (default: 6)
|
|
47
|
+
* @returns Truncated address string
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* formatShortAddress("abcdefghijklmnopqrstuvwxyz") // "abcdef...uvwxyz"
|
|
52
|
+
* formatShortAddress("abcdefghijklmnopqrstuvwxyz", 4) // "abcd...wxyz"
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function formatShortAddress(address: string, chars?: number): string;
|
|
56
|
+
//# sourceMappingURL=formatters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../src/formatters.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,MAAM,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAYzE;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,EACnC,YAAY,EAAE,OAAO,GACnB,MAAM,CAGR;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,MAAM,CAGrE"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatting Utilities
|
|
3
|
+
*
|
|
4
|
+
* This module provides common formatting functions for amounts, addresses, and dates.
|
|
5
|
+
*/
|
|
6
|
+
import { AMA_TOKEN_DECIMALS } from './constants';
|
|
7
|
+
/**
|
|
8
|
+
* Format a number with locale-aware commas and specified decimal places
|
|
9
|
+
*
|
|
10
|
+
* @param num - The number to format
|
|
11
|
+
* @param digits - Maximum fraction digits (default: 8)
|
|
12
|
+
* @returns Formatted number string
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* formatNumber(1234567.89) // "1,234,567.89"
|
|
17
|
+
* formatNumber(1.123456789, 4) // "1.1235"
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export function formatNumber(num, digits = 8) {
|
|
21
|
+
return num.toLocaleString(undefined, { maximumFractionDigits: digits });
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Format an amount with the AMA suffix
|
|
25
|
+
*
|
|
26
|
+
* @param amount - The amount to format
|
|
27
|
+
* @returns Formatted string like "1,234.56 AMA"
|
|
28
|
+
*/
|
|
29
|
+
export function formatAMAAmount(amount) {
|
|
30
|
+
return `${formatNumber(amount)} AMA`;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Format a balance value with proper AMA token decimals
|
|
34
|
+
*
|
|
35
|
+
* @param amount - The balance amount (string, number, or undefined)
|
|
36
|
+
* @returns Formatted balance string
|
|
37
|
+
*/
|
|
38
|
+
export function formatBalance(amount) {
|
|
39
|
+
if (amount === undefined)
|
|
40
|
+
return '0';
|
|
41
|
+
const num = Number(amount);
|
|
42
|
+
if (!Number.isNaN(num)) {
|
|
43
|
+
return num.toLocaleString(undefined, {
|
|
44
|
+
minimumFractionDigits: 0,
|
|
45
|
+
maximumFractionDigits: AMA_TOKEN_DECIMALS
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return String(amount);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Format balance with privacy mode support
|
|
52
|
+
*
|
|
53
|
+
* @param amount - The balance amount
|
|
54
|
+
* @param hideBalances - Whether to hide the balance
|
|
55
|
+
* @returns Formatted balance or masked string
|
|
56
|
+
*/
|
|
57
|
+
export function formatBalanceWithPrivacy(amount, hideBalances) {
|
|
58
|
+
if (hideBalances)
|
|
59
|
+
return '******';
|
|
60
|
+
return formatBalance(amount);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Truncate an address for display (e.g., "abc123...xyz789")
|
|
64
|
+
*
|
|
65
|
+
* @param address - The full address
|
|
66
|
+
* @param chars - Number of characters to show on each side (default: 6)
|
|
67
|
+
* @returns Truncated address string
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* formatShortAddress("abcdefghijklmnopqrstuvwxyz") // "abcdef...uvwxyz"
|
|
72
|
+
* formatShortAddress("abcdefghijklmnopqrstuvwxyz", 4) // "abcd...wxyz"
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export function formatShortAddress(address, chars = 6) {
|
|
76
|
+
if (!address || address.length <= chars * 2)
|
|
77
|
+
return address || '';
|
|
78
|
+
return `${address.substring(0, chars)}...${address.substring(address.length - chars)}`;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../src/formatters.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEhD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,MAAM,GAAG,CAAC;IACnD,OAAO,GAAG,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,qBAAqB,EAAE,MAAM,EAAE,CAAC,CAAA;AACxE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc;IAC7C,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,CAAA;AACrC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,MAAmC;IAChE,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,GAAG,CAAA;IAEpC,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;IAC1B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,GAAG,CAAC,cAAc,CAAC,SAAS,EAAE;YACpC,qBAAqB,EAAE,CAAC;YACxB,qBAAqB,EAAE,kBAAkB;SACzC,CAAC,CAAA;IACH,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,CAAA;AACtB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CACvC,MAAmC,EACnC,YAAqB;IAErB,IAAI,YAAY;QAAE,OAAO,QAAQ,CAAA;IACjC,OAAO,aAAa,CAAC,MAAM,CAAC,CAAA;AAC7B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe,EAAE,KAAK,GAAG,CAAC;IAC5D,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,OAAO,IAAI,EAAE,CAAA;IACjE,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE,CAAA;AACvF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -35,11 +35,16 @@
|
|
|
35
35
|
*/
|
|
36
36
|
export * from './types';
|
|
37
37
|
export * from './constants';
|
|
38
|
+
export * from './networks';
|
|
38
39
|
export * from './serialization';
|
|
39
40
|
export * from './crypto';
|
|
40
41
|
export * from './conversion';
|
|
41
42
|
export * from './encoding';
|
|
42
43
|
export * from './encryption';
|
|
44
|
+
export * from './validation';
|
|
45
|
+
export * from './formatters';
|
|
46
|
+
export * from './explorer';
|
|
47
|
+
export * from './transaction-errors';
|
|
43
48
|
export * from './transaction-builder';
|
|
44
49
|
export * from './client';
|
|
45
50
|
export * from './api';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA;AACrC,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,OAAO,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,OAAO,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -35,11 +35,16 @@
|
|
|
35
35
|
*/
|
|
36
36
|
export * from './types';
|
|
37
37
|
export * from './constants';
|
|
38
|
+
export * from './networks';
|
|
38
39
|
export * from './serialization';
|
|
39
40
|
export * from './crypto';
|
|
40
41
|
export * from './conversion';
|
|
41
42
|
export * from './encoding';
|
|
42
43
|
export * from './encryption';
|
|
44
|
+
export * from './validation';
|
|
45
|
+
export * from './formatters';
|
|
46
|
+
export * from './explorer';
|
|
47
|
+
export * from './transaction-errors';
|
|
43
48
|
export * from './transaction-builder';
|
|
44
49
|
export * from './client';
|
|
45
50
|
export * from './api';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA;AACrC,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,OAAO,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,OAAO,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Network Configuration
|
|
3
|
+
*
|
|
4
|
+
* This module provides network configuration for Amadeus Protocol networks.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Network types enum
|
|
8
|
+
*/
|
|
9
|
+
export declare enum NetworkType {
|
|
10
|
+
MAINNET = "mainnet",
|
|
11
|
+
TESTNET = "testnet",
|
|
12
|
+
CUSTOM = "custom"
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Network configuration interface
|
|
16
|
+
*/
|
|
17
|
+
export interface NetworkConfig {
|
|
18
|
+
rpcUrl: string;
|
|
19
|
+
explorerUrl: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Network API URLs
|
|
23
|
+
*/
|
|
24
|
+
export declare const NETWORK_URLS: {
|
|
25
|
+
[key in Exclude<NetworkType, NetworkType.CUSTOM>]: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Network Explorer URLs
|
|
29
|
+
*/
|
|
30
|
+
export declare const NETWORK_EXPLORER_URLS: {
|
|
31
|
+
[key in Exclude<NetworkType, NetworkType.CUSTOM>]: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Network configurations (RPC + Explorer)
|
|
35
|
+
*/
|
|
36
|
+
export declare const NETWORK_CONFIGS: {
|
|
37
|
+
[key in Exclude<NetworkType, NetworkType.CUSTOM>]: NetworkConfig;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Testnet Faucet URL
|
|
41
|
+
*/
|
|
42
|
+
export declare const TESTNET_FAUCET_URL = "https://mcp.ama.one/testnet-faucet";
|
|
43
|
+
//# sourceMappingURL=networks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networks.d.ts","sourceRoot":"","sources":["../src/networks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,oBAAY,WAAW;IACtB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,MAAM,WAAW;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;CACnB;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE;KAAG,GAAG,IAAI,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM;CAGrF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE;KAAG,GAAG,IAAI,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM;CAG9F,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE;KAAG,GAAG,IAAI,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,aAAa;CAU9F,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,uCAAuC,CAAA"}
|
package/dist/networks.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Network Configuration
|
|
3
|
+
*
|
|
4
|
+
* This module provides network configuration for Amadeus Protocol networks.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Network types enum
|
|
8
|
+
*/
|
|
9
|
+
export var NetworkType;
|
|
10
|
+
(function (NetworkType) {
|
|
11
|
+
NetworkType["MAINNET"] = "mainnet";
|
|
12
|
+
NetworkType["TESTNET"] = "testnet";
|
|
13
|
+
NetworkType["CUSTOM"] = "custom";
|
|
14
|
+
})(NetworkType || (NetworkType = {}));
|
|
15
|
+
/**
|
|
16
|
+
* Network API URLs
|
|
17
|
+
*/
|
|
18
|
+
export const NETWORK_URLS = {
|
|
19
|
+
[NetworkType.MAINNET]: 'https://nodes.amadeus.bot',
|
|
20
|
+
[NetworkType.TESTNET]: 'https://testnet-rpc.ama.one'
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Network Explorer URLs
|
|
24
|
+
*/
|
|
25
|
+
export const NETWORK_EXPLORER_URLS = {
|
|
26
|
+
[NetworkType.MAINNET]: 'https://explorer.ama.one',
|
|
27
|
+
[NetworkType.TESTNET]: 'https://testnet.explorer.ama.one'
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Network configurations (RPC + Explorer)
|
|
31
|
+
*/
|
|
32
|
+
export const NETWORK_CONFIGS = {
|
|
33
|
+
[NetworkType.MAINNET]: {
|
|
34
|
+
rpcUrl: NETWORK_URLS[NetworkType.MAINNET],
|
|
35
|
+
explorerUrl: NETWORK_EXPLORER_URLS[NetworkType.MAINNET]
|
|
36
|
+
},
|
|
37
|
+
[NetworkType.TESTNET]: {
|
|
38
|
+
rpcUrl: NETWORK_URLS[NetworkType.TESTNET],
|
|
39
|
+
explorerUrl: NETWORK_EXPLORER_URLS[NetworkType.TESTNET]
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Testnet Faucet URL
|
|
44
|
+
*/
|
|
45
|
+
export const TESTNET_FAUCET_URL = 'https://mcp.ama.one/testnet-faucet';
|
|
46
|
+
//# sourceMappingURL=networks.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transaction Error Messages
|
|
3
|
+
*
|
|
4
|
+
* This module provides human-readable error messages for transaction validation
|
|
5
|
+
* and execution errors.
|
|
6
|
+
*/
|
|
7
|
+
import { TransactionExecutionError, TransactionValidationError } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* Human-readable messages for transaction validation errors
|
|
10
|
+
*/
|
|
11
|
+
export declare const TRANSACTION_VALIDATION_ERROR_MESSAGES: Record<TransactionValidationError, string>;
|
|
12
|
+
/**
|
|
13
|
+
* Human-readable messages for transaction execution errors
|
|
14
|
+
*/
|
|
15
|
+
export declare const TRANSACTION_EXECUTION_ERROR_MESSAGES: Record<TransactionExecutionError, string>;
|
|
16
|
+
/**
|
|
17
|
+
* Get a human-readable message for a transaction validation error
|
|
18
|
+
*
|
|
19
|
+
* @param error - The validation error code
|
|
20
|
+
* @returns Human-readable error message
|
|
21
|
+
*/
|
|
22
|
+
export declare function getValidationErrorMessage(error: TransactionValidationError | string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Get a human-readable message for a transaction execution error
|
|
25
|
+
*
|
|
26
|
+
* @param error - The execution error code
|
|
27
|
+
* @returns Human-readable error message
|
|
28
|
+
*/
|
|
29
|
+
export declare function getExecutionErrorMessage(error: TransactionExecutionError | string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Get a human-readable message for any transaction error (validation or execution)
|
|
32
|
+
*
|
|
33
|
+
* @param error - The error code (validation or execution)
|
|
34
|
+
* @returns Human-readable error message
|
|
35
|
+
*/
|
|
36
|
+
export declare function getTransactionErrorMessage(error: TransactionValidationError | TransactionExecutionError | string): string;
|
|
37
|
+
//# sourceMappingURL=transaction-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-errors.d.ts","sourceRoot":"","sources":["../src/transaction-errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAA;AAE/E;;GAEG;AACH,eAAO,MAAM,qCAAqC,EAAE,MAAM,CAAC,0BAA0B,EAAE,MAAM,CAuB5F,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,oCAAoC,EAAE,MAAM,CAAC,yBAAyB,EAAE,MAAM,CAqH1F,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,0BAA0B,GAAG,MAAM,GAAG,MAAM,CAK5F;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,yBAAyB,GAAG,MAAM,GAAG,MAAM,CAK1F;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACzC,KAAK,EAAE,0BAA0B,GAAG,yBAAyB,GAAG,MAAM,GACpE,MAAM,CAWR"}
|