@swapkit/core 1.0.0-rc.167 → 1.0.0-rc.169

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/package.json CHANGED
@@ -1,27 +1,18 @@
1
1
  {
2
2
  "author": "swapkit-oss",
3
3
  "dependencies": {
4
- "@swapkit/api": "1.0.0-rc.80",
5
- "@swapkit/helpers": "1.0.0-rc.112"
4
+ "@swapkit/api": "1.0.0-rc.82",
5
+ "@swapkit/helpers": "1.0.0-rc.114",
6
+ "@swapkit/toolbox-cosmos": "1.0.0-rc.141",
7
+ "@swapkit/toolbox-evm": "1.0.0-rc.121",
8
+ "@swapkit/toolbox-solana": "1.0.0-rc.2",
9
+ "@swapkit/toolbox-substrate": "1.0.0-rc.49",
10
+ "@swapkit/toolbox-utxo": "1.0.0-rc.125"
6
11
  },
7
- "description": "SwapKit - Core",
8
12
  "devDependencies": {
9
- "@swapkit/tokens": "1.0.0-rc.54",
10
- "@swapkit/toolbox-cosmos": "1.0.0-rc.139",
11
- "@swapkit/toolbox-evm": "1.0.0-rc.119",
12
- "@swapkit/toolbox-substrate": "1.0.0-rc.47",
13
- "@swapkit/toolbox-utxo": "1.0.0-rc.123",
14
- "bun-types": "1.1.8"
15
- },
16
- "peerDependencies": {
17
- "@swapkit/api": "1.0.0-rc.80",
18
- "@swapkit/helpers": "1.0.0-rc.112",
19
- "@swapkit/tokens": "1.0.0-rc.54",
20
- "@swapkit/toolbox-cosmos": "1.0.0-rc.139",
21
- "@swapkit/toolbox-evm": "1.0.0-rc.119",
22
- "@swapkit/toolbox-substrate": "1.0.0-rc.47",
23
- "@swapkit/toolbox-utxo": "1.0.0-rc.123"
13
+ "@swapkit/tokens": "1.0.0-rc.56"
24
14
  },
15
+ "description": "SwapKit - Core",
25
16
  "files": [
26
17
  "src/",
27
18
  "dist/"
@@ -37,13 +28,13 @@
37
28
  },
38
29
  "scripts": {
39
30
  "build": "bun run ./build.ts",
40
- "clean": "rm -rf .turbo dist node_modules *.tsbuildinfo",
41
- "lint": "biome check --apply ./src",
31
+ "clean": "rm -rf dist node_modules *.tsbuildinfo",
32
+ "lint": "biome check --write ./src",
42
33
  "test": "echo 'bun test'",
43
- "test:coverage": "echo 'bun test --coverage'",
34
+ "test:coverage": "bun test --coverage",
44
35
  "type-check": "tsc --noEmit"
45
36
  },
46
37
  "type": "module",
47
38
  "types": "./src/index.ts",
48
- "version": "1.0.0-rc.167"
39
+ "version": "1.0.0-rc.169"
49
40
  }
@@ -50,4 +50,16 @@ describe("Explorer URLs", () => {
50
50
  });
51
51
  }
52
52
  });
53
+
54
+ describe("Solana", () => {
55
+ test("getExplorerTxUrl returns correct URL for Solana", () => {
56
+ expect(getExplorerTxUrl({ chain: Chain.Solana, txHash: "b123456789" })).toBe(
57
+ "https://solscan.io/tx/b123456789",
58
+ );
59
+
60
+ expect(getExplorerAddressUrl({ chain: Chain.Solana, address: "asdfg" })).toBe(
61
+ "https://solscan.io/account/asdfg",
62
+ );
63
+ });
64
+ });
53
65
  });
package/src/client.ts CHANGED
@@ -285,6 +285,7 @@ export function SwapKit<
285
285
  const chain = assetValue.chain as WalletChain;
286
286
  const wallet = connectedWallets[chain];
287
287
  if (!wallet) throw new SwapKitError("core_wallet_connection_not_found");
288
+
288
289
  return wallet.transfer({ from, recipient, assetValue, feeOptionKey });
289
290
  }
290
291
 
@@ -9,6 +9,7 @@ export function getExplorerTxUrl({ chain, txHash }: { txHash: string; chain: Cha
9
9
  case Chain.Kujira:
10
10
  case Chain.Cosmos:
11
11
  case Chain.THORChain:
12
+ case Chain.Solana:
12
13
  return `${baseUrl}/tx/${txHash.startsWith("0x") ? txHash.slice(2) : txHash}`;
13
14
 
14
15
  case Chain.Arbitrum:
@@ -34,5 +35,11 @@ export function getExplorerTxUrl({ chain, txHash }: { txHash: string; chain: Cha
34
35
  export function getExplorerAddressUrl({ chain, address }: { address: string; chain: Chain }) {
35
36
  const baseUrl = ChainToExplorerUrl[chain];
36
37
 
37
- return `${baseUrl}/address/${address}`;
38
+ switch (chain) {
39
+ case Chain.Solana:
40
+ return `${baseUrl}/account/${address}`;
41
+
42
+ default:
43
+ return `${baseUrl}/address/${address}`;
44
+ }
38
45
  }
package/src/types.ts CHANGED
@@ -8,12 +8,13 @@ import type {
8
8
  import type { CosmosWallets, ThorchainWallets } from "@swapkit/toolbox-cosmos";
9
9
  import type { CovalentApiType, EthplorerApiType } from "@swapkit/toolbox-evm";
10
10
  import type { EVMWallets } from "@swapkit/toolbox-evm";
11
+ import type { SolanaWallet } from "@swapkit/toolbox-solana";
11
12
  import type { SubstrateWallets } from "@swapkit/toolbox-substrate";
12
13
  import type { BlockchairApiType } from "@swapkit/toolbox-utxo";
13
14
  import type { UTXOWallets } from "@swapkit/toolbox-utxo";
14
15
 
15
16
  export type Wallet = BaseWallet<
16
- EVMWallets & UTXOWallets & CosmosWallets & ThorchainWallets & SubstrateWallets
17
+ EVMWallets & UTXOWallets & CosmosWallets & ThorchainWallets & SubstrateWallets & SolanaWallet
17
18
  >;
18
19
 
19
20
  export type SwapKitWallet<ConnectParams extends Todo[]> = (