@wirexapp/wpay-baas-sdk 0.1.8 → 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-ITBPDXHK.js → chunk-GOPZA7GB.js} +153 -70
- 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-ITBPDXHK.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
|
|
@@ -4262,7 +4305,20 @@ var BaseWalletService = class {
|
|
|
4262
4305
|
bundlerTransport: this.bundlerTransport,
|
|
4263
4306
|
paymaster: {
|
|
4264
4307
|
getPaymasterData: async (userOperation) => {
|
|
4265
|
-
const
|
|
4308
|
+
const {
|
|
4309
|
+
parameters: _parameters,
|
|
4310
|
+
stateOverride: _stateOverride,
|
|
4311
|
+
dataSuffix: _dataSuffix,
|
|
4312
|
+
paymasterContext: _paymasterContext,
|
|
4313
|
+
...cleanUserOperation
|
|
4314
|
+
} = userOperation;
|
|
4315
|
+
const sponsored = await this.kernelPaymasterClient.sponsorUserOperation({
|
|
4316
|
+
userOperation: cleanUserOperation
|
|
4317
|
+
});
|
|
4318
|
+
const requested = typeof userOperation.callGasLimit === "bigint" ? userOperation.callGasLimit : 0n;
|
|
4319
|
+
if (typeof sponsored?.callGasLimit === "bigint" && sponsored.callGasLimit < requested) {
|
|
4320
|
+
sponsored.callGasLimit = requested;
|
|
4321
|
+
}
|
|
4266
4322
|
this.logger?.debug(
|
|
4267
4323
|
`Paymaster gas: requested=${userOperation.callGasLimit ?? "n/a"} sponsored=${sponsored?.callGasLimit ?? "n/a"}`
|
|
4268
4324
|
);
|
|
@@ -4289,6 +4345,7 @@ var BaseYieldService = class {
|
|
|
4289
4345
|
this.BLOCKS_PER_SECOND = 0.5;
|
|
4290
4346
|
this.publicClient = config.publicClient;
|
|
4291
4347
|
this.walletService = config.walletService;
|
|
4348
|
+
this.chainId = config.chainId;
|
|
4292
4349
|
this.contracts = config.contracts;
|
|
4293
4350
|
this.tokens = config.tokens;
|
|
4294
4351
|
}
|
|
@@ -4336,7 +4393,10 @@ var BaseYieldService = class {
|
|
|
4336
4393
|
async switchYieldToken(token) {
|
|
4337
4394
|
const smartWalletClient = await this.walletService.getSmartWalletClient();
|
|
4338
4395
|
const claimCallData = await this.generateCallDataFoSwitchToken(token);
|
|
4339
|
-
const encodedExecutionCalls =
|
|
4396
|
+
const encodedExecutionCalls = withBuilderCode(
|
|
4397
|
+
await smartWalletClient.account.encodeCalls([claimCallData]),
|
|
4398
|
+
this.chainId
|
|
4399
|
+
);
|
|
4340
4400
|
const { receipt: executeReceipt } = await this.walletService.sendUserOperationsAndWaitReceipt(encodedExecutionCalls);
|
|
4341
4401
|
if (executeReceipt.success === false) {
|
|
4342
4402
|
throw new Error("Switching yield token failed");
|
|
@@ -4347,7 +4407,10 @@ var BaseYieldService = class {
|
|
|
4347
4407
|
async withdraw() {
|
|
4348
4408
|
const smartWalletClient = await this.walletService.getSmartWalletClient();
|
|
4349
4409
|
const claimCallData = await this.generateClaimCallData();
|
|
4350
|
-
const encodedExecutionCalls =
|
|
4410
|
+
const encodedExecutionCalls = withBuilderCode(
|
|
4411
|
+
await smartWalletClient.account.encodeCalls([claimCallData]),
|
|
4412
|
+
this.chainId
|
|
4413
|
+
);
|
|
4351
4414
|
const { receipt: executeReceipt } = await this.walletService.sendUserOperationsAndWaitReceipt(encodedExecutionCalls);
|
|
4352
4415
|
if (executeReceipt.success === false) {
|
|
4353
4416
|
throw new Error("Claimed yield failed");
|
|
@@ -4616,6 +4679,7 @@ var baseFactory = {
|
|
|
4616
4679
|
kernelPublicClient: config.kernelPublicClient,
|
|
4617
4680
|
contracts: config.contracts,
|
|
4618
4681
|
walletService,
|
|
4682
|
+
chainId: config.chain.id,
|
|
4619
4683
|
logger: config.logger
|
|
4620
4684
|
});
|
|
4621
4685
|
},
|
|
@@ -4623,6 +4687,7 @@ var baseFactory = {
|
|
|
4623
4687
|
return new BaseCryptoService({
|
|
4624
4688
|
contracts: config.contracts,
|
|
4625
4689
|
walletService,
|
|
4690
|
+
chainId: config.chain.id,
|
|
4626
4691
|
tokens,
|
|
4627
4692
|
logger: config.logger,
|
|
4628
4693
|
withdrawalApi: config.withdrawalApi
|
|
@@ -4632,6 +4697,7 @@ var baseFactory = {
|
|
|
4632
4697
|
return new BaseYieldService({
|
|
4633
4698
|
publicClient: config.publicClient,
|
|
4634
4699
|
walletService,
|
|
4700
|
+
chainId: config.chain.id,
|
|
4635
4701
|
contracts: config.contracts,
|
|
4636
4702
|
tokens
|
|
4637
4703
|
});
|
|
@@ -4640,6 +4706,7 @@ var baseFactory = {
|
|
|
4640
4706
|
return new BaseAccountContractService({
|
|
4641
4707
|
publicRpcClient: config.publicClient,
|
|
4642
4708
|
walletService,
|
|
4709
|
+
chainId: config.chain.id,
|
|
4643
4710
|
companyId: config.companyId || "",
|
|
4644
4711
|
logger: config.logger,
|
|
4645
4712
|
contracts: config.contracts
|
|
@@ -4648,6 +4715,7 @@ var baseFactory = {
|
|
|
4648
4715
|
createOnboardingService(config, walletService, accountAbstractionService, accountContractService) {
|
|
4649
4716
|
return new BaseOnboardingService({
|
|
4650
4717
|
walletService,
|
|
4718
|
+
chainId: config.chain.id,
|
|
4651
4719
|
accountAbstractionService,
|
|
4652
4720
|
accountContractService,
|
|
4653
4721
|
logger: config.logger
|
|
@@ -4656,6 +4724,7 @@ var baseFactory = {
|
|
|
4656
4724
|
};
|
|
4657
4725
|
chainRegistry.register(8453, baseFactory);
|
|
4658
4726
|
chainRegistry.register(84532, baseFactory);
|
|
4727
|
+
chainRegistry.register(5042, baseFactory);
|
|
4659
4728
|
chainRegistry.register(5042002, baseFactory);
|
|
4660
4729
|
|
|
4661
4730
|
// src/modules/crypto/internal/contract-registry.service.ts
|
|
@@ -4743,6 +4812,7 @@ var supportedEVMChains = [
|
|
|
4743
4812
|
SupportedChains.POLYGON,
|
|
4744
4813
|
SupportedChains.OPTIMISM
|
|
4745
4814
|
];
|
|
4815
|
+
var STELLAR_CHAIN = "STELLAR";
|
|
4746
4816
|
var SYSTEM_SUPPORTED_TOKENS = ["USDT", "USDC", "EURC"];
|
|
4747
4817
|
var SmartDepositAddressesService = class {
|
|
4748
4818
|
constructor(config) {
|
|
@@ -4761,11 +4831,13 @@ var SmartDepositAddressesService = class {
|
|
|
4761
4831
|
const hasEvmAddresses = result.evmChains.length > 0;
|
|
4762
4832
|
const hasTronAddresses = result.tronChains.length > 0;
|
|
4763
4833
|
const hasSolanaAddresses = result.solanaChains.length > 0;
|
|
4764
|
-
|
|
4834
|
+
const hasStellarAddresses = result.stellarChains.length > 0;
|
|
4835
|
+
if (!hasEvmAddresses || !hasTronAddresses || !hasSolanaAddresses || !hasStellarAddresses) {
|
|
4765
4836
|
const failedGroups = [];
|
|
4766
4837
|
if (!hasEvmAddresses) failedGroups.push("EVM");
|
|
4767
4838
|
if (!hasTronAddresses) failedGroups.push("TRON");
|
|
4768
4839
|
if (!hasSolanaAddresses) failedGroups.push("Solana");
|
|
4840
|
+
if (!hasStellarAddresses) failedGroups.push("Stellar");
|
|
4769
4841
|
console.warn(`Some chain groups failed to initialize: ${failedGroups.join(", ")}`);
|
|
4770
4842
|
}
|
|
4771
4843
|
this.setAddresses(allAddresses);
|
|
@@ -4828,11 +4900,13 @@ var SmartDepositAddressesService = class {
|
|
|
4828
4900
|
const results = await Promise.allSettled([
|
|
4829
4901
|
this.createSmartDepositAddressForChains(supportedEVMChains),
|
|
4830
4902
|
this.createSmartDepositAddressForChains([SupportedChains.TRON]),
|
|
4831
|
-
this.createSmartDepositAddressForChains([SupportedChains.SOLANA])
|
|
4903
|
+
this.createSmartDepositAddressForChains([SupportedChains.SOLANA]),
|
|
4904
|
+
this.createSmartDepositAddressForChains([STELLAR_CHAIN])
|
|
4832
4905
|
]);
|
|
4833
4906
|
const evmChains = results[0].status === "fulfilled" ? results[0].value : [];
|
|
4834
4907
|
const tronChains = results[1].status === "fulfilled" ? results[1].value : [];
|
|
4835
4908
|
const solanaChains = results[2].status === "fulfilled" ? results[2].value : [];
|
|
4909
|
+
const stellarChains = results[3].status === "fulfilled" ? results[3].value : [];
|
|
4836
4910
|
if (results[0].status === "rejected") {
|
|
4837
4911
|
console.error("Failed to create EVM chain addresses:", results[0].reason);
|
|
4838
4912
|
}
|
|
@@ -4842,11 +4916,15 @@ var SmartDepositAddressesService = class {
|
|
|
4842
4916
|
if (results[2].status === "rejected") {
|
|
4843
4917
|
console.error("Failed to create Solana chain addresses:", results[2].reason);
|
|
4844
4918
|
}
|
|
4919
|
+
if (results[3].status === "rejected") {
|
|
4920
|
+
console.error("Failed to create Stellar chain addresses:", results[3].reason);
|
|
4921
|
+
}
|
|
4845
4922
|
return {
|
|
4846
4923
|
evmChains,
|
|
4847
4924
|
tronChains,
|
|
4848
4925
|
solanaChains,
|
|
4849
|
-
|
|
4926
|
+
stellarChains,
|
|
4927
|
+
allAddresses: [...evmChains, ...tronChains, ...solanaChains, ...stellarChains]
|
|
4850
4928
|
};
|
|
4851
4929
|
}
|
|
4852
4930
|
async createMissingAddressesForChainGroup(chainCode) {
|
|
@@ -4883,6 +4961,8 @@ var SmartDepositAddressesService = class {
|
|
|
4883
4961
|
return [SupportedChains.TRON];
|
|
4884
4962
|
case "solana":
|
|
4885
4963
|
return [SupportedChains.SOLANA];
|
|
4964
|
+
case "stellar":
|
|
4965
|
+
return [STELLAR_CHAIN];
|
|
4886
4966
|
default:
|
|
4887
4967
|
throw new Error(`Unknown chain group: ${chainGroup}`);
|
|
4888
4968
|
}
|
|
@@ -4897,6 +4977,9 @@ var SmartDepositAddressesService = class {
|
|
|
4897
4977
|
if (chainCode === SupportedChains.SOLANA) {
|
|
4898
4978
|
return "solana";
|
|
4899
4979
|
}
|
|
4980
|
+
if (chainCode === STELLAR_CHAIN) {
|
|
4981
|
+
return "stellar";
|
|
4982
|
+
}
|
|
4900
4983
|
throw new Error(`Unknown chain code: ${chainCode}`);
|
|
4901
4984
|
}
|
|
4902
4985
|
getRhinoSdk() {
|
|
@@ -5060,5 +5143,5 @@ var CryptoModule = class {
|
|
|
5060
5143
|
};
|
|
5061
5144
|
|
|
5062
5145
|
export { BaseAccountAbstractionService, BaseAccountContractService, BaseCryptoService, BaseOnboardingService, BaseWalletService, BaseYieldService, ContractRegistryService, CryptoModule, chainRegistry };
|
|
5063
|
-
//# sourceMappingURL=chunk-
|
|
5064
|
-
//# sourceMappingURL=chunk-
|
|
5146
|
+
//# sourceMappingURL=chunk-GOPZA7GB.js.map
|
|
5147
|
+
//# sourceMappingURL=chunk-GOPZA7GB.js.map
|