@amadeus-protocol/sdk 1.0.8 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/chain.d.ts +144 -117
- package/dist/api/chain.d.ts.map +1 -1
- package/dist/api/chain.js +175 -146
- package/dist/api/chain.js.map +1 -1
- package/dist/api/contract.d.ts +78 -60
- package/dist/api/contract.d.ts.map +1 -1
- package/dist/api/contract.js +102 -75
- package/dist/api/contract.js.map +1 -1
- package/dist/api/epoch.d.ts +65 -66
- package/dist/api/epoch.d.ts.map +1 -1
- package/dist/api/epoch.js +90 -98
- package/dist/api/epoch.js.map +1 -1
- package/dist/api/peer.d.ts +77 -78
- package/dist/api/peer.d.ts.map +1 -1
- package/dist/api/peer.js +93 -94
- package/dist/api/peer.js.map +1 -1
- package/dist/api/proof.d.ts +44 -23
- package/dist/api/proof.d.ts.map +1 -1
- package/dist/api/proof.js +56 -29
- package/dist/api/proof.js.map +1 -1
- package/dist/api/transaction.d.ts +68 -69
- package/dist/api/transaction.d.ts.map +1 -1
- package/dist/api/transaction.js +84 -84
- package/dist/api/transaction.js.map +1 -1
- package/dist/api/wallet.d.ts +36 -37
- package/dist/api/wallet.d.ts.map +1 -1
- package/dist/api/wallet.js +47 -50
- package/dist/api/wallet.js.map +1 -1
- package/dist/client.d.ts +66 -68
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +231 -276
- package/dist/client.js.map +1 -1
- package/dist/constants.d.ts +13 -10
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +49 -45
- package/dist/constants.js.map +1 -1
- package/dist/contract-state.d.ts +6 -3
- package/dist/contract-state.d.ts.map +1 -1
- package/dist/contract-state.js +88 -106
- package/dist/contract-state.js.map +1 -1
- package/dist/contracts/abi-types.d.ts +32 -32
- package/dist/contracts/abi-types.d.ts.map +1 -1
- package/dist/contracts/coin.d.ts +13 -20
- package/dist/contracts/coin.d.ts.map +1 -1
- package/dist/contracts/coin.js +42 -38
- package/dist/contracts/coin.js.map +1 -1
- package/dist/contracts/contract-call.d.ts +14 -16
- package/dist/contracts/contract-call.d.ts.map +1 -1
- package/dist/contracts/contract-call.js +45 -54
- package/dist/contracts/contract-call.js.map +1 -1
- package/dist/contracts/contract.d.ts +24 -55
- package/dist/contracts/contract.d.ts.map +1 -1
- package/dist/contracts/contract.js +63 -101
- package/dist/contracts/contract.js.map +1 -1
- package/dist/contracts/lockup/abi.d.ts +54 -51
- package/dist/contracts/lockup/abi.d.ts.map +1 -1
- package/dist/contracts/lockup/abi.js +65 -74
- package/dist/contracts/lockup/abi.js.map +1 -1
- package/dist/contracts/lockup/helpers.d.ts +22 -18
- package/dist/contracts/lockup/helpers.d.ts.map +1 -1
- package/dist/contracts/lockup/helpers.js +44 -47
- package/dist/contracts/lockup/helpers.js.map +1 -1
- package/dist/contracts/lockup/parsers.d.ts +7 -3
- package/dist/contracts/lockup/parsers.d.ts.map +1 -1
- package/dist/contracts/lockup/parsers.js +51 -55
- package/dist/contracts/lockup/parsers.js.map +1 -1
- package/dist/contracts/lockup/storage-keys.d.ts +5 -2
- package/dist/contracts/lockup/storage-keys.d.ts.map +1 -1
- package/dist/contracts/lockup/storage-keys.js +54 -70
- package/dist/contracts/lockup/storage-keys.js.map +1 -1
- package/dist/contracts/lockup/types.d.ts +73 -70
- package/dist/contracts/lockup/types.d.ts.map +1 -1
- package/dist/contracts/lockup-prime/abi.d.ts +328 -325
- package/dist/contracts/lockup-prime/abi.d.ts.map +1 -1
- package/dist/contracts/lockup-prime/abi.js +397 -417
- package/dist/contracts/lockup-prime/abi.js.map +1 -1
- package/dist/contracts/lockup-prime/helpers.d.ts +35 -31
- package/dist/contracts/lockup-prime/helpers.d.ts.map +1 -1
- package/dist/contracts/lockup-prime/helpers.js +131 -137
- package/dist/contracts/lockup-prime/helpers.js.map +1 -1
- package/dist/contracts/lockup-prime/parsers.d.ts +9 -5
- package/dist/contracts/lockup-prime/parsers.d.ts.map +1 -1
- package/dist/contracts/lockup-prime/parsers.js +61 -61
- package/dist/contracts/lockup-prime/parsers.js.map +1 -1
- package/dist/contracts/lockup-prime/storage-keys.d.ts +7 -4
- package/dist/contracts/lockup-prime/storage-keys.d.ts.map +1 -1
- package/dist/contracts/lockup-prime/storage-keys.js +64 -80
- package/dist/contracts/lockup-prime/storage-keys.js.map +1 -1
- package/dist/contracts/lockup-prime/types.d.ts +92 -89
- package/dist/contracts/lockup-prime/types.d.ts.map +1 -1
- package/dist/contracts/lockup-prime/types.js +12 -13
- package/dist/contracts/lockup-prime/types.js.map +1 -1
- package/dist/contracts/nft/abi.d.ts +104 -0
- package/dist/contracts/nft/abi.d.ts.map +1 -0
- package/dist/contracts/nft/abi.js +135 -0
- package/dist/contracts/nft/abi.js.map +1 -0
- package/dist/contracts/nft/helpers.d.ts +21 -0
- package/dist/contracts/nft/helpers.d.ts.map +1 -0
- package/dist/contracts/nft/helpers.js +61 -0
- package/dist/contracts/nft/helpers.js.map +1 -0
- package/dist/contracts/nft/types.d.ts +47 -0
- package/dist/contracts/nft/types.d.ts.map +1 -0
- package/dist/conversion.d.ts +5 -2
- package/dist/conversion.d.ts.map +1 -1
- package/dist/conversion.js +45 -50
- package/dist/conversion.js.map +1 -1
- package/dist/crypto.d.ts +14 -16
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +121 -140
- package/dist/crypto.js.map +1 -1
- package/dist/encoding.d.ts +11 -8
- package/dist/encoding.d.ts.map +1 -1
- package/dist/encoding.js +123 -144
- package/dist/encoding.js.map +1 -1
- package/dist/encryption.d.ts +15 -12
- package/dist/encryption.d.ts.map +1 -1
- package/dist/encryption.js +119 -117
- package/dist/encryption.js.map +1 -1
- package/dist/explorer.d.ts +10 -7
- package/dist/explorer.d.ts.map +1 -1
- package/dist/explorer.js +51 -48
- package/dist/explorer.js.map +1 -1
- package/dist/formatters.d.ts +8 -5
- package/dist/formatters.d.ts.map +1 -1
- package/dist/formatters.js +67 -68
- package/dist/formatters.js.map +1 -1
- package/dist/index.d.ts +42 -55
- package/dist/index.js +39 -55
- package/dist/mnemonic.d.ts +12 -9
- package/dist/mnemonic.d.ts.map +1 -1
- package/dist/mnemonic.js +105 -114
- package/dist/mnemonic.js.map +1 -1
- package/dist/networks.d.ts +14 -17
- package/dist/networks.d.ts.map +1 -1
- package/dist/networks.js +40 -36
- package/dist/networks.js.map +1 -1
- package/dist/schemas.js +75 -79
- package/dist/schemas.js.map +1 -1
- package/dist/sdk.d.ts +69 -65
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +126 -117
- package/dist/sdk.js.map +1 -1
- package/dist/serialization.d.ts +8 -18
- package/dist/serialization.d.ts.map +1 -1
- package/dist/serialization.js +207 -260
- package/dist/serialization.js.map +1 -1
- package/dist/signing.js +67 -67
- package/dist/signing.js.map +1 -1
- package/dist/transaction-builder.d.ts +175 -184
- package/dist/transaction-builder.d.ts.map +1 -1
- package/dist/transaction-builder.js +295 -344
- package/dist/transaction-builder.js.map +1 -1
- package/dist/transaction-errors.d.ts +10 -12
- package/dist/transaction-errors.d.ts.map +1 -1
- package/dist/transaction-errors.js +145 -166
- package/dist/transaction-errors.js.map +1 -1
- package/dist/types.d.ts +530 -450
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +169 -183
- package/dist/types.js.map +1 -1
- package/dist/validation.d.ts +24 -26
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +194 -192
- package/dist/validation.js.map +1 -1
- package/package.json +4 -3
- package/dist/api/index.d.ts +0 -8
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/index.js +0 -8
- package/dist/api/index.js.map +0 -1
- package/dist/contracts/abi-types.js +0 -8
- package/dist/contracts/abi-types.js.map +0 -1
- package/dist/contracts/index.d.ts +0 -7
- package/dist/contracts/index.d.ts.map +0 -1
- package/dist/contracts/index.js +0 -7
- package/dist/contracts/index.js.map +0 -1
- package/dist/contracts/lockup/calls.d.ts +0 -23
- package/dist/contracts/lockup/calls.d.ts.map +0 -1
- package/dist/contracts/lockup/calls.js +0 -25
- package/dist/contracts/lockup/calls.js.map +0 -1
- package/dist/contracts/lockup/index.d.ts +0 -6
- package/dist/contracts/lockup/index.d.ts.map +0 -1
- package/dist/contracts/lockup/index.js +0 -6
- package/dist/contracts/lockup/index.js.map +0 -1
- package/dist/contracts/lockup/types.js +0 -7
- package/dist/contracts/lockup/types.js.map +0 -1
- package/dist/contracts/lockup-prime/calls.d.ts +0 -53
- package/dist/contracts/lockup-prime/calls.d.ts.map +0 -1
- package/dist/contracts/lockup-prime/calls.js +0 -60
- package/dist/contracts/lockup-prime/calls.js.map +0 -1
- package/dist/contracts/lockup-prime/index.d.ts +0 -6
- package/dist/contracts/lockup-prime/index.d.ts.map +0 -1
- package/dist/contracts/lockup-prime/index.js +0 -6
- package/dist/contracts/lockup-prime/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/schemas.d.ts +0 -67
- package/dist/schemas.d.ts.map +0 -1
- package/dist/signing.d.ts +0 -39
- package/dist/signing.d.ts.map +0 -1
package/dist/encryption.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption.js","
|
|
1
|
+
{"version":3,"file":"encryption.js","names":[],"sources":["../src/encryption.ts"],"sourcesContent":["/**\n * Password-Based Encryption Utilities\n *\n * Provides secure password-based encryption using PBKDF2 key derivation\n * and AES-GCM encryption. Suitable for encrypting sensitive wallet data.\n */\n\nimport { uint8ArrayToBase64, base64ToUint8Array } from './encoding'\nimport { uint8ArrayToArrayBuffer } from './encoding'\n\n// ============================================================================\n// Constants\n// ============================================================================\n\n/**\n * PBKDF2 iterations for key derivation (100,000 iterations for security)\n * Matches web wallet implementation for consistency\n */\nconst PBKDF2_ITERATIONS = 100_000\n\n/**\n * Salt length in bytes (128 bits)\n */\nconst SALT_LENGTH = 16\n\n/**\n * IV length in bytes for AES-GCM (96 bits)\n */\nconst IV_LENGTH = 12\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\n/**\n * Import password as a PBKDF2 key\n */\nasync function importPbkdf2Key(password: string): Promise<CryptoKey> {\n\tconst enc = new TextEncoder()\n\treturn crypto.subtle.importKey('raw', enc.encode(password), 'PBKDF2', false, ['deriveKey'])\n}\n\n/**\n * Derive a cryptographic key from a password using PBKDF2\n *\n * @param password - Password string\n * @param salt - Salt as Uint8Array or ArrayBuffer\n * @param iterations - Number of PBKDF2 iterations (default: 100,000)\n * @returns Derived AES-GCM key\n */\nexport async function deriveKey(\n\tpassword: string,\n\tsalt: Uint8Array | ArrayBuffer,\n\titerations: number = PBKDF2_ITERATIONS\n): Promise<CryptoKey> {\n\tconst baseKey = await importPbkdf2Key(password)\n\tconst saltBuffer = salt instanceof Uint8Array ? uint8ArrayToArrayBuffer(salt) : salt\n\n\treturn crypto.subtle.deriveKey(\n\t\t{\n\t\t\tname: 'PBKDF2',\n\t\t\tsalt: saltBuffer,\n\t\t\titerations,\n\t\t\thash: 'SHA-256'\n\t\t},\n\t\tbaseKey,\n\t\t{ name: 'AES-GCM', length: 256 },\n\t\tfalse,\n\t\t['encrypt', 'decrypt']\n\t)\n}\n\n// ============================================================================\n// Random Generation\n// ============================================================================\n\n/**\n * Generate a cryptographically secure random salt\n *\n * @returns Random salt (16 bytes)\n */\nexport function generateSalt(): Uint8Array {\n\tconst salt = new Uint8Array(SALT_LENGTH)\n\tcrypto.getRandomValues(salt)\n\treturn salt\n}\n\n/**\n * Generate a cryptographically secure random initialization vector\n *\n * @returns Random IV (12 bytes)\n */\nexport function generateIV(): Uint8Array {\n\tconst iv = new Uint8Array(IV_LENGTH)\n\tcrypto.getRandomValues(iv)\n\treturn iv\n}\n\n// ============================================================================\n// Encryption/Decryption (Base64 encoding for payloads)\n// ============================================================================\n\n/**\n * Encrypted data payload (Base64 encoded)\n *\n * Uses Base64 encoding for binary payloads like vaults (more efficient than Base58).\n * Base58 is reserved for addresses, keys, and hashes.\n */\nexport interface EncryptedPayload {\n\t/** Encrypted data (Base64 encoded) */\n\tencryptedData: string\n\t/** Initialization vector (Base64 encoded) */\n\tiv: string\n\t/** Salt used for key derivation (Base64 encoded) */\n\tsalt: string\n}\n\n/**\n * Encrypt plaintext with a password using AES-GCM\n *\n * Uses PBKDF2 for key derivation and Base64 encoding for output.\n * Suitable for encrypting sensitive wallet data like private keys.\n *\n * **Encoding Standard**: Uses Base64 encoding for binary payloads (RFC 4648).\n * Base58 is used for addresses, keys, and hashes elsewhere in the SDK.\n *\n * @param plaintext - Plaintext string to encrypt\n * @param password - Password for encryption\n * @returns Encrypted payload with encryptedData, IV, and salt (all Base64 encoded)\n *\n * @example\n * ```ts\n * const encrypted = await encryptWithPassword('sensitive data', 'my-password')\n * // Store encrypted.encryptedData, encrypted.iv, encrypted.salt\n * ```\n */\nexport async function encryptWithPassword(\n\tplaintext: string,\n\tpassword: string\n): Promise<EncryptedPayload> {\n\tconst enc = new TextEncoder()\n\tconst iv = generateIV()\n\tconst salt = generateSalt()\n\tconst key = await deriveKey(password, salt)\n\n\tconst ivBuffer = uint8ArrayToArrayBuffer(iv)\n\tconst encryptedBuf = await crypto.subtle.encrypt(\n\t\t{ name: 'AES-GCM', iv: ivBuffer },\n\t\tkey,\n\t\tenc.encode(plaintext)\n\t)\n\n\treturn {\n\t\tencryptedData: uint8ArrayToBase64(new Uint8Array(encryptedBuf)),\n\t\tiv: uint8ArrayToBase64(iv),\n\t\tsalt: uint8ArrayToBase64(salt)\n\t}\n}\n\n/**\n * Decrypt encrypted data with a password\n *\n * @param payload - Encrypted payload (Base64 encoded)\n * @param password - Password used for encryption\n * @returns Decrypted plaintext string\n * @throws {Error} If decryption fails (wrong password or corrupted data)\n *\n * @example\n * ```ts\n * const decrypted = await decryptWithPassword(encrypted, 'my-password')\n * ```\n */\nexport async function decryptWithPassword(\n\tpayload: EncryptedPayload,\n\tpassword: string\n): Promise<string> {\n\tconst dec = new TextDecoder()\n\tconst ivBytes = base64ToUint8Array(payload.iv)\n\tconst saltBytes = base64ToUint8Array(payload.salt)\n\tconst encryptedBytes = base64ToUint8Array(payload.encryptedData)\n\n\tconst key = await deriveKey(password, saltBytes)\n\tconst iv = uint8ArrayToArrayBuffer(ivBytes)\n\tconst encrypted = uint8ArrayToArrayBuffer(encryptedBytes)\n\n\ttry {\n\t\tconst plaintextBuf = await crypto.subtle.decrypt({ name: 'AES-GCM', iv }, key, encrypted)\n\t\treturn dec.decode(plaintextBuf)\n\t} catch {\n\t\tthrow new Error('Decryption failed. Incorrect password or corrupted data.')\n\t}\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAM,oBAAoB;;;;AAK1B,MAAM,cAAc;;;;AAKpB,MAAM,YAAY;;;;AASlB,eAAe,gBAAgB,UAAsC;CACpE,MAAM,MAAM,IAAI,aAAa;CAC7B,OAAO,OAAO,OAAO,UAAU,OAAO,IAAI,OAAO,SAAS,EAAE,UAAU,OAAO,CAAC,YAAY,CAAC;;;;;;;;;;AAW5F,eAAsB,UACrB,UACA,MACA,aAAqB,mBACA;CACrB,MAAM,UAAU,MAAM,gBAAgB,SAAS;CAC/C,MAAM,aAAa,gBAAgB,aAAa,wBAAwB,KAAK,GAAG;CAEhF,OAAO,OAAO,OAAO,UACpB;EACC,MAAM;EACN,MAAM;EACN;EACA,MAAM;EACN,EACD,SACA;EAAE,MAAM;EAAW,QAAQ;EAAK,EAChC,OACA,CAAC,WAAW,UAAU,CACtB;;;;;;;AAYF,SAAgB,eAA2B;CAC1C,MAAM,OAAO,IAAI,WAAW,YAAY;CACxC,OAAO,gBAAgB,KAAK;CAC5B,OAAO;;;;;;;AAQR,SAAgB,aAAyB;CACxC,MAAM,KAAK,IAAI,WAAW,UAAU;CACpC,OAAO,gBAAgB,GAAG;CAC1B,OAAO;;;;;;;;;;;;;;;;;;;;;AAyCR,eAAsB,oBACrB,WACA,UAC4B;CAC5B,MAAM,MAAM,IAAI,aAAa;CAC7B,MAAM,KAAK,YAAY;CACvB,MAAM,OAAO,cAAc;CAC3B,MAAM,MAAM,MAAM,UAAU,UAAU,KAAK;CAE3C,MAAM,WAAW,wBAAwB,GAAG;CAC5C,MAAM,eAAe,MAAM,OAAO,OAAO,QACxC;EAAE,MAAM;EAAW,IAAI;EAAU,EACjC,KACA,IAAI,OAAO,UAAU,CACrB;CAED,OAAO;EACN,eAAe,mBAAmB,IAAI,WAAW,aAAa,CAAC;EAC/D,IAAI,mBAAmB,GAAG;EAC1B,MAAM,mBAAmB,KAAK;EAC9B;;;;;;;;;;;;;;;AAgBF,eAAsB,oBACrB,SACA,UACkB;CAClB,MAAM,MAAM,IAAI,aAAa;CAC7B,MAAM,UAAU,mBAAmB,QAAQ,GAAG;CAC9C,MAAM,YAAY,mBAAmB,QAAQ,KAAK;CAClD,MAAM,iBAAiB,mBAAmB,QAAQ,cAAc;CAEhE,MAAM,MAAM,MAAM,UAAU,UAAU,UAAU;CAChD,MAAM,KAAK,wBAAwB,QAAQ;CAC3C,MAAM,YAAY,wBAAwB,eAAe;CAEzD,IAAI;EACH,MAAM,eAAe,MAAM,OAAO,OAAO,QAAQ;GAAE,MAAM;GAAW;GAAI,EAAE,KAAK,UAAU;EACzF,OAAO,IAAI,OAAO,aAAa;SACxB;EACP,MAAM,IAAI,MAAM,2DAA2D"}
|
package/dist/explorer.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/explorer.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Explorer URL Utilities
|
|
3
4
|
*
|
|
@@ -6,10 +7,10 @@
|
|
|
6
7
|
/**
|
|
7
8
|
* Types of explorer links
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
declare enum ExplorerType {
|
|
11
|
+
TRANSACTION = "tx",
|
|
12
|
+
ADDRESS = "address",
|
|
13
|
+
TIP = "tip"
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* Constructs an explorer URL for a given type and ID
|
|
@@ -28,7 +29,7 @@ export declare enum ExplorerType {
|
|
|
28
29
|
* // Returns: "https://testnet.explorer.ama.one/network/address/xyz789"
|
|
29
30
|
* ```
|
|
30
31
|
*/
|
|
31
|
-
|
|
32
|
+
declare function makeExplorerUrl(type: ExplorerType, id: string, baseUrl?: string): string;
|
|
32
33
|
/**
|
|
33
34
|
* Create a transaction explorer URL
|
|
34
35
|
*
|
|
@@ -36,7 +37,7 @@ export declare function makeExplorerUrl(type: ExplorerType, id: string, baseUrl?
|
|
|
36
37
|
* @param baseUrl - Optional base explorer URL
|
|
37
38
|
* @returns Transaction explorer URL
|
|
38
39
|
*/
|
|
39
|
-
|
|
40
|
+
declare function makeTransactionUrl(txHash: string, baseUrl?: string): string;
|
|
40
41
|
/**
|
|
41
42
|
* Create an address explorer URL
|
|
42
43
|
*
|
|
@@ -44,5 +45,7 @@ export declare function makeTransactionUrl(txHash: string, baseUrl?: string): st
|
|
|
44
45
|
* @param baseUrl - Optional base explorer URL
|
|
45
46
|
* @returns Address explorer URL
|
|
46
47
|
*/
|
|
47
|
-
|
|
48
|
+
declare function makeAddressUrl(address: string, baseUrl?: string): string;
|
|
49
|
+
//#endregion
|
|
50
|
+
export { ExplorerType, makeAddressUrl, makeExplorerUrl, makeTransactionUrl };
|
|
48
51
|
//# sourceMappingURL=explorer.d.ts.map
|
package/dist/explorer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explorer.d.ts","
|
|
1
|
+
{"version":3,"file":"explorer.d.ts","names":[],"sources":["../src/explorer.ts"],"mappings":";;AAWA;;;;;;;aAAY,YAAA;EACX,WAAA;EACA,OAAA;EACA,GAAA;AAAA;;;;;;;;AAgCD;;;;;AAWA;;;;;iBAvBgB,eAAA,CAAgB,IAAA,EAAM,YAAA,EAAc,EAAA,UAAY,OAAA;;;;;;;;iBAYhD,kBAAA,CAAmB,MAAA,UAAgB,OAAA;;;;;;;;iBAWnC,cAAA,CAAe,OAAA,UAAiB,OAAA"}
|
package/dist/explorer.js
CHANGED
|
@@ -1,57 +1,60 @@
|
|
|
1
|
+
import { NETWORK_EXPLORER_URLS } from "./networks.js";
|
|
2
|
+
//#region src/explorer.ts
|
|
1
3
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { NETWORK_EXPLORER_URLS, NetworkType } from './networks';
|
|
4
|
+
* Explorer URL Utilities
|
|
5
|
+
*
|
|
6
|
+
* This module provides utilities for generating Amadeus explorer URLs.
|
|
7
|
+
*/
|
|
7
8
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
9
|
+
* Types of explorer links
|
|
10
|
+
*/
|
|
11
|
+
let ExplorerType = /* @__PURE__ */ function(ExplorerType) {
|
|
12
|
+
ExplorerType["TRANSACTION"] = "tx";
|
|
13
|
+
ExplorerType["ADDRESS"] = "address";
|
|
14
|
+
ExplorerType["TIP"] = "tip";
|
|
15
|
+
return ExplorerType;
|
|
16
|
+
}({});
|
|
16
17
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return `${explorerBase}/network/${type}/${id}`;
|
|
18
|
+
* Constructs an explorer URL for a given type and ID
|
|
19
|
+
*
|
|
20
|
+
* @param type - The type of entity (transaction, address, tip)
|
|
21
|
+
* @param id - The ID/hash/address of the entity
|
|
22
|
+
* @param baseUrl - Optional base explorer URL (defaults to mainnet explorer URL)
|
|
23
|
+
* @returns The full explorer URL
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* makeExplorerUrl(ExplorerType.TRANSACTION, 'abc123')
|
|
28
|
+
* // Returns: "https://explorer.ama.one/network/tx/abc123"
|
|
29
|
+
*
|
|
30
|
+
* makeExplorerUrl(ExplorerType.ADDRESS, 'xyz789', 'https://testnet.explorer.ama.one')
|
|
31
|
+
* // Returns: "https://testnet.explorer.ama.one/network/address/xyz789"
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
function makeExplorerUrl(type, id, baseUrl) {
|
|
35
|
+
return `${baseUrl || NETWORK_EXPLORER_URLS["mainnet"]}/network/${type}/${id}`;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
+
function makeTransactionUrl(txHash, baseUrl) {
|
|
45
|
+
return makeExplorerUrl("tx", txHash, baseUrl);
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
+
function makeAddressUrl(address, baseUrl) {
|
|
55
|
+
return makeExplorerUrl("address", address, baseUrl);
|
|
56
56
|
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { ExplorerType, makeAddressUrl, makeExplorerUrl, makeTransactionUrl };
|
|
59
|
+
|
|
57
60
|
//# sourceMappingURL=explorer.js.map
|
package/dist/explorer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explorer.js","
|
|
1
|
+
{"version":3,"file":"explorer.js","names":[],"sources":["../src/explorer.ts"],"sourcesContent":["/**\n * Explorer URL Utilities\n *\n * This module provides utilities for generating Amadeus explorer URLs.\n */\n\nimport { NETWORK_EXPLORER_URLS, NetworkType } from './networks'\n\n/**\n * Types of explorer links\n */\nexport enum ExplorerType {\n\tTRANSACTION = 'tx',\n\tADDRESS = 'address',\n\tTIP = 'tip'\n}\n\n/**\n * Constructs an explorer URL for a given type and ID\n *\n * @param type - The type of entity (transaction, address, tip)\n * @param id - The ID/hash/address of the entity\n * @param baseUrl - Optional base explorer URL (defaults to mainnet explorer URL)\n * @returns The full explorer URL\n *\n * @example\n * ```ts\n * makeExplorerUrl(ExplorerType.TRANSACTION, 'abc123')\n * // Returns: \"https://explorer.ama.one/network/tx/abc123\"\n *\n * makeExplorerUrl(ExplorerType.ADDRESS, 'xyz789', 'https://testnet.explorer.ama.one')\n * // Returns: \"https://testnet.explorer.ama.one/network/address/xyz789\"\n * ```\n */\nexport function makeExplorerUrl(type: ExplorerType, id: string, baseUrl?: string): string {\n\tconst explorerBase = baseUrl || NETWORK_EXPLORER_URLS[NetworkType.MAINNET]\n\treturn `${explorerBase}/network/${type}/${id}`\n}\n\n/**\n * Create a transaction explorer URL\n *\n * @param txHash - Transaction hash\n * @param baseUrl - Optional base explorer URL\n * @returns Transaction explorer URL\n */\nexport function makeTransactionUrl(txHash: string, baseUrl?: string): string {\n\treturn makeExplorerUrl(ExplorerType.TRANSACTION, txHash, baseUrl)\n}\n\n/**\n * Create an address explorer URL\n *\n * @param address - Wallet address\n * @param baseUrl - Optional base explorer URL\n * @returns Address explorer URL\n */\nexport function makeAddressUrl(address: string, baseUrl?: string): string {\n\treturn makeExplorerUrl(ExplorerType.ADDRESS, address, baseUrl)\n}\n"],"mappings":";;;;;;;;;;AAWA,IAAY,eAAL,yBAAA,cAAA;CACN,aAAA,iBAAA;CACA,aAAA,aAAA;CACA,aAAA,SAAA;;KACA;;;;;;;;;;;;;;;;;;AAmBD,SAAgB,gBAAgB,MAAoB,IAAY,SAA0B;CAEzF,OAAO,GADc,WAAW,sBAAA,WACT,WAAW,KAAK,GAAG;;;;;;;;;AAU3C,SAAgB,mBAAmB,QAAgB,SAA0B;CAC5E,OAAO,gBAAA,MAA0C,QAAQ,QAAQ;;;;;;;;;AAUlE,SAAgB,eAAe,SAAiB,SAA0B;CACzE,OAAO,gBAAA,WAAsC,SAAS,QAAQ"}
|
package/dist/formatters.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/formatters.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Formatting Utilities
|
|
3
4
|
*
|
|
@@ -16,21 +17,21 @@
|
|
|
16
17
|
* formatNumber(1.123456789, 4) // "1.1235"
|
|
17
18
|
* ```
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
|
+
declare function formatNumber(num: number, digits?: number): string;
|
|
20
21
|
/**
|
|
21
22
|
* Format an amount with the AMA suffix
|
|
22
23
|
*
|
|
23
24
|
* @param amount - The amount to format
|
|
24
25
|
* @returns Formatted string like "1,234.56 AMA"
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
|
+
declare function formatAMAAmount(amount: number): string;
|
|
27
28
|
/**
|
|
28
29
|
* Format a balance value with proper AMA token decimals
|
|
29
30
|
*
|
|
30
31
|
* @param amount - The balance amount (string, number, or undefined)
|
|
31
32
|
* @returns Formatted balance string
|
|
32
33
|
*/
|
|
33
|
-
|
|
34
|
+
declare function formatBalance(amount: string | number | undefined): string;
|
|
34
35
|
/**
|
|
35
36
|
* Format balance with privacy mode support
|
|
36
37
|
*
|
|
@@ -38,7 +39,7 @@ export declare function formatBalance(amount: string | number | undefined): stri
|
|
|
38
39
|
* @param hideBalances - Whether to hide the balance
|
|
39
40
|
* @returns Formatted balance or masked string
|
|
40
41
|
*/
|
|
41
|
-
|
|
42
|
+
declare function formatBalanceWithPrivacy(amount: string | number | undefined, hideBalances: boolean): string;
|
|
42
43
|
/**
|
|
43
44
|
* Truncate an address for display (e.g., "abc123...xyz789")
|
|
44
45
|
*
|
|
@@ -52,5 +53,7 @@ export declare function formatBalanceWithPrivacy(amount: string | number | undef
|
|
|
52
53
|
* formatShortAddress("abcdefghijklmnopqrstuvwxyz", 4) // "abcd...wxyz"
|
|
53
54
|
* ```
|
|
54
55
|
*/
|
|
55
|
-
|
|
56
|
+
declare function formatShortAddress(address: string, chars?: number): string;
|
|
57
|
+
//#endregion
|
|
58
|
+
export { formatAMAAmount, formatBalance, formatBalanceWithPrivacy, formatNumber, formatShortAddress };
|
|
56
59
|
//# sourceMappingURL=formatters.d.ts.map
|
package/dist/formatters.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.d.ts","
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","names":[],"sources":["../src/formatters.ts"],"mappings":";;AAqBA;;;;;AAUA;;;;;AAUA;;;;;AAqBA;;iBAzCgB,YAAA,CAAa,GAAA,UAAa,MAAA;;;AA8D1C;;;;iBApDgB,eAAA,CAAgB,MAAA;;;;;;;iBAUhB,aAAA,CAAc,MAAA;;;;;;;;iBAqBd,wBAAA,CACf,MAAA,+BACA,YAAA;;;;;;;;;;;;;;iBAmBe,kBAAA,CAAmB,OAAA,UAAiB,KAAA"}
|
package/dist/formatters.js
CHANGED
|
@@ -1,80 +1,79 @@
|
|
|
1
|
+
import "./constants.js";
|
|
2
|
+
//#region src/formatters.ts
|
|
1
3
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { AMA_TOKEN_DECIMALS } from './constants';
|
|
4
|
+
* Formatting Utilities
|
|
5
|
+
*
|
|
6
|
+
* This module provides common formatting functions for amounts, addresses, and dates.
|
|
7
|
+
*/
|
|
7
8
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
* Format a number with locale-aware commas and specified decimal places
|
|
10
|
+
*
|
|
11
|
+
* @param num - The number to format
|
|
12
|
+
* @param digits - Maximum fraction digits (default: AMA_TOKEN_DECIMALS)
|
|
13
|
+
* @returns Formatted number string
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* formatNumber(1234567.89) // "1,234,567.89"
|
|
18
|
+
* formatNumber(1.123456789, 4) // "1.1235"
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
function formatNumber(num, digits = 9) {
|
|
22
|
+
return num.toLocaleString(void 0, { maximumFractionDigits: digits });
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
* Format an amount with the AMA suffix
|
|
26
|
+
*
|
|
27
|
+
* @param amount - The amount to format
|
|
28
|
+
* @returns Formatted string like "1,234.56 AMA"
|
|
29
|
+
*/
|
|
30
|
+
function formatAMAAmount(amount) {
|
|
31
|
+
return `${formatNumber(amount)} AMA`;
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
return String(amount);
|
|
34
|
+
* Format a balance value with proper AMA token decimals
|
|
35
|
+
*
|
|
36
|
+
* @param amount - The balance amount (string, number, or undefined)
|
|
37
|
+
* @returns Formatted balance string
|
|
38
|
+
*/
|
|
39
|
+
function formatBalance(amount) {
|
|
40
|
+
if (amount === void 0) return "0";
|
|
41
|
+
const num = Number(amount);
|
|
42
|
+
if (!Number.isNaN(num)) return num.toLocaleString(void 0, {
|
|
43
|
+
minimumFractionDigits: 0,
|
|
44
|
+
maximumFractionDigits: 9
|
|
45
|
+
});
|
|
46
|
+
return String(amount);
|
|
49
47
|
}
|
|
50
48
|
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return formatBalance(amount);
|
|
49
|
+
* Format balance with privacy mode support
|
|
50
|
+
*
|
|
51
|
+
* @param amount - The balance amount
|
|
52
|
+
* @param hideBalances - Whether to hide the balance
|
|
53
|
+
* @returns Formatted balance or masked string
|
|
54
|
+
*/
|
|
55
|
+
function formatBalanceWithPrivacy(amount, hideBalances) {
|
|
56
|
+
if (hideBalances) return "******";
|
|
57
|
+
return formatBalance(amount);
|
|
61
58
|
}
|
|
62
59
|
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return `${address.substring(0, chars)}...${address.substring(address.length - chars)}`;
|
|
60
|
+
* Truncate an address for display (e.g., "abc123...xyz789")
|
|
61
|
+
*
|
|
62
|
+
* @param address - The full address
|
|
63
|
+
* @param chars - Number of characters to show on each side (default: 6)
|
|
64
|
+
* @returns Truncated address string
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* formatShortAddress("abcdefghijklmnopqrstuvwxyz") // "abcdef...uvwxyz"
|
|
69
|
+
* formatShortAddress("abcdefghijklmnopqrstuvwxyz", 4) // "abcd...wxyz"
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
function formatShortAddress(address, chars = 6) {
|
|
73
|
+
if (!address || address.length <= chars * 2) return address || "";
|
|
74
|
+
return `${address.substring(0, chars)}...${address.substring(address.length - chars)}`;
|
|
79
75
|
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { formatAMAAmount, formatBalance, formatBalanceWithPrivacy, formatNumber, formatShortAddress };
|
|
78
|
+
|
|
80
79
|
//# sourceMappingURL=formatters.js.map
|
package/dist/formatters.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","
|
|
1
|
+
{"version":3,"file":"formatters.js","names":[],"sources":["../src/formatters.ts"],"sourcesContent":["/**\n * Formatting Utilities\n *\n * This module provides common formatting functions for amounts, addresses, and dates.\n */\n\nimport { AMA_TOKEN_DECIMALS } from './constants'\n\n/**\n * Format a number with locale-aware commas and specified decimal places\n *\n * @param num - The number to format\n * @param digits - Maximum fraction digits (default: AMA_TOKEN_DECIMALS)\n * @returns Formatted number string\n *\n * @example\n * ```ts\n * formatNumber(1234567.89) // \"1,234,567.89\"\n * formatNumber(1.123456789, 4) // \"1.1235\"\n * ```\n */\nexport function formatNumber(num: number, digits = AMA_TOKEN_DECIMALS): string {\n\treturn num.toLocaleString(undefined, { maximumFractionDigits: digits })\n}\n\n/**\n * Format an amount with the AMA suffix\n *\n * @param amount - The amount to format\n * @returns Formatted string like \"1,234.56 AMA\"\n */\nexport function formatAMAAmount(amount: number): string {\n\treturn `${formatNumber(amount)} AMA`\n}\n\n/**\n * Format a balance value with proper AMA token decimals\n *\n * @param amount - The balance amount (string, number, or undefined)\n * @returns Formatted balance string\n */\nexport function formatBalance(amount: string | number | undefined): string {\n\tif (amount === undefined) return '0'\n\n\tconst num = Number(amount)\n\tif (!Number.isNaN(num)) {\n\t\treturn num.toLocaleString(undefined, {\n\t\t\tminimumFractionDigits: 0,\n\t\t\tmaximumFractionDigits: AMA_TOKEN_DECIMALS\n\t\t})\n\t}\n\n\treturn String(amount)\n}\n\n/**\n * Format balance with privacy mode support\n *\n * @param amount - The balance amount\n * @param hideBalances - Whether to hide the balance\n * @returns Formatted balance or masked string\n */\nexport function formatBalanceWithPrivacy(\n\tamount: string | number | undefined,\n\thideBalances: boolean\n): string {\n\tif (hideBalances) return '******'\n\treturn formatBalance(amount)\n}\n\n/**\n * Truncate an address for display (e.g., \"abc123...xyz789\")\n *\n * @param address - The full address\n * @param chars - Number of characters to show on each side (default: 6)\n * @returns Truncated address string\n *\n * @example\n * ```ts\n * formatShortAddress(\"abcdefghijklmnopqrstuvwxyz\") // \"abcdef...uvwxyz\"\n * formatShortAddress(\"abcdefghijklmnopqrstuvwxyz\", 4) // \"abcd...wxyz\"\n * ```\n */\nexport function formatShortAddress(address: string, chars = 6): string {\n\tif (!address || address.length <= chars * 2) return address || ''\n\treturn `${address.substring(0, chars)}...${address.substring(address.length - chars)}`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,aAAa,KAAa,SAAA,GAAqC;CAC9E,OAAO,IAAI,eAAe,KAAA,GAAW,EAAE,uBAAuB,QAAQ,CAAC;;;;;;;;AASxE,SAAgB,gBAAgB,QAAwB;CACvD,OAAO,GAAG,aAAa,OAAO,CAAC;;;;;;;;AAShC,SAAgB,cAAc,QAA6C;CAC1E,IAAI,WAAW,KAAA,GAAW,OAAO;CAEjC,MAAM,MAAM,OAAO,OAAO;CAC1B,IAAI,CAAC,OAAO,MAAM,IAAI,EACrB,OAAO,IAAI,eAAe,KAAA,GAAW;EACpC,uBAAuB;EACvB,uBAAA;EACA,CAAC;CAGH,OAAO,OAAO,OAAO;;;;;;;;;AAUtB,SAAgB,yBACf,QACA,cACS;CACT,IAAI,cAAc,OAAO;CACzB,OAAO,cAAc,OAAO;;;;;;;;;;;;;;;AAgB7B,SAAgB,mBAAmB,SAAiB,QAAQ,GAAW;CACtE,IAAI,CAAC,WAAW,QAAQ,UAAU,QAAQ,GAAG,OAAO,WAAW;CAC/D,OAAO,GAAG,QAAQ,UAAU,GAAG,MAAM,CAAC,KAAK,QAAQ,UAAU,QAAQ,SAAS,MAAM"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,55 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
export
|
|
43
|
-
export * from './encoding';
|
|
44
|
-
export * from './encryption';
|
|
45
|
-
export * from './mnemonic';
|
|
46
|
-
export * from './validation';
|
|
47
|
-
export * from './formatters';
|
|
48
|
-
export * from './explorer';
|
|
49
|
-
export * from './transaction-errors';
|
|
50
|
-
export * from './transaction-builder';
|
|
51
|
-
export * from './client';
|
|
52
|
-
export * from './api';
|
|
53
|
-
export * from './sdk';
|
|
54
|
-
export * from './contracts';
|
|
55
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
import { ANRInfo, AmadeusSDKConfig, AmadeusSDKError, ApiResponse, BuildTransactionResult, ChainEntry, ChainEntryHeader, ChainKpi, ChainStats, Contract, ContractData, ContractDataValue, ContractFunction, ContractStateProof, ContractViewParams, ContractViewResponse, DecodedValue, EmissionAddress, EpochScore, EpochScoreAll, EpochScoreSingle, GetANRByPkResponse, GetANRsResponse, GetAllBalancesResponse, GetByHashResponse, GetByHeightResponse, GetEmissionAddressResponse, GetKpiResponse, GetNodesResponse, GetRemovedTrainersResponse, GetRichlistResponse, GetSolInEpochResponse, GetStatsResponse, GetTipResponse, GetTokenBalanceQuery, GetTokenBalanceResponse, GetTrainersResponse, GetTransactionEventsByAccountResponse, GetTransactionsInEntryResponse, GetWalletTransactionsQuery, GetWalletTransactionsResponse, KeyPair, LockupPrimeDailyCheckinInput, LockupPrimeLockInput, LockupPrimeUnlockInput, LockupUnlockInput, PeerInfo, ProofValidators, RichlistEntry, SerializableValue, SubmitAndWaitOptions, SubmitAndWaitTransactionResponse, SubmitTransactionRequestQuery, SubmitTransactionResponse, TokenBalance, Transaction, TransactionAction, TransactionActionBody, TransactionActionResponse, TransactionBody, TransactionEvent, TransactionEventType, TransactionExecutionError, TransactionFilters, TransactionMetadata, TransactionPacked, TransactionReceipt, TransactionResult, TransactionUnpacked, TransactionValidationError, TransactionValidationResult, TransferTransactionInput, TxByFilterParams, TxByFilterResponse, UnsignedTransaction, UnsignedTransactionWithHash, ValidateBytecodeResponse, ValidatorProofData, ValidatorProofNode, WalletBalance, WalletBalances } from "./types.js";
|
|
2
|
+
import { AMADEUS_PUBLIC_KEY_BYTE_LENGTH, AMADEUS_SEED_BYTE_LENGTH, AMA_TOKEN_DECIMALS, AMA_TOKEN_DECIMALS_MULTIPLIER, AMA_TRANSFER_FEE, DEFAULT_TIMEOUT, EXPLORER_URL, MIN_TRANSFERABLE_AMOUNT, NODE_API_URL, SDK_VERSION } from "./constants.js";
|
|
3
|
+
import { NETWORK_CONFIGS, NETWORK_EXPLORER_URLS, NETWORK_URLS, NetworkConfig, NetworkType, TESTNET_FAUCET_URL } from "./networks.js";
|
|
4
|
+
import { decode, decodeContractState, encode } from "./serialization.js";
|
|
5
|
+
import { decodeContractStateToBase64, parseStateNumber, parseStateString } from "./contract-state.js";
|
|
6
|
+
import { derivePublicKeyFromSeedBase58, deriveSkAndSeed64FromBase58Seed, generateKeypair, generatePrivateKey, getPublicKey, reduce512To256LE, seed64ToKeypair } from "./crypto.js";
|
|
7
|
+
import { fromAtomicAma, toAtomicAma } from "./conversion.js";
|
|
8
|
+
import { arrayBufferToBase64, arrayBufferToUint8Array, base64ToArrayBuffer, base64ToUint8Array, fromBase58, toBase58, uint8ArrayToArrayBuffer, uint8ArrayToBase64 } from "./encoding.js";
|
|
9
|
+
import { EncryptedPayload, decryptWithPassword, deriveKey, encryptWithPassword, generateIV, generateSalt } from "./encryption.js";
|
|
10
|
+
import { VaultSecretData, decodeVaultSecret, detectInputType, encodeVaultSecret, generateMnemonic, mnemonicToSeedBase58, validateMnemonic } from "./mnemonic.js";
|
|
11
|
+
import { ValidationResult, isValidAddress, isValidAmount, isValidSeed, validate, validateAddress, validateAmount, validatePassword, validateSeed, validateTokenSymbol } from "./validation.js";
|
|
12
|
+
import { formatAMAAmount, formatBalance, formatBalanceWithPrivacy, formatNumber, formatShortAddress } from "./formatters.js";
|
|
13
|
+
import { ExplorerType, makeAddressUrl, makeExplorerUrl, makeTransactionUrl } from "./explorer.js";
|
|
14
|
+
import { TRANSACTION_EXECUTION_ERROR_MESSAGES, TRANSACTION_VALIDATION_ERROR_MESSAGES, getExecutionErrorMessage, getTransactionErrorMessage, getValidationErrorMessage } from "./transaction-errors.js";
|
|
15
|
+
import { AbiDefinition, AbiFunction, AbiInput, ExtractContractName, ExtractFunctionNames, FunctionParams } from "./contracts/abi-types.js";
|
|
16
|
+
import { ContractCall, buildContractCall } from "./contracts/contract-call.js";
|
|
17
|
+
import { SignedContract, TypedContract, createContract } from "./contracts/contract.js";
|
|
18
|
+
import { NftCreateCollectionInput, NftCreateCollectionParams, NftMintInput, NftMintParams, NftTransferInput, NftTransferParams } from "./contracts/nft/types.js";
|
|
19
|
+
import { TransactionBuilder } from "./transaction-builder.js";
|
|
20
|
+
import { AmadeusClient } from "./client.js";
|
|
21
|
+
import { ChainAPI } from "./api/chain.js";
|
|
22
|
+
import { ContractAPI } from "./api/contract.js";
|
|
23
|
+
import { EpochAPI } from "./api/epoch.js";
|
|
24
|
+
import { PeerAPI } from "./api/peer.js";
|
|
25
|
+
import { ProofAPI } from "./api/proof.js";
|
|
26
|
+
import { TransactionAPI } from "./api/transaction.js";
|
|
27
|
+
import { WalletAPI } from "./api/wallet.js";
|
|
28
|
+
import { AmadeusSDK } from "./sdk.js";
|
|
29
|
+
import { CoinTransferParams, buildCoinTransfer } from "./contracts/coin.js";
|
|
30
|
+
import { LOCKUP_PRIME_ABI } from "./contracts/lockup-prime/abi.js";
|
|
31
|
+
import { LOCKUP_PRIME_TIER_KEYS, LockupPrimeAbiConstant, LockupPrimeAbiError, LockupPrimeAbiFunction, LockupPrimeAbiInput, LockupPrimeAbiOutput, LockupPrimeAbiStorage, LockupPrimeAbiStorageKey, LockupPrimeAbiStorageRead, LockupPrimeAbiStorageWrite, LockupPrimeTierKey, LockupPrimeVault, LockupPrimeVaultSchema, LockupTier, LockupTiersSchema, RawLockupPrimeVaultData, isValidLockupPrimeTierKey } from "./contracts/lockup-prime/types.js";
|
|
32
|
+
import { LockupPrime, RATE_MAP } from "./contracts/lockup-prime/helpers.js";
|
|
33
|
+
import { parseContractStateNumber, parseRawVaultData, parseVaultData } from "./contracts/lockup-prime/parsers.js";
|
|
34
|
+
import { buildDailyStreakKey, buildLockupPrimeVaultKeyPrefix, buildNextCheckinEpochKey, extractLockupPrimeVaultIndexFromKey } from "./contracts/lockup-prime/storage-keys.js";
|
|
35
|
+
import { LOCKUP_ABI } from "./contracts/lockup/abi.js";
|
|
36
|
+
import { LockupAbiError, LockupAbiFunction, LockupAbiInput, LockupAbiOutput, LockupAbiStorage, LockupAbiStorageKey, LockupAbiStorageRead, LockupAbiStorageWrite, LockupVault, LockupVaultSchema, RawLockupVaultData } from "./contracts/lockup/types.js";
|
|
37
|
+
import { Lockup } from "./contracts/lockup/helpers.js";
|
|
38
|
+
import { parseLockupVaultData, parseRawLockupVaultData } from "./contracts/lockup/parsers.js";
|
|
39
|
+
import { buildLockupVaultKeyPrefix, extractLockupVaultIndexFromKey } from "./contracts/lockup/storage-keys.js";
|
|
40
|
+
import { NFT_ABI } from "./contracts/nft/abi.js";
|
|
41
|
+
import { buildNftCreateCollection, buildNftMint, buildNftTransfer } from "./contracts/nft/helpers.js";
|
|
42
|
+
export { AMADEUS_PUBLIC_KEY_BYTE_LENGTH, AMADEUS_SEED_BYTE_LENGTH, AMA_TOKEN_DECIMALS, AMA_TOKEN_DECIMALS_MULTIPLIER, AMA_TRANSFER_FEE, ANRInfo, AbiDefinition, AbiFunction, AbiInput, AmadeusClient, AmadeusSDK, AmadeusSDKConfig, AmadeusSDKError, ApiResponse, BuildTransactionResult, ChainAPI, ChainEntry, ChainEntryHeader, ChainKpi, ChainStats, CoinTransferParams, Contract, ContractAPI, ContractCall, ContractData, ContractDataValue, ContractFunction, ContractStateProof, ContractViewParams, ContractViewResponse, DEFAULT_TIMEOUT, DecodedValue, EXPLORER_URL, EmissionAddress, EncryptedPayload, EpochAPI, EpochScore, EpochScoreAll, EpochScoreSingle, ExplorerType, ExtractContractName, ExtractFunctionNames, FunctionParams, GetANRByPkResponse, GetANRsResponse, GetAllBalancesResponse, GetByHashResponse, GetByHeightResponse, GetEmissionAddressResponse, GetKpiResponse, GetNodesResponse, GetRemovedTrainersResponse, GetRichlistResponse, GetSolInEpochResponse, GetStatsResponse, GetTipResponse, GetTokenBalanceQuery, GetTokenBalanceResponse, GetTrainersResponse, GetTransactionEventsByAccountResponse, GetTransactionsInEntryResponse, GetWalletTransactionsQuery, GetWalletTransactionsResponse, KeyPair, LOCKUP_ABI, LOCKUP_PRIME_ABI, LOCKUP_PRIME_TIER_KEYS, Lockup, LockupAbiError, LockupAbiFunction, LockupAbiInput, LockupAbiOutput, LockupAbiStorage, LockupAbiStorageKey, LockupAbiStorageRead, LockupAbiStorageWrite, LockupPrime, LockupPrimeAbiConstant, LockupPrimeAbiError, LockupPrimeAbiFunction, LockupPrimeAbiInput, LockupPrimeAbiOutput, LockupPrimeAbiStorage, LockupPrimeAbiStorageKey, LockupPrimeAbiStorageRead, LockupPrimeAbiStorageWrite, LockupPrimeDailyCheckinInput, LockupPrimeLockInput, LockupPrimeTierKey, LockupPrimeUnlockInput, LockupPrimeVault, LockupPrimeVaultSchema, LockupTier, LockupTiersSchema, LockupUnlockInput, LockupVault, LockupVaultSchema, MIN_TRANSFERABLE_AMOUNT, NETWORK_CONFIGS, NETWORK_EXPLORER_URLS, NETWORK_URLS, NFT_ABI, NODE_API_URL, NetworkConfig, NetworkType, NftCreateCollectionInput, NftCreateCollectionParams, NftMintInput, NftMintParams, NftTransferInput, NftTransferParams, PeerAPI, PeerInfo, ProofAPI, ProofValidators, RATE_MAP, RawLockupPrimeVaultData, RawLockupVaultData, RichlistEntry, SDK_VERSION, SerializableValue, SignedContract, SubmitAndWaitOptions, SubmitAndWaitTransactionResponse, SubmitTransactionRequestQuery, SubmitTransactionResponse, TESTNET_FAUCET_URL, TRANSACTION_EXECUTION_ERROR_MESSAGES, TRANSACTION_VALIDATION_ERROR_MESSAGES, TokenBalance, Transaction, TransactionAPI, TransactionAction, TransactionActionBody, TransactionActionResponse, TransactionBody, TransactionBuilder, TransactionEvent, TransactionEventType, TransactionExecutionError, TransactionFilters, TransactionMetadata, TransactionPacked, TransactionReceipt, TransactionResult, TransactionUnpacked, TransactionValidationError, TransactionValidationResult, TransferTransactionInput, TxByFilterParams, TxByFilterResponse, TypedContract, UnsignedTransaction, UnsignedTransactionWithHash, ValidateBytecodeResponse, ValidationResult, ValidatorProofData, ValidatorProofNode, VaultSecretData, WalletAPI, WalletBalance, WalletBalances, arrayBufferToBase64, arrayBufferToUint8Array, base64ToArrayBuffer, base64ToUint8Array, buildCoinTransfer, buildContractCall, buildDailyStreakKey, buildLockupPrimeVaultKeyPrefix, buildLockupVaultKeyPrefix, buildNextCheckinEpochKey, buildNftCreateCollection, buildNftMint, buildNftTransfer, createContract, decode, decodeContractState, decodeContractStateToBase64, decodeVaultSecret, decryptWithPassword, deriveKey, derivePublicKeyFromSeedBase58, deriveSkAndSeed64FromBase58Seed, detectInputType, encode, encodeVaultSecret, encryptWithPassword, extractLockupPrimeVaultIndexFromKey, extractLockupVaultIndexFromKey, formatAMAAmount, formatBalance, formatBalanceWithPrivacy, formatNumber, formatShortAddress, fromAtomicAma, fromBase58, generateIV, generateKeypair, generateMnemonic, generatePrivateKey, generateSalt, getExecutionErrorMessage, getPublicKey, getTransactionErrorMessage, getValidationErrorMessage, isValidAddress, isValidAmount, isValidLockupPrimeTierKey, isValidSeed, makeAddressUrl, makeExplorerUrl, makeTransactionUrl, mnemonicToSeedBase58, parseContractStateNumber, parseLockupVaultData, parseRawLockupVaultData, parseRawVaultData, parseStateNumber, parseStateString, parseVaultData, reduce512To256LE, seed64ToKeypair, toAtomicAma, toBase58, uint8ArrayToArrayBuffer, uint8ArrayToBase64, validate, validateAddress, validateAmount, validateMnemonic, validatePassword, validateSeed, validateTokenSymbol };
|