@thalalabs/surf 0.0.16 → 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/CHANGELOG.md +6 -0
- package/README.md +44 -45
- package/build/cjs/core/Client.js +55 -41
- package/build/cjs/core/Client.js.map +1 -1
- package/build/cjs/core/WalletClient.js +20 -31
- package/build/cjs/core/WalletClient.js.map +1 -1
- package/build/cjs/core/createEntryPayload.js +9 -91
- package/build/cjs/core/createEntryPayload.js.map +1 -1
- package/build/cjs/core/createViewPayload.js +26 -52
- package/build/cjs/core/createViewPayload.js.map +1 -1
- package/build/cjs/core/index.js +2 -2
- package/build/cjs/core/index.js.map +1 -1
- package/build/cjs/ensureTypes.js.map +1 -1
- package/build/cjs/hooks/index.js.map +1 -1
- package/build/cjs/hooks/useSubmitTransaction.js +25 -46
- package/build/cjs/hooks/useSubmitTransaction.js.map +1 -1
- package/build/cjs/hooks/useWalletClient.js +2 -2
- package/build/cjs/hooks/useWalletClient.js.map +1 -1
- package/build/cjs/index.js +2 -2
- package/build/cjs/index.js.map +1 -1
- package/build/esm/core/Client.js +53 -39
- package/build/esm/core/Client.js.map +1 -1
- package/build/esm/core/WalletClient.js +20 -31
- package/build/esm/core/WalletClient.js.map +1 -1
- package/build/esm/core/createEntryPayload.js +9 -91
- package/build/esm/core/createEntryPayload.js.map +1 -1
- package/build/esm/core/createViewPayload.js +26 -52
- package/build/esm/core/createViewPayload.js.map +1 -1
- package/build/esm/core/index.js +1 -1
- package/build/esm/core/index.js.map +1 -1
- package/build/esm/ensureTypes.js.map +1 -1
- package/build/esm/hooks/index.js.map +1 -1
- package/build/esm/hooks/useSubmitTransaction.js +25 -46
- package/build/esm/hooks/useSubmitTransaction.js.map +1 -1
- package/build/esm/hooks/useWalletClient.js +2 -2
- package/build/esm/hooks/useWalletClient.js.map +1 -1
- package/build/esm/index.js +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/types/core/Client.d.ts +61 -48
- package/build/types/core/Client.d.ts.map +1 -1
- package/build/types/core/WalletClient.d.ts +3 -5
- package/build/types/core/WalletClient.d.ts.map +1 -1
- package/build/types/core/createEntryPayload.d.ts +8 -8
- package/build/types/core/createEntryPayload.d.ts.map +1 -1
- package/build/types/core/createViewPayload.d.ts +4 -4
- package/build/types/core/createViewPayload.d.ts.map +1 -1
- package/build/types/core/index.d.ts +1 -1
- package/build/types/core/index.d.ts.map +1 -1
- package/build/types/ensureTypes.d.ts.map +1 -1
- package/build/types/hooks/index.d.ts +1 -1
- package/build/types/hooks/index.d.ts.map +1 -1
- package/build/types/hooks/useSubmitTransaction.d.ts +3 -11
- package/build/types/hooks/useSubmitTransaction.d.ts.map +1 -1
- package/build/types/hooks/useWalletClient.d.ts +1 -3
- package/build/types/hooks/useWalletClient.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/types/abi.d.ts.map +1 -1
- package/build/types/types/client/abiClient.d.ts +12 -16
- package/build/types/types/client/abiClient.d.ts.map +1 -1
- package/build/types/types/client/client.d.ts +11 -23
- package/build/types/types/client/client.d.ts.map +1 -1
- package/build/types/types/convertor/argsConvertor.d.ts +1 -1
- package/build/types/types/convertor/argsConvertor.d.ts.map +1 -1
- package/build/types/types/convertor/genericConvertor.d.ts.map +1 -1
- package/build/types/types/convertor/returnConvertor.d.ts +1 -1
- package/build/types/types/index.d.ts +1 -1
- package/build/types/types/index.d.ts.map +1 -1
- package/package.json +8 -9
- package/src/core/Client.ts +110 -114
- package/src/core/WalletClient.ts +21 -31
- package/src/core/__tests__/accountResource.test.ts +56 -54
- package/src/core/__tests__/createEntryPayload.test.ts +34 -34
- package/src/core/__tests__/createViewPayload.test.ts +94 -111
- package/src/core/__tests__/option.test.ts +38 -31
- package/src/core/__tests__/submitTransaction.test.ts +58 -26
- package/src/core/__tests__/useABI.test.ts +38 -38
- package/src/core/__tests__/view.test.ts +36 -30
- package/src/core/__tests__/view_vector.test.ts +52 -50
- package/src/core/createEntryPayload.ts +24 -143
- package/src/core/createViewPayload.ts +40 -68
- package/src/core/index.ts +1 -1
- package/src/ensureTypes.ts +1 -0
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useSubmitTransaction.ts +35 -68
- package/src/hooks/useWalletClient.ts +2 -2
- package/src/index.ts +1 -1
- package/src/types/abi.ts +1 -0
- package/src/types/client/abiClient.ts +12 -16
- package/src/types/client/client.ts +11 -25
- package/src/types/convertor/argsConvertor.ts +1 -1
- package/src/types/convertor/genericConvertor.ts +2 -0
- package/src/types/convertor/returnConvertor.ts +3 -3
- package/src/types/index.ts +0 -2
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* The types for the `Client` class.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { AptosAccount, TxnBuilderTypes } from 'aptos';
|
|
6
5
|
import { ABIRoot } from '../abi.js';
|
|
7
6
|
import {
|
|
8
7
|
EntryFunctionName,
|
|
@@ -11,29 +10,19 @@ import {
|
|
|
11
10
|
ViewFunctionName,
|
|
12
11
|
ExtractArgsType,
|
|
13
12
|
} from '../extractor/functionExtractor.js';
|
|
13
|
+
import { EntryFunctionArgumentTypes, MoveFunctionId, MoveStructId, MoveValue, SimpleEntryFunctionArgumentTypes } from '@aptos-labs/ts-sdk';
|
|
14
14
|
|
|
15
15
|
export type TransactionResponse = {
|
|
16
16
|
hash: string;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export type EntryOptions = {
|
|
20
|
-
account: AptosAccount;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export type ViewOptions = {
|
|
24
|
-
ledger_version?: string;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
19
|
/**
|
|
28
20
|
* The return payload type of `createEntryPayload`
|
|
29
21
|
*/
|
|
30
22
|
export type EntryPayload = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
arguments: any[];
|
|
35
|
-
};
|
|
36
|
-
entryRequest: TxnBuilderTypes.EntryFunction;
|
|
23
|
+
function: MoveFunctionId;
|
|
24
|
+
typeArguments: Array<string>;
|
|
25
|
+
functionArguments: Array<EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes>;
|
|
37
26
|
};
|
|
38
27
|
|
|
39
28
|
/**
|
|
@@ -44,8 +33,8 @@ export type EntryRequestPayload<
|
|
|
44
33
|
TFuncName extends EntryFunctionName<T>,
|
|
45
34
|
> = {
|
|
46
35
|
function: TFuncName;
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
functionArguments: ExtractArgsTypeOmitSigner<T, TFuncName>;
|
|
37
|
+
typeArguments: ExtractGenericArgsType<T, TFuncName>;
|
|
49
38
|
};
|
|
50
39
|
|
|
51
40
|
/**
|
|
@@ -56,18 +45,15 @@ export type ViewRequestPayload<
|
|
|
56
45
|
TFuncName extends ViewFunctionName<T>,
|
|
57
46
|
> = {
|
|
58
47
|
function: TFuncName;
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
functionArguments: ExtractArgsType<T, TFuncName>;
|
|
49
|
+
typeArguments: ExtractGenericArgsType<T, TFuncName>;
|
|
61
50
|
};
|
|
62
51
|
|
|
63
52
|
/**
|
|
64
53
|
* The return payload type of `createViewPayload`
|
|
65
54
|
*/
|
|
66
55
|
export type ViewPayload<_TReturn> = {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
arguments: any[];
|
|
71
|
-
};
|
|
72
|
-
decoders: (((value: any) => any) | null)[];
|
|
56
|
+
function: MoveFunctionId;
|
|
57
|
+
typeArguments?: Array<MoveStructId>;
|
|
58
|
+
functionArguments?: Array<MoveValue>;
|
|
73
59
|
};
|
|
@@ -57,5 +57,5 @@ type ConvertNonStructArgType<TMoveType extends MoveNonStructTypes> =
|
|
|
57
57
|
: TMoveType extends `0x1::object::Object<${string}>`
|
|
58
58
|
? `0x${string}`
|
|
59
59
|
: TMoveType extends `0x1::option::Option<${infer TInner}>`
|
|
60
|
-
?
|
|
60
|
+
? ConvertArgType<TInner> | null
|
|
61
61
|
: UnknownStruct<TMoveType>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Convert an array of generic arguments from Move type to TypeScript type.
|
|
3
3
|
*/
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
5
|
export type ConvertGenerics<T extends readonly any[]> = T extends readonly [
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
7
|
any,
|
|
6
8
|
...infer TRest,
|
|
7
9
|
]
|
|
@@ -36,11 +36,11 @@ type ConvertPrimitiveReturnType<TMoveType extends MovePrimitive> =
|
|
|
36
36
|
: TMoveType extends 'u32'
|
|
37
37
|
? number
|
|
38
38
|
: TMoveType extends 'u64'
|
|
39
|
-
?
|
|
39
|
+
? string
|
|
40
40
|
: TMoveType extends 'u128'
|
|
41
|
-
?
|
|
41
|
+
? string
|
|
42
42
|
: TMoveType extends 'u256'
|
|
43
|
-
?
|
|
43
|
+
? string
|
|
44
44
|
: TMoveType extends 'address'
|
|
45
45
|
? `0x${string}`
|
|
46
46
|
: TMoveType extends '0x1::string::String'
|