@ercworldio/blockchain-shared 1.0.2-dev.0 → 1.0.2-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -0
- package/build/chains/networks_dev.json +29 -8
- package/build/chains/networks_prod-dz.json +150 -2
- package/build/chains/networks_stg-dz.json +22 -0
- package/build/errors/errors.d.ts +9 -2
- package/build/errors/errors.d.ts.map +1 -1
- package/build/errors/errors.js +16 -2
- package/build/services/types/chain_manager.d.ts +1 -0
- package/build/services/types/chain_manager.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1 +1,27 @@
|
|
|
1
1
|
## README
|
|
2
|
+
|
|
3
|
+
# blockchain-shared
|
|
4
|
+
|
|
5
|
+
Shared TypeScript library for multi-chain blockchain infrastructure used across projectx services.
|
|
6
|
+
|
|
7
|
+
## What it does
|
|
8
|
+
|
|
9
|
+
- Manages deposit addresses, wallet indexes, and custodial/hot wallets
|
|
10
|
+
- Handles balances, withdrawals, sweeps, and claims across chains
|
|
11
|
+
- Abstracts RPC providers and chain configuration
|
|
12
|
+
- Processes on-chain events via Alchemy and Quicknode webhooks
|
|
13
|
+
- Integrates with Azure KeyVault, Redis, and PostgreSQL
|
|
14
|
+
|
|
15
|
+
## Supported chains
|
|
16
|
+
|
|
17
|
+
EVM (Ethereum, BSC, Avalanche, Polygon, Fantom, Bitlayer, Monad), Solana, Tron, Bitcoin, Lightning
|
|
18
|
+
|
|
19
|
+
## Stack
|
|
20
|
+
|
|
21
|
+
TypeScript · ethers.js v6 · @solana/web3.js · TronWeb · TypeORM · Redis · Azure
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install @ercworldio/blockchain-shared
|
|
27
|
+
```
|
|
@@ -45,7 +45,10 @@
|
|
|
45
45
|
"treasury_receiver": "TN4tXH5F36BxWEe8UQuUeMr1EuPwJjNUFJ",
|
|
46
46
|
"overflow_treasury_receiver": "TCdE3ZGvBjUcqVCreT25SWwF36gkiLYTGD",
|
|
47
47
|
"overflow_threshold_decimal": 100000,
|
|
48
|
-
"min_funding_wallet_balance_usd": 5
|
|
48
|
+
"min_funding_wallet_balance_usd": 5,
|
|
49
|
+
"allowed_receivers": [
|
|
50
|
+
"TCdE3ZGvBjUcqVCreT25SWwF36gkiLYTGD"
|
|
51
|
+
]
|
|
49
52
|
},
|
|
50
53
|
"rpcBaseUrl": "https://api.nileex.io",
|
|
51
54
|
"rpcBaseUrlWss": "",
|
|
@@ -104,13 +107,16 @@
|
|
|
104
107
|
"blockexplorerUrl": "https://solscan.io/?cluster=devnet",
|
|
105
108
|
"rpcBaseUrl": "https://rpc.ankr.com/solana_devnet",
|
|
106
109
|
"rpcBaseUrlWss": "wss://rpc.ankr.com/solana_devnet/ws",
|
|
107
|
-
"targetConfirmations":
|
|
110
|
+
"targetConfirmations": 32,
|
|
108
111
|
"accounting": {
|
|
109
112
|
"funding_wallet": "GLfRJqsRtTNDVvYVccXrz8RCKNnad2hqQfgFaApAKXCq",
|
|
110
113
|
"treasury_receiver": "AAuFzrm6H4Vv7UyJi8R5Gsm4ixtR2yVmqzLmuyUTS5cu",
|
|
111
114
|
"overflow_treasury_receiver": "GLfRJqsRtTNDVvYVccXrz8RCKNnad2hqQfgFaApAKXCq",
|
|
112
115
|
"overflow_threshold_decimal": 100000,
|
|
113
|
-
"min_funding_wallet_balance_usd": 5
|
|
116
|
+
"min_funding_wallet_balance_usd": 5,
|
|
117
|
+
"allowed_receivers": [
|
|
118
|
+
"AAuFzrm6H4Vv7UyJi8R5Gsm4ixtR2yVmqzLmuyUTS5cu"
|
|
119
|
+
]
|
|
114
120
|
},
|
|
115
121
|
"custodialAlchemyWebhooks": [
|
|
116
122
|
{
|
|
@@ -204,7 +210,10 @@
|
|
|
204
210
|
"treasury_receiver": "0xaD372aCDd0F14A9430Af29DaEc8229A9F109d7F5",
|
|
205
211
|
"overflow_treasury_receiver": "0xF84a78E56fBACAADd73E59eDAe02b3b80e4966C8",
|
|
206
212
|
"overflow_threshold_decimal": 100000,
|
|
207
|
-
"min_funding_wallet_balance_usd": 5
|
|
213
|
+
"min_funding_wallet_balance_usd": 5,
|
|
214
|
+
"allowed_receivers": [
|
|
215
|
+
"0xaD372aCDd0F14A9430Af29DaEc8229A9F109d7F5"
|
|
216
|
+
]
|
|
208
217
|
},
|
|
209
218
|
"custodialAlchemyWebhooks": [
|
|
210
219
|
{
|
|
@@ -364,7 +373,10 @@
|
|
|
364
373
|
"treasury_receiver": "0x89DecB6b265D7714A69EE05E3Bc50Fd829D7Ef90",
|
|
365
374
|
"overflow_treasury_receiver": "0xF84a78E56fBACAADd73E59eDAe02b3b80e4966C8",
|
|
366
375
|
"overflow_threshold_decimal": 100000,
|
|
367
|
-
"min_funding_wallet_balance_usd": 5
|
|
376
|
+
"min_funding_wallet_balance_usd": 5,
|
|
377
|
+
"allowed_receivers": [
|
|
378
|
+
"0x89DecB6b265D7714A69EE05E3Bc50Fd829D7Ef90"
|
|
379
|
+
]
|
|
368
380
|
},
|
|
369
381
|
"custodialAlchemyWebhooks": [
|
|
370
382
|
{
|
|
@@ -466,7 +478,10 @@
|
|
|
466
478
|
"treasury_receiver": "0xEA8Ad078561B83724EEcDBb5b5A4f03369115Cf8",
|
|
467
479
|
"overflow_treasury_receiver": "0xF84a78E56fBACAADd73E59eDAe02b3b80e4966C8",
|
|
468
480
|
"overflow_threshold_decimal": 100000,
|
|
469
|
-
"min_funding_wallet_balance_usd": 5
|
|
481
|
+
"min_funding_wallet_balance_usd": 5,
|
|
482
|
+
"allowed_receivers": [
|
|
483
|
+
"0xEA8Ad078561B83724EEcDBb5b5A4f03369115Cf8"
|
|
484
|
+
]
|
|
470
485
|
},
|
|
471
486
|
"custodialAlchemyWebhooks": [
|
|
472
487
|
{
|
|
@@ -554,7 +569,10 @@
|
|
|
554
569
|
"treasury_receiver": "0x69E1F9316E03Da502B52f4682b0349d36CFBfFfD",
|
|
555
570
|
"overflow_treasury_receiver": "0xF84a78E56fBACAADd73E59eDAe02b3b80e4966C8",
|
|
556
571
|
"overflow_threshold_decimal": 100000,
|
|
557
|
-
"min_funding_wallet_balance_usd": 1
|
|
572
|
+
"min_funding_wallet_balance_usd": 1,
|
|
573
|
+
"allowed_receivers": [
|
|
574
|
+
"0x69E1F9316E03Da502B52f4682b0349d36CFBfFfD"
|
|
575
|
+
]
|
|
558
576
|
},
|
|
559
577
|
"custodialAlchemyWebhooks": [
|
|
560
578
|
{
|
|
@@ -641,7 +659,10 @@
|
|
|
641
659
|
"treasury_receiver": "0xf4BE5695F5eCd281171ab625ceb59bEee081e14f",
|
|
642
660
|
"overflow_treasury_receiver": "0xF84a78E56fBACAADd73E59eDAe02b3b80e4966C8",
|
|
643
661
|
"overflow_threshold_decimal": 100000,
|
|
644
|
-
"min_funding_wallet_balance_usd": 0.5
|
|
662
|
+
"min_funding_wallet_balance_usd": 0.5,
|
|
663
|
+
"allowed_receivers": [
|
|
664
|
+
"0xf4BE5695F5eCd281171ab625ceb59bEee081e14f"
|
|
665
|
+
]
|
|
645
666
|
},
|
|
646
667
|
"custodialAlchemyWebhooks": [
|
|
647
668
|
{
|
|
@@ -26,6 +26,20 @@
|
|
|
26
26
|
"source": "wallet"
|
|
27
27
|
}
|
|
28
28
|
],
|
|
29
|
+
"quicknodeNotificationConfig": [
|
|
30
|
+
{
|
|
31
|
+
"name": "escrow-eth-prod-dz",
|
|
32
|
+
"network": "ethereum-mainnet",
|
|
33
|
+
"template": "evmWalletFilter",
|
|
34
|
+
"source": "contract",
|
|
35
|
+
"chain_id": 1
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "qn-custodial-webhook-eth-prod-dz",
|
|
39
|
+
"network": "ethereum-mainnet",
|
|
40
|
+
"template": "evmWalletFilter"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
29
43
|
"contracts": [
|
|
30
44
|
{
|
|
31
45
|
"type": "Escrow",
|
|
@@ -88,6 +102,17 @@
|
|
|
88
102
|
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
89
103
|
"sweepThreshold": 4,
|
|
90
104
|
"sweepWalletMinBalance": 1
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "PalmUSD",
|
|
108
|
+
"symbol": "PUSD",
|
|
109
|
+
"token_standard": "ERC-20",
|
|
110
|
+
"type": "erc20",
|
|
111
|
+
"isStableCoin": true,
|
|
112
|
+
"decimals": 6,
|
|
113
|
+
"address": "0xFAF0cEe6B20e2Aaa4B80748a6AF4CD89609a3d78",
|
|
114
|
+
"sweepThreshold": 1,
|
|
115
|
+
"sweepWalletMinBalance": 0.1
|
|
91
116
|
}
|
|
92
117
|
]
|
|
93
118
|
},
|
|
@@ -118,6 +143,20 @@
|
|
|
118
143
|
"source": "wallet"
|
|
119
144
|
}
|
|
120
145
|
],
|
|
146
|
+
"quicknodeNotificationConfig": [
|
|
147
|
+
{
|
|
148
|
+
"name": "escrow-bnb-prod-dz",
|
|
149
|
+
"network": "bnbchain-mainnet",
|
|
150
|
+
"template": "evmWalletFilter",
|
|
151
|
+
"source": "contract",
|
|
152
|
+
"chain_id": 56
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "qn-custodial-webhook-bnb-prod-dz",
|
|
156
|
+
"network": "bnbchain-mainnet",
|
|
157
|
+
"template": "evmWalletFilter"
|
|
158
|
+
}
|
|
159
|
+
],
|
|
121
160
|
"contracts": [
|
|
122
161
|
{
|
|
123
162
|
"type": "Escrow",
|
|
@@ -201,14 +240,14 @@
|
|
|
201
240
|
],
|
|
202
241
|
"quicknodeNotificationConfig": [
|
|
203
242
|
{
|
|
204
|
-
"name": "escrow-sol-prod-
|
|
243
|
+
"name": "escrow-sol-prod-dz",
|
|
205
244
|
"network": "solana-mainnet",
|
|
206
245
|
"template": "solanaWalletFilter",
|
|
207
246
|
"source": "contract",
|
|
208
247
|
"chain_id": 101
|
|
209
248
|
},
|
|
210
249
|
{
|
|
211
|
-
"name": "qn-custodial-webhook-sol-prod-
|
|
250
|
+
"name": "qn-custodial-webhook-sol-prod-dz",
|
|
212
251
|
"network": "solana-mainnet",
|
|
213
252
|
"template": "solanaWalletFilter"
|
|
214
253
|
}
|
|
@@ -264,6 +303,17 @@
|
|
|
264
303
|
"address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
265
304
|
"sweepThreshold": 1,
|
|
266
305
|
"sweepWalletMinBalance": 1
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"name": "PalmUSD",
|
|
309
|
+
"symbol": "PUSD",
|
|
310
|
+
"token_standard": "SOL",
|
|
311
|
+
"type": "erc20",
|
|
312
|
+
"isStableCoin": true,
|
|
313
|
+
"decimals": 6,
|
|
314
|
+
"address": "CZzgUBvxaMLwMhVSLgqJn3npmxoTo6nzMNQPAnwtHF3s",
|
|
315
|
+
"sweepThreshold": 1,
|
|
316
|
+
"sweepWalletMinBalance": 0.1
|
|
267
317
|
}
|
|
268
318
|
]
|
|
269
319
|
},
|
|
@@ -294,6 +344,20 @@
|
|
|
294
344
|
"source": "wallet"
|
|
295
345
|
}
|
|
296
346
|
],
|
|
347
|
+
"quicknodeNotificationConfig": [
|
|
348
|
+
{
|
|
349
|
+
"name": "escrow-pol-prod-dz",
|
|
350
|
+
"network": "polygon-mainnet",
|
|
351
|
+
"template": "evmWalletFilter",
|
|
352
|
+
"source": "contract",
|
|
353
|
+
"chain_id": 137
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"name": "qn-custodial-webhook-pol-prod-dz",
|
|
357
|
+
"network": "bnbchain-mainnet",
|
|
358
|
+
"template": "evmWalletFilter"
|
|
359
|
+
}
|
|
360
|
+
],
|
|
297
361
|
"contracts": [
|
|
298
362
|
{
|
|
299
363
|
"type": "Escrow",
|
|
@@ -348,6 +412,90 @@
|
|
|
348
412
|
}
|
|
349
413
|
]
|
|
350
414
|
},
|
|
415
|
+
"143": {
|
|
416
|
+
"status": true,
|
|
417
|
+
"isTestnet": false,
|
|
418
|
+
"name": "Monad",
|
|
419
|
+
"blockchainType": "evm",
|
|
420
|
+
"chainId": 143,
|
|
421
|
+
"blockexplorerUrl": "https://monadscan.com",
|
|
422
|
+
"rpcBaseUrl": "https://rpc.ankr.com/monad_mainnet",
|
|
423
|
+
"rpcBaseUrlWss": "wss://rpc.ankr.com/monad_mainnet/ws",
|
|
424
|
+
"targetConfirmations": 10,
|
|
425
|
+
"accounting": {
|
|
426
|
+
"funding_wallet": "0x9Ea8Fb697981Fe83599E3F90b0Bd77E3a3253fE7",
|
|
427
|
+
"treasury_receiver": "0x567559911E22E461a449BB036fE4C44464aaa664",
|
|
428
|
+
"overflow_treasury_receiver": "0x9ec71A61106a84048D19bDb4D27EbBcD4f12fd2e",
|
|
429
|
+
"overflow_threshold_decimal": 100000,
|
|
430
|
+
"min_funding_wallet_balance_usd": 5
|
|
431
|
+
},
|
|
432
|
+
"custodialAlchemyWebhooks": [
|
|
433
|
+
{
|
|
434
|
+
"chainId": "143",
|
|
435
|
+
"network_symbol": "mon",
|
|
436
|
+
"network": "MONAD_MAINNET",
|
|
437
|
+
"total_wallet_count": 10,
|
|
438
|
+
"endpoint": "webhook/alchemy/address-activity-mon",
|
|
439
|
+
"source": "wallet"
|
|
440
|
+
}
|
|
441
|
+
],
|
|
442
|
+
"quicknodeNotificationConfig": [
|
|
443
|
+
{
|
|
444
|
+
"name": "escrow-mon-prod-dz",
|
|
445
|
+
"network": "monad-mainnet",
|
|
446
|
+
"template": "evmWalletFilter",
|
|
447
|
+
"source": "contract",
|
|
448
|
+
"chain_id": 143
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
"name": "qn-custodial-webhook-mon-prod-dz",
|
|
452
|
+
"network": "monad-mainnet",
|
|
453
|
+
"template": "evmWalletFilter"
|
|
454
|
+
}
|
|
455
|
+
],
|
|
456
|
+
"contracts": [
|
|
457
|
+
{
|
|
458
|
+
"type": "Escrow",
|
|
459
|
+
"version": "1",
|
|
460
|
+
"startingBlock": 56816192,
|
|
461
|
+
"escrowAlchemyWebhooks": [
|
|
462
|
+
{
|
|
463
|
+
"chainId": "143",
|
|
464
|
+
"network_symbol": "mon",
|
|
465
|
+
"network": "MONAD_MAINNET",
|
|
466
|
+
"type": "GRAPHQL",
|
|
467
|
+
"endpoint": "webhook/alchemy/escrow-events",
|
|
468
|
+
"source": "contract"
|
|
469
|
+
}
|
|
470
|
+
],
|
|
471
|
+
"addresses": [
|
|
472
|
+
"0x567559911E22E461a449BB036fE4C44464aaa664"
|
|
473
|
+
]
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
"type": "FundingWallet",
|
|
477
|
+
"version": "1",
|
|
478
|
+
"startingBlock": 1,
|
|
479
|
+
"escrowAlchemyWebhooks": [],
|
|
480
|
+
"addresses": [
|
|
481
|
+
"0x9Ea8Fb697981Fe83599E3F90b0Bd77E3a3253fE7"
|
|
482
|
+
]
|
|
483
|
+
}
|
|
484
|
+
],
|
|
485
|
+
"paymentTokens": [
|
|
486
|
+
{
|
|
487
|
+
"name": "Monad",
|
|
488
|
+
"symbol": "MON",
|
|
489
|
+
"token_standard": "ERC-20",
|
|
490
|
+
"type": "native",
|
|
491
|
+
"decimals": 18,
|
|
492
|
+
"address": "0x0000000000000000000000000000000000000000",
|
|
493
|
+
"isStableCoin": false,
|
|
494
|
+
"sweepThreshold": 10,
|
|
495
|
+
"sweepWalletMinBalance": 0.1
|
|
496
|
+
}
|
|
497
|
+
]
|
|
498
|
+
},
|
|
351
499
|
"43114": {
|
|
352
500
|
"status": true,
|
|
353
501
|
"isTestnet": false,
|
|
@@ -88,6 +88,17 @@
|
|
|
88
88
|
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
89
89
|
"sweepThreshold": 1,
|
|
90
90
|
"sweepWalletMinBalance": 0.1
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "PalmUSD",
|
|
94
|
+
"symbol": "PUSD",
|
|
95
|
+
"token_standard": "ERC-20",
|
|
96
|
+
"type": "erc20",
|
|
97
|
+
"isStableCoin": true,
|
|
98
|
+
"decimals": 6,
|
|
99
|
+
"address": "0xFAF0cEe6B20e2Aaa4B80748a6AF4CD89609a3d78",
|
|
100
|
+
"sweepThreshold": 1,
|
|
101
|
+
"sweepWalletMinBalance": 0.1
|
|
91
102
|
}
|
|
92
103
|
]
|
|
93
104
|
},
|
|
@@ -250,6 +261,17 @@
|
|
|
250
261
|
"address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
251
262
|
"sweepThreshold": 1,
|
|
252
263
|
"sweepWalletMinBalance": 0.1
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"name": "PalmUSD",
|
|
267
|
+
"symbol": "PUSD",
|
|
268
|
+
"token_standard": "SOL",
|
|
269
|
+
"type": "erc20",
|
|
270
|
+
"isStableCoin": true,
|
|
271
|
+
"decimals": 6,
|
|
272
|
+
"address": "CZzgUBvxaMLwMhVSLgqJn3npmxoTo6nzMNQPAnwtHF3s",
|
|
273
|
+
"sweepThreshold": 1,
|
|
274
|
+
"sweepWalletMinBalance": 0.1
|
|
253
275
|
}
|
|
254
276
|
]
|
|
255
277
|
},
|
package/build/errors/errors.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export declare const ErrorMessages: {
|
|
|
15
15
|
readonly INVALID_PAYMENT_TOKEN: "The payment token provided is not recognized";
|
|
16
16
|
readonly UNEXPECTED_PAYMENT_TOKEN: "The selected payment token is not supported on this network";
|
|
17
17
|
readonly NOT_FOUND: "The requested resource was not found";
|
|
18
|
-
readonly CHAIN_CONFIG_NOT_SET: "Chain configuration is missing. Please contact support";
|
|
19
18
|
readonly UNEXPECTED_ERROR: "An unexpected error occurred. Please try again later";
|
|
20
19
|
readonly DATABASE_NOT_INITIALIZED: "Database connection is not available";
|
|
21
20
|
readonly INVALID_USER_ID: "The provided user ID is invalid";
|
|
@@ -52,6 +51,10 @@ export declare const ErrorMessages: {
|
|
|
52
51
|
readonly UNEXPECTED_ADDRESS_FORMAT: "The address does not match the expected format for the selected network";
|
|
53
52
|
readonly EMPTY_PAYLOAD: "Request payload cannot be empty";
|
|
54
53
|
readonly ONLY_STABLECOIN_WITHDRAWAL: "This network only supports stablecoin withdrawals";
|
|
54
|
+
/** Chain Config Related */
|
|
55
|
+
readonly CHAIN_CONFIG_NOT_SET: "Chain configuration is missing. Please contact support";
|
|
56
|
+
readonly ALLOWED_RECEIVERS_CONFIG_NOT_SET: "Allowed receiver addresses not configured. Please contact support";
|
|
57
|
+
readonly ACCOUNTING_CONFIG_NOT_SET: "Accounting configuration is missing. Please contact support";
|
|
55
58
|
};
|
|
56
59
|
export declare const ErrorCodes: {
|
|
57
60
|
readonly INTERNAL_SERVER: "error.internal_server_error";
|
|
@@ -66,7 +69,6 @@ export declare const ErrorCodes: {
|
|
|
66
69
|
readonly INVALID_PAYMENT_TOKEN: "error.invalid_payment_token";
|
|
67
70
|
readonly UNEXPECTED_PAYMENT_TOKEN: "error.unexpected_payment_token";
|
|
68
71
|
readonly NOT_FOUND: "error.not_found";
|
|
69
|
-
readonly CHAIN_CONFIG_NOT_SET: "error.chain_config_not_set";
|
|
70
72
|
readonly UNEXPECTED_ERROR: "error.unexpected_error";
|
|
71
73
|
readonly DATABASE_NOT_INITIALIZED: "error.database_not_initialized";
|
|
72
74
|
readonly INVALID_USER_ID: "error.invalid_user_id";
|
|
@@ -102,6 +104,9 @@ export declare const ErrorCodes: {
|
|
|
102
104
|
readonly UNEXPECTED_ADDRESS_FORMAT: "error.unexpected_address_format";
|
|
103
105
|
readonly EMPTY_PAYLOAD: "error.empty_payload";
|
|
104
106
|
readonly ONLY_STABLECOIN_WITHDRAWAL: "error.only_stablecoin_withdrawal";
|
|
107
|
+
readonly CHAIN_CONFIG_NOT_SET: "error.chain_config_not_set";
|
|
108
|
+
readonly ACCOUNTING_CONFIG_NOT_SET: "error.accounting_config_not_set";
|
|
109
|
+
readonly ALLOWED_RECEIVERS_CONFIG_NOT_SET: "error.allowed_receivers_config_not_set";
|
|
105
110
|
};
|
|
106
111
|
export type ErrorCode = typeof ErrorCodes[keyof typeof ErrorCodes];
|
|
107
112
|
export interface ErrorCodeEntry {
|
|
@@ -166,6 +171,8 @@ declare class BaseErrors {
|
|
|
166
171
|
UnexpectedPaymentToken(_?: any): "The selected payment token is not supported on this network";
|
|
167
172
|
NotFound(_?: any): "The requested resource was not found";
|
|
168
173
|
ChainConfigNotSet(_?: any): "Chain configuration is missing. Please contact support";
|
|
174
|
+
AccountingNotSet(): "Accounting configuration is missing. Please contact support";
|
|
175
|
+
AllowedReceiversNotSet(): "Allowed receiver addresses not configured. Please contact support";
|
|
169
176
|
UnexpectedError(_?: any): "An unexpected error occurred. Please try again later";
|
|
170
177
|
NotInitializedDatabase(_?: any): "Database connection is not available";
|
|
171
178
|
InvalidUserId(_?: any): "The provided user ID is invalid";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors/errors.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors/errors.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsFtB,2BAA2B;;;;CAKrB,CAAC;AAEX,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Db,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,OAAO,UAAU,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEnE,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,SAAS,CA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AE,GAAG;IAC5B,mBAAmB,CAAC,CAAC,CAAC,EAAE,GAAG;IAC3B,cAAc,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM;IAC/B,yBAAyB,CAAC,CAAC,CAAC,EAAE,GAAG;IACjC,gBAAgB,CAAC,CAAC,CAAC,EAAE,GAAG;IACxB,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG;IAE5B,sBAAsB;IACf,YAAY,GAAI,OAAO,GAAG,EAAE,eAAe,MAAM,KAAG,oBAAoB,CAuB9E;IAEM,mBAAmB,GAAI,SAAS,MAAM,KAAG,cAAc,GAAG,IAAI,CA2BpE;CACJ;AAED,eAAe,UAAU,CAAC"}
|
package/build/errors/errors.js
CHANGED
|
@@ -28,7 +28,6 @@ exports.ErrorMessages = {
|
|
|
28
28
|
UNEXPECTED_PAYMENT_TOKEN: "The selected payment token is not supported on this network",
|
|
29
29
|
// 400
|
|
30
30
|
NOT_FOUND: "The requested resource was not found",
|
|
31
|
-
CHAIN_CONFIG_NOT_SET: "Chain configuration is missing. Please contact support",
|
|
32
31
|
UNEXPECTED_ERROR: "An unexpected error occurred. Please try again later",
|
|
33
32
|
DATABASE_NOT_INITIALIZED: "Database connection is not available",
|
|
34
33
|
// 400
|
|
@@ -91,6 +90,10 @@ exports.ErrorMessages = {
|
|
|
91
90
|
EMPTY_PAYLOAD: "Request payload cannot be empty",
|
|
92
91
|
// 400
|
|
93
92
|
ONLY_STABLECOIN_WITHDRAWAL: "This network only supports stablecoin withdrawals",
|
|
93
|
+
/** Chain Config Related */
|
|
94
|
+
CHAIN_CONFIG_NOT_SET: "Chain configuration is missing. Please contact support",
|
|
95
|
+
ALLOWED_RECEIVERS_CONFIG_NOT_SET: "Allowed receiver addresses not configured. Please contact support",
|
|
96
|
+
ACCOUNTING_CONFIG_NOT_SET: "Accounting configuration is missing. Please contact support",
|
|
94
97
|
};
|
|
95
98
|
exports.ErrorCodes = {
|
|
96
99
|
INTERNAL_SERVER: 'error.internal_server_error',
|
|
@@ -105,7 +108,6 @@ exports.ErrorCodes = {
|
|
|
105
108
|
INVALID_PAYMENT_TOKEN: 'error.invalid_payment_token',
|
|
106
109
|
UNEXPECTED_PAYMENT_TOKEN: 'error.unexpected_payment_token',
|
|
107
110
|
NOT_FOUND: 'error.not_found',
|
|
108
|
-
CHAIN_CONFIG_NOT_SET: 'error.chain_config_not_set',
|
|
109
111
|
UNEXPECTED_ERROR: 'error.unexpected_error',
|
|
110
112
|
DATABASE_NOT_INITIALIZED: 'error.database_not_initialized',
|
|
111
113
|
INVALID_USER_ID: 'error.invalid_user_id',
|
|
@@ -146,6 +148,10 @@ exports.ErrorCodes = {
|
|
|
146
148
|
UNEXPECTED_ADDRESS_FORMAT: 'error.unexpected_address_format',
|
|
147
149
|
EMPTY_PAYLOAD: 'error.empty_payload',
|
|
148
150
|
ONLY_STABLECOIN_WITHDRAWAL: 'error.only_stablecoin_withdrawal',
|
|
151
|
+
// Chain/Network Config
|
|
152
|
+
CHAIN_CONFIG_NOT_SET: 'error.chain_config_not_set',
|
|
153
|
+
ACCOUNTING_CONFIG_NOT_SET: 'error.accounting_config_not_set',
|
|
154
|
+
ALLOWED_RECEIVERS_CONFIG_NOT_SET: 'error.allowed_receivers_config_not_set',
|
|
149
155
|
};
|
|
150
156
|
class BaseErrors {
|
|
151
157
|
constructor() {
|
|
@@ -229,6 +235,10 @@ class BaseErrors {
|
|
|
229
235
|
return Object.assign(Object.assign({}, this.codes[401]), { error_code: exports.ErrorCodes.PAYMENT_REQUEST_NOT_APPROVED });
|
|
230
236
|
if (message.includes("deposit address already exists"))
|
|
231
237
|
return Object.assign(Object.assign({}, this.codes[409]), { error_code: exports.ErrorCodes.ADDRESS_EXISTS });
|
|
238
|
+
if (message.includes(exports.ErrorMessages.ACCOUNTING_CONFIG_NOT_SET))
|
|
239
|
+
return Object.assign(Object.assign({}, this.codes[500]), { error_code: exports.ErrorCodes.ACCOUNTING_CONFIG_NOT_SET });
|
|
240
|
+
if (message.includes(exports.ErrorMessages.ALLOWED_RECEIVERS_CONFIG_NOT_SET))
|
|
241
|
+
return Object.assign(Object.assign({}, this.codes[500]), { error_code: exports.ErrorCodes.ALLOWED_RECEIVERS_CONFIG_NOT_SET });
|
|
232
242
|
return null;
|
|
233
243
|
};
|
|
234
244
|
}
|
|
@@ -257,6 +267,10 @@ class BaseErrors {
|
|
|
257
267
|
;
|
|
258
268
|
ChainConfigNotSet(_) { return exports.ErrorMessages.CHAIN_CONFIG_NOT_SET; }
|
|
259
269
|
;
|
|
270
|
+
AccountingNotSet() { return exports.ErrorMessages.ACCOUNTING_CONFIG_NOT_SET; }
|
|
271
|
+
;
|
|
272
|
+
AllowedReceiversNotSet() { return exports.ErrorMessages.ALLOWED_RECEIVERS_CONFIG_NOT_SET; }
|
|
273
|
+
;
|
|
260
274
|
UnexpectedError(_) { return exports.ErrorMessages.UNEXPECTED_ERROR; }
|
|
261
275
|
;
|
|
262
276
|
NotInitializedDatabase(_) { return exports.ErrorMessages.DATABASE_NOT_INITIALIZED; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain_manager.d.ts","sourceRoot":"","sources":["../../../src/services/types/chain_manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAElD,MAAM,MAAM,6BAA6B,GAAG;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,qBAAqB,CAAC;IAC/B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,UAAU,GAAG,QAAQ,CAAC;CACjC,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,oBAAoB,GAAG,iBAAiB,CAA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