@swapkit/helpers 1.7.1 → 1.9.0
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/index.js +3 -3
- package/dist/index.js.map +17 -17
- package/package.json +10 -11
- package/src/helpers/__tests__/asset.test.ts +29 -27
- package/src/helpers/__tests__/memo.test.ts +1 -1
- package/src/helpers/__tests__/others.test.ts +2 -2
- package/src/helpers/asset.ts +5 -5
- package/src/helpers/liquidity.ts +2 -2
- package/src/helpers/memo.ts +1 -1
- package/src/helpers/web3wallets.ts +5 -5
- package/src/index.ts +13 -13
- package/src/modules/__tests__/assetValue.test.ts +11 -2
- package/src/modules/__tests__/bigIntArithmetics.test.ts +1 -1
- package/src/modules/__tests__/swapKitNumber.test.ts +1 -1
- package/src/modules/assetValue.ts +14 -15
- package/src/modules/bigIntArithmetics.ts +2 -2
- package/src/modules/requestClient.ts +2 -2
- package/src/modules/swapKitError.ts +5 -2
- package/src/modules/swapKitNumber.ts +1 -1
- package/src/types/chains.ts +1 -1
- package/src/types/commonTypes.ts +12 -4
- package/src/types/network.ts +1 -1
- package/src/types/radix.ts +2 -2
- package/src/types/tokens.ts +0 -2
- package/src/types/wallet.ts +10 -3
package/package.json
CHANGED
|
@@ -2,17 +2,16 @@
|
|
|
2
2
|
"author": "swapkit-oss",
|
|
3
3
|
"description": "SwapKit - Helpers",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@swapkit/contracts": "1.0.
|
|
6
|
-
"@swapkit/tokens": "1.
|
|
7
|
-
"picocolors": "1.0.1"
|
|
5
|
+
"@swapkit/contracts": "1.0.5",
|
|
6
|
+
"@swapkit/tokens": "1.6.0"
|
|
8
7
|
},
|
|
9
8
|
"devDependencies": {
|
|
10
|
-
"@swapkit/toolbox-cosmos": "1.
|
|
11
|
-
"@swapkit/toolbox-evm": "1.
|
|
12
|
-
"@swapkit/toolbox-radix": "1.0
|
|
13
|
-
"@swapkit/toolbox-solana": "1.0
|
|
14
|
-
"@swapkit/toolbox-substrate": "1.2.
|
|
15
|
-
"@swapkit/toolbox-utxo": "1.1.
|
|
9
|
+
"@swapkit/toolbox-cosmos": "1.3.1",
|
|
10
|
+
"@swapkit/toolbox-evm": "1.4.0",
|
|
11
|
+
"@swapkit/toolbox-radix": "1.1.0",
|
|
12
|
+
"@swapkit/toolbox-solana": "1.1.0",
|
|
13
|
+
"@swapkit/toolbox-substrate": "1.2.7",
|
|
14
|
+
"@swapkit/toolbox-utxo": "1.1.12"
|
|
16
15
|
},
|
|
17
16
|
"files": [
|
|
18
17
|
"src/",
|
|
@@ -30,12 +29,12 @@
|
|
|
30
29
|
"scripts": {
|
|
31
30
|
"build": "bun run ./build.ts",
|
|
32
31
|
"clean": "rm -rf dist node_modules *.tsbuildinfo",
|
|
33
|
-
"lint": "biome check --write ./src",
|
|
32
|
+
"lint": "biome check --diagnostic-level=error --write ./src",
|
|
34
33
|
"test": "bun test",
|
|
35
34
|
"test:coverage": "bun test --coverage",
|
|
36
35
|
"type-check": "tsc --noEmit"
|
|
37
36
|
},
|
|
38
37
|
"type": "module",
|
|
39
38
|
"types": "./src/index.ts",
|
|
40
|
-
"version": "1.
|
|
39
|
+
"version": "1.9.0"
|
|
41
40
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import { BaseDecimal, Chain } from "../../types";
|
|
3
3
|
|
|
4
|
-
import { assetFromString, getAssetType, getDecimal } from "../asset
|
|
4
|
+
import { assetFromString, getAssetType, getDecimal } from "../asset";
|
|
5
5
|
|
|
6
6
|
const tickerMap: Record<string, string> = {
|
|
7
7
|
[Chain.THORChain]: "RUNE",
|
|
@@ -88,19 +88,20 @@ describe("getDecimal", () => {
|
|
|
88
88
|
expect(wbtcDecimal).toBe(8);
|
|
89
89
|
await Bun.sleep(500);
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
91
|
+
// TODO: this times out
|
|
92
|
+
// const kindDecimal = await getDecimal({
|
|
93
|
+
// chain: Chain.Ethereum,
|
|
94
|
+
// symbol: "KIND-0x4618519de4c304f3444ffa7f812dddc2971cc688",
|
|
95
|
+
// });
|
|
96
|
+
// expect(kindDecimal).toBe(8);
|
|
97
|
+
// await Bun.sleep(500);
|
|
98
|
+
|
|
99
|
+
// const shitcoinDecimal = await getDecimal({
|
|
100
|
+
// chain: Chain.Ethereum,
|
|
101
|
+
// symbol: "HOMI-0xCa208BfD69ae6D2667f1FCbE681BAe12767c0078",
|
|
102
|
+
// });
|
|
103
|
+
// expect(shitcoinDecimal).toBe(0);
|
|
104
|
+
// await Bun.sleep(500);
|
|
104
105
|
},
|
|
105
106
|
{ retry: 3 },
|
|
106
107
|
);
|
|
@@ -134,19 +135,20 @@ describe("getDecimal", () => {
|
|
|
134
135
|
expect(timeDecimal).toBe(9);
|
|
135
136
|
await Bun.sleep(500);
|
|
136
137
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
138
|
+
// TODO: this times out
|
|
139
|
+
// const usdtDecimal = await getDecimal({
|
|
140
|
+
// chain: Chain.Avalanche,
|
|
141
|
+
// symbol: "USDT-0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",
|
|
142
|
+
// });
|
|
143
|
+
// expect(usdtDecimal).toBe(6);
|
|
144
|
+
// await Bun.sleep(500);
|
|
145
|
+
|
|
146
|
+
// const usdcDecimal = await getDecimal({
|
|
147
|
+
// chain: Chain.Avalanche,
|
|
148
|
+
// symbol: "USDC-0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
|
|
149
|
+
// });
|
|
150
|
+
// expect(usdcDecimal).toBe(6);
|
|
151
|
+
// await Bun.sleep(500);
|
|
150
152
|
},
|
|
151
153
|
{ retry: 3 },
|
|
152
154
|
);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import { Chain } from "../../types";
|
|
3
3
|
|
|
4
|
-
import { findAssetBy } from "../asset
|
|
5
|
-
import { getTHORNameCost } from "../others
|
|
4
|
+
import { findAssetBy } from "../asset";
|
|
5
|
+
import { getTHORNameCost } from "../others";
|
|
6
6
|
|
|
7
7
|
describe("getTHORNameCost", () => {
|
|
8
8
|
describe("for correct values", () => {
|
package/src/helpers/asset.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AssetValue } from "../modules/assetValue
|
|
2
|
-
import { RequestClient } from "../modules/requestClient
|
|
3
|
-
import { BaseDecimal, Chain, ChainToRPC, type EVMChain, EVMChains } from "../types/chains
|
|
4
|
-
import type { RadixCoreStateResourceDTO } from "../types/radix
|
|
5
|
-
import type { TokenNames } from "../types/tokens
|
|
1
|
+
import { AssetValue } from "../modules/assetValue";
|
|
2
|
+
import { RequestClient } from "../modules/requestClient";
|
|
3
|
+
import { BaseDecimal, Chain, ChainToRPC, type EVMChain, EVMChains } from "../types/chains";
|
|
4
|
+
import type { RadixCoreStateResourceDTO } from "../types/radix";
|
|
5
|
+
import type { TokenNames } from "../types/tokens";
|
|
6
6
|
|
|
7
7
|
const getDecimalMethodHex = "0x313ce567";
|
|
8
8
|
|
package/src/helpers/liquidity.ts
CHANGED
package/src/helpers/memo.ts
CHANGED
|
@@ -166,7 +166,7 @@ type WithdrawParams = {
|
|
|
166
166
|
/**
|
|
167
167
|
* @deprecated - Use separate functions per each memo type like getMemoForDeposit, getMemoForWithdraw, etc.
|
|
168
168
|
*/
|
|
169
|
-
export const getMemoFor = <T extends MemoType>(memoType: T, options:
|
|
169
|
+
export const getMemoFor = <T extends MemoType>(memoType: T, options: any) => {
|
|
170
170
|
switch (memoType) {
|
|
171
171
|
case MemoType.LEAVE:
|
|
172
172
|
case MemoType.BOND: {
|
|
@@ -26,7 +26,7 @@ declare const window: {
|
|
|
26
26
|
ethereum: EthereumWindowProvider;
|
|
27
27
|
trustwallet: EthereumWindowProvider;
|
|
28
28
|
coinbaseWalletExtension: EthereumWindowProvider;
|
|
29
|
-
braveSolana:
|
|
29
|
+
braveSolana: any;
|
|
30
30
|
} & Window;
|
|
31
31
|
|
|
32
32
|
type NetworkParams = {
|
|
@@ -43,7 +43,7 @@ type NetworkParams = {
|
|
|
43
43
|
|
|
44
44
|
type ProviderRequestParams = {
|
|
45
45
|
provider?: BrowserProvider;
|
|
46
|
-
params?:
|
|
46
|
+
params?: any;
|
|
47
47
|
method:
|
|
48
48
|
| "wallet_addEthereumChain"
|
|
49
49
|
| "wallet_switchEthereumChain"
|
|
@@ -69,12 +69,12 @@ const methodsToWrap = [
|
|
|
69
69
|
"createContractTxObject",
|
|
70
70
|
];
|
|
71
71
|
|
|
72
|
-
export const wrapMethodWithNetworkSwitch = <T extends (...args:
|
|
72
|
+
export const wrapMethodWithNetworkSwitch = <T extends (...args: any[]) => any>(
|
|
73
73
|
func: T,
|
|
74
74
|
provider: BrowserProvider,
|
|
75
75
|
chainId: ChainId,
|
|
76
76
|
) =>
|
|
77
|
-
(async (...args:
|
|
77
|
+
(async (...args: any[]) => {
|
|
78
78
|
try {
|
|
79
79
|
await switchEVMWalletNetwork(provider, chainId);
|
|
80
80
|
} catch (error) {
|
|
@@ -95,7 +95,7 @@ const providerRequest = ({ provider, params, method }: ProviderRequestParams) =>
|
|
|
95
95
|
return provider.send(method, providerParams);
|
|
96
96
|
};
|
|
97
97
|
|
|
98
|
-
export const prepareNetworkSwitch = <T extends { [key: string]: (...args:
|
|
98
|
+
export const prepareNetworkSwitch = <T extends { [key: string]: (...args: any[]) => any }>({
|
|
99
99
|
toolbox,
|
|
100
100
|
chainId,
|
|
101
101
|
provider = window.ethereum,
|
package/src/index.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
export * from "@swapkit/contracts";
|
|
2
|
-
export * from "./types/index
|
|
2
|
+
export * from "./types/index";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Helpers
|
|
6
6
|
*/
|
|
7
|
-
export * from "./helpers/asset
|
|
8
|
-
export * from "./helpers/derivationPath
|
|
9
|
-
export * from "./helpers/liquidity
|
|
10
|
-
export * from "./helpers/memo
|
|
11
|
-
export * from "./helpers/others
|
|
12
|
-
export * from "./helpers/validators
|
|
13
|
-
export * from "./helpers/web3wallets
|
|
7
|
+
export * from "./helpers/asset";
|
|
8
|
+
export * from "./helpers/derivationPath";
|
|
9
|
+
export * from "./helpers/liquidity";
|
|
10
|
+
export * from "./helpers/memo";
|
|
11
|
+
export * from "./helpers/others";
|
|
12
|
+
export * from "./helpers/validators";
|
|
13
|
+
export * from "./helpers/web3wallets";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Modules
|
|
17
17
|
*/
|
|
18
|
-
export * from "./modules/assetValue
|
|
19
|
-
export * from "./modules/bigIntArithmetics
|
|
20
|
-
export * from "./modules/requestClient
|
|
21
|
-
export * from "./modules/swapKitError
|
|
22
|
-
export * from "./modules/swapKitNumber
|
|
18
|
+
export * from "./modules/assetValue";
|
|
19
|
+
export * from "./modules/bigIntArithmetics";
|
|
20
|
+
export * from "./modules/requestClient";
|
|
21
|
+
export * from "./modules/swapKitError";
|
|
22
|
+
export * from "./modules/swapKitNumber";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
|
|
3
|
-
import { BaseDecimal, Chain } from "../../types/chains
|
|
4
|
-
import { AssetValue, getMinAmountByChain } from "../assetValue
|
|
3
|
+
import { BaseDecimal, Chain } from "../../types/chains";
|
|
4
|
+
import { AssetValue, getMinAmountByChain } from "../assetValue";
|
|
5
5
|
|
|
6
6
|
describe("AssetValue", () => {
|
|
7
7
|
describe("assetValue", () => {
|
|
@@ -76,6 +76,15 @@ describe("AssetValue", () => {
|
|
|
76
76
|
expect(ethMayaSynth.toString({ includeSynthProtocol: true })).toBe("MAYA.ETH/ETH");
|
|
77
77
|
expect(ethMayaSynth.getBaseValue("string")).toBe("1000000000");
|
|
78
78
|
|
|
79
|
+
const ethTCSynthFallback = AssetValue.from({
|
|
80
|
+
asset: "ETH/ETH",
|
|
81
|
+
value: 10,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
expect(ethTCSynthFallback.toString()).toBe("ETH/ETH");
|
|
85
|
+
expect(ethTCSynthFallback.toString({ includeSynthProtocol: true })).toBe("THOR.ETH/ETH");
|
|
86
|
+
expect(ethTCSynthFallback.getBaseValue("string")).toBe("1000000000");
|
|
87
|
+
|
|
79
88
|
// TODO:
|
|
80
89
|
// const radixXWBTC = new AssetValue({
|
|
81
90
|
// identifier:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
|
|
3
|
-
import { formatBigIntToSafeValue } from "../bigIntArithmetics
|
|
3
|
+
import { formatBigIntToSafeValue } from "../bigIntArithmetics";
|
|
4
4
|
|
|
5
5
|
describe("BigIntArithmatics", () => {
|
|
6
6
|
describe("formatBigIntToSafeValue", () => {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { red, yellow } from "picocolors";
|
|
2
1
|
import {
|
|
3
2
|
type CommonAssetString,
|
|
4
3
|
CommonAssetStrings,
|
|
@@ -6,16 +5,16 @@ import {
|
|
|
6
5
|
getCommonAssetInfo,
|
|
7
6
|
getDecimal,
|
|
8
7
|
isGasAsset,
|
|
9
|
-
} from "../helpers/asset
|
|
10
|
-
import { warnOnce } from "../helpers/others
|
|
11
|
-
import { validateIdentifier } from "../helpers/validators
|
|
12
|
-
import { BaseDecimal, Chain, type ChainId, ChainToChainId } from "../types/chains
|
|
13
|
-
import type { TokenNames, TokenTax } from "../types/tokens
|
|
8
|
+
} from "../helpers/asset";
|
|
9
|
+
import { warnOnce } from "../helpers/others";
|
|
10
|
+
import { validateIdentifier } from "../helpers/validators";
|
|
11
|
+
import { BaseDecimal, Chain, type ChainId, ChainToChainId } from "../types/chains";
|
|
12
|
+
import type { TokenNames, TokenTax } from "../types/tokens";
|
|
14
13
|
|
|
15
|
-
import type { NumberPrimitives } from "./bigIntArithmetics
|
|
16
|
-
import { BigIntArithmetics, formatBigIntToSafeValue } from "./bigIntArithmetics
|
|
17
|
-
import { SwapKitError } from "./swapKitError
|
|
18
|
-
import type { SwapKitValueType } from "./swapKitNumber
|
|
14
|
+
import type { NumberPrimitives } from "./bigIntArithmetics";
|
|
15
|
+
import { BigIntArithmetics, formatBigIntToSafeValue } from "./bigIntArithmetics";
|
|
16
|
+
import { SwapKitError } from "./swapKitError";
|
|
17
|
+
import type { SwapKitValueType } from "./swapKitNumber";
|
|
19
18
|
|
|
20
19
|
const staticTokensMap = new Map<
|
|
21
20
|
TokenNames,
|
|
@@ -131,12 +130,10 @@ export class AssetValue extends BigIntArithmetics {
|
|
|
131
130
|
|
|
132
131
|
warnOnce(
|
|
133
132
|
!(asyncTokenLookup || tokenDecimal),
|
|
134
|
-
|
|
135
|
-
`Couldn't find static decimal for ${red(unsafeIdentifier)} (Using default ${red(BaseDecimal[chain])} decimal as fallback).
|
|
133
|
+
`Couldn't find static decimal for ${unsafeIdentifier} (Using default ${BaseDecimal[chain]} decimal as fallback).
|
|
136
134
|
This can result in incorrect calculations and mess with amount sent on transactions.
|
|
137
135
|
You can load static assets by installing @swapkit/tokens package and calling AssetValue.loadStaticAssets()
|
|
138
136
|
or by passing asyncTokenLookup: true to the from() function, which will make it async and return a promise.`,
|
|
139
|
-
),
|
|
140
137
|
);
|
|
141
138
|
|
|
142
139
|
const { decimal, identifier, tax } = token || {
|
|
@@ -158,7 +155,7 @@ or by passing asyncTokenLookup: true to the from() function, which will make it
|
|
|
158
155
|
}
|
|
159
156
|
|
|
160
157
|
static loadStaticAssets() {
|
|
161
|
-
return new Promise<{ ok: true } | { ok: false; message: string; error:
|
|
158
|
+
return new Promise<{ ok: true } | { ok: false; message: string; error: any }>(
|
|
162
159
|
(resolve, reject) => {
|
|
163
160
|
try {
|
|
164
161
|
import("@swapkit/tokens").then((tokenPackages) => {
|
|
@@ -289,7 +286,9 @@ async function createAssetValue(identifier: string, value: NumberPrimitives = 0)
|
|
|
289
286
|
}
|
|
290
287
|
|
|
291
288
|
function createSyntheticAssetValue(identifier: string, value: NumberPrimitives = 0) {
|
|
292
|
-
const chain = identifier.
|
|
289
|
+
const chain = identifier.includes(".")
|
|
290
|
+
? (identifier.split(".")?.[0]?.toUpperCase() as Chain)
|
|
291
|
+
: undefined;
|
|
293
292
|
const isMayaOrThor = chain ? [Chain.Maya, Chain.THORChain].includes(chain) : false;
|
|
294
293
|
|
|
295
294
|
const [synthChain, symbol] = isMayaOrThor
|
|
@@ -2,8 +2,8 @@ type Options = Parameters<typeof fetch>[1] & {
|
|
|
2
2
|
headers?: Record<string, string>;
|
|
3
3
|
apiKey?: string;
|
|
4
4
|
method?: "GET" | "POST";
|
|
5
|
-
onError?: (error:
|
|
6
|
-
responseHandler?: (response:
|
|
5
|
+
onError?: (error: any) => any;
|
|
6
|
+
responseHandler?: (response: any) => any;
|
|
7
7
|
searchParams?: Record<string, string>;
|
|
8
8
|
json?: unknown;
|
|
9
9
|
};
|
|
@@ -86,6 +86,8 @@ const errorCodes = {
|
|
|
86
86
|
wallet_talisman_not_enabled: 20601,
|
|
87
87
|
wallet_talisman_not_found: 20602,
|
|
88
88
|
wallet_polkadot_not_found: 20701,
|
|
89
|
+
wallet_radix_not_found: 20801,
|
|
90
|
+
wallet_radix_transaction_failed: 20802,
|
|
89
91
|
/**
|
|
90
92
|
* Chainflip
|
|
91
93
|
*/
|
|
@@ -130,6 +132,7 @@ const errorCodes = {
|
|
|
130
132
|
toolbox_evm_provider_not_eip1193_compatible: 90210,
|
|
131
133
|
toolbox_evm_error_estimating_gas_limit: 90211,
|
|
132
134
|
toolbox_evm_error_sending_transaction: 90212,
|
|
135
|
+
toolbox_radix_signer_not_defined: 90301,
|
|
133
136
|
/**
|
|
134
137
|
* Helpers
|
|
135
138
|
*/
|
|
@@ -153,8 +156,8 @@ export class SwapKitError extends Error {
|
|
|
153
156
|
static ErrorCode = errorCodes;
|
|
154
157
|
|
|
155
158
|
constructor(
|
|
156
|
-
errorOrErrorKey: ErrorKeys | { errorKey: ErrorKeys; info?: Record<string,
|
|
157
|
-
sourceError?:
|
|
159
|
+
errorOrErrorKey: ErrorKeys | { errorKey: ErrorKeys; info?: Record<string, any> },
|
|
160
|
+
sourceError?: any,
|
|
158
161
|
) {
|
|
159
162
|
const isErrorString = typeof errorOrErrorKey === "string";
|
|
160
163
|
|
package/src/types/chains.ts
CHANGED
package/src/types/commonTypes.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Chain } from "./chains
|
|
2
|
-
import type { ChainApis } from "./sdk
|
|
3
|
-
import type { ChainWallet } from "./wallet
|
|
1
|
+
import type { Chain } from "./chains";
|
|
2
|
+
import type { ChainApis } from "./sdk";
|
|
3
|
+
import type { ChainWallet } from "./wallet";
|
|
4
4
|
|
|
5
5
|
export type ConnectConfig = {
|
|
6
6
|
stagenet?: boolean;
|
|
@@ -47,9 +47,17 @@ export type ConnectConfig = {
|
|
|
47
47
|
* @optional for setting the chainflip broker url
|
|
48
48
|
*/
|
|
49
49
|
chainflipBrokerUrl?: string;
|
|
50
|
+
/**
|
|
51
|
+
* @optional for setting the chainflip radix dapp config
|
|
52
|
+
*/
|
|
53
|
+
radixDappConfig?: {
|
|
54
|
+
dAppDefinitionAddress: string;
|
|
55
|
+
applicationName: string;
|
|
56
|
+
applicationVersion: string;
|
|
57
|
+
};
|
|
50
58
|
};
|
|
51
59
|
|
|
52
|
-
export type ConnectWalletParams<M = { [key in string]:
|
|
60
|
+
export type ConnectWalletParams<M = { [key in string]: any }> = {
|
|
53
61
|
addChain: <T extends Chain>(params: ChainWallet<T> & M) => void;
|
|
54
62
|
apis: ChainApis;
|
|
55
63
|
config: ConnectConfig;
|
package/src/types/network.ts
CHANGED
|
@@ -20,7 +20,7 @@ export enum RPCUrl {
|
|
|
20
20
|
Radix = "https://radix-mainnet.rpc.grove.city/v1/326002fc/core",
|
|
21
21
|
THORChain = "https://rpc.thorswap.net",
|
|
22
22
|
THORChainStagenet = "https://stagenet-rpc.ninerealms.com",
|
|
23
|
-
Solana = "https://mainnet.helius-rpc.com
|
|
23
|
+
Solana = "https://mainnet.helius-rpc.com",
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export enum ExplorerUrl {
|
package/src/types/radix.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type RadixCoreStateResourceDTO = {
|
|
2
|
-
at_ledger_state?:
|
|
2
|
+
at_ledger_state?: any; // not needed
|
|
3
3
|
manager: {
|
|
4
4
|
resource_type: string;
|
|
5
5
|
divisibility: {
|
|
@@ -10,5 +10,5 @@ export type RadixCoreStateResourceDTO = {
|
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
owner_role?:
|
|
13
|
+
owner_role?: any; // not needed
|
|
14
14
|
};
|
package/src/types/tokens.ts
CHANGED
|
@@ -6,7 +6,6 @@ import type {
|
|
|
6
6
|
PangolinList,
|
|
7
7
|
SushiswapList,
|
|
8
8
|
ThorchainList,
|
|
9
|
-
TraderjoeV1List,
|
|
10
9
|
TraderjoeV2List,
|
|
11
10
|
UniswapV2List,
|
|
12
11
|
UniswapV3List,
|
|
@@ -22,7 +21,6 @@ export type TokenNames =
|
|
|
22
21
|
| (typeof PangolinList)["tokens"][number]["identifier"]
|
|
23
22
|
| (typeof SushiswapList)["tokens"][number]["identifier"]
|
|
24
23
|
| (typeof ThorchainList)["tokens"][number]["identifier"]
|
|
25
|
-
| (typeof TraderjoeV1List)["tokens"][number]["identifier"]
|
|
26
24
|
| (typeof TraderjoeV2List)["tokens"][number]["identifier"]
|
|
27
25
|
| (typeof UniswapV2List)["tokens"][number]["identifier"]
|
|
28
26
|
| (typeof UniswapV3List)["tokens"][number]["identifier"];
|
package/src/types/wallet.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CosmosWallets, ThorchainWallets } from "@swapkit/toolbox-cosmos";
|
|
2
2
|
import type { EVMWallets } from "@swapkit/toolbox-evm";
|
|
3
|
-
import type {
|
|
3
|
+
import type { RadixWallets } from "@swapkit/toolbox-radix";
|
|
4
|
+
import type { SolanaWallets } from "@swapkit/toolbox-solana";
|
|
4
5
|
import type { SubstrateWallets } from "@swapkit/toolbox-substrate";
|
|
5
6
|
import type { UTXOWallets } from "@swapkit/toolbox-utxo";
|
|
6
7
|
import type { Eip1193Provider } from "ethers";
|
|
@@ -62,7 +63,13 @@ export type BaseWallet<T extends EmptyWallet | Record<string, unknown>> = {
|
|
|
62
63
|
};
|
|
63
64
|
|
|
64
65
|
export type FullWallet = BaseWallet<
|
|
65
|
-
EVMWallets &
|
|
66
|
+
EVMWallets &
|
|
67
|
+
UTXOWallets &
|
|
68
|
+
CosmosWallets &
|
|
69
|
+
ThorchainWallets &
|
|
70
|
+
SubstrateWallets &
|
|
71
|
+
SolanaWallets &
|
|
72
|
+
RadixWallets
|
|
66
73
|
>;
|
|
67
74
|
|
|
68
75
|
/**
|
|
@@ -70,7 +77,7 @@ export type FullWallet = BaseWallet<
|
|
|
70
77
|
*/
|
|
71
78
|
export type Wallet = FullWallet;
|
|
72
79
|
|
|
73
|
-
export type SwapKitWallet<ConnectParams extends
|
|
80
|
+
export type SwapKitWallet<ConnectParams extends any[]> = (
|
|
74
81
|
params: ConnectWalletParams,
|
|
75
82
|
) => (...connectParams: ConnectParams) => boolean | Promise<boolean>;
|
|
76
83
|
|