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

algosdk

Package Overview
Dependencies
Maintainers
6
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

algosdk - npm Package Compare versions

Comparing version 1.19.0 to 1.19.1

2

dist/cjs/src/logic/logic.js

@@ -196,3 +196,3 @@ "use strict";

if (version < 4 && cost > maxCost) {
throw new Error('program too costly for Teal version < 4. consider using v4.');
throw new Error('program too costly for version < 4. consider using v4.');
}

@@ -199,0 +199,0 @@ return [ints, byteArrays, true];

@@ -32,3 +32,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.LogicTemplates = exports.SourceMap = exports.multisigAddress = exports.appendSignMultisigTransaction = exports.mergeMultisigTransactions = exports.signMultisigTransaction = exports.tealSignFromProgram = exports.tealSign = exports.logicSigFromByte = exports.signLogicSigTransactionObject = exports.signLogicSigTransaction = exports.makeLogicSig = exports.LogicSigAccount = exports.assignGroupID = exports.computeGroupID = exports.INVALID_MICROALGOS_ERROR_MSG = exports.algosToMicroalgos = exports.microalgosToAlgos = exports.mnemonicFromSeed = exports.seedFromMnemonic = exports.mnemonicToSecretKey = exports.secretKeyToMnemonic = exports.masterDerivationKeyToMnemonic = exports.mnemonicToMasterDerivationKey = exports.modelsv2 = exports.generateAccount = exports.decodeUint64 = exports.encodeUint64 = exports.bigIntToBytes = exports.bytesToBigInt = exports.getApplicationAddress = exports.decodeAddress = exports.encodeAddress = exports.isValidAddress = exports.waitForConfirmation = exports.Indexer = exports.IntDecoding = exports.Kmd = exports.Algodv2 = exports.ERROR_INVALID_MICROALGOS = exports.ERROR_MULTISIG_BAD_SENDER = exports.decodeObj = exports.encodeObj = exports.verifyBytes = exports.signBytes = exports.signBid = exports.signTransaction = exports.MULTISIG_BAD_SENDER_ERROR_MSG = void 0;
exports.SourceMap = exports.multisigAddress = exports.verifyMultisig = exports.appendSignRawMultisigSignature = exports.createMultisigTransaction = exports.appendSignMultisigTransaction = exports.mergeMultisigTransactions = exports.signMultisigTransaction = exports.tealSignFromProgram = exports.tealSign = exports.logicSigFromByte = exports.signLogicSigTransactionObject = exports.signLogicSigTransaction = exports.makeLogicSig = exports.LogicSigAccount = exports.assignGroupID = exports.computeGroupID = exports.INVALID_MICROALGOS_ERROR_MSG = exports.algosToMicroalgos = exports.microalgosToAlgos = exports.mnemonicFromSeed = exports.seedFromMnemonic = exports.mnemonicToSecretKey = exports.secretKeyToMnemonic = exports.masterDerivationKeyToMnemonic = exports.mnemonicToMasterDerivationKey = exports.modelsv2 = exports.generateAccount = exports.decodeUint64 = exports.encodeUint64 = exports.bigIntToBytes = exports.bytesToBigInt = exports.getApplicationAddress = exports.decodeAddress = exports.encodeAddress = exports.isValidAddress = exports.waitForConfirmation = exports.Indexer = exports.IntDecoding = exports.Kmd = exports.Algodv2 = exports.ERROR_INVALID_MICROALGOS = exports.ERROR_MULTISIG_BAD_SENDER = exports.decodeObj = exports.encodeObj = exports.verifyBytes = exports.signBytes = exports.signBid = exports.signTransaction = exports.MULTISIG_BAD_SENDER_ERROR_MSG = void 0;
exports.LogicTemplates = void 0;
const nacl = __importStar(require("./nacl/naclWrappers"));

@@ -185,2 +186,5 @@ const address = __importStar(require("./encoding/address"));

