@aztec/ethereum 0.46.6 → 0.46.7

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/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { type EthereumChain } from './ethereum_chain.js';
2
- export * from './testnet.js';
3
2
  export * from './deploy_l1_contracts.js';
4
3
  export * from './l1_contract_addresses.js';
5
4
  export * from './constants.js';
@@ -8,5 +7,5 @@ export * from './constants.js';
8
7
  * @param rpcUrl - The rpc url of the chain or a chain identifier (e.g. 'testnet')
9
8
  * @param apiKey - An optional API key for the chain client.
10
9
  */
11
- export declare function createEthereumChain(rpcUrl: string, apiKey?: string): EthereumChain;
10
+ export declare function createEthereumChain(rpcUrl: string, _chainId: number | string): EthereumChain;
12
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAE/B;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,iBAWlE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAE/B;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,iBAyB5E"}
package/dest/index.js CHANGED
@@ -1,6 +1,4 @@
1
1
  import { foundry } from 'viem/chains';
2
- import { createTestnetChain } from './testnet.js';
3
- export * from './testnet.js';
4
2
  export * from './deploy_l1_contracts.js';
5
3
  export * from './l1_contract_addresses.js';
6
4
  export * from './constants.js';
@@ -9,16 +7,32 @@ export * from './constants.js';
9
7
  * @param rpcUrl - The rpc url of the chain or a chain identifier (e.g. 'testnet')
10
8
  * @param apiKey - An optional API key for the chain client.
11
9
  */
