@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 +1 -1
- package/dist/index.js +1 -1
- package/dist/types/index.d.ts +17 -3
- package/dist/types/types.d.ts +0 -1
- package/package.json +2 -2
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/types.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var{defineProperty:
|
|
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:
|
|
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};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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
|
|
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
|
package/dist/types/types.d.ts
CHANGED
|
@@ -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.
|
|
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.
|
|
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,MAA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