Object.defineProperty(exports, "appendSignMultisigTransaction", { enumerable: true, get: function () { return multisig_1.appendSignMultisigTransaction; } });
Object.defineProperty(exports, "createMultisigTransaction", { enumerable: true, get: function () { return multisig_1.createMultisigTransaction; } });
Object.defineProperty(exports, "appendSignRawMultisigSignature", { enumerable: true, get: function () { return multisig_1.appendSignRawMultisigSignature; } });
Object.defineProperty(exports, "verifyMultisig", { enumerable: true, get: function () { return multisig_1.verifyMultisig; } });
Object.defineProperty(exports, "multisigAddress", { enumerable: true, get: function () { return multisig_1.multisigAddress; } });

@@ -187,0 +191,0 @@ var sourcemap_1 = require("./logic/sourcemap");

@@ -26,3 +26,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.multisigAddress = exports.appendSignMultisigTransaction = exports.signMultisigTransaction = exports.verifyMultisig = exports.mergeMultisigTransactions = exports.MultisigTransaction = exports.MULTISIG_USE_PARTIAL_SIGN_ERROR_MSG = exports.MULTISIG_NO_MUTATE_ERROR_MSG = exports.MULTISIG_MERGE_SIG_MISMATCH_ERROR_MSG = exports.MULTISIG_MERGE_WRONG_PREIMAGE_ERROR_MSG = exports.MULTISIG_MERGE_MISMATCH_AUTH_ADDR_MSG = exports.MULTISIG_MERGE_MISMATCH_ERROR_MSG = exports.MULTISIG_MERGE_LESSTHANTWO_ERROR_MSG = void 0;
exports.multisigAddress = exports.appendSignRawMultisigSignature = exports.appendSignMultisigTransaction = exports.signMultisigTransaction = exports.verifyMultisig = exports.mergeMultisigTransactions = exports.MultisigTransaction = exports.createMultisigTransaction = exports.MULTISIG_SIGNATURE_LENGTH_ERROR_MSG = exports.MULTISIG_USE_PARTIAL_SIGN_ERROR_MSG = exports.MULTISIG_NO_MUTATE_ERROR_MSG = exports.MULTISIG_MERGE_SIG_MISMATCH_ERROR_MSG = exports.MULTISIG_MERGE_WRONG_PREIMAGE_ERROR_MSG = exports.MULTISIG_MERGE_MISMATCH_AUTH_ADDR_MSG = exports.MULTISIG_MERGE_MISMATCH_ERROR_MSG = exports.MULTISIG_MERGE_LESSTHANTWO_ERROR_MSG = void 0;
const nacl = __importStar(require("./nacl/naclWrappers"));

@@ -44,28 +44,15 @@ const address = __importStar(require("./encoding/address"));