12
- export function createEthereumChain(rpcUrl, apiKey) {
13
- if (rpcUrl === 'testnet') {
14
- if (apiKey === undefined || apiKey === '') {
15
- throw new Error('API Key must be provided for aztec testnet');
16
- }
17
- return createTestnetChain(apiKey);
10
+ export function createEthereumChain(rpcUrl, _chainId) {
11
+ let chainId;
12
+ if (typeof _chainId === 'string') {
13
+ chainId = +_chainId;
14
+ }
15
+ else {
16
+ chainId = _chainId;
17
+ }
18
+ if (chainId) {
19
+ return {
20
+ chainInfo: {
21
+ id: chainId,
22
+ nativeCurrency: {
23
+ decimals: 18,
24
+ name: 'Ether',
25
+ symbol: 'ETH',
26
+ },
27
+ },
28
+ rpcUrl,
29
+ };
30
+ }
31
+ else {
32
+ return {
33
+ chainInfo: foundry,
34
+ rpcUrl,
35
+ };
18
36
  }
19
- return {
20
- chainInfo: foundry,
21
- rpcUrl,
22
- };
23
37
  }
24
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUd0QyxPQUFPLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFFbEQsY0FBYyxjQUFjLENBQUM7QUFDN0IsY0FBYywwQkFBMEIsQ0FBQztBQUN6QyxjQUFjLDRCQUE0QixDQUFDO0FBQzNDLGNBQWMsZ0J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FDWixPQUFPO1lBQ0wsU0FBUyxFQUFFO2dCQUNULEVBQUUsRUFBRSxPQUFPO2dCQUNYLGNBQWMsRUFBRTtvQkFDZCxRQUFRLEVBQUUsRUFBRTtvQkFDWixJQUFJLEVBQUUsT0FBTztvQkFDYixNQUFNLEVBQUUsS0FBSztpQkFDZDthQUNGO1lBQ0QsTUFBTTtTQUNVLENBQUM7SUFDckIsQ0FBQztTQUFNLENBQUM7UUFDTixPQUFPO1lBQ0wsU0FBUyxFQUFFLE9BQU87WUFDbEIsTUFBTTtTQUNVLENBQUM7SUFDckIsQ0FBQztBQUNILENBQUMifQ==
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/ethereum",
3
- "version": "0.46.6",
3
+ "version": "0.46.7",
4
4
  "type": "module",
5
5
  "exports": "./dest/index.js",
6
6
  "typedocOptions": {
@@ -24,7 +24,7 @@
24
24
  "../package.common.json"
25
25
  ],
26
26
  "dependencies": {
27
- "@aztec/foundation": "0.46.6",
27
+ "@aztec/foundation": "0.46.7",
28
28
  "dotenv": "^16.0.3",
29
29
  "tslib": "^2.4.0",
30
30
  "viem": "^2.7.15"
package/src/index.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  import { foundry } from 'viem/chains';
2
2
 
3
3
  import { type EthereumChain } from './ethereum_chain.js';
4
- import { createTestnetChain } from './testnet.js';
5
4
 
6
- export * from './testnet.js';
7
5
  export * from './deploy_l1_contracts.js';
8
6
  export * from './l1_contract_addresses.js';
9
7
  export * from './constants.js';
@@ -13,15 +11,29 @@ export * from './constants.js';
13
11
  * @param rpcUrl - The rpc url of the chain or a chain identifier (e.g. 'testnet')
14
12
  * @param apiKey - An optional API key for the chain client.
15
13
  */
16
- export function createEthereumChain(rpcUrl: string, apiKey?: string) {
17
- if (rpcUrl === 'testnet') {
18
- if (apiKey === undefined || apiKey === '') {
19
- throw new Error('API Key must be provided for aztec testnet');
20
- }
21
- return createTestnetChain(apiKey!);
14
+ export function createEthereumChain(rpcUrl: string, _chainId: number | string) {
15
+ let chainId: number;
16
+ if (typeof _chainId === 'string') {
17
+ chainId = +_chainId;
18
+ } else {
19
+ chainId = _chainId;
20
+ }
21
+ if (chainId) {
22
+ return {
23
+ chainInfo: {
24
+ id: chainId,
25
+ nativeCurrency: {
26
+ decimals: 18,
27
+ name: 'Ether',
28
+ symbol: 'ETH',
29
+ },
30
+ },
31
+ rpcUrl,
32
+ } as EthereumChain;
33
+ } else {
34
+ return {
35
+ chainInfo: foundry,
36
+ rpcUrl,
37
+ } as EthereumChain;
22
38
  }
23
- return {
24
- chainInfo: foundry,
25
- rpcUrl,
26
- } as EthereumChain;
27
39
  }
package/dest/testnet.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { type EthereumChain } from './ethereum_chain.js';
2
- export declare const createTestnetChain: (apiKey: string) => EthereumChain;
3
- //# sourceMappingURL=testnet.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"testnet.d.ts","sourceRoot":"","sources":["../src/testnet.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIzD,eAAO,MAAM,kBAAkB,WAAY,MAAM,kBAuBhD,CAAC"}
package/dest/testnet.js DELETED
@@ -1,26 +0,0 @@
1
- const { DEPLOY_TAG = 'aztec-dev', CHAIN_ID = 31337 } = process.env;
2
- export const createTestnetChain = (apiKey) => {
3
- const chain = {
4
- id: +CHAIN_ID,
5
- name: 'testnet',
6
- testnet: true,
7
- nativeCurrency: {
8
- name: 'Ether',
9
- symbol: 'ETH',
10
- decimals: 18,
11
- },
12
- rpcUrls: {
13
- default: {
14
- http: [`https://${DEPLOY_TAG}-mainnet-fork.aztec.network:8545/${apiKey}`],
15
- },
16
- public: {
17
- http: [`https://${DEPLOY_TAG}-mainnet-fork.aztec.network:8545/${apiKey}`],
18
- },
19
- },
20
- };
21
- return {
22
- chainInfo: chain,
23
- rpcUrl: chain.rpcUrls.default.http[0],
24
- };
25
- };
26
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdG5ldC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy90ZXN0bmV0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlBLE1BQU0sRUFBRSxVQUFVLEdBQUcsV0FBVyxFQUFFLFFBQVEsR0FBRyxLQUFLLEVBQUUsR0FBRyxPQUFPLENBQUMsR0FBRyxDQUFDO0FBRW5FLE1BQU0sQ0FBQyxNQUFNLGtCQUFrQixHQUFHLENBQUMsTUFBYyxFQUFFLEVBQUU7SUFDbkQsTUFBTSxLQUFLLEdBQVU7UUFDbkIsRUFBRSxFQUFFLENBQUMsUUFBUTtRQUNiLElBQUksRUFBRSxTQUFTO1FBQ2YsT0FBTyxFQUFFLElBQUk7UUFDYixjQUFjLEVBQUU7WUFDZCxJQUFJLEVBQUUsT0FBTztZQUNiLE1BQU0sRUFBRSxLQUFLO1lBQ2IsUUFBUSxFQUFFLEVBQUU7U0FDYjtRQUNELE9BQU8sRUFBRTtZQUNQLE9BQU8sRUFBRTtnQkFDUCxJQUFJLEVBQUUsQ0FBQyxXQUFXLFVBQVUsb0NBQW9DLE1BQU0sRUFBRSxDQUFDO2FBQzFFO1lBQ0QsTUFBTSxFQUFFO2dCQUNOLElBQUksRUFBRSxDQUFDLFdBQVcsVUFBVSxvQ0FBb0MsTUFBTSxFQUFFLENBQUM7YUFDMUU7U0FDRjtLQUNGLENBQUM7SUFDRixPQUFPO1FBQ0wsU0FBUyxFQUFFLEtBQUs7UUFDaEIsTUFBTSxFQUFFLEtBQUssQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUM7S0FDckIsQ0FBQztBQUNyQixDQUFDLENBQUMifQ==
package/src/testnet.ts DELETED
@@ -1,30 +0,0 @@
1
- import { type Chain } from 'viem';
2
-
3
- import { type EthereumChain } from './ethereum_chain.js';
4
-
5
- const { DEPLOY_TAG = 'aztec-dev', CHAIN_ID = 31337 } = process.env;
6
-
7
- export const createTestnetChain = (apiKey: string) => {
8
- const chain: Chain = {
9
- id: +CHAIN_ID,
10
- name: 'testnet',
11
- testnet: true,
12
- nativeCurrency: {
13
- name: 'Ether',
14
- symbol: 'ETH',
15
- decimals: 18,
16
- },
17
- rpcUrls: {
18
- default: {
19
- http: [`https://${DEPLOY_TAG}-mainnet-fork.aztec.network:8545/${apiKey}`],
20
- },
21
- public: {
22
- http: [`https://${DEPLOY_TAG}-mainnet-fork.aztec.network:8545/${apiKey}`],
23
- },
24
- },
25
- };
26
- return {
27
- chainInfo: chain,
28
- rpcUrl: chain.rpcUrls.default.http[0],
29
- } as EthereumChain;
30
- };