@swapkit/wallets 3.0.0-beta.16 → 3.0.0-beta.18
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/{chunk-3nr5rw92.js → chunk-a8qhv2x6.js} +2 -2
- package/dist/{chunk-3nr5rw92.js.map → chunk-a8qhv2x6.js.map} +3 -3
- package/dist/chunk-gmardvnh.js +4 -0
- package/dist/{chunk-1hhfz9hh.js.map → chunk-gmardvnh.js.map} +3 -3
- package/dist/chunk-v5jt2hmr.js +3 -0
- package/dist/chunk-v5jt2hmr.js.map +10 -0
- package/dist/chunk-y0g3prs9.js +3 -0
- package/dist/chunk-y0g3prs9.js.map +10 -0
- package/dist/src/bitget/index.js +1 -1
- package/dist/src/coinbase/index.js +1 -1
- package/dist/src/ctrl/index.cjs +2 -2
- package/dist/src/ctrl/index.cjs.map +3 -3
- package/dist/src/ctrl/index.js +2 -2
- package/dist/src/ctrl/index.js.map +3 -3
- package/dist/src/evm-extensions/index.js +1 -1
- package/dist/src/exodus/index.js +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/keepkey/index.js +1 -1
- package/dist/src/keepkey-bex/index.js +1 -1
- package/dist/src/keystore/index.js +1 -1
- package/dist/src/ledger/index.cjs +3 -3
- package/dist/src/ledger/index.cjs.map +8 -7
- package/dist/src/ledger/index.js +3 -3
- package/dist/src/ledger/index.js.map +8 -7
- package/dist/src/okx/index.js +1 -1
- package/dist/src/onekey/index.js +1 -1
- package/dist/src/phantom/index.js +1 -1
- package/dist/src/polkadotjs/index.js +1 -1
- package/dist/src/radix/index.js +1 -1
- package/dist/src/talisman/index.js +1 -1
- package/dist/src/trezor/index.cjs +2 -2
- package/dist/src/trezor/index.cjs.map +3 -3
- package/dist/src/trezor/index.js +2 -2
- package/dist/src/trezor/index.js.map +3 -3
- package/dist/src/walletconnect/index.js +1 -1
- package/package.json +21 -19
- package/src/cosmostation/index.ts +141 -0
- package/src/ctrl/walletHelpers.ts +63 -42
- package/src/ledger/clients/xrp.ts +66 -0
- package/src/ledger/helpers/getLedgerAddress.ts +12 -3
- package/src/ledger/helpers/getLedgerClient.ts +4 -0
- package/src/ledger/index.ts +10 -0
- package/src/trezor/index.ts +11 -1
- package/src/types.ts +3 -0
- package/src/utils.ts +4 -0
- package/dist/chunk-1hhfz9hh.js +0 -4
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { Chain, SwapKitError, WalletOption } from "@swapkit/helpers";
|
|
2
2
|
|
|
3
|
+
import type { XRPLedger } from "../clients/xrp";
|
|
3
4
|
import type { LEDGER_SUPPORTED_CHAINS } from "../index";
|
|
4
5
|
import type { CosmosLedgerClients, EVMLedgerClients, UTXOLedgerClients } from "../types";
|
|
5
6
|
import type { getLedgerClient } from "./getLedgerClient";
|
|
6
7
|
|
|
7
|
-
export const getLedgerAddress = async
|
|
8
|
+
export const getLedgerAddress = async <
|
|
9
|
+
T extends (typeof LEDGER_SUPPORTED_CHAINS)[number],
|
|
10
|
+
L extends Awaited<ReturnType<typeof getLedgerClient<T>>>,
|
|
11
|
+
>({
|
|
8
12
|
chain,
|
|
9
13
|
ledgerClient,
|
|
10
14
|
}: {
|
|
11
|
-
chain:
|
|
12
|
-
ledgerClient:
|
|
15
|
+
chain: T;
|
|
16
|
+
ledgerClient: L;
|
|
13
17
|
}) => {
|
|
14
18
|
if (!ledgerClient) return "";
|
|
15
19
|
|
|
@@ -40,6 +44,11 @@ export const getLedgerAddress = async ({
|
|
|
40
44
|
|
|
41
45
|
return chain === Chain.BitcoinCash ? address.replace("bitcoincash:", "") : address;
|
|
42
46
|
}
|
|
47
|
+
|
|
48
|
+
case Chain.Ripple: {
|
|
49
|
+
return (ledgerClient as Awaited<ReturnType<typeof XRPLedger>>).address;
|
|
50
|
+
}
|
|
51
|
+
|
|
43
52
|
default:
|
|
44
53
|
throw new SwapKitError("wallet_chain_not_supported", { wallet: WalletOption.LEDGER, chain });
|
|
45
54
|
}
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
DogecoinLedger,
|
|
19
19
|
LitecoinLedger,
|
|
20
20
|
} from "../clients/utxo";
|
|
21
|
+
import { XRPLedger } from "../clients/xrp";
|
|
21
22
|
|
|
22
23
|
type LedgerSignerMap = {
|
|
23
24
|
[Chain.Arbitrum]: ReturnType<typeof ArbitrumLedger>;
|
|
@@ -33,6 +34,7 @@ type LedgerSignerMap = {
|
|
|
33
34
|
[Chain.Litecoin]: ReturnType<typeof LitecoinLedger>;
|
|
34
35
|
[Chain.Optimism]: ReturnType<typeof OptimismLedger>;
|
|
35
36
|
[Chain.Polygon]: ReturnType<typeof PolygonLedger>;
|
|
37
|
+
[Chain.Ripple]: ReturnType<typeof XRPLedger>;
|
|
36
38
|
[Chain.THORChain]: THORChainLedger;
|
|
37
39
|
};
|
|
38
40
|
|
|
@@ -60,6 +62,8 @@ export const getLedgerClient = async <T extends LedgerSupportedChain>({
|
|
|
60
62
|
return DogecoinLedger(derivationPath) as LedgerSignerMap[T];
|
|
61
63
|
case Chain.Litecoin:
|
|
62
64
|
return LitecoinLedger(derivationPath) as LedgerSignerMap[T];
|
|
65
|
+
case Chain.Ripple:
|
|
66
|
+
return XRPLedger(derivationPath) as LedgerSignerMap[T];
|
|
63
67
|
|
|
64
68
|
case Chain.Arbitrum:
|
|
65
69
|
case Chain.Avalanche:
|
package/src/ledger/index.ts
CHANGED
|
@@ -32,6 +32,7 @@ export const ledgerWallet = createWallet({
|
|
|
32
32
|
Chain.Litecoin,
|
|
33
33
|
Chain.Optimism,
|
|
34
34
|
Chain.Polygon,
|
|
35
|
+
Chain.Ripple,
|
|
35
36
|
Chain.THORChain,
|
|
36
37
|
],
|
|
37
38
|
walletType: WalletOption.LEDGER,
|
|
@@ -267,6 +268,15 @@ async function getWalletMethods({
|
|
|
267
268
|
return { ...toolbox, address, deposit, transfer, signMessage };
|
|
268
269
|
}
|
|
269
270
|
|
|
271
|
+
case Chain.Ripple: {
|
|
272
|
+
const { getRippleToolbox } = await import("@swapkit/toolboxes/ripple");
|
|
273
|
+
const signer = await getLedgerClient({ chain, derivationPath });
|
|
274
|
+
const address = signer.address;
|
|
275
|
+
const toolbox = await getRippleToolbox({ signer });
|
|
276
|
+
|
|
277
|
+
return { ...toolbox, address };
|
|
278
|
+
}
|
|
279
|
+
|
|
270
280
|
default:
|
|
271
281
|
throw new Error("Unsupported chain");
|
|
272
282
|
}
|
package/src/trezor/index.ts
CHANGED
|
@@ -233,7 +233,17 @@ export const trezorWallet = createWallet({
|
|
|
233
233
|
const { success } = await TrezorConnect.getDeviceState();
|
|
234
234
|
|
|
235
235
|
if (!success) {
|
|
236
|
-
const
|
|
236
|
+
const trezorConfig = SKConfig.get("integrations").trezor;
|
|
237
|
+
const manifest = trezorConfig
|
|
238
|
+
? {
|
|
239
|
+
...trezorConfig,
|
|
240
|
+
appName: (trezorConfig as any).appName || "SwapKit",
|
|
241
|
+
}
|
|
242
|
+
: {
|
|
243
|
+
appUrl: "",
|
|
244
|
+
email: "",
|
|
245
|
+
appName: "SwapKit",
|
|
246
|
+
};
|
|
237
247
|
TrezorConnect.init({ lazyLoad: true, manifest });
|
|
238
248
|
}
|
|
239
249
|
|
package/src/types.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type { BrowserProvider, Eip1193Provider } from "ethers";
|
|
|
12
12
|
import type { SubstrateInjectedExtension } from "@swapkit/toolboxes/substrate";
|
|
13
13
|
import type { bitgetWallet } from "./bitget";
|
|
14
14
|
import type { coinbaseWallet } from "./coinbase";
|
|
15
|
+
import type { cosmostationWallet } from "./cosmostation";
|
|
15
16
|
import type { ctrlWallet } from "./ctrl";
|
|
16
17
|
import type { evmWallet } from "./evm-extensions";
|
|
17
18
|
import type { exodusWallet } from "./exodus";
|
|
@@ -34,6 +35,7 @@ export type SKWallets = {
|
|
|
34
35
|
[WalletOption.BRAVE]: typeof evmWallet;
|
|
35
36
|
[WalletOption.COINBASE_MOBILE]: typeof coinbaseWallet;
|
|
36
37
|
[WalletOption.COINBASE_WEB]: typeof evmWallet;
|
|
38
|
+
[WalletOption.COSMOSTATION]: typeof cosmostationWallet;
|
|
37
39
|
[WalletOption.CTRL]: typeof ctrlWallet;
|
|
38
40
|
[WalletOption.EIP6963]: typeof evmWallet;
|
|
39
41
|
[WalletOption.EXODUS]: typeof exodusWallet;
|
|
@@ -64,6 +66,7 @@ export type SKWalletsSupportedChains = {
|
|
|
64
66
|
[WalletOption.BRAVE]: typeof evmWallet.connectEVMWallet.supportedChains;
|
|
65
67
|
[WalletOption.COINBASE_MOBILE]: typeof coinbaseWallet.connectCoinbaseWallet.supportedChains;
|
|
66
68
|
[WalletOption.COINBASE_WEB]: typeof evmWallet.connectEVMWallet.supportedChains;
|
|
69
|
+
[WalletOption.COSMOSTATION]: typeof cosmostationWallet.connectCosmostation.supportedChains;
|
|
67
70
|
[WalletOption.CTRL]: typeof ctrlWallet.connectCtrl.supportedChains;
|
|
68
71
|
[WalletOption.EIP6963]: typeof evmWallet.connectEVMWallet.supportedChains;
|
|
69
72
|
[WalletOption.EXODUS]: typeof exodusWallet.connectExodusWallet.supportedChains;
|
package/src/utils.ts
CHANGED
|
@@ -25,6 +25,10 @@ export async function loadWallet<W extends WalletOption>(walletOption: W): Promi
|
|
|
25
25
|
async () => (await import("./walletconnect")).walletconnectWallet,
|
|
26
26
|
)
|
|
27
27
|
.with(WalletOption.KEPLR, WalletOption.LEAP, async () => (await import("./keplr")).keplrWallet)
|
|
28
|
+
.with(
|
|
29
|
+
WalletOption.COSMOSTATION,
|
|
30
|
+
async () => (await import("./cosmostation")).cosmostationWallet,
|
|
31
|
+
)
|
|
28
32
|
.with(
|
|
29
33
|
WalletOption.BRAVE,
|
|
30
34
|
WalletOption.COINBASE_WEB,
|
package/dist/chunk-1hhfz9hh.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{c as a,d as e}from"./chunk-p1kdg37m.js";import{WalletOption as t}from"@swapkit/helpers";function r(i){let l=Object.keys(i)?.[0]||"";return i?.[l]?.supportedChains||[]}async function p(i){let{match:l}=await import("ts-pattern");return await l(i).with(t.COINBASE_MOBILE,async()=>(await import("./src/coinbase/index.js")).coinbaseWallet).with(t.BITGET,async()=>(await import("./src/bitget/index.js")).bitgetWallet).with(t.CTRL,async()=>(await import("./src/ctrl/index.js")).ctrlWallet).with(t.OKX,async()=>(await import("./src/okx/index.js")).okxWallet).with(t.ONEKEY,async()=>(await import("./src/onekey/index.js")).onekeyWallet).with(t.EXODUS,async()=>(await import("./src/exodus/index.js")).exodusWallet).with(t.KEEPKEY,async()=>(await import("./src/keepkey/index.js")).keepkeyWallet).with(t.KEEPKEY_BEX,async()=>(await import("./src/keepkey-bex/index.js")).keepkeyBexWallet).with(t.WALLETCONNECT,async()=>(await import("./src/walletconnect/index.js")).walletconnectWallet).with(t.KEPLR,t.LEAP,async()=>(await import("./src/keplr/index.js")).keplrWallet).with(t.BRAVE,t.COINBASE_WEB,t.EIP6963,t.METAMASK,t.OKX_MOBILE,t.TRUSTWALLET_WEB,async()=>(await import("./src/evm-extensions/index.js")).evmWallet).with(t.KEYSTORE,async()=>(await import("./src/keystore/index.js")).keystoreWallet).with(t.TREZOR,async()=>(await import("./src/trezor/index.js")).trezorWallet).with(t.LEDGER,t.LEDGER_LIVE,async()=>(await import("./src/ledger/index.js")).ledgerWallet).with(t.PHANTOM,async()=>(await import("./src/phantom/index.js")).phantomWallet).with(t.POLKADOT_JS,async()=>(await import("./src/polkadotjs/index.js")).polkadotWallet).with(t.RADIX_WALLET,async()=>(await import("./src/radix/index.js")).radixWallet).with(t.TALISMAN,async()=>(await import("./src/talisman/index.js")).talismanWallet).exhaustive()}
|
|
2
|
-
export{r as a,p as b};
|
|
3
|
-
|
|
4
|
-
//# debugId=40B36BBD4009778C64756E2164756E21
|