@proton/wrap-constants 0.1.1 → 0.2.2
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/coins.d.ts +42 -9
- package/dist/constants.d.ts +10 -0
- package/dist/graph.d.ts +30 -0
- package/dist/index.d.ts +2 -0
- package/dist/math.d.ts +17 -0
- package/dist/parsers/actions.d.ts +1323 -0
- package/dist/parsers/address.d.ts +932 -0
- package/dist/parsers/auth.d.ts +1816 -0
- package/dist/parsers/base.d.ts +35 -0
- package/dist/parsers/currency.d.ts +236 -0
- package/dist/parsers/deposit.d.ts +63 -0
- package/dist/parsers/dex.d.ts +291 -0
- package/dist/parsers/index.d.ts +12 -0
- package/dist/parsers/otc.d.ts +46 -0
- package/dist/parsers/pool.d.ts +51 -0
- package/dist/parsers/withdraw.d.ts +1053 -0
- package/dist/parsers/withdrawalHistory.d.ts +98 -0
- package/dist/parsers/wrap.d.ts +109 -0
- package/dist/utils.d.ts +1 -0
- package/dist/wrap-constants.cjs.development.js +1236 -289
- package/dist/wrap-constants.cjs.development.js.map +1 -1
- package/dist/wrap-constants.cjs.production.min.js +1 -1
- package/dist/wrap-constants.cjs.production.min.js.map +1 -1
- package/dist/wrap-constants.esm.js +1216 -293
- package/dist/wrap-constants.esm.js.map +1 -1
- package/package.json +14 -8
- package/src/coins.ts +578 -150
- package/src/constants.ts +41 -14
- package/src/graph.ts +126 -0
- package/src/index.ts +3 -1
- package/src/math.ts +112 -0
- package/src/parsers/actions.ts +82 -0
- package/src/parsers/address.ts +27 -0
- package/src/parsers/auth.ts +22 -0
- package/src/parsers/base.ts +18 -0
- package/src/parsers/currency.ts +89 -0
- package/src/parsers/deposit.ts +30 -0
- package/src/parsers/dex.ts +156 -0
- package/src/parsers/index.ts +12 -0
- package/src/parsers/otc.ts +23 -0
- package/src/parsers/pool.ts +51 -0
- package/src/parsers/withdraw.ts +39 -0
- package/src/parsers/withdrawalHistory.ts +23 -0
- package/src/parsers/wrap.ts +41 -0
- package/src/utils.ts +12 -1
- package/dist/parsers.d.ts +0 -849
- package/dist/pools.d.ts +0 -31
- package/src/parsers.ts +0 -258
- package/src/pools.ts +0 -26
package/dist/coins.d.ts
CHANGED
|
@@ -5,22 +5,41 @@ export declare enum Chains {
|
|
|
5
5
|
EthereumMainnet = "Ethereum",
|
|
6
6
|
EthereumRopsten = "Ethereum (Ropsten)",
|
|
7
7
|
LitecoinMainnet = "Litecoin",
|
|
8
|
+
LitecoinTestnet = "Litecoin (Testnet)",
|
|
8
9
|
BitcoinCashMainnet = "Bitcoin Cash",
|
|
10
|
+
BitcoinCashTestnet = "Bitcoin Cash (Testnet)",
|
|
9
11
|
StellarMainnet = "Stellar",
|
|
12
|
+
StellarTestnet = "Stellar (Testnet)",
|
|
10
13
|
ProtonMainnet = "Proton",
|
|
11
14
|
ProtonTestnet = "Proton (Testnet)",
|
|
12
15
|
PolkadotMainnet = "Polkadot",
|
|
13
16
|
BinanceBEP2 = "Binance (BEP2)",
|
|
14
17
|
BinanceBEP20 = "Binance (BEP20)",
|
|
15
|
-
EosMainnet = "EOS"
|
|
18
|
+
EosMainnet = "EOS",
|
|
19
|
+
EosTestnet = "EOS (Jungle Testnet)",
|
|
20
|
+
HederaMainnet = "Hedera (Mainnet)",
|
|
21
|
+
HederaTestnet = "Hedera (Testnet)",
|
|
22
|
+
DogeMainnet = "Dogecoin",
|
|
23
|
+
CardanoMainnet = "Cardano",
|
|
24
|
+
AvalancheXChain = "Avalanche X-Chain",
|
|
25
|
+
AvalancheCChain = "Avalanche C-Chain",
|
|
26
|
+
PolygonMainnet = "Polygon",
|
|
27
|
+
TerraMainnet = "Terra",
|
|
28
|
+
RippleMainnet = "Ripple",
|
|
29
|
+
SolanaMainnet = "Solana"
|
|
16
30
|
}
|
|
17
31
|
export declare enum Networks {
|
|
18
32
|
Mainnet = "mainnet",
|
|
19
33
|
Testnet = "testnet",
|
|
20
34
|
Ropsten = "ropsten",
|
|
21
35
|
ERC20 = "erc20",
|
|
22
|
-
BEP20 = "bep20"
|
|
36
|
+
BEP20 = "bep20",
|
|
37
|
+
XLM = "xlm"
|
|
23
38
|
}
|
|
39
|
+
export declare const similarChains: {
|
|
40
|
+
Ethereum: Chains[];
|
|
41
|
+
"Binance (BEP20)": Chains[];
|
|
42
|
+
};
|
|
24
43
|
export interface Coin {
|
|
25
44
|
allowSwap: boolean;
|
|
26
45
|
allowBridge: boolean;
|
|
@@ -33,6 +52,7 @@ export interface Coin {
|
|
|
33
52
|
xtokenContract: string;
|
|
34
53
|
wallets: Wallet[];
|
|
35
54
|
image: string;
|
|
55
|
+
coingeckoId: string;
|
|
36
56
|
balance?: Asset;
|
|
37
57
|
}
|
|
38
58
|
export interface Wallet {
|
|
@@ -51,16 +71,31 @@ export declare const explorerLinkByChain: {
|
|
|
51
71
|
Ethereum: (txid: string) => string;
|
|
52
72
|
"Ethereum (Ropsten)": (txid: string) => string;
|
|
53
73
|
Litecoin: (txid: string) => string;
|
|
74
|
+
"Litecoin (Testnet)": (txid: string) => string;
|
|
54
75
|
"Bitcoin Cash": (txid: string) => string;
|
|
76
|
+
"Bitcoin Cash (Testnet)": (txid: string) => string;
|
|
55
77
|
Stellar: (txid: string) => string;
|
|
56
|
-
|
|
57
|
-
|
|
78
|
+
"Stellar (Testnet)": (txid: string) => string;
|
|
79
|
+
Proton: (txid: string, traces?: boolean | undefined) => string;
|
|
80
|
+
"Proton (Testnet)": (txid: string, traces?: boolean | undefined) => string;
|
|
58
81
|
Polkadot: (txid: string) => string;
|
|
59
|
-
EOS: (txid: string) => string;
|
|
60
82
|
"Binance (BEP2)": (txid: string) => string;
|
|
61
83
|
"Binance (BEP20)": (txid: string) => string;
|
|
84
|
+
EOS: (txid: string) => string;
|
|
85
|
+
"EOS (Jungle Testnet)": (txid: string) => string;
|
|
86
|
+
"Hedera (Mainnet)": (txid: string) => string;
|
|
87
|
+
"Hedera (Testnet)": (txid: string) => string;
|
|
88
|
+
Dogecoin: (txid: string) => string;
|
|
89
|
+
Cardano: (txid: string) => string;
|
|
90
|
+
"Avalanche X-Chain": (txid: string) => string;
|
|
91
|
+
"Avalanche C-Chain": (txid: string) => string;
|
|
92
|
+
Polygon: (txid: string) => string;
|
|
93
|
+
Terra: (txid: string) => string;
|
|
94
|
+
Ripple: (txid: string) => string;
|
|
95
|
+
Solana: (txid: string) => string;
|
|
62
96
|
};
|
|
63
|
-
|
|
97
|
+
export declare const protonExplorerTxUrl: (chain: string, txId: string, traces?: boolean | undefined) => string;
|
|
98
|
+
export declare const initializeCoins: (protonChain: string) => {
|
|
64
99
|
allCoins: Coin[];
|
|
65
100
|
swapCoins: Coin[];
|
|
66
101
|
bridgeCoins: Coin[];
|
|
@@ -68,6 +103,4 @@ interface InitializeReturn {
|
|
|
68
103
|
borrowCoins: Coin[];
|
|
69
104
|
loanCoins: Coin[];
|
|
70
105
|
allEnabledCoins: Coin[];
|
|
71
|
-
}
|
|
72
|
-
export declare const initializeCoins: (protonChain: string) => InitializeReturn;
|
|
73
|
-
export {};
|
|
106
|
+
};
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Coin, CoinWallet } from './coins';
|
|
2
2
|
export declare const WRAP_CONTRACT = "proton.wrap";
|
|
3
|
+
export declare const WRAP_AUTH_ACTION = "generateauth";
|
|
4
|
+
export declare const FEE_FACTOR = 10000;
|
|
3
5
|
export declare const initializeConstants: (chain: string) => {
|
|
4
6
|
SWAP_CONTRACT: string;
|
|
7
|
+
DEX_CONTRACT: string;
|
|
5
8
|
FEE_FACTOR: number;
|
|
6
9
|
GOOGLE_MAPS_KEY: string;
|
|
7
10
|
SWAP_URL: string;
|
|
@@ -9,6 +12,7 @@ export declare const initializeConstants: (chain: string) => {
|
|
|
9
12
|
WRAP_CONTRACT: string;
|
|
10
13
|
WRAP_ACTIONS: {
|
|
11
14
|
SAVE_ADDRESS: string;
|
|
15
|
+
DELETE_ADDRESS: string;
|
|
12
16
|
WRAP_START: string;
|
|
13
17
|
WRAP_FINISH: string;
|
|
14
18
|
WRAP_PROCESS: string;
|
|
@@ -31,16 +35,22 @@ export declare const initializeConstants: (chain: string) => {
|
|
|
31
35
|
FARM_CONTRACT: string;
|
|
32
36
|
WEBHOOK_PERMISSION: string;
|
|
33
37
|
PUBLIC_PERMISSION: string;
|
|
38
|
+
LIGHT_PERMISSION: string;
|
|
34
39
|
WRAP_AUTH_ACTION: string;
|
|
35
40
|
METAL_ENDPOINT: string;
|
|
36
41
|
METAL_PROTON_ENDPOINT: string;
|
|
42
|
+
METAL_DEX_ENDPOINT: string;
|
|
37
43
|
PROTON_ENDPOINTS: string[];
|
|
38
44
|
CHAIN_ID: string;
|
|
39
45
|
CHAIN: string;
|
|
40
46
|
SWAP_COINS: Coin[];
|
|
41
47
|
BRIDGE_COINS: Coin[];
|
|
42
48
|
ALL_ENABLED_COINS: Coin[];
|
|
49
|
+
LEND_COINS: Coin[];
|
|
50
|
+
BORROW_COINS: Coin[];
|
|
51
|
+
LOAN_COINS: Coin[];
|
|
43
52
|
ALL_COINS: Coin[];
|
|
53
|
+
findBridgeCoinWalletByXtokenAndChain(xtokenSymbol: string, chain: string): CoinWallet | undefined;
|
|
44
54
|
findBridgeCoinWallet(coin: string, wallet: string): CoinWallet | undefined;
|
|
45
55
|
findBridgeCoinNetwork(coin: string, network: string): CoinWallet | undefined;
|
|
46
56
|
};
|
package/dist/graph.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare class INode<T> {
|
|
2
|
+
key: string;
|
|
3
|
+
data: T;
|
|
4
|
+
constructor(key: string, data?: T);
|
|
5
|
+
}
|
|
6
|
+
export declare class ILink<T> {
|
|
7
|
+
from: INode<T>;
|
|
8
|
+
to: INode<T>;
|
|
9
|
+
data: T;
|
|
10
|
+
constructor(from: INode<T>, to: INode<T>, data?: T);
|
|
11
|
+
}
|
|
12
|
+
export declare class Graph<T> {
|
|
13
|
+
nodes: INode<T>[];
|
|
14
|
+
links: ILink<T>[];
|
|
15
|
+
lastPathFound: INode<T>[];
|
|
16
|
+
isEquals: (a: INode<T>, b: INode<T>) => boolean;
|
|
17
|
+
addNode(k: string, v?: T): void;
|
|
18
|
+
addNodes(...nodes: (string | [string, T?])[]): void;
|
|
19
|
+
findNode(k: string): INode<T> | undefined;
|
|
20
|
+
findNodes(...keys: string[]): (INode<T> | undefined)[];
|
|
21
|
+
requireFindNodes(...keys: string[]): INode<T>[];
|
|
22
|
+
addLink(nodeA: string, nodeB: string, data?: T): void;
|
|
23
|
+
addLinks(...links: [nodeA: string, nodeB: string, data?: T][]): void;
|
|
24
|
+
/**
|
|
25
|
+
* Get all nodes linked
|
|
26
|
+
* to from `node`.
|
|
27
|
+
*/
|
|
28
|
+
findLinkedNodes(node: INode<T>): INode<T>[];
|
|
29
|
+
findAllPaths(from: string, to: string): INode<T>[][];
|
|
30
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/math.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BigNumber as BN } from 'bignumber.js';
|
|
2
|
+
/**
|
|
3
|
+
* XPR<>XUSDT (XPR -> XUSDT)
|
|
4
|
+
*
|
|
5
|
+
* pool1 * pool2
|
|
6
|
+
* term = pool2 - --------------
|
|
7
|
+
* pool1 + swap
|
|
8
|
+
*
|
|
9
|
+
* result = term - (term * fee)
|
|
10
|
+
*/
|
|
11
|
+
export declare const compute_transfer: (pool1: BN.Instance, pool2: BN.Instance, swap: BN.Instance, exchange_fee: number, precision: number) => BN;
|
|
12
|
+
export declare const compute_transfer_curve: (reserve_in: number, reserve_out: number, amount_in: number, exchange_fee: number, precision: number, amplifier: number) => BN;
|
|
13
|
+
export declare const compute_liquidity: (amount_lt: BN.Instance, pool: BN.Instance, lt_supply: BN.Instance, precision: number) => number;
|
|
14
|
+
export declare const isInputInvalid: (data: string, value: string | number, pool: {
|
|
15
|
+
xtokenPrecision: number;
|
|
16
|
+
}) => boolean;
|
|
17
|
+
export declare const applyDiscountToFee: (fee: number, staked: number) => number;
|