@33cn/wallet-api
Advanced tools
Comparing version 1.3.0 to 1.3.1
export declare function callAndroidHandler(event: any, params?: any): Promise<{}>; | ||
export declare function androidGetCurrentBTYAddress(): Promise<{}>; | ||
export declare function androidSignRawTransaction(tx: string): Promise<{}>; | ||
export declare function androidSignRawTransaction(tx: string, cachePriv?: number): Promise<{}>; | ||
export declare function androidSignTransactionGroup(tx: string, exer?: string): Promise<{}>; | ||
export declare function androidClearPrivCache(): Promise<{}>; |
@@ -37,4 +37,4 @@ var bridgeName = 'WebViewJavascriptBridge'; | ||
} | ||
export function androidSignRawTransaction(tx) { | ||
return callAndroidHandler('sign', { createHash: tx }); | ||
export function androidSignRawTransaction(tx, cachePriv) { | ||
return callAndroidHandler('sign', { createHash: tx, cachePriv: cachePriv }); | ||
} | ||
@@ -44,2 +44,5 @@ export function androidSignTransactionGroup(tx, exer) { | ||
} | ||
export function androidClearPrivCache() { | ||
return callAndroidHandler('sendFinish'); | ||
} | ||
//# sourceMappingURL=androidJsBridge.js.map |
export declare function getCurrentBTYAddress(): Promise<any>; | ||
export declare function signTx(tx: string, title: string, address: string): Promise<any>; | ||
/** | ||
* @description 签名 | ||
* @param tx 未签名tx | ||
* @param title 标题 pc钱包,轻钱包必须 | ||
* @param address 地址 pc钱包必须 | ||
* @param cachePriv 是否缓存私钥 币钱包可用 | ||
*/ | ||
export declare function signTx(tx: string, title: string, address: string, cachePriv?: number): Promise<any>; | ||
/** | ||
* @description 请求构造代扣交易组并签名 | ||
@@ -12,1 +19,7 @@ * @export | ||
export declare function signTxGroup(tx: string, exer?: string): Promise<any>; | ||
/** | ||
* @description 清除钱包私钥缓存 | ||
* @export | ||
* @returns {Promise<any>} | ||
*/ | ||
export declare function clearPrivCache(): Promise<any>; |
import { Environment, getDappEnvironment, getDappEnvironmentDelay } from './dappEnvironment'; | ||
import { androidGetCurrentBTYAddress, androidSignRawTransaction, androidSignTransactionGroup } from './androidJsBridge'; | ||
import { iosGetCurrentBTYAddress, iosSignRawTransaction, iosSignTransactionGroup } from './iosJsBridge'; | ||
import { androidGetCurrentBTYAddress, androidSignRawTransaction, androidSignTransactionGroup, androidClearPrivCache } from './androidJsBridge'; | ||
import { iosGetCurrentBTYAddress, iosSignRawTransaction, iosSignTransactionGroup, iosClearPrivCache } from './iosJsBridge'; | ||
var myWindow = window; | ||
@@ -28,3 +28,11 @@ export function getCurrentBTYAddress() { | ||
} | ||
export function signTx(tx, title, address) { | ||
/** | ||
* @description 签名 | ||
* @param tx 未签名tx | ||
* @param title 标题 pc钱包,轻钱包必须 | ||
* @param address 地址 pc钱包必须 | ||
* @param cachePriv 是否缓存私钥 币钱包可用 | ||
*/ | ||
export function signTx(tx, title, address, cachePriv) { | ||
if (cachePriv === void 0) { cachePriv = 0; } | ||
switch (getDappEnvironment()) { | ||
@@ -51,3 +59,3 @@ case Environment.pcWallet: | ||
case Environment.androidBiWallet: | ||
return androidSignRawTransaction(tx).then(function (res) { | ||
return androidSignRawTransaction(tx, cachePriv).then(function (res) { | ||
console.log('打印Android签名结果', res); | ||
@@ -62,3 +70,3 @@ if (res.error) { | ||
case Environment.iosBiWallet: | ||
return iosSignRawTransaction(tx).then(function (res) { | ||
return iosSignRawTransaction(tx, cachePriv).then(function (res) { | ||
console.log('打印IOS签名结果', res); | ||
@@ -110,2 +118,19 @@ if (res.error) { | ||
} | ||
/** | ||
* @description 清除钱包私钥缓存 | ||
* @export | ||
* @returns {Promise<any>} | ||
*/ | ||
export function clearPrivCache() { | ||
switch (getDappEnvironment()) { | ||
case Environment.androidBiWallet: | ||
console.log('android 清除钱包私钥缓存'); | ||
return androidClearPrivCache(); | ||
case Environment.iosBiWallet: | ||
console.log('ios 清除钱包私钥缓存'); | ||
return iosClearPrivCache(); | ||
default: | ||
return Promise.reject('invalidEnvironment'); | ||
} | ||
} | ||
//# sourceMappingURL=index.js.map |
export declare function callIOSHandler(event: any, params?: any): Promise<{}>; | ||
export declare function iosGetCurrentBTYAddress(): Promise<{}>; | ||
export declare function iosSignRawTransaction(tx: string): Promise<{}>; | ||
export declare function iosSignRawTransaction(tx: string, cachePriv?: number): Promise<{}>; | ||
export declare function iosSignTransactionGroup(tx: string, exer?: string): Promise<{}>; | ||
export declare function iosClearPrivCache(): Promise<{}>; |
@@ -33,4 +33,4 @@ /** disale tslint */ | ||
} | ||
export function iosSignRawTransaction(tx) { | ||
return callIOSHandler('sign', { createHash: tx }); | ||
export function iosSignRawTransaction(tx, cachePriv) { | ||
return callIOSHandler('sign', { createHash: tx, cachePriv: cachePriv }); | ||
} | ||
@@ -40,2 +40,5 @@ export function iosSignTransactionGroup(tx, exer) { | ||
} | ||
export function iosClearPrivCache() { | ||
return callIOSHandler('sendFinish'); | ||
} | ||
//# sourceMappingURL=iosJsBridge.js.map |
{ | ||
"name": "@33cn/wallet-api", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "提供各种比特元钱包的获取地址、签名接口", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -0,0 +0,0 @@ { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
23363
20
371
1