Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@33cn/wallet-api

Package Overview
Dependencies
Maintainers
9
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@33cn/wallet-api - npm Package Compare versions

Comparing version 1.3.4 to 1.4.1-beta

13

dist/index.d.ts

@@ -0,1 +1,2 @@

import { ISignTxGroupCommon } from './type';
export declare function getCurrentBTYAddress(): Promise<any>;

@@ -25,1 +26,13 @@ /**

export declare function configPrivCache(cachePriv?: number): Promise<any>;
/**
* @description 交易组签名 兼容btypay
* @export
* @param {ISignTxGroupCommon} {
* tx: 交易hash,使用,连接 必须
* exer: 执行器 币钱包必须
* withhold: 是否代扣 -1 不代扣 1 代扣
* url 交易待发送的url
* }
* @returns {Promise<any>}
*/
export declare function signTxGroupCommon({ tx, exer, withhold, url }: ISignTxGroupCommon): Promise<any>;
import { Environment, getDappEnvironment, getDappEnvironmentDelay } from './dappEnvironment';
import { androidGetCurrentBTYAddress, androidSignRawTransaction, androidSignTransactionGroup, androidConfigPrivCache } from './androidJsBridge';
import { iosGetCurrentBTYAddress, iosSignRawTransaction, iosSignTransactionGroup, iosConfigPrivCache } from './iosJsBridge';
import BtyBaseSdk from '@33cn/chain33-rpc-api';
var chain33Rpc = new BtyBaseSdk('https://jiedian1.bityuan.com:8801', function (error) {
console.log('catch error ' + error);
});
var myWindow = window;

@@ -123,2 +127,4 @@ export function getCurrentBTYAddress() {

switch (getDappEnvironment()) {
case Environment.lightWallet:
return Promise.resolve(true);
case Environment.androidBiWallet:

@@ -145,2 +151,55 @@ return androidConfigPrivCache(cachePriv).then(function (res) {

}
/**
* @description 交易组签名 兼容btypay
* @export
* @param {ISignTxGroupCommon} {
* tx: 交易hash,使用,连接 必须
* exer: 执行器 币钱包必须
* withhold: 是否代扣 -1 不代扣 1 代扣
* url 交易待发送的url
* }
* @returns {Promise<any>}
*/
export function signTxGroupCommon(_a) {
var tx = _a.tx, exer = _a.exer, withhold = _a.withhold, url = _a.url;
switch (getDappEnvironment()) {
case Environment.lightWallet:
var txs = tx.split(',');
chain33Rpc.createRawTxGroup(txs, 'https://jiedian1.bityuan.com:8801').then(function (txs) {
return myWindow.btyExtensionProvider.signGroupTx({
tx: txs,
url: url,
isSend: false,
});
}).then(function (res) {
if (res.error) {
return Promise.reject(res.error);
}
return res.result;
})
.catch(function (error) { return Promise.reject(error); });
case Environment.androidBiWallet:
return androidSignTransactionGroup(tx, exer, withhold).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, exer, withhold).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

@@ -7,1 +7,7 @@ export interface ISignTx {

}
export interface ISignTxGroupCommon {
tx: string;
exer?: string;
withhold?: number;
url?: string;
}

8

package.json
{
"name": "@33cn/wallet-api",
"version": "1.3.4",
"version": "1.4.1-beta",
"description": "提供各种比特元钱包的获取地址、签名接口",

@@ -20,3 +20,9 @@ "main": "dist/index.js",

"typescript": "^3.2.4"
},
"dependencies": {
"@33cn/chain33-rpc-api": "^1.5.18",
"es6-promise": "^4.2.8",
"isomorphic-fetch": "^2.2.1",
"tslib": "^1.10.0"
}
}

@@ -33,2 +33,23 @@ # bityuan钱包 接口调用工具

```
#### signTxGroupCommon
- 功能:构造交易组、签名
- 环境:币钱包及其各个项目方的拷贝版本,btypay
- 参数
- tx: string, 未签名的hash,多个hash可以由,隔开
- exer?: string, 执行器,主链执行器为none,平行链执行器为user.p.${platform}.none
- withhold?: number = 1, 是否代扣 1: 代扣 -1: 不代扣
- url?: string 交易发送的url btypay环境必填
```
// 币钱包交易签名
signTxGroup({
tx: "0x1848959835460954609,0x93893548289256a678",
exer: "user.p.xxx.none",
withhold: -1,
})
// btypay交易签名
signTxGroup({
tx: "0x1848959835460954609,0x93893548289256a678",
url: "http://47.89.120.56:8089",
})
```

@@ -35,0 +56,0 @@ #### configPriv

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc