@klappay/types 3.8.0 → 4.1.0
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/README.md +20 -2
- package/dist/chunk-WKIOAEJ3.mjs +137 -0
- package/dist/chunk-WKIOAEJ3.mjs.map +1 -0
- package/dist/{constants-DQGVNS9O.d.mts → constants-021Ybu31.d.mts} +11 -2
- package/dist/{constants-DQGVNS9O.d.ts → constants-021Ybu31.d.ts} +11 -2
- package/dist/constants.d.mts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +51 -20
- package/dist/constants.js.map +1 -1
- package/dist/constants.mjs +9 -3
- package/dist/index.d.mts +57 -8
- package/dist/index.d.ts +57 -8
- package/dist/index.js +342 -284
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +301 -268
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-KZ3646WX.mjs +0 -109
- package/dist/chunk-KZ3646WX.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -39,6 +39,9 @@ already have it if you use any of them directly.
|
|
|
39
39
|
`charge.created`. `TypedWebhookPayload`/`WebhookEventDataMap` give the
|
|
40
40
|
exact `data` shape per event, keyed by `event` (a discriminated union —
|
|
41
41
|
see the webhook example below).
|
|
42
|
+
- Deployment metadata and helpers (`TOKEN_DEPLOYMENTS`, `TokenDeployment`,
|
|
43
|
+
`getTokenDeployment`, `isPaymentDeploymentEnabled`) that resolve a
|
|
44
|
+
token contract and its decimals per network/environment.
|
|
42
45
|
- A handful of small constants (`TOKEN_ADDRESSES`, `NETWORK_EXPLORERS`,
|
|
43
46
|
`EVM_NETWORKS`, `OPERATIONAL_NETWORKS`, `CHAIN_IDS`,
|
|
44
47
|
`CHARGE_ACCEPTED_PAYMENTS_MAX`) that mirror values the API itself uses —
|
|
@@ -123,14 +126,15 @@ needed. See the live API reference for details.
|
|
|
123
126
|
|
|
124
127
|
## Zero-dependency constants
|
|
125
128
|
|
|
126
|
-
Every plain
|
|
129
|
+
Every plain constant and deployment resolver this package exports (`TOKEN_DEPLOYMENTS`,
|
|
130
|
+
`getTokenDeployment`, `isPaymentDeploymentEnabled`, `TOKEN_ADDRESSES`,
|
|
127
131
|
`ALT_TOKEN_ADDRESSES`, `CHAIN_IDS`, `NETWORK_LABELS`, `NETWORK_EXPLORERS`,
|
|
128
132
|
`EVM_NETWORKS`, `OPERATIONAL_NETWORKS`, `TOKEN_DECIMALS`,
|
|
129
133
|
`ALT_TOKEN_DECIMALS`) is also available from a second entry point that
|
|
130
134
|
carries zero `zod` in its bundle:
|
|
131
135
|
|
|
132
136
|
```ts
|
|
133
|
-
import { CHAIN_IDS,
|
|
137
|
+
import { CHAIN_IDS, getTokenDeployment } from '@klappay/types/constants'
|
|
134
138
|
```
|
|
135
139
|
|
|
136
140
|
Useful for a browser/wallet-side bundle that only needs these plain
|
|
@@ -139,6 +143,20 @@ with the main entry. Everything exported here is identical to (and stays
|
|
|
139
143
|
in sync with) the same name imported from `@klappay/types` — nothing is
|
|
140
144
|
exclusive to this subpath, it's just a smaller bundle of the same values.
|
|
141
145
|
|
|
146
|
+
Use `getTokenDeployment(token, network, environment)?.decimals` for token
|
|
147
|
+
amounts. The legacy `TOKEN_DECIMALS = 6` export is deprecated: the BNB
|
|
148
|
+
contracts in the catalog use 18 decimals, and both BNB payment pairs are
|
|
149
|
+
currently disabled. `TOKEN_ADDRESSES` is an address-only compatibility
|
|
150
|
+
view, not a payment-availability matrix. Check `GET /v1/networks` before
|
|
151
|
+
offering a payment method.
|
|
152
|
+
|
|
153
|
+
Charge responses provide optional `amountExact`, `amountReceivedExact`,
|
|
154
|
+
and `paymentUnavailable`; swap quotes provide optional exact amount and
|
|
155
|
+
fee strings. Prefer the decimal strings for calculations. The original
|
|
156
|
+
numeric fields remain for compatibility and can lose precision. See the
|
|
157
|
+
[charge documentation](https://api.klappay.com/types/charges) for units and
|
|
158
|
+
availability handling.
|
|
159
|
+
|
|
142
160
|
## Versioning
|
|
143
161
|
|
|
144
162
|
This package follows the API's own versioning. A breaking change to a
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// src/networks.constants.ts
|
|
2
|
+
var NETWORK_LABELS = {
|
|
3
|
+
base: "Base",
|
|
4
|
+
optimism: "Optimism",
|
|
5
|
+
polygon: "Polygon",
|
|
6
|
+
ethereum: "Ethereum",
|
|
7
|
+
arbitrum: "Arbitrum",
|
|
8
|
+
avalanche: "Avalanche",
|
|
9
|
+
bnb: "BNB Chain"
|
|
10
|
+
};
|
|
11
|
+
var NETWORK_EXPLORERS = {
|
|
12
|
+
base: "https://basescan.org",
|
|
13
|
+
optimism: "https://optimistic.etherscan.io",
|
|
14
|
+
polygon: "https://polygonscan.com",
|
|
15
|
+
ethereum: "https://etherscan.io",
|
|
16
|
+
arbitrum: "https://arbiscan.io",
|
|
17
|
+
avalanche: "https://snowtrace.io",
|
|
18
|
+
bnb: "https://bscscan.com"
|
|
19
|
+
};
|
|
20
|
+
var EVM_NETWORKS = [
|
|
21
|
+
"base",
|
|
22
|
+
"optimism",
|
|
23
|
+
"polygon",
|
|
24
|
+
"ethereum",
|
|
25
|
+
"arbitrum",
|
|
26
|
+
"avalanche",
|
|
27
|
+
"bnb"
|
|
28
|
+
];
|
|
29
|
+
var OPERATIONAL_NETWORKS = [
|
|
30
|
+
"base",
|
|
31
|
+
"arbitrum",
|
|
32
|
+
"optimism",
|
|
33
|
+
"polygon",
|
|
34
|
+
"ethereum",
|
|
35
|
+
"avalanche",
|
|
36
|
+
"bnb"
|
|
37
|
+
];
|
|
38
|
+
var CHAIN_IDS = {
|
|
39
|
+
base: { live: 8453, test: 84532 },
|
|
40
|
+
optimism: { live: 10, test: 11155420 },
|
|
41
|
+
ethereum: { live: 1, test: 11155111 },
|
|
42
|
+
polygon: { live: 137 },
|
|
43
|
+
arbitrum: { live: 42161 },
|
|
44
|
+
avalanche: { live: 43114 },
|
|
45
|
+
bnb: { live: 56 }
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// src/tokens.constants.ts
|
|
49
|
+
var TOKEN_DECIMALS = 6;
|
|
50
|
+
var TOKEN_DEPLOYMENTS = {
|
|
51
|
+
USDC: {
|
|
52
|
+
base: {
|
|
53
|
+
live: { address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", decimals: 6 },
|
|
54
|
+
test: { address: "0x036CbD53842c5426634e7929541eC2318f3dCF7e", decimals: 6 }
|
|
55
|
+
},
|
|
56
|
+
optimism: {
|
|
57
|
+
live: { address: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85", decimals: 6 },
|
|
58
|
+
test: { address: "0x5fd84259d66Cd46123540766Be93DFE6D43130D7", decimals: 6 }
|
|
59
|
+
},
|
|
60
|
+
polygon: { live: { address: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", decimals: 6 } },
|
|
61
|
+
ethereum: {
|
|
62
|
+
live: { address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", decimals: 6 },
|
|
63
|
+
test: { address: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238", decimals: 6 }
|
|
64
|
+
},
|
|
65
|
+
arbitrum: { live: { address: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", decimals: 6 } },
|
|
66
|
+
avalanche: { live: { address: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", decimals: 6 } },
|
|
67
|
+
bnb: { live: { address: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", decimals: 18 } }
|
|
68
|
+
},
|
|
69
|
+
USDT: {
|
|
70
|
+
base: { live: { address: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2", decimals: 6 } },
|
|
71
|
+
optimism: { live: { address: "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58", decimals: 6 } },
|
|
72
|
+
polygon: { live: { address: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", decimals: 6 } },
|
|
73
|
+
ethereum: { live: { address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", decimals: 6 } },
|
|
74
|
+
arbitrum: { live: { address: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", decimals: 6 } },
|
|
75
|
+
avalanche: { live: { address: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", decimals: 6 } },
|
|
76
|
+
bnb: { live: { address: "0x55d398326f99059fF775485246999027B3197955", decimals: 18 } }
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
function getTokenDeployment(token, network, environment) {
|
|
80
|
+
return TOKEN_DEPLOYMENTS[token][network]?.[environment];
|
|
81
|
+
}
|
|
82
|
+
function isPaymentDeploymentEnabled(token, network, environment) {
|
|
83
|
+
if (network === "bnb" && environment === "live") return false;
|
|
84
|
+
return getTokenDeployment(token, network, environment) !== void 0;
|
|
85
|
+
}
|
|
86
|
+
function deriveAddresses(deployments) {
|
|
87
|
+
const addresses = {};
|
|
88
|
+
for (const network of EVM_NETWORKS) {
|
|
89
|
+
const byEnvironment = deployments[network];
|
|
90
|
+
if (!byEnvironment) continue;
|
|
91
|
+
const networkAddresses = {};
|
|
92
|
+
for (const environment of ["live", "test"]) {
|
|
93
|
+
const deployment = byEnvironment[environment];
|
|
94
|
+
if (deployment) networkAddresses[environment] = deployment.address;
|
|
95
|
+
}
|
|
96
|
+
addresses[network] = networkAddresses;
|
|
97
|
+
}
|
|
98
|
+
return addresses;
|
|
99
|
+
}
|
|
100
|
+
var TOKEN_ADDRESSES = {
|
|
101
|
+
USDC: deriveAddresses(TOKEN_DEPLOYMENTS.USDC),
|
|
102
|
+
USDT: deriveAddresses(TOKEN_DEPLOYMENTS.USDT)
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// src/alt-tokens.constants.ts
|
|
106
|
+
var ALT_TOKEN_DECIMALS = {
|
|
107
|
+
ETH: 18,
|
|
108
|
+
BNB: 18,
|
|
109
|
+
MATIC: 18,
|
|
110
|
+
AVAX: 18,
|
|
111
|
+
BTC: 8
|
|
112
|
+
};
|
|
113
|
+
var ALT_TOKEN_ADDRESSES = {
|
|
114
|
+
base: { ETH: "native", BTC: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf" },
|
|
115
|
+
optimism: { ETH: "native", BTC: "0x68f180fcCe6836688e9084f035309E29Bf0A2095" },
|
|
116
|
+
ethereum: { ETH: "native", BTC: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" },
|
|
117
|
+
arbitrum: { ETH: "native", BTC: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f" },
|
|
118
|
+
polygon: { MATIC: "native", BTC: "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6" },
|
|
119
|
+
avalanche: { AVAX: "native" },
|
|
120
|
+
bnb: { BNB: "native" }
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export {
|
|
124
|
+
NETWORK_LABELS,
|
|
125
|
+
NETWORK_EXPLORERS,
|
|
126
|
+
EVM_NETWORKS,
|
|
127
|
+
OPERATIONAL_NETWORKS,
|
|
128
|
+
CHAIN_IDS,
|
|
129
|
+
TOKEN_DECIMALS,
|
|
130
|
+
TOKEN_DEPLOYMENTS,
|
|
131
|
+
getTokenDeployment,
|
|
132
|
+
isPaymentDeploymentEnabled,
|
|
133
|
+
TOKEN_ADDRESSES,
|
|
134
|
+
ALT_TOKEN_DECIMALS,
|
|
135
|
+
ALT_TOKEN_ADDRESSES
|
|
136
|
+
};
|
|
137
|
+
//# sourceMappingURL=chunk-WKIOAEJ3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/networks.constants.ts","../src/tokens.constants.ts","../src/alt-tokens.constants.ts"],"sourcesContent":["import type { Environment } from './environment'\nimport type { Network } from './networks'\n\nexport const NETWORK_LABELS: Record<Network, string> = {\n base: 'Base',\n optimism: 'Optimism',\n polygon: 'Polygon',\n ethereum: 'Ethereum',\n arbitrum: 'Arbitrum',\n avalanche: 'Avalanche',\n bnb: 'BNB Chain',\n}\n\nexport const NETWORK_EXPLORERS: Record<Network, string> = {\n base: 'https://basescan.org',\n optimism: 'https://optimistic.etherscan.io',\n polygon: 'https://polygonscan.com',\n ethereum: 'https://etherscan.io',\n arbitrum: 'https://arbiscan.io',\n avalanche: 'https://snowtrace.io',\n bnb: 'https://bscscan.com',\n}\n\nexport const EVM_NETWORKS = [\n 'base',\n 'optimism',\n 'polygon',\n 'ethereum',\n 'arbitrum',\n 'avalanche',\n 'bnb',\n] as const\nexport type EvmNetwork = (typeof EVM_NETWORKS)[number]\n\nexport const OPERATIONAL_NETWORKS = [\n 'base',\n 'arbitrum',\n 'optimism',\n 'polygon',\n 'ethereum',\n 'avalanche',\n 'bnb',\n] as const\nexport type OperationalNetwork = (typeof OPERATIONAL_NETWORKS)[number]\n\nexport const CHAIN_IDS: Record<EvmNetwork, Partial<Record<Environment, number>>> = {\n base: { live: 8453, test: 84532 },\n optimism: { live: 10, test: 11155420 },\n ethereum: { live: 1, test: 11155111 },\n polygon: { live: 137 },\n arbitrum: { live: 42161 },\n avalanche: { live: 43114 },\n bnb: { live: 56 },\n}\n","import type { Environment } from './environment'\nimport type { Network } from './networks'\nimport { EVM_NETWORKS } from './networks.constants'\nimport type { Token } from './tokens'\n\nexport const TOKEN_DECIMALS = 6\n\nexport type TokenDeployment = { address: `0x${string}`; decimals: number }\n\ntype DeploymentsByNetwork = Partial<Record<Network, Partial<Record<Environment, TokenDeployment>>>>\ntype AddressesByNetwork = Partial<Record<Network, Partial<Record<Environment, `0x${string}`>>>>\n\nexport const TOKEN_DEPLOYMENTS: Record<Token, DeploymentsByNetwork> = {\n USDC: {\n base: {\n live: { address: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', decimals: 6 },\n test: { address: '0x036CbD53842c5426634e7929541eC2318f3dCF7e', decimals: 6 },\n },\n optimism: {\n live: { address: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85', decimals: 6 },\n test: { address: '0x5fd84259d66Cd46123540766Be93DFE6D43130D7', decimals: 6 },\n },\n polygon: { live: { address: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359', decimals: 6 } },\n ethereum: {\n live: { address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', decimals: 6 },\n test: { address: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238', decimals: 6 },\n },\n arbitrum: { live: { address: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', decimals: 6 } },\n avalanche: { live: { address: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E', decimals: 6 } },\n bnb: { live: { address: '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d', decimals: 18 } },\n },\n USDT: {\n base: { live: { address: '0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2', decimals: 6 } },\n optimism: { live: { address: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58', decimals: 6 } },\n polygon: { live: { address: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', decimals: 6 } },\n ethereum: { live: { address: '0xdAC17F958D2ee523a2206206994597C13D831ec7', decimals: 6 } },\n arbitrum: { live: { address: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9', decimals: 6 } },\n avalanche: { live: { address: '0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7', decimals: 6 } },\n bnb: { live: { address: '0x55d398326f99059fF775485246999027B3197955', decimals: 18 } },\n },\n}\n\nexport function getTokenDeployment(\n token: Token,\n network: Network,\n environment: Environment,\n): TokenDeployment | undefined {\n return TOKEN_DEPLOYMENTS[token][network]?.[environment]\n}\n\nexport function isPaymentDeploymentEnabled(\n token: Token,\n network: Network,\n environment: Environment,\n): boolean {\n if (network === 'bnb' && environment === 'live') return false\n return getTokenDeployment(token, network, environment) !== undefined\n}\n\nfunction deriveAddresses(deployments: DeploymentsByNetwork): AddressesByNetwork {\n const addresses: AddressesByNetwork = {}\n for (const network of EVM_NETWORKS) {\n const byEnvironment = deployments[network]\n if (!byEnvironment) continue\n const networkAddresses: Partial<Record<Environment, `0x${string}`>> = {}\n for (const environment of ['live', 'test'] as const) {\n const deployment = byEnvironment[environment]\n if (deployment) networkAddresses[environment] = deployment.address\n }\n addresses[network] = networkAddresses\n }\n return addresses\n}\n\nexport const TOKEN_ADDRESSES: Record<Token, AddressesByNetwork> = {\n USDC: deriveAddresses(TOKEN_DEPLOYMENTS.USDC),\n USDT: deriveAddresses(TOKEN_DEPLOYMENTS.USDT),\n}\n","import type { AltToken } from './alt-tokens'\nimport type { Network } from './networks'\n\nexport const ALT_TOKEN_DECIMALS: Record<AltToken, number> = {\n ETH: 18,\n BNB: 18,\n MATIC: 18,\n AVAX: 18,\n BTC: 8,\n}\n\nexport const ALT_TOKEN_ADDRESSES: Record<\n Network,\n Partial<Record<AltToken, 'native' | `0x${string}`>>\n> = {\n base: { ETH: 'native', BTC: '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf' },\n optimism: { ETH: 'native', BTC: '0x68f180fcCe6836688e9084f035309E29Bf0A2095' },\n ethereum: { ETH: 'native', BTC: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599' },\n arbitrum: { ETH: 'native', BTC: '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f' },\n polygon: { MATIC: 'native', BTC: '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6' },\n avalanche: { AVAX: 'native' },\n bnb: { BNB: 'native' },\n}\n"],"mappings":";AAGO,IAAM,iBAA0C;AAAA,EACrD,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,EACT,UAAU;AAAA,EACV,UAAU;AAAA,EACV,WAAW;AAAA,EACX,KAAK;AACP;AAEO,IAAM,oBAA6C;AAAA,EACxD,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,EACT,UAAU;AAAA,EACV,UAAU;AAAA,EACV,WAAW;AAAA,EACX,KAAK;AACP;AAEO,IAAM,eAAe;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,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M;AAAA,EACN,KAAK;AACP;AAEO,IAAM,sBAGT;AAAA,EACF,MAAM,EAAE,KAAK,UAAU,KAAK,6CAA6C;AAAA,EACzE,UAAU,EAAE,KAAK,UAAU,KAAK,6CAA6C;AAAA,EAC7E,UAAU,EAAE,KAAK,UAAU,KAAK,6CAA6C;AAAA,EAC7E,UAAU,EAAE,KAAK,UAAU,KAAK,6CAA6C;AAAA,EAC7E,SAAS,EAAE,OAAO,UAAU,KAAK,6CAA6C;AAAA,EAC9E,WAAW,EAAE,MAAM,SAAS;AAAA,EAC5B,KAAK,EAAE,KAAK,SAAS;AACvB;","names":[]}
|
|
@@ -18,7 +18,16 @@ declare const TokenSchema: z.ZodEnum<["USDC", "USDT"]>;
|
|
|
18
18
|
type Token = z.infer<typeof TokenSchema>;
|
|
19
19
|
|
|
20
20
|
declare const TOKEN_DECIMALS = 6;
|
|
21
|
-
|
|
21
|
+
type TokenDeployment = {
|
|
22
|
+
address: `0x${string}`;
|
|
23
|
+
decimals: number;
|
|
24
|
+
};
|
|
25
|
+
type DeploymentsByNetwork = Partial<Record<Network, Partial<Record<Environment, TokenDeployment>>>>;
|
|
26
|
+
type AddressesByNetwork = Partial<Record<Network, Partial<Record<Environment, `0x${string}`>>>>;
|
|
27
|
+
declare const TOKEN_DEPLOYMENTS: Record<Token, DeploymentsByNetwork>;
|
|
28
|
+
declare function getTokenDeployment(token: Token, network: Network, environment: Environment): TokenDeployment | undefined;
|
|
29
|
+
declare function isPaymentDeploymentEnabled(token: Token, network: Network, environment: Environment): boolean;
|
|
30
|
+
declare const TOKEN_ADDRESSES: Record<Token, AddressesByNetwork>;
|
|
22
31
|
|
|
23
32
|
declare const AltTokenSchema: z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>;
|
|
24
33
|
type AltToken = z.infer<typeof AltTokenSchema>;
|
|
@@ -38,4 +47,4 @@ declare function listSwapAlternatives(networks: readonly Network[]): SwapAlterna
|
|
|
38
47
|
declare const ALT_TOKEN_DECIMALS: Record<AltToken, number>;
|
|
39
48
|
declare const ALT_TOKEN_ADDRESSES: Record<Network, Partial<Record<AltToken, 'native' | `0x${string}`>>>;
|
|
40
49
|
|
|
41
|
-
export { ALT_TOKEN_ADDRESSES as A, CHAIN_IDS as C, EVM_NETWORKS as E, NETWORK_EXPLORERS as N, OPERATIONAL_NETWORKS as O, type SwapAlternative as S, TOKEN_ADDRESSES as T, ALT_TOKEN_DECIMALS as a, type AltToken as b, AltTokenSchema as c, type Environment as d, EnvironmentSchema as e, type EvmNetwork as f, NETWORK_LABELS as g, type Network as h, NetworkSchema as i, type OperationalNetwork as j, SwapAlternativeSchema as k, TOKEN_DECIMALS as l, type Token as
|
|
50
|
+
export { ALT_TOKEN_ADDRESSES as A, CHAIN_IDS as C, EVM_NETWORKS as E, NETWORK_EXPLORERS as N, OPERATIONAL_NETWORKS as O, type SwapAlternative as S, TOKEN_ADDRESSES as T, ALT_TOKEN_DECIMALS as a, type AltToken as b, AltTokenSchema as c, type Environment as d, EnvironmentSchema as e, type EvmNetwork as f, NETWORK_LABELS as g, type Network as h, NetworkSchema as i, type OperationalNetwork as j, SwapAlternativeSchema as k, TOKEN_DECIMALS as l, TOKEN_DEPLOYMENTS as m, type Token as n, type TokenDeployment as o, TokenSchema as p, getTokenDeployment as q, isPaymentDeploymentEnabled as r, listSwapAlternatives as s };
|
|
@@ -18,7 +18,16 @@ declare const TokenSchema: z.ZodEnum<["USDC", "USDT"]>;
|
|
|
18
18
|
type Token = z.infer<typeof TokenSchema>;
|
|
19
19
|
|
|
20
20
|
declare const TOKEN_DECIMALS = 6;
|
|
21
|
-
|
|
21
|
+
type TokenDeployment = {
|
|
22
|
+
address: `0x${string}`;
|
|
23
|
+
decimals: number;
|
|
24
|
+
};
|
|
25
|
+
type DeploymentsByNetwork = Partial<Record<Network, Partial<Record<Environment, TokenDeployment>>>>;
|
|
26
|
+
type AddressesByNetwork = Partial<Record<Network, Partial<Record<Environment, `0x${string}`>>>>;
|
|
27
|
+
declare const TOKEN_DEPLOYMENTS: Record<Token, DeploymentsByNetwork>;
|
|
28
|
+
declare function getTokenDeployment(token: Token, network: Network, environment: Environment): TokenDeployment | undefined;
|
|
29
|
+
declare function isPaymentDeploymentEnabled(token: Token, network: Network, environment: Environment): boolean;
|
|
30
|
+
declare const TOKEN_ADDRESSES: Record<Token, AddressesByNetwork>;
|
|
22
31
|
|
|
23
32
|
declare const AltTokenSchema: z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>;
|
|
24
33
|
type AltToken = z.infer<typeof AltTokenSchema>;
|
|
@@ -38,4 +47,4 @@ declare function listSwapAlternatives(networks: readonly Network[]): SwapAlterna
|
|
|
38
47
|
declare const ALT_TOKEN_DECIMALS: Record<AltToken, number>;
|
|
39
48
|
declare const ALT_TOKEN_ADDRESSES: Record<Network, Partial<Record<AltToken, 'native' | `0x${string}`>>>;
|
|
40
49
|
|
|
41
|
-
export { ALT_TOKEN_ADDRESSES as A, CHAIN_IDS as C, EVM_NETWORKS as E, NETWORK_EXPLORERS as N, OPERATIONAL_NETWORKS as O, type SwapAlternative as S, TOKEN_ADDRESSES as T, ALT_TOKEN_DECIMALS as a, type AltToken as b, AltTokenSchema as c, type Environment as d, EnvironmentSchema as e, type EvmNetwork as f, NETWORK_LABELS as g, type Network as h, NetworkSchema as i, type OperationalNetwork as j, SwapAlternativeSchema as k, TOKEN_DECIMALS as l, type Token as
|
|
50
|
+
export { ALT_TOKEN_ADDRESSES as A, CHAIN_IDS as C, EVM_NETWORKS as E, NETWORK_EXPLORERS as N, OPERATIONAL_NETWORKS as O, type SwapAlternative as S, TOKEN_ADDRESSES as T, ALT_TOKEN_DECIMALS as a, type AltToken as b, AltTokenSchema as c, type Environment as d, EnvironmentSchema as e, type EvmNetwork as f, NETWORK_LABELS as g, type Network as h, NetworkSchema as i, type OperationalNetwork as j, SwapAlternativeSchema as k, TOKEN_DECIMALS as l, TOKEN_DEPLOYMENTS as m, type Token as n, type TokenDeployment as o, TokenSchema as p, getTokenDeployment as q, isPaymentDeploymentEnabled as r, listSwapAlternatives as s };
|
package/dist/constants.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as ALT_TOKEN_ADDRESSES, a as ALT_TOKEN_DECIMALS, C as CHAIN_IDS, E as EVM_NETWORKS, f as EvmNetwork, N as NETWORK_EXPLORERS, g as NETWORK_LABELS, O as OPERATIONAL_NETWORKS, j as OperationalNetwork, T as TOKEN_ADDRESSES, l as TOKEN_DECIMALS } from './constants-
|
|
1
|
+
export { A as ALT_TOKEN_ADDRESSES, a as ALT_TOKEN_DECIMALS, C as CHAIN_IDS, E as EVM_NETWORKS, f as EvmNetwork, N as NETWORK_EXPLORERS, g as NETWORK_LABELS, O as OPERATIONAL_NETWORKS, j as OperationalNetwork, T as TOKEN_ADDRESSES, l as TOKEN_DECIMALS, m as TOKEN_DEPLOYMENTS, o as TokenDeployment, q as getTokenDeployment, r as isPaymentDeploymentEnabled } from './constants-021Ybu31.mjs';
|
|
2
2
|
import 'zod';
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as ALT_TOKEN_ADDRESSES, a as ALT_TOKEN_DECIMALS, C as CHAIN_IDS, E as EVM_NETWORKS, f as EvmNetwork, N as NETWORK_EXPLORERS, g as NETWORK_LABELS, O as OPERATIONAL_NETWORKS, j as OperationalNetwork, T as TOKEN_ADDRESSES, l as TOKEN_DECIMALS } from './constants-
|
|
1
|
+
export { A as ALT_TOKEN_ADDRESSES, a as ALT_TOKEN_DECIMALS, C as CHAIN_IDS, E as EVM_NETWORKS, f as EvmNetwork, N as NETWORK_EXPLORERS, g as NETWORK_LABELS, O as OPERATIONAL_NETWORKS, j as OperationalNetwork, T as TOKEN_ADDRESSES, l as TOKEN_DECIMALS, m as TOKEN_DEPLOYMENTS, o as TokenDeployment, q as getTokenDeployment, r as isPaymentDeploymentEnabled } from './constants-021Ybu31.js';
|
|
2
2
|
import 'zod';
|
package/dist/constants.js
CHANGED
|
@@ -28,7 +28,10 @@ __export(constants_exports, {
|
|
|
28
28
|
NETWORK_LABELS: () => NETWORK_LABELS,
|
|
29
29
|
OPERATIONAL_NETWORKS: () => OPERATIONAL_NETWORKS,
|
|
30
30
|
TOKEN_ADDRESSES: () => TOKEN_ADDRESSES,
|
|
31
|
-
TOKEN_DECIMALS: () => TOKEN_DECIMALS
|
|
31
|
+
TOKEN_DECIMALS: () => TOKEN_DECIMALS,
|
|
32
|
+
TOKEN_DEPLOYMENTS: () => TOKEN_DEPLOYMENTS,
|
|
33
|
+
getTokenDeployment: () => getTokenDeployment,
|
|
34
|
+
isPaymentDeploymentEnabled: () => isPaymentDeploymentEnabled
|
|
32
35
|
});
|
|
33
36
|
module.exports = __toCommonJS(constants_exports);
|
|
34
37
|
|
|
@@ -81,34 +84,59 @@ var CHAIN_IDS = {
|
|
|
81
84
|
|
|
82
85
|
// src/tokens.constants.ts
|
|
83
86
|
var TOKEN_DECIMALS = 6;
|
|
84
|
-
var
|
|
87
|
+
var TOKEN_DEPLOYMENTS = {
|
|
85
88
|
USDC: {
|
|
86
89
|
base: {
|
|
87
|
-
live: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
88
|
-
test: "0x036CbD53842c5426634e7929541eC2318f3dCF7e"
|
|
90
|
+
live: { address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", decimals: 6 },
|
|
91
|
+
test: { address: "0x036CbD53842c5426634e7929541eC2318f3dCF7e", decimals: 6 }
|
|
89
92
|
},
|
|
90
93
|
optimism: {
|
|
91
|
-
live: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
|
|
92
|
-
test: "0x5fd84259d66Cd46123540766Be93DFE6D43130D7"
|
|
94
|
+
live: { address: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85", decimals: 6 },
|
|
95
|
+
test: { address: "0x5fd84259d66Cd46123540766Be93DFE6D43130D7", decimals: 6 }
|
|
93
96
|
},
|
|
94
|
-
polygon: { live: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359" },
|
|
97
|
+
polygon: { live: { address: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", decimals: 6 } },
|
|
95
98
|
ethereum: {
|
|
96
|
-
live: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
97
|
-
test: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"
|
|
99
|
+
live: { address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", decimals: 6 },
|
|
100
|
+
test: { address: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238", decimals: 6 }
|
|
98
101
|
},
|
|
99
|
-
arbitrum: { live: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831" },
|
|
100
|
-
avalanche: { live: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E" },
|
|
101
|
-
bnb: { live: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d" }
|
|
102
|
+
arbitrum: { live: { address: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", decimals: 6 } },
|
|
103
|
+
avalanche: { live: { address: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", decimals: 6 } },
|
|
104
|
+
bnb: { live: { address: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", decimals: 18 } }
|
|
102
105
|
},
|
|
103
106
|
USDT: {
|
|
104
|
-
base: { live: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2" },
|
|
105
|
-
optimism: { live: "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58" },
|
|
106
|
-
polygon: { live: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F" },
|
|
107
|
-
ethereum: { live: "0xdAC17F958D2ee523a2206206994597C13D831ec7" },
|
|
108
|
-
arbitrum: { live: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9" },
|
|
109
|
-
avalanche: { live: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7" },
|
|
110
|
-
bnb: { live: "0x55d398326f99059fF775485246999027B3197955" }
|
|
107
|
+
base: { live: { address: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2", decimals: 6 } },
|
|
108
|
+
optimism: { live: { address: "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58", decimals: 6 } },
|
|
109
|
+
polygon: { live: { address: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", decimals: 6 } },
|
|
110
|
+
ethereum: { live: { address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", decimals: 6 } },
|
|
111
|
+
arbitrum: { live: { address: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", decimals: 6 } },
|
|
112
|
+
avalanche: { live: { address: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", decimals: 6 } },
|
|
113
|
+
bnb: { live: { address: "0x55d398326f99059fF775485246999027B3197955", decimals: 18 } }
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
function getTokenDeployment(token, network, environment) {
|
|
117
|
+
return TOKEN_DEPLOYMENTS[token][network]?.[environment];
|
|
118
|
+
}
|
|
119
|
+
function isPaymentDeploymentEnabled(token, network, environment) {
|
|
120
|
+
if (network === "bnb" && environment === "live") return false;
|
|
121
|
+
return getTokenDeployment(token, network, environment) !== void 0;
|
|
122
|
+
}
|
|
123
|
+
function deriveAddresses(deployments) {
|
|
124
|
+
const addresses = {};
|
|
125
|
+
for (const network of EVM_NETWORKS) {
|
|
126
|
+
const byEnvironment = deployments[network];
|
|
127
|
+
if (!byEnvironment) continue;
|
|
128
|
+
const networkAddresses = {};
|
|
129
|
+
for (const environment of ["live", "test"]) {
|
|
130
|
+
const deployment = byEnvironment[environment];
|
|
131
|
+
if (deployment) networkAddresses[environment] = deployment.address;
|
|
132
|
+
}
|
|
133
|
+
addresses[network] = networkAddresses;
|
|
111
134
|
}
|
|
135
|
+
return addresses;
|
|
136
|
+
}
|
|
137
|
+
var TOKEN_ADDRESSES = {
|
|
138
|
+
USDC: deriveAddresses(TOKEN_DEPLOYMENTS.USDC),
|
|
139
|
+
USDT: deriveAddresses(TOKEN_DEPLOYMENTS.USDT)
|
|
112
140
|
};
|
|
113
141
|
|
|
114
142
|
// src/alt-tokens.constants.ts
|
|
@@ -138,6 +166,9 @@ var ALT_TOKEN_ADDRESSES = {
|
|
|
138
166
|
NETWORK_LABELS,
|
|
139
167
|
OPERATIONAL_NETWORKS,
|
|
140
168
|
TOKEN_ADDRESSES,
|
|
141
|
-
TOKEN_DECIMALS
|
|
169
|
+
TOKEN_DECIMALS,
|
|
170
|
+
TOKEN_DEPLOYMENTS,
|
|
171
|
+
getTokenDeployment,
|
|
172
|
+
isPaymentDeploymentEnabled
|
|
142
173
|
});
|
|
143
174
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants.ts","../src/networks.constants.ts","../src/tokens.constants.ts","../src/alt-tokens.constants.ts"],"sourcesContent":["export * from './networks.constants'\nexport * from './tokens.constants'\nexport * from './alt-tokens.constants'\n","import type { Environment } from './environment'\nimport type { Network } from './networks'\n\nexport const NETWORK_LABELS: Record<Network, string> = {\n base: 'Base',\n optimism: 'Optimism',\n polygon: 'Polygon',\n ethereum: 'Ethereum',\n arbitrum: 'Arbitrum',\n avalanche: 'Avalanche',\n bnb: 'BNB Chain',\n}\n\nexport const NETWORK_EXPLORERS: Record<Network, string> = {\n base: 'https://basescan.org',\n optimism: 'https://optimistic.etherscan.io',\n polygon: 'https://polygonscan.com',\n ethereum: 'https://etherscan.io',\n arbitrum: 'https://arbiscan.io',\n avalanche: 'https://snowtrace.io',\n bnb: 'https://bscscan.com',\n}\n\nexport const EVM_NETWORKS = [\n 'base',\n 'optimism',\n 'polygon',\n 'ethereum',\n 'arbitrum',\n 'avalanche',\n 'bnb',\n] as const\nexport type EvmNetwork = (typeof EVM_NETWORKS)[number]\n\nexport const OPERATIONAL_NETWORKS = [\n 'base',\n 'arbitrum',\n 'optimism',\n 'polygon',\n 'ethereum',\n 'avalanche',\n 'bnb',\n] as const\nexport type OperationalNetwork = (typeof OPERATIONAL_NETWORKS)[number]\n\nexport const CHAIN_IDS: Record<EvmNetwork, Partial<Record<Environment, number>>> = {\n base: { live: 8453, test: 84532 },\n optimism: { live: 10, test: 11155420 },\n ethereum: { live: 1, test: 11155111 },\n polygon: { live: 137 },\n arbitrum: { live: 42161 },\n avalanche: { live: 43114 },\n bnb: { live: 56 },\n}\n","import type { Environment } from './environment'\nimport type { Network } from './networks'\nimport type { Token } from './tokens'\n\nexport const TOKEN_DECIMALS = 6\n\nexport
|
|
1
|
+
{"version":3,"sources":["../src/constants.ts","../src/networks.constants.ts","../src/tokens.constants.ts","../src/alt-tokens.constants.ts"],"sourcesContent":["export * from './networks.constants'\nexport * from './tokens.constants'\nexport * from './alt-tokens.constants'\n","import type { Environment } from './environment'\nimport type { Network } from './networks'\n\nexport const NETWORK_LABELS: Record<Network, string> = {\n base: 'Base',\n optimism: 'Optimism',\n polygon: 'Polygon',\n ethereum: 'Ethereum',\n arbitrum: 'Arbitrum',\n avalanche: 'Avalanche',\n bnb: 'BNB Chain',\n}\n\nexport const NETWORK_EXPLORERS: Record<Network, string> = {\n base: 'https://basescan.org',\n optimism: 'https://optimistic.etherscan.io',\n polygon: 'https://polygonscan.com',\n ethereum: 'https://etherscan.io',\n arbitrum: 'https://arbiscan.io',\n avalanche: 'https://snowtrace.io',\n bnb: 'https://bscscan.com',\n}\n\nexport const EVM_NETWORKS = [\n 'base',\n 'optimism',\n 'polygon',\n 'ethereum',\n 'arbitrum',\n 'avalanche',\n 'bnb',\n] as const\nexport type EvmNetwork = (typeof EVM_NETWORKS)[number]\n\nexport const OPERATIONAL_NETWORKS = [\n 'base',\n 'arbitrum',\n 'optimism',\n 'polygon',\n 'ethereum',\n 'avalanche',\n 'bnb',\n] as const\nexport type OperationalNetwork = (typeof OPERATIONAL_NETWORKS)[number]\n\nexport const CHAIN_IDS: Record<EvmNetwork, Partial<Record<Environment, number>>> = {\n base: { live: 8453, test: 84532 },\n optimism: { live: 10, test: 11155420 },\n ethereum: { live: 1, test: 11155111 },\n polygon: { live: 137 },\n arbitrum: { live: 42161 },\n avalanche: { live: 43114 },\n bnb: { live: 56 },\n}\n","import type { Environment } from './environment'\nimport type { Network } from './networks'\nimport { EVM_NETWORKS } from './networks.constants'\nimport type { Token } from './tokens'\n\nexport const TOKEN_DECIMALS = 6\n\nexport type TokenDeployment = { address: `0x${string}`; decimals: number }\n\ntype DeploymentsByNetwork = Partial<Record<Network, Partial<Record<Environment, TokenDeployment>>>>\ntype AddressesByNetwork = Partial<Record<Network, Partial<Record<Environment, `0x${string}`>>>>\n\nexport const TOKEN_DEPLOYMENTS: Record<Token, DeploymentsByNetwork> = {\n USDC: {\n base: {\n live: { address: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', decimals: 6 },\n test: { address: '0x036CbD53842c5426634e7929541eC2318f3dCF7e', decimals: 6 },\n },\n optimism: {\n live: { address: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85', decimals: 6 },\n test: { address: '0x5fd84259d66Cd46123540766Be93DFE6D43130D7', decimals: 6 },\n },\n polygon: { live: { address: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359', decimals: 6 } },\n ethereum: {\n live: { address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', decimals: 6 },\n test: { address: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238', decimals: 6 },\n },\n arbitrum: { live: { address: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', decimals: 6 } },\n avalanche: { live: { address: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E', decimals: 6 } },\n bnb: { live: { address: '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d', decimals: 18 } },\n },\n USDT: {\n base: { live: { address: '0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2', decimals: 6 } },\n optimism: { live: { address: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58', decimals: 6 } },\n polygon: { live: { address: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', decimals: 6 } },\n ethereum: { live: { address: '0xdAC17F958D2ee523a2206206994597C13D831ec7', decimals: 6 } },\n arbitrum: { live: { address: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9', decimals: 6 } },\n avalanche: { live: { address: '0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7', decimals: 6 } },\n bnb: { live: { address: '0x55d398326f99059fF775485246999027B3197955', decimals: 18 } },\n },\n}\n\nexport function getTokenDeployment(\n token: Token,\n network: Network,\n environment: Environment,\n): TokenDeployment | undefined {\n return TOKEN_DEPLOYMENTS[token][network]?.[environment]\n}\n\nexport function isPaymentDeploymentEnabled(\n token: Token,\n network: Network,\n environment: Environment,\n): boolean {\n if (network === 'bnb' && environment === 'live') return false\n return getTokenDeployment(token, network, environment) !== undefined\n}\n\nfunction deriveAddresses(deployments: DeploymentsByNetwork): AddressesByNetwork {\n const addresses: AddressesByNetwork = {}\n for (const network of EVM_NETWORKS) {\n const byEnvironment = deployments[network]\n if (!byEnvironment) continue\n const networkAddresses: Partial<Record<Environment, `0x${string}`>> = {}\n for (const environment of ['live', 'test'] as const) {\n const deployment = byEnvironment[environment]\n if (deployment) networkAddresses[environment] = deployment.address\n }\n addresses[network] = networkAddresses\n }\n return addresses\n}\n\nexport const TOKEN_ADDRESSES: Record<Token, AddressesByNetwork> = {\n USDC: deriveAddresses(TOKEN_DEPLOYMENTS.USDC),\n USDT: deriveAddresses(TOKEN_DEPLOYMENTS.USDT),\n}\n","import type { AltToken } from './alt-tokens'\nimport type { Network } from './networks'\n\nexport const ALT_TOKEN_DECIMALS: Record<AltToken, number> = {\n ETH: 18,\n BNB: 18,\n MATIC: 18,\n AVAX: 18,\n BTC: 8,\n}\n\nexport const ALT_TOKEN_ADDRESSES: Record<\n Network,\n Partial<Record<AltToken, 'native' | `0x${string}`>>\n> = {\n base: { ETH: 'native', BTC: '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf' },\n optimism: { ETH: 'native', BTC: '0x68f180fcCe6836688e9084f035309E29Bf0A2095' },\n ethereum: { ETH: 'native', BTC: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599' },\n arbitrum: { ETH: 'native', BTC: '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f' },\n polygon: { MATIC: 'native', BTC: '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6' },\n avalanche: { AVAX: 'native' },\n bnb: { BNB: 'native' },\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGO,IAAM,iBAA0C;AAAA,EACrD,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,EACT,UAAU;AAAA,EACV,UAAU;AAAA,EACV,WAAW;AAAA,EACX,KAAK;AACP;AAEO,IAAM,oBAA6C;AAAA,EACxD,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,EACT,UAAU;AAAA,EACV,UAAU;AAAA,EACV,WAAW;AAAA,EACX,KAAK;AACP;AAEO,IAAM,eAAe;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,IAAM,uBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,IAAM,YAAsE;AAAA,EACjF,MAAM,EAAE,MAAM,MAAM,MAAM,MAAM;AAAA,EAChC,UAAU,EAAE,MAAM,IAAI,MAAM,SAAS;AAAA,EACrC,UAAU,EAAE,MAAM,GAAG,MAAM,SAAS;AAAA,EACpC,SAAS,EAAE,MAAM,IAAI;AAAA,EACrB,UAAU,EA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AC5B,KAAK,EAAE,KAAK,SAAS;AACvB;","names":[]}
|
package/dist/constants.mjs
CHANGED
|
@@ -7,8 +7,11 @@ import {
|
|
|
7
7
|
NETWORK_LABELS,
|
|
8
8
|
OPERATIONAL_NETWORKS,
|
|
9
9
|
TOKEN_ADDRESSES,
|
|
10
|
-
TOKEN_DECIMALS
|
|
11
|
-
|
|
10
|
+
TOKEN_DECIMALS,
|
|
11
|
+
TOKEN_DEPLOYMENTS,
|
|
12
|
+
getTokenDeployment,
|
|
13
|
+
isPaymentDeploymentEnabled
|
|
14
|
+
} from "./chunk-WKIOAEJ3.mjs";
|
|
12
15
|
export {
|
|
13
16
|
ALT_TOKEN_ADDRESSES,
|
|
14
17
|
ALT_TOKEN_DECIMALS,
|
|
@@ -18,6 +21,9 @@ export {
|
|
|
18
21
|
NETWORK_LABELS,
|
|
19
22
|
OPERATIONAL_NETWORKS,
|
|
20
23
|
TOKEN_ADDRESSES,
|
|
21
|
-
TOKEN_DECIMALS
|
|
24
|
+
TOKEN_DECIMALS,
|
|
25
|
+
TOKEN_DEPLOYMENTS,
|
|
26
|
+
getTokenDeployment,
|
|
27
|
+
isPaymentDeploymentEnabled
|
|
22
28
|
};
|
|
23
29
|
//# sourceMappingURL=constants.mjs.map
|