@wirexapp/wpay-baas-sdk 0.1.9 → 0.1.10
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 +8 -1
- package/dist/{chunk-NYDDEDPQ.js → chunk-GOPZA7GB.js} +139 -69
- package/dist/chunk-GOPZA7GB.js.map +1 -0
- package/dist/{chunk-D2YHFKQI.js → chunk-RIB34JK2.js} +3 -3
- package/dist/{chunk-D2YHFKQI.js.map → chunk-RIB34JK2.js.map} +1 -1
- package/dist/{chunk-YXNNTBO5.js → chunk-XYHCKANZ.js} +23 -3
- package/dist/chunk-XYHCKANZ.js.map +1 -0
- package/dist/core/index.d.ts +7 -3
- package/dist/core/index.js +1 -1
- package/dist/{crypto.module-BsI4pLhf.d.ts → crypto.module-b1_0pvdU.d.ts} +3 -3
- package/dist/{index-3P-X9tLg.d.ts → index-Bi3ZpwPK.d.ts} +2 -2
- package/dist/index.d.ts +7 -7
- package/dist/index.js +22 -9
- package/dist/index.js.map +1 -1
- package/dist/modules/api/index.d.ts +3 -3
- package/dist/modules/api/index.js +2 -2
- package/dist/modules/crypto/index.d.ts +15 -5
- package/dist/modules/crypto/index.js +3 -3
- package/dist/{types-_RME4STd.d.ts → types-BVFY0JJu.d.ts} +7 -1
- package/dist/{withdrawal.api-CmRHIoyc.d.ts → withdrawal.api-DhpWX0eX.d.ts} +1 -1
- package/package.json +3 -3
- package/dist/chunk-NYDDEDPQ.js.map +0 -1
- package/dist/chunk-YXNNTBO5.js.map +0 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ SDK for integration with the WirexPay platform. Supports Account Abstraction (Ze
|
|
|
8
8
|
npm install @wirexapp/wpay-baas-sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
**Peer dependency:** `viem ^2.
|
|
11
|
+
**Peer dependency:** `viem ^2.49.3`
|
|
12
12
|
|
|
13
13
|
## SDK Initialization
|
|
14
14
|
|
|
@@ -18,6 +18,7 @@ import { createSDK, type SDKEnvironment } from '@wirexapp/wpay-baas-sdk';
|
|
|
18
18
|
const sdk = await createSDK({
|
|
19
19
|
env: 'dev', // 'dev' | 'prod'
|
|
20
20
|
companyId: '0x...', // Company ID in hex format
|
|
21
|
+
chainId: 8453, // optional, defaults to the remote config's defaultChain
|
|
21
22
|
getMainWalletClient: () => mainWalletClient, // Embedded wallet with EtheriumProvider
|
|
22
23
|
enableLogging: true, // optional, default false
|
|
23
24
|
logger: customLogger, // optional, custom logger
|
|
@@ -30,9 +31,13 @@ const sdk = await createSDK({
|
|
|
30
31
|
|-----------|------|----------|-------------|
|
|
31
32
|
| `env` | `'dev' \| 'prod'` | Yes | Environment |
|
|
32
33
|
| `companyId` | `string` | Yes | Company ID in hex format |
|
|
34
|
+
| `companyName` | `string` | No | Sent as `X-Company-Name` on the remote-config fetch, selects that company's chain / contracts / default company |
|
|
35
|
+
| `configUrl` | `string` | No | Explicit remote-config URL, overrides `env` |
|
|
36
|
+
| `chainId` | `number` | No | Chain to run on: `8453` Base, `84532` Base Sepolia, `5042` Arc, `5042002` Arc Testnet. Defaults to remote config `defaultChain` |
|
|
33
37
|
| `getMainWalletClient` | `() => MainWalletClient` | Yes | Function that returns embedded wallet with EtheriumProvider |
|
|
34
38
|
| `enableLogging` | `boolean` | No | Enable logging (default `false`) |
|
|
35
39
|
| `logger` | `Logger` | No | Custom logger (requires `enableLogging: true`) |
|
|
40
|
+
| `rhinoApiKey` | `string` | No | Rhino.fi API key, required only for `sdk.crypto.smartDepositAddress` |
|
|
36
41
|
|
|
37
42
|
---
|
|
38
43
|
|
|
@@ -333,6 +338,8 @@ interface YieldData {
|
|
|
333
338
|
- EVM: Base, Arbitrum, BNB Chain, Ethereum, Kaia, Polygon, Optimism
|
|
334
339
|
- TRON
|
|
335
340
|
- Solana
|
|
341
|
+
- Stellar
|
|
342
|
+
- Solana
|
|
336
343
|
|
|
337
344
|
---
|
|
338
345
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AuthService, WithdrawalApi } from './chunk-
|
|
2
|
-
import { ContractError, ConfigurationError } from './chunk-
|
|
1
|
+
import { AuthService, WithdrawalApi } from './chunk-RIB34JK2.js';
|
|
2
|
+
import { withBuilderCode, ContractError, ConfigurationError } from './chunk-XYHCKANZ.js';
|
|
3
3
|
import { toPermissionValidator } from '@zerodev/permissions';
|
|
4
4
|
import { toSudoPolicy } from '@zerodev/permissions/policies';
|
|
5
5
|
import { toECDSASigner } from '@zerodev/permissions/signers';
|
|
@@ -3461,6 +3461,7 @@ var BaseAccountAbstractionService = class {
|
|
|
3461
3461
|
this.kernelPublicClient = config.kernelPublicClient;
|
|
3462
3462
|
this.contracts = config.contracts;
|
|
3463
3463
|
this.walletService = config.walletService;
|
|
3464
|
+
this.chainId = config.chainId;
|
|
3464
3465
|
this.logger = config.logger;
|
|
3465
3466
|
}
|
|
3466
3467
|
async isExecutorInstalled() {
|
|
@@ -3534,42 +3535,51 @@ var BaseAccountAbstractionService = class {
|
|
|
3534
3535
|
const smartWalletClient = await this.walletService.getSmartWalletClientWithoutPolicy();
|
|
3535
3536
|
const executorCallData = await this.getExecutorCallData();
|
|
3536
3537
|
const policyCallData = await this.getPolicyCallData();
|
|
3537
|
-
const calls =
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3538
|
+
const calls = withBuilderCode(
|
|
3539
|
+
await smartWalletClient.account.encodeCalls([
|
|
3540
|
+
{
|
|
3541
|
+
to: smartWalletClient.account.address,
|
|
3542
|
+
value: BigInt(0),
|
|
3543
|
+
data: executorCallData
|
|
3544
|
+
},
|
|
3545
|
+
{
|
|
3546
|
+
to: smartWalletClient.account.address,
|
|
3547
|
+
value: BigInt(0),
|
|
3548
|
+
data: policyCallData
|
|
3549
|
+
}
|
|
3550
|
+
]),
|
|
3551
|
+
this.chainId
|
|
3552
|
+
);
|
|
3549
3553
|
return await this.walletService.sendUserOperationsAndWaitReceipt(calls, smartWalletClient);
|
|
3550
3554
|
}
|
|
3551
3555
|
async signInPolicy() {
|
|
3552
3556
|
const smartWalletClient = await this.walletService.getSmartWalletClientWithoutPolicy();
|
|
3553
3557
|
const policyCallData = await this.getPolicyCallData();
|
|
3554
|
-
const calls =
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3558
|
+
const calls = withBuilderCode(
|
|
3559
|
+
await smartWalletClient.account.encodeCalls([
|
|
3560
|
+
{
|
|
3561
|
+
to: smartWalletClient.account.address,
|
|
3562
|
+
value: BigInt(0),
|
|
3563
|
+
data: policyCallData
|
|
3564
|
+
}
|
|
3565
|
+
]),
|
|
3566
|
+
this.chainId
|
|
3567
|
+
);
|
|
3561
3568
|
return await this.walletService.sendUserOperationsAndWaitReceipt(calls, smartWalletClient);
|
|
3562
3569
|
}
|
|
3563
3570
|
async signInExecutor() {
|
|
3564
3571
|
const smartWalletClient = await this.walletService.getSmartWalletClientWithoutPolicy();
|
|
3565
3572
|
const policyCallData = await this.getExecutorCallData();
|
|
3566
|
-
const calls =
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
+
const calls = withBuilderCode(
|
|
3574
|
+
await smartWalletClient.account.encodeCalls([
|
|
3575
|
+
{
|
|
3576
|
+
to: smartWalletClient.account.address,
|
|
3577
|
+
value: BigInt(0),
|
|
3578
|
+
data: policyCallData
|
|
3579
|
+
}
|
|
3580
|
+
]),
|
|
3581
|
+
this.chainId
|
|
3582
|
+
);
|
|
3573
3583
|
return await this.walletService.sendUserOperationsAndWaitReceipt(calls, smartWalletClient);
|
|
3574
3584
|
}
|
|
3575
3585
|
// Batch-ready variants of the installs above: they return the calls instead of
|
|
@@ -3638,6 +3648,7 @@ var BaseAccountAbstractionService = class {
|
|
|
3638
3648
|
var BaseAccountContractService = class {
|
|
3639
3649
|
constructor(config) {
|
|
3640
3650
|
this.walletService = config.walletService;
|
|
3651
|
+
this.chainId = config.chainId;
|
|
3641
3652
|
this.logger = config.logger;
|
|
3642
3653
|
this.companyId = config.companyId;
|
|
3643
3654
|
this.publicRpcClient = config.publicRpcClient;
|
|
@@ -3695,13 +3706,16 @@ var BaseAccountContractService = class {
|
|
|
3695
3706
|
async registerInAccounts() {
|
|
3696
3707
|
const callData = await this.getCallData();
|
|
3697
3708
|
const smartWalletClient = await this.walletService.getSmartWalletClient();
|
|
3698
|
-
const encodedCallData =
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3709
|
+
const encodedCallData = withBuilderCode(
|
|
3710
|
+
await smartWalletClient.account.encodeCalls([
|
|
3711
|
+
{
|
|
3712
|
+
to: this.contracts.accounts,
|
|
3713
|
+
value: BigInt(0),
|
|
3714
|
+
data: callData
|
|
3715
|
+
}
|
|
3716
|
+
]),
|
|
3717
|
+
this.chainId
|
|
3718
|
+
);
|
|
3705
3719
|
const receipt = await this.walletService.sendUserOperationsAndWaitReceipt(encodedCallData);
|
|
3706
3720
|
if (!receipt) {
|
|
3707
3721
|
throw new Error("Unable to register in accounts contract");
|
|
@@ -3711,13 +3725,16 @@ var BaseAccountContractService = class {
|
|
|
3711
3725
|
async registerInCorporateAccounts() {
|
|
3712
3726
|
const callData = await this.getCorporateCallData();
|
|
3713
3727
|
const smartWalletClient = await this.walletService.getSmartWalletClient();
|
|
3714
|
-
const encodedCallData =
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3728
|
+
const encodedCallData = withBuilderCode(
|
|
3729
|
+
await smartWalletClient.account.encodeCalls([
|
|
3730
|
+
{
|
|
3731
|
+
to: this.contracts.corporateAccounts,
|
|
3732
|
+
value: BigInt(0),
|
|
3733
|
+
data: callData
|
|
3734
|
+
}
|
|
3735
|
+
]),
|
|
3736
|
+
this.chainId
|
|
3737
|
+
);
|
|
3721
3738
|
const receipt = await this.walletService.sendUserOperationsAndWaitReceipt(encodedCallData);
|
|
3722
3739
|
if (!receipt) {
|
|
3723
3740
|
throw new Error("Unable to register in corporate accounts contract");
|
|
@@ -3751,6 +3768,7 @@ var BaseAccountContractService = class {
|
|
|
3751
3768
|
var BaseCryptoService = class {
|
|
3752
3769
|
constructor(config) {
|
|
3753
3770
|
this.walletService = config.walletService;
|
|
3771
|
+
this.chainId = config.chainId;
|
|
3754
3772
|
this.contracts = config.contracts;
|
|
3755
3773
|
this.logger = config.logger;
|
|
3756
3774
|
this.tokens = config.tokens;
|
|
@@ -3781,9 +3799,15 @@ var BaseCryptoService = class {
|
|
|
3781
3799
|
if (!smartWalletClient.account) {
|
|
3782
3800
|
throw new Error("Smart wallet client account is not available.");
|
|
3783
3801
|
}
|
|
3784
|
-
const encodedExecutionCalls =
|
|
3802
|
+
const encodedExecutionCalls = withBuilderCode(
|
|
3803
|
+
await smartWalletClient.account.encodeCalls(callDataArray),
|
|
3804
|
+
this.chainId
|
|
3805
|
+
);
|
|
3785
3806
|
const requestCallData = await this.operationRequestCall(encodedExecutionCalls);
|
|
3786
|
-
const requestCalls =
|
|
3807
|
+
const requestCalls = withBuilderCode(
|
|
3808
|
+
await smartWalletClient.account.encodeCalls([requestCallData.call]),
|
|
3809
|
+
this.chainId
|
|
3810
|
+
);
|
|
3787
3811
|
const userOpReceipt = await this.walletService.sendUserOperationsAndWaitReceipt(requestCalls);
|
|
3788
3812
|
if (!userOpReceipt.success) {
|
|
3789
3813
|
throw new Error(
|
|
@@ -3829,12 +3853,18 @@ var BaseCryptoService = class {
|
|
|
3829
3853
|
params.recipientAddress,
|
|
3830
3854
|
parseUnits(String(params.amount), baseToken?.decimals ?? 18)
|
|
3831
3855
|
);
|
|
3832
|
-
const encodedExecutionCalls =
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3856
|
+
const encodedExecutionCalls = withBuilderCode(
|
|
3857
|
+
await smartWalletClient.account.encodeCalls([
|
|
3858
|
+
unwrapCallData,
|
|
3859
|
+
erc20TransferCallDetails
|
|
3860
|
+
]),
|
|
3861
|
+
this.chainId
|
|
3862
|
+
);
|
|
3836
3863
|
const requestCallData = await this.operationRequestCall(encodedExecutionCalls);
|
|
3837
|
-
const requestCalls =
|
|
3864
|
+
const requestCalls = withBuilderCode(
|
|
3865
|
+
await smartWalletClient.account.encodeCalls([requestCallData.call]),
|
|
3866
|
+
this.chainId
|
|
3867
|
+
);
|
|
3838
3868
|
const requestUserOpReceipt = await this.walletService.sendUserOperationsAndWaitReceipt(
|
|
3839
3869
|
requestCalls,
|
|
3840
3870
|
void 0,
|
|
@@ -3869,9 +3899,12 @@ var BaseCryptoService = class {
|
|
|
3869
3899
|
params.recipientAddress,
|
|
3870
3900
|
parseUnits(String(params.amount), tokenData?.decimals ?? 18)
|
|
3871
3901
|
);
|
|
3872
|
-
const encodedExecutionCalls =
|
|
3873
|
-
|
|
3874
|
-
|
|
3902
|
+
const encodedExecutionCalls = withBuilderCode(
|
|
3903
|
+
await smartWalletClient.account.encodeCalls([
|
|
3904
|
+
erc20TransferCallDetails
|
|
3905
|
+
]),
|
|
3906
|
+
this.chainId
|
|
3907
|
+
);
|
|
3875
3908
|
const userOpReceipt = await this.walletService.sendUserOperationsAndWaitReceipt(encodedExecutionCalls);
|
|
3876
3909
|
if (!userOpReceipt.success) {
|
|
3877
3910
|
throw new Error(
|
|
@@ -3955,10 +3988,13 @@ var BaseCryptoService = class {
|
|
|
3955
3988
|
params.recipientAddress,
|
|
3956
3989
|
parseUnits(params.amount, baseToken.decimals ?? 18)
|
|
3957
3990
|
);
|
|
3958
|
-
const encodedExecutionCalls =
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3991
|
+
const encodedExecutionCalls = withBuilderCode(
|
|
3992
|
+
await smartWalletClient.account.encodeCalls([
|
|
3993
|
+
unwrapCallData,
|
|
3994
|
+
erc20TransferCallDetails
|
|
3995
|
+
]),
|
|
3996
|
+
this.chainId
|
|
3997
|
+
);
|
|
3962
3998
|
const userOpReceipt = await this.walletService.sendUserOperationsAndWaitReceipt(
|
|
3963
3999
|
encodedExecutionCalls,
|
|
3964
4000
|
void 0,
|
|
@@ -3994,7 +4030,10 @@ var BaseCryptoService = class {
|
|
|
3994
4030
|
if (!smartWalletClient.account) {
|
|
3995
4031
|
throw new Error("Smart wallet client account is not available.");
|
|
3996
4032
|
}
|
|
3997
|
-
const encodedCall =
|
|
4033
|
+
const encodedCall = withBuilderCode(
|
|
4034
|
+
await smartWalletClient.account.encodeCalls([callData]),
|
|
4035
|
+
this.chainId
|
|
4036
|
+
);
|
|
3998
4037
|
const nonce = await this.getCustomNonceToFinishRequest(encodedCall);
|
|
3999
4038
|
const userOpReceipt = await this.walletService.sendUserOperationsWithNonceAndWaitReceipt(
|
|
4000
4039
|
encodedCall,
|
|
@@ -4082,6 +4121,7 @@ var BaseCryptoService = class {
|
|
|
4082
4121
|
var BaseOnboardingService = class {
|
|
4083
4122
|
constructor(config) {
|
|
4084
4123
|
this.walletService = config.walletService;
|
|
4124
|
+
this.chainId = config.chainId;
|
|
4085
4125
|
this.accountAbstractionService = config.accountAbstractionService;
|
|
4086
4126
|
this.accountContractService = config.accountContractService;
|
|
4087
4127
|
this.logger = config.logger;
|
|
@@ -4097,11 +4137,14 @@ var BaseOnboardingService = class {
|
|
|
4097
4137
|
const executorCall = await this.accountAbstractionService.getExecutorInstallCall();
|
|
4098
4138
|
const policyCall = await this.accountAbstractionService.getPolicyInstallCall();
|
|
4099
4139
|
const accountCall = await this.accountContractService.getAccountRegistrationCall();
|
|
4100
|
-
const callData =
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4140
|
+
const callData = withBuilderCode(
|
|
4141
|
+
await smartWalletClient.account.encodeCalls([
|
|
4142
|
+
executorCall,
|
|
4143
|
+
policyCall,
|
|
4144
|
+
accountCall
|
|
4145
|
+
]),
|
|
4146
|
+
this.chainId
|
|
4147
|
+
);
|
|
4105
4148
|
const userOpReceipt = await this.walletService.sendUserOperationsAndWaitReceipt(
|
|
4106
4149
|
callData,
|
|
4107
4150
|
smartWalletClient
|
|
@@ -4302,6 +4345,7 @@ var BaseYieldService = class {
|
|
|
4302
4345
|
this.BLOCKS_PER_SECOND = 0.5;
|
|
4303
4346
|
this.publicClient = config.publicClient;
|
|
4304
4347
|
this.walletService = config.walletService;
|
|
4348
|
+
this.chainId = config.chainId;
|
|
4305
4349
|
this.contracts = config.contracts;
|
|
4306
4350
|
this.tokens = config.tokens;
|
|
4307
4351
|
}
|
|
@@ -4349,7 +4393,10 @@ var BaseYieldService = class {
|
|
|
4349
4393
|
async switchYieldToken(token) {
|
|
4350
4394
|
const smartWalletClient = await this.walletService.getSmartWalletClient();
|
|
4351
4395
|
const claimCallData = await this.generateCallDataFoSwitchToken(token);
|
|
4352
|
-
const encodedExecutionCalls =
|
|
4396
|
+
const encodedExecutionCalls = withBuilderCode(
|
|
4397
|
+
await smartWalletClient.account.encodeCalls([claimCallData]),
|
|
4398
|
+
this.chainId
|
|
4399
|
+
);
|
|
4353
4400
|
const { receipt: executeReceipt } = await this.walletService.sendUserOperationsAndWaitReceipt(encodedExecutionCalls);
|
|
4354
4401
|
if (executeReceipt.success === false) {
|
|
4355
4402
|
throw new Error("Switching yield token failed");
|
|
@@ -4360,7 +4407,10 @@ var BaseYieldService = class {
|
|
|
4360
4407
|
async withdraw() {
|
|
4361
4408
|
const smartWalletClient = await this.walletService.getSmartWalletClient();
|
|
4362
4409
|
const claimCallData = await this.generateClaimCallData();
|
|
4363
|
-
const encodedExecutionCalls =
|
|
4410
|
+
const encodedExecutionCalls = withBuilderCode(
|
|
4411
|
+
await smartWalletClient.account.encodeCalls([claimCallData]),
|
|
4412
|
+
this.chainId
|
|
4413
|
+
);
|
|
4364
4414
|
const { receipt: executeReceipt } = await this.walletService.sendUserOperationsAndWaitReceipt(encodedExecutionCalls);
|
|
4365
4415
|
if (executeReceipt.success === false) {
|
|
4366
4416
|
throw new Error("Claimed yield failed");
|
|
@@ -4629,6 +4679,7 @@ var baseFactory = {
|
|
|
4629
4679
|
kernelPublicClient: config.kernelPublicClient,
|
|
4630
4680
|
contracts: config.contracts,
|
|
4631
4681
|
walletService,
|
|
4682
|
+
chainId: config.chain.id,
|
|
4632
4683
|
logger: config.logger
|
|
4633
4684
|
});
|
|
4634
4685
|
},
|
|
@@ -4636,6 +4687,7 @@ var baseFactory = {
|
|
|
4636
4687
|
return new BaseCryptoService({
|
|
4637
4688
|
contracts: config.contracts,
|
|
4638
4689
|
walletService,
|
|
4690
|
+
chainId: config.chain.id,
|
|
4639
4691
|
tokens,
|
|
4640
4692
|
logger: config.logger,
|
|
4641
4693
|
withdrawalApi: config.withdrawalApi
|
|
@@ -4645,6 +4697,7 @@ var baseFactory = {
|
|
|
4645
4697
|
return new BaseYieldService({
|
|
4646
4698
|
publicClient: config.publicClient,
|
|
4647
4699
|
walletService,
|
|
4700
|
+
chainId: config.chain.id,
|
|
4648
4701
|
contracts: config.contracts,
|
|
4649
4702
|
tokens
|
|
4650
4703
|
});
|
|
@@ -4653,6 +4706,7 @@ var baseFactory = {
|
|
|
4653
4706
|
return new BaseAccountContractService({
|
|
4654
4707
|
publicRpcClient: config.publicClient,
|
|
4655
4708
|
walletService,
|
|
4709
|
+
chainId: config.chain.id,
|
|
4656
4710
|
companyId: config.companyId || "",
|
|
4657
4711
|
logger: config.logger,
|
|
4658
4712
|
contracts: config.contracts
|
|
@@ -4661,6 +4715,7 @@ var baseFactory = {
|
|
|
4661
4715
|
createOnboardingService(config, walletService, accountAbstractionService, accountContractService) {
|
|
4662
4716
|
return new BaseOnboardingService({
|
|
4663
4717
|
walletService,
|
|
4718
|
+
chainId: config.chain.id,
|
|
4664
4719
|
accountAbstractionService,
|
|
4665
4720
|
accountContractService,
|
|
4666
4721
|
logger: config.logger
|
|
@@ -4669,6 +4724,7 @@ var baseFactory = {
|
|
|
4669
4724
|
};
|
|
4670
4725
|
chainRegistry.register(8453, baseFactory);
|
|
4671
4726
|
chainRegistry.register(84532, baseFactory);
|
|
4727
|
+
chainRegistry.register(5042, baseFactory);
|
|
4672
4728
|
chainRegistry.register(5042002, baseFactory);
|
|
4673
4729
|
|
|
4674
4730
|
// src/modules/crypto/internal/contract-registry.service.ts
|
|
@@ -4756,6 +4812,7 @@ var supportedEVMChains = [
|
|
|
4756
4812
|
SupportedChains.POLYGON,
|
|
4757
4813
|
SupportedChains.OPTIMISM
|
|
4758
4814
|
];
|
|
4815
|
+
var STELLAR_CHAIN = "STELLAR";
|
|
4759
4816
|
var SYSTEM_SUPPORTED_TOKENS = ["USDT", "USDC", "EURC"];
|
|
4760
4817
|
var SmartDepositAddressesService = class {
|
|
4761
4818
|
constructor(config) {
|
|
@@ -4774,11 +4831,13 @@ var SmartDepositAddressesService = class {
|
|
|
4774
4831
|
const hasEvmAddresses = result.evmChains.length > 0;
|
|
4775
4832
|
const hasTronAddresses = result.tronChains.length > 0;
|
|
4776
4833
|
const hasSolanaAddresses = result.solanaChains.length > 0;
|
|
4777
|
-
|
|
4834
|
+
const hasStellarAddresses = result.stellarChains.length > 0;
|
|
4835
|
+
if (!hasEvmAddresses || !hasTronAddresses || !hasSolanaAddresses || !hasStellarAddresses) {
|
|
4778
4836
|
const failedGroups = [];
|
|
4779
4837
|
if (!hasEvmAddresses) failedGroups.push("EVM");
|
|
4780
4838
|
if (!hasTronAddresses) failedGroups.push("TRON");
|
|
4781
4839
|
if (!hasSolanaAddresses) failedGroups.push("Solana");
|
|
4840
|
+
if (!hasStellarAddresses) failedGroups.push("Stellar");
|
|
4782
4841
|
console.warn(`Some chain groups failed to initialize: ${failedGroups.join(", ")}`);
|
|
4783
4842
|
}
|
|
4784
4843
|
this.setAddresses(allAddresses);
|
|
@@ -4841,11 +4900,13 @@ var SmartDepositAddressesService = class {
|
|
|
4841
4900
|
const results = await Promise.allSettled([
|
|
4842
4901
|
this.createSmartDepositAddressForChains(supportedEVMChains),
|
|
4843
4902
|
this.createSmartDepositAddressForChains([SupportedChains.TRON]),
|
|
4844
|
-
this.createSmartDepositAddressForChains([SupportedChains.SOLANA])
|
|
4903
|
+
this.createSmartDepositAddressForChains([SupportedChains.SOLANA]),
|
|
4904
|
+
this.createSmartDepositAddressForChains([STELLAR_CHAIN])
|
|
4845
4905
|
]);
|
|
4846
4906
|
const evmChains = results[0].status === "fulfilled" ? results[0].value : [];
|
|
4847
4907
|
const tronChains = results[1].status === "fulfilled" ? results[1].value : [];
|
|
4848
4908
|
const solanaChains = results[2].status === "fulfilled" ? results[2].value : [];
|
|
4909
|
+
const stellarChains = results[3].status === "fulfilled" ? results[3].value : [];
|
|
4849
4910
|
if (results[0].status === "rejected") {
|
|
4850
4911
|
console.error("Failed to create EVM chain addresses:", results[0].reason);
|
|
4851
4912
|
}
|
|
@@ -4855,11 +4916,15 @@ var SmartDepositAddressesService = class {
|
|
|
4855
4916
|
if (results[2].status === "rejected") {
|
|
4856
4917
|
console.error("Failed to create Solana chain addresses:", results[2].reason);
|
|
4857
4918
|
}
|
|
4919
|
+
if (results[3].status === "rejected") {
|
|
4920
|
+
console.error("Failed to create Stellar chain addresses:", results[3].reason);
|
|
4921
|
+
}
|
|
4858
4922
|
return {
|
|
4859
4923
|
evmChains,
|
|
4860
4924
|
tronChains,
|
|
4861
4925
|
solanaChains,
|
|
4862
|
-
|
|
4926
|
+
stellarChains,
|
|
4927
|
+
allAddresses: [...evmChains, ...tronChains, ...solanaChains, ...stellarChains]
|
|
4863
4928
|
};
|
|
4864
4929
|
}
|
|
4865
4930
|
async createMissingAddressesForChainGroup(chainCode) {
|
|
@@ -4896,6 +4961,8 @@ var SmartDepositAddressesService = class {
|
|
|
4896
4961
|
return [SupportedChains.TRON];
|
|
4897
4962
|
case "solana":
|
|
4898
4963
|
return [SupportedChains.SOLANA];
|
|
4964
|
+
case "stellar":
|
|
4965
|
+
return [STELLAR_CHAIN];
|
|
4899
4966
|
default:
|
|
4900
4967
|
throw new Error(`Unknown chain group: ${chainGroup}`);
|
|
4901
4968
|
}
|
|
@@ -4910,6 +4977,9 @@ var SmartDepositAddressesService = class {
|
|
|
4910
4977
|
if (chainCode === SupportedChains.SOLANA) {
|
|
4911
4978
|
return "solana";
|
|
4912
4979
|
}
|
|
4980
|
+
if (chainCode === STELLAR_CHAIN) {
|
|
4981
|
+
return "stellar";
|
|
4982
|
+
}
|
|
4913
4983
|
throw new Error(`Unknown chain code: ${chainCode}`);
|
|
4914
4984
|
}
|
|
4915
4985
|
getRhinoSdk() {
|
|
@@ -5073,5 +5143,5 @@ var CryptoModule = class {
|
|
|
5073
5143
|
};
|
|
5074
5144
|
|
|
5075
5145
|
export { BaseAccountAbstractionService, BaseAccountContractService, BaseCryptoService, BaseOnboardingService, BaseWalletService, BaseYieldService, ContractRegistryService, CryptoModule, chainRegistry };
|
|
5076
|
-
//# sourceMappingURL=chunk-
|
|
5077
|
-
//# sourceMappingURL=chunk-
|
|
5146
|
+
//# sourceMappingURL=chunk-GOPZA7GB.js.map
|
|
5147
|
+
//# sourceMappingURL=chunk-GOPZA7GB.js.map
|