Comparing version 1.1.6 to 1.1.7
{ | ||
"name": "slopes", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"description": "AVA Platform JS Library", | ||
@@ -5,0 +5,0 @@ "main": "typings/src/index.js", |
@@ -158,3 +158,3 @@ /** | ||
*/ | ||
getUTXOs = async (addresses:Array<string>, persistOpts:PersistanceOptions | boolean = false ):Promise<UTXOSet> => { | ||
getUTXOs = async (addresses:Array<string>, persistOpts:PersistanceOptions = undefined ):Promise<UTXOSet> => { | ||
let params = { | ||
@@ -197,5 +197,2 @@ "addresses": addresses | ||
* @param threshold The number of signatures required to spend the funds in the resultant UTXO | ||
* @param fallAddresses The fallback addresses which can spend the funds in the resultant UTXO | ||
* @param fallLocktime The fallback locktime timestamp which is greater than the locktime and used as an expiration date for the locktime as a {@link https://github.com/indutny/bn.js/|BN} | ||
* @param fallThreshold The fallback threshold for the number of signatures required from the fallback addresses to spend the resultant UTXO | ||
* | ||
@@ -210,4 +207,3 @@ * @returns An unsigned transaction created from the passed in parameters. | ||
changeAddresses:Array<string>, assetID:Buffer | string = undefined, asOf:BN = UnixNow(), | ||
locktime:BN = new BN(0), threshold:number = 1, fallAddresses:Array<string> = undefined, | ||
fallLocktime:BN = UnixNow(), fallThreshold:number = 1 | ||
locktime:BN = new BN(0), threshold:number = 1 | ||
):TxUnsigned => { | ||
@@ -220,4 +216,3 @@ if(typeof assetID === "string"){ | ||
amount, toAddresses, fromAddresses, changeAddresses, | ||
assetID, asOf, locktime, threshold, | ||
fallAddresses, fallLocktime, fallThreshold | ||
assetID, asOf, locktime, threshold | ||
); | ||
@@ -267,5 +262,5 @@ } | ||
* @param core A reference to the Slopes class | ||
* @param baseurl Defaults to the string "/ext/subnet/avm" as the path to subnets baseurl | ||
* @param baseurl Defaults to the string "/ext/bc/avm" as the path to subnets baseurl | ||
*/ | ||
constructor(core:SlopesCore, baseurl:string = "/ext/subnet/avm", blockchainID:string = ""){ | ||
constructor(core:SlopesCore, baseurl:string = "/ext/bc/avm", blockchainID:string = ""){ | ||
super(core, baseurl); | ||
@@ -272,0 +267,0 @@ this.keychain = new AVMKeyChain(); |
@@ -7,3 +7,3 @@ /** | ||
import BN from "bn.js"; | ||
import { SigIdx } from './types'; | ||
import { SigIdx, Constants } from './types'; | ||
@@ -15,2 +15,4 @@ /** | ||
const SECPINPUTID = 6; | ||
/** | ||
@@ -30,10 +32,6 @@ * Class representing an Input for a transaction. | ||
export class Input { | ||
protected id:Buffer = Buffer.alloc(4); | ||
protected txid:Buffer = Buffer.alloc(32); | ||
protected txidx:Buffer = Buffer.alloc(4); | ||
protected assetid:Buffer = Buffer.alloc(32); | ||
protected amount:Buffer = Buffer.alloc(8); | ||
protected amountValue:BN = new BN(0); | ||
protected numAddr:Buffer = Buffer.alloc(4); | ||
protected sigIdxs:Array<SigIdx> = []; // idxs of signers from utxo | ||
protected inputid:Buffer = Buffer.alloc(4); | ||
@@ -43,3 +41,3 @@ /** | ||
*/ | ||
static comparitor = ():(a:Input, b:Input) => (1|-1|0) => { | ||
static comparator = ():(a:Input, b:Input) => (1|-1|0) => { | ||
return function(a:Input, b:Input):(1|-1|0) { | ||
@@ -58,13 +56,6 @@ return Buffer.compare(a.toBuffer(), b.toBuffer()) as (1|-1|0); | ||
/** | ||
* Returns the array of [[SigIdx]] for this [[Input]] | ||
*/ | ||
getSigIdxs = ():Array<SigIdx> => { | ||
return this.sigIdxs; | ||
} | ||
/** | ||
* Returns the number for the input type of the output class. | ||
*/ | ||
getInputType = ():number => { | ||
return this.id.readUInt32BE(0); | ||
getInputID = ():number => { | ||
return this.inputid.readUInt32BE(0); | ||
}; | ||
@@ -82,7 +73,91 @@ | ||
*/ | ||
protected _basicTxInBuffer = (): Buffer => { | ||
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 - TxOut._basicTxBuffer: " + e; | ||
/* istanbul ignore next */ | ||
throw new Error(emsg); | ||
} | ||
} | ||
/** | ||
* 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 => { | ||
let offset:number = 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 = ():Buffer => { | ||
return this._basicInBuffer(); | ||
} | ||
/** | ||
* Returns a base-58 representation of the [[Input]]. | ||
*/ | ||
toString = ():string => { | ||
return bintools.bufferToB58(this.toBuffer()); | ||
} | ||
/** | ||
* Class representing an Input for a transaction. | ||
* | ||
* @param txid A {@link https://github.com/feross/buffer|Buffer} containing the transaction ID of the referenced UTXO | ||
* @param txidx A {@link https://github.com/feross/buffer|Buffer} containing the index of the output in the transaction consumed in the [[Input]] | ||
* @param assetID A {@link https://github.com/feross/buffer|Buffer} representing the assetID of the [[Input]] | ||
* @param inputid A number representing the InputID of the [[Input]] | ||
*/ | ||
constructor(txid?:Buffer, txidx?:Buffer, assetID?:Buffer, inputid?:number) { | ||
if(txid && txidx && assetID && inputid){ | ||
this.inputid.writeUInt32BE(inputid,0); | ||
this.txid = txid; | ||
this.txidx = txidx; | ||
this.assetid = assetID; | ||
} | ||
} | ||
} | ||
export class SecpInput extends Input { | ||
protected amount:Buffer = Buffer.alloc(8); | ||
protected amountValue:BN = new BN(0); | ||
protected numAddr:Buffer = Buffer.alloc(4); | ||
protected sigIdxs:Array<SigIdx> = []; // idxs of signers from utxo | ||
/** | ||
* Returns the array of [[SigIdx]] for this [[Input]] | ||
*/ | ||
getSigIdxs = ():Array<SigIdx> => { | ||
return this.sigIdxs; | ||
} | ||
/** | ||
* @ignore | ||
*/ | ||
protected _basicSecpInBuffer = (): Buffer => { | ||
try { | ||
this.numAddr.writeUInt32BE(this.sigIdxs.length, 0); | ||
let bsize:number = this.id.length + this.txid.length + this.txidx.length + this.assetid.length + this.amount.length + this.numAddr.length; | ||
let barr:Array<Buffer> = [this.id, this.txid, this.txidx, this.assetid, this.amount, this.numAddr]; | ||
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++) { | ||
@@ -112,10 +187,2 @@ let b:Buffer = this.sigIdxs[i].toBuffer(); | ||
let offset:number = 0; | ||
this.id = bintools.copyFrom(bytes, offset, offset + 4); | ||
offset += 4; | ||
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.amount = bintools.copyFrom(bytes, offset, offset + 8); | ||
@@ -141,3 +208,5 @@ offset += 8; | ||
toBuffer = ():Buffer => { | ||
return this._basicTxInBuffer(); | ||
let basicin:Buffer = this._basicInBuffer(); | ||
let secp:Buffer = this._basicSecpInBuffer(); | ||
return Buffer.concat([basicin, secp]); | ||
} | ||
@@ -177,4 +246,5 @@ | ||
constructor(txid?:Buffer, txidx?:Buffer, amount?:BN, assetID?:Buffer) { | ||
super(txid, txidx, assetID, Constants.SECPINPUTID); | ||
if(txid && txidx && amount && assetID){ | ||
this.id.writeUInt32BE(0,0); | ||
this.inputid.writeUInt32BE(Constants.SECPINPUTID,0); | ||
this.txid = txid; | ||
@@ -181,0 +251,0 @@ this.txidx = txidx; |
@@ -9,3 +9,3 @@ /** | ||
import { Signature, SigIdx } from './types'; | ||
import { Input } from './inputs'; | ||
import { SecpInput, Input } from './inputs'; | ||
import createHash from "create-hash"; | ||
@@ -186,3 +186,3 @@ import { KeyPair, KeyChain } from '../../utils/types'; | ||
*/ | ||
constructor(entropy:Buffer | boolean = false) { | ||
constructor(entropy:Buffer = undefined) { | ||
super(); | ||
@@ -208,3 +208,3 @@ this.generateKey(); | ||
*/ | ||
makeKey = (entropy:Buffer | boolean = false):string => { | ||
makeKey = (entropy:Buffer = undefined):string => { | ||
let keypair:AVMKeyPair = new AVMKeyPair(entropy); | ||
@@ -247,6 +247,7 @@ this.addKey(keypair); | ||
let msg:Buffer = Buffer.from(createHash('sha256').update(txbuff).digest()); | ||
let sigs:Array<Signature> = []; | ||
let sigs:Array<Array<Signature>> = []; | ||
let ins:Array<Input> = utx.getIns(); | ||
for(let i = 0; i < ins.length; i++){ | ||
let sigidxs:Array<SigIdx> = ins[i].getSigIdxs(); | ||
let arrsigs:Array<Signature> = []; | ||
let sigidxs:Array<SigIdx> = (ins[i] as SecpInput).getSigIdxs(); | ||
for(let j = 0; j < sigidxs.length; j++){ | ||
@@ -257,4 +258,5 @@ let keypair:AVMKeyPair = this.getKey(sigidxs[j].getSource()); | ||
sig.fromBuffer(signval); | ||
sigs.push(sig); | ||
arrsigs.push(sig); | ||
} | ||
sigs.push(arrsigs); | ||
} | ||
@@ -261,0 +263,0 @@ return new Tx(utx, sigs); |
@@ -7,10 +7,12 @@ /** | ||
import BN from "bn.js"; | ||
import { Address, UnixNow } from './types'; | ||
import { Address, UnixNow, Constants } from './types'; | ||
const bintools = BinTools.getInstance(); | ||
const SECPFXID = 4; | ||
/** | ||
* Output: | ||
* | ||
* Output Payment: | ||
* OutputID | 04 bytes | ||
* AssetID | 32 bytes | ||
* Amount | 08 bytes | ||
@@ -46,9 +48,8 @@ * Locktime | 08 bytes | ||
export const SelectOutputClass = (outbuffer:Buffer, args:Array<any> = []):Output => { | ||
let outputid:number = outbuffer.readUInt32BE(0); | ||
if(outputid == 0){ | ||
return new OutPayment(bintools.copyFrom(outbuffer,4,36), ...args); | ||
} else if (outputid == 1){ | ||
return new OutTakeOrLeave(bintools.copyFrom(outbuffer,4,36), ...args); | ||
} else if(outputid == 2) { | ||
return new OutCreateAsset(...args); | ||
let assetid:Buffer = bintools.copyFrom(outbuffer, 0, 32); | ||
let outputid:number = outbuffer.readUInt32BE(32); | ||
if(outputid == Constants.SECPOUTPUTID){ | ||
let secpout:SecpOutput = new SecpOutput(assetid, ...args); | ||
secpout.fromBuffer(outbuffer); | ||
return secpout; | ||
} | ||
@@ -62,14 +63,9 @@ throw new Error("Error - SelectOutputClass: unknown outputid " + outputid); | ||
export abstract class Output { | ||
protected id:Buffer = Buffer.alloc(4); | ||
protected idnum:number; | ||
protected amount:Buffer = Buffer.alloc(8); | ||
protected amountValue:BN; | ||
protected outputid:Buffer = Buffer.alloc(4); | ||
protected outputidnum:number; | ||
protected assetid:Buffer = Buffer.alloc(32); | ||
abstract getOutputType:() => number; | ||
abstract getAmount:() => BN; | ||
abstract getOutputID:() => number; | ||
abstract getAssetID:() => Buffer; | ||
abstract getAddresses:() => {[address:string]: BN};// address: locktimes | ||
abstract getAddressIdx:(address:string) => [number, boolean]; | ||
abstract getAddress:(idx:number, tol:boolean) => string; | ||
abstract fromBuffer:(utxobuff:Buffer) => number; | ||
@@ -79,6 +75,3 @@ abstract toBuffer:() => Buffer; | ||
abstract getSpenders:(addresses:Array<string>, asOf:BN | boolean) => Array<string>; | ||
abstract meetsThreshold:(addresses:Array<string>, asOf:BN | boolean) => boolean; | ||
static comparitor = ():(a:Output, b:Output) => (1|-1|0) => { | ||
static comparator = ():(a:Output, b:Output) => (1|-1|0) => { | ||
return function(a:Output, b:Output):(1|-1|0) { | ||
@@ -89,6 +82,7 @@ return Buffer.compare(a.toBuffer(), b.toBuffer()) as (1|-1|0); | ||
constructor(amount?:BN, assetID?:Buffer) { | ||
if(amount){ | ||
this.amountValue = amount.clone(); | ||
this.amount = bintools.fromBNToBuffer(this.amountValue, 8); | ||
constructor(outputidnum:number, assetID?:Buffer) { | ||
this.outputid.writeUInt32BE(outputidnum, 0); | ||
this.outputidnum = outputidnum; | ||
if(assetID){ | ||
this.assetid = assetID; | ||
} | ||
@@ -99,270 +93,5 @@ } | ||
/** | ||
* An [[Output]] class which creates an assetID. | ||
*/ | ||
export class OutCreateAsset extends Output { | ||
protected locktime:Buffer = Buffer.alloc(8); | ||
protected threshold:Buffer = Buffer.alloc(4); | ||
protected numaddrs:Buffer = Buffer.alloc(4); | ||
protected addresses:Array<Address> = []; | ||
/** | ||
* @ignore | ||
*/ | ||
protected _CAGetAddresses = ():{[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. | ||
*/ | ||
getOutputType = ():number => { | ||
return this.idnum; | ||
}; | ||
/** | ||
* Returns the amount as a {@link https://github.com/indutny/bn.js/|BN}. | ||
*/ | ||
getAmount = ():BN => { | ||
return this.amountValue.clone(); | ||
} | ||
/** | ||
* Returns the threshold of signers required to spend this output. | ||
*/ | ||
getThreshold = ():number => { | ||
return this.threshold.readUInt32BE(0); | ||
} | ||
/** | ||
* Returns the a {@link https://github.com/indutny/bn.js/|BN} repersenting the UNIX Timestamp when the lock is made available. | ||
*/ | ||
getLocktime = ():BN => { | ||
return bintools.fromBufferToBN(this.locktime); | ||
} | ||
/** | ||
* Returns the assetID as a {@link https://github.com/feross/buffer|Buffer}. | ||
*/ | ||
getAssetID = ():Buffer => { | ||
return undefined; | ||
} | ||
/** | ||
* 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._CAGetAddresses(); | ||
} | ||
/** | ||
* 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). | ||
* | ||
* @param address 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. | ||
*/ | ||
getAddressIdx = (address:string):[number, boolean] => { | ||
let idx:number = -1; | ||
for(let i = 0; i < this.addresses.length; i++){ | ||
if(this.addresses[i].toString() == address){ | ||
idx = i; | ||
break; | ||
} | ||
} | ||
return [idx, false]; | ||
} | ||
/** | ||
* Returns the address from the index provided. | ||
* | ||
* @param idx The index of the address. | ||
* @param tol Unused, there for compatibility. | ||
* | ||
* @returns Returns the string representing the address. | ||
*/ | ||
getAddress = (idx:number, tol:boolean = false):string => { | ||
if(idx < this.addresses.length){ | ||
return this.addresses[idx].toString(); | ||
} | ||
throw new Error("Error - OutPayment.getAddress: idx out of range"); | ||
} | ||
/** | ||
* @ignore | ||
*/ | ||
protected _OCAParseBuffer = (utxobuff:Buffer, offset:number):number => { | ||
this.id = bintools.copyFrom(utxobuff, offset, offset + 4); //copied | ||
this.idnum = this.id.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:number = this.numaddrs.readUInt32BE(0); | ||
this.addresses = []; | ||
for(let i = 0; i < numaddrs; i++){ | ||
let addr:Address = new Address(); | ||
let offsetEnd:number = offset + addr.getSize(); | ||
let copied:Buffer = bintools.copyFrom(utxobuff, offset, offsetEnd); | ||
addr.fromBuffer(copied); | ||
this.addresses.push(addr); | ||
offset = offsetEnd; | ||
} | ||
this.addresses.sort(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. | ||
*/ | ||
fromBuffer = (utxobuff:Buffer):number => { | ||
return this._OCAParseBuffer(utxobuff, 0); | ||
} | ||
/** | ||
* @ignore | ||
*/ | ||
protected _OCATxBuffer = (): Buffer => { | ||
try { | ||
this.addresses.sort(Address.comparitor()); | ||
let bsize:number = this.id.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.id, this.amount, this.locktime, this.threshold, this.numaddrs]; | ||
for(let i = 0; i < this.addresses.length; i++) { | ||
let b: Buffer = this.addresses[i].toBuffer(); | ||
barr.push(b as Buffer); | ||
bsize += b.length; | ||
} | ||
let buff: Buffer = Buffer.concat(barr,bsize); | ||
return buff; | ||
} catch(e) { | ||
/* istanbul ignore next */ | ||
let emsg:string = "Error - TxOut._OPCABuffer: " + e; | ||
/* istanbul ignore next */ | ||
throw new Error(emsg); | ||
} | ||
} | ||
/** | ||
* Returns the buffer representing the [[OutCreateAsset]] instance. | ||
*/ | ||
toBuffer = ():Buffer => { | ||
return this._OCATxBuffer(); | ||
} | ||
/** | ||
* Returns a base-58 string representing the [[OutCreateAsset]]. | ||
*/ | ||
toString = ():string => { | ||
return bintools.bufferToB58(this.toBuffer()); | ||
} | ||
/** | ||
* @ignore | ||
*/ | ||
protected _OCAQualified = (addresses:Array<string>, asOf:BN | boolean = false):Array<string> => { | ||
let qualified:Array<string> = []; | ||
let now:BN; | ||
if(typeof asOf === 'boolean'){ | ||
now = UnixNow(); | ||
} else { | ||
now = asOf; | ||
} | ||
let locktime:BN = bintools.fromBufferToBN(this.locktime); | ||
if(now.lte(locktime)){ //not unlocked, not spendable | ||
return qualified; | ||
} | ||
let threshold:number = this.threshold.readUInt32BE(0); | ||
for(let i = 0; i < this.addresses.length && qualified.length < threshold; i++) { | ||
for(let j = 0; j < addresses.length && qualified.length < threshold; j++){ | ||
if(addresses[j] == this.addresses[i].toString()){ | ||
qualified.push(addresses[j]); | ||
} | ||
} | ||
} | ||
if(qualified.length >= threshold){ | ||
return qualified; | ||
} | ||
return [] | ||
} | ||
/** | ||
* Given an array of addresses and an optional timestamp, select an array of address strings of qualified spenders for the output. | ||
*/ | ||
getSpenders = (addresses:Array<string>, asOf:BN | boolean = false):Array<string> => { | ||
return this._OCAQualified(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 | boolean = false):boolean => { | ||
let now:BN; | ||
if(typeof asOf === 'boolean'){ | ||
now = UnixNow(); | ||
} else { | ||
now = asOf; | ||
} | ||
let locktime:BN = bintools.fromBufferToBN(this.locktime); | ||
let qualified:Array<string> = this._OCAQualified(addresses, now); | ||
let threshold:number = this.threshold.readUInt32BE(0); | ||
if(now.lte(locktime)){ | ||
return false; | ||
} | ||
if(qualified.length >= threshold){ | ||
return true; | ||
} | ||
return false; | ||
} | ||
/** | ||
* An [[Output]] class which creates 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 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(amount?:BN, addresses?:Array<string>, locktime?:BN, threshold?:number){ | ||
super(amount); | ||
this.idnum = 2; | ||
this.id.writeUInt32BE(this.idnum, 0); | ||
if(amount && addresses){ | ||
this.amountValue = amount.clone(); | ||
let addrs:Array<Address> = []; | ||
for(let i = 0; i < addresses.length; i++){ | ||
addrs[i] = new Address(); | ||
addrs[i].fromString(addresses[i]); | ||
} | ||
this.addresses = addrs; | ||
this.addresses.sort(Address.comparitor()); | ||
this.numaddrs.writeUInt32BE(this.addresses.length, 0); | ||
this.threshold.writeUInt32BE((threshold ? threshold : 1), 0); | ||
if(!(locktime)){ | ||
/* istanbul ignore next */ | ||
locktime = new BN(0); | ||
} | ||
this.locktime = bintools.fromBNToBuffer(locktime, 8); | ||
} | ||
} | ||
} | ||
/** | ||
* An [[Output]] class which issues a payment on an assetID. | ||
*/ | ||
export class OutPayment extends Output { | ||
protected assetid:Buffer = Buffer.alloc(32); | ||
export class SecpOutput extends Output { | ||
protected locktime:Buffer = Buffer.alloc(8); | ||
@@ -372,2 +101,4 @@ protected threshold:Buffer = Buffer.alloc(4); | ||
protected addresses:Array<Address> = []; | ||
protected amount:Buffer = Buffer.alloc(8); | ||
protected amountValue:BN = new BN(0); | ||
@@ -388,4 +119,4 @@ /** | ||
*/ | ||
getOutputType = ():number => { | ||
return this.idnum; | ||
getOutputID = ():number => { | ||
return this.outputidnum; | ||
}; | ||
@@ -435,11 +166,9 @@ | ||
*/ | ||
getAddressIdx = (address:string):[number, boolean] => { | ||
let idx:number = -1; | ||
getAddressIdx = (address:string):number => { | ||
for(let i = 0; i < this.addresses.length; i++){ | ||
if(this.addresses[i].toString() == address){ | ||
idx = i; | ||
break; | ||
return i | ||
} | ||
} | ||
return [idx, false]; | ||
return -1; | ||
} | ||
@@ -451,7 +180,6 @@ | ||
* @param idx The index of the address. | ||
* @param tol Unused, there for compatibility. | ||
* | ||
* @returns Returns the string representing the address. | ||
*/ | ||
getAddress = (idx:number, tol:boolean = false):string => { | ||
getAddress = (idx:number):string => { | ||
if(idx < this.addresses.length){ | ||
@@ -467,7 +195,7 @@ return this.addresses[idx].toString(); | ||
protected _OPParseBuffer = (utxobuff:Buffer, offset:number):number => { | ||
this.id = bintools.copyFrom(utxobuff, offset, offset + 4); //copied | ||
this.idnum = this.id.readUInt32BE(0); | ||
offset += 4; | ||
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); | ||
@@ -509,5 +237,5 @@ this.amountValue = bintools.fromBufferToBN(this.amount); | ||
this.addresses.sort(Address.comparitor()); | ||
let bsize:number = this.id.length + this.assetid.length + this.amount.length + this.locktime.length + this.threshold.length + this.numaddrs.length; | ||
let bsize:number = 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:Array<Buffer> = [this.id, this.assetid, this.amount, this.locktime, this.threshold, this.numaddrs]; | ||
let barr:Array<Buffer> = [this.assetid, this.outputid, this.amount, this.locktime, this.threshold, this.numaddrs]; | ||
for(let i = 0; i < this.addresses.length; i++) { | ||
@@ -545,6 +273,6 @@ let b: Buffer = this.addresses[i].toBuffer(); | ||
*/ | ||
protected _OPQualified = (addresses:Array<string>, asOf:BN | boolean = false):Array<string> => { | ||
protected _OPQualified = (addresses:Array<string>, asOf:BN = undefined):Array<string> => { | ||
let qualified:Array<string> = []; | ||
let now:BN; | ||
if(typeof asOf === 'boolean'){ | ||
if(typeof asOf === 'undefined'){ | ||
now = UnixNow(); | ||
@@ -575,3 +303,3 @@ } else { | ||
*/ | ||
getSpenders = (addresses:Array<string>, asOf:BN | boolean = false):Array<string> => { | ||
getSpenders = (addresses:Array<string>, asOf:BN = undefined):Array<string> => { | ||
return this._OPQualified(addresses, asOf); | ||
@@ -583,5 +311,5 @@ } | ||
*/ | ||
meetsThreshold = (addresses:Array<string>, asOf:BN | boolean = false):boolean => { | ||
meetsThreshold = (addresses:Array<string>, asOf:BN = undefined):boolean => { | ||
let now:BN; | ||
if(typeof asOf === 'boolean'){ | ||
if(typeof asOf === 'undefined'){ | ||
now = UnixNow(); | ||
@@ -614,9 +342,6 @@ } else { | ||
constructor(assetid:Buffer, amount?:BN, addresses?:Array<string>, locktime?:BN, threshold?:number){ | ||
super(amount); | ||
this.assetid = assetid; | ||
this.idnum = 0; | ||
this.id.writeUInt32BE(this.idnum, 0); | ||
super(SECPFXID, assetid); | ||
if(amount && addresses){ | ||
this.amountValue = amount.clone(); | ||
this.amount = bintools.fromBNToBuffer(amount, 8); | ||
let addrs:Array<Address> = []; | ||
@@ -640,263 +365,2 @@ for(let i = 0; i < addresses.length; i++){ | ||
/** | ||
* An [[Output]] class which issues a payment on an assetID and has fallback addresses and locktimes. | ||
*/ | ||
export class OutTakeOrLeave extends OutPayment { | ||
protected fallLocktime:Buffer = Buffer.alloc(8); | ||
protected fallThreshold:Buffer = Buffer.alloc(4); | ||
protected numfalladdrs:Buffer = Buffer.alloc(4); | ||
protected fallAddresses:Array<Address>; | ||
/** | ||
* Returns the threshold of fallback signers required to spend this output. | ||
*/ | ||
getFallThreshold = ():number => { | ||
return this.fallThreshold.readUInt32BE(0); | ||
} | ||
/** | ||
* Returns the a {@link https://github.com/indutny/bn.js/|BN} repersenting the UNIX Timestamp when the fallback lock is made available. | ||
*/ | ||
getFallLocktime = ():BN => { | ||
return bintools.fromBufferToBN(this.fallLocktime); | ||
} | ||
/** | ||
* @ignore | ||
*/ | ||
protected _TOLGetAddresses = ():{[address:string]: BN} => { | ||
let result:{[address:string]: BN} = {}; | ||
for(let i = 0; i < this.fallAddresses.length; i++){ | ||
result[this.fallAddresses[i].toString()] = bintools.fromBufferToBN(this.fallLocktime); | ||
} | ||
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._TOLGetAddresses(), ...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). | ||
* | ||
* @param address 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. | ||
*/ | ||
getAddressIdx = (address:string):[number, boolean] => { | ||
let idx:number = -1; | ||
let tol:boolean = false; | ||
for(let i = 0; i < this.addresses.length; i++){ | ||
if(this.addresses[i].toString() == address){ | ||
idx = i; | ||
break; | ||
} | ||
} | ||
if(idx == -1){ | ||
for(let i = 0; i < this.fallAddresses.length; i++){ | ||
if(this.fallAddresses[i].toString() == address){ | ||
idx = i; | ||
tol = true; | ||
break; | ||
} | ||
} | ||
} | ||
return [idx, tol]; | ||
} | ||
/** | ||
* Returns the address from the index provided. | ||
* | ||
* @param idx The index of the address. | ||
* @param tol Indicates whether the address is a take it or leave it | ||
* | ||
* @returns Returns the string representing the address. | ||
*/ | ||
getAddress = (idx:number, tol:boolean = false):string => { | ||
if(!tol && idx < this.addresses.length){ | ||
return this.addresses[idx].toString(); | ||
} else if(tol && idx < this.fallAddresses.length){ | ||
return this.fallAddresses[idx].toString(); | ||
} | ||
throw new Error("Error - OutPayment.getAddress: idx out of range"); | ||
} | ||
/** | ||
* @ignore | ||
*/ | ||
protected _TOLParseBuffer = (utxobuff:Buffer, offset:number) => { | ||
this.fallLocktime = bintools.copyFrom(utxobuff, offset, offset + 8); | ||
offset += 8; | ||
this.fallThreshold = bintools.copyFrom(utxobuff, offset, offset + 4); | ||
offset += 4; | ||
this.numfalladdrs = bintools.copyFrom(utxobuff, offset, offset + 4); | ||
offset += 4; | ||
let numfalladdrs = this.numfalladdrs.readUInt32BE(0); | ||
this.fallAddresses = []; | ||
for(let i = 0; i < numfalladdrs; i++){ | ||
let addr = new Address(); | ||
let offsetEnd = offset + addr.getSize(); | ||
let copied = bintools.copyFrom(utxobuff, offset, offsetEnd); | ||
addr.fromBuffer(copied); | ||
this.fallAddresses.push(addr); | ||
offset = offsetEnd; | ||
} | ||
this.fallAddresses.sort(Address.comparitor()); | ||
return offset; | ||
} | ||
/** | ||
* Popuates the instance from a {@link https://github.com/feross/buffer|Buffer} representing the [[OutTakeOrLeave]] and returns the size of the output. | ||
*/ | ||
fromBuffer = (utxobuff:Buffer):number => { | ||
let offset:number = this._OPParseBuffer(utxobuff, 0); | ||
let offset2:number = this._TOLParseBuffer(utxobuff, offset); | ||
return offset2; | ||
} | ||
/** | ||
* @ignore | ||
*/ | ||
protected _TOLBuffer = (): Buffer => { | ||
try { | ||
this.fallAddresses.sort(Address.comparitor()); | ||
let bsize:number = this.fallLocktime.length + this.fallThreshold.length + this.numfalladdrs.length; | ||
this.numfalladdrs.writeUInt32BE(this.fallAddresses.length, 0); | ||
let barr:Array<Buffer> = [this.fallLocktime, this.fallThreshold, this.numfalladdrs]; | ||
for(let i = 0; i < this.fallAddresses.length; i++) { | ||
let b:Buffer = this.fallAddresses[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 - TxTakeOrLeave._TOLBuffer: " + e; | ||
/* istanbul ignore next */ | ||
throw new Error(emsg); | ||
} | ||
} | ||
/** | ||
* Returns the buffer representing the [[OutTakeOrLeave]] instance. | ||
*/ | ||
toBuffer = ():Buffer => { | ||
let pt1: Buffer = this._OPBuffer(); | ||
let pt2: Buffer = this._TOLBuffer(); | ||
return Buffer.concat([pt1, pt2], pt1.length + pt2.length) | ||
} | ||
/** | ||
* Returns a base-58 string representing the [[OutTakeOrLeave]]. | ||
*/ | ||
toString = ():string => { | ||
return bintools.bufferToB58(this.toBuffer()); | ||
} | ||
/** | ||
* @ignore | ||
*/ | ||
protected _TOLQualified = (addresses:Array<string>, asOf:BN | boolean = false):Array<string> => { | ||
let qualified:Array<string> = []; | ||
let now:BN; | ||
if(typeof asOf === 'boolean'){ | ||
now = UnixNow(); | ||
} else { | ||
now = asOf; | ||
} | ||
let locktime:BN = bintools.fromBufferToBN(this.fallLocktime); | ||
if(now.lte(locktime)){ //not unlocked, not spendable | ||
return qualified; | ||
} | ||
let threshold:number = this.fallThreshold.readUInt32BE(0); | ||
for(let i = 0; i < this.fallAddresses.length && qualified.length < threshold; i++) { | ||
for(let j = 0; j < addresses.length && qualified.length < threshold; j++){ | ||
if(addresses[j] == this.fallAddresses[i].toString()){ | ||
qualified.push(addresses[j]); | ||
} | ||
} | ||
} | ||
return qualified; | ||
} | ||
/** | ||
* Given an array of addresses and an optional timestamp, select an array of address strings of qualified spenders for the output. | ||
*/ | ||
getSpenders = (addresses:Array<string>, asOf:BN | boolean = false):Array<string> => { | ||
let qualified:Array<string> = this._OPQualified(addresses, asOf); | ||
qualified = qualified.concat(this._TOLQualified(addresses, asOf)); | ||
return [...new Set(qualified)]; | ||
} | ||
/** | ||
* 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 | boolean = false):boolean => { | ||
let now:BN; | ||
if(typeof asOf === 'boolean'){ | ||
now = UnixNow(); | ||
} else { | ||
now = asOf; | ||
} | ||
let locktime:BN = bintools.fromBufferToBN(this.locktime); | ||
let fallLocktime:BN = bintools.fromBufferToBN(this.fallLocktime); | ||
let qualified:Array<string> = this._OPQualified(addresses, now); | ||
let threshold:number = this.threshold.readUInt32BE(0); | ||
if(now.lte(locktime)){ | ||
return false; | ||
} | ||
if(qualified.length >= threshold){ | ||
return true; | ||
} | ||
qualified = this._TOLQualified(addresses, now); | ||
threshold = this.fallThreshold.readUInt32BE(0); | ||
if(now.lte(fallLocktime)){ | ||
return false; | ||
} | ||
if(qualified.length >= threshold){ | ||
return true; | ||
} | ||
return false; | ||
} | ||
/** | ||
* An [[Output]] class which issues a payment on an assetID and has fallback addresses and locktimes. | ||
* | ||
* @param assetid A {@link https://github.com/feross/buffer|Buffer} representing the 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 falladdresses An array of strings representing fallback addresses | ||
* @param locktime A {@link https://github.com/indutny/bn.js/|BN} representing the locktime | ||
* @param falllocktime A {@link https://github.com/indutny/bn.js/|BN} representing the fallback locktime | ||
* @param threshold A number representing the threshold number of signers required to sign the transaction | ||
* @param fallthreshold A number representing the fallback threshold number of signers required to sign the transaction | ||
*/ | ||
constructor(assetid:Buffer, amount?:BN, addresses?:Array<string>, falladdresses?:Array<string>, locktime?:BN, falllocktime?:BN, threshold?:number, fallthreshold?:number){ | ||
super(assetid, amount, addresses, locktime, threshold); | ||
this.idnum = 1; | ||
this.id.writeUInt32BE(this.idnum, 0); | ||
if(amount && addresses && falladdresses && falllocktime){ | ||
let addrs:Array<Address> = []; | ||
for(let i = 0; i < falladdresses.length; i++){ | ||
addrs[i] = new Address(); | ||
addrs[i].fromString(falladdresses[i]); | ||
} | ||
this.fallAddresses = addrs; | ||
this.fallAddresses.sort(Address.comparitor()); | ||
this.numfalladdrs.writeUInt32BE(this.fallAddresses.length, 0); | ||
this.fallThreshold.writeUInt32BE((fallthreshold ? fallthreshold : 1), 0); | ||
if(!falllocktime) { | ||
/* istanbul ignore next */ | ||
falllocktime = new BN(1); | ||
} | ||
this.fallLocktime = bintools.fromBNToBuffer(falllocktime, 8); | ||
} | ||
} | ||
} |
@@ -5,3 +5,3 @@ /** | ||
import {Buffer} from "buffer/"; | ||
import { Signature } from './types'; | ||
import { Signature, Constants } from './types'; | ||
import { Output, SelectOutputClass } from './outputs'; | ||
@@ -21,3 +21,3 @@ import { Input } from './inputs'; | ||
* Unsigned Tx: | ||
* Codec | 4 bytes | ||
* TxID | 4 bytes | ||
* NetworkID | 4 bytes | ||
@@ -42,3 +42,3 @@ * BlockchainID | 32 bytes | ||
export class TxUnsigned { | ||
protected codec:Buffer = Buffer.alloc(4); | ||
protected txtype:Buffer = Buffer.alloc(4); | ||
protected networkid:Buffer = Buffer.alloc(4); | ||
@@ -52,6 +52,6 @@ protected blockchainid:Buffer = Buffer.alloc(32); | ||
/** | ||
* Returns the number representation of the codec | ||
* Returns the number representation of the txtype | ||
*/ | ||
getCodec = ():number => { | ||
return this.codec.readUInt32BE(0); | ||
getTxType = ():number => { | ||
return this.txtype.readUInt32BE(0); | ||
} | ||
@@ -98,3 +98,3 @@ | ||
let offset:number = 0; | ||
this.codec = bintools.copyFrom(bytes, offset, offset + 4); | ||
this.txtype = bintools.copyFrom(bytes, offset, offset + 4); | ||
offset += 4; | ||
@@ -133,8 +133,8 @@ this.networkid = bintools.copyFrom(bytes, offset, offset + 4); | ||
try { | ||
this.outs.sort(Output.comparitor()); | ||
this.ins.sort(Input.comparitor()); | ||
this.outs.sort(Output.comparator()); | ||
this.ins.sort(Input.comparator()); | ||
this.numouts.writeUInt32BE(this.outs.length, 0); | ||
this.numins.writeUInt32BE(this.ins.length, 0); | ||
let bsize:number = this.codec.length + this.networkid.length + this.blockchainid.length + this.numouts.length; | ||
let barr:Array<Buffer> = [this.codec, this.networkid, this.blockchainid, this.numouts]; | ||
let bsize:number = this.txtype.length + this.networkid.length + this.blockchainid.length + this.numouts.length; | ||
let barr:Array<Buffer> = [this.txtype, this.networkid, this.blockchainid, this.numouts]; | ||
for(let i = 0; i < this.outs.length; i++) { | ||
@@ -183,6 +183,6 @@ let b:Buffer = this.outs[i].toBuffer(); | ||
* @param blockchainid Optional blockchainid, default Buffer.alloc(32, 16) | ||
* @param codec Optional codec, default 2 | ||
* @param txtype Optional txtype, default 2 | ||
*/ | ||
constructor(ins?:Array<Input>, outs?:Array<Output>, networkid:number = 2, blockchainid:Buffer = Buffer.alloc(32, 16), codec:number = 2) { | ||
this.codec.writeUInt32BE(codec, 0); | ||
constructor(ins?:Array<Input>, outs?:Array<Output>, networkid:number = 2, blockchainid:Buffer = Buffer.alloc(32, 16), txtype:number = 0) { | ||
this.txtype.writeUInt32BE(txtype, 0); | ||
this.networkid.writeUInt32BE(networkid, 0); | ||
@@ -192,5 +192,5 @@ this.blockchainid = blockchainid; | ||
this.numouts.writeUInt32BE(outs.length, 0); | ||
this.outs = outs.sort(Output.comparitor()); | ||
this.outs = outs.sort(Output.comparator()); | ||
this.numins.writeUInt32BE(ins.length, 0); | ||
this.ins = ins.sort(Input.comparitor()); | ||
this.ins = ins.sort(Input.comparator()); | ||
} | ||
@@ -205,3 +205,3 @@ } | ||
protected tx:TxUnsigned = new TxUnsigned(); | ||
protected signatures:Array<Signature> = []; | ||
protected signatures:Array<Array<Signature>> = []; | ||
@@ -218,15 +218,21 @@ /** | ||
let offset:number = this.tx.fromBuffer(bytes); | ||
if((bytes.length - offset) % 65 == 0){ | ||
let numsigs:number = (bytes.length - offset) / 65; | ||
let numcreds:number = bintools.copyFrom(bytes, offset, offset + 4).readUInt32BE(0); | ||
offset += 4; | ||
this.signatures = []; | ||
for(let i = 0; i < numsigs; i++){ | ||
let sig:Signature = new Signature(); | ||
sig.fromBuffer(bintools.copyFrom(bytes, offset, offset + 65)); | ||
this.signatures.push(sig); | ||
offset += 65; | ||
for(let i = 0; i < numcreds; i++){ | ||
let sigarray:Array<Signature> = []; | ||
let credential:number = bintools.copyFrom(bytes, offset, offset + 4).readUInt32BE(0); | ||
if(credential != Constants.SECPCREDENTIAL){ | ||
throw new Error("Error - Tx.fromBuffer: Invalid credentialID " + credential); | ||
} | ||
let numsigs:number = bintools.copyFrom(bytes, offset, offset + 4).readUInt32BE(0); | ||
offset += 4; | ||
for(let j = 0; j < numsigs; j++) { | ||
let sig:Signature = new Signature(); | ||
sig.fromBuffer(bintools.copyFrom(bytes, offset, offset + 65)); | ||
sigarray.push(sig); | ||
offset += 65; | ||
} | ||
this.signatures.push(sigarray); | ||
} | ||
} else { | ||
/* istanbul ignore next */ | ||
throw new Error("Error - Tx.fromBuffer: the signature block's byte length isn't evenly divisible by 65 and it should be"); | ||
} | ||
return offset; | ||
@@ -254,8 +260,21 @@ } | ||
let txbuff: Buffer = this.tx.toBuffer(); | ||
let barr:Array<Buffer> = [txbuff]; | ||
let bsize:number = txbuff.length; | ||
let sigarrlen:Buffer = Buffer.alloc(4); | ||
sigarrlen.writeUInt32BE(this.signatures.length, 0); | ||
let barr:Array<Buffer> = [txbuff, sigarrlen]; | ||
bsize += sigarrlen.length; | ||
for(let i = 0; i < this.signatures.length; i++){ | ||
let b:Buffer = this.signatures[i].toBuffer(); | ||
barr.push(b); | ||
bsize += b.length | ||
let siglen:Buffer = Buffer.alloc(4); | ||
siglen.writeUInt32BE(this.signatures[i].length, 0); | ||
let credentialID = Buffer.alloc(4); | ||
credentialID.writeUInt32BE(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:Buffer = this.signatures[i][j].toBuffer(); | ||
barr.push(b); | ||
bsize += b.length; | ||
} | ||
} | ||
@@ -288,3 +307,3 @@ let buff:Buffer = Buffer.concat(barr, bsize); | ||
*/ | ||
constructor(tx?:TxUnsigned, signatures?:Array<Signature>) { | ||
constructor(tx?:TxUnsigned, signatures?:Array<Array<Signature>>) { | ||
if(tx){ | ||
@@ -291,0 +310,0 @@ this.tx = tx; |
@@ -113,2 +113,9 @@ /** | ||
export class Constants { | ||
static SECPOUTPUTID:number = 4; | ||
static SECPINPUTID:number = 6; | ||
static BASETX:number = 0; | ||
static SECPCREDENTIAL:number =7; | ||
} | ||
/** | ||
@@ -115,0 +122,0 @@ * Rules used when merging sets |
@@ -7,6 +7,6 @@ /** | ||
import BN from "bn.js"; | ||
import { Output, OutTakeOrLeave, OutPayment, SelectOutputClass, OutCreateAsset } from './outputs'; | ||
import { MergeRule, UnixNow } from './types'; | ||
import { Output, SecpOutput, SelectOutputClass } from './outputs'; | ||
import { MergeRule, UnixNow, Constants } from './types'; | ||
import { TxUnsigned } from './tx'; | ||
import { Input } from './inputs'; | ||
import { SecpInput } from './inputs'; | ||
@@ -18,15 +18,132 @@ /** | ||
/** | ||
* Takes a buffer representing the output and returns the proper UTXO instance. | ||
* | ||
* @param utxobuffer A {@link https://github.com/feross/buffer|Buffer} containing the [[UTXO]] raw data. | ||
* | ||
* @returns An instance of an [[UTXO]]-extended class. ex. [[SecpUTXO]]. | ||
*/ | ||
export const SelectUTXOClass = (utxobuffer:Buffer, args:Array<any> = []):UTXO => { | ||
let txid:Buffer = bintools.copyFrom(utxobuffer, 0, 32); | ||
let txidx:number = utxobuffer.readUInt32BE(32); | ||
let outputbuff:Buffer = bintools.copyFrom(utxobuffer, 36); | ||
let output:Output = SelectOutputClass(outputbuff); | ||
let outputid:number = output.getOutputID(); | ||
if(outputid == Constants.SECPOUTPUTID){ | ||
let secpout:SecpOutput = output as SecpOutput; | ||
let utxo:SecpUTXO = new SecpUTXO(txid, txidx, secpout); | ||
return utxo; | ||
} | ||
throw new Error("Error - SelectUTXOClass: unknown outputid " + outputid); | ||
} | ||
/** | ||
* Class for representing a single UTXO. | ||
*/ | ||
export class UTXO { | ||
export abstract class UTXO { | ||
protected txid:Buffer = Buffer.alloc(32); | ||
protected txidx:Buffer = Buffer.alloc(4); | ||
protected output:Output = undefined; | ||
getOuputType = ():number => { | ||
return this.output.getOutputType(); | ||
abstract getOuputID:() => number; | ||
/** | ||
* Returns a {@link https://github.com/feross/buffer|Buffer} of the TxID. | ||
*/ | ||
getTxID = ():Buffer => { | ||
return this.txid; | ||
} | ||
/** | ||
* Returns a {@link https://github.com/feross/buffer|Buffer} of the TxIdx. | ||
*/ | ||
getTxIdx = ():Buffer => { | ||
return this.txidx; | ||
} | ||
/** | ||
* Returns the UTXOID as a base-58 string (UTXOID is a string ) | ||
*/ | ||
getUTXOID = ():string => { | ||
return bintools.bufferToB58(Buffer.concat([this.getTxID(), this.getTxIdx()])); | ||
} | ||
_basicUTXOBuffer = (utxobuff) => { | ||
this.txid = bintools.copyFrom(utxobuff, 0, 32); | ||
this.txidx = bintools.copyFrom(utxobuff, 32, 36); | ||
} | ||
/** | ||
* 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. | ||
* | ||
* @param bytes A {@link https://github.com/feross/buffer|Buffer} containing a raw [[UTXO]] | ||
*/ | ||
fromBuffer = (utxobuff:Buffer) => { | ||
this._basicUTXOBuffer(utxobuff); | ||
} | ||
/** | ||
* Takes a base-58 string containing an [[UTXO]], parses it, populates the class, and returns the length of the UTXO in bytes. | ||
* | ||
* @param serialized A base-58 string containing a raw [[UTXO]] | ||
* | ||
* @returns The length of the raw [[UTXO]] | ||
* | ||
* @remarks | ||
* unlike most fromStrings, it expects the string to be serialized in AVA format | ||
*/ | ||
fromString = (serialized:string) => { | ||
return this.fromBuffer( bintools.avaDeserialize(serialized) ); | ||
} | ||
/** | ||
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[UTXO]]. | ||
*/ | ||
toBuffer = ():Buffer => { | ||
try { | ||
let barr:Array<Buffer> = [this.txid, this.txidx]; | ||
return Buffer.concat(barr, this.txid.length + this.txidx.length) | ||
} catch(e) { | ||
/* istanbul ignore next */ | ||
let emsg:string = "Error - UTXO.toBuffer: " + e; | ||
/* istanbul ignore next */ | ||
throw new Error(emsg); | ||
} | ||
} | ||
/** | ||
* Returns a base-58 representation of the [[UTXO]]. | ||
* | ||
* @remarks | ||
* unlike most toStrings, this returns in AVA serialization format | ||
*/ | ||
toString = ():string => { | ||
return bintools.avaSerialize(this.toBuffer()); | ||
} | ||
/** | ||
* Class for representing a single UTXO. | ||
* | ||
* @param serialized Optional parameter of the serialized string representing a UTXO | ||
*/ | ||
constructor(txid?:Buffer, txidx:number = undefined) { | ||
if(txid && typeof txidx === "number") { | ||
this.txid = txid; | ||
this.txidx.writeUInt32BE(txidx, 0); | ||
} | ||
} | ||
} | ||
/** | ||
* Class for representing a single UTXO. | ||
*/ | ||
export class SecpUTXO extends UTXO { | ||
protected output:SecpOutput = undefined; | ||
getOuputID = ():number => { | ||
return this.output.getOutputID(); | ||
} | ||
/** | ||
* Gets the amount in the UTXO as a {@link https://github.com/indutny/bn.js/|BN}. | ||
@@ -50,3 +167,3 @@ */ | ||
*/ | ||
getAddressIdx = (address:string):[number, boolean] => { | ||
getAddressIdx = (address:string):number => { | ||
return this.output.getAddressIdx(address); | ||
@@ -59,8 +176,7 @@ } | ||
* @param idx The index of the address | ||
* @param tol Boolean indicating if this should be looked up in the fallback addresses (TakeItOrLeaveIt) | ||
* | ||
* @returns A string representing the address. | ||
*/ | ||
getAddress = (idx:number, tol:boolean):string => { | ||
return this.output.getAddress(idx, tol); | ||
getAddress = (idx:number):string => { | ||
return this.output.getAddress(idx); | ||
} | ||
@@ -106,6 +222,5 @@ | ||
fromBuffer = (utxobuff:Buffer) => { | ||
this.txid = bintools.copyFrom(utxobuff, 0, 32); | ||
this.txidx = bintools.copyFrom(utxobuff, 32, 36); | ||
this._basicUTXOBuffer(utxobuff); | ||
let utxoOut = bintools.copyFrom(utxobuff, 36, utxobuff.length); | ||
this.output = SelectOutputClass(utxoOut); | ||
this.output = SelectOutputClass(utxoOut) as SecpOutput; | ||
this.output.fromBuffer(utxoOut); | ||
@@ -157,3 +272,3 @@ } | ||
*/ | ||
getSpenders = (addresses:Array<string>, asOf:BN | boolean = false):Array<string> => { | ||
getSpenders = (addresses:Array<string>, asOf:BN = undefined):Array<string> => { | ||
return this.output.getSpenders(addresses, asOf); | ||
@@ -165,3 +280,3 @@ } | ||
*/ | ||
meetsThreshold = (addresses:Array<string>, asOf:BN | boolean = false) => { | ||
meetsThreshold = (addresses:Array<string>, asOf:BN = undefined) => { | ||
return this.output.meetsThreshold(addresses, asOf); | ||
@@ -173,7 +288,9 @@ } | ||
* | ||
* @param serialized Optional parameter of the serialized string representing a UTXO | ||
* @param txid Optional {@link https://github.com/feross/buffer|Buffer} representing the transaction ID | ||
* @param txidx Optional number for the transaction index | ||
*/ | ||
constructor(serialized?:string) { | ||
if(serialized) { | ||
this.fromString(serialized); | ||
constructor(txid:Buffer = undefined, txidx:number = undefined, secpoutput:SecpOutput) { | ||
super(txid, txidx); | ||
if(secpoutput){ | ||
this.output = secpoutput; | ||
} | ||
@@ -187,3 +304,3 @@ } | ||
export class UTXOSet { | ||
protected utxos:{[utxoid: string]: UTXO } = {}; | ||
protected utxos:{[utxoid: string]: SecpUTXO } = {}; | ||
protected addressUTXOs:{[address: string]: {[utxoid: string]: BN}} = {}; // maps address to utxoids:locktime | ||
@@ -200,3 +317,3 @@ | ||
if(typeof utxo === 'string') { | ||
utxoX = new UTXO(utxo); | ||
utxoX = SelectUTXOClass(bintools.avaDeserialize(utxo)); | ||
} else { | ||
@@ -221,11 +338,17 @@ utxoX = utxo; //forces a copy | ||
if(typeof utxo === 'string') { | ||
utxoX = new UTXO(utxo); | ||
utxoX = SelectUTXOClass(bintools.avaDeserialize(utxo)); | ||
} else { | ||
utxoX = new UTXO(utxo.toString()); //forces a copy | ||
utxoX = SelectUTXOClass(utxo.toBuffer()); //forces a copy | ||
} | ||
let utxoid:string = utxoX.getUTXOID(); | ||
let secputxo; | ||
try { | ||
secputxo = utxoX as SecpUTXO; | ||
} catch (e) { | ||
return false; | ||
} | ||
let utxoid:string = secputxo.getUTXOID(); | ||
if(!(utxoid in this.utxos) || overwrite === true){ | ||
this.utxos[utxoid] = utxoX; | ||
this.utxos[utxoid] = secputxo; | ||
let addresses:{[address:string]: BN} = utxoX.getAddresses(); //gets addresses and their locktime | ||
let addresses:{[address:string]: BN} = secputxo.getAddresses(); //gets addresses and their locktime | ||
for(let [address, locktime] of Object.entries(addresses)){ | ||
@@ -254,7 +377,6 @@ if(!(address in this.addressUTXOs)){ | ||
let u:UTXO; | ||
if(typeof utxos[i] === 'string'){ | ||
u = new UTXO(utxos[i] as string); | ||
} else { | ||
u = utxos[i] as UTXO; | ||
u = new UTXO(u.toString()); //force copy | ||
if(typeof utxos[i] === 'string') { | ||
u = SelectUTXOClass(bintools.avaDeserialize(utxos[i] as string)); | ||
} else { | ||
u = SelectUTXOClass((utxos[i] as UTXO).toBuffer()); //forces a copy | ||
} | ||
@@ -279,5 +401,5 @@ if(this.add(u, overwrite)){ | ||
if(typeof utxo === 'string') { | ||
utxoX = new UTXO(utxo); | ||
utxoX = SelectUTXOClass(bintools.avaDeserialize(utxo)); | ||
} else { | ||
utxoX = new UTXO(utxo.toString()); //forces a copy | ||
utxoX = SelectUTXOClass(utxo.toBuffer()); //forces a copy | ||
} | ||
@@ -310,7 +432,6 @@ let utxoid:string = utxoX.getUTXOID(); | ||
let u:UTXO; | ||
if(typeof utxos[i] === 'string'){ | ||
u = new UTXO(utxos[i] as string); | ||
} else { | ||
u = utxos[i] as UTXO; | ||
u = new UTXO(u.toString()); //force copy | ||
if(typeof utxos[i] === 'string') { | ||
u = SelectUTXOClass(bintools.avaDeserialize(utxos[i] as string)); | ||
} else { | ||
u = SelectUTXOClass((utxos[i] as UTXO).toBuffer()); //forces a copy | ||
} | ||
@@ -342,5 +463,5 @@ if(this.remove(u)){ | ||
*/ | ||
getAllUTXOs = (utxoids:Array<string> | boolean = false ):Array<UTXO> => { | ||
let results:Array<UTXO> = []; | ||
if(typeof utxoids !== 'boolean' && Array.isArray(utxoids)){ | ||
getAllUTXOs = (utxoids:Array<string> = undefined):Array<SecpUTXO> => { | ||
let results:Array<SecpUTXO> = []; | ||
if(typeof utxoids !== 'undefined' && Array.isArray(utxoids)){ | ||
for(let i = 0; i < utxoids.length; i++){ | ||
@@ -364,6 +485,6 @@ if(utxoids[i] in this.utxos && !(utxoids[i] in results)){ | ||
*/ | ||
getAllUTXOStrings = (utxoids:Array<string> | boolean = false):Array<string> => { | ||
getAllUTXOStrings = (utxoids:Array<string> = undefined):Array<string> => { | ||
let results:Array<string> = []; | ||
let utxos = Object.keys(this.utxos); | ||
if(typeof utxoids !== 'boolean' && Array.isArray(utxoids)){ | ||
if(typeof utxoids !== 'undefined' && Array.isArray(utxoids)){ | ||
for(let i = 0; i < utxoids.length; i++){ | ||
@@ -432,5 +553,5 @@ if(utxoids[i] in this.utxos){ | ||
*/ | ||
getBalance = (addresses:Array<string>, assetID:Buffer|string, asOf:BN | boolean = false):BN => { | ||
getBalance = (addresses:Array<string>, assetID:Buffer|string, asOf:BN = undefined):BN => { | ||
let utxoids:Array<string> = this.getUTXOIDsByAddress(addresses); | ||
let utxos:Array<UTXO> = this.getAllUTXOs(utxoids); | ||
let utxos:Array<SecpUTXO> = this.getAllUTXOs(utxoids); | ||
let spend:BN = new BN(0); | ||
@@ -491,5 +612,2 @@ let asset:Buffer; | ||
* @param threshold The number of signatures required to spend the funds in the resultant UTXO | ||
* @param fallAddresses The fallback addresses which can spend the funds in the resultant UTXO | ||
* @param fallLocktime The fallback locktime timestamp which is greater than the locktime and used as an expiration date for the locktime as a {@link https://github.com/indutny/bn.js/|BN} | ||
* @param fallThreshold The fallback threshold for the number of signatures required from the fallback addresses to spend the resultant UTXO | ||
* | ||
@@ -499,18 +617,12 @@ * @returns An unsigned transaction created from the passed in parameters. | ||
*/ | ||
makeUnsignedTx = (networkid:number, blockchainid:Buffer, amount:BN, toAddresses:Array<string>, fromAddresses:Array<string>, changeAddresses:Array<string>, assetID:Buffer = undefined, asOf:BN = UnixNow(), locktime:BN = new BN(0), threshold:number = 1, fallAddresses:Array<string> = undefined, fallLocktime:BN = UnixNow(), fallThreshold:number = 1):TxUnsigned => { | ||
makeUnsignedTx = (networkid:number, blockchainid:Buffer, amount:BN, toAddresses:Array<string>, fromAddresses:Array<string>, changeAddresses:Array<string>, assetID:Buffer = undefined, asOf:BN = UnixNow(), locktime:BN = new BN(0), threshold:number = 1):TxUnsigned => { | ||
const zero:BN = new BN(0); | ||
let spendamount:BN = zero.clone(); | ||
let utxos:Array<UTXO> = this.getAllUTXOs(this.getUTXOIDsByAddress(fromAddresses)); | ||
let utxos:Array<SecpUTXO> = this.getAllUTXOs(this.getUTXOIDsByAddress(fromAddresses)); | ||
let change:BN = zero.clone(); | ||
let outs:Array<Output> = []; | ||
let ins:Array<Input> = []; | ||
let outs:Array<SecpOutput> = []; | ||
let ins:Array<SecpInput> = []; | ||
if(fallAddresses && assetID){ | ||
outs.push(new OutTakeOrLeave(assetID, amount, toAddresses, fallAddresses, locktime, fallLocktime, threshold, fallThreshold)); | ||
} else if(assetID) { | ||
outs.push(new OutPayment(assetID, amount, toAddresses, locktime, threshold)); | ||
} else { | ||
outs.push(new OutCreateAsset(amount, toAddresses, locktime, threshold)) | ||
} | ||
outs.push(new SecpOutput(assetID, amount, toAddresses, locktime, threshold)); | ||
@@ -526,7 +638,7 @@ for(let i = 0; i < utxos.length && spendamount.lt(amount); i++){ | ||
let txidx:Buffer = utxos[i].getTxIdx(); | ||
let input:Input = new Input(txid, txidx, amt, assetID); | ||
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, tol:boolean; | ||
[idx, tol] = utxos[i].getAddressIdx(spenders[j]); | ||
let idx:number; | ||
idx = utxos[i].getAddressIdx(spenders[j]); | ||
if(idx == -1){ | ||
@@ -542,3 +654,3 @@ /* istanbul ignore next */ | ||
if(assetID) { | ||
outs.push(new OutPayment(assetID, change, changeAddresses, zero.clone(), 1)); | ||
outs.push(new SecpOutput(assetID, change, changeAddresses, zero.clone(), 1)); | ||
} | ||
@@ -552,5 +664,6 @@ break; | ||
} else { | ||
break; | ||
continue; | ||
} | ||
} | ||
if(spendamount.lt(amount)){ | ||
@@ -572,3 +685,3 @@ /* istanbul ignore next */ | ||
*/ | ||
merge = (utxoset:UTXOSet, hasUTXOIDs:Array<string> | boolean = false): UTXOSet => { | ||
merge = (utxoset:UTXOSet, hasUTXOIDs:Array<string> = undefined): UTXOSet => { | ||
let results:UTXOSet = new UTXOSet(); | ||
@@ -684,2 +797,2 @@ let utxos1:Array<UTXO> = this.getAllUTXOs(hasUTXOIDs); | ||
} | ||
} | ||
} |
@@ -79,7 +79,7 @@ /** | ||
* @param core A reference to the Slopes class | ||
* @param baseurl Defaults to the string "/ext/subnet/platform" as the path to subnets baseurl | ||
* @param baseurl Defaults to the string "/ext/platform" as the path to subnets baseurl | ||
*/ | ||
constructor(core:SlopesCore, baseurl:string = "/ext/subnet/platform"){ super(core, baseurl); } | ||
constructor(core:SlopesCore, baseurl:string = "/ext/platform"){ super(core, baseurl); } | ||
} | ||
export default PlatformAPI; |
@@ -73,3 +73,3 @@ /** | ||
this.addAPI("admin", AdminAPI); | ||
this.addAPI("avm", AVMAPI, "/ext/subnet/avm", chainid); | ||
this.addAPI("avm", AVMAPI, "/ext/bc/avm", chainid); | ||
this.addAPI("platform", PlatformAPI); | ||
@@ -96,6 +96,6 @@ this.addAPI("keystore", KeystoreAPI); | ||
export {Tx, TxUnsigned} from './apis/avm/tx'; | ||
export {UTXO, UTXOSet} from './apis/avm/utxos'; | ||
export {UTXO, SecpUTXO, UTXOSet} from './apis/avm/utxos'; | ||
export {SigIdx, Signature, UnixNow, Address} from './apis/avm/types'; | ||
export {OutCreateAsset, OutPayment, OutTakeOrLeave, Output, SelectOutputClass} from './apis/avm/outputs'; | ||
export {Input} from './apis/avm/inputs'; | ||
export {SecpOutput, Output, SelectOutputClass} from './apis/avm/outputs'; | ||
export {SecpInput, Input} from './apis/avm/inputs'; | ||
export {AVMKeyPair, AVMKeyChain} from './apis/avm/keychain'; | ||
@@ -102,0 +102,0 @@ |
@@ -252,3 +252,3 @@ /** | ||
*/ | ||
makeKey:(entropy:Buffer | boolean) => string; | ||
makeKey:(entropy?:Buffer) => string; | ||
@@ -274,3 +274,3 @@ /** | ||
/** | ||
* Adds the key pair to the list of the keys manages in the keychain. | ||
* Adds the key pair to the list of the keys managed in the keychain. | ||
* | ||
@@ -284,2 +284,26 @@ * @param newKey A key pair of the appropriate class to be added to 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 | ||
* | ||
* @returns The boolean true if a key was removed. | ||
*/ | ||
removeKey = (key:KPClass | string) => { | ||
let kaddr:string; | ||
if(typeof key !== "string"){ | ||
kaddr = key.getAddress(); | ||
} else if(typeof key === 'string'){ | ||
kaddr = key; | ||
} else { | ||
return false; | ||
} | ||
if(kaddr in this.keys){ | ||
delete this.keys[kaddr]; | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
/** | ||
* Checks if there is a key associated with the provided address. | ||
@@ -286,0 +310,0 @@ * |
@@ -106,3 +106,3 @@ /** | ||
*/ | ||
getUTXOs: (addresses: string[], persistOpts?: boolean | PersistanceOptions) => Promise<UTXOSet>; | ||
getUTXOs: (addresses: string[], persistOpts?: PersistanceOptions) => Promise<UTXOSet>; | ||
/** | ||
@@ -121,5 +121,2 @@ * Helper function which creates an unsigned transaction. For more granular control, you may create your own | ||
* @param threshold The number of signatures required to spend the funds in the resultant UTXO | ||
* @param fallAddresses The fallback addresses which can spend the funds in the resultant UTXO | ||
* @param fallLocktime The fallback locktime timestamp which is greater than the locktime and used as an expiration date for the locktime as a {@link https://github.com/indutny/bn.js/|BN} | ||
* @param fallThreshold The fallback threshold for the number of signatures required from the fallback addresses to spend the resultant UTXO | ||
* | ||
@@ -131,3 +128,3 @@ * @returns An unsigned transaction created from the passed in parameters. | ||
*/ | ||
makeUnsignedTx: (utxoset: UTXOSet, amount: BN, toAddresses: string[], fromAddresses: string[], changeAddresses: string[], assetID?: string | Buffer, asOf?: BN, locktime?: BN, threshold?: number, fallAddresses?: string[], fallLocktime?: BN, fallThreshold?: number) => TxUnsigned; | ||
makeUnsignedTx: (utxoset: UTXOSet, amount: BN, toAddresses: string[], fromAddresses: string[], changeAddresses: string[], assetID?: string | Buffer, asOf?: BN, locktime?: BN, threshold?: number) => TxUnsigned; | ||
/** | ||
@@ -153,3 +150,3 @@ * Helper function which takes an unsigned transaction and signs it, returning the resulting [[Tx]]. | ||
* @param core A reference to the Slopes class | ||
* @param baseurl Defaults to the string "/ext/subnet/avm" as the path to subnets baseurl | ||
* @param baseurl Defaults to the string "/ext/bc/avm" as the path to subnets baseurl | ||
*/ | ||
@@ -156,0 +153,0 @@ constructor(core: SlopesCore, baseurl?: string, blockchainID?: string); |
@@ -88,5 +88,5 @@ "use strict"; | ||
* @param core A reference to the Slopes class | ||
* @param baseurl Defaults to the string "/ext/subnet/avm" as the path to subnets baseurl | ||
* @param baseurl Defaults to the string "/ext/bc/avm" as the path to subnets baseurl | ||
*/ | ||
constructor(core, baseurl = "/ext/subnet/avm", blockchainID = "") { | ||
constructor(core, baseurl = "/ext/bc/avm", blockchainID = "") { | ||
super(core, baseurl); | ||
@@ -164,3 +164,3 @@ /** | ||
*/ | ||
this.getUTXOs = (addresses, persistOpts = false) => __awaiter(this, void 0, void 0, function* () { | ||
this.getUTXOs = (addresses, persistOpts = undefined) => __awaiter(this, void 0, void 0, function* () { | ||
let params = { | ||
@@ -202,5 +202,2 @@ "addresses": addresses | ||
* @param threshold The number of signatures required to spend the funds in the resultant UTXO | ||
* @param fallAddresses The fallback addresses which can spend the funds in the resultant UTXO | ||
* @param fallLocktime The fallback locktime timestamp which is greater than the locktime and used as an expiration date for the locktime as a {@link https://github.com/indutny/bn.js/|BN} | ||
* @param fallThreshold The fallback threshold for the number of signatures required from the fallback addresses to spend the resultant UTXO | ||
* | ||
@@ -212,7 +209,7 @@ * @returns An unsigned transaction created from the passed in parameters. | ||
*/ | ||
this.makeUnsignedTx = (utxoset, amount, toAddresses, fromAddresses, changeAddresses, assetID = undefined, asOf = types_2.UnixNow(), locktime = new bn_js_1.default(0), threshold = 1, fallAddresses = undefined, fallLocktime = types_2.UnixNow(), fallThreshold = 1) => { | ||
this.makeUnsignedTx = (utxoset, amount, toAddresses, fromAddresses, changeAddresses, assetID = undefined, asOf = types_2.UnixNow(), locktime = new bn_js_1.default(0), threshold = 1) => { | ||
if (typeof assetID === "string") { | ||
assetID = bintools.avaDeserialize(assetID); | ||
} | ||
return utxoset.makeUnsignedTx(this.core.getNetworkID(), bintools.avaDeserialize(this.blockchainID), amount, toAddresses, fromAddresses, changeAddresses, assetID, asOf, locktime, threshold, fallAddresses, fallLocktime, fallThreshold); | ||
return utxoset.makeUnsignedTx(this.core.getNetworkID(), bintools.avaDeserialize(this.blockchainID), amount, toAddresses, fromAddresses, changeAddresses, assetID, asOf, locktime, threshold); | ||
}; | ||
@@ -263,2 +260,2 @@ /** | ||
exports.default = A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HRcIl1bXCJ1dHhvc1wiXTtcbiAgICAgICAgICAgIGlmKHBlcnNpc3RPcHRzICYmIHR5cGVvZiBwZXJzaXN0T3B0cyA9PT0gJ29iamVjdCcpe1xuICAgICAgICAgICAgICAgIGlmKHRoaXMuZGIuaGFzKHBlcnNpc3RPcHRzLmdldE5hbWUoKSkpe1xuICAgICAgICAgICAgICAgICAgICBsZXQgc2VsZkFycmF5OkFycmF5PHN0cmluZz4gPSB0aGlzLmRiLmdldChwZXJzaXN0T3B0cy5nZXROYW1lKCkpO1xuICAgICAgICAgICAgICAgICAgICBpZihBcnJheS5pc0FycmF5KHNlbGZBcnJheSkpe1xuICAgICAgICAgICAgICAgICAgICAgICAgdXR4b3MuYWRkQXJyYXkoZGF0YSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgc2VsZjpVVFhPU2V0ID0gbmV3IFVUWE9TZXQoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuYWRkQXJyYXkoc2VsZkFycmF5KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYubWVyZ2VCeVJ1bGUodXR4b3MsIHBlcnNpc3RPcHRzLmdldE1lcmdlUnVsZSgpKVxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSA9IHNlbGYuZ2V0QWxsVVRYT1N0cmluZ3MoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB0aGlzLmRiLnNldChwZXJzaXN0T3B0cy5nZXROYW1lKCksIGRhdGEsIHBlcnNpc3RPcHRzLmdldE92ZXJ3cml0ZSgpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHV0eG9zLmFkZEFycmF5KGRhdGEpO1xuICAgICAgICAgICAgcmV0dXJuIHV0eG9zO1xuICAgICAgICB9KTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBIZWxwZXIgZnVuY3Rpb24gd2hpY2ggY3JlYXRlcyBhbiB1bnNp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UNoYWluKCk7XG4gICAgICAgIHRoaXMuYmxvY2tjaGFpbklEID0gYmxvY2tjaGFpbklEXG4gICAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBBVk1BUEk7Il19 |
@@ -21,14 +21,10 @@ /** | ||
export declare class Input { | ||
protected id: Buffer; | ||
protected txid: Buffer; | ||
protected txidx: Buffer; | ||
protected assetid: Buffer; | ||
protected amount: Buffer; | ||
protected amountValue: BN; | ||
protected numAddr: Buffer; | ||
protected sigIdxs: Array<SigIdx>; | ||
protected inputid: Buffer; | ||
/** | ||
* Returns a function used to sort an array of [[Input]]s | ||
*/ | ||
static comparitor: () => (a: Input, b: Input) => 0 | 1 | -1; | ||
static comparator: () => (a: Input, b: Input) => 0 | 1 | -1; | ||
/** | ||
@@ -39,9 +35,5 @@ * Returns a base-58 string representation of the UTXOID this [[Input]] references. | ||
/** | ||
* Returns the array of [[SigIdx]] for this [[Input]] | ||
*/ | ||
getSigIdxs: () => SigIdx[]; | ||
/** | ||
* Returns the number for the input type of the output class. | ||
*/ | ||
getInputType: () => number; | ||
getInputID: () => number; | ||
/** | ||
@@ -54,3 +46,3 @@ * Returns the assetID of the input. | ||
*/ | ||
protected _basicTxInBuffer: () => Buffer; | ||
protected _basicInBuffer: () => Buffer; | ||
/** | ||
@@ -73,2 +65,41 @@ * 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. | ||
/** | ||
* Class representing an Input for a transaction. | ||
* | ||
* @param txid A {@link https://github.com/feross/buffer|Buffer} containing the transaction ID of the referenced UTXO | ||
* @param txidx A {@link https://github.com/feross/buffer|Buffer} containing the index of the output in the transaction consumed in the [[Input]] | ||
* @param assetID A {@link https://github.com/feross/buffer|Buffer} representing the assetID of the [[Input]] | ||
* @param inputid A number representing the InputID of the [[Input]] | ||
*/ | ||
constructor(txid?: Buffer, txidx?: Buffer, assetID?: Buffer, inputid?: number); | ||
} | ||
export declare class SecpInput extends Input { | ||
protected amount: Buffer; | ||
protected amountValue: BN; | ||
protected numAddr: Buffer; | ||
protected sigIdxs: Array<SigIdx>; | ||
/** | ||
* Returns the array of [[SigIdx]] for this [[Input]] | ||
*/ | ||
getSigIdxs: () => SigIdx[]; | ||
/** | ||
* @ignore | ||
*/ | ||
protected _basicSecpInBuffer: () => Buffer; | ||
/** | ||
* 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; | ||
/** | ||
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[Input]]. | ||
*/ | ||
toBuffer: () => Buffer; | ||
/** | ||
* Returns a base-58 representation of the [[Input]]. | ||
*/ | ||
toString: () => string; | ||
/** | ||
* Creates and adds a [[SigIdx]] to the [[Input]]. | ||
@@ -75,0 +106,0 @@ * |
@@ -17,2 +17,3 @@ "use strict"; | ||
const bintools = bintools_1.default.getInstance(); | ||
const SECPINPUTID = 6; | ||
/** | ||
@@ -38,13 +39,9 @@ * Class representing an Input for a transaction. | ||
* @param assetID A {@link https://github.com/feross/buffer|Buffer} representing the assetID of the [[Input]] | ||
* @param amount A {@link https://github.com/indutny/bn.js/|BN} containing the amount of the output to be consumed | ||
* @param inputid A number representing the InputID of the [[Input]] | ||
*/ | ||
constructor(txid, txidx, amount, assetID) { | ||
this.id = buffer_1.Buffer.alloc(4); | ||
constructor(txid, txidx, assetID, inputid) { | ||
this.txid = buffer_1.Buffer.alloc(32); | ||
this.txidx = buffer_1.Buffer.alloc(4); | ||
this.assetid = buffer_1.Buffer.alloc(32); | ||
this.amount = buffer_1.Buffer.alloc(8); | ||
this.amountValue = new bn_js_1.default(0); | ||
this.numAddr = buffer_1.Buffer.alloc(4); | ||
this.sigIdxs = []; // idxs of signers from utxo | ||
this.inputid = buffer_1.Buffer.alloc(4); | ||
/** | ||
@@ -57,12 +54,6 @@ * Returns a base-58 string representation of the UTXOID this [[Input]] references. | ||
/** | ||
* Returns the array of [[SigIdx]] for this [[Input]] | ||
*/ | ||
this.getSigIdxs = () => { | ||
return this.sigIdxs; | ||
}; | ||
/** | ||
* Returns the number for the input type of the output class. | ||
*/ | ||
this.getInputType = () => { | ||
return this.id.readUInt32BE(0); | ||
this.getInputID = () => { | ||
return this.inputid.readUInt32BE(0); | ||
}; | ||
@@ -78,7 +69,93 @@ /** | ||
*/ | ||
this._basicTxInBuffer = () => { | ||
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 - TxOut._basicTxBuffer: " + e; | ||
/* istanbul ignore next */ | ||
throw new Error(emsg); | ||
} | ||
}; | ||
/** | ||
* 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) => { | ||
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; | ||
}; | ||
/** | ||
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[Input]]. | ||
*/ | ||
this.toBuffer = () => { | ||
return this._basicInBuffer(); | ||
}; | ||
/** | ||
* Returns a base-58 representation of the [[Input]]. | ||
*/ | ||
this.toString = () => { | ||
return bintools.bufferToB58(this.toBuffer()); | ||
}; | ||
if (txid && txidx && assetID && inputid) { | ||
this.inputid.writeUInt32BE(inputid, 0); | ||
this.txid = txid; | ||
this.txidx = txidx; | ||
this.assetid = assetID; | ||
} | ||
} | ||
} | ||
exports.Input = Input; | ||
/** | ||
* Returns a function used to sort an array of [[Input]]s | ||
*/ | ||
Input.comparator = () => { | ||
return function (a, b) { | ||
return buffer_1.Buffer.compare(a.toBuffer(), b.toBuffer()); | ||
}; | ||
}; | ||
class SecpInput extends Input { | ||
/** | ||
* Class representing an Input for a transaction. | ||
* | ||
* @param txid A {@link https://github.com/feross/buffer|Buffer} containing the transaction ID of the referenced UTXO | ||
* @param txidx A {@link https://github.com/feross/buffer|Buffer} containing the index of the output in the transaction consumed in the [[Input]] | ||
* @param assetID A {@link https://github.com/feross/buffer|Buffer} representing the assetID of the [[Input]] | ||
* @param amount A {@link https://github.com/indutny/bn.js/|BN} containing the amount of the output to be consumed | ||
*/ | ||
constructor(txid, txidx, amount, assetID) { | ||
super(txid, txidx, assetID, types_1.Constants.SECPINPUTID); | ||
this.amount = buffer_1.Buffer.alloc(8); | ||
this.amountValue = new bn_js_1.default(0); | ||
this.numAddr = buffer_1.Buffer.alloc(4); | ||
this.sigIdxs = []; // idxs of signers from utxo | ||
/** | ||
* Returns the array of [[SigIdx]] for this [[Input]] | ||
*/ | ||
this.getSigIdxs = () => { | ||
return this.sigIdxs; | ||
}; | ||
/** | ||
* @ignore | ||
*/ | ||
this._basicSecpInBuffer = () => { | ||
try { | ||
this.numAddr.writeUInt32BE(this.sigIdxs.length, 0); | ||
let bsize = this.id.length + this.txid.length + this.txidx.length + this.assetid.length + this.amount.length + this.numAddr.length; | ||
let barr = [this.id, this.txid, this.txidx, this.assetid, this.amount, this.numAddr]; | ||
let bsize = this.amount.length + this.numAddr.length; | ||
let barr = [this.amount, this.numAddr]; | ||
for (let i = 0; i < this.sigIdxs.length; i++) { | ||
@@ -108,10 +185,2 @@ let b = this.sigIdxs[i].toBuffer(); | ||
let offset = 0; | ||
this.id = bintools.copyFrom(bytes, offset, offset + 4); | ||
offset += 4; | ||
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.amount = bintools.copyFrom(bytes, offset, offset + 8); | ||
@@ -136,3 +205,5 @@ offset += 8; | ||
this.toBuffer = () => { | ||
return this._basicTxInBuffer(); | ||
let basicin = this._basicInBuffer(); | ||
let secp = this._basicSecpInBuffer(); | ||
return buffer_1.Buffer.concat([basicin, secp]); | ||
}; | ||
@@ -161,3 +232,3 @@ /** | ||
if (txid && txidx && amount && assetID) { | ||
this.id.writeUInt32BE(0, 0); | ||
this.inputid.writeUInt32BE(types_1.Constants.SECPINPUTID, 0); | ||
this.txid = txid; | ||
@@ -172,11 +243,3 @@ this.txidx = txidx; | ||
} | ||
exports.Input = Input; | ||
/** | ||
* Returns a function used to sort an array of [[Input]]s | ||
*/ | ||
Input.comparitor = () => { | ||
return function (a, b) { | ||
return buffer_1.Buffer.compare(a.toBuffer(), b.toBuffer()); | ||
}; | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2FwaXMvYXZtL2lucHV0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBOztHQUVHO0FBQ0gsb0NBQStCO0FBQy9CLG9FQUE0QztBQUM1QyxrREFBdUI7QUFDdkIsbUNBQWlDO0FBRWpDOztHQUVHO0FBQ0gsTUFBTSxRQUFRLEdBQUcsa0JBQVEsQ0FBQyxXQUFXLEVBQUUsQ0FBQztBQUV4Qzs7Ozs7Ozs7Ozs7O0dBWUc7QUFDSCxNQ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zLlNFQ1BJTlBVVElEKTtcbiAgICAgICAgaWYodHhpZCAmJiB0eGlkeCAmJiBhbW91bnQgJiYgYXNzZXRJRCl7XG4gICAgICAgICAgICB0aGlzLmlucHV0aWQud3JpdGVVSW50MzJCRShDb25zdGFudHMuU0VDUElOUFVUSUQsMCk7XG4gICAgICAgICAgICB0aGlzLnR4aWQgPSB0eGlkO1xuICAgICAgICAgICAgdGhpcy50eGlkeCA9IHR4aWR4O1xuICAgICAgICAgICAgdGhpcy5hc3NldGlkID0gYXNzZXRJRDtcbiAgICAgICAgICAgIHRoaXMuYW1vdW50VmFsdWUgPSBhbW91bnQ7XG4gICAgICAgICAgICB0aGlzLmFtb3VudCA9IGJpbnRvb2xzLmZyb21CTlRvQnVmZmVyKGFtb3VudCwgOCk7XG4gICAgICAgICAgICB0aGlzLnNpZ0lkeHMgPSBbXTtcbiAgICAgICAgfVxuICAgICAgICBcbiAgICB9XG59Il19 |
@@ -86,3 +86,3 @@ /** | ||
*/ | ||
constructor(entropy?: Buffer | boolean); | ||
constructor(entropy?: Buffer); | ||
} | ||
@@ -102,3 +102,3 @@ /** | ||
*/ | ||
makeKey: (entropy?: boolean | Buffer) => string; | ||
makeKey: (entropy?: Buffer) => string; | ||
/** | ||
@@ -105,0 +105,0 @@ * Given a private key, makes a new key pair, returns the address. |
@@ -50,3 +50,3 @@ "use strict"; | ||
*/ | ||
constructor(entropy = false) { | ||
constructor(entropy = undefined) { | ||
super(); | ||
@@ -201,3 +201,3 @@ /** | ||
*/ | ||
this.makeKey = (entropy = false) => { | ||
this.makeKey = (entropy = undefined) => { | ||
let keypair = new AVMKeyPair(entropy); | ||
@@ -242,2 +242,3 @@ this.addKey(keypair); | ||
for (let i = 0; i < ins.length; i++) { | ||
let arrsigs = []; | ||
let sigidxs = ins[i].getSigIdxs(); | ||
@@ -249,4 +250,5 @@ for (let j = 0; j < sigidxs.length; j++) { | ||
sig.fromBuffer(signval); | ||
sigs.push(sig); | ||
arrsigs.push(sig); | ||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8qKlxuICAgICAqIEdpdmVuIGEgcHJpdmF0ZSBrZXksIG1ha2VzIGEgbmV3IGtleSBwYWlyLCByZXR1cm5zIHRoZSBhZGRyZXNzLlxuICAgICAqIFxuICAgICAqIEBwYXJhbSBwcml2ayBBIHtAbGluayBodHRwczovL2dpdGh1Yi5jb20vZmVyb3NzL2J1ZmZlcnxCdWZmZXJ9IG9yIEFWQSBzZXJpYWxpemVkIHN0cmluZyByZXByZXNlbnRpbmcgdGhlIHByaXZhdGUga2V5IFxuICAgICAqIFxuICAgICAqIEByZXR1cm5zIEFkZHJlc3Mgb2YgdGhlIG5ldyBrZXkgcGFpclxuICAgICAqL1xuICAgIGltcG9ydEtleSA9IChwcml2azpCdWZmZXIgfCBzdHJpbmcpOnN0cmluZyA9PiB7XG4gICAgICAgIGxldCBrZXlwYWlyOkFWTUtleVBhaXIgPSBuZXcgQVZNS2V5UGFpcigpO1xuICAgICAgICBsZXQgcGs6QnVmZmVyO1xuICAgICAgICBpZih0eXBlb2YgcHJpdmsgPT09ICdzdHJpbmcnKXtcbiAgICAgICAgICAgIHBrID0gYmludG9vbHMuYXZhRGVzZXJpYWxpemUocHJpdmspO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcGsgPSBiaW50b29scy5jb3B5RnJvbShwcml2ayk7XG4gICAgICAgIH1cbiAgICAgICAga2V5cGFpci5pbXBvcnRLZXkocGspO1xuICAgICAgICBpZighKGtleXBhaXIuZ2V0QWRkcmVzcygpIGluIHRoaXMua2V5cykpe1xuICAgICAgICAgICAgdGhpcy5hZGRLZXkoa2V5cGFpcik7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGtleXBhaXIuZ2V0QWRkcmVzcygpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFNpZ25zIGEgW1tUeFVuc2lnbmVkXV0gYW5kIHJldHVybnMgc2lnbmVkIFtbVHhdXVxuICAgICAqIFxuICAgICAqIEBwYXJhbSB1dHggQSBbW1R4VW5zaWdu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dHVyZSA9IG5ldyBTaWduYXR1cmUoKTtcbiAgICAgICAgICAgICAgICBzaWcuZnJvbUJ1ZmZlcihzaWdudmFsKTtcbiAgICAgICAgICAgICAgICBhcnJzaWdzLnB1c2goc2lnKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHNpZ3MucHVzaChhcnJzaWdzKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbmV3IFR4KHV0eCwgc2lncyk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogUmV0dXJucyBpbnN0YW5jZSBvZiBBVk1LZXlDaGFpbi5cbiAgICAgKi9cbiAgICBjb25zdHJ1Y3Rvcigpe1xuICAgICAgICBzdXBlcigpO1xuICAgIH1cbn0iXX0= |
@@ -8,5 +8,5 @@ /** | ||
/** | ||
* Output: | ||
* | ||
* Output Payment: | ||
* OutputID | 04 bytes | ||
* AssetID | 32 bytes | ||
* Amount | 08 bytes | ||
@@ -31,126 +31,17 @@ * Locktime | 08 bytes | ||
export declare abstract class Output { | ||
protected id: Buffer; | ||
protected idnum: number; | ||
protected amount: Buffer; | ||
protected amountValue: BN; | ||
abstract getOutputType: () => number; | ||
abstract getAmount: () => BN; | ||
protected outputid: Buffer; | ||
protected outputidnum: number; | ||
protected assetid: Buffer; | ||
abstract getOutputID: () => number; | ||
abstract getAssetID: () => Buffer; | ||
abstract getAddresses: () => { | ||
[address: string]: BN; | ||
}; | ||
abstract getAddressIdx: (address: string) => [number, boolean]; | ||
abstract getAddress: (idx: number, tol: boolean) => string; | ||
abstract fromBuffer: (utxobuff: Buffer) => number; | ||
abstract toBuffer: () => Buffer; | ||
abstract toString: () => string; | ||
abstract getSpenders: (addresses: Array<string>, asOf: BN | boolean) => Array<string>; | ||
abstract meetsThreshold: (addresses: Array<string>, asOf: BN | boolean) => boolean; | ||
static comparitor: () => (a: Output, b: Output) => 0 | 1 | -1; | ||
constructor(amount?: BN, assetID?: Buffer); | ||
static comparator: () => (a: Output, b: Output) => 0 | 1 | -1; | ||
constructor(outputidnum: number, assetID?: Buffer); | ||
} | ||
/** | ||
* An [[Output]] class which creates an assetID. | ||
*/ | ||
export declare class OutCreateAsset extends Output { | ||
protected locktime: Buffer; | ||
protected threshold: Buffer; | ||
protected numaddrs: Buffer; | ||
protected addresses: Array<Address>; | ||
/** | ||
* @ignore | ||
*/ | ||
protected _CAGetAddresses: () => { | ||
[address: string]: BN; | ||
}; | ||
/** | ||
* Returns the number for the output type of the output class. | ||
*/ | ||
getOutputType: () => number; | ||
/** | ||
* Returns the amount as a {@link https://github.com/indutny/bn.js/|BN}. | ||
*/ | ||
getAmount: () => BN; | ||
/** | ||
* Returns the threshold of signers required to spend this output. | ||
*/ | ||
getThreshold: () => number; | ||
/** | ||
* Returns the a {@link https://github.com/indutny/bn.js/|BN} repersenting the UNIX Timestamp when the lock is made available. | ||
*/ | ||
getLocktime: () => BN; | ||
/** | ||
* Returns the assetID as a {@link https://github.com/feross/buffer|Buffer}. | ||
*/ | ||
getAssetID: () => 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). | ||
* | ||
* @param address 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. | ||
*/ | ||
getAddressIdx: (address: string) => [number, boolean]; | ||
/** | ||
* Returns the address from the index provided. | ||
* | ||
* @param idx The index of the address. | ||
* @param tol Unused, there for compatibility. | ||
* | ||
* @returns Returns the string representing the address. | ||
*/ | ||
getAddress: (idx: number, tol?: boolean) => string; | ||
/** | ||
* @ignore | ||
*/ | ||
protected _OCAParseBuffer: (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. | ||
*/ | ||
fromBuffer: (utxobuff: Buffer) => number; | ||
/** | ||
* @ignore | ||
*/ | ||
protected _OCATxBuffer: () => Buffer; | ||
/** | ||
* Returns the buffer representing the [[OutCreateAsset]] instance. | ||
*/ | ||
toBuffer: () => Buffer; | ||
/** | ||
* Returns a base-58 string representing the [[OutCreateAsset]]. | ||
*/ | ||
toString: () => string; | ||
/** | ||
* @ignore | ||
*/ | ||
protected _OCAQualified: (addresses: string[], asOf?: boolean | 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?: boolean | 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?: boolean | BN) => boolean; | ||
/** | ||
* An [[Output]] class which creates 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 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(amount?: BN, addresses?: Array<string>, locktime?: BN, threshold?: number); | ||
} | ||
/** | ||
* An [[Output]] class which issues a payment on an assetID. | ||
*/ | ||
export declare class OutPayment extends Output { | ||
protected assetid: Buffer; | ||
export declare class SecpOutput extends Output { | ||
protected locktime: Buffer; | ||
@@ -160,2 +51,4 @@ protected threshold: Buffer; | ||
protected addresses: Array<Address>; | ||
protected amount: Buffer; | ||
protected amountValue: BN; | ||
/** | ||
@@ -170,3 +63,3 @@ * @ignore | ||
*/ | ||
getOutputType: () => number; | ||
getOutputID: () => number; | ||
/** | ||
@@ -201,3 +94,3 @@ * Returns the amount as a {@link https://github.com/indutny/bn.js/|BN}. | ||
*/ | ||
getAddressIdx: (address: string) => [number, boolean]; | ||
getAddressIdx: (address: string) => number; | ||
/** | ||
@@ -207,7 +100,6 @@ * Returns the address from the index provided. | ||
* @param idx The index of the address. | ||
* @param tol Unused, there for compatibility. | ||
* | ||
* @returns Returns the string representing the address. | ||
*/ | ||
getAddress: (idx: number, tol?: boolean) => string; | ||
getAddress: (idx: number) => string; | ||
/** | ||
@@ -236,11 +128,11 @@ * @ignore | ||
*/ | ||
protected _OPQualified: (addresses: string[], asOf?: boolean | BN) => string[]; | ||
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?: boolean | BN) => string[]; | ||
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?: boolean | BN) => boolean; | ||
meetsThreshold: (addresses: string[], asOf?: BN) => boolean; | ||
/** | ||
@@ -257,93 +149,2 @@ * An [[Output]] class which issues a payment on an assetID. | ||
} | ||
/** | ||
* An [[Output]] class which issues a payment on an assetID and has fallback addresses and locktimes. | ||
*/ | ||
export declare class OutTakeOrLeave extends OutPayment { | ||
protected fallLocktime: Buffer; | ||
protected fallThreshold: Buffer; | ||
protected numfalladdrs: Buffer; | ||
protected fallAddresses: Array<Address>; | ||
/** | ||
* Returns the threshold of fallback signers required to spend this output. | ||
*/ | ||
getFallThreshold: () => number; | ||
/** | ||
* Returns the a {@link https://github.com/indutny/bn.js/|BN} repersenting the UNIX Timestamp when the fallback lock is made available. | ||
*/ | ||
getFallLocktime: () => BN; | ||
/** | ||
* @ignore | ||
*/ | ||
protected _TOLGetAddresses: () => { | ||
[address: string]: BN; | ||
}; | ||
/** | ||
* 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). | ||
* | ||
* @param address 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. | ||
*/ | ||
getAddressIdx: (address: string) => [number, boolean]; | ||
/** | ||
* Returns the address from the index provided. | ||
* | ||
* @param idx The index of the address. | ||
* @param tol Indicates whether the address is a take it or leave it | ||
* | ||
* @returns Returns the string representing the address. | ||
*/ | ||
getAddress: (idx: number, tol?: boolean) => string; | ||
/** | ||
* @ignore | ||
*/ | ||
protected _TOLParseBuffer: (utxobuff: Buffer, offset: number) => number; | ||
/** | ||
* Popuates the instance from a {@link https://github.com/feross/buffer|Buffer} representing the [[OutTakeOrLeave]] and returns the size of the output. | ||
*/ | ||
fromBuffer: (utxobuff: Buffer) => number; | ||
/** | ||
* @ignore | ||
*/ | ||
protected _TOLBuffer: () => Buffer; | ||
/** | ||
* Returns the buffer representing the [[OutTakeOrLeave]] instance. | ||
*/ | ||
toBuffer: () => Buffer; | ||
/** | ||
* Returns a base-58 string representing the [[OutTakeOrLeave]]. | ||
*/ | ||
toString: () => string; | ||
/** | ||
* @ignore | ||
*/ | ||
protected _TOLQualified: (addresses: string[], asOf?: boolean | 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?: boolean | 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?: boolean | BN) => boolean; | ||
/** | ||
* An [[Output]] class which issues a payment on an assetID and has fallback addresses and locktimes. | ||
* | ||
* @param assetid A {@link https://github.com/feross/buffer|Buffer} representing the 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 falladdresses An array of strings representing fallback addresses | ||
* @param locktime A {@link https://github.com/indutny/bn.js/|BN} representing the locktime | ||
* @param falllocktime A {@link https://github.com/indutny/bn.js/|BN} representing the fallback locktime | ||
* @param threshold A number representing the threshold number of signers required to sign the transaction | ||
* @param fallthreshold A number representing the fallback threshold number of signers required to sign the transaction | ||
*/ | ||
constructor(assetid: Buffer, amount?: BN, addresses?: Array<string>, falladdresses?: Array<string>, locktime?: BN, falllocktime?: BN, threshold?: number, fallthreshold?: number); | ||
} | ||
//# sourceMappingURL=outputs.d.ts.map |
@@ -13,3 +13,3 @@ /** | ||
* Unsigned Tx: | ||
* Codec | 4 bytes | ||
* TxID | 4 bytes | ||
* NetworkID | 4 bytes | ||
@@ -25,3 +25,3 @@ * BlockchainID | 32 bytes | ||
export declare class TxUnsigned { | ||
protected codec: Buffer; | ||
protected txtype: Buffer; | ||
protected networkid: Buffer; | ||
@@ -34,5 +34,5 @@ protected blockchainid: Buffer; | ||
/** | ||
* Returns the number representation of the codec | ||
* Returns the number representation of the txtype | ||
*/ | ||
getCodec: () => number; | ||
getTxType: () => number; | ||
/** | ||
@@ -83,5 +83,5 @@ * Returns the number representation of the NetworkID | ||
* @param blockchainid Optional blockchainid, default Buffer.alloc(32, 16) | ||
* @param codec Optional codec, default 2 | ||
* @param txtype Optional txtype, default 2 | ||
*/ | ||
constructor(ins?: Array<Input>, outs?: Array<Output>, networkid?: number, blockchainid?: Buffer, codec?: number); | ||
constructor(ins?: Array<Input>, outs?: Array<Output>, networkid?: number, blockchainid?: Buffer, txtype?: number); | ||
} | ||
@@ -93,3 +93,3 @@ /** | ||
protected tx: TxUnsigned; | ||
protected signatures: Array<Signature>; | ||
protected signatures: Array<Array<Signature>>; | ||
/** | ||
@@ -131,4 +131,4 @@ * 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. | ||
*/ | ||
constructor(tx?: TxUnsigned, signatures?: Array<Signature>); | ||
constructor(tx?: TxUnsigned, signatures?: Array<Array<Signature>>); | ||
} | ||
//# sourceMappingURL=tx.d.ts.map |
@@ -23,3 +23,3 @@ "use strict"; | ||
* Unsigned Tx: | ||
* Codec | 4 bytes | ||
* TxID | 4 bytes | ||
* NetworkID | 4 bytes | ||
@@ -51,6 +51,6 @@ * BlockchainID | 32 bytes | ||
* @param blockchainid Optional blockchainid, default Buffer.alloc(32, 16) | ||
* @param codec Optional codec, default 2 | ||
* @param txtype Optional txtype, default 2 | ||
*/ | ||
constructor(ins, outs, networkid = 2, blockchainid = buffer_1.Buffer.alloc(32, 16), codec = 2) { | ||
this.codec = buffer_1.Buffer.alloc(4); | ||
constructor(ins, outs, networkid = 2, blockchainid = buffer_1.Buffer.alloc(32, 16), txtype = 0) { | ||
this.txtype = buffer_1.Buffer.alloc(4); | ||
this.networkid = buffer_1.Buffer.alloc(4); | ||
@@ -61,6 +61,6 @@ this.blockchainid = buffer_1.Buffer.alloc(32); | ||
/** | ||
* Returns the number representation of the codec | ||
* Returns the number representation of the txtype | ||
*/ | ||
this.getCodec = () => { | ||
return this.codec.readUInt32BE(0); | ||
this.getTxType = () => { | ||
return this.txtype.readUInt32BE(0); | ||
}; | ||
@@ -102,3 +102,3 @@ /** | ||
let offset = 0; | ||
this.codec = bintools.copyFrom(bytes, offset, offset + 4); | ||
this.txtype = bintools.copyFrom(bytes, offset, offset + 4); | ||
offset += 4; | ||
@@ -136,8 +136,8 @@ this.networkid = bintools.copyFrom(bytes, offset, offset + 4); | ||
try { | ||
this.outs.sort(outputs_1.Output.comparitor()); | ||
this.ins.sort(inputs_1.Input.comparitor()); | ||
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.codec.length + this.networkid.length + this.blockchainid.length + this.numouts.length; | ||
let barr = [this.codec, this.networkid, this.blockchainid, this.numouts]; | ||
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++) { | ||
@@ -177,3 +177,3 @@ let b = this.outs[i].toBuffer(); | ||
}; | ||
this.codec.writeUInt32BE(codec, 0); | ||
this.txtype.writeUInt32BE(txtype, 0); | ||
this.networkid.writeUInt32BE(networkid, 0); | ||
@@ -183,5 +183,5 @@ this.blockchainid = blockchainid; | ||
this.numouts.writeUInt32BE(outs.length, 0); | ||
this.outs = outs.sort(outputs_1.Output.comparitor()); | ||
this.outs = outs.sort(outputs_1.Output.comparator()); | ||
this.numins.writeUInt32BE(ins.length, 0); | ||
this.ins = ins.sort(inputs_1.Input.comparitor()); | ||
this.ins = ins.sort(inputs_1.Input.comparator()); | ||
} | ||
@@ -214,16 +214,21 @@ } | ||
let offset = this.tx.fromBuffer(bytes); | ||
if ((bytes.length - offset) % 65 == 0) { | ||
let numsigs = (bytes.length - offset) / 65; | ||
this.signatures = []; | ||
for (let i = 0; i < numsigs; i++) { | ||
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); | ||
if (credential != types_1.Constants.SECPCREDENTIAL) { | ||
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)); | ||
this.signatures.push(sig); | ||
sigarray.push(sig); | ||
offset += 65; | ||
} | ||
this.signatures.push(sigarray); | ||
} | ||
else { | ||
/* istanbul ignore next */ | ||
throw new Error("Error - Tx.fromBuffer: the signature block's byte length isn't evenly divisible by 65 and it should be"); | ||
} | ||
return offset; | ||
@@ -250,8 +255,21 @@ }; | ||
let txbuff = this.tx.toBuffer(); | ||
let barr = [txbuff]; | ||
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 b = this.signatures[i].toBuffer(); | ||
barr.push(b); | ||
bsize += b.length; | ||
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; | ||
} | ||
} | ||
@@ -286,2 +304,2 @@ let buff = buffer_1.Buffer.concat(barr, bsize); | ||
exports.Tx = Tx; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYXBpcy9hdm0vdHgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQTs7R0FFRztBQUNILG9DQUErQjtBQUMvQixtQ0FBb0M7QUFDcEMsdUNBQXNEO0FBQ3RELHFDQUFpQztBQUNqQyxvRUFBNEM7QUFFNUM7O0dBRUc7QUFDSCxNQUFNLFFBQVEsR0FBRyxrQkFBUSxDQUFDLFdBQVcsRUFBRSxDQUFDO0FBRXhDOzs7Ozs7Ozs7Ozs7OztHQWNHO0FBQ0g7Ozs7R0FJRztBQUNIOzs7R0FHRztBQUNILE1BQWEsVUFBVTtJQW1JbkI7Ozs7Ozs7O09BUUc7SUFDSCxZQUFZLEdBQWlCLEVBQUUsSUFBbUIsRUFBRSxZQUFtQixDQUFDLEVBQUUsZUFBc0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nVmZik7XG4gICAgICAgICAgICB0aGlzLm91dHMucHVzaChvdXQpO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMubnVtaW5zID0gYmludG9vbHMuY29weUZyb20oYnl0ZXMsIG9mZnNldCwgb2Zmc2V0ICsgNCk7XG4gICAgICAgIG9mZnNldCArPSA0O1xuICAgICAgICBsZXQgaW5jb3VudDpudW1iZXIgPSB0aGlzLm51bWlucy5yZWFkVUludDMyQkUoMCk7XG4gICAgICAgIHRoaXMuaW5zID0gW107XG4gICAgICAgIGZvcihsZXQgaSA9IDA7IGkgPCBpbmNvdW50OyBpKyspe1xuICAgICAgICAgICAgbGV0IGluYnVmZjpCdWZmZXIgPSBiaW50b29scy5jb3B5RnJvbShieXRlcywgb2Zmc2V0LCBieXRlcy5sZW5ndGgpO1xuICAgICAgICAgICAgbGV0IGlucHV0OklucHV0ID0gbmV3IElucHV0KCk7XG4gICAgICAgICAgICBvZmZzZXQgKz0gaW5wdXQuZnJvbUJ1ZmZlcihpbmJ1ZmYpO1xuICAgICAgICAgICAgdGhpcy5pbnMucHVzaChpbnB1dCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG9mZnNldDtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBAaWdub3JlXG4gICAgICovXG4gICAgcHJvdGVjdGVkIF9iYXNpY1R4QnVmZmVyID0gKCk6QnVmZmVyID0+IHtcbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIHRoaXMub3V0cy5zb3J0KE91dHB1dC5jb21wYXJpdG9yKCkpO1xuICAgICAgICAgICAgdGhpcy5pbnMuc29ydChJbnB1dC5jb21wYXJpdG9yKCkpO1xuICAgICAgICAgICAgdGhpcy5udW1vdXRzLndyaXRlVUludDMyQkUodGhpcy5vdXRzLmxlbmd0aCwgMCk7XG4gICAgICAgICAgICB0aGlzLm51bWlucy53cml0ZVVJbnQzMkJFKHRoaXMuaW5zLmxlbmd0aCwgMCk7XG4gICAgICAgICAgICBsZXQgYnNpemU6bnVtYmVyID0gdGhpcy5jb2RlYy5sZW5ndGggKyB0aGlzLm5ldHdvcmtpZC5sZW5ndGggKyB0aGlzLmJsb2NrY2hhaW5pZC5sZW5ndGggKyB0aGlzLm51bW91dHMubGVuZ3RoO1xuICAgICAgICAgICAgbGV0IGJhcnI6QXJyYXk8QnVmZmVyPiA9IFt0aGlzLmNvZGVjLCB0aGlzLm5ldHdvcmtpZCwgdGhpcy5ibG9ja2NoYWluaWQsIHRoaXMubnVtb3V0c107XG4gICAgICAgICAgICBmb3IobGV0IGkgPSAwOyBpIDwgdGhpcy5vdXRzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgbGV0IGI6QnVmZmVyID0gdGhpcy5vdXRzW2ldLnRvQnVmZmVyKCk7XG4gICAgICAgICAgICAgICAgYmFyci5wdXNoKGIpO1xuICAgICAgICAgICAgICAgIGJzaXplICs9IGIubGVuZ3RoO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYmFyci5wdXNoKHRoaXMubnVtaW5zKTtcbiAgICAgICAgICAgIGJzaXplICs9IHRoaXMubnVtaW5zLmxlbmd0aDtcbiAgICAgICAgICAgIGZvcihsZXQgaSA9IDA7IGkgPCB0aGlzLmlucy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIGxldCBiOkJ1ZmZlciA9IHRoaXMuaW5zW2ldLnRvQnVmZmVyKCk7XG4gICAgICAgICAgICAgICAgYmFyci5wdXNoKGIpO1xuICAgICAgICAgICAgICAgIGJzaXplICs9IGIubGVuZ3RoO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbGV0IGJ1ZmY6QnVmZmVyID0gQnVmZmVyLmNvbmNhdChiYXJyLCBic2l6ZSk7XG4gICAgICAgICAgICByZXR1cm4gYnVmZjtcbiAgICAgICAgfSBjYXRjaChlKSB7XG4gICAgICAgICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgbmV4dCAqL1xuICAgICAgICAgICAgbGV0IGVtc2c6c3R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hbGl6ZWQgcmVwcmVzZW50YXRpb24gb2YgdGhlIFtbVHhdXS5cbiAgICAgKiBcbiAgICAgKiBAcmVtYXJrcyBcbiAgICAgKiB1bmxpa2UgbW9zdCB0b1N0cmluZ3MsIHRoaXMgcmV0dXJucyBpbiBBVkEgc2VyaWFsaXphdGlvbiBmb3JtYXRcbiAgICAgKi9cbiAgICB0b1N0cmluZyA9ICgpOnN0cmluZyA9PiB7XG4gICAgICAgIHJldHVybiBiaW50b29scy5hdmFTZXJpYWxpemUodGhpcy50b0J1ZmZlcigpKTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBDbGFzcyByZXByZXNlbnRpbmcgYSBzaWduZWQgdHJhbnNhY3Rpb24uXG4gICAgICogXG4gICAgICogQHBhcmFtIHR4IE9wdGlvbmFsIFtbVHhdXVxuICAgICAqIEBwYXJhbSBzaWduYXR1cmVzIE9wdGlvbmFsIGFycmF5IG9mIFtbU2lnbmF0dXJlXV1zXG4gICAgICovXG4gICAgY29uc3RydWN0b3IodHg/OlR4VW5zaWduZWQsIHNpZ25hdHVyZXM/OkFycmF5PFNpZ25hdHVyZT4pIHtcbiAgICAgICAgaWYodHgpe1xuICAgICAgICAgICAgdGhpcy50eCA9IHR4O1xuICAgICAgICAgICAgaWYoc2lnbmF0dXJlcyl7XG4gICAgICAgICAgICAgICAgdGhpcy5zaWduYXR1cmVzID0gc2lnbmF0dXJlc1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuXG5cbiJdfQ== | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYXBpcy9hdm0vdHgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQTs7R0FFRztBQUNILG9DQUErQjtBQUMvQixtQ0FBK0M7QUFDL0MsdUNBQXNEO0FBQ3RELHFD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XTtcbiAgICAgICAgICAgIGZvcihsZXQgaSA9IDA7IGkgPCB0aGlzLm91dHMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICBsZXQgYjpCdWZmZXIgPSB0aGlzLm91dHNbaV0udG9CdWZmZXIoKTtcbiAgICAgICAgICAgICAgICBiYXJyLnB1c2goYik7XG4gICAgICAgICAgICAgICAgYnNpemUgKz0gYi5sZW5ndGg7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBiYXJyLnB1c2godGhpcy5udW1pbnMpO1xuICAgICAgICAgICAgYnNpemUgKz0gdGhpcy5udW1pbnMubGVuZ3RoO1xuICAgICAgICAgICAgZm9yKGxldCBpID0gMDsgaSA8IHRoaXMuaW5zLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgbGV0IGI6QnVmZmVyID0gdGhpcy5pbnNbaV0udG9CdWZmZXIoKTtcbiAgICAgICAgICAgICAgICBiYXJyLnB1c2goYik7XG4gICAgICAgICAgICAgICAgYnNpemUgKz0gYi5sZW5ndGg7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsZXQgYnVmZjpCdWZmZXIgPSBCdWZmZXIuY29uY2F0KGJhcnIsIGJzaXplKTtcbiAgICAgICAgICAgIHJldHVybiBidWZmO1xuICAgICAgICB9IGNhdGNoKGUpIHtcbiAgICAgICAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovXG4gICAgICAgICAgICBsZXQgZW1zZzpzdHJpbmcgPSBcIkVycm9yIC0gVHhVbnNpZ25lZC5fYmFzaWNUeEJ1ZmZlcjogXCIgKyBlO1xuICAgICAgICAgICAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihlbXNnKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFJldHVybnMgYSB7QGxpbmsgaHR0cHM6Ly9naXRodWIuY29tL2Zlcm9zcy9idWZmZXJ8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uY29tL2Zlcm9zcy9idWZmZXJ8QnVmZmVyfSBjb250YWluaW5nIGEgcmF3IFtbVHhdXVxuICAgICAqIFxuICAgICAqIEByZXR1cm5zIFRoZSBsZW5ndGggb2YgdGhlIHJhdyBbW1R4XV1cbiAgICAgKi9cbiAgICBmcm9tQnVmZmVyID0gKGJ5dGVzOkJ1ZmZlcik6bnVtYmVyID0+IHtcbiAgICAgICAgdGhpcy50eCA9IG5ldyBUeFVuc2lnbmVkKCk7XG4gICAgICAgIGxldCBvZmZzZXQ6bnVtYmVyID0gdGhpcy50eC5mcm9tQnVmZmVyKGJ5dGVzKTtcbiAgICAgICAgICAgIGxldCBudW1jcmVkczpudW1iZXIgPSAgIGJpbnRvb2xzLmNvcHlGcm9tKGJ5dGVzLCBvZmZzZXQsIG9mZnNldCArIDQpLnJlYWRVSW50MzJCRSgwKTtcbiAgICAgICAgICAgIG9mZnNldCArPSA0O1xuICAgICAgICAgICAgdGhpcy5zaWduYXR1cmVzID0gW107XG4gICAgICAgICAgICBmb3IobGV0IGkgPSAwOyBpIDwgbnVtY3JlZHM7IGkrKyl7XG4gICAgICAgICAgICAgICAgbGV0IHNpZ2FycmF5OkFycmF5PFNpZ25hdHVyZT4gPSBbXTtcbiAgICAgICAgICAgICAgICBsZXQgY3JlZGVudGlhbDpudW1iZXIgPSBiaW50b29scy5jb3B5RnJvbShieXRlcywgb2Zmc2V0LCBvZmZzZXQgKyA0KS5yZWFkVUludDMyQkUoMCk7XG4gICAgICAgICAgICAgICAgaWYoY3JlZGVudGlhbCAhPSBDb25zdGFudHMuU0VDUENSRURFTlRJQUwpe1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJFcnJvciAtIFR4LmZyb21CdWZmZXI6IEludmFsaWQgY3JlZGVudGlhbElEIFwiICsgY3JlZGVudGlhbCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGxldCBudW1zaWdzOm51bWJlciA9ICAgYmludG9vbHMuY29weUZyb20oYnl0ZXMsIG9mZnNldCwgb2Zmc2V0ICsgNCkucmVhZFVJbnQzMkJFKDApO1xuICAgICAgICAgICAgICAgIG9mZnNldCArPSA0O1xuICAgICAgICAgICAgICAgIGZvcihsZXQgaiA9IDA7IGogIDwgbnVtc2lnczsgaisrKSB7XG4gICAgICAgICAgICAgICAgICAgIGxldCBzaWc6U2lnbmF0dXJlID0gbmV3IFNpZ25hdHVyZSgpO1xuICAgICAgICAgICAgICAgICAgICBzaWcuZnJvbUJ1ZmZlcihiaW50b29scy5jb3B5RnJvbShieXRlcywgb2Zmc2V0LCBvZmZzZXQgKyA2NSkpO1xuICAgICAgICAgICAgICAgICAgICBzaWdhcnJheS5wdXNoKHNpZyk7XG4gICAgICAgICAgICAgICAgICAgIG9mZnNldCArPSA2NTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGhpcy5zaWduYXR1cmVzLnB1c2goc2lnYXJyYXkpO1xuICAgICAgICAgICAgfVxuICAgICAgICByZXR1cm4gb2Zmc2V0O1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBUYWtlcyBhIGJhc2UtNTggc3RyaW5nIGNvbnRhaW5pbmcgYW4gW1tUeF1dLCBwYXJzZXMgaXQsIHBvcHVsYXRlcyB0aGUgY2xhc3MsIGFuZCByZXR1cm5zIHRoZSBsZW5ndGggb2YgdGhlIFR4IGluIGJ5dGVzLlxuICAgICAqIFxuICAgICAqIEBwYXJhbSBzZXJpYWxpemVkIEEgYmFzZS01OCBzdHJpbmcgY29udGFpbmluZyBhIHJhdyBbW1R4XV1cbiAgICAgKiBcbiAgICAgKiBAcmV0dXJucyBUaGUgbGVuZ3RoIG9mIHRoZSByYXcgW1tUeF1dXG4gICAgICogXG4gICAgICogQHJlbWFya3MgXG4gICAgICogdW5saWtlIG1vc3QgZnJvbVN0cmluZ3MsIGl0IGV4cGVjdHMgdGhlIHN0cmluZyB0byBiZSBzZXJpYWxpemVkIGluIEFWQSBmb3JtYXRc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3JlZGVudGlhbElEID0gQnVmZmVyLmFsbG9jKDQpO1xuICAgICAgICAgICAgICAgIGNyZWRlbnRpYWxJRC53cml0ZVVJbnQzMkJFKENvbnN0YW50cy5TRUNQQ1JFREVOVElBTCwgMCk7XG4gICAgICAgICAgICAgICAgYmFyci5wdXNoKGNyZWRlbnRpYWxJRCk7XG4gICAgICAgICAgICAgICAgYnNpemUgKz0gY3JlZGVudGlhbElELmxlbmd0aDtcbiAgICAgICAgICAgICAgICBiYXJyLnB1c2goc2lnbGVuKTtcbiAgICAgICAgICAgICAgICBic2l6ZSArPSBzaWdsZW4ubGVuZ3RoO1xuICAgICAgICAgICAgICAgIGZvcihsZXQgaiA9IDA7IGogPCB0aGlzLnNpZ25hdHVyZXNbaV0ubGVuZ3RoOyBqKyspe1xuICAgICAgICAgICAgICAgICAgICBsZXQgYjpCdWZmZXIgPSB0aGlzLnNpZ25hdHVyZXNbaV1bal0udG9CdWZmZXIoKTtcbiAgICAgICAgICAgICAgICAgICAgYmFyci5wdXNoKGIpO1xuICAgICAgICAgICAgICAgICAgICBic2l6ZSArPSBiLmxlbmd0aDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsZXQgYnVmZjpCdWZmZXIgPSBCdWZmZXIuY29uY2F0KGJhcnIsIGJzaXplKTtcbiAgICAgICAgICAgIHJldHVybiBidWZmO1xuICAgICAgICB9IGNhdGNoKGUpIHtcbiAgICAgICAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovXG4gICAgICAgICAgICBsZXQgZW1zZzpzdHJpbmcgPSBcIkVycm9yIC0gVHhTaWduZWQudG9CdWZmZXI6IFwiICsgZTtcbiAgICAgICAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovXG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoZW1zZyk7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBSZXR1cm5zIGEgYmFzZS01OCBBVkEtc2VyaWFsaXplZCByZXByZXNlbnRhdGlvbiBvZiB0aGUgW1tUeF1dLlxuICAgICAqIFxuICAgICAqIEByZW1hcmtzIFxuICAgICAqIHVubGlrZSBtb3N0IHRvU3RyaW5ncywgdGhpcyByZXR1cm5zIGluIEFWQSBzZXJpYWxpemF0aW9uIGZvcm1hdFxuICAgICAqL1xuICAgIHRvU3RyaW5nID0gKCk6c3RyaW5nID0+IHtcbiAgICAgICAgcmV0dXJuIGJpbnRvb2xzLmF2YVNlcmlhbGl6ZSh0aGlzLnRvQnVmZmVyKCkpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIENsYXNzIHJlcHJlc2VudGluZyBhIHNpZ25lZCB0cmFuc2FjdGlvbi5cbiAgICAgKiBcbiAgICAgKiBAcGFyYW0gdHggT3B0aW9uYWwgW1tUeF1dXG4gICAgICogQHBhcmFtIHNpZ25hdHVyZXMgT3B0aW9uYWwgYXJyYXkgb2YgW1tTaWduYXR1cmVdXXNcbiAgICAgKi9cbiAgICBjb25zdHJ1Y3Rvcih0eD86VHhVbnNpZ25lZCwgc2lnbmF0dXJlcz86QXJyYXk8QXJyYXk8U2lnbmF0dXJlPj4pIHtcbiAgICAgICAgaWYodHgpe1xuICAgICAgICAgICAgdGhpcy50eCA9IHR4O1xuICAgICAgICAgICAgaWYoc2lnbmF0dXJlcyl7XG4gICAgICAgICAgICAgICAgdGhpcy5zaWduYXR1cmVzID0gc2lnbmF0dXJlc1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuXG5cbiJdfQ== |
@@ -55,2 +55,8 @@ import { NBytes } from '../../utils/types'; | ||
} | ||
export declare class Constants { | ||
static SECPOUTPUTID: number; | ||
static SECPINPUTID: number; | ||
static BASETX: number; | ||
static SECPCREDENTIAL: number; | ||
} | ||
/** | ||
@@ -57,0 +63,0 @@ * Rules used when merging sets |
@@ -112,2 +112,9 @@ "use strict"; | ||
}; | ||
class Constants { | ||
} | ||
exports.Constants = Constants; | ||
Constants.SECPOUTPUTID = 4; | ||
Constants.SECPINPUTID = 6; | ||
Constants.BASETX = 0; | ||
Constants.SECPCREDENTIAL = 7; | ||
/** | ||
@@ -121,2 +128,2 @@ * Function providing the current UNIX time using a {@link https://github.com/indutny/bn.js/|BN} | ||
; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYXBpcy9hdm0vdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQTs7R0FFRztBQUNILG9DQUErQjtBQUMvQiw2Q0FBMkM7QUFDM0Msa0RBQXVCO0FBQ3ZCLG9FQUE0QztBQUU1Qzs7R0FFRztBQUNILElBQUksUUFBUSxHQUFZLGtCQUFRLENBQUMsV0FBVyxFQUFFLENBQUM7QUFFL0M7O0dBRUc7QUFDSCxNQUFhLE1BQU8sU0FBUSxjQUFNO0lBaUI5Qjs7T0FFRztJQUNIO1FBQ0ksS0FBSyxFQUFFLENBQUM7UUFsQlo7O1dBRUc7UUFDSCxjQUFTLEdBQUcsQ0FBQyxPQUFjLEVBQUUsRUFBRTtZQUMzQixJQUFJLENBQUMsTUFBTSxHQUFHLE9BQU8sQ0FBQztRQUMxQixDQUFDLENBQUE7UUFFRDs7V0FFRztRQUNILGNBQVMsR0FBRyxHQUFVLEVBQUU7WUFDcEIsT0FBTyxJQUFJLENBQUMsTUFBTSxDQUFDO1FBQ3ZCLENBQUMsQ0FBQTtRQU9HLElBQUksQ0FBQyxLQUFLLEdBQUcsZUFBTSxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUM3QixJQUFJLENBQUMsS0FBSyxHQUFHLENBQUMsQ0FBQztJQUNuQixDQUFDO0NBQ0o7QUF6QkQsd0JBeUJDO0FBRUQ7O0dBRUc7QUFDSCxNQUFhLFNB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lxuICogRnVuY3Rpb24gcHJvdmlkaW5nIHRoZSBjdXJyZW50IFVOSVggdGltZSB1c2luZyBhIHtAbGluayBodHRwczovL2dpdGh1Yi5jb20vaW5kdXRueS9ibi5qcy98Qk59XG4gKi9cbmV4cG9ydCBmdW5jdGlvbiBVbml4Tm93KCk6Qk4ge1xuICAgIHJldHVybiBuZXcgQk4oTWF0aC5yb3VuZCgobmV3IERhdGUoKSkuZ2V0VGltZSgpIC8gMTAwMCkpO1xufTsiXX0= |
@@ -6,14 +6,75 @@ /** | ||
import BN from "bn.js"; | ||
import { Output } from './outputs'; | ||
import { SecpOutput } from './outputs'; | ||
import { MergeRule } from './types'; | ||
import { TxUnsigned } from './tx'; | ||
/** | ||
* Takes a buffer representing the output and returns the proper UTXO instance. | ||
* | ||
* @param utxobuffer A {@link https://github.com/feross/buffer|Buffer} containing the [[UTXO]] raw data. | ||
* | ||
* @returns An instance of an [[UTXO]]-extended class. ex. [[SecpUTXO]]. | ||
*/ | ||
export declare const SelectUTXOClass: (utxobuffer: Buffer, args?: any[]) => UTXO; | ||
/** | ||
* Class for representing a single UTXO. | ||
*/ | ||
export declare class UTXO { | ||
export declare abstract class UTXO { | ||
protected txid: Buffer; | ||
protected txidx: Buffer; | ||
protected output: Output; | ||
getOuputType: () => number; | ||
abstract getOuputID: () => number; | ||
/** | ||
* Returns a {@link https://github.com/feross/buffer|Buffer} of the TxID. | ||
*/ | ||
getTxID: () => Buffer; | ||
/** | ||
* Returns a {@link https://github.com/feross/buffer|Buffer} of the TxIdx. | ||
*/ | ||
getTxIdx: () => Buffer; | ||
/** | ||
* Returns the UTXOID as a base-58 string (UTXOID is a string ) | ||
*/ | ||
getUTXOID: () => string; | ||
_basicUTXOBuffer: (utxobuff: any) => void; | ||
/** | ||
* 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. | ||
* | ||
* @param bytes A {@link https://github.com/feross/buffer|Buffer} containing a raw [[UTXO]] | ||
*/ | ||
fromBuffer: (utxobuff: Buffer) => void; | ||
/** | ||
* Takes a base-58 string containing an [[UTXO]], parses it, populates the class, and returns the length of the UTXO in bytes. | ||
* | ||
* @param serialized A base-58 string containing a raw [[UTXO]] | ||
* | ||
* @returns The length of the raw [[UTXO]] | ||
* | ||
* @remarks | ||
* unlike most fromStrings, it expects the string to be serialized in AVA format | ||
*/ | ||
fromString: (serialized: string) => void; | ||
/** | ||
* Returns a {@link https://github.com/feross/buffer|Buffer} representation of the [[UTXO]]. | ||
*/ | ||
toBuffer: () => Buffer; | ||
/** | ||
* Returns a base-58 representation of the [[UTXO]]. | ||
* | ||
* @remarks | ||
* unlike most toStrings, this returns in AVA serialization format | ||
*/ | ||
toString: () => string; | ||
/** | ||
* Class for representing a single UTXO. | ||
* | ||
* @param serialized Optional parameter of the serialized string representing a UTXO | ||
*/ | ||
constructor(txid?: Buffer, txidx?: number); | ||
} | ||
/** | ||
* Class for representing a single UTXO. | ||
*/ | ||
export declare class SecpUTXO extends UTXO { | ||
protected output: SecpOutput; | ||
getOuputID: () => number; | ||
/** | ||
* Gets the amount in the UTXO as a {@link https://github.com/indutny/bn.js/|BN}. | ||
@@ -33,3 +94,3 @@ */ | ||
*/ | ||
getAddressIdx: (address: string) => [number, boolean]; | ||
getAddressIdx: (address: string) => number; | ||
/** | ||
@@ -39,7 +100,6 @@ * Gets the address at the index. | ||
* @param idx The index of the address | ||
* @param tol Boolean indicating if this should be looked up in the fallback addresses (TakeItOrLeaveIt) | ||
* | ||
* @returns A string representing the address. | ||
*/ | ||
getAddress: (idx: number, tol: boolean) => string; | ||
getAddress: (idx: number) => string; | ||
/** | ||
@@ -92,13 +152,14 @@ * Returns a {@link https://github.com/feross/buffer|Buffer} of the assetID. | ||
*/ | ||
getSpenders: (addresses: string[], asOf?: boolean | BN) => string[]; | ||
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?: boolean | BN) => boolean; | ||
meetsThreshold: (addresses: string[], asOf?: BN) => boolean; | ||
/** | ||
* 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} representing the transaction ID | ||
* @param txidx Optional number for the transaction index | ||
*/ | ||
constructor(serialized?: string); | ||
constructor(txid: Buffer, txidx: number, secpoutput: SecpOutput); | ||
} | ||
@@ -110,3 +171,3 @@ /** | ||
protected utxos: { | ||
[utxoid: string]: UTXO; | ||
[utxoid: string]: SecpUTXO; | ||
}; | ||
@@ -174,3 +235,3 @@ protected addressUTXOs: { | ||
*/ | ||
getAllUTXOs: (utxoids?: boolean | string[]) => UTXO[]; | ||
getAllUTXOs: (utxoids?: string[]) => SecpUTXO[]; | ||
/** | ||
@@ -183,3 +244,3 @@ * Gets all the [[UTXO]]s as strings, optionally that match with UTXOIDs in an array. | ||
*/ | ||
getAllUTXOStrings: (utxoids?: boolean | string[]) => string[]; | ||
getAllUTXOStrings: (utxoids?: string[]) => string[]; | ||
/** | ||
@@ -211,3 +272,3 @@ * Returns an array of all the UTXOIDs in the [[UTXOSet]]. | ||
*/ | ||
getBalance: (addresses: string[], assetID: string | Buffer, asOf?: boolean | BN) => BN; | ||
getBalance: (addresses: string[], assetID: string | Buffer, asOf?: BN) => BN; | ||
/** | ||
@@ -235,5 +296,2 @@ * Gets all the Asset IDs, optionally that match with Asset IDs in an array | ||
* @param threshold The number of signatures required to spend the funds in the resultant UTXO | ||
* @param fallAddresses The fallback addresses which can spend the funds in the resultant UTXO | ||
* @param fallLocktime The fallback locktime timestamp which is greater than the locktime and used as an expiration date for the locktime as a {@link https://github.com/indutny/bn.js/|BN} | ||
* @param fallThreshold The fallback threshold for the number of signatures required from the fallback addresses to spend the resultant UTXO | ||
* | ||
@@ -243,3 +301,3 @@ * @returns An unsigned transaction created from the passed in parameters. | ||
*/ | ||
makeUnsignedTx: (networkid: number, blockchainid: Buffer, amount: BN, toAddresses: string[], fromAddresses: string[], changeAddresses: string[], assetID?: Buffer, asOf?: BN, locktime?: BN, threshold?: number, fallAddresses?: string[], fallLocktime?: BN, fallThreshold?: number) => TxUnsigned; | ||
makeUnsignedTx: (networkid: number, blockchainid: Buffer, amount: BN, toAddresses: string[], fromAddresses: string[], changeAddresses: string[], assetID?: Buffer, asOf?: BN, locktime?: BN, threshold?: number) => TxUnsigned; | ||
/** | ||
@@ -253,3 +311,3 @@ * Returns a new set with copy of UTXOs in this and set parameter. | ||
*/ | ||
merge: (utxoset: UTXOSet, hasUTXOIDs?: boolean | string[]) => UTXOSet; | ||
merge: (utxoset: UTXOSet, hasUTXOIDs?: string[]) => UTXOSet; | ||
/** | ||
@@ -256,0 +314,0 @@ * Set intersetion between this set and a parameter. |
@@ -48,3 +48,3 @@ /** | ||
* @param core A reference to the Slopes class | ||
* @param baseurl Defaults to the string "/ext/subnet/platform" as the path to subnets baseurl | ||
* @param baseurl Defaults to the string "/ext/platform" as the path to subnets baseurl | ||
*/ | ||
@@ -51,0 +51,0 @@ constructor(core: SlopesCore, baseurl?: string); |
@@ -25,5 +25,5 @@ "use strict"; | ||
* @param core A reference to the Slopes class | ||
* @param baseurl Defaults to the string "/ext/subnet/platform" as the path to subnets baseurl | ||
* @param baseurl Defaults to the string "/ext/platform" as the path to subnets baseurl | ||
*/ | ||
constructor(core, baseurl = "/ext/subnet/platform") { | ||
constructor(core, baseurl = "/ext/platform") { | ||
super(core, baseurl); | ||
@@ -88,2 +88,2 @@ /** | ||
exports.default = PlatformAPI; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2FwaXMvcGxhdGZvcm0vYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7O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icmVzdWx0XCJdW1widmFsaWRhdG9yc1wiXTtcbiAgICAgICAgfSk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhpcyBjbGFzcyBzaG91bGQgbm90IGJlIGluc3RhbnRpYXRlZCBkaXJlY3RseS4gSW5zdGVhZCB1c2UgdGhlIFtbU2xvcGVzLmFkZEFQSV1dIG1ldGhvZC5cbiAgICAgKiBcbiAgICAgKiBAcGFyYW0gY29yZSBBIHJlZmVyZW5jZSB0byB0aGUgU2xvcGVzIGNsYXNzXG4gICAgICogQHBhcmFtIGJhc2V1cmwgRGVmYXVsdHMgdG8gdGhlIHN0cmluZyBcIi9leHQvcGxhdGZvcm1cIiBhcyB0aGUgcGF0aCB0byBzdWJuZXRzIGJhc2V1cmxcbiAgICAgKi9cbiAgICBjb25zdHJ1Y3Rvcihjb3JlOlNsb3Blc0NvcmUsIGJhc2V1cmw6c3RyaW5nID0gXCIvZXh0L3BsYXRmb3JtXCIpeyBzdXBlcihjb3JlLCBiYXNldXJsKTsgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBQbGF0Zm9ybUFQSTsiXX0= |
@@ -63,6 +63,6 @@ /** | ||
export { Tx, TxUnsigned } from './apis/avm/tx'; | ||
export { UTXO, UTXOSet } from './apis/avm/utxos'; | ||
export { UTXO, SecpUTXO, UTXOSet } from './apis/avm/utxos'; | ||
export { SigIdx, Signature, UnixNow, Address } from './apis/avm/types'; | ||
export { OutCreateAsset, OutPayment, OutTakeOrLeave, Output, SelectOutputClass } from './apis/avm/outputs'; | ||
export { Input } from './apis/avm/inputs'; | ||
export { SecpOutput, Output, SelectOutputClass } from './apis/avm/outputs'; | ||
export { SecpInput, Input } from './apis/avm/inputs'; | ||
export { AVMKeyPair, AVMKeyChain } from './apis/avm/keychain'; | ||
@@ -69,0 +69,0 @@ export { AVMAPI as AVM }; |
@@ -90,3 +90,3 @@ "use strict"; | ||
this.addAPI("admin", api_4.default); | ||
this.addAPI("avm", api_3.default, "/ext/subnet/avm", chainid); | ||
this.addAPI("avm", api_3.default, "/ext/bc/avm", chainid); | ||
this.addAPI("platform", api_2.default); | ||
@@ -111,2 +111,3 @@ this.addAPI("keystore", api_1.default); | ||
exports.UTXO = utxos_1.UTXO; | ||
exports.SecpUTXO = utxos_1.SecpUTXO; | ||
exports.UTXOSet = utxos_1.UTXOSet; | ||
@@ -119,8 +120,7 @@ var types_1 = require("./apis/avm/types"); | ||
var outputs_1 = require("./apis/avm/outputs"); | ||
exports.OutCreateAsset = outputs_1.OutCreateAsset; | ||
exports.OutPayment = outputs_1.OutPayment; | ||
exports.OutTakeOrLeave = outputs_1.OutTakeOrLeave; | ||
exports.SecpOutput = outputs_1.SecpOutput; | ||
exports.Output = outputs_1.Output; | ||
exports.SelectOutputClass = outputs_1.SelectOutputClass; | ||
var inputs_1 = require("./apis/avm/inputs"); | ||
exports.SecpInput = inputs_1.SecpInput; | ||
exports.Input = inputs_1.Input; | ||
@@ -130,2 +130,2 @@ var keychain_1 = require("./apis/avm/keychain"); | ||
exports.AVMKeyChain = keychain_1.AVMKeyChain; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7O0FBQUE7O0dBRUc7QUFDSCxzREFBa0M7QUErRTFCLHFCQS9FRCxnQkFBVSxDQStFQztBQTlFbEIsOERBQThDO0FBaUd2QixtQkFqR2hCLGFBQVcsQ0FpR2E7QUFoRy9CLDhEQUE4QztBQWlHdkIsbUJBakdoQixhQUFXLENBaUdhO0FBaEcvQix5REFBb0M7QUE4RmxCLGNBOUZYLGFBQU0sQ0E4RlE7QUE3RnJCLDJEQUF3QztBQWdHcEIsZ0JBaEdiLGFBQVEsQ0FnR1U7QUEvRnpCLHlEQUEyQztBQXlFbkMsOEJBQ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4cG9ydCB7U2lnSWR4LCBTaWduYXR1cmUsIFVuaXhOb3csIEFkZHJlc3N9IGZyb20gJy4vYXBpcy9hdm0vdHlwZXMnO1x0XG5leHBvcnQge1NlY3BPdXRwdXQsIE91dHB1dCwgU2VsZWN0T3V0cHV0Q2xhc3N9IGZyb20gJy4vYXBpcy9hdm0vb3V0cHV0cyc7XHRcbmV4cG9ydCB7U2VjcElucHV0LCBJbnB1dH0gZnJvbSAnLi9hcGlzL2F2bS9pbnB1dHMnO1x0XG5leHBvcnQge0FWTUtleVBhaXIsIEFWTUtleUNoYWlufSBmcm9tICcuL2FwaXMvYXZtL2tleWNoYWluJztcblxuZXhwb3J0IHtBVk1BUEkgYXMgQVZNfTtcbmV4cG9ydCB7S2V5c3RvcmVBUEkgYXMgS2V5c3RvcmV9O1xuZXhwb3J0IHtQbGF0Zm9ybUFQSSBhcyBQbGF0Zm9ybX07XG5leHBvcnQge0FkbWluQVBJIGFzIEFkbWlufTtcblxuXG4iXX0= |
@@ -160,3 +160,3 @@ /// <reference types="node" /> | ||
*/ | ||
makeKey: (entropy: Buffer | boolean) => string; | ||
makeKey: (entropy?: Buffer) => string; | ||
/** | ||
@@ -177,3 +177,3 @@ * Given a private key, makes a new key pair, returns the address. | ||
/** | ||
* Adds the key pair to the list of the keys manages in the keychain. | ||
* Adds the key pair to the list of the keys managed in the keychain. | ||
* | ||
@@ -184,2 +184,10 @@ * @param newKey A key pair of the appropriate class to be added to 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 | ||
* | ||
* @returns The boolean true if a key was removed. | ||
*/ | ||
removeKey: (key: string | KPClass) => boolean; | ||
/** | ||
* Checks if there is a key associated with the provided address. | ||
@@ -186,0 +194,0 @@ * |
@@ -174,3 +174,3 @@ "use strict"; | ||
/** | ||
* Adds the key pair to the list of the keys manages in the keychain. | ||
* Adds the key pair to the list of the keys managed in the keychain. | ||
* | ||
@@ -183,2 +183,28 @@ * @param newKey A key pair of the appropriate class to be added to 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 | ||
* | ||
* @returns The boolean true if a key was removed. | ||
*/ | ||
this.removeKey = (key) => { | ||
let kaddr; | ||
if (typeof key !== "string") { | ||
kaddr = key.getAddress(); | ||
} | ||
else if (typeof key === 'string') { | ||
kaddr = key; | ||
} | ||
else { | ||
return false; | ||
} | ||
if (kaddr in this.keys) { | ||
delete this.keys[kaddr]; | ||
return true; | ||
} | ||
else { | ||
return false; | ||
} | ||
}; | ||
/** | ||
* Checks if there is a key associated with the provided address. | ||
@@ -281,2 +307,2 @@ * | ||
exports.NBytes = NBytes; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdXRpbHMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7QUFJQSxvQ0FBaUM7QUFDakMsOENBQXNCO0FBRXRCLDBEQUFtQztBQUluQzs7R0FFRztBQUNILE1BQU0sUUFBUSxHQUFHLGtCQUFRLENBQUMsV0FBVyxFQUFFLENBQUM7QUFFeEM7O0dBRUc7QUFDSCxNQUFhLG1CQUFtQjtDQU0vQjtBQU5ELGtEQU1DO0FBRUQ7O0dBRUc7QUFDSCxNQUFzQixPQUFPO0lBcUN6Qjs7OztPQUlHO0lBQ0gsWUFBWSxJQUFlLEVBQUUsT0FBYztRQXJDM0M7Ozs7V0FJRztRQUNILGVBQVUsR0FBRyxDQUFDLE9BQWMsRUFBRSxFQUFFO1lBQzVCLElBQUcsSUFBSSxDQUFDLEVBQUUsSUFBSSxJQUFJLENBQUMsT0FBTyxLQUFLLE9BQU8sRUFBQztnQkFDbkMsSUFBSSxNQUFNLEdBQUcsSUFBSSxDQUFDLEVBQUUsQ0FB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CgpLFxuICAgICAgICAgICAgcmVzcG9uc2VUeXBlOiAnanNvbidcbiAgICAgICAgfTtcblxuICAgICAgICByZXR1cm4gdGhpcy5jb3JlLnBvc3QoZXAsIHt9LCBKU09OLnN0cmluZ2lmeShycGMpLCBoZWFkZXJzLCBheENvbmYpLnRoZW4oIChyZXNwOlJlcXVlc3RSZXNwb25zZURhdGEpID0+IHtcbiAgICAgICAgICAgIGlmKHJlc3Auc3RhdHVzID49IDIwMCAmJiByZXNwLnN0YXR1cyA8IDMwMCl7XG4gICAgICAgICAgICAgICAgdGhpcy5ycGNpZCArPSAxO1xuICAgICAgICAgICAgICAgIGlmKHR5cGVvZiByZXNwLmRhdGEgPT09IFwic3RyaW5nXCIpe1xuICAgICAgICAgICAgICAgICAgICByZXNwLmRhdGEgPSBKU09OLnBhcnNlKHJlc3AuZGF0YSk7XG4gICAgICAgICAgICAgICAgICAgIFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZih0eXBlb2YgcmVzcC5kYXRhID09PSAnb2JqZWN0JyAmJiAnZXJyb3InIGluIHJlc3AuZGF0YSkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJFcnJvciByZXR1cm5lZDogXCIgKyBKU09OLnN0cmluZ2lmeShyZXNwLmRhdGEpKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIHJlc3A7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgIH0gICBcblxuICAgIC8qKlxuICAgICAqIFJldHVybnMgdGhlIHJwY2lkLCBhIHN0cmljdGx5LWluY3JlYXNpbmcgbnVtYmVyLCBzdGFydGluZyBmcm9tIDEsIGluZGljYXRpbmcgdGhlIG5leHQgcmVxdWVzdCBJRCB0aGF0IHdpbGwgYmUgc2VudC5cbiAgICAgKi9cbiAgICBnZXRSUENJRCA9ICgpOm51bWJlciA9PiB7XG4gICAgICAgIHJldHVybiB0aGlzLnJwY2l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dChlcCwge30sIEpTT04uc3RyaW5naWZ5KHJwYyksIGhlYWRlcnMsIGF4Q29uZikudGhlbiggKHJlc3A6UmVxdWVzdFJlc3BvbnNlRGF0YSkgPT4ge1xuICAgICAgICAgICAgaWYocmVzcC5zdGF0dXMgPj0gMjAwICYmIHJlc3Auc3RhdHVzIDwgMzAwKXtcbiAgICAgICAgICAgICAgICB0aGlzLnJwY2lkICs9IDE7XG4gICAgICAgICAgICAgICAgaWYodHlwZW9mIHJlc3AuZGF0YSA9PT0gXCJzdHJpbmdcIil7XG4gICAgICAgICAgICAgICAgICAgIHJlc3AuZGF0YSA9IEpTT04ucGFyc2UocmVzcC5kYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmKHR5cGVvZiByZXNwLmRhdGEgPT09ICdvYmplY3QnICYmICdlcnJvcicgaW4gcmVzcC5kYXRhKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkVycm9yIHJldHVybmVkOiBcIiArIEpTT04uc3RyaW5naWZ5KHJlc3AuZGF0YSkpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gcmVzcDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgfSAgIFxuXG4gICAgLyoqXG4gICAgICogUmV0dXJucyB0aGUgcnBjaWQsIGEgc3RyaWN0bHktaW5jcmVhc2luZyBudW1iZXIsIHN0YXJ0aW5nIGZyb20gMSwgaW5kaWNhdGluZyB0aGUgbmV4dCByZXF1ZXN0IElEIHRoYXQgd2lsbCBiZSBzZW50LlxuICAgICAqL1xuICAgIGdldFJQQ0lEID0gKCk6bnVtYmVyID0+IHtcbiAgICAgICAgcmV0dXJuIHRoaXMucnBjaWQ7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogXG4gICAgICogQHBhcmFtIGNvcmUgUmVmZXJlbmNlIHRvIHRoZSBTbG9wZX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N0b3JlZCB7QGxpbmsgaHR0cHM6Ly9naXRodWIuY29tL2Zlcm9zcy9idWZmZXJ8QnVmZmVyfS5cbiAgICAgKiBcbiAgICAgKiBAcmV0dXJucyBBIGJhc2UtNTggc3RyaW5nIG9mIHRoZSBzdG9yZWQge0BsaW5rIGh0dHBzOi8vZ2l0aHViLmNvbS9mZXJvc3MvYnVmZmVyfEJ1ZmZlcn1cbiAgICAgKi9cbiAgICB0b1N0cmluZyA9ICgpOnN0cmluZyA9PiB7XG4gICAgICAgIHJldHVybiBiaW50b29scy5idWZmZXJUb0I1OCh0aGlzLnRvQnVmZmVyKCkpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBSZXR1cm5zIGluc3RhbmNlIG9mIFtbTkJ5dGVzXV0uXG4gICAgICovXG4gICAgY29uc3RydWN0b3IoKSB7fVxufVxuIl19 |
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 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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2117452
76
9353