@swapkit/core 5.3.0 → 5.4.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/CHANGELOG.md +14 -0
- package/dist/index.js +1 -1
- package/dist/types/index.d.ts +308 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @swapkit/core
|
|
2
2
|
|
|
3
|
+
## 5.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#460](https://github.com/swapkit/sdk/pull/460) [`9190931`](https://github.com/swapkit/sdk/commit/9190931bb2c1f911543a22cb8ccc91e3913cfe6c) Thanks [@hippocampusSK](https://github.com/hippocampusSK)! - Add limit orders. A `SwapKit` instance with the `swapkit` plugin exposes `swapKit.limitOrder`: `tokens`, `quote`, `build`, `sign`, `submit`, `execute`, `list`, `get`, `allowedProviders` and `canSign`, plus `cancel.build`, `cancel.sign`, `cancel.submit` and `cancel.execute`. `execute({ build })` signs a built order with the connected wallet and submits it in one step; `cancel.execute(orderId)` does the same for a cancellation.
|
|
8
|
+
- [#460](https://github.com/swapkit/sdk/pull/460) [`9190931`](https://github.com/swapkit/sdk/commit/9190931bb2c1f911543a22cb8ccc91e3913cfe6c) Thanks [@hippocampusSK](https://github.com/hippocampusSK)! - `SwapKitApi` now covers the full limit-order API: `getLimitOrderTokens`, `getLimitOrderQuote`, `buildLimitOrder`, `submitLimitOrder`, `getLimitOrders`, `getLimitOrder`, `buildLimitOrderCancel` and `submitLimitOrderCancel`, with typed responses and `LimitOrderStatus` and `LimitOrderTxType` constants. `getLimitOrderQuote` accepts an optional `providers` list to restrict the quote to those providers. Each call can be overridden through `SKConfig.endpoints`. (via @swapkit/helpers@6.4.0)
|
|
9
|
+
- [#467](https://github.com/swapkit/sdk/pull/467) [`6ddbd12`](https://github.com/swapkit/sdk/commit/6ddbd12b87af88d304aa575518970214ca4516e9) Thanks [@ice-chillios](https://github.com/ice-chillios)! - `getTokenAddress` and `getChecksumAddressFromAsset` now use `isGasAsset`, so `MONAD.MON`, `XLAYER.OKB` and `GNO.xDAI` resolve to the native asset address instead of returning `null` or throwing. Identifiers that repeat the chain name on a chain whose gas asset has another ticker, such as `ARB.ARB` or `BSC.BSC`, no longer resolve to the native asset address. `ContractAddress[Chain.Optimism]` is now the zero address, like every EVM chain except Polygon, so `OP.ETH` resolves to the zero address instead of the OP token contract (`0x4200000000000000000000000000000000000042`). `OP.OP` without an address still resolves to the OP token contract. The Botanix toolbox now targets the Botanix network instead of Sonic. (via @swapkit/helpers@6.4.0)
|
|
10
|
+
- [#474](https://github.com/swapkit/sdk/pull/474) [`f107064`](https://github.com/swapkit/sdk/commit/f10706478e42440912a009b011b92b4e345104f8) Thanks [@ice-chillios](https://github.com/ice-chillios)! - The TON toolbox spaces out and retries its requests to the public Toncenter endpoint, which allows about one request per second without an API key, so TON jetton sales such as TON.USDT are much less likely to fail there. Requests to the chain's default endpoints start at least 1.1 seconds apart, through a queue shared by every toolbox in the process. Waits therefore grow with concurrent TON activity; for servers and other high-volume use, configure a custom TON RPC or a Toncenter API key, which is not spaced out. The endpoint health check is not queued. A request rejected with 429 or a gateway error (502 and above) is sent again after 1, 2 and 4 seconds. A node's 500 answer, such as a rejected message, a timeout and a network failure fail at once. A jetton lookup that the RPC does not answer is reported as `helpers_chain_rpc_connection_failed` instead of `core_swap_contract_not_found`. A toolbox looks up each jetton wallet address only once per jetton and owner. (via @swapkit/helpers@6.4.0)
|
|
11
|
+
- [#464](https://github.com/swapkit/sdk/pull/464) [`c20cc10`](https://github.com/swapkit/sdk/commit/c20cc10b4534c7948dfe4b57f29e07f1b183f1ca) Thanks [@github-actions](https://github.com/apps/github-actions)! - Update generated token lists. (via @swapkit/helpers@6.4.0)
|
|
12
|
+
- [#460](https://github.com/swapkit/sdk/pull/460) [`9190931`](https://github.com/swapkit/sdk/commit/9190931bb2c1f911543a22cb8ccc91e3913cfe6c) Thanks [@hippocampusSK](https://github.com/hippocampusSK)! - The keystore can now sign Bitcoin messages (BIP-137) and declares the `btcMessage` capability for Bitcoin, so flows that need a Bitcoin signed message, like cancelling a Harbor Bitcoin limit order, work with it. (via @swapkit/toolboxes@6.5.0)
|
|
13
|
+
- [#460](https://github.com/swapkit/sdk/pull/460) [`9190931`](https://github.com/swapkit/sdk/commit/9190931bb2c1f911543a22cb8ccc91e3913cfe6c) Thanks [@hippocampusSK](https://github.com/hippocampusSK)! - EVM transactions that carry only a legacy `gasPrice` are now sent as legacy transactions instead of failing on chains that support EIP-1559. (via @swapkit/toolboxes@6.5.0)
|
|
14
|
+
- [#468](https://github.com/swapkit/sdk/pull/468) [`8062907`](https://github.com/swapkit/sdk/commit/8062907e7f2dd5a7c12f436b9ee3a2b5fad66e15) Thanks [@ice-chillios](https://github.com/ice-chillios)! - The TON toolbox no longer falls back to Orbs TON Access when every configured TON RPC fails. That service no longer returns any nodes, so the fallback itself failed with an unclear error. Now the toolbox throws `helpers_chain_rpc_connection_failed`, and jetton transfers and sweeps report that error instead of `core_swap_contract_not_found`. Set a working endpoint with `SKConfig.setRpcUrl(Chain.Ton, [...])` or pass `provider` to the toolbox. The `@orbs-network/ton-access` dependency is removed. (via @swapkit/toolboxes@6.5.0)
|
|
15
|
+
- [#465](https://github.com/swapkit/sdk/pull/465) [`d03591d`](https://github.com/swapkit/sdk/commit/d03591dd257fb2735d1ce1eb72540e11082a084e) Thanks [@towanTG](https://github.com/towanTG)! - Zcash transactions keep working through the NU7 network upgrade (mainnet block 3,543,405, around 5 November 2026), which rejects version 4 transactions. From the activation block on, the Zcash toolbox builds version 5 transactions with the NU7 consensus branch id `0x77190ad9`; before it, nothing changes. If the block height can't be fetched, building a Zcash transaction now fails with `toolbox_utxo_api_error` instead of guessing the format, because a guess on the wrong side of an upgrade produces a transaction the network rejects. `@swapkit/utxo-signer` can now build, sign, parse and compute the txid of transparent version 5 transactions, including version 5 PSBTs and PCZTs, and exports `getZcashTransactionFormat` and `ZCASH_NU7_ACTIVATION_HEIGHT`. Parsing a raw Zcash transaction now keeps input txids in the right byte order, so re-serializing it no longer changes them. (via @swapkit/toolboxes@6.5.0)
|
|
16
|
+
|
|
3
17
|
## 5.3.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var S=((l)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(l,{get:(g,y)=>(typeof require<"u"?require:g)[y]}):l)(function(l){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+l+'" is not supported')});import{ApproveMode as P,AssetValue as d,Chain as m,CosmosChains as ae,EVMChains as N,ProviderName as h,SKConfig as re,SwapKitError as r,UTXOChains as se,walletSupportsDirectSigning as W}from"@swapkit/helpers";import{parseTransactionValue as oe,SwapKitApi as p}from"@swapkit/helpers/api";export*from"@swapkit/helpers";var le=[h.FLASHNET,h.MAYAN,h.PACTSWAP,h.RELAY];function ue({pluginName:l,providers:g,useDirectSigning:y}){return g.some((_)=>le.includes(_))||y?"swapkit":l||g[0]}function ce(l){let g="approvalTx"in l?l.approvalTx:void 0;return g!==void 0&&"txType"in g&&g.txType==="STELLAR"?d.from({asset:l.buyAsset}):d.from({asset:l.sellAsset,value:l.sellAmount})}function fe({config:l,plugins:g,wallets:y}={}){if(l)re.set(l);let T={},_=Object.entries(g||{}).reduce((e,[n,t])=>{let i=t({getWallet:s});return e[n]=i,e},{}),E=Object.entries(y||{}).reduce((e,[n,t])=>{let i=t.connectWallet({addChain:M});return e[n]=i,e},{});function V(e){let n=e&&_[e],t=Object.values(_).find((a)=>a.supportedSwapkitProviders?.includes(e)),i=n||t;if(!i)throw new r("core_plugin_not_found");return i}function M(e){let n=s(e.chain),t=e?.balance||n?.balance||[d.from({chain:e.chain})],i={...n,...e,balance:t};return T[e.chain]=i,i}function x({pluginName:e,route:n,useDirectSigning:t}){return V(ue({pluginName:e,providers:n.providers,useDirectSigning:t}))}function K({assetValue:e,plugin:n,route:t,spenderAddress:i,type:a}){if(a===P.CheckOnly&&"isAssetValueApproved"in n)return n.isAssetValueApproved({assetValue:e,route:t,spenderAddress:i});if(a===P.Approve&&"approveAssetValue"in n)return n.approveAssetValue({assetValue:e,route:t,spenderAddress:i});throw new r({errorKey:"core_approve_asset_target_invalid",info:{message:`Target ${String(i??t?.providers[0])} cannot be used for approve operation`}})}function C({assetValue:e,type:n="checkOnly",contractAddress:t,route:i}){let a=e??(i?ce(i):void 0);if(!a)throw new r("core_approve_asset_target_invalid");let o=t??i?.meta.approvalAddress,A=i?x({route:i,useDirectSigning:W(s(a.chain))}):o&&_[o];if(A)return K({assetValue:a,plugin:A,route:i,spenderAddress:o,type:n});let R=a.chain,c=N.includes(R);if(c&&a.isGasAsset||!c||a.isSynthetic)return Promise.resolve(n==="checkOnly"?!0:"approved");let u=s(R),v=n==="checkOnly"?u.isApproved:u.approve;if(!v)throw new r("core_wallet_connection_not_found");if(!(a.address&&u.address&&typeof o==="string"))throw new r("core_approve_asset_address_or_from_not_found");return v({amount:a.getBaseValue("bigint"),assetAddress:a.address,from:u.address,spenderAddress:o})}function s(e){return T[e]}function F(){return{...T}}function D(e){return s(e)?.address||""}function B(e,n){return e instanceof d?C({assetValue:e,contractAddress:n,type:P.Approve}):C({route:e,type:P.Approve})}function I(e,n){return e instanceof d?C({assetValue:e,contractAddress:n,type:P.CheckOnly}):C({route:e,type:P.CheckOnly})}function b(e){s(e)?.disconnect?.(),delete T[e]}function G(){for(let e of Object.keys(T))b(e)}function Q(e,n){return n?k(e).then(({balance:t})=>t):s(e)?.balance||[]}async function k(e,n=!0){let t=s(e);if(!t)throw new r("core_wallet_connection_not_found");let i=await t.getBalance?.(t.address,n);return t.balance=i||[d.from({chain:e})],t}function j({route:e,pluginName:n,...t}){let i=d.from({asset:e.sellAsset}).chain,a=s(i);if(!a)throw new r("core_wallet_connection_not_found");let o=x({pluginName:n,route:e,useDirectSigning:Boolean(W(a)&&e.tx)});if("swap"in o)return o.swap({...t,route:e});throw new r("core_plugin_swap_not_found")}function w(){let e=V("swapkit");if(typeof e.limitOrderSign!=="function")throw new r({errorKey:"core_plugin_not_found",info:{method:"limitOrderSign",plugin:"swapkit"}});return e}async function H(e){let n=d.from({asset:e.sellAsset}),t=w().limitOrderAllowedProviders({sellAsset:n}),i=e.providers?t.filter((a)=>e.providers?.includes(a)):t;if(i.length===0)throw new r("plugin_swapkit_limit_order_no_signable_provider",{chain:n.chain,requestedProviders:e.providers,sellAsset:e.sellAsset});return await p.getLimitOrderQuote({...e,providers:i})}async function U(e){let{orderId:n}=e.build,t=await w().limitOrderSign(e);try{return await p.submitLimitOrder({orderId:n,...t})}catch(i){throw new r({errorKey:"plugin_swapkit_limit_order_submit_failed",info:{...t,error:i,orderId:n}},i)}}async function Y(e){let n=await p.buildLimitOrderCancel({orderId:e});if(n.orderId!==e)throw new r("plugin_swapkit_limit_order_invalid_build",{buildOrderId:n.orderId,expectedOrderId:e,reason:"Cancel build belongs to a different order"});let t=await w().limitOrderCancelSign({cancelBuild:n});try{return await p.submitLimitOrderCancel({orderId:e,...t})}catch(i){throw new r({errorKey:"plugin_swapkit_limit_order_cancel_submit_failed",info:{...t,error:i,orderId:e}},i)}}let X={allowedProviders:({sellAsset:e})=>w().limitOrderAllowedProviders({sellAsset:e}),build:p.buildLimitOrder,cancel:{build:p.buildLimitOrderCancel,canSign:({order:e})=>w().limitOrderCanCancel({order:e}),execute:Y,sign:(e)=>w().limitOrderCancelSign(e),submit:p.submitLimitOrderCancel},canSign:({sellAsset:e})=>w().limitOrderAllowedProviders({sellAsset:e}).length>0,execute:U,get:p.getLimitOrder,list:p.getLimitOrders,quote:H,sign:(e)=>w().limitOrderSign(e),submit:p.submitLimitOrder,tokens:p.getLimitOrderTokens};function q({assetValue:e,...n}){let t=e.chain;if([m.Radix].includes(t)||!s(t))throw new r("core_wallet_connection_not_found");return s(t).transfer({...n,assetValue:e})}function z({chain:e,message:n}){let t=s(e);if(!t)throw new r("core_wallet_connection_not_found");if("signMessage"in t)return t.signMessage?.(n);throw new r({errorKey:"core_wallet_sign_message_not_supported",info:{chain:e,wallet:t.walletType}})}function J({chain:e,domain:n,primaryType:t,types:i,value:a}){let o=s(e);if(!o)throw new r("core_wallet_connection_not_found");if("signTypedData"in o&&typeof o.signTypedData==="function")return o.signTypedData({domain:n,primaryType:t,types:i,value:a});throw new r({errorKey:"core_wallet_sign_typed_data_not_supported",info:{chain:e,wallet:o.walletType}})}async function Z({address:e,chain:n,message:t,signature:i}){if(n!==m.THORChain)throw new r({errorKey:"core_verify_message_not_supported",info:{chain:n}});let{getCosmosToolbox:a}=await import("@swapkit/toolboxes/cosmos");return a(n).verifySignature({address:e,message:t,signature:i})}async function ee({type:e,feeOptionKey:n,params:t}){let{assetValue:i}=t,{chain:a}=i;if(!s(a))throw new r("core_wallet_connection_not_found");let o=d.from({chain:a}),{match:A}=await import("ts-pattern");return await A(a).returnType().with(...N,(c)=>{let{address:f,...u}=s(c),v=A(e).with("transfer",()=>u.createTransferTx(t)).with("approve",(ne)=>{let{contractAddress:O}=t;return u.createApprovalTx({amount:i.getBaseValue("bigint"),assetAddress:i.address,from:f,spenderAddress:O})}).with("swap",(ne)=>{let{route:{providers:[O],tx:ie}}=t;if(O&&[h.CHAINFLIP,h.CHAINFLIP_STREAMING].includes(O))return u.createTransferTx({assetValue:i,recipient:f,sender:f});let L=ie;return{...L,value:oe(L.value)}}).otherwise(()=>{return});if(!v)return o;return u.estimateTransactionFee({...v,feeOption:n})}).with(...ae,async()=>{let{estimateTransactionFee:c}=await import("@swapkit/toolboxes/cosmos");return c(t)}).with(...se,(c)=>{let{address:f,...u}=s(c);return u.estimateTransactionFee({...t,feeOptionKey:n,recipient:f,sender:f})}).with(m.Tron,m.Ton,m.Polkadot,(c)=>{let{address:f,...u}=s(c);return u.estimateTransactionFee({...t,recipient:f,sender:f})}).with(m.Aptos,m.Cardano,m.Ripple,m.Stellar,m.Sui,(c)=>s(c).estimateTransactionFee()).otherwise(()=>o)}async function te({address:e,chain:n}){try{let{getAddressValidator:t}=await import("@swapkit/toolboxes");return(await t())({address:e,chain:n})}catch{return!1}}return{..._,...E,approveAssetValue:B,disconnectAll:G,disconnectChain:b,estimateTransactionFee:ee,getAddress:D,getAllWallets:F,getBalance:Q,getWallet:s,getWalletWithBalance:k,isAssetValueApproved:I,limitOrder:X,signMessage:z,signTypedData:J,swap:j,transfer:q,validateAddress:te,verifyMessage:Z}}export{fe as SwapKit,ce as getRouteApprovalAssetValue,ue as resolveRoutePluginName};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AssetValue, Chain, type ChainWallet, type ConditionalAssetValueReturn, type FeeOption, type GenericTransferParams, ProviderName as PluginNameEnum, type SKConfigState, type SwapParams } from "@swapkit/helpers";
|
|
2
|
-
import { type QuoteResponseRoute, type SwapRouteV2Response } from "@swapkit/helpers/api";
|
|
3
|
-
import type { createPlugin } from "@swapkit/plugins";
|
|
2
|
+
import { type LimitOrderQuoteRequest, type QuoteResponseRoute, type SwapRouteV2Response } from "@swapkit/helpers/api";
|
|
3
|
+
import type { createPlugin, SKPlugins } from "@swapkit/plugins";
|
|
4
4
|
import type { FullWallet } from "@swapkit/toolboxes";
|
|
5
5
|
import type { EVMCreateTransactionParams, EVMTransferParams, TypedDataField } from "@swapkit/toolboxes/evm";
|
|
6
6
|
import type { createWallet } from "@swapkit/wallet-core";
|
|
@@ -10,6 +10,8 @@ export type SwapKitParams<P, W> = {
|
|
|
10
10
|
wallets?: W;
|
|
11
11
|
};
|
|
12
12
|
type SwapRoute = QuoteResponseRoute | SwapRouteV2Response;
|
|
13
|
+
type LimitOrderPlugin = ReturnType<SKPlugins["swapkit"]>;
|
|
14
|
+
type LimitOrderSignParams = Parameters<LimitOrderPlugin["limitOrderSign"]>[0];
|
|
13
15
|
export declare function resolveRoutePluginName({ pluginName, providers, useDirectSigning, }: {
|
|
14
16
|
pluginName?: string;
|
|
15
17
|
providers: readonly PluginNameEnum[];
|
|
@@ -1598,6 +1600,7 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
1598
1600
|
} | undefined;
|
|
1599
1601
|
scriptType: import("@swapkit/helpers").UTXOScriptType;
|
|
1600
1602
|
signAndBroadcastTransaction: (tx: InstanceType<typeof import("@swapkit/utxo-signer").Transaction>) => Promise<string>;
|
|
1603
|
+
signMessage: ((message: string) => Promise<string>) | undefined;
|
|
1601
1604
|
signTransaction: (tx: InstanceType<typeof import("@swapkit/utxo-signer").Transaction>) => import("@swapkit/utxo-signer").Transaction | Promise<import("@swapkit/utxo-signer").Transaction>;
|
|
1602
1605
|
signTransactionWithMultipleKeys: ({ tx, inputDerivations, }: {
|
|
1603
1606
|
tx: InstanceType<typeof import("@swapkit/utxo-signer").Transaction>;
|
|
@@ -1754,6 +1757,7 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
1754
1757
|
index: number;
|
|
1755
1758
|
} | undefined;
|
|
1756
1759
|
scriptType: import("@swapkit/helpers").UTXOScriptType;
|
|
1760
|
+
signMessage: ((message: string) => Promise<string>) | undefined;
|
|
1757
1761
|
signTransactionWithMultipleKeys: ({ tx, inputDerivations, }: {
|
|
1758
1762
|
tx: InstanceType<typeof import("@swapkit/utxo-signer").Transaction>;
|
|
1759
1763
|
inputDerivations: import("@swapkit/toolboxes/utxo/types").InputDerivation[];
|
|
@@ -2640,6 +2644,7 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
2640
2644
|
} | undefined;
|
|
2641
2645
|
scriptType: import("@swapkit/helpers").UTXOScriptType;
|
|
2642
2646
|
signAndBroadcastTransaction: (tx: InstanceType<typeof import("@swapkit/utxo-signer").Transaction>) => Promise<string>;
|
|
2647
|
+
signMessage: ((message: string) => Promise<string>) | undefined;
|
|
2643
2648
|
signTransaction: (tx: InstanceType<typeof import("@swapkit/utxo-signer").Transaction>) => import("@swapkit/utxo-signer").Transaction | Promise<import("@swapkit/utxo-signer").Transaction>;
|
|
2644
2649
|
signTransactionWithMultipleKeys: ({ tx, inputDerivations, }: {
|
|
2645
2650
|
tx: InstanceType<typeof import("@swapkit/utxo-signer").Transaction>;
|
|
@@ -2776,6 +2781,7 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
2776
2781
|
} | undefined;
|
|
2777
2782
|
scriptType: import("@swapkit/helpers").UTXOScriptType;
|
|
2778
2783
|
signAndBroadcastTransaction: (tx: InstanceType<typeof import("@swapkit/utxo-signer").Transaction>) => Promise<string>;
|
|
2784
|
+
signMessage: ((message: string) => Promise<string>) | undefined;
|
|
2779
2785
|
signTransaction: (tx: InstanceType<typeof import("@swapkit/utxo-signer").Transaction>) => import("@swapkit/utxo-signer").Transaction | Promise<import("@swapkit/utxo-signer").Transaction>;
|
|
2780
2786
|
signTransactionWithMultipleKeys: ({ tx, inputDerivations, }: {
|
|
2781
2787
|
tx: InstanceType<typeof import("@swapkit/utxo-signer").Transaction>;
|
|
@@ -3544,6 +3550,7 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
3544
3550
|
} | undefined;
|
|
3545
3551
|
scriptType: import("@swapkit/helpers").UTXOScriptType;
|
|
3546
3552
|
signAndBroadcastTransaction: (tx: InstanceType<typeof import("@swapkit/utxo-signer").Transaction>) => Promise<string>;
|
|
3553
|
+
signMessage: ((message: string) => Promise<string>) | undefined;
|
|
3547
3554
|
signTransaction: (tx: InstanceType<typeof import("@swapkit/utxo-signer").Transaction>) => import("@swapkit/utxo-signer").Transaction | Promise<import("@swapkit/utxo-signer").Transaction>;
|
|
3548
3555
|
signTransactionWithMultipleKeys: ({ tx, inputDerivations, }: {
|
|
3549
3556
|
tx: InstanceType<typeof import("@swapkit/utxo-signer").Transaction>;
|
|
@@ -5670,6 +5677,7 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
5670
5677
|
index: number;
|
|
5671
5678
|
} | undefined;
|
|
5672
5679
|
scriptType: import("@swapkit/helpers").UTXOScriptType;
|
|
5680
|
+
signMessage: ((message: string) => Promise<string>) | undefined;
|
|
5673
5681
|
signTransactionWithMultipleKeys: ({ tx, inputDerivations, }: {
|
|
5674
5682
|
tx: InstanceType<typeof import("@swapkit/utxo-signer").Transaction>;
|
|
5675
5683
|
inputDerivations: import("@swapkit/toolboxes/utxo/types").InputDerivation[];
|
|
@@ -5690,6 +5698,304 @@ export declare function SwapKit<Plugins extends ReturnType<typeof createPlugin>,
|
|
|
5690
5698
|
getWallet: <T_1 extends Chain>(chain: T_1) => FullWallet[T_1];
|
|
5691
5699
|
getWalletWithBalance: <T_1 extends Chain>(chain: T_1, scamFilter?: boolean) => Promise<FullWallet[T_1]>;
|
|
5692
5700
|
isAssetValueApproved: (target: AssetValue | SwapRoute, contractAddress?: string | keyof Plugins) => Promise<boolean>;
|
|
5701
|
+
limitOrder: {
|
|
5702
|
+
allowedProviders: ({ sellAsset }: {
|
|
5703
|
+
sellAsset: AssetValue;
|
|
5704
|
+
}) => (PluginNameEnum.ONEINCH | PluginNameEnum.NEAR | PluginNameEnum.HARBOR)[];
|
|
5705
|
+
build: (json: import("@swapkit/helpers").LimitOrderBuildRequest) => Promise<{
|
|
5706
|
+
nextActions: {
|
|
5707
|
+
method: string;
|
|
5708
|
+
url: string;
|
|
5709
|
+
payload?: unknown;
|
|
5710
|
+
}[];
|
|
5711
|
+
orderHash: string;
|
|
5712
|
+
orderId: string;
|
|
5713
|
+
tx: string | Record<string, unknown> | unknown[] | {
|
|
5714
|
+
data: string;
|
|
5715
|
+
to: string;
|
|
5716
|
+
value: string;
|
|
5717
|
+
from?: string | undefined;
|
|
5718
|
+
gas?: string | undefined;
|
|
5719
|
+
gasPrice?: string | undefined;
|
|
5720
|
+
maxFeePerGas?: string | undefined;
|
|
5721
|
+
maxPriorityFeePerGas?: string | undefined;
|
|
5722
|
+
type?: string | undefined;
|
|
5723
|
+
} | null;
|
|
5724
|
+
txMeta: {
|
|
5725
|
+
txType: "evm" | "cardano" | "near" | "psbt" | "ripple" | "solana" | "starknet" | "stellar" | "sui" | "ton" | "tron";
|
|
5726
|
+
chainId?: number | undefined;
|
|
5727
|
+
memo?: string | undefined;
|
|
5728
|
+
} | null;
|
|
5729
|
+
typedData: {
|
|
5730
|
+
domain: {
|
|
5731
|
+
[x: string]: unknown;
|
|
5732
|
+
chainId: number;
|
|
5733
|
+
name: string;
|
|
5734
|
+
verifyingContract: string;
|
|
5735
|
+
version: string;
|
|
5736
|
+
};
|
|
5737
|
+
message: Record<string, unknown>;
|
|
5738
|
+
primaryType: string;
|
|
5739
|
+
types: Record<string, {
|
|
5740
|
+
name: string;
|
|
5741
|
+
type: string;
|
|
5742
|
+
}[]>;
|
|
5743
|
+
} | null;
|
|
5744
|
+
approvalTx?: {
|
|
5745
|
+
data: string;
|
|
5746
|
+
from: string;
|
|
5747
|
+
to: string;
|
|
5748
|
+
value: string;
|
|
5749
|
+
gasLimit?: string | undefined;
|
|
5750
|
+
gasPrice?: string | undefined;
|
|
5751
|
+
} | undefined;
|
|
5752
|
+
depositAddress?: string | undefined;
|
|
5753
|
+
depositAmount?: string | undefined;
|
|
5754
|
+
depositMemo?: string | undefined;
|
|
5755
|
+
isApproved?: boolean | undefined;
|
|
5756
|
+
warnings?: {
|
|
5757
|
+
code: string;
|
|
5758
|
+
display: string;
|
|
5759
|
+
tooltip?: string | undefined;
|
|
5760
|
+
}[] | undefined;
|
|
5761
|
+
}>;
|
|
5762
|
+
cancel: {
|
|
5763
|
+
build: (json: {
|
|
5764
|
+
orderId: string;
|
|
5765
|
+
}) => Promise<{
|
|
5766
|
+
btcSignaturePreimage: string | null;
|
|
5767
|
+
cancelTx: {
|
|
5768
|
+
chainId: number;
|
|
5769
|
+
data: string;
|
|
5770
|
+
from: string;
|
|
5771
|
+
to: string;
|
|
5772
|
+
value: string;
|
|
5773
|
+
} | null;
|
|
5774
|
+
nextActions: {
|
|
5775
|
+
method: string;
|
|
5776
|
+
url: string;
|
|
5777
|
+
payload?: unknown;
|
|
5778
|
+
}[];
|
|
5779
|
+
orderId: string;
|
|
5780
|
+
typedData: {
|
|
5781
|
+
domain: {
|
|
5782
|
+
[x: string]: unknown;
|
|
5783
|
+
name: string;
|
|
5784
|
+
version: string;
|
|
5785
|
+
};
|
|
5786
|
+
message: {
|
|
5787
|
+
[x: string]: unknown;
|
|
5788
|
+
action: "cancel_and_withdraw";
|
|
5789
|
+
chain: string;
|
|
5790
|
+
expiry: number;
|
|
5791
|
+
l1Address: string;
|
|
5792
|
+
nonce: number;
|
|
5793
|
+
payload: {
|
|
5794
|
+
[x: string]: unknown;
|
|
5795
|
+
orderId: string;
|
|
5796
|
+
};
|
|
5797
|
+
};
|
|
5798
|
+
primaryType: "CancelAndWithdraw";
|
|
5799
|
+
types: {
|
|
5800
|
+
[x: string]: unknown;
|
|
5801
|
+
CancelAndWithdraw: {
|
|
5802
|
+
name: string;
|
|
5803
|
+
type: string;
|
|
5804
|
+
}[];
|
|
5805
|
+
CancelAndWithdrawPayload: {
|
|
5806
|
+
name: string;
|
|
5807
|
+
type: string;
|
|
5808
|
+
}[];
|
|
5809
|
+
EIP712Domain: {
|
|
5810
|
+
name: string;
|
|
5811
|
+
type: string;
|
|
5812
|
+
}[];
|
|
5813
|
+
};
|
|
5814
|
+
} | null;
|
|
5815
|
+
}>;
|
|
5816
|
+
canSign: ({ order }: Parameters<LimitOrderPlugin["limitOrderCanCancel"]>[0]) => boolean;
|
|
5817
|
+
execute: (orderId: string) => Promise<{
|
|
5818
|
+
orderId: string;
|
|
5819
|
+
status: (string & {}) | "CANCELLED" | "EXPIRED" | "FAILED" | "FILLED" | "OPEN" | "PARTIAL" | "PENDING" | "SUBMITTED";
|
|
5820
|
+
cancelRequestedAt?: string | undefined;
|
|
5821
|
+
txHash?: string | undefined;
|
|
5822
|
+
withdrawId?: string | undefined;
|
|
5823
|
+
}>;
|
|
5824
|
+
sign: (params: Parameters<LimitOrderPlugin["limitOrderCancelSign"]>[0]) => Promise<{
|
|
5825
|
+
txHash: string;
|
|
5826
|
+
signature?: undefined;
|
|
5827
|
+
} | {
|
|
5828
|
+
signature: string;
|
|
5829
|
+
txHash?: undefined;
|
|
5830
|
+
} | {
|
|
5831
|
+
txHash?: undefined;
|
|
5832
|
+
signature?: undefined;
|
|
5833
|
+
}>;
|
|
5834
|
+
submit: (json: import("@swapkit/helpers").LimitOrderCancelSubmitRequest) => Promise<{
|
|
5835
|
+
orderId: string;
|
|
5836
|
+
status: (string & {}) | "CANCELLED" | "EXPIRED" | "FAILED" | "FILLED" | "OPEN" | "PARTIAL" | "PENDING" | "SUBMITTED";
|
|
5837
|
+
cancelRequestedAt?: string | undefined;
|
|
5838
|
+
txHash?: string | undefined;
|
|
5839
|
+
withdrawId?: string | undefined;
|
|
5840
|
+
}>;
|
|
5841
|
+
};
|
|
5842
|
+
canSign: ({ sellAsset }: {
|
|
5843
|
+
sellAsset: AssetValue;
|
|
5844
|
+
}) => boolean;
|
|
5845
|
+
execute: (params: LimitOrderSignParams) => Promise<{
|
|
5846
|
+
createdAt: string;
|
|
5847
|
+
orderHash: string;
|
|
5848
|
+
orderId: string;
|
|
5849
|
+
status: (string & {}) | "CANCELLED" | "EXPIRED" | "FAILED" | "FILLED" | "OPEN" | "PARTIAL" | "PENDING" | "SUBMITTED";
|
|
5850
|
+
}>;
|
|
5851
|
+
get: (orderId: string) => Promise<{
|
|
5852
|
+
buyAmount: string;
|
|
5853
|
+
buyAsset: string;
|
|
5854
|
+
chainId: import("@swapkit/types").ChainId | (string & {});
|
|
5855
|
+
createdAt: string;
|
|
5856
|
+
expiresAt: string;
|
|
5857
|
+
fees: {
|
|
5858
|
+
amount: string;
|
|
5859
|
+
asset: string;
|
|
5860
|
+
chain: string;
|
|
5861
|
+
protocol: (string & {}) | import("@swapkit/helpers").ProviderName;
|
|
5862
|
+
type: (string & {}) | import("@swapkit/helpers").FeeTypeEnum;
|
|
5863
|
+
amountBps?: number | undefined;
|
|
5864
|
+
}[];
|
|
5865
|
+
filledBuyAmount: string;
|
|
5866
|
+
filledSellAmount: string;
|
|
5867
|
+
limitPrice: string;
|
|
5868
|
+
maker: string;
|
|
5869
|
+
orderHash: string;
|
|
5870
|
+
orderId: string;
|
|
5871
|
+
provider: (string & {}) | import("@swapkit/helpers").ProviderName;
|
|
5872
|
+
receiver: string | null;
|
|
5873
|
+
sellAmount: string;
|
|
5874
|
+
sellAsset: string;
|
|
5875
|
+
status: (string & {}) | "CANCELLED" | "EXPIRED" | "FAILED" | "FILLED" | "OPEN" | "PARTIAL" | "PENDING" | "SUBMITTED";
|
|
5876
|
+
updatedAt: string;
|
|
5877
|
+
cancelRequestedAt?: string | undefined;
|
|
5878
|
+
depositHash?: string | undefined;
|
|
5879
|
+
txHashes?: {
|
|
5880
|
+
chainId: import("@swapkit/types").ChainId | (string & {});
|
|
5881
|
+
txHash: string;
|
|
5882
|
+
type: "fill" | (string & {}) | "cancel" | "deposit" | "withdraw" | "refund";
|
|
5883
|
+
blockNumber?: number | undefined;
|
|
5884
|
+
}[] | undefined;
|
|
5885
|
+
usdValueClose?: string | null | undefined;
|
|
5886
|
+
usdValueOpen?: string | null | undefined;
|
|
5887
|
+
withdrawHash?: string | undefined;
|
|
5888
|
+
}>;
|
|
5889
|
+
list: (query?: import("@swapkit/helpers").LimitOrderListQuery) => Promise<{
|
|
5890
|
+
orders: {
|
|
5891
|
+
buyAmount: string;
|
|
5892
|
+
buyAsset: string;
|
|
5893
|
+
chainId: import("@swapkit/types").ChainId | (string & {});
|
|
5894
|
+
createdAt: string;
|
|
5895
|
+
expiresAt: string;
|
|
5896
|
+
fees: {
|
|
5897
|
+
amount: string;
|
|
5898
|
+
asset: string;
|
|
5899
|
+
chain: string;
|
|
5900
|
+
protocol: (string & {}) | import("@swapkit/helpers").ProviderName;
|
|
5901
|
+
type: (string & {}) | import("@swapkit/helpers").FeeTypeEnum;
|
|
5902
|
+
amountBps?: number | undefined;
|
|
5903
|
+
}[];
|
|
5904
|
+
filledBuyAmount: string;
|
|
5905
|
+
filledSellAmount: string;
|
|
5906
|
+
limitPrice: string;
|
|
5907
|
+
maker: string;
|
|
5908
|
+
orderHash: string;
|
|
5909
|
+
orderId: string;
|
|
5910
|
+
provider: (string & {}) | import("@swapkit/helpers").ProviderName;
|
|
5911
|
+
receiver: string | null;
|
|
5912
|
+
sellAmount: string;
|
|
5913
|
+
sellAsset: string;
|
|
5914
|
+
status: (string & {}) | "CANCELLED" | "EXPIRED" | "FAILED" | "FILLED" | "OPEN" | "PARTIAL" | "PENDING" | "SUBMITTED";
|
|
5915
|
+
updatedAt: string;
|
|
5916
|
+
cancelRequestedAt?: string | undefined;
|
|
5917
|
+
depositHash?: string | undefined;
|
|
5918
|
+
txHashes?: {
|
|
5919
|
+
chainId: import("@swapkit/types").ChainId | (string & {});
|
|
5920
|
+
txHash: string;
|
|
5921
|
+
type: "fill" | (string & {}) | "cancel" | "deposit" | "withdraw" | "refund";
|
|
5922
|
+
blockNumber?: number | undefined;
|
|
5923
|
+
}[] | undefined;
|
|
5924
|
+
usdValueClose?: string | null | undefined;
|
|
5925
|
+
usdValueOpen?: string | null | undefined;
|
|
5926
|
+
withdrawHash?: string | undefined;
|
|
5927
|
+
}[];
|
|
5928
|
+
nextCursor?: string | undefined;
|
|
5929
|
+
}>;
|
|
5930
|
+
quote: (request: LimitOrderQuoteRequest) => Promise<{
|
|
5931
|
+
quoteId: string;
|
|
5932
|
+
routes: {
|
|
5933
|
+
buyAmount: string;
|
|
5934
|
+
buyAsset: string;
|
|
5935
|
+
effectiveFillPrice: string;
|
|
5936
|
+
integratorFeeBps: number;
|
|
5937
|
+
limitPrice: string;
|
|
5938
|
+
maxExpirationSeconds: number;
|
|
5939
|
+
minExpirationSeconds: number;
|
|
5940
|
+
provider: (string & {}) | import("@swapkit/helpers").ProviderName;
|
|
5941
|
+
routeId: string;
|
|
5942
|
+
sellAmount: string;
|
|
5943
|
+
sellAsset: string;
|
|
5944
|
+
spotPrice: string;
|
|
5945
|
+
spotPriceDeviationBps: number;
|
|
5946
|
+
takerFeeBps: number;
|
|
5947
|
+
fees?: {
|
|
5948
|
+
amount: string;
|
|
5949
|
+
asset: string;
|
|
5950
|
+
chain: string;
|
|
5951
|
+
protocol: (string & {}) | import("@swapkit/helpers").ProviderName;
|
|
5952
|
+
type: (string & {}) | import("@swapkit/helpers").FeeTypeEnum;
|
|
5953
|
+
amountBps?: number | undefined;
|
|
5954
|
+
}[] | undefined;
|
|
5955
|
+
nextActions?: {
|
|
5956
|
+
method: string;
|
|
5957
|
+
url: string;
|
|
5958
|
+
payload?: unknown;
|
|
5959
|
+
}[] | undefined;
|
|
5960
|
+
warnings?: {
|
|
5961
|
+
code: string;
|
|
5962
|
+
display: string;
|
|
5963
|
+
tooltip?: string | undefined;
|
|
5964
|
+
}[] | undefined;
|
|
5965
|
+
}[];
|
|
5966
|
+
error?: string | undefined;
|
|
5967
|
+
providerErrors?: {
|
|
5968
|
+
errorCode?: string | undefined;
|
|
5969
|
+
message?: string | undefined;
|
|
5970
|
+
provider?: (string & {}) | import("@swapkit/helpers").ProviderName | undefined;
|
|
5971
|
+
}[] | undefined;
|
|
5972
|
+
}>;
|
|
5973
|
+
sign: (params: LimitOrderSignParams) => Promise<{
|
|
5974
|
+
signature: string;
|
|
5975
|
+
depositTxHash?: undefined;
|
|
5976
|
+
} | {
|
|
5977
|
+
depositTxHash: string;
|
|
5978
|
+
signature?: undefined;
|
|
5979
|
+
}>;
|
|
5980
|
+
submit: (json: import("@swapkit/helpers").LimitOrderSubmitRequest) => Promise<{
|
|
5981
|
+
createdAt: string;
|
|
5982
|
+
orderHash: string;
|
|
5983
|
+
orderId: string;
|
|
5984
|
+
status: (string & {}) | "CANCELLED" | "EXPIRED" | "FAILED" | "FILLED" | "OPEN" | "PARTIAL" | "PENDING" | "SUBMITTED";
|
|
5985
|
+
}>;
|
|
5986
|
+
tokens: () => Promise<{
|
|
5987
|
+
crossChain: {
|
|
5988
|
+
assets: string[];
|
|
5989
|
+
chainIds: (import("@swapkit/types").ChainId | (string & {}))[];
|
|
5990
|
+
provider: (string & {}) | import("@swapkit/helpers").ProviderName;
|
|
5991
|
+
}[];
|
|
5992
|
+
singleChain: {
|
|
5993
|
+
assets: string[];
|
|
5994
|
+
chainId: import("@swapkit/types").ChainId | (string & {});
|
|
5995
|
+
provider: (string & {}) | import("@swapkit/helpers").ProviderName;
|
|
5996
|
+
}[];
|
|
5997
|
+
}>;
|
|
5998
|
+
};
|
|
5693
5999
|
signMessage: ({ chain, message }: {
|
|
5694
6000
|
chain: Chain;
|
|
5695
6001
|
message: string;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "swapkit-dev",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@swapkit/helpers": "6.
|
|
5
|
-
"@swapkit/plugins": "5.
|
|
6
|
-
"@swapkit/toolboxes": "6.
|
|
7
|
-
"@swapkit/wallet-core": "5.1.
|
|
4
|
+
"@swapkit/helpers": "6.4.0",
|
|
5
|
+
"@swapkit/plugins": "5.2.0",
|
|
6
|
+
"@swapkit/toolboxes": "6.5.0",
|
|
7
|
+
"@swapkit/wallet-core": "5.1.1"
|
|
8
8
|
},
|
|
9
9
|
"description": "SwapKit - Core",
|
|
10
10
|
"devDependencies": {
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"type-check:go": "tsgo"
|
|
35
35
|
},
|
|
36
36
|
"type": "module",
|
|
37
|
-
"version": "5.
|
|
37
|
+
"version": "5.4.0"
|
|
38
38
|
}
|