exports.MULTISIG_USE_PARTIAL_SIGN_ERROR_MSG = 'Cannot sign a multisig transaction using `signTxn`. Use `partialSignTxn` instead.';
exports.MULTISIG_SIGNATURE_LENGTH_ERROR_MSG = 'Cannot add multisig signature. Signature is not of the correct length.';
/**
* createMultisigTransaction creates a multisig transaction blob.
* @param txnForEncoding - the actual transaction to sign.
* @param rawSig - a Buffer raw signature of that transaction
* @param myPk - a public key that corresponds with rawSig
* createRawMultisigTransaction creates a raw, unsigned multisig transaction blob.
* @param txn - the actual transaction.
* @param version - multisig version
* @param threshold - mutlisig threshold
* @param threshold - multisig threshold
* @param pks - ordered list of public keys in this multisig
* @returns encoded multisig blob
*/
function createMultisigTransaction(txnForEncoding, { rawSig, myPk }, { version, threshold, pks }) {
let keyExist = false;
function createMultisigTransaction(txn, { version, threshold, addrs }) {
// construct the appendable multisigned transaction format
const subsigs = pks.map((pk) => {
if (nacl.bytesEqual(pk, myPk)) {
keyExist = true;
return {
pk: Buffer.from(pk),
s: rawSig,
};
}
return { pk: Buffer.from(pk) };
});
if (keyExist === false) {
throw new Error(MULTISIG_KEY_NOT_EXIST_ERROR_MSG);
}
const pks = addrs.map((addr) => address.decodeAddress(addr).publicKey);
const subsigs = pks.map((pk) => ({ pk: Buffer.from(pk) }));
const msig = {

@@ -76,2 +63,3 @@ v: version,

};
const txnForEncoding = txn.get_obj_for_encoding();
const signedTxn = {

@@ -94,3 +82,46 @@ msig,

}
exports.createMultisigTransaction = createMultisigTransaction;
/**
* createMultisigTransactionWithSignature creates a multisig transaction blob with an included signature.
* @param txn - the actual transaction to sign.
* @param rawSig - a Buffer raw signature of that transaction
* @param myPk - a public key that corresponds with rawSig
* @param version - multisig version
* @param threshold - multisig threshold
* @param pks - ordered list of public keys in this multisig
* @returns encoded multisig blob
*/
function createMultisigTransactionWithSignature(txn, { rawSig, myPk }, { version, threshold, pks }) {
// Create an empty encoded multisig transaction
const encodedMsig = createMultisigTransaction(txn, {
version,
threshold,
addrs: pks.map((pk) => address.encodeAddress(pk)),
});
// note: this is not signed yet, but will be shortly
const signedTxn = encoding.decode(encodedMsig);
let keyExist = false;
// append the multisig signature to the corresponding public key in the multisig blob
signedTxn.msig.subsig.forEach((subsig, i) => {
if (nacl.bytesEqual(subsig.pk, myPk)) {
keyExist = true;
signedTxn.msig.subsig[i].s = rawSig;
}
});
if (keyExist === false) {
throw new Error(MULTISIG_KEY_NOT_EXIST_ERROR_MSG);
}
// if the address of this multisig is different from the transaction sender,
// we need to add the auth-addr field
const msigAddr = address.fromMultisigPreImg({
version,
threshold,
pks,
});
if (address.encodeAddress(signedTxn.txn.snd) !== address.encodeAddress(msigAddr)) {
signedTxn.sgnr = Buffer.from(msigAddr);
}
return new Uint8Array(encoding.encode(signedTxn));
}
/**
* MultisigTransaction is a Transaction that also supports creating partially-signed multisig transactions.

@@ -128,4 +159,21 @@ */

const myPk = nacl.keyPairFromSecretKey(sk).publicKey;
return createMultisigTransaction(this.get_obj_for_encoding(), { rawSig: this.rawSignTxn(sk), myPk }, { version, threshold, pks });
return createMultisigTransactionWithSignature(this, { rawSig: this.rawSignTxn(sk), myPk }, { version, threshold, pks });
}
/**
* partialSignWithMultisigSignature partially signs this transaction with an external raw multisig signature and returns
* a partially-signed multisig transaction, encoded with msgpack as a typed array.
* @param metadata - multisig metadata
* @param signerAddr - address of the signer
* @param signature - raw multisig signature
* @returns an encoded, partially signed multisig transaction.
*/
partialSignWithMultisigSignature(metadata, signerAddr, signature) {
if (!nacl.isValidSignatureLength(signature.length)) {
throw new Error(exports.MULTISIG_SIGNATURE_LENGTH_ERROR_MSG);
}
return createMultisigTransactionWithSignature(this, {
rawSig: signature,
myPk: address.decodeAddress(signerAddr).publicKey,
}, metadata);
}
// eslint-disable-next-line camelcase

@@ -269,3 +317,3 @@ static from_obj_for_encoding(txnForEnc) {

* a multisig transaction, which is a blob representing a transaction and multisignature account preimage. The returned
* multisig txn can accumulate additional signatures through mergeMultisigTransactions or appendMultisigTransaction.
* multisig txn can accumulate additional signatures through mergeMultisigTransactions or appendSignMultisigTransaction.
* @param txn - object with either payment or key registration fields

@@ -334,4 +382,27 @@ * @param version - multisig version

/**
* appendMultisigTransactionSignature takes a multisig transaction blob, and appends a given raw signature to it.
* This makes it possible to compile a multisig signature using only raw signatures from external methods.
* @param multisigTxnBlob - an encoded multisig txn. Supports non-payment txn types.
* @param version - multisig version
* @param threshold - multisig threshold
* @param addrs - a list of Algorand addresses representing possible signers for this multisig. Order is important.
* @param signerAddr - address of the signer
* @param signature - raw multisig signature
* @returns object containing txID, and blob representing encoded multisig txn
*/
function appendSignRawMultisigSignature(multisigTxnBlob, { version, threshold, addrs }, signerAddr, signature) {
const pks = addrs.map((addr) => address.decodeAddress(addr).publicKey);
// obtain underlying txn, sign it, and merge it
const multisigTxObj = encoding.decode(multisigTxnBlob);
const msigTxn = MultisigTransaction.from_obj_for_encoding(multisigTxObj.txn);
const partialSignedBlob = msigTxn.partialSignWithMultisigSignature({ version, threshold, pks }, signerAddr, signature);
return {
txID: msigTxn.txID().toString(),
blob: mergeMultisigTransactions([multisigTxnBlob, partialSignedBlob]),
};
}
exports.appendSignRawMultisigSignature = appendSignRawMultisigSignature;
/**
* multisigAddress takes multisig metadata (preimage) and returns the corresponding human readable Algorand address.
* @param version - mutlisig version
* @param version - multisig version
* @param threshold - multisig threshold

@@ -338,0 +409,0 @@ * @param addrs - list of Algorand addresses

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.SEED_BTYES_LENGTH = exports.HASH_BYTES_LENGTH = exports.SECRET_KEY_LENGTH = exports.PUBLIC_KEY_LENGTH = exports.verify = exports.bytesEqual = exports.sign = exports.keyPairFromSecretKey = exports.keyPair = exports.keyPairFromSeed = exports.randomBytes = exports.genericHash = void 0;
exports.SEED_BTYES_LENGTH = exports.HASH_BYTES_LENGTH = exports.SECRET_KEY_LENGTH = exports.PUBLIC_KEY_LENGTH = exports.verify = exports.bytesEqual = exports.sign = exports.keyPairFromSecretKey = exports.isValidSignatureLength = exports.keyPair = exports.keyPairFromSeed = exports.randomBytes = exports.genericHash = void 0;
const tweetnacl_1 = __importDefault(require("tweetnacl"));

@@ -27,2 +27,6 @@ const js_sha512_1 = __importDefault(require("js-sha512"));

exports.keyPair = keyPair;
function isValidSignatureLength(len) {
return len === tweetnacl_1.default.sign.signatureLength;
}
exports.isValidSignatureLength = isValidSignatureLength;
function keyPairFromSecretKey(sk) {

@@ -29,0 +33,0 @@ return tweetnacl_1.default.sign.keyPair.fromSecretKey(sk);

@@ -861,2 +861,17 @@ "use strict";

}
attachSignature(signerAddr, signature) {
if (!nacl.isValidSignatureLength(signature.length)) {
throw new Error('Invalid signature length');
}
const sTxn = {
sig: Buffer.from(signature),
txn: this.get_obj_for_encoding(),
};
// add AuthAddr if signing with a different key than From indicates
if (signerAddr !== address.encodeAddress(this.from.publicKey)) {
const signerPublicKey = address.decodeAddress(signerAddr).publicKey;
sTxn.sgnr = Buffer.from(signerPublicKey);
}
return new Uint8Array(encoding.encode(sTxn));
}
rawTxID() {

@@ -863,0 +878,0 @@ const enMsg = this.toByte();

@@ -189,3 +189,3 @@ /* eslint-disable no-bitwise */

if (version < 4 && cost > maxCost) {
throw new Error('program too costly for Teal version < 4. consider using v4.');
throw new Error('program too costly for version < 4. consider using v4.');
}

@@ -192,0 +192,0 @@ return [ints, byteArrays, true];

@@ -111,3 +111,3 @@ import * as nacl from './nacl/naclWrappers';

export { LogicSigAccount, makeLogicSig, signLogicSigTransaction, signLogicSigTransactionObject, logicSigFromByte, tealSign, tealSignFromProgram, } from './logicsig';
export { signMultisigTransaction, mergeMultisigTransactions, appendSignMultisigTransaction, multisigAddress, } from './multisig';
export { signMultisigTransaction, mergeMultisigTransactions, appendSignMultisigTransaction, createMultisigTransaction, appendSignRawMultisigSignature, verifyMultisig, multisigAddress, } from './multisig';
export { SourceMap } from './logic/sourcemap';

@@ -114,0 +114,0 @@ export const LogicTemplates = LogicTemplatesCommonJSExport.default;

@@ -17,28 +17,15 @@ import * as nacl from './nacl/naclWrappers';

export const MULTISIG_USE_PARTIAL_SIGN_ERROR_MSG = 'Cannot sign a multisig transaction using `signTxn`. Use `partialSignTxn` instead.';
export const MULTISIG_SIGNATURE_LENGTH_ERROR_MSG = 'Cannot add multisig signature. Signature is not of the correct length.';
/**
* createMultisigTransaction creates a multisig transaction blob.
* @param txnForEncoding - the actual transaction to sign.
* @param rawSig - a Buffer raw signature of that transaction
* @param myPk - a public key that corresponds with rawSig
* createRawMultisigTransaction creates a raw, unsigned multisig transaction blob.
* @param txn - the actual transaction.
* @param version - multisig version
* @param threshold - mutlisig threshold
* @param threshold - multisig threshold
* @param pks - ordered list of public keys in this multisig
* @returns encoded multisig blob
*/
function createMultisigTransaction(txnForEncoding, { rawSig, myPk }, { version, threshold, pks }) {
let keyExist = false;
export function createMultisigTransaction(txn, { version, threshold, addrs }) {
// construct the appendable multisigned transaction format
const subsigs = pks.map((pk) => {
if (nacl.bytesEqual(pk, myPk)) {
keyExist = true;
return {
pk: Buffer.from(pk),
s: rawSig,
};
}
return { pk: Buffer.from(pk) };
});
if (keyExist === false) {
throw new Error(MULTISIG_KEY_NOT_EXIST_ERROR_MSG);
}
const pks = addrs.map((addr) => address.decodeAddress(addr).publicKey);
const subsigs = pks.map((pk) => ({ pk: Buffer.from(pk) }));
const msig = {

@@ -49,2 +36,3 @@ v: version,

};
const txnForEncoding = txn.get_obj_for_encoding();
const signedTxn = {

@@ -68,2 +56,44 @@ msig,

/**
* createMultisigTransactionWithSignature creates a multisig transaction blob with an included signature.
* @param txn - the actual transaction to sign.
* @param rawSig - a Buffer raw signature of that transaction
* @param myPk - a public key that corresponds with rawSig
* @param version - multisig version
* @param threshold - multisig threshold
* @param pks - ordered list of public keys in this multisig
* @returns encoded multisig blob
*/
function createMultisigTransactionWithSignature(txn, { rawSig, myPk }, { version, threshold, pks }) {
// Create an empty encoded multisig transaction
const encodedMsig = createMultisigTransaction(txn, {
version,
threshold,
addrs: pks.map((pk) => address.encodeAddress(pk)),
});
// note: this is not signed yet, but will be shortly
const signedTxn = encoding.decode(encodedMsig);
let keyExist = false;
// append the multisig signature to the corresponding public key in the multisig blob
signedTxn.msig.subsig.forEach((subsig, i) => {
if (nacl.bytesEqual(subsig.pk, myPk)) {
keyExist = true;
signedTxn.msig.subsig[i].s = rawSig;
}
});
if (keyExist === false) {
throw new Error(MULTISIG_KEY_NOT_EXIST_ERROR_MSG);
}
// if the address of this multisig is different from the transaction sender,
// we need to add the auth-addr field
const msigAddr = address.fromMultisigPreImg({
version,
threshold,
pks,
});
if (address.encodeAddress(signedTxn.txn.snd) !== address.encodeAddress(msigAddr)) {
signedTxn.sgnr = Buffer.from(msigAddr);
}
return new Uint8Array(encoding.encode(signedTxn));
}
/**
* MultisigTransaction is a Transaction that also supports creating partially-signed multisig transactions.

@@ -101,4 +131,21 @@ */

const myPk = nacl.keyPairFromSecretKey(sk).publicKey;
return createMultisigTransaction(this.get_obj_for_encoding(), { rawSig: this.rawSignTxn(sk), myPk }, { version, threshold, pks });
return createMultisigTransactionWithSignature(this, { rawSig: this.rawSignTxn(sk), myPk }, { version, threshold, pks });
}
/**
* partialSignWithMultisigSignature partially signs this transaction with an external raw multisig signature and returns
* a partially-signed multisig transaction, encoded with msgpack as a typed array.
* @param metadata - multisig metadata
* @param signerAddr - address of the signer
* @param signature - raw multisig signature
* @returns an encoded, partially signed multisig transaction.
*/
partialSignWithMultisigSignature(metadata, signerAddr, signature) {
if (!nacl.isValidSignatureLength(signature.length)) {
throw new Error(MULTISIG_SIGNATURE_LENGTH_ERROR_MSG);
}
return createMultisigTransactionWithSignature(this, {
rawSig: signature,
myPk: address.decodeAddress(signerAddr).publicKey,
}, metadata);
}
// eslint-disable-next-line camelcase

@@ -239,3 +286,3 @@ static from_obj_for_encoding(txnForEnc) {

* a multisig transaction, which is a blob representing a transaction and multisignature account preimage. The returned
* multisig txn can accumulate additional signatures through mergeMultisigTransactions or appendMultisigTransaction.
* multisig txn can accumulate additional signatures through mergeMultisigTransactions or appendSignMultisigTransaction.
* @param txn - object with either payment or key registration fields

@@ -302,4 +349,26 @@ * @param version - multisig version

/**
* appendMultisigTransactionSignature takes a multisig transaction blob, and appends a given raw signature to it.
* This makes it possible to compile a multisig signature using only raw signatures from external methods.
* @param multisigTxnBlob - an encoded multisig txn. Supports non-payment txn types.
* @param version - multisig version
* @param threshold - multisig threshold
* @param addrs - a list of Algorand addresses representing possible signers for this multisig. Order is important.
* @param signerAddr - address of the signer
* @param signature - raw multisig signature
* @returns object containing txID, and blob representing encoded multisig txn
*/
export function appendSignRawMultisigSignature(multisigTxnBlob, { version, threshold, addrs }, signerAddr, signature) {
const pks = addrs.map((addr) => address.decodeAddress(addr).publicKey);
// obtain underlying txn, sign it, and merge it
const multisigTxObj = encoding.decode(multisigTxnBlob);
const msigTxn = MultisigTransaction.from_obj_for_encoding(multisigTxObj.txn);
const partialSignedBlob = msigTxn.partialSignWithMultisigSignature({ version, threshold, pks }, signerAddr, signature);
return {
txID: msigTxn.txID().toString(),
blob: mergeMultisigTransactions([multisigTxnBlob, partialSignedBlob]),
};
}
/**
* multisigAddress takes multisig metadata (preimage) and returns the corresponding human readable Algorand address.
* @param version - mutlisig version
* @param version - multisig version
* @param threshold - multisig threshold

@@ -306,0 +375,0 @@ * @param addrs - list of Algorand addresses

@@ -16,2 +16,5 @@ import nacl from 'tweetnacl';

}
export function isValidSignatureLength(len) {
return len === nacl.sign.signatureLength;
}
export function keyPairFromSecretKey(sk) {

@@ -18,0 +21,0 @@ return nacl.sign.keyPair.fromSecretKey(sk);

@@ -832,2 +832,17 @@ import base32 from 'hi-base32';

}
attachSignature(signerAddr, signature) {
if (!nacl.isValidSignatureLength(signature.length)) {
throw new Error('Invalid signature length');
}
const sTxn = {
sig: Buffer.from(signature),
txn: this.get_obj_for_encoding(),
};
// add AuthAddr if signing with a different key than From indicates
if (signerAddr !== address.encodeAddress(this.from.publicKey)) {
const signerPublicKey = address.decodeAddress(signerAddr).publicKey;
sTxn.sgnr = Buffer.from(signerPublicKey);
}
return new Uint8Array(encoding.encode(sTxn));
}
rawTxID() {

@@ -834,0 +849,0 @@ const enMsg = this.toByte();

@@ -80,3 +80,3 @@ import * as txnBuilder from './transaction';

export { LogicSigAccount, makeLogicSig, signLogicSigTransaction, signLogicSigTransactionObject, logicSigFromByte, tealSign, tealSignFromProgram, } from './logicsig';
export { signMultisigTransaction, mergeMultisigTransactions, appendSignMultisigTransaction, multisigAddress, } from './multisig';
export { signMultisigTransaction, mergeMultisigTransactions, appendSignMultisigTransaction, createMultisigTransaction, appendSignRawMultisigSignature, verifyMultisig, multisigAddress, } from './multisig';
export { SourceMap } from './logic/sourcemap';

@@ -83,0 +83,0 @@ export declare const LogicTemplates: any;

@@ -15,2 +15,3 @@ import * as txnBuilder from './transaction';

export declare const MULTISIG_USE_PARTIAL_SIGN_ERROR_MSG = "Cannot sign a multisig transaction using `signTxn`. Use `partialSignTxn` instead.";
export declare const MULTISIG_SIGNATURE_LENGTH_ERROR_MSG = "Cannot add multisig signature. Signature is not of the correct length.";
interface MultisigMetadataWithPks extends Omit<MultisigMetadata, 'addrs'> {

@@ -20,2 +21,11 @@ pks: Uint8Array[];

/**
* createRawMultisigTransaction creates a raw, unsigned multisig transaction blob.
* @param txn - the actual transaction.
* @param version - multisig version
* @param threshold - multisig threshold
* @param pks - ordered list of public keys in this multisig
* @returns encoded multisig blob
*/
export declare function createMultisigTransaction(txn: txnBuilder.Transaction, { version, threshold, addrs }: MultisigMetadata): Uint8Array;
/**
* MultisigTransaction is a Transaction that also supports creating partially-signed multisig transactions.

@@ -46,2 +56,11 @@ */

partialSignTxn({ version, threshold, pks }: MultisigMetadataWithPks, sk: Uint8Array): Uint8Array;
/**
* partialSignWithMultisigSignature partially signs this transaction with an external raw multisig signature and returns
* a partially-signed multisig transaction, encoded with msgpack as a typed array.
* @param metadata - multisig metadata
* @param signerAddr - address of the signer
* @param signature - raw multisig signature
* @returns an encoded, partially signed multisig transaction.
*/
partialSignWithMultisigSignature(metadata: MultisigMetadataWithPks, signerAddr: string, signature: Uint8Array): Uint8Array;
static from_obj_for_encoding(txnForEnc: EncodedTransaction): MultisigTransaction;

@@ -59,3 +78,3 @@ }

* a multisig transaction, which is a blob representing a transaction and multisignature account preimage. The returned
* multisig txn can accumulate additional signatures through mergeMultisigTransactions or appendMultisigTransaction.
* multisig txn can accumulate additional signatures through mergeMultisigTransactions or appendSignMultisigTransaction.
* @param txn - object with either payment or key registration fields

@@ -89,4 +108,19 @@ * @param version - multisig version

/**
* appendMultisigTransactionSignature takes a multisig transaction blob, and appends a given raw signature to it.
* This makes it possible to compile a multisig signature using only raw signatures from external methods.
* @param multisigTxnBlob - an encoded multisig txn. Supports non-payment txn types.
* @param version - multisig version
* @param threshold - multisig threshold
* @param addrs - a list of Algorand addresses representing possible signers for this multisig. Order is important.
* @param signerAddr - address of the signer
* @param signature - raw multisig signature
* @returns object containing txID, and blob representing encoded multisig txn
*/
export declare function appendSignRawMultisigSignature(multisigTxnBlob: Uint8Array, { version, threshold, addrs }: MultisigMetadata, signerAddr: string, signature: Uint8Array): {
txID: string;
blob: Uint8Array;
};
/**
* multisigAddress takes multisig metadata (preimage) and returns the corresponding human readable Algorand address.
* @param version - mutlisig version
* @param version - multisig version
* @param threshold - multisig threshold

@@ -93,0 +127,0 @@ * @param addrs - list of Algorand addresses

@@ -7,2 +7,3 @@ import nacl from 'tweetnacl';

export declare function keyPair(): nacl.SignKeyPair;
export declare function isValidSignatureLength(len: number): boolean;
export declare function keyPairFromSecretKey(sk: Uint8Array): nacl.SignKeyPair;

@@ -9,0 +10,0 @@ export declare function sign(msg: Uint8Array, secretKey: Uint8Array): Uint8Array;

@@ -126,2 +126,3 @@ /// <reference types="node" />

signTxn(sk: Uint8Array): Uint8Array;
attachSignature(signerAddr: string, signature: Uint8Array): Uint8Array;
rawTxID(): Buffer;

@@ -128,0 +129,0 @@ txID(): string;

{
"name": "algosdk",
"version": "1.19.0",
"version": "1.19.1",
"description": "The official JavaScript SDK for Algorand",

@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js",

@@ -25,4 +25,4 @@ # js-algorand-sdk

<script
src="https://unpkg.com/algosdk@v1.19.0/dist/browser/algosdk.min.js"
integrity="sha384-5cebCuqDx6A5Y1HeScIKIcSdqsub2M3wwkqTZyu45M8zN/+do8cgxcHDJjkaVTNb"
src="https://unpkg.com/algosdk@v1.19.1/dist/browser/algosdk.min.js"
integrity="sha384-vpY7inPLTrCOYSwaOYlQbFwoSY/t3lFMVjAh/iXN+86fNAQ39DeQjlX87aczChqD"
crossorigin="anonymous"

@@ -36,4 +36,4 @@ ></script>

<script
src="https://cdn.jsdelivr.net/npm/algosdk@v1.19.0/dist/browser/algosdk.min.js"
integrity="sha384-5cebCuqDx6A5Y1HeScIKIcSdqsub2M3wwkqTZyu45M8zN/+do8cgxcHDJjkaVTNb"
src="https://cdn.jsdelivr.net/npm/algosdk@v1.19.1/dist/browser/algosdk.min.js"
integrity="sha384-vpY7inPLTrCOYSwaOYlQbFwoSY/t3lFMVjAh/iXN+86fNAQ39DeQjlX87aczChqD"
crossorigin="anonymous"

@@ -40,0 +40,0 @@ ></script>

Sorry, the diff of this file is too big to display

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

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

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

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