@klappay/types 3.0.1 → 3.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 +22 -2
- package/dist/chunk-KZ3646WX.mjs +109 -0
- package/dist/chunk-KZ3646WX.mjs.map +1 -0
- package/dist/constants-DQGVNS9O.d.mts +41 -0
- package/dist/constants-DQGVNS9O.d.ts +41 -0
- package/dist/constants.d.mts +2 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +143 -0
- package/dist/constants.js.map +1 -0
- package/dist/constants.mjs +23 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/index.d.mts +46 -32
- package/dist/index.d.ts +46 -32
- package/dist/index.js +47 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -90
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -1
package/README.md
CHANGED
|
@@ -40,8 +40,10 @@ already have it if you use any of them directly.
|
|
|
40
40
|
exact `data` shape per event, keyed by `event` (a discriminated union —
|
|
41
41
|
see the webhook example below).
|
|
42
42
|
- A handful of small constants (`TOKEN_ADDRESSES`, `NETWORK_EXPLORERS`,
|
|
43
|
-
`EVM_NETWORKS`, `OPERATIONAL_NETWORKS`, `
|
|
44
|
-
that mirror values the API itself uses
|
|
43
|
+
`EVM_NETWORKS`, `OPERATIONAL_NETWORKS`, `CHAIN_IDS`,
|
|
44
|
+
`CHARGE_ACCEPTED_PAYMENTS_MAX`) that mirror values the API itself uses —
|
|
45
|
+
also available with zero `zod` in the bundle via
|
|
46
|
+
`@klappay/types/constants`, see below.
|
|
45
47
|
- `AcceptedPaymentSchema`/`AcceptedPayment` (`{ token, network }`) — a
|
|
46
48
|
charge accepts a *list* of these, not a single `token`/`network` pair;
|
|
47
49
|
`CapabilitiesSchema`/`Capabilities` is the response shape of
|
|
@@ -119,6 +121,24 @@ helper that verifies the signature and returns a `TypedWebhookPayload`
|
|
|
119
121
|
— `data` narrows automatically from `event` in a `switch`/`if`, no cast
|
|
120
122
|
needed. See the live API reference for details.
|
|
121
123
|
|
|
124
|
+
## Zero-dependency constants
|
|
125
|
+
|
|
126
|
+
Every plain-object constant this package exports (`TOKEN_ADDRESSES`,
|
|
127
|
+
`ALT_TOKEN_ADDRESSES`, `CHAIN_IDS`, `NETWORK_LABELS`, `NETWORK_EXPLORERS`,
|
|
128
|
+
`EVM_NETWORKS`, `OPERATIONAL_NETWORKS`, `TOKEN_DECIMALS`,
|
|
129
|
+
`ALT_TOKEN_DECIMALS`) is also available from a second entry point that
|
|
130
|
+
carries zero `zod` in its bundle:
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
import { CHAIN_IDS, TOKEN_ADDRESSES } from '@klappay/types/constants'
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Useful for a browser/wallet-side bundle that only needs these plain
|
|
137
|
+
values and doesn't want to pay for the schema-validation code that ships
|
|
138
|
+
with the main entry. Everything exported here is identical to (and stays
|
|
139
|
+
in sync with) the same name imported from `@klappay/types` — nothing is
|
|
140
|
+
exclusive to this subpath, it's just a smaller bundle of the same values.
|
|
141
|
+
|
|
122
142
|
## Versioning
|
|
123
143
|
|
|
124
144
|
This package follows the API's own versioning. A breaking change to a
|
|
@@ -0,0 +1,109 @@
|
|
|
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_ADDRESSES = {
|
|
51
|
+
USDC: {
|
|
52
|
+
base: {
|
|
53
|
+
live: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
54
|
+
test: "0x036CbD53842c5426634e7929541eC2318f3dCF7e"
|
|
55
|
+
},
|
|
56
|
+
optimism: {
|
|
57
|
+
live: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
|
|
58
|
+
test: "0x5fd84259d66Cd46123540766Be93DFE6D43130D7"
|
|
59
|
+
},
|
|
60
|
+
polygon: { live: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359" },
|
|
61
|
+
ethereum: {
|
|
62
|
+
live: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
63
|
+
test: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"
|
|
64
|
+
},
|
|
65
|
+
arbitrum: { live: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831" },
|
|
66
|
+
avalanche: { live: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E" },
|
|
67
|
+
bnb: { live: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d" }
|
|
68
|
+
},
|
|
69
|
+
USDT: {
|
|
70
|
+
base: { live: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2" },
|
|
71
|
+
optimism: { live: "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58" },
|
|
72
|
+
polygon: { live: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F" },
|
|
73
|
+
ethereum: { live: "0xdAC17F958D2ee523a2206206994597C13D831ec7" },
|
|
74
|
+
arbitrum: { live: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9" },
|
|
75
|
+
avalanche: { live: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7" },
|
|
76
|
+
bnb: { live: "0x55d398326f99059fF775485246999027B3197955" }
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// src/alt-tokens.constants.ts
|
|
81
|
+
var ALT_TOKEN_DECIMALS = {
|
|
82
|
+
ETH: 18,
|
|
83
|
+
BNB: 18,
|
|
84
|
+
MATIC: 18,
|
|
85
|
+
AVAX: 18,
|
|
86
|
+
BTC: 8
|
|
87
|
+
};
|
|
88
|
+
var ALT_TOKEN_ADDRESSES = {
|
|
89
|
+
base: { ETH: "native", BTC: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf" },
|
|
90
|
+
optimism: { ETH: "native", BTC: "0x68f180fcCe6836688e9084f035309E29Bf0A2095" },
|
|
91
|
+
ethereum: { ETH: "native", BTC: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" },
|
|
92
|
+
arbitrum: { ETH: "native", BTC: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f" },
|
|
93
|
+
polygon: { MATIC: "native", BTC: "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6" },
|
|
94
|
+
avalanche: { AVAX: "native" },
|
|
95
|
+
bnb: { BNB: "native" }
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export {
|
|
99
|
+
NETWORK_LABELS,
|
|
100
|
+
NETWORK_EXPLORERS,
|
|
101
|
+
EVM_NETWORKS,
|
|
102
|
+
OPERATIONAL_NETWORKS,
|
|
103
|
+
CHAIN_IDS,
|
|
104
|
+
TOKEN_DECIMALS,
|
|
105
|
+
TOKEN_ADDRESSES,
|
|
106
|
+
ALT_TOKEN_DECIMALS,
|
|
107
|
+
ALT_TOKEN_ADDRESSES
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=chunk-KZ3646WX.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 type { Token } from './tokens'\n\nexport const TOKEN_DECIMALS = 6\n\nexport const TOKEN_ADDRESSES: Record<\n Token,\n Partial<Record<Network, Partial<Record<Environment, `0x${string}`>>>>\n> = {\n USDC: {\n base: {\n live: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',\n test: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',\n },\n optimism: {\n live: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85',\n test: '0x5fd84259d66Cd46123540766Be93DFE6D43130D7',\n },\n polygon: { live: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359' },\n ethereum: {\n live: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',\n test: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238',\n },\n arbitrum: { live: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831' },\n avalanche: { live: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E' },\n bnb: { live: '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d' },\n },\n USDT: {\n base: { live: '0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2' },\n optimism: { live: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58' },\n polygon: { live: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F' },\n ethereum: { live: '0xdAC17F958D2ee523a2206206994597C13D831ec7' },\n arbitrum: { live: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9' },\n avalanche: { live: '0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7' },\n bnb: { live: '0x55d398326f99059fF775485246999027B3197955' },\n },\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,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,EAAE,MAAM,MAAM;AAAA,EACxB,WAAW,EAAE,MAAM,MAAM;AAAA,EACzB,KAAK,EAAE,MAAM,GAAG;AAClB;;;ACjDO,IAAM,iBAAiB;AAEvB,IAAM,kBAGT;AAAA,EACF,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,UAAU;AAAA,MACR,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,SAAS,EAAE,MAAM,6CAA6C;AAAA,IAC9D,UAAU;AAAA,MACR,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,UAAU,EAAE,MAAM,6CAA6C;AAAA,IAC/D,WAAW,EAAE,MAAM,6CAA6C;AAAA,IAChE,KAAK,EAAE,MAAM,6CAA6C;AAAA,EAC5D;AAAA,EACA,MAAM;AAAA,IACJ,MAAM,EAAE,MAAM,6CAA6C;AAAA,IAC3D,UAAU,EAAE,MAAM,6CAA6C;AAAA,IAC/D,SAAS,EAAE,MAAM,6CAA6C;AAAA,IAC9D,UAAU,EAAE,MAAM,6CAA6C;AAAA,IAC/D,UAAU,EAAE,MAAM,6CAA6C;AAAA,IAC/D,WAAW,EAAE,MAAM,6CAA6C;AAAA,IAChE,KAAK,EAAE,MAAM,6CAA6C;AAAA,EAC5D;AACF;;;AClCO,IAAM,qBAA+C;AAAA,EAC1D,KAAK;AAAA,EACL,KAAK;AAAA,EACL,OAAO;AAAA,EACP,MAAM;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":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const EnvironmentSchema: z.ZodEnum<["live", "test"]>;
|
|
4
|
+
type Environment = z.infer<typeof EnvironmentSchema>;
|
|
5
|
+
|
|
6
|
+
declare const NetworkSchema: z.ZodEnum<["base", "optimism", "polygon", "ethereum", "arbitrum", "avalanche", "bnb"]>;
|
|
7
|
+
type Network = z.infer<typeof NetworkSchema>;
|
|
8
|
+
|
|
9
|
+
declare const NETWORK_LABELS: Record<Network, string>;
|
|
10
|
+
declare const NETWORK_EXPLORERS: Record<Network, string>;
|
|
11
|
+
declare const EVM_NETWORKS: readonly ["base", "optimism", "polygon", "ethereum", "arbitrum", "avalanche", "bnb"];
|
|
12
|
+
type EvmNetwork = (typeof EVM_NETWORKS)[number];
|
|
13
|
+
declare const OPERATIONAL_NETWORKS: readonly ["base", "arbitrum", "optimism", "polygon", "ethereum", "avalanche", "bnb"];
|
|
14
|
+
type OperationalNetwork = (typeof OPERATIONAL_NETWORKS)[number];
|
|
15
|
+
declare const CHAIN_IDS: Record<EvmNetwork, Partial<Record<Environment, number>>>;
|
|
16
|
+
|
|
17
|
+
declare const TokenSchema: z.ZodEnum<["USDC", "USDT"]>;
|
|
18
|
+
type Token = z.infer<typeof TokenSchema>;
|
|
19
|
+
|
|
20
|
+
declare const TOKEN_DECIMALS = 6;
|
|
21
|
+
declare const TOKEN_ADDRESSES: Record<Token, Partial<Record<Network, Partial<Record<Environment, `0x${string}`>>>>>;
|
|
22
|
+
|
|
23
|
+
declare const AltTokenSchema: z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>;
|
|
24
|
+
type AltToken = z.infer<typeof AltTokenSchema>;
|
|
25
|
+
declare const SwapAlternativeSchema: z.ZodObject<{
|
|
26
|
+
token: z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>;
|
|
27
|
+
network: z.ZodEnum<["base", "optimism", "polygon", "ethereum", "arbitrum", "avalanche", "bnb"]>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
|
|
30
|
+
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
31
|
+
}, {
|
|
32
|
+
token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
|
|
33
|
+
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
34
|
+
}>;
|
|
35
|
+
type SwapAlternative = z.infer<typeof SwapAlternativeSchema>;
|
|
36
|
+
declare function listSwapAlternatives(networks: readonly Network[]): SwapAlternative[];
|
|
37
|
+
|
|
38
|
+
declare const ALT_TOKEN_DECIMALS: Record<AltToken, number>;
|
|
39
|
+
declare const ALT_TOKEN_ADDRESSES: Record<Network, Partial<Record<AltToken, 'native' | `0x${string}`>>>;
|
|
40
|
+
|
|
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 m, TokenSchema as n, listSwapAlternatives as o };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const EnvironmentSchema: z.ZodEnum<["live", "test"]>;
|
|
4
|
+
type Environment = z.infer<typeof EnvironmentSchema>;
|
|
5
|
+
|
|
6
|
+
declare const NetworkSchema: z.ZodEnum<["base", "optimism", "polygon", "ethereum", "arbitrum", "avalanche", "bnb"]>;
|
|
7
|
+
type Network = z.infer<typeof NetworkSchema>;
|
|
8
|
+
|
|
9
|
+
declare const NETWORK_LABELS: Record<Network, string>;
|
|
10
|
+
declare const NETWORK_EXPLORERS: Record<Network, string>;
|
|
11
|
+
declare const EVM_NETWORKS: readonly ["base", "optimism", "polygon", "ethereum", "arbitrum", "avalanche", "bnb"];
|
|
12
|
+
type EvmNetwork = (typeof EVM_NETWORKS)[number];
|
|
13
|
+
declare const OPERATIONAL_NETWORKS: readonly ["base", "arbitrum", "optimism", "polygon", "ethereum", "avalanche", "bnb"];
|
|
14
|
+
type OperationalNetwork = (typeof OPERATIONAL_NETWORKS)[number];
|
|
15
|
+
declare const CHAIN_IDS: Record<EvmNetwork, Partial<Record<Environment, number>>>;
|
|
16
|
+
|
|
17
|
+
declare const TokenSchema: z.ZodEnum<["USDC", "USDT"]>;
|
|
18
|
+
type Token = z.infer<typeof TokenSchema>;
|
|
19
|
+
|
|
20
|
+
declare const TOKEN_DECIMALS = 6;
|
|
21
|
+
declare const TOKEN_ADDRESSES: Record<Token, Partial<Record<Network, Partial<Record<Environment, `0x${string}`>>>>>;
|
|
22
|
+
|
|
23
|
+
declare const AltTokenSchema: z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>;
|
|
24
|
+
type AltToken = z.infer<typeof AltTokenSchema>;
|
|
25
|
+
declare const SwapAlternativeSchema: z.ZodObject<{
|
|
26
|
+
token: z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>;
|
|
27
|
+
network: z.ZodEnum<["base", "optimism", "polygon", "ethereum", "arbitrum", "avalanche", "bnb"]>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
|
|
30
|
+
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
31
|
+
}, {
|
|
32
|
+
token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
|
|
33
|
+
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
34
|
+
}>;
|
|
35
|
+
type SwapAlternative = z.infer<typeof SwapAlternativeSchema>;
|
|
36
|
+
declare function listSwapAlternatives(networks: readonly Network[]): SwapAlternative[];
|
|
37
|
+
|
|
38
|
+
declare const ALT_TOKEN_DECIMALS: Record<AltToken, number>;
|
|
39
|
+
declare const ALT_TOKEN_ADDRESSES: Record<Network, Partial<Record<AltToken, 'native' | `0x${string}`>>>;
|
|
40
|
+
|
|
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 m, TokenSchema as n, listSwapAlternatives as o };
|
|
@@ -0,0 +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-DQGVNS9O.mjs';
|
|
2
|
+
import 'zod';
|
|
@@ -0,0 +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-DQGVNS9O.js';
|
|
2
|
+
import 'zod';
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/constants.ts
|
|
21
|
+
var constants_exports = {};
|
|
22
|
+
__export(constants_exports, {
|
|
23
|
+
ALT_TOKEN_ADDRESSES: () => ALT_TOKEN_ADDRESSES,
|
|
24
|
+
ALT_TOKEN_DECIMALS: () => ALT_TOKEN_DECIMALS,
|
|
25
|
+
CHAIN_IDS: () => CHAIN_IDS,
|
|
26
|
+
EVM_NETWORKS: () => EVM_NETWORKS,
|
|
27
|
+
NETWORK_EXPLORERS: () => NETWORK_EXPLORERS,
|
|
28
|
+
NETWORK_LABELS: () => NETWORK_LABELS,
|
|
29
|
+
OPERATIONAL_NETWORKS: () => OPERATIONAL_NETWORKS,
|
|
30
|
+
TOKEN_ADDRESSES: () => TOKEN_ADDRESSES,
|
|
31
|
+
TOKEN_DECIMALS: () => TOKEN_DECIMALS
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(constants_exports);
|
|
34
|
+
|
|
35
|
+
// src/networks.constants.ts
|
|
36
|
+
var NETWORK_LABELS = {
|
|
37
|
+
base: "Base",
|
|
38
|
+
optimism: "Optimism",
|
|
39
|
+
polygon: "Polygon",
|
|
40
|
+
ethereum: "Ethereum",
|
|
41
|
+
arbitrum: "Arbitrum",
|
|
42
|
+
avalanche: "Avalanche",
|
|
43
|
+
bnb: "BNB Chain"
|
|
44
|
+
};
|
|
45
|
+
var NETWORK_EXPLORERS = {
|
|
46
|
+
base: "https://basescan.org",
|
|
47
|
+
optimism: "https://optimistic.etherscan.io",
|
|
48
|
+
polygon: "https://polygonscan.com",
|
|
49
|
+
ethereum: "https://etherscan.io",
|
|
50
|
+
arbitrum: "https://arbiscan.io",
|
|
51
|
+
avalanche: "https://snowtrace.io",
|
|
52
|
+
bnb: "https://bscscan.com"
|
|
53
|
+
};
|
|
54
|
+
var EVM_NETWORKS = [
|
|
55
|
+
"base",
|
|
56
|
+
"optimism",
|
|
57
|
+
"polygon",
|
|
58
|
+
"ethereum",
|
|
59
|
+
"arbitrum",
|
|
60
|
+
"avalanche",
|
|
61
|
+
"bnb"
|
|
62
|
+
];
|
|
63
|
+
var OPERATIONAL_NETWORKS = [
|
|
64
|
+
"base",
|
|
65
|
+
"arbitrum",
|
|
66
|
+
"optimism",
|
|
67
|
+
"polygon",
|
|
68
|
+
"ethereum",
|
|
69
|
+
"avalanche",
|
|
70
|
+
"bnb"
|
|
71
|
+
];
|
|
72
|
+
var CHAIN_IDS = {
|
|
73
|
+
base: { live: 8453, test: 84532 },
|
|
74
|
+
optimism: { live: 10, test: 11155420 },
|
|
75
|
+
ethereum: { live: 1, test: 11155111 },
|
|
76
|
+
polygon: { live: 137 },
|
|
77
|
+
arbitrum: { live: 42161 },
|
|
78
|
+
avalanche: { live: 43114 },
|
|
79
|
+
bnb: { live: 56 }
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// src/tokens.constants.ts
|
|
83
|
+
var TOKEN_DECIMALS = 6;
|
|
84
|
+
var TOKEN_ADDRESSES = {
|
|
85
|
+
USDC: {
|
|
86
|
+
base: {
|
|
87
|
+
live: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
88
|
+
test: "0x036CbD53842c5426634e7929541eC2318f3dCF7e"
|
|
89
|
+
},
|
|
90
|
+
optimism: {
|
|
91
|
+
live: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
|
|
92
|
+
test: "0x5fd84259d66Cd46123540766Be93DFE6D43130D7"
|
|
93
|
+
},
|
|
94
|
+
polygon: { live: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359" },
|
|
95
|
+
ethereum: {
|
|
96
|
+
live: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
97
|
+
test: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"
|
|
98
|
+
},
|
|
99
|
+
arbitrum: { live: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831" },
|
|
100
|
+
avalanche: { live: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E" },
|
|
101
|
+
bnb: { live: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d" }
|
|
102
|
+
},
|
|
103
|
+
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" }
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// src/alt-tokens.constants.ts
|
|
115
|
+
var ALT_TOKEN_DECIMALS = {
|
|
116
|
+
ETH: 18,
|
|
117
|
+
BNB: 18,
|
|
118
|
+
MATIC: 18,
|
|
119
|
+
AVAX: 18,
|
|
120
|
+
BTC: 8
|
|
121
|
+
};
|
|
122
|
+
var ALT_TOKEN_ADDRESSES = {
|
|
123
|
+
base: { ETH: "native", BTC: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf" },
|
|
124
|
+
optimism: { ETH: "native", BTC: "0x68f180fcCe6836688e9084f035309E29Bf0A2095" },
|
|
125
|
+
ethereum: { ETH: "native", BTC: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" },
|
|
126
|
+
arbitrum: { ETH: "native", BTC: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f" },
|
|
127
|
+
polygon: { MATIC: "native", BTC: "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6" },
|
|
128
|
+
avalanche: { AVAX: "native" },
|
|
129
|
+
bnb: { BNB: "native" }
|
|
130
|
+
};
|
|
131
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
132
|
+
0 && (module.exports = {
|
|
133
|
+
ALT_TOKEN_ADDRESSES,
|
|
134
|
+
ALT_TOKEN_DECIMALS,
|
|
135
|
+
CHAIN_IDS,
|
|
136
|
+
EVM_NETWORKS,
|
|
137
|
+
NETWORK_EXPLORERS,
|
|
138
|
+
NETWORK_LABELS,
|
|
139
|
+
OPERATIONAL_NETWORKS,
|
|
140
|
+
TOKEN_ADDRESSES,
|
|
141
|
+
TOKEN_DECIMALS
|
|
142
|
+
});
|
|
143
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +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 const TOKEN_ADDRESSES: Record<\n Token,\n Partial<Record<Network, Partial<Record<Environment, `0x${string}`>>>>\n> = {\n USDC: {\n base: {\n live: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',\n test: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',\n },\n optimism: {\n live: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85',\n test: '0x5fd84259d66Cd46123540766Be93DFE6D43130D7',\n },\n polygon: { live: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359' },\n ethereum: {\n live: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',\n test: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238',\n },\n arbitrum: { live: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831' },\n avalanche: { live: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E' },\n bnb: { live: '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d' },\n },\n USDT: {\n base: { live: '0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2' },\n optimism: { live: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58' },\n polygon: { live: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F' },\n ethereum: { live: '0xdAC17F958D2ee523a2206206994597C13D831ec7' },\n arbitrum: { live: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9' },\n avalanche: { live: '0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7' },\n bnb: { live: '0x55d398326f99059fF775485246999027B3197955' },\n },\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;;;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,EAAE,MAAM,MAAM;AAAA,EACxB,WAAW,EAAE,MAAM,MAAM;AAAA,EACzB,KAAK,EAAE,MAAM,GAAG;AAClB;;;ACjDO,IAAM,iBAAiB;AAEvB,IAAM,kBAGT;AAAA,EACF,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,UAAU;AAAA,MACR,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,SAAS,EAAE,MAAM,6CAA6C;AAAA,IAC9D,UAAU;AAAA,MACR,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,IACA,UAAU,EAAE,MAAM,6CAA6C;AAAA,IAC/D,WAAW,EAAE,MAAM,6CAA6C;AAAA,IAChE,KAAK,EAAE,MAAM,6CAA6C;AAAA,EAC5D;AAAA,EACA,MAAM;AAAA,IACJ,MAAM,EAAE,MAAM,6CAA6C;AAAA,IAC3D,UAAU,EAAE,MAAM,6CAA6C;AAAA,IAC/D,SAAS,EAAE,MAAM,6CAA6C;AAAA,IAC9D,UAAU,EAAE,MAAM,6CAA6C;AAAA,IAC/D,UAAU,EAAE,MAAM,6CAA6C;AAAA,IAC/D,WAAW,EAAE,MAAM,6CAA6C;AAAA,IAChE,KAAK,EAAE,MAAM,6CAA6C;AAAA,EAC5D;AACF;;;AClCO,IAAM,qBAA+C;AAAA,EAC1D,KAAK;AAAA,EACL,KAAK;AAAA,EACL,OAAO;AAAA,EACP,MAAM;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":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ALT_TOKEN_ADDRESSES,
|
|
3
|
+
ALT_TOKEN_DECIMALS,
|
|
4
|
+
CHAIN_IDS,
|
|
5
|
+
EVM_NETWORKS,
|
|
6
|
+
NETWORK_EXPLORERS,
|
|
7
|
+
NETWORK_LABELS,
|
|
8
|
+
OPERATIONAL_NETWORKS,
|
|
9
|
+
TOKEN_ADDRESSES,
|
|
10
|
+
TOKEN_DECIMALS
|
|
11
|
+
} from "./chunk-KZ3646WX.mjs";
|
|
12
|
+
export {
|
|
13
|
+
ALT_TOKEN_ADDRESSES,
|
|
14
|
+
ALT_TOKEN_DECIMALS,
|
|
15
|
+
CHAIN_IDS,
|
|
16
|
+
EVM_NETWORKS,
|
|
17
|
+
NETWORK_EXPLORERS,
|
|
18
|
+
NETWORK_LABELS,
|
|
19
|
+
OPERATIONAL_NETWORKS,
|
|
20
|
+
TOKEN_ADDRESSES,
|
|
21
|
+
TOKEN_DECIMALS
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
export { A as ALT_TOKEN_ADDRESSES, a as ALT_TOKEN_DECIMALS, b as AltToken, c as AltTokenSchema, C as CHAIN_IDS, E as EVM_NETWORKS, d as Environment, e as EnvironmentSchema, f as EvmNetwork, N as NETWORK_EXPLORERS, g as NETWORK_LABELS, h as Network, i as NetworkSchema, O as OPERATIONAL_NETWORKS, j as OperationalNetwork, S as SwapAlternative, k as SwapAlternativeSchema, T as TOKEN_ADDRESSES, l as TOKEN_DECIMALS, m as Token, n as TokenSchema, o as listSwapAlternatives } from './constants-DQGVNS9O.mjs';
|
|
2
3
|
|
|
3
4
|
declare const ErrorPayloadSchema: z.ZodObject<{
|
|
4
5
|
error: z.ZodObject<{
|
|
@@ -29,24 +30,12 @@ declare const ErrorPayloadSchema: z.ZodObject<{
|
|
|
29
30
|
}>;
|
|
30
31
|
type ErrorPayload = z.infer<typeof ErrorPayloadSchema>;
|
|
31
32
|
|
|
32
|
-
declare const EnvironmentSchema: z.ZodEnum<["live", "test"]>;
|
|
33
|
-
type Environment = z.infer<typeof EnvironmentSchema>;
|
|
34
|
-
|
|
35
33
|
declare const ApiKeyScopeSchema: z.ZodEnum<["charges:read", "charges:write", "webhooks:read", "webhooks:write", "webhooks:manage_secret", "metrics:read", "metrics:charges:read", "metrics:transactions:read", "metrics:distributions:read", "sandbox:trigger", "charges:split_write", "recipients:read", "recipients:write", "recipients:manage_payout"]>;
|
|
36
34
|
type ApiKeyScope = z.infer<typeof ApiKeyScopeSchema>;
|
|
37
35
|
declare const API_KEY_SCOPES: ["charges:read", "charges:write", "webhooks:read", "webhooks:write", "webhooks:manage_secret", "metrics:read", "metrics:charges:read", "metrics:transactions:read", "metrics:distributions:read", "sandbox:trigger", "charges:split_write", "recipients:read", "recipients:write", "recipients:manage_payout"];
|
|
38
36
|
declare const CONFLICTING_SCOPE_PAIRS: ReadonlyArray<readonly [ApiKeyScope, ApiKeyScope]>;
|
|
39
37
|
declare function findConflictingScopes(scopes: readonly ApiKeyScope[]): readonly [ApiKeyScope, ApiKeyScope] | null;
|
|
40
38
|
|
|
41
|
-
declare const NetworkSchema: z.ZodEnum<["base", "optimism", "polygon", "ethereum", "arbitrum", "avalanche", "bnb"]>;
|
|
42
|
-
type Network = z.infer<typeof NetworkSchema>;
|
|
43
|
-
declare const NETWORK_LABELS: Record<Network, string>;
|
|
44
|
-
declare const NETWORK_EXPLORERS: Record<Network, string>;
|
|
45
|
-
declare const EVM_NETWORKS: readonly ["base", "optimism", "polygon", "ethereum", "arbitrum", "avalanche", "bnb"];
|
|
46
|
-
type EvmNetwork = (typeof EVM_NETWORKS)[number];
|
|
47
|
-
declare const OPERATIONAL_NETWORKS: readonly ["base", "arbitrum", "optimism", "polygon", "ethereum", "avalanche", "bnb"];
|
|
48
|
-
type OperationalNetwork = (typeof OPERATIONAL_NETWORKS)[number];
|
|
49
|
-
|
|
50
39
|
declare const PAGINATION_LIMIT_MIN = 1;
|
|
51
40
|
declare const PAGINATION_LIMIT_MAX = 100;
|
|
52
41
|
declare const PAGINATION_LIMIT_DEFAULT = 20;
|
|
@@ -76,17 +65,6 @@ declare function paginatedSchema<T extends z.ZodTypeAny>(itemSchema: T): z.ZodOb
|
|
|
76
65
|
hasMore: boolean;
|
|
77
66
|
}>;
|
|
78
67
|
|
|
79
|
-
declare const TokenSchema: z.ZodEnum<["USDC", "USDT"]>;
|
|
80
|
-
type Token = z.infer<typeof TokenSchema>;
|
|
81
|
-
declare const TOKEN_DECIMALS = 6;
|
|
82
|
-
declare const TOKEN_ADDRESSES: Record<Token, Partial<Record<Network, Partial<Record<Environment, `0x${string}`>>>>>;
|
|
83
|
-
|
|
84
|
-
declare const AltTokenSchema: z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>;
|
|
85
|
-
type AltToken = z.infer<typeof AltTokenSchema>;
|
|
86
|
-
declare const ALT_TOKEN_DECIMALS: Record<AltToken, number>;
|
|
87
|
-
declare const ALT_TOKEN_ADDRESSES: Record<Network, Partial<Record<AltToken, 'native' | `0x${string}`>>>;
|
|
88
|
-
declare function listAltTokensForNetworks(networks: readonly Network[]): AltToken[];
|
|
89
|
-
|
|
90
68
|
declare const ChargeStatusSchema: z.ZodEnum<["pending", "partially_paid", "confirmed", "expired", "underpaid"]>;
|
|
91
69
|
type ChargeStatus = z.infer<typeof ChargeStatusSchema>;
|
|
92
70
|
declare const SettlementStatusSchema: z.ZodEnum<["pending", "completed", "failed"]>;
|
|
@@ -386,7 +364,16 @@ declare const ChargeSchema: z.ZodObject<{
|
|
|
386
364
|
token: "USDC" | "USDT";
|
|
387
365
|
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
388
366
|
}>, "many">;
|
|
389
|
-
swapAlternatives: z.ZodArray<z.
|
|
367
|
+
swapAlternatives: z.ZodArray<z.ZodObject<{
|
|
368
|
+
token: z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>;
|
|
369
|
+
network: z.ZodEnum<["base", "optimism", "polygon", "ethereum", "arbitrum", "avalanche", "bnb"]>;
|
|
370
|
+
}, "strip", z.ZodTypeAny, {
|
|
371
|
+
token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
|
|
372
|
+
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
373
|
+
}, {
|
|
374
|
+
token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
|
|
375
|
+
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
376
|
+
}>, "many">;
|
|
390
377
|
address: z.ZodString;
|
|
391
378
|
status: z.ZodEnum<["pending", "partially_paid", "confirmed", "expired", "underpaid"]>;
|
|
392
379
|
settlementStatus: z.ZodNullable<z.ZodEnum<["pending", "completed", "failed"]>>;
|
|
@@ -553,7 +540,10 @@ declare const ChargeSchema: z.ZodObject<{
|
|
|
553
540
|
token: "USDC" | "USDT";
|
|
554
541
|
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
555
542
|
}[];
|
|
556
|
-
swapAlternatives:
|
|
543
|
+
swapAlternatives: {
|
|
544
|
+
token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
|
|
545
|
+
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
546
|
+
}[];
|
|
557
547
|
settlementStatus: "pending" | "completed" | "failed" | null;
|
|
558
548
|
environment: "live" | "test";
|
|
559
549
|
apiKeyId: string | null;
|
|
@@ -617,7 +607,10 @@ declare const ChargeSchema: z.ZodObject<{
|
|
|
617
607
|
token: "USDC" | "USDT";
|
|
618
608
|
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
619
609
|
}[];
|
|
620
|
-
swapAlternatives:
|
|
610
|
+
swapAlternatives: {
|
|
611
|
+
token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
|
|
612
|
+
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
613
|
+
}[];
|
|
621
614
|
settlementStatus: "pending" | "completed" | "failed" | null;
|
|
622
615
|
environment: "live" | "test";
|
|
623
616
|
apiKeyId: string | null;
|
|
@@ -688,7 +681,16 @@ declare const PaginatedChargesSchema: z.ZodObject<{
|
|
|
688
681
|
token: "USDC" | "USDT";
|
|
689
682
|
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
690
683
|
}>, "many">;
|
|
691
|
-
swapAlternatives: z.ZodArray<z.
|
|
684
|
+
swapAlternatives: z.ZodArray<z.ZodObject<{
|
|
685
|
+
token: z.ZodEnum<["ETH", "BNB", "MATIC", "AVAX", "BTC"]>;
|
|
686
|
+
network: z.ZodEnum<["base", "optimism", "polygon", "ethereum", "arbitrum", "avalanche", "bnb"]>;
|
|
687
|
+
}, "strip", z.ZodTypeAny, {
|
|
688
|
+
token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
|
|
689
|
+
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
690
|
+
}, {
|
|
691
|
+
token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
|
|
692
|
+
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
693
|
+
}>, "many">;
|
|
692
694
|
address: z.ZodString;
|
|
693
695
|
status: z.ZodEnum<["pending", "partially_paid", "confirmed", "expired", "underpaid"]>;
|
|
694
696
|
settlementStatus: z.ZodNullable<z.ZodEnum<["pending", "completed", "failed"]>>;
|
|
@@ -855,7 +857,10 @@ declare const PaginatedChargesSchema: z.ZodObject<{
|
|
|
855
857
|
token: "USDC" | "USDT";
|
|
856
858
|
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
857
859
|
}[];
|
|
858
|
-
swapAlternatives:
|
|
860
|
+
swapAlternatives: {
|
|
861
|
+
token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
|
|
862
|
+
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
863
|
+
}[];
|
|
859
864
|
settlementStatus: "pending" | "completed" | "failed" | null;
|
|
860
865
|
environment: "live" | "test";
|
|
861
866
|
apiKeyId: string | null;
|
|
@@ -919,7 +924,10 @@ declare const PaginatedChargesSchema: z.ZodObject<{
|
|
|
919
924
|
token: "USDC" | "USDT";
|
|
920
925
|
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
921
926
|
}[];
|
|
922
|
-
swapAlternatives:
|
|
927
|
+
swapAlternatives: {
|
|
928
|
+
token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
|
|
929
|
+
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
930
|
+
}[];
|
|
923
931
|
settlementStatus: "pending" | "completed" | "failed" | null;
|
|
924
932
|
environment: "live" | "test";
|
|
925
933
|
apiKeyId: string | null;
|
|
@@ -987,7 +995,10 @@ declare const PaginatedChargesSchema: z.ZodObject<{
|
|
|
987
995
|
token: "USDC" | "USDT";
|
|
988
996
|
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
989
997
|
}[];
|
|
990
|
-
swapAlternatives:
|
|
998
|
+
swapAlternatives: {
|
|
999
|
+
token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
|
|
1000
|
+
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
1001
|
+
}[];
|
|
991
1002
|
settlementStatus: "pending" | "completed" | "failed" | null;
|
|
992
1003
|
environment: "live" | "test";
|
|
993
1004
|
apiKeyId: string | null;
|
|
@@ -1055,7 +1066,10 @@ declare const PaginatedChargesSchema: z.ZodObject<{
|
|
|
1055
1066
|
token: "USDC" | "USDT";
|
|
1056
1067
|
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
1057
1068
|
}[];
|
|
1058
|
-
swapAlternatives:
|
|
1069
|
+
swapAlternatives: {
|
|
1070
|
+
token: "ETH" | "BNB" | "MATIC" | "AVAX" | "BTC";
|
|
1071
|
+
network: "base" | "optimism" | "polygon" | "ethereum" | "arbitrum" | "avalanche" | "bnb";
|
|
1072
|
+
}[];
|
|
1059
1073
|
settlementStatus: "pending" | "completed" | "failed" | null;
|
|
1060
1074
|
environment: "live" | "test";
|
|
1061
1075
|
apiKeyId: string | null;
|
|
@@ -2621,4 +2635,4 @@ declare const SwapQuoteSchema: z.ZodObject<{
|
|
|
2621
2635
|
}>;
|
|
2622
2636
|
type SwapQuote = z.infer<typeof SwapQuoteSchema>;
|
|
2623
2637
|
|
|
2624
|
-
export {
|
|
2638
|
+
export { API_KEY_SCOPES, type AcceptedPayment, AcceptedPaymentSchema, type ApiKeyScope, ApiKeyScopeSchema, CHARGE_ACCEPTED_PAYMENTS_MAX, CHARGE_AMOUNT_MAX, CHARGE_EXPIRES_IN_MAX_SECONDS, CHARGE_EXPIRES_IN_MIN_SECONDS, CHARGE_SPLIT_RECIPIENTS_MAX, CHECKOUT_PRODUCTS_MAX, CONFLICTING_SCOPE_PAIRS, type Capabilities, CapabilitiesSchema, type Charge, ChargeSchema, type ChargeStatus, ChargeStatusSchema, ChargeWebhookEventTypeSchema, type ChargesDateField, ChargesDateFieldSchema, type ChargesMetricField, ChargesMetricFieldSchema, type ChargesQueryField, ChargesQueryFieldSchema, type CheckoutProduct, CheckoutProductSchema, type CreateChargeInput, type CreateChargeRequest, CreateChargeSchema, type CreateRecipientInput, type CreateRecipientRequest, CreateRecipientSchema, type CreateSwapQuoteInput, CreateSwapQuoteSchema, type CreateWebhookInput, type CreateWebhookRequest, CreateWebhookSchema, type DistributionsDateField, DistributionsDateFieldSchema, type DistributionsMetricField, DistributionsMetricFieldSchema, type DistributionsQueryField, DistributionsQueryFieldSchema, EVENT_CATEGORY_MAP, type ErrorPayload, ErrorPayloadSchema, type GetChargeQrCodeQuery, type GetChargeQrCodeQueryRequest, GetChargeQrCodeQuerySchema, type Health, HealthSchema, type KlappayCheckoutMetadata, KlappayCheckoutMetadataSchema, type ListChargesInput, type ListChargesRequest, ListChargesSchema, type ListWebhookDeliveriesInput, type ListWebhookDeliveriesRequest, ListWebhookDeliveriesSchema, type ListenPendingDistributionsQuery, ListenPendingDistributionsQuerySchema, MAX_METRICS_QUERY_DATE_RANGE_DAYS, METRICS_QUERY_DEFAULT_ROW_LIMIT, METRICS_QUERY_MAX_FILTERS, METRICS_QUERY_MAX_GROUP_BY, METRICS_QUERY_MAX_METRICS, METRICS_QUERY_MAX_ROW_LIMIT, MetadataWithKlappaySchema, type MetricsAggregation, MetricsAggregationSchema, type MetricsDateGranularity, MetricsDateGranularitySchema, type MetricsFilterOperator, MetricsFilterOperatorSchema, type MetricsQuery, type MetricsQueryRequest, type MetricsQueryResult, type MetricsQueryResultRow, MetricsQueryResultRowSchema, MetricsQueryResultSchema, MetricsQuerySchema, type MetricsResource, MetricsResourceSchema, PAGINATION_LIMIT_DEFAULT, PAGINATION_LIMIT_MAX, PAGINATION_LIMIT_MIN, type PaginatedCharges, PaginatedChargesSchema, type PaginatedPendingDistributions, PaginatedPendingDistributionsSchema, type PaginatedWebhookDeliveries, PaginatedWebhookDeliveriesSchema, type PaginationQuery, type PaginationQueryRequest, PaginationQuerySchema, type PendingDistribution, type PendingDistributionEvent, PendingDistributionEventSchema, PendingDistributionRecipientSchema, PendingDistributionSchema, type Recipient, RecipientSchema, type SandboxTriggerInput, SandboxTriggerSchema, type SetRecipientPayoutInput, SetRecipientPayoutSchema, type SettlementStatus, SettlementStatusSchema, type SplitDistributionStatus, SplitDistributionStatusSchema, type SplitRecipient, type SplitRecipientInput, SplitRecipientInputSchema, SplitRecipientSchema, type SwapQuote, SwapQuoteSchema, type TimelineEvent, TimelineEventSchema, type TimelineEventType, TimelineEventTypeSchema, type TransactionSource, TransactionSourceSchema, type TransactionsDateField, TransactionsDateFieldSchema, type TransactionsMetricField, TransactionsMetricFieldSchema, type TransactionsQueryField, TransactionsQueryFieldSchema, type TriggerableChargeEvent, TriggerableChargeEventSchema, type TypedWebhookPayload, WEBHOOK_EVENTS_WILDCARD, WEBHOOK_EVENT_CATEGORIES, type Webhook, type WebhookCategory, WebhookCategorySchema, type WebhookDelivery, WebhookDeliveryEventTypeSchema, WebhookDeliverySchema, type WebhookDeliveryStatus, WebhookDeliveryStatusSchema, type WebhookEventDataMap, type WebhookEventType, WebhookEventTypeSchema, type WebhookHealthEventData, type WebhookListItem, WebhookListItemSchema, type WebhookPayload, WebhookPayloadSchema, WebhookSchema, findConflictingScopes, paginatedSchema };
|