@swapkit/core 5.1.1 → 5.2.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 +22 -0
- package/dist/index.js +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @swapkit/core
|
|
2
2
|
|
|
3
|
+
## 5.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#437](https://github.com/swapkit/sdk/pull/437) [`5baea45`](https://github.com/swapkit/sdk/commit/5baea45e1595c1582e1d1911fa99177f5e8150f0) Thanks [@hippocampusSK](https://github.com/hippocampusSK)! - Export `tronAddressToHex` from `@swapkit/toolboxes/tron` so hardware wallets can reuse the checksum-validated address conversion. (via @swapkit/toolboxes@6.2.0)
|
|
8
|
+
- [#436](https://github.com/swapkit/sdk/pull/436) [`b7890a5`](https://github.com/swapkit/sdk/commit/b7890a5413c888b7114c512f197bd944672c5256) Thanks [@hippocampusSK](https://github.com/hippocampusSK)! - Fee-bump replacements from nested segwit and taproot addresses can now be signed by external wallets (via @swapkit/toolboxes@6.2.0)
|
|
9
|
+
- [#419](https://github.com/swapkit/sdk/pull/419) [`b1b908b`](https://github.com/swapkit/sdk/commit/b1b908b64f5078d7bead574c5ff45f9ce4995ee8) Thanks [@ice-chillios](https://github.com/ice-chillios)! - Remove the CTRL (formerly XDEFI) and Leap wallet options, along with CTRL provider detection, its account-change listener and wallet-specific error codes. Update Cosmos signer documentation to refer to supported wallets. Integrations must remove CTRL and Leap from wallet configuration and use a supported wallet instead. (via @swapkit/toolboxes@6.2.0)
|
|
10
|
+
- [#433](https://github.com/swapkit/sdk/pull/433) [`c52f562`](https://github.com/swapkit/sdk/commit/c52f56237e2a9149ba12a89e0c8a47fb6138c66c) Thanks [@mfaizan1](https://github.com/mfaizan1)! - Accept PSBT inputs a wallet has already finalized. OKX Wallet finalizes inside `signPsbt` and drops `tapKeySig`, so `finalize()` threw `finalize/taproot: unknown input` and every OKX taproot send failed before broadcast. (via @swapkit/toolboxes@6.2.0)
|
|
11
|
+
- [#434](https://github.com/swapkit/sdk/pull/434) [`151c624`](https://github.com/swapkit/sdk/commit/151c6247a0c84e75d365853a48630d20d746477e) Thanks [@hippocampusSK](https://github.com/hippocampusSK)! - Support Zcash swaps through THORChain: only transparent addresses are accepted and the ZEC minimum amount matches the THORChain dust threshold. (via @swapkit/toolboxes@6.2.0)
|
|
12
|
+
- [#435](https://github.com/swapkit/sdk/pull/435) [`94a2a79`](https://github.com/swapkit/sdk/commit/94a2a79867f89b5a12f34169a20e904469a010dc) Thanks [@hippocampusSK](https://github.com/hippocampusSK)! - Add `tonConnect` to the SKConfig integrations type so wallets can read the TON Connect manifest URL from `SKConfig.get("integrations").tonConnect?.manifestUrl`. (via @swapkit/toolboxes@6.2.0)
|
|
13
|
+
- [#430](https://github.com/swapkit/sdk/pull/430) [`9d44f87`](https://github.com/swapkit/sdk/commit/9d44f87ec8cd6ebef168a8ea64ec492f25d3d305) Thanks [@github-actions](https://github.com/apps/github-actions)! - Update generated token lists. (via @swapkit/toolboxes@6.2.0)
|
|
14
|
+
|
|
15
|
+
## 5.2.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#426](https://github.com/swapkit/sdk/pull/426) [`489fa6c`](https://github.com/swapkit/sdk/commit/489fa6c90f668c65b3b7ec2a7d355449f5312ce2) Thanks [@hippocampusSK](https://github.com/hippocampusSK)! - Add Relay support: `ProviderName.RELAY` is now available, and Relay routes resolve to the generic `swapkit` plugin for any wallet (like Flashnet, Mayan and PactSwap), which signs the route's prebuilt EVM transaction.
|
|
20
|
+
- [#427](https://github.com/swapkit/sdk/pull/427) [`607fac7`](https://github.com/swapkit/sdk/commit/607fac77adfa5fc2e3bd221c71a82b2a99337b56) Thanks [@hippocampusSK](https://github.com/hippocampusSK)! - `getTHORNameCost` and `getMAYANameCost` now match on-chain pricing: the 10 RUNE / 10 CACAO registration fee already includes the first year, and each extra year costs 1.0512 (20 tor or 2000 base units per block × 5,256,000 blocks). (via @swapkit/helpers@6.1.0)
|
|
21
|
+
- [#415](https://github.com/swapkit/sdk/pull/415) [`3e3dca0`](https://github.com/swapkit/sdk/commit/3e3dca0aea7625917a797c1a8183c60a47ae5574) Thanks [@github-actions](https://github.com/apps/github-actions)! - Update generated token lists. (via @swapkit/helpers@6.1.0)
|
|
22
|
+
- [#372](https://github.com/swapkit/sdk/pull/372) [`3f07d19`](https://github.com/swapkit/sdk/commit/3f07d19c90e320d1f04ce4088efa66f2edcff24d) Thanks [@ice-chillios](https://github.com/ice-chillios)! - **New `estimateTronSweepDeduction({ assetValue, recipient, memo?, timeoutMs? })`** — a bounded, recipient-aware quote-time reserve for a Tron sweep. A caller reserving a flat constant cannot see a fresh recipient's activation cost, so an address funded with exactly the sell amount swept short of activating the destination and the transfer failed on chain. (via @swapkit/toolboxes@6.1.0)
|
|
23
|
+
- [#422](https://github.com/swapkit/sdk/pull/422) [`8a1e977`](https://github.com/swapkit/sdk/commit/8a1e977fc99eae87beb62390066d835a721b5c37) Thanks [@ice-chillios](https://github.com/ice-chillios)! - Use an external UTXO signer's optional account `publicKey` consistently in `transfer`, `createTransaction` and `createReplacementTransaction`, so nested segwit and taproot inputs receive their spending metadata. The key must be a 33-byte `Uint8Array`; other values throw `toolbox_utxo_invalid_params`. (via @swapkit/toolboxes@6.1.0)
|
|
24
|
+
|
|
3
25
|
## 5.1.1
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var R=((i)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(c,w)=>(typeof require<"u"?require:c)[w]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});import{ApproveMode as m,AssetValue as g,Chain as f,CosmosChains as z,EVMChains as k,ProviderName as
|
|
1
|
+
var R=((i)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(c,w)=>(typeof require<"u"?require:c)[w]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});import{ApproveMode as m,AssetValue as g,Chain as f,CosmosChains as z,EVMChains as k,ProviderName as h,SKConfig as J,SwapKitError as l,UTXOChains as Z}from"@swapkit/helpers";import{parseTransactionValue as ee}from"@swapkit/helpers/api";export*from"@swapkit/helpers";var te=[h.FLASHNET,h.MAYAN,h.PACTSWAP,h.RELAY];function ne({pluginName:i,providers:c,useDirectSigning:w}){return c.some((T)=>te.includes(T))||w?"swapkit":i||c[0]}function ae(i){let c="approvalTx"in i?i.approvalTx:void 0;return c!==void 0&&"txType"in c&&c.txType==="STELLAR"?g.from({asset:i.buyAsset}):g.from({asset:i.sellAsset,value:i.sellAmount})}function ie({config:i,plugins:c,wallets:w}={}){if(i)J.set(i);let y={},T=Object.entries(c||{}).reduce((e,[n,t])=>{let a=t({getWallet:o});return e[n]=a,e},{}),W=Object.entries(w||{}).reduce((e,[n,t])=>{let a=t.connectWallet({addChain:E});return e[n]=a,e},{});function b(e){let n=e&&T[e],t=Object.values(T).find((s)=>s.supportedSwapkitProviders?.includes(e)),a=n||t;if(!a)throw new l("core_plugin_not_found");return a}function E(e){let n=o(e.chain),t=e?.balance||n?.balance||[g.from({chain:e.chain})],a={...n,...e,balance:t};return y[e.chain]=a,a}function C({pluginName:e,route:n,useDirectSigning:t}){return b(ne({pluginName:e,providers:n.providers,useDirectSigning:t}))}function M({assetValue:e,plugin:n,route:t,spenderAddress:a,type:s}){if(s===m.CheckOnly&&"isAssetValueApproved"in n)return n.isAssetValueApproved({assetValue:e,route:t,spenderAddress:a});if(s===m.Approve&&"approveAssetValue"in n)return n.approveAssetValue({assetValue:e,route:t,spenderAddress:a});throw new l({errorKey:"core_approve_asset_target_invalid",info:{message:`Target ${String(a??t?.providers[0])} cannot be used for approve operation`}})}function P({assetValue:e,type:n="checkOnly",contractAddress:t,route:a}){let s=e??(a?ae(a):void 0);if(!s)throw new l("core_approve_asset_target_invalid");let r=t??a?.meta.approvalAddress,A=a?C({route:a,useDirectSigning:Boolean(o(s.chain)?.supportsDirectSigning)}):r&&T[r];if(A)return M({assetValue:s,plugin:A,route:a,spenderAddress:r,type:n});let V=s.chain,u=k.includes(V);if(u&&s.isGasAsset||!u||s.isSynthetic)return Promise.resolve(n==="checkOnly"?!0:"approved");let p=o(V),_=n==="checkOnly"?p.isApproved:p.approve;if(!_)throw new l("core_wallet_connection_not_found");if(!(s.address&&p.address&&typeof r==="string"))throw new l("core_approve_asset_address_or_from_not_found");return _({amount:s.getBaseValue("bigint"),assetAddress:s.address,from:p.address,spenderAddress:r})}function o(e){return y[e]}function O(){return{...y}}function F(e){return o(e)?.address||""}function K(e,n){return e instanceof g?P({assetValue:e,contractAddress:n,type:m.Approve}):P({route:e,type:m.Approve})}function D(e,n){return e instanceof g?P({assetValue:e,contractAddress:n,type:m.CheckOnly}):P({route:e,type:m.CheckOnly})}function S(e){o(e)?.disconnect?.(),delete y[e]}function B(){for(let e of Object.keys(y))S(e)}function I(e,n){return n?x(e).then(({balance:t})=>t):o(e)?.balance||[]}async function x(e,n=!0){let t=o(e);if(!t)throw new l("core_wallet_connection_not_found");let a=await t.getBalance?.(t.address,n);return t.balance=a||[g.from({chain:e})],t}function L({route:e,pluginName:n,...t}){let a=g.from({asset:e.sellAsset}).chain,s=o(a);if(!s)throw new l("core_wallet_connection_not_found");let r=C({pluginName:n,route:e,useDirectSigning:Boolean(s.supportsDirectSigning&&e.tx)});if("swap"in r)return r.swap({...t,route:e});throw new l("core_plugin_swap_not_found")}function G({assetValue:e,...n}){let t=e.chain;if([f.Radix].includes(t)||!o(t))throw new l("core_wallet_connection_not_found");return o(t).transfer({...n,assetValue:e})}function j({chain:e,message:n}){let t=o(e);if(!t)throw new l("core_wallet_connection_not_found");if("signMessage"in t)return t.signMessage?.(n);throw new l({errorKey:"core_wallet_sign_message_not_supported",info:{chain:e,wallet:t.walletType}})}function H({chain:e,domain:n,primaryType:t,types:a,value:s}){let r=o(e);if(!r)throw new l("core_wallet_connection_not_found");if("signTypedData"in r&&typeof r.signTypedData==="function")return r.signTypedData({domain:n,primaryType:t,types:a,value:s});throw new l({errorKey:"core_wallet_sign_typed_data_not_supported",info:{chain:e,wallet:r.walletType}})}async function Q({address:e,chain:n,message:t,signature:a}){if(n!==f.THORChain)throw new l({errorKey:"core_verify_message_not_supported",info:{chain:n}});let{getCosmosToolbox:s}=await import("@swapkit/toolboxes/cosmos");return s(n).verifySignature({address:e,message:t,signature:a})}async function U({type:e,feeOptionKey:n,params:t}){let{assetValue:a}=t,{chain:s}=a;if(!o(s))throw new l("core_wallet_connection_not_found");let r=g.from({chain:s}),{match:A}=await import("ts-pattern");return await A(s).returnType().with(...k,(u)=>{let{address:d,...p}=o(u),_=A(e).with("transfer",()=>p.createTransferTx(t)).with("approve",(X)=>{let{contractAddress:v}=t;return p.createApprovalTx({amount:a.getBaseValue("bigint"),assetAddress:a.address,from:d,spenderAddress:v})}).with("swap",(X)=>{let{route:{providers:[v],tx:q}}=t;if(v&&[h.CHAINFLIP,h.CHAINFLIP_STREAMING].includes(v))return p.createTransferTx({assetValue:a,recipient:d,sender:d});let N=q;return{...N,value:ee(N.value)}}).otherwise(()=>{return});if(!_)return r;return p.estimateTransactionFee({..._,feeOption:n})}).with(...z,async()=>{let{estimateTransactionFee:u}=await import("@swapkit/toolboxes/cosmos");return u(t)}).with(...Z,(u)=>{let{address:d,...p}=o(u);return p.estimateTransactionFee({...t,feeOptionKey:n,recipient:d,sender:d})}).with(f.Tron,f.Ton,f.Polkadot,(u)=>{let{address:d,...p}=o(u);return p.estimateTransactionFee({...t,recipient:d,sender:d})}).with(f.Aptos,f.Cardano,f.Ripple,f.Stellar,f.Sui,(u)=>o(u).estimateTransactionFee()).otherwise(()=>r)}async function Y({address:e,chain:n}){try{let{getAddressValidator:t}=await import("@swapkit/toolboxes");return(await t())({address:e,chain:n})}catch{return!1}}return{...T,...W,approveAssetValue:K,disconnectAll:B,disconnectChain:S,estimateTransactionFee:U,getAddress:F,getAllWallets:O,getBalance:I,getWallet:o,getWalletWithBalance:x,isAssetValueApproved:D,signMessage:j,signTypedData:H,swap:L,transfer:G,validateAddress:Y,verifyMessage:Q}}export{ie as SwapKit,ae as getRouteApprovalAssetValue,ne as resolveRoutePluginName};
|
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.0.
|
|
6
|
-
"@swapkit/toolboxes": "6.0
|
|
7
|
-
"@swapkit/wallet-core": "5.0.
|
|
4
|
+
"@swapkit/helpers": "6.1.1",
|
|
5
|
+
"@swapkit/plugins": "5.0.13",
|
|
6
|
+
"@swapkit/toolboxes": "6.2.0",
|
|
7
|
+
"@swapkit/wallet-core": "5.0.13"
|
|
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.2.1"
|
|
38
38
|
}
|