@bithighlander/cosmos-tx-builder
Advanced tools
Comparing version 6.3.0 to 6.3.1
require("dotenv").config({path:'../../../.env'}) | ||
let txBuilder = require("../index") | ||
let WALLET_ATOM_MASTER_PRIVATE = "fc383d8ebe95e0d075991238aec956b1e26bb19b4048084b6e91fc3b7e286713" | ||
let WALLET_ATOM_MASTER_PUBLIC = "03bee3af30e53a73f38abc5a2fcdac426d7b04eb72a8ebd3b01992e2d206e24ad8" | ||
let run_test = async function(){ | ||
try{ | ||
//To Address | ||
let to = "cosmos1wlx2epy0t6lh8hn4ugzd8gap2amh0ykx8ujt2p" | ||
let amount = 1000 | ||
let from = "cosmos15cenya0tr7nm3tz2wn3h3zwkht2rxrq7q7h3dj" | ||
// | ||
let tx = await txBuilder.createTransfer(from,to,amount) | ||
let wallet = { | ||
privateKey: WALLET_ATOM_MASTER_PRIVATE, | ||
publicKey: WALLET_ATOM_MASTER_PUBLIC | ||
} | ||
let sequence = 0 | ||
let account_number = 123 | ||
let chain_id = "cosmoshub-2" | ||
let result = await txBuilder.sign(tx,wallet,sequence, account_number, chain_id) | ||
console.log(result) | ||
}catch(e){ | ||
console.error(e) | ||
} | ||
} | ||
run_test() |
@@ -35,3 +35,3 @@ /* | ||
let amountU = 1000 | ||
let from = "" | ||
let from = "cosmos15cenya0tr7nm3tz2wn3h3zwkht2rxrq7q7h3dj" | ||
// | ||
@@ -38,0 +38,0 @@ let tx = await client.createTransfer(from,to,amount) |
31
index.js
@@ -5,13 +5,13 @@ /* | ||
*/ | ||
const bip39 = require(`bip39`) | ||
const bip32 = require(`bip32`) | ||
const bech32 = require(`bech32`) | ||
// const bip39 = require(`bip39`) | ||
// const bip32 = require(`bip32`) | ||
// const bech32 = require(`bech32`) | ||
const secp256k1 = require(`secp256k1`) | ||
const sha256 = require("crypto-js/sha256") | ||
const ripemd160 = require("crypto-js/ripemd160") | ||
const CryptoJS = require("crypto-js") | ||
const HDKey = require('hdkey') | ||
const coininfo = require('coininfo') | ||
const hdPathAtom = `m/44'/118'/0'/0/0` // key controlling ATOM allocation | ||
let bitcoin = require("bitcoinjs-lib"); | ||
// const ripemd160 = require("crypto-js/ripemd160") | ||
// const CryptoJS = require("crypto-js") | ||
// const HDKey = require('hdkey') | ||
// const coininfo = require('coininfo') | ||
// const hdPathAtom = `m/44'/118'/0'/0/0` // key controlling ATOM allocation | ||
// let bitcoin = require("bitcoinjs-lib"); | ||
@@ -92,3 +92,4 @@ const TAG = " | tx-builder | " | ||
let create_signed_tx = function(tx, signature) { | ||
tx.value.signatures = [signature] | ||
if(!tx.signatures) tx.signatures = [] | ||
tx.signatures = [signature] | ||
return tx | ||
@@ -141,4 +142,2 @@ } | ||
signatureBuffer, | ||
sequence, | ||
account_number, | ||
pubKeyBuffer | ||
@@ -213,4 +212,4 @@ ) | ||
try{ | ||
//log.debug(tag,"signMessage: ",typeof(signMessage)) | ||
//log.debug(tag,"signMessage: ",signMessage) | ||
console.log(tag,"signMessage: ",typeof(signMessage)) | ||
console.log(tag,"signMessage: ",signMessage) | ||
@@ -231,3 +230,3 @@ const signHash = Buffer.from(sha256(signMessage).toString(), `hex`) | ||
// signature, sequence, account_number, publicKey | ||
const format_signature = async function(signature, sequence, account_number, publicKey){ | ||
const format_signature = async function(signature, publicKey){ | ||
let tag = TAG+" | format_signature | " | ||
@@ -238,4 +237,2 @@ try{ | ||
signature: signature.toString(`base64`), | ||
account_number, | ||
sequence, | ||
pub_key: { | ||
@@ -242,0 +239,0 @@ type: `tendermint/PubKeySecp256k1`, // TODO: allow other keyprpess |
{ | ||
"name": "@bithighlander/cosmos-tx-builder", | ||
"version": "6.3.0", | ||
"version": "6.3.1", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "test": "jest" |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
14813
395
19