@skip-go/widget 2.4.3 → 2.4.4
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 +0 -2
- package/build/hooks/use-account.d.ts +28 -0
- package/build/hooks/use-skip-client.d.ts +3051 -0
- package/build/hooks/use-swap-widget.d.ts +1 -1
- package/build/index.es.js +197 -18
- package/build/index.es.js.map +1 -1
- package/build/provider/index.d.ts +14 -0
- package/build/provider/skip-provider.d.ts +15 -1
- package/build/ui/Icon/ShareIcon.d.ts +0 -1
- package/build/ui/PreviewRoute/types.d.ts +2 -2
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@ export declare function useSwapWidget(persistSwapWidgetState?: boolean): {
|
|
|
31
31
|
onSourceAssetChange: (asset: Asset) => void;
|
|
32
32
|
onSourceChainChange: (chain: Chain, injectAsset?: Asset) => Promise<void>;
|
|
33
33
|
priceImpactThresholdReached: boolean;
|
|
34
|
-
route: import("@skip-go/client/dist/shared-
|
|
34
|
+
route: import("@skip-go/client/dist/shared-Squ-EH8u").R | undefined;
|
|
35
35
|
routeError: string;
|
|
36
36
|
routeLoading: boolean;
|
|
37
37
|
routeWarningMessage: string | undefined;
|
package/build/index.es.js
CHANGED
|
@@ -315,13 +315,13 @@ function isReadyToCheckLedger(walletClient) {
|
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
const SkipContext = createContext(undefined);
|
|
318
|
-
function SkipProvider({ children, apiURL, endpointOptions, makeDestinationWallets, chainIDsToAffiliates, }) {
|
|
318
|
+
function SkipProvider({ children, apiURL, endpointOptions, makeDestinationWallets, chainIDsToAffiliates, connectedWallet, }) {
|
|
319
319
|
const { getWalletRepo } = useManager();
|
|
320
320
|
const { wallets } = useWallet();
|
|
321
321
|
const skipClient = new SkipClient({
|
|
322
322
|
chainIDsToAffiliates,
|
|
323
323
|
getCosmosSigner: async (chainID) => {
|
|
324
|
-
var _a, _b;
|
|
324
|
+
var _a, _b, _c;
|
|
325
325
|
const chainName = chainIdToName(chainID);
|
|
326
326
|
if (!chainName) {
|
|
327
327
|
throw new Error(`getCosmosSigner error: unknown chainID '${chainID}'`);
|
|
@@ -335,6 +335,12 @@ function SkipProvider({ children, apiURL, endpointOptions, makeDestinationWallet
|
|
|
335
335
|
return w.walletName === walletName;
|
|
336
336
|
});
|
|
337
337
|
if (!wallet) {
|
|
338
|
+
if (!!((_a = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.cosmos) === null || _a === void 0 ? void 0 : _a.getSigner)) {
|
|
339
|
+
const signer = await connectedWallet.cosmos.getSigner(chainID);
|
|
340
|
+
if (signer) {
|
|
341
|
+
return signer;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
338
344
|
throw new Error(`getCosmosSigner error: unable to find wallets connected to '${chainID}'`);
|
|
339
345
|
}
|
|
340
346
|
if (!wallet.isWalletConnected || wallet.isWalletDisconnected) {
|
|
@@ -345,21 +351,29 @@ function SkipProvider({ children, apiURL, endpointOptions, makeDestinationWallet
|
|
|
345
351
|
if (!wallet.offlineSigner) {
|
|
346
352
|
throw new Error(`getCosmosSigner error: no offline signer for walletName '${walletName}'`);
|
|
347
353
|
}
|
|
348
|
-
(
|
|
354
|
+
(_c = (_b = wallet.client).setDefaultSignOptions) === null || _c === void 0 ? void 0 : _c.call(_b, {
|
|
349
355
|
preferNoSetFee: true,
|
|
350
356
|
});
|
|
351
357
|
return wallet.offlineSigner;
|
|
352
358
|
},
|
|
353
359
|
getEVMSigner: async (chainID) => {
|
|
360
|
+
var _a;
|
|
354
361
|
const evmWalletClient = (await getWalletClient(config, {
|
|
355
362
|
chainId: parseInt(chainID),
|
|
356
363
|
}));
|
|
357
364
|
if (!evmWalletClient) {
|
|
365
|
+
if (!!((_a = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.evm) === null || _a === void 0 ? void 0 : _a.getSigner)) {
|
|
366
|
+
const signer = await connectedWallet.evm.getSigner(chainID);
|
|
367
|
+
if (signer) {
|
|
368
|
+
return signer;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
358
371
|
throw new Error(`getEVMSigner error: no wallet client available for chain ${chainID}`);
|
|
359
372
|
}
|
|
360
373
|
return evmWalletClient;
|
|
361
374
|
},
|
|
362
375
|
getSVMSigner: async () => {
|
|
376
|
+
var _a;
|
|
363
377
|
const walletName = (() => {
|
|
364
378
|
const { svm } = trackWallet.get();
|
|
365
379
|
if ((svm === null || svm === void 0 ? void 0 : svm.chainType) === 'svm')
|
|
@@ -367,6 +381,12 @@ function SkipProvider({ children, apiURL, endpointOptions, makeDestinationWallet
|
|
|
367
381
|
})();
|
|
368
382
|
const solanaWallet = wallets.find((w) => w.adapter.name === walletName);
|
|
369
383
|
if (!(solanaWallet === null || solanaWallet === void 0 ? void 0 : solanaWallet.adapter)) {
|
|
384
|
+
if (!!((_a = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.svm) === null || _a === void 0 ? void 0 : _a.getSigner)) {
|
|
385
|
+
const signer = await connectedWallet.svm.getSigner();
|
|
386
|
+
if (signer) {
|
|
387
|
+
return signer;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
370
390
|
throw new Error(`getSVMSigner error: no wallet client available`);
|
|
371
391
|
}
|
|
372
392
|
return solanaWallet.adapter;
|
|
@@ -379,6 +399,7 @@ function SkipProvider({ children, apiURL, endpointOptions, makeDestinationWallet
|
|
|
379
399
|
apiURL,
|
|
380
400
|
endpointOptions,
|
|
381
401
|
makeDestinationWallets,
|
|
402
|
+
connectedWallet,
|
|
382
403
|
}, children: children }));
|
|
383
404
|
}
|
|
384
405
|
|
|
@@ -398,6 +419,7 @@ function useSkipConfig() {
|
|
|
398
419
|
apiURL: context.apiURL,
|
|
399
420
|
endpointOptions: context.endpointOptions,
|
|
400
421
|
makeDestinationWallets: context.makeDestinationWallets,
|
|
422
|
+
connectedWallet: context.connectedWallet,
|
|
401
423
|
};
|
|
402
424
|
}
|
|
403
425
|
|
|
@@ -1483,8 +1505,8 @@ const apiURL = `${appUrl}/api/widget/skip`;
|
|
|
1483
1505
|
const WalletProvider = ({ children, wagmiConfig, }) => {
|
|
1484
1506
|
return (jsx(SolanaProvider, { children: jsx(CosmosProvider, { children: jsx(EVMProvider, { wagmiConfig: wagmiConfig, children: jsx(WalletModalProvider, { children: children }) }) }) }));
|
|
1485
1507
|
};
|
|
1486
|
-
const SkipAPIProvider = ({ children, endpointOptions: endpointOptions$1 = endpointOptions, apiURL: apiURL$1 = apiURL, makeDestinationWallets, chainIDsToAffiliates, }) => {
|
|
1487
|
-
return (jsx(SkipProvider, { apiURL: apiURL$1, endpointOptions: endpointOptions$1, makeDestinationWallets: makeDestinationWallets, chainIDsToAffiliates: chainIDsToAffiliates, children: jsx(AssetsProvider, { children: children }) }));
|
|
1508
|
+
const SkipAPIProvider = ({ children, endpointOptions: endpointOptions$1 = endpointOptions, apiURL: apiURL$1 = apiURL, makeDestinationWallets, chainIDsToAffiliates, connectedWallet, }) => {
|
|
1509
|
+
return (jsx(SkipProvider, { apiURL: apiURL$1, endpointOptions: endpointOptions$1, makeDestinationWallets: makeDestinationWallets, chainIDsToAffiliates: chainIDsToAffiliates, connectedWallet: connectedWallet, children: jsx(AssetsProvider, { children: children }) }));
|
|
1488
1510
|
};
|
|
1489
1511
|
const SwapWidgetProvider = ({ children, wagmiConfig, ...skipApiProviderProps }) => {
|
|
1490
1512
|
return (jsx(WalletProvider, { wagmiConfig: wagmiConfig, children: jsx(SkipAPIProvider, { ...skipApiProviderProps, children: children }) }));
|
|
@@ -1605,8 +1627,10 @@ function useAnyDisclosureOpen() {
|
|
|
1605
1627
|
}
|
|
1606
1628
|
|
|
1607
1629
|
function useAccount(chainID) {
|
|
1630
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1608
1631
|
const { data: chain } = useChainByID(chainID);
|
|
1609
1632
|
const trackedWallet = useTrackWallet(chain === null || chain === void 0 ? void 0 : chain.chainType);
|
|
1633
|
+
const { connectedWallet } = useSkipConfig();
|
|
1610
1634
|
const { getWalletRepo } = useManager();
|
|
1611
1635
|
const cosmosWallet = useMemo(() => {
|
|
1612
1636
|
if ((chain === null || chain === void 0 ? void 0 : chain.chainType) !== 'cosmos')
|
|
@@ -1654,10 +1678,73 @@ function useAccount(chainID) {
|
|
|
1654
1678
|
readyToCheckLedger &&
|
|
1655
1679
|
!!(cosmosWallet === null || cosmosWallet === void 0 ? void 0 : cosmosWallet.address),
|
|
1656
1680
|
});
|
|
1681
|
+
const { data: parentCosmosAddress } = useQuery({
|
|
1682
|
+
queryKey: [
|
|
1683
|
+
'parentCosmosAddress',
|
|
1684
|
+
chain === null || chain === void 0 ? void 0 : chain.chainID,
|
|
1685
|
+
(_a = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.cosmos) === null || _a === void 0 ? void 0 : _a.getSigner,
|
|
1686
|
+
],
|
|
1687
|
+
queryFn: async () => {
|
|
1688
|
+
var _a, _b;
|
|
1689
|
+
if ((chain === null || chain === void 0 ? void 0 : chain.chainType) === 'cosmos') {
|
|
1690
|
+
const signer = await ((_b = (_a = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.cosmos) === null || _a === void 0 ? void 0 : _a.getSigner) === null || _b === void 0 ? void 0 : _b.call(_a, chain.chainID));
|
|
1691
|
+
const accounts = await (signer === null || signer === void 0 ? void 0 : signer.getAccounts());
|
|
1692
|
+
return accounts === null || accounts === void 0 ? void 0 : accounts[0].address;
|
|
1693
|
+
}
|
|
1694
|
+
},
|
|
1695
|
+
enabled: (chain === null || chain === void 0 ? void 0 : chain.chainType) === 'cosmos' && !!((_b = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.cosmos) === null || _b === void 0 ? void 0 : _b.getSigner),
|
|
1696
|
+
});
|
|
1697
|
+
const { data: parentEVMSAddress } = useQuery({
|
|
1698
|
+
queryKey: [
|
|
1699
|
+
'parentEVMSAddress',
|
|
1700
|
+
chain === null || chain === void 0 ? void 0 : chain.chainID,
|
|
1701
|
+
(_c = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.evm) === null || _c === void 0 ? void 0 : _c.getSigner,
|
|
1702
|
+
],
|
|
1703
|
+
queryFn: async () => {
|
|
1704
|
+
var _a, _b, _c;
|
|
1705
|
+
if ((chain === null || chain === void 0 ? void 0 : chain.chainType) === 'evm') {
|
|
1706
|
+
const signer = await ((_b = (_a = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.evm) === null || _a === void 0 ? void 0 : _a.getSigner) === null || _b === void 0 ? void 0 : _b.call(_a, chain.chainID));
|
|
1707
|
+
return (_c = signer === null || signer === void 0 ? void 0 : signer.account) === null || _c === void 0 ? void 0 : _c.address;
|
|
1708
|
+
}
|
|
1709
|
+
},
|
|
1710
|
+
enabled: (chain === null || chain === void 0 ? void 0 : chain.chainType) === 'evm' && !!((_d = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.evm) === null || _d === void 0 ? void 0 : _d.getSigner),
|
|
1711
|
+
});
|
|
1712
|
+
const { data: parentSVMAddress } = useQuery({
|
|
1713
|
+
queryKey: [
|
|
1714
|
+
'parentSVMAddress',
|
|
1715
|
+
chain === null || chain === void 0 ? void 0 : chain.chainID,
|
|
1716
|
+
(_e = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.svm) === null || _e === void 0 ? void 0 : _e.getSigner,
|
|
1717
|
+
],
|
|
1718
|
+
queryFn: async () => {
|
|
1719
|
+
var _a, _b, _c;
|
|
1720
|
+
if ((chain === null || chain === void 0 ? void 0 : chain.chainType) === 'svm') {
|
|
1721
|
+
const signer = await ((_b = (_a = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.svm) === null || _a === void 0 ? void 0 : _a.getSigner) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
1722
|
+
return (_c = signer === null || signer === void 0 ? void 0 : signer.publicKey) === null || _c === void 0 ? void 0 : _c.toBase58();
|
|
1723
|
+
}
|
|
1724
|
+
},
|
|
1725
|
+
enabled: (chain === null || chain === void 0 ? void 0 : chain.chainType) === 'svm' && !!((_f = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.svm) === null || _f === void 0 ? void 0 : _f.getSigner),
|
|
1726
|
+
});
|
|
1657
1727
|
const account = useMemo(() => {
|
|
1658
1728
|
var _a;
|
|
1659
1729
|
if (!chain)
|
|
1660
1730
|
return;
|
|
1731
|
+
if (chain.chainType === 'cosmos' && parentCosmosAddress && !cosmosWallet) {
|
|
1732
|
+
return {
|
|
1733
|
+
address: parentCosmosAddress,
|
|
1734
|
+
isWalletConnected: true,
|
|
1735
|
+
wallet: {
|
|
1736
|
+
walletName: 'injected',
|
|
1737
|
+
walletPrettyName: '',
|
|
1738
|
+
walletInfo: {
|
|
1739
|
+
logo: '',
|
|
1740
|
+
},
|
|
1741
|
+
isLedger: false,
|
|
1742
|
+
},
|
|
1743
|
+
chainType: chain.chainType,
|
|
1744
|
+
connect: () => { },
|
|
1745
|
+
disconnect: () => { },
|
|
1746
|
+
};
|
|
1747
|
+
}
|
|
1661
1748
|
if (chain.chainType === 'cosmos' && cosmosWallet) {
|
|
1662
1749
|
return {
|
|
1663
1750
|
address: cosmosWallet.address,
|
|
@@ -1686,6 +1773,22 @@ function useAccount(chainID) {
|
|
|
1686
1773
|
};
|
|
1687
1774
|
}
|
|
1688
1775
|
if (chain.chainType === 'evm') {
|
|
1776
|
+
if (parentEVMSAddress && !wagmiAccount) {
|
|
1777
|
+
return {
|
|
1778
|
+
address: parentEVMSAddress,
|
|
1779
|
+
isWalletConnected: true,
|
|
1780
|
+
wallet: {
|
|
1781
|
+
walletName: 'injected',
|
|
1782
|
+
walletPrettyName: '',
|
|
1783
|
+
walletInfo: {
|
|
1784
|
+
logo: '',
|
|
1785
|
+
},
|
|
1786
|
+
},
|
|
1787
|
+
chainType: chain.chainType,
|
|
1788
|
+
connect: () => { },
|
|
1789
|
+
disconnect: () => { },
|
|
1790
|
+
};
|
|
1791
|
+
}
|
|
1689
1792
|
return {
|
|
1690
1793
|
address: wagmiAccount.address,
|
|
1691
1794
|
isWalletConnected: wagmiAccount.isConnected,
|
|
@@ -1715,6 +1818,22 @@ function useAccount(chainID) {
|
|
|
1715
1818
|
}
|
|
1716
1819
|
if (chain.chainType === 'svm') {
|
|
1717
1820
|
const solanaWallet = wallets.find((w) => w.adapter.name === (trackedWallet === null || trackedWallet === void 0 ? void 0 : trackedWallet.walletName));
|
|
1821
|
+
if (parentSVMAddress && !solanaWallet) {
|
|
1822
|
+
return {
|
|
1823
|
+
address: parentSVMAddress,
|
|
1824
|
+
isWalletConnected: true,
|
|
1825
|
+
wallet: {
|
|
1826
|
+
walletName: 'injected',
|
|
1827
|
+
walletPrettyName: '',
|
|
1828
|
+
walletInfo: {
|
|
1829
|
+
logo: '',
|
|
1830
|
+
},
|
|
1831
|
+
},
|
|
1832
|
+
chainType: chain.chainType,
|
|
1833
|
+
connect: () => { },
|
|
1834
|
+
disconnect: () => { },
|
|
1835
|
+
};
|
|
1836
|
+
}
|
|
1718
1837
|
return {
|
|
1719
1838
|
address: (_a = solanaWallet === null || solanaWallet === void 0 ? void 0 : solanaWallet.adapter.publicKey) === null || _a === void 0 ? void 0 : _a.toBase58(),
|
|
1720
1839
|
isWalletConnected: (solanaWallet === null || solanaWallet === void 0 ? void 0 : solanaWallet.adapter.connected) && !solanaWallet.adapter.connecting,
|
|
@@ -1749,6 +1868,9 @@ function useAccount(chainID) {
|
|
|
1749
1868
|
wagmiAccount.isConnected,
|
|
1750
1869
|
wagmiAccount.connector,
|
|
1751
1870
|
wallets,
|
|
1871
|
+
parentCosmosAddress,
|
|
1872
|
+
parentEVMSAddress,
|
|
1873
|
+
parentSVMAddress,
|
|
1752
1874
|
]);
|
|
1753
1875
|
return account;
|
|
1754
1876
|
}
|
|
@@ -4254,16 +4376,21 @@ function useBridgeByID(bridgeID) {
|
|
|
4254
4376
|
|
|
4255
4377
|
const useAutoSetAddress = ({ chain, chainID, index, enabled, signRequired, chainAddresses, setChainAddresses, }) => {
|
|
4256
4378
|
var _a, _b, _c, _d;
|
|
4379
|
+
const { connectedWallet } = useSkipConfig();
|
|
4257
4380
|
const trackedWallets = useTrackWallet(chain === null || chain === void 0 ? void 0 : chain.chainType);
|
|
4258
4381
|
const source = chainAddresses === null || chainAddresses === void 0 ? void 0 : chainAddresses[0];
|
|
4259
4382
|
const destination = chainAddresses === null || chainAddresses === void 0 ? void 0 : chainAddresses[Object.values(chainAddresses).length - 1];
|
|
4260
4383
|
const current = chainAddresses === null || chainAddresses === void 0 ? void 0 : chainAddresses[index];
|
|
4261
4384
|
const currentAcdress = current === null || current === void 0 ? void 0 : current.address;
|
|
4262
4385
|
const isSameAsDestination = (current === null || current === void 0 ? void 0 : current.source) !== 'input' &&
|
|
4386
|
+
(current === null || current === void 0 ? void 0 : current.source) !== 'parent' &&
|
|
4387
|
+
(destination === null || destination === void 0 ? void 0 : destination.source) !== 'parent' &&
|
|
4263
4388
|
(destination === null || destination === void 0 ? void 0 : destination.source) !== 'input' &&
|
|
4264
4389
|
((_a = destination === null || destination === void 0 ? void 0 : destination.source) === null || _a === void 0 ? void 0 : _a.walletName) === ((_b = current === null || current === void 0 ? void 0 : current.source) === null || _b === void 0 ? void 0 : _b.walletName);
|
|
4265
4390
|
const isSameAsSource = (current === null || current === void 0 ? void 0 : current.source) !== 'input' &&
|
|
4266
4391
|
(source === null || source === void 0 ? void 0 : source.source) !== 'input' &&
|
|
4392
|
+
(current === null || current === void 0 ? void 0 : current.source) !== 'parent' &&
|
|
4393
|
+
(source === null || source === void 0 ? void 0 : source.source) !== 'parent' &&
|
|
4267
4394
|
((_c = source === null || source === void 0 ? void 0 : source.source) === null || _c === void 0 ? void 0 : _c.walletName) === ((_d = current === null || current === void 0 ? void 0 : current.source) === null || _d === void 0 ? void 0 : _d.walletName);
|
|
4268
4395
|
const { makeWallets } = useMakeWallets();
|
|
4269
4396
|
return useQuery({
|
|
@@ -4276,11 +4403,12 @@ const useAutoSetAddress = ({ chain, chainID, index, enabled, signRequired, chain
|
|
|
4276
4403
|
index,
|
|
4277
4404
|
destination,
|
|
4278
4405
|
currentSource: current === null || current === void 0 ? void 0 : current.source,
|
|
4406
|
+
connectedWallet,
|
|
4279
4407
|
},
|
|
4280
4408
|
],
|
|
4281
4409
|
queryFn: async () => {
|
|
4282
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
4283
|
-
if ((current === null || current === void 0 ? void 0 : current.source) === 'input') {
|
|
4410
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
4411
|
+
if ((current === null || current === void 0 ? void 0 : current.source) === 'input' || (current === null || current === void 0 ? void 0 : current.source) === 'parent') {
|
|
4284
4412
|
return null;
|
|
4285
4413
|
}
|
|
4286
4414
|
const wallets = makeWallets(chainID);
|
|
@@ -4293,7 +4421,9 @@ const useAutoSetAddress = ({ chain, chainID, index, enabled, signRequired, chain
|
|
|
4293
4421
|
cosmos &&
|
|
4294
4422
|
!chain.chainID.includes('penumbra')) {
|
|
4295
4423
|
const walletSelected = wallets.find((wallet) => wallet.walletName === (cosmos === null || cosmos === void 0 ? void 0 : cosmos.walletName));
|
|
4296
|
-
const address = await ((_a = walletSelected === null || walletSelected === void 0 ? void 0 : walletSelected.getAddress) === null || _a === void 0 ? void 0 : _a.call(walletSelected, {
|
|
4424
|
+
const address = await ((_a = walletSelected === null || walletSelected === void 0 ? void 0 : walletSelected.getAddress) === null || _a === void 0 ? void 0 : _a.call(walletSelected, {
|
|
4425
|
+
signRequired,
|
|
4426
|
+
}));
|
|
4297
4427
|
if (walletSelected && address) {
|
|
4298
4428
|
setChainAddresses({
|
|
4299
4429
|
index,
|
|
@@ -4308,6 +4438,7 @@ const useAutoSetAddress = ({ chain, chainID, index, enabled, signRequired, chain
|
|
|
4308
4438
|
if (Boolean(destination === null || destination === void 0 ? void 0 : destination.address) &&
|
|
4309
4439
|
(destination === null || destination === void 0 ? void 0 : destination.chainType) === 'cosmos' &&
|
|
4310
4440
|
(destination === null || destination === void 0 ? void 0 : destination.source) !== 'input' &&
|
|
4441
|
+
(destination === null || destination === void 0 ? void 0 : destination.source) !== 'parent' &&
|
|
4311
4442
|
index !== 0 &&
|
|
4312
4443
|
!signRequired &&
|
|
4313
4444
|
!chain.chainID.includes('penumbra')) {
|
|
@@ -4336,13 +4467,29 @@ const useAutoSetAddress = ({ chain, chainID, index, enabled, signRequired, chain
|
|
|
4336
4467
|
source: walletSelected,
|
|
4337
4468
|
});
|
|
4338
4469
|
}
|
|
4470
|
+
else {
|
|
4471
|
+
if ((_e = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.cosmos) === null || _e === void 0 ? void 0 : _e.getAddress) {
|
|
4472
|
+
const address = await connectedWallet.cosmos.getAddress(chainID);
|
|
4473
|
+
if (address) {
|
|
4474
|
+
setChainAddresses({
|
|
4475
|
+
index,
|
|
4476
|
+
chainID,
|
|
4477
|
+
chainType: chain.chainType,
|
|
4478
|
+
address,
|
|
4479
|
+
source: 'parent',
|
|
4480
|
+
});
|
|
4481
|
+
}
|
|
4482
|
+
}
|
|
4483
|
+
}
|
|
4339
4484
|
}
|
|
4340
4485
|
}
|
|
4341
4486
|
if ((chain === null || chain === void 0 ? void 0 : chain.chainType) === 'evm') {
|
|
4342
4487
|
// intermediary chain need to be signed and the source chain is same as the current chain
|
|
4343
4488
|
if (index !== 0 && signRequired && (source === null || source === void 0 ? void 0 : source.chainType) === 'evm' && evm) {
|
|
4344
4489
|
const walletSelected = wallets.find((wallet) => wallet.walletName === (evm === null || evm === void 0 ? void 0 : evm.walletName));
|
|
4345
|
-
const address = await ((
|
|
4490
|
+
const address = await ((_f = walletSelected === null || walletSelected === void 0 ? void 0 : walletSelected.getAddress) === null || _f === void 0 ? void 0 : _f.call(walletSelected, {
|
|
4491
|
+
signRequired,
|
|
4492
|
+
}));
|
|
4346
4493
|
if (walletSelected && address) {
|
|
4347
4494
|
setChainAddresses({
|
|
4348
4495
|
index,
|
|
@@ -4357,10 +4504,11 @@ const useAutoSetAddress = ({ chain, chainID, index, enabled, signRequired, chain
|
|
|
4357
4504
|
if (Boolean(destination === null || destination === void 0 ? void 0 : destination.address) &&
|
|
4358
4505
|
(destination === null || destination === void 0 ? void 0 : destination.chainType) === 'evm' &&
|
|
4359
4506
|
(destination === null || destination === void 0 ? void 0 : destination.source) !== 'input' &&
|
|
4507
|
+
(destination === null || destination === void 0 ? void 0 : destination.source) !== 'parent' &&
|
|
4360
4508
|
index !== 0) {
|
|
4361
|
-
const walletName = (
|
|
4509
|
+
const walletName = (_g = destination.source) === null || _g === void 0 ? void 0 : _g.walletName;
|
|
4362
4510
|
const walletSelected = wallets.find((wallet) => wallet.walletName === walletName);
|
|
4363
|
-
const address = await ((
|
|
4511
|
+
const address = await ((_h = walletSelected === null || walletSelected === void 0 ? void 0 : walletSelected.getAddress) === null || _h === void 0 ? void 0 : _h.call(walletSelected, {}));
|
|
4364
4512
|
if (walletSelected && address) {
|
|
4365
4513
|
setChainAddresses({
|
|
4366
4514
|
index,
|
|
@@ -4373,7 +4521,7 @@ const useAutoSetAddress = ({ chain, chainID, index, enabled, signRequired, chain
|
|
|
4373
4521
|
}
|
|
4374
4522
|
else {
|
|
4375
4523
|
const walletSelected = wallets.find((wallet) => wallet.walletName === (evm === null || evm === void 0 ? void 0 : evm.walletName));
|
|
4376
|
-
const address = await ((
|
|
4524
|
+
const address = await ((_j = walletSelected === null || walletSelected === void 0 ? void 0 : walletSelected.getAddress) === null || _j === void 0 ? void 0 : _j.call(walletSelected, {}));
|
|
4377
4525
|
if (walletSelected && address) {
|
|
4378
4526
|
setChainAddresses({
|
|
4379
4527
|
index,
|
|
@@ -4383,16 +4531,31 @@ const useAutoSetAddress = ({ chain, chainID, index, enabled, signRequired, chain
|
|
|
4383
4531
|
source: walletSelected,
|
|
4384
4532
|
});
|
|
4385
4533
|
}
|
|
4534
|
+
else {
|
|
4535
|
+
if ((_k = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.evm) === null || _k === void 0 ? void 0 : _k.getAddress) {
|
|
4536
|
+
const address = await connectedWallet.evm.getAddress(chainID);
|
|
4537
|
+
if (address) {
|
|
4538
|
+
setChainAddresses({
|
|
4539
|
+
index,
|
|
4540
|
+
chainID,
|
|
4541
|
+
chainType: chain.chainType,
|
|
4542
|
+
address,
|
|
4543
|
+
source: 'parent',
|
|
4544
|
+
});
|
|
4545
|
+
}
|
|
4546
|
+
}
|
|
4547
|
+
}
|
|
4386
4548
|
}
|
|
4387
4549
|
}
|
|
4388
4550
|
if ((chain === null || chain === void 0 ? void 0 : chain.chainType) === 'svm') {
|
|
4389
4551
|
if (Boolean(destination === null || destination === void 0 ? void 0 : destination.address) &&
|
|
4390
4552
|
(destination === null || destination === void 0 ? void 0 : destination.chainType) === 'svm' &&
|
|
4391
4553
|
(destination === null || destination === void 0 ? void 0 : destination.source) !== 'input' &&
|
|
4554
|
+
destination.source !== 'parent' &&
|
|
4392
4555
|
index !== 0) {
|
|
4393
|
-
const walletName = (
|
|
4556
|
+
const walletName = (_l = destination.source) === null || _l === void 0 ? void 0 : _l.walletName;
|
|
4394
4557
|
const walletSelected = wallets.find((wallet) => wallet.walletName === walletName);
|
|
4395
|
-
const address = await ((
|
|
4558
|
+
const address = await ((_m = walletSelected === null || walletSelected === void 0 ? void 0 : walletSelected.getAddress) === null || _m === void 0 ? void 0 : _m.call(walletSelected, {}));
|
|
4396
4559
|
if (walletSelected && address) {
|
|
4397
4560
|
setChainAddresses({
|
|
4398
4561
|
index,
|
|
@@ -4405,7 +4568,7 @@ const useAutoSetAddress = ({ chain, chainID, index, enabled, signRequired, chain
|
|
|
4405
4568
|
}
|
|
4406
4569
|
else {
|
|
4407
4570
|
const walletSelected = wallets.find((wallet) => wallet.walletName === (svm === null || svm === void 0 ? void 0 : svm.walletName));
|
|
4408
|
-
const address = await ((
|
|
4571
|
+
const address = await ((_o = walletSelected === null || walletSelected === void 0 ? void 0 : walletSelected.getAddress) === null || _o === void 0 ? void 0 : _o.call(walletSelected, {}));
|
|
4409
4572
|
if (walletSelected && address) {
|
|
4410
4573
|
setChainAddresses({
|
|
4411
4574
|
index,
|
|
@@ -4415,13 +4578,27 @@ const useAutoSetAddress = ({ chain, chainID, index, enabled, signRequired, chain
|
|
|
4415
4578
|
source: walletSelected,
|
|
4416
4579
|
});
|
|
4417
4580
|
}
|
|
4581
|
+
else {
|
|
4582
|
+
if ((_p = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.svm) === null || _p === void 0 ? void 0 : _p.getAddress) {
|
|
4583
|
+
const address = await connectedWallet.svm.getAddress(chainID);
|
|
4584
|
+
if (address) {
|
|
4585
|
+
setChainAddresses({
|
|
4586
|
+
index,
|
|
4587
|
+
chainID,
|
|
4588
|
+
chainType: chain.chainType,
|
|
4589
|
+
address,
|
|
4590
|
+
source: 'parent',
|
|
4591
|
+
});
|
|
4592
|
+
}
|
|
4593
|
+
}
|
|
4594
|
+
}
|
|
4418
4595
|
}
|
|
4419
4596
|
}
|
|
4420
4597
|
return null;
|
|
4421
4598
|
},
|
|
4422
4599
|
enabled: enabled &&
|
|
4423
4600
|
!!(chain === null || chain === void 0 ? void 0 : chain.chainType) &&
|
|
4424
|
-
!!trackedWallets &&
|
|
4601
|
+
(!!trackedWallets || !!connectedWallet) &&
|
|
4425
4602
|
(!currentAcdress || !isSameAsDestination || !isSameAsSource),
|
|
4426
4603
|
retry: false,
|
|
4427
4604
|
refetchOnMount: true,
|
|
@@ -4584,12 +4761,14 @@ const ChainStep = ({ chainID, index, transferAction, swapAction, route, chainIDs
|
|
|
4584
4761
|
catch (error) {
|
|
4585
4762
|
toast.error('Failed to copy address to clipboard');
|
|
4586
4763
|
}
|
|
4587
|
-
}, className: "opacity-50", children: (chainAddress === null || chainAddress === void 0 ? void 0 : chainAddress.source) !== 'input'
|
|
4764
|
+
}, className: "opacity-50", children: (chainAddress === null || chainAddress === void 0 ? void 0 : chainAddress.source) !== 'input' &&
|
|
4765
|
+
(chainAddress === null || chainAddress === void 0 ? void 0 : chainAddress.source) !== 'parent' ? (jsx("img", { height: 16, width: 16, alt: 'wallet', className: "object-contain", src: (typeof ((_h = chainAddress === null || chainAddress === void 0 ? void 0 : chainAddress.source) === null || _h === void 0 ? void 0 : _h.walletInfo.logo) ===
|
|
4588
4766
|
'string'
|
|
4589
4767
|
? (_j = chainAddress === null || chainAddress === void 0 ? void 0 : chainAddress.source) === null || _j === void 0 ? void 0 : _j.walletInfo.logo
|
|
4590
4768
|
: ((_l = (_k = chainAddress === null || chainAddress === void 0 ? void 0 : chainAddress.source) === null || _k === void 0 ? void 0 : _k.walletInfo.logo) === null || _l === void 0 ? void 0 : _l.major) ||
|
|
4591
4769
|
((_o = (_m = chainAddress === null || chainAddress === void 0 ? void 0 : chainAddress.source) === null || _m === void 0 ? void 0 : _m.walletInfo.logo) === null || _o === void 0 ? void 0 : _o.minor)) ||
|
|
4592
|
-
'https://api.dicebear.com/6.x/shapes/svg' })) : (jsx(FaKeyboard, { className: "h-4 w-4 text-neutral-400" })) }) })), (stepState === null || stepState === void 0 ? void 0 : stepState.explorerLink) && (jsxs(StyledAdaptiveLink, { className: cn('flex flex-row items-center text-sm font-semibold underline'), href: stepState.explorerLink.link, "data-testid": `explorer-link`, children: [stepState.explorerLink.shorthand, jsx(FaExternalLinkAlt, { className: "ml-1 h-3 w-3" })] }))] }), jsxs("div", { className: cn('flex h-9 flex-row items-center space-x-2', isNotFocused && 'opacity-50'), children: [(chainAddress === null || chainAddress === void 0 ? void 0 : chainAddress.address) && !isIntermidiaryChain && (jsxs(Fragment, { children: [(chainAddress === null || chainAddress === void 0 ? void 0 : chainAddress.source) !== 'input'
|
|
4770
|
+
'https://api.dicebear.com/6.x/shapes/svg' })) : (chainAddress === null || chainAddress === void 0 ? void 0 : chainAddress.source) !== 'parent' ? (jsx(FaKeyboard, { className: "h-4 w-4 text-neutral-400" })) : (jsx(FaKeyboard, { className: "h-4 w-4 text-neutral-400" })) }) })), (stepState === null || stepState === void 0 ? void 0 : stepState.explorerLink) && (jsxs(StyledAdaptiveLink, { className: cn('flex flex-row items-center text-sm font-semibold underline'), href: stepState.explorerLink.link, "data-testid": `explorer-link`, children: [stepState.explorerLink.shorthand, jsx(FaExternalLinkAlt, { className: "ml-1 h-3 w-3" })] }))] }), jsxs("div", { className: cn('flex h-9 flex-row items-center space-x-2', isNotFocused && 'opacity-50'), children: [(chainAddress === null || chainAddress === void 0 ? void 0 : chainAddress.address) && !isIntermidiaryChain && (jsxs(Fragment, { children: [(chainAddress === null || chainAddress === void 0 ? void 0 : chainAddress.source) !== 'input' &&
|
|
4771
|
+
(chainAddress === null || chainAddress === void 0 ? void 0 : chainAddress.source) !== 'parent' ? (jsx("img", { height: 16, width: 16, alt: 'wallet', className: "object-contain", src: (typeof ((_p = chainAddress === null || chainAddress === void 0 ? void 0 : chainAddress.source) === null || _p === void 0 ? void 0 : _p.walletInfo.logo) === 'string'
|
|
4593
4772
|
? (_q = chainAddress === null || chainAddress === void 0 ? void 0 : chainAddress.source) === null || _q === void 0 ? void 0 : _q.walletInfo.logo
|
|
4594
4773
|
: ((_s = (_r = chainAddress === null || chainAddress === void 0 ? void 0 : chainAddress.source) === null || _r === void 0 ? void 0 : _r.walletInfo.logo) === null || _s === void 0 ? void 0 : _s.major) ||
|
|
4595
4774
|
((_u = (_t = chainAddress === null || chainAddress === void 0 ? void 0 : chainAddress.source) === null || _t === void 0 ? void 0 : _t.walletInfo.logo) === null || _u === void 0 ? void 0 : _u.minor)) ||
|