@thalalabs/surf 0.0.9 → 0.0.10
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/.github/dependabot.yml +11 -0
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/build/cjs/abi/aggregator.js +96 -0
- package/build/cjs/abi/aggregator.js.map +1 -0
- package/build/cjs/abi/optional_aggregator.js +137 -0
- package/build/cjs/abi/optional_aggregator.js.map +1 -0
- package/build/cjs/core/Client.js.map +1 -1
- package/build/cjs/core/createEntryPayload.js.map +1 -1
- package/build/cjs/core/createViewPayload.js.map +1 -1
- package/build/esm/abi/aggregator.js +93 -0
- package/build/esm/abi/aggregator.js.map +1 -0
- package/build/esm/abi/optional_aggregator.js +134 -0
- package/build/esm/abi/optional_aggregator.js.map +1 -0
- package/build/esm/core/Client.js.map +1 -1
- package/build/esm/core/createEntryPayload.js.map +1 -1
- package/build/esm/core/createViewPayload.js.map +1 -1
- package/build/types/abi/aggregator.d.ts +63 -0
- package/build/types/abi/aggregator.d.ts.map +1 -0
- package/build/types/abi/optional_aggregator.d.ts +88 -0
- package/build/types/abi/optional_aggregator.d.ts.map +1 -0
- package/build/types/core/Client.d.ts +95 -0
- package/build/types/core/Client.d.ts.map +1 -1
- package/build/types/core/createEntryPayload.d.ts +20 -0
- package/build/types/core/createEntryPayload.d.ts.map +1 -1
- package/build/types/core/createViewPayload.d.ts +16 -0
- package/build/types/core/createViewPayload.d.ts.map +1 -1
- package/build/types/types/defaultABITable.d.ts +4 -0
- package/build/types/types/defaultABITable.d.ts.map +1 -1
- package/build/types/types/struct.d.ts +4 -1
- package/build/types/types/struct.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/abi/aggregator.ts +92 -0
- package/src/abi/optional_aggregator.ts +133 -0
- package/src/core/Client.ts +97 -0
- package/src/core/__tests__/accountResource.test.ts +14 -1
- package/src/core/createEntryPayload.ts +20 -0
- package/src/core/createViewPayload.ts +16 -0
- package/src/types/defaultABITable.ts +4 -0
- package/src/types/struct.ts +7 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export declare const AGGREGATOR_ABI: {
|
|
2
|
+
readonly address: "0x1";
|
|
3
|
+
readonly name: "aggregator";
|
|
4
|
+
readonly friends: readonly [];
|
|
5
|
+
readonly exposed_functions: readonly [{
|
|
6
|
+
readonly name: "add";
|
|
7
|
+
readonly visibility: "public";
|
|
8
|
+
readonly is_entry: false;
|
|
9
|
+
readonly is_view: false;
|
|
10
|
+
readonly generic_type_params: readonly [];
|
|
11
|
+
readonly params: readonly ["&mut 0x1::aggregator::Aggregator", "u128"];
|
|
12
|
+
readonly return: readonly [];
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "destroy";
|
|
15
|
+
readonly visibility: "public";
|
|
16
|
+
readonly is_entry: false;
|
|
17
|
+
readonly is_view: false;
|
|
18
|
+
readonly generic_type_params: readonly [];
|
|
19
|
+
readonly params: readonly ["0x1::aggregator::Aggregator"];
|
|
20
|
+
readonly return: readonly [];
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "limit";
|
|
23
|
+
readonly visibility: "public";
|
|
24
|
+
readonly is_entry: false;
|
|
25
|
+
readonly is_view: false;
|
|
26
|
+
readonly generic_type_params: readonly [];
|
|
27
|
+
readonly params: readonly ["&0x1::aggregator::Aggregator"];
|
|
28
|
+
readonly return: readonly ["u128"];
|
|
29
|
+
}, {
|
|
30
|
+
readonly name: "read";
|
|
31
|
+
readonly visibility: "public";
|
|
32
|
+
readonly is_entry: false;
|
|
33
|
+
readonly is_view: false;
|
|
34
|
+
readonly generic_type_params: readonly [];
|
|
35
|
+
readonly params: readonly ["&0x1::aggregator::Aggregator"];
|
|
36
|
+
readonly return: readonly ["u128"];
|
|
37
|
+
}, {
|
|
38
|
+
readonly name: "sub";
|
|
39
|
+
readonly visibility: "public";
|
|
40
|
+
readonly is_entry: false;
|
|
41
|
+
readonly is_view: false;
|
|
42
|
+
readonly generic_type_params: readonly [];
|
|
43
|
+
readonly params: readonly ["&mut 0x1::aggregator::Aggregator", "u128"];
|
|
44
|
+
readonly return: readonly [];
|
|
45
|
+
}];
|
|
46
|
+
readonly structs: readonly [{
|
|
47
|
+
readonly name: "Aggregator";
|
|
48
|
+
readonly is_native: false;
|
|
49
|
+
readonly abilities: readonly ["store"];
|
|
50
|
+
readonly generic_type_params: readonly [];
|
|
51
|
+
readonly fields: readonly [{
|
|
52
|
+
readonly name: "handle";
|
|
53
|
+
readonly type: "address";
|
|
54
|
+
}, {
|
|
55
|
+
readonly name: "key";
|
|
56
|
+
readonly type: "address";
|
|
57
|
+
}, {
|
|
58
|
+
readonly name: "limit";
|
|
59
|
+
readonly type: "u128";
|
|
60
|
+
}];
|
|
61
|
+
}];
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=aggregator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregator.d.ts","sourceRoot":"","sources":["../../../src/abi/aggregator.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Ff,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export declare const OPTIONAL_AGGREGATOR_ABI: {
|
|
2
|
+
readonly address: "0x1";
|
|
3
|
+
readonly name: "optional_aggregator";
|
|
4
|
+
readonly friends: readonly ["0x1::coin"];
|
|
5
|
+
readonly exposed_functions: readonly [{
|
|
6
|
+
readonly name: "add";
|
|
7
|
+
readonly visibility: "public";
|
|
8
|
+
readonly is_entry: false;
|
|
9
|
+
readonly is_view: false;
|
|
10
|
+
readonly generic_type_params: readonly [];
|
|
11
|
+
readonly params: readonly ["&mut 0x1::optional_aggregator::OptionalAggregator", "u128"];
|
|
12
|
+
readonly return: readonly [];
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "destroy";
|
|
15
|
+
readonly visibility: "public";
|
|
16
|
+
readonly is_entry: false;
|
|
17
|
+
readonly is_view: false;
|
|
18
|
+
readonly generic_type_params: readonly [];
|
|
19
|
+
readonly params: readonly ["0x1::optional_aggregator::OptionalAggregator"];
|
|
20
|
+
readonly return: readonly [];
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "is_parallelizable";
|
|
23
|
+
readonly visibility: "public";
|
|
24
|
+
readonly is_entry: false;
|
|
25
|
+
readonly is_view: false;
|
|
26
|
+
readonly generic_type_params: readonly [];
|
|
27
|
+
readonly params: readonly ["&0x1::optional_aggregator::OptionalAggregator"];
|
|
28
|
+
readonly return: readonly ["bool"];
|
|
29
|
+
}, {
|
|
30
|
+
readonly name: "new";
|
|
31
|
+
readonly visibility: "friend";
|
|
32
|
+
readonly is_entry: false;
|
|
33
|
+
readonly is_view: false;
|
|
34
|
+
readonly generic_type_params: readonly [];
|
|
35
|
+
readonly params: readonly ["u128", "bool"];
|
|
36
|
+
readonly return: readonly ["0x1::optional_aggregator::OptionalAggregator"];
|
|
37
|
+
}, {
|
|
38
|
+
readonly name: "read";
|
|
39
|
+
readonly visibility: "public";
|
|
40
|
+
readonly is_entry: false;
|
|
41
|
+
readonly is_view: false;
|
|
42
|
+
readonly generic_type_params: readonly [];
|
|
43
|
+
readonly params: readonly ["&0x1::optional_aggregator::OptionalAggregator"];
|
|
44
|
+
readonly return: readonly ["u128"];
|
|
45
|
+
}, {
|
|
46
|
+
readonly name: "sub";
|
|
47
|
+
readonly visibility: "public";
|
|
48
|
+
readonly is_entry: false;
|
|
49
|
+
readonly is_view: false;
|
|
50
|
+
readonly generic_type_params: readonly [];
|
|
51
|
+
readonly params: readonly ["&mut 0x1::optional_aggregator::OptionalAggregator", "u128"];
|
|
52
|
+
readonly return: readonly [];
|
|
53
|
+
}, {
|
|
54
|
+
readonly name: "switch";
|
|
55
|
+
readonly visibility: "public";
|
|
56
|
+
readonly is_entry: false;
|
|
57
|
+
readonly is_view: false;
|
|
58
|
+
readonly generic_type_params: readonly [];
|
|
59
|
+
readonly params: readonly ["&mut 0x1::optional_aggregator::OptionalAggregator"];
|
|
60
|
+
readonly return: readonly [];
|
|
61
|
+
}];
|
|
62
|
+
readonly structs: readonly [{
|
|
63
|
+
readonly name: "Integer";
|
|
64
|
+
readonly is_native: false;
|
|
65
|
+
readonly abilities: readonly ["store"];
|
|
66
|
+
readonly generic_type_params: readonly [];
|
|
67
|
+
readonly fields: readonly [{
|
|
68
|
+
readonly name: "value";
|
|
69
|
+
readonly type: "u128";
|
|
70
|
+
}, {
|
|
71
|
+
readonly name: "limit";
|
|
72
|
+
readonly type: "u128";
|
|
73
|
+
}];
|
|
74
|
+
}, {
|
|
75
|
+
readonly name: "OptionalAggregator";
|
|
76
|
+
readonly is_native: false;
|
|
77
|
+
readonly abilities: readonly ["store"];
|
|
78
|
+
readonly generic_type_params: readonly [];
|
|
79
|
+
readonly fields: readonly [{
|
|
80
|
+
readonly name: "aggregator";
|
|
81
|
+
readonly type: "0x1::option::Option<0x1::aggregator::Aggregator>";
|
|
82
|
+
}, {
|
|
83
|
+
readonly name: "integer";
|
|
84
|
+
readonly type: "0x1::option::Option<0x1::optional_aggregator::Integer>";
|
|
85
|
+
}];
|
|
86
|
+
}];
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=optional_aggregator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional_aggregator.d.ts","sourceRoot":"","sources":["../../../src/abi/optional_aggregator.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoIxB,CAAC"}
|
|
@@ -3,18 +3,113 @@ import type { ABIEntryClient, ABIViewClient, ABIRoot, EntryOptions, EntryPayload
|
|
|
3
3
|
import type { TransactionResponse } from "../types/common.js";
|
|
4
4
|
import { ABIResourceClient } from "../types/abiClient.js";
|
|
5
5
|
import { ABITable } from "../types/struct.js";
|
|
6
|
+
/**
|
|
7
|
+
* Create a client to interact with Aptos smart contract.
|
|
8
|
+
*
|
|
9
|
+
* @param options.nodeUrl URL of the Aptos Node API endpoint.
|
|
10
|
+
* @returns The client object.
|
|
11
|
+
*/
|
|
6
12
|
export declare function createClient<TABITable extends ABITable = DefaultABITable>(options: {
|
|
7
13
|
nodeUrl: string;
|
|
8
14
|
}): Client<TABITable>;
|
|
9
15
|
export declare class Client<TABITable extends ABITable> {
|
|
10
16
|
private client;
|
|
11
17
|
constructor(client: AptosClient);
|
|
18
|
+
/**
|
|
19
|
+
* Call a view function.
|
|
20
|
+
*
|
|
21
|
+
* @param payload The payload object created by `createViewPayload`.
|
|
22
|
+
* @param options.ledger_version The ledger version.
|
|
23
|
+
* @returns The return value of view function.
|
|
24
|
+
* @example
|
|
25
|
+
* const viewPayload = createViewPayload(COIN_ABI, {
|
|
26
|
+
* function: 'balance',
|
|
27
|
+
* arguments: ['0x1'],
|
|
28
|
+
* type_arguments: ['0x1::aptos_coin::AptosCoin'],
|
|
29
|
+
* });
|
|
30
|
+
* const [balance] = await client.view(viewPayload);
|
|
31
|
+
*/
|
|
12
32
|
view<TReturn>(payload: ViewPayload<TReturn>, options?: ViewOptions): Promise<TReturn>;
|
|
33
|
+
/**
|
|
34
|
+
* Submit a transaction.
|
|
35
|
+
*
|
|
36
|
+
* @param payload The payload object created by `createEntryPayload`.
|
|
37
|
+
* @param options.account AptosAccount to submit the transaction.
|
|
38
|
+
* @returns The transaction response.
|
|
39
|
+
* @example
|
|
40
|
+
* const entryPayload = createEntryPayload(COIN_ABI, {
|
|
41
|
+
* function: 'transfer',
|
|
42
|
+
* arguments: ['0x1', 1],
|
|
43
|
+
* type_arguments: ['0x1::aptos_coin::AptosCoin'],
|
|
44
|
+
* });
|
|
45
|
+
*
|
|
46
|
+
* const { hash } = await client.submitTransaction(
|
|
47
|
+
* entryPayload,
|
|
48
|
+
* { account },
|
|
49
|
+
* );
|
|
50
|
+
*/
|
|
13
51
|
submitTransaction(payload: EntryPayload, options: EntryOptions): Promise<TransactionResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* Simulate a transaction.
|
|
54
|
+
*
|
|
55
|
+
* @param payload The payload object created by `createEntryPayload`.
|
|
56
|
+
* @param options.account AptosAccount to simulate the transaction.
|
|
57
|
+
* @returns The transaction response.
|
|
58
|
+
* @example
|
|
59
|
+
* const entryPayload = createEntryPayload(COIN_ABI, {
|
|
60
|
+
* function: 'transfer',
|
|
61
|
+
* arguments: ['0x1', 1],
|
|
62
|
+
* type_arguments: ['0x1::aptos_coin::AptosCoin'],
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* const { hash } = await client.simulateTransaction(
|
|
66
|
+
* entryPayload,
|
|
67
|
+
* { account },
|
|
68
|
+
* );
|
|
69
|
+
*/
|
|
14
70
|
simulateTransaction(payload: EntryPayload, options: EntryOptions): Promise<TransactionResponse>;
|
|
71
|
+
/**
|
|
72
|
+
* Create a client associated with a specific ABI.
|
|
73
|
+
*
|
|
74
|
+
* @param abi The ABI JSON.
|
|
75
|
+
* @returns A client can call view/entry functions or get account resource.
|
|
76
|
+
* @example
|
|
77
|
+
* const [balance] = await client.useABI(COIN_ABI).view.balance({
|
|
78
|
+
* arguments: ['0x1'],
|
|
79
|
+
* type_arguments: ['0x1::aptos_coin::AptosCoin'],
|
|
80
|
+
* });
|
|
81
|
+
*/
|
|
15
82
|
useABI<T extends ABIRoot>(abi: T): {
|
|
83
|
+
/**
|
|
84
|
+
* Call an view function.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* const [balance] = await client.useABI(COIN_ABI).view.balance({
|
|
88
|
+
* arguments: ['0x1'],
|
|
89
|
+
* type_arguments: ['0x1::aptos_coin::AptosCoin'],
|
|
90
|
+
* });
|
|
91
|
+
*/
|
|
16
92
|
view: ABIViewClient<T>;
|
|
93
|
+
/**
|
|
94
|
+
* Call an entry function.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* const { hash } = await client.useABI(COIN_ABI).entry.transfer({
|
|
98
|
+
* arguments: ['0x1', 1],
|
|
99
|
+
* type_arguments: ['0x1::aptos_coin::AptosCoin'],
|
|
100
|
+
* account,
|
|
101
|
+
* });
|
|
102
|
+
*/
|
|
17
103
|
entry: ABIEntryClient<T>;
|
|
104
|
+
/**
|
|
105
|
+
* Get account resource.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* const { data } = await client.useABI(COIN_ABI).resource.CoinStore({
|
|
109
|
+
* type_arguments: ['0x1::aptos_coin::AptosCoin'],
|
|
110
|
+
* account: '0x1',
|
|
111
|
+
* });
|
|
112
|
+
*/
|
|
18
113
|
resource: ABIResourceClient<TABITable, T>;
|
|
19
114
|
};
|
|
20
115
|
private generateRawTxn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Client.d.ts","sourceRoot":"","sources":["../../../src/core/Client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAmB,MAAM,OAAO,CAAC;AAGrD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACvJ,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,wBAAgB,YAAY,CAAC,SAAS,SAAS,QAAQ,GAAG,eAAe,EACpE,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,SAAS,CAAC,CAIpD;AAED,qBAAa,MAAM,CAAC,SAAS,SAAS,QAAQ;IAC1C,OAAO,CAAC,MAAM,CAAc;gBAEhB,MAAM,EAAE,WAAW;
|
|
1
|
+
{"version":3,"file":"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;;;WAQG;;;YAoBG,cAAc;CAW/B"}
|
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
import type { ABIRoot, EntryPayload } from "../types/index.js";
|
|
2
2
|
import type { EntryFunctionName, EntryRequestPayload } from "../types/common.js";
|
|
3
|
+
/**
|
|
4
|
+
* Create a payload for calling a entry function.
|
|
5
|
+
*
|
|
6
|
+
* @param abi The ABI JSON contains the entry function. For type inference and encoding/decoding purpose.
|
|
7
|
+
* @param payload.function The function name.
|
|
8
|
+
* @param payload.arguments The input arguments for function.
|
|
9
|
+
* @param payload.type_arguments The generic type arguments for function.
|
|
10
|
+
* @returns The payload object to be used in `simulateTransaction` or `submitTransaction` method.
|
|
11
|
+
* @example
|
|
12
|
+
* const entryPayload = createEntryPayload(COIN_ABI, {
|
|
13
|
+
* function: 'transfer',
|
|
14
|
+
* arguments: ['0x1', 1],
|
|
15
|
+
* type_arguments: ['0x1::aptos_coin::AptosCoin'],
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* const { hash } = await client.submitTransaction(
|
|
19
|
+
* entryPayload,
|
|
20
|
+
* { account },
|
|
21
|
+
* );
|
|
22
|
+
*/
|
|
3
23
|
export declare function createEntryPayload<T extends ABIRoot, TFuncName extends EntryFunctionName<T>>(abi: T, payload: EntryRequestPayload<T, TFuncName>): EntryPayload;
|
|
4
24
|
//# sourceMappingURL=createEntryPayload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createEntryPayload.d.ts","sourceRoot":"","sources":["../../../src/core/createEntryPayload.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEjF,wBAAgB,kBAAkB,CAC9B,CAAC,SAAS,OAAO,EACjB,SAAS,SAAS,iBAAiB,CAAC,CAAC,CAAC,EAEtC,GAAG,EAAE,CAAC,EACN,OAAO,EAAE,mBAAmB,CAAC,CAAC,EAAE,SAAS,CAAC,GAC3C,YAAY,CAoDd"}
|
|
1
|
+
{"version":3,"file":"createEntryPayload.d.ts","sourceRoot":"","sources":["../../../src/core/createEntryPayload.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEjF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAC9B,CAAC,SAAS,OAAO,EACjB,SAAS,SAAS,iBAAiB,CAAC,CAAC,CAAC,EAEtC,GAAG,EAAE,CAAC,EACN,OAAO,EAAE,mBAAmB,CAAC,CAAC,EAAE,SAAS,CAAC,GAC3C,YAAY,CAoDd"}
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import type { ABIRoot, ViewPayload } from "../types/index.js";
|
|
2
2
|
import type { ExtractReturnType, ViewFunctionName, ViewRequestPayload } from "../types/common.js";
|
|
3
|
+
/**
|
|
4
|
+
* Create a payload for calling a view function.
|
|
5
|
+
*
|
|
6
|
+
* @param abi The ABI JSON contains the view function. For type inference and encoding/decoding purpose.
|
|
7
|
+
* @param payload.function The function name.
|
|
8
|
+
* @param payload.arguments The input arguments for function.
|
|
9
|
+
* @param payload.type_arguments The generic type arguments for function.
|
|
10
|
+
* @returns The payload object to be used in `view` method.
|
|
11
|
+
* @example
|
|
12
|
+
* const viewPayload = createViewPayload(COIN_ABI, {
|
|
13
|
+
* function: 'balance',
|
|
14
|
+
* arguments: ['0x1'],
|
|
15
|
+
* type_arguments: ['0x1::aptos_coin::AptosCoin'],
|
|
16
|
+
* });
|
|
17
|
+
* const [balance] = await client.view(viewPayload);
|
|
18
|
+
*/
|
|
3
19
|
export declare function createViewPayload<T extends ABIRoot, TFuncName extends ViewFunctionName<T>>(abi: T, payload: ViewRequestPayload<T, TFuncName>): ViewPayload<ExtractReturnType<T, TFuncName>>;
|
|
4
20
|
//# sourceMappingURL=createViewPayload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createViewPayload.d.ts","sourceRoot":"","sources":["../../../src/core/createViewPayload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAKlG,wBAAgB,iBAAiB,CAC7B,CAAC,SAAS,OAAO,EACjB,SAAS,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAErC,GAAG,EAAE,CAAC,EACN,OAAO,EAAE,kBAAkB,CAAC,CAAC,EAAE,SAAS,CAAC,GAEzC,WAAW,CAAC,iBAAiB,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAgD/C"}
|
|
1
|
+
{"version":3,"file":"createViewPayload.d.ts","sourceRoot":"","sources":["../../../src/core/createViewPayload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAKlG;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAC7B,CAAC,SAAS,OAAO,EACjB,SAAS,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAErC,GAAG,EAAE,CAAC,EACN,OAAO,EAAE,kBAAkB,CAAC,CAAC,EAAE,SAAS,CAAC,GAEzC,WAAW,CAAC,iBAAiB,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAgD/C"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { AGGREGATOR_ABI } from "../abi/aggregator.js";
|
|
1
2
|
import type { COIN_ABI } from "../abi/coin.js";
|
|
2
3
|
import type { EVENT_ABI } from "../abi/event.js";
|
|
3
4
|
import type { GUID_ABI } from "../abi/guid.js";
|
|
5
|
+
import { OPTIONAL_AGGREGATOR_ABI } from "../abi/optional_aggregator.js";
|
|
4
6
|
import { TABLE_ABI } from "../abi/table.js";
|
|
5
7
|
export type DefaultABITable = {
|
|
6
8
|
'0x1::coin': typeof COIN_ABI;
|
|
7
9
|
'0x1::event': typeof EVENT_ABI;
|
|
8
10
|
'0x1::guid': typeof GUID_ABI;
|
|
9
11
|
'0x1::table': typeof TABLE_ABI;
|
|
12
|
+
'0x1::optional_aggregator': typeof OPTIONAL_AGGREGATOR_ABI;
|
|
13
|
+
'0x1::aggregator': typeof AGGREGATOR_ABI;
|
|
10
14
|
};
|
|
11
15
|
//# sourceMappingURL=defaultABITable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultABITable.d.ts","sourceRoot":"","sources":["../../../src/types/defaultABITable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG;IAC1B,WAAW,EAAE,OAAO,QAAQ,CAAC;IAC7B,YAAY,EAAE,OAAO,SAAS,CAAC;IAC/B,WAAW,EAAE,OAAO,QAAQ,CAAC;IAC7B,YAAY,EAAE,OAAO,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"defaultABITable.d.ts","sourceRoot":"","sources":["../../../src/types/defaultABITable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG;IAC1B,WAAW,EAAE,OAAO,QAAQ,CAAC;IAC7B,YAAY,EAAE,OAAO,SAAS,CAAC;IAC/B,WAAW,EAAE,OAAO,QAAQ,CAAC;IAC7B,YAAY,EAAE,OAAO,SAAS,CAAC;IAC/B,0BAA0B,EAAE,OAAO,uBAAuB,CAAC;IAC3D,iBAAiB,EAAE,OAAO,cAAc,CAAC;CAC5C,CAAC"}
|
|
@@ -11,8 +11,11 @@ type ExtractStruct<T extends ABIRoot, TResourceName extends ResourceStructName<T
|
|
|
11
11
|
type ExtractStructFieldMoveType<T extends ABIRoot, TStructName extends ResourceStructName<T>, TFieldName extends string> = Extract<ExtractStruct<T, TStructName>['fields'][number], {
|
|
12
12
|
name: TFieldName;
|
|
13
13
|
}>['type'];
|
|
14
|
-
type ConvertStructFieldType<TABITable extends ABITable, TMoveType extends string> = TMoveType extends AllTypes ? ConvertStructFieldNonStructType<TABITable, TMoveType> : ConvertStructFieldStructType<TABITable, TMoveType>;
|
|
14
|
+
type ConvertStructFieldType<TABITable extends ABITable, TMoveType extends string> = TMoveType extends AllTypes ? ConvertStructFieldNonStructType<TABITable, TMoveType> : TMoveType extends `0x1::option::Option<${infer TInner}>` ? ConvertStructFieldOptionType<TABITable, TInner> : ConvertStructFieldStructType<TABITable, TMoveType>;
|
|
15
15
|
export type ConvertStructFieldNonStructType<TABITable extends ABITable, TMoveType extends AllTypes> = TMoveType extends Primitive ? ConvertPrimitiveStructField<TMoveType> : TMoveType extends `vector<${infer TInner}>` ? ConvertStructFieldType<TABITable, TInner>[] : Struct<TMoveType>;
|
|
16
|
+
type ConvertStructFieldOptionType<TABITable extends ABITable, TMoveType extends string> = {
|
|
17
|
+
vec: [ConvertStructFieldType<TABITable, TMoveType>] | [];
|
|
18
|
+
};
|
|
16
19
|
type ConvertStructFieldStructType<TABITable extends ABITable, TMoveType extends string> = TMoveType extends `${infer TAccountAddress}::${infer TModuleName}::${infer TStructName}${'' | `<${infer _TInnerType}>`}` ? `${TAccountAddress}::${TModuleName}` extends keyof TABITable ? OmitInner<TStructName> extends ResourceStructName<TABITable[`${TAccountAddress}::${TModuleName}`]> ? ExtractStructType<TABITable, TABITable[`${TAccountAddress}::${TModuleName}`], OmitInner<TStructName>> : Struct<TMoveType> : Struct<TMoveType> : Struct<TMoveType>;
|
|
17
20
|
export type ExtractStructType<TABITable extends ABITable, TABI extends ABIRoot, TStructName extends ResourceStructName<TABI>> = {
|
|
18
21
|
[TField in ExtractStructFieldsName<TABI, TStructName>]: ConvertStructFieldType<TABITable, ExtractStructFieldMoveType<TABI, TStructName, TField>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"struct.d.ts","sourceRoot":"","sources":["../../../src/types/struct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAErE,KAAK,MAAM,CAAC,EAAE,SAAS,MAAM,IAAI,MAAM,CAAC;AAExC,MAAM,MAAM,2BAA2B,CAAC,CAAC,SAAS,SAAS,IACvD,CAAC,SAAS,MAAM,GAAG,OAAO,GAC1B,CAAC,SAAS,IAAI,GAAG,MAAM,GACvB,CAAC,SAAS,KAAK,GAAG,MAAM,GACxB,CAAC,SAAS,KAAK,GAAG,MAAM,GACxB,CAAC,SAAS,KAAK,GAAG,MAAM,GACxB,CAAC,SAAS,MAAM,GAAG,MAAM,GACzB,CAAC,SAAS,MAAM,GAAG,MAAM,GACzB,CAAC,SAAS,SAAS,GAAG,K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ptos Smart Contracts with type safety.",
|
|
5
5
|
"main": "./build/cjs/index.js",
|
|
6
6
|
"module": "./build/esm/index.js",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"@typescript-eslint/eslint-plugin": "~5.59",
|
|
41
41
|
"@typescript-eslint/parser": "~5.59",
|
|
42
42
|
"aptos": "^1.9.0",
|
|
43
|
-
"eslint": "~8.
|
|
43
|
+
"eslint": "~8.44",
|
|
44
44
|
"eslint-config-prettier": "~8.8",
|
|
45
45
|
"eslint-plugin-jest": "~27.2",
|
|
46
|
-
"jest": "~29.
|
|
46
|
+
"jest": "~29.6",
|
|
47
47
|
"prettier": "~2.8",
|
|
48
48
|
"react": "^18.2.0",
|
|
49
49
|
"rimraf": "~5.0",
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export const AGGREGATOR_ABI = {
|
|
2
|
+
"address": "0x1",
|
|
3
|
+
"name": "aggregator",
|
|
4
|
+
"friends": [],
|
|
5
|
+
"exposed_functions": [
|
|
6
|
+
{
|
|
7
|
+
"name": "add",
|
|
8
|
+
"visibility": "public",
|
|
9
|
+
"is_entry": false,
|
|
10
|
+
"is_view": false,
|
|
11
|
+
"generic_type_params": [],
|
|
12
|
+
"params": [
|
|
13
|
+
"&mut 0x1::aggregator::Aggregator",
|
|
14
|
+
"u128"
|
|
15
|
+
],
|
|
16
|
+
"return": []
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "destroy",
|
|
20
|
+
"visibility": "public",
|
|
21
|
+
"is_entry": false,
|
|
22
|
+
"is_view": false,
|
|
23
|
+
"generic_type_params": [],
|
|
24
|
+
"params": [
|
|
25
|
+
"0x1::aggregator::Aggregator"
|
|
26
|
+
],
|
|
27
|
+
"return": []
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "limit",
|
|
31
|
+
"visibility": "public",
|
|
32
|
+
"is_entry": false,
|
|
33
|
+
"is_view": false,
|
|
34
|
+
"generic_type_params": [],
|
|
35
|
+
"params": [
|
|
36
|
+
"&0x1::aggregator::Aggregator"
|
|
37
|
+
],
|
|
38
|
+
"return": [
|
|
39
|
+
"u128"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "read",
|
|
44
|
+
"visibility": "public",
|
|
45
|
+
"is_entry": false,
|
|
46
|
+
"is_view": false,
|
|
47
|
+
"generic_type_params": [],
|
|
48
|
+
"params": [
|
|
49
|
+
"&0x1::aggregator::Aggregator"
|
|
50
|
+
],
|
|
51
|
+
"return": [
|
|
52
|
+
"u128"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "sub",
|
|
57
|
+
"visibility": "public",
|
|
58
|
+
"is_entry": false,
|
|
59
|
+
"is_view": false,
|
|
60
|
+
"generic_type_params": [],
|
|
61
|
+
"params": [
|
|
62
|
+
"&mut 0x1::aggregator::Aggregator",
|
|
63
|
+
"u128"
|
|
64
|
+
],
|
|
65
|
+
"return": []
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"structs": [
|
|
69
|
+
{
|
|
70
|
+
"name": "Aggregator",
|
|
71
|
+
"is_native": false,
|
|
72
|
+
"abilities": [
|
|
73
|
+
"store"
|
|
74
|
+
],
|
|
75
|
+
"generic_type_params": [],
|
|
76
|
+
"fields": [
|
|
77
|
+
{
|
|
78
|
+
"name": "handle",
|
|
79
|
+
"type": "address"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "key",
|
|
83
|
+
"type": "address"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "limit",
|
|
87
|
+
"type": "u128"
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
} as const;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
export const OPTIONAL_AGGREGATOR_ABI = {
|
|
2
|
+
"address": "0x1",
|
|
3
|
+
"name": "optional_aggregator",
|
|
4
|
+
"friends": [
|
|
5
|
+
"0x1::coin"
|
|
6
|
+
],
|
|
7
|
+
"exposed_functions": [
|
|
8
|
+
{
|
|
9
|
+
"name": "add",
|
|
10
|
+
"visibility": "public",
|
|
11
|
+
"is_entry": false,
|
|
12
|
+
"is_view": false,
|
|
13
|
+
"generic_type_params": [],
|
|
14
|
+
"params": [
|
|
15
|
+
"&mut 0x1::optional_aggregator::OptionalAggregator",
|
|
16
|
+
"u128"
|
|
17
|
+
],
|
|
18
|
+
"return": []
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "destroy",
|
|
22
|
+
"visibility": "public",
|
|
23
|
+
"is_entry": false,
|
|
24
|
+
"is_view": false,
|
|
25
|
+
"generic_type_params": [],
|
|
26
|
+
"params": [
|
|
27
|
+
"0x1::optional_aggregator::OptionalAggregator"
|
|
28
|
+
],
|
|
29
|
+
"return": []
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "is_parallelizable",
|
|
33
|
+
"visibility": "public",
|
|
34
|
+
"is_entry": false,
|
|
35
|
+
"is_view": false,
|
|
36
|
+
"generic_type_params": [],
|
|
37
|
+
"params": [
|
|
38
|
+
"&0x1::optional_aggregator::OptionalAggregator"
|
|
39
|
+
],
|
|
40
|
+
"return": [
|
|
41
|
+
"bool"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "new",
|
|
46
|
+
"visibility": "friend",
|
|
47
|
+
"is_entry": false,
|
|
48
|
+
"is_view": false,
|
|
49
|
+
"generic_type_params": [],
|
|
50
|
+
"params": [
|
|
51
|
+
"u128",
|
|
52
|
+
"bool"
|
|
53
|
+
],
|
|
54
|
+
"return": [
|
|
55
|
+
"0x1::optional_aggregator::OptionalAggregator"
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "read",
|
|
60
|
+
"visibility": "public",
|
|
61
|
+
"is_entry": false,
|
|
62
|
+
"is_view": false,
|
|
63
|
+
"generic_type_params": [],
|
|
64
|
+
"params": [
|
|
65
|
+
"&0x1::optional_aggregator::OptionalAggregator"
|
|
66
|
+
],
|
|
67
|
+
"return": [
|
|
68
|
+
"u128"
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "sub",
|
|
73
|
+
"visibility": "public",
|
|
74
|
+
"is_entry": false,
|
|
75
|
+
"is_view": false,
|
|
76
|
+
"generic_type_params": [],
|
|
77
|
+
"params": [
|
|
78
|
+
"&mut 0x1::optional_aggregator::OptionalAggregator",
|
|
79
|
+
"u128"
|
|
80
|
+
],
|
|
81
|
+
"return": []
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"name": "switch",
|
|
85
|
+
"visibility": "public",
|
|
86
|
+
"is_entry": false,
|
|
87
|
+
"is_view": false,
|
|
88
|
+
"generic_type_params": [],
|
|
89
|
+
"params": [
|
|
90
|
+
"&mut 0x1::optional_aggregator::OptionalAggregator"
|
|
91
|
+
],
|
|
92
|
+
"return": []
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"structs": [
|
|
96
|
+
{
|
|
97
|
+
"name": "Integer",
|
|
98
|
+
"is_native": false,
|
|
99
|
+
"abilities": [
|
|
100
|
+
"store"
|
|
101
|
+
],
|
|
102
|
+
"generic_type_params": [],
|
|
103
|
+
"fields": [
|
|
104
|
+
{
|
|
105
|
+
"name": "value",
|
|
106
|
+
"type": "u128"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "limit",
|
|
110
|
+
"type": "u128"
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "OptionalAggregator",
|
|
116
|
+
"is_native": false,
|
|
117
|
+
"abilities": [
|
|
118
|
+
"store"
|
|
119
|
+
],
|
|
120
|
+
"generic_type_params": [],
|
|
121
|
+
"fields": [
|
|
122
|
+
{
|
|
123
|
+
"name": "aggregator",
|
|
124
|
+
"type": "0x1::option::Option<0x1::aggregator::Aggregator>"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "integer",
|
|
128
|
+
"type": "0x1::option::Option<0x1::optional_aggregator::Integer>"
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
} as const;
|