@azguardwallet/types 0.3.1 → 0.3.2
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/README.md +4 -3
- package/dist/operation.d.ts +11 -15
- package/dist/result.d.ts +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@ import type {
|
|
|
30
30
|
CallAction,
|
|
31
31
|
FailedResult,
|
|
32
32
|
OkResult,
|
|
33
|
+
SendTransactionResult,
|
|
33
34
|
} from "@azguardwallet/types";
|
|
34
35
|
|
|
35
36
|
if (!window.azguard) {
|
|
@@ -58,11 +59,11 @@ const [result] = await azguard.request("execute", {
|
|
|
58
59
|
],
|
|
59
60
|
});
|
|
60
61
|
|
|
61
|
-
if (result.
|
|
62
|
-
const txHash = (result as OkResult<
|
|
62
|
+
if (result.status === "ok") {
|
|
63
|
+
const txHash = (result as OkResult<SendTransactionResult>).result;
|
|
63
64
|
// ...
|
|
64
65
|
}
|
|
65
|
-
else if (result.
|
|
66
|
+
else if (result.status === "failed") {
|
|
66
67
|
const error = (result as FailedResult).error;
|
|
67
68
|
// ...
|
|
68
69
|
}
|
package/dist/operation.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type OperationKind = "add_note" | "get_complete_address" | "register_cont
|
|
|
6
6
|
/** A request to perform some operation */
|
|
7
7
|
export type Operation = AddNoteOperation | GetCompleteAddressOperation | RegisterContractOperation | RegisterSenderOperation | SendTransactionOperation | SimulateTransactionOperation | SimulateUnconstrainedOperation | SimulateViewsOperation;
|
|
8
8
|
/** Operation result */
|
|
9
|
-
export type OperationResult = AddNoteResult | GetCompleteAddressResult | RegisterContractResult | RegisterSenderResult | SendTransactionResult | SimulateTransactionResult | SimulateUnconstrainedResult | SimulateViewsResult
|
|
9
|
+
export type OperationResult = Result<AddNoteResult> | Result<GetCompleteAddressResult> | Result<RegisterContractResult> | Result<RegisterSenderResult> | Result<SendTransactionResult> | Result<SimulateTransactionResult> | Result<SimulateUnconstrainedResult> | Result<SimulateViewsResult>;
|
|
10
10
|
/** A request to add a note to PXE */
|
|
11
11
|
export type AddNoteOperation = {
|
|
12
12
|
/** Operation kind */
|
|
@@ -17,7 +17,7 @@ export type AddNoteOperation = {
|
|
|
17
17
|
note: unknown;
|
|
18
18
|
};
|
|
19
19
|
/** A result of the "add_note" operation */
|
|
20
|
-
export type AddNoteResult =
|
|
20
|
+
export type AddNoteResult = void;
|
|
21
21
|
/** A request to get complete address of the specified account */
|
|
22
22
|
export type GetCompleteAddressOperation = {
|
|
23
23
|
/** Operation kind */
|
|
@@ -26,7 +26,7 @@ export type GetCompleteAddressOperation = {
|
|
|
26
26
|
account: CaipAccount;
|
|
27
27
|
};
|
|
28
28
|
/** A result of the "get_complete_address" operation (CompleteAddress) */
|
|
29
|
-
export type GetCompleteAddressResult =
|
|
29
|
+
export type GetCompleteAddressResult = unknown;
|
|
30
30
|
/** A request to register contract in PXE */
|
|
31
31
|
export type RegisterContractOperation = {
|
|
32
32
|
/** Operation kind */
|
|
@@ -47,7 +47,7 @@ export type RegisterContractOperation = {
|
|
|
47
47
|
artifact?: unknown;
|
|
48
48
|
};
|
|
49
49
|
/** A result of the "register_contract" operation */
|
|
50
|
-
export type RegisterContractResult =
|
|
50
|
+
export type RegisterContractResult = void;
|
|
51
51
|
/** A request to register sender in PXE */
|
|
52
52
|
export type RegisterSenderOperation = {
|
|
53
53
|
/** Operation kind */
|
|
@@ -58,7 +58,7 @@ export type RegisterSenderOperation = {
|
|
|
58
58
|
address: string;
|
|
59
59
|
};
|
|
60
60
|
/** A result of the "register_sender" operation */
|
|
61
|
-
export type RegisterSenderResult =
|
|
61
|
+
export type RegisterSenderResult = void;
|
|
62
62
|
/** A request to send the transaction */
|
|
63
63
|
export type SendTransactionOperation = {
|
|
64
64
|
/** Operation kind */
|
|
@@ -77,7 +77,7 @@ export type SendTransactionOperation = {
|
|
|
77
77
|
setup?: Action[];
|
|
78
78
|
};
|
|
79
79
|
/** A result of the "send_transaction" operation (TxHash) */
|
|
80
|
-
export type SendTransactionResult =
|
|
80
|
+
export type SendTransactionResult = string;
|
|
81
81
|
/** A request to simulate the transaction */
|
|
82
82
|
export type SimulateTransactionOperation = {
|
|
83
83
|
/** Operation kind */
|
|
@@ -97,8 +97,8 @@ export type SimulateTransactionOperation = {
|
|
|
97
97
|
/** Whether to also simulate enqueued public calls or not */
|
|
98
98
|
simulatePublic?: boolean;
|
|
99
99
|
};
|
|
100
|
-
/**
|
|
101
|
-
export type
|
|
100
|
+
/** A result of the "simulate_transaction" operation */
|
|
101
|
+
export type SimulateTransactionResult = {
|
|
102
102
|
/** Gas usage info (GasUsed) */
|
|
103
103
|
gasUsed: unknown;
|
|
104
104
|
/** Private return values (NestedProcessReturnValues) */
|
|
@@ -106,8 +106,6 @@ export type SimulationReturn = {
|
|
|
106
106
|
/** Public return values (NestedProcessReturnValues[]) */
|
|
107
107
|
publicReturn: unknown[];
|
|
108
108
|
};
|
|
109
|
-
/** A result of the "simulate_transaction" operation */
|
|
110
|
-
export type SimulateTransactionResult = Result<SimulationReturn>;
|
|
111
109
|
/** A request to simulate the unconstrained function */
|
|
112
110
|
export type SimulateUnconstrainedOperation = {
|
|
113
111
|
/** Operation kind */
|
|
@@ -122,7 +120,7 @@ export type SimulateUnconstrainedOperation = {
|
|
|
122
120
|
args: any[];
|
|
123
121
|
};
|
|
124
122
|
/** A result of the "simulate_unconstrained" operation (AbiDecoded) */
|
|
125
|
-
export type SimulateUnconstrainedResult =
|
|
123
|
+
export type SimulateUnconstrainedResult = unknown;
|
|
126
124
|
/** A request to simulate the batch of view calls */
|
|
127
125
|
export type SimulateViewsOperation = {
|
|
128
126
|
/** Operation kind */
|
|
@@ -132,12 +130,10 @@ export type SimulateViewsOperation = {
|
|
|
132
130
|
/** Batch of view calls to simulate */
|
|
133
131
|
calls: (CallAction | EncodedCallAction)[];
|
|
134
132
|
};
|
|
135
|
-
/**
|
|
136
|
-
export type
|
|
133
|
+
/** A result of the "simulate_views" operation */
|
|
134
|
+
export type SimulateViewsResult = {
|
|
137
135
|
/** List of results, encoded with function return types ABI (Fr[][]) */
|
|
138
136
|
encoded: string[][];
|
|
139
137
|
/** List of results, decoded with function return types ABI (AbiDecoded[]) */
|
|
140
138
|
decoded: unknown[];
|
|
141
139
|
};
|
|
142
|
-
/** A result of the "simulate_views" operation */
|
|
143
|
-
export type SimulateViewsResult = Result<ViewsSimulationResult>;
|
package/dist/result.d.ts
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
export type Result<T> = OkResult<T> | FailedResult | SkippedResult;
|
|
3
3
|
/** Successful result, containing returned value */
|
|
4
4
|
export type OkResult<T> = {
|
|
5
|
-
/** Result
|
|
6
|
-
|
|
5
|
+
/** Result status */
|
|
6
|
+
status: "ok";
|
|
7
7
|
/** Returned value */
|
|
8
8
|
result: T;
|
|
9
9
|
};
|
|
10
10
|
/** Failed result, containing error message */
|
|
11
11
|
export type FailedResult = {
|
|
12
|
-
/** Result
|
|
13
|
-
|
|
12
|
+
/** Result status */
|
|
13
|
+
status: "failed";
|
|
14
14
|
/** Returned error */
|
|
15
15
|
error: string;
|
|
16
16
|
};
|
|
@@ -19,6 +19,6 @@ export type FailedResult = {
|
|
|
19
19
|
* due to one of the previous operations in the same batch failed
|
|
20
20
|
* */
|
|
21
21
|
export type SkippedResult = {
|
|
22
|
-
/** Result
|
|
23
|
-
|
|
22
|
+
/** Result status */
|
|
23
|
+
status: "skipped";
|
|
24
24
|
};
|
package/package.json
CHANGED