@reptilianhq/launch-on-block-sdk 0.4.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/CHANGELOG.md +15 -0
- package/LICENSE +674 -0
- package/README.md +116 -0
- package/dist/abis.d.ts +2 -0
- package/dist/abis.d.ts.map +1 -0
- package/dist/abis.js +2 -0
- package/dist/abis.js.map +1 -0
- package/dist/compatibility.d.ts +50 -0
- package/dist/compatibility.d.ts.map +1 -0
- package/dist/compatibility.js +244 -0
- package/dist/compatibility.js.map +1 -0
- package/dist/deployments.d.ts +294 -0
- package/dist/deployments.d.ts.map +1 -0
- package/dist/deployments.js +122 -0
- package/dist/deployments.js.map +1 -0
- package/dist/economics.d.ts +23 -0
- package/dist/economics.d.ts.map +1 -0
- package/dist/economics.js +111 -0
- package/dist/economics.js.map +1 -0
- package/dist/errors.d.ts +18 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +30 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated/abis.d.ts +1652 -0
- package/dist/generated/abis.d.ts.map +1 -0
- package/dist/generated/abis.js +2243 -0
- package/dist/generated/abis.js.map +1 -0
- package/dist/generated/deployments.d.ts +212 -0
- package/dist/generated/deployments.d.ts.map +1 -0
- package/dist/generated/deployments.js +237 -0
- package/dist/generated/deployments.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/receipts.d.ts +84 -0
- package/dist/receipts.d.ts.map +1 -0
- package/dist/receipts.js +104 -0
- package/dist/receipts.js.map +1 -0
- package/dist/transactions.d.ts +115 -0
- package/dist/transactions.d.ts.map +1 -0
- package/dist/transactions.js +395 -0
- package/dist/transactions.js.map +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import type { Address, Hex } from "viem";
|
|
2
|
+
export declare const deploymentManifest: {
|
|
3
|
+
readonly $schema: "./blockchains.schema.json";
|
|
4
|
+
readonly schema_version: 1;
|
|
5
|
+
readonly active_network: "mainnet";
|
|
6
|
+
readonly deployer_address: "0xD07B1A5110f0042d9d38E66FFc1E9Ee07F1C9025";
|
|
7
|
+
readonly robinhood: {
|
|
8
|
+
readonly mainnet: {
|
|
9
|
+
readonly name: "Robinhood Chain Mainnet";
|
|
10
|
+
readonly id: "robinhood-chain-mainnet";
|
|
11
|
+
readonly blockchain_env: "mainnet";
|
|
12
|
+
readonly chain_id: 4663;
|
|
13
|
+
readonly rpc_url: "https://rpc.mainnet.chain.robinhood.com";
|
|
14
|
+
readonly explorer_url: "https://robinhoodchain.blockscout.com";
|
|
15
|
+
readonly native_currency: {
|
|
16
|
+
readonly name: "Ether";
|
|
17
|
+
readonly symbol: "ETH";
|
|
18
|
+
readonly decimals: 18;
|
|
19
|
+
};
|
|
20
|
+
readonly addresses: {
|
|
21
|
+
readonly w_native: "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73";
|
|
22
|
+
readonly usdg: "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168";
|
|
23
|
+
};
|
|
24
|
+
readonly deployment: {
|
|
25
|
+
readonly max_managed_native: "10000000000000000000";
|
|
26
|
+
};
|
|
27
|
+
readonly release_authorities: {
|
|
28
|
+
readonly safe_dependencies: {
|
|
29
|
+
readonly version: "1.4.1";
|
|
30
|
+
readonly proxy_factory: "0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67";
|
|
31
|
+
readonly proxy_factory_runtime_code_hash: "0x50c3cdc4074750a7a974204a716c999edd37482f907608d960b2b025ee0b3317";
|
|
32
|
+
readonly singleton: "0x29fcB43b46531BcA003ddC8FCB67FFE91900C762";
|
|
33
|
+
readonly singleton_runtime_code_hash: "0xb1f926978a0f44a2c0ec8fe822418ae969bd8c3f18d61e5103100339894f81ff";
|
|
34
|
+
readonly fallback_handler: "0xfd0732Dc9E303f09fCEf3a7388Ad10A83459Ec99";
|
|
35
|
+
readonly fallback_handler_runtime_code_hash: "0x7c6007a5d711cea8dfd5d91f5940ec29c7f200fe511eb1fc1397b367af3c42f9";
|
|
36
|
+
};
|
|
37
|
+
readonly timelock: {
|
|
38
|
+
readonly address: "0x4047d08fdf3a19cc86054c6447ca4f86bc9bc952";
|
|
39
|
+
readonly delay_seconds: 3600;
|
|
40
|
+
};
|
|
41
|
+
readonly safes: {
|
|
42
|
+
readonly governance: {
|
|
43
|
+
readonly owners: readonly ["0x5EdB0e05E71eCcfEee551b5bBDAA8182842EC49E", "0xD07B1A5110f0042d9d38E66FFc1E9Ee07F1C9025", "0xc71841296be105003fc48de2024461e5be024b9d"];
|
|
44
|
+
readonly threshold: 2;
|
|
45
|
+
readonly salt_nonce: 1;
|
|
46
|
+
readonly address: "0x06c75582873bf5c018dc20481ab467760bd6bbda";
|
|
47
|
+
};
|
|
48
|
+
readonly security: {
|
|
49
|
+
readonly owners: readonly ["0x5EdB0e05E71eCcfEee551b5bBDAA8182842EC49E", "0xD07B1A5110f0042d9d38E66FFc1E9Ee07F1C9025", "0xc71841296be105003fc48de2024461e5be024b9d"];
|
|
50
|
+
readonly threshold: 2;
|
|
51
|
+
readonly salt_nonce: 2;
|
|
52
|
+
readonly address: "0xbc0b6fe52d1a0076c2812aab06aedeb7f50caac0";
|
|
53
|
+
};
|
|
54
|
+
readonly treasury: {
|
|
55
|
+
readonly owners: readonly ["0x5EdB0e05E71eCcfEee551b5bBDAA8182842EC49E", "0xD07B1A5110f0042d9d38E66FFc1E9Ee07F1C9025", "0xc71841296be105003fc48de2024461e5be024b9d"];
|
|
56
|
+
readonly threshold: 2;
|
|
57
|
+
readonly salt_nonce: 3;
|
|
58
|
+
readonly address: "0x55599775e667e17ffba9f3fc7c48a1190d0fc516";
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
readonly chain_data: {
|
|
63
|
+
readonly deployment_id: "4663:launchpad:0x135492b3ccb2cb64749f91332f929f49a1deed3f:17957183";
|
|
64
|
+
readonly launchpad: "0x135492b3ccb2cb64749f91332f929f49a1deed3f";
|
|
65
|
+
readonly start_block: 17957183;
|
|
66
|
+
};
|
|
67
|
+
readonly contracts: {
|
|
68
|
+
readonly generation: "gen-12";
|
|
69
|
+
readonly start_block: 17957183;
|
|
70
|
+
readonly launchpad: "0x135492b3ccb2cb64749f91332f929f49a1deed3f";
|
|
71
|
+
readonly fee_controller: "0xbd885463e6e0f24ee467f173719a7330ade1ca01";
|
|
72
|
+
readonly fee_controller_implementation: "0x598fd4da33e893f4a2b195b38a9838a27dbd7352";
|
|
73
|
+
readonly fee_controller_admin: "0x5c1e873d37eafcf772569dd67536d7d098fdd914";
|
|
74
|
+
readonly router: "0xf3fcb520def7473f0eeb473a73cade20a2eb1f4a";
|
|
75
|
+
readonly lb_factory: "0xf8e7505380c3c9c949b071e374fe9b3ae5ff752e";
|
|
76
|
+
readonly lb_pair_implementation: "0x4aba9d609eefc5252f52ca2ed87853321c748090";
|
|
77
|
+
readonly lb_router: "0x5c944d8e208ca11cb751128ac84bcbb075638677";
|
|
78
|
+
readonly launchpad_type: "immutable";
|
|
79
|
+
readonly curve_id_1: "0xed51fb775a87931a9a92b3ac2191f757e66c8685";
|
|
80
|
+
readonly pool_deployer: "0x7ad25c4f43b9a40bf300b18dc8a24bd6dbfd4b37";
|
|
81
|
+
readonly escrow_deployer: "0x64a52ae2a1ec4fa72e41bfdf8137d27f01466731";
|
|
82
|
+
readonly proxy_upgrade_gate: "0x40e909ab66315606fd2102a8f72bbfb9d82a343a";
|
|
83
|
+
readonly release_id: "gen-12";
|
|
84
|
+
readonly writes_enabled: true;
|
|
85
|
+
readonly abi_revision: "sha256:635cf660979631c57c4fa5cdf28460f8a4293272ebe153f0064e3758c6a5b9be";
|
|
86
|
+
readonly runtime_code_hashes: {
|
|
87
|
+
readonly launchpad: "0x3ef65ddfde1a1d789bd7ac0f14529788f93493cc5073d103962d50d1e0efa138";
|
|
88
|
+
readonly fee_controller: "0x7d8625196afdf5a2cfca49803b9de7df2b68ba16a071a513ba650aba1477922f";
|
|
89
|
+
readonly fee_controller_implementation: "0x6303dde8ed462b9b1c078dc75810f10115d58b991145f4153344e7c6242e855f";
|
|
90
|
+
readonly router: "0xf736df164f19a8d0024fc28871f4c97a56621137c69d8aa394564c136cff76ae";
|
|
91
|
+
readonly lb_factory: "0x50710981faa8754701a5e0fde2f13dc3f8cfca1e93a3731c36d22347ffcce85f";
|
|
92
|
+
readonly lb_pair_implementation: "0x684e78c40171e58778c35cec6362fd264b53af55bea68c1e1347181e99f0577c";
|
|
93
|
+
readonly lb_router: "0x45507f54da674eae3e9074e438b2166051b03b35b41b52a07ff39ddeb7463537";
|
|
94
|
+
readonly fee_controller_admin: "0xa98dbb25ee77fe62597fa5217281b4aab9777e521e3bd69fe5084ee7c8d6b893";
|
|
95
|
+
readonly curve_id_1: "0xf359db705238fe65857cf28ac3e784a0433f4cfb308b0d10a82e8ebbfc1b3659";
|
|
96
|
+
readonly pool_deployer: "0xfe2e5909f2d70f729d194e65cbee255981b1c6602228f0f4c9c7e9826b4ce2d2";
|
|
97
|
+
readonly escrow_deployer: "0xd38c4aaf2c9040560e504d8e6b56d2ada516a0c35569ad80c156cde02200112d";
|
|
98
|
+
readonly proxy_upgrade_gate: "0x20c1a039d3124dbc1ff3dd33adcbf0922f693e1f6f8700e7d14a08241d53189f";
|
|
99
|
+
readonly escrow_implementation: "0x2052156230036ae864e17c709bcee51e63cd45d528853c77fbca368fee01153d";
|
|
100
|
+
};
|
|
101
|
+
readonly implementations: {
|
|
102
|
+
readonly launchpad: null;
|
|
103
|
+
readonly fee_controller: {
|
|
104
|
+
readonly address: "0x598fd4da33e893f4a2b195b38a9838a27dbd7352";
|
|
105
|
+
readonly runtime_code_hash: "0x6303dde8ed462b9b1c078dc75810f10115d58b991145f4153344e7c6242e855f";
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
readonly escrow_implementation: "0xb0743a0c4740837245cd6b6b96c27d1379571b51";
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
readonly testnet: {
|
|
112
|
+
readonly name: "Robinhood Chain Testnet";
|
|
113
|
+
readonly id: "robinhood-chain-testnet";
|
|
114
|
+
readonly blockchain_env: "testnet";
|
|
115
|
+
readonly chain_id: 46630;
|
|
116
|
+
readonly rpc_url: "https://rpc.testnet.chain.robinhood.com";
|
|
117
|
+
readonly explorer_url: "https://explorer.testnet.chain.robinhood.com";
|
|
118
|
+
readonly native_currency: {
|
|
119
|
+
readonly name: "Ether";
|
|
120
|
+
readonly symbol: "ETH";
|
|
121
|
+
readonly decimals: 18;
|
|
122
|
+
};
|
|
123
|
+
readonly addresses: {
|
|
124
|
+
readonly w_native: "0x7943e237c7F95DA44E0301572D358911207852Fa";
|
|
125
|
+
readonly usdg: null;
|
|
126
|
+
};
|
|
127
|
+
readonly release_authorities: {
|
|
128
|
+
readonly safe_dependencies: {
|
|
129
|
+
readonly version: "1.4.1";
|
|
130
|
+
readonly proxy_factory: "0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67";
|
|
131
|
+
readonly proxy_factory_runtime_code_hash: "0x50c3cdc4074750a7a974204a716c999edd37482f907608d960b2b025ee0b3317";
|
|
132
|
+
readonly singleton: "0x29fcB43b46531BcA003ddC8FCB67FFE91900C762";
|
|
133
|
+
readonly singleton_runtime_code_hash: "0xb1f926978a0f44a2c0ec8fe822418ae969bd8c3f18d61e5103100339894f81ff";
|
|
134
|
+
readonly fallback_handler: "0xfd0732Dc9E303f09fCEf3a7388Ad10A83459Ec99";
|
|
135
|
+
readonly fallback_handler_runtime_code_hash: "0x7c6007a5d711cea8dfd5d91f5940ec29c7f200fe511eb1fc1397b367af3c42f9";
|
|
136
|
+
};
|
|
137
|
+
readonly timelock: {
|
|
138
|
+
readonly address: "0xf3fcb520def7473f0eeb473a73cade20a2eb1f4a";
|
|
139
|
+
readonly delay_seconds: 0;
|
|
140
|
+
};
|
|
141
|
+
readonly safes: {
|
|
142
|
+
readonly governance: {
|
|
143
|
+
readonly address: "0x3d4B110BC7de8Fc8De3c91e5fA78e8c292543eed";
|
|
144
|
+
readonly owners: readonly ["0x5EdB0e05E71eCcfEee551b5bBDAA8182842EC49E", "0xD07B1A5110f0042d9d38E66FFc1E9Ee07F1C9025", "0xc71841296be105003fc48de2024461e5be024b9d"];
|
|
145
|
+
readonly threshold: 2;
|
|
146
|
+
readonly salt_nonce: 1;
|
|
147
|
+
};
|
|
148
|
+
readonly security: {
|
|
149
|
+
readonly address: "0x2667b89bd57dC1889768DE21Cf2370C8C484dcd6";
|
|
150
|
+
readonly owners: readonly ["0x5EdB0e05E71eCcfEee551b5bBDAA8182842EC49E", "0xD07B1A5110f0042d9d38E66FFc1E9Ee07F1C9025", "0xc71841296be105003fc48de2024461e5be024b9d"];
|
|
151
|
+
readonly threshold: 2;
|
|
152
|
+
readonly salt_nonce: 2;
|
|
153
|
+
};
|
|
154
|
+
readonly treasury: {
|
|
155
|
+
readonly address: "0x7fAF3Ea4fF8615cD677B498073F7374543Bbf398";
|
|
156
|
+
readonly owners: readonly ["0x5EdB0e05E71eCcfEee551b5bBDAA8182842EC49E", "0xD07B1A5110f0042d9d38E66FFc1E9Ee07F1C9025", "0xc71841296be105003fc48de2024461e5be024b9d"];
|
|
157
|
+
readonly threshold: 2;
|
|
158
|
+
readonly salt_nonce: 3;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
readonly chain_data: {
|
|
163
|
+
readonly deployment_id: "46630:launchpad:0x6993320e82ac53f75eda8a5051ce437c6f3584c5:91383760";
|
|
164
|
+
readonly launchpad: "0x6993320E82Ac53F75eDA8a5051cE437c6F3584c5";
|
|
165
|
+
readonly start_block: 91383760;
|
|
166
|
+
};
|
|
167
|
+
readonly contracts: {
|
|
168
|
+
readonly generation: "gen-12";
|
|
169
|
+
readonly start_block: 92793378;
|
|
170
|
+
readonly launchpad: "0x9fe4f17b53a520c4c8672c945285574a7396340f";
|
|
171
|
+
readonly fee_controller: "0x19809b400d7d160fc71a261f8415b29556e63487";
|
|
172
|
+
readonly fee_controller_implementation: "0x0231795b50e3dbd48dc1660691b84f1ef50981a5";
|
|
173
|
+
readonly fee_controller_admin: "0x2d2209a71ca57675c2e31b1bbd21b187b54891e5";
|
|
174
|
+
readonly router: "0xf06e880a714cb8683850a29d435b86bd9f14523d";
|
|
175
|
+
readonly lb_factory: "0xb79595369054FADb0931E0D4e1604D7BEe3B4675";
|
|
176
|
+
readonly lb_pair_implementation: "0xa77B1516762Df1a68f9800b22cB0464687C581c2";
|
|
177
|
+
readonly lb_router: "0x0f8d88068c77b3fd804abee29ea3cef44b0dc04c";
|
|
178
|
+
readonly launchpad_type: "immutable";
|
|
179
|
+
readonly curve_id_1: "0xc8ee86322d7cc309b430432845dc586cdf34cecf";
|
|
180
|
+
readonly pool_deployer: "0x22c9732bbaf7c4cd1c4423540279b3621c9e0b14";
|
|
181
|
+
readonly escrow_deployer: "0xefaad6de1921b05c0d4623f169175b620b6b7aa0";
|
|
182
|
+
readonly proxy_upgrade_gate: "0xad486010fccfcfd5672e04347d80758044fa2b88";
|
|
183
|
+
readonly release_id: "gen-12";
|
|
184
|
+
readonly writes_enabled: true;
|
|
185
|
+
readonly abi_revision: "sha256:635cf660979631c57c4fa5cdf28460f8a4293272ebe153f0064e3758c6a5b9be";
|
|
186
|
+
readonly runtime_code_hashes: {
|
|
187
|
+
readonly launchpad: "0x4b3e8efe37610dcd8d06476f7a5b1c24adc987de00ce58b391a94b06b27086e5";
|
|
188
|
+
readonly fee_controller: "0xcb972390fd037953c1e7128c3f92d1bbe4d4c03828f09eac95f72757746eac75";
|
|
189
|
+
readonly fee_controller_implementation: "0x6303dde8ed462b9b1c078dc75810f10115d58b991145f4153344e7c6242e855f";
|
|
190
|
+
readonly router: "0x6daefe68cf5adef174d2ee77e8bc0209965a494e82e266366ad70f03a7cbd219";
|
|
191
|
+
readonly lb_factory: "0x26d327c7a7ebf1494da252f2aa63ebcc372ea9cbea1021b96ed8e9101cc843f9";
|
|
192
|
+
readonly lb_pair_implementation: "0xfe9dc5a79798944729ae22c65811d29cb0ee6dce545a60e1ccb0f4b018dd1ddf";
|
|
193
|
+
readonly lb_router: "0xb8831f38a5d8697e6effa26aca7dd85d5cda0303b15ffb072c56c3c1adb3c3d4";
|
|
194
|
+
readonly fee_controller_admin: "0xa98dbb25ee77fe62597fa5217281b4aab9777e521e3bd69fe5084ee7c8d6b893";
|
|
195
|
+
readonly curve_id_1: "0x5fda3a6bf83ff9269524b254616ae49fe540d2c656d7bae10008415d64626c0e";
|
|
196
|
+
readonly pool_deployer: "0xfe2e5909f2d70f729d194e65cbee255981b1c6602228f0f4c9c7e9826b4ce2d2";
|
|
197
|
+
readonly escrow_deployer: "0x1abf5e986a39484a3fe6438019294d7ffc723f3bd32394de3e08a6eedb3299d5";
|
|
198
|
+
readonly proxy_upgrade_gate: "0x6f1a535a63d28a9bdb9c860454d0ab6ab3867d412154c19a2eb1abeb06cd72ae";
|
|
199
|
+
readonly escrow_implementation: "0x2052156230036ae864e17c709bcee51e63cd45d528853c77fbca368fee01153d";
|
|
200
|
+
};
|
|
201
|
+
readonly implementations: {
|
|
202
|
+
readonly launchpad: null;
|
|
203
|
+
readonly fee_controller: {
|
|
204
|
+
readonly address: "0x0231795b50e3dbd48dc1660691b84f1ef50981a5";
|
|
205
|
+
readonly runtime_code_hash: "0x6303dde8ed462b9b1c078dc75810f10115d58b991145f4153344e7c6242e855f";
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
readonly escrow_implementation: "0x81C13B971007e703b0D8d35A97EB47Aed53D1d8C";
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
export declare const ROBINHOOD_CHAIN_ID = 4663;
|
|
214
|
+
export declare const ROBINHOOD_CHAIN_TESTNET_ID = 46630;
|
|
215
|
+
export type BlockchainEnvironment = "mainnet" | "testnet" | "local";
|
|
216
|
+
export interface ContractIdentity {
|
|
217
|
+
readonly address: Address;
|
|
218
|
+
readonly runtimeCodeHash: Hex;
|
|
219
|
+
}
|
|
220
|
+
export interface ProtocolContracts {
|
|
221
|
+
readonly releaseId: string;
|
|
222
|
+
readonly abiRevision: string;
|
|
223
|
+
readonly generation: string;
|
|
224
|
+
readonly startBlock: number;
|
|
225
|
+
readonly launchpad: Address;
|
|
226
|
+
readonly launchpadType: "immutable";
|
|
227
|
+
readonly feeController: Address;
|
|
228
|
+
readonly router: Address;
|
|
229
|
+
readonly lbFactory: Address;
|
|
230
|
+
readonly lbPairImplementation: Address;
|
|
231
|
+
readonly lbRouter: Address;
|
|
232
|
+
readonly feeControllerAdmin: ContractIdentity;
|
|
233
|
+
readonly defaultCurve: ContractIdentity & {
|
|
234
|
+
readonly id: number;
|
|
235
|
+
};
|
|
236
|
+
readonly graduationPoolDeployer: ContractIdentity;
|
|
237
|
+
readonly launchEscrowDeployer: ContractIdentity & {
|
|
238
|
+
readonly implementation: ContractIdentity;
|
|
239
|
+
};
|
|
240
|
+
readonly proxyUpgradeGate: ContractIdentity;
|
|
241
|
+
readonly runtimeCodeHashes: {
|
|
242
|
+
readonly launchpad: Hex;
|
|
243
|
+
readonly feeController: Hex;
|
|
244
|
+
readonly router: Hex;
|
|
245
|
+
readonly lbFactory: Hex;
|
|
246
|
+
readonly lbPairImplementation: Hex;
|
|
247
|
+
readonly lbRouter: Hex;
|
|
248
|
+
readonly curveId1: Hex;
|
|
249
|
+
readonly poolDeployer: Hex;
|
|
250
|
+
readonly escrowDeployer: Hex;
|
|
251
|
+
readonly escrowImplementation: Hex;
|
|
252
|
+
readonly proxyUpgradeGate: Hex;
|
|
253
|
+
readonly feeControllerAdmin: Hex;
|
|
254
|
+
};
|
|
255
|
+
readonly implementations: {
|
|
256
|
+
readonly launchpad: null;
|
|
257
|
+
readonly feeController: ContractIdentity;
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
export interface Deployment {
|
|
261
|
+
readonly name: string;
|
|
262
|
+
readonly blockchainEnvironment: BlockchainEnvironment;
|
|
263
|
+
readonly chainId: number;
|
|
264
|
+
readonly rpcUrl: string;
|
|
265
|
+
readonly explorerUrl: string | null;
|
|
266
|
+
readonly nativeCurrency: {
|
|
267
|
+
readonly name: string;
|
|
268
|
+
readonly symbol: string;
|
|
269
|
+
readonly decimals: number;
|
|
270
|
+
};
|
|
271
|
+
readonly addresses: {
|
|
272
|
+
readonly wNative: Address | null;
|
|
273
|
+
readonly usdg: Address | null;
|
|
274
|
+
};
|
|
275
|
+
readonly contracts: ProtocolContracts | null;
|
|
276
|
+
}
|
|
277
|
+
export declare function getChain(chainId: number): Deployment;
|
|
278
|
+
export declare function getDeployment(chainId: number): Deployment & {
|
|
279
|
+
contracts: ProtocolContracts;
|
|
280
|
+
};
|
|
281
|
+
export declare function listChains(): readonly Deployment[];
|
|
282
|
+
export declare const robinhoodMainnet: Deployment & {
|
|
283
|
+
contracts: ProtocolContracts;
|
|
284
|
+
};
|
|
285
|
+
export declare const robinhoodTestnet: Deployment & {
|
|
286
|
+
contracts: ProtocolContracts;
|
|
287
|
+
};
|
|
288
|
+
export declare const ROBINHOOD_MAINNET_LAUNCHPAD_ADDRESS: `0x${string}`;
|
|
289
|
+
export declare const ROBINHOOD_MAINNET_LAUNCHPAD_START_BLOCK: number;
|
|
290
|
+
export declare const ROBINHOOD_MAINNET_WETH_ADDRESS: Address;
|
|
291
|
+
export declare const ROBINHOOD_TESTNET_LAUNCHPAD_ADDRESS: `0x${string}`;
|
|
292
|
+
export declare const ROBINHOOD_TESTNET_LAUNCHPAD_START_BLOCK: number;
|
|
293
|
+
export declare const ROBINHOOD_TESTNET_WETH_ADDRESS: Address;
|
|
294
|
+
//# sourceMappingURL=deployments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployments.d.ts","sourceRoot":"","sources":["../src/deployments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAIz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AE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IACvG,QAAQ,CAAC,SAAS,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAA;KAAE,CAAC;IACxF,QAAQ,CAAC,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC9C;AAiGD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CASpD;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG;IAAE,SAAS,EAAE,iBAAiB,CAAA;CAAE,CAS5F;AAED,wBAAgB,UAAU,IAAI,SAAS,UAAU,EAAE,CAElD;AAED,eAAO,MAAM,gBAAgB;eAf6C,iBAAiB;CAe1B,CAAC;AAClE,eAAO,MAAM,gBAAgB;eAhB6C,iBAAiB;CAgBlB,CAAC;AAE1E,eAAO,MAAM,mCAAmC,eAAuC,CAAC;AACxF,eAAO,MAAM,uCAAuC,QAAwC,CAAC;AAC7F,eAAO,MAAM,8BAA8B,EAAyC,OAAO,CAAC;AAC5F,eAAO,MAAM,mCAAmC,eAAuC,CAAC;AACxF,eAAO,MAAM,uCAAuC,QAAwC,CAAC;AAC7F,eAAO,MAAM,8BAA8B,EAAyC,OAAO,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { deploymentManifest as generatedDeploymentManifest } from "./generated/deployments.js";
|
|
2
|
+
import { SdkError } from "./errors.js";
|
|
3
|
+
export const deploymentManifest = deepFreeze(generatedDeploymentManifest);
|
|
4
|
+
export const ROBINHOOD_CHAIN_ID = 4663;
|
|
5
|
+
export const ROBINHOOD_CHAIN_TESTNET_ID = 46630;
|
|
6
|
+
const deployments = deepFreeze(Object.values(deploymentManifest.robinhood).map((network) => ({
|
|
7
|
+
name: network.name,
|
|
8
|
+
blockchainEnvironment: network.blockchain_env,
|
|
9
|
+
chainId: network.chain_id,
|
|
10
|
+
rpcUrl: network.rpc_url,
|
|
11
|
+
explorerUrl: network.explorer_url,
|
|
12
|
+
nativeCurrency: network.native_currency,
|
|
13
|
+
addresses: {
|
|
14
|
+
wNative: network.addresses.w_native,
|
|
15
|
+
usdg: network.addresses.usdg,
|
|
16
|
+
},
|
|
17
|
+
contracts: network.contracts === null ? null : {
|
|
18
|
+
releaseId: network.contracts.release_id,
|
|
19
|
+
abiRevision: network.contracts.abi_revision,
|
|
20
|
+
generation: network.contracts.generation,
|
|
21
|
+
startBlock: network.contracts.start_block,
|
|
22
|
+
launchpad: network.contracts.launchpad,
|
|
23
|
+
launchpadType: network.contracts.launchpad_type,
|
|
24
|
+
feeController: network.contracts.fee_controller,
|
|
25
|
+
router: network.contracts.router,
|
|
26
|
+
lbFactory: network.contracts.lb_factory,
|
|
27
|
+
lbPairImplementation: network.contracts.lb_pair_implementation,
|
|
28
|
+
lbRouter: network.contracts.lb_router,
|
|
29
|
+
feeControllerAdmin: {
|
|
30
|
+
address: network.contracts.fee_controller_admin,
|
|
31
|
+
runtimeCodeHash: network.contracts.runtime_code_hashes.fee_controller_admin,
|
|
32
|
+
},
|
|
33
|
+
defaultCurve: {
|
|
34
|
+
id: 1,
|
|
35
|
+
address: network.contracts.curve_id_1,
|
|
36
|
+
runtimeCodeHash: network.contracts.runtime_code_hashes.curve_id_1,
|
|
37
|
+
},
|
|
38
|
+
graduationPoolDeployer: {
|
|
39
|
+
address: network.contracts.pool_deployer,
|
|
40
|
+
runtimeCodeHash: network.contracts.runtime_code_hashes.pool_deployer,
|
|
41
|
+
},
|
|
42
|
+
launchEscrowDeployer: {
|
|
43
|
+
address: network.contracts.escrow_deployer,
|
|
44
|
+
runtimeCodeHash: network.contracts.runtime_code_hashes.escrow_deployer,
|
|
45
|
+
implementation: {
|
|
46
|
+
address: network.contracts.escrow_implementation,
|
|
47
|
+
runtimeCodeHash: network.contracts.runtime_code_hashes.escrow_implementation,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
proxyUpgradeGate: {
|
|
51
|
+
address: network.contracts.proxy_upgrade_gate,
|
|
52
|
+
runtimeCodeHash: network.contracts.runtime_code_hashes.proxy_upgrade_gate,
|
|
53
|
+
},
|
|
54
|
+
runtimeCodeHashes: {
|
|
55
|
+
launchpad: network.contracts.runtime_code_hashes.launchpad,
|
|
56
|
+
feeController: network.contracts.runtime_code_hashes.fee_controller,
|
|
57
|
+
router: network.contracts.runtime_code_hashes.router,
|
|
58
|
+
lbFactory: network.contracts.runtime_code_hashes.lb_factory,
|
|
59
|
+
lbPairImplementation: network.contracts.runtime_code_hashes.lb_pair_implementation,
|
|
60
|
+
lbRouter: network.contracts.runtime_code_hashes.lb_router,
|
|
61
|
+
curveId1: network.contracts.runtime_code_hashes.curve_id_1,
|
|
62
|
+
poolDeployer: network.contracts.runtime_code_hashes.pool_deployer,
|
|
63
|
+
escrowDeployer: network.contracts.runtime_code_hashes.escrow_deployer,
|
|
64
|
+
escrowImplementation: network.contracts.runtime_code_hashes.escrow_implementation,
|
|
65
|
+
proxyUpgradeGate: network.contracts.runtime_code_hashes.proxy_upgrade_gate,
|
|
66
|
+
feeControllerAdmin: network.contracts.runtime_code_hashes.fee_controller_admin,
|
|
67
|
+
},
|
|
68
|
+
implementations: normalizeImplementations(network.contracts.implementations),
|
|
69
|
+
},
|
|
70
|
+
})));
|
|
71
|
+
function deepFreeze(value) {
|
|
72
|
+
if (value !== null && typeof value === "object" && !Object.isFrozen(value)) {
|
|
73
|
+
for (const child of Object.values(value))
|
|
74
|
+
deepFreeze(child);
|
|
75
|
+
Object.freeze(value);
|
|
76
|
+
}
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
function normalizeImplementations(implementations) {
|
|
80
|
+
return {
|
|
81
|
+
launchpad: null,
|
|
82
|
+
feeController: normalizeIdentity(implementations.fee_controller),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function normalizeIdentity(identity) {
|
|
86
|
+
return {
|
|
87
|
+
address: identity.address,
|
|
88
|
+
runtimeCodeHash: identity.runtime_code_hash,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
export function getChain(chainId) {
|
|
92
|
+
const deployment = deployments.find((candidate) => candidate.chainId === chainId);
|
|
93
|
+
if (!deployment) {
|
|
94
|
+
throw new SdkError("UNSUPPORTED_CHAIN", `Unsupported chain ID ${chainId}`, {
|
|
95
|
+
path: "chainId",
|
|
96
|
+
actual: String(chainId),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return deployment;
|
|
100
|
+
}
|
|
101
|
+
export function getDeployment(chainId) {
|
|
102
|
+
const deployment = getChain(chainId);
|
|
103
|
+
if (!deployment.contracts) {
|
|
104
|
+
throw new SdkError("DEPLOYMENT_NOT_FOUND", `No protocol deployment is recorded for chain ID ${chainId}`, {
|
|
105
|
+
path: "contracts",
|
|
106
|
+
actual: "null",
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return deployment;
|
|
110
|
+
}
|
|
111
|
+
export function listChains() {
|
|
112
|
+
return deployments;
|
|
113
|
+
}
|
|
114
|
+
export const robinhoodMainnet = getDeployment(ROBINHOOD_CHAIN_ID);
|
|
115
|
+
export const robinhoodTestnet = getDeployment(ROBINHOOD_CHAIN_TESTNET_ID);
|
|
116
|
+
export const ROBINHOOD_MAINNET_LAUNCHPAD_ADDRESS = robinhoodMainnet.contracts.launchpad;
|
|
117
|
+
export const ROBINHOOD_MAINNET_LAUNCHPAD_START_BLOCK = robinhoodMainnet.contracts.startBlock;
|
|
118
|
+
export const ROBINHOOD_MAINNET_WETH_ADDRESS = robinhoodMainnet.addresses.wNative;
|
|
119
|
+
export const ROBINHOOD_TESTNET_LAUNCHPAD_ADDRESS = robinhoodTestnet.contracts.launchpad;
|
|
120
|
+
export const ROBINHOOD_TESTNET_LAUNCHPAD_START_BLOCK = robinhoodTestnet.contracts.startBlock;
|
|
121
|
+
export const ROBINHOOD_TESTNET_WETH_ADDRESS = robinhoodTestnet.addresses.wNative;
|
|
122
|
+
//# sourceMappingURL=deployments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployments.js","sourceRoot":"","sources":["../src/deployments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,IAAI,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC,2BAA2B,CAAC,CAAC;AAE1E,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AACvC,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAC;AAgEhD,MAAM,WAAW,GAA0B,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAClH,IAAI,EAAE,OAAO,CAAC,IAAI;IAClB,qBAAqB,EAAE,OAAO,CAAC,cAAc;IAC7C,OAAO,EAAE,OAAO,CAAC,QAAQ;IACzB,MAAM,EAAE,OAAO,CAAC,OAAO;IACvB,WAAW,EAAE,OAAO,CAAC,YAAY;IACjC,cAAc,EAAE,OAAO,CAAC,eAAe;IACvC,SAAS,EAAE;QACT,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,QAA0B;QACrD,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,IAAsB;KAC/C;IACD,SAAS,EAAE,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7C,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,UAAU;QACvC,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,YAAY;QAC3C,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC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MAAM,gBAAgB,GAAG,aAAa,CAAC,0BAA0B,CAAC,CAAC;AAE1E,MAAM,CAAC,MAAM,mCAAmC,GAAG,gBAAgB,CAAC,SAAS,CAAC,SAAS,CAAC;AACxF,MAAM,CAAC,MAAM,uCAAuC,GAAG,gBAAgB,CAAC,SAAS,CAAC,UAAU,CAAC;AAC7F,MAAM,CAAC,MAAM,8BAA8B,GAAG,gBAAgB,CAAC,SAAS,CAAC,OAAkB,CAAC;AAC5F,MAAM,CAAC,MAAM,mCAAmC,GAAG,gBAAgB,CAAC,SAAS,CAAC,SAAS,CAAC;AACxF,MAAM,CAAC,MAAM,uCAAuC,GAAG,gBAAgB,CAAC,SAAS,CAAC,UAAU,CAAC;AAC7F,MAAM,CAAC,MAAM,8BAA8B,GAAG,gBAAgB,CAAC,SAAS,CAAC,OAAkB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
export declare const BASIS_POINTS_DENOMINATOR = 10000;
|
|
3
|
+
export declare const NATIVE_TOKEN_ADDRESS: Address;
|
|
4
|
+
/**
|
|
5
|
+
* Applies a caller-selected slippage tolerance and rounds down exactly as Solidity does.
|
|
6
|
+
* Product-specific tolerance limits belong to the caller; this helper accepts the full bps range.
|
|
7
|
+
*/
|
|
8
|
+
export declare function calculateSlippageFloor(quotedAmountOut: bigint, slippageBps: number): bigint;
|
|
9
|
+
/** Calculates the largest creator graduation cut allowed by caller-supplied live terms. */
|
|
10
|
+
export declare function calculateCreatorCutCapacity(maxGraduationCutBps: number, protocolCutBps: number): number;
|
|
11
|
+
/** Validates a fee against caller-supplied live bounds and returns the validated value. */
|
|
12
|
+
export declare function validateFeeRange(feeBps: number, minimumFeeBps: number, maximumFeeBps: number): number;
|
|
13
|
+
/**
|
|
14
|
+
* Validates the Router's exact expiry rule against a caller-supplied timestamp.
|
|
15
|
+
* A deadline equal to the current timestamp remains valid on-chain.
|
|
16
|
+
*/
|
|
17
|
+
export declare function validateDeadline(deadline: bigint, currentTimestamp: bigint): bigint;
|
|
18
|
+
/**
|
|
19
|
+
* Derives the only valid transaction value for an exact-input swap and, when supplied,
|
|
20
|
+
* verifies that a caller-provided value agrees with both tokenIn and amountIn.
|
|
21
|
+
*/
|
|
22
|
+
export declare function validateNativeValue(tokenIn: Address, amountIn: bigint, value?: bigint): bigint;
|
|
23
|
+
//# sourceMappingURL=economics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"economics.d.ts","sourceRoot":"","sources":["../src/economics.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAG5D,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAC/C,eAAO,MAAM,oBAAoB,EAAE,OAAqB,CAAC;AAKzD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAK3F;AAED,2FAA2F;AAC3F,wBAAgB,2BAA2B,CACzC,mBAAmB,EAAE,MAAM,EAC3B,cAAc,EAAE,MAAM,GACrB,MAAM,CAWR;AAED,2FAA2F;AAC3F,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,GACpB,MAAM,CAmBR;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAWnF;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,GACb,MAAM,CAsBR"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { isAddress, zeroAddress } from "viem";
|
|
2
|
+
import { SdkError } from "./errors.js";
|
|
3
|
+
export const BASIS_POINTS_DENOMINATOR = 10_000;
|
|
4
|
+
export const NATIVE_TOKEN_ADDRESS = zeroAddress;
|
|
5
|
+
const MAX_UINT16 = 65_535;
|
|
6
|
+
const MAX_UINT256 = (1n << 256n) - 1n;
|
|
7
|
+
/**
|
|
8
|
+
* Applies a caller-selected slippage tolerance and rounds down exactly as Solidity does.
|
|
9
|
+
* Product-specific tolerance limits belong to the caller; this helper accepts the full bps range.
|
|
10
|
+
*/
|
|
11
|
+
export function calculateSlippageFloor(quotedAmountOut, slippageBps) {
|
|
12
|
+
assertUint256(quotedAmountOut, "quotedAmountOut");
|
|
13
|
+
assertBasisPoints(slippageBps, "slippageBps");
|
|
14
|
+
return quotedAmountOut * BigInt(BASIS_POINTS_DENOMINATOR - slippageBps)
|
|
15
|
+
/ BigInt(BASIS_POINTS_DENOMINATOR);
|
|
16
|
+
}
|
|
17
|
+
/** Calculates the largest creator graduation cut allowed by caller-supplied live terms. */
|
|
18
|
+
export function calculateCreatorCutCapacity(maxGraduationCutBps, protocolCutBps) {
|
|
19
|
+
assertUint16(maxGraduationCutBps, "maxGraduationCutBps");
|
|
20
|
+
assertUint16(protocolCutBps, "protocolCutBps");
|
|
21
|
+
if (protocolCutBps > maxGraduationCutBps) {
|
|
22
|
+
throw new SdkError("TERMS_INCONSISTENT", "protocolCutBps cannot exceed maxGraduationCutBps", {
|
|
23
|
+
path: "protocolCutBps",
|
|
24
|
+
expected: `<= ${maxGraduationCutBps}`,
|
|
25
|
+
actual: String(protocolCutBps),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return maxGraduationCutBps - protocolCutBps;
|
|
29
|
+
}
|
|
30
|
+
/** Validates a fee against caller-supplied live bounds and returns the validated value. */
|
|
31
|
+
export function validateFeeRange(feeBps, minimumFeeBps, maximumFeeBps) {
|
|
32
|
+
assertUint16(feeBps, "feeBps");
|
|
33
|
+
assertUint16(minimumFeeBps, "minimumFeeBps");
|
|
34
|
+
assertUint16(maximumFeeBps, "maximumFeeBps");
|
|
35
|
+
if (minimumFeeBps > maximumFeeBps) {
|
|
36
|
+
throw new SdkError("TERMS_INCONSISTENT", "minimumFeeBps cannot exceed maximumFeeBps", {
|
|
37
|
+
path: "minimumFeeBps",
|
|
38
|
+
expected: `<= ${maximumFeeBps}`,
|
|
39
|
+
actual: String(minimumFeeBps),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (feeBps < minimumFeeBps || feeBps > maximumFeeBps) {
|
|
43
|
+
throw new SdkError("FEE_OUT_OF_RANGE", `feeBps must be between ${minimumFeeBps} and ${maximumFeeBps}`, {
|
|
44
|
+
path: "feeBps",
|
|
45
|
+
expected: `${minimumFeeBps}..${maximumFeeBps}`,
|
|
46
|
+
actual: String(feeBps),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return feeBps;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Validates the Router's exact expiry rule against a caller-supplied timestamp.
|
|
53
|
+
* A deadline equal to the current timestamp remains valid on-chain.
|
|
54
|
+
*/
|
|
55
|
+
export function validateDeadline(deadline, currentTimestamp) {
|
|
56
|
+
assertUint256(deadline, "deadline");
|
|
57
|
+
assertUint256(currentTimestamp, "currentTimestamp");
|
|
58
|
+
if (deadline < currentTimestamp) {
|
|
59
|
+
throw new SdkError("DEADLINE_EXPIRED", "deadline has expired", {
|
|
60
|
+
path: "deadline",
|
|
61
|
+
expected: `>= ${currentTimestamp}`,
|
|
62
|
+
actual: String(deadline),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return deadline;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Derives the only valid transaction value for an exact-input swap and, when supplied,
|
|
69
|
+
* verifies that a caller-provided value agrees with both tokenIn and amountIn.
|
|
70
|
+
*/
|
|
71
|
+
export function validateNativeValue(tokenIn, amountIn, value) {
|
|
72
|
+
if (!isAddress(tokenIn)) {
|
|
73
|
+
throw new SdkError("INVALID_ADDRESS", "tokenIn must be an EVM address", {
|
|
74
|
+
path: "tokenIn",
|
|
75
|
+
expected: "20-byte EVM address",
|
|
76
|
+
actual: tokenIn,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
assertUint256(amountIn, "amountIn");
|
|
80
|
+
if (value !== undefined)
|
|
81
|
+
assertUint256(value, "value");
|
|
82
|
+
const expectedValue = tokenIn.toLowerCase() === NATIVE_TOKEN_ADDRESS ? amountIn : 0n;
|
|
83
|
+
if (value !== undefined && value !== expectedValue) {
|
|
84
|
+
throw new SdkError("NATIVE_VALUE_MISMATCH", tokenIn.toLowerCase() === NATIVE_TOKEN_ADDRESS
|
|
85
|
+
? "Native input requires value to equal amountIn"
|
|
86
|
+
: "ERC-20 input requires zero native value", { path: "value", expected: String(expectedValue), actual: String(value) });
|
|
87
|
+
}
|
|
88
|
+
return expectedValue;
|
|
89
|
+
}
|
|
90
|
+
function assertBasisPoints(value, name) {
|
|
91
|
+
if (!Number.isInteger(value) || value < 0 || value > BASIS_POINTS_DENOMINATOR) {
|
|
92
|
+
throw invalidArgument(name, `integer from 0 through ${BASIS_POINTS_DENOMINATOR}`, value);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function assertUint16(value, name) {
|
|
96
|
+
if (!Number.isInteger(value) || value < 0 || value > MAX_UINT16) {
|
|
97
|
+
throw invalidArgument(name, "integer from 0 through 65535", value);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function assertUint256(value, name) {
|
|
101
|
+
if (value < 0n || value > MAX_UINT256)
|
|
102
|
+
throw invalidArgument(name, "unsigned 256-bit integer", value);
|
|
103
|
+
}
|
|
104
|
+
function invalidArgument(name, expected, actual) {
|
|
105
|
+
return new SdkError("INVALID_ARGUMENT", `${name} must be an ${expected}`, {
|
|
106
|
+
path: name,
|
|
107
|
+
expected,
|
|
108
|
+
actual: String(actual),
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=economics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"economics.js","sourceRoot":"","sources":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,CAAC;QAChE,MAAM,eAAe,CAAC,IAAI,EAAE,8BAA8B,EAAE,KAAK,CAAC,CAAC;IACrE,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,KAAa,EAAE,IAAY;IAChD,IAAI,KAAK,GAAG,EAAE,IAAI,KAAK,GAAG,WAAW;QAAE,MAAM,eAAe,CAAC,IAAI,EAAE,0BAA0B,EAAE,KAAK,CAAC,CAAC;AACxG,CAAC;AAED,SAAS,eAAe,CAAC,IAAY,EAAE,QAAgB,EAAE,MAAuB;IAC9E,OAAO,IAAI,QAAQ,CAAC,kBAAkB,EAAE,GAAG,IAAI,eAAe,QAAQ,EAAE,EAAE;QACxE,IAAI,EAAE,IAAI;QACV,QAAQ;QACR,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;KACvB,CAAC,CAAC;AACL,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Stable machine-readable failures emitted by the SDK's own validation boundaries. */
|
|
2
|
+
export type SdkErrorCode = "ADMIN_MISMATCH" | "ABI_REVISION_MISMATCH" | "CALLDATA_MISMATCH" | "CHAIN_MISMATCH" | "CODE_HASH_MISMATCH" | "CODE_MISSING" | "DEADLINE_EXPIRED" | "DEPLOYMENT_NOT_FOUND" | "EVENT_NOT_FOUND" | "FEE_OUT_OF_RANGE" | "IMPLEMENTATION_MISMATCH" | "INVALID_ADDRESS" | "INVALID_ARGUMENT" | "INVALID_CALLDATA" | "INVALID_RPC_QUANTITY" | "NATIVE_VALUE_MISMATCH" | "OUTPUT_BELOW_MINIMUM" | "POINTER_MISMATCH" | "RECEIPT_FIELD_MISMATCH" | "RECEIPT_REVERTED" | "TERMS_INCONSISTENT" | "UNEXPECTED_SENDER" | "UNEXPECTED_TARGET" | "UNEXPECTED_VALUE" | "UNSUPPORTED_CHAIN" | "UNSUPPORTED_FUNCTION";
|
|
3
|
+
export interface SdkErrorOptions {
|
|
4
|
+
path?: string;
|
|
5
|
+
expected?: string;
|
|
6
|
+
actual?: string;
|
|
7
|
+
cause?: unknown;
|
|
8
|
+
}
|
|
9
|
+
export declare class SdkError extends Error {
|
|
10
|
+
readonly code: SdkErrorCode;
|
|
11
|
+
readonly path?: string;
|
|
12
|
+
readonly expected?: string;
|
|
13
|
+
readonly actual?: string;
|
|
14
|
+
constructor(code: SdkErrorCode, message: string, options?: SdkErrorOptions);
|
|
15
|
+
toJSON(): Record<string, string>;
|
|
16
|
+
}
|
|
17
|
+
export declare function isSdkError(error: unknown): error is SdkError;
|
|
18
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,MAAM,MAAM,YAAY,GACpB,gBAAgB,GAChB,uBAAuB,GACvB,mBAAmB,GACnB,gBAAgB,GAChB,oBAAoB,GACpB,cAAc,GACd,kBAAkB,GAClB,sBAAsB,GACtB,iBAAiB,GACjB,kBAAkB,GAClB,yBAAyB,GACzB,iBAAiB,GACjB,kBAAkB,GAClB,kBAAkB,GAClB,sBAAsB,GACtB,uBAAuB,GACvB,sBAAsB,GACtB,kBAAkB,GAClB,wBAAwB,GACxB,kBAAkB,GAClB,oBAAoB,GACpB,mBAAmB,GACnB,mBAAmB,GACnB,kBAAkB,GAClB,mBAAmB,GACnB,sBAAsB,CAAC;AAE3B,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,qBAAa,QAAS,SAAQ,KAAK;aAMf,IAAI,EAAE,YAAY;IALpC,SAAgB,IAAI,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAgB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClC,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAC;gBAGd,IAAI,EAAE,YAAY,EAClC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,eAAoB;IAU/B,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAUjC;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAE5D"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class SdkError extends Error {
|
|
2
|
+
code;
|
|
3
|
+
path;
|
|
4
|
+
expected;
|
|
5
|
+
actual;
|
|
6
|
+
constructor(code, message, options = {}) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.name = "SdkError";
|
|
10
|
+
this.path = options.path;
|
|
11
|
+
this.expected = options.expected;
|
|
12
|
+
this.actual = options.actual;
|
|
13
|
+
if (options.cause !== undefined)
|
|
14
|
+
this.cause = options.cause;
|
|
15
|
+
}
|
|
16
|
+
toJSON() {
|
|
17
|
+
return Object.fromEntries(Object.entries({
|
|
18
|
+
name: this.name,
|
|
19
|
+
code: this.code,
|
|
20
|
+
message: this.message,
|
|
21
|
+
path: this.path,
|
|
22
|
+
expected: this.expected,
|
|
23
|
+
actual: this.actual,
|
|
24
|
+
}).filter((entry) => entry[1] !== undefined));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export function isSdkError(error) {
|
|
28
|
+
return error instanceof SdkError;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAoCA,MAAM,OAAO,QAAS,SAAQ,KAAK;IAMf;IALF,IAAI,CAAU;IACd,QAAQ,CAAU;IAClB,MAAM,CAAU;IAEhC,YACkB,IAAkB,EAClC,OAAe,EACf,UAA2B,EAAE;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,SAAI,GAAJ,IAAI,CAAc;QAKlC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC9D,CAAC;IAED,MAAM;QACJ,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC;YACvC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAA6B,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC;IAC3E,CAAC;CACF;AAED,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,KAAK,YAAY,QAAQ,CAAC;AACnC,CAAC"}
|