@azguardwallet/types 0.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/LICENSE +21 -0
- package/README.md +61 -0
- package/dist/action.d.ts +56 -0
- package/dist/authwit-content.d.ts +31 -0
- package/dist/client.d.ts +92 -0
- package/dist/dapp-session.d.ts +35 -0
- package/dist/index.d.ts +25 -0
- package/dist/operation.d.ts +116 -0
- package/dist/result.d.ts +24 -0
- package/package.json +19 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Azguard Wallet
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# @azguardwallet/types
|
|
2
|
+
|
|
3
|
+
This library contains type declarations with annotations for Azguard Wallet inpage RPC client, that can be helpful for browser based apps written in TypeScript.
|
|
4
|
+
|
|
5
|
+
### How to use
|
|
6
|
+
|
|
7
|
+
Install the package:
|
|
8
|
+
|
|
9
|
+
```shell
|
|
10
|
+
npm install @azguardwallet/types --save-dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And import it somewhere in your codebase:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import "@azguardwallet/types";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
After that TS will be aware of `window.azguard` object and all related types.
|
|
20
|
+
|
|
21
|
+
### Example
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import type {
|
|
25
|
+
CaipAccount,
|
|
26
|
+
CallAction,
|
|
27
|
+
FailedResult,
|
|
28
|
+
OkResult,
|
|
29
|
+
} from "@azguardwallet/types";
|
|
30
|
+
|
|
31
|
+
const azguard = window.azguard.createClient();
|
|
32
|
+
|
|
33
|
+
const account: CaipAccount = "aztec:31337:0xffff...";
|
|
34
|
+
|
|
35
|
+
const transferCall: CallAction = {
|
|
36
|
+
kind: "call",
|
|
37
|
+
contract: "0xffff...",
|
|
38
|
+
method: "transfer",
|
|
39
|
+
args: ["0xffff...", 100],
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const [result] = await azguard.request("execute", {
|
|
43
|
+
sessionId: "1234",
|
|
44
|
+
operations: [
|
|
45
|
+
{
|
|
46
|
+
kind: "send_transaction",
|
|
47
|
+
account: account,
|
|
48
|
+
actions: [transferCall],
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
if (result.kind === "ok") {
|
|
54
|
+
const txHash = (result as OkResult<string>).result;
|
|
55
|
+
// ...
|
|
56
|
+
}
|
|
57
|
+
else if (result.kind === "failed") {
|
|
58
|
+
const error = (result as FailedResult).error;
|
|
59
|
+
// ...
|
|
60
|
+
}
|
|
61
|
+
```
|
package/dist/action.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { AuthwitContent } from "./authwit-content";
|
|
2
|
+
/** Action kind */
|
|
3
|
+
export type ActionKind = "add_capsule" | "add_private_authwit" | "add_public_authwit" | "call" | "call_ext";
|
|
4
|
+
/** A request to perform some action */
|
|
5
|
+
export type Action = AddCapsuleAction | AddPrivateAuthwitAction | AddPublicAuthwitAction | CallAction | CallExtAction;
|
|
6
|
+
/** A request to add a capsule to PXE */
|
|
7
|
+
export type AddCapsuleAction = {
|
|
8
|
+
/** Action kind */
|
|
9
|
+
kind: "add_capsule";
|
|
10
|
+
/** Capsule to be added (Fr[]) */
|
|
11
|
+
capsule: string[];
|
|
12
|
+
};
|
|
13
|
+
/** A request to add an authwit for the message hash computed from the given content to PXE */
|
|
14
|
+
export type AddPrivateAuthwitAction = {
|
|
15
|
+
/** Action kind */
|
|
16
|
+
kind: "add_private_authwit";
|
|
17
|
+
/** Original content from which a message hash will be comupted */
|
|
18
|
+
content: AuthwitContent;
|
|
19
|
+
};
|
|
20
|
+
/** A request to call the AuthRegistry contract to authorize message hash computed from the given content */
|
|
21
|
+
export type AddPublicAuthwitAction = {
|
|
22
|
+
/** Action kind */
|
|
23
|
+
kind: "add_public_authwit";
|
|
24
|
+
/** Original content from which a message hash will be comupted */
|
|
25
|
+
content: AuthwitContent;
|
|
26
|
+
};
|
|
27
|
+
/** A request to call a contract with plain args */
|
|
28
|
+
export type CallAction = {
|
|
29
|
+
/** Action kind */
|
|
30
|
+
kind: "call";
|
|
31
|
+
/** Address of the contract (AztecAddress) */
|
|
32
|
+
contract: string;
|
|
33
|
+
/** Name of the function */
|
|
34
|
+
method: string;
|
|
35
|
+
/** Arguments (unencoded) */
|
|
36
|
+
args: any[];
|
|
37
|
+
};
|
|
38
|
+
/** A request to call a contract with encoded args (matches FunctionCall from aztec.js) */
|
|
39
|
+
export type CallExtAction = {
|
|
40
|
+
/** Action kind */
|
|
41
|
+
kind: "call_ext";
|
|
42
|
+
/** Name of the function */
|
|
43
|
+
name: string;
|
|
44
|
+
/** Address of the contract (AztecAddress) */
|
|
45
|
+
to: string;
|
|
46
|
+
/** Selector of the function (FunctionSelector) */
|
|
47
|
+
selector: string;
|
|
48
|
+
/** Type of the function (FunctionType) */
|
|
49
|
+
type: string;
|
|
50
|
+
/** Whether this call can makes modifications to state or not */
|
|
51
|
+
isStatic: boolean;
|
|
52
|
+
/** Encoded arguments (Fr[]) */
|
|
53
|
+
args: string[];
|
|
54
|
+
/** Return types for decoding (AbiType[]) */
|
|
55
|
+
returnTypes: unknown[];
|
|
56
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Content to add authwitness for. */
|
|
2
|
+
export type AuthwitContent = CallAuthwitContent | IntentAuthwitContent | MessageHashAuthwitContent;
|
|
3
|
+
/** Contract call to be authorized */
|
|
4
|
+
export type CallAuthwitContent = {
|
|
5
|
+
/** Authwit content kind */
|
|
6
|
+
kind: "call";
|
|
7
|
+
/** Address of the caller (AztecAddress) */
|
|
8
|
+
caller: string;
|
|
9
|
+
/** Address of the contract (AztecAddress) */
|
|
10
|
+
contract: string;
|
|
11
|
+
/** Name of the function */
|
|
12
|
+
method: string;
|
|
13
|
+
/** Arguments (unencoded) */
|
|
14
|
+
args: any[];
|
|
15
|
+
};
|
|
16
|
+
/** Arbitrary intent to be authorized */
|
|
17
|
+
export type IntentAuthwitContent = {
|
|
18
|
+
/** Authwit content kind */
|
|
19
|
+
kind: "intent";
|
|
20
|
+
/** Address of the authwitness consumer (AztecAddress) */
|
|
21
|
+
consumer: string;
|
|
22
|
+
/** Intent (Fr[]) */
|
|
23
|
+
intent: string[];
|
|
24
|
+
};
|
|
25
|
+
/** Message hash to be authorized */
|
|
26
|
+
export type MessageHashAuthwitContent = {
|
|
27
|
+
/** Authwit content kind */
|
|
28
|
+
kind: "message_hash";
|
|
29
|
+
/** Message hash (Fr) */
|
|
30
|
+
messageHash: string;
|
|
31
|
+
};
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { DappMetadata, DappPermissions, DappSession } from "./dapp-session";
|
|
2
|
+
import { Operation, OperationResult } from "./operation";
|
|
3
|
+
/** Azguard RPC client for sending requests to and receiving events from the wallet */
|
|
4
|
+
export type AzguardRpcClient = {
|
|
5
|
+
/**
|
|
6
|
+
* Adds event handler for the `session_updated` event
|
|
7
|
+
* @param event event name
|
|
8
|
+
* @param handler event handler
|
|
9
|
+
*/
|
|
10
|
+
on(event: "session_updated", handler: (session: DappSession) => void): void;
|
|
11
|
+
/**
|
|
12
|
+
* Adds event handler for the `session_closed` event
|
|
13
|
+
* @param event event name
|
|
14
|
+
* @param handler event handler
|
|
15
|
+
*/
|
|
16
|
+
on(event: "session_closed", handler: (session: DappSession) => void): void;
|
|
17
|
+
/**
|
|
18
|
+
* Removes event handler for the `session_updated` event
|
|
19
|
+
* @param event event name
|
|
20
|
+
* @param handler event handler
|
|
21
|
+
*/
|
|
22
|
+
off(event: "session_updated", handler: (session: DappSession) => void): void;
|
|
23
|
+
/**
|
|
24
|
+
* Removes event handler for the `session_closed` event
|
|
25
|
+
* @param event event name
|
|
26
|
+
* @param handler event handler
|
|
27
|
+
*/
|
|
28
|
+
off(event: "session_closed", handler: (session: DappSession) => void): void;
|
|
29
|
+
/**
|
|
30
|
+
* Requests wallet info
|
|
31
|
+
* @param method RPC method name
|
|
32
|
+
* @returns Wallet info
|
|
33
|
+
*/
|
|
34
|
+
request(method: "get_wallet_info"): Promise<WalletInfo>;
|
|
35
|
+
/**
|
|
36
|
+
* Requests session info
|
|
37
|
+
* @param method RPC method name
|
|
38
|
+
* @param sessionId Session id
|
|
39
|
+
* @returns Dapp session or `null` if not found
|
|
40
|
+
*/
|
|
41
|
+
request(method: "get_session", sessionId: string): Promise<DappSession | null>;
|
|
42
|
+
/**
|
|
43
|
+
* Requests session termination
|
|
44
|
+
* @param method RPC method name
|
|
45
|
+
* @param sessionId Session id
|
|
46
|
+
* @returns Closed dapp session or `null` if not found
|
|
47
|
+
*/
|
|
48
|
+
request(method: "close_session", sessionId: string): Promise<DappSession | null>;
|
|
49
|
+
/**
|
|
50
|
+
* Requests connection to the wallet
|
|
51
|
+
* @param method RPC method name
|
|
52
|
+
* @param params Connection parameters
|
|
53
|
+
* @returns Created dapp session
|
|
54
|
+
* @throws "User rejected" if user rejects
|
|
55
|
+
*/
|
|
56
|
+
request(method: "connect", params: {
|
|
57
|
+
/** Information about the connected DApp */
|
|
58
|
+
dappMetadata: DappMetadata;
|
|
59
|
+
/** Required permissions requested by the DApp */
|
|
60
|
+
requiredPermissions: DappPermissions[];
|
|
61
|
+
/** Optional permissions requested by the DApp */
|
|
62
|
+
optionalPermissions?: DappPermissions[];
|
|
63
|
+
}): Promise<DappSession>;
|
|
64
|
+
/**
|
|
65
|
+
* Requests execution of a batch of operations
|
|
66
|
+
* @param method RPC method name
|
|
67
|
+
* @param params Execution parameters
|
|
68
|
+
* @returns List of operation results, fully matching the list of requested operations
|
|
69
|
+
* @throws "User rejected" if user rejects
|
|
70
|
+
*/
|
|
71
|
+
request(method: "execute", params: {
|
|
72
|
+
/** Id of the session */
|
|
73
|
+
sessionId: string;
|
|
74
|
+
/** List of operations to execute */
|
|
75
|
+
operations: Operation[];
|
|
76
|
+
}): Promise<OperationResult[]>;
|
|
77
|
+
};
|
|
78
|
+
/** Wallet metadata */
|
|
79
|
+
export type WalletInfo = {
|
|
80
|
+
/** Name */
|
|
81
|
+
name: string;
|
|
82
|
+
/** Short description */
|
|
83
|
+
description: string;
|
|
84
|
+
/** Logo URI */
|
|
85
|
+
logo: string;
|
|
86
|
+
/** Wallet URI */
|
|
87
|
+
url: string;
|
|
88
|
+
/** Version */
|
|
89
|
+
version: string;
|
|
90
|
+
/** Capabilities */
|
|
91
|
+
capabilities: string[];
|
|
92
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ActionKind } from "./action";
|
|
2
|
+
import { OperationKind } from "./operation";
|
|
3
|
+
/** Chain id (CAIP-2) */
|
|
4
|
+
export type CaipChain = `aztec:${number}`;
|
|
5
|
+
/** Accound address (CAIP-10) */
|
|
6
|
+
export type CaipAccount = `${CaipChain}:${string}`;
|
|
7
|
+
/** DApp metadata */
|
|
8
|
+
export type DappMetadata = {
|
|
9
|
+
/** Name */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Short description */
|
|
12
|
+
description?: string;
|
|
13
|
+
/** Logo URI */
|
|
14
|
+
logo?: string;
|
|
15
|
+
/** DApp URI */
|
|
16
|
+
url?: string;
|
|
17
|
+
};
|
|
18
|
+
/** Permissions set */
|
|
19
|
+
export type DappPermissions = {
|
|
20
|
+
/** List of chains */
|
|
21
|
+
chains?: CaipChain[];
|
|
22
|
+
/** List of methods */
|
|
23
|
+
methods?: (OperationKind | ActionKind)[];
|
|
24
|
+
/** List of events */
|
|
25
|
+
events?: CaipAccount[];
|
|
26
|
+
};
|
|
27
|
+
/** Dapp session */
|
|
28
|
+
export type DappSession = {
|
|
29
|
+
/** Id of the session */
|
|
30
|
+
id: string;
|
|
31
|
+
/** Approved permissions */
|
|
32
|
+
permissions: DappPermissions[];
|
|
33
|
+
/** Approved accounts */
|
|
34
|
+
accounts: CaipAccount[];
|
|
35
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AzguardRpcClient } from "./client";
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
/**
|
|
5
|
+
* Azguard Wallet accessor
|
|
6
|
+
*/
|
|
7
|
+
azguard: {
|
|
8
|
+
/**
|
|
9
|
+
* Version
|
|
10
|
+
*/
|
|
11
|
+
version: string;
|
|
12
|
+
/**
|
|
13
|
+
* Creates an RPC client for interaction with the Azguard Wallet
|
|
14
|
+
* @returns a new instance of AzguardRpcClient
|
|
15
|
+
*/
|
|
16
|
+
createClient: () => AzguardRpcClient;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export * from "./action";
|
|
21
|
+
export * from "./authwit-content";
|
|
22
|
+
export * from "./client";
|
|
23
|
+
export * from "./dapp-session";
|
|
24
|
+
export * from "./operation";
|
|
25
|
+
export * from "./result";
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Action } from "./action";
|
|
2
|
+
import { Result } from "./result";
|
|
3
|
+
import { CaipAccount, CaipChain } from "./dapp-session";
|
|
4
|
+
/** Operation kind */
|
|
5
|
+
export type OperationKind = "add_note" | "register_contract" | "register_sender" | "send_transaction" | "simulate_transaction" | "simulate_unconstrained";
|
|
6
|
+
/** A request to perform some operation */
|
|
7
|
+
export type Operation = AddNoteOperation | RegisterContractOperation | RegisterSenderOperation | SendTransactionOperation | SimulateTransactionOperation | SimulateUnconstrainedOperation;
|
|
8
|
+
/** Operation result */
|
|
9
|
+
export type OperationResult = AddNoteResult | RegisterContractResult | RegisterSenderResult | SendTransactionResult | SimulateTransactionResult | SimulateUnconstrainedResult;
|
|
10
|
+
/** A request to add a note to PXE */
|
|
11
|
+
export type AddNoteOperation = {
|
|
12
|
+
/** Operation kind */
|
|
13
|
+
kind: "add_note";
|
|
14
|
+
/** Account to add the note for */
|
|
15
|
+
account: CaipAccount;
|
|
16
|
+
/** Extended note, converted to string */
|
|
17
|
+
note: string;
|
|
18
|
+
};
|
|
19
|
+
/** A result of the "add_note" operation */
|
|
20
|
+
export type AddNoteResult = Result<void>;
|
|
21
|
+
/** A request to register contract in PXE */
|
|
22
|
+
export type RegisterContractOperation = {
|
|
23
|
+
/** Operation kind */
|
|
24
|
+
kind: "register_contract";
|
|
25
|
+
/** Chain to register the contract for */
|
|
26
|
+
chain: CaipChain;
|
|
27
|
+
/** Address of the contract (AztecAddress) */
|
|
28
|
+
address: string;
|
|
29
|
+
/**
|
|
30
|
+
* Contract instance (ContractInstanceWithAddress).
|
|
31
|
+
* If not specified, the wallet will try to fetch it from PXE/node.
|
|
32
|
+
*/
|
|
33
|
+
instance?: unknown;
|
|
34
|
+
/**
|
|
35
|
+
* Contract artifact (ContractArtifact).
|
|
36
|
+
* If not specified, the wallet will try to fetch it from PXE/node.
|
|
37
|
+
*/
|
|
38
|
+
artifact?: unknown;
|
|
39
|
+
};
|
|
40
|
+
/** A result of the "register_contract" operation */
|
|
41
|
+
export type RegisterContractResult = Result<void>;
|
|
42
|
+
/** A request to register sender in PXE */
|
|
43
|
+
export type RegisterSenderOperation = {
|
|
44
|
+
/** Operation kind */
|
|
45
|
+
kind: "register_sender";
|
|
46
|
+
/** Chain to register the sender for */
|
|
47
|
+
chain: CaipChain;
|
|
48
|
+
/** Address of the sender (AztecAddress) */
|
|
49
|
+
address: string;
|
|
50
|
+
};
|
|
51
|
+
/** A result of the "register_sender" operation */
|
|
52
|
+
export type RegisterSenderResult = Result<void>;
|
|
53
|
+
/** A request to send the transaction */
|
|
54
|
+
export type SendTransactionOperation = {
|
|
55
|
+
/** Operation kind */
|
|
56
|
+
kind: "send_transaction";
|
|
57
|
+
/** Address of the account to send transaction from */
|
|
58
|
+
account: CaipAccount;
|
|
59
|
+
/**
|
|
60
|
+
* Batch of calls to be passed to the account contract for the "execution" phase
|
|
61
|
+
* and additional actions, that may be needed for its execution
|
|
62
|
+
* */
|
|
63
|
+
actions: Action[];
|
|
64
|
+
/**
|
|
65
|
+
* Batch of calls to be passed to the account contract for the "setup" phase
|
|
66
|
+
* and additional actions, that may be needed for its execution
|
|
67
|
+
* */
|
|
68
|
+
setup?: Action[];
|
|
69
|
+
};
|
|
70
|
+
/** A result of the "send_transaction" operation (TxHash) */
|
|
71
|
+
export type SendTransactionResult = Result<string>;
|
|
72
|
+
/** A request to simulate the transaction */
|
|
73
|
+
export type SimulateTransactionOperation = {
|
|
74
|
+
/** Operation kind */
|
|
75
|
+
kind: "simulate_transaction";
|
|
76
|
+
/** Address of the account to send transaction from */
|
|
77
|
+
account: CaipAccount;
|
|
78
|
+
/**
|
|
79
|
+
* Batch of calls to be passed to the account contract for the "execution" phase
|
|
80
|
+
* and additional actions, that may be needed for its execution
|
|
81
|
+
* */
|
|
82
|
+
actions: Action[];
|
|
83
|
+
/**
|
|
84
|
+
* Batch of calls to be passed to the account contract for the "setup" phase
|
|
85
|
+
* and additional actions, that may be needed for its execution
|
|
86
|
+
* */
|
|
87
|
+
setup?: Action[];
|
|
88
|
+
/** Whether to also simulate enqueued public calls or not */
|
|
89
|
+
simulatePublic?: boolean;
|
|
90
|
+
};
|
|
91
|
+
/** Wrapped simulation results */
|
|
92
|
+
export type SimulationReturn = {
|
|
93
|
+
/** Gas usage info (GasUsed) */
|
|
94
|
+
gasUsed: unknown;
|
|
95
|
+
/** Private return values (NestedProcessReturnValues) */
|
|
96
|
+
privateReturn: unknown;
|
|
97
|
+
/** Public return values (NestedProcessReturnValues[]) */
|
|
98
|
+
publicReturn: unknown[];
|
|
99
|
+
};
|
|
100
|
+
/** A result of the "simulate_transaction" operation */
|
|
101
|
+
export type SimulateTransactionResult = Result<SimulationReturn>;
|
|
102
|
+
/** A request to simulate the unconstrained function */
|
|
103
|
+
export type SimulateUnconstrainedOperation = {
|
|
104
|
+
/** Operation kind */
|
|
105
|
+
kind: "simulate_unconstrained";
|
|
106
|
+
/** Address of the account to simulate for */
|
|
107
|
+
account: CaipAccount;
|
|
108
|
+
/** Address of the contract (AztecAddress) */
|
|
109
|
+
contract: string;
|
|
110
|
+
/** Name of the function */
|
|
111
|
+
method: string;
|
|
112
|
+
/** Arguments (unencoded) */
|
|
113
|
+
args: any[];
|
|
114
|
+
};
|
|
115
|
+
/** A result of the "simulate_unconstrained" operation (AbiDecoded) */
|
|
116
|
+
export type SimulateUnconstrainedResult = Result<unknown>;
|
package/dist/result.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Result object */
|
|
2
|
+
export type Result<T> = OkResult<T> | FailedResult | SkippedResult;
|
|
3
|
+
/** Successful result, containing returned value */
|
|
4
|
+
export type OkResult<T> = {
|
|
5
|
+
/** Result kind */
|
|
6
|
+
kind: "ok";
|
|
7
|
+
/** Returned value */
|
|
8
|
+
result: T;
|
|
9
|
+
};
|
|
10
|
+
/** Failed result, containing error message */
|
|
11
|
+
export type FailedResult = {
|
|
12
|
+
/** Result kind */
|
|
13
|
+
kind: "failed";
|
|
14
|
+
/** Returned error */
|
|
15
|
+
error: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Skipped result, meaning that the operation was skipped
|
|
19
|
+
* due to one of the previous operations in the same batch failed
|
|
20
|
+
* */
|
|
21
|
+
export type SkippedResult = {
|
|
22
|
+
/** Result kind */
|
|
23
|
+
kind: "skipped";
|
|
24
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@azguardwallet/types",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Typings for Azguard Wallet inpage RPC client",
|
|
5
|
+
"author": "Azguard Wallet",
|
|
6
|
+
"homepage": "https://github.com/AzguardWallet/azguard-wallet-types",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/AzguardWallet/azguard-wallet-types.git"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "rm -rf dist && tsc"
|
|
18
|
+
}
|
|
19
|
+
}
|