Sub-Adapters 1
Preview and test each sub adapter.
Aztec Network (aztec-network)
Metadata
- ID
- aztec-network
- icon
- category
"l2"
- name
"Aztec Network"
- description
"Aztec is an open source layer 2 network that aims to bring scalability and privacy to Ethereum based on ZK-SNARKS."
- l2BeatSlug
"aztec"
- website
"https://aztec.network/"
Queries
Adapter Code
Check the entire code written for the Adapter.
Source code
Showing TS source.
1export const name = 'Aztec Protocol Transaction Fees';
2export const version = '0.2.2';
3export const license = 'MIT';
4export const changelog = 'adding aztec logo';
5
6const aztec_fees_url = 'https://api.aztec.network/aztec-connect-prod/falafel/tx-fees'
7enum AssetId {
8 ETH,
9 DAI
10};
11
12enum TxType {
13 DEPOSIT,
14 TRANSFER,
15 WITHDRAW_TO_WALLET,
16 WITHDRAW_HIGH_GAS,
17 ACCOUNT,
18 DEFI_DEPOSIT,
19 DEFI_CLAIM,
20}
21
22enum TxSettlementTime {
23 NEXT_ROLLUP,
24 INSTANT,
25}
26
27export function setup(sdk: Context) {
28 const getFeeTransferEth = async () => {
29 const response = await sdk.http.post(aztec_fees_url, { assetId: AssetId.ETH });
30 const ethPrice = await sdk.coinGecko.getCurrentPrice('ethereum');
31 return response[TxType.TRANSFER][TxSettlementTime.NEXT_ROLLUP].value / 1e18 * ethPrice;
32 };
33 const getFeeTransferERC20 = async () => {
34 const response = await sdk.http.post(aztec_fees_url, { assetId: AssetId.DAI });
35 const daiPrice = await sdk.coinGecko.getCurrentPrice('dai');
36 return response[TxType.TRANSFER][TxSettlementTime.NEXT_ROLLUP].value / 1e18 * daiPrice;
37 };
38
39 sdk.register({
40 id: 'aztec-network',
41 queries: {
42 feeTransferEth: getFeeTransferEth,
43 feeTransferERC20: getFeeTransferERC20,
44 // feeSwap: getFeeForSwap,
45 },
46 metadata: {
47 icon: sdk.ipfs.getDataURILoader('QmaaYiAtFKGPeHRR629yQqkDAqzcpywfbEjun5KmhE6QH1', 'image/svg+xml'),
48 category: 'l2',
49 name: 'Aztec Network',
50 description: 'Aztec is an open source layer 2 network that aims to bring scalability and privacy to Ethereum based on ZK-SNARKS.',
51 l2BeatSlug: 'aztec',
52 website: 'https://aztec.network/',
53 },
54 });
55}
It's something off?
Report it to the discussion board on Discord, we will take care of it.