@ape.swap/bonds-sdk 1.0.165 → 1.0.166
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/dist/components/Bonds/Bonds.js +1 -1
- package/dist/config/constants/addresses.d.ts +18 -0
- package/dist/config/constants/addresses.js +112 -0
- package/dist/config/constants/api.d.ts +6 -0
- package/dist/config/constants/api.js +6 -0
- package/dist/config/constants/chains.d.ts +48 -0
- package/dist/config/constants/chains.js +439 -0
- package/dist/config/constants/lifiRouting.d.ts +2 -0
- package/dist/config/constants/lifiRouting.js +6 -0
- package/dist/config/constants/lists.d.ts +10 -0
- package/dist/config/constants/lists.js +21 -0
- package/dist/config/constants/meta.d.ts +11 -0
- package/dist/config/constants/meta.js +92 -0
- package/dist/config/constants/misc.d.ts +3 -0
- package/dist/config/constants/misc.js +4 -0
- package/dist/config/constants/networks.d.ts +2 -0
- package/dist/config/constants/networks.js +44 -0
- package/dist/config/constants/products.d.ts +21 -0
- package/dist/config/constants/products.js +58 -0
- package/dist/config/constants/providers.d.ts +14 -0
- package/dist/config/constants/providers.js +103 -0
- package/dist/config/constants/queryKeys.d.ts +18 -0
- package/dist/config/constants/queryKeys.js +18 -0
- package/dist/config/constants/tokens.d.ts +6 -0
- package/dist/config/constants/tokens.js +452 -0
- package/dist/config/constants/tutorials.d.ts +7 -0
- package/dist/config/constants/tutorials.js +80 -0
- package/package.json +2 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const APESWAP_LIST_REPO_BRANCH: string;
|
|
2
|
+
export declare const APESWAP_LISTS_URL: string;
|
|
3
|
+
export declare const APESWAP_LIST_REPO: string;
|
|
4
|
+
export declare const APESWAP: string;
|
|
5
|
+
export declare const LIFI = "https://li.quest/v1/tokens";
|
|
6
|
+
export declare const UNSUPPORTED_LIST_URLS: string[];
|
|
7
|
+
export declare const DEFAULT_ACTIVE_LIST_URLS: string[];
|
|
8
|
+
export declare const DEFAULT_INACTIVE_LIST_URLS: string[];
|
|
9
|
+
export declare const DEFAULT_LIST_OF_LISTS: string[];
|
|
10
|
+
export declare const APE_CHAIN_LISTS: number[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
+
if (ar || !(i in from)) {
|
|
4
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
+
ar[i] = from[i];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
+
};
|
|
10
|
+
export var APESWAP_LIST_REPO_BRANCH = process.env.NEXT_PUBLIC_APESWAP_LIST_REPO_BRANCH || 'staging';
|
|
11
|
+
export var APESWAP_LISTS_URL = "https://raw.githubusercontent.com/ApeSwapFinance/apeswap-lists/".concat(APESWAP_LIST_REPO_BRANCH);
|
|
12
|
+
export var APESWAP_LIST_REPO = "https://raw.githubusercontent.com/ApeSwapFinance/apeswap-token-lists/".concat(APESWAP_LIST_REPO_BRANCH);
|
|
13
|
+
export var APESWAP = process.env.NEXT_PUBLIC_APESWAP_LIST || "".concat(APESWAP_LIST_REPO, "/lists/apeswap.json");
|
|
14
|
+
export var LIFI = 'https://li.quest/v1/tokens';
|
|
15
|
+
export var UNSUPPORTED_LIST_URLS = [];
|
|
16
|
+
// default lists to be 'active' aka searched across
|
|
17
|
+
export var DEFAULT_ACTIVE_LIST_URLS = [APESWAP, LIFI];
|
|
18
|
+
// need to load unsupported tokens as well
|
|
19
|
+
export var DEFAULT_INACTIVE_LIST_URLS = UNSUPPORTED_LIST_URLS;
|
|
20
|
+
export var DEFAULT_LIST_OF_LISTS = __spreadArray(__spreadArray([], DEFAULT_ACTIVE_LIST_URLS, true), DEFAULT_INACTIVE_LIST_URLS, true);
|
|
21
|
+
export var APE_CHAIN_LISTS = [1, 56, 137, 42161, 2525];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type PageMeta = {
|
|
2
|
+
title: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
image?: string;
|
|
5
|
+
favIco?: string;
|
|
6
|
+
twitterImage?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const ABOND_DEFAULT_META: PageMeta;
|
|
9
|
+
export declare const apebondCustomMeta: {
|
|
10
|
+
[key: string]: PageMeta;
|
|
11
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export var ABOND_DEFAULT_META = {
|
|
2
|
+
title: 'ApeBond | Building A Sustainable DeFi Future',
|
|
3
|
+
description: 'ApeBond is a multi-chain bonding protocol committed to building a sustainable DeFi future for projects and communities.',
|
|
4
|
+
image: 'https://frontend-git-feat-metadata-ape-swap-finance.vercel.app/meta/apebond/logo.png',
|
|
5
|
+
twitterImage: 'https://frontend-git-feat-metadata-ape-swap-finance.vercel.app/meta/apebond/twitter.png',
|
|
6
|
+
favIco: '/meta/apebond/favicon.ico',
|
|
7
|
+
};
|
|
8
|
+
export var apebondCustomMeta = {
|
|
9
|
+
'/': {
|
|
10
|
+
title: 'Home Page | ApeBond: Building A Sustainable DeFi Future',
|
|
11
|
+
description: 'ApeBond is a multi-chain bonding protocol committed to building a sustainable DeFi future for projects and communities.',
|
|
12
|
+
},
|
|
13
|
+
'/swap': {
|
|
14
|
+
title: 'Swap | ApeBond',
|
|
15
|
+
description: "Easily swap cross-chain between hundreds of crypto tokens using ApeBond's decentralized exchange.",
|
|
16
|
+
},
|
|
17
|
+
'/earn': {
|
|
18
|
+
title: 'Earn | ApeBond',
|
|
19
|
+
description: 'Stake LPs or single tokens in ApeBond to earn rewards.',
|
|
20
|
+
},
|
|
21
|
+
'/bonds': {
|
|
22
|
+
title: 'Bonds | ApeBond',
|
|
23
|
+
description: 'Buy tokens at a discount that vest over time through a unique NFT.',
|
|
24
|
+
},
|
|
25
|
+
'/bond-markets': {
|
|
26
|
+
title: 'Bonds | ApeBond',
|
|
27
|
+
description: 'Buy tokens at a discount that vest over time through a unique NFT.',
|
|
28
|
+
},
|
|
29
|
+
'/bond-highlight': {
|
|
30
|
+
title: 'Bonds | ApeBond',
|
|
31
|
+
description: 'Buy tokens at a discount that vest over time through a unique NFT.',
|
|
32
|
+
},
|
|
33
|
+
'/liquidity-health': {
|
|
34
|
+
title: 'Liquidity Health Dashboard | ApeBond',
|
|
35
|
+
image: 'https://frontend-git-feat-metadata-ape-swap-finance.vercel.app/meta/apebond/lhd_meta.png',
|
|
36
|
+
twitterImage: 'https://frontend-git-feat-metadata-ape-swap-finance.vercel.app/meta/apebond/lhd_meta.png',
|
|
37
|
+
description: "ApeBond's Liquidity Health Dashboard provides insights into the quality and sustainability of cryptocurrency projects based on their liquidity.",
|
|
38
|
+
},
|
|
39
|
+
'/dashboard': {
|
|
40
|
+
title: 'Protocol Dashboard | ApeBond',
|
|
41
|
+
description: 'ApeBond is a multi-chain bonding protocol committed to building a sustainable DeFi future for projects and communities.',
|
|
42
|
+
},
|
|
43
|
+
'/pools': {
|
|
44
|
+
title: 'Staking Pools | ApeBond',
|
|
45
|
+
description: 'Stake in Staking Pools to earn partner project tokens.',
|
|
46
|
+
},
|
|
47
|
+
'/farms': {
|
|
48
|
+
title: 'Farms | ApeBond',
|
|
49
|
+
description: 'Stake your liquidity provider (LP) Farms to earn.',
|
|
50
|
+
},
|
|
51
|
+
'/pool': {
|
|
52
|
+
title: 'Liquidity | ApeBond',
|
|
53
|
+
description: 'Add liquidity to the ApeBond decentralized exchange to create LPs and earn trading fees..',
|
|
54
|
+
},
|
|
55
|
+
'/add': {
|
|
56
|
+
title: 'Liquidity | ApeBond',
|
|
57
|
+
description: 'Add liquidity to the ApeBond decentralized exchange to create LPs and earn trading fees..',
|
|
58
|
+
},
|
|
59
|
+
'/nft': {
|
|
60
|
+
title: 'Non Fungible Apes | ApeBond',
|
|
61
|
+
description: 'Buy and sell ApeBond NFTs and join our NFT community.',
|
|
62
|
+
},
|
|
63
|
+
'/vaults': {
|
|
64
|
+
title: 'BANANA Maximizers | ApeBond',
|
|
65
|
+
description: 'Stake your liquidity provider (LP) tokens in auto-compounding vaults to earn BANANA.',
|
|
66
|
+
},
|
|
67
|
+
'/jungle-farms': {
|
|
68
|
+
title: 'Jungle Farms | ApeBond',
|
|
69
|
+
description: 'Stake your liquidity provider (LP) tokens to earn partner project tokens.',
|
|
70
|
+
},
|
|
71
|
+
'/iao': {
|
|
72
|
+
title: 'Initial Ape Offerings | ApeBond',
|
|
73
|
+
description: 'Launch your crypto project with ApeBond, or commit into Initial Ape Offerings.',
|
|
74
|
+
},
|
|
75
|
+
'/gnana': {
|
|
76
|
+
title: 'GNANA | ApeBond',
|
|
77
|
+
description: 'Convert your BANANA to GNANA to gain exclusive access to governance, pools, and more.',
|
|
78
|
+
},
|
|
79
|
+
'/stats': {
|
|
80
|
+
title: 'ApeStats | ApeBond',
|
|
81
|
+
description: 'Track your portfolio on ApeBond using our custom dashboard.',
|
|
82
|
+
},
|
|
83
|
+
'/orders': {
|
|
84
|
+
title: 'Limit Orders | ApeBond',
|
|
85
|
+
description: 'Trade crypto tokens at the price you want using limit orders on the ApeBond DEX.',
|
|
86
|
+
},
|
|
87
|
+
'/the-problem-with-sush': {
|
|
88
|
+
title: 'The Problem With SushiSwap | Apebond',
|
|
89
|
+
image: 'https://apeswap.finance/sushi-problem.jpg',
|
|
90
|
+
twitterImage: 'https://apeswap.finance/sushi-problem.jpg',
|
|
91
|
+
},
|
|
92
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { ChainId } from './chains';
|
|
3
|
+
export var PUBLIC_RPC_URLS = (_a = {},
|
|
4
|
+
_a[ChainId.BSC] = [
|
|
5
|
+
'https://bsc-dataseed.binance.org/',
|
|
6
|
+
'https://bsc-dataseed1.defibit.io',
|
|
7
|
+
'https://endpoints.omniatech.io/v1/bsc/mainnet/public',
|
|
8
|
+
],
|
|
9
|
+
_a[ChainId.ARBITRUM_ONE] = ['https://arb1.arbitrum.io/rpc'],
|
|
10
|
+
_a[ChainId.BSC_TESTNET] = ['https://data-seed-prebsc-2-s3.binance.org:8545/'],
|
|
11
|
+
_a[ChainId.POLYGON] = [
|
|
12
|
+
'https://polygon-mainnet.public.blastapi.io/',
|
|
13
|
+
'https://polygon-rpc.com/',
|
|
14
|
+
'https://rpc-mainnet.matic.network',
|
|
15
|
+
'https://matic-mainnet.chainstacklabs.com',
|
|
16
|
+
],
|
|
17
|
+
_a[ChainId.POLYGON_MUMBAI] = ['https://matic-mumbai.chainstacklabs.com'],
|
|
18
|
+
_a[ChainId.MAINNET] = [
|
|
19
|
+
'https://ethereum-rpc.publicnode.com',
|
|
20
|
+
'https://eth-mainnet.public.blastapi.io',
|
|
21
|
+
'https://rpc.ankr.com/eth',
|
|
22
|
+
],
|
|
23
|
+
_a[ChainId.TLOS] = ['https://mainnet.telos.net/evm'],
|
|
24
|
+
_a[ChainId.AVALANCHE] = ['https://api.avax.network/ext/bc/C/rpc'],
|
|
25
|
+
_a[ChainId.OPTIMISM] = ['https://rpc.ankr.com/optimism', 'https://optimism.publicnode.com'],
|
|
26
|
+
_a[ChainId.FANTOM] = ['https://rpc.ftm.tools/', 'https://rpcapi.fantom.network'],
|
|
27
|
+
_a[ChainId.CRONOS] = ['https://evm-cronos.crypto.org'],
|
|
28
|
+
_a[ChainId.POLYGON_ZK] = ['https://zkevm-rpc.com'],
|
|
29
|
+
_a[ChainId.CELO] = ['https://forno.celo.org'],
|
|
30
|
+
_a[ChainId.GNOSIS] = ['https://rpc.gnosischain.com/', 'https://rpc.ankr.com/gnosis'],
|
|
31
|
+
_a[ChainId.OKX] = ['https://exchainrpc.okex.org'],
|
|
32
|
+
_a[ChainId.INJECTED_EVM_TESTNET] = ['https://inevm-testnet.rpc.caldera.xyz/http'],
|
|
33
|
+
_a[ChainId.INEVM] = ['https://mainnet.rpc.inevm.com/http'],
|
|
34
|
+
_a[ChainId.SEPOLIA] = ['https://eth-sepolia-public.unifra.io'],
|
|
35
|
+
_a[ChainId.LINEA] = [
|
|
36
|
+
'https://linea.blockpi.network/v1/rpc/public',
|
|
37
|
+
'https://linea.decubate.com',
|
|
38
|
+
'https://rpc.linea.build',
|
|
39
|
+
],
|
|
40
|
+
_a[ChainId.LIGHTLINK] = ['https://replicator.phoenix.lightlink.io/rpc/v1'],
|
|
41
|
+
_a[ChainId.IOTA] = ['https://json-rpc.evm.iotaledger.net/'],
|
|
42
|
+
_a[ChainId.IOTA_TESTNET] = ['https://json-rpc.evm.testnet.iotaledger.net/'],
|
|
43
|
+
_a[ChainId.BASE] = ['https://base-rpc.publicnode.com', 'https://mainnet.base.org'],
|
|
44
|
+
_a);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ChainId } from './chains';
|
|
2
|
+
export declare enum LIST_VIEW_PRODUCTS {
|
|
3
|
+
BILLS = "treasury-bills",
|
|
4
|
+
MAXIMIZERS = "maximizers",
|
|
5
|
+
JUNGLE_FARMS = "jungle-farms",
|
|
6
|
+
POOLS = "pools",
|
|
7
|
+
FARMS = "farms",
|
|
8
|
+
EARN = "earn"
|
|
9
|
+
}
|
|
10
|
+
export declare enum OTHER_PRODUCTS {
|
|
11
|
+
GNANA = "gnana",
|
|
12
|
+
MIGRATE = "migrate",
|
|
13
|
+
ZAP = "zap",
|
|
14
|
+
IAO = "iao",
|
|
15
|
+
NFA_COLLECTION = "nft",
|
|
16
|
+
NFA_AUCTION = "auction",
|
|
17
|
+
NFA_STAKING = "staking",
|
|
18
|
+
V3 = "v3"
|
|
19
|
+
}
|
|
20
|
+
export declare const AVAILABLE_CHAINS_ON_LIST_VIEW_PRODUCTS: Record<LIST_VIEW_PRODUCTS, ChainId[]>;
|
|
21
|
+
export declare const FULL_PRODUCT_NAMES: Record<LIST_VIEW_PRODUCTS | OTHER_PRODUCTS, string>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
var _a, _b;
|
|
2
|
+
// enum to corresponding url
|
|
3
|
+
import { ChainId } from './chains';
|
|
4
|
+
export var LIST_VIEW_PRODUCTS;
|
|
5
|
+
(function (LIST_VIEW_PRODUCTS) {
|
|
6
|
+
LIST_VIEW_PRODUCTS["BILLS"] = "treasury-bills";
|
|
7
|
+
LIST_VIEW_PRODUCTS["MAXIMIZERS"] = "maximizers";
|
|
8
|
+
LIST_VIEW_PRODUCTS["JUNGLE_FARMS"] = "jungle-farms";
|
|
9
|
+
LIST_VIEW_PRODUCTS["POOLS"] = "pools";
|
|
10
|
+
LIST_VIEW_PRODUCTS["FARMS"] = "farms";
|
|
11
|
+
LIST_VIEW_PRODUCTS["EARN"] = "earn";
|
|
12
|
+
})(LIST_VIEW_PRODUCTS || (LIST_VIEW_PRODUCTS = {}));
|
|
13
|
+
export var OTHER_PRODUCTS;
|
|
14
|
+
(function (OTHER_PRODUCTS) {
|
|
15
|
+
OTHER_PRODUCTS["GNANA"] = "gnana";
|
|
16
|
+
OTHER_PRODUCTS["MIGRATE"] = "migrate";
|
|
17
|
+
OTHER_PRODUCTS["ZAP"] = "zap";
|
|
18
|
+
OTHER_PRODUCTS["IAO"] = "iao";
|
|
19
|
+
OTHER_PRODUCTS["NFA_COLLECTION"] = "nft";
|
|
20
|
+
OTHER_PRODUCTS["NFA_AUCTION"] = "auction";
|
|
21
|
+
OTHER_PRODUCTS["NFA_STAKING"] = "staking";
|
|
22
|
+
OTHER_PRODUCTS["V3"] = "v3";
|
|
23
|
+
})(OTHER_PRODUCTS || (OTHER_PRODUCTS = {}));
|
|
24
|
+
// Products on different chains and their available chains
|
|
25
|
+
// These products are list view components that have a specific chain redirect component
|
|
26
|
+
export var AVAILABLE_CHAINS_ON_LIST_VIEW_PRODUCTS = (_a = {},
|
|
27
|
+
_a[LIST_VIEW_PRODUCTS.BILLS] = [
|
|
28
|
+
ChainId.BSC,
|
|
29
|
+
ChainId.POLYGON,
|
|
30
|
+
ChainId.ARBITRUM_ONE,
|
|
31
|
+
ChainId.INEVM,
|
|
32
|
+
ChainId.MAINNET,
|
|
33
|
+
ChainId.LINEA,
|
|
34
|
+
ChainId.LIGHTLINK,
|
|
35
|
+
],
|
|
36
|
+
_a[LIST_VIEW_PRODUCTS.FARMS] = [ChainId.BSC, ChainId.POLYGON],
|
|
37
|
+
_a[LIST_VIEW_PRODUCTS.MAXIMIZERS] = [ChainId.BSC],
|
|
38
|
+
_a[LIST_VIEW_PRODUCTS.JUNGLE_FARMS] = [ChainId.BSC],
|
|
39
|
+
_a[LIST_VIEW_PRODUCTS.POOLS] = [ChainId.BSC, ChainId.POLYGON, ChainId.MAINNET],
|
|
40
|
+
_a[LIST_VIEW_PRODUCTS.EARN] = [ChainId.BSC, ChainId.POLYGON, ChainId.MAINNET],
|
|
41
|
+
_a);
|
|
42
|
+
// Full product names for readability
|
|
43
|
+
export var FULL_PRODUCT_NAMES = (_b = {},
|
|
44
|
+
_b[LIST_VIEW_PRODUCTS.BILLS] = 'Bonds',
|
|
45
|
+
_b[LIST_VIEW_PRODUCTS.MAXIMIZERS] = 'Banana Maximizers',
|
|
46
|
+
_b[LIST_VIEW_PRODUCTS.JUNGLE_FARMS] = 'Jungle Farms',
|
|
47
|
+
_b[LIST_VIEW_PRODUCTS.POOLS] = 'Pools',
|
|
48
|
+
_b[LIST_VIEW_PRODUCTS.FARMS] = 'Farms',
|
|
49
|
+
_b[LIST_VIEW_PRODUCTS.EARN] = 'Earn products',
|
|
50
|
+
_b[OTHER_PRODUCTS.GNANA] = 'Golden Banana',
|
|
51
|
+
_b[OTHER_PRODUCTS.MIGRATE] = 'Migrate',
|
|
52
|
+
_b[OTHER_PRODUCTS.ZAP] = 'Zap',
|
|
53
|
+
_b[OTHER_PRODUCTS.IAO] = 'Official IAO',
|
|
54
|
+
_b[OTHER_PRODUCTS.NFA_COLLECTION] = 'Nfa Collection',
|
|
55
|
+
_b[OTHER_PRODUCTS.NFA_AUCTION] = 'Nfa Auction',
|
|
56
|
+
_b[OTHER_PRODUCTS.NFA_STAKING] = 'Nfa Staking',
|
|
57
|
+
_b[OTHER_PRODUCTS.V3] = 'V3 Concentrated Liquidity',
|
|
58
|
+
_b);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StaticJsonRpcProvider } from '@ethersproject/providers';
|
|
2
|
+
import { ChainId } from './chains';
|
|
3
|
+
declare class AppJsonRpcProvider extends StaticJsonRpcProvider {
|
|
4
|
+
private _blockCache;
|
|
5
|
+
get blockCache(): Map<string, Promise<any>>;
|
|
6
|
+
constructor(chainId: ChainId, useApeRPC?: boolean);
|
|
7
|
+
send(method: string, params: Array<any>): Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* These are the only JsonRpcProviders used directly by the interface.
|
|
11
|
+
*/
|
|
12
|
+
export declare const RPC_PROVIDERS: Record<ChainId, StaticJsonRpcProvider>;
|
|
13
|
+
export declare const getProvider: (chainId: ChainId, useApeRPC?: boolean) => AppJsonRpcProvider;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var _a;
|
|
17
|
+
import { PUBLIC_RPC_URLS } from './networks';
|
|
18
|
+
import { StaticJsonRpcProvider } from '@ethersproject/providers';
|
|
19
|
+
import { AVERAGE_L1_BLOCK_TIME, CHAIN_NAMES, ChainId } from './chains';
|
|
20
|
+
import { isPlain } from '@reduxjs/toolkit';
|
|
21
|
+
import { deepCopy } from 'ethers/lib/utils';
|
|
22
|
+
var AppJsonRpcProvider = /** @class */ (function (_super) {
|
|
23
|
+
__extends(AppJsonRpcProvider, _super);
|
|
24
|
+
function AppJsonRpcProvider(chainId, useApeRPC) {
|
|
25
|
+
if (useApeRPC === void 0) { useApeRPC = false; }
|
|
26
|
+
var _this = this;
|
|
27
|
+
var urls = PUBLIC_RPC_URLS;
|
|
28
|
+
_this = _super.call(this, urls[chainId][0], /* networkish= */ { chainId: chainId, name: CHAIN_NAMES[chainId] }) || this;
|
|
29
|
+
_this._blockCache = new Map();
|
|
30
|
+
// NB: Third-party providers (eg MetaMask) will have their own polling intervals,
|
|
31
|
+
// which should be left as-is to allow operations (eg transaction confirmation) to resolve faster.
|
|
32
|
+
// Network providers (eg AppJsonRpcProvider) need to update less frequently to be considered responsive.
|
|
33
|
+
_this.pollingInterval = AVERAGE_L1_BLOCK_TIME;
|
|
34
|
+
return _this;
|
|
35
|
+
}
|
|
36
|
+
Object.defineProperty(AppJsonRpcProvider.prototype, "blockCache", {
|
|
37
|
+
get: function () {
|
|
38
|
+
var _this = this;
|
|
39
|
+
// If the blockCache has not yet been initialized this block, do so by
|
|
40
|
+
// setting a listener to clear it on the next block.
|
|
41
|
+
if (!this._blockCache.size) {
|
|
42
|
+
this.once('block', function () { return _this._blockCache.clear(); });
|
|
43
|
+
}
|
|
44
|
+
return this._blockCache;
|
|
45
|
+
},
|
|
46
|
+
enumerable: false,
|
|
47
|
+
configurable: true
|
|
48
|
+
});
|
|
49
|
+
AppJsonRpcProvider.prototype.send = function (method, params) {
|
|
50
|
+
// Only cache eth_call's.
|
|
51
|
+
if (method !== 'eth_call')
|
|
52
|
+
return _super.prototype.send.call(this, method, params);
|
|
53
|
+
// Only cache if params are serializable.
|
|
54
|
+
if (!isPlain(params))
|
|
55
|
+
return _super.prototype.send.call(this, method, params);
|
|
56
|
+
var key = "call:".concat(JSON.stringify(params));
|
|
57
|
+
var cached = this.blockCache.get(key);
|
|
58
|
+
if (cached) {
|
|
59
|
+
this.emit('debug', {
|
|
60
|
+
action: 'request',
|
|
61
|
+
request: deepCopy({ method: method, params: params, id: 'cache' }),
|
|
62
|
+
provider: this,
|
|
63
|
+
});
|
|
64
|
+
return cached;
|
|
65
|
+
}
|
|
66
|
+
var result = _super.prototype.send.call(this, method, params);
|
|
67
|
+
this.blockCache.set(key, result);
|
|
68
|
+
return result;
|
|
69
|
+
};
|
|
70
|
+
return AppJsonRpcProvider;
|
|
71
|
+
}(StaticJsonRpcProvider));
|
|
72
|
+
/**
|
|
73
|
+
* These are the only JsonRpcProviders used directly by the interface.
|
|
74
|
+
*/
|
|
75
|
+
export var RPC_PROVIDERS = (_a = {},
|
|
76
|
+
_a[ChainId.MAINNET] = new AppJsonRpcProvider(ChainId.MAINNET),
|
|
77
|
+
_a[ChainId.POLYGON] = new AppJsonRpcProvider(ChainId.POLYGON),
|
|
78
|
+
_a[ChainId.ARBITRUM_ONE] = new AppJsonRpcProvider(ChainId.ARBITRUM_ONE),
|
|
79
|
+
_a[ChainId.POLYGON_MUMBAI] = new AppJsonRpcProvider(ChainId.POLYGON_MUMBAI),
|
|
80
|
+
_a[ChainId.BSC] = new AppJsonRpcProvider(ChainId.BSC),
|
|
81
|
+
_a[ChainId.BSC_TESTNET] = new AppJsonRpcProvider(ChainId.BSC_TESTNET),
|
|
82
|
+
_a[ChainId.TLOS] = new AppJsonRpcProvider(ChainId.TLOS),
|
|
83
|
+
_a[ChainId.GNOSIS] = new AppJsonRpcProvider(ChainId.GNOSIS),
|
|
84
|
+
_a[ChainId.AVALANCHE] = new AppJsonRpcProvider(ChainId.AVALANCHE),
|
|
85
|
+
_a[ChainId.OPTIMISM] = new AppJsonRpcProvider(ChainId.OPTIMISM),
|
|
86
|
+
_a[ChainId.FANTOM] = new AppJsonRpcProvider(ChainId.FANTOM),
|
|
87
|
+
_a[ChainId.CRONOS] = new AppJsonRpcProvider(ChainId.CRONOS),
|
|
88
|
+
_a[ChainId.POLYGON_ZK] = new AppJsonRpcProvider(ChainId.POLYGON_ZK),
|
|
89
|
+
_a[ChainId.OKX] = new AppJsonRpcProvider(ChainId.OKX),
|
|
90
|
+
_a[ChainId.CELO] = new AppJsonRpcProvider(ChainId.CELO),
|
|
91
|
+
_a[ChainId.INJECTED_EVM_TESTNET] = new AppJsonRpcProvider(ChainId.INJECTED_EVM_TESTNET),
|
|
92
|
+
_a[ChainId.INEVM] = new AppJsonRpcProvider(ChainId.INEVM),
|
|
93
|
+
_a[ChainId.SEPOLIA] = new AppJsonRpcProvider(ChainId.SEPOLIA),
|
|
94
|
+
_a[ChainId.LINEA] = new AppJsonRpcProvider(ChainId.LINEA),
|
|
95
|
+
_a[ChainId.LIGHTLINK] = new AppJsonRpcProvider(ChainId.LIGHTLINK),
|
|
96
|
+
_a[ChainId.IOTA] = new AppJsonRpcProvider(ChainId.IOTA),
|
|
97
|
+
_a[ChainId.IOTA_TESTNET] = new AppJsonRpcProvider(ChainId.IOTA_TESTNET),
|
|
98
|
+
_a[ChainId.BASE] = new AppJsonRpcProvider(ChainId.BASE),
|
|
99
|
+
_a);
|
|
100
|
+
export var getProvider = function (chainId, useApeRPC) {
|
|
101
|
+
if (useApeRPC === void 0) { useApeRPC = false; }
|
|
102
|
+
return new AppJsonRpcProvider(chainId, useApeRPC);
|
|
103
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const QUERY_KEYS: {
|
|
2
|
+
INDUSTRY_STATS: string;
|
|
3
|
+
HISTORICAL_INDUSTRY_STATS: string;
|
|
4
|
+
LHD_PROFILES: string;
|
|
5
|
+
LHD_PROFILE: string;
|
|
6
|
+
LHD_PASSWORD_VERIFIED: string;
|
|
7
|
+
HOMEPAGE_STATS: string;
|
|
8
|
+
LIVE_AND_UPCOMING: string;
|
|
9
|
+
TVL_STATS: string;
|
|
10
|
+
TOKEN_HISTORIC: string;
|
|
11
|
+
BONDS_LANDING: string;
|
|
12
|
+
BOND_POST_REFERENCE: string;
|
|
13
|
+
BOND_RECOMMENDATIONS: string;
|
|
14
|
+
TOKEN_PRICES: string;
|
|
15
|
+
TIERS: string;
|
|
16
|
+
BOND_STATS: string;
|
|
17
|
+
HOT_BONDS: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export var QUERY_KEYS = {
|
|
2
|
+
INDUSTRY_STATS: 'industryStats',
|
|
3
|
+
HISTORICAL_INDUSTRY_STATS: 'historicalIndustryStats',
|
|
4
|
+
LHD_PROFILES: 'lhdProfiles',
|
|
5
|
+
LHD_PROFILE: 'lhdProfile',
|
|
6
|
+
LHD_PASSWORD_VERIFIED: 'lhdPasswordVerified',
|
|
7
|
+
HOMEPAGE_STATS: 'homepageStats',
|
|
8
|
+
LIVE_AND_UPCOMING: 'liveAndUpcoming',
|
|
9
|
+
TVL_STATS: 'tvlStats',
|
|
10
|
+
TOKEN_HISTORIC: 'tokenHistoric',
|
|
11
|
+
BONDS_LANDING: 'bondsLanding',
|
|
12
|
+
BOND_POST_REFERENCE: 'bondPostReference',
|
|
13
|
+
BOND_RECOMMENDATIONS: 'bondRecommendations',
|
|
14
|
+
TOKEN_PRICES: 'tokenPrices',
|
|
15
|
+
TIERS: 'tiers',
|
|
16
|
+
BOND_STATS: 'bondStats',
|
|
17
|
+
HOT_BONDS: 'hotBonds',
|
|
18
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NativeCurrency, Token } from '@ape.swap/sdk-core';
|
|
2
|
+
export declare const NATIVE_CHAIN_ID = "NATIVE";
|
|
3
|
+
export declare const WRAPPED_NATIVE_CURRENCY: {
|
|
4
|
+
[chainId: number]: Token | undefined;
|
|
5
|
+
};
|
|
6
|
+
export declare function nativeOnChain(chainId: number): NativeCurrency | Token;
|