@33cn/wallet-api
Advanced tools
Comparing version 1.1.0 to 1.2.0
export declare function callAndroidHandler(event: any, params?: any): Promise<{}>; | ||
export declare function androidGetCurrentBTYAddress(): Promise<{}>; | ||
export declare function androidSignRawTransaction(tx: string): Promise<{}>; | ||
export declare function androidSignTransactionGroup(tx: string): Promise<{}>; |
@@ -40,2 +40,5 @@ var bridgeName = 'WebViewJavascriptBridge'; | ||
} | ||
export function androidSignTransactionGroup(tx) { | ||
return callAndroidHandler('signTxGroup', { createHash: tx }); | ||
} | ||
//# sourceMappingURL=androidJsBridge.js.map |
export declare function getCurrentBTYAddress(): Promise<any>; | ||
export declare function signTx(tx: string, title: string, address: string): Promise<any>; | ||
/** | ||
* @description 请求构造代扣交易组并签名 | ||
* @export | ||
* @param {string} tx | ||
* @param {string} title | ||
* @param {string} address | ||
* @returns {Promise<any>} | ||
*/ | ||
export declare function signTxGroup(tx: string, title: string, address: string): Promise<any>; |
import { Environment, getDappEnvironment, getDappEnvironmentDelay } from './dappEnvironment'; | ||
import { androidGetCurrentBTYAddress, androidSignRawTransaction } from './androidJsBridge'; | ||
import { iosGetCurrentBTYAddress, iosSignRawTransaction } from './iosJsBridge'; | ||
import { androidGetCurrentBTYAddress, androidSignRawTransaction, androidSignTransactionGroup } from './androidJsBridge'; | ||
import { iosGetCurrentBTYAddress, iosSignRawTransaction, iosSignTransactionGroup } from './iosJsBridge'; | ||
var myWindow = window; | ||
@@ -51,2 +51,3 @@ export function getCurrentBTYAddress() { | ||
return androidSignRawTransaction(tx).then(function (res) { | ||
console.log('打印Android签名结果', res); | ||
if (res.error) { | ||
@@ -56,3 +57,3 @@ return Promise.reject(res.error); | ||
else { | ||
return res.txhex; | ||
return res.signHash; | ||
} | ||
@@ -62,2 +63,3 @@ }); | ||
return iosSignRawTransaction(tx).then(function (res) { | ||
console.log('打印IOS签名结果', res); | ||
if (res.error) { | ||
@@ -67,3 +69,3 @@ return Promise.reject(res.error); | ||
else { | ||
return res.txhex; | ||
return res.signHash; | ||
} | ||
@@ -75,2 +77,36 @@ }); | ||
} | ||
/** | ||
* @description 请求构造代扣交易组并签名 | ||
* @export | ||
* @param {string} tx | ||
* @param {string} title | ||
* @param {string} address | ||
* @returns {Promise<any>} | ||
*/ | ||
export function signTxGroup(tx, title, address) { | ||
switch (getDappEnvironment()) { | ||
case Environment.androidBiWallet: | ||
return androidSignTransactionGroup(tx).then(function (res) { | ||
console.log('打印Android签名结果', res); | ||
if (res.error) { | ||
return Promise.reject(res.error); | ||
} | ||
else { | ||
return res.signHash; | ||
} | ||
}); | ||
case Environment.iosBiWallet: | ||
return iosSignTransactionGroup(tx).then(function (res) { | ||
console.log('打印IOS签名结果', res); | ||
if (res.error) { | ||
return Promise.reject(res.error); | ||
} | ||
else { | ||
return res.signHash; | ||
} | ||
}); | ||
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 iosSignTransactionGroup(tx: string): Promise<{}>; |
@@ -17,5 +17,5 @@ /** disale tslint */ | ||
WVJBIframe.src = "https://__bridge_loaded__"; | ||
document.documentElement && document.documentElement.appendChild(WVJBIframe); | ||
document.documentElement.appendChild(WVJBIframe); | ||
setTimeout(function () { | ||
document.documentElement && document.documentElement.removeChild(WVJBIframe); | ||
document.documentElement.removeChild(WVJBIframe); | ||
}, 0); | ||
@@ -37,2 +37,5 @@ } | ||
} | ||
export function iosSignTransactionGroup(tx) { | ||
return callIOSHandler('signTxGroup', { createHash: tx }); | ||
} | ||
//# sourceMappingURL=iosJsBridge.js.map |
{ | ||
"name": "@33cn/wallet-api", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"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
19733
319