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

slopes

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slopes - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

2

package.json
{
"name": "slopes",
"version": "1.2.1",
"version": "1.3.0",
"description": "AVA Platform JS Library",

@@ -5,0 +5,0 @@ "main": "typings/src/index.js",

@@ -6,7 +6,7 @@ /**

import { Buffer } from "buffer/";
import { JRPCAPI, RequestResponseData } from "../../utils/types";
import { JRPCAPI, RequestResponseData, Defaults } from "../../utils/types";
import { UTXOSet } from './utxos';
import { MergeRule, UnixNow } from './types';
import { MergeRule, UnixNow, AVMConstants, InitialStates } from './types';
import { AVMKeyChain } from './keychain';
import { TxUnsigned, Tx } from './tx';
import { TxUnsigned, Tx, TxCreateAsset } from './tx';
import BN from "bn.js";

@@ -85,9 +85,24 @@ import BinTools from '../../utils/bintools';

*/
protected keychain:AVMKeyChain = new AVMKeyChain();
protected keychain:AVMKeyChain = new AVMKeyChain("");
protected blockchainID:string = "";
protected AVAAssetID:Buffer = undefined;
/**
* Gets the alias for the blockchainID if it exists, otherwise returns `undefined`.
*
* @returns The alias for the blockchainID
*/
getBlockchainAlias = ():string => {
let netid:number = this.core.getNetworkID();
if(netid in Defaults.network && this.blockchainID in Defaults.network[netid]){
return Defaults.network[netid][this.blockchainID].alias;
}
/* istanbul ignore next */
return undefined;
}
/**
* Gets the blockchainID and returns it.
*
* @returns The the provided string representing the blockchainID
* @returns The blockchainID
*/

@@ -99,2 +114,31 @@ getBlockchainID = ():string => {

/**
* Takes an address string and returns its {@link https://github.com/feross/buffer|Buffer} representation if valid.
*
* @returns A {@link https://github.com/feross/buffer|Buffer} for the address if valid, undefined if not valid.
*/
parseAddress = (addr:string):Buffer => {
let alias:string = this.getBlockchainAlias();
let blockchainID:string = this.getBlockchainID();
return bintools.parseAddress(addr, blockchainID, alias, AVMConstants.ADDRESSLENGTH);
}
addressFromBuffer = (address:Buffer):string => {
let chainid:string = this.getBlockchainAlias() ? this.getBlockchainAlias() : this.getBlockchainID();
return bintools.addressToString(chainid, address);
}
/**
* Fetches the AVA AssetID and returns it in a Promise.
*
* @returns The the provided string representing the blockchainID
*/
getAVAAssetID = async ():Promise<Buffer> => {
if(typeof this.AVAAssetID === 'undefined'){
let asset:object = await this.getAssetDescription("AVA");
this.AVAAssetID = asset["assetID"];
}
return this.AVAAssetID;
}
/**
* Gets a reference to the keychain for this class.

@@ -113,3 +157,8 @@ *

//warning, overwrites the old keychain
this.keychain = new AVMKeyChain();
let alias = this.getBlockchainAlias();
if(alias){
this.keychain = new AVMKeyChain(alias);
} else {
this.keychain = new AVMKeyChain(this.blockchainID);
}
return this.keychain;

@@ -119,15 +168,76 @@ }

/**
* Creates an asset of a given amount and assigns it to the address provided.
* Gets the balance of a particular asset on a subnet.
*
* @param amount The amount of the asset to be created. If Amount is 10, for example, there will be exist 10 units of the new asset
* @param address The base 58 string representation of the address that holds all units of the new asset upon creation of the asset
* @param address The address to pull the asset balance from
* @param assetID The assetID to pull the balance from
*
* @returns Promise with the balance of the assetID on the provided address for the subnet.
*/
getBalance = async (address:string, assetID:string):Promise<number> => {
if(typeof this.parseAddress(address) === "undefined"){
/* istanbul ignore next */
throw new Error("Error - AVMAPI.getBalance: Invalid address format " + address);
}
let params = {
"address": address,
"assetID": assetID
};
return this.callMethod("avm.getBalance", params).then((response:RequestResponseData) => {
return parseInt(response.data["result"]["balance"]);
});
}
/**
* Creates an address (and associated private keys) on a user under a subnet.
*
* @param username Name of the user to create the address under
* @param password Password to unlock the user and encrypt the private key
*
* @returns Promise for a string representing the address created by the subnet.
*/
createAddress = async (username:string, password:string):Promise<string> => {
let params = {
"username": username,
"password": password
};
return this.callMethod("avm.createAddress", params).then((response:RequestResponseData) => {
return response.data["result"]["address"];
});
}
/**
* Create a new fixed-cap, fungible asset. A quantity of it is created at initialization and there no more is ever created.
*
* @param username The user paying the transaction fee (in $AVA) for asset creation
* @param password The password for the user paying the transaction fee (in $AVA) for asset creation
* @param name The human-readable name for the asset
* @param symbol Optional. The shorthand symbol for the asset. Between 0 and 4 characters
* @param initialHolders An array of objects containing the field "address" and "amount" to establish the genesis values for the new asset
*
* ```js
* Example initialHolders:
* [
* {
* "address": "X-7sik3Pr6r1FeLrvK1oWwECBS8iJ5VPuSh",
* "amount": 10000
* },
* {
* "address": "X-7sik3Pr6r1FeLrvK1oWwECBS8iJ5VPuSh",
* "amount": 50000
* }
* ]
* ```
*
* @returns Returns a Promise<string> containing the base 58 string representation of the ID of the newly created asset.
*/
createAsset = async (amount:number, address:string):Promise<string> => {
createFixedCapAsset = async (username:string, password:string, name:string, symbol:string, initialHolders:Array<object>):Promise<string> => {
let params = {
"amount": amount,
"address": address
"name": name,
"symbol": symbol,
"username": username,
"password": password,
"initialHolders": initialHolders
};
return this.callMethod("avm.createAsset", params).then((response:RequestResponseData) => {
return this.callMethod("avm.createFixedCapAsset", params).then((response:RequestResponseData) => {
return response.data["result"]["assetID"];

@@ -138,9 +248,195 @@ });

/**
* Create a new variable-cap, fungible asset. No units of the asset exist at initialization. Minters can mint units of this asset using createMintTx, signMintTx and sendMintTx.
*
* @param username The user paying the transaction fee (in $AVA) for asset creation
* @param password The password for the user paying the transaction fee (in $AVA) for asset creation
* @param name The human-readable name for the asset
* @param symbol Optional. The shorthand symbol for the asset -- between 0 and 4 characters
* @param minterSets is a list where each element specifies that threshold of the addresses in minters may together mint more of the asset by signing a minting transaction
*
* ```js
* Example minterSets:
* [
* {
* "minters":[
* "X-4peJsFvhdn7XjhNF4HWAQy6YaJts27s9q"
* ],
* "threshold": 1
* },
* {
* "minters": [
* "X-dcJ6z9duLfyQTgbjq2wBCowkvcPZHVDF",
* "X-2fE6iibqfERz5wenXE6qyvinsxDvFhHZk",
* "X-7ieAJbfrGQbpNZRAQEpZCC1Gs1z5gz4HU"
* ],
* "threshold": 2
* }
* ]
* ```
*
* @returns Returns a Promise<string> containing the base 58 string representation of the ID of the newly created asset.
*/
createVariableCapAsset = async (username:string, password:string, name:string, symbol:string, minterSets:Array<object>):Promise<string> => {
let params = {
"name": name,
"symbol": symbol,
"username": username,
"password": password,
"minterSets": minterSets
};
return this.callMethod("avm.createVariableCapAsset", params).then((response:RequestResponseData) => {
return response.data["result"]["assetID"];
});
}
/**
* Create an unsigned transaction to mint more of an asset.
*
* @param amount The units of the asset to mint
* @param assetID The ID of the asset to mint
* @param to The address to assign the units of the minted asset
* @param minters Addresses of the minters responsible for signing the transaction
*
* @returns Returns a Promise<string> containing the base 58 string representation of the unsigned transaction.
*/
createMintTx = async (amount:number | BN, assetID:Buffer | string, to:string, minters:Array<string>):Promise<string> => {
let asset:string;
let amnt:BN;
if(typeof assetID !== "string"){
asset = bintools.avaSerialize(assetID);
} else {
asset = assetID;
}
if(typeof amount === 'number'){
amnt = new BN(amount);
} else {
amnt = amount;
}
let params = {
"amount": amnt.toString(10),
"assetID": asset,
"to": to,
"minters": minters
};
return this.callMethod("avm.createMintTx", params).then((response:RequestResponseData) => {
return response.data["result"]["tx"];
});
}
/**
* Sign an unsigned or partially signed mint transaction.
*
* @param username The user signing
* @param password The password for the user signing
* @param tx The output of createMintTx or signMintTx
* @param minter The minter signing this transaction
*
* @returns Returns a Promise<string> containing the base 58 string representation of the unsigned transaction.
*/
signMintTx = async (username:string, password:string, tx:string | Buffer, minter:string):Promise<string> => {
if(typeof this.parseAddress(minter) === "undefined"){
/* istanbul ignore next */
throw new Error("Error - AVMAPI.signMintTx: Invalid address format " + minter);
}
let params = {
"username": username,
"password": password,
"tx": tx,
"minter": minter
};
return this.callMethod("avm.signMintTx", params).then((response:RequestResponseData) => {
return response.data["result"]["tx"];
});
}
/**
* Exports the private key for an address.
*
* @param username The name of the user with the private key
* @param password The password used to decrypt the private key
* @param address The address whose private key should be exported
*
* @returns Promise with the decrypted private key as store in the database
*/
exportKey = async (username:string, password:string, address:string):Promise<string> => {
if(typeof this.parseAddress(address) === "undefined"){
/* istanbul ignore next */
throw new Error("Error - AVMAPI.exportKey: Invalid address format " + address);
}
let params = {
"username": username,
"password": password,
"address": address
};
return this.callMethod("avm.exportKey", params).then((response:RequestResponseData) => {
return response.data["result"]["privateKey"];
});
}
/**
* Imports a private key into the node's database under an user and for a subnet.
*
* @param username The name of the user to store the private key
* @param password The password that unlocks the user
* @param privateKey A string representing the private key in the subnet's format
*
* @returns The address for the imported private key.
*/
importKey = async (username:string, password:string, privateKey:string):Promise<string> => {
let params = {
"username": username,
"password": password,
"privateKey": privateKey
};
return this.callMethod("avm.importKey", params).then((response:RequestResponseData) => {
return response.data["result"]["address"];
});
}
/**
* Lists all the addresses under a user.
*
* @param username The user to list addresses
* @param password The password of the user to list the addresses
*
* @returns Promise of an array of address strings in the format specified by the subnet.
*/
listAddresses = async (username:string, password:string): Promise<Array<string>> => {
let params = {
"username": username,
"password": password
};
return this.callMethod("avm.listAddresses", params).then((response:RequestResponseData) => {
return response.data["result"]["addresses"];
});
}
/**
* Lists all assets for an address.
*
* @param address The address to get a list of assets
*
* @returns Promise of an array of assetIDs for the address on the subnet.
*/
listAssets = async (address:string):Promise<Array<string>> => {
if(typeof this.parseAddress(address) === "undefined"){
/* istanbul ignore next */
throw new Error("Error - AVMAPI.listAssets: Invalid address format " + address);
}
let params = {
"address": address
};
return this.callMethod("avm.listAssets", params).then((response:RequestResponseData) => {
return response.data["result"]["assets"];
});
}
/**
* Retrieves an assets name and symbol.
*
* @param assetID Either a {@link https://github.com/feross/buffer|Buffer} or an AVA serialized string for the AssetID.
* @param assetID Either a {@link https://github.com/feross/buffer|Buffer} or an AVA serialized string for the AssetID or its alias.
*
* @returns Returns a Promise<object> with keys "name" and "symbol".
*/
getAssetDescription = async(assetID:Buffer | string):Promise<{name:string;symbol:string}> => {
getAssetDescription = async(assetID:Buffer | string):Promise<{name:string;symbol:string;assetID:Buffer;denomination:number}> => {
let asset:string;

@@ -156,3 +452,8 @@ if(typeof assetID !== "string"){

return this.callMethod("avm.getAssetDescription", params).then((response:RequestResponseData) => {
return {name: response.data["result"]["name"], symbol: response.data["result"]["symbol"]};
return {
name: response.data["result"]["name"],
symbol: response.data["result"]["symbol"],
assetID: bintools.avaDeserialize(response.data["result"]["assetID"]),
denomination: parseInt(response.data["result"]["denomination"])
};
});

@@ -180,3 +481,3 @@ }

*
* @param addresses An array of addresses as strings
* @param addresses An array of addresses as strings or addresses as {@link https://github.com/feross/buffer|Buffer}s
* @param persistOpts Options available to persist these UTXOs in local storage

@@ -188,5 +489,7 @@ *

*/
getUTXOs = async (addresses:Array<string>, persistOpts:PersistanceOptions = undefined ):Promise<UTXOSet> => {
getUTXOs = async (addresses:Array<string> | Array<Buffer>, persistOpts:PersistanceOptions = undefined ):Promise<UTXOSet> => {
let addrs:Array<string> = this._cleanAddressArray(addresses, "getUTXOs");
let params = {
"addresses": addresses
"addresses": addrs
};

@@ -233,13 +536,18 @@ return this.callMethod("avm.getUTXOs", params).then((response:RequestResponseData) => {

*/
makeUnsignedTx = (
makeUnsignedTx = async (
utxoset:UTXOSet, amount:BN, toAddresses:Array<string>, fromAddresses:Array<string>,
changeAddresses:Array<string>, assetID:Buffer | string = undefined, asOf:BN = UnixNow(),
locktime:BN = new BN(0), threshold:number = 1
):TxUnsigned => {
):Promise<TxUnsigned> => {
let to:Array<Buffer> = this._cleanAddressArray(toAddresses, "makeUnsignedTx").map(a => bintools.stringToAddress(a));;
let from:Array<Buffer> = this._cleanAddressArray(fromAddresses, "makeUnsignedTx").map(a => bintools.stringToAddress(a));;
let change:Array<Buffer> = this._cleanAddressArray(changeAddresses, "makeUnsignedTx").map(a => bintools.stringToAddress(a));;
if(typeof assetID === "string"){
assetID = bintools.avaDeserialize(assetID);
}
return utxoset.makeUnsignedTx(
this.core.getNetworkID(), bintools.avaDeserialize(this.blockchainID),
amount, toAddresses, fromAddresses, changeAddresses,
amount, to, from, change,
assetID, asOf, locktime, threshold

@@ -249,3 +557,42 @@ );

/**
* Creates an unsigned transaction. For more granular control, you may create your own
* [[TxCreateAsset]] manually (with their corresponding [[Input]]s, [[Output]]s).
*
* @param utxoset A set of UTXOs that the transaction is built on
* @param fee The amount of AVA to be paid for fees, in NanoAVA
* @param creatorAddresses The addresses to send the fees
* @param initialState The [[InitialStates]] that represent the intial state of a created asset
* @param name String for the descriptive name of the asset
* @param symbol String for the ticker symbol of the asset
* @param denomination Optional number for the denomination which is 10^D. D must be >= 0 and <= 32. Ex: $1 AVA = 10^9 $nAVA
*
* @returns An unsigned transaction created from the passed in parameters.
*
*/
makeCreateAssetTx = async (
utxoset:UTXOSet, fee:BN, creatorAddresses:Array<string> | Array<Buffer>,
initialState:InitialStates, name:string,
symbol:string, denomination:number
):Promise<TxCreateAsset> => {
let creators:Array<Buffer> = this._cleanAddressArray(creatorAddresses, "makeCreateAssetTx").map(a => bintools.stringToAddress(a));
/* istanbul ignore next */
if(symbol.length > AVMConstants.SYMBOLMAXLEN){
/* istanbul ignore next */
throw new Error("Error - AVMAPI.makeCreateAssetTx: Symbols may not exceed length of " + AVMConstants.SYMBOLMAXLEN);
}
/* istanbul ignore next */
if(name.length > AVMConstants.ASSETNAMELEN) {
/* istanbul ignore next */
throw new Error("Error - AVMAPI.makeCreateAssetTx: Names may not exceed length of " + AVMConstants.ASSETNAMELEN);
}
let avaAssetID:Buffer = await this.getAVAAssetID();
return utxoset.makeCreateAssetTx(
this.core.getNetworkID(), bintools.avaDeserialize(this.blockchainID), avaAssetID,
fee, creators, initialState, name, symbol, denomination
);
}
/**
* Helper function which takes an unsigned transaction and signs it, returning the resulting [[Tx]].

@@ -287,3 +634,70 @@ *

}
/**
* Sends an amount of assetID to the specified address from a list of owned of addresses.
*
* @param username The user that owns the private keys associated with the `from` addresses
* @param password The password unlocking the user
* @param assetID The assetID of the asset to send
* @param amount The amount of the asset to be sent
* @param to The address of the recipient
* @param from An array of addresses managed by the node for this subnet which will fund this transaction
*
* @returns Promise for the string representing the transaction's ID.
*/
send = async (username:string, password:string, assetID:string | Buffer, amount:number | BN, to:string, from:Array<string> | Array<Buffer>):Promise<string> => {
let asset:string;
let amnt:BN;
if(typeof this.parseAddress(to) === "undefined"){
/* istanbul ignore next */
throw new Error("Error - AVMAPI.listAssets: Invalid address format " + to);
}
from = this._cleanAddressArray(from, "send")
if(typeof assetID !== "string"){
asset = bintools.avaSerialize(assetID);
} else {
asset = assetID;
}
if(typeof amount === 'number'){
amnt = new BN(amount);
} else {
amnt = amount;
}
let params = {
"username": username,
"password": password,
"assetID": asset,
"amount": amnt.toString(10),
"to": to,
"from": from
};
return this.callMethod("avm.send", params).then((response:RequestResponseData) => {
return response.data["result"]["txID"];
});
}
protected _cleanAddressArray(addresses:Array<string> | Array<Buffer>, caller:string):Array<string> {
let addrs:Array<string> = [];
let chainid:string = this.getBlockchainAlias() ? this.getBlockchainAlias() : this.getBlockchainID();
if(addresses && addresses.length > 0){
for(let i = 0; i < addresses.length; i++){
if(typeof addresses[i] === "string"){
if(typeof this.parseAddress(addresses[i] as string) === "undefined"){
/* istanbul ignore next */
throw new Error("Error - AVMAPI." + caller + ": Invalid address format " + addresses[i]);
}
addrs.push(addresses[i] as string);
} else {
addrs.push(bintools.addressToString(chainid, addresses[i] as Buffer))
}
}
}
return addrs;
}
/**
* This class should not be instantiated directly. Instead use the [[Slopes.addAPI]] method.

@@ -296,3 +710,9 @@ *

super(core, baseurl);
this.keychain = new AVMKeyChain();
let netid:number = core.getNetworkID();
if(netid in Defaults.network && this.blockchainID in Defaults.network[netid]){
let alias = Defaults.network[netid][this.blockchainID].alias;
this.keychain = new AVMKeyChain(alias);
} else {
this.keychain = new AVMKeyChain(blockchainID);
}
this.blockchainID = blockchainID

@@ -299,0 +719,0 @@ }

@@ -7,3 +7,3 @@ /**

import BN from "bn.js";
import { SigIdx, Constants } from './types';
import { SigIdx, AVMConstants } from './types';

@@ -38,3 +38,3 @@ /**

let inputid:number = inbuffer.readUInt32BE(68);
if(inputid == Constants.SECPINPUTID){
if(inputid == AVMConstants.SECPINPUTID){
let secpin:SecpInput = new SecpInput();

@@ -86,20 +86,9 @@ secpin.fromBuffer(inbuffer);

/**
* @ignore
* Takes a {@link https://github.com/feross/buffer|Buffer} containing an [[Input]], parses it, populates the class, and returns the length of the Input in bytes.
*
* @param bytes A {@link https://github.com/feross/buffer|Buffer} containing a raw [[Input]]
*
* @returns The length of the raw [[Input]]
*/
protected _basicInBuffer = (): Buffer => {
try {
let bsize:number = this.txid.length + this.txidx.length + this.assetid.length + this.inputid.length ;
let barr:Array<Buffer> = [this.txid, this.txidx, this.assetid, this.inputid];
let buff: Buffer = Buffer.concat(barr,bsize);
return buff;
} catch(e) {
/* istanbul ignore next */
let emsg:string = "Error - Input._basicInBuffer: " + e;
/* istanbul ignore next */
throw new Error(emsg);
}
}
protected _basicInParser = (bytes:Buffer):number => {
let offset:number = 0;
fromBuffer(bytes:Buffer, offset:number = 0):number {
this.txid = bintools.copyFrom(bytes, offset, offset + 32);

@@ -117,19 +106,16 @@ offset += 32;

/**
* Takes a {@link https://github.com/feross/buffer|Buffer} containing an [[Input]], parses it, populates the class, and returns the length of the Input in bytes.
*
* @param bytes A {@link https://github.com/feross/buffer|Buffer} containing a raw [[Input]]
*
* @returns The length of the raw [[Input]]
*/
fromBuffer = (bytes:Buffer):number => {
/* istanbul ignore next */
return this._basicInParser(bytes);
}
/**
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[Input]].
*/
toBuffer = ():Buffer => {
/* istanbul ignore next */
return this._basicInBuffer();
toBuffer():Buffer {
try {
let bsize:number = this.txid.length + this.txidx.length + this.assetid.length + this.inputid.length ;
let barr:Array<Buffer> = [this.txid, this.txidx, this.assetid, this.inputid];
let buff: Buffer = Buffer.concat(barr,bsize);
return buff;
} catch(e) {
/* istanbul ignore next */
let emsg:string = "Error - Input.toBuffer: " + e;
/* istanbul ignore next */
throw new Error(emsg);
}
}

@@ -140,3 +126,3 @@

*/
toString = ():string => {
toString():string {
/* istanbul ignore next */

@@ -180,26 +166,10 @@ return bintools.bufferToB58(this.toBuffer());

/**
* @ignore
* Takes a {@link https://github.com/feross/buffer|Buffer} containing an [[Input]], parses it, populates the class, and returns the length of the [[Input]] in bytes.
*
* @param bytes A {@link https://github.com/feross/buffer|Buffer} containing a raw [[Input]]
*
* @returns The length of the raw [[Input]]
*/
protected _SecpInBuffer = (): Buffer => {
try {
this.numAddr.writeUInt32BE(this.sigIdxs.length, 0);
let bsize:number = this.amount.length + this.numAddr.length;
let barr:Array<Buffer> = [this.amount, this.numAddr];
for(let i = 0; i < this.sigIdxs.length; i++) {
let b:Buffer = this.sigIdxs[i].toBuffer();
barr.push(b);
bsize += b.length;
}
let buff: Buffer = Buffer.concat(barr,bsize);
return buff;
} catch(e) {
/* istanbul ignore next */
let emsg:string = "Error - SecpInput._SecpInBuffer: " + e;
/* istanbul ignore next */
throw new Error(emsg);
}
}
protected _SecpInParser = (bytes:Buffer):number => {
let offset:number = this._basicInParser(bytes);
fromBuffer(bytes:Buffer, offset:number = 0):number {
offset = super.fromBuffer(bytes, offset);
this.amount = bintools.copyFrom(bytes, offset, offset + 8);

@@ -223,19 +193,22 @@ offset += 8;

/**
* Takes a {@link https://github.com/feross/buffer|Buffer} containing an [[Input]], parses it, populates the class, and returns the length of the [[Input]] in bytes.
*
* @param bytes A {@link https://github.com/feross/buffer|Buffer} containing a raw [[Input]]
*
* @returns The length of the raw [[Input]]
*/
fromBuffer = (bytes:Buffer):number => {
return this._SecpInParser(bytes);
}
/**
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[Input]].
*/
toBuffer = ():Buffer => {
let basicin:Buffer = this._basicInBuffer();
let secp:Buffer = this._SecpInBuffer();
return Buffer.concat([basicin, secp]);
toBuffer():Buffer {
try {
let basicin:Buffer = super.toBuffer();
this.numAddr.writeUInt32BE(this.sigIdxs.length, 0);
let bsize:number = basicin.length + this.amount.length + this.numAddr.length;
let barr:Array<Buffer> = [basicin, this.amount, this.numAddr];
for(let i = 0; i < this.sigIdxs.length; i++) {
let b:Buffer = this.sigIdxs[i].toBuffer();
barr.push(b);
bsize += b.length;
}
return Buffer.concat(barr,bsize);
} catch(e) {
/* istanbul ignore next */
let emsg:string = "Error - SecpInput.toBuffer: " + e;
/* istanbul ignore next */
throw new Error(emsg);
}
}

@@ -246,3 +219,3 @@

*/
toString = ():string => {
toString():string {
return bintools.bufferToB58(this.toBuffer());

@@ -257,3 +230,3 @@ }

*/
addSignatureIdx = (addressIdx:number, address:string) => {
addSignatureIdx = (addressIdx:number, address:Buffer) => {
let sigidx:SigIdx = new SigIdx();

@@ -277,5 +250,5 @@ let b:Buffer = Buffer.alloc(4);

constructor(txid?:Buffer, txidx?:Buffer, amount?:BN, assetID?:Buffer) {
super(txid, txidx, assetID, Constants.SECPINPUTID);
super(txid, txidx, assetID, AVMConstants.SECPINPUTID);
if(txid && txidx && amount && assetID){
this.inputid.writeUInt32BE(Constants.SECPINPUTID,0);
this.inputid.writeUInt32BE(AVMConstants.SECPINPUTID,0);
this.txid = txid;

@@ -282,0 +255,0 @@ this.txidx = txidx;

@@ -89,7 +89,7 @@ /**

/**
* Returns the address.
* Returns the address as a {@link https://github.com/feross/buffer|Buffer}.
*
* @returns A string representation of the address
* @returns A {@link https://github.com/feross/buffer|Buffer} representation of the address
*/
getAddress = ():string => {
getAddress = ():Buffer => {
return this.addressFromPublicKey(this.pubk);

@@ -99,2 +99,12 @@ }

/**
* Returns the address's string representation.
*
* @returns A string representation of the address
*/
getAddressString = ():string => {
let addr:Buffer = this.addressFromPublicKey(this.pubk);
return bintools.addressToString(this.chainid, addr);
}
/**
* Returns an address given a public key.

@@ -104,5 +114,5 @@ *

*
* @returns A string for the address of the public key.
* @returns A {@link https://github.com/feross/buffer|Buffer} for the address of the public key.
*/
addressFromPublicKey = (pubk:Buffer): string => {
addressFromPublicKey = (pubk:Buffer): Buffer => {
let address:string = "";

@@ -116,4 +126,5 @@ if(pubk.length == 65) {

let ripesha:Buffer = Buffer.from(createHash('rmd160').update(sha256).digest());
address = bintools.avaSerialize(ripesha);
return address;
return ripesha;
//address = bintools.avaSerialize(ripesha);
//return address;
}

@@ -189,4 +200,4 @@ /* istanbul ignore next */

*/
constructor(entropy:Buffer = undefined) {
super();
constructor(chainid:string, entropy:Buffer = undefined) {
super(chainid);
this.generateKey();

@@ -211,4 +222,4 @@ }

*/
makeKey = (entropy:Buffer = undefined):string => {
let keypair:AVMKeyPair = new AVMKeyPair(entropy);
makeKey = (entropy:Buffer = undefined):Buffer => {
let keypair:AVMKeyPair = new AVMKeyPair(this.chainid, entropy);
this.addKey(keypair);

@@ -225,4 +236,4 @@ return keypair.getAddress();

*/
importKey = (privk:Buffer | string):string => {
let keypair:AVMKeyPair = new AVMKeyPair();
importKey = (privk:Buffer | string):Buffer => {
let keypair:AVMKeyPair = new AVMKeyPair(this.chainid);
let pk:Buffer;

@@ -235,3 +246,3 @@ if(typeof privk === 'string'){

keypair.importKey(pk);
if(!(keypair.getAddress() in this.keys)){
if(!(keypair.getAddress().toString("hex") in this.keys)){
this.addKey(keypair);

@@ -272,5 +283,5 @@ }

*/
constructor(){
super();
constructor(chainid:string){
super(chainid);
}
}

@@ -7,8 +7,6 @@ /**

import BN from "bn.js";
import { Address, UnixNow, Constants } from './types';
import { Address, UnixNow, AVMConstants } from './types';
const bintools = BinTools.getInstance();
const SECPFXID = 4;
/**

@@ -22,5 +20,5 @@ * Takes a buffer representing the output and returns the proper Output instance.

export const SelectOutputClass = (outbuffer:Buffer, args:Array<any> = []):Output => {
let assetid:Buffer = bintools.copyFrom(outbuffer, 0, 32);
let outputid:number = outbuffer.readUInt32BE(32);
if(outputid == Constants.SECPOUTPUTID){
let assetid:Buffer = bintools.copyFrom(outbuffer, 0, AVMConstants.ASSETIDLEN);
let outputid:number = outbuffer.readUInt32BE(AVMConstants.ASSETIDLEN);
if(outputid == AVMConstants.SECPOUTPUTID){
let secpout:SecpOutput = new SecpOutput(assetid, ...args);

@@ -34,16 +32,26 @@ secpout.fromBuffer(outbuffer);

/**
* An abstract representing a transaction output. All output types must extend on this class.
* A class representing a transaction output. All output types must extend on this class.
*/
export abstract class Output {
export class Output {
protected outputid:Buffer = Buffer.alloc(4);
protected outputidnum:number;
protected assetid:Buffer = Buffer.alloc(32);
abstract getOutputID:() => number;
abstract getAssetID:() => Buffer;
getOutputID = ():number => {
return this.outputidnum;
};
abstract fromBuffer:(utxobuff:Buffer) => number;
abstract toBuffer:() => Buffer;
abstract toString:() => string;
fromBuffer(outbuff:Buffer, offset:number = 0):number {
this.outputid = bintools.copyFrom(outbuff, offset, offset + 4);
this.outputidnum = this.outputid.readUInt32BE(0);
return offset + 4;
};
toBuffer():Buffer {
return this.outputid;
};
toString():string {
return bintools.bufferToB58(this.outputid);
};
static comparator = ():(a:Output, b:Output) => (1|-1|0) => {

@@ -55,8 +63,5 @@ return function(a:Output, b:Output):(1|-1|0) {

constructor(outputidnum:number, assetID?:Buffer) {
constructor(outputidnum:number) {
this.outputid.writeUInt32BE(outputidnum, 0);
this.outputidnum = outputidnum;
if(assetID){
this.assetid = assetID;
}
}

@@ -66,5 +71,5 @@ }

/**
* An [[Output]] class which issues a payment on an assetID.
* An [[Output]] class which specifies a secp256k1 .
*/
export class SecpOutput extends Output {
export class SecpOutBase extends Output {
protected locktime:Buffer = Buffer.alloc(8);

@@ -78,20 +83,2 @@ protected threshold:Buffer = Buffer.alloc(4);

/**
* @ignore
*/
protected _OPGetAddresses = ():{[address:string]: BN} => {
let result:{[address:string]: BN} = {};
for(let i = 0; i < this.addresses.length; i++) {
result[this.addresses[i].toString()] = bintools.fromBufferToBN(this.locktime);
}
return result;
}
/**
* Returns the number for the output type of the output class.
*/
getOutputID = ():number => {
return this.outputidnum;
};
/**
* Returns the amount as a {@link https://github.com/indutny/bn.js/|BN}.

@@ -118,25 +105,22 @@ */

/**
* Returns the assetID as a {@link https://github.com/feross/buffer|Buffer}.
* Returns an array of {@link https://github.com/feross/buffer|Buffer}s for the addresses.
*/
getAssetID = ():Buffer => {
return this.assetid;
getAddresses = ():Array<Buffer> => {
let result:Array<Buffer> = [];
for(let i = 0; i < this.addresses.length; i++) {
result.push(this.addresses[i].toBuffer())
}
return result;
}
/**
* Returns a map from all addresses as string keys to their locktime represented in {@link https://github.com/indutny/bn.js/|BN}.
*/
getAddresses = ():{[address:string]: BN} => {
return this._OPGetAddresses();
}
/**
* Returns an array of length 2 with the first index being the index of the provided address and the second being false (as fallback addresses are not available in this output type).
* Returns the index of the address.
*
* @param address Address to look up to return its index.
* @param address A {@link https://github.com/feross/buffer|Buffer} of the address to look up to return its index.
*
* @returns An array of length 2, first index is the index the address resides in, second index is false.
* @returns The index of the address.
*/
getAddressIdx = (address:string):number => {
getAddressIdx = (address:Buffer):number => {
for(let i = 0; i < this.addresses.length; i++){
if(this.addresses[i].toString() == address){
if(this.addresses[i].toBuffer().toString("hex") == address.toString("hex")){
return i

@@ -156,18 +140,14 @@ }

*/
getAddress = (idx:number):string => {
getAddress = (idx:number):Buffer => {
if(idx < this.addresses.length){
return this.addresses[idx].toString();
return this.addresses[idx].toBuffer();
}
throw new Error("Error - OutPayment.getAddress: idx out of range");
throw new Error("Error - SecpOutBase.getAddress: idx out of range");
}
/**
* @ignore
* Popuates the instance from a {@link https://github.com/feross/buffer|Buffer} representing the [[SecpOutBase]] and returns the size of the output.
*/
protected _OPParseBuffer = (utxobuff:Buffer, offset:number):number => {
this.assetid = bintools.copyFrom(utxobuff, offset, offset + 32);
offset += 32;
this.outputid = bintools.copyFrom(utxobuff, offset, offset + 4); //copied
this.outputidnum = this.outputid.readUInt32BE(0);
offset += 4;
fromBuffer(utxobuff:Buffer, offset:number = 0):number {
offset = super.fromBuffer(utxobuff, offset);
this.amount = bintools.copyFrom(utxobuff, offset, offset + 8);

@@ -197,17 +177,11 @@ this.amountValue = bintools.fromBufferToBN(this.amount);

/**
* Popuates the instance from a {@link https://github.com/feross/buffer|Buffer} representing the [[OutCreateAsset]] and returns the size of the output.
* Returns the buffer representing the [[SecpOutBase]] instance.
*/
fromBuffer = (utxobuff:Buffer):number => {
return this._OPParseBuffer(utxobuff, 0);
}
/**
* @ignore
*/
protected _OPBuffer = (): Buffer => {
toBuffer():Buffer {
try {
this.addresses.sort(Address.comparitor());
let bsize:number = this.assetid.length + this.outputid.length + this.amount.length + this.locktime.length + this.threshold.length + this.numaddrs.length;
let superbuff:Buffer = super.toBuffer();
let bsize:number = superbuff.length + this.amount.length + this.locktime.length + this.threshold.length + this.numaddrs.length;
this.numaddrs.writeUInt32BE(this.addresses.length, 0);
let barr:Array<Buffer> = [this.assetid, this.outputid, this.amount, this.locktime, this.threshold, this.numaddrs];
let barr:Array<Buffer> = [superbuff, this.amount, this.locktime, this.threshold, this.numaddrs];
for(let i = 0; i < this.addresses.length; i++) {

@@ -218,7 +192,6 @@ let b: Buffer = this.addresses[i].toBuffer();

}
let buff: Buffer = Buffer.concat(barr,bsize);
return buff;
return Buffer.concat(barr,bsize);;
} catch(e) {
/* istanbul ignore next */
let emsg:string = "Error - TxOut._OPTxBuffer: " + e;
let emsg:string = "Error - SecpOutBase.toBuffer: " + e;
/* istanbul ignore next */

@@ -230,12 +203,5 @@ throw new Error(emsg);

/**
* Returns the buffer representing the [[OutCreateAsset]] instance.
* Returns a base-58 string representing the [[SecpOutBase]].
*/
toBuffer = ():Buffer => {
return this._OPBuffer();
}
/**
* Returns a base-58 string representing the [[OutCreateAsset]].
*/
toString = ():string => {
toString():string {
return bintools.bufferToB58(this.toBuffer());

@@ -245,6 +211,6 @@ }

/**
* @ignore
* Given an array of addresses and an optional timestamp, select an array of address {@link https://github.com/feross/buffer|Buffer}s of qualified spenders for the output.
*/
protected _OPQualified = (addresses:Array<string>, asOf:BN = undefined):Array<string> => {
let qualified:Array<string> = [];
getSpenders = (addresses:Array<Buffer>, asOf:BN = undefined):Array<Buffer> => {
let qualified:Array<Buffer> = [];
let now:BN;

@@ -265,3 +231,3 @@ if(typeof asOf === 'undefined'){

for(let j = 0; j < addresses.length && qualified.length < threshold; j++){
if(addresses[j] == this.addresses[i].toString()){
if(addresses[j].toString("hex") == this.addresses[i].toBuffer().toString("hex")){
qualified.push(addresses[j]);

@@ -276,12 +242,5 @@ }

/**
* Given an array of addresses and an optional timestamp, select an array of address strings of qualified spenders for the output.
* Given an array of address {@link https://github.com/feross/buffer|Buffer}s and an optional timestamp, returns true if the addresses meet the threshold required to spend the output.
*/
getSpenders = (addresses:Array<string>, asOf:BN = undefined):Array<string> => {
return this._OPQualified(addresses, asOf);
}
/**
* Given an array of addresses and an optional timestamp, returns true if the addresses meet the threshold required to spend the output.
*/
meetsThreshold = (addresses:Array<string>, asOf:BN = undefined):boolean => {
meetsThreshold = (addresses:Array<Buffer>, asOf:BN = undefined):boolean => {
let now:BN;

@@ -293,8 +252,4 @@ if(typeof asOf === 'undefined'){

}
let locktime:BN = bintools.fromBufferToBN(this.locktime);
let qualified:Array<string> = this._OPQualified(addresses, now);
let qualified:Array<Buffer> = this.getSpenders(addresses, now);
let threshold:number = this.threshold.readUInt32BE(0);
if(now.lte(locktime)){
return false;
}
if(qualified.length >= threshold){

@@ -312,8 +267,8 @@ return true;

* @param amount A {@link https://github.com/indutny/bn.js/|BN} representing the amount in the output
* @param addresses An array of strings representing addresses
* @param addresses An array of {@link https://github.com/feross/buffer|Buffer}s representing addresses
* @param locktime A {@link https://github.com/indutny/bn.js/|BN} representing the locktime
* @param threshold A number representing the the threshold number of signers required to sign the transaction
*/
constructor(assetid:Buffer, amount?:BN, addresses?:Array<string>, locktime?:BN, threshold?:number){
super(SECPFXID, assetid);
constructor(amount?:BN, addresses?:Array<Buffer>, locktime?:BN, threshold?:number){
super(AVMConstants.SECPOUTPUTID);
if(amount && addresses){

@@ -325,3 +280,3 @@ this.amountValue = amount.clone();

addrs[i] = new Address();
addrs[i].fromString(addresses[i]);
addrs[i].fromBuffer(addresses[i]);
}

@@ -341,2 +296,30 @@ this.addresses = addrs;

export class SecpOutput extends SecpOutBase {
protected assetid:Buffer = Buffer.alloc(32);
fromBuffer(outbuff:Buffer, offset:number = 0):number {
this.assetid = bintools.copyFrom(outbuff, offset, offset + 32);
offset += 32;
offset = super.fromBuffer(outbuff, offset);
return offset;
}
toBuffer():Buffer {
let superbuff:Buffer = super.toBuffer();
return Buffer.concat([this.assetid, superbuff]);
}
/**
* Returns the assetID as a {@link https://github.com/feross/buffer|Buffer}.
*/
getAssetID = ():Buffer => {
return this.assetid;
}
constructor(assetid?:Buffer, amount?:BN, addresses?:Array<Buffer>, locktime?:BN, threshold?:number){
super(amount, addresses, locktime, threshold);
if(typeof assetid !== 'undefined' && assetid.length == AVMConstants.ASSETIDLEN) {
this.assetid = assetid;
}
}
}

@@ -5,5 +5,5 @@ /**

import {Buffer} from "buffer/";
import { Signature, Constants } from './types';
import { Output, SelectOutputClass } from './outputs';
import { Input, SecpInput, SelectInputClass } from './inputs';
import { Signature, AVMConstants, InitialStates } from './types';
import { Output, SecpOutBase, SelectOutputClass } from './outputs';
import { Input, SelectInputClass } from './inputs';
import BinTools from '../../utils/bintools';

@@ -91,6 +91,5 @@

*
* @remarks assume not-checksummed and deserialized
* @remarks assume not-checksummed
*/
fromBuffer = (bytes:Buffer):number => {
let offset:number = 0;
fromBuffer(bytes:Buffer, offset:number = 0):number {
this.txtype = bintools.copyFrom(bytes, offset, offset + 4);

@@ -126,5 +125,5 @@ offset += 4;

/**
* @ignore
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[TxUnsigned]].
*/
protected _basicTxBuffer = ():Buffer => {
toBuffer():Buffer {
try {

@@ -153,3 +152,3 @@ this.outs.sort(Output.comparator());

/* istanbul ignore next */
let emsg:string = "Error - TxUnsigned._basicTxBuffer: " + e;
let emsg:string = "Error - TxUnsigned.toBuffer: " + e;
/* istanbul ignore next */

@@ -161,12 +160,5 @@ throw new Error(emsg);

/**
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[TxUnsigned]].
*/
toBuffer = ():Buffer => {
return this._basicTxBuffer();
}
/**
* Returns a base-58 representation of the [[TxUnsigned]].
*/
toString = ():string => {
toString():string {
return bintools.bufferToB58(this.toBuffer());

@@ -197,2 +189,119 @@ }

export class TxCreateAsset extends TxUnsigned {
protected name:string = "";
protected namebuff:Buffer = Buffer.alloc(2);
protected symbol:string = "";
protected symbolbuff:Buffer = Buffer.alloc(2);
protected denomination:Buffer = Buffer.alloc(1);
protected initialstate:InitialStates = new InitialStates();
/**
* Returns the array of array of [[Output]]s for the initial state
*/
getInitialStates = ():InitialStates => {
return this.initialstate;
}
/**
* Returns the string representation of the name
*/
getName = ():string => {
return this.name;
}
/**
* Returns the {@link https://github.com/feross/buffer|Buffer} representation of the name
*/
getNameBuffer = ():Buffer => {
return this.namebuff;
}
/**
* Returns the string representation of the symbol
*/
getSymbol = ():string => {
return this.symbol;
}
/**
* Returns the {@link https://github.com/feross/buffer|Buffer} representation of the symbol
*/
getSymbolBuffer = ():Buffer => {
return this.symbolbuff;
}
/**
* Returns the numeric representation of the denomination
*/
getDenomination = ():number => {
return this.denomination.readUInt8(0);
}
/**
* Returns the {@link https://github.com/feross/buffer|Buffer} representation of the denomination
*/
getDenominationBuffer = ():Buffer => {
return this.denomination;
}
/**
* Takes a {@link https://github.com/feross/buffer|Buffer} containing an [[TxCreateAsset]], parses it, populates the class, and returns the length of the TxUnsigned in bytes.
*
* @param bytes A {@link https://github.com/feross/buffer|Buffer} containing a raw [[TxCreateAsset]]
*
* @returns The length of the raw [[TxCreateAsset]]
*
* @remarks assume not-checksummed
*/
fromBuffer(bytes:Buffer, offset:number = 0):number {
offset = super.fromBuffer(bytes, offset);
let namesize:number = bintools.copyFrom(bytes, offset, offset + 2).readUInt16BE(0);
this.namebuff = bintools.copyFrom(bytes, offset, offset + 2 + namesize);
offset += 2;
offset += namesize;
let symsize:number = bintools.copyFrom(bytes, offset, offset + 2).readUInt16BE(0);
this.symbolbuff = bintools.copyFrom(bytes, offset, offset + 2 + symsize);
offset += 2;
offset += symsize;
this.denomination = bintools.copyFrom(bytes, offset, offset + 1);
offset += 1;
let inits:InitialStates = new InitialStates();
offset = inits.fromBuffer(bytes, offset);
this.initialstate = inits;
return offset;
}
toBuffer():Buffer {
let barr:Array<Buffer> = [super.toBuffer(), this.namebuff, this.symbolbuff, this.denomination, this.initialstate.toBuffer()];
return Buffer.concat(barr);
}
/**
* Class representing an unsigned Create Asset transaction.
*
* @param name String for the descriptive name of the asset
* @param symbol String for the ticker symbol of the asset
* @param denomination Optional number for the denomination which is 10^D. D must be >= 0 and <= 32. Ex: $1 AVA = 10^9 $nAVA
* @param initialstate Optional [[InitialStates]] that represent the intial state of a created asset
* @param ins Optional array of the [[Input]]s
* @param outs Optional array of the [[Output]]s
* @param networkid Optional networkid, default 2
* @param blockchainid Optional blockchainid, default Buffer.alloc(32, 16)
* @param txtype Optional txtype, default 1
*/
constructor(name:string = undefined, symbol:string = undefined, denomination:number = undefined, initialstate:InitialStates = undefined, ins:Array<Input> = undefined, outs:Array<Output> = undefined, networkid:number = 2, blockchainid:Buffer = Buffer.alloc(32, 16), txtype:number = AVMConstants.CREATEASSETTX) {
super(ins, outs, networkid, blockchainid, txtype);
if(typeof name === 'string' && typeof symbol === 'string' && typeof denomination === 'number' && denomination >= 0 && denomination <= 32 && initialstate) {
this.initialstate = initialstate;
this.namebuff = bintools.stringToBuffer(name);
this.name = name;
this.symbolbuff = bintools.stringToBuffer(symbol);
this.symbol = symbol;
this.denomination.writeUInt8(denomination, 0);
}
}
}
/**

@@ -212,3 +321,3 @@ * Class representing a signed transaction.

*/
fromBuffer = (bytes:Buffer):number => {
fromBuffer(bytes:Buffer):number {
this.tx = new TxUnsigned();

@@ -223,3 +332,3 @@ let offset:number = this.tx.fromBuffer(bytes);

offset += 4;
if(credential != Constants.SECPCREDENTIAL){
if(credential != AVMConstants.SECPCREDENTIAL){
/* istanbul ignore next */

@@ -250,3 +359,3 @@ throw new Error("Error - Tx.fromBuffer: Invalid credentialID " + credential);

*/
fromString = (serialized:string):number => {
fromString(serialized:string):number {
return this.fromBuffer(bintools.avaDeserialize(serialized));

@@ -258,3 +367,3 @@ }

*/
toBuffer = ():Buffer => {
toBuffer():Buffer {
try {

@@ -271,3 +380,3 @@ let txbuff: Buffer = this.tx.toBuffer();

let credentialID = Buffer.alloc(4);
credentialID.writeUInt32BE(Constants.SECPCREDENTIAL, 0);
credentialID.writeUInt32BE(AVMConstants.SECPCREDENTIAL, 0);
barr.push(credentialID);

@@ -299,3 +408,3 @@ bsize += credentialID.length;

*/
toString = ():string => {
toString():string {
return bintools.avaSerialize(this.toBuffer());

@@ -302,0 +411,0 @@ }

@@ -8,2 +8,3 @@ /**

import BinTools from '../../utils/bintools';
import { Output, SelectOutputClass, SecpOutBase } from './outputs';

@@ -19,3 +20,3 @@ /**

export class SigIdx extends NBytes {
source:string;
source:Buffer;

@@ -25,3 +26,3 @@ /**

*/
setSource = (address:string) => {
setSource = (address:Buffer) => {
this.source = address;

@@ -33,3 +34,3 @@ }

*/
getSource = ():string => {
getSource = ():Buffer => {
return this.source;

@@ -79,3 +80,3 @@ }

*/
toString = ():string => {
toString():string {
return bintools.avaSerialize(this.toBuffer());

@@ -90,3 +91,3 @@ }

*/
fromString = (addr:string):number => {
fromString(addr:string):number {
let addrbuff:Buffer = bintools.b58ToBuffer(addr);

@@ -119,7 +120,74 @@ if(addrbuff.length == 24 && bintools.validateChecksum(addrbuff)) {

export class Constants {
export class InitialStates {
protected fxs:{[fxid:number]:Array<Output>} = {};
addOutput(out:Output, fxid:number):void {
if(!(fxid in this.fxs)){
this.fxs[fxid] = [];
}
this.fxs[fxid].push(out);
}
fromBuffer(bytes:Buffer, offset:number):number {
let result:{[fxid:number]:Array<Output>} = {};
let klen:Buffer = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
let klennum:number = klen.readUInt32BE(0);
for(let i = 0; i < klennum; i++){
let fxidbuff:Buffer = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
let fxid:number = fxidbuff.readUInt32BE(0);
result[fxid] = [];
let statelenbuff:Buffer = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
let statelen:number = statelenbuff.readUInt32BE(0);
for(let j = 0; j < statelen; j++){
let abuff:Buffer = bintools.copyFrom(bytes, offset);
let out:Output = new SecpOutBase();
out.fromBuffer(abuff)
let outbuff:Buffer = out.toBuffer();
offset += outbuff.length;
result[fxid].push(out);
}
}
this.fxs = result;
return offset
}
toBuffer():Buffer {
let buff:Array<Buffer> = [];
let keys:Array<number> = Object.keys(this.fxs).map(k => parseInt(k)).sort();
let klen:Buffer = Buffer.alloc(4);
klen.writeUInt32BE(keys.length, 0);
buff.push(klen);
for(let i = 0; i < keys.length; i++){
let fxid:number = keys[i];
let fxidbuff:Buffer = Buffer.alloc(4);
fxidbuff.writeUInt32BE(fxid, 0);
buff.push(fxidbuff);
let initialState = this.fxs[fxid].sort(Output.comparator());
let statelen:Buffer = Buffer.alloc(4);
statelen.writeUInt32BE(initialState.length, 0);
buff.push(statelen);
for(let j = 0; j < initialState.length; j++){
buff.push(initialState[j].toBuffer());
}
}
return Buffer.concat(buff);
}
constructor(){}
}
export class AVMConstants {
static SECPOUTPUTID:number = 4;
static SECPINPUTID:number = 6;
static CREATEASSETTX:number = 1;
static BASETX:number = 0;
static SECPCREDENTIAL:number =7;
static SECPCREDENTIAL:number = 7;
static ASSETIDLEN:number = 32;
static BLOCKCHAINIDLEN:number = 32;
static SYMBOLMAXLEN:number = 4;
static ASSETNAMELEN:number = 128;
static ADDRESSLENGTH:number = 20;
static SECPFXID:number = 0;
}

@@ -126,0 +194,0 @@

@@ -8,5 +8,5 @@ /**

import { Output, SecpOutput, SelectOutputClass } from './outputs';
import { MergeRule, UnixNow, Constants } from './types';
import { TxUnsigned } from './tx';
import { SecpInput } from './inputs';
import { MergeRule, UnixNow, AVMConstants, InitialStates } from './types';
import { TxUnsigned, TxCreateAsset } from './tx';
import { SecpInput, Input } from './inputs';

@@ -32,3 +32,3 @@ /**

let outputid:number = output.getOutputID();
if(outputid == Constants.SECPOUTPUTID){
if(outputid == AVMConstants.SECPOUTPUTID){
let secpout:SecpOutput = output as SecpOutput;

@@ -45,7 +45,9 @@ let utxo:SecpUTXO = new SecpUTXO(txid, txidx, secpout);

*/
export abstract class UTXO {
export class UTXO {
protected txid:Buffer = Buffer.alloc(32);
protected txidx:Buffer = Buffer.alloc(4);
abstract getOuputID:() => number;
getOuputID():number {
return undefined;
};

@@ -76,7 +78,2 @@ /**

_basicUTXOBuffer = (utxobuff) => {
this.txid = bintools.copyFrom(utxobuff, 0, 32);
this.txidx = bintools.copyFrom(utxobuff, 32, 36);
}
/**

@@ -87,5 +84,8 @@ * Takes a {@link https://github.com/feross/buffer|Buffer} containing an [[UTXO]], parses it, populates the class, and returns the length of the UTXO in bytes.

*/
fromBuffer = (utxobuff:Buffer) => {
/* istanbul ignore next */
this._basicUTXOBuffer(utxobuff);
fromBuffer(utxobuff:Buffer, offset:number = 0):number {
this.txid = bintools.copyFrom(utxobuff, offset, offset + 32);
offset += 32;
this.txidx = bintools.copyFrom(utxobuff, offset, offset + 4);
offset += 4;
return offset;
}

@@ -103,3 +103,3 @@

*/
fromString = (serialized:string) => {
fromString(serialized:string) {
/* istanbul ignore next */

@@ -112,3 +112,3 @@ return this.fromBuffer( bintools.avaDeserialize(serialized) );

*/
toBuffer = ():Buffer => {
toBuffer():Buffer {
/* istanbul ignore next */

@@ -132,3 +132,3 @@ try {

*/
toString = ():string => {
toString():string {
/* istanbul ignore next */

@@ -141,6 +141,7 @@ return bintools.avaSerialize(this.toBuffer());

*
* @param serialized Optional parameter of the serialized string representing a UTXO
* @param txid Optional {@link https://github.com/feross/buffer|Buffer} of transaction ID for the UTXO
* @param txidx Optional number for the index of the transaction's [[Output]]
*/
constructor(txid?:Buffer, txidx:number = undefined) {
if(txid && typeof txidx === "number") {
constructor(txid:Buffer = undefined, txidx:number = undefined) {
if(typeof txid !== "undefined" && typeof txidx === "number") {
this.txid = txid;

@@ -173,3 +174,3 @@ this.txidx.writeUInt32BE(txidx, 0);

*/
getAddresses = ():{[address:string]: BN} => {
getAddresses = ():Array<Buffer> => {
return this.output.getAddresses();

@@ -183,3 +184,3 @@ };

*/
getAddressIdx = (address:string):number => {
getAddressIdx = (address:Buffer):number => {
return this.output.getAddressIdx(address);

@@ -193,5 +194,5 @@ }

*
* @returns A string representing the address.
* @returns A {@link https://github.com/feross/buffer|Buffer} representing the address.
*/
getAddress = (idx:number):string => {
getAddress = (idx:number):Buffer => {
return this.output.getAddress(idx);

@@ -227,2 +228,9 @@ }

/**
* Returns a {@link https://github.com/indutny/bn.js/|BN} of the locktime.
*/
getLocktime = ():BN => {
return this.output.getLocktime();
}
/**
* Returns the UTXOID as a base-58 string (UTXOID is a string )

@@ -239,7 +247,8 @@ */

*/
fromBuffer = (utxobuff:Buffer) => {
this._basicUTXOBuffer(utxobuff);
let utxoOut = bintools.copyFrom(utxobuff, 36, utxobuff.length);
fromBuffer(utxobuff:Buffer, offset:number = 0):number {
offset = super.fromBuffer(utxobuff, offset);
let utxoOut = bintools.copyFrom(utxobuff, offset, utxobuff.length);
this.output = SelectOutputClass(utxoOut) as SecpOutput;
this.output.fromBuffer(utxoOut);
offset += this.output.toBuffer().length;
return offset;
}

@@ -257,3 +266,3 @@

*/
fromString = (serialized:string) => {
fromString(serialized:string):number {
return this.fromBuffer( bintools.avaDeserialize(serialized) );

@@ -265,10 +274,11 @@ }

*/
toBuffer = ():Buffer => {
toBuffer():Buffer {
try {
let superbuff = super.toBuffer();
let obuff = this.output.toBuffer();
let barr:Array<Buffer> = [this.txid, this.txidx, obuff];
return Buffer.concat(barr, this.txid.length + this.txidx.length + obuff.length)
let barr:Array<Buffer> = [superbuff, obuff];
return Buffer.concat(barr, superbuff.length + obuff.length)
} catch(e) {
/* istanbul ignore next */
let emsg:string = "Error - UTXO.toBuffer: " + e;
let emsg:string = "Error - SecpUTXO.toBuffer: " + e;
/* istanbul ignore next */

@@ -285,3 +295,3 @@ throw new Error(emsg);

*/
toString = ():string => {
toString():string {
return bintools.avaSerialize(this.toBuffer());

@@ -293,3 +303,3 @@ }

*/
getSpenders = (addresses:Array<string>, asOf:BN = undefined):Array<string> => {
getSpenders = (addresses:Array<Buffer>, asOf:BN = undefined):Array<Buffer> => {
return this.output.getSpenders(addresses, asOf);

@@ -301,3 +311,3 @@ }

*/
meetsThreshold = (addresses:Array<string>, asOf:BN = undefined) => {
meetsThreshold = (addresses:Array<Buffer>, asOf:BN = undefined) => {
return this.output.meetsThreshold(addresses, asOf);

@@ -360,3 +370,3 @@ }

}
let secputxo;
let secputxo:SecpUTXO;
try {

@@ -372,4 +382,6 @@ secputxo = utxoX as SecpUTXO;

let addresses:{[address:string]: BN} = secputxo.getAddresses(); //gets addresses and their locktime
for(let [address, locktime] of Object.entries(addresses)){
let addresses:Array<Buffer> = secputxo.getAddresses();
let locktime:BN = secputxo.getLocktime();
for(let i = 0; i < addresses.length; i++){
let address:string = addresses[i].toString("hex");
if(!(address in this.addressUTXOs)){

@@ -521,3 +533,3 @@ this.addressUTXOs[address] = {};

*
* @param address An address or array of addresses
* @param address An array of address {@link https://github.com/feross/buffer|Buffer}s
* @param spendable If true, only retrieves UTXOIDs whose locktime has passed

@@ -527,12 +539,9 @@ *

*/
getUTXOIDs = (address:string | Array<string> = undefined, spendable:boolean = true):Array<string> => {
if(typeof address !== "undefined") {
let results:Array<string> = [];
if(typeof address === 'string'){
address = [address];
}
getUTXOIDs = (addresses:Array<Buffer> = undefined, spendable:boolean = true):Array<string> => {
if(typeof addresses !== "undefined") {
let results:Array<string> = [];
let now:BN = UnixNow();
for(let i = 0; i < address.length; i++){
if(address[i] in this.addressUTXOs){
let entries = Object.entries(this.addressUTXOs[address[i]]);
for(let i = 0; i < addresses.length; i++){
if(addresses[i].toString("hex") in this.addressUTXOs){
let entries = Object.entries(this.addressUTXOs[addresses[i].toString("hex")]);
for(let [utxoid, locktime] of entries){

@@ -551,6 +560,6 @@ if(results.indexOf(utxoid) == -1 && (spendable && locktime.lte(now)) || !spendable) {

/**
* Gets the addresses in the [[UTXOSet]].
* Gets the addresses in the [[UTXOSet]] and returns an array of {@link https://github.com/feross/buffer|Buffer}.
*/
getAddresses = ():Array<string> => {
return Object.keys(this.addressUTXOs);
getAddresses = ():Array<Buffer> => {
return Object.keys(this.addressUTXOs).map(k => Buffer.from(k, "hex"));
}

@@ -567,3 +576,3 @@

*/
getBalance = (addresses:Array<string>, assetID:Buffer|string, asOf:BN = undefined):BN => {
getBalance = (addresses:Array<Buffer>, assetID:Buffer|string, asOf:BN = undefined):BN => {
let utxoids:Array<string> = this.getUTXOIDs(addresses);

@@ -593,3 +602,3 @@ let utxos:Array<SecpUTXO> = this.getAllUTXOs(utxoids);

*/
getAssetIDs = (addresses:string | Array<string> = undefined ):Array<Buffer> => {
getAssetIDs = (addresses:Array<Buffer> = undefined ):Array<Buffer> => {
let results:Set<Buffer> = new Set();

@@ -615,3 +624,3 @@ let utxoids:Array<string> = [];

* Creates an unsigned transaction. For more granular control, you may create your own
* [[TxUnsigned]] manually (with their corresponding [[Input]]s and [[Output]]s.
* [[TxUnsigned]] manually (with their corresponding [[Input]]s and [[Output]]s).
*

@@ -622,5 +631,3 @@ * @param networkid The number representing NetworkID of the node

* @param toAddresses The addresses to send the funds
* @param fromAddresses The addresses being used to send the funds from the UTXOs provided
* @param changeAddresses The addresses that can spend the change remaining from the spent UTXOs, locktime of BN(0) and a threshold of 1
* @param assetID The assetID of the value being sent as a {@link https://github.com/indutny/bn.js/|BN}
* @param fromAddresses The addresses being used to send the funds from the UTXOs {@link https://github.com/feross/buffer|Buffer}
* @param asOf The timestamp to verify the transaction against as a {@link https://github.com/indutny/bn.js/|BN}

@@ -633,3 +640,3 @@ * @param locktime The locktime field created in the resulting outputs

*/
makeUnsignedTx = (networkid:number, blockchainid:Buffer, amount:BN, toAddresses:Array<string>, fromAddresses:Array<string>, changeAddresses:Array<string>, assetID:Buffer, asOf:BN = UnixNow(), locktime:BN = new BN(0), threshold:number = 1):TxUnsigned => {
makeUnsignedTx = (networkid:number, blockchainid:Buffer, amount:BN, toAddresses:Array<Buffer>, fromAddresses:Array<Buffer>, changeAddresses:Array<Buffer>, assetID:Buffer, asOf:BN = UnixNow(), locktime:BN = new BN(0), threshold:number = 1):TxUnsigned => {
const zero:BN = new BN(0);

@@ -643,46 +650,48 @@ let spendamount:BN = zero.clone();

outs.push(new SecpOutput(assetID, amount, toAddresses, locktime, threshold));
if(amount.toNumber() !== 0){
outs.push(new SecpOutput(assetID, amount, toAddresses, locktime, threshold));
for(let i = 0; i < utxos.length && spendamount.lt(amount); i++){
if((assetID === undefined || (utxos[i].getAssetID().compare(assetID) == 0) && utxos[i].meetsThreshold(fromAddresses, asOf))){
let amt:BN = utxos[i].getAmount().clone();
spendamount = spendamount.add(amt);
change = spendamount.sub(amount);
change = change.gt(zero) ? change : zero.clone();
for(let i = 0; i < utxos.length && spendamount.lt(amount); i++){
if((assetID === undefined || (utxos[i].getAssetID().compare(assetID) == 0) && utxos[i].meetsThreshold(fromAddresses, asOf))){
let amt:BN = utxos[i].getAmount().clone();
spendamount = spendamount.add(amt);
change = spendamount.sub(amount);
change = change.gt(zero) ? change : zero.clone();
let txid:Buffer = utxos[i].getTxID();
let txidx:Buffer = utxos[i].getTxIdx();
let input:SecpInput = new SecpInput(txid, txidx, amt, assetID);
let spenders:Array<string> = utxos[i].getSpenders(fromAddresses, asOf);
for(let j = 0; j < spenders.length; j++){
let idx:number;
idx = utxos[i].getAddressIdx(spenders[j]);
if(idx == -1){
/* istanbul ignore next */
throw new Error("Error - UTXOSet.makeUnsignedTx: no such address in output: " + spenders[j]);
let txid:Buffer = utxos[i].getTxID();
let txidx:Buffer = utxos[i].getTxIdx();
let input:SecpInput = new SecpInput(txid, txidx, amt, assetID);
let spenders:Array<Buffer> = utxos[i].getSpenders(fromAddresses, asOf);
for(let j = 0; j < spenders.length; j++){
let idx:number;
idx = utxos[i].getAddressIdx(spenders[j]);
if(idx == -1){
/* istanbul ignore next */
throw new Error("Error - UTXOSet.makeUnsignedTx: no such address in output: " + spenders[j]);
}
input.addSignatureIdx(idx, spenders[j]);
}
input.addSignatureIdx(idx, spenders[j]);
ins.push(input);
if(change.gt(zero)){
if(assetID) {
outs.push(new SecpOutput(assetID, change, changeAddresses, zero.clone(), 1));
}
break;
}
/* istanbul ignore next */
if(spendamount.gte(amount)){
break;
}
} else {
continue;
}
ins.push(input);
}
if(change.gt(zero)){
if(assetID) {
outs.push(new SecpOutput(assetID, change, changeAddresses, zero.clone(), 1));
}
break;
}
if(spendamount.lt(amount)){
/* istanbul ignore next */
if(spendamount.gte(amount)){
break;
}
} else {
continue;
throw new Error("Error - UTXOSet.makeUnsignedTx: insufficient funds to create the transaction");
}
}
if(spendamount.lt(amount)){
/* istanbul ignore next */
throw new Error("Error - UTXOSet.makeUnsignedTx: insufficient funds to create the transaction");
}
return new TxUnsigned(ins, outs, networkid, blockchainid);

@@ -692,2 +701,32 @@ }

/**
* Creates an unsigned transaction. For more granular control, you may create your own
* [[TxCreateAsset]] manually (with their corresponding [[Input]]s, [[Output]]s).
*
* @param networkid The number representing NetworkID of the node
* @param blockchainid The {@link https://github.com/feross/buffer|Buffer} representing the BlockchainID for the transaction
* @param fee The amount of AVA to be paid for fees, in NanoAVA
* @param creatorAddresses The addresses to send the fees
* @param initialState The [[InitialStates]]that represent the intial state of a created asset
* @param name String for the descriptive name of the asset
* @param symbol String for the ticker symbol of the asset
* @param denomination Optional number for the denomination which is 10^D. D must be >= 0 and <= 32. Ex: $1 AVA = 10^9 $nAVA
*
* @returns An unsigned transaction created from the passed in parameters.
*
*/
makeCreateAssetTx = (
networkid:number, blockchainid:Buffer, avaAssetID:Buffer,
fee:BN, creatorAddresses:Array<Buffer>,
initialState:InitialStates, name:string,
symbol:string, denomination:number
):TxCreateAsset => {
// Cheating and using makeUnsignedTx to get Ins and Outs for fees.
// Fees are burned, so no toAddresses, only fromAddresses and changeAddresses, both are the creatorAddresses
let utx:TxUnsigned = this.makeUnsignedTx(networkid, blockchainid, fee, [], creatorAddresses, creatorAddresses, avaAssetID);
let ins:Array<Input> = utx.getIns();
let outs:Array<Output> = utx.getOuts();
return new TxCreateAsset(name, symbol, denomination, initialState, ins, outs, networkid, blockchainid, AVMConstants.CREATEASSETTX);
}
/**
* Returns a new set with copy of UTXOs in this and set parameter.

@@ -694,0 +733,0 @@ *

@@ -19,15 +19,15 @@ /**

/**
* Creates a account in the node's database.
* Creates a user in the node's database.
*
* @param accountName Name of the account to create
* @param password Password for the account
* @param username Name of the user to create
* @param password Password for the user
*
* @returns Promise for a boolean with true on success
*/
createAccount = async (accountName:string, password:string):Promise<boolean> => {
createUser = async (username:string, password:string):Promise<boolean> => {
let params = {
"accountName": accountName,
"username": username,
"password": password
};
return this.callMethod("keystore.createAccount", params).then((response:RequestResponseData) => {
return this.callMethod("keystore.createUser", params).then((response:RequestResponseData) => {
return response.data["result"]["success"];

@@ -38,36 +38,16 @@ });

/**
* Creates an address (and associated private keys) on an account under a subnet.
* Exports a user. The user can be imported to another node with keystore.importUser .
*
* @param accountName Name of the account to create the address under
* @param password Password to unlock the account and encrypt the private key
* @param subnetAlias The subnetID or subnetAlias which the address is created under
* @param username The name of the user to export
* @param password The password of the user to export
*
* @returns Promise for a string representing the address created by the subnet.
* @returns Promise with a string importable using importUser
*/
createAddress = async (accountName:string, password:string, subnetAlias:string):Promise<string> => {
exportUser = async (username:string, password:string):Promise<string> => {
let params = {
"accountName": accountName,
"password": password,
"subnetAlias": subnetAlias
};
return this.callMethod("keystore.createAddress", params).then((response:RequestResponseData) => {
return response.data["result"]["address"];
});
}
/**
* Exports and account, returning a string with the AVA Keystore File (AKF).
*
* @param accountName The name of the account to export
* @param password Not just anyone can export an account... you must have the password
*
* @returns Promise with a string representing the AVA Keystore File (AKF)
*/
exportAccount = async (accountName:string, password:string):Promise<string> => {
let params = {
"accountName": accountName,
"username": username,
"password": password
};
return this.callMethod("keystore.exportAccount", params).then((response:RequestResponseData) => {
return response.data["result"]["accountData"];
return this.callMethod("keystore.exportUser", params).then((response:RequestResponseData) => {
return response.data["result"]["user"];
});

@@ -77,90 +57,17 @@ }

/**
* Exports the private key for an address.
* Imports a user file into the node's user database and assigns it to a username.
*
* @param accountName The name of the account with the private key
* @param password The password used to decrypt the private key
* @param subnetAlias The subnetID or subnetAlias that the key exists under
* @param address The address whose private key should be exported
* @param username The name the user file should be imported into
* @param user AVA serialized string represetning a user's data
* @param password The user's password
*
* @returns Promise with the decrypted private key as store in the database
*/
exportKey = async (accountName:string, password:string, subnetAlias:string, address:string):Promise<string> => {
let params = {
"accountName": accountName,
"password": password,
"subnetAlias": subnetAlias,
"address": address
};
return this.callMethod("keystore.exportKey", params).then((response:RequestResponseData) => {
return response.data["result"]["privateKey"];
});
}
/**
* Gets the balances for all assets on the provided address on the provided subnet.
*
* @param subnetAlias The subnetID or subnetAlias that the address exists under
* @param address The address to pull the asset balances from
*
* @returns Promise with the key-value pair of assetID to balance.
*/
getAllBalances = async (subnetAlias:string, address:string):Promise<object> => {
let params = {
"subnetAlias": subnetAlias,
"address": address
};
return this.callMethod("keystore.getAllBalances", params).then((response:RequestResponseData) => {
return response.data["result"]["balances"];
});
}
/**
* Gets the balance of a particular asset on a subnet.
*
* @param subnetAlias The subnetID or subnetAlias that the address exists under
* @param address The address to pull the asset balance from
* @param assetID The assetID to pull the balance from
*
* @returns Promise with the balance of the assetID on the provided address for the subnet.
*/
getBalance = async (subnetAlias:string, address:string, assetID:string):Promise<number> => {
let params = {
"subnetAlias": subnetAlias,
"address": address,
"assetID": assetID
};
return this.callMethod("keystore.getBalance", params).then((response:RequestResponseData) => {
return response.data["result"]["balance"];
});
}
/**
* @ignore
*/
getTxHistory = async (subnetAlias:string, address:string):Promise<object> => {
let params = {
"subnetAlias": subnetAlias,
"address": address
};
return this.callMethod("keystore.getTxHistory", params).then((response:RequestResponseData) => {
return response.data["result"];
});
}
/**
* Imports an account file into the node's account database and assigns it to an account name.
*
* @param accountName The name the account file should be imported into
* @param accountData The JSON in the AVA Keystore File (AKF) format
* @param password The password that's used to encode the private keys in the AKF
*
* @returns A promise with a true-value on success.
*/
importAccount = async (accountName:string, accountData:string, password:string):Promise<boolean> => {
importUser = async (username:string, user:string, password:string):Promise<boolean> => {
let params = {
"accountName": accountName,
"accountData": accountData,
"usermame": username,
"user": user,
"password": password
};
return this.callMethod("keystore.importAccount", params).then((response:RequestResponseData) => {
return this.callMethod("keystore.importUser", params).then((response:RequestResponseData) => {
return response.data["result"]["success"];

@@ -171,20 +78,9 @@ });

/**
* Imports a private key into the node's database under an account and for a subnet.
* Lists the names of all users on the node.
*
* @param accountName The name of the account to store the private key
* @param password The password that unlocks the account
* @param subnetAlias The subnetID or subnetAlias to insert the private key
* @param privateKey A string representing the private key in the subnet's format
*
* @returns The address for the imported private key.
* @returns Promise of an array with all user names.
*/
importKey = async (accountName:string, password:string, subnetAlias:string, privateKey:string):Promise<string> => {
let params = {
"accountName": accountName,
"password": password,
"subnetAlias": subnetAlias,
"privateKey": privateKey
};
return this.callMethod("keystore.importKey", params).then((response:RequestResponseData) => {
return response.data["result"]["address"];
listUsers = async ():Promise<Array<string>> => {
return this.callMethod("keystore.listUsers").then((response:RequestResponseData) => {
return response.data["result"]["users"];
});

@@ -194,88 +90,2 @@ }

/**
* Lists the names of all accounts on the node.
*
* @returns Promise of an array with all account names.
*/
listAccounts = async ():Promise<Array<string>> => {
return this.callMethod("keystore.listAccounts").then((response:RequestResponseData) => {
return response.data["result"]["accounts"];
});
}
/**
* Lists all the addresses under a subnet on an account.
*
* @param accountName The account to list addresses for
* @param subnetAlias The subnet to list the addreses for
*
* @returns Promise of an array of address strings in the format specified by the subnet.
*/
listAddresses = async (accountName:string, subnetAlias:string): Promise<Array<string>> => {
let params = {
"accountName": accountName,
"subnetAlias": subnetAlias
};
return this.callMethod("keystore.listAddresses", params).then((response:RequestResponseData) => {
return response.data["result"]["addresses"];
});
}
/**
* Lists all assets for a subnet on an address.
*
* @param subnetAlias The subnetID or subnetAlias the address is on
* @param address The address to get a list of assets for
*
* @returns Promise of an array of assetIDs for the address on the subnet.
*/
listAssets = async (subnetAlias:string, address:string):Promise<Array<string>> => {
let params = {
"subnetAlias": subnetAlias,
"address": address
};
return this.callMethod("keystore.listAssets", params).then((response:RequestResponseData) => {
return response.data["result"]["assets"];
});
}
/**
* A list of all subnets supported by the wallet.
*
* @returns An array of subnetIDs which the wallet supports.
*/
listSubnets = async ():Promise<Array<string>> => {
return this.callMethod("keystore.listSubnets").then((response:RequestResponseData) => {
return response.data["result"]["subnetIDs"];
});
}
/**
* Sends an amount of assetID to the specified address from a list of owned of addresses.
*
* @param accountName The account that owns the private keys associated with the `from` addresses
* @param password The password unlocking the account
* @param subnetAlias The subnetID or subnetAlias the asset resides on
* @param assetID The assetID of the asset to send
* @param amount The amount of the asset to be sent
* @param to The address of the recipient
* @param from An array of addresses managed by the node for this subnet which will fund this transaction
*
* @returns Promise for the string representing the transaction's ID.
*/
send = async (accountName:string, password:string, subnetAlias:string, assetID:string, amount:number, to:string, from:Array<string>):Promise<string> => {
let params = {
"accountName": accountName,
"password": password,
"subnetAlias": subnetAlias,
"assetID": assetID,
"amount": amount,
"to": to,
"from": from
};
return this.callMethod("keystore.send", params).then((response:RequestResponseData) => {
return response.data["result"]["txID"];
});
}
/**
* This class should not be instantiated directly. Instead use the [[Slopes.addAPI]] method.

@@ -282,0 +92,0 @@ *

@@ -33,14 +33,20 @@ /**

/**
* Creates a new subnet.
* Creates a new blockchain.
*
* @param tx The string representation of a createSubnetTx
* @param vmID The VMID used to build the blockchain
* @param name A human-readable name for the new blockchain
* @param method The VMID's hook method for ingesting genesis data
* @param genesis The object used to build the initial state of the blockchain
*
* @returns Promise for a boolean value, true on success.
* @returns Promise for a string for the blockchainID.
*/
createSubnet = async (tx:string):Promise<boolean> => {
createBlockchain = async (vmID:string, name:string, method:string, genesis:object):Promise<string> => {
let params = {
"tx": tx
"vmID": vmID,
"name": name,
"method": method,
"genesis": genesis
};
return this.callMethod("platform.createSubnet", params).then((response:RequestResponseData) => {
return response.data["result"]["success"];
return this.callMethod("platform.createBlockchain", params).then((response:RequestResponseData) => {
return response.data["result"]["blockchainID"];
});

@@ -50,2 +56,18 @@ }

/**
* Creates a new blockchain.
*
* @param blockchainID The blockchainID requesting a status update
*
* @returns Promise for a string of one of: "Validating", "Created", "Preferred", "Unknown".
*/
getBlockchainStatus = async (blockchainID: string):Promise<string> => {
let params = {
"blockchainID": blockchainID
};
return this.callMethod("platform.getBlockchainStatus", params).then((response:RequestResponseData) => {
return response.data["result"]["status"];
});
}
/**
* Lists the current set of validators.

@@ -70,3 +92,3 @@ *

let params = {
"size": sampleSize
"size": sampleSize.toString()
};

@@ -73,0 +95,0 @@ return this.callMethod("platform.sampleValidators", params).then((response:RequestResponseData) => {

@@ -94,7 +94,7 @@ /**

export {Tx, TxUnsigned} from './apis/avm/tx';
export {UTXO, SecpUTXO, UTXOSet} from './apis/avm/utxos';
export {SigIdx, Signature, UnixNow, Address} from './apis/avm/types';
export {SecpOutput, Output, SelectOutputClass} from './apis/avm/outputs';
export {SecpInput, Input} from './apis/avm/inputs';
export {Tx, TxUnsigned, TxCreateAsset} from './apis/avm/tx';
export {UTXO, SecpUTXO, UTXOSet, SelectUTXOClass} from './apis/avm/utxos';
export {SigIdx, Signature, UnixNow, Address, AVMConstants, InitialStates} from './apis/avm/types';
export {SecpOutput, SecpOutBase, Output, SelectOutputClass} from './apis/avm/outputs';
export {SecpInput, Input, SelectInputClass} from './apis/avm/inputs';
export {AVMKeyPair, AVMKeyChain} from './apis/avm/keychain';

@@ -101,0 +101,0 @@

@@ -40,2 +40,23 @@ /**

/**
* Produces a string from a {@link https://github.com/feross/buffer|Buffer} representing a string.
*
* @param buff The {@link https://github.com/feross/buffer|Buffer} to convert to a string
*/
bufferToString = (buff:Buffer):string => {
return this.copyFrom(buff, 2).toString("utf8");
}
/**
* Produces a {@link https://github.com/feross/buffer|Buffer} from a string.
*
* @param str The string to convert to a {@link https://github.com/feross/buffer|Buffer}
*/
stringToBuffer = (str:string):Buffer => {
let buff:Buffer = Buffer.alloc(2 + str.length);
buff.writeUInt16BE(str.length, 0);
buff.write(str, 2, str.length, "utf8");
return buff;
}
/**
* Makes a copy (no reference) of a {@link https://github.com/feross/buffer|Buffer} over provided indecies.

@@ -174,2 +195,29 @@ *

addressToString = (chainid:string, bytes:Buffer):string => {
return chainid + "-" + this.avaSerialize(bytes);
}
stringToAddress = (address:string):Buffer => {
let parts:Array<string> = address.split("-");
return this.avaDeserialize(parts[1]);
}
/**
* Takes an address and returns its {@link https://github.com/feross/buffer|Buffer} representation if valid.
*
* @returns A {@link https://github.com/feross/buffer|Buffer} for the address if valid, undefined if not valid.
*/
parseAddress = (addr:string, blockchainID:string, alias:string = undefined, addrlen:number = 20):Buffer => {
let abc:Array<string> = addr.split("-");
if(abc.length == 2){
if((alias && abc[0] == alias) || (blockchainID && abc[0] == blockchainID)) {
let addrbuff = this.avaDeserialize(abc[1]);
if((addrlen && addrbuff.length == addrlen) || !(addrlen)){
return addrbuff;
}
}
}
return undefined;
}
}

@@ -176,0 +224,0 @@

@@ -148,2 +148,3 @@ /**

protected privk:Buffer;
protected chainid:string = "";

@@ -230,7 +231,34 @@ /**

*
* @returns A {@link https://github.com/feross/buffer|Buffer} representation of the address
*/
getAddress:() => Buffer;
/**
* Returns the address's string representation.
*
* @returns A string representation of the address
*/
getAddress:() => string;
getAddressString:() => string;
constructor() {}
/**
* Returns the chainID associated with this key.
*
* @returns The [[KeyPair]]'s chainID
*/
getChainID = ():string => {
return this.chainid
}
/**
* Sets the the chainID associated with this key.
*
* @param chainid String for the chainID
*/
setChainID = (chainid:string):void => {
this.chainid = chainid;
}
constructor(chainid:string) {
this.chainid = chainid
}
}

@@ -242,56 +270,67 @@

*
* @typeparam KPClass Class extending [[KeyPair]] which is used as the key in [[KeyChain]]
* @typeparam KPClass extending [[KeyPair]] which is used as the key in [[KeyChain]]
*/
export class KeyChain<KPClass extends KeyPair> {
protected keys:{[address: string]: KPClass} = {};
protected chainid:string = "";
/**
* Makes a new key pair, returns the address.
* Makes a new [[KeyPair]], returns the address.
*
* @param entropy Optional parameter that may be necessary to produce secure keys
*
* @returns Address of the new key pair
* @returns Address of the new [[KeyPair]]
*/
makeKey:(entropy?:Buffer) => string;
makeKey:(entropy?:Buffer) => Buffer;
/**
* Given a private key, makes a new key pair, returns the address.
* Given a private key, makes a new [[KeyPair]], returns the address.
*
* @param privk A {@link https://github.com/feross/buffer|Buffer} representing the private key
*
* @returns Address of the new key pair
* @returns Address of the new [[KeyPair]]
*/
importKey:(privk:Buffer) => string;
importKey:(privk:Buffer) => Buffer;
/**
* Gets an array of addresses stored in the key chain.
* Gets an array of addresses stored in the [[KeyChain]].
*
* @returns An array of {@link https://github.com/feross/buffer|Buffer} representations of the addresses
*/
getAddresses = ():Array<Buffer> => {
return Object.values(this.keys).map(kp => kp.getAddress());
}
/**
* Gets an array of addresses stored in the [[KeyChain]].
*
* @returns An array of string representations of the addresses
*/
getAddresses = ():Array<string> => {
return Object.keys(this.keys);
getAddressStrings = ():Array<string> => {
return Object.values(this.keys).map(kp => kp.getAddressString());
}
/**
* Adds the key pair to the list of the keys managed in the keychain.
* Adds the key pair to the list of the keys managed in the [[KeyChain]].
*
* @param newKey A key pair of the appropriate class to be added to the keychain
* @param newKey A key pair of the appropriate class to be added to the [[KeyChain]]
*/
addKey = (newKey:KPClass) => {
this.keys[newKey.getAddress()] = newKey;
newKey.setChainID(this.chainid);
this.keys[newKey.getAddress().toString("hex")] = newKey;
}
/**
* Removes the key pair from the list of they keys managed in the keychain.
* Removes the key pair from the list of they keys managed in the [[KeyChain]].
*
* @param key A string for the address or KPClass to remove
* @param key A {@link https://github.com/feross/buffer|Buffer} for the address or KPClass to remove
*
* @returns The boolean true if a key was removed.
*/
removeKey = (key:KPClass | string) => {
removeKey = (key:KPClass | Buffer) => {
let kaddr:string;
if(typeof key !== "string"){
kaddr = key.getAddress();
if(key instanceof Buffer){
kaddr = key.toString("hex");
} else {
kaddr = key;
kaddr = key.getAddress().toString("hex");
}

@@ -313,20 +352,44 @@ if(kaddr in this.keys){

*/
hasKey = (address:string):boolean => {
return (address in this.keys);
hasKey = (address:Buffer):boolean => {
return (address.toString("hex") in this.keys);
}
/**
* Returns the key pair listed under the provided address
* Returns the [[KeyPair]] listed under the provided address
*
* @param address The address to retrieve from the keys database
* @param address The {@link https://github.com/feross/buffer|Buffer} of the address to retrieve from the keys database
*
* @returns A reference to the key pair in the keys database
* @returns A reference to the [[KeyPair]] in the keys database
*/
getKey = (address:string): KPClass => {
return this.keys[address];
getKey = (address:Buffer): KPClass => {
return this.keys[address.toString("hex")];
}
/**
* Returns instance of KeyChain.
* Returns the chainID associated with this [[KeyChain]].
*
* @returns The [[KeyChain]]'s chainID
*/
constructor() {}
getChainID = ():string => {
return this.chainid
}
/**
* Sets the the chainID associated with this [[KeyChain]] and all associated keypairs.
*
* @param chainid String for the chainID
*/
setChainID = (chainid:string):void => {
this.chainid = chainid;
for(let address in this.keys){
this.keys[address].setChainID(chainid);
}
}
/**
* Returns instance of [[KeyChain]].
*/
constructor(chainid:string) {
this.chainid = chainid;
}
}

@@ -357,3 +420,3 @@

*/
fromString = (b58str:string):number => {
fromString(b58str:string):number {
try {

@@ -375,3 +438,3 @@ this.fromBuffer(bintools.b58ToBuffer(b58str));

*/
fromBuffer = (buff:Buffer):number => {
fromBuffer(buff:Buffer):number {
try {

@@ -397,3 +460,3 @@ if(buff.length != this.bsize){

*/
toBuffer = ():Buffer => {
toBuffer():Buffer {
return this.bytes;

@@ -407,3 +470,3 @@ }

*/
toString = ():string => {
toString():string {
return bintools.bufferToB58(this.toBuffer());

@@ -416,1 +479,58 @@ }

}
let n2_avm:object = {
blockchainID: "HD8HEwNKTXRBcVUqvQW2LRu9izqej91xzGmXATF4KMMV6LLm7",
alias: "X",
vm: "avm"
};
let n2_platform:object = {
blockchainID: "",
alias: "P",
vm: "platform"
};
let n2_contracts:object = {
blockchainID: "",
alias: "C",
vm: "contracts"
}
export class Defaults {
static network = {
1: {}, //update before mainnet
2: {
"avm": n2_avm,
"X": n2_avm,
"HD8HEwNKTXRBcVUqvQW2LRu9izqej91xzGmXATF4KMMV6LLm7": n2_avm,
"platform": n2_platform,
"P": n2_platform,
"BCID1": n2_platform,
"contracts": n2_contracts,
"C": n2_contracts,
"BCID2": n2_contracts
},
49: {
"avm": n2_avm,
"X": n2_avm,
"HD8HEwNKTXRBcVUqvQW2LRu9izqej91xzGmXATF4KMMV6LLm7": n2_avm,
"platform": n2_platform,
"P": n2_platform,
"BCID1": n2_platform,
"contracts": n2_contracts,
"C": n2_contracts,
"BCID2": n2_contracts
},
12345: {
"avm": n2_avm,
"X": n2_avm,
"GJABrZ9A6UQFpwjPU8MDxDd8vuyRoDVeDAXc694wJ5t3zEkhU": n2_avm,
"platform": n2_platform,
"P": n2_platform,
"BCID1": n2_platform,
"contracts": n2_contracts,
"C": n2_contracts,
"BCID2": n2_contracts
}
};
}

@@ -9,7 +9,8 @@ import mockAxios from 'jest-mock-axios';

import { UTXOSet, UTXO, SecpUTXO } from 'src/apis/avm/utxos';
import { Output, SecpOutput } from 'src/apis/avm/outputs';
import { Output, SecpOutput, SecpOutBase } from 'src/apis/avm/outputs';
import { Input, SecpInput } from 'src/apis/avm/inputs';
import createHash from "create-hash";
import { TxUnsigned, Tx } from 'src/apis/avm/tx';
import { UnixNow } from 'src/apis/avm/types';
import { TxUnsigned, TxCreateAsset, Tx } from 'src/apis/avm/tx';
import { UnixNow, AVMConstants } from 'src/apis/avm/types';
import { InitialStates } from '../../../src/apis/avm/types';

@@ -23,3 +24,3 @@ /**

const networkid:number = 49;
const blockchainid:string = "6h2s5de1VC65meajE1L2PjvZ1MXvHc3F6eqPCGKuDt4MxiweF";
const blockchainid:string = "HD8HEwNKTXRBcVUqvQW2LRu9izqej91xzGmXATF4KMMV6LLm7";
const ip:string = '127.0.0.1';

@@ -34,5 +35,11 @@ const port:number = 9650;

let api:AVMAPI;
let alias:string;
const addrA:string = "X-B6D4v1VtPYLbiUvYXtW4Px8oE9imC2vGW";
const addrB:string = "X-P5wdRuZeaDt28eHMP5S3w9ZdoBfo7wuzF";
const addrC:string = "X-6Y3kysjF9jnHnYkdS9yGAuoHyae2eNmeV";
beforeAll(() => {
api = new AVMAPI(slopes, "/ext/subnet/avm", blockchainid);
api = new AVMAPI(slopes, "/ext/bc/avm", blockchainid);
alias = api.getBlockchainAlias();
});

@@ -44,11 +51,181 @@

test('createAsset', async ()=>{
let kp:AVMKeyPair = new AVMKeyPair();
test('can Send 1', async ()=>{
let txId = 'asdfhvl234';
let result:Promise<string> = api.send(username, password, 'assetId', 10, addrA, [addrB]);
let payload:object = {
"result": {
'txID': txId
}
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let response:string = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(txId);
});
test('can Send 2', async ()=>{
let txId = 'asdfhvl234';
let result:Promise<string> = api.send(username, password, bintools.b58ToBuffer("6h2s5de1VC65meajE1L2PjvZ1MXvHc3F6eqPCGKuDt4MxiweF"), new BN(10), addrA, [addrB]);
let payload:object = {
"result": {
'txID': txId
}
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let response:string = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(txId);
});
test('listAssets', async ()=>{
let assets = ['ATH','ETH'];
let result:Promise<Array<string>> = api.listAssets(addrA);
let payload:object = {
"result": {
'assets': assets
}
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let response:Array<string> = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(assets);
});
test('listAddresses', async ()=>{
let addresses = [addrA,addrB];
let result:Promise<Array<string>> = api.listAddresses(username, password);
let payload:object = {
"result": {
'addresses': addresses
}
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let response:Array<string> = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(addresses);
});
test('importKey', async ()=>{
let address = addrC;
let result:Promise<string> = api.importKey(username, password, 'key');
let payload:object = {
"result": {
'address': address
}
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let response:string = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(address);
});
test('getBalance', async ()=>{
let balance = 100;
let result:Promise<number> = api.getBalance(addrA, 'ATH');
let payload:object = {
"result": {
"balance": balance
}
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let response:number = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(balance);
});
test('exportKey', async ()=>{
let key = 'sdfglvlj2h3v45';
let result:Promise<string> = api.exportKey(username, password, addrA);
let payload:object = {
"result": {
"privateKey": key
}
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let response:string = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(key);
});
test('createAddress', async ()=>{
let alias = 'randomalias';
let result:Promise<string> = api.createAddress(username, password);
let payload:object = {
"result": {
"address": alias
}
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let response:string = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(alias);
});
test('createFixedCapAsset', async ()=>{
let kp:AVMKeyPair = new AVMKeyPair(alias);
kp.importKey(Buffer.from("ef9bf2d4436491c153967c9709dd8e82795bdb9b5ad44ee22c2903005d1cf676", "hex"));
let amount:number = 10000;
let address:string = kp.getAddress();
let address:Buffer = kp.getAddress();
let assetid:string = "8a5d2d32e68bc50036e4d086044617fe4a0a0296b274999ba568ea92da46d533";
let initialHolders:Array<object> = [
{
"address": "7sik3Pr6r1FeLrvK1oWwECBS8iJ5VPuSh",
"amount": "10000"
},
{
"address": "7sik3Pr6r1FeLrvK1oWwECBS8iJ5VPuSh",
"amount": "50000"
}
]
let result:Promise<string> = api.createAsset(amount,address);
let result:Promise<string> = api.createFixedCapAsset(username, password, "Some Coin", "SCC", initialHolders);
let payload:object = {

@@ -70,2 +247,43 @@ "result": {

test('createVariableCapAsset', async ()=>{
let kp:AVMKeyPair = new AVMKeyPair(alias);
kp.importKey(Buffer.from("ef9bf2d4436491c153967c9709dd8e82795bdb9b5ad44ee22c2903005d1cf676", "hex"));
let amount:number = 10000;
let address:Buffer = kp.getAddress();
let assetid:string = "8a5d2d32e68bc50036e4d086044617fe4a0a0296b274999ba568ea92da46d533";
let minterSets:Array<object> = [
{
"minters":[
"4peJsFvhdn7XjhNF4HWAQy6YaJts27s9q"
],
"threshold": 1
},
{
"minters": [
"dcJ6z9duLfyQTgbjq2wBCowkvcPZHVDF",
"2fE6iibqfERz5wenXE6qyvinsxDvFhHZk",
"7ieAJbfrGQbpNZRAQEpZCC1Gs1z5gz4HU"
],
"threshold": 2
}
]
let result:Promise<string> = api.createVariableCapAsset(username, password, "Some Coin", "SCC", minterSets);
let payload:object = {
"result": {
'assetID': assetid
}
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let response:string = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(assetid);
});
test('getTxStatus', async ()=>{

@@ -93,9 +311,12 @@ let txid:string = "f966750f438867c3c9828ddcdbe660e21ccdbb36a9276958f011ba472f75d4e7";

test('getAssetDescription as string', async ()=>{
let assetid:string = "8a5d2d32e68bc50036e4d086044617fe4a0a0296b274999ba568ea92da46d533";
let assetid:Buffer = Buffer.from("8a5d2d32e68bc50036e4d086044617fe4a0a0296b274999ba568ea92da46d533", 'hex');
let assetidstr:string = bintools.avaSerialize(assetid);
let result:Promise<object> = api.getAssetDescription(assetid);
let result:Promise<object> = api.getAssetDescription(assetidstr);
let payload:object = {
"result": {
'name': "Collin Coin",
'symbol': 'CKC'
'symbol': 'CKC',
'assetID': assetidstr,
'denomination': '10'
}

@@ -113,6 +334,9 @@ };

expect(response["symbol"]).toBe("CKC");
expect(response["assetID"].toString("hex")).toBe(assetid.toString("hex"));
expect(response["denomination"]).toBe(10);
});
test('getAssetDescription as Buffer', async ()=>{
let assetid:Buffer = Buffer.from("8a5d2d32e68bc50036e4d086044617fe4a0a0296b274999ba568ea92da46d533");
let assetid:Buffer = Buffer.from("8a5d2d32e68bc50036e4d086044617fe4a0a0296b274999ba568ea92da46d533", 'hex');
let assetidstr:string = bintools.avaSerialize(Buffer.from('8a5d2d32e68bc50036e4d086044617fe4a0a0296b274999ba568ea92da46d533', 'hex'));

@@ -123,3 +347,5 @@ let result:Promise<object> = api.getAssetDescription(assetid);

'name': "Collin Coin",
'symbol': 'CKC'
'symbol': 'CKC',
'assetID': assetidstr,
'denomination': '11'
}

@@ -137,2 +363,4 @@ };

expect(response["symbol"]).toBe("CKC");
expect(response["assetID"].toString("hex")).toBe(assetid.toString("hex"));
expect(response["denomination"]).toBe(11);
});

@@ -152,4 +380,4 @@

expect(persistOpts.getMergeRule()).toBe("union");
let result:Promise<UTXOSet> = api.getUTXOs(set.getAddresses(), persistOpts);
let addresses:Array<string> = set.getAddresses().map(a => api.addressFromBuffer(a));
let result:Promise<UTXOSet> = api.getUTXOs(addresses, persistOpts);
let payload:object = {

@@ -170,3 +398,4 @@ "result": {

result = api.getUTXOs(set.getAddresses(), persistOpts);
addresses = set.getAddresses().map(a => api.addressFromBuffer(a));
result = api.getUTXOs(addresses, persistOpts);

@@ -193,2 +422,7 @@

let assetID:Buffer = Buffer.from(createHash("sha256").update("mary had a little lamb").digest());
let secpbase1:SecpOutBase;
let secpbase2:SecpOutBase;
let secpbase3:SecpOutBase;
let initialState:InitialStates;

@@ -198,4 +432,4 @@ beforeEach(() => {

api.newKeyChain()
keymgr2 = new AVMKeyChain();
keymgr3 = new AVMKeyChain();
keymgr2 = new AVMKeyChain(alias);
keymgr3 = new AVMKeyChain(alias);
addrs1 = [];

@@ -208,12 +442,11 @@ addrs2 = [];

for(let i:number = 0; i < 3; i++){
addrs1.push(api.keyChain().makeKey());
addrs2.push(keymgr2.makeKey());
addrs3.push(keymgr3.makeKey());
addrs1.push(api.addressFromBuffer(api.keyChain().makeKey()));
addrs2.push(api.addressFromBuffer(keymgr2.makeKey()));
addrs3.push(api.addressFromBuffer(keymgr3.makeKey()));
}
let amount:BN = new BN(amnt);
let addresses:Array<string> = api.keyChain().getAddresses();
let fallAddresses:Array<string> = keymgr2.getAddresses()
let addressbuffs:Array<Buffer> = api.keyChain().getAddresses();
let addresses:Array<string> = addressbuffs.map(a => api.addressFromBuffer(a));
let fallAddresses:Array<string> = keymgr2.getAddresses().map(a => api.addressFromBuffer(a));
let locktime:BN = new BN(54321);

@@ -228,3 +461,3 @@ let fallLocktime:BN = locktime.add(new BN(50));

let out:SecpOutput;
out = new SecpOutput(assetID, amount, addresses, locktime, threshold);
out = new SecpOutput(assetID, amount, addressbuffs, locktime, threshold);
outputs.push(out);

@@ -244,11 +477,21 @@

set.addArray(utxos);
secpbase1 = new SecpOutBase(new BN(777), addrs3.map(a => api.parseAddress(a)));
secpbase2 = new SecpOutBase(new BN(888), addrs2.map(a => api.parseAddress(a)));
secpbase3 = new SecpOutBase(new BN(999), addrs2.map(a => api.parseAddress(a)));
initialState = new InitialStates();
initialState.addOutput(secpbase1, AVMConstants.SECPFXID);
initialState.addOutput(secpbase2, AVMConstants.SECPFXID);
initialState.addOutput(secpbase3, AVMConstants.SECPFXID);
});
test('makeUnsignedTx1', () => {
test('makeUnsignedTx1', async () => {
let txu1:TxUnsigned = api.makeUnsignedTx(set, new BN(amnt), addrs3, addrs1, addrs1, bintools.avaSerialize(assetID));
let txu1:TxUnsigned = await api.makeUnsignedTx(set, new BN(amnt), addrs3, addrs1, addrs1, bintools.avaSerialize(assetID));
let txu2:TxUnsigned = set.makeUnsignedTx(
networkid, bintools.avaDeserialize(blockchainid), new BN(amnt),
addrs3, addrs1, addrs1, assetID,
UnixNow(), new BN(0), 1
addrs3.map(a => api.parseAddress(a)),
addrs1.map(a => api.parseAddress(a)),
addrs1.map(a => api.parseAddress(a)),
assetID, UnixNow(), new BN(0), 1
);

@@ -261,8 +504,10 @@

test('makeUnsignedTx2', () => {
let txu1:TxUnsigned = api.makeUnsignedTx(set, new BN(amnt).sub(new BN(100)), addrs3, addrs1, addrs2, bintools.avaSerialize(assetID));
test('makeUnsignedTx2', async () => {
let txu1:TxUnsigned = await api.makeUnsignedTx(set, new BN(amnt).sub(new BN(100)), addrs3, addrs1, addrs2, bintools.avaSerialize(assetID));
let txu2:TxUnsigned = set.makeUnsignedTx(
networkid, bintools.avaDeserialize(blockchainid), new BN(amnt).sub(new BN(100)),
addrs3, addrs1, addrs2, assetID,
UnixNow(), new BN(0), 1
addrs3.map(a => api.parseAddress(a)),
addrs1.map(a => api.parseAddress(a)),
addrs2.map(a => api.parseAddress(a)),
assetID, UnixNow(), new BN(0), 1
);

@@ -276,4 +521,4 @@

expect(outies.length).toBe(2);
let outaddr0 = Object.keys(outies[0].getAddresses());
let outaddr1 = Object.keys(outies[1].getAddresses());
let outaddr0 = outies[0].getAddresses().map(a => api.addressFromBuffer(a));
let outaddr1 = outies[1].getAddresses().map(a => api.addressFromBuffer(a));

@@ -291,8 +536,10 @@ let testaddr2 = JSON.stringify(addrs2.sort());

test('signTx', () => {
let txu1:TxUnsigned = api.makeUnsignedTx(set, new BN(amnt), addrs3, addrs1, addrs1, bintools.avaSerialize(assetID));
test('signTx', async () => {
let txu1:TxUnsigned = await api.makeUnsignedTx(set, new BN(amnt), addrs3, addrs1, addrs1, bintools.avaSerialize(assetID));
let txu2:TxUnsigned = set.makeUnsignedTx(
networkid, bintools.avaDeserialize(blockchainid), new BN(amnt),
addrs3, addrs1, addrs1, assetID, UnixNow(),
new BN(0), 1
addrs3.map(a => api.parseAddress(a)),
addrs1.map(a => api.parseAddress(a)),
addrs1.map(a => api.parseAddress(a)),
assetID, UnixNow(), new BN(0), 1
);

@@ -309,3 +556,3 @@

test('issueTx Serialized', async ()=>{
let txu:TxUnsigned = api.makeUnsignedTx(set, new BN(amnt), addrs3, addrs1, addrs1, bintools.avaSerialize(assetID));
let txu:TxUnsigned = await api.makeUnsignedTx(set, new BN(amnt), addrs3, addrs1, addrs1, bintools.avaSerialize(assetID));
let tx = api.signTx(txu);

@@ -333,3 +580,3 @@

test('issueTx Buffer', async ()=>{
let txu:TxUnsigned = api.makeUnsignedTx(set, new BN(amnt), addrs3, addrs1, addrs1, bintools.avaSerialize(assetID));
let txu:TxUnsigned = await api.makeUnsignedTx(set, new BN(amnt), addrs3, addrs1, addrs1, bintools.avaSerialize(assetID));
let tx = api.signTx(txu);

@@ -357,3 +604,3 @@

test('issueTx Class Tx', async ()=>{
let txu:TxUnsigned = api.makeUnsignedTx(set, new BN(amnt), addrs3, addrs1, addrs1, bintools.avaSerialize(assetID));
let txu:TxUnsigned = await api.makeUnsignedTx(set, new BN(amnt), addrs3, addrs1, addrs1, bintools.avaSerialize(assetID));
let tx = api.signTx(txu);

@@ -380,2 +627,34 @@

test('makeCreateAssetTx', async () => {
let fee:number = 10;
let name:string = "Mortycoin is the dumb as a sack of hammers.";
let symbol:string = "morT";
let denomination:number = 8;
let result:Promise<TxCreateAsset> = api.makeCreateAssetTx(set, new BN(fee), addrs1, initialState, name, symbol, denomination);
let payload:object = {
"result": {
'name': name,
'symbol': symbol,
'assetID': bintools.avaSerialize(assetID),
'denomination': "" + denomination
}
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let txu1:TxCreateAsset = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
let txu2:TxCreateAsset = set.makeCreateAssetTx(slopes.getNetworkID(), bintools.avaDeserialize(api.getBlockchainID()), assetID, new BN(fee), addrs1.map(a => api.parseAddress(a)), initialState, name, symbol, denomination);
expect(txu2.toBuffer().toString("hex")).toBe(txu1.toBuffer().toString("hex"));
expect(txu2.toString()).toBe(txu1.toString());
});
});

@@ -382,0 +661,0 @@

@@ -9,3 +9,3 @@ import { UTXOSet, UTXO, SecpUTXO } from 'src/apis/avm/utxos';

import { Output, SecpOutput } from 'src/apis/avm/outputs';
import { Constants } from 'src/apis/avm/types';
import { AVMConstants } from 'src/apis/avm/types';

@@ -21,4 +21,4 @@

let keymgr2:AVMKeyChain;
let addrs1:Array<string>;
let addrs2:Array<string>;
let addrs1:Array<Buffer>;
let addrs2:Array<Buffer>;
let utxos:Array<SecpUTXO>;

@@ -28,4 +28,4 @@ const amnt:number = 10000;

set = new UTXOSet();
keymgr1 = new AVMKeyChain();
keymgr2 = new AVMKeyChain();
keymgr1 = new AVMKeyChain("X");
keymgr2 = new AVMKeyChain("X");
addrs1 = [];

@@ -39,4 +39,4 @@ addrs2 = [];

let amount:BN = new BN(amnt);
let addresses:Array<string> = keymgr1.getAddresses();
let fallAddresses:Array<string> = keymgr2.getAddresses()
let addresses:Array<Buffer> = keymgr1.getAddresses();
let fallAddresses:Array<Buffer> = keymgr2.getAddresses()
let locktime:BN = new BN(54321);

@@ -73,3 +73,3 @@ let fallLocktime:BN = locktime.add(new BN(50));

expect(input.getUTXOID()).toBe(u.getUTXOID());
expect(input.getInputID()).toBe(Constants.SECPINPUTID);
expect(input.getInputID()).toBe(AVMConstants.SECPINPUTID);

@@ -76,0 +76,0 @@ input.addSignatureIdx(0, addrs2[0]);

@@ -7,6 +7,6 @@ import { AVMKeyChain, AVMKeyPair } from 'src/apis/avm/keychain';

const bintools = BinTools.getInstance();
const alias = "X";
describe('AVMKeyPair', () => {
test('repeatable 1', () => {
let kp:AVMKeyPair = new AVMKeyPair();
let kp:AVMKeyPair = new AVMKeyPair(alias);
kp.importKey(Buffer.from("ef9bf2d4436491c153967c9709dd8e82795bdb9b5ad44ee22c2903005d1cf676", "hex"));

@@ -25,3 +25,3 @@ expect(kp.getPublicKey().toString("hex")).toBe("033fad3644deb20d7a210d12757092312451c112d04773cee2699fbb59dc8bb2ef");

test('repeatable 2', () => {
let kp:AVMKeyPair = new AVMKeyPair();
let kp:AVMKeyPair = new AVMKeyPair(alias);
kp.importKey(Buffer.from("17c692d4a99d12f629d9f0ff92ec0dba15c9a83e85487b085c1a3018286995c6", "hex"));

@@ -40,3 +40,3 @@ expect(kp.getPublicKey().toString("hex")).toBe("02486553b276cfe7abf0efbcd8d173e55db9c03da020c33d0b219df24124da18ee");

test('repeatable 3', () => {
let kp:AVMKeyPair = new AVMKeyPair();
let kp:AVMKeyPair = new AVMKeyPair(alias);
kp.importKey(Buffer.from("d0e17d4b31380f96a42b3e9ffc4c1b2a93589a1e51d86d7edc107f602fbc7475", "hex"));

@@ -55,3 +55,3 @@ expect(kp.getPublicKey().toString("hex")).toBe("031475b91d4fcf52979f1cf107f058088cc2bea6edd51915790f27185a7586e2f2");

test('Creation Empty', () => {
let kp:AVMKeyPair = new AVMKeyPair();
let kp:AVMKeyPair = new AVMKeyPair(alias);
expect(kp.getPrivateKey()).not.toBeUndefined();

@@ -75,9 +75,9 @@ expect(kp.getAddress()).not.toBeUndefined();

let keybuff:Buffer = Buffer.from("d0e17d4b31380f96a42b3e9ffc4c1b2a93589a1e51d86d7edc107f602fbc7475", "hex");
let kc:AVMKeyChain = new AVMKeyChain();
let kp2:AVMKeyPair = new AVMKeyPair();
let addr1:string = kc.importKey(keybuff);
let kc:AVMKeyChain = new AVMKeyChain(alias);
let kp2:AVMKeyPair = new AVMKeyPair(alias);
let addr1:Buffer = kc.importKey(keybuff);
let kp1:AVMKeyPair = kc.getKey(addr1);
kp2.importKey(keybuff);
let addr2 = kp1.getAddress();
expect(addr1).toBe(addr2);
expect(addr1.toString("hex")).toBe(addr2.toString("hex"));
expect(kp1.getPrivateKeyString()).toBe(kp2.getPrivateKeyString());

@@ -90,9 +90,9 @@ expect(kp1.getPublicKeyString()).toBe(kp2.getPublicKeyString());

let keybuff:Buffer = Buffer.from("d0e17d4b31380f96a42b3e9ffc4c1b2a93589a1e51d86d7edc107f602fbc7475", "hex");
let kc:AVMKeyChain = new AVMKeyChain();
let kp2:AVMKeyPair = new AVMKeyPair();
let addr1:string = kc.importKey(bintools.avaSerialize(keybuff));
let kc:AVMKeyChain = new AVMKeyChain(alias);
let kp2:AVMKeyPair = new AVMKeyPair(alias);
let addr1:Buffer = kc.importKey(bintools.avaSerialize(keybuff));
let kp1:AVMKeyPair = kc.getKey(addr1);
kp2.importKey(keybuff);
let addr2 = kp1.getAddress();
expect(addr1).toBe(addr2);
expect(addr1.toString("hex")).toBe(addr2.toString("hex"));
expect(kp1.getPrivateKeyString()).toBe(kp2.getPrivateKeyString());

@@ -105,5 +105,5 @@ expect(kp1.getPublicKeyString()).toBe(kp2.getPublicKeyString());

let keybuff:Buffer = Buffer.from("d0e17d4b31380f96a42b3e9ffc4c1b2a93589a1e51d86d7edc107f602fbc7475", "hex");
let kc:AVMKeyChain = new AVMKeyChain();
let kp1:AVMKeyPair = new AVMKeyPair();
let addr1:string = kc.importKey(keybuff);
let kc:AVMKeyChain = new AVMKeyChain(alias);
let kp1:AVMKeyPair = new AVMKeyPair(alias);
let addr1:Buffer = kc.importKey(keybuff);
kp1.importKey(keybuff);

@@ -117,4 +117,4 @@ expect(kc.hasKey(addr1)).toBe(true);

let keybuff:Buffer = Buffer.from("d0e17d4b31380f96a42b3e9ffc4c1b2a93589a1e51d86d7edc107f602fbc7475", "hex");
let kc:AVMKeyChain = new AVMKeyChain();
let addr1:string = kc.importKey(keybuff);
let kc:AVMKeyChain = new AVMKeyChain(alias);
let addr1:Buffer = kc.importKey(keybuff);
expect(kc.hasKey(addr1)).toBe(true);

@@ -127,7 +127,7 @@ kc.removeKey(addr1);

let keybuff:Buffer = Buffer.from("d0e17d4b31380f96a42b3e9ffc4c1b2a93589a1e51d86d7edc107f602fbc7475", "hex");
let kc:AVMKeyChain = new AVMKeyChain();
let addr1:string = kc.importKey(keybuff);
let kc:AVMKeyChain = new AVMKeyChain(alias);
let addr1:Buffer = kc.importKey(keybuff);
expect(kc.hasKey(addr1)).toBe(true);
expect(kc.removeKey("6Y3kysjF9jnHnYkdS9yGAuoHyae2eNmeV")).toBe(false);
expect(kc.removeKey(bintools.avaDeserialize("6Y3kysjF9jnHnYkdS9yGAuoHyae2eNmeV"))).toBe(false);
});
});

@@ -5,3 +5,2 @@ import BN from "bn.js";

import { Output, SecpOutput, SelectOutputClass } from 'src/apis/avm/outputs';
import { Constants } from '../../../src/apis/avm/types';

@@ -13,6 +12,6 @@ const bintools = BinTools.getInstance();

let assetIDBuff:Buffer = Buffer.from(assetID, "hex");
let addrs:Array<string> = [
"B6D4v1VtPYLbiUvYXtW4Px8oE9imC2vGW",
"P5wdRuZeaDt28eHMP5S3w9ZdoBfo7wuzF",
"6Y3kysjF9jnHnYkdS9yGAuoHyae2eNmeV"
let addrs:Array<Buffer> = [
bintools.avaDeserialize("B6D4v1VtPYLbiUvYXtW4Px8oE9imC2vGW"),
bintools.avaDeserialize("P5wdRuZeaDt28eHMP5S3w9ZdoBfo7wuzF"),
bintools.avaDeserialize("6Y3kysjF9jnHnYkdS9yGAuoHyae2eNmeV")
].sort();

@@ -50,6 +49,3 @@

expect(out.getOutputID()).toBe(4);
expect(JSON.stringify(Object.keys(out.getAddresses()).sort())).toBe(JSON.stringify(addrs.sort()));
expect(out.getAddresses()[addrs[0]].toNumber()).toBe(locktime.toNumber());
expect(out.getAddresses()[addrs[1]].toNumber()).toBe(locktime.toNumber());
expect(out.getAddresses()[addrs[2]].toNumber()).toBe(locktime.toNumber());
expect(JSON.stringify(out.getAddresses().sort())).toStrictEqual(JSON.stringify(addrs.sort()));

@@ -62,3 +58,3 @@ expect(out.getThreshold()).toBe(3);

let r = out.getAddressIdx(addrs[2]);
expect(out.getAddress(r)).toBe(addrs[2]);
expect(out.getAddress(r)).toStrictEqual(addrs[2]);
expect(() => {

@@ -73,3 +69,3 @@ out.getAddress(400)

let s:Array<string> = out.getSpenders(addrs);
let s:Array<Buffer> = out.getSpenders(addrs);
expect(JSON.stringify(s.sort())).toBe(JSON.stringify(addrs.sort()));

@@ -76,0 +72,0 @@

import { UTXOSet, UTXO, SecpUTXO } from 'src/apis/avm/utxos';
import { TxUnsigned, Tx } from 'src/apis/avm/tx';
import { TxUnsigned, TxCreateAsset, Tx } from 'src/apis/avm/tx';
import { AVMKeyChain } from 'src/apis/avm/keychain';

@@ -9,5 +9,5 @@ import { Input, SecpInput } from 'src/apis/avm/inputs';

import {Buffer} from "buffer/";
import { Output, SecpOutput } from 'src/apis/avm/outputs';
import { UnixNow } from 'src/apis/avm/types';
import { Output, SecpOutput, SecpOutBase } from 'src/apis/avm/outputs';
import { UnixNow, AVMConstants} from 'src/apis/avm/types';
import { InitialStates } from '../../../src/apis/avm/types';
/**

@@ -22,5 +22,5 @@ * @ignore

let keymgr3:AVMKeyChain;
let addrs1:Array<string>;
let addrs2:Array<string>;
let addrs3:Array<string>;
let addrs1:Array<Buffer>;
let addrs2:Array<Buffer>;
let addrs3:Array<Buffer>;
let utxos:Array<SecpUTXO>;

@@ -32,8 +32,9 @@ let inputs:Array<SecpInput>;

let blockchainID:Buffer = Buffer.from(createHash("sha256").update("I am the very model of a modern major general").digest());
let alias:string = "X";
let assetID:Buffer = Buffer.from(createHash("sha256").update("mary had a little lamb").digest());
beforeEach(() => {
set = new UTXOSet();
keymgr1 = new AVMKeyChain();
keymgr2 = new AVMKeyChain();
keymgr3 = new AVMKeyChain();
keymgr1 = new AVMKeyChain(alias);
keymgr2 = new AVMKeyChain(alias);
keymgr3 = new AVMKeyChain(alias);
addrs1 = [];

@@ -52,4 +53,4 @@ addrs2 = [];

let amount:BN = new BN(amnt);
let addresses:Array<string> = keymgr1.getAddresses();
let fallAddresses:Array<string> = keymgr2.getAddresses()
let addresses:Array<Buffer> = keymgr1.getAddresses();
let fallAddresses:Array<Buffer> = keymgr2.getAddresses();
let locktime:BN = new BN(54321);

@@ -59,3 +60,2 @@ let fallLocktime:BN = locktime.add(new BN(50));

let fallThreshold:number = 1;
for(let i:number = 0; i < 5; i++){

@@ -152,3 +152,55 @@ let txid:Buffer = Buffer.from(createHash("sha256").update(bintools.fromBNToBuffer(new BN(i), 32)).digest());

});
test('Asset Creation Tx', () => {
let secpbase1:SecpOutBase = new SecpOutBase(new BN(777), addrs3);
let secpbase2:SecpOutBase = new SecpOutBase(new BN(888), addrs2);
let secpbase3:SecpOutBase = new SecpOutBase(new BN(999), addrs2);
let initialState:InitialStates = new InitialStates();
initialState.addOutput(secpbase1, AVMConstants.SECPFXID);
initialState.addOutput(secpbase2, AVMConstants.SECPFXID);
initialState.addOutput(secpbase3, AVMConstants.SECPFXID);
let name:string = "Rickcoin is the most intelligent coin";
let symbol:string = "RICK";
let denomination:number = 9;
let txu:TxCreateAsset = new TxCreateAsset(name, symbol, denomination, initialState, inputs, outputs, netid, blockchainID, AVMConstants.CREATEASSETTX);
let txins:Array<Input> = txu.getIns();
let txouts:Array<Output> = txu.getOuts();
let initState:InitialStates = txu.getInitialStates();
expect(txins.length).toBe(inputs.length);
expect(txouts.length).toBe(outputs.length);
expect(initState.toBuffer().toString("hex")).toBe(initialState.toBuffer().toString("hex"));
expect(txu.getTxType()).toBe(AVMConstants.CREATEASSETTX);
expect(txu.getNetworkID()).toBe(49);
expect(txu.getBlockchainID().toString("hex")).toBe(blockchainID.toString("hex"));
expect(txu.getName()).toBe(name);
expect(txu.getNameBuffer().toString("hex")).toBe(bintools.stringToBuffer(name).toString("hex"));
expect(txu.getSymbol()).toBe(symbol);
expect(txu.getSymbolBuffer().toString("hex")).toBe(bintools.stringToBuffer(symbol).toString("hex"));
expect(txu.getDenomination()).toBe(denomination);
expect(txu.getDenominationBuffer().readUInt8(0)).toBe(denomination);
let a:Array<string> = [];
let b:Array<string> = [];
for(let i:number = 0; i < txins.length; i++){
a.push(txins[i].toString());
b.push(inputs[i].toString());
}
expect(JSON.stringify(a.sort())).toBe(JSON.stringify(b.sort()));
a = [];
b = [];
for(let i:number = 0; i < txouts.length; i++){
a.push(txouts[i].toString());
b.push(outputs[i].toString());
}
expect(JSON.stringify(a.sort())).toBe(JSON.stringify(b.sort()));
let txunew:TxCreateAsset = new TxCreateAsset();
txunew.fromBuffer(txu.toBuffer());
expect(txunew.toBuffer().toString("hex")).toBe(txu.toBuffer().toString("hex"));
expect(txunew.toString()).toBe(txu.toString());
});
});

@@ -38,4 +38,4 @@ import { SigIdx, Signature, Address, UnixNow } from 'src/apis/avm/types';

expect(sigidx.getSize()).toBe(sigidx.toBuffer().length);
sigidx.setSource("abcd");
expect(sigidx.getSource()).toBe("abcd");
sigidx.setSource(Buffer.from("abcd", "hex"));
expect(sigidx.getSource().toString("hex")).toBe("abcd");
});

@@ -42,0 +42,0 @@

@@ -77,13 +77,9 @@ import BN from "bn.js";

test('getAddresses', () => {
let addresses:{ [address: string]: BN } = u1.getAddresses();
let expected:{ [address: string]: BN; } = {};
expected[opaddr] = new BN(oplocktime, "hex");
const addrs = Object.keys(addresses);
for( let x of addrs ){
expect(expected[x]).not.toBeUndefined();
expect(expected[x].toNumber()).toBe(addresses[x].toNumber());
let addresses:Array<Buffer> = u1.getAddresses();
for( let i = 0; i < addresses.length; i++ ){
expect(addresses[i]).not.toBeUndefined();
}
});
test('getAddressIdx', () => {
let addropinfo:number = u1.getAddressIdx(opaddr);
let addropinfo:number = u1.getAddressIdx(bintools.avaDeserialize(opaddr));
expect(addropinfo).toBe(0);

@@ -94,7 +90,7 @@ });

let recaddr1 = u1.getAddress(0);
expect(recaddr1).toBe(opaddr);
expect(recaddr1.toString("hex")).toBe(bintools.avaDeserialize(opaddr).toString("hex"));
});
test('getSpenders', () => {
let addrs = [opaddr];
let addrs = [bintools.avaDeserialize(opaddr)];

@@ -110,3 +106,3 @@ let thepast = u1.getSpenders(addrs, new BN(0));

test('meetsThreshold', () => {
let addrs = [opaddr];
let addrs = [bintools.avaDeserialize(opaddr)];
let thepast = u1.meetsThreshold(addrs, new BN(1));

@@ -144,5 +140,5 @@ expect(thepast).toBe(true);

];
let addrs:Array<string> = [
"FuB6Lw2D62NuM8zpGLA4Avepq7eGsZRiG",
"MaTvKGccbYzCxzBkJpb2zHW7E1WReZqB8"
let addrs:Array<Buffer> = [
bintools.avaDeserialize("FuB6Lw2D62NuM8zpGLA4Avepq7eGsZRiG"),
bintools.avaDeserialize("MaTvKGccbYzCxzBkJpb2zHW7E1WReZqB8")
];

@@ -262,3 +258,3 @@ test('Creation', () => {

let utxoids:Array<string>;
utxoids = set.getUTXOIDs(addrs[0]);
utxoids = set.getUTXOIDs([addrs[0]]);
expect(utxoids.length).toBe(1);

@@ -315,3 +311,3 @@ utxoids = set.getUTXOIDs(addrs);

}
let addresses:Array<string> = set.getAddresses();
let addresses:Array<Buffer> = set.getAddresses();
expect(set.getAssetIDs(addresses)).toEqual(set.getAssetIDs())

@@ -318,0 +314,0 @@ });

@@ -26,5 +26,5 @@ import mockAxios from 'jest-mock-axios';

test("createAccount", async ()=>{
test("createUser", async ()=>{
let result:Promise<boolean> = keystore.createAccount(username, password);
let result:Promise<boolean> = keystore.createUser(username, password);
let payload:object = {

@@ -46,30 +46,9 @@ "result": {

test('can CreateAddress', async ()=>{
let alias = 'randomalias';
let result:Promise<string> = keystore.createAddress(username, password, alias);
let payload:object = {
"result": {
"address": alias
}
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let response:string = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(alias);
});
test('exportAccount', async ()=>{
test('exportUser', async ()=>{
let data = 'data';
let result:Promise<string> = keystore.exportAccount(username, password);
let result:Promise<string> = keystore.exportUser(username, password);
let payload:object = {
"result": {
"accountData": data
"user": data
}

@@ -88,90 +67,7 @@ };

test('exportKey', async ()=>{
let key = 'sdfglvlj2h3v45';
test('importUser', async ()=>{
let result:Promise<string> = keystore.exportKey(username, password, 'alias', 'address');
let result:Promise<boolean> = keystore.importUser(username, 'data', password);
let payload:object = {
"result": {
"privateKey": key
}
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let response:string = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(key);
});
test('getAllBalances', async ()=>{
let balances = {
'ATH': 23,
'BTC': 59
};
let result:Promise<object> = keystore.getAllBalances('alias', 'address');
let payload:object = {
"result": {
"balances": balances
}
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let response:object = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(balances);
});
test('getBalance', async ()=>{
let balance = 100;
let result:Promise<number> = keystore.getBalance('alias', 'address', 'ATH');
let payload:object = {
"result": {
"balance": balance
}
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let response:number = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(balance);
});
test('getTxHistory', async ()=>{
let history = {};
let result:Promise<object> = keystore.getTxHistory('alias', 'address');
let payload:object = {
"result": history
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let response:object = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(history);
});
test('importAccount', async ()=>{
let result:Promise<boolean> = keystore.importAccount(username, 'data', password);
let payload:object = {
"result": {
'success': true

@@ -191,30 +87,9 @@ }

test('importKey', async ()=>{
let address = 'asdflashdvfalsdf';
let result:Promise<string> = keystore.importKey(username,password, 'alias', 'key');
let payload:object = {
"result": {
'address': address
}
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let response:string = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(address);
});
test('listAccounts', async ()=>{
test('listUsers', async ()=>{
let accounts = ['acc1','acc2'];
let result:Promise<Array<string>> = keystore.listAccounts();
let result:Promise<Array<string>> = keystore.listUsers();
let payload:object = {
"result": {
'accounts': accounts
'users': accounts
}

@@ -233,87 +108,2 @@ };

test('listAddresses', async ()=>{
let addresses = ['acc1','acc2'];
let result:Promise<Array<string>> = keystore.listAddresses(username, 'alias');
let payload:object = {
"result": {
'addresses': addresses
}
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let response:Array<string> = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(addresses);
});
test('listAssets', async ()=>{
let assets = ['ATH','ETH'];
let result:Promise<Array<string>> = keystore.listAssets(username, 'address');
let payload:object = {
"result": {
'assets': assets
}
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let response:Array<string> = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(assets);
});
test('can ListSubnets', async ()=>{
let subnets = ['net1','net2'];
let result:Promise<Array<string>> = keystore.listSubnets();
let payload:object = {
"result": {
'subnetIDs': subnets
}
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let response:Array<string> = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(subnets);
});
test('can Send', async ()=>{
let txId = 'asdfhvl234';
let result:Promise<string> = keystore.send(username,password,'alias', 'assetId', 10, 'toAddress', ['fromAddress']);
let payload:object = {
"result": {
'txID': txId
}
};
let responseObj = {
data: payload
};
mockAxios.mockResponse(responseObj);
let response:string = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(txId);
});
});

@@ -45,9 +45,32 @@ import mockAxios from 'jest-mock-axios';

test("createBlockchain", async ()=>{
let blockchainID:string = "7sik3Pr6r1FeLrvK1oWwECBS8iJ5VPuSh";
let vmID:string = "7sik3Pr6r1FeLrvK1oWwECBS8iJ5VPuSh";
let name:string = "Some Blockchain";
let method:string = 'avm.Booyashakalah';
let genesis:object = {ruh:"roh"};
let result:Promise<string> = platform.createBlockchain(vmID, name, method, genesis);
let payload:object = {
"result": {
"blockchainID": blockchainID
}
};
let responseObj = {
data: payload
};
test("createSubnet", async ()=>{
mockAxios.mockResponse(responseObj);
let response:string = await result;
let result:Promise<boolean> = platform.createSubnet('txId');
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(blockchainID);
});
test("getBlockchainStatus", async ()=>{
let blockchainID:string = "7sik3Pr6r1FeLrvK1oWwECBS8iJ5VPuSh";
let result:Promise<string> = platform.getBlockchainStatus(blockchainID);
let payload:object = {
"result": {
"success": true
"status": "Accepted"
}

@@ -60,6 +83,6 @@ };

mockAxios.mockResponse(responseObj);
let response:boolean = await result;
let response:string = await result;
expect(mockAxios.request).toHaveBeenCalledTimes(1);
expect(response).toBe(true);
expect(response).toBe("Accepted");
});

@@ -66,0 +89,0 @@

@@ -11,2 +11,5 @@ import BinTools from "src/utils/bintools";

let hexstr3:string = "0001020304050607080909080706050403020101"
let hexbuffstr1:string = "000461736466"; // = asdf
let hexbuffstr2:string = "000761626364656667"; // = abcdefg
let hexbuffstr3:string = "00076f6b0066696e65"; // = ok<null>fineokfine
let b58str:string = "1UoWww8DGaVGLtea7zU7p";

@@ -37,2 +40,24 @@ let b58str2:string = "1Bhh3pU9gLXZiJv73kmqZwHJ4F"

test('bufferToString', () => {
let bres:string = bintools.bufferToString(Buffer.from(hexbuffstr1, "hex"));
expect(bres).toBe(Buffer.from(hexbuffstr1.slice(4), "hex").toString("utf8"));
// testing null character edge case
let bres2:string = bintools.bufferToString(Buffer.from(hexbuffstr2, "hex"));
expect(bres2).toBe(Buffer.from(hexbuffstr2.slice(4), "hex").toString("utf8"));
// testing null character edge case
let bres3:string = bintools.bufferToString(Buffer.from(hexbuffstr3, "hex"));
expect(bres3).toBe(Buffer.from(hexbuffstr3.slice(4), "hex").toString("utf8"));
});
test('stringToBuffer', () => {
let bres:Buffer = bintools.stringToBuffer("asdf");
expect(bres.slice(2).toString()).toBe(Buffer.from(hexbuffstr1.slice(4), "hex").toString("utf8"));
// testing null character edge case
let bres2:Buffer = bintools.stringToBuffer("abcdefg");
expect(bres2.slice(2).toString()).toBe(Buffer.from(hexbuffstr2.slice(4), "hex").toString("utf8"));
// testing null character edge case
let bres3:Buffer = bintools.stringToBuffer(Buffer.from(hexbuffstr3.slice(4), "hex").toString("utf8"));
expect(bres3.slice(2).toString()).toBe(Buffer.from(hexbuffstr3.slice(4), "hex").toString("utf8"));
});
test('bufferToB58', () => {

@@ -39,0 +64,0 @@ let b58res:string = bintools.bufferToB58(buff);

@@ -8,5 +8,5 @@ /**

import { UTXOSet } from './utxos';
import { MergeRule } from './types';
import { MergeRule, InitialStates } from './types';
import { AVMKeyChain } from './keychain';
import { TxUnsigned, Tx } from './tx';
import { TxUnsigned, Tx, TxCreateAsset } from './tx';
import BN from "bn.js";

@@ -64,9 +64,29 @@ /**

protected blockchainID: string;
protected AVAAssetID: Buffer;
/**
* Gets the alias for the blockchainID if it exists, otherwise returns `undefined`.
*
* @returns The alias for the blockchainID
*/
getBlockchainAlias: () => string;
/**
* Gets the blockchainID and returns it.
*
* @returns The the provided string representing the blockchainID
* @returns The blockchainID
*/
getBlockchainID: () => string;
/**
* Takes an address string and returns its {@link https://github.com/feross/buffer|Buffer} representation if valid.
*
* @returns A {@link https://github.com/feross/buffer|Buffer} for the address if valid, undefined if not valid.
*/
parseAddress: (addr: string) => Buffer;
addressFromBuffer: (address: Buffer) => string;
/**
* Fetches the AVA AssetID and returns it in a Promise.
*
* @returns The the provided string representing the blockchainID
*/
getAVAAssetID: () => Promise<Buffer>;
/**
* Gets a reference to the keychain for this class.

@@ -82,14 +102,140 @@ *

/**
* Creates an asset of a given amount and assigns it to the address provided.
* Gets the balance of a particular asset on a subnet.
*
* @param amount The amount of the asset to be created. If Amount is 10, for example, there will be exist 10 units of the new asset
* @param address The base 58 string representation of the address that holds all units of the new asset upon creation of the asset
* @param address The address to pull the asset balance from
* @param assetID The assetID to pull the balance from
*
* @returns Promise with the balance of the assetID on the provided address for the subnet.
*/
getBalance: (address: string, assetID: string) => Promise<number>;
/**
* Creates an address (and associated private keys) on a user under a subnet.
*
* @param username Name of the user to create the address under
* @param password Password to unlock the user and encrypt the private key
*
* @returns Promise for a string representing the address created by the subnet.
*/
createAddress: (username: string, password: string) => Promise<string>;
/**
* Create a new fixed-cap, fungible asset. A quantity of it is created at initialization and there no more is ever created.
*
* @param username The user paying the transaction fee (in $AVA) for asset creation
* @param password The password for the user paying the transaction fee (in $AVA) for asset creation
* @param name The human-readable name for the asset
* @param symbol Optional. The shorthand symbol for the asset. Between 0 and 4 characters
* @param initialHolders An array of objects containing the field "address" and "amount" to establish the genesis values for the new asset
*
* ```js
* Example initialHolders:
* [
* {
* "address": "X-7sik3Pr6r1FeLrvK1oWwECBS8iJ5VPuSh",
* "amount": 10000
* },
* {
* "address": "X-7sik3Pr6r1FeLrvK1oWwECBS8iJ5VPuSh",
* "amount": 50000
* }
* ]
* ```
*
* @returns Returns a Promise<string> containing the base 58 string representation of the ID of the newly created asset.
*/
createAsset: (amount: number, address: string) => Promise<string>;
createFixedCapAsset: (username: string, password: string, name: string, symbol: string, initialHolders: object[]) => Promise<string>;
/**
* Create a new variable-cap, fungible asset. No units of the asset exist at initialization. Minters can mint units of this asset using createMintTx, signMintTx and sendMintTx.
*
* @param username The user paying the transaction fee (in $AVA) for asset creation
* @param password The password for the user paying the transaction fee (in $AVA) for asset creation
* @param name The human-readable name for the asset
* @param symbol Optional. The shorthand symbol for the asset -- between 0 and 4 characters
* @param minterSets is a list where each element specifies that threshold of the addresses in minters may together mint more of the asset by signing a minting transaction
*
* ```js
* Example minterSets:
* [
* {
* "minters":[
* "X-4peJsFvhdn7XjhNF4HWAQy6YaJts27s9q"
* ],
* "threshold": 1
* },
* {
* "minters": [
* "X-dcJ6z9duLfyQTgbjq2wBCowkvcPZHVDF",
* "X-2fE6iibqfERz5wenXE6qyvinsxDvFhHZk",
* "X-7ieAJbfrGQbpNZRAQEpZCC1Gs1z5gz4HU"
* ],
* "threshold": 2
* }
* ]
* ```
*
* @returns Returns a Promise<string> containing the base 58 string representation of the ID of the newly created asset.
*/
createVariableCapAsset: (username: string, password: string, name: string, symbol: string, minterSets: object[]) => Promise<string>;
/**
* Create an unsigned transaction to mint more of an asset.
*
* @param amount The units of the asset to mint
* @param assetID The ID of the asset to mint
* @param to The address to assign the units of the minted asset
* @param minters Addresses of the minters responsible for signing the transaction
*
* @returns Returns a Promise<string> containing the base 58 string representation of the unsigned transaction.
*/
createMintTx: (amount: number | BN, assetID: string | Buffer, to: string, minters: string[]) => Promise<string>;
/**
* Sign an unsigned or partially signed mint transaction.
*
* @param username The user signing
* @param password The password for the user signing
* @param tx The output of createMintTx or signMintTx
* @param minter The minter signing this transaction
*
* @returns Returns a Promise<string> containing the base 58 string representation of the unsigned transaction.
*/
signMintTx: (username: string, password: string, tx: string | Buffer, minter: string) => Promise<string>;
/**
* Exports the private key for an address.
*
* @param username The name of the user with the private key
* @param password The password used to decrypt the private key
* @param address The address whose private key should be exported
*
* @returns Promise with the decrypted private key as store in the database
*/
exportKey: (username: string, password: string, address: string) => Promise<string>;
/**
* Imports a private key into the node's database under an user and for a subnet.
*
* @param username The name of the user to store the private key
* @param password The password that unlocks the user
* @param privateKey A string representing the private key in the subnet's format
*
* @returns The address for the imported private key.
*/
importKey: (username: string, password: string, privateKey: string) => Promise<string>;
/**
* Lists all the addresses under a user.
*
* @param username The user to list addresses
* @param password The password of the user to list the addresses
*
* @returns Promise of an array of address strings in the format specified by the subnet.
*/
listAddresses: (username: string, password: string) => Promise<string[]>;
/**
* Lists all assets for an address.
*
* @param address The address to get a list of assets
*
* @returns Promise of an array of assetIDs for the address on the subnet.
*/
listAssets: (address: string) => Promise<string[]>;
/**
* Retrieves an assets name and symbol.
*
* @param assetID Either a {@link https://github.com/feross/buffer|Buffer} or an AVA serialized string for the AssetID.
* @param assetID Either a {@link https://github.com/feross/buffer|Buffer} or an AVA serialized string for the AssetID or its alias.
*

@@ -101,2 +247,4 @@ * @returns Returns a Promise<object> with keys "name" and "symbol".

symbol: string;
assetID: Buffer;
denomination: number;
}>;

@@ -114,3 +262,3 @@ /**

*
* @param addresses An array of addresses as strings
* @param addresses An array of addresses as strings or addresses as {@link https://github.com/feross/buffer|Buffer}s
* @param persistOpts Options available to persist these UTXOs in local storage

@@ -122,3 +270,3 @@ *

*/
getUTXOs: (addresses: string[], persistOpts?: PersistanceOptions) => Promise<UTXOSet>;
getUTXOs: (addresses: Buffer[] | string[], persistOpts?: PersistanceOptions) => Promise<UTXOSet>;
/**

@@ -143,4 +291,20 @@ * Helper function which creates an unsigned transaction. For more granular control, you may create your own

*/
makeUnsignedTx: (utxoset: UTXOSet, amount: BN, toAddresses: string[], fromAddresses: string[], changeAddresses: string[], assetID?: string | Buffer, asOf?: BN, locktime?: BN, threshold?: number) => TxUnsigned;
makeUnsignedTx: (utxoset: UTXOSet, amount: BN, toAddresses: string[], fromAddresses: string[], changeAddresses: string[], assetID?: string | Buffer, asOf?: BN, locktime?: BN, threshold?: number) => Promise<TxUnsigned>;
/**
* Creates an unsigned transaction. For more granular control, you may create your own
* [[TxCreateAsset]] manually (with their corresponding [[Input]]s, [[Output]]s).
*
* @param utxoset A set of UTXOs that the transaction is built on
* @param fee The amount of AVA to be paid for fees, in NanoAVA
* @param creatorAddresses The addresses to send the fees
* @param initialState The [[InitialStates]] that represent the intial state of a created asset
* @param name String for the descriptive name of the asset
* @param symbol String for the ticker symbol of the asset
* @param denomination Optional number for the denomination which is 10^D. D must be >= 0 and <= 32. Ex: $1 AVA = 10^9 $nAVA
*
* @returns An unsigned transaction created from the passed in parameters.
*
*/
makeCreateAssetTx: (utxoset: UTXOSet, fee: BN, creatorAddresses: Buffer[] | string[], initialState: InitialStates, name: string, symbol: string, denomination: number) => Promise<TxCreateAsset>;
/**
* Helper function which takes an unsigned transaction and signs it, returning the resulting [[Tx]].

@@ -162,2 +326,16 @@ *

/**
* Sends an amount of assetID to the specified address from a list of owned of addresses.
*
* @param username The user that owns the private keys associated with the `from` addresses
* @param password The password unlocking the user
* @param assetID The assetID of the asset to send
* @param amount The amount of the asset to be sent
* @param to The address of the recipient
* @param from An array of addresses managed by the node for this subnet which will fund this transaction
*
* @returns Promise for the string representing the transaction's ID.
*/
send: (username: string, password: string, assetID: string | Buffer, amount: number | BN, to: string, from: Buffer[] | string[]) => Promise<string>;
protected _cleanAddressArray(addresses: Array<string> | Array<Buffer>, caller: string): Array<string>;
/**
* This class should not be instantiated directly. Instead use the [[Slopes.addAPI]] method.

@@ -164,0 +342,0 @@ *

@@ -50,7 +50,2 @@ /**

/**
* @ignore
*/
protected _basicInBuffer: () => Buffer;
protected _basicInParser: (bytes: Buffer) => number;
/**
* Takes a {@link https://github.com/feross/buffer|Buffer} containing an [[Input]], parses it, populates the class, and returns the length of the Input in bytes.

@@ -62,11 +57,11 @@ *

*/
fromBuffer: (bytes: Buffer) => number;
fromBuffer(bytes: Buffer, offset?: number): number;
/**
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[Input]].
*/
toBuffer: () => Buffer;
toBuffer(): Buffer;
/**
* Returns a base-58 representation of the [[Input]].
*/
toString: () => string;
toString(): string;
/**

@@ -92,7 +87,2 @@ * Class representing an Input for a transaction.

/**
* @ignore
*/
protected _SecpInBuffer: () => Buffer;
protected _SecpInParser: (bytes: Buffer) => number;
/**
* Takes a {@link https://github.com/feross/buffer|Buffer} containing an [[Input]], parses it, populates the class, and returns the length of the [[Input]] in bytes.

@@ -104,11 +94,11 @@ *

*/
fromBuffer: (bytes: Buffer) => number;
fromBuffer(bytes: Buffer, offset?: number): number;
/**
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[Input]].
*/
toBuffer: () => Buffer;
toBuffer(): Buffer;
/**
* Returns a base-58 representation of the [[Input]].
*/
toString: () => string;
toString(): string;
/**

@@ -120,3 +110,3 @@ * Creates and adds a [[SigIdx]] to the [[Input]].

*/
addSignatureIdx: (addressIdx: number, address: string) => void;
addSignatureIdx: (addressIdx: number, address: Buffer) => void;
/**

@@ -123,0 +113,0 @@ * Class representing an Input for a transaction.

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

let inputid = inbuffer.readUInt32BE(68);
if (inputid == types_1.Constants.SECPINPUTID) {
if (inputid == types_1.AVMConstants.SECPINPUTID) {
let secpin = new SecpInput();

@@ -81,56 +81,2 @@ secpin.fromBuffer(inbuffer);

};
/**
* @ignore
*/
this._basicInBuffer = () => {
try {
let bsize = this.txid.length + this.txidx.length + this.assetid.length + this.inputid.length;
let barr = [this.txid, this.txidx, this.assetid, this.inputid];
let buff = buffer_1.Buffer.concat(barr, bsize);
return buff;
}
catch (e) {
/* istanbul ignore next */
let emsg = "Error - Input._basicInBuffer: " + e;
/* istanbul ignore next */
throw new Error(emsg);
}
};
this._basicInParser = (bytes) => {
let offset = 0;
this.txid = bintools.copyFrom(bytes, offset, offset + 32);
offset += 32;
this.txidx = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
this.assetid = bintools.copyFrom(bytes, offset, offset + 32);
offset += 32;
this.inputid = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
return offset;
};
/**
* Takes a {@link https://github.com/feross/buffer|Buffer} containing an [[Input]], parses it, populates the class, and returns the length of the Input in bytes.
*
* @param bytes A {@link https://github.com/feross/buffer|Buffer} containing a raw [[Input]]
*
* @returns The length of the raw [[Input]]
*/
this.fromBuffer = (bytes) => {
/* istanbul ignore next */
return this._basicInParser(bytes);
};
/**
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[Input]].
*/
this.toBuffer = () => {
/* istanbul ignore next */
return this._basicInBuffer();
};
/**
* Returns a base-58 representation of the [[Input]].
*/
this.toString = () => {
/* istanbul ignore next */
return bintools.bufferToB58(this.toBuffer());
};
if (txid && txidx && assetID && inputid) {

@@ -143,2 +89,44 @@ this.inputid.writeUInt32BE(inputid, 0);

}
/**
* Takes a {@link https://github.com/feross/buffer|Buffer} containing an [[Input]], parses it, populates the class, and returns the length of the Input in bytes.
*
* @param bytes A {@link https://github.com/feross/buffer|Buffer} containing a raw [[Input]]
*
* @returns The length of the raw [[Input]]
*/
fromBuffer(bytes, offset = 0) {
this.txid = bintools.copyFrom(bytes, offset, offset + 32);
offset += 32;
this.txidx = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
this.assetid = bintools.copyFrom(bytes, offset, offset + 32);
offset += 32;
this.inputid = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
return offset;
}
/**
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[Input]].
*/
toBuffer() {
try {
let bsize = this.txid.length + this.txidx.length + this.assetid.length + this.inputid.length;
let barr = [this.txid, this.txidx, this.assetid, this.inputid];
let buff = buffer_1.Buffer.concat(barr, bsize);
return buff;
}
catch (e) {
/* istanbul ignore next */
let emsg = "Error - Input.toBuffer: " + e;
/* istanbul ignore next */
throw new Error(emsg);
}
}
/**
* Returns a base-58 representation of the [[Input]].
*/
toString() {
/* istanbul ignore next */
return bintools.bufferToB58(this.toBuffer());
}
}

@@ -164,3 +152,3 @@ exports.Input = Input;

constructor(txid, txidx, amount, assetID) {
super(txid, txidx, assetID, types_1.Constants.SECPINPUTID);
super(txid, txidx, assetID, types_1.AVMConstants.SECPINPUTID);
this.amount = buffer_1.Buffer.alloc(8);

@@ -177,67 +165,2 @@ this.amountValue = new bn_js_1.default(0);

/**
* @ignore
*/
this._SecpInBuffer = () => {
try {
this.numAddr.writeUInt32BE(this.sigIdxs.length, 0);
let bsize = this.amount.length + this.numAddr.length;
let barr = [this.amount, this.numAddr];
for (let i = 0; i < this.sigIdxs.length; i++) {
let b = this.sigIdxs[i].toBuffer();
barr.push(b);
bsize += b.length;
}
let buff = buffer_1.Buffer.concat(barr, bsize);
return buff;
}
catch (e) {
/* istanbul ignore next */
let emsg = "Error - SecpInput._SecpInBuffer: " + e;
/* istanbul ignore next */
throw new Error(emsg);
}
};
this._SecpInParser = (bytes) => {
let offset = this._basicInParser(bytes);
this.amount = bintools.copyFrom(bytes, offset, offset + 8);
offset += 8;
this.amountValue = bintools.fromBufferToBN(this.amount);
this.numAddr = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
let numaddr = this.numAddr.readUInt32BE(0);
this.sigIdxs = [];
for (let i = 0; i < numaddr; i++) {
let sigidx = new types_1.SigIdx();
let sigbuff = bintools.copyFrom(bytes, offset, offset + 4);
sigidx.fromBuffer(sigbuff);
offset += 4;
this.sigIdxs.push(sigidx);
}
return offset;
};
/**
* Takes a {@link https://github.com/feross/buffer|Buffer} containing an [[Input]], parses it, populates the class, and returns the length of the [[Input]] in bytes.
*
* @param bytes A {@link https://github.com/feross/buffer|Buffer} containing a raw [[Input]]
*
* @returns The length of the raw [[Input]]
*/
this.fromBuffer = (bytes) => {
return this._SecpInParser(bytes);
};
/**
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[Input]].
*/
this.toBuffer = () => {
let basicin = this._basicInBuffer();
let secp = this._SecpInBuffer();
return buffer_1.Buffer.concat([basicin, secp]);
};
/**
* Returns a base-58 representation of the [[Input]].
*/
this.toString = () => {
return bintools.bufferToB58(this.toBuffer());
};
/**
* Creates and adds a [[SigIdx]] to the [[Input]].

@@ -258,3 +181,3 @@ *

if (txid && txidx && amount && assetID) {
this.inputid.writeUInt32BE(types_1.Constants.SECPINPUTID, 0);
this.inputid.writeUInt32BE(types_1.AVMConstants.SECPINPUTID, 0);
this.txid = txid;

@@ -268,4 +191,58 @@ this.txidx = txidx;

}
/**
* Takes a {@link https://github.com/feross/buffer|Buffer} containing an [[Input]], parses it, populates the class, and returns the length of the [[Input]] in bytes.
*
* @param bytes A {@link https://github.com/feross/buffer|Buffer} containing a raw [[Input]]
*
* @returns The length of the raw [[Input]]
*/
fromBuffer(bytes, offset = 0) {
offset = super.fromBuffer(bytes, offset);
this.amount = bintools.copyFrom(bytes, offset, offset + 8);
offset += 8;
this.amountValue = bintools.fromBufferToBN(this.amount);
this.numAddr = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
let numaddr = this.numAddr.readUInt32BE(0);
this.sigIdxs = [];
for (let i = 0; i < numaddr; i++) {
let sigidx = new types_1.SigIdx();
let sigbuff = bintools.copyFrom(bytes, offset, offset + 4);
sigidx.fromBuffer(sigbuff);
offset += 4;
this.sigIdxs.push(sigidx);
}
return offset;
}
/**
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[Input]].
*/
toBuffer() {
try {
let basicin = super.toBuffer();
this.numAddr.writeUInt32BE(this.sigIdxs.length, 0);
let bsize = basicin.length + this.amount.length + this.numAddr.length;
let barr = [basicin, this.amount, this.numAddr];
for (let i = 0; i < this.sigIdxs.length; i++) {
let b = this.sigIdxs[i].toBuffer();
barr.push(b);
bsize += b.length;
}
return buffer_1.Buffer.concat(barr, bsize);
}
catch (e) {
/* istanbul ignore next */
let emsg = "Error - SecpInput.toBuffer: " + e;
/* istanbul ignore next */
throw new Error(emsg);
}
}
/**
* Returns a base-58 representation of the [[Input]].
*/
toString() {
return bintools.bufferToB58(this.toBuffer());
}
}
exports.SecpInput = SecpInput;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2FwaXMvYXZtL2lucHV0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBOztHQUVHO0FBQ0gsb0NBQStCO0FBQy9CLG9FQUE0QztBQUM1QyxrREFBdUI7QUFDdkIsbUNBQTRDO0FBRTVDOztHQUVHO0FBQ0gsTUFBTSxRQUFRLEdBQUcsa0JBQVEsQ0FBQyxXQUFXLEVBQUUsQ0FBQztBQUV4Qzs7Ozs7Ozs7Ozs7O0dBWUc7QUFFSDs7Ozs7O0dBTUc7QUFDVSxRQUFBLGdCQUFnQixHQUFHLENBQUMsUUFBZSxFQUFFLE9BQWtCLEVBQUUsRUFBUSxFQUFFO0lBQzVFLElBQUksT0FBTyxHQUFVLFFBQVEsQ0FBQyxZQUFZLENBQUMsRUFBRSxDQUFDLENBQUM7SUFDL0MsSUFBRyxPQUFPLElBQUksaUJBQVMsQ0FBQyxXQUFXLEVBQUM7UUFDaEMsSUFBSSxNQUFNLEdBQWEsSUFBSSxTQUFTLEVBQUUsQ0FBQztRQUN2QyxNQUFNLENBQUMsVUFBVSxDQUFDLFFBQVEsQ0FBQyxDQUFDO1FBQzVCLE9BQU8sTUFBTSxDQUFDO0tBQ2pCO0lBQ0QsMEJBQTBCO0lBQzFCLE1BQU0sSUFBSSxLQUFLLENBQUMsNENBQTRDLEdBQUcsT0FBTyxDQUFDLENBQUM7QUFDNUUsQ0FBQyxDQUFBO0FBRUQsTUFBYSxLQUFLO0lBK0ZkOzs7Ozs7O09BT0c7SUFDSCxZQUFZLElBQVksRUFBRSxLQUFhLEV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ZXRJRDtcbiAgICAgICAgICAgIHRoaXMuYW1vdW50VmFsdWUgPSBhbW91bnQ7XG4gICAgICAgICAgICB0aGlzLmFtb3VudCA9IGJpbnRvb2xzLmZyb21CTlRvQnVmZmVyKGFtb3VudCwgOCk7XG4gICAgICAgICAgICB0aGlzLnNpZ0lkeHMgPSBbXTtcbiAgICAgICAgfVxuICAgICAgICBcbiAgICB9XG59Il19

@@ -32,7 +32,13 @@ /**

/**
* Returns the address.
* Returns the address as a {@link https://github.com/feross/buffer|Buffer}.
*
* @returns A {@link https://github.com/feross/buffer|Buffer} representation of the address
*/
getAddress: () => Buffer;
/**
* Returns the address's string representation.
*
* @returns A string representation of the address
*/
getAddress: () => string;
getAddressString: () => string;
/**

@@ -43,5 +49,5 @@ * Returns an address given a public key.

*
* @returns A string for the address of the public key.
* @returns A {@link https://github.com/feross/buffer|Buffer} for the address of the public key.
*/
addressFromPublicKey: (pubk: Buffer) => string;
addressFromPublicKey: (pubk: Buffer) => Buffer;
/**

@@ -88,3 +94,3 @@ * Returns a string representation of the private key.

*/
constructor(entropy?: Buffer);
constructor(chainid: string, entropy?: Buffer);
}

@@ -104,3 +110,3 @@ /**

*/
makeKey: (entropy?: Buffer) => string;
makeKey: (entropy?: Buffer) => Buffer;
/**

@@ -113,3 +119,3 @@ * Given a private key, makes a new key pair, returns the address.

*/
importKey: (privk: string | Buffer) => string;
importKey: (privk: string | Buffer) => Buffer;
/**

@@ -126,4 +132,4 @@ * Signs a [[TxUnsigned]] and returns signed [[Tx]]

*/
constructor();
constructor(chainid: string);
}
//# sourceMappingURL=keychain.d.ts.map

@@ -50,4 +50,4 @@ "use strict";

*/
constructor(entropy = undefined) {
super();
constructor(chainid, entropy = undefined) {
super(chainid);
/**

@@ -93,5 +93,5 @@ * @ignore

/**
* Returns the address.
* Returns the address as a {@link https://github.com/feross/buffer|Buffer}.
*
* @returns A string representation of the address
* @returns A {@link https://github.com/feross/buffer|Buffer} representation of the address
*/

@@ -102,2 +102,11 @@ this.getAddress = () => {

/**
* Returns the address's string representation.
*
* @returns A string representation of the address
*/
this.getAddressString = () => {
let addr = this.addressFromPublicKey(this.pubk);
return bintools.addressToString(this.chainid, addr);
};
/**
* Returns an address given a public key.

@@ -107,3 +116,3 @@ *

*
* @returns A string for the address of the public key.
* @returns A {@link https://github.com/feross/buffer|Buffer} for the address of the public key.
*/

@@ -119,4 +128,5 @@ this.addressFromPublicKey = (pubk) => {

let ripesha = buffer_1.Buffer.from(create_hash_1.default('rmd160').update(sha256).digest());
address = bintools.avaSerialize(ripesha);
return address;
return ripesha;
//address = bintools.avaSerialize(ripesha);
//return address;
}

@@ -196,4 +206,4 @@ /* istanbul ignore next */

*/
constructor() {
super();
constructor(chainid) {
super(chainid);
/**

@@ -207,3 +217,3 @@ * Makes a new key pair, returns the address.

this.makeKey = (entropy = undefined) => {
let keypair = new AVMKeyPair(entropy);
let keypair = new AVMKeyPair(this.chainid, entropy);
this.addKey(keypair);

@@ -220,3 +230,3 @@ return keypair.getAddress();

this.importKey = (privk) => {
let keypair = new AVMKeyPair();
let keypair = new AVMKeyPair(this.chainid);
let pk;

@@ -230,3 +240,3 @@ if (typeof privk === 'string') {

keypair.importKey(pk);
if (!(keypair.getAddress() in this.keys)) {
if (!(keypair.getAddress().toString("hex") in this.keys)) {
this.addKey(keypair);

@@ -265,2 +275,2 @@ }

exports.AVMKeyChain = AVMKeyChain;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoia2V5Y2hhaW4uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYXBpcy9hdm0va2V5Y2hhaW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O0FBQUE7O0dBRUc7QUFDSCxvQ0FBK0I7QUFDL0IsbURBQXFDO0FBQ3JDLG9FQUE0QztBQUM1Qyw2QkFBc0M7QUFDdEMsbUNBQTRDO0FBRTVD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Zlci5mcm9tKGVjLmtleUZyb21QdWJsaWMocHViaykuZ2V0UHVibGljKHRydWUsIFwiaGV4XCIpLCBcImhleFwiKTsgLy9tYWtlIGNvbXBhY3QsIHN0aWNrIGJhY2sgaW50byBidWZmZXJcbiAgICAgICAgfSBcbiAgICAgICAgaWYocHViay5sZW5ndGggPT0gMzMpe1xuICAgICAgICAgICAgbGV0IHNoYTI1NjpCdWZmZXIgPSBCdWZmZXIuZnJvbShjcmVhdGVIYXNoKCdzaGEyNTYnKS51cGRhdGUocHViaykuZGlnZXN0KCkpO1xuICAgICAgICAgICAgbGV0IHJpcGVzaGE6QnVmZmVyID0gQnVmZmVyLmZyb20oY3JlYXRlSGFzaCgncm1kMTYwJykudXBkYXRlKHNoYTI1NikuZGlnZXN0KCkpO1xuICAgICAgICAgICAgYWRkcmVzcyA9IGJpbnRvb2xzLmF2YVNlcmlhbGl6ZShyaXBlc2hhKTtcbiAgICAgICAgICAgIHJldHVybiBhZGRyZXNzO1xuICAgICAgICB9XG4gICAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovXG4gICAgICAgIHRocm93IG5ldyBFcnJvcihcIlVuYWJsZSB0byBtYWtlIGFkZHJlc3MuXCIpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFJldHVybnMgYSBzdHJpbmcgcmVwcmVzZW50YXRpb24gb2YgdGhlIHByaXZhdGUga2V5LlxuICAgICAqIFxuICAgICAqIEByZXR1cm5zIEFuIEFWQSBzZXJpYWxpemVkIHN0cmluZyByZXByZXNlbnRhdGlvbiBvZiB0aGUgcHVibGljIGtleVxuICAgICAqL1xuICAgIGdldFByaXZhdGVLZXlTdHJpbmcgPSAoKTpzdHJpbmcgPT4ge1xuICAgICAgICByZXR1cm4gYmludG9vbHMuYXZhU2VyaWFsaXplKHRoaXMucHJpdmspO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFJldHVybnMgdGhlIHB1YmxpYyBrZXkuXG4gICAgICogXG4gICAgICogQ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3QoKSk7IFxuICAgICAgICBsZXQgc2lnczpBcnJheTxBcnJheTxTaWduYXR1cmU+PiA9IFtdO1xuICAgICAgICBsZXQgaW5zOkFycmF5PElucHV0PiA9IHV0eC5nZXRJbnMoKTtcbiAgICAgICAgZm9yKGxldCBpID0gMDsgaSA8IGlucy5sZW5ndGg7IGkrKyl7XG4gICAgICAgICAgICBsZXQgYXJyc2lnczpBcnJheTxTaWduYXR1cmU+ID0gW107XG4gICAgICAgICAgICBsZXQgc2lnaWR4czpBcnJheTxTaWdJZHg+ID0gKGluc1tpXSBhcyBTZWNwSW5wdXQpLmdldFNpZ0lkeHMoKTtcbiAgICAgICAgICAgIGZvcihsZXQgaiA9IDA7IGogPCBzaWdpZHhzLmxlbmd0aDsgaisrKXtcbiAgICAgICAgICAgICAgICBsZXQga2V5cGFpcjpBVk1LZXlQYWlyID0gdGhpcy5nZXRLZXkoc2lnaWR4c1tqXS5nZXRTb3VyY2UoKSk7XG4gICAgICAgICAgICAgICAgbGV0IHNpZ252YWw6QnVmZmVyID0ga2V5cGFpci5zaWduKG1zZylcbiAgICAgICAgICAgICAgICBsZXQgc2lnOlNpZ25hdHVyZSA9IG5ldyBTaWduYXR1cmUoKTtcbiAgICAgICAgICAgICAgICBzaWcuZnJvbUJ1ZmZlcihzaWdudmFsKTtcbiAgICAgICAgICAgICAgICBhcnJzaWdzLnB1c2goc2lnKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHNpZ3MucHVzaChhcnJzaWdzKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbmV3IFR4KHV0eCwgc2lncyk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogUmV0dXJucyBpbnN0YW5jZSBvZiBBVk1LZXlDaGFpbi5cbiAgICAgKi9cbiAgICBjb25zdHJ1Y3Rvcigpe1xuICAgICAgICBzdXBlcigpO1xuICAgIH1cbn0iXX0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjo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nbmVkXG4gICAgICogXG4gICAgICogQHJldHVybnMgQSBzaWduZWQgW1tUeF1dXG4gICAgICovXG4gICAgc2lnblR4ID0gKHV0eDpUeFVuc2lnbmVkKTpUeCA9PiB7XG4gICAgICAgIGxldCB0eGJ1ZmYgPSB1dHgudG9CdWZmZXIoKTtcbiAgICAgICAgbGV0IG1zZzpCdWZmZXIgPSBCdWZmZXIuZnJvbShjcmVhdGVIYXNoKCdzaGEyNTYnKS51cGRhdGUodHhidWZmKS5kaWdlc3QoKSk7IFxuICAgICAgICBsZXQgc2lnczpBcnJheTxBcnJheTxTaWduYXR1cmU+PiA9IFtdO1xuICAgICAgICBsZXQgaW5zOkFycmF5PElucHV0PiA9IHV0eC5nZXRJbnMoKTtcbiAgICAgICAgZm9yKGxldCBpID0gMDsgaSA8IGlucy5sZW5ndGg7IGkrKyl7XG4gICAgICAgICAgICBsZXQgYXJyc2lnczpBcnJheTxTaWduYXR1cmU+ID0gW107XG4gICAgICAgICAgICBsZXQgc2lnaWR4czpBcnJheTxTaWdJZHg+ID0gKGluc1tpXSBhcyBTZWNwSW5wdXQpLmdldFNpZ0lkeHMoKTtcbiAgICAgICAgICAgIGZvcihsZXQgaiA9IDA7IGogPCBzaWdpZHhzLmxlbmd0aDsgaisrKXtcbiAgICAgICAgICAgICAgICBsZXQga2V5cGFpcjpBVk1LZXlQYWlyID0gdGhpcy5nZXRLZXkoc2lnaWR4c1tqXS5nZXRTb3VyY2UoKSk7XG4gICAgICAgICAgICAgICAgbGV0IHNpZ252YWw6QnVmZmVyID0ga2V5cGFpci5zaWduKG1zZylcbiAgICAgICAgICAgICAgICBsZXQgc2lnOlNpZ25hdHVyZSA9IG5ldyBTaWduYXR1cmUoKTtcbiAgICAgICAgICAgICAgICBzaWcuZnJvbUJ1ZmZlcihzaWdudmFsKTtcbiAgICAgICAgICAgICAgICBhcnJzaWdzLnB1c2goc2lnKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHNpZ3MucHVzaChhcnJzaWdzKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbmV3IFR4KHV0eCwgc2lncyk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogUmV0dXJucyBpbnN0YW5jZSBvZiBBVk1LZXlDaGFpbi5cbiAgICAgKi9cbiAgICBjb25zdHJ1Y3RvcihjaGFpbmlkOnN0cmluZyl7XG4gICAgICAgIHN1cGVyKGNoYWluaWQpO1xuICAgIH1cbn0iXX0=

@@ -16,20 +16,18 @@ /**

/**
* An abstract representing a transaction output. All output types must extend on this class.
* A class representing a transaction output. All output types must extend on this class.
*/
export declare abstract class Output {
export declare class Output {
protected outputid: Buffer;
protected outputidnum: number;
protected assetid: Buffer;
abstract getOutputID: () => number;
abstract getAssetID: () => Buffer;
abstract fromBuffer: (utxobuff: Buffer) => number;
abstract toBuffer: () => Buffer;
abstract toString: () => string;
getOutputID: () => number;
fromBuffer(outbuff: Buffer, offset?: number): number;
toBuffer(): Buffer;
toString(): string;
static comparator: () => (a: Output, b: Output) => 0 | 1 | -1;
constructor(outputidnum: number, assetID?: Buffer);
constructor(outputidnum: number);
}
/**
* An [[Output]] class which issues a payment on an assetID.
* An [[Output]] class which specifies a secp256k1 .
*/
export declare class SecpOutput extends Output {
export declare class SecpOutBase extends Output {
protected locktime: Buffer;

@@ -42,12 +40,2 @@ protected threshold: Buffer;

/**
* @ignore
*/
protected _OPGetAddresses: () => {
[address: string]: BN;
};
/**
* Returns the number for the output type of the output class.
*/
getOutputID: () => number;
/**
* Returns the amount as a {@link https://github.com/indutny/bn.js/|BN}.

@@ -65,19 +53,13 @@ */

/**
* Returns the assetID as a {@link https://github.com/feross/buffer|Buffer}.
* Returns an array of {@link https://github.com/feross/buffer|Buffer}s for the addresses.
*/
getAssetID: () => Buffer;
getAddresses: () => Buffer[];
/**
* Returns a map from all addresses as string keys to their locktime represented in {@link https://github.com/indutny/bn.js/|BN}.
*/
getAddresses: () => {
[address: string]: BN;
};
/**
* Returns an array of length 2 with the first index being the index of the provided address and the second being false (as fallback addresses are not available in this output type).
* Returns the index of the address.
*
* @param address Address to look up to return its index.
* @param address A {@link https://github.com/feross/buffer|Buffer} of the address to look up to return its index.
*
* @returns An array of length 2, first index is the index the address resides in, second index is false.
* @returns The index of the address.
*/
getAddressIdx: (address: string) => number;
getAddressIdx: (address: Buffer) => number;
/**

@@ -90,36 +72,24 @@ * Returns the address from the index provided.

*/
getAddress: (idx: number) => string;
getAddress: (idx: number) => Buffer;
/**
* @ignore
* Popuates the instance from a {@link https://github.com/feross/buffer|Buffer} representing the [[SecpOutBase]] and returns the size of the output.
*/
protected _OPParseBuffer: (utxobuff: Buffer, offset: number) => number;
fromBuffer(utxobuff: Buffer, offset?: number): number;
/**
* Popuates the instance from a {@link https://github.com/feross/buffer|Buffer} representing the [[OutCreateAsset]] and returns the size of the output.
* Returns the buffer representing the [[SecpOutBase]] instance.
*/
fromBuffer: (utxobuff: Buffer) => number;
toBuffer(): Buffer;
/**
* @ignore
* Returns a base-58 string representing the [[SecpOutBase]].
*/
protected _OPBuffer: () => Buffer;
toString(): string;
/**
* Returns the buffer representing the [[OutCreateAsset]] instance.
* Given an array of addresses and an optional timestamp, select an array of address {@link https://github.com/feross/buffer|Buffer}s of qualified spenders for the output.
*/
toBuffer: () => Buffer;
getSpenders: (addresses: Buffer[], asOf?: BN) => Buffer[];
/**
* Returns a base-58 string representing the [[OutCreateAsset]].
* Given an array of address {@link https://github.com/feross/buffer|Buffer}s and an optional timestamp, returns true if the addresses meet the threshold required to spend the output.
*/
toString: () => string;
meetsThreshold: (addresses: Buffer[], asOf?: BN) => boolean;
/**
* @ignore
*/
protected _OPQualified: (addresses: string[], asOf?: BN) => string[];
/**
* Given an array of addresses and an optional timestamp, select an array of address strings of qualified spenders for the output.
*/
getSpenders: (addresses: string[], asOf?: BN) => string[];
/**
* Given an array of addresses and an optional timestamp, returns true if the addresses meet the threshold required to spend the output.
*/
meetsThreshold: (addresses: string[], asOf?: BN) => boolean;
/**
* An [[Output]] class which issues a payment on an assetID.

@@ -129,8 +99,18 @@ *

* @param amount A {@link https://github.com/indutny/bn.js/|BN} representing the amount in the output
* @param addresses An array of strings representing addresses
* @param addresses An array of {@link https://github.com/feross/buffer|Buffer}s representing addresses
* @param locktime A {@link https://github.com/indutny/bn.js/|BN} representing the locktime
* @param threshold A number representing the the threshold number of signers required to sign the transaction
*/
constructor(assetid: Buffer, amount?: BN, addresses?: Array<string>, locktime?: BN, threshold?: number);
constructor(amount?: BN, addresses?: Array<Buffer>, locktime?: BN, threshold?: number);
}
export declare class SecpOutput extends SecpOutBase {
protected assetid: Buffer;
fromBuffer(outbuff: Buffer, offset?: number): number;
toBuffer(): Buffer;
/**
* Returns the assetID as a {@link https://github.com/feross/buffer|Buffer}.
*/
getAssetID: () => Buffer;
constructor(assetid?: Buffer, amount?: BN, addresses?: Array<Buffer>, locktime?: BN, threshold?: number);
}
//# sourceMappingURL=outputs.d.ts.map

@@ -14,3 +14,2 @@ "use strict";

const bintools = bintools_1.default.getInstance();
const SECPFXID = 4;
/**

@@ -24,5 +23,5 @@ * Takes a buffer representing the output and returns the proper Output instance.

exports.SelectOutputClass = (outbuffer, args = []) => {
let assetid = bintools.copyFrom(outbuffer, 0, 32);
let outputid = outbuffer.readUInt32BE(32);
if (outputid == types_1.Constants.SECPOUTPUTID) {
let assetid = bintools.copyFrom(outbuffer, 0, types_1.AVMConstants.ASSETIDLEN);
let outputid = outbuffer.readUInt32BE(types_1.AVMConstants.ASSETIDLEN);
if (outputid == types_1.AVMConstants.SECPOUTPUTID) {
let secpout = new SecpOutput(assetid, ...args);

@@ -35,14 +34,27 @@ secpout.fromBuffer(outbuffer);

/**
* An abstract representing a transaction output. All output types must extend on this class.
* A class representing a transaction output. All output types must extend on this class.
*/
class Output {
constructor(outputidnum, assetID) {
constructor(outputidnum) {
this.outputid = buffer_1.Buffer.alloc(4);
this.assetid = buffer_1.Buffer.alloc(32);
this.getOutputID = () => {
return this.outputidnum;
};
this.outputid.writeUInt32BE(outputidnum, 0);
this.outputidnum = outputidnum;
if (assetID) {
this.assetid = assetID;
}
}
fromBuffer(outbuff, offset = 0) {
this.outputid = bintools.copyFrom(outbuff, offset, offset + 4);
this.outputidnum = this.outputid.readUInt32BE(0);
return offset + 4;
}
;
toBuffer() {
return this.outputid;
}
;
toString() {
return bintools.bufferToB58(this.outputid);
}
;
}

@@ -56,5 +68,5 @@ exports.Output = Output;

/**
* An [[Output]] class which issues a payment on an assetID.
* An [[Output]] class which specifies a secp256k1 .
*/
class SecpOutput extends Output {
class SecpOutBase extends Output {
/**

@@ -65,8 +77,8 @@ * An [[Output]] class which issues a payment on an assetID.

* @param amount A {@link https://github.com/indutny/bn.js/|BN} representing the amount in the output
* @param addresses An array of strings representing addresses
* @param addresses An array of {@link https://github.com/feross/buffer|Buffer}s representing addresses
* @param locktime A {@link https://github.com/indutny/bn.js/|BN} representing the locktime
* @param threshold A number representing the the threshold number of signers required to sign the transaction
*/
constructor(assetid, amount, addresses, locktime, threshold) {
super(SECPFXID, assetid);
constructor(amount, addresses, locktime, threshold) {
super(types_1.AVMConstants.SECPOUTPUTID);
this.locktime = buffer_1.Buffer.alloc(8);

@@ -79,18 +91,2 @@ this.threshold = buffer_1.Buffer.alloc(4);

/**
* @ignore
*/
this._OPGetAddresses = () => {
let result = {};
for (let i = 0; i < this.addresses.length; i++) {
result[this.addresses[i].toString()] = bintools.fromBufferToBN(this.locktime);
}
return result;
};
/**
* Returns the number for the output type of the output class.
*/
this.getOutputID = () => {
return this.outputidnum;
};
/**
* Returns the amount as a {@link https://github.com/indutny/bn.js/|BN}.

@@ -114,23 +110,21 @@ */

/**
* Returns the assetID as a {@link https://github.com/feross/buffer|Buffer}.
* Returns an array of {@link https://github.com/feross/buffer|Buffer}s for the addresses.
*/
this.getAssetID = () => {
return this.assetid;
};
/**
* Returns a map from all addresses as string keys to their locktime represented in {@link https://github.com/indutny/bn.js/|BN}.
*/
this.getAddresses = () => {
return this._OPGetAddresses();
let result = [];
for (let i = 0; i < this.addresses.length; i++) {
result.push(this.addresses[i].toBuffer());
}
return result;
};
/**
* Returns an array of length 2 with the first index being the index of the provided address and the second being false (as fallback addresses are not available in this output type).
* Returns the index of the address.
*
* @param address Address to look up to return its index.
* @param address A {@link https://github.com/feross/buffer|Buffer} of the address to look up to return its index.
*
* @returns An array of length 2, first index is the index the address resides in, second index is false.
* @returns The index of the address.
*/
this.getAddressIdx = (address) => {
for (let i = 0; i < this.addresses.length; i++) {
if (this.addresses[i].toString() == address) {
if (this.addresses[i].toBuffer().toString("hex") == address.toString("hex")) {
return i;

@@ -151,83 +145,10 @@ }

if (idx < this.addresses.length) {
return this.addresses[idx].toString();
return this.addresses[idx].toBuffer();
}
throw new Error("Error - OutPayment.getAddress: idx out of range");
throw new Error("Error - SecpOutBase.getAddress: idx out of range");
};
/**
* @ignore
* Given an array of addresses and an optional timestamp, select an array of address {@link https://github.com/feross/buffer|Buffer}s of qualified spenders for the output.
*/
this._OPParseBuffer = (utxobuff, offset) => {
this.assetid = bintools.copyFrom(utxobuff, offset, offset + 32);
offset += 32;
this.outputid = bintools.copyFrom(utxobuff, offset, offset + 4); //copied
this.outputidnum = this.outputid.readUInt32BE(0);
offset += 4;
this.amount = bintools.copyFrom(utxobuff, offset, offset + 8);
this.amountValue = bintools.fromBufferToBN(this.amount);
offset += 8;
this.locktime = bintools.copyFrom(utxobuff, offset, offset + 8);
offset += 8;
this.threshold = bintools.copyFrom(utxobuff, offset, offset + 4);
offset += 4;
this.numaddrs = bintools.copyFrom(utxobuff, offset, offset + 4);
offset += 4;
let numaddrs = this.numaddrs.readUInt32BE(0);
this.addresses = [];
for (let i = 0; i < numaddrs; i++) {
let addr = new types_1.Address();
let offsetEnd = offset + addr.getSize();
let copied = bintools.copyFrom(utxobuff, offset, offsetEnd);
addr.fromBuffer(copied);
this.addresses.push(addr);
offset = offsetEnd;
}
this.addresses.sort(types_1.Address.comparitor());
return offset;
};
/**
* Popuates the instance from a {@link https://github.com/feross/buffer|Buffer} representing the [[OutCreateAsset]] and returns the size of the output.
*/
this.fromBuffer = (utxobuff) => {
return this._OPParseBuffer(utxobuff, 0);
};
/**
* @ignore
*/
this._OPBuffer = () => {
try {
this.addresses.sort(types_1.Address.comparitor());
let bsize = this.assetid.length + this.outputid.length + this.amount.length + this.locktime.length + this.threshold.length + this.numaddrs.length;
this.numaddrs.writeUInt32BE(this.addresses.length, 0);
let barr = [this.assetid, this.outputid, this.amount, this.locktime, this.threshold, this.numaddrs];
for (let i = 0; i < this.addresses.length; i++) {
let b = this.addresses[i].toBuffer();
barr.push(b);
bsize += b.length;
}
let buff = buffer_1.Buffer.concat(barr, bsize);
return buff;
}
catch (e) {
/* istanbul ignore next */
let emsg = "Error - TxOut._OPTxBuffer: " + e;
/* istanbul ignore next */
throw new Error(emsg);
}
};
/**
* Returns the buffer representing the [[OutCreateAsset]] instance.
*/
this.toBuffer = () => {
return this._OPBuffer();
};
/**
* Returns a base-58 string representing the [[OutCreateAsset]].
*/
this.toString = () => {
return bintools.bufferToB58(this.toBuffer());
};
/**
* @ignore
*/
this._OPQualified = (addresses, asOf = undefined) => {
this.getSpenders = (addresses, asOf = undefined) => {
let qualified = [];

@@ -248,3 +169,3 @@ let now;

for (let j = 0; j < addresses.length && qualified.length < threshold; j++) {
if (addresses[j] == this.addresses[i].toString()) {
if (addresses[j].toString("hex") == this.addresses[i].toBuffer().toString("hex")) {
qualified.push(addresses[j]);

@@ -257,10 +178,4 @@ }

/**
* Given an array of addresses and an optional timestamp, select an array of address strings of qualified spenders for the output.
* Given an array of address {@link https://github.com/feross/buffer|Buffer}s and an optional timestamp, returns true if the addresses meet the threshold required to spend the output.
*/
this.getSpenders = (addresses, asOf = undefined) => {
return this._OPQualified(addresses, asOf);
};
/**
* Given an array of addresses and an optional timestamp, returns true if the addresses meet the threshold required to spend the output.
*/
this.meetsThreshold = (addresses, asOf = undefined) => {

@@ -274,8 +189,4 @@ let now;

}
let locktime = bintools.fromBufferToBN(this.locktime);
let qualified = this._OPQualified(addresses, now);
let qualified = this.getSpenders(addresses, now);
let threshold = this.threshold.readUInt32BE(0);
if (now.lte(locktime)) {
return false;
}
if (qualified.length >= threshold) {

@@ -292,3 +203,3 @@ return true;

addrs[i] = new types_1.Address();
addrs[i].fromString(addresses[i]);
addrs[i].fromBuffer(addresses[i]);
}

@@ -306,4 +217,88 @@ this.addresses = addrs;

}
/**
* Popuates the instance from a {@link https://github.com/feross/buffer|Buffer} representing the [[SecpOutBase]] and returns the size of the output.
*/
fromBuffer(utxobuff, offset = 0) {
offset = super.fromBuffer(utxobuff, offset);
this.amount = bintools.copyFrom(utxobuff, offset, offset + 8);
this.amountValue = bintools.fromBufferToBN(this.amount);
offset += 8;
this.locktime = bintools.copyFrom(utxobuff, offset, offset + 8);
offset += 8;
this.threshold = bintools.copyFrom(utxobuff, offset, offset + 4);
offset += 4;
this.numaddrs = bintools.copyFrom(utxobuff, offset, offset + 4);
offset += 4;
let numaddrs = this.numaddrs.readUInt32BE(0);
this.addresses = [];
for (let i = 0; i < numaddrs; i++) {
let addr = new types_1.Address();
let offsetEnd = offset + addr.getSize();
let copied = bintools.copyFrom(utxobuff, offset, offsetEnd);
addr.fromBuffer(copied);
this.addresses.push(addr);
offset = offsetEnd;
}
this.addresses.sort(types_1.Address.comparitor());
return offset;
}
/**
* Returns the buffer representing the [[SecpOutBase]] instance.
*/
toBuffer() {
try {
this.addresses.sort(types_1.Address.comparitor());
let superbuff = super.toBuffer();
let bsize = superbuff.length + this.amount.length + this.locktime.length + this.threshold.length + this.numaddrs.length;
this.numaddrs.writeUInt32BE(this.addresses.length, 0);
let barr = [superbuff, this.amount, this.locktime, this.threshold, this.numaddrs];
for (let i = 0; i < this.addresses.length; i++) {
let b = this.addresses[i].toBuffer();
barr.push(b);
bsize += b.length;
}
return buffer_1.Buffer.concat(barr, bsize);
;
}
catch (e) {
/* istanbul ignore next */
let emsg = "Error - SecpOutBase.toBuffer: " + e;
/* istanbul ignore next */
throw new Error(emsg);
}
}
/**
* Returns a base-58 string representing the [[SecpOutBase]].
*/
toString() {
return bintools.bufferToB58(this.toBuffer());
}
}
exports.SecpOutBase = SecpOutBase;
class SecpOutput extends SecpOutBase {
constructor(assetid, amount, addresses, locktime, threshold) {
super(amount, addresses, locktime, threshold);
this.assetid = buffer_1.Buffer.alloc(32);
/**
* Returns the assetID as a {@link https://github.com/feross/buffer|Buffer}.
*/
this.getAssetID = () => {
return this.assetid;
};
if (typeof assetid !== 'undefined' && assetid.length == types_1.AVMConstants.ASSETIDLEN) {
this.assetid = assetid;
}
}
fromBuffer(outbuff, offset = 0) {
this.assetid = bintools.copyFrom(outbuff, offset, offset + 32);
offset += 32;
offset = super.fromBuffer(outbuff, offset);
return offset;
}
toBuffer() {
let superbuff = super.toBuffer();
return buffer_1.Buffer.concat([this.assetid, superbuff]);
}
}
exports.SecpOutput = SecpOutput;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0cHV0cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9hcGlzL2F2bS9vdXRwdXRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUE7O0dBRUc7QUFDSCxvQ0FBK0I7QUFDL0Isb0VBQTRDO0FBQzVDLGtEQUF1QjtBQUN2QixtQ0FBc0Q7QUFFdEQsTUFBTSxRQUFRLEdBQUcsa0JBQVEsQ0FBQyxXQUFXLEVBQUUsQ0FBQztBQUV4QyxNQUFNLFFBQVEsR0FBRyxDQUFDLENBQUM7QUFFbkI7Ozs7OztHQU1HO0FBQ1UsUUFBQSxpQkFBaUIsR0FBRyxDQUFDLFNBQWdCLEVBQUUsT0FBa0IsRUFBRSxFQUFTLEVBQUU7SUFDL0UsSUFBSSxPQUFPLEdBQVUsUUFBUSxDQUFDLFFBQVEsQ0FBQyxTQUFTLEVBQUUsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUFD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29scy5jb3B5RnJvbShvdXRidWZmLCBvZmZzZXQsIG9mZnNldCArIDMyKTtcbiAgICAgICAgb2Zmc2V0ICs9IDMyO1xuICAgICAgICBvZmZzZXQgPSBzdXBlci5mcm9tQnVmZmVyKG91dGJ1ZmYsIG9mZnNldCk7XG4gICAgICAgIHJldHVybiBvZmZzZXQ7XG4gICAgfVxuXG4gICAgdG9CdWZmZXIoKTpCdWZmZXIge1xuICAgICAgICBsZXQgc3VwZXJidWZmOkJ1ZmZlciA9IHN1cGVyLnRvQnVmZmVyKCk7XG4gICAgICAgIHJldHVybiBCdWZmZXIuY29uY2F0KFt0aGlzLmFzc2V0aWQsIHN1cGVyYnVmZl0pO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFJldHVybnMgdGhlIGFzc2V0SUQgYXMgYSB7QGxpbmsgaHR0cHM6Ly9naXRodWIuY29tL2Zlcm9zcy9idWZmZXJ8QnVmZmVyfS5cbiAgICAgKi9cbiAgICBnZXRBc3NldElEID0gKCk6QnVmZmVyID0+IHtcbiAgICAgICAgcmV0dXJuIHRoaXMuYXNzZXRpZDtcbiAgICB9XG5cbiAgICBjb25zdHJ1Y3Rvcihhc3NldGlkPzpCdWZmZXIsIGFtb3VudD86Qk4sIGFkZHJlc3Nlcz86QXJyYXk8QnVmZmVyPiwgbG9ja3RpbWU/OkJOLCB0aHJlc2hvbGQ/Om51bWJlcil7XG4gICAgICAgIHN1cGVyKGFtb3VudCwgYWRkcmVzc2VzLCBsb2NrdGltZSwgdGhyZXNob2xkKTtcbiAgICAgICAgaWYodHlwZW9mIGFzc2V0aWQgIT09ICd1bmRlZmluZWQnICYmIGFzc2V0aWQubGVuZ3RoID09IEFWTUNvbnN0YW50cy5BU1NFVElETEVOKSB7XG4gICAgICAgICAgICB0aGlzLmFzc2V0aWQgPSBhc3NldGlkO1xuICAgICAgICB9XG4gICAgfVxufSJdfQ==

@@ -5,3 +5,3 @@ /**

import { Buffer } from "buffer/";
import { Signature } from './types';
import { Signature, InitialStates } from './types';
import { Output } from './outputs';

@@ -59,17 +59,13 @@ import { Input } from './inputs';

*
* @remarks assume not-checksummed and deserialized
* @remarks assume not-checksummed
*/
fromBuffer: (bytes: Buffer) => number;
fromBuffer(bytes: Buffer, offset?: number): number;
/**
* @ignore
*/
protected _basicTxBuffer: () => Buffer;
/**
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[TxUnsigned]].
*/
toBuffer: () => Buffer;
toBuffer(): Buffer;
/**
* Returns a base-58 representation of the [[TxUnsigned]].
*/
toString: () => string;
toString(): string;
/**

@@ -86,2 +82,63 @@ * Class representing an unsigned transaction.

}
export declare class TxCreateAsset extends TxUnsigned {
protected name: string;
protected namebuff: Buffer;
protected symbol: string;
protected symbolbuff: Buffer;
protected denomination: Buffer;
protected initialstate: InitialStates;
/**
* Returns the array of array of [[Output]]s for the initial state
*/
getInitialStates: () => InitialStates;
/**
* Returns the string representation of the name
*/
getName: () => string;
/**
* Returns the {@link https://github.com/feross/buffer|Buffer} representation of the name
*/
getNameBuffer: () => Buffer;
/**
* Returns the string representation of the symbol
*/
getSymbol: () => string;
/**
* Returns the {@link https://github.com/feross/buffer|Buffer} representation of the symbol
*/
getSymbolBuffer: () => Buffer;
/**
* Returns the numeric representation of the denomination
*/
getDenomination: () => number;
/**
* Returns the {@link https://github.com/feross/buffer|Buffer} representation of the denomination
*/
getDenominationBuffer: () => Buffer;
/**
* Takes a {@link https://github.com/feross/buffer|Buffer} containing an [[TxCreateAsset]], parses it, populates the class, and returns the length of the TxUnsigned in bytes.
*
* @param bytes A {@link https://github.com/feross/buffer|Buffer} containing a raw [[TxCreateAsset]]
*
* @returns The length of the raw [[TxCreateAsset]]
*
* @remarks assume not-checksummed
*/
fromBuffer(bytes: Buffer, offset?: number): number;
toBuffer(): Buffer;
/**
* Class representing an unsigned Create Asset transaction.
*
* @param name String for the descriptive name of the asset
* @param symbol String for the ticker symbol of the asset
* @param denomination Optional number for the denomination which is 10^D. D must be >= 0 and <= 32. Ex: $1 AVA = 10^9 $nAVA
* @param initialstate Optional [[InitialStates]] that represent the intial state of a created asset
* @param ins Optional array of the [[Input]]s
* @param outs Optional array of the [[Output]]s
* @param networkid Optional networkid, default 2
* @param blockchainid Optional blockchainid, default Buffer.alloc(32, 16)
* @param txtype Optional txtype, default 1
*/
constructor(name?: string, symbol?: string, denomination?: number, initialstate?: InitialStates, ins?: Array<Input>, outs?: Array<Output>, networkid?: number, blockchainid?: Buffer, txtype?: number);
}
/**

@@ -100,3 +157,3 @@ * Class representing a signed transaction.

*/
fromBuffer: (bytes: Buffer) => number;
fromBuffer(bytes: Buffer): number;
/**

@@ -112,7 +169,7 @@ * Takes a base-58 string containing an [[Tx]], parses it, populates the class, and returns the length of the Tx in bytes.

*/
fromString: (serialized: string) => number;
fromString(serialized: string): number;
/**
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[Tx]].
*/
toBuffer: () => Buffer;
toBuffer(): Buffer;
/**

@@ -124,3 +181,3 @@ * Returns a base-58 AVA-serialized representation of the [[Tx]].

*/
toString: () => string;
toString(): string;
/**

@@ -127,0 +184,0 @@ * Class representing a signed transaction.

@@ -88,98 +88,196 @@ "use strict";

};
this.txtype.writeUInt32BE(txtype, 0);
this.networkid.writeUInt32BE(networkid, 0);
this.blockchainid = blockchainid;
if (ins && outs) {
this.numouts.writeUInt32BE(outs.length, 0);
this.outs = outs.sort(outputs_1.Output.comparator());
this.numins.writeUInt32BE(ins.length, 0);
this.ins = ins.sort(inputs_1.Input.comparator());
}
}
/**
* Takes a {@link https://github.com/feross/buffer|Buffer} containing an [[TxUnsigned]], parses it, populates the class, and returns the length of the TxUnsigned in bytes.
*
* @param bytes A {@link https://github.com/feross/buffer|Buffer} containing a raw [[TxUnsigned]]
*
* @returns The length of the raw [[TxUnsigned]]
*
* @remarks assume not-checksummed
*/
fromBuffer(bytes, offset = 0) {
this.txtype = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
this.networkid = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
this.blockchainid = bintools.copyFrom(bytes, offset, offset + 32);
offset += 32;
this.numouts = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
let outcount = this.numouts.readUInt32BE(0);
this.outs = [];
for (let i = 0; i < outcount; i++) {
let outbuff = bintools.copyFrom(bytes, offset, bytes.length);
let out = outputs_1.SelectOutputClass(outbuff);
offset += out.fromBuffer(outbuff);
this.outs.push(out);
}
this.numins = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
let incount = this.numins.readUInt32BE(0);
this.ins = [];
for (let i = 0; i < incount; i++) {
let inbuff = bintools.copyFrom(bytes, offset, bytes.length);
let input = inputs_1.SelectInputClass(inbuff);
offset += input.fromBuffer(inbuff);
this.ins.push(input);
}
return offset;
}
/**
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[TxUnsigned]].
*/
toBuffer() {
try {
this.outs.sort(outputs_1.Output.comparator());
this.ins.sort(inputs_1.Input.comparator());
this.numouts.writeUInt32BE(this.outs.length, 0);
this.numins.writeUInt32BE(this.ins.length, 0);
let bsize = this.txtype.length + this.networkid.length + this.blockchainid.length + this.numouts.length;
let barr = [this.txtype, this.networkid, this.blockchainid, this.numouts];
for (let i = 0; i < this.outs.length; i++) {
let b = this.outs[i].toBuffer();
barr.push(b);
bsize += b.length;
}
barr.push(this.numins);
bsize += this.numins.length;
for (let i = 0; i < this.ins.length; i++) {
let b = this.ins[i].toBuffer();
barr.push(b);
bsize += b.length;
}
let buff = buffer_1.Buffer.concat(barr, bsize);
return buff;
}
catch (e) {
/* istanbul ignore next */
let emsg = "Error - TxUnsigned.toBuffer: " + e;
/* istanbul ignore next */
throw new Error(emsg);
}
}
/**
* Returns a base-58 representation of the [[TxUnsigned]].
*/
toString() {
return bintools.bufferToB58(this.toBuffer());
}
}
exports.TxUnsigned = TxUnsigned;
class TxCreateAsset extends TxUnsigned {
/**
* Class representing an unsigned Create Asset transaction.
*
* @param name String for the descriptive name of the asset
* @param symbol String for the ticker symbol of the asset
* @param denomination Optional number for the denomination which is 10^D. D must be >= 0 and <= 32. Ex: $1 AVA = 10^9 $nAVA
* @param initialstate Optional [[InitialStates]] that represent the intial state of a created asset
* @param ins Optional array of the [[Input]]s
* @param outs Optional array of the [[Output]]s
* @param networkid Optional networkid, default 2
* @param blockchainid Optional blockchainid, default Buffer.alloc(32, 16)
* @param txtype Optional txtype, default 1
*/
constructor(name = undefined, symbol = undefined, denomination = undefined, initialstate = undefined, ins = undefined, outs = undefined, networkid = 2, blockchainid = buffer_1.Buffer.alloc(32, 16), txtype = types_1.AVMConstants.CREATEASSETTX) {
super(ins, outs, networkid, blockchainid, txtype);
this.name = "";
this.namebuff = buffer_1.Buffer.alloc(2);
this.symbol = "";
this.symbolbuff = buffer_1.Buffer.alloc(2);
this.denomination = buffer_1.Buffer.alloc(1);
this.initialstate = new types_1.InitialStates();
/**
* Takes a {@link https://github.com/feross/buffer|Buffer} containing an [[TxUnsigned]], parses it, populates the class, and returns the length of the TxUnsigned in bytes.
*
* @param bytes A {@link https://github.com/feross/buffer|Buffer} containing a raw [[TxUnsigned]]
*
* @returns The length of the raw [[TxUnsigned]]
*
* @remarks assume not-checksummed and deserialized
* Returns the array of array of [[Output]]s for the initial state
*/
this.fromBuffer = (bytes) => {
let offset = 0;
this.txtype = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
this.networkid = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
this.blockchainid = bintools.copyFrom(bytes, offset, offset + 32);
offset += 32;
this.numouts = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
let outcount = this.numouts.readUInt32BE(0);
this.outs = [];
for (let i = 0; i < outcount; i++) {
let outbuff = bintools.copyFrom(bytes, offset, bytes.length);
let out = outputs_1.SelectOutputClass(outbuff);
offset += out.fromBuffer(outbuff);
this.outs.push(out);
}
this.numins = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
let incount = this.numins.readUInt32BE(0);
this.ins = [];
for (let i = 0; i < incount; i++) {
let inbuff = bintools.copyFrom(bytes, offset, bytes.length);
let input = inputs_1.SelectInputClass(inbuff);
offset += input.fromBuffer(inbuff);
this.ins.push(input);
}
return offset;
this.getInitialStates = () => {
return this.initialstate;
};
/**
* @ignore
* Returns the string representation of the name
*/
this._basicTxBuffer = () => {
try {
this.outs.sort(outputs_1.Output.comparator());
this.ins.sort(inputs_1.Input.comparator());
this.numouts.writeUInt32BE(this.outs.length, 0);
this.numins.writeUInt32BE(this.ins.length, 0);
let bsize = this.txtype.length + this.networkid.length + this.blockchainid.length + this.numouts.length;
let barr = [this.txtype, this.networkid, this.blockchainid, this.numouts];
for (let i = 0; i < this.outs.length; i++) {
let b = this.outs[i].toBuffer();
barr.push(b);
bsize += b.length;
}
barr.push(this.numins);
bsize += this.numins.length;
for (let i = 0; i < this.ins.length; i++) {
let b = this.ins[i].toBuffer();
barr.push(b);
bsize += b.length;
}
let buff = buffer_1.Buffer.concat(barr, bsize);
return buff;
}
catch (e) {
/* istanbul ignore next */
let emsg = "Error - TxUnsigned._basicTxBuffer: " + e;
/* istanbul ignore next */
throw new Error(emsg);
}
this.getName = () => {
return this.name;
};
/**
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[TxUnsigned]].
* Returns the {@link https://github.com/feross/buffer|Buffer} representation of the name
*/
this.toBuffer = () => {
return this._basicTxBuffer();
this.getNameBuffer = () => {
return this.namebuff;
};
/**
* Returns a base-58 representation of the [[TxUnsigned]].
* Returns the string representation of the symbol
*/
this.toString = () => {
return bintools.bufferToB58(this.toBuffer());
this.getSymbol = () => {
return this.symbol;
};
this.txtype.writeUInt32BE(txtype, 0);
this.networkid.writeUInt32BE(networkid, 0);
this.blockchainid = blockchainid;
if (ins && outs) {
this.numouts.writeUInt32BE(outs.length, 0);
this.outs = outs.sort(outputs_1.Output.comparator());
this.numins.writeUInt32BE(ins.length, 0);
this.ins = ins.sort(inputs_1.Input.comparator());
/**
* Returns the {@link https://github.com/feross/buffer|Buffer} representation of the symbol
*/
this.getSymbolBuffer = () => {
return this.symbolbuff;
};
/**
* Returns the numeric representation of the denomination
*/
this.getDenomination = () => {
return this.denomination.readUInt8(0);
};
/**
* Returns the {@link https://github.com/feross/buffer|Buffer} representation of the denomination
*/
this.getDenominationBuffer = () => {
return this.denomination;
};
if (typeof name === 'string' && typeof symbol === 'string' && typeof denomination === 'number' && denomination >= 0 && denomination <= 32 && initialstate) {
this.initialstate = initialstate;
this.namebuff = bintools.stringToBuffer(name);
this.name = name;
this.symbolbuff = bintools.stringToBuffer(symbol);
this.symbol = symbol;
this.denomination.writeUInt8(denomination, 0);
}
}
/**
* Takes a {@link https://github.com/feross/buffer|Buffer} containing an [[TxCreateAsset]], parses it, populates the class, and returns the length of the TxUnsigned in bytes.
*
* @param bytes A {@link https://github.com/feross/buffer|Buffer} containing a raw [[TxCreateAsset]]
*
* @returns The length of the raw [[TxCreateAsset]]
*
* @remarks assume not-checksummed
*/
fromBuffer(bytes, offset = 0) {
offset = super.fromBuffer(bytes, offset);
let namesize = bintools.copyFrom(bytes, offset, offset + 2).readUInt16BE(0);
this.namebuff = bintools.copyFrom(bytes, offset, offset + 2 + namesize);
offset += 2;
offset += namesize;
let symsize = bintools.copyFrom(bytes, offset, offset + 2).readUInt16BE(0);
this.symbolbuff = bintools.copyFrom(bytes, offset, offset + 2 + symsize);
offset += 2;
offset += symsize;
this.denomination = bintools.copyFrom(bytes, offset, offset + 1);
offset += 1;
let inits = new types_1.InitialStates();
offset = inits.fromBuffer(bytes, offset);
this.initialstate = inits;
return offset;
}
toBuffer() {
let barr = [super.toBuffer(), this.namebuff, this.symbolbuff, this.denomination, this.initialstate.toBuffer()];
return buffer_1.Buffer.concat(barr);
}
}
exports.TxUnsigned = TxUnsigned;
exports.TxCreateAsset = TxCreateAsset;
/**

@@ -198,93 +296,2 @@ * Class representing a signed transaction.

this.signatures = [];
/**
* Takes a {@link https://github.com/feross/buffer|Buffer} containing an [[Tx]], parses it, populates the class, and returns the length of the Tx in bytes.
*
* @param bytes A {@link https://github.com/feross/buffer|Buffer} containing a raw [[Tx]]
*
* @returns The length of the raw [[Tx]]
*/
this.fromBuffer = (bytes) => {
this.tx = new TxUnsigned();
let offset = this.tx.fromBuffer(bytes);
let numcreds = bintools.copyFrom(bytes, offset, offset + 4).readUInt32BE(0);
offset += 4;
this.signatures = [];
for (let i = 0; i < numcreds; i++) {
let sigarray = [];
let credential = bintools.copyFrom(bytes, offset, offset + 4).readUInt32BE(0);
offset += 4;
if (credential != types_1.Constants.SECPCREDENTIAL) {
/* istanbul ignore next */
throw new Error("Error - Tx.fromBuffer: Invalid credentialID " + credential);
}
let numsigs = bintools.copyFrom(bytes, offset, offset + 4).readUInt32BE(0);
offset += 4;
for (let j = 0; j < numsigs; j++) {
let sig = new types_1.Signature();
sig.fromBuffer(bintools.copyFrom(bytes, offset, offset + 65));
sigarray.push(sig);
offset += 65;
}
this.signatures.push(sigarray);
}
return offset;
};
/**
* Takes a base-58 string containing an [[Tx]], parses it, populates the class, and returns the length of the Tx in bytes.
*
* @param serialized A base-58 string containing a raw [[Tx]]
*
* @returns The length of the raw [[Tx]]
*
* @remarks
* unlike most fromStrings, it expects the string to be serialized in AVA format
*/
this.fromString = (serialized) => {
return this.fromBuffer(bintools.avaDeserialize(serialized));
};
/**
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[Tx]].
*/
this.toBuffer = () => {
try {
let txbuff = this.tx.toBuffer();
let bsize = txbuff.length;
let sigarrlen = buffer_1.Buffer.alloc(4);
sigarrlen.writeUInt32BE(this.signatures.length, 0);
let barr = [txbuff, sigarrlen];
bsize += sigarrlen.length;
for (let i = 0; i < this.signatures.length; i++) {
let siglen = buffer_1.Buffer.alloc(4);
siglen.writeUInt32BE(this.signatures[i].length, 0);
let credentialID = buffer_1.Buffer.alloc(4);
credentialID.writeUInt32BE(types_1.Constants.SECPCREDENTIAL, 0);
barr.push(credentialID);
bsize += credentialID.length;
barr.push(siglen);
bsize += siglen.length;
for (let j = 0; j < this.signatures[i].length; j++) {
let b = this.signatures[i][j].toBuffer();
barr.push(b);
bsize += b.length;
}
}
let buff = buffer_1.Buffer.concat(barr, bsize);
return buff;
}
catch (e) {
/* istanbul ignore next */
let emsg = "Error - TxSigned.toBuffer: " + e;
/* istanbul ignore next */
throw new Error(emsg);
}
};
/**
* Returns a base-58 AVA-serialized representation of the [[Tx]].
*
* @remarks
* unlike most toStrings, this returns in AVA serialization format
*/
this.toString = () => {
return bintools.avaSerialize(this.toBuffer());
};
if (tx) {

@@ -297,4 +304,95 @@ this.tx = tx;

}
/**
* Takes a {@link https://github.com/feross/buffer|Buffer} containing an [[Tx]], parses it, populates the class, and returns the length of the Tx in bytes.
*
* @param bytes A {@link https://github.com/feross/buffer|Buffer} containing a raw [[Tx]]
*
* @returns The length of the raw [[Tx]]
*/
fromBuffer(bytes) {
this.tx = new TxUnsigned();
let offset = this.tx.fromBuffer(bytes);
let numcreds = bintools.copyFrom(bytes, offset, offset + 4).readUInt32BE(0);
offset += 4;
this.signatures = [];
for (let i = 0; i < numcreds; i++) {
let sigarray = [];
let credential = bintools.copyFrom(bytes, offset, offset + 4).readUInt32BE(0);
offset += 4;
if (credential != types_1.AVMConstants.SECPCREDENTIAL) {
/* istanbul ignore next */
throw new Error("Error - Tx.fromBuffer: Invalid credentialID " + credential);
}
let numsigs = bintools.copyFrom(bytes, offset, offset + 4).readUInt32BE(0);
offset += 4;
for (let j = 0; j < numsigs; j++) {
let sig = new types_1.Signature();
sig.fromBuffer(bintools.copyFrom(bytes, offset, offset + 65));
sigarray.push(sig);
offset += 65;
}
this.signatures.push(sigarray);
}
return offset;
}
/**
* Takes a base-58 string containing an [[Tx]], parses it, populates the class, and returns the length of the Tx in bytes.
*
* @param serialized A base-58 string containing a raw [[Tx]]
*
* @returns The length of the raw [[Tx]]
*
* @remarks
* unlike most fromStrings, it expects the string to be serialized in AVA format
*/
fromString(serialized) {
return this.fromBuffer(bintools.avaDeserialize(serialized));
}
/**
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[Tx]].
*/
toBuffer() {
try {
let txbuff = this.tx.toBuffer();
let bsize = txbuff.length;
let sigarrlen = buffer_1.Buffer.alloc(4);
sigarrlen.writeUInt32BE(this.signatures.length, 0);
let barr = [txbuff, sigarrlen];
bsize += sigarrlen.length;
for (let i = 0; i < this.signatures.length; i++) {
let siglen = buffer_1.Buffer.alloc(4);
siglen.writeUInt32BE(this.signatures[i].length, 0);
let credentialID = buffer_1.Buffer.alloc(4);
credentialID.writeUInt32BE(types_1.AVMConstants.SECPCREDENTIAL, 0);
barr.push(credentialID);
bsize += credentialID.length;
barr.push(siglen);
bsize += siglen.length;
for (let j = 0; j < this.signatures[i].length; j++) {
let b = this.signatures[i][j].toBuffer();
barr.push(b);
bsize += b.length;
}
}
let buff = buffer_1.Buffer.concat(barr, bsize);
return buff;
}
catch (e) {
/* istanbul ignore next */
let emsg = "Error - TxSigned.toBuffer: " + e;
/* istanbul ignore next */
throw new Error(emsg);
}
}
/**
* Returns a base-58 AVA-serialized representation of the [[Tx]].
*
* @remarks
* unlike most toStrings, this returns in AVA serialization format
*/
toString() {
return bintools.avaSerialize(this.toBuffer());
}
}
exports.Tx = Tx;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYXBpcy9hdm0vdHgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQTs7R0FFRztBQUNILG9DQUErQjtBQUMvQixtQ0FBK0M7QUFDL0MsdUNBQXNEO0FBQ3RELHFDQUE4RDtBQUM5RCxvRUFBNEM7QUFFNUM7O0dBRUc7QUFDSCxNQUFNLFFBQVEsR0FBRyxrQkFBUSxDQUFDLFdBQVcsRUFBRSxDQUFDO0FBRXhDOzs7Ozs7Ozs7Ozs7OztHQWNHO0FBQ0g7Ozs7R0FJRztBQUNIOzs7R0FHRztBQUNILE1BQW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B0aGlzLm51bW91dHNdO1xuICAgICAgICAgICAgZm9yKGxldCBpID0gMDsgaSA8IHRoaXMub3V0cy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIGxldCBiOkJ1ZmZlciA9IHRoaXMub3V0c1tpXS50b0J1ZmZlcigpO1xuICAgICAgICAgICAgICAgIGJhcnIucHVzaChiKTtcbiAgICAgICAgICAgICAgICBic2l6ZSArPSBiLmxlbmd0aDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJhcnIucHVzaCh0aGlzLm51bWlucyk7XG4gICAgICAgICAgICBic2l6ZSArPSB0aGlzLm51bWlucy5sZW5ndGg7XG4gICAgICAgICAgICBmb3IobGV0IGkgPSAwOyBpIDwgdGhpcy5pbnMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICBsZXQgYjpCdWZmZXIgPSB0aGlzLmluc1tpXS50b0J1ZmZlcigpO1xuICAgICAgICAgICAgICAgIGJhcnIucHVzaChiKTtcbiAgICAgICAgICAgICAgICBic2l6ZSArPSBiLmxlbmd0aDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGxldCBidWZmOkJ1ZmZlciA9IEJ1ZmZlci5jb25jYXQoYmFyciwgYnNpemUpO1xuICAgICAgICAgICAgcmV0dXJuIGJ1ZmY7XG4gICAgICAgIH0gY2F0Y2goZSkge1xuICAgICAgICAgICAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cbiAgICAgICAgICAgIGxldCBlbXNnOnN0cmluZyA9IFwiRXJyb3IgLSBUeFVuc2lnbmVkLl9iYXNpY1R4QnVmZmVyOiBcIiArIGU7XG4gICAgICAgICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgbmV4dCAqL1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGVtc2cpO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogUmV0dXJucyBhIHtAbGluayBodHRwczovL2dpdGh1Yi5jb20vZmVyb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cbiAgICAgICAgICAgICAgICBsZXQgY3JlZGVudGlhbElEID0gQnVmZmVyLmFsbG9jKDQpO1xuICAgICAgICAgICAgICAgIGNyZWRlbnRpYWxJRC53cml0ZVVJbnQzMkJFKENvbnN0YW50cy5TRUNQQ1JFREVOVElBTCwgMCk7XG4gICAgICAgICAgICAgICAgYmFyci5wdXNoKGNyZWRlbnRpYWxJRCk7XG4gICAgICAgICAgICAgICAgYnNpemUgKz0gY3JlZGVudGlhbElELmxlbmd0aDtcbiAgICAgICAgICAgICAgICBiYXJyLnB1c2goc2lnbGVuKTtcbiAgICAgICAgICAgICAgICBic2l6ZSArPSBzaWdsZW4ubGVuZ3RoO1xuICAgICAgICAgICAgICAgIGZvcihsZXQgaiA9IDA7IGogPCB0aGlzLnNpZ25hdHVyZXNbaV0ubGVuZ3RoOyBqKyspe1xuICAgICAgICAgICAgICAgICAgICBsZXQgYjpCdWZmZXIgPSB0aGlzLnNpZ25hdHVyZXNbaV1bal0udG9CdWZmZXIoKTtcbiAgICAgICAgICAgICAgICAgICAgYmFyci5wdXNoKGIpO1xuICAgICAgICAgICAgICAgICAgICBic2l6ZSArPSBiLmxlbmd0aDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsZXQgYnVmZjpCdWZmZXIgPSBCdWZmZXIuY29uY2F0KGJhcnIsIGJzaXplKTtcbiAgICAgICAgICAgIHJldHVybiBidWZmO1xuICAgICAgICB9IGNhdGNoKGUpIHtcbiAgICAgICAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovXG4gICAgICAgICAgICBsZXQgZW1zZzpzdHJpbmcgPSBcIkVycm9yIC0gVHhTaWduZWQudG9CdWZmZXI6IFwiICsgZTtcbiAgICAgICAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovXG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoZW1zZyk7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBSZXR1cm5zIGEgYmFzZS01OCBBVkEtc2VyaWFsaXplZCByZXByZXNlbnRhdGlvbiBvZiB0aGUgW1tUeF1dLlxuICAgICAqIFxuICAgICAqIEByZW1hcmtzIFxuICAgICAqIHVubGlrZSBtb3N0IHRvU3RyaW5ncywgdGhpcyByZXR1cm5zIGluIEFWQSBzZXJpYWxpemF0aW9uIGZvcm1hdFxuICAgICAqL1xuICAgIHRvU3RyaW5nID0gKCk6c3RyaW5nID0+IHtcbiAgICAgICAgcmV0dXJuIGJpbnRvb2xzLmF2YVNlcmlhbGl6ZSh0aGlzLnRvQnVmZmVyKCkpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIENsYXNzIHJlcHJlc2VudGluZyBhIHNpZ25lZCB0cmFuc2FjdGlvbi5cbiAgICAgKiBcbiAgICAgKiBAcGFyYW0gdHggT3B0aW9uYWwgW1tUeF1dXG4gICAgICogQHBhcmFtIHNpZ25hdHVyZXMgT3B0aW9uYWwgYXJyYXkgb2YgW1tTaWduYXR1cmVdXXNcbiAgICAgKi9cbiAgICBjb25zdHJ1Y3Rvcih0eD86VHhVbnNpZ25lZCwgc2lnbmF0dXJlcz86QXJyYXk8QXJyYXk8U2lnbmF0dXJlPj4pIHtcbiAgICAgICAgaWYodHgpe1xuICAgICAgICAgICAgdGhpcy50eCA9IHR4O1xuICAgICAgICAgICAgaWYoc2lnbmF0dXJlcyl7XG4gICAgICAgICAgICAgICAgdGhpcy5zaWduYXR1cmVzID0gc2lnbmF0dXJlc1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuXG5cbiJdfQ==
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYXBpcy9hdm0vdHgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQTs7R0FFRzt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AgICB0aGlzLmlucy5zb3J0KElucHV0LmNvbXBhcmF0b3IoKSk7XG4gICAgICAgICAgICB0aGlzLm51bW91dHMud3JpdGVVSW50MzJCRSh0aGlzLm91dHMubGVuZ3RoLCAwKTtcbiAgICAgICAgICAgIHRoaXMubnVtaW5zLndyaXRlVUludDMyQkUodGhpcy5pbnMubGVuZ3RoLCAwKTtcbiAgICAgICAgICAgIGxldCBic2l6ZTpudW1iZXIgPSB0aGlzLnR4dHlwZS5sZW5ndGggKyB0aGlzLm5ldHdvcmtpZC5sZW5ndGggKyB0aGlzLmJsb2NrY2hhaW5pZC5sZW5ndGggKyB0aGlzLm51bW91dHMubGVuZ3RoO1xuICAgICAgICAgICAgbGV0IGJhcnI6QXJyYXk8QnVmZmVyPiA9IFt0aGlzLnR4dHlwZSwgdGhpcy5uZXR3b3JraWQsIHRoaXMuYmxvY2tjaGFpbmlkLCB0aGlzLm51bW91dHNdO1xuICAgICAgICAgICAgZm9yKGxldCBpID0gMDsgaSA8IHRoaXMub3V0cy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIGxldCBiOkJ1ZmZlciA9IHRoaXMub3V0c1tpXS50b0J1ZmZlcigpO1xuICAgICAgICAgICAgICAgIGJhcnIucHVzaChiKTtcbiAgICAgICAgICAgICAgICBic2l6ZSArPSBiLmxlbmd0aDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJhcnIucHVzaCh0aGlzLm51bWlucyk7XG4gICAgICAgICAgICBic2l6ZSArPSB0aGlzLm51bWlucy5sZW5ndGg7XG4gICAgICAgICAgICBmb3IobGV0IGkgPSAwOyBpIDwgdGhpcy5pbnMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICBsZXQgYjpCdWZmZXIgPSB0aGlzLmluc1tpXS50b0J1ZmZlcigpO1xuICAgICAgICAgICAgICAgIGJhcnIucHVzaChiKTtcbiAgICAgICAgICAgICAgICBic2l6ZSArPSBiLmxlbmd0aDtcbiAgICAgICAgIC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LlNFQ1BDUkVERU5USUFMLCAwKTtcbiAgICAgICAgICAgICAgICBiYXJyLnB1c2goY3JlZGVudGlhbElEKTtcbiAgICAgICAgICAgICAgICBic2l6ZSArPSBjcmVkZW50aWFsSUQubGVuZ3RoO1xuICAgICAgICAgICAgICAgIGJhcnIucHVzaChzaWdsZW4pO1xuICAgICAgICAgICAgICAgIGJzaXplICs9IHNpZ2xlbi5sZW5ndGg7XG4gICAgICAgICAgICAgICAgZm9yKGxldCBqID0gMDsgaiA8IHRoaXMuc2lnbmF0dXJlc1tpXS5sZW5ndGg7IGorKyl7XG4gICAgICAgICAgICAgICAgICAgIGxldCBiOkJ1ZmZlciA9IHRoaXMuc2lnbmF0dXJlc1tpXVtqXS50b0J1ZmZlcigpO1xuICAgICAgICAgICAgICAgICAgICBiYXJyLnB1c2goYik7XG4gICAgICAgICAgICAgICAgICAgIGJzaXplICs9IGIubGVuZ3RoO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGxldCBidWZmOkJ1ZmZlciA9IEJ1ZmZlci5jb25jYXQoYmFyciwgYnNpemUpO1xuICAgICAgICAgICAgcmV0dXJuIGJ1ZmY7XG4gICAgICAgIH0gY2F0Y2goZSkge1xuICAgICAgICAgICAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cbiAgICAgICAgICAgIGxldCBlbXNnOnN0cmluZyA9IFwiRXJyb3IgLSBUeFNpZ25lZC50b0J1ZmZlcjogXCIgKyBlO1xuICAgICAgICAgICAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihlbXNnKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFJldHVybnMgYSBiYXNlLTU4IEFWQS1zZXJpYWxpemVkIHJlcHJlc2VudGF0aW9uIG9mIHRoZSBbW1R4XV0uXG4gICAgICogXG4gICAgICogQHJlbWFya3MgXG4gICAgICogdW5saWtlIG1vc3QgdG9TdHJpbmdzLCB0aGlzIHJldHVybnMgaW4gQVZBIHNlcmlhbGl6YXRpb24gZm9ybWF0XG4gICAgICovXG4gICAgdG9TdHJpbmcoKTpzdHJpbmcge1xuICAgICAgICByZXR1cm4gYmludG9vbHMuYXZhU2VyaWFsaXplKHRoaXMudG9CdWZmZXIoKSk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQ2xhc3MgcmVwcmVzZW50aW5nIGEgc2lnbmVkIHRyYW5zYWN0aW9uLlxuICAgICAqIFxuICAgICAqIEBwYXJhbSB0eCBPcHRpb25hbCBbW1R4XV1cbiAgICAgKiBAcGFyYW0gc2lnbmF0dXJlcyBPcHRpb25hbCBhcnJheSBvZiBbW1NpZ25hdHVyZV1dc1xuICAgICAqL1xuICAgIGNvbnN0cnVjdG9yKHR4PzpUeFVuc2lnbmVkLCBzaWduYXR1cmVzPzpBcnJheTxBcnJheTxTaWduYXR1cmU+Pikge1xuICAgICAgICBpZih0eCl7XG4gICAgICAgICAgICB0aGlzLnR4ID0gdHg7XG4gICAgICAgICAgICBpZihzaWduYXR1cmVzKXtcbiAgICAgICAgICAgICAgICB0aGlzLnNpZ25hdHVyZXMgPSBzaWduYXR1cmVzXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG59XG5cblxuIl19

@@ -0,3 +1,8 @@

/**
* @module AVMAPI
*/
import { Buffer } from "buffer/";
import { NBytes } from '../../utils/types';
import BN from "bn.js";
import { Output } from './outputs';
/**

@@ -7,11 +12,11 @@ * Type representing a [[Signature]] index used in [[Input]]

export declare class SigIdx extends NBytes {
source: string;
source: Buffer;
/**
* Sets the source address for the signature
*/
setSource: (address: string) => void;
setSource: (address: Buffer) => void;
/**
* Retrieves the source address for the signature
*/
getSource: () => string;
getSource: () => Buffer;
/**

@@ -42,3 +47,3 @@ * Type representing a [[Signature]] index used in [[Input]]

*/
toString: () => string;
toString(): string;
/**

@@ -51,3 +56,3 @@ * Takes a base-58 string containing an [[Address]], parses it, populates the class, and returns the length of the Address in bytes.

*/
fromString: (addr: string) => number;
fromString(addr: string): number;
/**

@@ -58,7 +63,23 @@ * Class for representing an address used in [[Output]] types

}
export declare class Constants {
export declare class InitialStates {
protected fxs: {
[fxid: number]: Array<Output>;
};
addOutput(out: Output, fxid: number): void;
fromBuffer(bytes: Buffer, offset: number): number;
toBuffer(): Buffer;
constructor();
}
export declare class AVMConstants {
static SECPOUTPUTID: number;
static SECPINPUTID: number;
static CREATEASSETTX: number;
static BASETX: number;
static SECPCREDENTIAL: number;
static ASSETIDLEN: number;
static BLOCKCHAINIDLEN: number;
static SYMBOLMAXLEN: number;
static ASSETNAMELEN: number;
static ADDRESSLENGTH: number;
static SECPFXID: number;
}

@@ -65,0 +86,0 @@ /**

@@ -13,2 +13,3 @@ "use strict";

const bintools_1 = __importDefault(require("../../utils/bintools"));
const outputs_1 = require("./outputs");
/**

@@ -67,38 +68,38 @@ * @ignore

super();
/**
* Returns a base-58 representation of the [[Address]].
*/
this.toString = () => {
return bintools.avaSerialize(this.toBuffer());
};
/**
* Takes a base-58 string containing an [[Address]], parses it, populates the class, and returns the length of the Address in bytes.
*
* @param bytes A base-58 string containing a raw [[Address]]
*
* @returns The length of the raw [[Address]]
*/
this.fromString = (addr) => {
let addrbuff = bintools.b58ToBuffer(addr);
if (addrbuff.length == 24 && bintools.validateChecksum(addrbuff)) {
let newbuff = bintools.copyFrom(addrbuff, 0, addrbuff.length - 4);
if (newbuff.length == 20) {
this.bytes = newbuff;
}
}
else if (addrbuff.length == 24) {
throw new Error("Error - Address.fromString: invalid checksum on address");
}
else if (addrbuff.length == 20) {
this.bytes = addrbuff;
}
else {
/* istanbul ignore next */
throw new Error("Error - Address.fromString: invalid address");
}
return this.getSize();
};
this.bytes = buffer_1.Buffer.alloc(20);
this.bsize = 20;
}
/**
* Returns a base-58 representation of the [[Address]].
*/
toString() {
return bintools.avaSerialize(this.toBuffer());
}
/**
* Takes a base-58 string containing an [[Address]], parses it, populates the class, and returns the length of the Address in bytes.
*
* @param bytes A base-58 string containing a raw [[Address]]
*
* @returns The length of the raw [[Address]]
*/
fromString(addr) {
let addrbuff = bintools.b58ToBuffer(addr);
if (addrbuff.length == 24 && bintools.validateChecksum(addrbuff)) {
let newbuff = bintools.copyFrom(addrbuff, 0, addrbuff.length - 4);
if (newbuff.length == 20) {
this.bytes = newbuff;
}
}
else if (addrbuff.length == 24) {
throw new Error("Error - Address.fromString: invalid checksum on address");
}
else if (addrbuff.length == 20) {
this.bytes = addrbuff;
}
else {
/* istanbul ignore next */
throw new Error("Error - Address.fromString: invalid address");
}
return this.getSize();
}
}

@@ -114,9 +115,74 @@ exports.Address = Address;

};
class Constants {
class InitialStates {
constructor() {
this.fxs = {};
}
addOutput(out, fxid) {
if (!(fxid in this.fxs)) {
this.fxs[fxid] = [];
}
this.fxs[fxid].push(out);
}
fromBuffer(bytes, offset) {
let result = {};
let klen = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
let klennum = klen.readUInt32BE(0);
for (let i = 0; i < klennum; i++) {
let fxidbuff = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
let fxid = fxidbuff.readUInt32BE(0);
result[fxid] = [];
let statelenbuff = bintools.copyFrom(bytes, offset, offset + 4);
offset += 4;
let statelen = statelenbuff.readUInt32BE(0);
for (let j = 0; j < statelen; j++) {
let abuff = bintools.copyFrom(bytes, offset);
let out = new outputs_1.SecpOutBase();
out.fromBuffer(abuff);
let outbuff = out.toBuffer();
offset += outbuff.length;
result[fxid].push(out);
}
}
this.fxs = result;
return offset;
}
toBuffer() {
let buff = [];
let keys = Object.keys(this.fxs).map(k => parseInt(k)).sort();
let klen = buffer_1.Buffer.alloc(4);
klen.writeUInt32BE(keys.length, 0);
buff.push(klen);
for (let i = 0; i < keys.length; i++) {
let fxid = keys[i];
let fxidbuff = buffer_1.Buffer.alloc(4);
fxidbuff.writeUInt32BE(fxid, 0);
buff.push(fxidbuff);
let initialState = this.fxs[fxid].sort(outputs_1.Output.comparator());
let statelen = buffer_1.Buffer.alloc(4);
statelen.writeUInt32BE(initialState.length, 0);
buff.push(statelen);
for (let j = 0; j < initialState.length; j++) {
buff.push(initialState[j].toBuffer());
}
}
return buffer_1.Buffer.concat(buff);
}
}
exports.Constants = Constants;
Constants.SECPOUTPUTID = 4;
Constants.SECPINPUTID = 6;
Constants.BASETX = 0;
Constants.SECPCREDENTIAL = 7;
exports.InitialStates = InitialStates;
class AVMConstants {
}
exports.AVMConstants = AVMConstants;
AVMConstants.SECPOUTPUTID = 4;
AVMConstants.SECPINPUTID = 6;
AVMConstants.CREATEASSETTX = 1;
AVMConstants.BASETX = 0;
AVMConstants.SECPCREDENTIAL = 7;
AVMConstants.ASSETIDLEN = 32;
AVMConstants.BLOCKCHAINIDLEN = 32;
AVMConstants.SYMBOLMAXLEN = 4;
AVMConstants.ASSETNAMELEN = 128;
AVMConstants.ADDRESSLENGTH = 20;
AVMConstants.SECPFXID = 0;
/**

@@ -130,2 +196,2 @@ * Function providing the current UNIX time using a {@link https://github.com/indutny/bn.js/|BN}

;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYXBpcy9hdm0vdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQTs7R0FFRztBQUNILG9DQUErQjtBQUMvQiw2Q0FBMkM7QUFDM0Msa0RBQXVCO0FBQ3ZCLG9FQUE0QztBQUU1Qzs7R0FFRztBQUNILElBQUksUUFBUSxHQUFZLGtCQUFRLENBQUMsV0FBVyxFQUFFLENBQUM7QUFFL0M7O0dBRUc7QUFDSCxNQUFhLE1BQU8sU0FBUSxjQUFNO0lBaUI5Qjs7T0FFRztJQUNIO1FBQ0ksS0FBSyxFQUFFLENBQUM7UUFsQlo7O1dBRUc7UUFDSCxjQUFTLEdBQUcsQ0FBQ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OZXdcbiAgICAgICAgICAgICAgICAgICAgICAgIHwgXCJ1bmlvblwiIC8vU2VsZiBVTklPTiBOZXdcbiAgICAgICAgICAgICAgICAgICAgICAgIHwgXCJ1bmlvbk1pbnVzTmV3XCIgLy91bmlvbiBNSU5VUyBkaWZmZXJlbmNlTmV3XG4gICAgICAgICAgICAgICAgICAgICAgICB8IFwidW5pb25NaW51c1NlbGZcIiAvL3VuaW9uIE1JTlVTIGRpZmZlcmVuY2VTZWxmXG4gICAgICAgICAgICAgICAgICAgICAgICB8IFwiRVJST1JcIjsgLy9nZW5lcmF0ZSBlcnJvciBmb3IgdGVzdGluZ1xuXG4vKipcbiAqIEZ1bmN0aW9uIHByb3ZpZGluZyB0aGUgY3VycmVudCBVTklYIHRpbWUgdXNpbmcgYSB7QGxpbmsgaHR0cHM6Ly9naXRodWIuY29tL2luZHV0bnkvYm4uanMvfEJOfVxuICovXG5leHBvcnQgZnVuY3Rpb24gVW5peE5vdygpOkJOIHtcbiAgICByZXR1cm4gbmV3IEJOKE1hdGgucm91bmQoKG5ldyBEYXRlKCkpLmdldFRpbWUoKSAvIDEwMDApKTtcbn07Il19

@@ -7,4 +7,4 @@ /**

import { SecpOutput } from './outputs';
import { MergeRule } from './types';
import { TxUnsigned } from './tx';
import { MergeRule, InitialStates } from './types';
import { TxUnsigned, TxCreateAsset } from './tx';
/**

@@ -21,6 +21,6 @@ * Takes a buffer representing the output and returns the proper UTXO instance.

*/
export declare abstract class UTXO {
export declare class UTXO {
protected txid: Buffer;
protected txidx: Buffer;
abstract getOuputID: () => number;
getOuputID(): number;
/**

@@ -38,3 +38,2 @@ * Returns a {@link https://github.com/feross/buffer|Buffer} of the TxID.

getUTXOID: () => string;
_basicUTXOBuffer: (utxobuff: any) => void;
/**

@@ -45,3 +44,3 @@ * Takes a {@link https://github.com/feross/buffer|Buffer} containing an [[UTXO]], parses it, populates the class, and returns the length of the UTXO in bytes.

*/
fromBuffer: (utxobuff: Buffer) => void;
fromBuffer(utxobuff: Buffer, offset?: number): number;
/**

@@ -57,7 +56,7 @@ * Takes a base-58 string containing an [[UTXO]], parses it, populates the class, and returns the length of the UTXO in bytes.

*/
fromString: (serialized: string) => void;
fromString(serialized: string): number;
/**
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[UTXO]].
*/
toBuffer: () => Buffer;
toBuffer(): Buffer;
/**

@@ -69,7 +68,8 @@ * Returns a base-58 representation of the [[UTXO]].

*/
toString: () => string;
toString(): string;
/**
* Class for representing a single UTXO.
*
* @param serialized Optional parameter of the serialized string representing a UTXO
* @param txid Optional {@link https://github.com/feross/buffer|Buffer} of transaction ID for the UTXO
* @param txidx Optional number for the index of the transaction's [[Output]]
*/

@@ -91,5 +91,3 @@ constructor(txid?: Buffer, txidx?: number);

*/
getAddresses: () => {
[address: string]: BN;
};
getAddresses: () => Buffer[];
/**

@@ -100,3 +98,3 @@ * Gets the index of the address in the output.

*/
getAddressIdx: (address: string) => number;
getAddressIdx: (address: Buffer) => number;
/**

@@ -107,5 +105,5 @@ * Gets the address at the index.

*
* @returns A string representing the address.
* @returns A {@link https://github.com/feross/buffer|Buffer} representing the address.
*/
getAddress: (idx: number) => string;
getAddress: (idx: number) => Buffer;
/**

@@ -124,2 +122,6 @@ * Returns a {@link https://github.com/feross/buffer|Buffer} of the assetID.

/**
* Returns a {@link https://github.com/indutny/bn.js/|BN} of the locktime.
*/
getLocktime: () => BN;
/**
* Returns the UTXOID as a base-58 string (UTXOID is a string )

@@ -133,3 +135,3 @@ */

*/
fromBuffer: (utxobuff: Buffer) => void;
fromBuffer(utxobuff: Buffer, offset?: number): number;
/**

@@ -145,7 +147,7 @@ * Takes a base-58 string containing an [[UTXO]], parses it, populates the class, and returns the length of the UTXO in bytes.

*/
fromString: (serialized: string) => void;
fromString(serialized: string): number;
/**
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[UTXO]].
*/
toBuffer: () => Buffer;
toBuffer(): Buffer;
/**

@@ -157,11 +159,11 @@ * Returns a base-58 representation of the [[UTXO]].

*/
toString: () => string;
toString(): string;
/**
* Given an array of addresses and an optional timestamp, returns an array of address strings of qualified spenders for the output.
*/
getSpenders: (addresses: string[], asOf?: BN) => string[];
getSpenders: (addresses: Buffer[], asOf?: BN) => Buffer[];
/**
* Given an array of addresses and an optional timestamp, returns true if the addresses meet the threshold required to spend the output.
*/
meetsThreshold: (addresses: string[], asOf?: BN) => boolean;
meetsThreshold: (addresses: Buffer[], asOf?: BN) => boolean;
/**

@@ -255,3 +257,3 @@ * Class for representing a single UTXO.

*
* @param address An address or array of addresses
* @param address An array of address {@link https://github.com/feross/buffer|Buffer}s
* @param spendable If true, only retrieves UTXOIDs whose locktime has passed

@@ -261,7 +263,7 @@ *

*/
getUTXOIDs: (address?: string | string[], spendable?: boolean) => string[];
getUTXOIDs: (addresses?: Buffer[], spendable?: boolean) => string[];
/**
* Gets the addresses in the [[UTXOSet]].
* Gets the addresses in the [[UTXOSet]] and returns an array of {@link https://github.com/feross/buffer|Buffer}.
*/
getAddresses: () => string[];
getAddresses: () => Buffer[];
/**

@@ -276,3 +278,3 @@ * Returns the balance of a set of addresses in the UTXOSet.

*/
getBalance: (addresses: string[], assetID: string | Buffer, asOf?: BN) => BN;
getBalance: (addresses: Buffer[], assetID: string | Buffer, asOf?: BN) => BN;
/**

@@ -285,6 +287,6 @@ * Gets all the Asset IDs, optionally that match with Asset IDs in an array

*/
getAssetIDs: (addresses?: string | string[]) => Buffer[];
getAssetIDs: (addresses?: Buffer[]) => Buffer[];
/**
* Creates an unsigned transaction. For more granular control, you may create your own
* [[TxUnsigned]] manually (with their corresponding [[Input]]s and [[Output]]s.
* [[TxUnsigned]] manually (with their corresponding [[Input]]s and [[Output]]s).
*

@@ -295,5 +297,3 @@ * @param networkid The number representing NetworkID of the node

* @param toAddresses The addresses to send the funds
* @param fromAddresses The addresses being used to send the funds from the UTXOs provided
* @param changeAddresses The addresses that can spend the change remaining from the spent UTXOs, locktime of BN(0) and a threshold of 1
* @param assetID The assetID of the value being sent as a {@link https://github.com/indutny/bn.js/|BN}
* @param fromAddresses The addresses being used to send the funds from the UTXOs {@link https://github.com/feross/buffer|Buffer}
* @param asOf The timestamp to verify the transaction against as a {@link https://github.com/indutny/bn.js/|BN}

@@ -306,4 +306,21 @@ * @param locktime The locktime field created in the resulting outputs

*/
makeUnsignedTx: (networkid: number, blockchainid: Buffer, amount: BN, toAddresses: string[], fromAddresses: string[], changeAddresses: string[], assetID: Buffer, asOf?: BN, locktime?: BN, threshold?: number) => TxUnsigned;
makeUnsignedTx: (networkid: number, blockchainid: Buffer, amount: BN, toAddresses: Buffer[], fromAddresses: Buffer[], changeAddresses: Buffer[], assetID: Buffer, asOf?: BN, locktime?: BN, threshold?: number) => TxUnsigned;
/**
* Creates an unsigned transaction. For more granular control, you may create your own
* [[TxCreateAsset]] manually (with their corresponding [[Input]]s, [[Output]]s).
*
* @param networkid The number representing NetworkID of the node
* @param blockchainid The {@link https://github.com/feross/buffer|Buffer} representing the BlockchainID for the transaction
* @param fee The amount of AVA to be paid for fees, in NanoAVA
* @param creatorAddresses The addresses to send the fees
* @param initialState The [[InitialStates]]that represent the intial state of a created asset
* @param name String for the descriptive name of the asset
* @param symbol String for the ticker symbol of the asset
* @param denomination Optional number for the denomination which is 10^D. D must be >= 0 and <= 32. Ex: $1 AVA = 10^9 $nAVA
*
* @returns An unsigned transaction created from the passed in parameters.
*
*/
makeCreateAssetTx: (networkid: number, blockchainid: Buffer, avaAssetID: Buffer, fee: BN, creatorAddresses: Buffer[], initialState: InitialStates, name: string, symbol: string, denomination: number) => TxCreateAsset;
/**
* Returns a new set with copy of UTXOs in this and set parameter.

@@ -310,0 +327,0 @@ *

@@ -17,129 +17,36 @@ /**

/**
* Creates a account in the node's database.
* Creates a user in the node's database.
*
* @param accountName Name of the account to create
* @param password Password for the account
* @param username Name of the user to create
* @param password Password for the user
*
* @returns Promise for a boolean with true on success
*/
createAccount: (accountName: string, password: string) => Promise<boolean>;
createUser: (username: string, password: string) => Promise<boolean>;
/**
* Creates an address (and associated private keys) on an account under a subnet.
* Exports a user. The user can be imported to another node with keystore.importUser .
*
* @param accountName Name of the account to create the address under
* @param password Password to unlock the account and encrypt the private key
* @param subnetAlias The subnetID or subnetAlias which the address is created under
* @param username The name of the user to export
* @param password The password of the user to export
*
* @returns Promise for a string representing the address created by the subnet.
* @returns Promise with a string importable using importUser
*/
createAddress: (accountName: string, password: string, subnetAlias: string) => Promise<string>;
exportUser: (username: string, password: string) => Promise<string>;
/**
* Exports and account, returning a string with the AVA Keystore File (AKF).
* Imports a user file into the node's user database and assigns it to a username.
*
* @param accountName The name of the account to export
* @param password Not just anyone can export an account... you must have the password
* @param username The name the user file should be imported into
* @param user AVA serialized string represetning a user's data
* @param password The user's password
*
* @returns Promise with a string representing the AVA Keystore File (AKF)
*/
exportAccount: (accountName: string, password: string) => Promise<string>;
/**
* Exports the private key for an address.
*
* @param accountName The name of the account with the private key
* @param password The password used to decrypt the private key
* @param subnetAlias The subnetID or subnetAlias that the key exists under
* @param address The address whose private key should be exported
*
* @returns Promise with the decrypted private key as store in the database
*/
exportKey: (accountName: string, password: string, subnetAlias: string, address: string) => Promise<string>;
/**
* Gets the balances for all assets on the provided address on the provided subnet.
*
* @param subnetAlias The subnetID or subnetAlias that the address exists under
* @param address The address to pull the asset balances from
*
* @returns Promise with the key-value pair of assetID to balance.
*/
getAllBalances: (subnetAlias: string, address: string) => Promise<object>;
/**
* Gets the balance of a particular asset on a subnet.
*
* @param subnetAlias The subnetID or subnetAlias that the address exists under
* @param address The address to pull the asset balance from
* @param assetID The assetID to pull the balance from
*
* @returns Promise with the balance of the assetID on the provided address for the subnet.
*/
getBalance: (subnetAlias: string, address: string, assetID: string) => Promise<number>;
/**
* @ignore
*/
getTxHistory: (subnetAlias: string, address: string) => Promise<object>;
/**
* Imports an account file into the node's account database and assigns it to an account name.
*
* @param accountName The name the account file should be imported into
* @param accountData The JSON in the AVA Keystore File (AKF) format
* @param password The password that's used to encode the private keys in the AKF
*
* @returns A promise with a true-value on success.
*/
importAccount: (accountName: string, accountData: string, password: string) => Promise<boolean>;
importUser: (username: string, user: string, password: string) => Promise<boolean>;
/**
* Imports a private key into the node's database under an account and for a subnet.
* Lists the names of all users on the node.
*
* @param accountName The name of the account to store the private key
* @param password The password that unlocks the account
* @param subnetAlias The subnetID or subnetAlias to insert the private key
* @param privateKey A string representing the private key in the subnet's format
*
* @returns The address for the imported private key.
* @returns Promise of an array with all user names.
*/
importKey: (accountName: string, password: string, subnetAlias: string, privateKey: string) => Promise<string>;
listUsers: () => Promise<string[]>;
/**
* Lists the names of all accounts on the node.
*
* @returns Promise of an array with all account names.
*/
listAccounts: () => Promise<string[]>;
/**
* Lists all the addresses under a subnet on an account.
*
* @param accountName The account to list addresses for
* @param subnetAlias The subnet to list the addreses for
*
* @returns Promise of an array of address strings in the format specified by the subnet.
*/
listAddresses: (accountName: string, subnetAlias: string) => Promise<string[]>;
/**
* Lists all assets for a subnet on an address.
*
* @param subnetAlias The subnetID or subnetAlias the address is on
* @param address The address to get a list of assets for
*
* @returns Promise of an array of assetIDs for the address on the subnet.
*/
listAssets: (subnetAlias: string, address: string) => Promise<string[]>;
/**
* A list of all subnets supported by the wallet.
*
* @returns An array of subnetIDs which the wallet supports.
*/
listSubnets: () => Promise<string[]>;
/**
* Sends an amount of assetID to the specified address from a list of owned of addresses.
*
* @param accountName The account that owns the private keys associated with the `from` addresses
* @param password The password unlocking the account
* @param subnetAlias The subnetID or subnetAlias the asset resides on
* @param assetID The assetID of the asset to send
* @param amount The amount of the asset to be sent
* @param to The address of the recipient
* @param from An array of addresses managed by the node for this subnet which will fund this transaction
*
* @returns Promise for the string representing the transaction's ID.
*/
send: (accountName: string, password: string, subnetAlias: string, assetID: string, amount: number, to: string, from: string[]) => Promise<string>;
/**
* This class should not be instantiated directly. Instead use the [[Slopes.addAPI]] method.

@@ -146,0 +53,0 @@ *

@@ -32,15 +32,15 @@ "use strict";

/**
* Creates a account in the node's database.
* Creates a user in the node's database.
*
* @param accountName Name of the account to create
* @param password Password for the account
* @param username Name of the user to create
* @param password Password for the user
*
* @returns Promise for a boolean with true on success
*/
this.createAccount = (accountName, password) => __awaiter(this, void 0, void 0, function* () {
this.createUser = (username, password) => __awaiter(this, void 0, void 0, function* () {
let params = {
"accountName": accountName,
"username": username,
"password": password
};
return this.callMethod("keystore.createAccount", params).then((response) => {
return this.callMethod("keystore.createUser", params).then((response) => {
return response.data["result"]["success"];

@@ -50,122 +50,34 @@ });

/**
* Creates an address (and associated private keys) on an account under a subnet.
* Exports a user. The user can be imported to another node with keystore.importUser .
*
* @param accountName Name of the account to create the address under
* @param password Password to unlock the account and encrypt the private key
* @param subnetAlias The subnetID or subnetAlias which the address is created under
* @param username The name of the user to export
* @param password The password of the user to export
*
* @returns Promise for a string representing the address created by the subnet.
* @returns Promise with a string importable using importUser
*/
this.createAddress = (accountName, password, subnetAlias) => __awaiter(this, void 0, void 0, function* () {
this.exportUser = (username, password) => __awaiter(this, void 0, void 0, function* () {
let params = {
"accountName": accountName,
"password": password,
"subnetAlias": subnetAlias
};
return this.callMethod("keystore.createAddress", params).then((response) => {
return response.data["result"]["address"];
});
});
/**
* Exports and account, returning a string with the AVA Keystore File (AKF).
*
* @param accountName The name of the account to export
* @param password Not just anyone can export an account... you must have the password
*
* @returns Promise with a string representing the AVA Keystore File (AKF)
*/
this.exportAccount = (accountName, password) => __awaiter(this, void 0, void 0, function* () {
let params = {
"accountName": accountName,
"username": username,
"password": password
};
return this.callMethod("keystore.exportAccount", params).then((response) => {
return response.data["result"]["accountData"];
return this.callMethod("keystore.exportUser", params).then((response) => {
return response.data["result"]["user"];
});
});
/**
* Exports the private key for an address.
* Imports a user file into the node's user database and assigns it to a username.
*
* @param accountName The name of the account with the private key
* @param password The password used to decrypt the private key
* @param subnetAlias The subnetID or subnetAlias that the key exists under
* @param address The address whose private key should be exported
* @param username The name the user file should be imported into
* @param user AVA serialized string represetning a user's data
* @param password The user's password
*
* @returns Promise with the decrypted private key as store in the database
*/
this.exportKey = (accountName, password, subnetAlias, address) => __awaiter(this, void 0, void 0, function* () {
let params = {
"accountName": accountName,
"password": password,
"subnetAlias": subnetAlias,
"address": address
};
return this.callMethod("keystore.exportKey", params).then((response) => {
return response.data["result"]["privateKey"];
});
});
/**
* Gets the balances for all assets on the provided address on the provided subnet.
*
* @param subnetAlias The subnetID or subnetAlias that the address exists under
* @param address The address to pull the asset balances from
*
* @returns Promise with the key-value pair of assetID to balance.
*/
this.getAllBalances = (subnetAlias, address) => __awaiter(this, void 0, void 0, function* () {
let params = {
"subnetAlias": subnetAlias,
"address": address
};
return this.callMethod("keystore.getAllBalances", params).then((response) => {
return response.data["result"]["balances"];
});
});
/**
* Gets the balance of a particular asset on a subnet.
*
* @param subnetAlias The subnetID or subnetAlias that the address exists under
* @param address The address to pull the asset balance from
* @param assetID The assetID to pull the balance from
*
* @returns Promise with the balance of the assetID on the provided address for the subnet.
*/
this.getBalance = (subnetAlias, address, assetID) => __awaiter(this, void 0, void 0, function* () {
let params = {
"subnetAlias": subnetAlias,
"address": address,
"assetID": assetID
};
return this.callMethod("keystore.getBalance", params).then((response) => {
return response.data["result"]["balance"];
});
});
/**
* @ignore
*/
this.getTxHistory = (subnetAlias, address) => __awaiter(this, void 0, void 0, function* () {
let params = {
"subnetAlias": subnetAlias,
"address": address
};
return this.callMethod("keystore.getTxHistory", params).then((response) => {
return response.data["result"];
});
});
/**
* Imports an account file into the node's account database and assigns it to an account name.
*
* @param accountName The name the account file should be imported into
* @param accountData The JSON in the AVA Keystore File (AKF) format
* @param password The password that's used to encode the private keys in the AKF
*
* @returns A promise with a true-value on success.
*/
this.importAccount = (accountName, accountData, password) => __awaiter(this, void 0, void 0, function* () {
this.importUser = (username, user, password) => __awaiter(this, void 0, void 0, function* () {
let params = {
"accountName": accountName,
"accountData": accountData,
"usermame": username,
"user": user,
"password": password
};
return this.callMethod("keystore.importAccount", params).then((response) => {
return this.callMethod("keystore.importUser", params).then((response) => {
return response.data["result"]["success"];

@@ -175,106 +87,14 @@ });

/**
* Imports a private key into the node's database under an account and for a subnet.
* Lists the names of all users on the node.
*
* @param accountName The name of the account to store the private key
* @param password The password that unlocks the account
* @param subnetAlias The subnetID or subnetAlias to insert the private key
* @param privateKey A string representing the private key in the subnet's format
*
* @returns The address for the imported private key.
* @returns Promise of an array with all user names.
*/
this.importKey = (accountName, password, subnetAlias, privateKey) => __awaiter(this, void 0, void 0, function* () {
let params = {
"accountName": accountName,
"password": password,
"subnetAlias": subnetAlias,
"privateKey": privateKey
};
return this.callMethod("keystore.importKey", params).then((response) => {
return response.data["result"]["address"];
this.listUsers = () => __awaiter(this, void 0, void 0, function* () {
return this.callMethod("keystore.listUsers").then((response) => {
return response.data["result"]["users"];
});
});
/**
* Lists the names of all accounts on the node.
*
* @returns Promise of an array with all account names.
*/
this.listAccounts = () => __awaiter(this, void 0, void 0, function* () {
return this.callMethod("keystore.listAccounts").then((response) => {
return response.data["result"]["accounts"];
});
});
/**
* Lists all the addresses under a subnet on an account.
*
* @param accountName The account to list addresses for
* @param subnetAlias The subnet to list the addreses for
*
* @returns Promise of an array of address strings in the format specified by the subnet.
*/
this.listAddresses = (accountName, subnetAlias) => __awaiter(this, void 0, void 0, function* () {
let params = {
"accountName": accountName,
"subnetAlias": subnetAlias
};
return this.callMethod("keystore.listAddresses", params).then((response) => {
return response.data["result"]["addresses"];
});
});
/**
* Lists all assets for a subnet on an address.
*
* @param subnetAlias The subnetID or subnetAlias the address is on
* @param address The address to get a list of assets for
*
* @returns Promise of an array of assetIDs for the address on the subnet.
*/
this.listAssets = (subnetAlias, address) => __awaiter(this, void 0, void 0, function* () {
let params = {
"subnetAlias": subnetAlias,
"address": address
};
return this.callMethod("keystore.listAssets", params).then((response) => {
return response.data["result"]["assets"];
});
});
/**
* A list of all subnets supported by the wallet.
*
* @returns An array of subnetIDs which the wallet supports.
*/
this.listSubnets = () => __awaiter(this, void 0, void 0, function* () {
return this.callMethod("keystore.listSubnets").then((response) => {
return response.data["result"]["subnetIDs"];
});
});
/**
* Sends an amount of assetID to the specified address from a list of owned of addresses.
*
* @param accountName The account that owns the private keys associated with the `from` addresses
* @param password The password unlocking the account
* @param subnetAlias The subnetID or subnetAlias the asset resides on
* @param assetID The assetID of the asset to send
* @param amount The amount of the asset to be sent
* @param to The address of the recipient
* @param from An array of addresses managed by the node for this subnet which will fund this transaction
*
* @returns Promise for the string representing the transaction's ID.
*/
this.send = (accountName, password, subnetAlias, assetID, amount, to, from) => __awaiter(this, void 0, void 0, function* () {
let params = {
"accountName": accountName,
"password": password,
"subnetAlias": subnetAlias,
"assetID": assetID,
"amount": amount,
"to": to,
"from": from
};
return this.callMethod("keystore.send", params).then((response) => {
return response.data["result"]["txID"];
});
});
}
}
exports.default = KeystoreAPI;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2FwaXMva2V5c3RvcmUvYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7O0FBSUEsNkNBQThEO0FBRTlEOzs7Ozs7OztHQVFHO0FBQ0gsTUFBTSxXQUFZLFNBQVEsZUFBTztJQW1RN0I7Ozs7O09BS0c7SUFDSCxZQUFZLElBQWUsRUFBRSxVQUFpQixlQUFlO1FBQUcsS0FBSyxDQUFDLElBQUksRUFBRSxPQUFPLENBQUMsQ0FBQztRQXZRckY7Ozs7Ozs7V0FPRztRQUNILGtCQUFhLEdBQUcsQ0FBTyxXQUFrQixFQUFFLFFBQWUsRUFBbUIsRUFBRTtZQUMzRSxJQUFJLE1BQU0sR0FBRztnQkFDVCxhQUFhLEVBQUUsV0FBVztnQkFDMUIsVUFBVSxFQUFFLFFBQVE7YUFDdkIsQ0FBQztZQUNGLE9BQU8sSUFBSSxDQUFDLFVBQVUsQ0FBQyx3QkFBd0IsRUFBRSxNQUFNLENBQ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25zZURhdGEpID0+IHtcbiAgICAgICAgICAgIHJldHVybiByZXNwb25zZS5kYXRhW1wicmVzdWx0XCJdW1widXNlcnNcIl07XG4gICAgICAgIH0pO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoaXMgY2xhc3Mgc2hvdWxkIG5vdCBiZSBpbnN0YW50aWF0ZWQgZGlyZWN0bHkuIEluc3RlYWQgdXNlIHRoZSBbW1Nsb3Blcy5hZGRBUEldXSBtZXRob2QuXG4gICAgICogXG4gICAgICogQHBhcmFtIGNvcmUgQSByZWZlcmVuY2UgdG8gdGhlIFNsb3BlcyBjbGFzc1xuICAgICAqIEBwYXJhbSBiYXNldXJsIERlZmF1bHRzIHRvIHRoZSBzdHJpbmcgXCIvZXh0L2tleXN0b3JlXCIgYXMgdGhlIHBhdGggdG8gc3VibmV0cyBiYXNldXJsXG4gICAgICovXG4gICAgY29uc3RydWN0b3IoY29yZTpTbG9wZXNDb3JlLCBiYXNldXJsOnN0cmluZyA9IFwiL2V4dC9rZXlzdG9yZVwiKXsgc3VwZXIoY29yZSwgYmFzZXVybCk7IH1cbn1cblxuZXhwb3J0IGRlZmF1bHQgS2V5c3RvcmVBUEk7Il19

@@ -23,10 +23,21 @@ /**

/**
* Creates a new subnet.
* Creates a new blockchain.
*
* @param tx The string representation of a createSubnetTx
* @param vmID The VMID used to build the blockchain
* @param name A human-readable name for the new blockchain
* @param method The VMID's hook method for ingesting genesis data
* @param genesis The object used to build the initial state of the blockchain
*
* @returns Promise for a boolean value, true on success.
* @returns Promise for a string for the blockchainID.
*/
createSubnet: (tx: string) => Promise<boolean>;
createBlockchain: (vmID: string, name: string, method: string, genesis: object) => Promise<string>;
/**
* Creates a new blockchain.
*
* @param blockchainID The blockchainID requesting a status update
*
* @returns Promise for a string of one of: "Validating", "Created", "Preferred", "Unknown".
*/
getBlockchainStatus: (blockchainID: string) => Promise<string>;
/**
* Lists the current set of validators.

@@ -33,0 +44,0 @@ *

@@ -45,17 +45,38 @@ "use strict";

/**
* Creates a new subnet.
* Creates a new blockchain.
*
* @param tx The string representation of a createSubnetTx
* @param vmID The VMID used to build the blockchain
* @param name A human-readable name for the new blockchain
* @param method The VMID's hook method for ingesting genesis data
* @param genesis The object used to build the initial state of the blockchain
*
* @returns Promise for a boolean value, true on success.
* @returns Promise for a string for the blockchainID.
*/
this.createSubnet = (tx) => __awaiter(this, void 0, void 0, function* () {
this.createBlockchain = (vmID, name, method, genesis) => __awaiter(this, void 0, void 0, function* () {
let params = {
"tx": tx
"vmID": vmID,
"name": name,
"method": method,
"genesis": genesis
};
return this.callMethod("platform.createSubnet", params).then((response) => {
return response.data["result"]["success"];
return this.callMethod("platform.createBlockchain", params).then((response) => {
return response.data["result"]["blockchainID"];
});
});
/**
* Creates a new blockchain.
*
* @param blockchainID The blockchainID requesting a status update
*
* @returns Promise for a string of one of: "Validating", "Created", "Preferred", "Unknown".
*/
this.getBlockchainStatus = (blockchainID) => __awaiter(this, void 0, void 0, function* () {
let params = {
"blockchainID": blockchainID
};
return this.callMethod("platform.getBlockchainStatus", params).then((response) => {
return response.data["result"]["status"];
});
});
/**
* Lists the current set of validators.

@@ -79,3 +100,3 @@ *

let params = {
"size": sampleSize
"size": sampleSize.toString()
};

@@ -89,2 +110,2 @@ return this.callMethod("platform.sampleValidators", params).then((response) => {

exports.default = PlatformAPI;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2FwaXMvcGxhdGZvcm0vYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7O0FBSUEsNkNBQWlFO0FBRWpFOzs7Ozs7R0FNRztBQUNILE1BQU0sV0FBWSxTQUFRLGVBQU87SUE2RDdCOzs7OztPQUtHO0lBQ0gsWUFBWSxJQUFlLEVBQUUsVUFBaUIsZUFBZTtRQUFHLEtBQU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ldXJsOnN0cmluZyA9IFwiL2V4dC9wbGF0Zm9ybVwiKXsgc3VwZXIoY29yZSwgYmFzZXVybCk7IH1cbn1cblxuZXhwb3J0IGRlZmF1bHQgUGxhdGZvcm1BUEk7Il19

@@ -62,7 +62,7 @@ /**

export * from './utils/db';
export { Tx, TxUnsigned } from './apis/avm/tx';
export { UTXO, SecpUTXO, UTXOSet } from './apis/avm/utxos';
export { SigIdx, Signature, UnixNow, Address } from './apis/avm/types';
export { SecpOutput, Output, SelectOutputClass } from './apis/avm/outputs';
export { SecpInput, Input } from './apis/avm/inputs';
export { Tx, TxUnsigned, TxCreateAsset } from './apis/avm/tx';
export { UTXO, SecpUTXO, UTXOSet, SelectUTXOClass } from './apis/avm/utxos';
export { SigIdx, Signature, UnixNow, Address, AVMConstants, InitialStates } from './apis/avm/types';
export { SecpOutput, SecpOutBase, Output, SelectOutputClass } from './apis/avm/outputs';
export { SecpInput, Input, SelectInputClass } from './apis/avm/inputs';
export { AVMKeyPair, AVMKeyChain } from './apis/avm/keychain';

@@ -69,0 +69,0 @@ export { AVMAPI as AVM };

@@ -108,2 +108,3 @@ "use strict";

exports.TxUnsigned = tx_1.TxUnsigned;
exports.TxCreateAsset = tx_1.TxCreateAsset;
var utxos_1 = require("./apis/avm/utxos");

@@ -113,2 +114,3 @@ exports.UTXO = utxos_1.UTXO;

exports.UTXOSet = utxos_1.UTXOSet;
exports.SelectUTXOClass = utxos_1.SelectUTXOClass;
var types_1 = require("./apis/avm/types");

@@ -119,4 +121,7 @@ exports.SigIdx = types_1.SigIdx;

exports.Address = types_1.Address;
exports.AVMConstants = types_1.AVMConstants;
exports.InitialStates = types_1.InitialStates;
var outputs_1 = require("./apis/avm/outputs");
exports.SecpOutput = outputs_1.SecpOutput;
exports.SecpOutBase = outputs_1.SecpOutBase;
exports.Output = outputs_1.Output;

@@ -127,5 +132,6 @@ exports.SelectOutputClass = outputs_1.SelectOutputClass;

exports.Input = inputs_1.Input;
exports.SelectInputClass = inputs_1.SelectInputClass;
var keychain_1 = require("./apis/avm/keychain");
exports.AVMKeyPair = keychain_1.AVMKeyPair;
exports.AVMKeyChain = keychain_1.AVMKeyChain;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7O0FBQUE7O0dBRUc7QUFDSCxzREFBa0M7QUErRTFCLHFCQS9FRCxnQkFBVSxDQStFQztBQTlFbEIsOERBQThDO0FBaUd2QixtQkFqR2hCLGFBQVcsQ0FpR2E7QUFoRy9CLDhEQUE4QztBQWlHdkIsbUJBakdoQixhQUFXLENBaUdhO0FBaEcvQix5REFBb0M7QUE4RmxCLGNBOUZYLGFBQU0sQ0E4RlE7QUE3RnJCLDJEQUF3QztBQWdHcEIsZ0JBaEdiLGFBQVEsQ0FnR1U7QUEvRnpCLHlEQUEyQztBQXlFbkMsOEJBQVM7QUF4RWpCLGdFQUF3QztBQXNFaEMsbUJBdEVELGtCQUFRLENBc0VDO0FBckVoQixvREFBNEI7QUFzRXBCLGFBdEVELFlBQUUsQ0FzRUM7QUFwRVY7Ozs7Ozs7O0dBUUc7QUFDSCxNQUFhLE1BQU8sU0FBUSxnQkFBVTtJQThCbEM7Ozs7Ozs7OztPQVNHO0lBQ0gsWUFBWSxFQUFTLEVBQUUsSUFBVyxFQUFFLFdBQWtCLE1BQU0sRUFBRSxZQUFtQixDQUFDLEVBQUUsYUFBb0IsU0FBUyxFQUFFLFdBQW1CLEtBQUs7UUFDdkksS0FBSyxDQUFDLEVBQUUsRUFBRSxJQUFJLEVBQUUsUUFBUSxDQUFDLENBQUM7UUF2QzlCOztXQUVHO1FBQ0gsVUFBSyxHQUFHLEdBQUcsRUFBRTtZQUNULE9BQU8sSUFBSSxDQUFDLElBQUksQ0FBQyxPQUFP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B1dCwgSW5wdXQsIFNlbGVjdElucHV0Q2xhc3N9IGZyb20gJy4vYXBpcy9hdm0vaW5wdXRzJztcdFxuZXhwb3J0IHtBVk1LZXlQYWlyLCBBVk1LZXlDaGFpbn0gZnJvbSAnLi9hcGlzL2F2bS9rZXljaGFpbic7XG5cbmV4cG9ydCB7QVZNQVBJIGFzIEFWTX07XG5leHBvcnQge0tleXN0b3JlQVBJIGFzIEtleXN0b3JlfTtcbmV4cG9ydCB7UGxhdGZvcm1BUEkgYXMgUGxhdGZvcm19O1xuZXhwb3J0IHtBZG1pbkFQSSBhcyBBZG1pbn07XG5cblxuIl19

@@ -28,2 +28,14 @@ /**

/**
* Produces a string from a {@link https://github.com/feross/buffer|Buffer} representing a string.
*
* @param buff The {@link https://github.com/feross/buffer|Buffer} to convert to a string
*/
bufferToString: (buff: Buffer) => string;
/**
* Produces a {@link https://github.com/feross/buffer|Buffer} from a string.
*
* @param str The string to convert to a {@link https://github.com/feross/buffer|Buffer}
*/
stringToBuffer: (str: string) => Buffer;
/**
* Makes a copy (no reference) of a {@link https://github.com/feross/buffer|Buffer} over provided indecies.

@@ -99,2 +111,10 @@ *

avaDeserialize: (bytes: string | Buffer) => Buffer;
addressToString: (chainid: string, bytes: Buffer) => string;
stringToAddress: (address: string) => Buffer;
/**
* Takes an address and returns its {@link https://github.com/feross/buffer|Buffer} representation if valid.
*
* @returns A {@link https://github.com/feross/buffer|Buffer} for the address if valid, undefined if not valid.
*/
parseAddress: (addr: string, blockchainID: string, alias?: string, addrlen?: number) => Buffer;
}

@@ -101,0 +121,0 @@ /**

@@ -28,2 +28,21 @@ "use strict";

/**
* Produces a string from a {@link https://github.com/feross/buffer|Buffer} representing a string.
*
* @param buff The {@link https://github.com/feross/buffer|Buffer} to convert to a string
*/
this.bufferToString = (buff) => {
return this.copyFrom(buff, 2).toString("utf8");
};
/**
* Produces a {@link https://github.com/feross/buffer|Buffer} from a string.
*
* @param str The string to convert to a {@link https://github.com/feross/buffer|Buffer}
*/
this.stringToBuffer = (str) => {
let buff = buffer_1.Buffer.alloc(2 + str.length);
buff.writeUInt16BE(str.length, 0);
buff.write(str, 2, str.length, "utf8");
return buff;
};
/**
* Makes a copy (no reference) of a {@link https://github.com/feross/buffer|Buffer} over provided indecies.

@@ -151,2 +170,26 @@ *

};
this.addressToString = (chainid, bytes) => {
return chainid + "-" + this.avaSerialize(bytes);
};
this.stringToAddress = (address) => {
let parts = address.split("-");
return this.avaDeserialize(parts[1]);
};
/**
* Takes an address and returns its {@link https://github.com/feross/buffer|Buffer} representation if valid.
*
* @returns A {@link https://github.com/feross/buffer|Buffer} for the address if valid, undefined if not valid.
*/
this.parseAddress = (addr, blockchainID, alias = undefined, addrlen = 20) => {
let abc = addr.split("-");
if (abc.length == 2) {
if ((alias && abc[0] == alias) || (blockchainID && abc[0] == blockchainID)) {
let addrbuff = this.avaDeserialize(abc[1]);
if ((addrlen && addrbuff.length == addrlen) || !(addrlen)) {
return addrbuff;
}
}
}
return undefined;
};
this.b58 = new Base58();

@@ -274,2 +317,2 @@ }

exports.Base58 = Base58;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmludG9vbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdXRpbHMvYmludG9vbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQTs7R0FFRztBQUNILGtEQUF3QjtBQUN4QixvQ0FBK0I7QUFDL0IsOERBQXFDO0FBRXJDOzs7Ozs7Ozs7Ozs7R0FZRztBQUNILE1BQXFCLFFBQVE7SUFFekI7UUFnQkE7Ozs7OztXQU1HO1FBQ0gsYUFBUSxHQUFHLENBQUMsSUFBVyxFQUFFLFFBQWUsQ0FBQyxFQUFFLE1BQWEsU0FBUyxFQUFTLEVBQUU7WUFDeEUsSUFBSSxNQUFNLEdBQUcsR0FBRyxDQUFDO1lBQ2pCLElBQUcsR0FBRyx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blxuICAgICAgICBsZXQgYW5zaGV4ID0gYW5zd2VyLnRvU3RyaW5nKFwiaGV4XCIpO1xuICAgICAgICBhbnNoZXggPSBhbnNoZXgubGVuZ3RoICUgMiA/IFwiMFwiICsgYW5zaGV4IDogYW5zaGV4OyBcblxuICAgICAgICBsZXQgdG1wdmFsOkJ1ZmZlciA9IEJ1ZmZlci5mcm9tKGFuc2hleCwgXCJoZXhcIik7XG4gICAgICAgIGxldCBudW1aZXJvczpudW1iZXI7XG4gICAgICAgIGZvcihudW1aZXJvcyA9IDA7IG51bVplcm9zIDwgYi5sZW5ndGg7IG51bVplcm9zKyspe1xuICAgICAgICAgICAgaWYoYltudW1aZXJvc10gIT0gdGhpcy5hbHBoYWJldElkeDApe1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGxldCB4bGVuOm51bWJlciA9IG51bVplcm9zICsgdG1wdmFsLmxlbmd0aDtcbiAgICAgICAgbGV0IHJlc3VsdDpCdWZmZXIgPSBCdWZmZXIuYWxsb2MoeGxlbiwgMCk7XG4gICAgICAgIHRtcHZhbC5jb3B5KHJlc3VsdCwgbnVtWmVyb3MpO1xuXG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfVxufSJdfQ==
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmludG9vbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdXRpbHMvYmludG9vbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQTs7R0FFRztBQUNILGtEQUF3QjtBQUN4QixvQ0FBK0I7QUFDL0IsOERBQXFDO0FBRXJDOzs7Ozs7Ozs7Ozs7R0FZRztBQUNILE1BQXFCLFFBQVE7SUFFekI7UUFnQkE7Ozs7V0FJRztRQUNILG1CQUFjLEdBQUcsQ0FBQyxJQUFXLEVBQVMsRU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ICAgIGouaW11bCh0aGlzLmJpZzU4UmFkaXgpO1xuICAgICAgICB9XG5cbiAgICAgICAgbGV0IGFuc2hleCA9IGFuc3dlci50b1N0cmluZyhcImhleFwiKTtcbiAgICAgICAgYW5zaGV4ID0gYW5zaGV4Lmxlbmd0aCAlIDIgPyBcIjBcIiArIGFuc2hleCA6IGFuc2hleDsgXG5cbiAgICAgICAgbGV0IHRtcHZhbDpCdWZmZXIgPSBCdWZmZXIuZnJvbShhbnNoZXgsIFwiaGV4XCIpO1xuICAgICAgICBsZXQgbnVtWmVyb3M6bnVtYmVyO1xuICAgICAgICBmb3IobnVtWmVyb3MgPSAwOyBudW1aZXJvcyA8IGIubGVuZ3RoOyBudW1aZXJvcysrKXtcbiAgICAgICAgICAgIGlmKGJbbnVtWmVyb3NdICE9IHRoaXMuYWxwaGFiZXRJZHgwKXtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBsZXQgeGxlbjpudW1iZXIgPSBudW1aZXJvcyArIHRtcHZhbC5sZW5ndGg7XG4gICAgICAgIGxldCByZXN1bHQ6QnVmZmVyID0gQnVmZmVyLmFsbG9jKHhsZW4sIDApO1xuICAgICAgICB0bXB2YWwuY29weShyZXN1bHQsIG51bVplcm9zKTtcblxuICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH1cbn0iXX0=

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

protected privk: Buffer;
protected chainid: string;
/**

@@ -139,6 +140,24 @@ * Generates a new keypair.

*
* @returns A {@link https://github.com/feross/buffer|Buffer} representation of the address
*/
getAddress: () => Buffer;
/**
* Returns the address's string representation.
*
* @returns A string representation of the address
*/
getAddress: () => string;
constructor();
getAddressString: () => string;
/**
* Returns the chainID associated with this key.
*
* @returns The [[KeyPair]]'s chainID
*/
getChainID: () => string;
/**
* Sets the the chainID associated with this key.
*
* @param chainid String for the chainID
*/
setChainID: (chainid: string) => void;
constructor(chainid: string);
}

@@ -149,3 +168,3 @@ /**

*
* @typeparam KPClass Class extending [[KeyPair]] which is used as the key in [[KeyChain]]
* @typeparam KPClass extending [[KeyPair]] which is used as the key in [[KeyChain]]
*/

@@ -156,38 +175,45 @@ export declare class KeyChain<KPClass extends KeyPair> {

};
protected chainid: string;
/**
* Makes a new key pair, returns the address.
* Makes a new [[KeyPair]], returns the address.
*
* @param entropy Optional parameter that may be necessary to produce secure keys
*
* @returns Address of the new key pair
* @returns Address of the new [[KeyPair]]
*/
makeKey: (entropy?: Buffer) => string;
makeKey: (entropy?: Buffer) => Buffer;
/**
* Given a private key, makes a new key pair, returns the address.
* Given a private key, makes a new [[KeyPair]], returns the address.
*
* @param privk A {@link https://github.com/feross/buffer|Buffer} representing the private key
*
* @returns Address of the new key pair
* @returns Address of the new [[KeyPair]]
*/
importKey: (privk: Buffer) => string;
importKey: (privk: Buffer) => Buffer;
/**
* Gets an array of addresses stored in the key chain.
* Gets an array of addresses stored in the [[KeyChain]].
*
* @returns An array of {@link https://github.com/feross/buffer|Buffer} representations of the addresses
*/
getAddresses: () => Buffer[];
/**
* Gets an array of addresses stored in the [[KeyChain]].
*
* @returns An array of string representations of the addresses
*/
getAddresses: () => string[];
getAddressStrings: () => string[];
/**
* Adds the key pair to the list of the keys managed in the keychain.
* Adds the key pair to the list of the keys managed in the [[KeyChain]].
*
* @param newKey A key pair of the appropriate class to be added to the keychain
* @param newKey A key pair of the appropriate class to be added to the [[KeyChain]]
*/
addKey: (newKey: KPClass) => void;
/**
* Removes the key pair from the list of they keys managed in the keychain.
* Removes the key pair from the list of they keys managed in the [[KeyChain]].
*
* @param key A string for the address or KPClass to remove
* @param key A {@link https://github.com/feross/buffer|Buffer} for the address or KPClass to remove
*
* @returns The boolean true if a key was removed.
*/
removeKey: (key: string | KPClass) => boolean;
removeKey: (key: Buffer | KPClass) => boolean;
/**

@@ -200,15 +226,27 @@ * Checks if there is a key associated with the provided address.

*/
hasKey: (address: string) => boolean;
hasKey: (address: Buffer) => boolean;
/**
* Returns the key pair listed under the provided address
* Returns the [[KeyPair]] listed under the provided address
*
* @param address The address to retrieve from the keys database
* @param address The {@link https://github.com/feross/buffer|Buffer} of the address to retrieve from the keys database
*
* @returns A reference to the key pair in the keys database
* @returns A reference to the [[KeyPair]] in the keys database
*/
getKey: (address: string) => KPClass;
getKey: (address: Buffer) => KPClass;
/**
* Returns instance of KeyChain.
* Returns the chainID associated with this [[KeyChain]].
*
* @returns The [[KeyChain]]'s chainID
*/
constructor();
getChainID: () => string;
/**
* Sets the the chainID associated with this [[KeyChain]] and all associated keypairs.
*
* @param chainid String for the chainID
*/
setChainID: (chainid: string) => void;
/**
* Returns instance of [[KeyChain]].
*/
constructor(chainid: string);
}

@@ -234,3 +272,3 @@ /**

*/
fromString: (b58str: string) => number;
fromString(b58str: string): number;
/**

@@ -241,3 +279,3 @@ * Takes a [[Buffer]], verifies its length, and stores it.

*/
fromBuffer: (buff: Buffer) => number;
fromBuffer(buff: Buffer): number;
/**

@@ -248,3 +286,3 @@ * Returns the stored {@link https://github.com/feross/buffer|Buffer}.

*/
toBuffer: () => Buffer;
toBuffer(): Buffer;
/**

@@ -255,3 +293,3 @@ * Returns a base-58 string of the stored {@link https://github.com/feross/buffer|Buffer}.

*/
toString: () => string;
toString(): string;
/**

@@ -262,2 +300,40 @@ * Returns instance of [[NBytes]].

}
export declare class Defaults {
static network: {
1: {};
2: {
"avm": object;
"X": object;
"HD8HEwNKTXRBcVUqvQW2LRu9izqej91xzGmXATF4KMMV6LLm7": object;
"platform": object;
"P": object;
"BCID1": object;
"contracts": object;
"C": object;
"BCID2": object;
};
49: {
"avm": object;
"X": object;
"HD8HEwNKTXRBcVUqvQW2LRu9izqej91xzGmXATF4KMMV6LLm7": object;
"platform": object;
"P": object;
"BCID1": object;
"contracts": object;
"C": object;
"BCID2": object;
};
12345: {
"avm": object;
"X": object;
"GJABrZ9A6UQFpwjPU8MDxDd8vuyRoDVeDAXc694wJ5t3zEkhU": object;
"platform": object;
"P": object;
"BCID1": object;
"contracts": object;
"C": object;
"BCID2": object;
};
};
}
//# sourceMappingURL=types.d.ts.map

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

class KeyPair {
constructor() {
constructor(chainid) {
this.chainid = "";
/**

@@ -151,2 +152,19 @@ * Returns a reference to the private key.

};
/**
* Returns the chainID associated with this key.
*
* @returns The [[KeyPair]]'s chainID
*/
this.getChainID = () => {
return this.chainid;
};
/**
* Sets the the chainID associated with this key.
*
* @param chainid String for the chainID
*/
this.setChainID = (chainid) => {
this.chainid = chainid;
};
this.chainid = chainid;
}

@@ -159,30 +177,40 @@ }

*
* @typeparam KPClass Class extending [[KeyPair]] which is used as the key in [[KeyChain]]
* @typeparam KPClass extending [[KeyPair]] which is used as the key in [[KeyChain]]
*/
class KeyChain {
/**
* Returns instance of KeyChain.
* Returns instance of [[KeyChain]].
*/
constructor() {
constructor(chainid) {
this.keys = {};
this.chainid = "";
/**
* Gets an array of addresses stored in the key chain.
* Gets an array of addresses stored in the [[KeyChain]].
*
* @returns An array of string representations of the addresses
* @returns An array of {@link https://github.com/feross/buffer|Buffer} representations of the addresses
*/
this.getAddresses = () => {
return Object.keys(this.keys);
return Object.values(this.keys).map(kp => kp.getAddress());
};
/**
* Adds the key pair to the list of the keys managed in the keychain.
* Gets an array of addresses stored in the [[KeyChain]].
*
* @param newKey A key pair of the appropriate class to be added to the keychain
* @returns An array of string representations of the addresses
*/
this.getAddressStrings = () => {
return Object.values(this.keys).map(kp => kp.getAddressString());
};
/**
* Adds the key pair to the list of the keys managed in the [[KeyChain]].
*
* @param newKey A key pair of the appropriate class to be added to the [[KeyChain]]
*/
this.addKey = (newKey) => {
this.keys[newKey.getAddress()] = newKey;
newKey.setChainID(this.chainid);
this.keys[newKey.getAddress().toString("hex")] = newKey;
};
/**
* Removes the key pair from the list of they keys managed in the keychain.
* Removes the key pair from the list of they keys managed in the [[KeyChain]].
*
* @param key A string for the address or KPClass to remove
* @param key A {@link https://github.com/feross/buffer|Buffer} for the address or KPClass to remove
*

@@ -193,7 +221,7 @@ * @returns The boolean true if a key was removed.

let kaddr;
if (typeof key !== "string") {
kaddr = key.getAddress();
if (key instanceof buffer_1.Buffer) {
kaddr = key.toString("hex");
}
else {
kaddr = key;
kaddr = key.getAddress().toString("hex");
}

@@ -216,14 +244,34 @@ if (kaddr in this.keys) {

this.hasKey = (address) => {
return (address in this.keys);
return (address.toString("hex") in this.keys);
};
/**
* Returns the key pair listed under the provided address
* Returns the [[KeyPair]] listed under the provided address
*
* @param address The address to retrieve from the keys database
* @param address The {@link https://github.com/feross/buffer|Buffer} of the address to retrieve from the keys database
*
* @returns A reference to the key pair in the keys database
* @returns A reference to the [[KeyPair]] in the keys database
*/
this.getKey = (address) => {
return this.keys[address];
return this.keys[address.toString("hex")];
};
/**
* Returns the chainID associated with this [[KeyChain]].
*
* @returns The [[KeyChain]]'s chainID
*/
this.getChainID = () => {
return this.chainid;
};
/**
* Sets the the chainID associated with this [[KeyChain]] and all associated keypairs.
*
* @param chainid String for the chainID
*/
this.setChainID = (chainid) => {
this.chainid = chainid;
for (let address in this.keys) {
this.keys[address].setChainID(chainid);
}
};
this.chainid = chainid;
}

@@ -250,59 +298,113 @@ }

};
/**
* Takes a base-58 encoded string, verifies its length, and stores it.
*
* @returns The size of the {@link https://github.com/feross/buffer|Buffer}
*/
this.fromString = (b58str) => {
try {
this.fromBuffer(bintools.b58ToBuffer(b58str));
}
catch (e) {
}
/**
* Takes a base-58 encoded string, verifies its length, and stores it.
*
* @returns The size of the {@link https://github.com/feross/buffer|Buffer}
*/
fromString(b58str) {
try {
this.fromBuffer(bintools.b58ToBuffer(b58str));
}
catch (e) {
/* istanbul ignore next */
let emsg = "Error - NBytes.fromString: " + e;
/* istanbul ignore next */
throw new Error(emsg);
}
return this.bsize;
}
/**
* Takes a [[Buffer]], verifies its length, and stores it.
*
* @returns The size of the {@link https://github.com/feross/buffer|Buffer}
*/
fromBuffer(buff) {
try {
if (buff.length != this.bsize) {
/* istanbul ignore next */
let emsg = "Error - NBytes.fromString: " + e;
/* istanbul ignore next */
throw new Error(emsg);
throw new Error("Buffer length must be exactly " + this.bsize + " bytes.");
}
return this.bsize;
};
/**
* Takes a [[Buffer]], verifies its length, and stores it.
*
* @returns The size of the {@link https://github.com/feross/buffer|Buffer}
*/
this.fromBuffer = (buff) => {
try {
if (buff.length != this.bsize) {
/* istanbul ignore next */
throw new Error("Buffer length must be exactly " + this.bsize + " bytes.");
}
this.bytes = buffer_1.Buffer.from(buff);
}
catch (e) {
/* istanbul ignore next */
let emsg = "Error - NBytes.fromBuffer: " + e;
/* istanbul ignore next */
throw new Error(emsg);
}
return this.bsize;
};
/**
* Returns the stored {@link https://github.com/feross/buffer|Buffer}.
*
* @returns A reference to the stored {@link https://github.com/feross/buffer|Buffer}
*/
this.toBuffer = () => {
return this.bytes;
};
/**
* Returns a base-58 string of the stored {@link https://github.com/feross/buffer|Buffer}.
*
* @returns A base-58 string of the stored {@link https://github.com/feross/buffer|Buffer}
*/
this.toString = () => {
return bintools.bufferToB58(this.toBuffer());
};
this.bytes = buffer_1.Buffer.from(buff);
}
catch (e) {
/* istanbul ignore next */
let emsg = "Error - NBytes.fromBuffer: " + e;
/* istanbul ignore next */
throw new Error(emsg);
}
return this.bsize;
}
/**
* Returns the stored {@link https://github.com/feross/buffer|Buffer}.
*
* @returns A reference to the stored {@link https://github.com/feross/buffer|Buffer}
*/
toBuffer() {
return this.bytes;
}
/**
* Returns a base-58 string of the stored {@link https://github.com/feross/buffer|Buffer}.
*
* @returns A base-58 string of the stored {@link https://github.com/feross/buffer|Buffer}
*/
toString() {
return bintools.bufferToB58(this.toBuffer());
}
}
exports.NBytes = NBytes;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdXRpbHMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Oz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3N0KGVwLCB7fSwgSlNPTi5zdHJpbmdpZnkocnBjKSwgaGVhZGVycywgYXhDb25mKS50aGVuKCAocmVzcDpSZXF1ZXN0UmVzcG9uc2VEYXRhKSA9PiB7XG4gICAgICAgICAgICBpZihyZXNwLnN0YXR1cyA+PSAyMDAgJiYgcmVzcC5zdGF0dXMgPCAzMDApe1xuICAgICAgICAgICAgICAgIHRoaXMucnBjaWQgKz0gMTtcbiAgICAgICAgICAgICAgICBpZih0eXBlb2YgcmVzcC5kYXRhID09PSBcInN0cmluZ1wiKXtcbiAgICAgICAgICAgICAgICAgICAgcmVzcC5kYXRhID0gSlNPTi5wYXJzZShyZXNwLmRhdGEpO1xuICAgICAgICAgICAgICAgICAgICBcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYodHlwZW9mIHJlc3AuZGF0YSA9PT0gJ29iamVjdCcgJiYgJ2Vycm9yJyBpbiByZXNwLmRhdGEpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiRXJyb3IgcmV0dXJuZWQ6IFwiICsgSlNPTi5zdHJpbmdpZnkocmVzcC5kYXRhKSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiByZXNwO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICB9ICAgXG5cbiAgICAvKipcbiAgICAgKiBSZXR1cm5zIHRoZSBycGNpZCwgYSBzdHJpY3RseS1pbmNyZWFzaW5nIG51bWJlciwgc3RhcnRpbmcgZnJvbSAxLCBpbmRpY2F0aW5nIHRoZSBuZXh0IHJlcXVlc3QgSUQgdGhhdCB3aWxsIGJlIHNlbnQuXG4gICAgICovXG4gICAgZ2V0UlBDSUQgPSAoKTpudW1iZXIgPT4ge1xuICAgICAgICByZXR1cm4gdGhpcy5ycGNpZDtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBcbiAgICAgKiBAcGFyYW0gY29yZSBSZWZlcmVuY2UgdG8g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tAbGluayBodHRwczovL2dpdGh1Yi5jb20vZmVyb3NzL2J1ZmZlcnxCdWZmZXJ9LlxuICAgICAqIFxuICAgICAqIEByZXR1cm5zIEEgYmFzZS01OCBzdHJpbmcgb2YgdGhlIHN0b3JlZCB7QGxpbmsgaHR0cHM6Ly9naXRodWIuY29tL2Zlcm9zcy9idWZmZXJ8QnVmZmVyfVxuICAgICAqL1xuICAgIHRvU3RyaW5nID0gKCk6c3RyaW5nID0+IHtcbiAgICAgICAgcmV0dXJuIGJpbnRvb2xzLmJ1ZmZlclRvQjU4KHRoaXMudG9CdWZmZXIoKSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFJldHVybnMgaW5zdGFuY2Ugb2YgW1tOQnl0ZXNdXS5cbiAgICAgKi9cbiAgICBjb25zdHJ1Y3RvcigpIHt9XG59XG4iXX0=
let n2_avm = {
blockchainID: "HD8HEwNKTXRBcVUqvQW2LRu9izqej91xzGmXATF4KMMV6LLm7",
alias: "X",
vm: "avm"
};
let n2_platform = {
blockchainID: "",
alias: "P",
vm: "platform"
};
let n2_contracts = {
blockchainID: "",
alias: "C",
vm: "contracts"
};
class Defaults {
}
exports.Defaults = Defaults;
Defaults.network = {
1: {},
2: {
"avm": n2_avm,
"X": n2_avm,
"HD8HEwNKTXRBcVUqvQW2LRu9izqej91xzGmXATF4KMMV6LLm7": n2_avm,
"platform": n2_platform,
"P": n2_platform,
"BCID1": n2_platform,
"contracts": n2_contracts,
"C": n2_contracts,
"BCID2": n2_contracts
},
49: {
"avm": n2_avm,
"X": n2_avm,
"HD8HEwNKTXRBcVUqvQW2LRu9izqej91xzGmXATF4KMMV6LLm7": n2_avm,
"platform": n2_platform,
"P": n2_platform,
"BCID1": n2_platform,
"contracts": n2_contracts,
"C": n2_contracts,
"BCID2": n2_contracts
},
12345: {
"avm": n2_avm,
"X": n2_avm,
"GJABrZ9A6UQFpwjPU8MDxDd8vuyRoDVeDAXc694wJ5t3zEkhU": n2_avm,
"platform": n2_platform,
"P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OUE2VVFGcHdqUFU4TUR4RGQ4dnV5Um9EVmVEQVhjNjk0d0o1dDN6RWtoVVwiOiBuMl9hdm0sXG4gICAgICAgICAgICBcInBsYXRmb3JtXCI6IG4yX3BsYXRmb3JtLFxuICAgICAgICAgICAgXCJQXCI6IG4yX3BsYXRmb3JtLFxuICAgICAgICAgICAgXCJCQ0lEMVwiOiBuMl9wbGF0Zm9ybSxcbiAgICAgICAgICAgIFwiY29udHJhY3RzXCI6IG4yX2NvbnRyYWN0cyxcbiAgICAgICAgICAgIFwiQ1wiOiBuMl9jb250cmFjdHMsXG4gICAgICAgICAgICBcIkJDSUQyXCI6IG4yX2NvbnRyYWN0c1xuICAgICAgICB9XG4gICAgfTtcbn0iXX0=

@@ -29,4 +29,4 @@ "use strict";

set = new utxos_1.UTXOSet();
keymgr1 = new keychain_1.AVMKeyChain();
keymgr2 = new keychain_1.AVMKeyChain();
keymgr1 = new keychain_1.AVMKeyChain("X");
keymgr2 = new keychain_1.AVMKeyChain("X");
addrs1 = [];

@@ -70,3 +70,3 @@ addrs2 = [];

expect(input.getUTXOID()).toBe(u.getUTXOID());
expect(input.getInputID()).toBe(types_1.Constants.SECPINPUTID);
expect(input.getInputID()).toBe(types_1.AVMConstants.SECPINPUTID);
input.addSignatureIdx(0, addrs2[0]);

@@ -91,2 +91,2 @@ input.addSignatureIdx(1, addrs2[1]);

});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXRzLnRlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi90ZXN0cy9hcGlzL2F2bS9pbnB1dHMudGVzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLDhDQUE2RDtBQUM3RCxvREFBb0Q7QUFDcEQsZ0RBQXVEO0FBQ3ZELDhEQUFxQztBQUNyQyxrRUFBMEM7QUFDMUMsa0RBQXVCO0FBQ3ZCLG9DQUErQj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HhJZHgoKSwgdXR4b3NbMF0uZ2V0QW1vdW50KCksIHV0eG9zWzBdLmdldEFzc2V0SUQoKSk7XG4gICAgICAgIGxldCBpbjI6U2VjcElucHV0ID0gbmV3IFNlY3BJbnB1dCh1dHhvc1sxXS5nZXRUeElEKCksIHV0eG9zWzFdLmdldFR4SWR4KCksIHV0eG9zWzFdLmdldEFtb3VudCgpLCB1dHhvc1sxXS5nZXRBc3NldElEKCkpO1xuICAgICAgICBsZXQgaW4zOlNlY3BJbnB1dCA9IG5ldyBTZWNwSW5wdXQodXR4b3NbMl0uZ2V0VHhJRCgpLCB1dHhvc1syXS5nZXRUeElkeCgpLCB1dHhvc1syXS5nZXRBbW91bnQoKSwgdXR4b3NbMl0uZ2V0QXNzZXRJRCgpKTtcblxuICAgICAgICBsZXQgY21wID0gU2VjcElucHV0LmNvbXBhcmF0b3IoKTtcbiAgICAgICAgZXhwZWN0KGNtcChpbjEsIGluMikpLnRvQmUoLTEpO1xuICAgICAgICBleHBlY3QoY21wKGluMSwgaW4zKSkudG9CZSgtMSk7XG4gICAgICAgIGV4cGVjdChjbXAoaW4xLCBpbjEpKS50b0JlKDApO1xuICAgICAgICBleHBlY3QoY21wKGluMiwgaW4yKSkudG9CZSgwKTtcbiAgICAgICAgZXhwZWN0KGNtcChpbjMsIGluMykpLnRvQmUoMCk7XG4gICAgfSk7XG5cbn0pOyJdfQ==

@@ -11,5 +11,6 @@ "use strict";

const bintools = bintools_1.default.getInstance();
const alias = "X";
describe('AVMKeyPair', () => {
test('repeatable 1', () => {
let kp = new keychain_1.AVMKeyPair();
let kp = new keychain_1.AVMKeyPair(alias);
kp.importKey(buffer_1.Buffer.from("ef9bf2d4436491c153967c9709dd8e82795bdb9b5ad44ee22c2903005d1cf676", "hex"));

@@ -24,3 +25,3 @@ expect(kp.getPublicKey().toString("hex")).toBe("033fad3644deb20d7a210d12757092312451c112d04773cee2699fbb59dc8bb2ef");

test('repeatable 2', () => {
let kp = new keychain_1.AVMKeyPair();
let kp = new keychain_1.AVMKeyPair(alias);
kp.importKey(buffer_1.Buffer.from("17c692d4a99d12f629d9f0ff92ec0dba15c9a83e85487b085c1a3018286995c6", "hex"));

@@ -35,3 +36,3 @@ expect(kp.getPublicKey().toString("hex")).toBe("02486553b276cfe7abf0efbcd8d173e55db9c03da020c33d0b219df24124da18ee");

test('repeatable 3', () => {
let kp = new keychain_1.AVMKeyPair();
let kp = new keychain_1.AVMKeyPair(alias);
kp.importKey(buffer_1.Buffer.from("d0e17d4b31380f96a42b3e9ffc4c1b2a93589a1e51d86d7edc107f602fbc7475", "hex"));

@@ -46,3 +47,3 @@ expect(kp.getPublicKey().toString("hex")).toBe("031475b91d4fcf52979f1cf107f058088cc2bea6edd51915790f27185a7586e2f2");

test('Creation Empty', () => {
let kp = new keychain_1.AVMKeyPair();
let kp = new keychain_1.AVMKeyPair(alias);
expect(kp.getPrivateKey()).not.toBeUndefined();

@@ -63,4 +64,4 @@ expect(kp.getAddress()).not.toBeUndefined();

let keybuff = buffer_1.Buffer.from("d0e17d4b31380f96a42b3e9ffc4c1b2a93589a1e51d86d7edc107f602fbc7475", "hex");
let kc = new keychain_1.AVMKeyChain();
let kp2 = new keychain_1.AVMKeyPair();
let kc = new keychain_1.AVMKeyChain(alias);
let kp2 = new keychain_1.AVMKeyPair(alias);
let addr1 = kc.importKey(keybuff);

@@ -70,3 +71,3 @@ let kp1 = kc.getKey(addr1);

let addr2 = kp1.getAddress();
expect(addr1).toBe(addr2);
expect(addr1.toString("hex")).toBe(addr2.toString("hex"));
expect(kp1.getPrivateKeyString()).toBe(kp2.getPrivateKeyString());

@@ -78,4 +79,4 @@ expect(kp1.getPublicKeyString()).toBe(kp2.getPublicKeyString());

let keybuff = buffer_1.Buffer.from("d0e17d4b31380f96a42b3e9ffc4c1b2a93589a1e51d86d7edc107f602fbc7475", "hex");
let kc = new keychain_1.AVMKeyChain();
let kp2 = new keychain_1.AVMKeyPair();
let kc = new keychain_1.AVMKeyChain(alias);
let kp2 = new keychain_1.AVMKeyPair(alias);
let addr1 = kc.importKey(bintools.avaSerialize(keybuff));

@@ -85,3 +86,3 @@ let kp1 = kc.getKey(addr1);

let addr2 = kp1.getAddress();
expect(addr1).toBe(addr2);
expect(addr1.toString("hex")).toBe(addr2.toString("hex"));
expect(kp1.getPrivateKeyString()).toBe(kp2.getPrivateKeyString());

@@ -93,4 +94,4 @@ expect(kp1.getPublicKeyString()).toBe(kp2.getPublicKeyString());

let keybuff = buffer_1.Buffer.from("d0e17d4b31380f96a42b3e9ffc4c1b2a93589a1e51d86d7edc107f602fbc7475", "hex");
let kc = new keychain_1.AVMKeyChain();
let kp1 = new keychain_1.AVMKeyPair();
let kc = new keychain_1.AVMKeyChain(alias);
let kp1 = new keychain_1.AVMKeyPair(alias);
let addr1 = kc.importKey(keybuff);

@@ -104,3 +105,3 @@ kp1.importKey(keybuff);

let keybuff = buffer_1.Buffer.from("d0e17d4b31380f96a42b3e9ffc4c1b2a93589a1e51d86d7edc107f602fbc7475", "hex");
let kc = new keychain_1.AVMKeyChain();
let kc = new keychain_1.AVMKeyChain(alias);
let addr1 = kc.importKey(keybuff);

@@ -113,8 +114,8 @@ expect(kc.hasKey(addr1)).toBe(true);

let keybuff = buffer_1.Buffer.from("d0e17d4b31380f96a42b3e9ffc4c1b2a93589a1e51d86d7edc107f602fbc7475", "hex");
let kc = new keychain_1.AVMKeyChain();
let kc = new keychain_1.AVMKeyChain(alias);
let addr1 = kc.importKey(keybuff);
expect(kc.hasKey(addr1)).toBe(true);
expect(kc.removeKey("6Y3kysjF9jnHnYkdS9yGAuoHyae2eNmeV")).toBe(false);
expect(kc.removeKey(bintools.avaDeserialize("6Y3kysjF9jnHnYkdS9yGAuoHyae2eNmeV"))).toBe(false);
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoia2V5Y2hhaW4udGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4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1ZmYpO1xuICAgICAgICBleHBlY3Qoa2MuaGFzS2V5KGFkZHIxKSkudG9CZSh0cnVlKTtcbiAgICAgICAga2MucmVtb3ZlS2V5KGFkZHIxKTtcbiAgICAgICAgZXhwZWN0KGtjLmhhc0tleShhZGRyMSkpLnRvQmUoZmFsc2UpO1xuICAgIH0pO1xuXG4gICAgdGVzdCgncmVtb3ZlS2V5IGJhZCBrZXlzJywgKCkgPT4ge1xuICAgICAgICBsZXQga2V5YnVmZjpCdWZmZXIgPSBCdWZmZXIuZnJvbShcImQwZTE3ZDRiMzEzODBmOTZhNDJiM2U5ZmZjNGMxYjJhOTM1ODlhMWU1MWQ4NmQ3ZWRjMTA3ZjYwMmZiYzc0NzVcIiwgXCJoZXhcIik7XG4gICAgICAgIGxldCBrYzpBVk1LZXlDaGFpbiA9IG5ldyBBVk1LZXlDaGFpbihhbGlhcyk7XG4gICAgICAgIGxldCBhZGRyMTpCdWZmZXIgPSBrYy5pbXBvcnRLZXkoa2V5YnVmZik7XG4gICAgICAgIGV4cGVjdChrYy5oYXNLZXkoYWRkcjEpKS50b0JlKHRydWUpO1xuICAgICAgICBleHBlY3Qoa2MucmVtb3ZlS2V5KGJpbnRvb2xzLmF2YURlc2VyaWFsaXplKFwiNlkza3lzakY5am5IbllrZFM5eUdBdW9IeWFlMmVObWVWXCIpKSkudG9CZShmYWxzZSk7XG4gICAgfSk7XG59KTsiXX0=

@@ -15,5 +15,5 @@ "use strict";

let addrs = [
"B6D4v1VtPYLbiUvYXtW4Px8oE9imC2vGW",
"P5wdRuZeaDt28eHMP5S3w9ZdoBfo7wuzF",
"6Y3kysjF9jnHnYkdS9yGAuoHyae2eNmeV"
bintools.avaDeserialize("B6D4v1VtPYLbiUvYXtW4Px8oE9imC2vGW"),
bintools.avaDeserialize("P5wdRuZeaDt28eHMP5S3w9ZdoBfo7wuzF"),
bintools.avaDeserialize("6Y3kysjF9jnHnYkdS9yGAuoHyae2eNmeV")
].sort();

@@ -48,6 +48,3 @@ let locktime = new bn_js_1.default(54321);

expect(out.getOutputID()).toBe(4);
expect(JSON.stringify(Object.keys(out.getAddresses()).sort())).toBe(JSON.stringify(addrs.sort()));
expect(out.getAddresses()[addrs[0]].toNumber()).toBe(locktime.toNumber());
expect(out.getAddresses()[addrs[1]].toNumber()).toBe(locktime.toNumber());
expect(out.getAddresses()[addrs[2]].toNumber()).toBe(locktime.toNumber());
expect(JSON.stringify(out.getAddresses().sort())).toStrictEqual(JSON.stringify(addrs.sort()));
expect(out.getThreshold()).toBe(3);

@@ -57,3 +54,3 @@ expect(out.getLocktime().toNumber()).toBe(locktime.toNumber());

let r = out.getAddressIdx(addrs[2]);
expect(out.getAddress(r)).toBe(addrs[2]);
expect(out.getAddress(r)).toStrictEqual(addrs[2]);
expect(() => {

@@ -77,2 +74,2 @@ out.getAddress(400);

});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0cHV0cy50ZXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vdGVzdHMvYXBpcy9hdm0vb3V0cHV0cy50ZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsa0RBQXVCO0FBQ3ZCLG9DQUErQjtBQUMvQixrRUFBMEM7QUFDMUMsa0RBQTZFO0FBRzdFLE1BQU0sUUFBUSxHQUFHLGtCQUFRLENBQUMsV0FBVyxFQUFFLENBQUM7QUFFeEMsUUFBUSxDQUFDLFNBQVMsRUFBRSxHQUFHLEVBQUU7SUFDckIsSUFBSSxPQUFPLEdBQVUsa0VBQWtFLENBQUM7SUFDeEYsSUFBSSxXQUFXLEdBQVUsZUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLEVBQUUsS0FBSyxDQUFDLENBQUM7SUFDckQsSUFBSSxLQUFLLEdBQWlCO1FBQ3RCLG1DQUFtQztRQUNuQyxtQ0FBbUM7UUFDbkMsbUNBQW1DO0tBQ3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LCBsb2NrdGltZS5hZGQobmV3IEJOKDEwMCkpKTtcbiAgICAgICAgZXhwZWN0KG00KS50b0JlKHRydWUpO1xuICAgIH0pO1xufSk7Il19

@@ -16,2 +16,3 @@ "use strict";

const types_1 = require("src/apis/avm/types");
const types_2 = require("../../../src/apis/avm/types");
/**

@@ -35,8 +36,9 @@ * @ignore

let blockchainID = buffer_1.Buffer.from(create_hash_1.default("sha256").update("I am the very model of a modern major general").digest());
let alias = "X";
let assetID = buffer_1.Buffer.from(create_hash_1.default("sha256").update("mary had a little lamb").digest());
beforeEach(() => {
set = new utxos_1.UTXOSet();
keymgr1 = new keychain_1.AVMKeyChain();
keymgr2 = new keychain_1.AVMKeyChain();
keymgr3 = new keychain_1.AVMKeyChain();
keymgr1 = new keychain_1.AVMKeyChain(alias);
keymgr2 = new keychain_1.AVMKeyChain(alias);
keymgr3 = new keychain_1.AVMKeyChain(alias);
addrs1 = [];

@@ -126,3 +128,49 @@ addrs2 = [];

});
test('Asset Creation Tx', () => {
let secpbase1 = new outputs_1.SecpOutBase(new bn_js_1.default(777), addrs3);
let secpbase2 = new outputs_1.SecpOutBase(new bn_js_1.default(888), addrs2);
let secpbase3 = new outputs_1.SecpOutBase(new bn_js_1.default(999), addrs2);
let initialState = new types_2.InitialStates();
initialState.addOutput(secpbase1, types_1.AVMConstants.SECPFXID);
initialState.addOutput(secpbase2, types_1.AVMConstants.SECPFXID);
initialState.addOutput(secpbase3, types_1.AVMConstants.SECPFXID);
let name = "Rickcoin is the most intelligent coin";
let symbol = "RICK";
let denomination = 9;
let txu = new tx_1.TxCreateAsset(name, symbol, denomination, initialState, inputs, outputs, netid, blockchainID, types_1.AVMConstants.CREATEASSETTX);
let txins = txu.getIns();
let txouts = txu.getOuts();
let initState = txu.getInitialStates();
expect(txins.length).toBe(inputs.length);
expect(txouts.length).toBe(outputs.length);
expect(initState.toBuffer().toString("hex")).toBe(initialState.toBuffer().toString("hex"));
expect(txu.getTxType()).toBe(types_1.AVMConstants.CREATEASSETTX);
expect(txu.getNetworkID()).toBe(49);
expect(txu.getBlockchainID().toString("hex")).toBe(blockchainID.toString("hex"));
expect(txu.getName()).toBe(name);
expect(txu.getNameBuffer().toString("hex")).toBe(bintools.stringToBuffer(name).toString("hex"));
expect(txu.getSymbol()).toBe(symbol);
expect(txu.getSymbolBuffer().toString("hex")).toBe(bintools.stringToBuffer(symbol).toString("hex"));
expect(txu.getDenomination()).toBe(denomination);
expect(txu.getDenominationBuffer().readUInt8(0)).toBe(denomination);
let a = [];
let b = [];
for (let i = 0; i < txins.length; i++) {
a.push(txins[i].toString());
b.push(inputs[i].toString());
}
expect(JSON.stringify(a.sort())).toBe(JSON.stringify(b.sort()));
a = [];
b = [];
for (let i = 0; i < txouts.length; i++) {
a.push(txouts[i].toString());
b.push(outputs[i].toString());
}
expect(JSON.stringify(a.sort())).toBe(JSON.stringify(b.sort()));
let txunew = new tx_1.TxCreateAsset();
txunew.fromBuffer(txu.toBuffer());
expect(txunew.toBuffer().toString("hex")).toBe(txu.toBuffer().toString("hex"));
expect(txunew.toString()).toBe(txu.toString());
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHgudGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Rlc3RzL2FwaXMvYXZtL3R4LnRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSw4Q0FBNkQ7QUFDN0Qsd0NBQWlEO0FBQ2pELG9EQUFvRDtBQUNwRCxnREFBdUQ7QUFDdkQsOERBQXFDO0FBQ3JDLGtFQUEwQztBQUMxQyxrREFBdUI7QUFDdkIsb0NBQStCO0FBQy9CLGtEQUEwRDtBQUMxRCw4Q0FBNkM7QUFFN0M7O0dBRUc7QUFDSCxNQUFNLFFBQVEsR0FBRyxrQkFBUSxDQUFDLFdBQVcsRUFBRSxDQUFDO0FBQ3hDLFFBQVEsQ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5OSk7XG4gICAgICAgIGxldCB0eGluczpBcnJheTxJbnB1dD4gID0gdHh1LmdldElucygpO1xuICAgICAgICBsZXQgdHhvdXRzOkFycmF5PE91dHB1dD4gPSB0eHUuZ2V0T3V0cygpO1xuICAgICAgICBleHBlY3QodHhpbnMubGVuZ3RoKS50b0JlKGlucHV0cy5sZW5ndGgpO1xuICAgICAgICBleHBlY3QodHhvdXRzLmxlbmd0aCkudG9CZShvdXRwdXRzLmxlbmd0aCk7XG4gICAgICAgIFxuICAgICAgICBleHBlY3QodHh1LmdldFR4VHlwZSgpKS50b0JlKDk5KTtcbiAgICAgICAgZXhwZWN0KHR4dS5nZXROZXR3b3JrSUQoKSkudG9CZSg0OSk7XG4gICAgICAgIGV4cGVjdCh0eHUuZ2V0QmxvY2tjaGFpbklEKCkudG9TdHJpbmcoXCJoZXhcIikpLnRvQmUoYmxvY2tjaGFpbklELnRvU3RyaW5nKFwiaGV4XCIpKTtcbiAgICAgICAgXG4gICAgICAgIGxldCBhOkFycmF5PHN0cmluZz4gPSBbXTtcbiAgICAgICAgbGV0IGI6QXJyYXk8c3RyaW5nPiA9IFtdO1xuICAgICAgICBmb3IobGV0IGk6bnVtYmVyID0gMDsgaSA8IHR4aW5zLmxlbmd0aDsgaSsrKXtcbiAgICAgICAgICAgIGEucHVzaCh0eGluc1tpXS50b1N0cmluZygpKTtcbiAgICAgICAgICAgIGIucHVzaChpbnB1dHNbaV0udG9TdHJpbmcoKSk7XG4gICAgICAgIH1cbiAgICAgICAgZXhwZWN0KEpTT04uc3RyaW5naWZ5KGEuc29ydCgpKSkudG9CZShKU09OLnN0cmluZ2lmeShiLnNvcnQoKSkpO1xuICAgICAgICBcbiAgICAgICAgYSA9IFtdO1xuICAgICAgICBiID0gW107XG5cbiAgICAgICAgZm9yKGxldCBpOm51bWJlciA9IDA7IGkgPCB0eG91dHMubGVuZ3RoOyBpKyspe1xuICAgICAgICAgICAgYS5wdXNoKHR4b3V0c1tpXS50b1N0cmluZygpKTtcbiAgICAgICAgICAgIGIucHVzaChvdXRwdXRzW2ldLnRvU3RyaW5nKCkpO1xuICAgICAgICB9XG4gICAgICAgIGV4cGVjdChKU09OLnN0cmluZ2lmeShhLnNvcnQoKSkpLnRvQmUoSlNPTi5zdHJpbmdpZnkoYi5zb3J0KCkpKTtcblxuICAgICAgICBsZXQgdHh1bmV3OlR4VW5zaWduZWQgPSBuZXcgVHhVbnNpZ25lZCgpO1xuICAgICAgICB0eHVuZXcuZnJvbUJ1ZmZlcih0eHUudG9CdWZmZXIoKSk7XG4gICAgICAgIGV4cGVjdCh0eHVuZXcudG9CdWZmZXIoKS50b1N0cmluZyhcImhleFwiKSkudG9CZSh0eHUudG9CdWZmZXIoKS50b1N0cmluZyhcImhleFwiKSk7XG4gICAgICAgIGV4cGVjdCh0eHVuZXcudG9TdHJpbmcoKSkudG9CZSh0eHUudG9TdHJpbmcoKSk7XG4gICAgfSk7XG5cbiAgICB0ZXN0KCdDcmVhdGlvbiBUeFVuc2lnbmVkIENoZWNrIEFtb3VudCcsICgpID0+IHtcbiAgICAgICAgZXhwZWN0KCgpID0+IHtcbiAgICAgICAgICAgIHNldC5tYWtlVW5zaWduZWRUeChcbiAgICAgICAgICAgICAgICBuZXRpZCwgYmxvY2tjaGFpbklELFxuICAgICAgICAgICAgICAgIG5ldyBCTihhbW50ICogMTAwMCksIFxuICAgICAgICAgICAgICAgIGFkZHJzMywgYWRkcnMxLCBhZGRyczEsIGFzc2V0SURcbiAgICAgICAgICAgICk7XG4gICAgICAgIH0pLnRvVGhyb3coKTtcbiAgICB9KTtcblxuICAgIHRlc3QoJ0NyZWF0aW9uIFR4MScsICgpID0+IHtcbiAgICAgICAgbGV0IHR4dTpUeFVuc2lnbmVkID0gc2V0Lm1ha2VVbnNpZ25lZFR4KFxuICAgICAgICAgICAgbmV0aWQsIGJsb2NrY2hhaW5JRCxcbiAgICAgICAgICAgIG5ldyBCTig5MDAwKSwgXG4gICAgICAgICAgICBhZGRyczMsIGFkZHJzMSwgYWRkcnMxLCBhc3NldElELCBcbiAgICAgICAgICAgIFVuaXhOb3coKSwgVW5peE5vdygpLmFkZChuZXcgQk4oNTApKSwgMVxuICAgICAgICApO1xuICAgICAgICBsZXQgdHg6VHggPSBrZXltZ3IxLnNpZ25UeCh0eHUpO1xuXG4gICAgICAgIGxldCB0eDI6VHggPSBuZXcgVHgoKTtcbiAgICAgICAgdHgyLmZyb21TdHJpbmcodHgudG9TdHJpbmcoKSk7XG4gICAgICAgIGV4cGVjdCh0eDIudG9CdWZmZXIoKS50b1N0cmluZyhcImhleFwiKSkudG9CZSh0eC50b0J1ZmZlcigpLnRvU3RyaW5nKFwiaGV4XCIpKTtcbiAgICAgICAgZXhwZWN0KHR4Mi50b1N0cmluZygpKS50b0JlKHR4LnRvU3RyaW5nKCkpO1xuICAgIH0pO1xuICAgIHRlc3QoJ0NyZWF0aW9uIFR4MicsICgpID0+IHtcbiAgICAgICAgbGV0IHR4dTpUeFVuc2lnbmVkID0gc2V0Lm1ha2VVbnNpZ25lZFR4KFxuICAgICAgICAgICAgbmV0aWQsIGJsb2NrY2hhaW5JRCxcbiAgICAgICAgICAgIG5ldyBCTig5MDAwKSwgXG4gICAgICAgICAgICBhZGRyczMsIGFkZHJzMSwgYWRkcnMxLCBhc3NldElEXG4gICAgICAgICk7XG4gICAgICAgIGxldCB0eDpUeCA9IGtleW1ncjEuc2lnblR4KHR4dSk7XG4gICAgICAgIGxldCB0eDI6VHggPSBuZXcgVHgoKTtcbiAgICAgICAgdHgyLmZyb21TdHJpbmcodHgudG9TdHJpbmcoKSk7XG4gICAgICAgIGV4cGVjdCh0eDIudG9CdWZmZXIoKS50b1N0cmluZyhcImhleFwiKSkudG9CZSh0eC50b0J1ZmZlcigpLnRvU3RyaW5nKFwiaGV4XCIpKTtcbiAgICAgICAgZXhwZWN0KHR4Mi50b1N0cmluZygpKS50b0JlKHR4LnRvU3RyaW5nKCkpO1xuICAgIH0pO1xufSk7XG4gICAgIl19
//# sourceMapping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h0eGlucy5sZW5ndGgpLnRvQmUoaW5wdXRzLmxlbmd0aCk7XG4gICAgICAgIGV4cGVjdCh0eG91dHMubGVuZ3RoKS50b0JlKG91dHB1dHMubGVuZ3RoKTtcbiAgICAgICAgXG4gICAgICAgIGV4cGVjdCh0eHUuZ2V0VHhUeXBlKCkpLnRvQmUoOTkpO1xuICAgICAgICBleHBlY3QodHh1LmdldE5ldHdvcmtJRCgpKS50b0JlKDQ5KTtcbiAgICAgICAgZXhwZWN0KHR4dS5nZXRCbG9ja2NoYWluSUQoKS50b1N0cmluZyhcImhleFwiKSkudG9CZShibG9ja2NoYWluSUQudG9TdHJpbmcoXCJoZXhcIikpO1xuICAgICAgICBcbiAgICAgICAgbGV0IGE6QXJyYXk8c3RyaW5nPiA9IFtdO1xuICAgICAgICBsZXQgYjpBcnJheTxzdHJpbmc+ID0gW107XG4gICAgICAgIGZvcihsZXQgaTpudW1iZXIgPSAwOyBpIDwgdHhpbnMubGVuZ3RoOyBpKyspe1xuICAgICAgICAgICAgYS5wdXNoKHR4aW5zW2ldLnRvU3RyaW5nKCkpO1xuICAgICAgICAgICAgYi5wdXNoKGlucHV0c1tpXS50b1N0cmluZygpKTtcbiAgICAgICAgfVxuICAgICAgICBleHBlY3QoSlNPTi5zdHJpbmdpZnkoYS5zb3J0KCkpKS50b0JlKEpTT04uc3RyaW5naWZ5KGIuc29ydCgpKSk7XG4gICAgICAgIFxuICAgICAgICBhID0gW107XG4gICAgICAgIGIgPSBbXTtcblxuICAgICAgICBmb3IobGV0IGk6bnVtYmVyID0gMDsgaSA8IHR4b3V0cy5sZW5ndGg7IGkrKyl7XG4gICAgICAgICAgICBhLnB1c2godHhvdXRzW2ldLnRvU3RyaW5nKCkpO1xuICAgICAgICAgICAgYi5wdXNoKG91dHB1dHNbaV0udG9TdHJpbmcoKSk7XG4gICAgICAgIH1cbiAgICAgICAgZXhwZWN0KEpTT04uc3RyaW5naWZ5KGEuc29ydCgpKSkudG9CZShKU09OLnN0cmluZ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iaGV4XCIpKS50b0JlKHR4dS50b0J1ZmZlcigpLnRvU3RyaW5nKFwiaGV4XCIpKTtcbiAgICAgICAgZXhwZWN0KHR4dW5ldy50b1N0cmluZygpKS50b0JlKHR4dS50b1N0cmluZygpKTtcbiAgICB9KTtcbn0pO1xuICAgICJdfQ==

@@ -39,4 +39,4 @@ "use strict";

expect(sigidx.getSize()).toBe(sigidx.toBuffer().length);
sigidx.setSource("abcd");
expect(sigidx.getSource()).toBe("abcd");
sigidx.setSource(buffer_1.Buffer.from("abcd", "hex"));
expect(sigidx.getSource().toString("hex")).toBe("abcd");
});

@@ -76,2 +76,2 @@ describe('Address', () => {

});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMudGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Rlc3RzL2FwaXMvYXZtL3R5cGVzLnRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSw4Q0FBeUU7QUFDekUsb0NBQStCO0FBQy9CLGtFQUEwQztBQUUxQyxJQUFJLFFBQVEsR0FBWSxrQkFBUSxDQUFDLFdBQVcsRUFBRSxDQUFDO0FBRS9DLFFBQVEsQ0FBQyxTQUFTLEVBQUUsR0FBRyxFQUFFO0lBQ3JCLElBQUksQ0FBQyxnQ0FBZ0MsRUFBRSxHQUFHLEVBQUU7UUFDeEMsSUFBSSxHQUFHLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxDQUFDLElBQUksSUFBSSxFQUFFLENBQUMsQ0FBQyxPQUFPLEVBQUUsR0FBRyxJQUFJLENBQUMsQ0FBQztRQUNwRCxJQUFJLElBQUksR0FBRyxlQUFPLEVBQUUsQ0FBQztRQUNyQixNQUFNLENBQUMsR0FBRyxHQUFHLEVBQUUsQ0FBQyxDQUFDLFdBQVcsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLEVB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FkYWRkci5mcm9tU3RyaW5nKGJhZHN0cilcbiAgICB9KS50b1Rocm93KFwiRXJyb3IgLSBBZGRyZXNzLmZyb21TdHJpbmc6IGludmFsaWQgYWRkcmVzc1wiKTtcblxuICAgIGJhZGJ1ZmZvdXQgPSBCdWZmZXIuY29uY2F0KFtiYWRidWZmLCBCdWZmZXIuZnJvbShbMSwyLDMsNF0pXSk7XG4gICAgYmFkc3RyID0gYmludG9vbHMuYnVmZmVyVG9CNTgoYmFkYnVmZm91dCk7XG4gICAgZXhwZWN0KCgpID0+IHtcbiAgICAgICAgYmFkYWRkci5mcm9tU3RyaW5nKGJhZHN0cilcbiAgICB9KS50b1Rocm93KFwiRXJyb3IgLSBBZGRyZXNzLmZyb21TdHJpbmc6IGludmFsaWQgY2hlY2tzdW0gb24gYWRkcmVzc1wiKTtcblxufSk7Il19

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

});
test("createAccount", () => __awaiter(void 0, void 0, void 0, function* () {
let result = keystore.createAccount(username, password);
test("createUser", () => __awaiter(void 0, void 0, void 0, function* () {
let result = keystore.createUser(username, password);
let payload = {

@@ -48,24 +48,8 @@ "result": {

}));
test('can CreateAddress', () => __awaiter(void 0, void 0, void 0, function* () {
let alias = 'randomalias';
let result = keystore.createAddress(username, password, alias);
let payload = {
"result": {
"address": alias
}
};
let responseObj = {
data: payload
};
jest_mock_axios_1.default.mockResponse(responseObj);
let response = yield result;
expect(jest_mock_axios_1.default.request).toHaveBeenCalledTimes(1);
expect(response).toBe(alias);
}));
test('exportAccount', () => __awaiter(void 0, void 0, void 0, function* () {
test('exportUser', () => __awaiter(void 0, void 0, void 0, function* () {
let data = 'data';
let result = keystore.exportAccount(username, password);
let result = keystore.exportUser(username, password);
let payload = {
"result": {
"accountData": data
"user": data
}

@@ -81,71 +65,6 @@ };

}));
test('exportKey', () => __awaiter(void 0, void 0, void 0, function* () {
let key = 'sdfglvlj2h3v45';
let result = keystore.exportKey(username, password, 'alias', 'address');
test('importUser', () => __awaiter(void 0, void 0, void 0, function* () {
let result = keystore.importUser(username, 'data', password);
let payload = {
"result": {
"privateKey": key
}
};
let responseObj = {
data: payload
};
jest_mock_axios_1.default.mockResponse(responseObj);
let response = yield result;
expect(jest_mock_axios_1.default.request).toHaveBeenCalledTimes(1);
expect(response).toBe(key);
}));
test('getAllBalances', () => __awaiter(void 0, void 0, void 0, function* () {
let balances = {
'ATH': 23,
'BTC': 59
};
let result = keystore.getAllBalances('alias', 'address');
let payload = {
"result": {
"balances": balances
}
};
let responseObj = {
data: payload
};
jest_mock_axios_1.default.mockResponse(responseObj);
let response = yield result;
expect(jest_mock_axios_1.default.request).toHaveBeenCalledTimes(1);
expect(response).toBe(balances);
}));
test('getBalance', () => __awaiter(void 0, void 0, void 0, function* () {
let balance = 100;
let result = keystore.getBalance('alias', 'address', 'ATH');
let payload = {
"result": {
"balance": balance
}
};
let responseObj = {
data: payload
};
jest_mock_axios_1.default.mockResponse(responseObj);
let response = yield result;
expect(jest_mock_axios_1.default.request).toHaveBeenCalledTimes(1);
expect(response).toBe(balance);
}));
test('getTxHistory', () => __awaiter(void 0, void 0, void 0, function* () {
let history = {};
let result = keystore.getTxHistory('alias', 'address');
let payload = {
"result": history
};
let responseObj = {
data: payload
};
jest_mock_axios_1.default.mockResponse(responseObj);
let response = yield result;
expect(jest_mock_axios_1.default.request).toHaveBeenCalledTimes(1);
expect(response).toBe(history);
}));
test('importAccount', () => __awaiter(void 0, void 0, void 0, function* () {
let result = keystore.importAccount(username, 'data', password);
let payload = {
"result": {
'success': true

@@ -162,24 +81,8 @@ }

}));
test('importKey', () => __awaiter(void 0, void 0, void 0, function* () {
let address = 'asdflashdvfalsdf';
let result = keystore.importKey(username, password, 'alias', 'key');
let payload = {
"result": {
'address': address
}
};
let responseObj = {
data: payload
};
jest_mock_axios_1.default.mockResponse(responseObj);
let response = yield result;
expect(jest_mock_axios_1.default.request).toHaveBeenCalledTimes(1);
expect(response).toBe(address);
}));
test('listAccounts', () => __awaiter(void 0, void 0, void 0, function* () {
test('listUsers', () => __awaiter(void 0, void 0, void 0, function* () {
let accounts = ['acc1', 'acc2'];
let result = keystore.listAccounts();
let result = keystore.listUsers();
let payload = {
"result": {
'accounts': accounts
'users': accounts
}

@@ -195,67 +98,3 @@ };

}));
test('listAddresses', () => __awaiter(void 0, void 0, void 0, function* () {
let addresses = ['acc1', 'acc2'];
let result = keystore.listAddresses(username, 'alias');
let payload = {
"result": {
'addresses': addresses
}
};
let responseObj = {
data: payload
};
jest_mock_axios_1.default.mockResponse(responseObj);
let response = yield result;
expect(jest_mock_axios_1.default.request).toHaveBeenCalledTimes(1);
expect(response).toBe(addresses);
}));
test('listAssets', () => __awaiter(void 0, void 0, void 0, function* () {
let assets = ['ATH', 'ETH'];
let result = keystore.listAssets(username, 'address');
let payload = {
"result": {
'assets': assets
}
};
let responseObj = {
data: payload
};
jest_mock_axios_1.default.mockResponse(responseObj);
let response = yield result;
expect(jest_mock_axios_1.default.request).toHaveBeenCalledTimes(1);
expect(response).toBe(assets);
}));
test('can ListSubnets', () => __awaiter(void 0, void 0, void 0, function* () {
let subnets = ['net1', 'net2'];
let result = keystore.listSubnets();
let payload = {
"result": {
'subnetIDs': subnets
}
};
let responseObj = {
data: payload
};
jest_mock_axios_1.default.mockResponse(responseObj);
let response = yield result;
expect(jest_mock_axios_1.default.request).toHaveBeenCalledTimes(1);
expect(response).toBe(subnets);
}));
test('can Send', () => __awaiter(void 0, void 0, void 0, function* () {
let txId = 'asdfhvl234';
let result = keystore.send(username, password, 'alias', 'assetId', 10, 'toAddress', ['fromAddress']);
let payload = {
"result": {
'txID': txId
}
};
let responseObj = {
data: payload
};
jest_mock_axios_1.default.mockResponse(responseObj);
let response = yield result;
expect(jest_mock_axios_1.default.request).toHaveBeenCalledTimes(1);
expect(response).toBe(txId);
}));
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBpLnRlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6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1cbiAgICAgICAgfTtcbiAgICAgICAgbGV0IHJlc3BvbnNlT2JqID0ge1xuICAgICAgICAgICAgZGF0YTogcGF5bG9hZFxuICAgICAgICB9O1xuXG4gICAgICAgIG1vY2tBeGlvcy5tb2NrUmVzcG9uc2UocmVzcG9uc2VPYmopO1xuICAgICAgICBsZXQgcmVzcG9uc2U6c3RyaW5nID0gYXdhaXQgcmVzdWx0O1xuXG4gICAgICAgIGV4cGVjdChtb2NrQXhpb3MucmVxdWVzdCkudG9IYXZlQmVlbkNhbGxlZFRpbWVzKDEpO1xuICAgICAgICBleHBlY3QocmVzcG9uc2UpLnRvQmUoYWRkcmVzcyk7XG4gICAgfSk7XG5cbiAgICB0ZXN0KCdsaXN0QWNjb3VudHMnLCBhc3luYyAoKT0+e1xuICAgICAgICBsZXQgYWNjb3VudHMgPSBbJ2FjYzEnLCdhY2MyJ107XG5cbiAgICAgICAgbGV0IHJlc3VsdDpQcm9taXNlPEFycmF5PHN0cmluZz4+ID0ga2V5c3RvcmUubGlzdEFjY291bnRzKCk7XG4gICAgICAgIGxldCBwYXlsb2FkOm9iamVjdCA9IHtcbiAgICAgICAgICAgIFwicmVzdWx0XCI6IHtcbiAgICAgICAgICAgICAgICAnYWNjb3VudHMnOiBhY2NvdW50c1xuICAgICAgICAgICAgfVxuICAgICAgICB9O1xuICAgICAgICBsZXQgcmVzcG9uc2VPYmogPSB7XG4gICAgICAgICAgICBkYXRhOiBwYXlsb2FkXG4gICAgICAgIH07XG5cbiAgICAgICAgbW9ja0F4aW9zLm1vY2tSZXNwb25zZShyZXNwb25zZU9iaik7XG4gICAgICAgIGxldCByZXNwb25zZTpBcnJheTxzdHJpbmc+ID0gYXdhaXQgcmVzdWx0O1xuXG4gICAgICAgIGV4cGVjdChtb2NrQXhpb3MucmVxdWVzdCkudG9IYXZlQmVlbkNhbGxlZFRpbWVzKDEpO1xuICAgICAgICBleHBlY3QocmVzcG9uc2UpLnRvQmUoYWNjb3VudHMpO1xuICAgIH0pO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xuICAgICAgICBleHBlY3QocmVzcG9uc2UpLnRvQmUoZGF0YSk7XG4gICAgfSk7XG5cbiAgICB0ZXN0KCdpbXBvcnRVc2VyJywgYXN5bmMgKCk9PntcblxuICAgICAgICBsZXQgcmVzdWx0OlByb21pc2U8Ym9vbGVhbj4gPSBrZXlzdG9yZS5pbXBvcnRVc2VyKHVzZXJuYW1lLCAnZGF0YScsIHBhc3N3b3JkKTtcbiAgICAgICAgbGV0IHBheWxvYWQ6b2JqZWN0ID0ge1xuICAgICAgICAgICAgXCJyZXN1bHRcIjoge1xuICAgICAgICAgICAgICAgICdzdWNjZXNzJzogdHJ1ZVxuICAgICAgICAgICAgfVxuICAgICAgICB9O1xuICAgICAgICBsZXQgcmVzcG9uc2VPYmogPSB7XG4gICAgICAgICAgICBkYXRhOiBwYXlsb2FkXG4gICAgICAgIH07XG5cbiAgICAgICAgbW9ja0F4aW9zLm1vY2tSZXNwb25zZShyZXNwb25zZU9iaik7XG4gICAgICAgIGxldCByZXNwb25zZTpib29sZWFuID0gYXdhaXQgcmVzdWx0O1xuXG4gICAgICAgIGV4cGVjdChtb2NrQXhpb3MucmVxdWVzdCkudG9IYXZlQmVlbkNhbGxlZFRpbWVzKDEpO1xuICAgICAgICBleHBlY3QocmVzcG9uc2UpLnRvQmUodHJ1ZSk7XG4gICAgfSk7XG5cbiAgICB0ZXN0KCdsaXN0VXNlcnMnLCBhc3luYyAoKT0+e1xuICAgICAgICBsZXQgYWNjb3VudHMgPSBbJ2FjYzEnLCdhY2MyJ107XG5cbiAgICAgICAgbGV0IHJlc3VsdDpQcm9taXNlPEFycmF5PHN0cmluZz4+ID0ga2V5c3RvcmUubGlzdFVzZXJzKCk7XG4gICAgICAgIGxldCBwYXlsb2FkOm9iamVjdCA9IHtcbiAgICAgICAgICAgIFwicmVzdWx0XCI6IHtcbiAgICAgICAgICAgICAgICAndXNlcnMnOiBhY2NvdW50c1xuICAgICAgICAgICAgfVxuICAgICAgICB9O1xuICAgICAgICBsZXQgcmVzcG9uc2VPYmogPSB7XG4gICAgICAgICAgICBkYXRhOiBwYXlsb2FkXG4gICAgICAgIH07XG5cbiAgICAgICAgbW9ja0F4aW9zLm1vY2tSZXNwb25zZShyZXNwb25zZU9iaik7XG4gICAgICAgIGxldCByZXNwb25zZTpBcnJheTxzdHJpbmc+ID0gYXdhaXQgcmVzdWx0O1xuXG4gICAgICAgIGV4cGVjdChtb2NrQXhpb3MucmVxdWVzdCkudG9IYXZlQmVlbkNhbGxlZFRpbWVzKDEpO1xuICAgICAgICBleHBlY3QocmVzcG9uc2UpLnRvQmUoYWNjb3VudHMpO1xuICAgIH0pO1xuXG59KTsiXX0=

@@ -47,7 +47,12 @@ "use strict";

}));
test("createSubnet", () => __awaiter(void 0, void 0, void 0, function* () {
let result = platform.createSubnet('txId');
test("createBlockchain", () => __awaiter(void 0, void 0, void 0, function* () {
let blockchainID = "7sik3Pr6r1FeLrvK1oWwECBS8iJ5VPuSh";
let vmID = "7sik3Pr6r1FeLrvK1oWwECBS8iJ5VPuSh";
let name = "Some Blockchain";
let method = 'avm.Booyashakalah';
let genesis = { ruh: "roh" };
let result = platform.createBlockchain(vmID, name, method, genesis);
let payload = {
"result": {
"success": true
"blockchainID": blockchainID
}

@@ -61,4 +66,20 @@ };

expect(jest_mock_axios_1.default.request).toHaveBeenCalledTimes(1);
expect(response).toBe(true);
expect(response).toBe(blockchainID);
}));
test("getBlockchainStatus", () => __awaiter(void 0, void 0, void 0, function* () {
let blockchainID = "7sik3Pr6r1FeLrvK1oWwECBS8iJ5VPuSh";
let result = platform.getBlockchainStatus(blockchainID);
let payload = {
"result": {
"status": "Accepted"
}
};
let responseObj = {
data: payload
};
jest_mock_axios_1.default.mockResponse(responseObj);
let response = yield result;
expect(jest_mock_axios_1.default.request).toHaveBeenCalledTimes(1);
expect(response).toBe("Accepted");
}));
test("listValidators", () => __awaiter(void 0, void 0, void 0, function* () {

@@ -97,2 +118,2 @@ let validators = ['val1', 'val2'];

});
//# sourceMapping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dG9ycyA9IFsndmFsMScsICd2YWwyJ107XG4gICAgICAgIGxldCByZXN1bHQ6UHJvbWlzZTxBcnJheTxzdHJpbmc+PiA9IHBsYXRmb3JtLmxpc3RWYWxpZGF0b3JzKCk7XG4gICAgICAgIGxldCBwYXlsb2FkOm9iamVjdCA9IHtcbiAgICAgICAgICAgIFwicmVzdWx0XCI6IHtcbiAgICAgICAgICAgICAgICBcInZhbGlkYXRvcnNcIjogdmFsaWRhdG9yc1xuICAgICAgICAgICAgfVxuICAgICAgICB9O1xuICAgICAgICBsZXQgcmVzcG9uc2VPYmogPSB7XG4gICAgICAgICAgICBkYXRhOiBwYXlsb2FkXG4gICAgICAgIH07XG5cbiAgICAgICAgbW9ja0F4aW9zLm1vY2tSZXNwb25zZShyZXNwb25zZU9iaik7XG4gICAgICAgIGxldCByZXNwb25zZTpBcnJheTxzdHJpbmc+ID0gYXdhaXQgcmVzdWx0O1xuXG4gICAgICAgIGV4cGVjdChtb2NrQXhpb3MucmVxdWVzdCkudG9IYXZlQmVlbkNhbGxlZFRpbWVzKDEpO1xuICAgICAgICBleHBlY3QocmVzcG9uc2UpLnRvQmUodmFsaWRhdG9ycyk7XG4gICAgfSk7XG5cbiAgICB0ZXN0KFwic2FtcGxlVmFsaWRhdG9yc1wiLCBhc3luYyAoKT0+e1xuXG4gICAgICAgIGxldCB2YWxpZGF0b3JzID0gWyd2YWwxJywgJ3ZhbDInXTtcbiAgICAgICAgbGV0IHJlc3VsdDpQcm9taXNlPEFycmF5PHN0cmluZz4+ID0gcGxhdGZvcm0uc2FtcGxlVmFsaWRhdG9ycygxMCk7XG4gICAgICAgIGxldCBwYXlsb2FkOm9iamVjdCA9IHtcbiAgICAgICAgICAgIFwicmVzdWx0XCI6IHtcbiAgICAgICAgICAgICAgICBcInZhbGlkYXRvcnNcIjogdmFsaWRhdG9yc1xuICAgICAgICAgICAgfVxuICAgICAgICB9O1xuICAgICAgICBsZXQgcmVzcG9uc2VPYmogPSB7XG4gICAgICAgICAgICBkYXRhOiBwYXlsb2FkXG4gICAgICAgIH07XG5cbiAgICAgICAgbW9ja0F4aW9zLm1vY2tSZXNwb25zZShyZXNwb25zZU9iaik7XG4gICAgICAgIGxldCByZXNwb25zZTpBcnJheTxzdHJpbmc+ID0gYXdhaXQgcmVzdWx0O1xuXG4gICAgICAgIGV4cGVjdChtb2NrQXhpb3MucmVxdWVzdCkudG9IYXZlQmVlbkNhbGxlZFRpbWVzKDEpO1xuICAgICAgICBleHBlY3QocmVzcG9uc2UpLnRvQmUodmFsaWRhdG9ycyk7XG4gICAgfSk7XG59KTsiXX0=

@@ -14,2 +14,5 @@ "use strict";

let hexstr3 = "0001020304050607080909080706050403020101";
let hexbuffstr1 = "000461736466"; // = asdf
let hexbuffstr2 = "000761626364656667"; // = abcdefg
let hexbuffstr3 = "00076f6b0066696e65"; // = ok<null>fineokfine
let b58str = "1UoWww8DGaVGLtea7zU7p";

@@ -39,2 +42,22 @@ let b58str2 = "1Bhh3pU9gLXZiJv73kmqZwHJ4F";

});
test('bufferToString', () => {
let bres = bintools.bufferToString(buffer_1.Buffer.from(hexbuffstr1, "hex"));
expect(bres).toBe(buffer_1.Buffer.from(hexbuffstr1.slice(4), "hex").toString("utf8"));
// testing null character edge case
let bres2 = bintools.bufferToString(buffer_1.Buffer.from(hexbuffstr2, "hex"));
expect(bres2).toBe(buffer_1.Buffer.from(hexbuffstr2.slice(4), "hex").toString("utf8"));
// testing null character edge case
let bres3 = bintools.bufferToString(buffer_1.Buffer.from(hexbuffstr3, "hex"));
expect(bres3).toBe(buffer_1.Buffer.from(hexbuffstr3.slice(4), "hex").toString("utf8"));
});
test('stringToBuffer', () => {
let bres = bintools.stringToBuffer("asdf");
expect(bres.slice(2).toString()).toBe(buffer_1.Buffer.from(hexbuffstr1.slice(4), "hex").toString("utf8"));
// testing null character edge case
let bres2 = bintools.stringToBuffer("abcdefg");
expect(bres2.slice(2).toString()).toBe(buffer_1.Buffer.from(hexbuffstr2.slice(4), "hex").toString("utf8"));
// testing null character edge case
let bres3 = bintools.stringToBuffer(buffer_1.Buffer.from(hexbuffstr3.slice(4), "hex").toString("utf8"));
expect(bres3.slice(2).toString()).toBe(buffer_1.Buffer.from(hexbuffstr3.slice(4), "hex").toString("utf8"));
});
test('bufferToB58', () => {

@@ -130,2 +153,2 @@ let b58res = bintools.bufferToB58(buff);

});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmludG9vbHMudGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Rlc3RzL3V0aWxzL2JpbnRvb2xzLnRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxrRUFBMkM7QUFDM0Msa0RBQXdCO0FBQ3hCLG9DQUErQjtBQUUvQixNQUFNLFFBQVEsR0FBRyxrQkFBUSxDQUFDLFdBQVcsRUFBRSxDQUFDO0FBRXhDLFFBQVEsQ0FBQyxVQUFVLEVBQUUsR0FBRyxFQUFFO0lBQ3RCLElBQUksTUFBTSxHQUFVLGtDQUFrQyxDQUFDO0lBQ3ZELElBQUksT0FBTyxHQUFVLDBDQUEwQyxDQUFDO0lBQ2hFLElBQUksT0FBTyxHQUFVLDBDQUEwQyxDQUFBO0lBQy9ELElBQUksTUFBTSxHQUFVLHVCQUF1QixDQUFDO0lBQzVDLElBQUksT0FBTyxHQUFVLDRCQUE0QixDQUFBO0lBQ2pELElBQUksT0FBTyxHQUFVLDRCQUE0QixDQUFDO0lBQ2xELElBQUksSUFBSSxHQUFVLGVBQU0sQ0FBQyxJQUFJLENBQUMsTUFBTSxFQUFFLEtBQUssQ0FBQyxDQUFDO0lBQzdDLElBQUksS0FBSyxHQUFVLGVBQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxFQUFFLEtBQUssQ0FBQyxDQUFDO0lBQy9DLElBQUksS0FBSyxHQUFVLGVBQU0sQ0FBQyxJQUFJLENBQUMsT0F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VsdHlbc2VyYnVmZmZhdWx0eS5sZW5ndGggLSAxXSAtIDE7XG4gICAgICAgIGV4cGVjdChkc3IxLnRvU3RyaW5nKFwiaGV4XCIpKS50b0JlKGhleHN0cik7XG4gICAgICAgIGV4cGVjdChkc3IyLnRvU3RyaW5nKFwiaGV4XCIpKS50b0JlKGhleHN0cik7XG4gICAgICAgIGV4cGVjdCgoKSA9PiB7XG4gICAgICAgICAgICBiaW50b29scy5hdmFEZXNlcmlhbGl6ZShzZXJidWZmZmF1bHR5KTtcbiAgICAgICAgfSkudG9UaHJvdyhcIkVycm9yIC0gQmluVG9vbHMuYXZhRGVzZXJpYWxpemU6IGludmFsaWQgY2hlY2tzdW1cIik7XG4gICAgfSk7XG59KTsiXX0=

Sorry, the diff of this file is not supported yet

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 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 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 too big to display

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

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