@wirexapp/wpay-baas-sdk 0.1.11 → 0.1.12
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
CHANGED
|
@@ -337,10 +337,12 @@ interface YieldData {
|
|
|
337
337
|
|
|
338
338
|
**Destination chain** follows the SDK `chainId`: `8453` / `84532` → `BASE`, `5042` / `5042002` → `ARC`. Rhino.fi has no testnet chains, so testnet ids resolve to the mainnet code.
|
|
339
339
|
|
|
340
|
-
|
|
340
|
+
The destination chain is itself requested as a deposit chain, so the EVM group also holds a same-chain address — `ARC` → `ARC` when the SDK runs on Arc, `BASE` → `BASE` on Base.
|
|
341
|
+
|
|
342
|
+
Deposit chains the destination rejects are skipped with a warning and the remaining chains in the group are still created: no bridgeable route (Rhino.fi `DepositAddressNoBridgableTokens`, e.g. USDT-only Kaia and TRON towards Arc) and chains Rhino.fi has not enabled for deposit addresses (`DepositAddressChainsNotSupported`).
|
|
341
343
|
|
|
342
344
|
**Supported deposit networks:**
|
|
343
|
-
- EVM: Base, Arbitrum, BNB Chain, Ethereum, Kaia, Polygon, Optimism
|
|
345
|
+
- EVM: the destination chain (Base or Arc), Base, Arbitrum, BNB Chain, Ethereum, Kaia, Polygon, Optimism
|
|
344
346
|
- TRON
|
|
345
347
|
- Solana
|
|
346
348
|
- Stellar
|
|
@@ -4814,6 +4814,9 @@ var supportedEVMChains = [
|
|
|
4814
4814
|
SupportedChains.POLYGON,
|
|
4815
4815
|
SupportedChains.OPTIMISM
|
|
4816
4816
|
];
|
|
4817
|
+
function getEvmDepositChains(destinationChain) {
|
|
4818
|
+
return supportedEVMChains.includes(destinationChain) ? [...supportedEVMChains] : [destinationChain, ...supportedEVMChains];
|
|
4819
|
+
}
|
|
4817
4820
|
var RHINO_DESTINATION_CHAIN_BY_CHAIN_ID = {
|
|
4818
4821
|
8453: SupportedChains.BASE,
|
|
4819
4822
|
84532: SupportedChains.BASE,
|
|
@@ -4832,12 +4835,19 @@ function resolveRhinoDestinationChain(chainId) {
|
|
|
4832
4835
|
}
|
|
4833
4836
|
var SYSTEM_SUPPORTED_TOKENS = ["USDT", "USDC", "EURC"];
|
|
4834
4837
|
var NO_BRIDGEABLE_TOKENS_TAG = "DepositAddressNoBridgableTokens";
|
|
4835
|
-
|
|
4838
|
+
var CHAINS_NOT_SUPPORTED_TAG = "DepositAddressChainsNotSupported";
|
|
4839
|
+
function getRejectedChains(error) {
|
|
4836
4840
|
if (!error || typeof error !== "object") {
|
|
4837
|
-
return
|
|
4841
|
+
return [];
|
|
4842
|
+
}
|
|
4843
|
+
const { _tag, from, chains } = error;
|
|
4844
|
+
if (_tag === NO_BRIDGEABLE_TOKENS_TAG) {
|
|
4845
|
+
return typeof from === "string" ? [from] : [];
|
|
4838
4846
|
}
|
|
4839
|
-
|
|
4840
|
-
|
|
4847
|
+
if (_tag === CHAINS_NOT_SUPPORTED_TAG && Array.isArray(chains)) {
|
|
4848
|
+
return chains.filter((chain) => typeof chain === "string");
|
|
4849
|
+
}
|
|
4850
|
+
return [];
|
|
4841
4851
|
}
|
|
4842
4852
|
var SmartDepositAddressesService = class {
|
|
4843
4853
|
constructor(config) {
|
|
@@ -4905,14 +4915,16 @@ var SmartDepositAddressesService = class {
|
|
|
4905
4915
|
if (response.response.status === 200 && response.data) {
|
|
4906
4916
|
return this.activateDepositAddresses(sdk, response.data);
|
|
4907
4917
|
}
|
|
4908
|
-
const
|
|
4909
|
-
|
|
4918
|
+
const rejectedChains = getRejectedChains(response.error).filter(
|
|
4919
|
+
(chain) => depositChains.includes(chain)
|
|
4920
|
+
);
|
|
4921
|
+
if (rejectedChains.length === 0) {
|
|
4910
4922
|
throw new Error(JSON.stringify(response.error));
|
|
4911
4923
|
}
|
|
4912
4924
|
console.warn(
|
|
4913
|
-
`
|
|
4925
|
+
`Rhino.fi rejected deposit chains ${rejectedChains.join(", ")} for destination ${this.destinationChain}, skipping them`
|
|
4914
4926
|
);
|
|
4915
|
-
depositChains = depositChains.filter((chain) => chain
|
|
4927
|
+
depositChains = depositChains.filter((chain) => !rejectedChains.includes(chain));
|
|
4916
4928
|
}
|
|
4917
4929
|
return [];
|
|
4918
4930
|
}
|
|
@@ -4952,7 +4964,7 @@ var SmartDepositAddressesService = class {
|
|
|
4952
4964
|
}
|
|
4953
4965
|
async createSmartDepositAddresses() {
|
|
4954
4966
|
const results = await Promise.allSettled([
|
|
4955
|
-
this.createSmartDepositAddressForChains(
|
|
4967
|
+
this.createSmartDepositAddressForChains(getEvmDepositChains(this.destinationChain)),
|
|
4956
4968
|
this.createSmartDepositAddressForChains([SupportedChains.TRON]),
|
|
4957
4969
|
this.createSmartDepositAddressForChains([SupportedChains.SOLANA]),
|
|
4958
4970
|
this.createSmartDepositAddressForChains([STELLAR_CHAIN])
|
|
@@ -5010,7 +5022,7 @@ var SmartDepositAddressesService = class {
|
|
|
5010
5022
|
getChainsForGroup(chainGroup) {
|
|
5011
5023
|
switch (chainGroup) {
|
|
5012
5024
|
case "evm":
|
|
5013
|
-
return
|
|
5025
|
+
return getEvmDepositChains(this.destinationChain);
|
|
5014
5026
|
case "tron":
|
|
5015
5027
|
return [SupportedChains.TRON];
|
|
5016
5028
|
case "solana":
|
|
@@ -5022,7 +5034,7 @@ var SmartDepositAddressesService = class {
|
|
|
5022
5034
|
}
|
|
5023
5035
|
}
|
|
5024
5036
|
getChainGroupByChainCode(chainCode) {
|
|
5025
|
-
if (
|
|
5037
|
+
if (getEvmDepositChains(this.destinationChain).includes(chainCode)) {
|
|
5026
5038
|
return "evm";
|
|
5027
5039
|
}
|
|
5028
5040
|
if (chainCode === SupportedChains.TRON) {
|
|
@@ -5198,5 +5210,5 @@ var CryptoModule = class {
|
|
|
5198
5210
|
};
|
|
5199
5211
|
|
|
5200
5212
|
export { BaseAccountAbstractionService, BaseAccountContractService, BaseCryptoService, BaseOnboardingService, BaseWalletService, BaseYieldService, ContractRegistryService, CryptoModule, chainRegistry };
|
|
5201
|
-
//# sourceMappingURL=chunk-
|
|
5202
|
-
//# sourceMappingURL=chunk-
|
|
5213
|
+
//# sourceMappingURL=chunk-IAY3T66T.js.map
|
|
5214
|
+
//# sourceMappingURL=chunk-IAY3T66T.js.map
|