@aztec/aztec.js 0.28.1 → 0.30.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/dest/account/interface.d.ts +17 -6
- package/dest/account/interface.d.ts.map +1 -1
- package/dest/account/interface.js +1 -1
- package/dest/account_manager/index.d.ts.map +1 -1
- package/dest/account_manager/index.js +6 -7
- package/dest/contract/contract_base.d.ts +1 -2
- package/dest/contract/contract_base.d.ts.map +1 -1
- package/dest/contract/contract_base.js +1 -1
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +5 -4
- package/dest/deployment/deploy_instance.d.ts +1 -4
- package/dest/deployment/deploy_instance.d.ts.map +1 -1
- package/dest/deployment/deploy_instance.js +9 -6
- package/dest/fee/native_fee_payment_method.d.ts +6 -3
- package/dest/fee/native_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/native_fee_payment_method.js +19 -13
- package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/private_fee_payment_method.js +4 -4
- package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/public_fee_payment_method.js +4 -4
- package/dest/index.d.ts +4 -3
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +5 -4
- package/dest/rpc_clients/pxe_client.d.ts.map +1 -1
- package/dest/rpc_clients/pxe_client.js +2 -4
- package/dest/utils/authwit.d.ts +2 -2
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +6 -6
- package/dest/utils/index.d.ts +0 -1
- package/dest/utils/index.d.ts.map +1 -1
- package/dest/utils/index.js +1 -2
- package/dest/wallet/account_wallet.d.ts +36 -8
- package/dest/wallet/account_wallet.d.ts.map +1 -1
- package/dest/wallet/account_wallet.js +36 -9
- package/dest/wallet/base_wallet.d.ts +17 -5
- package/dest/wallet/base_wallet.d.ts.map +1 -1
- package/dest/wallet/base_wallet.js +12 -9
- package/dest/wallet/signerless_wallet.d.ts +1 -1
- package/dest/wallet/signerless_wallet.d.ts.map +1 -1
- package/dest/wallet/signerless_wallet.js +2 -2
- package/package.json +7 -7
- package/src/account/interface.ts +22 -6
- package/src/account_manager/index.ts +5 -6
- package/src/contract/contract_base.ts +1 -2
- package/src/contract/deploy_method.ts +3 -2
- package/src/deployment/deploy_instance.ts +11 -10
- package/src/fee/native_fee_payment_method.ts +18 -10
- package/src/fee/private_fee_payment_method.ts +2 -9
- package/src/fee/public_fee_payment_method.ts +1 -5
- package/src/index.ts +1 -5
- package/src/rpc_clients/pxe_client.ts +0 -4
- package/src/utils/authwit.ts +5 -5
- package/src/utils/index.ts +0 -1
- package/src/wallet/account_wallet.ts +76 -9
- package/src/wallet/base_wallet.ts +27 -12
- package/src/wallet/signerless_wallet.ts +1 -1
- package/dest/utils/l2_contracts.d.ts +0 -10
- package/dest/utils/l2_contracts.d.ts.map +0 -1
- package/dest/utils/l2_contracts.js +0 -10
- package/src/utils/l2_contracts.ts +0 -12
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
import { FunctionCall } from '@aztec/circuit-types';
|
|
2
|
-
import { FunctionData } from '@aztec/circuits.js';
|
|
2
|
+
import { AztecAddress, FunctionData } from '@aztec/circuits.js';
|
|
3
3
|
import { FunctionSelector } from '@aztec/foundation/abi';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
-
import {
|
|
5
|
+
import { getCanonicalGasTokenAddress } from '@aztec/protocol-contracts/gas-token';
|
|
6
6
|
|
|
7
|
+
import { Wallet } from '../account/wallet.js';
|
|
7
8
|
import { FeePaymentMethod } from './fee_payment_method.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Pay fee directly in the native gas token.
|
|
11
12
|
*/
|
|
12
13
|
export class NativeFeePaymentMethod implements FeePaymentMethod {
|
|
13
|
-
|
|
14
|
+
#gasTokenAddress: AztecAddress;
|
|
14
15
|
|
|
15
|
-
constructor() {
|
|
16
|
+
private constructor(canonicalGasTokenAddress: AztecAddress) {
|
|
17
|
+
this.#gasTokenAddress = canonicalGasTokenAddress;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static async create(wallet: Wallet): Promise<NativeFeePaymentMethod> {
|
|
21
|
+
const nodeInfo = await wallet.getNodeInfo();
|
|
22
|
+
return new NativeFeePaymentMethod(getCanonicalGasTokenAddress(nodeInfo.l1ContractAddresses.gasPortalAddress));
|
|
23
|
+
}
|
|
16
24
|
|
|
17
25
|
/**
|
|
18
26
|
* Gets the native gas asset used to pay the fee.
|
|
19
27
|
* @returns The asset used to pay the fee.
|
|
20
28
|
*/
|
|
21
29
|
getAsset() {
|
|
22
|
-
return
|
|
30
|
+
return this.#gasTokenAddress;
|
|
23
31
|
}
|
|
24
32
|
|
|
25
33
|
/**
|
|
@@ -27,7 +35,7 @@ export class NativeFeePaymentMethod implements FeePaymentMethod {
|
|
|
27
35
|
* @returns The contract address responsible for holding the fee payment.
|
|
28
36
|
*/
|
|
29
37
|
getPaymentContract() {
|
|
30
|
-
return
|
|
38
|
+
return this.#gasTokenAddress;
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
/**
|
|
@@ -46,13 +54,13 @@ export class NativeFeePaymentMethod implements FeePaymentMethod {
|
|
|
46
54
|
getFunctionCalls(feeLimit: Fr): Promise<FunctionCall[]> {
|
|
47
55
|
return Promise.resolve([
|
|
48
56
|
{
|
|
49
|
-
to:
|
|
50
|
-
functionData: new FunctionData(FunctionSelector.fromSignature('check_balance(Field)'), false
|
|
57
|
+
to: this.#gasTokenAddress,
|
|
58
|
+
functionData: new FunctionData(FunctionSelector.fromSignature('check_balance(Field)'), false),
|
|
51
59
|
args: [feeLimit],
|
|
52
60
|
},
|
|
53
61
|
{
|
|
54
|
-
to:
|
|
55
|
-
functionData: new FunctionData(FunctionSelector.fromSignature('pay_fee(Field)'), false
|
|
62
|
+
to: this.#gasTokenAddress,
|
|
63
|
+
functionData: new FunctionData(FunctionSelector.fromSignature('pay_fee(Field)'), false),
|
|
56
64
|
args: [feeLimit],
|
|
57
65
|
},
|
|
58
66
|
]);
|
|
@@ -60,15 +60,10 @@ export class PrivateFeePaymentMethod implements FeePaymentMethod {
|
|
|
60
60
|
const nonce = Fr.random();
|
|
61
61
|
const messageHash = computeAuthWitMessageHash(this.paymentContract, {
|
|
62
62
|
args: [this.wallet.getCompleteAddress().address, this.paymentContract, maxFee, nonce],
|
|
63
|
-
functionData: new FunctionData(
|
|
64
|
-
FunctionSelector.fromSignature('unshield((Field),(Field),Field,Field)'),
|
|
65
|
-
false,
|
|
66
|
-
true,
|
|
67
|
-
false,
|
|
68
|
-
),
|
|
63
|
+
functionData: new FunctionData(FunctionSelector.fromSignature('unshield((Field),(Field),Field,Field)'), true),
|
|
69
64
|
to: this.asset,
|
|
70
65
|
});
|
|
71
|
-
await this.wallet.
|
|
66
|
+
await this.wallet.createAuthWit(messageHash);
|
|
72
67
|
|
|
73
68
|
const secretHashForRebate = computeMessageSecretHash(this.rebateSecret);
|
|
74
69
|
|
|
@@ -77,9 +72,7 @@ export class PrivateFeePaymentMethod implements FeePaymentMethod {
|
|
|
77
72
|
to: this.getPaymentContract(),
|
|
78
73
|
functionData: new FunctionData(
|
|
79
74
|
FunctionSelector.fromSignature('fee_entrypoint_private(Field,(Field),Field,Field)'),
|
|
80
|
-
false,
|
|
81
75
|
true,
|
|
82
|
-
false,
|
|
83
76
|
),
|
|
84
77
|
args: [maxFee, this.asset, secretHashForRebate, nonce],
|
|
85
78
|
},
|
|
@@ -56,21 +56,17 @@ export class PublicFeePaymentMethod implements FeePaymentMethod {
|
|
|
56
56
|
functionData: new FunctionData(
|
|
57
57
|
FunctionSelector.fromSignature('transfer_public((Field),(Field),Field,Field)'),
|
|
58
58
|
false,
|
|
59
|
-
false,
|
|
60
|
-
false,
|
|
61
59
|
),
|
|
62
60
|
to: this.asset,
|
|
63
61
|
});
|
|
64
62
|
|
|
65
63
|
return Promise.resolve([
|
|
66
|
-
this.wallet.
|
|
64
|
+
this.wallet.setPublicAuthWit(messageHash, true).request(),
|
|
67
65
|
{
|
|
68
66
|
to: this.getPaymentContract(),
|
|
69
67
|
functionData: new FunctionData(
|
|
70
68
|
FunctionSelector.fromSignature('fee_entrypoint_public(Field,(Field),Field)'),
|
|
71
|
-
false,
|
|
72
69
|
true,
|
|
73
|
-
false,
|
|
74
70
|
),
|
|
75
71
|
args: [maxFee, this.asset, nonce],
|
|
76
72
|
},
|
package/src/index.ts
CHANGED
|
@@ -41,7 +41,6 @@ export {
|
|
|
41
41
|
AztecAddressLike,
|
|
42
42
|
FunctionSelectorLike,
|
|
43
43
|
WrappedFieldLike,
|
|
44
|
-
isContractDeployed,
|
|
45
44
|
EthCheatCodes,
|
|
46
45
|
computeAuthWitMessageHash,
|
|
47
46
|
computeInnerAuthWitHash,
|
|
@@ -69,7 +68,7 @@ export {
|
|
|
69
68
|
GlobalVariables,
|
|
70
69
|
GrumpkinScalar,
|
|
71
70
|
Point,
|
|
72
|
-
getContractInstanceFromDeployParams,
|
|
71
|
+
getContractInstanceFromDeployParams, // TODO(@spalladino) This method should be used from within the DeployMethod but not exposed in aztec.js
|
|
73
72
|
getContractClassFromArtifact,
|
|
74
73
|
INITIAL_L2_BLOCK_NUM,
|
|
75
74
|
} from '@aztec/circuits.js';
|
|
@@ -83,9 +82,6 @@ export {
|
|
|
83
82
|
AztecNode,
|
|
84
83
|
Body,
|
|
85
84
|
CompleteAddress,
|
|
86
|
-
ContractData,
|
|
87
|
-
DeployedContract,
|
|
88
|
-
ExtendedContractData,
|
|
89
85
|
ExtendedNote,
|
|
90
86
|
FunctionCall,
|
|
91
87
|
GrumpkinPrivateKey,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AuthWitness,
|
|
3
|
-
ContractData,
|
|
4
|
-
ExtendedContractData,
|
|
5
3
|
ExtendedNote,
|
|
6
4
|
ExtendedUnencryptedL2Log,
|
|
7
5
|
L2Block,
|
|
@@ -40,10 +38,8 @@ export const createPXEClient = (url: string, fetch = makeFetch([1, 2, 3], false)
|
|
|
40
38
|
AuthWitness,
|
|
41
39
|
AztecAddress,
|
|
42
40
|
CompleteAddress,
|
|
43
|
-
ContractData,
|
|
44
41
|
FunctionSelector,
|
|
45
42
|
EthAddress,
|
|
46
|
-
ExtendedContractData,
|
|
47
43
|
ExtendedNote,
|
|
48
44
|
ExtendedUnencryptedL2Log,
|
|
49
45
|
Fr,
|
package/src/utils/authwit.ts
CHANGED
|
@@ -12,16 +12,16 @@ import { pedersenHash } from '@aztec/foundation/crypto';
|
|
|
12
12
|
* `bob` then signs the message hash and gives it to `alice` who can then perform the
|
|
13
13
|
* action.
|
|
14
14
|
* @param caller - The caller approved to make the call
|
|
15
|
-
* @param
|
|
15
|
+
* @param action - The request to be made (function call)
|
|
16
16
|
* @returns The message hash for the witness
|
|
17
17
|
*/
|
|
18
|
-
export const computeAuthWitMessageHash = (caller: AztecAddress,
|
|
18
|
+
export const computeAuthWitMessageHash = (caller: AztecAddress, action: FunctionCall) => {
|
|
19
19
|
return computeOuterAuthWitHash(
|
|
20
|
-
|
|
20
|
+
action.to.toField(),
|
|
21
21
|
computeInnerAuthWitHash([
|
|
22
22
|
caller.toField(),
|
|
23
|
-
|
|
24
|
-
PackedArguments.fromArgs(
|
|
23
|
+
action.functionData.selector.toField(),
|
|
24
|
+
PackedArguments.fromArgs(action.args).hash,
|
|
25
25
|
]),
|
|
26
26
|
);
|
|
27
27
|
};
|
package/src/utils/index.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { AuthWitness, FunctionCall, PXE, TxExecutionRequest } from '@aztec/circuit-types';
|
|
2
|
-
import { Fr } from '@aztec/circuits.js';
|
|
2
|
+
import { AztecAddress, Fr } from '@aztec/circuits.js';
|
|
3
3
|
import { ABIParameterVisibility, FunctionAbi, FunctionType } from '@aztec/foundation/abi';
|
|
4
4
|
|
|
5
5
|
import { AccountInterface, FeeOptions } from '../account/interface.js';
|
|
6
6
|
import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
|
|
7
|
+
import { computeAuthWitMessageHash } from '../utils/authwit.js';
|
|
7
8
|
import { BaseWallet } from './base_wallet.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -18,21 +19,76 @@ export class AccountWallet extends BaseWallet {
|
|
|
18
19
|
return this.account.createTxExecutionRequest(execs, fee);
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Computes an authentication witness from either a message or a caller and an action.
|
|
24
|
+
* If a message is provided, it will create a witness for the message directly.
|
|
25
|
+
* Otherwise, it will compute the message using the caller and the action.
|
|
26
|
+
* @param messageHashOrIntent - The message or the caller and action to approve
|
|
27
|
+
* @returns The authentication witness
|
|
28
|
+
*/
|
|
29
|
+
async createAuthWit(
|
|
30
|
+
messageHashOrIntent:
|
|
31
|
+
| Fr
|
|
32
|
+
| Buffer
|
|
33
|
+
| {
|
|
34
|
+
/** The caller to approve */
|
|
35
|
+
caller: AztecAddress;
|
|
36
|
+
/** The action to approve */
|
|
37
|
+
action: ContractFunctionInteraction | FunctionCall;
|
|
38
|
+
},
|
|
39
|
+
): Promise<AuthWitness> {
|
|
40
|
+
const messageHash = this.getMessageHash(messageHashOrIntent);
|
|
41
|
+
const witness = await this.account.createAuthWit(messageHash);
|
|
24
42
|
await this.pxe.addAuthWitness(witness);
|
|
25
43
|
return witness;
|
|
26
44
|
}
|
|
27
45
|
|
|
28
46
|
/**
|
|
29
|
-
* Returns
|
|
47
|
+
* Returns the message hash for the given message or authwit input.
|
|
48
|
+
* @param messageHashOrIntent - The message hash or the caller and action to authorize
|
|
49
|
+
* @returns The message hash
|
|
50
|
+
*/
|
|
51
|
+
private getMessageHash(
|
|
52
|
+
messageHashOrIntent:
|
|
53
|
+
| Fr
|
|
54
|
+
| Buffer
|
|
55
|
+
| {
|
|
56
|
+
/** The caller to approve */
|
|
57
|
+
caller: AztecAddress;
|
|
58
|
+
/** The action to approve */
|
|
59
|
+
action: ContractFunctionInteraction | FunctionCall;
|
|
60
|
+
},
|
|
61
|
+
): Fr {
|
|
62
|
+
if (Buffer.isBuffer(messageHashOrIntent)) {
|
|
63
|
+
return Fr.fromBuffer(messageHashOrIntent);
|
|
64
|
+
} else if (messageHashOrIntent instanceof Fr) {
|
|
65
|
+
return messageHashOrIntent;
|
|
66
|
+
} else if (messageHashOrIntent.action instanceof ContractFunctionInteraction) {
|
|
67
|
+
return computeAuthWitMessageHash(messageHashOrIntent.caller, messageHashOrIntent.action.request());
|
|
68
|
+
}
|
|
69
|
+
return computeAuthWitMessageHash(messageHashOrIntent.caller, messageHashOrIntent.action);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Returns a function interaction to set a message hash as authorized or revoked in this account.
|
|
30
74
|
* Public calls can then consume this authorization.
|
|
31
|
-
* @param
|
|
75
|
+
* @param messageHashOrIntent - The message or the caller and action to authorize/revoke
|
|
32
76
|
* @param authorized - True to authorize, false to revoke authorization.
|
|
33
77
|
* @returns - A function interaction.
|
|
34
78
|
*/
|
|
35
|
-
public
|
|
79
|
+
public setPublicAuthWit(
|
|
80
|
+
messageHashOrIntent:
|
|
81
|
+
| Fr
|
|
82
|
+
| Buffer
|
|
83
|
+
| {
|
|
84
|
+
/** The caller to approve */
|
|
85
|
+
caller: AztecAddress;
|
|
86
|
+
/** The action to approve */
|
|
87
|
+
action: ContractFunctionInteraction | FunctionCall;
|
|
88
|
+
},
|
|
89
|
+
authorized: boolean,
|
|
90
|
+
): ContractFunctionInteraction {
|
|
91
|
+
const message = this.getMessageHash(messageHashOrIntent);
|
|
36
92
|
if (authorized) {
|
|
37
93
|
return new ContractFunctionInteraction(this, this.getAddress(), this.getApprovePublicAuthwitAbi(), [message]);
|
|
38
94
|
} else {
|
|
@@ -42,10 +98,21 @@ export class AccountWallet extends BaseWallet {
|
|
|
42
98
|
|
|
43
99
|
/**
|
|
44
100
|
* Returns a function interaction to cancel a message hash as authorized in this account.
|
|
45
|
-
* @param
|
|
101
|
+
* @param messageHashOrIntent - The message or the caller and action to authorize/revoke
|
|
46
102
|
* @returns - A function interaction.
|
|
47
103
|
*/
|
|
48
|
-
public cancelAuthWit(
|
|
104
|
+
public cancelAuthWit(
|
|
105
|
+
messageHashOrIntent:
|
|
106
|
+
| Fr
|
|
107
|
+
| Buffer
|
|
108
|
+
| {
|
|
109
|
+
/** The caller to approve */
|
|
110
|
+
caller: AztecAddress;
|
|
111
|
+
/** The action to approve */
|
|
112
|
+
action: ContractFunctionInteraction | FunctionCall;
|
|
113
|
+
},
|
|
114
|
+
): ContractFunctionInteraction {
|
|
115
|
+
const message = this.getMessageHash(messageHashOrIntent);
|
|
49
116
|
const args = [message];
|
|
50
117
|
return new ContractFunctionInteraction(this, this.getAddress(), this.getCancelAuthwitAbi(), args);
|
|
51
118
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AuthWitness,
|
|
3
|
-
ContractData,
|
|
4
|
-
DeployedContract,
|
|
5
|
-
ExtendedContractData,
|
|
6
3
|
ExtendedNote,
|
|
7
4
|
FunctionCall,
|
|
8
5
|
GetUnencryptedLogsResponse,
|
|
@@ -18,11 +15,13 @@ import {
|
|
|
18
15
|
TxReceipt,
|
|
19
16
|
} from '@aztec/circuit-types';
|
|
20
17
|
import { AztecAddress, CompleteAddress, Fr, GrumpkinPrivateKey, PartialAddress } from '@aztec/circuits.js';
|
|
18
|
+
import { ContractArtifact } from '@aztec/foundation/abi';
|
|
21
19
|
import { ContractClassWithId, ContractInstanceWithAddress } from '@aztec/types/contracts';
|
|
22
20
|
import { NodeInfo } from '@aztec/types/interfaces';
|
|
23
21
|
|
|
24
22
|
import { FeeOptions } from '../account/interface.js';
|
|
25
23
|
import { Wallet } from '../account/wallet.js';
|
|
24
|
+
import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
|
|
26
25
|
|
|
27
26
|
/**
|
|
28
27
|
* A base class for Wallet implementations
|
|
@@ -34,8 +33,21 @@ export abstract class BaseWallet implements Wallet {
|
|
|
34
33
|
|
|
35
34
|
abstract createTxExecutionRequest(execs: FunctionCall[], fee?: FeeOptions): Promise<TxExecutionRequest>;
|
|
36
35
|
|
|
37
|
-
abstract
|
|
36
|
+
abstract createAuthWit(
|
|
37
|
+
messageHashOrIntent:
|
|
38
|
+
| Fr
|
|
39
|
+
| Buffer
|
|
40
|
+
| {
|
|
41
|
+
/** The caller to approve */
|
|
42
|
+
caller: AztecAddress;
|
|
43
|
+
/** The action to approve */
|
|
44
|
+
action: ContractFunctionInteraction | FunctionCall;
|
|
45
|
+
},
|
|
46
|
+
): Promise<AuthWitness>;
|
|
38
47
|
|
|
48
|
+
getAddress() {
|
|
49
|
+
return this.getCompleteAddress().address;
|
|
50
|
+
}
|
|
39
51
|
getContractInstance(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined> {
|
|
40
52
|
return this.pxe.getContractInstance(address);
|
|
41
53
|
}
|
|
@@ -63,8 +75,14 @@ export abstract class BaseWallet implements Wallet {
|
|
|
63
75
|
getRecipient(address: AztecAddress): Promise<CompleteAddress | undefined> {
|
|
64
76
|
return this.pxe.getRecipient(address);
|
|
65
77
|
}
|
|
66
|
-
|
|
67
|
-
|
|
78
|
+
registerContract(contract: {
|
|
79
|
+
/** Instance */ instance: ContractInstanceWithAddress;
|
|
80
|
+
/** Associated artifact */ artifact?: ContractArtifact;
|
|
81
|
+
}): Promise<void> {
|
|
82
|
+
return this.pxe.registerContract(contract);
|
|
83
|
+
}
|
|
84
|
+
registerContractClass(artifact: ContractArtifact): Promise<void> {
|
|
85
|
+
return this.pxe.registerContractClass(artifact);
|
|
68
86
|
}
|
|
69
87
|
getContracts(): Promise<AztecAddress[]> {
|
|
70
88
|
return this.pxe.getContracts();
|
|
@@ -100,12 +118,6 @@ export abstract class BaseWallet implements Wallet {
|
|
|
100
118
|
viewTx(functionName: string, args: any[], to: AztecAddress, from?: AztecAddress | undefined): Promise<any> {
|
|
101
119
|
return this.pxe.viewTx(functionName, args, to, from);
|
|
102
120
|
}
|
|
103
|
-
getExtendedContractData(contractAddress: AztecAddress): Promise<ExtendedContractData | undefined> {
|
|
104
|
-
return this.pxe.getExtendedContractData(contractAddress);
|
|
105
|
-
}
|
|
106
|
-
getContractData(contractAddress: AztecAddress): Promise<ContractData | undefined> {
|
|
107
|
-
return this.pxe.getContractData(contractAddress);
|
|
108
|
-
}
|
|
109
121
|
getUnencryptedLogs(filter: LogFilter): Promise<GetUnencryptedLogsResponse> {
|
|
110
122
|
return this.pxe.getUnencryptedLogs(filter);
|
|
111
123
|
}
|
|
@@ -130,4 +142,7 @@ export abstract class BaseWallet implements Wallet {
|
|
|
130
142
|
isContractClassPubliclyRegistered(id: Fr): Promise<boolean> {
|
|
131
143
|
return this.pxe.isContractClassPubliclyRegistered(id);
|
|
132
144
|
}
|
|
145
|
+
isContractPubliclyDeployed(address: AztecAddress): Promise<boolean> {
|
|
146
|
+
return this.pxe.isContractPubliclyDeployed(address);
|
|
147
|
+
}
|
|
133
148
|
}
|
|
@@ -31,7 +31,7 @@ export class SignerlessWallet extends BaseWallet {
|
|
|
31
31
|
throw new Error('Method not implemented.');
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
createAuthWit(_message: Fr): Promise<AuthWitness> {
|
|
35
35
|
throw new Error('Method not implemented.');
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { PXE } from '@aztec/circuit-types';
|
|
2
|
-
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
3
|
-
/**
|
|
4
|
-
* Checks whether a give contract is deployed on the network.
|
|
5
|
-
* @param pxe - The PXE to use to obtain the information.
|
|
6
|
-
* @param contractAddress - The address of the contract to check.
|
|
7
|
-
* @returns A flag indicating whether the contract is deployed.
|
|
8
|
-
*/
|
|
9
|
-
export declare function isContractDeployed(pxe: PXE, contractAddress: AztecAddress): Promise<boolean>;
|
|
10
|
-
//# sourceMappingURL=l2_contracts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"l2_contracts.d.ts","sourceRoot":"","sources":["../../src/utils/l2_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAElG"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks whether a give contract is deployed on the network.
|
|
3
|
-
* @param pxe - The PXE to use to obtain the information.
|
|
4
|
-
* @param contractAddress - The address of the contract to check.
|
|
5
|
-
* @returns A flag indicating whether the contract is deployed.
|
|
6
|
-
*/
|
|
7
|
-
export async function isContractDeployed(pxe, contractAddress) {
|
|
8
|
-
return !!(await pxe.getContractData(contractAddress)) || !!(await pxe.getContractInstance(contractAddress));
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibDJfY29udHJhY3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL2wyX2NvbnRyYWN0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHQTs7Ozs7R0FLRztBQUNILE1BQU0sQ0FBQyxLQUFLLFVBQVUsa0JBQWtCLENBQUMsR0FBUSxFQUFFLGVBQTZCO0lBQzlFLE9BQU8sQ0FBQyxDQUFDLENBQUMsTUFBTSxHQUFHLENBQUMsZUFBZSxDQUFDLGVBQWUsQ0FBQyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsTUFBTSxHQUFHLENBQUMsbUJBQW1CLENBQUMsZUFBZSxDQUFDLENBQUMsQ0FBQztBQUM5RyxDQUFDIn0=
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PXE } from '@aztec/circuit-types';
|
|
2
|
-
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Checks whether a give contract is deployed on the network.
|
|
6
|
-
* @param pxe - The PXE to use to obtain the information.
|
|
7
|
-
* @param contractAddress - The address of the contract to check.
|
|
8
|
-
* @returns A flag indicating whether the contract is deployed.
|
|
9
|
-
*/
|
|
10
|
-
export async function isContractDeployed(pxe: PXE, contractAddress: AztecAddress): Promise<boolean> {
|
|
11
|
-
return !!(await pxe.getContractData(contractAddress)) || !!(await pxe.getContractInstance(contractAddress));
|
|
12
|
-
}
|