@azguardwallet/aztec-wallet 2.0.3
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 +110 -0
- package/dist/azguard.d.ts +58 -0
- package/dist/azguard.js +359 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/methods.d.ts +2 -0
- package/dist/methods.js +27 -0
- package/dist/schemas.d.ts +227 -0
- package/dist/schemas.js +23 -0
- package/package.json +33 -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,110 @@
|
|
|
1
|
+
# @azguardwallet/aztec-wallet
|
|
2
|
+
|
|
3
|
+
[](https://github.com/AzguardWallet/aztec-wallet/blob/main/LICENSE)
|
|
4
|
+
[](https://www.npmjs.com/package/@azguardwallet/aztec-wallet)
|
|
5
|
+
[](https://www.npmjs.com/package/@azguardwallet/aztec-wallet)
|
|
6
|
+
|
|
7
|
+
Azguard Wallet client fully compatible with Aztec.js' `Wallet` interface, enabling seamless integration.
|
|
8
|
+
|
|
9
|
+
## How to use
|
|
10
|
+
|
|
11
|
+
Install the package:
|
|
12
|
+
|
|
13
|
+
```shell
|
|
14
|
+
npm install @azguardwallet/aztec-wallet
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Connect the wallet:
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
import { AztecWallet } from "@azguardwallet/aztec-wallet";
|
|
21
|
+
|
|
22
|
+
// the simplest way
|
|
23
|
+
const wallet = await AztecWallet.connect();
|
|
24
|
+
|
|
25
|
+
// or you can additionally provide the dapp metadata and the chain
|
|
26
|
+
const wallet = await AztecWallet.connect(
|
|
27
|
+
{
|
|
28
|
+
name: "My Dapp",
|
|
29
|
+
description: "The best dapp in the world",
|
|
30
|
+
logo: "...",
|
|
31
|
+
url: "..."
|
|
32
|
+
},
|
|
33
|
+
"testnet" // or "sandbox", or CAIP-string like "aztec:11155111"
|
|
34
|
+
);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Then use this `wallet` for interaction with Aztec.js:
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
41
|
+
import { SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
42
|
+
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
43
|
+
|
|
44
|
+
const address = wallet.getAddress();
|
|
45
|
+
|
|
46
|
+
const tokenAddress = AztecAddress.fromString("0x...");
|
|
47
|
+
const tokenContract = await TokenContract.at(tokenAddress, wallet);
|
|
48
|
+
|
|
49
|
+
// get token private balance
|
|
50
|
+
|
|
51
|
+
const prvBalance = await token.methods
|
|
52
|
+
.balance_of_private(address)
|
|
53
|
+
.simulate({from: address});
|
|
54
|
+
|
|
55
|
+
console.log("Private balance", prvBalance);
|
|
56
|
+
|
|
57
|
+
// get token public balance
|
|
58
|
+
|
|
59
|
+
const pubBalance = await token.methods
|
|
60
|
+
.balance_of_public(address)
|
|
61
|
+
.simulate({from: address});
|
|
62
|
+
|
|
63
|
+
console.log("Public balance", pubBalance);
|
|
64
|
+
|
|
65
|
+
// send token
|
|
66
|
+
|
|
67
|
+
const feeOptions = {
|
|
68
|
+
paymentMethod: new SponsoredFeePaymentMethod(
|
|
69
|
+
AztecAddress.fromString("0x..."),
|
|
70
|
+
),
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const txReceipt = await token.methods
|
|
74
|
+
.transfer(AztecAddress.fromString("0x..."), 100000000n)
|
|
75
|
+
.send({from: address, fee: feeOptions})
|
|
76
|
+
.wait();
|
|
77
|
+
|
|
78
|
+
console.log("Tx hash", txReceipt.txHash);
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
That's pretty much it! See more Aztec.js examples at https://docs.aztec.network.
|
|
82
|
+
|
|
83
|
+
## Connection state
|
|
84
|
+
|
|
85
|
+
When Azguard user confirms connection from a dapp (`AztecWallet.connect()`), a dapp session is opened, and while this session is active, the dapp is allowed to interact with the wallet. If the dapp session is expired or closed (either by the dapp or by the user), the interaction is no longer allowed.
|
|
86
|
+
|
|
87
|
+
Even though the `AztecWallet` client reconnects automatically, you might want to additionally track the connection state. You can do the following:
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
// connect the wallet (in most cases it's called automatically under the hood, so you don't have to call it manually)
|
|
91
|
+
await wallet.connect();
|
|
92
|
+
|
|
93
|
+
// check if the wallet is connected
|
|
94
|
+
console.log(wallet.connected);
|
|
95
|
+
|
|
96
|
+
// track connection/disconnection events
|
|
97
|
+
wallet.onConnected.addHandler(() => console.log("Azguard connected"));
|
|
98
|
+
wallet.onDisconnected.addHandler(() => console.log("Azguard disconnected"));
|
|
99
|
+
|
|
100
|
+
// in the end you can disconnect and close the session
|
|
101
|
+
await wallet.disconnect();
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Support channels
|
|
105
|
+
|
|
106
|
+
If you have any questions, feel free to contact us in:
|
|
107
|
+
- Telegram: https://t.me/azguardwallet
|
|
108
|
+
- Twitter: https://twitter.com/AzguardWallet
|
|
109
|
+
|
|
110
|
+
Cheers! 🍺
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { CaipChain, DappMetadata } from "@azguardwallet/types";
|
|
2
|
+
import { AuthWitness, AztecAddress, CompleteAddress, ContractArtifact, ContractInstanceWithAddress, Fr, IntentAction, IntentInnerHash, NodeInfo, Tx, TxExecutionRequest, TxHash, TxProfileResult, TxReceipt, Wallet } from "@aztec/aztec.js";
|
|
3
|
+
import { FeeOptions, TxExecutionOptions } from "@aztec/entrypoints/interfaces";
|
|
4
|
+
import { ExecutionPayload } from "@aztec/entrypoints/payload";
|
|
5
|
+
import { GasFees } from "@aztec/stdlib/gas";
|
|
6
|
+
import { ContractClassMetadata, ContractMetadata, PXEInfo, EventMetadataDefinition } from "@aztec/stdlib/interfaces/client";
|
|
7
|
+
import { SimulationOverrides, TxSimulationResult, UtilitySimulationResult, PrivateExecutionResult, TxProvingResult } from "@aztec/stdlib/tx";
|
|
8
|
+
/** Azguard Wallet client fully compatible with Aztec.js' `Wallet` interface */
|
|
9
|
+
export declare class AztecWallet implements Wallet {
|
|
10
|
+
#private;
|
|
11
|
+
/**
|
|
12
|
+
* Creates `AztecWallet` instance, connected to Azguard Wallet
|
|
13
|
+
* @param dapp Dapp metadata (default: { name: window.location.hostname })
|
|
14
|
+
* @param chain Chain (default: "testnet")
|
|
15
|
+
* @param timeout Timeout in ms for the `window.azguard` object lookup (default: 1000ms)
|
|
16
|
+
* @returns AztecWallet instance
|
|
17
|
+
*/
|
|
18
|
+
static connect(dapp?: DappMetadata, chain?: "testnet" | "sandbox" | CaipChain, timeout?: number): Promise<AztecWallet>;
|
|
19
|
+
/** Indicates whether the wallet is connected or not */
|
|
20
|
+
get connected(): boolean;
|
|
21
|
+
/** Event handlers invoked when the wallet is connected */
|
|
22
|
+
get onConnected(): import("@azguardwallet/client").IEventHandlers<void>;
|
|
23
|
+
/** Event handlers invoked when the wallet is disconnected */
|
|
24
|
+
get onDisconnected(): import("@azguardwallet/client").IEventHandlers<void>;
|
|
25
|
+
/** Connects to the wallet */
|
|
26
|
+
connect(): Promise<void>;
|
|
27
|
+
/** Disconnects from the wallet */
|
|
28
|
+
disconnect(): Promise<void>;
|
|
29
|
+
private constructor();
|
|
30
|
+
getCompleteAddress(): CompleteAddress;
|
|
31
|
+
getAddress(): AztecAddress;
|
|
32
|
+
getChainId(): Fr;
|
|
33
|
+
getVersion(): Fr;
|
|
34
|
+
createTxExecutionRequest(exec: ExecutionPayload, fee: FeeOptions, options: TxExecutionOptions): Promise<TxExecutionRequest>;
|
|
35
|
+
createAuthWit(messageHashOrIntent: IntentAction | IntentInnerHash | Fr | Buffer): Promise<AuthWitness>;
|
|
36
|
+
simulateTx(txRequest: TxExecutionRequest, simulatePublic: boolean, skipTxValidation?: boolean, skipFeeEnforcement?: boolean, overrides?: SimulationOverrides, scopes?: AztecAddress[]): Promise<TxSimulationResult>;
|
|
37
|
+
simulateUtility(functionName: string, args: any[], to: AztecAddress, authwits?: AuthWitness[], from?: AztecAddress, scopes?: AztecAddress[]): Promise<UtilitySimulationResult>;
|
|
38
|
+
profileTx(txRequest: TxExecutionRequest, profileMode: "gates" | "execution-steps" | "full", skipProofGeneration?: boolean, msgSender?: AztecAddress): Promise<TxProfileResult>;
|
|
39
|
+
sendTx(tx: Tx): Promise<TxHash>;
|
|
40
|
+
getContractClassMetadata(id: Fr, includeArtifact?: boolean): Promise<ContractClassMetadata>;
|
|
41
|
+
getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
|
|
42
|
+
registerContract(contract: {
|
|
43
|
+
instance: ContractInstanceWithAddress;
|
|
44
|
+
artifact?: ContractArtifact;
|
|
45
|
+
}): Promise<void>;
|
|
46
|
+
registerContractClass(artifact: ContractArtifact): Promise<void>;
|
|
47
|
+
proveTx(txRequest: TxExecutionRequest, privateExecutionResult?: PrivateExecutionResult): Promise<TxProvingResult>;
|
|
48
|
+
getNodeInfo(): Promise<NodeInfo>;
|
|
49
|
+
getPXEInfo(): Promise<PXEInfo>;
|
|
50
|
+
getCurrentBaseFees(): Promise<GasFees>;
|
|
51
|
+
updateContract(contractAddress: AztecAddress, artifact: ContractArtifact): Promise<void>;
|
|
52
|
+
registerSender(address: AztecAddress): Promise<AztecAddress>;
|
|
53
|
+
getSenders(): Promise<AztecAddress[]>;
|
|
54
|
+
removeSender(address: AztecAddress): Promise<void>;
|
|
55
|
+
getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
|
|
56
|
+
getPrivateEvents<T>(contractAddress: AztecAddress, eventMetadata: EventMetadataDefinition, from: number, numBlocks: number, recipients: AztecAddress[]): Promise<T[]>;
|
|
57
|
+
getPublicEvents<T>(eventMetadata: EventMetadataDefinition, from: number, limit: number): Promise<T[]>;
|
|
58
|
+
}
|
package/dist/azguard.js
ADDED
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import { AzguardClient } from "@azguardwallet/client";
|
|
2
|
+
import { AuthWitness, AztecAddress, CompleteAddress, ContractFunctionInteraction, Fr, TxExecutionRequest, TxHash, TxProfileResult, TxReceipt, } from "@aztec/aztec.js";
|
|
3
|
+
import { GasFees } from "@aztec/stdlib/gas";
|
|
4
|
+
import { TxSimulationResult, UtilitySimulationResult, TxProvingResult, } from "@aztec/stdlib/tx";
|
|
5
|
+
import { NodeInfoSchema } from "@aztec/stdlib/contract";
|
|
6
|
+
import z from "zod";
|
|
7
|
+
import { ContractClassMetadataSchema, ContractMetadataSchema, PXEInfoSchema } from "./schemas";
|
|
8
|
+
import { aztecMethods } from "./methods";
|
|
9
|
+
/** Azguard Wallet client fully compatible with Aztec.js' `Wallet` interface */
|
|
10
|
+
export class AztecWallet {
|
|
11
|
+
/**
|
|
12
|
+
* Creates `AztecWallet` instance, connected to Azguard Wallet
|
|
13
|
+
* @param dapp Dapp metadata (default: { name: window.location.hostname })
|
|
14
|
+
* @param chain Chain (default: "testnet")
|
|
15
|
+
* @param timeout Timeout in ms for the `window.azguard` object lookup (default: 1000ms)
|
|
16
|
+
* @returns AztecWallet instance
|
|
17
|
+
*/
|
|
18
|
+
static async connect(dapp, chain, timeout) {
|
|
19
|
+
if (!dapp?.name) {
|
|
20
|
+
dapp = { ...dapp, name: window.location.hostname };
|
|
21
|
+
}
|
|
22
|
+
if (!chain || chain === "testnet") {
|
|
23
|
+
chain = "aztec:11155111";
|
|
24
|
+
}
|
|
25
|
+
else if (chain === "sandbox") {
|
|
26
|
+
chain = "aztec:31337";
|
|
27
|
+
}
|
|
28
|
+
const azguard = await AzguardClient.create("aztec.js", timeout ?? 1000);
|
|
29
|
+
const wallet = new AztecWallet(azguard, chain, dapp);
|
|
30
|
+
await wallet.connect();
|
|
31
|
+
return wallet;
|
|
32
|
+
}
|
|
33
|
+
/** Indicates whether the wallet is connected or not */
|
|
34
|
+
get connected() {
|
|
35
|
+
return this.#azguard.connected;
|
|
36
|
+
}
|
|
37
|
+
/** Event handlers invoked when the wallet is connected */
|
|
38
|
+
get onConnected() {
|
|
39
|
+
return this.#azguard.onConnected;
|
|
40
|
+
}
|
|
41
|
+
/** Event handlers invoked when the wallet is disconnected */
|
|
42
|
+
get onDisconnected() {
|
|
43
|
+
return this.#azguard.onDisconnected;
|
|
44
|
+
}
|
|
45
|
+
/** Connects to the wallet */
|
|
46
|
+
async connect() {
|
|
47
|
+
await this.#ensureConnected();
|
|
48
|
+
}
|
|
49
|
+
/** Disconnects from the wallet */
|
|
50
|
+
async disconnect() {
|
|
51
|
+
await this.#azguard.disconnect();
|
|
52
|
+
}
|
|
53
|
+
#azguard;
|
|
54
|
+
#chain;
|
|
55
|
+
#dapp;
|
|
56
|
+
#completeAddress;
|
|
57
|
+
#address;
|
|
58
|
+
#chainId;
|
|
59
|
+
#version;
|
|
60
|
+
constructor(azguard, chain, dapp) {
|
|
61
|
+
this.#azguard = azguard;
|
|
62
|
+
this.#chain = chain;
|
|
63
|
+
this.#dapp = dapp;
|
|
64
|
+
this.#azguard.onAccountsChanged.addHandler(this.#onAccountsChanged);
|
|
65
|
+
this.#azguard.onPermissionsChanged.addHandler(this.#onPermissionsChanged);
|
|
66
|
+
this.#azguard.onDisconnected.addHandler(this.#onDisconnected);
|
|
67
|
+
}
|
|
68
|
+
#onAccountsChanged = (accounts) => {
|
|
69
|
+
const currentAccount = this.#address?.toString();
|
|
70
|
+
if (currentAccount && !accounts.some((x) => x.endsWith(currentAccount))) {
|
|
71
|
+
this.#azguard.disconnect();
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
#onPermissionsChanged = (permissions) => {
|
|
75
|
+
if (aztecMethods.some((x) => !permissions.some((p) => p.chains?.includes(this.#chain) && p.methods?.includes(x)))) {
|
|
76
|
+
this.#azguard.disconnect();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
#onDisconnected = () => {
|
|
80
|
+
this.#completeAddress = undefined;
|
|
81
|
+
this.#address = undefined;
|
|
82
|
+
this.#chainId = undefined;
|
|
83
|
+
this.#version = undefined;
|
|
84
|
+
};
|
|
85
|
+
async #ensureConnected() {
|
|
86
|
+
if (!this.#azguard.connected) {
|
|
87
|
+
await this.#azguard.connect(this.#dapp, [
|
|
88
|
+
{
|
|
89
|
+
chains: [this.#chain],
|
|
90
|
+
methods: aztecMethods,
|
|
91
|
+
},
|
|
92
|
+
]);
|
|
93
|
+
}
|
|
94
|
+
if (!this.#version) {
|
|
95
|
+
const [r1, r2, r3, r4] = await this.#azguard.execute([
|
|
96
|
+
{
|
|
97
|
+
kind: "aztec_getCompleteAddress",
|
|
98
|
+
account: this.#azguard.accounts[0],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
kind: "aztec_getAddress",
|
|
102
|
+
account: this.#azguard.accounts[0],
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
kind: "aztec_getChainId",
|
|
106
|
+
chain: this.#chain,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
kind: "aztec_getVersion",
|
|
110
|
+
chain: this.#chain,
|
|
111
|
+
},
|
|
112
|
+
]);
|
|
113
|
+
if (r1.status !== "ok" || r2.status !== "ok" || r3.status !== "ok" || r4.status !== "ok") {
|
|
114
|
+
throw new Error("Failed to initialize aztec wallet");
|
|
115
|
+
}
|
|
116
|
+
this.#completeAddress = await CompleteAddress.schema.parseAsync(r1.result);
|
|
117
|
+
this.#address = await AztecAddress.schema.parseAsync(r2.result);
|
|
118
|
+
this.#chainId = await Fr.schema.parseAsync(r3.result);
|
|
119
|
+
this.#version = await Fr.schema.parseAsync(r4.result);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
async #account() {
|
|
123
|
+
await this.#ensureConnected();
|
|
124
|
+
return this.#azguard.accounts[0];
|
|
125
|
+
}
|
|
126
|
+
async #execute(schema, operation) {
|
|
127
|
+
await this.#ensureConnected();
|
|
128
|
+
const [result] = await this.#azguard.execute([operation]);
|
|
129
|
+
if (result.status === "failed") {
|
|
130
|
+
throw new Error(`Operation failed: ${result.error}`);
|
|
131
|
+
}
|
|
132
|
+
if (result.status === "skipped") {
|
|
133
|
+
throw new Error("Operation was skipped");
|
|
134
|
+
}
|
|
135
|
+
return await schema.parseAsync(result.result);
|
|
136
|
+
}
|
|
137
|
+
getCompleteAddress() {
|
|
138
|
+
if (!this.#completeAddress) {
|
|
139
|
+
throw new Error("Aztec wallet was disconnected by the user");
|
|
140
|
+
}
|
|
141
|
+
return this.#completeAddress;
|
|
142
|
+
}
|
|
143
|
+
getAddress() {
|
|
144
|
+
if (!this.#address) {
|
|
145
|
+
throw new Error("Aztec wallet was disconnected by the user");
|
|
146
|
+
}
|
|
147
|
+
return this.#address;
|
|
148
|
+
}
|
|
149
|
+
getChainId() {
|
|
150
|
+
if (!this.#chainId) {
|
|
151
|
+
throw new Error("Aztec wallet was disconnected by the user");
|
|
152
|
+
}
|
|
153
|
+
return this.#chainId;
|
|
154
|
+
}
|
|
155
|
+
getVersion() {
|
|
156
|
+
if (!this.#version) {
|
|
157
|
+
throw new Error("Aztec wallet was disconnected by the user");
|
|
158
|
+
}
|
|
159
|
+
return this.#version;
|
|
160
|
+
}
|
|
161
|
+
async createTxExecutionRequest(exec, fee, options) {
|
|
162
|
+
let asset;
|
|
163
|
+
try {
|
|
164
|
+
asset = await fee.paymentMethod.getAsset();
|
|
165
|
+
}
|
|
166
|
+
catch { }
|
|
167
|
+
const paymentMethodDto = {
|
|
168
|
+
asset,
|
|
169
|
+
executionPayload: await fee.paymentMethod.getExecutionPayload(fee.gasSettings),
|
|
170
|
+
feePayer: await fee.paymentMethod.getFeePayer(fee.gasSettings),
|
|
171
|
+
};
|
|
172
|
+
return await this.#execute(TxExecutionRequest.schema, {
|
|
173
|
+
kind: "aztec_createTxExecutionRequest",
|
|
174
|
+
account: await this.#account(),
|
|
175
|
+
exec,
|
|
176
|
+
fee: {
|
|
177
|
+
paymentMethod: paymentMethodDto,
|
|
178
|
+
gasSettings: fee.gasSettings,
|
|
179
|
+
},
|
|
180
|
+
options,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
async createAuthWit(messageHashOrIntent) {
|
|
184
|
+
let intentDto;
|
|
185
|
+
if (typeof messageHashOrIntent === "object" && "caller" in messageHashOrIntent) {
|
|
186
|
+
intentDto = {
|
|
187
|
+
caller: messageHashOrIntent.caller,
|
|
188
|
+
action: messageHashOrIntent.action instanceof ContractFunctionInteraction
|
|
189
|
+
? (await messageHashOrIntent.action.request()).calls[0]
|
|
190
|
+
: messageHashOrIntent.action,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
else if (typeof messageHashOrIntent === "object" && "consumer" in messageHashOrIntent) {
|
|
194
|
+
intentDto = {
|
|
195
|
+
consumer: messageHashOrIntent.consumer,
|
|
196
|
+
innerHash: new Fr(messageHashOrIntent.innerHash),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
intentDto = new Fr(messageHashOrIntent);
|
|
201
|
+
}
|
|
202
|
+
return await this.#execute(AuthWitness.schema, {
|
|
203
|
+
kind: "aztec_createAuthWit",
|
|
204
|
+
account: await this.#account(),
|
|
205
|
+
messageHashOrIntent: intentDto,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
async simulateTx(txRequest, simulatePublic, skipTxValidation, skipFeeEnforcement, overrides, scopes) {
|
|
209
|
+
return await this.#execute(TxSimulationResult.schema, {
|
|
210
|
+
kind: "aztec_simulateTx",
|
|
211
|
+
chain: this.#chain,
|
|
212
|
+
txRequest,
|
|
213
|
+
simulatePublic,
|
|
214
|
+
skipTxValidation,
|
|
215
|
+
skipFeeEnforcement,
|
|
216
|
+
overrides,
|
|
217
|
+
scopes,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
async simulateUtility(functionName, args, to, authwits, from, scopes) {
|
|
221
|
+
return await this.#execute(UtilitySimulationResult.schema, {
|
|
222
|
+
kind: "aztec_simulateUtility",
|
|
223
|
+
chain: this.#chain,
|
|
224
|
+
functionName,
|
|
225
|
+
args,
|
|
226
|
+
to,
|
|
227
|
+
authwits,
|
|
228
|
+
from,
|
|
229
|
+
scopes,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
async profileTx(txRequest, profileMode, skipProofGeneration, msgSender) {
|
|
233
|
+
return await this.#execute(TxProfileResult.schema, {
|
|
234
|
+
kind: "aztec_profileTx",
|
|
235
|
+
chain: this.#chain,
|
|
236
|
+
txRequest,
|
|
237
|
+
profileMode,
|
|
238
|
+
skipProofGeneration,
|
|
239
|
+
msgSender,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
async sendTx(tx) {
|
|
243
|
+
return await this.#execute(TxHash.schema, {
|
|
244
|
+
kind: "aztec_sendTx",
|
|
245
|
+
chain: this.#chain,
|
|
246
|
+
tx,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
async getContractClassMetadata(id, includeArtifact) {
|
|
250
|
+
return await this.#execute(ContractClassMetadataSchema, {
|
|
251
|
+
kind: "aztec_getContractClassMetadata",
|
|
252
|
+
chain: this.#chain,
|
|
253
|
+
id,
|
|
254
|
+
includeArtifact,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
async getContractMetadata(address) {
|
|
258
|
+
return await this.#execute(ContractMetadataSchema, {
|
|
259
|
+
kind: "aztec_getContractMetadata",
|
|
260
|
+
chain: this.#chain,
|
|
261
|
+
address,
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
async registerContract(contract) {
|
|
265
|
+
return await this.#execute(z.void(), {
|
|
266
|
+
kind: "aztec_registerContract",
|
|
267
|
+
chain: this.#chain,
|
|
268
|
+
contract,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
async registerContractClass(artifact) {
|
|
272
|
+
return await this.#execute(z.void(), {
|
|
273
|
+
kind: "aztec_registerContractClass",
|
|
274
|
+
chain: this.#chain,
|
|
275
|
+
artifact,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
async proveTx(txRequest, privateExecutionResult) {
|
|
279
|
+
return await this.#execute(TxProvingResult.schema, {
|
|
280
|
+
kind: "aztec_proveTx",
|
|
281
|
+
chain: this.#chain,
|
|
282
|
+
txRequest,
|
|
283
|
+
privateExecutionResult,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
async getNodeInfo() {
|
|
287
|
+
return await this.#execute(NodeInfoSchema, {
|
|
288
|
+
kind: "aztec_getNodeInfo",
|
|
289
|
+
chain: this.#chain,
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
async getPXEInfo() {
|
|
293
|
+
return await this.#execute(PXEInfoSchema, {
|
|
294
|
+
kind: "aztec_getPXEInfo",
|
|
295
|
+
chain: this.#chain,
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
async getCurrentBaseFees() {
|
|
299
|
+
return await this.#execute(GasFees.schema, {
|
|
300
|
+
kind: "aztec_getCurrentBaseFees",
|
|
301
|
+
chain: this.#chain,
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
async updateContract(contractAddress, artifact) {
|
|
305
|
+
return await this.#execute(z.void(), {
|
|
306
|
+
kind: "aztec_updateContract",
|
|
307
|
+
chain: this.#chain,
|
|
308
|
+
contractAddress,
|
|
309
|
+
artifact,
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
async registerSender(address) {
|
|
313
|
+
return await this.#execute(AztecAddress.schema, {
|
|
314
|
+
kind: "aztec_registerSender",
|
|
315
|
+
chain: this.#chain,
|
|
316
|
+
address,
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
async getSenders() {
|
|
320
|
+
return await this.#execute(z.array(AztecAddress.schema), {
|
|
321
|
+
kind: "aztec_getSenders",
|
|
322
|
+
chain: this.#chain,
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
async removeSender(address) {
|
|
326
|
+
return await this.#execute(z.void(), {
|
|
327
|
+
kind: "aztec_removeSender",
|
|
328
|
+
chain: this.#chain,
|
|
329
|
+
address,
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
async getTxReceipt(txHash) {
|
|
333
|
+
return await this.#execute(TxReceipt.schema, {
|
|
334
|
+
kind: "aztec_getTxReceipt",
|
|
335
|
+
chain: this.#chain,
|
|
336
|
+
txHash,
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
async getPrivateEvents(contractAddress, eventMetadata, from, numBlocks, recipients) {
|
|
340
|
+
return await this.#execute(z.any(), {
|
|
341
|
+
kind: "aztec_getPrivateEvents",
|
|
342
|
+
chain: this.#chain,
|
|
343
|
+
contractAddress,
|
|
344
|
+
eventMetadata,
|
|
345
|
+
from,
|
|
346
|
+
numBlocks,
|
|
347
|
+
recipients,
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
async getPublicEvents(eventMetadata, from, limit) {
|
|
351
|
+
return await this.#execute(z.any(), {
|
|
352
|
+
kind: "aztec_getPublicEvents",
|
|
353
|
+
chain: this.#chain,
|
|
354
|
+
eventMetadata,
|
|
355
|
+
from,
|
|
356
|
+
limit,
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AztecWallet } from "./azguard";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AztecWallet } from "./azguard";
|
package/dist/methods.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const aztecMethods = [
|
|
2
|
+
"aztec_simulateTx",
|
|
3
|
+
"aztec_simulateUtility",
|
|
4
|
+
"aztec_profileTx",
|
|
5
|
+
"aztec_sendTx",
|
|
6
|
+
"aztec_getContractClassMetadata",
|
|
7
|
+
"aztec_getContractMetadata",
|
|
8
|
+
"aztec_registerContract",
|
|
9
|
+
"aztec_registerContractClass",
|
|
10
|
+
"aztec_proveTx",
|
|
11
|
+
"aztec_getNodeInfo",
|
|
12
|
+
"aztec_getPXEInfo",
|
|
13
|
+
"aztec_getCurrentBaseFees",
|
|
14
|
+
"aztec_updateContract",
|
|
15
|
+
"aztec_registerSender",
|
|
16
|
+
"aztec_getSenders",
|
|
17
|
+
"aztec_removeSender",
|
|
18
|
+
"aztec_getTxReceipt",
|
|
19
|
+
"aztec_getPrivateEvents",
|
|
20
|
+
"aztec_getPublicEvents",
|
|
21
|
+
"aztec_getCompleteAddress",
|
|
22
|
+
"aztec_getAddress",
|
|
23
|
+
"aztec_getChainId",
|
|
24
|
+
"aztec_getVersion",
|
|
25
|
+
"aztec_createTxExecutionRequest",
|
|
26
|
+
"aztec_createAuthWit",
|
|
27
|
+
];
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { EventSelector } from "@aztec/stdlib/abi";
|
|
2
|
+
import { ZodFor } from "@aztec/foundation/schemas";
|
|
3
|
+
import z from "zod";
|
|
4
|
+
export declare const ContractClassMetadataSchema: z.ZodObject<{
|
|
5
|
+
contractClass: z.ZodUnion<[z.ZodObject<{
|
|
6
|
+
version: z.ZodLiteral<1>;
|
|
7
|
+
artifactHash: z.ZodType<import("@aztec/aztec.js").Fr, any, string>;
|
|
8
|
+
privateFunctions: z.ZodArray<z.ZodObject<{
|
|
9
|
+
selector: ZodFor<import("@aztec/aztec.js").FunctionSelector>;
|
|
10
|
+
vkHash: z.ZodType<import("@aztec/aztec.js").Fr, any, string>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
selector: import("@aztec/aztec.js").FunctionSelector;
|
|
13
|
+
vkHash: import("@aztec/aztec.js").Fr;
|
|
14
|
+
}, {
|
|
15
|
+
vkHash: string;
|
|
16
|
+
selector?: any;
|
|
17
|
+
}>, "many">;
|
|
18
|
+
packedBytecode: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Buffer<ArrayBuffer>, string>, z.ZodEffects<z.ZodObject<{
|
|
19
|
+
type: z.ZodLiteral<"Buffer">;
|
|
20
|
+
data: z.ZodArray<z.ZodNumber, "many">;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
type: "Buffer";
|
|
23
|
+
data: number[];
|
|
24
|
+
}, {
|
|
25
|
+
type: "Buffer";
|
|
26
|
+
data: number[];
|
|
27
|
+
}>, Buffer<ArrayBuffer>, {
|
|
28
|
+
type: "Buffer";
|
|
29
|
+
data: number[];
|
|
30
|
+
}>]>;
|
|
31
|
+
} & {
|
|
32
|
+
id: z.ZodType<import("@aztec/aztec.js").Fr, any, string>;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
version: 1;
|
|
35
|
+
id: import("@aztec/aztec.js").Fr;
|
|
36
|
+
artifactHash: import("@aztec/aztec.js").Fr;
|
|
37
|
+
packedBytecode: Buffer<ArrayBuffer>;
|
|
38
|
+
privateFunctions: {
|
|
39
|
+
selector: import("@aztec/aztec.js").FunctionSelector;
|
|
40
|
+
vkHash: import("@aztec/aztec.js").Fr;
|
|
41
|
+
}[];
|
|
42
|
+
}, {
|
|
43
|
+
version: 1;
|
|
44
|
+
id: string;
|
|
45
|
+
artifactHash: string;
|
|
46
|
+
packedBytecode: string | {
|
|
47
|
+
type: "Buffer";
|
|
48
|
+
data: number[];
|
|
49
|
+
};
|
|
50
|
+
privateFunctions: {
|
|
51
|
+
vkHash: string;
|
|
52
|
+
selector?: any;
|
|
53
|
+
}[];
|
|
54
|
+
}>, z.ZodUndefined]>;
|
|
55
|
+
isContractClassPubliclyRegistered: z.ZodBoolean;
|
|
56
|
+
artifact: z.ZodUnion<[ZodFor<import("@aztec/aztec.js").ContractArtifact>, z.ZodUndefined]>;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
isContractClassPubliclyRegistered: boolean;
|
|
59
|
+
contractClass?: {
|
|
60
|
+
version: 1;
|
|
61
|
+
id: import("@aztec/aztec.js").Fr;
|
|
62
|
+
artifactHash: import("@aztec/aztec.js").Fr;
|
|
63
|
+
packedBytecode: Buffer<ArrayBuffer>;
|
|
64
|
+
privateFunctions: {
|
|
65
|
+
selector: import("@aztec/aztec.js").FunctionSelector;
|
|
66
|
+
vkHash: import("@aztec/aztec.js").Fr;
|
|
67
|
+
}[];
|
|
68
|
+
} | undefined;
|
|
69
|
+
artifact?: import("@aztec/aztec.js").ContractArtifact | undefined;
|
|
70
|
+
}, {
|
|
71
|
+
isContractClassPubliclyRegistered: boolean;
|
|
72
|
+
contractClass?: {
|
|
73
|
+
version: 1;
|
|
74
|
+
id: string;
|
|
75
|
+
artifactHash: string;
|
|
76
|
+
packedBytecode: string | {
|
|
77
|
+
type: "Buffer";
|
|
78
|
+
data: number[];
|
|
79
|
+
};
|
|
80
|
+
privateFunctions: {
|
|
81
|
+
vkHash: string;
|
|
82
|
+
selector?: any;
|
|
83
|
+
}[];
|
|
84
|
+
} | undefined;
|
|
85
|
+
artifact?: any;
|
|
86
|
+
}>;
|
|
87
|
+
export declare const ContractMetadataSchema: z.ZodObject<{
|
|
88
|
+
contractInstance: z.ZodUnion<[z.ZodIntersection<z.ZodObject<{
|
|
89
|
+
version: z.ZodLiteral<1>;
|
|
90
|
+
salt: ZodFor<import("@aztec/aztec.js").Fr>;
|
|
91
|
+
deployer: ZodFor<import("@aztec/aztec.js").AztecAddress>;
|
|
92
|
+
currentContractClassId: ZodFor<import("@aztec/aztec.js").Fr>;
|
|
93
|
+
originalContractClassId: ZodFor<import("@aztec/aztec.js").Fr>;
|
|
94
|
+
initializationHash: ZodFor<import("@aztec/aztec.js").Fr>;
|
|
95
|
+
publicKeys: z.ZodEffects<z.ZodObject<{
|
|
96
|
+
masterNullifierPublicKey: z.ZodType<import("@aztec/aztec.js").Point, any, string>;
|
|
97
|
+
masterIncomingViewingPublicKey: z.ZodType<import("@aztec/aztec.js").Point, any, string>;
|
|
98
|
+
masterOutgoingViewingPublicKey: z.ZodType<import("@aztec/aztec.js").Point, any, string>;
|
|
99
|
+
masterTaggingPublicKey: z.ZodType<import("@aztec/aztec.js").Point, any, string>;
|
|
100
|
+
}, "strip", z.ZodTypeAny, {
|
|
101
|
+
masterNullifierPublicKey: import("@aztec/aztec.js").Point;
|
|
102
|
+
masterIncomingViewingPublicKey: import("@aztec/aztec.js").Point;
|
|
103
|
+
masterOutgoingViewingPublicKey: import("@aztec/aztec.js").Point;
|
|
104
|
+
masterTaggingPublicKey: import("@aztec/aztec.js").Point;
|
|
105
|
+
}, {
|
|
106
|
+
masterNullifierPublicKey: string;
|
|
107
|
+
masterIncomingViewingPublicKey: string;
|
|
108
|
+
masterOutgoingViewingPublicKey: string;
|
|
109
|
+
masterTaggingPublicKey: string;
|
|
110
|
+
}>, import("@aztec/aztec.js").PublicKeys, {
|
|
111
|
+
masterNullifierPublicKey: string;
|
|
112
|
+
masterIncomingViewingPublicKey: string;
|
|
113
|
+
masterOutgoingViewingPublicKey: string;
|
|
114
|
+
masterTaggingPublicKey: string;
|
|
115
|
+
}>;
|
|
116
|
+
}, "strip", z.ZodTypeAny, {
|
|
117
|
+
version: 1;
|
|
118
|
+
salt: import("@aztec/aztec.js").Fr;
|
|
119
|
+
publicKeys: import("@aztec/aztec.js").PublicKeys;
|
|
120
|
+
deployer: import("@aztec/aztec.js").AztecAddress;
|
|
121
|
+
currentContractClassId: import("@aztec/aztec.js").Fr;
|
|
122
|
+
originalContractClassId: import("@aztec/aztec.js").Fr;
|
|
123
|
+
initializationHash: import("@aztec/aztec.js").Fr;
|
|
124
|
+
}, {
|
|
125
|
+
version: 1;
|
|
126
|
+
publicKeys: {
|
|
127
|
+
masterNullifierPublicKey: string;
|
|
128
|
+
masterIncomingViewingPublicKey: string;
|
|
129
|
+
masterOutgoingViewingPublicKey: string;
|
|
130
|
+
masterTaggingPublicKey: string;
|
|
131
|
+
};
|
|
132
|
+
salt?: any;
|
|
133
|
+
deployer?: any;
|
|
134
|
+
currentContractClassId?: any;
|
|
135
|
+
originalContractClassId?: any;
|
|
136
|
+
initializationHash?: any;
|
|
137
|
+
}>, z.ZodObject<{
|
|
138
|
+
address: ZodFor<import("@aztec/aztec.js").AztecAddress>;
|
|
139
|
+
}, "strip", z.ZodTypeAny, {
|
|
140
|
+
address: import("@aztec/aztec.js").AztecAddress;
|
|
141
|
+
}, {
|
|
142
|
+
address?: any;
|
|
143
|
+
}>>, z.ZodUndefined]>;
|
|
144
|
+
isContractInitialized: z.ZodBoolean;
|
|
145
|
+
isContractPublished: z.ZodBoolean;
|
|
146
|
+
}, "strip", z.ZodTypeAny, {
|
|
147
|
+
isContractInitialized: boolean;
|
|
148
|
+
isContractPublished: boolean;
|
|
149
|
+
contractInstance?: ({
|
|
150
|
+
version: 1;
|
|
151
|
+
salt: import("@aztec/aztec.js").Fr;
|
|
152
|
+
publicKeys: import("@aztec/aztec.js").PublicKeys;
|
|
153
|
+
deployer: import("@aztec/aztec.js").AztecAddress;
|
|
154
|
+
currentContractClassId: import("@aztec/aztec.js").Fr;
|
|
155
|
+
originalContractClassId: import("@aztec/aztec.js").Fr;
|
|
156
|
+
initializationHash: import("@aztec/aztec.js").Fr;
|
|
157
|
+
} & {
|
|
158
|
+
address: import("@aztec/aztec.js").AztecAddress;
|
|
159
|
+
}) | undefined;
|
|
160
|
+
}, {
|
|
161
|
+
isContractInitialized: boolean;
|
|
162
|
+
isContractPublished: boolean;
|
|
163
|
+
contractInstance?: ({
|
|
164
|
+
version: 1;
|
|
165
|
+
publicKeys: {
|
|
166
|
+
masterNullifierPublicKey: string;
|
|
167
|
+
masterIncomingViewingPublicKey: string;
|
|
168
|
+
masterOutgoingViewingPublicKey: string;
|
|
169
|
+
masterTaggingPublicKey: string;
|
|
170
|
+
};
|
|
171
|
+
salt?: any;
|
|
172
|
+
deployer?: any;
|
|
173
|
+
currentContractClassId?: any;
|
|
174
|
+
originalContractClassId?: any;
|
|
175
|
+
initializationHash?: any;
|
|
176
|
+
} & {
|
|
177
|
+
address?: any;
|
|
178
|
+
}) | undefined;
|
|
179
|
+
}>;
|
|
180
|
+
export declare const PXEInfoSchema: z.ZodObject<{
|
|
181
|
+
pxeVersion: z.ZodString;
|
|
182
|
+
protocolContractAddresses: z.ZodObject<{
|
|
183
|
+
classRegistry: import("@aztec/stdlib/schemas").ZodFor<import("@aztec/aztec.js").AztecAddress>;
|
|
184
|
+
feeJuice: import("@aztec/stdlib/schemas").ZodFor<import("@aztec/aztec.js").AztecAddress>;
|
|
185
|
+
instanceRegistry: import("@aztec/stdlib/schemas").ZodFor<import("@aztec/aztec.js").AztecAddress>;
|
|
186
|
+
multiCallEntrypoint: import("@aztec/stdlib/schemas").ZodFor<import("@aztec/aztec.js").AztecAddress>;
|
|
187
|
+
}, "strip", z.ZodTypeAny, {
|
|
188
|
+
classRegistry: import("@aztec/aztec.js").AztecAddress;
|
|
189
|
+
feeJuice: import("@aztec/aztec.js").AztecAddress;
|
|
190
|
+
instanceRegistry: import("@aztec/aztec.js").AztecAddress;
|
|
191
|
+
multiCallEntrypoint: import("@aztec/aztec.js").AztecAddress;
|
|
192
|
+
}, {
|
|
193
|
+
classRegistry?: any;
|
|
194
|
+
feeJuice?: any;
|
|
195
|
+
instanceRegistry?: any;
|
|
196
|
+
multiCallEntrypoint?: any;
|
|
197
|
+
}>;
|
|
198
|
+
}, "strip", z.ZodTypeAny, {
|
|
199
|
+
pxeVersion: string;
|
|
200
|
+
protocolContractAddresses: {
|
|
201
|
+
classRegistry: import("@aztec/aztec.js").AztecAddress;
|
|
202
|
+
feeJuice: import("@aztec/aztec.js").AztecAddress;
|
|
203
|
+
instanceRegistry: import("@aztec/aztec.js").AztecAddress;
|
|
204
|
+
multiCallEntrypoint: import("@aztec/aztec.js").AztecAddress;
|
|
205
|
+
};
|
|
206
|
+
}, {
|
|
207
|
+
pxeVersion: string;
|
|
208
|
+
protocolContractAddresses: {
|
|
209
|
+
classRegistry?: any;
|
|
210
|
+
feeJuice?: any;
|
|
211
|
+
instanceRegistry?: any;
|
|
212
|
+
multiCallEntrypoint?: any;
|
|
213
|
+
};
|
|
214
|
+
}>;
|
|
215
|
+
export declare const EventMetadataDefinitionSchema: z.ZodObject<{
|
|
216
|
+
eventSelector: z.ZodType<EventSelector, any, string>;
|
|
217
|
+
abiType: z.ZodType<import("@aztec/aztec.js").AbiType, z.ZodTypeDef, import("@aztec/aztec.js").AbiType>;
|
|
218
|
+
fieldNames: z.ZodArray<z.ZodString, "many">;
|
|
219
|
+
}, "strip", z.ZodTypeAny, {
|
|
220
|
+
eventSelector: EventSelector;
|
|
221
|
+
abiType: import("@aztec/aztec.js").AbiType;
|
|
222
|
+
fieldNames: string[];
|
|
223
|
+
}, {
|
|
224
|
+
eventSelector: string;
|
|
225
|
+
abiType: import("@aztec/aztec.js").AbiType;
|
|
226
|
+
fieldNames: string[];
|
|
227
|
+
}>;
|
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AbiTypeSchema, ContractArtifactSchema, EventSelector } from "@aztec/stdlib/abi";
|
|
2
|
+
import { ContractClassWithIdSchema, ContractInstanceWithAddressSchema, ProtocolContractAddressesSchema, } from "@aztec/stdlib/contract";
|
|
3
|
+
import z from "zod";
|
|
4
|
+
// copied from aztec.js, because it's not exported
|
|
5
|
+
export const ContractClassMetadataSchema = z.object({
|
|
6
|
+
contractClass: z.union([ContractClassWithIdSchema, z.undefined()]),
|
|
7
|
+
isContractClassPubliclyRegistered: z.boolean(),
|
|
8
|
+
artifact: z.union([ContractArtifactSchema, z.undefined()]),
|
|
9
|
+
});
|
|
10
|
+
export const ContractMetadataSchema = z.object({
|
|
11
|
+
contractInstance: z.union([ContractInstanceWithAddressSchema, z.undefined()]),
|
|
12
|
+
isContractInitialized: z.boolean(),
|
|
13
|
+
isContractPublished: z.boolean(),
|
|
14
|
+
});
|
|
15
|
+
export const PXEInfoSchema = z.object({
|
|
16
|
+
pxeVersion: z.string(),
|
|
17
|
+
protocolContractAddresses: ProtocolContractAddressesSchema,
|
|
18
|
+
});
|
|
19
|
+
export const EventMetadataDefinitionSchema = z.object({
|
|
20
|
+
eventSelector: EventSelector.schema,
|
|
21
|
+
abiType: AbiTypeSchema,
|
|
22
|
+
fieldNames: z.array(z.string()),
|
|
23
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@azguardwallet/aztec-wallet",
|
|
3
|
+
"version": "2.0.3",
|
|
4
|
+
"description": "Azguard Wallet client fully compatible with Aztec.js' Wallet interface",
|
|
5
|
+
"author": "Azguard Wallet",
|
|
6
|
+
"homepage": "https://github.com/AzguardWallet/aztec-wallet",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/AzguardWallet/aztec-wallet.git"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"default": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "rm -rf dist && tsc"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@azguardwallet/client": "0.5.0",
|
|
26
|
+
"@azguardwallet/types": "0.5.0",
|
|
27
|
+
"@aztec/aztec.js": "2.0.3",
|
|
28
|
+
"@aztec/entrypoints": "2.0.3",
|
|
29
|
+
"@aztec/foundation": "2.0.3",
|
|
30
|
+
"@aztec/stdlib": "2.0.3",
|
|
31
|
+
"zod": "^3.23.8"
|
|
32
|
+
}
|
|
33
|
+
}
|