@amadeus-protocol/sdk 1.0.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/LICENSE +21 -0
- package/README.md +410 -0
- package/dist/api/chain.d.ts +119 -0
- package/dist/api/chain.d.ts.map +1 -0
- package/dist/api/chain.js +147 -0
- package/dist/api/chain.js.map +1 -0
- package/dist/api/contract.d.ts +62 -0
- package/dist/api/contract.d.ts.map +1 -0
- package/dist/api/contract.js +76 -0
- package/dist/api/contract.js.map +1 -0
- package/dist/api/epoch.d.ts +68 -0
- package/dist/api/epoch.d.ts.map +1 -0
- package/dist/api/epoch.js +99 -0
- package/dist/api/epoch.js.map +1 -0
- package/dist/api/index.d.ts +8 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +8 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/peer.d.ts +80 -0
- package/dist/api/peer.d.ts.map +1 -0
- package/dist/api/peer.js +95 -0
- package/dist/api/peer.js.map +1 -0
- package/dist/api/proof.d.ts +25 -0
- package/dist/api/proof.d.ts.map +1 -0
- package/dist/api/proof.js +30 -0
- package/dist/api/proof.js.map +1 -0
- package/dist/api/transaction.d.ts +71 -0
- package/dist/api/transaction.d.ts.map +1 -0
- package/dist/api/transaction.js +85 -0
- package/dist/api/transaction.js.map +1 -0
- package/dist/api/wallet.d.ts +39 -0
- package/dist/api/wallet.d.ts.map +1 -0
- package/dist/api/wallet.js +51 -0
- package/dist/api/wallet.js.map +1 -0
- package/dist/client.d.ts +70 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +280 -0
- package/dist/client.js.map +1 -0
- package/dist/constants.d.ts +42 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +42 -0
- package/dist/constants.js.map +1 -0
- package/dist/conversion.d.ts +32 -0
- package/dist/conversion.d.ts.map +1 -0
- package/dist/conversion.js +50 -0
- package/dist/conversion.js.map +1 -0
- package/dist/crypto.d.ts +93 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +156 -0
- package/dist/crypto.js.map +1 -0
- package/dist/encoding.d.ts +108 -0
- package/dist/encoding.d.ts.map +1 -0
- package/dist/encoding.js +165 -0
- package/dist/encoding.js.map +1 -0
- package/dist/encryption.d.ts +76 -0
- package/dist/encryption.d.ts.map +1 -0
- package/dist/encryption.js +137 -0
- package/dist/encryption.js.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas.d.ts +67 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +103 -0
- package/dist/schemas.js.map +1 -0
- package/dist/sdk.d.ts +100 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/sdk.js +120 -0
- package/dist/sdk.js.map +1 -0
- package/dist/serialization.d.ts +42 -0
- package/dist/serialization.d.ts.map +1 -0
- package/dist/serialization.js +247 -0
- package/dist/serialization.js.map +1 -0
- package/dist/transaction-builder.d.ts +267 -0
- package/dist/transaction-builder.d.ts.map +1 -0
- package/dist/transaction-builder.js +397 -0
- package/dist/transaction-builder.js.map +1 -0
- package/dist/types.d.ts +550 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +78 -0
- package/dist/types.js.map +1 -0
- package/dist/validation.d.ts +15 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +39 -0
- package/dist/validation.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain.js","sourceRoot":"","sources":["../../src/api/chain.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,MAAM,OAAO,QAAQ;IACA;IAApB,YAA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K,CAAC,sBAAsB,CAAC,SAAiB;QAC7C,QAAQ,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAA;QACrC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CACrB,2BAA2B,SAAS,EAAE,CACtC,CAAA;IACF,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,6BAA6B,CAClC,OAAe,EACf,UAA8B,EAAE;QAEhC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;QACnC,QAAQ,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAA;QAE3C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CACrB,mCAAmC,OAAO,EAAE,EAC5C,OAAkC,CAClC,CAAA;IACF,CAAC;CACD"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract API
|
|
3
|
+
*
|
|
4
|
+
* Provides methods for interacting with smart contracts
|
|
5
|
+
*/
|
|
6
|
+
import type { AmadeusClient } from '../client';
|
|
7
|
+
import type { ValidateBytecodeResponse, GetRichlistResponse, ContractDataValue } from '../types';
|
|
8
|
+
export declare class ContractAPI {
|
|
9
|
+
private client;
|
|
10
|
+
constructor(client: AmadeusClient);
|
|
11
|
+
/**
|
|
12
|
+
* Validate contract bytecode
|
|
13
|
+
*
|
|
14
|
+
* @param bytecode - Contract bytecode as Uint8Array or ArrayBuffer
|
|
15
|
+
* @returns Promise resolving to validation result
|
|
16
|
+
* @throws {AmadeusSDKError} If bytecode is invalid or empty
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const result = await sdk.contract.validateBytecode(wasmBytecode)
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
validateBytecode(bytecode: Uint8Array | ArrayBuffer): Promise<ValidateBytecodeResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Get contract data by key
|
|
26
|
+
*
|
|
27
|
+
* @param key - Contract key as Uint8Array or Base58 string
|
|
28
|
+
* @returns Promise resolving to contract data value (JSON-serializable)
|
|
29
|
+
* @throws {AmadeusSDKError} If key is invalid
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const data = await sdk.contract.get(keyBytes)
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
get(key: Uint8Array | string): Promise<ContractDataValue>;
|
|
37
|
+
/**
|
|
38
|
+
* Get contract data by key prefix
|
|
39
|
+
*
|
|
40
|
+
* @param key - Contract key prefix as Uint8Array or Base58 string
|
|
41
|
+
* @returns Promise resolving to contract data matching the prefix (array of key-value pairs)
|
|
42
|
+
* @throws {AmadeusSDKError} If key is invalid
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const data = await sdk.contract.getPrefix(keyPrefix)
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
getPrefix(key: Uint8Array | string): Promise<ContractDataValue[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Get contract richlist (token holders)
|
|
52
|
+
*
|
|
53
|
+
* @returns Promise resolving to richlist entries
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const { richlist } = await sdk.contract.getRichlist()
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
getRichlist(): Promise<GetRichlistResponse>;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/api/contract.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,KAAK,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAIhG,qBAAa,WAAW;IACX,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAEzC;;;;;;;;;;;OAWG;IACG,gBAAgB,CAAC,QAAQ,EAAE,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAM7F;;;;;;;;;;;OAWG;IACG,GAAG,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAK/D;;;;;;;;;;;OAWG;IACG,SAAS,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAKvE;;;;;;;;;OASG;IACG,WAAW,IAAI,OAAO,CAAC,mBAAmB,CAAC;CAGjD"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract API
|
|
3
|
+
*
|
|
4
|
+
* Provides methods for interacting with smart contracts
|
|
5
|
+
*/
|
|
6
|
+
import { BytecodeSchema, ContractKeySchema } from '../schemas';
|
|
7
|
+
import { validate } from '../validation';
|
|
8
|
+
export class ContractAPI {
|
|
9
|
+
client;
|
|
10
|
+
constructor(client) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Validate contract bytecode
|
|
15
|
+
*
|
|
16
|
+
* @param bytecode - Contract bytecode as Uint8Array or ArrayBuffer
|
|
17
|
+
* @returns Promise resolving to validation result
|
|
18
|
+
* @throws {AmadeusSDKError} If bytecode is invalid or empty
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const result = await sdk.contract.validateBytecode(wasmBytecode)
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
async validateBytecode(bytecode) {
|
|
26
|
+
validate(BytecodeSchema, bytecode);
|
|
27
|
+
const body = bytecode instanceof ArrayBuffer ? new Uint8Array(bytecode) : bytecode;
|
|
28
|
+
return this.client.post('/api/contract/validate_bytecode', body);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get contract data by key
|
|
32
|
+
*
|
|
33
|
+
* @param key - Contract key as Uint8Array or Base58 string
|
|
34
|
+
* @returns Promise resolving to contract data value (JSON-serializable)
|
|
35
|
+
* @throws {AmadeusSDKError} If key is invalid
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const data = await sdk.contract.get(keyBytes)
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
async get(key) {
|
|
43
|
+
validate(ContractKeySchema, key);
|
|
44
|
+
return this.client.post('/api/contract/get', key);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get contract data by key prefix
|
|
48
|
+
*
|
|
49
|
+
* @param key - Contract key prefix as Uint8Array or Base58 string
|
|
50
|
+
* @returns Promise resolving to contract data matching the prefix (array of key-value pairs)
|
|
51
|
+
* @throws {AmadeusSDKError} If key is invalid
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* const data = await sdk.contract.getPrefix(keyPrefix)
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
async getPrefix(key) {
|
|
59
|
+
validate(ContractKeySchema, key);
|
|
60
|
+
return this.client.post('/api/contract/get_prefix', key);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get contract richlist (token holders)
|
|
64
|
+
*
|
|
65
|
+
* @returns Promise resolving to richlist entries
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const { richlist } = await sdk.contract.getRichlist()
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
async getRichlist() {
|
|
73
|
+
return this.client.get('/api/contract/richlist');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/api/contract.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA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';
|
|
7
|
+
import type { EpochScore, GetEmissionAddressResponse, GetSolInEpochResponse } from '../types';
|
|
8
|
+
export declare class EpochAPI {
|
|
9
|
+
private client;
|
|
10
|
+
constructor(client: AmadeusClient);
|
|
11
|
+
/**
|
|
12
|
+
* Get epoch score for all validators or a specific validator
|
|
13
|
+
*
|
|
14
|
+
* @param publicKey - Optional validator public key (Base58 encoded)
|
|
15
|
+
* @returns Promise resolving to epoch score(s)
|
|
16
|
+
* @throws {Error} If public key is invalid
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* // Get all scores
|
|
21
|
+
* const scores = await sdk.epoch.getScore()
|
|
22
|
+
*
|
|
23
|
+
* // Get specific validator score
|
|
24
|
+
* const score = await sdk.epoch.getScore('5Kd3N...')
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
getScore(publicKey?: string): Promise<EpochScore>;
|
|
28
|
+
/**
|
|
29
|
+
* Get emission address for a public key
|
|
30
|
+
*
|
|
31
|
+
* @param publicKey - Validator public key (Base58 encoded)
|
|
32
|
+
* @returns Promise resolving to emission address
|
|
33
|
+
* @throws {Error} If public key is invalid
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const { emission_address } = await sdk.epoch.getEmissionAddress('5Kd3N...')
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
getEmissionAddress(publicKey: string): Promise<GetEmissionAddressResponse>;
|
|
41
|
+
/**
|
|
42
|
+
* Get solution in epoch
|
|
43
|
+
*
|
|
44
|
+
* @param epoch - Epoch number (must be >= 0)
|
|
45
|
+
* @param solHash - Solution hash as string or Uint8Array
|
|
46
|
+
* @returns Promise resolving to solution data
|
|
47
|
+
* @throws {Error} If parameters are invalid
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const sol = await sdk.epoch.getSolInEpoch(100, '5Kd3N...')
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
getSolInEpoch(epoch: number, solHash: string | Uint8Array): Promise<GetSolInEpochResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* Get all epoch scores as array of [pk, score] tuples
|
|
57
|
+
*/
|
|
58
|
+
getAllScores(): Promise<[string, number][]>;
|
|
59
|
+
/**
|
|
60
|
+
* Get epoch score for a specific validator
|
|
61
|
+
*/
|
|
62
|
+
getValidatorScore(publicKey: string): Promise<number>;
|
|
63
|
+
/**
|
|
64
|
+
* Get top validators by score
|
|
65
|
+
*/
|
|
66
|
+
getTopValidators(limit?: number): Promise<[string, number][]>;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=epoch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epoch.d.ts","sourceRoot":"","sources":["../../src/api/epoch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAK7F,qBAAa,QAAQ;IACR,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAEzC;;;;;;;;;;;;;;;OAeG;IACG,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAQvD;;;;;;;;;;;OAWG;IACG,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAOhF;;;;;;;;;;;;OAYG;IACG,aAAa,CAClB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GAAG,UAAU,GAC1B,OAAO,CAAC,qBAAqB,CAAC;IAWjC;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAKjD;;OAEG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ3D;;OAEG;IACG,gBAAgB,CAAC,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;CAIvE"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Epoch API
|
|
3
|
+
*
|
|
4
|
+
* Provides methods for querying epoch and validator information
|
|
5
|
+
*/
|
|
6
|
+
import { Base58PublicKeySchema } from '../schemas';
|
|
7
|
+
import { Schema } from 'effect';
|
|
8
|
+
import { validate } from '../validation';
|
|
9
|
+
export class EpochAPI {
|
|
10
|
+
client;
|
|
11
|
+
constructor(client) {
|
|
12
|
+
this.client = client;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get epoch score for all validators or a specific validator
|
|
16
|
+
*
|
|
17
|
+
* @param publicKey - Optional validator public key (Base58 encoded)
|
|
18
|
+
* @returns Promise resolving to epoch score(s)
|
|
19
|
+
* @throws {Error} If public key is invalid
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* // Get all scores
|
|
24
|
+
* const scores = await sdk.epoch.getScore()
|
|
25
|
+
*
|
|
26
|
+
* // Get specific validator score
|
|
27
|
+
* const score = await sdk.epoch.getScore('5Kd3N...')
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
async getScore(publicKey) {
|
|
31
|
+
if (publicKey) {
|
|
32
|
+
validate(Base58PublicKeySchema, publicKey);
|
|
33
|
+
}
|
|
34
|
+
const url = publicKey ? `/api/epoch/score/${publicKey}` : '/api/epoch/score';
|
|
35
|
+
return this.client.get(url);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Get emission address for a public key
|
|
39
|
+
*
|
|
40
|
+
* @param publicKey - Validator public key (Base58 encoded)
|
|
41
|
+
* @returns Promise resolving to emission address
|
|
42
|
+
* @throws {Error} If public key is invalid
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const { emission_address } = await sdk.epoch.getEmissionAddress('5Kd3N...')
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
async getEmissionAddress(publicKey) {
|
|
50
|
+
validate(Base58PublicKeySchema, publicKey);
|
|
51
|
+
return this.client.get(`/api/epoch/get_emission_address/${publicKey}`);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get solution in epoch
|
|
55
|
+
*
|
|
56
|
+
* @param epoch - Epoch number (must be >= 0)
|
|
57
|
+
* @param solHash - Solution hash as string or Uint8Array
|
|
58
|
+
* @returns Promise resolving to solution data
|
|
59
|
+
* @throws {Error} If parameters are invalid
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const sol = await sdk.epoch.getSolInEpoch(100, '5Kd3N...')
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
async getSolInEpoch(epoch, solHash) {
|
|
67
|
+
validate(Schema.NonNegativeInt, epoch);
|
|
68
|
+
if (!solHash) {
|
|
69
|
+
throw new Error('Solution hash is required');
|
|
70
|
+
}
|
|
71
|
+
const hash = typeof solHash === 'string' ? solHash : solHash.toString();
|
|
72
|
+
return this.client.get(`/api/epoch/sol_in_epoch/${epoch}/${hash}`);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get all epoch scores as array of [pk, score] tuples
|
|
76
|
+
*/
|
|
77
|
+
async getAllScores() {
|
|
78
|
+
const result = await this.getScore();
|
|
79
|
+
return Array.isArray(result) ? result : [];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get epoch score for a specific validator
|
|
83
|
+
*/
|
|
84
|
+
async getValidatorScore(publicKey) {
|
|
85
|
+
const result = await this.getScore(publicKey);
|
|
86
|
+
if (Array.isArray(result)) {
|
|
87
|
+
throw new Error('Unexpected array response for single validator score');
|
|
88
|
+
}
|
|
89
|
+
return result.score;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Get top validators by score
|
|
93
|
+
*/
|
|
94
|
+
async getTopValidators(limit = 10) {
|
|
95
|
+
const scores = await this.getAllScores();
|
|
96
|
+
return scores.sort((a, b) => b[1] - a[1]).slice(0, limit);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=epoch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epoch.js","sourceRoot":"","sources":["../../src/api/epoch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,MAAM,OAAO,QAAQ;IACA;IAApB,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,QAAQ,CAAC,SAAkB;QAChC,IAAI,SAAS,EAAE,CAAC;YACf,QAAQ,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAA;QAC3C,CAAC;QACD,MAAM,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,oBAAoB,SAAS,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAA;QAC5E,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAa,GAAG,CAAC,CAAA;IACxC,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,kBAAkB,CAAC,SAAiB;QACzC,QAAQ,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAA;QAC1C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CACrB,mCAAmC,SAAS,EAAE,CAC9C,CAAA;IACF,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,aAAa,CAClB,KAAa,EACb,OAA4B;QAE5B,QAAQ,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|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Peer API
|
|
3
|
+
*
|
|
4
|
+
* Provides methods for querying network peer information
|
|
5
|
+
*/
|
|
6
|
+
import type { AmadeusClient } from '../client';
|
|
7
|
+
import type { GetNodesResponse, GetTrainersResponse, GetRemovedTrainersResponse, GetANRsResponse, GetANRByPkResponse } from '../types';
|
|
8
|
+
export declare class PeerAPI {
|
|
9
|
+
private client;
|
|
10
|
+
constructor(client: AmadeusClient);
|
|
11
|
+
/**
|
|
12
|
+
* Get all nodes in the network
|
|
13
|
+
*
|
|
14
|
+
* @returns Promise resolving to network nodes
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const { nodes } = await sdk.peer.getNodes()
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
getNodes(): Promise<GetNodesResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Get all trainers (validators)
|
|
24
|
+
*
|
|
25
|
+
* @returns Promise resolving to trainer nodes
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const { trainers } = await sdk.peer.getTrainers()
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
getTrainers(): Promise<GetTrainersResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* Get removed trainers
|
|
35
|
+
*
|
|
36
|
+
* @returns Promise resolving to removed trainer nodes
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const { removed_trainers } = await sdk.peer.getRemovedTrainers()
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
getRemovedTrainers(): Promise<GetRemovedTrainersResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* Get all ANR (Autonomous Network Registry) entries
|
|
46
|
+
*
|
|
47
|
+
* @returns Promise resolving to ANR entries
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const { anrs } = await sdk.peer.getANRs()
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
getANRs(): Promise<GetANRsResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* Get ANR validators only
|
|
57
|
+
*
|
|
58
|
+
* @returns Promise resolving to ANR validator entries
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* const { anrs } = await sdk.peer.getANRValidators()
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
getANRValidators(): Promise<GetANRsResponse>;
|
|
66
|
+
/**
|
|
67
|
+
* Get ANR entry by public key
|
|
68
|
+
*
|
|
69
|
+
* @param publicKey - Public key (Base58 encoded)
|
|
70
|
+
* @returns Promise resolving to ANR entry
|
|
71
|
+
* @throws {Error} If public key is invalid
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* const { anr } = await sdk.peer.getANRByPk('5Kd3N...')
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
getANRByPk(publicKey: string): Promise<GetANRByPkResponse>;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=peer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peer.d.ts","sourceRoot":"","sources":["../../src/api/peer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,KAAK,EACX,gBAAgB,EAChB,mBAAmB,EACnB,0BAA0B,EAC1B,eAAe,EACf,kBAAkB,EAClB,MAAM,UAAU,CAAA;AAIjB,qBAAa,OAAO;IACP,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAEzC;;;;;;;;;OASG;IACG,QAAQ,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAI3C;;;;;;;;;OASG;IACG,WAAW,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAIjD;;;;;;;;;OASG;IACG,kBAAkB,IAAI,OAAO,CAAC,0BAA0B,CAAC;IAI/D;;;;;;;;;OASG;IACG,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC;IAIzC;;;;;;;;;OASG;IACG,gBAAgB,IAAI,OAAO,CAAC,eAAe,CAAC;IAIlD;;;;;;;;;;;OAWG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAIhE"}
|
package/dist/api/peer.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Peer API
|
|
3
|
+
*
|
|
4
|
+
* Provides methods for querying network peer information
|
|
5
|
+
*/
|
|
6
|
+
import { Base58PublicKeySchema } from '../schemas';
|
|
7
|
+
import { validate } from '../validation';
|
|
8
|
+
export class PeerAPI {
|
|
9
|
+
client;
|
|
10
|
+
constructor(client) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Get all nodes in the network
|
|
15
|
+
*
|
|
16
|
+
* @returns Promise resolving to network nodes
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const { nodes } = await sdk.peer.getNodes()
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
async getNodes() {
|
|
24
|
+
return this.client.get('/api/peer/nodes');
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get all trainers (validators)
|
|
28
|
+
*
|
|
29
|
+
* @returns Promise resolving to trainer nodes
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const { trainers } = await sdk.peer.getTrainers()
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
async getTrainers() {
|
|
37
|
+
return this.client.get('/api/peer/trainers');
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Get removed trainers
|
|
41
|
+
*
|
|
42
|
+
* @returns Promise resolving to removed trainer nodes
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const { removed_trainers } = await sdk.peer.getRemovedTrainers()
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
async getRemovedTrainers() {
|
|
50
|
+
return this.client.get('/api/peer/removed_trainers');
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Get all ANR (Autonomous Network Registry) entries
|
|
54
|
+
*
|
|
55
|
+
* @returns Promise resolving to ANR entries
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* const { anrs } = await sdk.peer.getANRs()
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
async getANRs() {
|
|
63
|
+
return this.client.get('/api/peer/anr');
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get ANR validators only
|
|
67
|
+
*
|
|
68
|
+
* @returns Promise resolving to ANR validator entries
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const { anrs } = await sdk.peer.getANRValidators()
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
async getANRValidators() {
|
|
76
|
+
return this.client.get('/api/peer/anr_validators');
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get ANR entry by public key
|
|
80
|
+
*
|
|
81
|
+
* @param publicKey - Public key (Base58 encoded)
|
|
82
|
+
* @returns Promise resolving to ANR entry
|
|
83
|
+
* @throws {Error} If public key is invalid
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* const { anr } = await sdk.peer.getANRByPk('5Kd3N...')
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
async getANRByPk(publicKey) {
|
|
91
|
+
validate(Base58PublicKeySchema, publicKey);
|
|
92
|
+
return this.client.get(`/api/peer/anr/${publicKey}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=peer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peer.js","sourceRoot":"","sources":["../../src/api/peer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,MAAM,OAAO,OAAO;IACC;IAApB,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C;;;;;;;;;OASG;IACH,KAAK,CAAC,QAAQ;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAmB,iBAAiB,CAAC,CAAA;IAC5D,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,WAAW;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAsB,oBAAoB,CAAC,CAAA;IAClE,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,kBAAkB;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAA6B,4BAA4B,CAAC,CAAA;IACjF,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,OAAO;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAkB,eAAe,CAAC,CAAA;IACzD,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,gBAAgB;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAkB,0BAA0B,CAAC,CAAA;IACpE,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,UAAU,CAAC,SAAiB;QACjC,QAAQ,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAA;QAC1C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAqB,iBAAiB,SAAS,EAAE,CAAC,CAAA;IACzE,CAAC;CACD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Proof API
|
|
3
|
+
*
|
|
4
|
+
* Provides methods for querying validator proofs
|
|
5
|
+
*/
|
|
6
|
+
import type { AmadeusClient } from '../client';
|
|
7
|
+
import type { ProofValidators } from '../types';
|
|
8
|
+
export declare class ProofAPI {
|
|
9
|
+
private client;
|
|
10
|
+
constructor(client: AmadeusClient);
|
|
11
|
+
/**
|
|
12
|
+
* Get validator proof for an entry hash
|
|
13
|
+
*
|
|
14
|
+
* @param entryHash - Entry hash (Base58 encoded)
|
|
15
|
+
* @returns Promise resolving to validator proof data
|
|
16
|
+
* @throws {Error} If entry hash is invalid
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const proof = await sdk.proof.getValidators('5Kd3N...')
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
getValidators(entryHash: string): Promise<ProofValidators>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=proof.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof.d.ts","sourceRoot":"","sources":["../../src/api/proof.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAI/C,qBAAa,QAAQ;IACR,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAEzC;;;;;;;;;;;OAWG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAIhE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Proof API
|
|
3
|
+
*
|
|
4
|
+
* Provides methods for querying validator proofs
|
|
5
|
+
*/
|
|
6
|
+
import { Base58HashSchema } from '../schemas';
|
|
7
|
+
import { validate } from '../validation';
|
|
8
|
+
export class ProofAPI {
|
|
9
|
+
client;
|
|
10
|
+
constructor(client) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Get validator proof for an entry hash
|
|
15
|
+
*
|
|
16
|
+
* @param entryHash - Entry hash (Base58 encoded)
|
|
17
|
+
* @returns Promise resolving to validator proof data
|
|
18
|
+
* @throws {Error} If entry hash is invalid
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const proof = await sdk.proof.getValidators('5Kd3N...')
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
async getValidators(entryHash) {
|
|
26
|
+
validate(Base58HashSchema, entryHash);
|
|
27
|
+
return this.client.get(`/api/proof/validators/${entryHash}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=proof.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof.js","sourceRoot":"","sources":["../../src/api/proof.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,MAAM,OAAO,QAAQ;IACA;IAApB,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,aAAa,CAAC,SAAiB;QACpC,QAAQ,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAA;QACrC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAkB,yBAAyB,SAAS,EAAE,CAAC,CAAA;IAC9E,CAAC;CACD"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transaction API
|
|
3
|
+
*
|
|
4
|
+
* Provides methods for submitting transactions and querying transaction data
|
|
5
|
+
*/
|
|
6
|
+
import type { AmadeusClient } from '../client';
|
|
7
|
+
import type { SubmitTransactionResponse, SubmitAndWaitTransactionResponse, GetTransactionsInEntryResponse, Transaction } from '../types';
|
|
8
|
+
export declare class TransactionAPI {
|
|
9
|
+
private client;
|
|
10
|
+
constructor(client: AmadeusClient);
|
|
11
|
+
/**
|
|
12
|
+
* Submit a transaction to the network
|
|
13
|
+
*
|
|
14
|
+
* @param txPacked - Packed transaction as Uint8Array or Base58 string
|
|
15
|
+
* @returns Promise resolving to submission result
|
|
16
|
+
* @throws {AmadeusSDKError} If transaction data is invalid
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const result = await sdk.transaction.submit(txPacked)
|
|
21
|
+
* if (result.error === 'ok') {
|
|
22
|
+
* console.log('Transaction hash:', result.hash)
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
submit(txPacked: Uint8Array | string): Promise<SubmitTransactionResponse>;
|
|
27
|
+
/**
|
|
28
|
+
* Submit a transaction and wait for confirmation
|
|
29
|
+
*
|
|
30
|
+
* @param txPacked - Packed transaction as Uint8Array or Base58 string
|
|
31
|
+
* @returns Promise resolving to submission result with confirmation
|
|
32
|
+
* @throws {AmadeusSDKError} If transaction data is invalid
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const result = await sdk.transaction.submitAndWait(txPacked)
|
|
37
|
+
* if (result.error === 'ok') {
|
|
38
|
+
* console.log('Transaction hash:', result.hash)
|
|
39
|
+
* console.log('Entry hash:', result.entry_hash)
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
submitAndWait(txPacked: Uint8Array | string): Promise<SubmitAndWaitTransactionResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* Get transaction by ID
|
|
46
|
+
*
|
|
47
|
+
* @param txid - Transaction ID (Base58 encoded)
|
|
48
|
+
* @returns Promise resolving to transaction data
|
|
49
|
+
* @throws {AmadeusSDKError} If transaction ID is invalid
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const tx = await sdk.transaction.get('5Kd3N...')
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
get(txid: string): Promise<Transaction>;
|
|
57
|
+
/**
|
|
58
|
+
* Get transactions by entry hash
|
|
59
|
+
*
|
|
60
|
+
* @param entryHash - Entry hash (Base58 encoded)
|
|
61
|
+
* @returns Promise resolving to transactions in the entry
|
|
62
|
+
* @throws {AmadeusSDKError} If entry hash is invalid
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* const { txs } = await sdk.transaction.getByEntry('5Kd3N...')
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
getByEntry(entryHash: string): Promise<GetTransactionsInEntryResponse>;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=transaction.d.ts.map
|