@aztec/aztec.js 0.1.0-alpha36 → 0.1.0-alpha38
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/.tsbuildinfo +1 -1
- package/README.md +3 -3
- package/dest/abis/ecdsa_account_contract.json +2 -2
- package/dest/abis/schnorr_account_contract.json +2 -2
- package/dest/abis/schnorr_single_key_account_contract.json +1 -1
- package/dest/account/account.d.ts +1 -2
- package/dest/account/account.d.ts.map +1 -1
- package/dest/account/account.js +7 -6
- package/dest/account/contract/ecdsa_account_contract.d.ts +1 -2
- package/dest/account/contract/ecdsa_account_contract.d.ts.map +1 -1
- package/dest/account/contract/ecdsa_account_contract.js +1 -1
- package/dest/account/contract/index.d.ts +1 -2
- package/dest/account/contract/index.d.ts.map +1 -1
- package/dest/account/contract/index.js +1 -1
- package/dest/account/contract/schnorr_account_contract.d.ts +1 -2
- package/dest/account/contract/schnorr_account_contract.d.ts.map +1 -1
- package/dest/account/contract/schnorr_account_contract.js +1 -1
- package/dest/account/contract/single_key_account_contract.d.ts +1 -2
- package/dest/account/contract/single_key_account_contract.d.ts.map +1 -1
- package/dest/account/contract/single_key_account_contract.js +1 -1
- package/dest/account/entrypoint/single_key_account_entrypoint.d.ts +3 -3
- package/dest/account/entrypoint/single_key_account_entrypoint.d.ts.map +1 -1
- package/dest/account/entrypoint/single_key_account_entrypoint.js +5 -5
- package/dest/account/index.d.ts +1 -2
- package/dest/account/index.d.ts.map +1 -1
- package/dest/account/index.js +7 -3
- package/dest/aztec_rpc_client/aztec_rpc_client.d.ts.map +1 -1
- package/dest/aztec_rpc_client/aztec_rpc_client.js +5 -4
- package/dest/aztec_rpc_client/wallet.d.ts +12 -13
- package/dest/aztec_rpc_client/wallet.d.ts.map +1 -1
- package/dest/aztec_rpc_client/wallet.js +21 -24
- package/dest/contract/contract.d.ts +1 -1
- package/dest/contract/contract.d.ts.map +1 -1
- package/dest/contract/contract.js +4 -3
- package/dest/contract/contract.test.js +16 -14
- package/dest/contract_deployer/deploy_method.d.ts +2 -2
- package/dest/contract_deployer/deploy_method.d.ts.map +1 -1
- package/dest/contract_deployer/deploy_method.js +7 -7
- package/dest/contract_deployer/deploy_sent_tx.js +2 -2
- package/dest/index.d.ts +3 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +4 -2
- package/dest/main.js +1 -1
- package/dest/sandbox/index.d.ts +108 -0
- package/dest/sandbox/index.d.ts.map +1 -0
- package/dest/sandbox/index.js +66 -0
- package/dest/utils/abi_types.d.ts +6 -0
- package/dest/utils/abi_types.d.ts.map +1 -0
- package/dest/utils/abi_types.js +2 -0
- package/dest/utils/account.d.ts +5 -2
- package/dest/utils/account.d.ts.map +1 -1
- package/dest/utils/account.js +21 -12
- package/dest/utils/index.d.ts +2 -0
- package/dest/utils/index.d.ts.map +1 -1
- package/dest/utils/index.js +3 -1
- package/dest/utils/l2_contracts.d.ts +10 -0
- package/dest/utils/l2_contracts.d.ts.map +1 -0
- package/dest/utils/l2_contracts.js +10 -0
- package/package.json +4 -4
- package/src/abis/ecdsa_account_contract.json +2 -2
- package/src/abis/schnorr_account_contract.json +2 -2
- package/src/abis/schnorr_single_key_account_contract.json +1 -1
- package/src/account/account.ts +6 -6
- package/src/account/contract/ecdsa_account_contract.ts +1 -2
- package/src/account/contract/index.ts +1 -2
- package/src/account/contract/schnorr_account_contract.ts +1 -2
- package/src/account/contract/single_key_account_contract.ts +1 -2
- package/src/account/entrypoint/single_key_account_entrypoint.ts +3 -10
- package/src/account/index.ts +5 -4
- package/src/aztec_rpc_client/aztec_rpc_client.ts +4 -3
- package/src/aztec_rpc_client/wallet.ts +23 -38
- package/src/contract/contract.test.ts +15 -14
- package/src/contract/contract.ts +3 -2
- package/src/contract_deployer/deploy_method.ts +7 -7
- package/src/contract_deployer/deploy_sent_tx.ts +1 -1
- package/src/index.ts +3 -1
- package/src/sandbox/index.ts +83 -0
- package/src/utils/abi_types.ts +4 -0
- package/src/utils/account.ts +36 -16
- package/src/utils/index.ts +2 -0
- package/src/utils/l2_contracts.ts +12 -0
- package/dest/account/complete_address.d.ts +0 -13
- package/dest/account/complete_address.d.ts.map +0 -1
- package/dest/account/complete_address.js +0 -8
- package/src/account/complete_address.ts +0 -18
package/src/contract/contract.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ContractAbi } from '@aztec/foundation/abi';
|
|
|
2
2
|
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
3
3
|
|
|
4
4
|
import { Wallet } from '../aztec_rpc_client/wallet.js';
|
|
5
|
+
import { isContractDeployed } from '../index.js';
|
|
5
6
|
import { ContractBase } from './contract_base.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -19,8 +20,8 @@ export class Contract extends ContractBase {
|
|
|
19
20
|
* @param wallet - The wallet to use when interacting with the contract.
|
|
20
21
|
* @returns A promise that resolves to a new Contract instance.
|
|
21
22
|
*/
|
|
22
|
-
public static async
|
|
23
|
-
if (!(await
|
|
23
|
+
public static async at(address: AztecAddress, abi: ContractAbi, wallet: Wallet): Promise<Contract> {
|
|
24
|
+
if (!(await isContractDeployed(wallet, address))) {
|
|
24
25
|
throw new Error('Contract ' + address.toString() + ' is not deployed');
|
|
25
26
|
}
|
|
26
27
|
return new Contract(address, abi, wallet);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ContractDeploymentData,
|
|
3
3
|
FunctionData,
|
|
4
|
-
|
|
4
|
+
PartialAddress,
|
|
5
5
|
TxContext,
|
|
6
6
|
getContractDeploymentInfo,
|
|
7
7
|
} from '@aztec/circuits.js';
|
|
@@ -36,7 +36,7 @@ export interface DeployOptions extends SendMethodOptions {
|
|
|
36
36
|
*/
|
|
37
37
|
export class DeployMethod<TContract extends ContractBase = Contract> extends BaseContractInteraction {
|
|
38
38
|
/** The partially computed contract address. Known after creation of the deployment transaction. */
|
|
39
|
-
public
|
|
39
|
+
public partialAddress?: PartialAddress = undefined;
|
|
40
40
|
|
|
41
41
|
/** The complete contract address. */
|
|
42
42
|
public completeContractAddress?: AztecAddress = undefined;
|
|
@@ -66,7 +66,7 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
|
|
|
66
66
|
|
|
67
67
|
const { chainId, version } = await this.rpc.getNodeInfo();
|
|
68
68
|
|
|
69
|
-
const {
|
|
69
|
+
const { completeAddress, constructorHash, functionTreeRoot } = await getContractDeploymentInfo(
|
|
70
70
|
this.abi,
|
|
71
71
|
this.args,
|
|
72
72
|
contractAddressSalt,
|
|
@@ -84,7 +84,7 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
|
|
|
84
84
|
const txContext = new TxContext(false, false, true, contractDeploymentData, new Fr(chainId), new Fr(version));
|
|
85
85
|
const args = encodeArguments(this.constructorAbi, this.args);
|
|
86
86
|
const functionData = FunctionData.fromAbi(this.constructorAbi);
|
|
87
|
-
const execution = { args, functionData, to: address };
|
|
87
|
+
const execution = { args, functionData, to: completeAddress.address };
|
|
88
88
|
const packedArguments = await PackedArguments.fromArgs(execution.args);
|
|
89
89
|
|
|
90
90
|
const txRequest = TxExecutionRequest.from({
|
|
@@ -96,11 +96,11 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
|
|
|
96
96
|
});
|
|
97
97
|
|
|
98
98
|
this.txRequest = txRequest;
|
|
99
|
-
this.
|
|
100
|
-
this.completeContractAddress = address;
|
|
99
|
+
this.partialAddress = completeAddress.partialAddress;
|
|
100
|
+
this.completeContractAddress = completeAddress.address;
|
|
101
101
|
|
|
102
102
|
// TODO: Should we add the contracts to the DB here, or once the tx has been sent or mined?
|
|
103
|
-
await this.rpc.addContracts([{ abi: this.abi, address, portalContract }]);
|
|
103
|
+
await this.rpc.addContracts([{ abi: this.abi, address: completeAddress.address, portalContract }]);
|
|
104
104
|
|
|
105
105
|
return this.txRequest;
|
|
106
106
|
}
|
|
@@ -50,6 +50,6 @@ export class DeploySentTx<TContract extends ContractBase = Contract> extends Sen
|
|
|
50
50
|
const contractWallet = wallet ?? (isWallet(this.arc) && this.arc);
|
|
51
51
|
if (!contractWallet) throw new Error(`A wallet is required for creating a contract instance`);
|
|
52
52
|
if (!address) throw new Error(`Contract address is missing from transaction receipt`);
|
|
53
|
-
return Contract.
|
|
53
|
+
return Contract.at(address, this.abi, contractWallet) as Promise<TContract>;
|
|
54
54
|
}
|
|
55
55
|
}
|
package/src/index.ts
CHANGED
|
@@ -4,13 +4,14 @@ export * from './utils/index.js';
|
|
|
4
4
|
export * from './aztec_rpc_client/index.js';
|
|
5
5
|
export * from './account/index.js';
|
|
6
6
|
export * from './contract_deployer/deploy_method.js';
|
|
7
|
+
export * from './sandbox/index.js';
|
|
7
8
|
|
|
8
9
|
export { AztecAddress, EthAddress, Point, Fr } from '@aztec/circuits.js';
|
|
9
10
|
export {
|
|
10
11
|
AztecRPC,
|
|
11
12
|
ContractData,
|
|
12
13
|
ContractDeploymentTx,
|
|
13
|
-
|
|
14
|
+
ContractDataAndBytecode,
|
|
14
15
|
DeployedContract,
|
|
15
16
|
FunctionCall,
|
|
16
17
|
L2BlockL2Logs,
|
|
@@ -27,3 +28,4 @@ export {
|
|
|
27
28
|
} from '@aztec/types';
|
|
28
29
|
|
|
29
30
|
export { createDebugLogger } from '@aztec/foundation/log';
|
|
31
|
+
export { sleep } from '@aztec/foundation/sleep';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Fr, PrivateKey } from '@aztec/circuits.js';
|
|
2
|
+
import { ContractAbi } from '@aztec/foundation/abi';
|
|
3
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
4
|
+
|
|
5
|
+
import SchnorrAccountContractAbi from '../abis/schnorr_account_contract.json' assert { type: 'json' };
|
|
6
|
+
import { AztecRPC, getAccountWallets, getSchnorrAccount } from '../index.js';
|
|
7
|
+
|
|
8
|
+
export const INITIAL_SANDBOX_ENCRYPTION_KEYS = [
|
|
9
|
+
new PrivateKey(Buffer.from('b2803ec899f76f6b2ac011480d24028f1a29587f8a3a92f7ee9d48d8c085c284', 'hex')),
|
|
10
|
+
new PrivateKey(Buffer.from('6bb46e9a80da2ff7bfff71c2c50eaaa4b15f7ed5ad1ade4261b574ef80b0cdb0', 'hex')),
|
|
11
|
+
new PrivateKey(Buffer.from('0f6addf0da06c33293df974a565b03d1ab096090d907d98055a8b7f4954e120c', 'hex')),
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export const INITIAL_SANDBOX_SIGNING_KEYS = INITIAL_SANDBOX_ENCRYPTION_KEYS;
|
|
15
|
+
|
|
16
|
+
export const INITIAL_SANDBOX_SALTS = [Fr.ZERO, Fr.ZERO, Fr.ZERO];
|
|
17
|
+
|
|
18
|
+
export const INITIAL_SANDBOX_ACCOUNT_CONTRACT_ABI = SchnorrAccountContractAbi;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Gets a wallet for the Aztec accounts that are initially stored in the sandbox.
|
|
22
|
+
* @param aztecRpc - An instance of the Aztec RPC interface.
|
|
23
|
+
* @returns An AccountWallet implementation that includes all the accounts found.
|
|
24
|
+
*/
|
|
25
|
+
export async function getSandboxAccountsWallet(aztecRpc: AztecRPC) {
|
|
26
|
+
return await getAccountWallets(
|
|
27
|
+
aztecRpc,
|
|
28
|
+
INITIAL_SANDBOX_ACCOUNT_CONTRACT_ABI as ContractAbi,
|
|
29
|
+
INITIAL_SANDBOX_ENCRYPTION_KEYS,
|
|
30
|
+
INITIAL_SANDBOX_SIGNING_KEYS,
|
|
31
|
+
INITIAL_SANDBOX_SALTS,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Deploys the initial set of schnorr signature accounts to the sandbox
|
|
37
|
+
* @param aztecRpc - An instance of the Aztec RPC interface.
|
|
38
|
+
* @returns The set of deployed Account objects and associated private encryption keys
|
|
39
|
+
*/
|
|
40
|
+
export async function deployInitialSandboxAccounts(aztecRpc: AztecRPC) {
|
|
41
|
+
const accounts = INITIAL_SANDBOX_ENCRYPTION_KEYS.map((privateKey, i) => {
|
|
42
|
+
const account = getSchnorrAccount(aztecRpc, privateKey, INITIAL_SANDBOX_SIGNING_KEYS[i], INITIAL_SANDBOX_SALTS[i]);
|
|
43
|
+
return {
|
|
44
|
+
account,
|
|
45
|
+
privateKey,
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
// Attempt to get as much parallelism as possible
|
|
49
|
+
const deployMethods = await Promise.all(
|
|
50
|
+
accounts.map(async x => {
|
|
51
|
+
const deployMethod = await x.account.getDeployMethod();
|
|
52
|
+
await deployMethod.create({ contractAddressSalt: x.account.salt });
|
|
53
|
+
await deployMethod.simulate({});
|
|
54
|
+
return deployMethod;
|
|
55
|
+
}),
|
|
56
|
+
);
|
|
57
|
+
// Send tx together to try and get them in the same rollup
|
|
58
|
+
const sentTxs = deployMethods.map(dm => {
|
|
59
|
+
return dm.send();
|
|
60
|
+
});
|
|
61
|
+
await Promise.all(
|
|
62
|
+
sentTxs.map(async (tx, i) => {
|
|
63
|
+
const wallet = await accounts[i].account.getWallet();
|
|
64
|
+
return tx.wait({ wallet });
|
|
65
|
+
}),
|
|
66
|
+
);
|
|
67
|
+
return accounts;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Function to wait until the sandbox becomes ready for use.
|
|
72
|
+
* @param rpcServer - The rpc client connected to the sandbox.
|
|
73
|
+
*/
|
|
74
|
+
export const waitForSandbox = async (rpcServer: AztecRPC) => {
|
|
75
|
+
while (true) {
|
|
76
|
+
try {
|
|
77
|
+
await rpcServer.getNodeInfo();
|
|
78
|
+
break;
|
|
79
|
+
} catch (err) {
|
|
80
|
+
await sleep(1000);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
package/src/utils/account.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { AztecRPC, TxStatus } from '@aztec/types';
|
|
|
6
6
|
|
|
7
7
|
import { SingleKeyAccountEntrypoint } from '../account/entrypoint/single_key_account_entrypoint.js';
|
|
8
8
|
import { EntrypointWallet, Wallet } from '../aztec_rpc_client/wallet.js';
|
|
9
|
-
import { ContractDeployer, EntrypointCollection, generatePublicKey } from '../index.js';
|
|
9
|
+
import { ContractDeployer, EntrypointCollection, StoredKeyAccountEntrypoint, generatePublicKey } from '../index.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Creates an Aztec Account.
|
|
@@ -27,7 +27,7 @@ export async function createAccounts(
|
|
|
27
27
|
const privKey = i == 0 && privateKey ? privateKey : PrivateKey.random();
|
|
28
28
|
const publicKey = await generatePublicKey(privKey);
|
|
29
29
|
const deploymentInfo = await getContractDeploymentInfo(accountContractAbi, [], salt, publicKey);
|
|
30
|
-
await aztecRpcClient.
|
|
30
|
+
await aztecRpcClient.registerAccount(privKey, deploymentInfo.completeAddress);
|
|
31
31
|
const contractDeployer = new ContractDeployer(accountContractAbi, aztecRpcClient, publicKey);
|
|
32
32
|
const tx = contractDeployer.deploy().send({ contractAddressSalt: salt });
|
|
33
33
|
await tx.isMined({ interval: 0.5 });
|
|
@@ -36,15 +36,20 @@ export async function createAccounts(
|
|
|
36
36
|
throw new Error(`Deployment tx not mined (status is ${receipt.status})`);
|
|
37
37
|
}
|
|
38
38
|
const address = receipt.contractAddress!;
|
|
39
|
-
if (!address.equals(deploymentInfo.address)) {
|
|
39
|
+
if (!address.equals(deploymentInfo.completeAddress.address)) {
|
|
40
40
|
throw new Error(
|
|
41
|
-
`Deployment address does not match for account contract (expected ${deploymentInfo.address.toString()} got ${address.toString()})`,
|
|
41
|
+
`Deployment address does not match for account contract (expected ${deploymentInfo.completeAddress.address.toString()} got ${address.toString()})`,
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
44
|
logger(`Created account ${address.toString()} with public key ${publicKey.toString()}`);
|
|
45
45
|
accountImpls.registerAccount(
|
|
46
46
|
address,
|
|
47
|
-
new SingleKeyAccountEntrypoint(
|
|
47
|
+
new SingleKeyAccountEntrypoint(
|
|
48
|
+
address,
|
|
49
|
+
deploymentInfo.completeAddress.partialAddress,
|
|
50
|
+
privKey,
|
|
51
|
+
await Schnorr.new(),
|
|
52
|
+
),
|
|
48
53
|
);
|
|
49
54
|
}
|
|
50
55
|
return new EntrypointWallet(aztecRpcClient, accountImpls);
|
|
@@ -53,23 +58,38 @@ export async function createAccounts(
|
|
|
53
58
|
/**
|
|
54
59
|
* Gets the Aztec accounts that are stored in an Aztec RPC instance.
|
|
55
60
|
* @param aztecRpcClient - An instance of the Aztec RPC interface.
|
|
56
|
-
* @param
|
|
61
|
+
* @param accountContractAbi - The abi of the account contract used when the accounts were deployed
|
|
62
|
+
* @param privateKeys - The encryption private keys used to create the accounts.
|
|
63
|
+
* @param signingKeys - The signing private keys used to create the accounts.
|
|
64
|
+
* @param salts - The salt values used to create the accounts.
|
|
57
65
|
* @returns An AccountWallet implementation that includes all the accounts found.
|
|
58
66
|
*/
|
|
59
|
-
export async function
|
|
67
|
+
export async function getAccountWallets(
|
|
60
68
|
aztecRpcClient: AztecRPC,
|
|
61
69
|
accountContractAbi: ContractAbi,
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
privateKeys: PrivateKey[],
|
|
71
|
+
signingKeys: PrivateKey[],
|
|
72
|
+
salts: Fr[],
|
|
64
73
|
) {
|
|
74
|
+
if (privateKeys.length != salts.length || signingKeys.length != privateKeys.length) {
|
|
75
|
+
throw new Error('Keys and salts must be the same length');
|
|
76
|
+
}
|
|
65
77
|
const accountCollection = new EntrypointCollection();
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
78
|
+
for (let i = 0; i < privateKeys.length; i++) {
|
|
79
|
+
const publicKey = await generatePublicKey(privateKeys[i]);
|
|
80
|
+
const signingPublicKey = await generatePublicKey(signingKeys[i]);
|
|
81
|
+
const deploymentInfo = await getContractDeploymentInfo(
|
|
82
|
+
accountContractAbi,
|
|
83
|
+
[signingPublicKey.x, signingPublicKey.y],
|
|
84
|
+
salts[i],
|
|
85
|
+
publicKey,
|
|
86
|
+
);
|
|
87
|
+
const address = deploymentInfo.completeAddress.address;
|
|
69
88
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
89
|
+
accountCollection.registerAccount(
|
|
90
|
+
address,
|
|
91
|
+
new StoredKeyAccountEntrypoint(address, signingKeys[i], await Schnorr.new()),
|
|
92
|
+
);
|
|
93
|
+
}
|
|
74
94
|
return new EntrypointWallet(aztecRpcClient, accountCollection);
|
|
75
95
|
}
|
package/src/utils/index.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
2
|
+
import { AztecRPC } from '@aztec/types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Checks whether a give contract is deployed on the network.
|
|
6
|
+
* @param aztecRpcClient - The aztec rpc client 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(aztecRpcClient: AztecRPC, contractAddress: AztecAddress): Promise<boolean> {
|
|
11
|
+
return !!(await aztecRpcClient.getContractData(contractAddress));
|
|
12
|
+
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AztecAddress, PartialContractAddress, PublicKey } from '@aztec/circuits.js';
|
|
2
|
-
/** Address and preimages associated with an account. */
|
|
3
|
-
export type CompleteAddress = {
|
|
4
|
-
/** Address of an account. Derived from the partial address and public key. */
|
|
5
|
-
address: AztecAddress;
|
|
6
|
-
/** Partial address of the account. Required for deriving the address from the encryption public key. */
|
|
7
|
-
partialAddress: PartialContractAddress;
|
|
8
|
-
/** Encryption public key associated with this address. */
|
|
9
|
-
publicKey: PublicKey;
|
|
10
|
-
};
|
|
11
|
-
/** Returns whether the argument looks like a CompleteAddress. */
|
|
12
|
-
export declare function isCompleteAddress(obj: any): obj is CompleteAddress;
|
|
13
|
-
//# sourceMappingURL=complete_address.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"complete_address.d.ts","sourceRoot":"","sources":["../../src/account/complete_address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAErF,wDAAwD;AACxD,MAAM,MAAM,eAAe,GAAG;IAC5B,8EAA8E;IAC9E,OAAO,EAAE,YAAY,CAAC;IACtB,wGAAwG;IACxG,cAAc,EAAE,sBAAsB,CAAC;IACvC,0DAA0D;IAC1D,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,iEAAiE;AACjE,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,eAAe,CAIlE"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/** Returns whether the argument looks like a CompleteAddress. */
|
|
2
|
-
export function isCompleteAddress(obj) {
|
|
3
|
-
if (!obj)
|
|
4
|
-
return false;
|
|
5
|
-
const maybe = obj;
|
|
6
|
-
return !!maybe.address && !!maybe.partialAddress && !!maybe.publicKey;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcGxldGVfYWRkcmVzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9hY2NvdW50L2NvbXBsZXRlX2FkZHJlc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBWUEsaUVBQWlFO0FBQ2pFLE1BQU0sVUFBVSxpQkFBaUIsQ0FBQyxHQUFRO0lBQ3hDLElBQUksQ0FBQyxHQUFHO1FBQUUsT0FBTyxLQUFLLENBQUM7SUFDdkIsTUFBTSxLQUFLLEdBQUcsR0FBc0IsQ0FBQztJQUNyQyxPQUFPLENBQUMsQ0FBQyxLQUFLLENBQUMsT0FBTyxJQUFJLENBQUMsQ0FBQyxLQUFLLENBQUMsY0FBYyxJQUFJLENBQUMsQ0FBQyxLQUFLLENBQUMsU0FBUyxDQUFDO0FBQ3hFLENBQUMifQ==
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { AztecAddress, PartialContractAddress, PublicKey } from '@aztec/circuits.js';
|
|
2
|
-
|
|
3
|
-
/** Address and preimages associated with an account. */
|
|
4
|
-
export type CompleteAddress = {
|
|
5
|
-
/** Address of an account. Derived from the partial address and public key. */
|
|
6
|
-
address: AztecAddress;
|
|
7
|
-
/** Partial address of the account. Required for deriving the address from the encryption public key. */
|
|
8
|
-
partialAddress: PartialContractAddress;
|
|
9
|
-
/** Encryption public key associated with this address. */
|
|
10
|
-
publicKey: PublicKey;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
/** Returns whether the argument looks like a CompleteAddress. */
|
|
14
|
-
export function isCompleteAddress(obj: any): obj is CompleteAddress {
|
|
15
|
-
if (!obj) return false;
|
|
16
|
-
const maybe = obj as CompleteAddress;
|
|
17
|
-
return !!maybe.address && !!maybe.partialAddress && !!maybe.publicKey;
|
|
18
|
-
}
|