@secux/app-eth
Advanced tools
Comparing version 2.1.2 to 2.1.3
@@ -5,2 +5,3 @@ /// <reference types="node" /> | ||
import { TypedData } from "./eip712"; | ||
import { ERC20 } from "./erc20"; | ||
export { SecuxETH, tx155, tx1559, TypedData }; | ||
@@ -11,2 +12,3 @@ /** | ||
declare class SecuxETH { | ||
static readonly ERC20: typeof ERC20; | ||
/** | ||
@@ -72,3 +74,3 @@ * Get EIP55 address derived by given BIP32 path | ||
* @param {string} message | ||
* @param {number} chainId 1(default): ETH, 56: BSC | ||
* @param {number} [chainId] if give a chainId, the signature of output will be EIP-155 applied | ||
* @returns {object} signed | ||
@@ -87,3 +89,3 @@ * @returns {string} signed.raw_tx | ||
* @param {TypedData} data EIP712 | ||
* @param {number} chainId 1(default): ETH, 56: BSC | ||
* @param {number} [chainId] if give a chainId, the signature of output will be EIP-155 applied | ||
* @returns {object} signed | ||
@@ -90,0 +92,0 @@ * @returns {string} signed.raw_tx |
@@ -1,1 +0,1 @@ | ||
"use strict";var t=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[i]}})}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),e=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(i){if(i&&i.__esModule)return i;var r={};if(null!=i)for(var n in i)"default"!==n&&Object.prototype.hasOwnProperty.call(i,n)&&t(r,i,n);return e(r,i),r},r=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(n,a){function o(t){try{u(r.next(t))}catch(t){a(t)}}function s(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,s)}u((r=r.apply(t,e||[])).next())}))},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SecuxETH=void 0;const a=require("js-sha3"),o=n(require("ow")),s=require("@secux/transport/lib/ITransaction"),u=i(require("@secux/utility")),c=require("./interface"),l=require("./transaction"),d=require("./eip712"),f=require("wallet-address-validator").validate;function h(t,e){return Buffer.concat([t.r,t.s,Buffer.from([t.v[0]+2*e+35])])}exports.SecuxETH=class{static getAddress(t,e){return r(this,void 0,void 0,(function*(){(0,o.default)(e,u.ow_strictPath(60,44));let{publicKey:i}=yield t.getXPublickey(e,!1);if(65!==i.length)throw Error(`XPubicKey length error: ${i.length} (should be 65)`);const r=function(t){t=t.toLowerCase().replace(/^0x/,"");const e=(0,a.keccak256)(t);let i="0x";for(let r=0;r<t.length;r++)parseInt(e[r],16)>=8?i+=t[r].toUpperCase():i+=t[r];return i}((0,a.keccak256)(i.slice(1)).slice(-40));return r}))}static signTransaction(t,e,i){return r(this,void 0,void 0,(function*(){if((0,o.default)(e,u.ow_strictPath(60,44)),(0,o.default)(i,o.default.any(c.ow_tx155,c.ow_tx1559)),!f(i.to,"ETH"))throw Error(`Invalid address: ${i.to}`);const r=(0,l.getBuilder)(i),n=r.serialize(),a=yield t.SignRawTransaction(e,n,{tp:s.TransactionType.TOKEN,curve:s.EllipticCurve.SECP256K1,chainId:i.chainId,showOption:s.ShowOption.NONE});return a.trimZero(),{raw_tx:r.withSignature(a).toString("hex"),signature:h(a,i.chainId)}}))}static signMessage(t,e,i,n=1){return r(this,void 0,void 0,(function*(){(0,o.default)(e,u.ow_strictPath(60,44)),(0,o.default)(i,o.default.string),(0,o.default)(n,o.default.number.positive);const r=yield t.SignMessage(e,Buffer.from(i));return r.trimZero(),{raw_tx:"",signature:h(r,n)}}))}static signTypedData(t,e,i,n=1){return r(this,void 0,void 0,(function*(){(0,o.default)(e,u.ow_strictPath(60,44)),(0,o.default)(i,c.ow_TypedData),(0,o.default)(n,o.default.number.positive);const r=function(t){const e={};for(const i in c.TYPED_MESSAGE_SCHEMA.properties)t[i]&&(e[i]=t[i]);"types"in e&&(e.types=Object.assign({EIP712Domain:[]},e.types));return e}(i),a=[];a.push(d.TypedDataUtils.hashStruct("EIP712Domain",r.domain,r.types,!0)),"EIP712Domain"!==r.primaryType&&a.push(d.TypedDataUtils.hashStruct(r.primaryType.toString(),r.message,r.types,!0));const s=Buffer.concat(a),l=yield t.SignTypedMessage(e,s);return l.trimZero(),{raw_tx:"",signature:h(l,n)}}))}static signWalletConnectTransaction(t,e,i){return r(this,void 0,void 0,(function*(){(0,o.default)(e,u.ow_strictPath(60,44)),(0,o.default)(i,o.default.any(c.ow_tx155,c.ow_tx1559));const r=(0,l.getBuilder)(i),n=r.serialize(!0),a=yield t.SignTransaction(e,n,{tp:s.TransactionType.NORMAL,curve:s.EllipticCurve.SECP256K1,chainId:i.chainId,showOption:s.ShowOption.NONE});return a.trimZero(),{raw_tx:r.withSignature(a).toString("hex"),signature:h(a,i.chainId)}}))}}; | ||
"use strict";var t=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[i]}})}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),e=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(i){if(i&&i.__esModule)return i;var r={};if(null!=i)for(var n in i)"default"!==n&&Object.prototype.hasOwnProperty.call(i,n)&&t(r,i,n);return e(r,i),r},r=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(n,a){function o(t){try{s(r.next(t))}catch(t){a(t)}}function u(t){try{s(r.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,u)}s((r=r.apply(t,e||[])).next())}))},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SecuxETH=void 0;const a=require("js-sha3"),o=n(require("ow")),u=require("@secux/transport/lib/ITransaction"),s=i(require("@secux/utility")),c=require("./interface"),l=require("./transaction"),d=require("./eip712"),f=require("./erc20"),h=require("wallet-address-validator").validate;class p{static getAddress(t,e){return r(this,void 0,void 0,(function*(){(0,o.default)(e,s.ow_strictPath(60,44));let{publicKey:i}=yield t.getXPublickey(e,!1);if(65!==i.length)throw Error(`XPubicKey length error: ${i.length} (should be 65)`);const r=function(t){t=t.toLowerCase().replace(/^0x/,"");const e=(0,a.keccak256)(t);let i="0x";for(let r=0;r<t.length;r++)parseInt(e[r],16)>=8?i+=t[r].toUpperCase():i+=t[r];return i}((0,a.keccak256)(i.slice(1)).slice(-40));return r}))}static signTransaction(t,e,i){return r(this,void 0,void 0,(function*(){if((0,o.default)(e,s.ow_strictPath(60,44)),(0,o.default)(i,o.default.any(c.ow_tx155,c.ow_tx1559)),!h(i.to,"ETH"))throw Error(`Invalid address: ${i.to}`);const r=(0,l.getBuilder)(i),n=r.serialize(),a=yield t.SignRawTransaction(e,n,{tp:u.TransactionType.TOKEN,curve:u.EllipticCurve.SECP256K1,chainId:i.chainId,showOption:u.ShowOption.NONE});return a.trimZero(),{raw_tx:r.withSignature(a).toString("hex"),signature:g(a,i.chainId)}}))}static signMessage(t,e,i,n){return r(this,void 0,void 0,(function*(){(0,o.default)(e,s.ow_strictPath(60,44)),(0,o.default)(i,o.default.string),(0,o.default)(n,o.default.optional.number.positive);const r=yield t.SignMessage(e,Buffer.from(i));return r.trimZero(),{raw_tx:"",signature:g(r,n)}}))}static signTypedData(t,e,i,n){return r(this,void 0,void 0,(function*(){(0,o.default)(e,s.ow_strictPath(60,44)),(0,o.default)(i,c.ow_TypedData),(0,o.default)(n,o.default.optional.number.positive);const r=function(t){const e={};for(const i in c.TYPED_MESSAGE_SCHEMA.properties)t[i]&&(e[i]=t[i]);"types"in e&&(e.types=Object.assign({EIP712Domain:[]},e.types));return e}(i),a=[];a.push(d.TypedDataUtils.hashStruct("EIP712Domain",r.domain,r.types,!0)),"EIP712Domain"!==r.primaryType&&a.push(d.TypedDataUtils.hashStruct(r.primaryType.toString(),r.message,r.types,!0));const u=Buffer.concat(a),l=yield t.SignTypedMessage(e,u);return l.trimZero(),{raw_tx:"",signature:g(l,n)}}))}static signWalletConnectTransaction(t,e,i){return r(this,void 0,void 0,(function*(){(0,o.default)(e,s.ow_strictPath(60,44)),(0,o.default)(i,o.default.any(c.ow_tx155,c.ow_tx1559));const r=(0,l.getBuilder)(i),n=r.serialize(!0),a=yield t.SignTransaction(e,n,{tp:u.TransactionType.NORMAL,curve:u.EllipticCurve.SECP256K1,chainId:i.chainId,showOption:u.ShowOption.NONE});return a.trimZero(),{raw_tx:r.withSignature(a).toString("hex"),signature:g(a,i.chainId)}}))}}function g(t,e){let i=(void 0!==e?t.v[0]+2*e+35:t.v[0]+27).toString(16);i.length%2!=0&&(i=`0${i}`);return Buffer.concat([t.r,t.s,Buffer.from(i,"hex")])}exports.SecuxETH=p,p.ERC20=f.ERC20; |
@@ -22,6 +22,6 @@ export declare type PrefixedHexString = string; | ||
export interface tx155 extends tx155_base { | ||
data?: string | transferData; | ||
data?: string; | ||
} | ||
export interface tx1559 extends tx1559_base { | ||
data?: string | transferData; | ||
data?: string; | ||
} | ||
@@ -44,6 +44,3 @@ export interface transferData { | ||
value: string | number; | ||
data: string | { | ||
toAddress: string; | ||
amount: string | number; | ||
} | undefined; | ||
data: string | undefined; | ||
}>; | ||
@@ -58,6 +55,3 @@ export declare const ow_tx1559: import("ow").ObjectPredicate<{ | ||
value: string | number; | ||
data: string | { | ||
toAddress: string; | ||
amount: string | number; | ||
} | undefined; | ||
data: string | undefined; | ||
accessList: unknown[] | undefined; | ||
@@ -64,0 +58,0 @@ }>; |
@@ -1,1 +0,1 @@ | ||
"use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[a]}})}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),t=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(a){if(a&&a.__esModule)return a;var r={};if(null!=a)for(var o in a)"default"!==o&&Object.prototype.hasOwnProperty.call(a,o)&&e(r,a,o);return t(r,a),r},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.isTransferData=exports.TYPED_MESSAGE_SCHEMA=exports.ow_TypedData=exports.ow_TypedMessage=exports.ow_EIP712TypedData=exports.ow_baseData=exports.ow_tx1559_base=exports.ow_tx155_base=exports.ow_tx1559=exports.ow_tx155=exports.ow_transferData=exports.ow_address=void 0;const o=r(require("ow")),n=a(require("@secux/utility"));exports.ow_address=o.default.string.matches(/^0x[0-9A-fa-f]{40}$/),exports.ow_transferData=o.default.object.exactShape({toAddress:exports.ow_address,amount:o.default.any(o.default.number.not.negative,n.ow_prefixedhexString)}),exports.ow_tx155=o.default.object.exactShape({chainId:o.default.number.positive,nonce:o.default.any(o.default.number,n.ow_prefixedhexString),gasPrice:o.default.any(o.default.number.positive,n.ow_prefixedhexString),gasLimit:o.default.any(o.default.number.positive,n.ow_prefixedhexString),to:exports.ow_address,value:o.default.any(o.default.number.not.negative,n.ow_prefixedhexString),data:o.default.any(o.default.undefined,n.ow_prefixedhexString,exports.ow_transferData)}),exports.ow_tx1559=o.default.object.exactShape({chainId:o.default.number.positive,nonce:o.default.any(o.default.number,n.ow_prefixedhexString),maxPriorityFeePerGas:o.default.any(o.default.number.positive,n.ow_prefixedhexString),maxFeePerGas:o.default.any(o.default.number.positive,n.ow_prefixedhexString),gasLimit:o.default.any(o.default.number.positive,n.ow_prefixedhexString),to:exports.ow_address,value:o.default.any(o.default.number.not.negative,n.ow_prefixedhexString),data:o.default.any(o.default.undefined,n.ow_prefixedhexString,exports.ow_transferData),accessList:o.default.any(o.default.undefined,o.default.array.ofType(o.default.any()))}),exports.ow_tx155_base=o.default.object.exactShape({chainId:o.default.number.positive,nonce:o.default.any(o.default.number,n.ow_prefixedhexString),gasPrice:o.default.any(o.default.number.positive,n.ow_prefixedhexString),gasLimit:o.default.any(o.default.number.positive,n.ow_prefixedhexString),to:exports.ow_address,value:o.default.any(o.default.undefined,o.default.number.not.negative,n.ow_prefixedhexString)}),exports.ow_tx1559_base=o.default.object.exactShape({chainId:o.default.number.positive,nonce:o.default.any(o.default.number,n.ow_prefixedhexString),maxPriorityFeePerGas:o.default.any(o.default.number.positive,n.ow_prefixedhexString),maxFeePerGas:o.default.any(o.default.number.positive,n.ow_prefixedhexString),gasLimit:o.default.any(o.default.number.positive,n.ow_prefixedhexString),to:exports.ow_address,value:o.default.any(o.default.undefined,o.default.number.not.negative,n.ow_prefixedhexString),accessList:o.default.any(o.default.undefined,o.default.array.ofType(o.default.any()))}),exports.ow_baseData=o.default.any(exports.ow_tx155_base,exports.ow_tx1559_base),exports.ow_EIP712TypedData=o.default.object.exactShape({name:o.default.string,type:o.default.string}),exports.ow_TypedMessage=o.default.object.exactShape({types:o.default.object.valuesOfType(o.default.array.ofType(exports.ow_EIP712TypedData)),primaryType:o.default.string,domain:o.default.object.exactShape({name:o.default.optional.string,version:o.default.optional.string,chainId:o.default.optional.number.not.negative,verifyingContract:o.default.optional.string}),message:o.default.object}),exports.ow_TypedData=o.default.any(exports.ow_TypedMessage),exports.TYPED_MESSAGE_SCHEMA={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},exports.isTransferData=function(e){try{return(0,o.default)(e,exports.ow_transferData),e}catch(e){}}; | ||
"use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[a]}})}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),t=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(a){if(a&&a.__esModule)return a;var r={};if(null!=a)for(var o in a)"default"!==o&&Object.prototype.hasOwnProperty.call(a,o)&&e(r,a,o);return t(r,a),r},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.isTransferData=exports.TYPED_MESSAGE_SCHEMA=exports.ow_TypedData=exports.ow_TypedMessage=exports.ow_EIP712TypedData=exports.ow_baseData=exports.ow_tx1559_base=exports.ow_tx155_base=exports.ow_tx1559=exports.ow_tx155=exports.ow_transferData=exports.ow_address=void 0;const o=r(require("ow")),i=a(require("@secux/utility"));exports.ow_address=o.default.string.matches(/^0x[0-9A-fa-f]{40}$/),exports.ow_transferData=o.default.object.exactShape({toAddress:exports.ow_address,amount:o.default.any(o.default.number.not.negative,i.ow_prefixedhexString)}),exports.ow_tx155=o.default.object.exactShape({chainId:o.default.number.positive,nonce:o.default.any(o.default.number,i.ow_prefixedhexString),gasPrice:o.default.any(o.default.number.positive,i.ow_prefixedhexString),gasLimit:o.default.any(o.default.number.positive,i.ow_prefixedhexString),to:exports.ow_address,value:o.default.any(o.default.number.not.negative,i.ow_prefixedhexString),data:o.default.any(o.default.undefined,i.ow_prefixedhexString)}),exports.ow_tx1559=o.default.object.exactShape({chainId:o.default.number.positive,nonce:o.default.any(o.default.number,i.ow_prefixedhexString),maxPriorityFeePerGas:o.default.any(o.default.number.positive,i.ow_prefixedhexString),maxFeePerGas:o.default.any(o.default.number.positive,i.ow_prefixedhexString),gasLimit:o.default.any(o.default.number.positive,i.ow_prefixedhexString),to:exports.ow_address,value:o.default.any(o.default.number.not.negative,i.ow_prefixedhexString),data:o.default.any(o.default.undefined,i.ow_prefixedhexString),accessList:o.default.any(o.default.undefined,o.default.array.ofType(o.default.any()))}),exports.ow_tx155_base=o.default.object.partialShape({chainId:o.default.number.positive,nonce:o.default.any(o.default.number,i.ow_prefixedhexString),gasPrice:o.default.any(o.default.number.positive,i.ow_prefixedhexString),gasLimit:o.default.any(o.default.number.positive,i.ow_prefixedhexString),to:exports.ow_address,value:o.default.any(o.default.undefined,o.default.number.not.negative,i.ow_prefixedhexString)}),exports.ow_tx1559_base=o.default.object.partialShape({chainId:o.default.number.positive,nonce:o.default.any(o.default.number,i.ow_prefixedhexString),maxPriorityFeePerGas:o.default.any(o.default.number.positive,i.ow_prefixedhexString),maxFeePerGas:o.default.any(o.default.number.positive,i.ow_prefixedhexString),gasLimit:o.default.any(o.default.number.positive,i.ow_prefixedhexString),to:exports.ow_address,value:o.default.any(o.default.undefined,o.default.number.not.negative,i.ow_prefixedhexString),accessList:o.default.any(o.default.undefined,o.default.array.ofType(o.default.any()))}),exports.ow_baseData=o.default.any(exports.ow_tx155_base,exports.ow_tx1559_base),exports.ow_EIP712TypedData=o.default.object.exactShape({name:o.default.string,type:o.default.string}),exports.ow_TypedMessage=o.default.object.exactShape({types:o.default.object.valuesOfType(o.default.array.ofType(exports.ow_EIP712TypedData)),primaryType:o.default.string,domain:o.default.object.exactShape({name:o.default.optional.string,version:o.default.optional.string,chainId:o.default.optional.number.not.negative,verifyingContract:o.default.optional.string}),message:o.default.object}),exports.ow_TypedData=o.default.any(exports.ow_TypedMessage),exports.TYPED_MESSAGE_SCHEMA={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},exports.isTransferData=function(e){try{return(0,o.default)(e,exports.ow_transferData),e}catch(e){}}; |
{ | ||
"name": "@secux/app-eth", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "SecuX Hardware Wallet ETH API", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -74,4 +74,4 @@ # `@secux/app-eth` | ||
// transfer token easy use | ||
const { raw_tx, signature } = await SecuxETH.signTransaction( | ||
// alternative usage | ||
const { raw_tx, signature } = await SecuxETH.ERC20.transfer( | ||
device, | ||
@@ -83,9 +83,9 @@ "m/44'/60'/0'/0/0", | ||
value: 0, | ||
data: { | ||
toAddress: "0xD080156885651fADbD6df14145051b934660a748", | ||
amount: `0x${1e18.toString(16)}` | ||
}, | ||
chainId: 1, | ||
gasPrice: 1e6, | ||
gasLimit: 25000 | ||
}, | ||
{ | ||
toAddress: "0xD080156885651fADbD6df14145051b934660a748", | ||
amount: `0x${1e18.toString(16)}` | ||
} | ||
@@ -100,5 +100,5 @@ ); | ||
5. Sign TypedMessage transaction | ||
5. Sign TypeData transaction (EIP-712) | ||
```ts | ||
const { raw_tx, signature } = await SecuxETH.signTypedMessage(device, "m/44'/60'/0'/0/0", msg); | ||
const { raw_tx, signature } = await SecuxETH.signTypedData(device, "m/44'/60'/0'/0/0", msg); | ||
``` | ||
@@ -137,3 +137,3 @@ | ||
## SecuxETH | ||
### `SecuxETH` | ||
ETH package for SecuX device | ||
@@ -146,4 +146,4 @@ | ||
- [**SecuxETH.signTransaction(trans, path, content)** ⇒ <code>object</code>](#secuxethsigntransactiontrans-path-content--object) | ||
- [**SecuxETH.signMessage(trans, path, message, chainId)** ⇒ <code>object</code>](#secuxethsignmessagetrans-path-message-chainid--object) | ||
- [**SecuxETH.signTypedData(trans, path, data, chainId)** ⇒ <code>object</code>](#secuxethsigntypeddatatrans-path-data-chainid--object) | ||
- [**SecuxETH.signMessage(trans, path, message, [chainId])** ⇒ <code>object</code>](#secuxethsignmessagetrans-path-message-chainid--object) | ||
- [**SecuxETH.signTypedData(trans, path, data, [chainId])** ⇒ <code>object</code>](#secuxethsigntypeddatatrans-path-data-chainid--object) | ||
- [**SecuxETH.signWalletConnectTransaction(trans, path, content)** ⇒ <code>object</code>](#secuxethsignwalletconnecttransactiontrans-path-content--object) | ||
@@ -171,4 +171,4 @@ | ||
**Returns**: <code>object</code> - signed<br/> | ||
<code style="margin-left:62px">string</code> - signed.raw_tx<br/> | ||
<code style="margin-left:62px">Buffer</code> - signed.signature<br/> | ||
<code>string</code> - signed.raw_tx<br/> | ||
<code>Buffer</code> - signed.signature<br/> | ||
@@ -183,3 +183,3 @@ | Param | Type | Description | | ||
### **SecuxETH.signMessage(trans, path, message, chainId)** ⇒ <code>object</code> | ||
### **SecuxETH.signMessage(trans, path, message, [chainId])** ⇒ <code>object</code> | ||
*Create message type transaction and Sign* | ||
@@ -189,15 +189,15 @@ | ||
**Returns**: <code>object</code> - signed<br/> | ||
<code style="margin-left:62px">string</code> - signed.raw_tx<br/> | ||
<code style="margin-left:62px">Buffer</code> - signed.signature<br/> | ||
<code>string</code> - signed.raw_tx<br/> | ||
<code>Buffer</code> - signed.signature<br/> | ||
| Param | Type | Default | Description | | ||
| --- | --- | --- | --- | | ||
| trans | <code>ITransport</code> | | | | ||
| path | <code>string</code> | | BIP32 | | ||
| message | <code>string</code> | | | | ||
| chainId | <code>number</code> | <code>1</code> | 1: ETH, 56: BSC | | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| trans | <code>ITransport</code> | | | ||
| path | <code>string</code> | BIP32 | | ||
| message | <code>string</code> | | | ||
| [chainId] | <code>number</code> | if give a chainId, the signature of output will be EIP-155 applied | | ||
<a name="SecuxETH.signTypedData"></a><br/> | ||
### **SecuxETH.signTypedData(trans, path, data, chainId)** ⇒ <code>object</code> | ||
### **SecuxETH.signTypedData(trans, path, data, [chainId])** ⇒ <code>object</code> | ||
*Create EIP712 transaction and Sign* | ||
@@ -207,11 +207,11 @@ | ||
**Returns**: <code>object</code> - signed<br/> | ||
<code style="margin-left:62px">string</code> - signed.raw_tx<br/> | ||
<code style="margin-left:62px">Buffer</code> - signed.signature<br/> | ||
<code>string</code> - signed.raw_tx<br/> | ||
<code>Buffer</code> - signed.signature<br/> | ||
| Param | Type | Default | Description | | ||
| --- | --- | --- | --- | | ||
| trans | <code>ITransport</code> | | | | ||
| path | <code>string</code> | | BIP32 | | ||
| data | <code>TypedData</code> | | EIP712 | | ||
| chainId | <code>number</code> | <code>1</code> | 1: ETH, 56: BSC | | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| trans | <code>ITransport</code> | | | ||
| path | <code>string</code> | BIP32 | | ||
| data | <code>TypedData</code> | EIP712 | | ||
| [chainId] | <code>number</code> | if give a chainId, the signature of output will be EIP-155 applied | | ||
@@ -225,4 +225,4 @@ <a name="SecuxETH.signWalletConnectTransaction"></a><br/> | ||
**Returns**: <code>object</code> - signed<br/> | ||
<code style="margin-left:62px">string</code> - signed.raw_tx<br/> | ||
<code style="margin-left:62px">Buffer</code> - signed.signature<br/> | ||
<code>string</code> - signed.raw_tx<br/> | ||
<code>Buffer</code> - signed.signature<br/> | ||
@@ -229,0 +229,0 @@ | Param | Type | Description | |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
38143
13
387
6