@dcentralab/common
Advanced tools
Comparing version 0.0.7 to 0.1.1
@@ -22,1 +22,3 @@ import { IhdDerivationPath } from './interfaces'; | ||
export declare const TREZOR_PATHS: IhdDerivationPath; | ||
export declare const INPAGE_KEY = "63b16228-dfcb-46c0-969c-3b13b2acad7d"; | ||
export declare const WALLET_TYPE_LS_KEY = "738d28b6-82ae-458b-9178-2c94a9240ace"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TREZOR_PATHS = exports.HD_DERIVATION_PATHS = exports.WALLET_TYPES = exports.BLOCKCHAIN_TYPES = void 0; | ||
exports.WALLET_TYPE_LS_KEY = exports.INPAGE_KEY = exports.TREZOR_PATHS = exports.HD_DERIVATION_PATHS = exports.WALLET_TYPES = exports.BLOCKCHAIN_TYPES = void 0; | ||
exports.BLOCKCHAIN_TYPES = { | ||
@@ -38,2 +38,4 @@ evm: 'evm', | ||
}; | ||
exports.INPAGE_KEY = '63b16228-dfcb-46c0-969c-3b13b2acad7d'; | ||
exports.WALLET_TYPE_LS_KEY = '738d28b6-82ae-458b-9178-2c94a9240ace'; | ||
//# sourceMappingURL=contants.js.map |
import { BLOCKCHAIN_TYPES, WALLET_TYPES } from './contants'; | ||
export type BLOCKCHAIN_TYPE = typeof BLOCKCHAIN_TYPES[keyof typeof BLOCKCHAIN_TYPES]; | ||
export type TWalletType = (typeof WALLET_TYPES)[keyof typeof WALLET_TYPES]; | ||
export interface JsonRpcPayload { | ||
jsonrpc: string; | ||
method: string; | ||
params?: any[]; | ||
id?: string | number; | ||
} | ||
export interface JsonRpcResponse { | ||
jsonrpc: string; | ||
id: string | number; | ||
result?: any; | ||
error?: { | ||
readonly code?: number; | ||
readonly data?: unknown; | ||
readonly message: string; | ||
}; | ||
} | ||
export interface RequestArguments { | ||
method: string; | ||
params?: any; | ||
[key: string]: any; | ||
} | ||
export interface AbstractProvider { | ||
sendAsync(payload: JsonRpcPayload, callback?: (error: Error | null, result?: JsonRpcResponse) => Promise<unknown> | void): void; | ||
send?(payload: JsonRpcPayload, callback: (error: Error | null, result?: JsonRpcResponse) => unknown): void; | ||
request?(args: RequestArguments): Promise<any>; | ||
connected?: boolean; | ||
} | ||
export interface ICardanoProvider { | ||
getBalance: () => Promise<string>; | ||
signData: (address: string, payload: string) => Promise<ISignature>; | ||
getUsedAddresses: () => Promise<string[]>; | ||
getNetworkId: () => Promise<number>; | ||
experimental: { | ||
on: (eventName: string, callback: TCb) => void; | ||
off: (eventName: string, callback: TCb) => void; | ||
}; | ||
} | ||
export interface IBinanceProvider { | ||
chainId: string; | ||
autoRefreshOnNetworkChange: boolean; | ||
enable: () => void; | ||
removeAllListeners: () => void; | ||
selectedAddress: string; | ||
request?: (args: RequestArguments) => Promise<string>; | ||
on: (name: string, callback: (args?: any) => Promise<any> | void) => void; | ||
sendAsync(payload: JsonRpcPayload, callback: (error: Error | null, result?: JsonRpcResponse) => void): void; | ||
} | ||
export type TConnect = (connectingWalletType: string, options?: IConnectionOptions) => void; | ||
export type TDisconnect = (clearDerivationPath?: boolean) => void; | ||
export interface IConnectionOptions { | ||
@@ -15,2 +64,4 @@ rpcUrl?: string; | ||
showToast?: (msg: string, duration?: number) => any; | ||
connectWallet?: TConnect; | ||
disconnectWallet?: TDisconnect; | ||
} | ||
@@ -25,2 +76,3 @@ export interface IGetHWAccounts { | ||
provider: any; | ||
providerName?: string; | ||
} | ||
@@ -30,7 +82,14 @@ export interface IConnector { | ||
blockchainType: BLOCKCHAIN_TYPE; | ||
mobile?: boolean; | ||
mobile: boolean; | ||
enabled: () => boolean; | ||
connector: (opts: IConnectionOptions) => Promise<IConnectionResult>; | ||
disconnector?: () => Promise<void>; | ||
getAccount: (provider: AbstractProvider | IBinanceProvider | ICardanoProvider) => Promise<string | undefined>; | ||
getBalance: (provider: AbstractProvider | IBinanceProvider | ICardanoProvider, address: string) => Promise<string | undefined>; | ||
getHWAccounts?: (opts: IGetHWAccounts) => Promise<string[]>; | ||
showToast?: (msg: string, duration?: number) => void; | ||
localStorageKey?: string; | ||
connectWallet?: TConnect; | ||
disconnectWallet?: TDisconnect; | ||
unsubscribeEvents?: () => void; | ||
} | ||
@@ -44,2 +103,7 @@ interface ThdDerivationPath { | ||
} | ||
export type TCb = (params: any) => void; | ||
export interface ISignature { | ||
key: string; | ||
signature: string; | ||
} | ||
export {}; |
{ | ||
"name": "@dcentralab/common", | ||
"version": "0.0.7", | ||
"version": "0.1.1", | ||
"description": "Dcentralab common constants and utils", | ||
@@ -11,3 +11,4 @@ "main": "./lib/index.js", | ||
"prebuild": "rimraf lib", | ||
"prepublishOnly": "yarn build" | ||
"prepublishOnly": "yarn build", | ||
"release": "npm publish --access public" | ||
}, | ||
@@ -14,0 +15,0 @@ "author": "dcentralab", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8229
189