@33cn/wallet-api
Advanced tools
Comparing version 1.3.1 to 1.3.2
export declare function callAndroidHandler(event: any, params?: any): Promise<{}>; | ||
export declare function androidGetCurrentBTYAddress(): Promise<{}>; | ||
export declare function androidSignRawTransaction(tx: string, cachePriv?: number): Promise<{}>; | ||
export declare function androidSignRawTransaction(tx: string): Promise<{}>; | ||
export declare function androidSignTransactionGroup(tx: string, exer?: string): Promise<{}>; | ||
export declare function androidClearPrivCache(): Promise<{}>; | ||
export declare function androidConfigPrivCache(cachePriv: number): Promise<{}>; |
@@ -37,4 +37,4 @@ var bridgeName = 'WebViewJavascriptBridge'; | ||
} | ||
export function androidSignRawTransaction(tx, cachePriv) { | ||
return callAndroidHandler('sign', { createHash: tx, cachePriv: cachePriv }); | ||
export function androidSignRawTransaction(tx) { | ||
return callAndroidHandler('sign', { createHash: tx }); | ||
} | ||
@@ -44,5 +44,5 @@ export function androidSignTransactionGroup(tx, exer) { | ||
} | ||
export function androidClearPrivCache() { | ||
return callAndroidHandler('sendFinish'); | ||
export function androidConfigPrivCache(cachePriv) { | ||
return callAndroidHandler('configPriv', { cachePriv: cachePriv }); | ||
} | ||
//# sourceMappingURL=androidJsBridge.js.map |
@@ -7,5 +7,4 @@ export declare function getCurrentBTYAddress(): Promise<any>; | ||
* @param address 地址 pc钱包必须 | ||
* @param cachePriv 是否缓存私钥 币钱包可用 | ||
*/ | ||
export declare function signTx(tx: string, title: string, address: string, cachePriv?: number): Promise<any>; | ||
export declare function signTx(tx: string, title: string, address: string): Promise<any>; | ||
/** | ||
@@ -21,6 +20,7 @@ * @description 请求构造代扣交易组并签名 | ||
/** | ||
* @description 清除钱包私钥缓存 | ||
* @description 配置私钥缓存 0:默认 1:缓存私钥 -1:清除私钥 | ||
* @param {number} cachePriv | ||
* @export | ||
* @returns {Promise<any>} | ||
*/ | ||
export declare function clearPrivCache(): Promise<any>; | ||
export declare function configPrivCache(cachePriv?: number): Promise<any>; |
import { Environment, getDappEnvironment, getDappEnvironmentDelay } from './dappEnvironment'; | ||
import { androidGetCurrentBTYAddress, androidSignRawTransaction, androidSignTransactionGroup, androidClearPrivCache } from './androidJsBridge'; | ||
import { iosGetCurrentBTYAddress, iosSignRawTransaction, iosSignTransactionGroup, iosClearPrivCache } from './iosJsBridge'; | ||
import { androidGetCurrentBTYAddress, androidSignRawTransaction, androidSignTransactionGroup, androidConfigPrivCache } from './androidJsBridge'; | ||
import { iosGetCurrentBTYAddress, iosSignRawTransaction, iosSignTransactionGroup, iosConfigPrivCache } from './iosJsBridge'; | ||
var myWindow = window; | ||
@@ -33,6 +33,4 @@ export function getCurrentBTYAddress() { | ||
* @param address 地址 pc钱包必须 | ||
* @param cachePriv 是否缓存私钥 币钱包可用 | ||
*/ | ||
export function signTx(tx, title, address, cachePriv) { | ||
if (cachePriv === void 0) { cachePriv = 0; } | ||
export function signTx(tx, title, address) { | ||
switch (getDappEnvironment()) { | ||
@@ -59,3 +57,3 @@ case Environment.pcWallet: | ||
case Environment.androidBiWallet: | ||
return androidSignRawTransaction(tx, cachePriv).then(function (res) { | ||
return androidSignRawTransaction(tx).then(function (res) { | ||
console.log('打印Android签名结果', res); | ||
@@ -70,3 +68,3 @@ if (res.error) { | ||
case Environment.iosBiWallet: | ||
return iosSignRawTransaction(tx, cachePriv).then(function (res) { | ||
return iosSignRawTransaction(tx).then(function (res) { | ||
console.log('打印IOS签名结果', res); | ||
@@ -119,14 +117,16 @@ if (res.error) { | ||
/** | ||
* @description 清除钱包私钥缓存 | ||
* @description 配置私钥缓存 0:默认 1:缓存私钥 -1:清除私钥 | ||
* @param {number} cachePriv | ||
* @export | ||
* @returns {Promise<any>} | ||
*/ | ||
export function clearPrivCache() { | ||
export function configPrivCache(cachePriv) { | ||
if (cachePriv === void 0) { cachePriv = 0; } | ||
switch (getDappEnvironment()) { | ||
case Environment.androidBiWallet: | ||
console.log('android 清除钱包私钥缓存'); | ||
return androidClearPrivCache(); | ||
console.log("android \u94B1\u5305\u79C1\u94A5\u7F13\u5B58\u914D\u7F6E " + cachePriv); | ||
return androidConfigPrivCache(cachePriv); | ||
case Environment.iosBiWallet: | ||
console.log('ios 清除钱包私钥缓存'); | ||
return iosClearPrivCache(); | ||
console.log("ios \u94B1\u5305\u79C1\u94A5\u7F13\u5B58\u914D\u7F6E " + cachePriv); | ||
return iosConfigPrivCache(cachePriv); | ||
default: | ||
@@ -133,0 +133,0 @@ return Promise.reject('invalidEnvironment'); |
export declare function callIOSHandler(event: any, params?: any): Promise<{}>; | ||
export declare function iosGetCurrentBTYAddress(): Promise<{}>; | ||
export declare function iosSignRawTransaction(tx: string, cachePriv?: number): Promise<{}>; | ||
export declare function iosSignRawTransaction(tx: string): Promise<{}>; | ||
export declare function iosSignTransactionGroup(tx: string, exer?: string): Promise<{}>; | ||
export declare function iosClearPrivCache(): Promise<{}>; | ||
export declare function iosConfigPrivCache(cachePriv: number): Promise<{}>; |
@@ -33,4 +33,4 @@ /** disale tslint */ | ||
} | ||
export function iosSignRawTransaction(tx, cachePriv) { | ||
return callIOSHandler('sign', { createHash: tx, cachePriv: cachePriv }); | ||
export function iosSignRawTransaction(tx) { | ||
return callIOSHandler('sign', { createHash: tx }); | ||
} | ||
@@ -40,5 +40,5 @@ export function iosSignTransactionGroup(tx, exer) { | ||
} | ||
export function iosClearPrivCache() { | ||
return callIOSHandler('sendFinish'); | ||
export function iosConfigPrivCache(cachePriv) { | ||
return callIOSHandler('configPriv', { cachePriv: cachePriv }); | ||
} | ||
//# sourceMappingURL=iosJsBridge.js.map |
{ | ||
"name": "@33cn/wallet-api", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "提供各种比特元钱包的获取地址、签名接口", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
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
23491
0