@swapkit/helpers
Advanced tools
Comparing version 1.0.0-rc.88 to 1.0.0-rc.89
@@ -8,7 +8,8 @@ { | ||
"devDependencies": { | ||
"@swapkit/tokens": "1.0.0-rc.48", | ||
"bun-types": "1.1.2" | ||
"@swapkit/tokens": "1.0.0-rc.49", | ||
"bun-types": "1.1.2", | ||
"ethers": "6.11.1" | ||
}, | ||
"peerDependencies": { | ||
"@swapkit/tokens": "1.0.0-rc.48", | ||
"@swapkit/tokens": "1.0.0-rc.49", | ||
"ky": "1.2.3" | ||
@@ -39,3 +40,3 @@ }, | ||
"types": "./src/index.ts", | ||
"version": "1.0.0-rc.88" | ||
"version": "1.0.0-rc.89" | ||
} |
@@ -11,2 +11,3 @@ export * from "./types/index.ts"; | ||
export * from "./helpers/validators.ts"; | ||
export * from "./helpers/web3wallets.ts"; | ||
@@ -13,0 +14,0 @@ /** |
@@ -274,4 +274,7 @@ import type { CommonAssetString } from "../helpers/asset.ts"; | ||
const isThorchain = identifier.split(".")?.[0]?.toUpperCase() === Chain.THORChain; | ||
const isMaya = identifier.split(".")?.[0]?.toUpperCase() === Chain.Maya; | ||
const [synthChain, synthSymbol = ""] = | ||
identifier.split(".")?.[0]?.toUpperCase() === Chain.THORChain | ||
isThorchain || isMaya | ||
? identifier.split(".").slice(1).join().split("/") | ||
@@ -283,3 +286,5 @@ : identifier.split("/"); | ||
const adjustedIdentifier = | ||
identifier.includes(".") && !isSynthetic ? identifier : `${Chain.THORChain}.${synthSymbol}`; | ||
identifier.includes(".") && !isSynthetic | ||
? identifier | ||
: `${isMaya ? Chain.Maya : Chain.THORChain}.${synthSymbol}`; | ||
@@ -286,0 +291,0 @@ const [chain, ...rest] = adjustedIdentifier.split(".") as [Chain, string]; |
@@ -11,3 +11,5 @@ const errorMessages = { | ||
core_plugin_not_found: 10006, | ||
core_plugin_swap_not_found: 10007, | ||
core_chain_halted: 10099, | ||
/** | ||
@@ -14,0 +16,0 @@ * Core - Wallet Connection |
import type { Chain, CosmosChain, EVMChain, UTXOChain } from "./chains.ts"; | ||
import type { WalletOption } from "./wallet.ts"; | ||
type ConnectMethodNames = | ||
| "connectEVMWallet" | ||
| "connectKeplr" | ||
| "connectKeystore" | ||
| "connectKeepkey" | ||
| "connectLedger" | ||
| "connectOkx" | ||
| "connectTrezor" | ||
| "connectWalletconnect" | ||
| "connectXDEFI"; | ||
export type ConnectConfig = { | ||
@@ -84,13 +73,2 @@ stagenet?: boolean; | ||
export type ExtendParams<WalletConnectMethodNames = ""> = { | ||
excludedChains?: Chain[]; | ||
config?: ConnectConfig; | ||
rpcUrls?: { [chain in Chain]?: string }; | ||
apis?: ApisType; | ||
wallets: { | ||
connectMethodName: ConnectMethodNames | WalletConnectMethodNames; | ||
connect: (params: ConnectWalletParams) => (...params: Todo) => Promise<Todo>; | ||
}[]; | ||
}; | ||
export enum QuoteMode { | ||
@@ -97,0 +75,0 @@ TC_SUPPORTED_TO_TC_SUPPORTED = "TC-TC", |
import type { AssetValue } from "../modules/assetValue"; | ||
export type PluginName = "thorchain" | "chainflip" | "mayachain"; | ||
export type ProviderMethods = { | ||
swap: (swapParams: SwapParams) => Promise<string>; | ||
[key: string]: Todo; | ||
}; | ||
export type SwapKitPlugins = { | ||
[K in PluginName]?: ProviderMethods; | ||
}; | ||
type GenericSwapParams = { | ||
export type GenericSwapParams = { | ||
buyAsset: AssetValue; | ||
@@ -20,14 +9,4 @@ sellAsset: AssetValue; | ||
export type SwapParams<T = GenericSwapParams> = T & { | ||
provider?: { | ||
name: PluginName; | ||
config: Record<string, Todo>; | ||
}; | ||
export type SwapParams<PluginNames = string, T = GenericSwapParams> = T & { | ||
pluginName: PluginNames; | ||
}; | ||
export type AvailableProviders<T> = T | { [K in PluginName]?: ProviderMethods }; | ||
export type SwapKitPlugin = <T>({ wallets, stagenet }: { wallets: T; stagenet?: boolean }) => { | ||
name: PluginName; | ||
methods: ProviderMethods; | ||
}; |
@@ -10,2 +10,3 @@ import type { AssetValue } from "../modules/assetValue"; | ||
COINBASE_WEB = "COINBASE_WEB", | ||
COINBASE_MOBILE = "COINBASE_MOBILE", | ||
TREZOR = "TREZOR", | ||
@@ -12,0 +13,0 @@ TRUSTWALLET_WEB = "TRUSTWALLET_WEB", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
347261
33
5797
3