@wirexapp/wpay-baas-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +566 -0
- package/dist/abi/accounts.abi.d.ts +405 -0
- package/dist/abi/accounts.abi.d.ts.map +1 -0
- package/dist/abi/accounts.abi.js +351 -0
- package/dist/abi/accounts.abi.js.map +1 -0
- package/dist/abi/contractRegistry.abi.d.ts +220 -0
- package/dist/abi/contractRegistry.abi.d.ts.map +1 -0
- package/dist/abi/contractRegistry.abi.js +287 -0
- package/dist/abi/contractRegistry.abi.js.map +1 -0
- package/dist/abi/corporateAccounts.abi.d.ts +42 -0
- package/dist/abi/corporateAccounts.abi.d.ts.map +1 -0
- package/dist/abi/corporateAccounts.abi.js +34 -0
- package/dist/abi/corporateAccounts.abi.js.map +1 -0
- package/dist/abi/erc20.abi.d.ts +253 -0
- package/dist/abi/erc20.abi.d.ts.map +1 -0
- package/dist/abi/erc20.abi.js +98 -0
- package/dist/abi/erc20.abi.js.map +1 -0
- package/dist/abi/executionDelayPolicy.abi.d.ts +378 -0
- package/dist/abi/executionDelayPolicy.abi.d.ts.map +1 -0
- package/dist/abi/executionDelayPolicy.abi.js +502 -0
- package/dist/abi/executionDelayPolicy.abi.js.map +1 -0
- package/dist/abi/fundsManagement.abi.d.ts +54 -0
- package/dist/abi/fundsManagement.abi.d.ts.map +1 -0
- package/dist/abi/fundsManagement.abi.js +361 -0
- package/dist/abi/fundsManagement.abi.js.map +1 -0
- package/dist/abi/index.d.ts +11 -0
- package/dist/abi/index.d.ts.map +1 -0
- package/dist/abi/index.js +11 -0
- package/dist/abi/index.js.map +1 -0
- package/dist/abi/signer.abi.d.ts +20 -0
- package/dist/abi/signer.abi.d.ts.map +1 -0
- package/dist/abi/signer.abi.js +13 -0
- package/dist/abi/signer.abi.js.map +1 -0
- package/dist/abi/synthetic.abi.d.ts +2459 -0
- package/dist/abi/synthetic.abi.d.ts.map +1 -0
- package/dist/abi/synthetic.abi.js +1739 -0
- package/dist/abi/synthetic.abi.js.map +1 -0
- package/dist/abi/tokenRegistry.abi.d.ts +209 -0
- package/dist/abi/tokenRegistry.abi.d.ts.map +1 -0
- package/dist/abi/tokenRegistry.abi.js +117 -0
- package/dist/abi/tokenRegistry.abi.js.map +1 -0
- package/dist/abi/yieldCalculator.abi.d.ts +327 -0
- package/dist/abi/yieldCalculator.abi.d.ts.map +1 -0
- package/dist/abi/yieldCalculator.abi.js +2 -0
- package/dist/abi/yieldCalculator.abi.js.map +1 -0
- package/dist/client.d.ts +23 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +97 -0
- package/dist/client.js.map +1 -0
- package/dist/core/config/config.service.d.ts +18 -0
- package/dist/core/config/config.service.d.ts.map +1 -0
- package/dist/core/config/config.service.js +78 -0
- package/dist/core/config/config.service.js.map +1 -0
- package/dist/core/config/index.d.ts +4 -0
- package/dist/core/config/index.d.ts.map +1 -0
- package/dist/core/config/index.js +3 -0
- package/dist/core/config/index.js.map +1 -0
- package/dist/core/config/types.d.ts +40 -0
- package/dist/core/config/types.d.ts.map +1 -0
- package/dist/core/config/types.js +5 -0
- package/dist/core/config/types.js.map +1 -0
- package/dist/core/errors.d.ts +31 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +63 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +5 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/internal/http-client.d.ts +40 -0
- package/dist/core/internal/http-client.d.ts.map +1 -0
- package/dist/core/internal/http-client.js +113 -0
- package/dist/core/internal/http-client.js.map +1 -0
- package/dist/core/types.d.ts +82 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +13 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/api/api.module.d.ts +21 -0
- package/dist/modules/api/api.module.d.ts.map +1 -0
- package/dist/modules/api/api.module.js +47 -0
- package/dist/modules/api/api.module.js.map +1 -0
- package/dist/modules/api/baas/activity/activity.service.d.ts +34 -0
- package/dist/modules/api/baas/activity/activity.service.d.ts.map +1 -0
- package/dist/modules/api/baas/activity/activity.service.js +61 -0
- package/dist/modules/api/baas/activity/activity.service.js.map +1 -0
- package/dist/modules/api/baas/activity/index.d.ts +3 -0
- package/dist/modules/api/baas/activity/index.d.ts.map +1 -0
- package/dist/modules/api/baas/activity/index.js +2 -0
- package/dist/modules/api/baas/activity/index.js.map +1 -0
- package/dist/modules/api/baas/activity/types.d.ts +166 -0
- package/dist/modules/api/baas/activity/types.d.ts.map +1 -0
- package/dist/modules/api/baas/activity/types.js +5 -0
- package/dist/modules/api/baas/activity/types.js.map +1 -0
- package/dist/modules/api/baas/baas.module.d.ts +41 -0
- package/dist/modules/api/baas/baas.module.d.ts.map +1 -0
- package/dist/modules/api/baas/baas.module.js +144 -0
- package/dist/modules/api/baas/baas.module.js.map +1 -0
- package/dist/modules/api/baas/bank/bank.service.d.ts +42 -0
- package/dist/modules/api/baas/bank/bank.service.d.ts.map +1 -0
- package/dist/modules/api/baas/bank/bank.service.js +75 -0
- package/dist/modules/api/baas/bank/bank.service.js.map +1 -0
- package/dist/modules/api/baas/bank/index.d.ts +3 -0
- package/dist/modules/api/baas/bank/index.d.ts.map +1 -0
- package/dist/modules/api/baas/bank/index.js +2 -0
- package/dist/modules/api/baas/bank/index.js.map +1 -0
- package/dist/modules/api/baas/bank/types.d.ts +116 -0
- package/dist/modules/api/baas/bank/types.d.ts.map +1 -0
- package/dist/modules/api/baas/bank/types.js +5 -0
- package/dist/modules/api/baas/bank/types.js.map +1 -0
- package/dist/modules/api/baas/cards/cards.service.d.ts +118 -0
- package/dist/modules/api/baas/cards/cards.service.d.ts.map +1 -0
- package/dist/modules/api/baas/cards/cards.service.js +254 -0
- package/dist/modules/api/baas/cards/cards.service.js.map +1 -0
- package/dist/modules/api/baas/cards/index.d.ts +3 -0
- package/dist/modules/api/baas/cards/index.d.ts.map +1 -0
- package/dist/modules/api/baas/cards/index.js +2 -0
- package/dist/modules/api/baas/cards/index.js.map +1 -0
- package/dist/modules/api/baas/cards/types.d.ts +249 -0
- package/dist/modules/api/baas/cards/types.d.ts.map +1 -0
- package/dist/modules/api/baas/cards/types.js +5 -0
- package/dist/modules/api/baas/cards/types.js.map +1 -0
- package/dist/modules/api/baas/config/config.service.d.ts +21 -0
- package/dist/modules/api/baas/config/config.service.d.ts.map +1 -0
- package/dist/modules/api/baas/config/config.service.js +22 -0
- package/dist/modules/api/baas/config/config.service.js.map +1 -0
- package/dist/modules/api/baas/config/index.d.ts +3 -0
- package/dist/modules/api/baas/config/index.d.ts.map +1 -0
- package/dist/modules/api/baas/config/index.js +2 -0
- package/dist/modules/api/baas/config/index.js.map +1 -0
- package/dist/modules/api/baas/config/types.d.ts +42 -0
- package/dist/modules/api/baas/config/types.d.ts.map +1 -0
- package/dist/modules/api/baas/config/types.js +2 -0
- package/dist/modules/api/baas/config/types.js.map +1 -0
- package/dist/modules/api/baas/confirmation/confirmation.service.d.ts +30 -0
- package/dist/modules/api/baas/confirmation/confirmation.service.d.ts.map +1 -0
- package/dist/modules/api/baas/confirmation/confirmation.service.js +39 -0
- package/dist/modules/api/baas/confirmation/confirmation.service.js.map +1 -0
- package/dist/modules/api/baas/confirmation/index.d.ts +3 -0
- package/dist/modules/api/baas/confirmation/index.d.ts.map +1 -0
- package/dist/modules/api/baas/confirmation/index.js +2 -0
- package/dist/modules/api/baas/confirmation/index.js.map +1 -0
- package/dist/modules/api/baas/confirmation/types.d.ts +30 -0
- package/dist/modules/api/baas/confirmation/types.d.ts.map +1 -0
- package/dist/modules/api/baas/confirmation/types.js +5 -0
- package/dist/modules/api/baas/confirmation/types.js.map +1 -0
- package/dist/modules/api/baas/index.d.ts +12 -0
- package/dist/modules/api/baas/index.d.ts.map +1 -0
- package/dist/modules/api/baas/index.js +12 -0
- package/dist/modules/api/baas/index.js.map +1 -0
- package/dist/modules/api/baas/rates/index.d.ts +3 -0
- package/dist/modules/api/baas/rates/index.d.ts.map +1 -0
- package/dist/modules/api/baas/rates/index.js +2 -0
- package/dist/modules/api/baas/rates/index.js.map +1 -0
- package/dist/modules/api/baas/rates/rates.service.d.ts +21 -0
- package/dist/modules/api/baas/rates/rates.service.d.ts.map +1 -0
- package/dist/modules/api/baas/rates/rates.service.js +25 -0
- package/dist/modules/api/baas/rates/rates.service.js.map +1 -0
- package/dist/modules/api/baas/rates/types.d.ts +12 -0
- package/dist/modules/api/baas/rates/types.d.ts.map +1 -0
- package/dist/modules/api/baas/rates/types.js +2 -0
- package/dist/modules/api/baas/rates/types.js.map +1 -0
- package/dist/modules/api/baas/recipients/index.d.ts +3 -0
- package/dist/modules/api/baas/recipients/index.d.ts.map +1 -0
- package/dist/modules/api/baas/recipients/index.js +2 -0
- package/dist/modules/api/baas/recipients/index.js.map +1 -0
- package/dist/modules/api/baas/recipients/recipients.service.d.ts +74 -0
- package/dist/modules/api/baas/recipients/recipients.service.d.ts.map +1 -0
- package/dist/modules/api/baas/recipients/recipients.service.js +190 -0
- package/dist/modules/api/baas/recipients/recipients.service.js.map +1 -0
- package/dist/modules/api/baas/recipients/types.d.ts +208 -0
- package/dist/modules/api/baas/recipients/types.d.ts.map +1 -0
- package/dist/modules/api/baas/recipients/types.js +5 -0
- package/dist/modules/api/baas/recipients/types.js.map +1 -0
- package/dist/modules/api/baas/token/index.d.ts +3 -0
- package/dist/modules/api/baas/token/index.d.ts.map +1 -0
- package/dist/modules/api/baas/token/index.js +2 -0
- package/dist/modules/api/baas/token/index.js.map +1 -0
- package/dist/modules/api/baas/token/token.service.d.ts +21 -0
- package/dist/modules/api/baas/token/token.service.d.ts.map +1 -0
- package/dist/modules/api/baas/token/token.service.js +22 -0
- package/dist/modules/api/baas/token/token.service.js.map +1 -0
- package/dist/modules/api/baas/token/types.d.ts +12 -0
- package/dist/modules/api/baas/token/types.d.ts.map +1 -0
- package/dist/modules/api/baas/token/types.js +2 -0
- package/dist/modules/api/baas/token/types.js.map +1 -0
- package/dist/modules/api/baas/user/index.d.ts +3 -0
- package/dist/modules/api/baas/user/index.d.ts.map +1 -0
- package/dist/modules/api/baas/user/index.js +2 -0
- package/dist/modules/api/baas/user/index.js.map +1 -0
- package/dist/modules/api/baas/user/types.d.ts +145 -0
- package/dist/modules/api/baas/user/types.d.ts.map +1 -0
- package/dist/modules/api/baas/user/types.js +5 -0
- package/dist/modules/api/baas/user/types.js.map +1 -0
- package/dist/modules/api/baas/user/user.service.d.ts +73 -0
- package/dist/modules/api/baas/user/user.service.d.ts.map +1 -0
- package/dist/modules/api/baas/user/user.service.js +140 -0
- package/dist/modules/api/baas/user/user.service.js.map +1 -0
- package/dist/modules/api/baas/wallet/index.d.ts +3 -0
- package/dist/modules/api/baas/wallet/index.d.ts.map +1 -0
- package/dist/modules/api/baas/wallet/index.js +2 -0
- package/dist/modules/api/baas/wallet/index.js.map +1 -0
- package/dist/modules/api/baas/wallet/types.d.ts +26 -0
- package/dist/modules/api/baas/wallet/types.d.ts.map +1 -0
- package/dist/modules/api/baas/wallet/types.js +5 -0
- package/dist/modules/api/baas/wallet/types.js.map +1 -0
- package/dist/modules/api/baas/wallet/wallet.service.d.ts +30 -0
- package/dist/modules/api/baas/wallet/wallet.service.d.ts.map +1 -0
- package/dist/modules/api/baas/wallet/wallet.service.js +43 -0
- package/dist/modules/api/baas/wallet/wallet.service.js.map +1 -0
- package/dist/modules/api/index.d.ts +7 -0
- package/dist/modules/api/index.d.ts.map +1 -0
- package/dist/modules/api/index.js +5 -0
- package/dist/modules/api/index.js.map +1 -0
- package/dist/modules/api/internal/endpoints/wallets.api.d.ts +8 -0
- package/dist/modules/api/internal/endpoints/wallets.api.d.ts.map +1 -0
- package/dist/modules/api/internal/endpoints/wallets.api.js +9 -0
- package/dist/modules/api/internal/endpoints/wallets.api.js.map +1 -0
- package/dist/modules/api/internal/endpoints/withdrawal.api.d.ts +8 -0
- package/dist/modules/api/internal/endpoints/withdrawal.api.d.ts.map +1 -0
- package/dist/modules/api/internal/endpoints/withdrawal.api.js +10 -0
- package/dist/modules/api/internal/endpoints/withdrawal.api.js.map +1 -0
- package/dist/modules/api/types/common.types.d.ts +19 -0
- package/dist/modules/api/types/common.types.d.ts.map +1 -0
- package/dist/modules/api/types/common.types.js +2 -0
- package/dist/modules/api/types/common.types.js.map +1 -0
- package/dist/modules/api/types/wallets.types.d.ts +12 -0
- package/dist/modules/api/types/wallets.types.d.ts.map +1 -0
- package/dist/modules/api/types/wallets.types.js +2 -0
- package/dist/modules/api/types/wallets.types.js.map +1 -0
- package/dist/modules/auth/auth.service.d.ts +32 -0
- package/dist/modules/auth/auth.service.d.ts.map +1 -0
- package/dist/modules/auth/auth.service.js +182 -0
- package/dist/modules/auth/auth.service.js.map +1 -0
- package/dist/modules/auth/index.d.ts +3 -0
- package/dist/modules/auth/index.d.ts.map +1 -0
- package/dist/modules/auth/index.js +2 -0
- package/dist/modules/auth/index.js.map +1 -0
- package/dist/modules/auth/types.d.ts +82 -0
- package/dist/modules/auth/types.d.ts.map +1 -0
- package/dist/modules/auth/types.js +2 -0
- package/dist/modules/auth/types.js.map +1 -0
- package/dist/modules/crypto/chains/base/account-abstraction.service.d.ts +28 -0
- package/dist/modules/crypto/chains/base/account-abstraction.service.d.ts.map +1 -0
- package/dist/modules/crypto/chains/base/account-abstraction.service.js +173 -0
- package/dist/modules/crypto/chains/base/account-abstraction.service.js.map +1 -0
- package/dist/modules/crypto/chains/base/account.contract.service.d.ts +26 -0
- package/dist/modules/crypto/chains/base/account.contract.service.d.ts.map +1 -0
- package/dist/modules/crypto/chains/base/account.contract.service.js +109 -0
- package/dist/modules/crypto/chains/base/account.contract.service.js.map +1 -0
- package/dist/modules/crypto/chains/base/crypto.service.d.ts +32 -0
- package/dist/modules/crypto/chains/base/crypto.service.d.ts.map +1 -0
- package/dist/modules/crypto/chains/base/crypto.service.js +211 -0
- package/dist/modules/crypto/chains/base/crypto.service.js.map +1 -0
- package/dist/modules/crypto/chains/base/index.d.ts +6 -0
- package/dist/modules/crypto/chains/base/index.d.ts.map +1 -0
- package/dist/modules/crypto/chains/base/index.js +54 -0
- package/dist/modules/crypto/chains/base/index.js.map +1 -0
- package/dist/modules/crypto/chains/base/wallet.service.d.ts +53 -0
- package/dist/modules/crypto/chains/base/wallet.service.d.ts.map +1 -0
- package/dist/modules/crypto/chains/base/wallet.service.js +142 -0
- package/dist/modules/crypto/chains/base/wallet.service.js.map +1 -0
- package/dist/modules/crypto/chains/base/yield.service.d.ts +38 -0
- package/dist/modules/crypto/chains/base/yield.service.d.ts.map +1 -0
- package/dist/modules/crypto/chains/base/yield.service.js +297 -0
- package/dist/modules/crypto/chains/base/yield.service.js.map +1 -0
- package/dist/modules/crypto/chains/index.d.ts +5 -0
- package/dist/modules/crypto/chains/index.d.ts.map +1 -0
- package/dist/modules/crypto/chains/index.js +3 -0
- package/dist/modules/crypto/chains/index.js.map +1 -0
- package/dist/modules/crypto/chains/registry.d.ts +11 -0
- package/dist/modules/crypto/chains/registry.d.ts.map +1 -0
- package/dist/modules/crypto/chains/registry.js +19 -0
- package/dist/modules/crypto/chains/registry.js.map +1 -0
- package/dist/modules/crypto/chains/types.d.ts +37 -0
- package/dist/modules/crypto/chains/types.d.ts.map +1 -0
- package/dist/modules/crypto/chains/types.js +2 -0
- package/dist/modules/crypto/chains/types.js.map +1 -0
- package/dist/modules/crypto/crypto.module.d.ts +40 -0
- package/dist/modules/crypto/crypto.module.d.ts.map +1 -0
- package/dist/modules/crypto/crypto.module.js +127 -0
- package/dist/modules/crypto/crypto.module.js.map +1 -0
- package/dist/modules/crypto/index.d.ts +9 -0
- package/dist/modules/crypto/index.d.ts.map +1 -0
- package/dist/modules/crypto/index.js +8 -0
- package/dist/modules/crypto/index.js.map +1 -0
- package/dist/modules/crypto/interfaces/account-abstraction.interface.d.ts +8 -0
- package/dist/modules/crypto/interfaces/account-abstraction.interface.d.ts.map +1 -0
- package/dist/modules/crypto/interfaces/account-abstraction.interface.js +2 -0
- package/dist/modules/crypto/interfaces/account-abstraction.interface.js.map +1 -0
- package/dist/modules/crypto/interfaces/account-contract.interface.d.ts +8 -0
- package/dist/modules/crypto/interfaces/account-contract.interface.d.ts.map +1 -0
- package/dist/modules/crypto/interfaces/account-contract.interface.js +2 -0
- package/dist/modules/crypto/interfaces/account-contract.interface.js.map +1 -0
- package/dist/modules/crypto/interfaces/crypto.interface.d.ts +50 -0
- package/dist/modules/crypto/interfaces/crypto.interface.d.ts.map +1 -0
- package/dist/modules/crypto/interfaces/crypto.interface.js +2 -0
- package/dist/modules/crypto/interfaces/crypto.interface.js.map +1 -0
- package/dist/modules/crypto/interfaces/index.d.ts +5 -0
- package/dist/modules/crypto/interfaces/index.d.ts.map +1 -0
- package/dist/modules/crypto/interfaces/index.js +2 -0
- package/dist/modules/crypto/interfaces/index.js.map +1 -0
- package/dist/modules/crypto/interfaces/yield.interface.d.ts +19 -0
- package/dist/modules/crypto/interfaces/yield.interface.d.ts.map +1 -0
- package/dist/modules/crypto/interfaces/yield.interface.js +2 -0
- package/dist/modules/crypto/interfaces/yield.interface.js.map +1 -0
- package/dist/modules/crypto/internal/contract-registry.service.d.ts +14 -0
- package/dist/modules/crypto/internal/contract-registry.service.d.ts.map +1 -0
- package/dist/modules/crypto/internal/contract-registry.service.js +76 -0
- package/dist/modules/crypto/internal/contract-registry.service.js.map +1 -0
- package/dist/modules/crypto/internal/smartDepositWallet.service.d.ts +39 -0
- package/dist/modules/crypto/internal/smartDepositWallet.service.d.ts.map +1 -0
- package/dist/modules/crypto/internal/smartDepositWallet.service.js +183 -0
- package/dist/modules/crypto/internal/smartDepositWallet.service.js.map +1 -0
- package/dist/modules/crypto/types.d.ts +47 -0
- package/dist/modules/crypto/types.d.ts.map +1 -0
- package/dist/modules/crypto/types.js +2 -0
- package/dist/modules/crypto/types.js.map +1 -0
- package/package.json +96 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 WirexPay
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
# WirexPay SDK
|
|
2
|
+
|
|
3
|
+
SDK for integration with the WirexPay platform. Supports Account Abstraction (ZeroDev Kernel V3.1), token transfers, yield, and smart deposit addresses.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @wirexpay/sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Peer dependency:** `viem ^2.0.0`
|
|
12
|
+
|
|
13
|
+
## SDK Initialization
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { createSDK, type SDKEnvironment } from '@wirexpay/sdk';
|
|
17
|
+
|
|
18
|
+
const sdk = await createSDK({
|
|
19
|
+
env: 'dev', // 'dev' | 'prod'
|
|
20
|
+
companyId: '0x...', // Company ID in hex format
|
|
21
|
+
getMainWalletClient: () => mainWalletClient, // Embedded wallet with EtheriumProvider
|
|
22
|
+
enableLogging: true, // optional, default false
|
|
23
|
+
logger: customLogger, // optional, custom logger
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Configuration Parameters
|
|
28
|
+
|
|
29
|
+
| Parameter | Type | Required | Description |
|
|
30
|
+
|-----------|------|----------|-------------|
|
|
31
|
+
| `env` | `'dev' \| 'prod'` | Yes | Environment |
|
|
32
|
+
| `companyId` | `string` | Yes | Company ID in hex format |
|
|
33
|
+
| `getMainWalletClient` | `() => MainWalletClient` | Yes | Function that returns embedded wallet with EtheriumProvider |
|
|
34
|
+
| `enableLogging` | `boolean` | No | Enable logging (default `false`) |
|
|
35
|
+
| `logger` | `Logger` | No | Custom logger (requires `enableLogging: true`) |
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## User Registration Flow
|
|
40
|
+
|
|
41
|
+
### 1: Get Smart Wallet Address
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
const address = await sdk.crypto.wallet.getSmartWalletAddress();
|
|
45
|
+
console.log('Smart Wallet:', address);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 2: Check Policy & Executor Status
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
const isPolicyInstalled = await sdk.crypto.accountAbstraction.isPolicyInstalled();
|
|
52
|
+
const isExecutorInstalled = await sdk.crypto.accountAbstraction.isExecutorInstalled();
|
|
53
|
+
|
|
54
|
+
console.log('Policy installed:', isPolicyInstalled);
|
|
55
|
+
console.log('Executor installed:', isExecutorInstalled);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 3: Install Policy & Executor (if not installed)
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
if (!isPolicyInstalled || !isExecutorInstalled) {
|
|
62
|
+
const result = await sdk.crypto.accountAbstraction.signInPolicyAndExecutor();
|
|
63
|
+
console.log('Transaction hash:', result?.receipt?.transactionHash);
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 4: If you use Privy as auth — Link Smart Wallet to Privy (SIWE)
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { useLinkWithSiwe } from '@privy-io/react-auth';
|
|
71
|
+
|
|
72
|
+
const { generateSiweMessage, linkWithSiwe } = useLinkWithSiwe();
|
|
73
|
+
|
|
74
|
+
const smartWalletClient = await sdk.crypto.wallet.getSmartWalletClient();
|
|
75
|
+
const message = await generateSiweMessage({
|
|
76
|
+
address: smartWalletClient.account.address,
|
|
77
|
+
chainId: 'eip155:' + smartWalletClient.chain?.id,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const signature = await smartWalletClient.signMessage({
|
|
81
|
+
account: smartWalletClient.account,
|
|
82
|
+
message: message,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
await linkWithSiwe({
|
|
86
|
+
message: message,
|
|
87
|
+
chainId: 'eip155:' + smartWalletClient.chain?.id,
|
|
88
|
+
signature,
|
|
89
|
+
walletClientType: 'smart_wallet',
|
|
90
|
+
connectorType: 'kernel',
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 5: Register in Accounts Smart Contract
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
const receipt = await sdk.crypto.accountContract.registerInAccounts();
|
|
98
|
+
const isRegistered = await sdk.crypto.accountContract.isWalletInAccounts();
|
|
99
|
+
console.log('Registered in contract:', isRegistered);
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 6: Register in API
|
|
103
|
+
|
|
104
|
+
**Option A: Using Privy auth**
|
|
105
|
+
```typescript
|
|
106
|
+
import { getAccessToken, useIdentityToken } from '@privy-io/react-auth';
|
|
107
|
+
|
|
108
|
+
const accessToken = await getAccessToken();
|
|
109
|
+
const { identityToken } = useIdentityToken();
|
|
110
|
+
|
|
111
|
+
const userResponse = await sdk.auth.registerUser({
|
|
112
|
+
privy: {
|
|
113
|
+
accessToken: accessToken,
|
|
114
|
+
identityToken: identityToken,
|
|
115
|
+
},
|
|
116
|
+
country: 'FR',
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Option B: Using JWT token**
|
|
121
|
+
```typescript
|
|
122
|
+
const userResponse = await sdk.auth.registerUser({
|
|
123
|
+
authorizationToken: 'your-jwt-token',
|
|
124
|
+
country: 'FR',
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 7: Login to API
|
|
129
|
+
|
|
130
|
+
**Option A: Using Privy auth**
|
|
131
|
+
```typescript
|
|
132
|
+
const authResponse = await sdk.auth.login({
|
|
133
|
+
privy: {
|
|
134
|
+
accessToken: accessToken,
|
|
135
|
+
identityToken: identityToken,
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
console.log('Access token:', authResponse.access_token);
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Option B: Using JWT token**
|
|
142
|
+
```typescript
|
|
143
|
+
const authResponse = await sdk.auth.login({
|
|
144
|
+
authorizationToken: 'your-jwt-token',
|
|
145
|
+
});
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## SDK Modules
|
|
151
|
+
|
|
152
|
+
### `sdk.auth` — Authentication Service
|
|
153
|
+
|
|
154
|
+
| Method | Description |
|
|
155
|
+
|--------|-------------|
|
|
156
|
+
| `login(params)` | Login retail user (Privy or JWT) |
|
|
157
|
+
| `loginCompany(params)` | Login company/corporation |
|
|
158
|
+
| `registerUser(params)` | Register retail user |
|
|
159
|
+
| `registerCompany(params)` | Register company/corporation |
|
|
160
|
+
| `getAccessToken()` | Get current access token (returns `null` if expired) |
|
|
161
|
+
| `isAuthenticated()` | Check if user is authenticated |
|
|
162
|
+
| `getUserWallet()` | Get current user wallet address |
|
|
163
|
+
| `setUserWallet(wallet)` | Set user wallet address |
|
|
164
|
+
| `setAuthState(response, userWallet?)` | Manually set auth state from an auth response |
|
|
165
|
+
| `ensureAuthenticated()` | Throws `AuthenticationError` if not authenticated |
|
|
166
|
+
| `clearAuth()` | Clear all authentication state |
|
|
167
|
+
| `getAuthHeaders()` | Get `Authorization` and `X-User-Wallet` headers |
|
|
168
|
+
|
|
169
|
+
**Authentication Parameters:**
|
|
170
|
+
|
|
171
|
+
All auth methods accept either Privy tokens or a JWT authorization token:
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
// Option 1: Privy authentication
|
|
175
|
+
{
|
|
176
|
+
privy: {
|
|
177
|
+
accessToken: string; // Privy access token
|
|
178
|
+
identityToken: string; // Privy identity token
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Option 2: JWT authentication
|
|
183
|
+
{
|
|
184
|
+
authorizationToken: string; // Your JWT token
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Company Registration Parameters:**
|
|
189
|
+
```typescript
|
|
190
|
+
interface RegisterCompanyParams {
|
|
191
|
+
privy?: PrivyAuth;
|
|
192
|
+
authorizationToken?: string;
|
|
193
|
+
companyAddress: string;
|
|
194
|
+
companyName: string;
|
|
195
|
+
registrationCountry: string;
|
|
196
|
+
registrationNumber: string;
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
### `sdk.crypto.wallet` — Wallet Service
|
|
203
|
+
|
|
204
|
+
| Method | Description |
|
|
205
|
+
|--------|-------------|
|
|
206
|
+
| `getSmartWalletAddress()` | Get Smart Wallet address |
|
|
207
|
+
| `getSmartWalletClient()` | Get Kernel client with Policy |
|
|
208
|
+
| `getSmartWalletClientWithoutPolicy()` | Get Kernel client without Policy |
|
|
209
|
+
| `getSmartAccountSigner()` | Get signer for Smart Account |
|
|
210
|
+
| `getMainWalletClient()` | Get main wallet client |
|
|
211
|
+
| `sendUserOperationsAndWaitReceipt(callData, smartWalletClient?)` | Send user operations and wait for receipt |
|
|
212
|
+
| `sendUserOperationsWithNonceAndWaitReceipt(callData, nonce)` | Send user operations with specific nonce |
|
|
213
|
+
| `invalidateLocalCache()` | Clear cached wallet clients |
|
|
214
|
+
|
|
215
|
+
### `sdk.crypto.accountAbstraction` — Account Abstraction Service
|
|
216
|
+
|
|
217
|
+
| Method | Description |
|
|
218
|
+
|--------|-------------|
|
|
219
|
+
| `isPolicyInstalled()` | Check if Execution Delay Policy is installed |
|
|
220
|
+
| `isExecutorInstalled()` | Check if Funds Management Executor is installed |
|
|
221
|
+
| `signInPolicyAndExecutor()` | Install Policy and Executor together |
|
|
222
|
+
| `signInPolicy()` | Install Policy only |
|
|
223
|
+
| `signInExecutor()` | Install Executor only |
|
|
224
|
+
|
|
225
|
+
### `sdk.crypto.accountContract` — Account Contract Service
|
|
226
|
+
|
|
227
|
+
| Method | Description |
|
|
228
|
+
|--------|-------------|
|
|
229
|
+
| `isWalletInAccounts()` | Check if wallet is registered in Accounts contract |
|
|
230
|
+
| `registerInAccounts()` | Register wallet in Accounts contract (retail) |
|
|
231
|
+
| `isWalletInCorporateAccounts()` | Check if wallet is registered in Corporate Accounts contract |
|
|
232
|
+
| `registerInCorporateAccounts()` | Register wallet in Corporate Accounts contract (B2B) |
|
|
233
|
+
|
|
234
|
+
### `sdk.crypto.transfer` — Transfer Service
|
|
235
|
+
|
|
236
|
+
| Method | Description |
|
|
237
|
+
|--------|-------------|
|
|
238
|
+
| `makeFullErc20Transfer(params)` | Full ERC20 transfer (two steps in one) |
|
|
239
|
+
| `makeErc20TransferFirstPart(params)` | First part: create withdrawal request |
|
|
240
|
+
| `makeErc20TransferFinal(callData)` | Second part: complete the transfer |
|
|
241
|
+
| `makeErc20TransferSynthetic(params)` | Transfer synthetic tokens |
|
|
242
|
+
| `batchTransfer(params)` | Execute multiple transfers in a batch |
|
|
243
|
+
|
|
244
|
+
**Transfer Parameters:**
|
|
245
|
+
```typescript
|
|
246
|
+
interface Erc20TransferParams {
|
|
247
|
+
tokenAddress: `0x${string}`;
|
|
248
|
+
recipientAddress: `0x${string}`;
|
|
249
|
+
amount: number;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
interface BatchTransferParams {
|
|
253
|
+
items: BatchTransferItem[];
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
interface BatchTransferItem {
|
|
257
|
+
to: `0x${string}`;
|
|
258
|
+
amount: string;
|
|
259
|
+
token: string;
|
|
260
|
+
guid: string;
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### `sdk.crypto.yield` — Yield Service
|
|
265
|
+
|
|
266
|
+
| Method | Description |
|
|
267
|
+
|--------|-------------|
|
|
268
|
+
| `fetchYieldData()` | Get yield data (APY, pending, weekly, lifetime) |
|
|
269
|
+
| `getYieldDataForGraphic()` | Get data for graph visualization |
|
|
270
|
+
| `getWeeklyYield()` | Get weekly yield |
|
|
271
|
+
| `withdraw()` | Withdraw accumulated yield |
|
|
272
|
+
| `switchYieldToken(token)` | Switch yield token |
|
|
273
|
+
|
|
274
|
+
**YieldData Structure:**
|
|
275
|
+
```typescript
|
|
276
|
+
interface YieldData {
|
|
277
|
+
tokenSymbol: string;
|
|
278
|
+
apy: string;
|
|
279
|
+
currentYield: string;
|
|
280
|
+
weeklyYield: string;
|
|
281
|
+
lifetimeYield: string;
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### `sdk.crypto.smartDepositAddress` — Smart Deposit Addresses
|
|
286
|
+
|
|
287
|
+
| Method | Description |
|
|
288
|
+
|--------|-------------|
|
|
289
|
+
| `initializeSmartDepositAddresses(forceRefresh?)` | Create/get all deposit addresses |
|
|
290
|
+
| `getAddresses()` | Get cached addresses |
|
|
291
|
+
| `clearAddresses()` | Clear address cache |
|
|
292
|
+
|
|
293
|
+
**Supported Networks:**
|
|
294
|
+
- EVM: Base, Arbitrum, BNB Chain, Ethereum, Kaia, Polygon, Optimism
|
|
295
|
+
- TRON
|
|
296
|
+
- Solana
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
### `sdk.api.wallets` — Wallets API
|
|
301
|
+
|
|
302
|
+
| Method | Description |
|
|
303
|
+
|--------|-------------|
|
|
304
|
+
| `getBalances()` | Get wallet balances |
|
|
305
|
+
|
|
306
|
+
### `sdk.api.withdrawal` — Withdrawal API
|
|
307
|
+
|
|
308
|
+
| Method | Description |
|
|
309
|
+
|--------|-------------|
|
|
310
|
+
| `getWithdrawalRequests()` | Get list of withdrawal requests |
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
### `sdk.api.baas` — BaaS Module
|
|
315
|
+
|
|
316
|
+
Banking-as-a-Service module with the following sub-services:
|
|
317
|
+
|
|
318
|
+
#### `sdk.api.baas.user` — User Service
|
|
319
|
+
|
|
320
|
+
| Method | Description |
|
|
321
|
+
|--------|-------------|
|
|
322
|
+
| `getUser()` | Get current user |
|
|
323
|
+
| `getUserV2()` | Get current user (v2) |
|
|
324
|
+
| `createUser(request)` | Create a new user |
|
|
325
|
+
| `createRetailUser(request)` | Create a retail user |
|
|
326
|
+
| `validateRetailUser()` | Validate retail user |
|
|
327
|
+
| `authorizeUser(params)` | Authorize user |
|
|
328
|
+
| `updatePhoneNumber(request)` | Update phone number |
|
|
329
|
+
| `confirmPhoneNumber(request)` | Confirm phone number via OTP |
|
|
330
|
+
| `uploadDocument(formData)` | Upload verification document |
|
|
331
|
+
| `updateFreshdeskId(request)` | Update Freshdesk ID |
|
|
332
|
+
| `getSharingToken(request)` | Get sharing token |
|
|
333
|
+
| `setSharingToken(request)` | Set sharing token |
|
|
334
|
+
| `getVerificationToken()` | Get verification token |
|
|
335
|
+
| `getVerificationLink()` | Get verification link |
|
|
336
|
+
|
|
337
|
+
#### `sdk.api.baas.activity` — Activity Service
|
|
338
|
+
|
|
339
|
+
| Method | Description |
|
|
340
|
+
|--------|-------------|
|
|
341
|
+
| `getFeed(request?)` | Get activity feed |
|
|
342
|
+
| `getById(request)` | Get activity by ID |
|
|
343
|
+
| `getFullStatement(request)` | Get full statement |
|
|
344
|
+
| `getRequestedErcWithdrawals()` | Get requested ERC withdrawals |
|
|
345
|
+
|
|
346
|
+
#### `sdk.api.baas.bank` — Bank Service
|
|
347
|
+
|
|
348
|
+
| Method | Description |
|
|
349
|
+
|--------|-------------|
|
|
350
|
+
| `getAccounts(request?)` | Get bank accounts |
|
|
351
|
+
| `activateAccount(request)` | Activate bank account |
|
|
352
|
+
| `estimateTransfer(request)` | Estimate bank transfer |
|
|
353
|
+
| `executeTransfer(request)` | Execute bank transfer |
|
|
354
|
+
| `estimateCorridorTransferV2(corridor, request)` | Estimate corridor transfer (v2) |
|
|
355
|
+
| `executeCorridorTransferV2(corridor, request)` | Execute corridor transfer (v2) |
|
|
356
|
+
|
|
357
|
+
#### `sdk.api.baas.cards` — Cards Service
|
|
358
|
+
|
|
359
|
+
| Method | Description |
|
|
360
|
+
|--------|-------------|
|
|
361
|
+
| `getCards(request?)` | Get user cards |
|
|
362
|
+
| `getCard(cardId)` | Get card details |
|
|
363
|
+
| `getCardTransactions(request?)` | Get card transactions |
|
|
364
|
+
| `issuePlasticCard(request)` | Issue a plastic card |
|
|
365
|
+
| `issueVirtualCard(request)` | Issue a virtual card |
|
|
366
|
+
| `activateCard(cardId, request)` | Activate card |
|
|
367
|
+
| `blockCard(cardId)` | Block card |
|
|
368
|
+
| `unblockCard(cardId)` | Unblock card |
|
|
369
|
+
| `closeCard(cardId)` | Close card |
|
|
370
|
+
| `getCardDetails(cardId, request)` | Get card PAN and expiry |
|
|
371
|
+
| `getCardCvv(cardId, request)` | Get card CVV |
|
|
372
|
+
| `getCardPin(cardId, request)` | Get card PIN |
|
|
373
|
+
| `changeCardLimit(cardId, request)` | Change card limit |
|
|
374
|
+
| `changeCardName(cardId, request)` | Change card name |
|
|
375
|
+
| `estimateCardTransfer(request)` | Estimate card transfer |
|
|
376
|
+
| `executeCardTransfer(request)` | Execute card transfer |
|
|
377
|
+
| `estimateCardWithdrawal(cardId, request)` | Estimate card withdrawal |
|
|
378
|
+
| `executeCardWithdrawal(cardId, request)` | Execute card withdrawal |
|
|
379
|
+
| `getActive3dsRequests()` | Get active 3DS requests |
|
|
380
|
+
| `approve3dsRequest(transactionId)` | Approve 3DS request |
|
|
381
|
+
| `decline3dsRequest(transactionId)` | Decline 3DS request |
|
|
382
|
+
| `getDeliveryCountries()` | Get card delivery countries |
|
|
383
|
+
| `getDeliveryMethods(country)` | Get card delivery methods |
|
|
384
|
+
| `getOrderFees(type, country)` | Get card order fees |
|
|
385
|
+
| `createOrderFeesInvoice(type, country, request)` | Create order fees invoice |
|
|
386
|
+
|
|
387
|
+
#### `sdk.api.baas.config` — Config Service
|
|
388
|
+
|
|
389
|
+
| Method | Description |
|
|
390
|
+
|--------|-------------|
|
|
391
|
+
| `getConfig()` | Get client app config |
|
|
392
|
+
|
|
393
|
+
#### `sdk.api.baas.confirmation` — Confirmation Service
|
|
394
|
+
|
|
395
|
+
| Method | Description |
|
|
396
|
+
|--------|-------------|
|
|
397
|
+
| `verifySignature(request)` | Verify signature for action confirmation |
|
|
398
|
+
| `requestSms(request)` | Request SMS confirmation code |
|
|
399
|
+
| `verifySms(request)` | Verify SMS confirmation code |
|
|
400
|
+
|
|
401
|
+
#### `sdk.api.baas.recipients` — Recipients Service
|
|
402
|
+
|
|
403
|
+
| Method | Description |
|
|
404
|
+
|--------|-------------|
|
|
405
|
+
| `getRecipients(request?)` | Get all recipients |
|
|
406
|
+
| `getRecipientsByCatalog(request)` | Get recipients by catalog |
|
|
407
|
+
| `getRecipientsByCurrency(request)` | Get recipients by currency |
|
|
408
|
+
| `getRecipientsByName(request)` | Get recipients by name |
|
|
409
|
+
| `getRecipientsByType(request)` | Get recipients by type |
|
|
410
|
+
| `getRecipientById(recipientId)` | Get recipient by ID |
|
|
411
|
+
| `createRecipient(request)` | Create recipient |
|
|
412
|
+
| `createRecipientV2(request)` | Create recipient (v2) |
|
|
413
|
+
| `updateRecipient(recipientId, request)` | Update recipient |
|
|
414
|
+
| `deleteRecipient(recipientId)` | Delete recipient |
|
|
415
|
+
| `createRecipientPaymentDetails(recipientId, request)` | Create payment details |
|
|
416
|
+
| `updateRecipientPaymentDetails(recipientId, paymentDetailsId, request)` | Update payment details |
|
|
417
|
+
| `deleteRecipientPaymentDetails(recipientId, paymentDetailsId)` | Delete payment details |
|
|
418
|
+
| `incrementRecipientUsage(recipientId)` | Increment recipient usage counter |
|
|
419
|
+
|
|
420
|
+
#### `sdk.api.baas.rates` — Rates Service
|
|
421
|
+
|
|
422
|
+
| Method | Description |
|
|
423
|
+
|--------|-------------|
|
|
424
|
+
| `getRates(request)` | Get exchange rates |
|
|
425
|
+
|
|
426
|
+
#### `sdk.api.baas.token` — Token Service
|
|
427
|
+
|
|
428
|
+
| Method | Description |
|
|
429
|
+
|--------|-------------|
|
|
430
|
+
| `getToken(request)` | Get OAuth2 token |
|
|
431
|
+
|
|
432
|
+
#### `sdk.api.baas.wallet` — Wallet Service
|
|
433
|
+
|
|
434
|
+
| Method | Description |
|
|
435
|
+
|--------|-------------|
|
|
436
|
+
| `getWallet(request?)` | Get wallet by ID or default |
|
|
437
|
+
| `getWallets()` | Get all wallets |
|
|
438
|
+
| `createGlobalWallet(request)` | Create global wallet |
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
## Examples
|
|
443
|
+
|
|
444
|
+
### Full Token Transfer
|
|
445
|
+
|
|
446
|
+
```typescript
|
|
447
|
+
const result = await sdk.crypto.transfer.makeFullErc20Transfer({
|
|
448
|
+
tokenAddress: '0x920D17f7A226Ce306f2B51F74a0f0dA89C3b8dF3',
|
|
449
|
+
recipientAddress: '0x...',
|
|
450
|
+
amount: 100,
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
console.log('First part tx:', result.firstPartTxHash);
|
|
454
|
+
console.log('Final tx:', result.finalTxHash);
|
|
455
|
+
console.log('Success:', result.success);
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### Two-Step Transfer
|
|
459
|
+
|
|
460
|
+
```typescript
|
|
461
|
+
// Step 1: Initiate transfer
|
|
462
|
+
const txHash = await sdk.crypto.transfer.makeErc20TransferFirstPart({
|
|
463
|
+
tokenAddress: '0x920D17f7A226Ce306f2B51F74a0f0dA89C3b8dF3',
|
|
464
|
+
recipientAddress: '0x...',
|
|
465
|
+
amount: 100,
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
// Step 2: Get withdrawal requests
|
|
469
|
+
const withdrawals = await sdk.api.withdrawal.getWithdrawalRequests();
|
|
470
|
+
|
|
471
|
+
// Step 3: Complete transfer (after valid_after time)
|
|
472
|
+
await sdk.crypto.transfer.makeErc20TransferFinal(withdrawal.call_data);
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
### Batch Transfer
|
|
476
|
+
|
|
477
|
+
```typescript
|
|
478
|
+
const txHashes = await sdk.crypto.transfer.batchTransfer({
|
|
479
|
+
items: [
|
|
480
|
+
{ to: '0x...', amount: '100', token: 'USDC', guid: 'tx-1' },
|
|
481
|
+
{ to: '0x...', amount: '50', token: 'USDC', guid: 'tx-2' },
|
|
482
|
+
],
|
|
483
|
+
});
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
### Yield Operations
|
|
487
|
+
|
|
488
|
+
```typescript
|
|
489
|
+
const yieldData = await sdk.crypto.yield.fetchYieldData();
|
|
490
|
+
console.log('APY:', yieldData.apy);
|
|
491
|
+
console.log('Pending yield:', yieldData.currentYield);
|
|
492
|
+
await sdk.crypto.yield.withdraw();
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
### Smart Deposit Addresses
|
|
496
|
+
|
|
497
|
+
```typescript
|
|
498
|
+
const addresses = await sdk.crypto.smartDepositAddress.initializeSmartDepositAddresses();
|
|
499
|
+
|
|
500
|
+
addresses.forEach(addr => {
|
|
501
|
+
console.log(`Chain: ${addr.depositChain}`);
|
|
502
|
+
console.log(`Address: ${addr.depositAddress}`);
|
|
503
|
+
console.log(`Tokens: ${addr.supportedTokens.join(', ')}`);
|
|
504
|
+
});
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
## Types
|
|
508
|
+
|
|
509
|
+
```typescript
|
|
510
|
+
import type {
|
|
511
|
+
SDKConfig,
|
|
512
|
+
SDKEnvironment,
|
|
513
|
+
Logger,
|
|
514
|
+
TokenInfo,
|
|
515
|
+
ContractAddresses,
|
|
516
|
+
Hex,
|
|
517
|
+
TransactionHash,
|
|
518
|
+
MainWalletClient,
|
|
519
|
+
TransferRequest,
|
|
520
|
+
TransferResult,
|
|
521
|
+
BatchTransferItem,
|
|
522
|
+
BatchTransferResult,
|
|
523
|
+
YieldData,
|
|
524
|
+
YieldGraphicDataPoint,
|
|
525
|
+
AccountStatus,
|
|
526
|
+
PolicyStatus,
|
|
527
|
+
PrivyAuth,
|
|
528
|
+
LoginUserParams,
|
|
529
|
+
LoginCompanyParams,
|
|
530
|
+
RegisterUserParams,
|
|
531
|
+
RegisterCompanyParams,
|
|
532
|
+
AuthResponse,
|
|
533
|
+
RegisterUserResponse,
|
|
534
|
+
} from '@wirexpay/sdk';
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
## Error Handling
|
|
538
|
+
|
|
539
|
+
The SDK provides typed error classes:
|
|
540
|
+
|
|
541
|
+
| Error | Description |
|
|
542
|
+
|-------|-------------|
|
|
543
|
+
| `SDKError` | Base error class |
|
|
544
|
+
| `ConfigurationError` | Invalid configuration |
|
|
545
|
+
| `NetworkError` | Network/HTTP errors |
|
|
546
|
+
| `ContractError` | Smart contract interaction errors |
|
|
547
|
+
| `WalletError` | Wallet-related errors |
|
|
548
|
+
| `TransactionError` | Transaction execution errors |
|
|
549
|
+
| `AuthenticationError` | Authentication failures |
|
|
550
|
+
| `ValidationError` | Input validation errors |
|
|
551
|
+
|
|
552
|
+
```typescript
|
|
553
|
+
import { SDKError, AuthenticationError } from '@wirexpay/sdk';
|
|
554
|
+
|
|
555
|
+
try {
|
|
556
|
+
await sdk.auth.login({ authorizationToken: 'token' });
|
|
557
|
+
} catch (error) {
|
|
558
|
+
if (error instanceof AuthenticationError) {
|
|
559
|
+
// handle auth error
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
## License
|
|
565
|
+
|
|
566
|
+
MIT
|