@0xsquid/react-hooks 8.11.0 → 8.11.1-beta-danal.1
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/dist/core/client/index.d.ts +1 -0
- package/dist/core/constants.d.ts +2 -0
- package/dist/core/types/danal.d.ts +1 -0
- package/dist/core/types/wallet.d.ts +7 -0
- package/dist/hooks/chains/useSquidChains.d.ts +1 -0
- package/dist/hooks/store/useDepositAddressStore.d.ts +6 -0
- package/dist/hooks/swap/useDepositAddress.d.ts +2 -0
- package/dist/hooks/tokens/useSquidTokens.d.ts +1 -0
- package/dist/hooks/wallet/useMultiChainWallet.d.ts +38 -0
- package/dist/hooks/wallet/useWallet.d.ts +42 -0
- package/dist/{index-BzTFES6t.js → index-BT6G_mgr.js} +143 -18
- package/dist/index-BT6G_mgr.js.map +1 -0
- package/dist/{index-D5bkikGx.js → index-D6rznmR_.js} +140 -19
- package/dist/index-D6rznmR_.js.map +1 -0
- package/dist/{index.es-DaKI7v5_.js → index.es-BZb8tg2z.js} +2 -2
- package/dist/{index.es-DaKI7v5_.js.map → index.es-BZb8tg2z.js.map} +1 -1
- package/dist/{index.es-wL3I3c3h.js → index.es-Dl19u5sy.js} +2 -2
- package/dist/{index.es-wL3I3c3h.js.map → index.es-Dl19u5sy.js.map} +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/{secretService-BMH_eXJd.js → secretService-Dvc9Dg4U.js} +2 -2
- package/dist/{secretService-BMH_eXJd.js.map → secretService-Dvc9Dg4U.js.map} +1 -1
- package/dist/{secretService-D70MRo5w.js → secretService-TP5V9Jwg.js} +2 -2
- package/dist/{secretService-D70MRo5w.js.map → secretService-TP5V9Jwg.js.map} +1 -1
- package/dist/server.esm.js +6 -0
- package/dist/server.esm.js.map +1 -1
- package/dist/server.js +6 -0
- package/dist/server.js.map +1 -1
- package/dist/services/index.d.ts +1 -0
- package/dist/services/internal/danalService.d.ts +8 -0
- package/dist/services/internal/transactionService.d.ts +8 -0
- package/dist/{stellarService.client-DhwF4F1c.js → stellarService.client-WTkVJJhn.js} +2 -2
- package/dist/{stellarService.client-DhwF4F1c.js.map → stellarService.client-WTkVJJhn.js.map} +1 -1
- package/dist/{stellarService.client-BpCW1qZY.js → stellarService.client-c48cnGgL.js} +2 -2
- package/dist/{stellarService.client-BpCW1qZY.js.map → stellarService.client-c48cnGgL.js.map} +1 -1
- package/dist/tests/danalService.test.d.ts +1 -0
- package/package.json +2 -2
- package/dist/index-BzTFES6t.js.map +0 -1
- package/dist/index-D5bkikGx.js.map +0 -1
|
@@ -80,6 +80,7 @@ const suiZeroAddress = "0x0000000000000000000000000000000000000000";
|
|
|
80
80
|
const xrplZeroAddress = "rrrrrrrrrrrrrrrrrrrrrhoLvTp";
|
|
81
81
|
const stellarZeroAddress = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF";
|
|
82
82
|
const cantonZeroAddress = "none::12200000000000000000000000000000000000000000000000000000000000000000";
|
|
83
|
+
const danalZeroAddress = "PCI00000000000000000000000000000000000000000000000000";
|
|
83
84
|
const chainTypeToZeroAddressMap = {
|
|
84
85
|
[squidTypes.ChainType.EVM]: viem.zeroAddress,
|
|
85
86
|
[squidTypes.ChainType.COSMOS]: cosmosZeroAddress,
|
|
@@ -89,6 +90,7 @@ const chainTypeToZeroAddressMap = {
|
|
|
89
90
|
[squidTypes.ChainType.XRPL]: xrplZeroAddress,
|
|
90
91
|
[squidTypes.ChainType.STELLAR]: stellarZeroAddress,
|
|
91
92
|
[squidTypes.ChainType.CANTON]: cantonZeroAddress,
|
|
93
|
+
[squidTypes.ChainType.DANAL]: danalZeroAddress,
|
|
92
94
|
};
|
|
93
95
|
const nativeEvmTokenAddress = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
94
96
|
const nativeCosmosTokenAddress = "uosmo";
|
|
@@ -98,6 +100,7 @@ const nativeSuiTokenAddress = "0x00000000000000000000000000000000000000000000000
|
|
|
98
100
|
const nativeXrplTokenAddress = "xrp";
|
|
99
101
|
const nativeStellarTokenAddress = "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA";
|
|
100
102
|
const nativeCantonTokenAddress = "DSO::1220b1431ef217342db44d516bb9befde802be7d8899637d290895fa58880f19accc";
|
|
103
|
+
const nativeDanalTokenAddress = "pci";
|
|
101
104
|
// by setting slippage to undefined, it's set to "auto"
|
|
102
105
|
const defaultSlippage = undefined;
|
|
103
106
|
const destinationAddressResetValue = "null";
|
|
@@ -163,6 +166,7 @@ const CHAIN_IDS = {
|
|
|
163
166
|
STELLAR: "stellar-mainnet",
|
|
164
167
|
STELLAR_TESTNET: "stellar-testnet",
|
|
165
168
|
CANTON: "canton",
|
|
169
|
+
DANAL_TESTNET: "danal-testnet",
|
|
166
170
|
};
|
|
167
171
|
const chainTypeToDefaultChainIdMap = {
|
|
168
172
|
[squidTypes.ChainType.EVM]: CHAIN_IDS.ETHEREUM,
|
|
@@ -173,6 +177,7 @@ const chainTypeToDefaultChainIdMap = {
|
|
|
173
177
|
[squidTypes.ChainType.XRPL]: CHAIN_IDS.XRPL,
|
|
174
178
|
[squidTypes.ChainType.STELLAR]: CHAIN_IDS.STELLAR,
|
|
175
179
|
[squidTypes.ChainType.CANTON]: CHAIN_IDS.CANTON,
|
|
180
|
+
[squidTypes.ChainType.DANAL]: CHAIN_IDS.DANAL_TESTNET,
|
|
176
181
|
};
|
|
177
182
|
const chainTypeToNativeTokenAddressMap = {
|
|
178
183
|
[squidTypes.ChainType.EVM]: nativeEvmTokenAddress,
|
|
@@ -183,6 +188,7 @@ const chainTypeToNativeTokenAddressMap = {
|
|
|
183
188
|
[squidTypes.ChainType.XRPL]: nativeXrplTokenAddress,
|
|
184
189
|
[squidTypes.ChainType.STELLAR]: nativeStellarTokenAddress,
|
|
185
190
|
[squidTypes.ChainType.CANTON]: nativeCantonTokenAddress,
|
|
191
|
+
[squidTypes.ChainType.DANAL]: nativeDanalTokenAddress,
|
|
186
192
|
};
|
|
187
193
|
const defaultConfigValues = {
|
|
188
194
|
integratorId: INTEGRATOR_ID,
|
|
@@ -21126,6 +21132,41 @@ function groupCantonHoldingBalances(acsResponse) {
|
|
|
21126
21132
|
return Object.fromEntries(Object.entries(totals).map(([key, total]) => [key, total.toString(10)]));
|
|
21127
21133
|
}
|
|
21128
21134
|
|
|
21135
|
+
// Matches the backend validation: "PCI" + 50 uppercase-hex chars, case-sensitive.
|
|
21136
|
+
const DANAL_ADDRESS_REGEX = /^PCI[0-9A-F]{50}$/;
|
|
21137
|
+
function isDanalAddressValid(address) {
|
|
21138
|
+
if (!address)
|
|
21139
|
+
return false;
|
|
21140
|
+
return DANAL_ADDRESS_REGEX.test(address);
|
|
21141
|
+
}
|
|
21142
|
+
// Fabric transaction id: 64 hex chars, no 0x prefix
|
|
21143
|
+
const DANAL_TX_HASH_REGEX = /^[0-9a-fA-F]{64}$/;
|
|
21144
|
+
function isDanalTxHashValid(hash) {
|
|
21145
|
+
if (!hash)
|
|
21146
|
+
return false;
|
|
21147
|
+
return DANAL_TX_HASH_REGEX.test(hash);
|
|
21148
|
+
}
|
|
21149
|
+
function isDanalTransferRequestBody(value) {
|
|
21150
|
+
if (typeof value !== "object" || value === null)
|
|
21151
|
+
return false;
|
|
21152
|
+
const { receiver, amount, memo } = value;
|
|
21153
|
+
return (typeof receiver === "string" &&
|
|
21154
|
+
receiver.length > 0 &&
|
|
21155
|
+
typeof amount === "string" &&
|
|
21156
|
+
amount.length > 0 &&
|
|
21157
|
+
typeof memo === "string" &&
|
|
21158
|
+
memo.length > 0);
|
|
21159
|
+
}
|
|
21160
|
+
function parseDanalTransferBody(data) {
|
|
21161
|
+
try {
|
|
21162
|
+
const parsed = JSON.parse(data);
|
|
21163
|
+
return isDanalTransferRequestBody(parsed) ? parsed : null;
|
|
21164
|
+
}
|
|
21165
|
+
catch {
|
|
21166
|
+
return null;
|
|
21167
|
+
}
|
|
21168
|
+
}
|
|
21169
|
+
|
|
21129
21170
|
const solanaTokenProgramIdByAddress = {
|
|
21130
21171
|
[splToken.TOKEN_PROGRAM_ID.toBase58()]: splToken.TOKEN_PROGRAM_ID,
|
|
21131
21172
|
[splToken.TOKEN_2022_PROGRAM_ID.toBase58()]: splToken.TOKEN_2022_PROGRAM_ID,
|
|
@@ -21462,6 +21503,15 @@ function isOnChainTxData(squidData) {
|
|
|
21462
21503
|
function isDepositAddressDirectTransferRoute(squidData) {
|
|
21463
21504
|
return squidData.type === squidTypes.SquidDataType.DepositAddressDirectTransfer;
|
|
21464
21505
|
}
|
|
21506
|
+
/**
|
|
21507
|
+
* Danal keeps SquidDataType.DepositAddressWithMemo, which XRPL/Stellar use for
|
|
21508
|
+
* wallet-signed transactions — so the deposit treatment is gated on the chain,
|
|
21509
|
+
* not just the type
|
|
21510
|
+
*/
|
|
21511
|
+
function isDanalDepositRoute(route) {
|
|
21512
|
+
return (route.params.fromChain === CHAIN_IDS.DANAL_TESTNET &&
|
|
21513
|
+
route.transactionRequest?.type === squidTypes.SquidDataType.DepositAddressWithMemo);
|
|
21514
|
+
}
|
|
21465
21515
|
function getHistoryTransactionId(tx) {
|
|
21466
21516
|
switch (tx.txType) {
|
|
21467
21517
|
case exports.HistoryTxType.SWAP:
|
|
@@ -21986,6 +22036,11 @@ const chainTypeToTrimLength = {
|
|
|
21986
22036
|
start: 3,
|
|
21987
22037
|
end: 3,
|
|
21988
22038
|
},
|
|
22039
|
+
// PCI0180...E77E
|
|
22040
|
+
[squidTypes.ChainType.DANAL]: {
|
|
22041
|
+
start: 7,
|
|
22042
|
+
end: 4,
|
|
22043
|
+
},
|
|
21989
22044
|
};
|
|
21990
22045
|
const truncateWithEllipsis = (value, startLength, endLength) => value.length <= startLength + endLength
|
|
21991
22046
|
? value
|
|
@@ -22034,6 +22089,8 @@ const isWalletAddressValid = (chainData, address) => {
|
|
|
22034
22089
|
return isStellarAddressValid(address);
|
|
22035
22090
|
case squidTypes.ChainType.CANTON:
|
|
22036
22091
|
return isCantonAddressValid(address);
|
|
22092
|
+
case squidTypes.ChainType.DANAL:
|
|
22093
|
+
return isDanalAddressValid(address);
|
|
22037
22094
|
}
|
|
22038
22095
|
};
|
|
22039
22096
|
const redirectToExtensionsStore = (wallet) => {
|
|
@@ -22318,6 +22375,8 @@ const connectByChainType = async (chainType, wallet, defaultChain, params) => {
|
|
|
22318
22375
|
connector,
|
|
22319
22376
|
},
|
|
22320
22377
|
});
|
|
22378
|
+
case squidTypes.ChainType.DANAL:
|
|
22379
|
+
return null;
|
|
22321
22380
|
}
|
|
22322
22381
|
};
|
|
22323
22382
|
const getChainTypesToConnect = (selectedChainTypes, defaultChain, supportedChains) => {
|
|
@@ -23302,7 +23361,7 @@ const handleDestinationAddressOnSwapChange = ({ fromChainId, fromTokenAddress, t
|
|
|
23302
23361
|
});
|
|
23303
23362
|
let destinationTokenAddress = toChainId && !toTokenAddress
|
|
23304
23363
|
? defaultToAddress
|
|
23305
|
-
:
|
|
23364
|
+
: toTokenAddress ?? swapRoute?.toTokenAddress;
|
|
23306
23365
|
const lowerCaseDestinationTokenAddress = destinationTokenAddress?.toLowerCase();
|
|
23307
23366
|
if (destinationTokensFiltered.find((t) => t.address === lowerCaseDestinationTokenAddress) === undefined) {
|
|
23308
23367
|
destinationTokenAddress = defaultToAddress;
|
|
@@ -23354,7 +23413,7 @@ const getNewSwapParamsFromInput = ({ inputParams, initialSwapRoute, tokens, chai
|
|
|
23354
23413
|
toTokenAddress === initialSwapRoute?.fromTokenAddress;
|
|
23355
23414
|
const sourceTokenAddress = sameNewDestAndInitialSource || onlySourceChainIdChanged
|
|
23356
23415
|
? defaultFromAddress
|
|
23357
|
-
:
|
|
23416
|
+
: fromTokenAddress ?? initialSwapRoute?.fromTokenAddress;
|
|
23358
23417
|
let destinationTokenAddress = undefined;
|
|
23359
23418
|
if (!sameNewSourceAndInitialDest) {
|
|
23360
23419
|
if (onlySourceChainIdChanged) {
|
|
@@ -23676,7 +23735,7 @@ const filterViewableTokens = (tokens, config, direction) => {
|
|
|
23676
23735
|
};
|
|
23677
23736
|
const getSecretNetworkBalances = async (chainData, cosmosAddress, squidTokens, keplrTypeWallet) => {
|
|
23678
23737
|
const squidSecretTokens = squidTokens.filter((t) => t.chainId === CHAIN_IDS.SECRET);
|
|
23679
|
-
const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-
|
|
23738
|
+
const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-TP5V9Jwg.js'); });
|
|
23680
23739
|
return fetchAllSecretBalances(chainData, cosmosAddress, squidSecretTokens, keplrTypeWallet);
|
|
23681
23740
|
};
|
|
23682
23741
|
function getTokenAssetsKey(token) {
|
|
@@ -25670,7 +25729,7 @@ const useSquidTokens = (direction) => {
|
|
|
25670
25729
|
config.availableChains,
|
|
25671
25730
|
direction,
|
|
25672
25731
|
]);
|
|
25673
|
-
const { evmTokens, cosmosTokens, solanaTokens, bitcoinTokens, suiTokens, xrplTokens, stellarTokens, cantonTokens, } = React.useMemo(() => {
|
|
25732
|
+
const { evmTokens, cosmosTokens, solanaTokens, bitcoinTokens, suiTokens, xrplTokens, stellarTokens, cantonTokens, danalTokens, } = React.useMemo(() => {
|
|
25674
25733
|
return tokens?.reduce((acc, token) => {
|
|
25675
25734
|
switch (token.type) {
|
|
25676
25735
|
case squidTypes.ChainType.EVM:
|
|
@@ -25697,6 +25756,9 @@ const useSquidTokens = (direction) => {
|
|
|
25697
25756
|
case squidTypes.ChainType.CANTON:
|
|
25698
25757
|
acc.cantonTokens.push(token);
|
|
25699
25758
|
break;
|
|
25759
|
+
case squidTypes.ChainType.DANAL:
|
|
25760
|
+
acc.danalTokens.push(token);
|
|
25761
|
+
break;
|
|
25700
25762
|
}
|
|
25701
25763
|
return acc;
|
|
25702
25764
|
}, {
|
|
@@ -25708,6 +25770,7 @@ const useSquidTokens = (direction) => {
|
|
|
25708
25770
|
xrplTokens: [],
|
|
25709
25771
|
stellarTokens: [],
|
|
25710
25772
|
cantonTokens: [],
|
|
25773
|
+
danalTokens: [],
|
|
25711
25774
|
});
|
|
25712
25775
|
}, [tokens]);
|
|
25713
25776
|
const findToken = React.useCallback((address, chainId) => {
|
|
@@ -25726,6 +25789,7 @@ const useSquidTokens = (direction) => {
|
|
|
25726
25789
|
xrplTokens,
|
|
25727
25790
|
stellarTokens,
|
|
25728
25791
|
cantonTokens,
|
|
25792
|
+
danalTokens,
|
|
25729
25793
|
};
|
|
25730
25794
|
};
|
|
25731
25795
|
|
|
@@ -26262,6 +26326,7 @@ const chainTypeToRefetchInterval = {
|
|
|
26262
26326
|
[squidTypes.ChainType.XRPL]: 1_000,
|
|
26263
26327
|
[squidTypes.ChainType.STELLAR]: 1_000,
|
|
26264
26328
|
[squidTypes.ChainType.CANTON]: 1_000,
|
|
26329
|
+
[squidTypes.ChainType.DANAL]: 1_000,
|
|
26265
26330
|
};
|
|
26266
26331
|
/**
|
|
26267
26332
|
* Returns the status refetch interval of a Send transaction
|
|
@@ -26528,7 +26593,7 @@ const useSquidChains = (direction) => {
|
|
|
26528
26593
|
const chain = findChain(chainId);
|
|
26529
26594
|
return chain?.chainType;
|
|
26530
26595
|
}, [findChain]);
|
|
26531
|
-
const { evmChains, cosmosChains, suiChains, stellarChains, xrplChains, cantonChains, } = React.useMemo(() => {
|
|
26596
|
+
const { evmChains, cosmosChains, suiChains, stellarChains, xrplChains, cantonChains, danalChains, } = React.useMemo(() => {
|
|
26532
26597
|
return chains.reduce((acc, chain) => {
|
|
26533
26598
|
switch (chain.chainType) {
|
|
26534
26599
|
case squidTypes.ChainType.EVM:
|
|
@@ -26549,6 +26614,9 @@ const useSquidChains = (direction) => {
|
|
|
26549
26614
|
case squidTypes.ChainType.CANTON:
|
|
26550
26615
|
acc.cantonChains.push(chain);
|
|
26551
26616
|
break;
|
|
26617
|
+
case squidTypes.ChainType.DANAL:
|
|
26618
|
+
acc.danalChains.push(chain);
|
|
26619
|
+
break;
|
|
26552
26620
|
}
|
|
26553
26621
|
return acc;
|
|
26554
26622
|
}, {
|
|
@@ -26558,6 +26626,7 @@ const useSquidChains = (direction) => {
|
|
|
26558
26626
|
xrplChains: [],
|
|
26559
26627
|
stellarChains: [],
|
|
26560
26628
|
cantonChains: [],
|
|
26629
|
+
danalChains: [],
|
|
26561
26630
|
});
|
|
26562
26631
|
}, [chains]);
|
|
26563
26632
|
const { supportedSourceChains, supportedDestinationChains } = React.useMemo(() => {
|
|
@@ -26579,6 +26648,7 @@ const useSquidChains = (direction) => {
|
|
|
26579
26648
|
xrplChains,
|
|
26580
26649
|
stellarChains,
|
|
26581
26650
|
cantonChains,
|
|
26651
|
+
danalChains,
|
|
26582
26652
|
getChainType,
|
|
26583
26653
|
findChain,
|
|
26584
26654
|
};
|
|
@@ -27424,7 +27494,7 @@ function useStellarWallets() {
|
|
|
27424
27494
|
try {
|
|
27425
27495
|
const { allowAllModules: initializeAllModules } = await import('@creit.tech/stellar-wallets-kit');
|
|
27426
27496
|
const { LedgerModule } = await import('@creit.tech/stellar-wallets-kit/modules/ledger.module.mjs');
|
|
27427
|
-
const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-
|
|
27497
|
+
const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-WTkVJJhn.js'); });
|
|
27428
27498
|
const modules = [...initializeAllModules(), new LedgerModule()];
|
|
27429
27499
|
const promises = modules.map(async (module) => {
|
|
27430
27500
|
const isAvailable = await module.isAvailable();
|
|
@@ -28234,6 +28304,8 @@ const useMultiChainWallet = (chain) => {
|
|
|
28234
28304
|
chainType: chain.chainType,
|
|
28235
28305
|
}),
|
|
28236
28306
|
};
|
|
28307
|
+
case squidTypes.ChainType.DANAL:
|
|
28308
|
+
return {};
|
|
28237
28309
|
}
|
|
28238
28310
|
}, [
|
|
28239
28311
|
chain?.chainType,
|
|
@@ -29072,6 +29144,8 @@ async function createClient(chain) {
|
|
|
29072
29144
|
return new StellarRpcClient(chain.rpc);
|
|
29073
29145
|
case squidTypes.ChainType.CANTON:
|
|
29074
29146
|
return null;
|
|
29147
|
+
case squidTypes.ChainType.DANAL:
|
|
29148
|
+
return null;
|
|
29075
29149
|
}
|
|
29076
29150
|
}
|
|
29077
29151
|
|
|
@@ -30338,7 +30412,7 @@ const useCantonBalance = ({ chain, token, userAddress, enabled = true, refreshIn
|
|
|
30338
30412
|
};
|
|
30339
30413
|
|
|
30340
30414
|
function useNativeTokenForChain(chain) {
|
|
30341
|
-
const { evmTokens, cosmosTokens, solanaTokens, bitcoinTokens, suiTokens, xrplTokens, stellarTokens, cantonTokens, } = useSquidTokens();
|
|
30415
|
+
const { evmTokens, cosmosTokens, solanaTokens, bitcoinTokens, suiTokens, xrplTokens, stellarTokens, cantonTokens, danalTokens, } = useSquidTokens();
|
|
30342
30416
|
const getTokensForChainType = () => {
|
|
30343
30417
|
if (!chain?.chainType)
|
|
30344
30418
|
return [];
|
|
@@ -30359,6 +30433,8 @@ function useNativeTokenForChain(chain) {
|
|
|
30359
30433
|
return stellarTokens;
|
|
30360
30434
|
case squidTypes.ChainType.CANTON:
|
|
30361
30435
|
return cantonTokens;
|
|
30436
|
+
case squidTypes.ChainType.DANAL:
|
|
30437
|
+
return danalTokens;
|
|
30362
30438
|
}
|
|
30363
30439
|
};
|
|
30364
30440
|
const nativeTokenForChainType = React.useMemo(() => {
|
|
@@ -30619,6 +30695,9 @@ const useNativeBalance = (chain) => {
|
|
|
30619
30695
|
case squidTypes.ChainType.CANTON:
|
|
30620
30696
|
balance = nativeCantonBalance;
|
|
30621
30697
|
break;
|
|
30698
|
+
case squidTypes.ChainType.DANAL:
|
|
30699
|
+
balance = undefined;
|
|
30700
|
+
break;
|
|
30622
30701
|
}
|
|
30623
30702
|
const balanceFormatted = !!balance
|
|
30624
30703
|
? formatBNToReadable(balance.value, balance.decimals)
|
|
@@ -30658,6 +30737,8 @@ const useNativeBalance = (chain) => {
|
|
|
30658
30737
|
return isStellarLoading;
|
|
30659
30738
|
case squidTypes.ChainType.CANTON:
|
|
30660
30739
|
return isCantonLoading;
|
|
30740
|
+
case squidTypes.ChainType.DANAL:
|
|
30741
|
+
return false;
|
|
30661
30742
|
}
|
|
30662
30743
|
}, [
|
|
30663
30744
|
chain?.chainType,
|
|
@@ -30883,7 +30964,7 @@ function hederaWalletConnect(parameters) {
|
|
|
30883
30964
|
const optionalChains = config.chains.map((x) => x.id);
|
|
30884
30965
|
if (!optionalChains.length)
|
|
30885
30966
|
return;
|
|
30886
|
-
const { EthereumProvider } = await Promise.resolve().then(function () { return require('./index.es-
|
|
30967
|
+
const { EthereumProvider } = await Promise.resolve().then(function () { return require('./index.es-BZb8tg2z.js'); });
|
|
30887
30968
|
const rawProvider = await EthereumProvider.init({
|
|
30888
30969
|
...restParameters,
|
|
30889
30970
|
disableProviderPing: true,
|
|
@@ -31117,6 +31198,8 @@ const useSigner = ({ chain }) => {
|
|
|
31117
31198
|
return isStellarSignerReady;
|
|
31118
31199
|
case squidTypes.ChainType.CANTON:
|
|
31119
31200
|
return isCantonSignerReady;
|
|
31201
|
+
case squidTypes.ChainType.DANAL:
|
|
31202
|
+
return false;
|
|
31120
31203
|
}
|
|
31121
31204
|
}, [
|
|
31122
31205
|
chain?.chainType,
|
|
@@ -31569,8 +31652,12 @@ const useSendTransactionStore = zustand.create((set, get) => ({
|
|
|
31569
31652
|
const useDepositAddressStore = zustand.create((set) => ({
|
|
31570
31653
|
deposit: null,
|
|
31571
31654
|
selectedPaymentMethod: "connectedWallet",
|
|
31655
|
+
userDepositTxId: null,
|
|
31572
31656
|
setDeposit: (data) => {
|
|
31573
|
-
set({ deposit: data });
|
|
31657
|
+
set({ deposit: data, userDepositTxId: null });
|
|
31658
|
+
},
|
|
31659
|
+
setUserDepositTxId: (txId) => {
|
|
31660
|
+
set({ userDepositTxId: txId });
|
|
31574
31661
|
},
|
|
31575
31662
|
setPaymentMethod: (method) => {
|
|
31576
31663
|
set({ selectedPaymentMethod: method });
|
|
@@ -31582,7 +31669,7 @@ function useDepositAddress(squidRoute) {
|
|
|
31582
31669
|
selectedPaymentMethod: state.selectedPaymentMethod,
|
|
31583
31670
|
depositAddress: state.deposit?.depositAddress,
|
|
31584
31671
|
}));
|
|
31585
|
-
const { setDeposit, setPaymentMethod, deposit } = useDepositAddressStore();
|
|
31672
|
+
const { setDeposit, setPaymentMethod, deposit, userDepositTxId, setUserDepositTxId, } = useDepositAddressStore();
|
|
31586
31673
|
const { squid } = useSquidStore();
|
|
31587
31674
|
const { fromChain } = useSwap();
|
|
31588
31675
|
const isAvailableAsPaymentMethod = React.useMemo(() => {
|
|
@@ -31592,11 +31679,13 @@ function useDepositAddress(squidRoute) {
|
|
|
31592
31679
|
CHAIN_IDS.BITCOIN,
|
|
31593
31680
|
CHAIN_IDS.SOLANA,
|
|
31594
31681
|
CHAIN_IDS.CANTON,
|
|
31682
|
+
CHAIN_IDS.DANAL_TESTNET,
|
|
31595
31683
|
];
|
|
31596
31684
|
return chainsSupportingDepositAddress.includes(fromChain.chainId);
|
|
31597
31685
|
}, [fromChain?.chainId]);
|
|
31598
|
-
const routeProvidesDirectDepositAddress = !!squidRoute?.transactionRequest &&
|
|
31599
|
-
isDepositAddressDirectTransferRoute(squidRoute.transactionRequest)
|
|
31686
|
+
const routeProvidesDirectDepositAddress = (!!squidRoute?.transactionRequest &&
|
|
31687
|
+
isDepositAddressDirectTransferRoute(squidRoute.transactionRequest)) ||
|
|
31688
|
+
(!!squidRoute && isDanalDepositRoute(squidRoute));
|
|
31600
31689
|
const swapWillGenerateDepositAddress = isChainflipDepositRoute(squidRoute) || routeProvidesDirectDepositAddress;
|
|
31601
31690
|
const paymentMethod = isAvailableAsPaymentMethod
|
|
31602
31691
|
? selectedPaymentMethod
|
|
@@ -31622,6 +31711,19 @@ function useDepositAddress(squidRoute) {
|
|
|
31622
31711
|
});
|
|
31623
31712
|
return;
|
|
31624
31713
|
}
|
|
31714
|
+
else if (isDanalDepositRoute(route)) {
|
|
31715
|
+
const transferBody = parseDanalTransferBody(route.transactionRequest.data);
|
|
31716
|
+
if (!transferBody) {
|
|
31717
|
+
throw new Error("Could not parse Danal transfer request body");
|
|
31718
|
+
}
|
|
31719
|
+
setDeposit({
|
|
31720
|
+
amount: transferBody.amount,
|
|
31721
|
+
depositAddress: route.transactionRequest.target,
|
|
31722
|
+
statusTrackingId: transferBody.memo,
|
|
31723
|
+
memo: transferBody.memo,
|
|
31724
|
+
});
|
|
31725
|
+
return;
|
|
31726
|
+
}
|
|
31625
31727
|
else if (isDepositAddressDirectTransferRoute(route.transactionRequest)) {
|
|
31626
31728
|
// Canton case
|
|
31627
31729
|
const orderHash = route.transactionRequest.data;
|
|
@@ -31644,6 +31746,8 @@ function useDepositAddress(squidRoute) {
|
|
|
31644
31746
|
depositAddress,
|
|
31645
31747
|
closeDepositChannel,
|
|
31646
31748
|
depositData: deposit,
|
|
31749
|
+
userDepositTxId,
|
|
31750
|
+
setUserDepositTxId,
|
|
31647
31751
|
};
|
|
31648
31752
|
}
|
|
31649
31753
|
|
|
@@ -31671,7 +31775,7 @@ const useUrlSwapParams = () => {
|
|
|
31671
31775
|
|
|
31672
31776
|
const useAllTokensWithBalanceForChainType = ({ chainType, address, direction, queryOptions, }) => {
|
|
31673
31777
|
const { evmChains, cosmosChains, suiChains, xrplChains, stellarChains } = useSquidChains(direction);
|
|
31674
|
-
const { evmTokens, cosmosTokens, solanaTokens, bitcoinTokens, suiTokens, xrplTokens, stellarTokens, cantonTokens, } = useSquidTokens(direction);
|
|
31778
|
+
const { evmTokens, cosmosTokens, solanaTokens, bitcoinTokens, suiTokens, xrplTokens, stellarTokens, cantonTokens, danalTokens, } = useSquidTokens(direction);
|
|
31675
31779
|
const { keplrTypeWallet } = useCosmosContext();
|
|
31676
31780
|
const cantonConnector = useWalletStore((store) => store.connectedWalletsByChainType[squidTypes.ChainType.CANTON]?.wallet?.connector);
|
|
31677
31781
|
const placeholderData = React.useMemo(() => {
|
|
@@ -31684,6 +31788,7 @@ const useAllTokensWithBalanceForChainType = ({ chainType, address, direction, qu
|
|
|
31684
31788
|
[squidTypes.ChainType.XRPL]: xrplTokens.map((t) => ({ ...t, balance: "0" })),
|
|
31685
31789
|
[squidTypes.ChainType.STELLAR]: stellarTokens.map((t) => ({ ...t, balance: "0" })),
|
|
31686
31790
|
[squidTypes.ChainType.CANTON]: cantonTokens.map((t) => ({ ...t, balance: "0" })),
|
|
31791
|
+
[squidTypes.ChainType.DANAL]: danalTokens.map((t) => ({ ...t, balance: "0" })),
|
|
31687
31792
|
};
|
|
31688
31793
|
if (!chainType) {
|
|
31689
31794
|
// Return all tokens with zero balance
|
|
@@ -31706,6 +31811,7 @@ const useAllTokensWithBalanceForChainType = ({ chainType, address, direction, qu
|
|
|
31706
31811
|
xrplTokens,
|
|
31707
31812
|
stellarTokens,
|
|
31708
31813
|
cantonTokens,
|
|
31814
|
+
danalTokens,
|
|
31709
31815
|
]);
|
|
31710
31816
|
const isQueryEnabled = React.useMemo(() => {
|
|
31711
31817
|
// Respect the queryOptions.enabled override if provided
|
|
@@ -31730,6 +31836,8 @@ const useAllTokensWithBalanceForChainType = ({ chainType, address, direction, qu
|
|
|
31730
31836
|
return stellarTokens.length > 0;
|
|
31731
31837
|
case squidTypes.ChainType.CANTON:
|
|
31732
31838
|
return cantonTokens.length > 0;
|
|
31839
|
+
case squidTypes.ChainType.DANAL:
|
|
31840
|
+
return danalTokens.length > 0;
|
|
31733
31841
|
}
|
|
31734
31842
|
}, [
|
|
31735
31843
|
chainType,
|
|
@@ -31743,6 +31851,7 @@ const useAllTokensWithBalanceForChainType = ({ chainType, address, direction, qu
|
|
|
31743
31851
|
xrplTokens.length,
|
|
31744
31852
|
stellarTokens.length,
|
|
31745
31853
|
cantonTokens.length,
|
|
31854
|
+
danalTokens.length,
|
|
31746
31855
|
]);
|
|
31747
31856
|
const query = reactQuery.useQuery(keys().allTokensBalance(address, chainType, direction), async () => {
|
|
31748
31857
|
// Return zero balances if no address
|
|
@@ -31867,6 +31976,12 @@ const useAllConnectedWalletBalances = ({ direction, queryOptions = {
|
|
|
31867
31976
|
direction,
|
|
31868
31977
|
queryOptions,
|
|
31869
31978
|
});
|
|
31979
|
+
const danalBalancesQuery = useAllTokensWithBalanceForChainType({
|
|
31980
|
+
chainType: squidTypes.ChainType.DANAL,
|
|
31981
|
+
address: connectedAddresses?.[squidTypes.ChainType.DANAL],
|
|
31982
|
+
direction,
|
|
31983
|
+
queryOptions,
|
|
31984
|
+
});
|
|
31870
31985
|
// Create a map of chain type to balance query results
|
|
31871
31986
|
const balanceQueries = React.useMemo(() => ({
|
|
31872
31987
|
[squidTypes.ChainType.EVM]: evmBalancesQuery,
|
|
@@ -31877,6 +31992,7 @@ const useAllConnectedWalletBalances = ({ direction, queryOptions = {
|
|
|
31877
31992
|
[squidTypes.ChainType.XRPL]: xrplBalancesQuery,
|
|
31878
31993
|
[squidTypes.ChainType.STELLAR]: stellarBalancesQuery,
|
|
31879
31994
|
[squidTypes.ChainType.CANTON]: cantonBalancesQuery,
|
|
31995
|
+
[squidTypes.ChainType.DANAL]: danalBalancesQuery,
|
|
31880
31996
|
}), [
|
|
31881
31997
|
evmBalancesQuery,
|
|
31882
31998
|
cosmosBalancesQuery,
|
|
@@ -31886,6 +32002,7 @@ const useAllConnectedWalletBalances = ({ direction, queryOptions = {
|
|
|
31886
32002
|
xrplBalancesQuery,
|
|
31887
32003
|
stellarBalancesQuery,
|
|
31888
32004
|
cantonBalancesQuery,
|
|
32005
|
+
danalBalancesQuery,
|
|
31889
32006
|
]);
|
|
31890
32007
|
// Combine all tokens from different chains
|
|
31891
32008
|
const allTokens = React.useMemo(() => Object.values(balanceQueries).flatMap((query) => query.data?.tokens ?? []), [balanceQueries]);
|
|
@@ -31993,6 +32110,8 @@ const useMultiChainBalance = ({ chain, token, userAddress, enabled = true, }) =>
|
|
|
31993
32110
|
return stellarBalance;
|
|
31994
32111
|
case squidTypes.ChainType.CANTON:
|
|
31995
32112
|
return cantonBalance;
|
|
32113
|
+
case squidTypes.ChainType.DANAL:
|
|
32114
|
+
return "0";
|
|
31996
32115
|
}
|
|
31997
32116
|
}, [
|
|
31998
32117
|
chain?.chainType,
|
|
@@ -33102,8 +33221,9 @@ function useSendTransaction({ to, amount, token, chain, }) {
|
|
|
33102
33221
|
chain,
|
|
33103
33222
|
});
|
|
33104
33223
|
break;
|
|
33105
|
-
case squidTypes.ChainType.CANTON:
|
|
33106
|
-
|
|
33224
|
+
case squidTypes.ChainType.CANTON:
|
|
33225
|
+
case squidTypes.ChainType.DANAL: {
|
|
33226
|
+
throw new Error(`Send not implemented for chain type ${chain.chainType}`);
|
|
33107
33227
|
}
|
|
33108
33228
|
}
|
|
33109
33229
|
return {
|
|
@@ -33309,7 +33429,8 @@ async function getSendTransactionStatus({ chain, txHash, }) {
|
|
|
33309
33429
|
chain,
|
|
33310
33430
|
});
|
|
33311
33431
|
case squidTypes.ChainType.CANTON:
|
|
33312
|
-
|
|
33432
|
+
case squidTypes.ChainType.DANAL:
|
|
33433
|
+
throw new Error(`Send not implemented for chain type ${chain.chainType}`);
|
|
33313
33434
|
}
|
|
33314
33435
|
}
|
|
33315
33436
|
|
|
@@ -38179,7 +38300,7 @@ refetchIntervalInBackground = false, refetchInterval = 30000, quoteOnly = true,
|
|
|
38179
38300
|
//
|
|
38180
38301
|
// If deposit address is not selected, we use the connected address as the source address instead
|
|
38181
38302
|
const sourceUserAddress = isDepositAddressActive
|
|
38182
|
-
?
|
|
38303
|
+
? depositRefundAddress ?? sourceConnectedAddress
|
|
38183
38304
|
: sourceConnectedAddress;
|
|
38184
38305
|
const squidRouteQueryKeys = React.useMemo(() => keys().transaction(fromChain?.chainId, toChain?.chainId, toToken?.address, fromToken?.address, fromPrice, config.slippage, sourceUserAddress, config.degenMode, destinationAddress, fallbackAddress, quoteOnly, fromChain?.chainType, config.preHook, config.postHook, config.overrideGasRefundAddress), [
|
|
38185
38306
|
fromChain?.chainId,
|
|
@@ -38965,6 +39086,9 @@ exports.isChainflipBridgeTransaction = isChainflipBridgeTransaction;
|
|
|
38965
39086
|
exports.isChainflipDepositRoute = isChainflipDepositRoute;
|
|
38966
39087
|
exports.isCoralBridgeAction = isCoralBridgeAction;
|
|
38967
39088
|
exports.isCosmosAddressValid = isCosmosAddressValid;
|
|
39089
|
+
exports.isDanalAddressValid = isDanalAddressValid;
|
|
39090
|
+
exports.isDanalDepositRoute = isDanalDepositRoute;
|
|
39091
|
+
exports.isDanalTxHashValid = isDanalTxHashValid;
|
|
38968
39092
|
exports.isDepositAddressDirectTransferRoute = isDepositAddressDirectTransferRoute;
|
|
38969
39093
|
exports.isEmptyObject = isEmptyObject;
|
|
38970
39094
|
exports.isEvmChainNotSupportedError = isEvmChainNotSupportedError;
|
|
@@ -39002,6 +39126,7 @@ exports.nativeXrplTokenAddress = nativeXrplTokenAddress;
|
|
|
39002
39126
|
exports.normalizeError = normalizeError;
|
|
39003
39127
|
exports.normalizeIbcAddress = normalizeIbcAddress;
|
|
39004
39128
|
exports.normalizeTokenSymbol = normalizeTokenSymbol;
|
|
39129
|
+
exports.parseDanalTransferBody = parseDanalTransferBody;
|
|
39005
39130
|
exports.parseEvmAddress = parseEvmAddress;
|
|
39006
39131
|
exports.parseInitialAssetsFromUrl = parseInitialAssetsFromUrl;
|
|
39007
39132
|
exports.parseToBigInt = parseToBigInt;
|
|
@@ -39114,4 +39239,4 @@ exports.useXrplTrustLine = useXrplTrustLine;
|
|
|
39114
39239
|
exports.waitForReceiptWithRetry = waitForReceiptWithRetry;
|
|
39115
39240
|
exports.walletIconBaseUrl = walletIconBaseUrl;
|
|
39116
39241
|
exports.walletSupportsChainType = walletSupportsChainType;
|
|
39117
|
-
//# sourceMappingURL=index-
|
|
39242
|
+
//# sourceMappingURL=index-BT6G_mgr.js.map
|