@swapkit/wallet-core 4.2.7 → 4.3.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/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- var{defineProperty:p,getOwnPropertyNames:d,getOwnPropertyDescriptor:u}=Object,y=Object.prototype.hasOwnProperty;function h(e){return this[e]}var C=(e)=>{var n=(o??=new WeakMap).get(e),t;if(n)return n;if(n=p({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var a of d(e))if(!y.call(n,a))p(n,a,{get:h.bind(e,a),enumerable:!(t=u(e,a))||t.enumerable})}return o.set(e,n),n},o;var S=(e)=>e;function g(e,n){this[e]=S.bind(null,n)}var T=(e,n)=>{for(var t in n)p(e,t,{get:n[t],enumerable:!0,configurable:!0,set:g.bind(n,t)})};var f={};T(f,{getWalletSupportedChains:()=>m,createWallet:()=>W});module.exports=C(f);function W({connect:e,directSigningSupport:n,name:t,supportedChains:a,walletType:s}){let i=n??{};function l({addChain:c}){return e({addChain:(r)=>c({supportsDirectSigning:i[r.chain]??!1,...r}),supportedChains:a,walletType:s})}return{[t]:{connectWallet:l,directSigningSupport:i,supportedChains:a}}}function m(e){let n=Object.keys(e)?.[0]||"";return e?.[n]?.supportedChains||[]}
1
+ var{defineProperty:i,getOwnPropertyNames:u,getOwnPropertyDescriptor:y}=Object,g=Object.prototype.hasOwnProperty;function h(e){return this[e]}var C=(e)=>{var n=(d??=new WeakMap).get(e),t;if(n)return n;if(n=i({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var a of u(e))if(!g.call(n,a))i(n,a,{get:h.bind(e,a),enumerable:!(t=y(e,a))||t.enumerable})}return d.set(e,n),n},d;var x=(e)=>e;function S(e,n){this[e]=x.bind(null,n)}var b=(e,n)=>{for(var t in n)i(e,t,{get:n[t],enumerable:!0,configurable:!0,set:S.bind(n,t)})};var T={};b(T,{getWalletSupportedChains:()=>P,createWallet:()=>m});module.exports=C(T);function m({connect:e,directSigningSupport:n,getExtendedPublicKey:t,name:a,supportedChains:r,walletType:c}){let p=n??{};function l({addChain:s}){return e({addChain:(o)=>s({supportsDirectSigning:p[o.chain]??!1,...o}),supportedChains:r,walletType:c})}return{[a]:{connectWallet:l,directSigningSupport:p,getExtendedPublicKey:t,supportedChains:r}}}function P(e){let n=Object.keys(e)?.[0]||"";return e?.[n]?.supportedChains||[]}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- function l({connect:e,directSigningSupport:n,name:i,supportedChains:t,walletType:r}){let a=n??{};function o({addChain:s}){return e({addChain:(p)=>s({supportsDirectSigning:a[p.chain]??!1,...p}),supportedChains:t,walletType:r})}return{[i]:{connectWallet:o,directSigningSupport:a,supportedChains:t}}}function c(e){let n=Object.keys(e)?.[0]||"";return e?.[n]?.supportedChains||[]}export{c as getWalletSupportedChains,l as createWallet};
1
+ function l({connect:e,directSigningSupport:n,getExtendedPublicKey:r,name:p,supportedChains:t,walletType:o}){let a=n??{};function d({addChain:c}){return e({addChain:(i)=>c({supportsDirectSigning:a[i.chain]??!1,...i}),supportedChains:t,walletType:o})}return{[p]:{connectWallet:d,directSigningSupport:a,getExtendedPublicKey:r,supportedChains:t}}}function s(e){let n=Object.keys(e)?.[0]||"";return e?.[n]?.supportedChains||[]}export{s as getWalletSupportedChains,l as createWallet};
@@ -1,12 +1,26 @@
1
- import type { AddChainType, Chain, WalletOption } from "@swapkit/helpers";
1
+ import type { AddChainType, Chain, DerivationPathArray, WalletOption } from "@swapkit/helpers";
2
2
  export type DirectSigningSupport = Partial<Record<Chain, boolean>>;
3
- export declare function createWallet<ConnectParams extends any[], SupportedChains extends Chain[], const Name extends string, WalletType extends WalletOption>({ connect, directSigningSupport, name, supportedChains, walletType, }: {
3
+ export type HardwareExtendedPublicKeyInfo = {
4
+ xpub: string;
5
+ path: string;
6
+ accountIndex?: number;
7
+ xpubSegwit?: string;
8
+ chainCode?: string;
9
+ publicKey?: string;
10
+ fingerprint?: number;
11
+ depth?: number;
12
+ };
13
+ export type GetExtendedPublicKey = (chain: Chain, derivationPath?: DerivationPathArray, params?: {
14
+ accountIndex?: number;
15
+ }) => Promise<HardwareExtendedPublicKeyInfo | undefined>;
16
+ export declare function createWallet<ConnectParams extends any[], SupportedChains extends Chain[], const Name extends string, WalletType extends WalletOption>({ connect, directSigningSupport, getExtendedPublicKey, name, supportedChains, walletType, }: {
4
17
  connect: (connectParams: {
5
18
  addChain: AddChainType;
6
19
  walletType: WalletType;
7
20
  supportedChains: SupportedChains;
8
21
  }) => (...params: ConnectParams) => Promise<boolean>;
9
22
  directSigningSupport?: DirectSigningSupport;
23
+ getExtendedPublicKey?: GetExtendedPublicKey;
10
24
  name: Name;
11
25
  supportedChains: SupportedChains;
12
26
  walletType?: WalletType | string;
@@ -15,7 +29,7 @@ export declare function createWallet<ConnectParams extends any[], SupportedChain
15
29
  addChain: AddChainType;
16
30
  }) => (...params: ConnectParams) => Promise<boolean>;
17
31
  directSigningSupport: DirectSigningSupport;
32
+ getExtendedPublicKey?: GetExtendedPublicKey;
18
33
  supportedChains: SupportedChains;
19
34
  }; };
20
35
  export declare function getWalletSupportedChains<T extends ReturnType<typeof createWallet<any, any, any, any>>>(wallet: T): T[keyof T]["supportedChains"];
21
- //# sourceMappingURL=index.d.ts.map
@@ -7,4 +7,3 @@ export type ConnectFunction<ConnectParams extends any[], SupportedChains extends
7
7
  export type CreateFunction<CreateParams extends any[], WalletType extends WalletOption, Wallets extends Record<Chain, any>> = (createParams: {
8
8
  walletType: WalletType;
9
9
  }) => (...params: CreateParams) => Promise<Wallets> | Wallets;
10
- //# sourceMappingURL=types.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "author": "swapkit-dev",
3
- "dependencies": { "@swapkit/helpers": "4.13.7" },
3
+ "dependencies": { "@swapkit/helpers": "4.13.9" },
4
4
  "description": "SwapKit - Wallet Core",
5
5
  "exports": {
6
6
  ".": { "import": "./dist/index.js", "require": "./dist/index.cjs", "types": "./dist/types/index.d.ts" }
@@ -23,5 +23,5 @@
23
23
  "type-check:go": "tsgo"
24
24
  },
25
25
  "type": "module",
26
- "version": "4.2.7"
26
+ "version": "4.3.0"
27
27
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE1E,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AAEnE,wBAAgB,YAAY,CAC1B,aAAa,SAAS,GAAG,EAAE,EAC3B,eAAe,SAAS,KAAK,EAAE,EAC/B,KAAK,CAAC,IAAI,SAAS,MAAM,EACzB,UAAU,SAAS,YAAY,EAC/B,EACA,OAAO,EACP,oBAAoB,EACpB,IAAI,EACJ,eAAe,EACf,UAAU,GACX,EAAE;IACD,OAAO,EAAE,CAAC,aAAa,EAAE;QACvB,QAAQ,EAAE,YAAY,CAAC;QACvB,UAAU,EAAE,UAAU,CAAC;QACvB,eAAe,EAAE,eAAe,CAAC;KAClC,KAAK,CAAC,GAAG,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACrD,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,IAAI,EAAE,IAAI,CAAC;IACX,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;CAClC,GAciB,GACb,GAAG,IAAI,IAAI,GAAG;IACb,aAAa,iBAboB;QAAE,QAAQ,EAAE,YAAY,CAAA;KAAE,iBAR7C,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC,CAqBZ;IACpC,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,eAAe,EAAE,eAAe,CAAC;CAClC,GACF,CACF;AAED,wBAAgB,wBAAwB,CA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