@swapkit/core 4.6.8 → 5.0.1
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/CHANGELOG.md +16 -19
- package/dist/types/index.d.ts +39 -39
- package/package.json +6 -8
- package/dist/index.cjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
# @swapkit/core
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 5.0.1
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- [`
|
|
7
|
+
- [#363](https://github.com/swapkit/sdk/pull/363) [`7b9f214`](https://github.com/swapkit/sdk/commit/7b9f2145e8644975620db1f2b39775c33cb40d20) Thanks [@towanTG](https://github.com/towanTG)! - HyperCore balances are now API-first: `getBalance` queries the SwapKit (via @swapkit/toolboxes@5.1.0)
|
|
8
|
+
- [#366](https://github.com/swapkit/sdk/pull/366) [`c64be1d`](https://github.com/swapkit/sdk/commit/c64be1d700ef8855495ca9d7ef0ebe18f46687ee) Thanks [@towanTG](https://github.com/towanTG)! - HyperCore chain-query balances take decimals from Hyperliquid spotMeta (via @swapkit/toolboxes@5.1.0)
|
|
9
|
+
- Update generated token lists. (via @swapkit/toolboxes@5.1.0)
|
|
10
|
+
- [#363](https://github.com/swapkit/sdk/pull/363) [`7b9f214`](https://github.com/swapkit/sdk/commit/7b9f2145e8644975620db1f2b39775c33cb40d20) Thanks [@towanTG](https://github.com/towanTG)! - Correct the Hyperliquid chain display names: `Chain.Hyperevm`'s config is now (via @swapkit/toolboxes@5.1.0)
|
|
8
11
|
|
|
9
|
-
##
|
|
12
|
+
## 5.0.0
|
|
10
13
|
|
|
11
|
-
###
|
|
12
|
-
|
|
13
|
-
- [`c357b3b`](https://github.com/swapkit/sdk/commit/c357b3bc1a384d9ebdf1b4da2f4b94542636538e) Thanks [@towanTG](https://github.com/towanTG)! - Hypercore balances take their decimals from Hyperliquid's `weiDecimals` instead of a hardcoded ticker table. USDC is 8 decimals on Hypercore (it is 6 only on EVM chains), so the old `{ USDC: 6 }` fallback truncated spot balances; the table now applies only when spot metadata is unavailable. (via @swapkit/toolboxes@4.28.3)
|
|
14
|
-
- [#358](https://github.com/swapkit/sdk/pull/358) [`6734cab`](https://github.com/swapkit/sdk/commit/6734cab233f17b6e5372519fe43e029477117827) Thanks [@github-actions](https://github.com/apps/github-actions)! - Correct flashnet's Hypercore assets in the dev list. The api collapses flashnet's two Hyperliquid chains and emitted Hypercore USDC carrying HyperEVM USDC's contract address (`HYPE.USDC-0xb88339CB…`) — an EVM address is not a valid Hypercore asset id, so `spotSend` built from it was rejected. Hypercore entries are now generated in Hyperliquid `NAME:tokenId` form, matching what the hypercore toolbox builds at runtime: `HYPE.USDC-USDC:0x6d1e7cde…` and `HYPE.USDE-USDE:0x2e6d84f2…`, both 8 decimals (`weiDecimals`). `HYPEREVM.*` assets are untouched. (via @swapkit/toolboxes@4.28.3)
|
|
15
|
-
|
|
16
|
-
## 4.6.6
|
|
17
|
-
|
|
18
|
-
### Patch Changes
|
|
19
|
-
|
|
20
|
-
- [`bca217f`](https://github.com/swapkit/sdk/commit/bca217f89314ac520eae2d5eeeee027f125c4262) Thanks [@towanTG](https://github.com/towanTG)! - Refresh generated token lists and restore faithful provider mirroring. The `HYPE.*` filter added in 4.5.0 is removed: `HYPE.USDC-0xb88339CB…` is the identifier the api actually routes on (it is the only HYPE-family buy asset `/swapTo` returns on prod), so dropping it removed the static entry for a routable token. Dev flashnet now carries `HYPE.USDC` alongside its `HYPEREVM.*` assets, exactly as the provider serves them. (via @swapkit/helpers@4.20.3)
|
|
21
|
-
|
|
22
|
-
## 4.6.5
|
|
23
|
-
|
|
24
|
-
### Patch Changes
|
|
14
|
+
### Major Changes
|
|
25
15
|
|
|
26
|
-
- [`
|
|
27
|
-
- [`
|
|
16
|
+
- [#344](https://github.com/swapkit/sdk/pull/344) [`7f99d74`](https://github.com/swapkit/sdk/commit/7f99d74ec21d58d07b2cccc5b111f8fdae6c7afb) Thanks [@ice-chillios](https://github.com/ice-chillios)! - **ESM-only packages.** CommonJS output (`.cjs`) and `require` export conditions have been removed; every package now ships ESM only (code-splitting stays enabled), with a uniform `{ default, types }` exports shape. `buildPackage` from `@swapkit/tools-builder` no longer emits CJS and the unused `esmOnly` option has been removed.
|
|
17
|
+
- [#249](https://github.com/swapkit/sdk/pull/249) [`41505dc`](https://github.com/swapkit/sdk/commit/41505dc0f4f77dd301cfced063013efb6307b9bb) Thanks [@ice-chillios](https://github.com/ice-chillios)! - Replace `@cosmjs/{amino,crypto,proto-signing,stargate}@0.39.0` with native `@swapkit/cosmos-signer` package. The new signer is ESM-native (no CJS↔ESM-only-noble breakage), uses only `@noble/curves`, `@noble/hashes`, `@scure/{base,bip32,bip39}` + `cosmjs-types` for proto encoders. **No `@cosmjs/*` runtime dependency.** (via @swapkit/toolboxes@5.0.0)
|
|
18
|
+
- [#298](https://github.com/swapkit/sdk/pull/298) [`3017621`](https://github.com/swapkit/sdk/commit/3017621ee5c2da15550036853df74d81f59d6ffb) Thanks [@ice-chillios](https://github.com/ice-chillios)! - Speed up `createTransaction` across toolboxes by removing serial and redundant network round-trips from the build path. Two techniques, both backward-compatible: (via @swapkit/toolboxes@5.0.0)
|
|
19
|
+
- [#360](https://github.com/swapkit/sdk/pull/360) [`d6061d5`](https://github.com/swapkit/sdk/commit/d6061d58367cdf077acf60421a1e8b448363f486) Thanks [@ice-chillios](https://github.com/ice-chillios)! - Add HyperCore `sendAsset` payin support. (via @swapkit/toolboxes@5.0.0)
|
|
20
|
+
- [#295](https://github.com/swapkit/sdk/pull/295) [`fd1d5d7`](https://github.com/swapkit/sdk/commit/fd1d5d7304eda3ff20c53b14d0eb5998fb6b8250) Thanks [@ice-chillios](https://github.com/ice-chillios)! - Remove `ethers` and `@near-js/providers` from `@swapkit/helpers`. EVM address checksum/validation now uses an in-house EIP-55 implementation backed by `@noble/hashes`, ERC-20 symbol decoding reuses the existing dynamic-string ABI decoder, and NEAR token metadata is fetched via JSON-RPC through `RequestClient`. Public behaviour is preserved (ethers-parity semantics, including throw-on-bad-checksum). (via @swapkit/toolboxes@5.0.0)
|
|
21
|
+
- [#295](https://github.com/swapkit/sdk/pull/295) [`fd1d5d7`](https://github.com/swapkit/sdk/commit/fd1d5d7304eda3ff20c53b14d0eb5998fb6b8250) Thanks [@ice-chillios](https://github.com/ice-chillios)! - Consolidate scattered helper utility modules (explorer URLs, validators, widget auth, TNS cost helpers) into grouped homes. Pure internal relocation — the public export surface is unchanged. (via @swapkit/toolboxes@5.0.0)
|
|
22
|
+
- [#353](https://github.com/swapkit/sdk/pull/353) [`2d00760`](https://github.com/swapkit/sdk/commit/2d0076010f56b843295fa814922b46385d3fc52b) Thanks [@towanTG](https://github.com/towanTG)! - Update generated token lists (prod and dev). Remove the hand-maintained hypercore token list and its `hype`/`hypercore` list names — the api serves no HYPE provider, so the documented exception from 4.4.0 is retired and static lists are again 100% provider-generated. (via @swapkit/toolboxes@5.0.0)
|
|
23
|
+
- Update generated token lists. (via @swapkit/toolboxes@5.0.0)
|
|
24
|
+
- [#354](https://github.com/swapkit/sdk/pull/354) [`8d21eef`](https://github.com/swapkit/sdk/commit/8d21eefe8a5379347a6a9b92978b0336e1a155a4) Thanks [@towanTG](https://github.com/towanTG)! - Refresh generated token lists (prod and dev) — dev flashnet now carries the HyperEVM assets (`HYPEREVM.HYPE`, `USDC`, `USDe`, `USDT0`) alongside `HYPE.USDC`. Lists mirror provider output verbatim; no identifiers are filtered. (via @swapkit/toolboxes@5.0.0)
|
|
28
25
|
|
|
29
26
|
## 4.6.4
|
|
30
27
|
|
package/dist/types/index.d.ts
CHANGED
|
@@ -260,15 +260,15 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
260
260
|
};
|
|
261
261
|
APT: ChainWallet<Chain.Aptos> & {
|
|
262
262
|
broadcastTransaction: ({ senderAuthenticator, transaction, }: {
|
|
263
|
-
senderAuthenticator: Awaited<ReturnType<(transaction: Awaited<ReturnType<({ recipient, assetValue, maxGasAmount, sender: _senderAddress, sweep, }: import("@swapkit/toolboxes/aptos/types").AptosCreateTransactionParams) => Promise<import("@aptos-labs/ts-sdk").SimpleTransaction>>>) => Promise<import("@aptos-labs/ts-sdk").AccountAuthenticator>>>;
|
|
264
|
-
transaction: Awaited<ReturnType<({ recipient, assetValue, maxGasAmount, sender: _senderAddress, sweep, }: import("@swapkit/toolboxes/aptos/types").AptosCreateTransactionParams) => Promise<import("@aptos-labs/ts-sdk").SimpleTransaction>>>;
|
|
263
|
+
senderAuthenticator: Awaited<ReturnType<(transaction: Awaited<ReturnType<({ recipient, assetValue, maxGasAmount, sender: _senderAddress, accountSequenceNumber, gasUnitPrice, sweep, }: import("@swapkit/toolboxes/aptos/types").AptosCreateTransactionParams) => Promise<import("@aptos-labs/ts-sdk").SimpleTransaction>>>) => Promise<import("@aptos-labs/ts-sdk").AccountAuthenticator>>>;
|
|
264
|
+
transaction: Awaited<ReturnType<({ recipient, assetValue, maxGasAmount, sender: _senderAddress, accountSequenceNumber, gasUnitPrice, sweep, }: import("@swapkit/toolboxes/aptos/types").AptosCreateTransactionParams) => Promise<import("@aptos-labs/ts-sdk").SimpleTransaction>>>;
|
|
265
265
|
}) => Promise<string>;
|
|
266
|
-
createTransaction: ({ recipient, assetValue, maxGasAmount, sender: _senderAddress, sweep, }: import("@swapkit/toolboxes/aptos/types").AptosCreateTransactionParams) => Promise<import("@aptos-labs/ts-sdk").SimpleTransaction>;
|
|
266
|
+
createTransaction: ({ recipient, assetValue, maxGasAmount, sender: _senderAddress, accountSequenceNumber, gasUnitPrice, sweep, }: import("@swapkit/toolboxes/aptos/types").AptosCreateTransactionParams) => Promise<import("@aptos-labs/ts-sdk").SimpleTransaction>;
|
|
267
267
|
estimateTransactionFee: (params?: import("@swapkit/toolboxes/aptos/types").AptosCreateTransactionParams) => Promise<AssetValue>;
|
|
268
268
|
getAddress: () => Promise<"" | `0x${string}`>;
|
|
269
269
|
getBalance: (targetAddress?: string) => Promise<AssetValue[]>;
|
|
270
|
-
signAndBroadcastTransaction: (transaction: Awaited<ReturnType<({ recipient, assetValue, maxGasAmount, sender: _senderAddress, sweep, }: import("@swapkit/toolboxes/aptos/types").AptosCreateTransactionParams) => Promise<import("@aptos-labs/ts-sdk").SimpleTransaction>>>) => Promise<string>;
|
|
271
|
-
signTransaction: (transaction: Awaited<ReturnType<({ recipient, assetValue, maxGasAmount, sender: _senderAddress, sweep, }: import("@swapkit/toolboxes/aptos/types").AptosCreateTransactionParams) => Promise<import("@aptos-labs/ts-sdk").SimpleTransaction>>>) => Promise<import("@aptos-labs/ts-sdk").AccountAuthenticator>;
|
|
270
|
+
signAndBroadcastTransaction: (transaction: Awaited<ReturnType<({ recipient, assetValue, maxGasAmount, sender: _senderAddress, accountSequenceNumber, gasUnitPrice, sweep, }: import("@swapkit/toolboxes/aptos/types").AptosCreateTransactionParams) => Promise<import("@aptos-labs/ts-sdk").SimpleTransaction>>>) => Promise<string>;
|
|
271
|
+
signTransaction: (transaction: Awaited<ReturnType<({ recipient, assetValue, maxGasAmount, sender: _senderAddress, accountSequenceNumber, gasUnitPrice, sweep, }: import("@swapkit/toolboxes/aptos/types").AptosCreateTransactionParams) => Promise<import("@aptos-labs/ts-sdk").SimpleTransaction>>>) => Promise<import("@aptos-labs/ts-sdk").AccountAuthenticator>;
|
|
272
272
|
transfer: ({ assetValue, maxGasAmount, recipient, sweep }: import("@swapkit/toolboxes/aptos/types").AptosTransferParams) => Promise<string>;
|
|
273
273
|
validateAddress: typeof import("@swapkit/toolboxes/aptos/toolbox").validateAptosAddress;
|
|
274
274
|
};
|
|
@@ -2145,10 +2145,10 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
2145
2145
|
validateAddress: typeof import("@swapkit/toolboxes/evm").validateEVMAddress;
|
|
2146
2146
|
};
|
|
2147
2147
|
GAIA: ChainWallet<Chain.Cosmos> & {
|
|
2148
|
-
createPrivateKeyFromPhrase: (phrase: string) => Promise<Uint8Array<
|
|
2148
|
+
createPrivateKeyFromPhrase: (phrase: string) => Promise<Uint8Array<ArrayBuffer>>;
|
|
2149
2149
|
createTransaction: typeof import("@swapkit/toolboxes/cosmos").cosmosCreateTransaction;
|
|
2150
2150
|
fetchFeeRateFromSwapKit: typeof import("@swapkit/toolboxes/cosmos").fetchFeeRateFromSwapKit;
|
|
2151
|
-
getAccount: (address: string) => Promise<import("@
|
|
2151
|
+
getAccount: (address: string) => Promise<import("@swapkit/toolboxes/cosmos").StargateAccount | null>;
|
|
2152
2152
|
getAddress: () => Promise<string | undefined>;
|
|
2153
2153
|
getBalance: (address: string, _potentialScamFilter?: boolean) => Promise<AssetValue[]>;
|
|
2154
2154
|
getBalanceAsDenoms: (address: string) => Promise<{
|
|
@@ -2164,10 +2164,10 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
2164
2164
|
getSignerFromPhrase: ({ phrase, derivationPath }: {
|
|
2165
2165
|
phrase: string;
|
|
2166
2166
|
derivationPath: import("@swapkit/helpers").DerivationPathArray;
|
|
2167
|
-
}) => Promise<import("@
|
|
2168
|
-
getSignerFromPrivateKey: (privateKey: Uint8Array) => Promise<import("@
|
|
2167
|
+
}) => Promise<import("@swapkit/toolboxes/cosmos").OfflineDirectSigner>;
|
|
2168
|
+
getSignerFromPrivateKey: (privateKey: Uint8Array) => Promise<import("@swapkit/toolboxes/cosmos").OfflineDirectSigner>;
|
|
2169
2169
|
signAndBroadcastTransaction: (transaction: import("@swapkit/helpers").CosmosTransaction) => Promise<string>;
|
|
2170
|
-
signTransaction: (transaction: import("@swapkit/helpers").CosmosTransaction) => Promise<import("
|
|
2170
|
+
signTransaction: (transaction: import("@swapkit/helpers").CosmosTransaction) => Promise<import("@swapkit/toolboxes/cosmos").SignedTx>;
|
|
2171
2171
|
transfer: ({ recipient, assetValue, memo, feeRate, feeOptionKey, sweep, }: GenericTransferParams) => Promise<string>;
|
|
2172
2172
|
validateAddress: (address: string) => boolean;
|
|
2173
2173
|
verifySignature: ({ signature, message, address, }: {
|
|
@@ -2965,10 +2965,10 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
2965
2965
|
validateAddress: typeof import("@swapkit/toolboxes/evm").validateEVMAddress;
|
|
2966
2966
|
};
|
|
2967
2967
|
HARBOR: ChainWallet<Chain.Harbor> & {
|
|
2968
|
-
createPrivateKeyFromPhrase: (phrase: string) => Promise<Uint8Array<
|
|
2968
|
+
createPrivateKeyFromPhrase: (phrase: string) => Promise<Uint8Array<ArrayBuffer>>;
|
|
2969
2969
|
createTransaction: typeof import("@swapkit/toolboxes/cosmos").cosmosCreateTransaction;
|
|
2970
2970
|
fetchFeeRateFromSwapKit: typeof import("@swapkit/toolboxes/cosmos").fetchFeeRateFromSwapKit;
|
|
2971
|
-
getAccount: (address: string) => Promise<import("@
|
|
2971
|
+
getAccount: (address: string) => Promise<import("@swapkit/toolboxes/cosmos").StargateAccount | null>;
|
|
2972
2972
|
getAddress: () => Promise<string | undefined>;
|
|
2973
2973
|
getBalance: (address: string, _potentialScamFilter?: boolean) => Promise<AssetValue[]>;
|
|
2974
2974
|
getBalanceAsDenoms: (address: string) => Promise<{
|
|
@@ -2984,10 +2984,10 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
2984
2984
|
getSignerFromPhrase: ({ phrase, derivationPath }: {
|
|
2985
2985
|
phrase: string;
|
|
2986
2986
|
derivationPath: import("@swapkit/helpers").DerivationPathArray;
|
|
2987
|
-
}) => Promise<import("@
|
|
2988
|
-
getSignerFromPrivateKey: (privateKey: Uint8Array) => Promise<import("@
|
|
2987
|
+
}) => Promise<import("@swapkit/toolboxes/cosmos").OfflineDirectSigner>;
|
|
2988
|
+
getSignerFromPrivateKey: (privateKey: Uint8Array) => Promise<import("@swapkit/toolboxes/cosmos").OfflineDirectSigner>;
|
|
2989
2989
|
signAndBroadcastTransaction: (transaction: import("@swapkit/helpers").CosmosTransaction) => Promise<string>;
|
|
2990
|
-
signTransaction: (transaction: import("@swapkit/helpers").CosmosTransaction) => Promise<import("
|
|
2990
|
+
signTransaction: (transaction: import("@swapkit/helpers").CosmosTransaction) => Promise<import("@swapkit/toolboxes/cosmos").SignedTx>;
|
|
2991
2991
|
transfer: ({ recipient, assetValue, memo, feeRate, feeOptionKey, sweep, }: GenericTransferParams) => Promise<string>;
|
|
2992
2992
|
validateAddress: (address: string) => boolean;
|
|
2993
2993
|
verifySignature: ({ signature, message, address, }: {
|
|
@@ -3178,11 +3178,13 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
3178
3178
|
status?: string;
|
|
3179
3179
|
}>;
|
|
3180
3180
|
createL1ActionRequest: typeof import("@swapkit/toolboxes/hypercore/toolbox").createL1ActionRequest;
|
|
3181
|
+
createSendAssetTransaction: typeof import("@swapkit/toolboxes/hypercore/toolbox").createSendAssetTransaction;
|
|
3181
3182
|
createTransaction: typeof import("@swapkit/toolboxes/hypercore/toolbox").createTransaction;
|
|
3182
3183
|
createUserSignedActionRequest: typeof import("@swapkit/toolboxes/hypercore/toolbox").createUserSignedActionRequest;
|
|
3183
3184
|
estimateTransactionFee: () => AssetValue;
|
|
3184
3185
|
getAddress: () => Promise<string>;
|
|
3185
|
-
getBalance: (address: string) => Promise<AssetValue[]>;
|
|
3186
|
+
getBalance: (address: string, scamFilter?: boolean) => Promise<AssetValue[]>;
|
|
3187
|
+
getBalanceFromChain: (address: string) => Promise<AssetValue[]>;
|
|
3186
3188
|
getState: {
|
|
3187
3189
|
clearinghouse: ({ dex, user }: import("@swapkit/toolboxes/hypercore/types").HyperCoreUserStateQueryParams) => Promise<{
|
|
3188
3190
|
marginSummary?: {
|
|
@@ -3201,31 +3203,24 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
3201
3203
|
spotClearinghouse: ({ user }: {
|
|
3202
3204
|
user: string;
|
|
3203
3205
|
}) => Promise<{
|
|
3204
|
-
balances?:
|
|
3205
|
-
coin?: string;
|
|
3206
|
-
token?: number | string;
|
|
3207
|
-
total?: string;
|
|
3208
|
-
}[];
|
|
3206
|
+
balances?: import("@swapkit/toolboxes/hypercore/toolbox").HyperliquidSpotBalance[];
|
|
3209
3207
|
spotState?: {
|
|
3210
|
-
balances?:
|
|
3211
|
-
coin?: string;
|
|
3212
|
-
token?: number | string;
|
|
3213
|
-
total?: string;
|
|
3214
|
-
}[];
|
|
3208
|
+
balances?: import("@swapkit/toolboxes/hypercore/toolbox").HyperliquidSpotBalance[];
|
|
3215
3209
|
};
|
|
3216
3210
|
}>;
|
|
3217
3211
|
userFills: ({ aggregateByTime, user }: import("@swapkit/toolboxes/hypercore/types").HyperCoreUserFillsQueryParams) => Promise<import("@swapkit/toolboxes/hypercore/types").HyperCoreFill[]>;
|
|
3218
3212
|
userFillsByTime: ({ aggregateByTime, endTime, startTime, user }: import("@swapkit/toolboxes/hypercore/types").HyperCoreUserFillsByTimeQueryParams) => Promise<import("@swapkit/toolboxes/hypercore/types").HyperCoreFill[]>;
|
|
3219
3213
|
};
|
|
3214
|
+
signAndBroadcastSendAsset: (params: import("@swapkit/toolboxes/hypercore/types").HyperCoreSendAssetPayinParams) => Promise<string>;
|
|
3220
3215
|
signTransaction: (request: import("@swapkit/toolboxes/hypercore/types").HyperCoreUnsignedRequest) => Promise<import("@swapkit/toolboxes/hypercore/types").HyperCoreSignedRequest>;
|
|
3221
3216
|
transfer: ({ sweep, ...params }: import("@swapkit/toolboxes/hypercore/types").HyperCoreTransferParams) => Promise<string>;
|
|
3222
3217
|
validateAddress: typeof import("@swapkit/toolboxes/hypercore/toolbox").validateHyperCoreAddress;
|
|
3223
3218
|
};
|
|
3224
3219
|
KUJI: ChainWallet<Chain.Kujira> & {
|
|
3225
|
-
createPrivateKeyFromPhrase: (phrase: string) => Promise<Uint8Array<
|
|
3220
|
+
createPrivateKeyFromPhrase: (phrase: string) => Promise<Uint8Array<ArrayBuffer>>;
|
|
3226
3221
|
createTransaction: typeof import("@swapkit/toolboxes/cosmos").cosmosCreateTransaction;
|
|
3227
3222
|
fetchFeeRateFromSwapKit: typeof import("@swapkit/toolboxes/cosmos").fetchFeeRateFromSwapKit;
|
|
3228
|
-
getAccount: (address: string) => Promise<import("@
|
|
3223
|
+
getAccount: (address: string) => Promise<import("@swapkit/toolboxes/cosmos").StargateAccount | null>;
|
|
3229
3224
|
getAddress: () => Promise<string | undefined>;
|
|
3230
3225
|
getBalance: (address: string, _potentialScamFilter?: boolean) => Promise<AssetValue[]>;
|
|
3231
3226
|
getBalanceAsDenoms: (address: string) => Promise<{
|
|
@@ -3241,10 +3236,10 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
3241
3236
|
getSignerFromPhrase: ({ phrase, derivationPath }: {
|
|
3242
3237
|
phrase: string;
|
|
3243
3238
|
derivationPath: import("@swapkit/helpers").DerivationPathArray;
|
|
3244
|
-
}) => Promise<import("@
|
|
3245
|
-
getSignerFromPrivateKey: (privateKey: Uint8Array) => Promise<import("@
|
|
3239
|
+
}) => Promise<import("@swapkit/toolboxes/cosmos").OfflineDirectSigner>;
|
|
3240
|
+
getSignerFromPrivateKey: (privateKey: Uint8Array) => Promise<import("@swapkit/toolboxes/cosmos").OfflineDirectSigner>;
|
|
3246
3241
|
signAndBroadcastTransaction: (transaction: import("@swapkit/helpers").CosmosTransaction) => Promise<string>;
|
|
3247
|
-
signTransaction: (transaction: import("@swapkit/helpers").CosmosTransaction) => Promise<import("
|
|
3242
|
+
signTransaction: (transaction: import("@swapkit/helpers").CosmosTransaction) => Promise<import("@swapkit/toolboxes/cosmos").SignedTx>;
|
|
3248
3243
|
transfer: ({ recipient, assetValue, memo, feeRate, feeOptionKey, sweep, }: GenericTransferParams) => Promise<string>;
|
|
3249
3244
|
validateAddress: (address: string) => boolean;
|
|
3250
3245
|
verifySignature: ({ signature, message, address, }: {
|
|
@@ -3946,10 +3941,10 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
3946
3941
|
validateAddress: typeof import("@swapkit/toolboxes/near/index").validateNearAddress;
|
|
3947
3942
|
};
|
|
3948
3943
|
NOBLE: ChainWallet<Chain.Noble> & {
|
|
3949
|
-
createPrivateKeyFromPhrase: (phrase: string) => Promise<Uint8Array<
|
|
3944
|
+
createPrivateKeyFromPhrase: (phrase: string) => Promise<Uint8Array<ArrayBuffer>>;
|
|
3950
3945
|
createTransaction: typeof import("@swapkit/toolboxes/cosmos").cosmosCreateTransaction;
|
|
3951
3946
|
fetchFeeRateFromSwapKit: typeof import("@swapkit/toolboxes/cosmos").fetchFeeRateFromSwapKit;
|
|
3952
|
-
getAccount: (address: string) => Promise<import("@
|
|
3947
|
+
getAccount: (address: string) => Promise<import("@swapkit/toolboxes/cosmos").StargateAccount | null>;
|
|
3953
3948
|
getAddress: () => Promise<string | undefined>;
|
|
3954
3949
|
getBalance: (address: string, _potentialScamFilter?: boolean) => Promise<AssetValue[]>;
|
|
3955
3950
|
getBalanceAsDenoms: (address: string) => Promise<{
|
|
@@ -3965,10 +3960,10 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
3965
3960
|
getSignerFromPhrase: ({ phrase, derivationPath }: {
|
|
3966
3961
|
phrase: string;
|
|
3967
3962
|
derivationPath: import("@swapkit/helpers").DerivationPathArray;
|
|
3968
|
-
}) => Promise<import("@
|
|
3969
|
-
getSignerFromPrivateKey: (privateKey: Uint8Array) => Promise<import("@
|
|
3963
|
+
}) => Promise<import("@swapkit/toolboxes/cosmos").OfflineDirectSigner>;
|
|
3964
|
+
getSignerFromPrivateKey: (privateKey: Uint8Array) => Promise<import("@swapkit/toolboxes/cosmos").OfflineDirectSigner>;
|
|
3970
3965
|
signAndBroadcastTransaction: (transaction: import("@swapkit/helpers").CosmosTransaction) => Promise<string>;
|
|
3971
|
-
signTransaction: (transaction: import("@swapkit/helpers").CosmosTransaction) => Promise<import("
|
|
3966
|
+
signTransaction: (transaction: import("@swapkit/helpers").CosmosTransaction) => Promise<import("@swapkit/toolboxes/cosmos").SignedTx>;
|
|
3972
3967
|
transfer: ({ recipient, assetValue, memo, feeRate, feeOptionKey, sweep, }: GenericTransferParams) => Promise<string>;
|
|
3973
3968
|
validateAddress: (address: string) => boolean;
|
|
3974
3969
|
verifySignature: ({ signature, message, address, }: {
|
|
@@ -4534,7 +4529,7 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
4534
4529
|
tx_blob: string;
|
|
4535
4530
|
hash: string;
|
|
4536
4531
|
}>;
|
|
4537
|
-
createTransaction: ({ assetValue, recipient, memo, sender, sweep, destinationTag, extendBySeconds, }: {
|
|
4532
|
+
createTransaction: ({ assetValue, recipient, memo, sender, sweep, destinationTag, extendBySeconds, sequence, fee, lastLedgerSequence, }: {
|
|
4538
4533
|
assetValue: AssetValue;
|
|
4539
4534
|
recipient: string;
|
|
4540
4535
|
sender?: string;
|
|
@@ -4542,6 +4537,9 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
4542
4537
|
sweep?: boolean;
|
|
4543
4538
|
destinationTag?: number;
|
|
4544
4539
|
extendBySeconds?: number;
|
|
4540
|
+
sequence?: number;
|
|
4541
|
+
fee?: string;
|
|
4542
|
+
lastLedgerSequence?: number;
|
|
4545
4543
|
}) => Promise<import("xrpl").Payment>;
|
|
4546
4544
|
disconnect: () => void;
|
|
4547
4545
|
estimateTransactionFee: () => Promise<AssetValue>;
|
|
@@ -4738,7 +4736,7 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
4738
4736
|
SOL: ChainWallet<Chain.Solana> & {
|
|
4739
4737
|
broadcastTransaction: (transaction: import("@solana/web3.js/lib").Transaction | import("@solana/web3.js/lib").VersionedTransaction) => Promise<string>;
|
|
4740
4738
|
createKeysForPath: typeof import("@swapkit/toolboxes/solana/toolbox").createKeysForPath;
|
|
4741
|
-
createTransaction: ({ recipient, assetValue, memo, isProgramDerivedAddress, sender, sweep, }: import("@swapkit/toolboxes/solana/index").SolanaCreateTransactionParams) => Promise<import("@solana/web3.js/lib").Transaction>;
|
|
4739
|
+
createTransaction: ({ recipient, assetValue, memo, isProgramDerivedAddress, sender, recentBlockhash, sweep, }: import("@swapkit/toolboxes/solana/index").SolanaCreateTransactionParams) => Promise<import("@solana/web3.js/lib").Transaction>;
|
|
4742
4740
|
createTransactionFromInstructions: ({ instructions, }: {
|
|
4743
4741
|
instructions: import("@solana/web3.js/lib").TransactionInstruction[];
|
|
4744
4742
|
isProgramDerivedAddress?: boolean;
|
|
@@ -4999,6 +4997,8 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
4999
4997
|
broadcastTransaction: (transferCell: import("@ton/core").Cell) => Promise<string>;
|
|
5000
4998
|
createTransaction: ({ sender, sweep, ...params }: GenericTransferParams & {
|
|
5001
4999
|
sender?: string;
|
|
5000
|
+
sweep?: boolean;
|
|
5001
|
+
jettonWalletAddress?: string;
|
|
5002
5002
|
}) => Promise<import("@swapkit/toolboxes/ton/types").TONToolboxTransaction>;
|
|
5003
5003
|
estimateTransactionFee: ({ sender, ...params }: GenericTransferParams & {
|
|
5004
5004
|
sender?: string;
|
|
@@ -5017,7 +5017,7 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
5017
5017
|
TRON: ChainWallet<Chain.Tron> & {
|
|
5018
5018
|
approve: ({ assetAddress, spenderAddress, amount, from }: import("@swapkit/toolboxes/tron/types").TronApproveParams) => Promise<string>;
|
|
5019
5019
|
broadcastTransaction: typeof import("@swapkit/toolboxes/tron/helpers/trongrid").broadcastTronTransaction;
|
|
5020
|
-
createTransaction: ({ recipient, assetValue, memo, sender, expiration, sweep, }: import("@swapkit/toolboxes/tron/types").TronCreateTransactionParams) => Promise<import("@swapkit/toolboxes/tron/types").TronTransaction>;
|
|
5020
|
+
createTransaction: ({ recipient, assetValue, memo, sender, expiration, sweep, recipientExists: providedRecipientExists, }: import("@swapkit/toolboxes/tron/types").TronCreateTransactionParams) => Promise<import("@swapkit/toolboxes/tron/types").TronTransaction>;
|
|
5021
5021
|
estimateTransactionFee: ({ assetValue, memo, recipient, sender, }: import("@swapkit/toolboxes/tron/types").TronTransferParams & {
|
|
5022
5022
|
sender?: string;
|
|
5023
5023
|
}) => Promise<AssetValue>;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "swapkit-dev",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@swapkit/helpers": "
|
|
5
|
-
"@swapkit/plugins": "
|
|
6
|
-
"@swapkit/toolboxes": "
|
|
7
|
-
"@swapkit/wallet-core": "
|
|
4
|
+
"@swapkit/helpers": "5.0.1",
|
|
5
|
+
"@swapkit/plugins": "5.0.1",
|
|
6
|
+
"@swapkit/toolboxes": "5.1.0",
|
|
7
|
+
"@swapkit/wallet-core": "5.0.1"
|
|
8
8
|
},
|
|
9
9
|
"description": "SwapKit - Core",
|
|
10
10
|
"devDependencies": {
|
|
@@ -13,9 +13,7 @@
|
|
|
13
13
|
"cosmjs-types": "0.11.0",
|
|
14
14
|
"ts-pattern": "5.9.0"
|
|
15
15
|
},
|
|
16
|
-
"exports": {
|
|
17
|
-
".": { "import": "./dist/index.js", "require": "./dist/index.cjs", "types": "./dist/types/index.d.ts" }
|
|
18
|
-
},
|
|
16
|
+
"exports": { ".": { "default": "./dist/index.js", "types": "./dist/types/index.d.ts" } },
|
|
19
17
|
"files": ["dist/", "CHANGELOG.md"],
|
|
20
18
|
"homepage": "https://github.com/swapkit/SwapKit",
|
|
21
19
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -36,5 +34,5 @@
|
|
|
36
34
|
"type-check:go": "tsgo"
|
|
37
35
|
},
|
|
38
36
|
"type": "module",
|
|
39
|
-
"version": "
|
|
37
|
+
"version": "5.0.1"
|
|
40
38
|
}
|
package/dist/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var{defineProperty:O,getOwnPropertyNames:E,getOwnPropertyDescriptor:jj}=Object,x=Object.prototype.hasOwnProperty;function P(J){return this[J]}var B=(J,L,$)=>{var I=E(L);for(let X of I)if(!x.call(J,X)&&X!=="default")O(J,X,{get:P.bind(L,X),enumerable:!0});if($){for(let X of I)if(!x.call($,X)&&X!=="default")O($,X,{get:P.bind(L,X),enumerable:!0});return $}};var qj=(J)=>{var L=(S??=new WeakMap).get(J),$;if(L)return L;if(L=O({},"__esModule",{value:!0}),J&&typeof J==="object"||typeof J==="function"){for(var I of E(J))if(!x.call(L,I))O(L,I,{get:P.bind(J,I),enumerable:!($=jj(J,I))||$.enumerable})}return S.set(J,L),L},S;var zj=(J)=>J;function Gj(J,L){this[J]=zj.bind(null,L)}var Hj=(J,L)=>{for(var $ in L)O(J,$,{get:L[$],enumerable:!0,configurable:!0,set:Gj.bind(L,$)})};var k={};Hj(k,{resolveRoutePluginName:()=>v,getRouteApprovalAssetValue:()=>V,SwapKit:()=>Lj});module.exports=qj(k);var q=require("@swapkit/helpers"),y=require("@swapkit/helpers/api");B(k,require("@swapkit/helpers"),module.exports);var Jj=[q.ProviderName.FLASHNET,q.ProviderName.MAYAN];function v({pluginName:J,providers:L,useDirectSigning:$}){return L.some((X)=>Jj.includes(X))||$?"swapkit":J||L[0]}function V(J){let L="approvalTx"in J?J.approvalTx:void 0;return L!==void 0&&"txType"in L&&L.txType==="STELLAR"?q.AssetValue.from({asset:J.buyAsset}):q.AssetValue.from({asset:J.sellAsset,value:J.sellAmount})}function Lj({config:J,plugins:L,wallets:$}={}){if(J)q.SKConfig.set(J);let I={},X=Object.entries(L||{}).reduce((j,[G,z])=>{let H=z({getWallet:Y});return j[G]=H,j},{}),W=Object.entries($||{}).reduce((j,[G,z])=>{let H=z.connectWallet({addChain:w});return j[G]=H,j},{});function A(j){let G=j&&X[j],z=Object.values(X).find((Q)=>Q.supportedSwapkitProviders?.includes(j)),H=G||z;if(!H)throw new q.SwapKitError("core_plugin_not_found");return H}function w(j){let G=Y(j.chain),z=j?.balance||G?.balance||[q.AssetValue.from({chain:j.chain})],H={...G,...j,balance:z};return I[j.chain]=H,H}function T({pluginName:j,route:G,useDirectSigning:z}){return A(v({pluginName:j,providers:G.providers,useDirectSigning:z}))}function m({assetValue:j,plugin:G,route:z,spenderAddress:H,type:Q}){if(Q===q.ApproveMode.CheckOnly&&"isAssetValueApproved"in G)return G.isAssetValueApproved({assetValue:j,route:z,spenderAddress:H});if(Q===q.ApproveMode.Approve&&"approveAssetValue"in G)return G.approveAssetValue({assetValue:j,route:z,spenderAddress:H});throw new q.SwapKitError({errorKey:"core_approve_asset_target_invalid",info:{message:`Target ${String(H??z?.providers[0])} cannot be used for approve operation`}})}function b({assetValue:j,type:G="checkOnly",contractAddress:z,route:H}){let Q=j??(H?V(H):void 0);if(!Q)throw new q.SwapKitError("core_approve_asset_target_invalid");let Z=z??H?.meta.approvalAddress,R=H?T({route:H,useDirectSigning:Boolean(Y(Q.chain)?.supportsDirectSigning)}):Z&&X[Z];if(R)return m({assetValue:Q,plugin:R,route:H,spenderAddress:Z,type:G});let f=Q.chain,_=q.EVMChains.includes(f);if(_&&Q.isGasAsset||!_||Q.isSynthetic)return Promise.resolve(G==="checkOnly"?!0:"approved");let U=Y(f),D=G==="checkOnly"?U.isApproved:U.approve;if(!D)throw new q.SwapKitError("core_wallet_connection_not_found");if(!(Q.address&&U.address&&typeof Z==="string"))throw new q.SwapKitError("core_approve_asset_address_or_from_not_found");return D({amount:Q.getBaseValue("bigint"),assetAddress:Q.address,from:U.address,spenderAddress:Z})}function Y(j){return I[j]}function h(){return{...I}}function d(j){return Y(j)?.address||""}function g(j,G){return j instanceof q.AssetValue?b({assetValue:j,contractAddress:G,type:q.ApproveMode.Approve}):b({route:j,type:q.ApproveMode.Approve})}function u(j,G){return j instanceof q.AssetValue?b({assetValue:j,contractAddress:G,type:q.ApproveMode.CheckOnly}):b({route:j,type:q.ApproveMode.CheckOnly})}function K(j){Y(j)?.disconnect?.(),delete I[j]}function c(){for(let j of Object.keys(I))K(j)}function o(j,G){return G?N(j).then(({balance:z})=>z):Y(j)?.balance||[]}async function N(j,G=!0){let z=Y(j);if(!z)throw new q.SwapKitError("core_wallet_connection_not_found");let H=await z.getBalance?.(z.address,G);return z.balance=H||[q.AssetValue.from({chain:j})],z}function p({route:j,pluginName:G,...z}){let H=q.AssetValue.from({asset:j.sellAsset}).chain,Q=Y(H);if(!Q)throw new q.SwapKitError("core_wallet_connection_not_found");let Z=T({pluginName:G,route:j,useDirectSigning:Boolean(Q.supportsDirectSigning&&j.tx)});if("swap"in Z)return Z.swap({...z,route:j});throw new q.SwapKitError("core_plugin_swap_not_found")}function i({assetValue:j,...G}){let z=j.chain;if([q.Chain.Radix].includes(z)||!Y(z))throw new q.SwapKitError("core_wallet_connection_not_found");return Y(z).transfer({...G,assetValue:j})}function n({chain:j,message:G}){let z=Y(j);if(!z)throw new q.SwapKitError("core_wallet_connection_not_found");if("signMessage"in z)return z.signMessage?.(G);throw new q.SwapKitError({errorKey:"core_wallet_sign_message_not_supported",info:{chain:j,wallet:z.walletType}})}function r({chain:j,domain:G,primaryType:z,types:H,value:Q}){let Z=Y(j);if(!Z)throw new q.SwapKitError("core_wallet_connection_not_found");if("signTypedData"in Z&&typeof Z.signTypedData==="function")return Z.signTypedData({domain:G,primaryType:z,types:H,value:Q});throw new q.SwapKitError({errorKey:"core_wallet_sign_typed_data_not_supported",info:{chain:j,wallet:Z.walletType}})}async function s({address:j,chain:G,message:z,signature:H}){if(G!==q.Chain.THORChain)throw new q.SwapKitError({errorKey:"core_verify_message_not_supported",info:{chain:G}});let{getCosmosToolbox:Q}=await import("@swapkit/toolboxes/cosmos");return Q(G).verifySignature({address:j,message:z,signature:H})}async function l({type:j,feeOptionKey:G,params:z}){let{assetValue:H}=z,{chain:Q}=H;if(!Y(Q))throw new q.SwapKitError("core_wallet_connection_not_found");let Z=q.AssetValue.from({chain:Q}),{match:R}=await import("ts-pattern");return await R(Q).returnType().with(...q.EVMChains,(_)=>{let{address:F,...U}=Y(_),D=R(j).with("transfer",()=>U.createTransferTx(z)).with("approve",(a)=>{let{contractAddress:M}=z;return U.createApprovalTx({amount:H.getBaseValue("bigint"),assetAddress:H.address,from:F,spenderAddress:M})}).with("swap",(a)=>{let{route:{providers:[M],tx:e}}=z;if(M&&[q.ProviderName.CHAINFLIP,q.ProviderName.CHAINFLIP_STREAMING].includes(M))return U.createTransferTx({assetValue:H,recipient:F,sender:F});let C=e;return{...C,value:y.parseTransactionValue(C.value)}}).otherwise(()=>{return});if(!D)return Z;return U.estimateTransactionFee({...D,feeOption:G})}).with(...q.CosmosChains,async()=>{let{estimateTransactionFee:_}=await import("@swapkit/toolboxes/cosmos");return _(z)}).with(...q.UTXOChains,(_)=>{let{address:F,...U}=Y(_);return U.estimateTransactionFee({...z,feeOptionKey:G,recipient:F,sender:F})}).with(q.Chain.Tron,q.Chain.Ton,q.Chain.Polkadot,(_)=>{let{address:F,...U}=Y(_);return U.estimateTransactionFee({...z,recipient:F,sender:F})}).with(q.Chain.Aptos,q.Chain.Cardano,q.Chain.Ripple,q.Chain.Stellar,q.Chain.Sui,(_)=>Y(_).estimateTransactionFee()).otherwise(()=>Z)}async function t({address:j,chain:G}){try{let{getAddressValidator:z}=await import("@swapkit/toolboxes");return(await z())({address:j,chain:G})}catch{return!1}}return{...X,...W,approveAssetValue:g,disconnectAll:c,disconnectChain:K,estimateTransactionFee:l,getAddress:d,getAllWallets:h,getBalance:o,getWallet:Y,getWalletWithBalance:N,isAssetValueApproved:u,signMessage:n,signTypedData:r,swap:p,transfer:i,validateAddress:t,verifyMessage:s}}
|