@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/api/proof.d.ts
CHANGED
|
@@ -1,25 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { ContractStateProof, ProofValidators } from "../types.js";
|
|
2
|
+
import { AmadeusClient } from "../client.js";
|
|
3
|
+
|
|
4
|
+
//#region src/api/proof.d.ts
|
|
5
|
+
declare class ProofAPI {
|
|
6
|
+
private client;
|
|
7
|
+
constructor(client: AmadeusClient);
|
|
8
|
+
/**
|
|
9
|
+
* Get validator proof for an entry hash
|
|
10
|
+
*
|
|
11
|
+
* @param entryHash - Entry hash (Base58 encoded)
|
|
12
|
+
* @returns Promise resolving to validator proof data
|
|
13
|
+
* @throws {Error} If entry hash is invalid
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const proof = await sdk.proof.getValidators('5Kd3N...')
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
getValidators(entryHash: string): Promise<ProofValidators>;
|
|
21
|
+
/**
|
|
22
|
+
* Get a merkle proof for a contract state entry.
|
|
23
|
+
*
|
|
24
|
+
* If `value` is supplied the node also verifies the proof and returns
|
|
25
|
+
* `result: true | false` indicating whether the value matches the proof.
|
|
26
|
+
*
|
|
27
|
+
* @param key - Contract state key, either raw bytes or already-Base58-encoded
|
|
28
|
+
* @param value - Optional value to verify against the proof (raw bytes or Base58)
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* // Just fetch the proof
|
|
33
|
+
* const proof = await sdk.proof.getContractStateProof(
|
|
34
|
+
* new TextEncoder().encode('account:5Kd3N...:balance:AMA')
|
|
35
|
+
* )
|
|
36
|
+
*
|
|
37
|
+
* // Fetch and verify the value
|
|
38
|
+
* const verified = await sdk.proof.getContractStateProof(key, expectedValueBytes)
|
|
39
|
+
* if (verified.result) console.log('matches')
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
getContractStateProof(key: Uint8Array | string, value?: Uint8Array | string): Promise<ContractStateProof>;
|
|
24
43
|
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { ProofAPI };
|
|
25
46
|
//# sourceMappingURL=proof.d.ts.map
|
package/dist/api/proof.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proof.d.ts","
|
|
1
|
+
{"version":3,"file":"proof.d.ts","names":[],"sources":["../../src/api/proof.ts"],"mappings":";;;;cAYa,QAAA;EAAA,QACQ,MAAA;cAAA,MAAA,EAAQ,aAAA;EAyCtB;;;;;;;;;;;;EA3BA,aAAA,CAAc,SAAA,WAAoB,OAAA,CAAQ,eAAA;EAAA;;;;;;;;;;;;;;;;;;;;;EA0B1C,qBAAA,CACL,GAAA,EAAK,UAAA,WACL,KAAA,GAAQ,UAAA,YACN,OAAA,CAAQ,kBAAA;AAAA"}
|
package/dist/api/proof.js
CHANGED
|
@@ -1,30 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
1
|
+
import { toBase58 } from "../encoding.js";
|
|
2
|
+
import { validate } from "../validation.js";
|
|
3
|
+
import { Base58HashSchema } from "../schemas.js";
|
|
4
|
+
//#region src/api/proof.ts
|
|
5
|
+
var ProofAPI = class {
|
|
6
|
+
client;
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Get validator proof for an entry hash
|
|
12
|
+
*
|
|
13
|
+
* @param entryHash - Entry hash (Base58 encoded)
|
|
14
|
+
* @returns Promise resolving to validator proof data
|
|
15
|
+
* @throws {Error} If entry hash is invalid
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const proof = await sdk.proof.getValidators('5Kd3N...')
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
async getValidators(entryHash) {
|
|
23
|
+
validate(Base58HashSchema, entryHash);
|
|
24
|
+
return this.client.get(`/api/proof/validators/${entryHash}`);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get a merkle proof for a contract state entry.
|
|
28
|
+
*
|
|
29
|
+
* If `value` is supplied the node also verifies the proof and returns
|
|
30
|
+
* `result: true | false` indicating whether the value matches the proof.
|
|
31
|
+
*
|
|
32
|
+
* @param key - Contract state key, either raw bytes or already-Base58-encoded
|
|
33
|
+
* @param value - Optional value to verify against the proof (raw bytes or Base58)
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* // Just fetch the proof
|
|
38
|
+
* const proof = await sdk.proof.getContractStateProof(
|
|
39
|
+
* new TextEncoder().encode('account:5Kd3N...:balance:AMA')
|
|
40
|
+
* )
|
|
41
|
+
*
|
|
42
|
+
* // Fetch and verify the value
|
|
43
|
+
* const verified = await sdk.proof.getContractStateProof(key, expectedValueBytes)
|
|
44
|
+
* if (verified.result) console.log('matches')
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
async getContractStateProof(key, value) {
|
|
48
|
+
const path = `/api/proof/contractstate/${typeof key === "string" ? key : toBase58(key)}`;
|
|
49
|
+
if (value === void 0) return this.client.get(path);
|
|
50
|
+
const valueB58 = typeof value === "string" ? value : toBase58(value);
|
|
51
|
+
return this.client.get(`${path}/${valueB58}`);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
export { ProofAPI };
|
|
56
|
+
|
|
30
57
|
//# sourceMappingURL=proof.js.map
|
package/dist/api/proof.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proof.js","
|
|
1
|
+
{"version":3,"file":"proof.js","names":[],"sources":["../../src/api/proof.ts"],"sourcesContent":["/**\n * Proof API\n *\n * Provides methods for querying validator proofs\n */\n\nimport type { AmadeusClient } from '../client'\nimport type { ProofValidators, ContractStateProof } from '../types'\nimport { Base58HashSchema } from '../schemas'\nimport { toBase58 } from '../encoding'\nimport { validate } from '../validation'\n\nexport class ProofAPI {\n\tconstructor(private client: AmadeusClient) {}\n\n\t/**\n\t * Get validator proof for an entry hash\n\t *\n\t * @param entryHash - Entry hash (Base58 encoded)\n\t * @returns Promise resolving to validator proof data\n\t * @throws {Error} If entry hash is invalid\n\t *\n\t * @example\n\t * ```ts\n\t * const proof = await sdk.proof.getValidators('5Kd3N...')\n\t * ```\n\t */\n\tasync getValidators(entryHash: string): Promise<ProofValidators> {\n\t\tvalidate(Base58HashSchema, entryHash)\n\t\treturn this.client.get<ProofValidators>(`/api/proof/validators/${entryHash}`)\n\t}\n\n\t/**\n\t * Get a merkle proof for a contract state entry.\n\t *\n\t * If `value` is supplied the node also verifies the proof and returns\n\t * `result: true | false` indicating whether the value matches the proof.\n\t *\n\t * @param key - Contract state key, either raw bytes or already-Base58-encoded\n\t * @param value - Optional value to verify against the proof (raw bytes or Base58)\n\t *\n\t * @example\n\t * ```ts\n\t * // Just fetch the proof\n\t * const proof = await sdk.proof.getContractStateProof(\n\t * new TextEncoder().encode('account:5Kd3N...:balance:AMA')\n\t * )\n\t *\n\t * // Fetch and verify the value\n\t * const verified = await sdk.proof.getContractStateProof(key, expectedValueBytes)\n\t * if (verified.result) console.log('matches')\n\t * ```\n\t */\n\tasync getContractStateProof(\n\t\tkey: Uint8Array | string,\n\t\tvalue?: Uint8Array | string\n\t): Promise<ContractStateProof> {\n\t\tconst keyB58 = typeof key === 'string' ? key : toBase58(key)\n\t\tconst path = `/api/proof/contractstate/${keyB58}`\n\t\tif (value === undefined) {\n\t\t\treturn this.client.get<ContractStateProof>(path)\n\t\t}\n\t\tconst valueB58 = typeof value === 'string' ? value : toBase58(value)\n\t\treturn this.client.get<ContractStateProof>(`${path}/${valueB58}`)\n\t}\n}\n"],"mappings":";;;;AAYA,IAAa,WAAb,MAAsB;CACD;CAApB,YAAY,QAA+B;EAAvB,KAAA,SAAA;;;;;;;;;;;;;;CAcpB,MAAM,cAAc,WAA6C;EAChE,SAAS,kBAAkB,UAAU;EACrC,OAAO,KAAK,OAAO,IAAqB,yBAAyB,YAAY;;;;;;;;;;;;;;;;;;;;;;;CAwB9E,MAAM,sBACL,KACA,OAC8B;EAE9B,MAAM,OAAO,4BADE,OAAO,QAAQ,WAAW,MAAM,SAAS,IAAI;EAE5D,IAAI,UAAU,KAAA,GACb,OAAO,KAAK,OAAO,IAAwB,KAAK;EAEjD,MAAM,WAAW,OAAO,UAAU,WAAW,QAAQ,SAAS,MAAM;EACpE,OAAO,KAAK,OAAO,IAAwB,GAAG,KAAK,GAAG,WAAW"}
|
|
@@ -1,71 +1,70 @@
|
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
getByEntry(entryHash: string): Promise<GetTransactionsInEntryResponse>;
|
|
1
|
+
import { GetTransactionsInEntryResponse, SubmitAndWaitOptions, SubmitAndWaitTransactionResponse, SubmitTransactionResponse, Transaction } from "../types.js";
|
|
2
|
+
import { AmadeusClient } from "../client.js";
|
|
3
|
+
|
|
4
|
+
//#region src/api/transaction.d.ts
|
|
5
|
+
declare class TransactionAPI {
|
|
6
|
+
private client;
|
|
7
|
+
constructor(client: AmadeusClient);
|
|
8
|
+
/**
|
|
9
|
+
* Submit a transaction to the network
|
|
10
|
+
*
|
|
11
|
+
* @param txPacked - Packed transaction as Uint8Array or Base58 string
|
|
12
|
+
* @returns Promise resolving to submission result
|
|
13
|
+
* @throws {AmadeusSDKError} If transaction data is invalid
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const result = await sdk.transaction.submit(txPacked)
|
|
18
|
+
* if (result.error === 'ok') {
|
|
19
|
+
* console.log('Transaction hash:', result.hash)
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
submit(txPacked: Uint8Array | string): Promise<SubmitTransactionResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Submit a transaction and wait for confirmation.
|
|
26
|
+
*
|
|
27
|
+
* Pass `{ finalized: true }` to wait for finality (consensus reached) instead
|
|
28
|
+
* of just confirmation. Default behavior is to return as soon as the tx is
|
|
29
|
+
* included in an entry.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* // Wait for confirmation only (fast)
|
|
34
|
+
* const result = await sdk.transaction.submitAndWait(txPacked)
|
|
35
|
+
*
|
|
36
|
+
* // Wait for finality (slower but stronger guarantee)
|
|
37
|
+
* const finalized = await sdk.transaction.submitAndWait(txPacked, { finalized: true })
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
submitAndWait(txPacked: Uint8Array | string, options?: SubmitAndWaitOptions): Promise<SubmitAndWaitTransactionResponse>;
|
|
41
|
+
/**
|
|
42
|
+
* Get transaction by ID
|
|
43
|
+
*
|
|
44
|
+
* @param txid - Transaction ID (Base58 encoded)
|
|
45
|
+
* @returns Promise resolving to transaction data
|
|
46
|
+
* @throws {AmadeusSDKError} If transaction ID is invalid
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const tx = await sdk.transaction.get('5Kd3N...')
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
get(txid: string): Promise<Transaction>;
|
|
54
|
+
/**
|
|
55
|
+
* Get transactions by entry hash
|
|
56
|
+
*
|
|
57
|
+
* @param entryHash - Entry hash (Base58 encoded)
|
|
58
|
+
* @returns Promise resolving to transactions in the entry
|
|
59
|
+
* @throws {AmadeusSDKError} If entry hash is invalid
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const { txs } = await sdk.transaction.getByEntry('5Kd3N...')
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
getByEntry(entryHash: string): Promise<GetTransactionsInEntryResponse>;
|
|
70
67
|
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { TransactionAPI };
|
|
71
70
|
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","names":[],"sources":["../../src/api/transaction.ts"],"mappings":";;;;cAiBa,cAAA;EAAA,QACQ,MAAA;cAAA,MAAA,EAAQ,aAAA;EAiBiB;;;;;;;;;;;;;;;EAAvC,MAAA,CAAO,QAAA,EAAU,UAAA,YAAsB,OAAA,CAAQ,yBAAA;EAA9B;;;;;;;;;;;;;;;;EAqBjB,aAAA,CACL,QAAA,EAAU,UAAA,WACV,OAAA,GAAS,oBAAA,GACP,OAAA,CAAQ,gCAAA;EAqC0B;;;;;;;;;;;;EAjB/B,GAAA,CAAI,IAAA,WAAe,OAAA,CAAQ,WAAA;;;;;;;;;;;;;EAiB3B,UAAA,CAAW,SAAA,WAAoB,OAAA,CAAQ,8BAAA;AAAA"}
|
package/dist/api/transaction.js
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
1
|
+
import { validate } from "../validation.js";
|
|
2
|
+
import { Base58HashSchema, TransactionDataSchema } from "../schemas.js";
|
|
3
|
+
//#region src/api/transaction.ts
|
|
4
|
+
var TransactionAPI = class {
|
|
5
|
+
client;
|
|
6
|
+
constructor(client) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Submit a transaction to the network
|
|
11
|
+
*
|
|
12
|
+
* @param txPacked - Packed transaction as Uint8Array or Base58 string
|
|
13
|
+
* @returns Promise resolving to submission result
|
|
14
|
+
* @throws {AmadeusSDKError} If transaction data is invalid
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const result = await sdk.transaction.submit(txPacked)
|
|
19
|
+
* if (result.error === 'ok') {
|
|
20
|
+
* console.log('Transaction hash:', result.hash)
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
async submit(txPacked) {
|
|
25
|
+
validate(TransactionDataSchema, txPacked);
|
|
26
|
+
return this.client.post("/api/tx/submit", txPacked);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Submit a transaction and wait for confirmation.
|
|
30
|
+
*
|
|
31
|
+
* Pass `{ finalized: true }` to wait for finality (consensus reached) instead
|
|
32
|
+
* of just confirmation. Default behavior is to return as soon as the tx is
|
|
33
|
+
* included in an entry.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* // Wait for confirmation only (fast)
|
|
38
|
+
* const result = await sdk.transaction.submitAndWait(txPacked)
|
|
39
|
+
*
|
|
40
|
+
* // Wait for finality (slower but stronger guarantee)
|
|
41
|
+
* const finalized = await sdk.transaction.submitAndWait(txPacked, { finalized: true })
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
async submitAndWait(txPacked, options = {}) {
|
|
45
|
+
validate(TransactionDataSchema, txPacked);
|
|
46
|
+
const endpoint = options.finalized ? "/api/tx/submit_and_wait?finalized=true" : "/api/tx/submit_and_wait";
|
|
47
|
+
return this.client.post(endpoint, txPacked);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get transaction by ID
|
|
51
|
+
*
|
|
52
|
+
* @param txid - Transaction ID (Base58 encoded)
|
|
53
|
+
* @returns Promise resolving to transaction data
|
|
54
|
+
* @throws {AmadeusSDKError} If transaction ID is invalid
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const tx = await sdk.transaction.get('5Kd3N...')
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
async get(txid) {
|
|
62
|
+
validate(Base58HashSchema, txid);
|
|
63
|
+
return this.client.get(`/api/chain/tx/${txid}`);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get transactions by entry hash
|
|
67
|
+
*
|
|
68
|
+
* @param entryHash - Entry hash (Base58 encoded)
|
|
69
|
+
* @returns Promise resolving to transactions in the entry
|
|
70
|
+
* @throws {AmadeusSDKError} If entry hash is invalid
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* const { txs } = await sdk.transaction.getByEntry('5Kd3N...')
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
async getByEntry(entryHash) {
|
|
78
|
+
validate(Base58HashSchema, entryHash);
|
|
79
|
+
return this.client.get(`/api/chain/txs_in_entry/${entryHash}`);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
//#endregion
|
|
83
|
+
export { TransactionAPI };
|
|
84
|
+
|
|
85
85
|
//# sourceMappingURL=transaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","
|
|
1
|
+
{"version":3,"file":"transaction.js","names":[],"sources":["../../src/api/transaction.ts"],"sourcesContent":["/**\n * Transaction API\n *\n * Provides methods for submitting transactions and querying transaction data\n */\n\nimport type { AmadeusClient } from '../client'\nimport type {\n\tSubmitTransactionResponse,\n\tSubmitAndWaitTransactionResponse,\n\tSubmitAndWaitOptions,\n\tGetTransactionsInEntryResponse,\n\tTransaction\n} from '../types'\nimport { Base58HashSchema, TransactionDataSchema } from '../schemas'\nimport { validate } from '../validation'\n\nexport class TransactionAPI {\n\tconstructor(private client: AmadeusClient) {}\n\n\t/**\n\t * Submit a transaction to the network\n\t *\n\t * @param txPacked - Packed transaction as Uint8Array or Base58 string\n\t * @returns Promise resolving to submission result\n\t * @throws {AmadeusSDKError} If transaction data is invalid\n\t *\n\t * @example\n\t * ```ts\n\t * const result = await sdk.transaction.submit(txPacked)\n\t * if (result.error === 'ok') {\n\t * console.log('Transaction hash:', result.hash)\n\t * }\n\t * ```\n\t */\n\tasync submit(txPacked: Uint8Array | string): Promise<SubmitTransactionResponse> {\n\t\tvalidate(TransactionDataSchema, txPacked)\n\t\treturn this.client.post<SubmitTransactionResponse>('/api/tx/submit', txPacked)\n\t}\n\n\t/**\n\t * Submit a transaction and wait for confirmation.\n\t *\n\t * Pass `{ finalized: true }` to wait for finality (consensus reached) instead\n\t * of just confirmation. Default behavior is to return as soon as the tx is\n\t * included in an entry.\n\t *\n\t * @example\n\t * ```ts\n\t * // Wait for confirmation only (fast)\n\t * const result = await sdk.transaction.submitAndWait(txPacked)\n\t *\n\t * // Wait for finality (slower but stronger guarantee)\n\t * const finalized = await sdk.transaction.submitAndWait(txPacked, { finalized: true })\n\t * ```\n\t */\n\tasync submitAndWait(\n\t\ttxPacked: Uint8Array | string,\n\t\toptions: SubmitAndWaitOptions = {}\n\t): Promise<SubmitAndWaitTransactionResponse> {\n\t\tvalidate(TransactionDataSchema, txPacked)\n\t\tconst endpoint = options.finalized\n\t\t\t? '/api/tx/submit_and_wait?finalized=true'\n\t\t\t: '/api/tx/submit_and_wait'\n\t\treturn this.client.post<SubmitAndWaitTransactionResponse>(endpoint, txPacked)\n\t}\n\n\t/**\n\t * Get transaction by ID\n\t *\n\t * @param txid - Transaction ID (Base58 encoded)\n\t * @returns Promise resolving to transaction data\n\t * @throws {AmadeusSDKError} If transaction ID is invalid\n\t *\n\t * @example\n\t * ```ts\n\t * const tx = await sdk.transaction.get('5Kd3N...')\n\t * ```\n\t */\n\tasync get(txid: string): Promise<Transaction> {\n\t\tvalidate(Base58HashSchema, txid)\n\t\treturn this.client.get<Transaction>(`/api/chain/tx/${txid}`)\n\t}\n\n\t/**\n\t * Get transactions by entry hash\n\t *\n\t * @param entryHash - Entry hash (Base58 encoded)\n\t * @returns Promise resolving to transactions in the entry\n\t * @throws {AmadeusSDKError} If entry hash is invalid\n\t *\n\t * @example\n\t * ```ts\n\t * const { txs } = await sdk.transaction.getByEntry('5Kd3N...')\n\t * ```\n\t */\n\tasync getByEntry(entryHash: string): Promise<GetTransactionsInEntryResponse> {\n\t\tvalidate(Base58HashSchema, entryHash)\n\t\treturn this.client.get<GetTransactionsInEntryResponse>(\n\t\t\t`/api/chain/txs_in_entry/${entryHash}`\n\t\t)\n\t}\n}\n"],"mappings":";;;AAiBA,IAAa,iBAAb,MAA4B;CACP;CAApB,YAAY,QAA+B;EAAvB,KAAA,SAAA;;;;;;;;;;;;;;;;;CAiBpB,MAAM,OAAO,UAAmE;EAC/E,SAAS,uBAAuB,SAAS;EACzC,OAAO,KAAK,OAAO,KAAgC,kBAAkB,SAAS;;;;;;;;;;;;;;;;;;CAmB/E,MAAM,cACL,UACA,UAAgC,EAAE,EACU;EAC5C,SAAS,uBAAuB,SAAS;EACzC,MAAM,WAAW,QAAQ,YACtB,2CACA;EACH,OAAO,KAAK,OAAO,KAAuC,UAAU,SAAS;;;;;;;;;;;;;;CAe9E,MAAM,IAAI,MAAoC;EAC7C,SAAS,kBAAkB,KAAK;EAChC,OAAO,KAAK,OAAO,IAAiB,iBAAiB,OAAO;;;;;;;;;;;;;;CAe7D,MAAM,WAAW,WAA4D;EAC5E,SAAS,kBAAkB,UAAU;EACrC,OAAO,KAAK,OAAO,IAClB,2BAA2B,YAC3B"}
|
package/dist/api/wallet.d.ts
CHANGED
|
@@ -1,39 +1,38 @@
|
|
|
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
|
-
getAllBalances(address: string): Promise<GetAllBalancesResponse>;
|
|
1
|
+
import { GetAllBalancesResponse, WalletBalance } from "../types.js";
|
|
2
|
+
import { AmadeusClient } from "../client.js";
|
|
3
|
+
|
|
4
|
+
//#region src/api/wallet.d.ts
|
|
5
|
+
declare class WalletAPI {
|
|
6
|
+
private client;
|
|
7
|
+
constructor(client: AmadeusClient);
|
|
8
|
+
/**
|
|
9
|
+
* Get balance for a specific address and symbol
|
|
10
|
+
*
|
|
11
|
+
* @param address - Base58 encoded wallet address
|
|
12
|
+
* @param symbol - Token symbol (default: 'AMA')
|
|
13
|
+
* @returns Promise resolving to wallet balance
|
|
14
|
+
* @throws {AmadeusSDKError} If address is invalid
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const balance = await sdk.wallet.getBalance('5Kd3N...', 'AMA')
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
getBalance(address: string, symbol?: string): Promise<WalletBalance>;
|
|
22
|
+
/**
|
|
23
|
+
* Get all balances for an address
|
|
24
|
+
*
|
|
25
|
+
* @param address - Base58 encoded wallet address
|
|
26
|
+
* @returns Promise resolving to all wallet balances
|
|
27
|
+
* @throws {AmadeusSDKError} If address is invalid
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const { balances } = await sdk.wallet.getAllBalances('5Kd3N...')
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
getAllBalances(address: string): Promise<GetAllBalancesResponse>;
|
|
38
35
|
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { WalletAPI };
|
|
39
38
|
//# sourceMappingURL=wallet.d.ts.map
|
package/dist/api/wallet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.d.ts","
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","names":[],"sources":["../../src/api/wallet.ts"],"mappings":";;;;cAWa,SAAA;EAAA,QACQ,MAAA;cAAA,MAAA,EAAQ,aAAA;EAsCmB;;;;;;;;;;;;;EAvBzC,UAAA,CAAW,OAAA,UAAiB,MAAA,YAAyB,OAAA,CAAQ,aAAA;EAuB9C;;;;;;;;;;;;EAAf,cAAA,CAAe,OAAA,WAAkB,OAAA,CAAQ,sBAAA;AAAA"}
|