@swapkit/helpers
Advanced tools
Comparing version 1.0.0-rc.99 to 1.0.0-rc.100
@@ -39,3 +39,3 @@ { | ||
"types": "./src/index.ts", | ||
"version": "1.0.0-rc.99" | ||
"version": "1.0.0-rc.100" | ||
} |
@@ -10,4 +10,5 @@ import { | ||
type Params = { | ||
chain: Chain; | ||
index: number; | ||
chain: Chain; | ||
addressIndex?: number; | ||
type?: "legacy" | "ledgerLive" | "nativeSegwitMiddleAccount" | "segwit"; | ||
@@ -21,6 +22,6 @@ }; | ||
export function getDerivationPathFor({ chain, index, type }: Params) { | ||
export function getDerivationPathFor({ chain, index, addressIndex = 0, type }: Params) { | ||
if (EVMChains.includes(chain as EVMChain)) { | ||
if (type === "legacy") return [44, 60, 0, index]; | ||
if (type === "ledgerLive") return [44, 60, index, 0, 0]; | ||
if (type === "ledgerLive") return [44, 60, index, 0, addressIndex]; | ||
return updatedLastIndex(NetworkDerivationPath[chain], index); | ||
@@ -32,3 +33,3 @@ } | ||
if (type === "nativeSegwitMiddleAccount") return [84, chainId, index, 0, 0]; | ||
if (type === "nativeSegwitMiddleAccount") return [84, chainId, index, 0, addressIndex]; | ||
if (type === "segwit") return [49, chainId, 0, 0, index]; | ||
@@ -35,0 +36,0 @@ if (type === "legacy") return [44, chainId, 0, 0, index]; |
@@ -1,2 +0,2 @@ | ||
import type { Options } from "ky"; | ||
import type { KyInstance, Options } from "ky"; | ||
import ky from "ky"; | ||
@@ -24,7 +24,17 @@ | ||
const getTypedBaseRequestClient = (kyClient: KyInstance) => ({ | ||
get: <T>(url: string | URL | Request, options?: Options) => kyClient.get(url, options).json<T>(), | ||
post: <T>(url: string | URL | Request, options?: Options) => | ||
kyClient.post(url, options).json<T>(), | ||
}); | ||
export const RequestClient = { | ||
get: <T>(url: string | URL | Request, options?: Options) => | ||
getKyClient().get(url, options).json<T>(), | ||
post: <T>(url: string | URL | Request, options?: Options) => | ||
getKyClient().post(url, options).json<T>(), | ||
...getTypedBaseRequestClient(getKyClient()), | ||
extend: (options: Options) => { | ||
const extendedClient = getKyClient().extend(options); | ||
return { | ||
...getTypedBaseRequestClient(extendedClient), | ||
extend: RequestClient.extend, | ||
}; | ||
}, | ||
}; |
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
405479
35
6649