@luno-kit/core 0.0.7 → 0.0.9-beta.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/chains/index.cjs +2 -2
- package/dist/chains/index.cjs.map +1 -1
- package/dist/chains/index.d.cts +13 -7
- package/dist/chains/index.d.ts +13 -7
- package/dist/chains/index.js +2 -2
- package/dist/chains/index.js.map +1 -1
- package/dist/{chunk-242IPEOF.js → chunk-5WHVXOMN.js} +2 -2
- package/dist/chunk-5WHVXOMN.js.map +1 -0
- package/dist/chunk-AND4WL4I.js +2 -0
- package/dist/chunk-AND4WL4I.js.map +1 -0
- package/dist/chunk-UXRZAYEH.cjs +2 -0
- package/dist/chunk-UXRZAYEH.cjs.map +1 -0
- package/dist/{chunk-YHPF74FG.cjs → chunk-VDC6UBTV.cjs} +2 -2
- package/dist/chunk-VDC6UBTV.cjs.map +1 -0
- package/dist/connectors/index.cjs +2 -2
- package/dist/connectors/index.cjs.map +1 -1
- package/dist/connectors/index.d.cts +32 -33
- package/dist/connectors/index.d.ts +32 -33
- package/dist/connectors/index.js +2 -2
- package/dist/connectors/index.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -16
- package/dist/index.d.ts +12 -16
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +162 -11
- package/dist/types/index.d.ts +162 -11
- package/dist/types/index.js +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.cts +19 -12
- package/dist/utils/index.d.ts +19 -12
- package/dist/utils/index.js +1 -1
- package/package.json +8 -8
- package/dist/account-DElDu01m.d.cts +0 -76
- package/dist/account-DElDu01m.d.ts +0 -76
- package/dist/chain-9vBVQoCB.d.cts +0 -28
- package/dist/chain-9vBVQoCB.d.ts +0 -28
- package/dist/chunk-242IPEOF.js.map +0 -1
- package/dist/chunk-SYUDETGE.js +0 -2
- package/dist/chunk-SYUDETGE.js.map +0 -1
- package/dist/chunk-WQPMFK4M.cjs +0 -2
- package/dist/chunk-WQPMFK4M.cjs.map +0 -1
- package/dist/chunk-YHPF74FG.cjs.map +0 -1
- package/dist/connector-6qzOSWQP.d.ts +0 -48
- package/dist/connector-BjPpWk_D.d.cts +0 -48
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,10 @@
|
|
|
1
|
+
import { CreateConfigParameters, Config, RawStorage, LunoStorage, Transport } from './types/index.js';
|
|
1
2
|
import { WsProvider } from 'dedot';
|
|
2
|
-
import { CreateConfigParameters, Config, RawStorage, LunoStorage } from './types/index.js';
|
|
3
|
-
export { Transport } from './types/index.js';
|
|
4
|
-
import './chain-9vBVQoCB.js';
|
|
5
|
-
import './account-DElDu01m.js';
|
|
6
|
-
import 'dedot/utils';
|
|
7
3
|
import 'dedot/types';
|
|
8
|
-
import './connector-6qzOSWQP.js';
|
|
9
|
-
import 'eventemitter3';
|
|
10
|
-
import '@walletconnect/universal-provider';
|
|
11
4
|
import 'dedot/shape';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* @param url - WebSocket RPC URL or URL array (for fallback).
|
|
16
|
-
* @returns WsProvider instance.
|
|
17
|
-
*/
|
|
18
|
-
declare function wsProvider(url: string | string[]): WsProvider;
|
|
5
|
+
import '@walletconnect/universal-provider';
|
|
6
|
+
import 'eventemitter3';
|
|
7
|
+
import '@polkadot-api/pjs-signer';
|
|
19
8
|
|
|
20
9
|
declare function createConfig(parameters: CreateConfigParameters): Config;
|
|
21
10
|
|
|
@@ -33,4 +22,11 @@ interface CreateStorageParameters {
|
|
|
33
22
|
*/
|
|
34
23
|
declare function createStorage({ storage, keyPrefix, }: CreateStorageParameters): LunoStorage;
|
|
35
24
|
|
|
36
|
-
|
|
25
|
+
/**
|
|
26
|
+
* create a WebSocket Transport (WsProvider) instance.
|
|
27
|
+
* @param url - WebSocket RPC URL or URL array (for fallback).
|
|
28
|
+
* @returns WsProvider instance.
|
|
29
|
+
*/
|
|
30
|
+
declare function wsProvider(url: Transport): WsProvider;
|
|
31
|
+
|
|
32
|
+
export { type CreateStorageParameters, Transport, createConfig, createStorage, wsProvider };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {WsProvider}from'dedot';function
|
|
1
|
+
import {WsProvider}from'dedot';function l({storage:t,keyPrefix:a="luno."}){let r=e=>`${a}${e}`;return {async getItem(e){try{let o=r(e),n=await t.getItem(o);return n==null?null:String(n)}catch(o){return console.error(`[LunoStorage] Error getting item "${e}" (full key: "${r(e)}"):`,o),null}},async setItem(e,o){try{let n=r(e);await t.setItem(n,o);}catch(n){console.error(`[LunoStorage] Error setting item "${e}" (full key: "${r(e)}"):`,n);}},async removeItem(e){try{let o=r(e);await t.removeItem(o);}catch(o){console.error(`[LunoStorage] Error removing item "${e}" (full key: "${r(e)}"):`,o);}}}}var w={getItem:async t=>null,setItem:async(t,a)=>{},removeItem:async t=>{}},C=l({storage:typeof window<"u"&&window.localStorage?window.localStorage:w,keyPrefix:"luno."});function S(t){let a={};for(let r of t){let e=r.rpcUrls.webSocket;e?a[r.genesisHash]=e:console.warn(`No WebSocket URL found for chain "${r.name}" (${r.genesisHash}). Skipping transport generation.`);}return a}function R(t){let{appName:a="My Luno App",chains:r=[],connectors:e,transports:o={},storage:n=C,autoConnect:p=true,cacheMetadata:m,metadata:f,scaledResponses:u,customTypes:y,customRpc:d,subscan:h}=t;if(!e||e.length===0)throw new Error("No connectors provided. Wallet connection features will be unavailable.");let i=r.length>0?S(r):{},c=o?{...i,...o}:i;if(r.length>0)for(let s of r)c[s.genesisHash]||console.warn(`Missing transport for chain "${s.name}" (genesisHash: ${s.genesisHash}). Chain functionality may be limited.`);let g={customRpc:d,customTypes:y,cacheMetadata:m,metadata:f,scaledResponses:u,appName:a,chains:Object.freeze([...r]),connectors:Object.freeze([...e]),transports:Object.freeze({...c}),storage:n,autoConnect:p,subscan:h};return console.log("[createConfig]: Luno Core Config created:",g),g}function I(t){return new WsProvider(t)}export{R as createConfig,l as createStorage,I as wsProvider};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config/
|
|
1
|
+
{"version":3,"sources":["../src/config/createStorage.ts","../src/config/createConfig.ts","../src/config/providers.ts"],"names":["createStorage","storage","keyPrefix","getKey","suffix","keySuffix","fullKey","value","error","noopStorage","_key","_value","defaultLunoStorage","generateTransportsFromChains","chains","transports","chain","wsUrl","createConfig","parameters","appName","connectors","autoConnect","cacheMetadata","metadata","scaledResponses","customTypes","customRpc","subscan","transportsFromChains","finalTransports","config","wsProvider","url","WsProvider"],"mappings":"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","file":"index.js","sourcesContent":["import type { LunoStorage, RawStorage } from '../types';\n\n// Defines the parameters for the createStorage function.\nexport interface CreateStorageParameters {\n storage: RawStorage;\n keyPrefix?: string; // Optional key prefix, e.g., \"luno.\"\n}\n\n/**\n * Creates a LunoStorage object that wraps a raw storage mechanism (like localStorage)\n * to provide a consistent async API with key prefixing and error handling.\n *\n * @param storage The raw storage mechanism (e.g., window.localStorage).\n * @param keyPrefix An optional prefix for all storage keys to avoid collisions.\n * @returns A LunoStorage object.\n */\nexport function createStorage({\n storage,\n keyPrefix = 'luno.', // Default key prefix\n}: CreateStorageParameters): LunoStorage {\n const getKey = (suffix: string): string => `${keyPrefix}${suffix}`;\n\n return {\n async getItem(keySuffix: string): Promise<string | null> {\n try {\n const fullKey = getKey(keySuffix);\n // Await to handle both sync and async RawStorage getItem methods consistently\n const value = await storage.getItem(fullKey);\n // Normalize undefined or null to null\n return value == null ? null : String(value);\n } catch (error) {\n console.error(\n `[LunoStorage] Error getting item \"${keySuffix}\" (full key: \"${getKey(keySuffix)}\"):`,\n error\n );\n return null; // Return null on error to indicate failure\n }\n },\n\n async setItem(keySuffix: string, value: string): Promise<void> {\n try {\n const fullKey = getKey(keySuffix);\n // Await to handle both sync and async RawStorage setItem methods consistently\n await storage.setItem(fullKey, value);\n } catch (error) {\n console.error(\n `[LunoStorage] Error setting item \"${keySuffix}\" (full key: \"${getKey(keySuffix)}\"):`,\n error\n );\n // Errors during setItem are logged but don't typically need to be propagated further in the same way getItem might.\n }\n },\n\n async removeItem(keySuffix: string): Promise<void> {\n try {\n const fullKey = getKey(keySuffix);\n // Await to handle both sync and async RawStorage removeItem methods consistently\n await storage.removeItem(fullKey);\n } catch (error) {\n console.error(\n `[LunoStorage] Error removing item \"${keySuffix}\" (full key: \"${getKey(keySuffix)}\"):`,\n error\n );\n }\n },\n };\n}\n","import type {\n Chain,\n Config,\n Connector,\n CreateConfigParameters,\n RawStorage,\n Transport,\n} from '../types';\nimport { createStorage } from './createStorage';\n\nconst noopStorage: RawStorage = {\n getItem: async (_key: string) => null,\n setItem: async (_key: string, _value: string) => {},\n removeItem: async (_key: string) => {},\n};\n\nconst defaultLunoStorage = createStorage({\n storage: typeof window !== 'undefined' && window.localStorage ? window.localStorage : noopStorage,\n keyPrefix: 'luno.',\n});\n\nfunction generateTransportsFromChains(chains: readonly Chain[]): Record<string, Transport> {\n const transports: Record<string, Transport> = {};\n\n for (const chain of chains) {\n const wsUrl = chain.rpcUrls.webSocket;\n if (wsUrl) {\n transports[chain.genesisHash] = wsUrl;\n } else {\n console.warn(\n `No WebSocket URL found for chain \"${chain.name}\" (${chain.genesisHash}). Skipping transport generation.`\n );\n }\n }\n\n return transports;\n}\n\nexport function createConfig(parameters: CreateConfigParameters): Config {\n const {\n appName = 'My Luno App',\n chains = [],\n connectors,\n transports = {},\n storage = defaultLunoStorage,\n autoConnect = true,\n cacheMetadata,\n metadata,\n scaledResponses,\n customTypes,\n customRpc,\n subscan,\n } = parameters;\n\n if (!connectors || connectors.length === 0) {\n throw new Error('No connectors provided. Wallet connection features will be unavailable.');\n }\n\n const transportsFromChains = chains.length > 0 ? generateTransportsFromChains(chains) : {};\n\n const finalTransports = transports\n ? { ...transportsFromChains, ...transports }\n : transportsFromChains;\n\n if (chains.length > 0) {\n for (const chain of chains) {\n if (!finalTransports[chain.genesisHash]) {\n console.warn(\n `Missing transport for chain \"${chain.name}\" (genesisHash: ${chain.genesisHash}). Chain functionality may be limited.`\n );\n }\n }\n }\n\n const config = {\n customRpc,\n customTypes,\n cacheMetadata,\n metadata,\n scaledResponses,\n\n appName,\n chains: Object.freeze([...chains]) as readonly Chain[],\n connectors: Object.freeze([...connectors]) as readonly Connector[],\n transports: Object.freeze({ ...finalTransports }) as Readonly<Record<string, Transport>>,\n storage,\n autoConnect,\n\n subscan,\n };\n\n console.log('[createConfig]: Luno Core Config created:', config);\n\n return config;\n}\n","import { WsProvider } from 'dedot';\nimport type { Transport } from '../types';\n\n/**\n * create a WebSocket Transport (WsProvider) instance.\n * @param url - WebSocket RPC URL or URL array (for fallback).\n * @returns WsProvider instance.\n */\nexport function wsProvider(url: Transport): WsProvider {\n return new WsProvider(url as string[]);\n}\n\nexport type { Transport };\n"]}
|
package/dist/types/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var t=(r=>(r.NORMAL="normal",r.MULTISIG="multisig",r.PROXY="proxy",r.CONTRACT="contract",r))(t||{});exports.ACCOUNT_TYPE=t;//# sourceMappingURL=index.cjs.map
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/types/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/account.ts"],"names":["ACCOUNT_TYPE"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/types/account.ts"],"names":["ACCOUNT_TYPE"],"mappings":"aA8EO,IAAKA,CAAAA,CAAAA,CAAAA,CAAAA,GAEVA,CAAAA,CAAA,MAAA,CAAS,QAAA,CAGTA,CAAAA,CAAA,QAAA,CAAW,UAAA,CAGXA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CAGRA,CAAAA,CAAA,QAAA,CAAW,WAXDA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA","file":"index.cjs","sourcesContent":["import type { KeypairType } from 'dedot/types';\n\nexport type HexString = `0x${string}`;\n\n/**\n * Polkadot account interface\n * Represents a chain account\n */\nexport interface Account {\n /**\n * account address (original format from wallet)\n * specific SS58 formatting should be done in the React layer based on the chain.\n */\n address: string;\n\n /** account name (if any) */\n name?: string;\n\n /**\n * account public key (hex format, without 0x prefix)\n * used for cross-chain address conversion and verification\n */\n publicKey?: HexString;\n\n /**\n * other metadata\n * including account source, control method, etc.\n */\n meta?: {\n /** account source (e.g. 'polkadot-js', 'subwallet-js', 'talisman' etc.) */\n source?: string;\n\n /** genesis hash (if the wallet provides a specific chain account) */\n genesisHash?: string | null;\n\n /** other custom metadata */\n [key: string]: any;\n };\n type?: KeypairType;\n}\n\n/**\n * account balance information\n */\nexport interface AccountBalance {\n /** available balance (in smallest unit) */\n free: bigint;\n\n /** total balance (in smallest unit) */\n total: bigint;\n\n /** reserved balance (in smallest unit) */\n reserved: bigint;\n\n /**\n * transferable balance (in smallest unit)\n * free minus various locked amounts\n */\n transferable: bigint;\n\n /** formatted available balance (with unit, for display) */\n formattedTransferable: string;\n\n /** formatted total balance (with unit, for display) */\n formattedTotal: string;\n\n /** lock details (if any) */\n locks?: Array<{\n id: string;\n amount: bigint;\n reason: string;\n lockHuman: string;\n }>;\n}\n\n/**\n * account type enum\n */\nexport enum ACCOUNT_TYPE {\n /** normal account */\n NORMAL = 'normal',\n\n /** multisig account */\n MULTISIG = 'multisig',\n\n /** proxy account */\n PROXY = 'proxy',\n\n /** smart contract account */\n CONTRACT = 'contract',\n}\n"]}
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,13 +1,123 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { b as ACCOUNT_TYPE, A as Account, a as AccountBalance } from '../account-DElDu01m.cjs';
|
|
3
|
-
import { a as Connector } from '../connector-BjPpWk_D.cjs';
|
|
4
|
-
export { C as ConnectorLinks, S as Signer, W as WalletConnectConnectorOptions } from '../connector-BjPpWk_D.cjs';
|
|
1
|
+
import { KeypairType, InjectedSigner } from 'dedot/types';
|
|
5
2
|
import { ApiOptions } from 'dedot';
|
|
6
3
|
import { AnyShape } from 'dedot/shape';
|
|
7
|
-
import '
|
|
8
|
-
import '
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
import { Metadata } from '@walletconnect/universal-provider';
|
|
5
|
+
import { EventEmitter } from 'eventemitter3';
|
|
6
|
+
export { PolkadotSigner as PapiSigner } from '@polkadot-api/pjs-signer';
|
|
7
|
+
|
|
8
|
+
type HexString = `0x${string}`;
|
|
9
|
+
/**
|
|
10
|
+
* Polkadot account interface
|
|
11
|
+
* Represents a chain account
|
|
12
|
+
*/
|
|
13
|
+
interface Account {
|
|
14
|
+
/**
|
|
15
|
+
* account address (original format from wallet)
|
|
16
|
+
* specific SS58 formatting should be done in the React layer based on the chain.
|
|
17
|
+
*/
|
|
18
|
+
address: string;
|
|
19
|
+
/** account name (if any) */
|
|
20
|
+
name?: string;
|
|
21
|
+
/**
|
|
22
|
+
* account public key (hex format, without 0x prefix)
|
|
23
|
+
* used for cross-chain address conversion and verification
|
|
24
|
+
*/
|
|
25
|
+
publicKey?: HexString;
|
|
26
|
+
/**
|
|
27
|
+
* other metadata
|
|
28
|
+
* including account source, control method, etc.
|
|
29
|
+
*/
|
|
30
|
+
meta?: {
|
|
31
|
+
/** account source (e.g. 'polkadot-js', 'subwallet-js', 'talisman' etc.) */
|
|
32
|
+
source?: string;
|
|
33
|
+
/** genesis hash (if the wallet provides a specific chain account) */
|
|
34
|
+
genesisHash?: string | null;
|
|
35
|
+
/** other custom metadata */
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
};
|
|
38
|
+
type?: KeypairType;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* account balance information
|
|
42
|
+
*/
|
|
43
|
+
interface AccountBalance {
|
|
44
|
+
/** available balance (in smallest unit) */
|
|
45
|
+
free: bigint;
|
|
46
|
+
/** total balance (in smallest unit) */
|
|
47
|
+
total: bigint;
|
|
48
|
+
/** reserved balance (in smallest unit) */
|
|
49
|
+
reserved: bigint;
|
|
50
|
+
/**
|
|
51
|
+
* transferable balance (in smallest unit)
|
|
52
|
+
* free minus various locked amounts
|
|
53
|
+
*/
|
|
54
|
+
transferable: bigint;
|
|
55
|
+
/** formatted available balance (with unit, for display) */
|
|
56
|
+
formattedTransferable: string;
|
|
57
|
+
/** formatted total balance (with unit, for display) */
|
|
58
|
+
formattedTotal: string;
|
|
59
|
+
/** lock details (if any) */
|
|
60
|
+
locks?: Array<{
|
|
61
|
+
id: string;
|
|
62
|
+
amount: bigint;
|
|
63
|
+
reason: string;
|
|
64
|
+
lockHuman: string;
|
|
65
|
+
}>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* account type enum
|
|
69
|
+
*/
|
|
70
|
+
declare enum ACCOUNT_TYPE {
|
|
71
|
+
/** normal account */
|
|
72
|
+
NORMAL = "normal",
|
|
73
|
+
/** multisig account */
|
|
74
|
+
MULTISIG = "multisig",
|
|
75
|
+
/** proxy account */
|
|
76
|
+
PROXY = "proxy",
|
|
77
|
+
/** smart contract account */
|
|
78
|
+
CONTRACT = "contract"
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface Signer extends InjectedSigner {
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface ConnectorLinks {
|
|
85
|
+
browserExtension?: string;
|
|
86
|
+
deepLink?: string;
|
|
87
|
+
}
|
|
88
|
+
interface Connector extends EventEmitter {
|
|
89
|
+
readonly id: string;
|
|
90
|
+
readonly name: string;
|
|
91
|
+
readonly icon: string;
|
|
92
|
+
readonly links: ConnectorLinks;
|
|
93
|
+
isAvailable(): Promise<boolean>;
|
|
94
|
+
isInstalled: () => boolean;
|
|
95
|
+
connect(appName: string, chains?: Chain[], targetChainId?: string): Promise<Account[] | undefined>;
|
|
96
|
+
disconnect(): Promise<void>;
|
|
97
|
+
getAccounts(): Promise<Array<Account>>;
|
|
98
|
+
getSigner(): Promise<Signer | undefined>;
|
|
99
|
+
signMessage(message: string, address: string): Promise<string | undefined>;
|
|
100
|
+
hasConnectionUri(): boolean;
|
|
101
|
+
getConnectionUri(): Promise<string | undefined>;
|
|
102
|
+
on(event: 'connect', listener: (accounts: Account[]) => void): this;
|
|
103
|
+
on(event: 'disconnect', listener: () => void): this;
|
|
104
|
+
on(event: 'accountsChanged', listener: (accounts: Account[]) => void): this;
|
|
105
|
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
106
|
+
off(event: 'connect', listener: (accounts: Account[]) => void): this;
|
|
107
|
+
off(event: 'disconnect', listener: () => void): this;
|
|
108
|
+
off(event: 'accountsChanged', listener: (accounts: Account[]) => void): this;
|
|
109
|
+
off(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
110
|
+
}
|
|
111
|
+
interface WalletConnectConnectorOptions {
|
|
112
|
+
id?: string;
|
|
113
|
+
name?: string;
|
|
114
|
+
icon?: string;
|
|
115
|
+
projectId: string;
|
|
116
|
+
relayUrl?: string;
|
|
117
|
+
metadata?: Metadata;
|
|
118
|
+
links?: ConnectorLinks;
|
|
119
|
+
supportedChains?: HexString[];
|
|
120
|
+
}
|
|
11
121
|
|
|
12
122
|
interface RawStorage {
|
|
13
123
|
getItem(key: string): string | null | Promise<string | null>;
|
|
@@ -19,18 +129,23 @@ interface LunoStorage {
|
|
|
19
129
|
setItem(keySuffix: string, value: string): Promise<void>;
|
|
20
130
|
removeItem(keySuffix: string): Promise<void>;
|
|
21
131
|
}
|
|
22
|
-
type Transport = string
|
|
132
|
+
type Transport = Readonly<string[]>;
|
|
23
133
|
type LunoApiOptions = Partial<Omit<ApiOptions, 'provider' | 'signer'>> & {
|
|
24
134
|
customTypes?: Record<string, AnyShape>;
|
|
25
135
|
customRpc?: Record<string, any>;
|
|
26
136
|
};
|
|
27
137
|
interface CreateConfigParameters extends LunoApiOptions {
|
|
28
138
|
appName?: string;
|
|
29
|
-
chains
|
|
139
|
+
chains?: readonly Chain[];
|
|
30
140
|
connectors: Connector[];
|
|
31
141
|
transports?: Record<string, Transport>;
|
|
32
142
|
storage?: LunoStorage;
|
|
33
143
|
autoConnect?: boolean;
|
|
144
|
+
subscan?: {
|
|
145
|
+
apiKey: string;
|
|
146
|
+
cacheTime?: number;
|
|
147
|
+
retryCount?: number;
|
|
148
|
+
};
|
|
34
149
|
}
|
|
35
150
|
interface Config extends LunoApiOptions {
|
|
36
151
|
readonly appName: string;
|
|
@@ -39,6 +154,42 @@ interface Config extends LunoApiOptions {
|
|
|
39
154
|
readonly transports: Readonly<Record<string, Transport>>;
|
|
40
155
|
readonly storage: LunoStorage;
|
|
41
156
|
readonly autoConnect: boolean;
|
|
157
|
+
readonly subscan?: {
|
|
158
|
+
apiKey: string;
|
|
159
|
+
cacheTime?: number;
|
|
160
|
+
retryCount?: number;
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
interface Chain {
|
|
165
|
+
genesisHash: HexString;
|
|
166
|
+
name: string;
|
|
167
|
+
nativeCurrency: {
|
|
168
|
+
name: string;
|
|
169
|
+
symbol: string;
|
|
170
|
+
decimals: number;
|
|
171
|
+
};
|
|
172
|
+
rpcUrls: {
|
|
173
|
+
webSocket: Transport;
|
|
174
|
+
http?: readonly string[];
|
|
175
|
+
};
|
|
176
|
+
ss58Format: number;
|
|
177
|
+
blockExplorers?: {
|
|
178
|
+
default?: {
|
|
179
|
+
name: string;
|
|
180
|
+
url: string;
|
|
181
|
+
};
|
|
182
|
+
[key: string]: {
|
|
183
|
+
name: string;
|
|
184
|
+
url: string;
|
|
185
|
+
} | undefined;
|
|
186
|
+
};
|
|
187
|
+
testnet: boolean;
|
|
188
|
+
chainIconUrl: string;
|
|
189
|
+
subscan?: {
|
|
190
|
+
api: string;
|
|
191
|
+
url: string;
|
|
192
|
+
};
|
|
42
193
|
}
|
|
43
194
|
|
|
44
|
-
export { Chain, type Config, Connector, type CreateConfigParameters, type LunoStorage, type RawStorage, type Transport };
|
|
195
|
+
export { ACCOUNT_TYPE, type Account, type AccountBalance, type Chain, type Config, type Connector, type ConnectorLinks, type CreateConfigParameters, type HexString, type LunoStorage, type RawStorage, type Signer, type Transport, type WalletConnectConnectorOptions };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,13 +1,123 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { b as ACCOUNT_TYPE, A as Account, a as AccountBalance } from '../account-DElDu01m.js';
|
|
3
|
-
import { a as Connector } from '../connector-6qzOSWQP.js';
|
|
4
|
-
export { C as ConnectorLinks, S as Signer, W as WalletConnectConnectorOptions } from '../connector-6qzOSWQP.js';
|
|
1
|
+
import { KeypairType, InjectedSigner } from 'dedot/types';
|
|
5
2
|
import { ApiOptions } from 'dedot';
|
|
6
3
|
import { AnyShape } from 'dedot/shape';
|
|
7
|
-
import '
|
|
8
|
-
import '
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
import { Metadata } from '@walletconnect/universal-provider';
|
|
5
|
+
import { EventEmitter } from 'eventemitter3';
|
|
6
|
+
export { PolkadotSigner as PapiSigner } from '@polkadot-api/pjs-signer';
|
|
7
|
+
|
|
8
|
+
type HexString = `0x${string}`;
|
|
9
|
+
/**
|
|
10
|
+
* Polkadot account interface
|
|
11
|
+
* Represents a chain account
|
|
12
|
+
*/
|
|
13
|
+
interface Account {
|
|
14
|
+
/**
|
|
15
|
+
* account address (original format from wallet)
|
|
16
|
+
* specific SS58 formatting should be done in the React layer based on the chain.
|
|
17
|
+
*/
|
|
18
|
+
address: string;
|
|
19
|
+
/** account name (if any) */
|
|
20
|
+
name?: string;
|
|
21
|
+
/**
|
|
22
|
+
* account public key (hex format, without 0x prefix)
|
|
23
|
+
* used for cross-chain address conversion and verification
|
|
24
|
+
*/
|
|
25
|
+
publicKey?: HexString;
|
|
26
|
+
/**
|
|
27
|
+
* other metadata
|
|
28
|
+
* including account source, control method, etc.
|
|
29
|
+
*/
|
|
30
|
+
meta?: {
|
|
31
|
+
/** account source (e.g. 'polkadot-js', 'subwallet-js', 'talisman' etc.) */
|
|
32
|
+
source?: string;
|
|
33
|
+
/** genesis hash (if the wallet provides a specific chain account) */
|
|
34
|
+
genesisHash?: string | null;
|
|
35
|
+
/** other custom metadata */
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
};
|
|
38
|
+
type?: KeypairType;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* account balance information
|
|
42
|
+
*/
|
|
43
|
+
interface AccountBalance {
|
|
44
|
+
/** available balance (in smallest unit) */
|
|
45
|
+
free: bigint;
|
|
46
|
+
/** total balance (in smallest unit) */
|
|
47
|
+
total: bigint;
|
|
48
|
+
/** reserved balance (in smallest unit) */
|
|
49
|
+
reserved: bigint;
|
|
50
|
+
/**
|
|
51
|
+
* transferable balance (in smallest unit)
|
|
52
|
+
* free minus various locked amounts
|
|
53
|
+
*/
|
|
54
|
+
transferable: bigint;
|
|
55
|
+
/** formatted available balance (with unit, for display) */
|
|
56
|
+
formattedTransferable: string;
|
|
57
|
+
/** formatted total balance (with unit, for display) */
|
|
58
|
+
formattedTotal: string;
|
|
59
|
+
/** lock details (if any) */
|
|
60
|
+
locks?: Array<{
|
|
61
|
+
id: string;
|
|
62
|
+
amount: bigint;
|
|
63
|
+
reason: string;
|
|
64
|
+
lockHuman: string;
|
|
65
|
+
}>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* account type enum
|
|
69
|
+
*/
|
|
70
|
+
declare enum ACCOUNT_TYPE {
|
|
71
|
+
/** normal account */
|
|
72
|
+
NORMAL = "normal",
|
|
73
|
+
/** multisig account */
|
|
74
|
+
MULTISIG = "multisig",
|
|
75
|
+
/** proxy account */
|
|
76
|
+
PROXY = "proxy",
|
|
77
|
+
/** smart contract account */
|
|
78
|
+
CONTRACT = "contract"
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface Signer extends InjectedSigner {
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface ConnectorLinks {
|
|
85
|
+
browserExtension?: string;
|
|
86
|
+
deepLink?: string;
|
|
87
|
+
}
|
|
88
|
+
interface Connector extends EventEmitter {
|
|
89
|
+
readonly id: string;
|
|
90
|
+
readonly name: string;
|
|
91
|
+
readonly icon: string;
|
|
92
|
+
readonly links: ConnectorLinks;
|
|
93
|
+
isAvailable(): Promise<boolean>;
|
|
94
|
+
isInstalled: () => boolean;
|
|
95
|
+
connect(appName: string, chains?: Chain[], targetChainId?: string): Promise<Account[] | undefined>;
|
|
96
|
+
disconnect(): Promise<void>;
|
|
97
|
+
getAccounts(): Promise<Array<Account>>;
|
|
98
|
+
getSigner(): Promise<Signer | undefined>;
|
|
99
|
+
signMessage(message: string, address: string): Promise<string | undefined>;
|
|
100
|
+
hasConnectionUri(): boolean;
|
|
101
|
+
getConnectionUri(): Promise<string | undefined>;
|
|
102
|
+
on(event: 'connect', listener: (accounts: Account[]) => void): this;
|
|
103
|
+
on(event: 'disconnect', listener: () => void): this;
|
|
104
|
+
on(event: 'accountsChanged', listener: (accounts: Account[]) => void): this;
|
|
105
|
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
106
|
+
off(event: 'connect', listener: (accounts: Account[]) => void): this;
|
|
107
|
+
off(event: 'disconnect', listener: () => void): this;
|
|
108
|
+
off(event: 'accountsChanged', listener: (accounts: Account[]) => void): this;
|
|
109
|
+
off(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
110
|
+
}
|
|
111
|
+
interface WalletConnectConnectorOptions {
|
|
112
|
+
id?: string;
|
|
113
|
+
name?: string;
|
|
114
|
+
icon?: string;
|
|
115
|
+
projectId: string;
|
|
116
|
+
relayUrl?: string;
|
|
117
|
+
metadata?: Metadata;
|
|
118
|
+
links?: ConnectorLinks;
|
|
119
|
+
supportedChains?: HexString[];
|
|
120
|
+
}
|
|
11
121
|
|
|
12
122
|
interface RawStorage {
|
|
13
123
|
getItem(key: string): string | null | Promise<string | null>;
|
|
@@ -19,18 +129,23 @@ interface LunoStorage {
|
|
|
19
129
|
setItem(keySuffix: string, value: string): Promise<void>;
|
|
20
130
|
removeItem(keySuffix: string): Promise<void>;
|
|
21
131
|
}
|
|
22
|
-
type Transport = string
|
|
132
|
+
type Transport = Readonly<string[]>;
|
|
23
133
|
type LunoApiOptions = Partial<Omit<ApiOptions, 'provider' | 'signer'>> & {
|
|
24
134
|
customTypes?: Record<string, AnyShape>;
|
|
25
135
|
customRpc?: Record<string, any>;
|
|
26
136
|
};
|
|
27
137
|
interface CreateConfigParameters extends LunoApiOptions {
|
|
28
138
|
appName?: string;
|
|
29
|
-
chains
|
|
139
|
+
chains?: readonly Chain[];
|
|
30
140
|
connectors: Connector[];
|
|
31
141
|
transports?: Record<string, Transport>;
|
|
32
142
|
storage?: LunoStorage;
|
|
33
143
|
autoConnect?: boolean;
|
|
144
|
+
subscan?: {
|
|
145
|
+
apiKey: string;
|
|
146
|
+
cacheTime?: number;
|
|
147
|
+
retryCount?: number;
|
|
148
|
+
};
|
|
34
149
|
}
|
|
35
150
|
interface Config extends LunoApiOptions {
|
|
36
151
|
readonly appName: string;
|
|
@@ -39,6 +154,42 @@ interface Config extends LunoApiOptions {
|
|
|
39
154
|
readonly transports: Readonly<Record<string, Transport>>;
|
|
40
155
|
readonly storage: LunoStorage;
|
|
41
156
|
readonly autoConnect: boolean;
|
|
157
|
+
readonly subscan?: {
|
|
158
|
+
apiKey: string;
|
|
159
|
+
cacheTime?: number;
|
|
160
|
+
retryCount?: number;
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
interface Chain {
|
|
165
|
+
genesisHash: HexString;
|
|
166
|
+
name: string;
|
|
167
|
+
nativeCurrency: {
|
|
168
|
+
name: string;
|
|
169
|
+
symbol: string;
|
|
170
|
+
decimals: number;
|
|
171
|
+
};
|
|
172
|
+
rpcUrls: {
|
|
173
|
+
webSocket: Transport;
|
|
174
|
+
http?: readonly string[];
|
|
175
|
+
};
|
|
176
|
+
ss58Format: number;
|
|
177
|
+
blockExplorers?: {
|
|
178
|
+
default?: {
|
|
179
|
+
name: string;
|
|
180
|
+
url: string;
|
|
181
|
+
};
|
|
182
|
+
[key: string]: {
|
|
183
|
+
name: string;
|
|
184
|
+
url: string;
|
|
185
|
+
} | undefined;
|
|
186
|
+
};
|
|
187
|
+
testnet: boolean;
|
|
188
|
+
chainIconUrl: string;
|
|
189
|
+
subscan?: {
|
|
190
|
+
api: string;
|
|
191
|
+
url: string;
|
|
192
|
+
};
|
|
42
193
|
}
|
|
43
194
|
|
|
44
|
-
export { Chain, type Config, Connector, type CreateConfigParameters, type LunoStorage, type RawStorage, type Transport };
|
|
195
|
+
export { ACCOUNT_TYPE, type Account, type AccountBalance, type Chain, type Config, type Connector, type ConnectorLinks, type CreateConfigParameters, type HexString, type LunoStorage, type RawStorage, type Signer, type Transport, type WalletConnectConnectorOptions };
|
package/dist/types/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var t=(r=>(r.NORMAL="normal",r.MULTISIG="multisig",r.PROXY="proxy",r.CONTRACT="contract",r))(t||{});export{t as ACCOUNT_TYPE};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/account.ts"],"names":["ACCOUNT_TYPE"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/types/account.ts"],"names":["ACCOUNT_TYPE"],"mappings":"AA8EO,IAAKA,CAAAA,CAAAA,CAAAA,CAAAA,GAEVA,CAAAA,CAAA,MAAA,CAAS,QAAA,CAGTA,CAAAA,CAAA,QAAA,CAAW,UAAA,CAGXA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CAGRA,CAAAA,CAAA,QAAA,CAAW,WAXDA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA","file":"index.js","sourcesContent":["import type { KeypairType } from 'dedot/types';\n\nexport type HexString = `0x${string}`;\n\n/**\n * Polkadot account interface\n * Represents a chain account\n */\nexport interface Account {\n /**\n * account address (original format from wallet)\n * specific SS58 formatting should be done in the React layer based on the chain.\n */\n address: string;\n\n /** account name (if any) */\n name?: string;\n\n /**\n * account public key (hex format, without 0x prefix)\n * used for cross-chain address conversion and verification\n */\n publicKey?: HexString;\n\n /**\n * other metadata\n * including account source, control method, etc.\n */\n meta?: {\n /** account source (e.g. 'polkadot-js', 'subwallet-js', 'talisman' etc.) */\n source?: string;\n\n /** genesis hash (if the wallet provides a specific chain account) */\n genesisHash?: string | null;\n\n /** other custom metadata */\n [key: string]: any;\n };\n type?: KeypairType;\n}\n\n/**\n * account balance information\n */\nexport interface AccountBalance {\n /** available balance (in smallest unit) */\n free: bigint;\n\n /** total balance (in smallest unit) */\n total: bigint;\n\n /** reserved balance (in smallest unit) */\n reserved: bigint;\n\n /**\n * transferable balance (in smallest unit)\n * free minus various locked amounts\n */\n transferable: bigint;\n\n /** formatted available balance (with unit, for display) */\n formattedTransferable: string;\n\n /** formatted total balance (with unit, for display) */\n formattedTotal: string;\n\n /** lock details (if any) */\n locks?: Array<{\n id: string;\n amount: bigint;\n reason: string;\n lockHuman: string;\n }>;\n}\n\n/**\n * account type enum\n */\nexport enum ACCOUNT_TYPE {\n /** normal account */\n NORMAL = 'normal',\n\n /** multisig account */\n MULTISIG = 'multisig',\n\n /** proxy account */\n PROXY = 'proxy',\n\n /** smart contract account */\n CONTRACT = 'contract',\n}\n"]}
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkUXRZAYEH_cjs=require('../chunk-UXRZAYEH.cjs');Object.defineProperty(exports,"convertAddress",{enumerable:true,get:function(){return chunkUXRZAYEH_cjs.b}});Object.defineProperty(exports,"createPapiSigner",{enumerable:true,get:function(){return chunkUXRZAYEH_cjs.m}});Object.defineProperty(exports,"defineChain",{enumerable:true,get:function(){return chunkUXRZAYEH_cjs.f}});Object.defineProperty(exports,"formatAddress",{enumerable:true,get:function(){return chunkUXRZAYEH_cjs.k}});Object.defineProperty(exports,"formatBalance",{enumerable:true,get:function(){return chunkUXRZAYEH_cjs.j}});Object.defineProperty(exports,"formatBalanceWithUnit",{enumerable:true,get:function(){return chunkUXRZAYEH_cjs.l}});Object.defineProperty(exports,"getChainToken",{enumerable:true,get:function(){return chunkUXRZAYEH_cjs.g}});Object.defineProperty(exports,"getExplorerUrl",{enumerable:true,get:function(){return chunkUXRZAYEH_cjs.h}});Object.defineProperty(exports,"getPublicKey",{enumerable:true,get:function(){return chunkUXRZAYEH_cjs.d}});Object.defineProperty(exports,"isMobileDevice",{enumerable:true,get:function(){return chunkUXRZAYEH_cjs.i}});Object.defineProperty(exports,"isSameAddress",{enumerable:true,get:function(){return chunkUXRZAYEH_cjs.c}});Object.defineProperty(exports,"isValidAddress",{enumerable:true,get:function(){return chunkUXRZAYEH_cjs.a}});Object.defineProperty(exports,"mapInjectedAccounts",{enumerable:true,get:function(){return chunkUXRZAYEH_cjs.e}});//# sourceMappingURL=index.cjs.map
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { A as Account } from '../account-DElDu01m.cjs';
|
|
2
1
|
import { InjectedAccount } from 'dedot/types';
|
|
3
|
-
import {
|
|
2
|
+
import { Account, Chain, Signer } from '../types/index.cjs';
|
|
3
|
+
import { PolkadotSigner } from '@polkadot-api/pjs-signer';
|
|
4
|
+
export { PolkadotSigner as PapiSigner } from '@polkadot-api/pjs-signer';
|
|
4
5
|
export { formatBalance as formatBalanceWithUnit } from 'dedot/utils';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
declare function formatBalance(value: string | number | bigint | undefined, decimals?: number, fixedDecimals?: number): string;
|
|
10
|
-
/**
|
|
11
|
-
* format address display
|
|
12
|
-
*/
|
|
13
|
-
declare function formatAddress(address?: string, prefixLength?: number, suffixLength?: number): string;
|
|
6
|
+
import 'dedot';
|
|
7
|
+
import 'dedot/shape';
|
|
8
|
+
import '@walletconnect/universal-provider';
|
|
9
|
+
import 'eventemitter3';
|
|
14
10
|
|
|
15
11
|
/**
|
|
16
12
|
* check if address is valid
|
|
@@ -40,4 +36,15 @@ declare function getExplorerUrl(explorerUrl?: string, data?: string, type?: 'tra
|
|
|
40
36
|
|
|
41
37
|
declare const isMobileDevice: () => boolean;
|
|
42
38
|
|
|
43
|
-
|
|
39
|
+
/**
|
|
40
|
+
* format balance
|
|
41
|
+
*/
|
|
42
|
+
declare function formatBalance(value: string | number | bigint | undefined, decimals?: number, fixedDecimals?: number): string;
|
|
43
|
+
/**
|
|
44
|
+
* format address display
|
|
45
|
+
*/
|
|
46
|
+
declare function formatAddress(address?: string, prefixLength?: number, suffixLength?: number): string;
|
|
47
|
+
|
|
48
|
+
declare function createPapiSigner(address: string, signer: Signer): Promise<PolkadotSigner | undefined>;
|
|
49
|
+
|
|
50
|
+
export { convertAddress, createPapiSigner, defineChain, formatAddress, formatBalance, getChainToken, getExplorerUrl, getPublicKey, isMobileDevice, isSameAddress, isValidAddress, mapInjectedAccounts };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { A as Account } from '../account-DElDu01m.js';
|
|
2
1
|
import { InjectedAccount } from 'dedot/types';
|
|
3
|
-
import {
|
|
2
|
+
import { Account, Chain, Signer } from '../types/index.js';
|
|
3
|
+
import { PolkadotSigner } from '@polkadot-api/pjs-signer';
|
|
4
|
+
export { PolkadotSigner as PapiSigner } from '@polkadot-api/pjs-signer';
|
|
4
5
|
export { formatBalance as formatBalanceWithUnit } from 'dedot/utils';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
declare function formatBalance(value: string | number | bigint | undefined, decimals?: number, fixedDecimals?: number): string;
|
|
10
|
-
/**
|
|
11
|
-
* format address display
|
|
12
|
-
*/
|
|
13
|
-
declare function formatAddress(address?: string, prefixLength?: number, suffixLength?: number): string;
|
|
6
|
+
import 'dedot';
|
|
7
|
+
import 'dedot/shape';
|
|
8
|
+
import '@walletconnect/universal-provider';
|
|
9
|
+
import 'eventemitter3';
|
|
14
10
|
|
|
15
11
|
/**
|
|
16
12
|
* check if address is valid
|
|
@@ -40,4 +36,15 @@ declare function getExplorerUrl(explorerUrl?: string, data?: string, type?: 'tra
|
|
|
40
36
|
|
|
41
37
|
declare const isMobileDevice: () => boolean;
|
|
42
38
|
|
|
43
|
-
|
|
39
|
+
/**
|
|
40
|
+
* format balance
|
|
41
|
+
*/
|
|
42
|
+
declare function formatBalance(value: string | number | bigint | undefined, decimals?: number, fixedDecimals?: number): string;
|
|
43
|
+
/**
|
|
44
|
+
* format address display
|
|
45
|
+
*/
|
|
46
|
+
declare function formatAddress(address?: string, prefixLength?: number, suffixLength?: number): string;
|
|
47
|
+
|
|
48
|
+
declare function createPapiSigner(address: string, signer: Signer): Promise<PolkadotSigner | undefined>;
|
|
49
|
+
|
|
50
|
+
export { convertAddress, createPapiSigner, defineChain, formatAddress, formatBalance, getChainToken, getExplorerUrl, getPublicKey, isMobileDevice, isSameAddress, isValidAddress, mapInjectedAccounts };
|