Comparing version 1.2.1 to 1.2.2
@@ -0,1 +1,4 @@ | ||
# 1.2.2 | ||
## Added | ||
- Support for Optional Parameters for GetTransactionsByAddress | ||
# 1.2.1 | ||
@@ -2,0 +5,0 @@ ## Added |
@@ -13,4 +13,3 @@ (function() { | ||
var algos = document.getElementById('algos'); | ||
algos.value = 739; | ||
algos.value = 739000; | ||
var tb = document.getElementById('block'); | ||
@@ -27,3 +26,4 @@ var ta = document.getElementById('ta'); | ||
var adetails = document.getElementById('adetails'); | ||
var trans = document.getElementById('trans'); | ||
var txid = document.getElementById('txid'); | ||
var signKey = null; | ||
@@ -41,4 +41,5 @@ var account = null; | ||
} | ||
//acount information | ||
if (adetails) { | ||
adetails.onclick = function() { | ||
adetails.onclick = function () { | ||
ta.innerHTML = ""; | ||
@@ -59,4 +60,5 @@ const algodclient = new algosdk.Algod(atoken, aserver, aport); | ||
} | ||
//block status | ||
if (tb) { | ||
tb.onclick = function() { | ||
tb.onclick = function () { | ||
ta.innerHTML = ""; | ||
@@ -82,4 +84,5 @@ const algodclient = new algosdk.Algod(atoken, aserver, aport); | ||
} | ||
//Create account | ||
if (ga) { | ||
ga.onclick = function() { | ||
ga.onclick = function () { | ||
ta.innerHTML = ""; | ||
@@ -103,4 +106,5 @@ | ||
} | ||
//recover account | ||
if (re) { | ||
re.onclick = function() { | ||
re.onclick = function () { | ||
ta.innerHTML = ""; | ||
@@ -130,18 +134,19 @@ | ||
} | ||
//submit transaction | ||
if (st) { | ||
st.onclick = function() { | ||
st.onclick = function () { | ||
ta.innerHTML = ""; | ||
var person = { firstName: "John", lastName: "Doe", age: 50, eyeColor: "blue" }; | ||
var note = algosdk.encodeObj(person); | ||
txn = { | ||
"from": account, | ||
"to": to.value.toString(), | ||
"fee": 10, | ||
"fee": 1000, | ||
"amount": parseInt(algos.value), | ||
"firstRound": parseInt(fround.value), | ||
"lastRound": parseInt(lround.value), | ||
"note": new Uint8Array(0) | ||
"note": algosdk.encodeObj(person), | ||
"genesisID": "testnet-v1.0", | ||
"genesisHash": "SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=" | ||
}; | ||
var signedTxn = algosdk.signTransaction(txn, signKey); | ||
@@ -155,2 +160,5 @@ console.log(signedTxn.txID); | ||
ta.innerHTML = textedJson; | ||
console.log(tx); | ||
console.log(tx.txId); | ||
txid.value = tx.txId; | ||
})().catch(e => { | ||
@@ -162,39 +170,26 @@ ta.innerHTML = e.text; | ||
} | ||
} | ||
//Get transaction note | ||
if (trans) { | ||
trans.onclick = function () { | ||
if (wr) { | ||
wr.onclick = function() { | ||
ta.innerHTML = ""; | ||
const kmdclient = new algosdk.Kmd(kmdtoken, kmdserver, kmdport); | ||
const algodclient = new algosdk.Algod(atoken, aserver, aport); | ||
// Recover a wallet example | ||
let algodclient = new algosdk.Algod(atoken, aserver, aport); | ||
(async () => { | ||
let mdk = (await algosdk.mnemonicToMasterDerivationKey(wall.value)); | ||
console.log(mdk); | ||
var walletname = createWalletName(); | ||
console.log("Created Wallet : " + walletname); | ||
let walletid = (await kmdclient.createWallet(walletname, "", mdk)).wallet.id; | ||
let wallethandle = (await kmdclient.initWalletHandle(walletid, "")).wallet_handle_token; | ||
console.log("Got wallet handle.", wallethandle); | ||
var acct = (await kmdclient.generateKey(wallethandle)); | ||
signKey = (await kmdclient.exportKey(wallethandle, "", acct.address)).private_key; | ||
account = acct.address; | ||
console.log(signKey) | ||
let tx = (await algodclient.accountInformation(account)); | ||
var textedJson = JSON.stringify(tx, undefined, 4); | ||
let tx = (await algodclient.transactionInformation(account, txid.value)); | ||
var textedJson = JSON.stringify(tx, undefined, 4); | ||
console.log(textedJson); | ||
ta.innerHTML = textedJson; | ||
var encodednote = algosdk.decodeObj(tx.note); | ||
ta.innerHTML = JSON.stringify(encodednote, undefined, 4); | ||
})().catch(e => { | ||
ta.innerHTML = e.text; | ||
if (e.text === undefined) { | ||
} | ||
console.log(e); | ||
}) | ||
}); | ||
@@ -207,2 +202,2 @@ | ||
})(); | ||
})(); |
{ | ||
"name": "algosdk", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "algosdk is Algorand's official javascript SDK", | ||
@@ -16,2 +16,3 @@ "main": "index.js", | ||
"js-sha512": "^0.8.0", | ||
"js-yaml": ">=3.13.1", | ||
"msgpack-lite": "git+https://github.com/algorand/msgpack-lite.git", | ||
@@ -18,0 +19,0 @@ "superagent": "^4.1.0", |
@@ -103,8 +103,14 @@ const client = require('./client'); | ||
* @param addr string | ||
* @param first number | ||
* @param last number | ||
* @param first number, optional | ||
* @param last number, optional | ||
* @returns {Promise<*>} | ||
*/ | ||
this.transactionByAddress = async function (addr, first, last) { | ||
if (!Number.isInteger(first) || !Number.isInteger(last)) throw Error("first and last rounds should be integers"); | ||
this.transactionByAddress = async function (addr, first=null, last=null) { | ||
if (( first !== null ) && (!Number.isInteger(first) )){ | ||
throw Error("first round should be an integer") | ||
} | ||
if (( last !== null ) && (!Number.isInteger(last) )){ | ||
throw Error("last round should be an integer") | ||
} | ||
let res = await c.get("/v1/account/" + addr + "/transactions", { 'firstRound': first, 'lastRound': last }); | ||
@@ -111,0 +117,0 @@ if (res.statusCode === 200 && res.body.transactions !== undefined) { |
@@ -278,3 +278,3 @@ const client = require('./client'); | ||
*/ | ||
this.listMultiSig = async function (walletHandle) { | ||
this.listMultisig = async function (walletHandle) { | ||
let req = { | ||
@@ -288,3 +288,3 @@ "wallet_handle_token": walletHandle, | ||
/** | ||
* importMultiSig accepts a wallet handle and the information required to | ||
* importMultisig accepts a wallet handle and the information required to | ||
* generate a multisig address. It derives this address, and stores all of the | ||
@@ -299,3 +299,3 @@ * information within the wallet. It returns a ImportMultisigResponse with the | ||
*/ | ||
this.importMultiSig = async function (walletHandle, version, threshold, pks) { | ||
this.importMultisig = async function (walletHandle, version, threshold, pks) { | ||
let req = { | ||
@@ -322,7 +322,6 @@ "wallet_handle_token": walletHandle, | ||
*/ | ||
this.exportMultisig = async function (walletHandle, walletPassword, addr) { | ||
this.exportMultisig = async function (walletHandle, addr) { | ||
let req = { | ||
"wallet_handle_token": walletHandle, | ||
"address": addr, | ||
"wallet_password": walletPassword | ||
}; | ||
@@ -346,6 +345,7 @@ let res = await c.post("/v1/multisig/export", req); | ||
*/ | ||
this.signMultisigTransaction = async function (walletHandle, pw, tx, pk, partial) { | ||
this.signMultisigTransaction = async function (walletHandle, pw, transaction, pk, partial) { | ||
let tx = new txn.Transaction(transaction); | ||
let req = { | ||
"wallet_handle_token": walletHandle, | ||
"transaction": tx, | ||
"transaction": tx.toByte().toString('base64'), | ||
"public_key": Buffer.from(pk).toString('base64'), | ||
@@ -355,3 +355,3 @@ "partial_multisig": partial, | ||
}; | ||
let res = await c.delete("/v1/multisig/sign", req); | ||
let res = await c.post("/v1/multisig/sign", req); | ||
return res.body; | ||
@@ -358,0 +358,0 @@ }; |
@@ -129,3 +129,3 @@ const nacl = require('./nacl/naclWrappers'); | ||
} | ||
let algoTxn = new multisig.MultiSigTransaction(txn); | ||
let algoTxn = new multisig.MultisigTransaction(txn); | ||
const pks = addrs.map(addr => { | ||
@@ -157,3 +157,3 @@ return address.decode(addr).publicKey; | ||
let multisigTxObj = encoding.decode(multisigTxnBlob); | ||
let msigTxn = multisig.MultiSigTransaction.from_obj_for_encoding(multisigTxObj.txn); | ||
let msigTxn = multisig.MultisigTransaction.from_obj_for_encoding(multisigTxObj.txn); | ||
let partialSignedBlob = msigTxn.partialSignTxn({version, threshold, pks}, sk); | ||
@@ -160,0 +160,0 @@ return { |
@@ -18,5 +18,5 @@ const nacl = require('./nacl/naclWrappers'); | ||
/** | ||
* MultiSigTransaction is a Transaction that also supports creating partially-signed multisig transactions. | ||
* MultisigTransaction is a Transaction that also supports creating partially-signed multisig transactions. | ||
*/ | ||
class MultiSigTransaction extends txnBuilder.Transaction { | ||
class MultisigTransaction extends txnBuilder.Transaction { | ||
get_obj_for_encoding() { | ||
@@ -119,3 +119,3 @@ if (this.hasOwnProperty("objForEncoding")) { | ||
const refSigTx = encoding.decode(multisigTxnBlobs[0]); | ||
const refSigAlgoTx = MultiSigTransaction.from_obj_for_encoding(refSigTx.txn); | ||
const refSigAlgoTx = MultisigTransaction.from_obj_for_encoding(refSigTx.txn); | ||
const refTxIDStr = refSigAlgoTx.txID().toString(); | ||
@@ -127,3 +127,3 @@ const from = address.encode(refSigTx.txn.snd); | ||
let unisig = encoding.decode(multisigTxnBlobs[i]); | ||
let unisigAlgoTxn = MultiSigTransaction.from_obj_for_encoding(unisig.txn); | ||
let unisigAlgoTxn = MultisigTransaction.from_obj_for_encoding(unisig.txn); | ||
if (unisigAlgoTxn.txID().toString() !== refTxIDStr) { | ||
@@ -180,3 +180,3 @@ throw ERROR_MULTISIG_MERGE_MISMATCH; | ||
module.exports = { | ||
MultiSigTransaction, | ||
MultisigTransaction, | ||
mergeMultisigTransactions, | ||
@@ -183,0 +183,0 @@ createMultisigTransaction, |
@@ -42,3 +42,3 @@ let assert = require('assert'); | ||
let msigTxn = multisig.MultiSigTransaction.from_obj_for_encoding(o); | ||
let msigTxn = multisig.MultisigTransaction.from_obj_for_encoding(o); | ||
let seed = passphrase.seedFromMnemonic(mnem1); | ||
@@ -83,3 +83,3 @@ let sk = nacl.keyPairFromSeed(seed).secretKey; | ||
let msigTxn = multisig.MultiSigTransaction.from_obj_for_encoding(o); | ||
let msigTxn = multisig.MultisigTransaction.from_obj_for_encoding(o); | ||
let seed = passphrase.seedFromMnemonic(mnem2); | ||
@@ -109,3 +109,3 @@ let sk = nacl.keyPairFromSeed(seed).secretKey; | ||
const decRawTx = encoding.decode(rawTxBlob).txn; | ||
let msigTxn = multisig.MultiSigTransaction.from_obj_for_encoding(decRawTx); | ||
let msigTxn = multisig.MultisigTransaction.from_obj_for_encoding(decRawTx); | ||
let mnem1 = "auction inquiry lava second expand liberty glass involve ginger illness length room item discover ahead table doctor term tackle cement bonus profit right above catch"; | ||
@@ -132,3 +132,3 @@ let seed = passphrase.seedFromMnemonic(mnem1); | ||
const decRawTx = encoding.decode(rawOneSigTxBlob).txn; | ||
let msigTxn = multisig.MultiSigTransaction.from_obj_for_encoding(decRawTx); | ||
let msigTxn = multisig.MultisigTransaction.from_obj_for_encoding(decRawTx); | ||
let mnem3 = "advice pudding treat near rule blouse same whisper inner electric quit surface sunny dismiss leader blood seat clown cost exist hospital century reform able sponsor"; | ||
@@ -135,0 +135,0 @@ let seed = passphrase.seedFromMnemonic(mnem3); |
Sorry, the diff of this file is too big to display
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
319401
29
4220
6
+ Addedjs-yaml@>=3.13.1
+ Addedargparse@2.0.1(transitive)
+ Addedjs-yaml@4.1.0(transitive)