From d49a96c4f52b11126206e19eeed925a4743b9f54 Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Wed, 9 Feb 2022 09:34:09 -0500 Subject: [PATCH 01/37] adding first pass at dryrun stack printer --- src/dryrun.ts | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) diff --git a/src/dryrun.ts b/src/dryrun.ts index 5b2597516..0700fb23b 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -167,3 +167,145 @@ export async function createDryrun({ sources, }); } + +class DryrunStackValue { + type: number = 0; + bytes: string = ''; + uint: number = 0; + + constructor(sv: Record) { + this.type = sv.type; + this.bytes = sv.bytes; + this.uint = sv.uint; + } + + toString(): string { + if (this.type === 1) { + return this.bytes; + } + return this.uint.toString(); + } +} + +class DryrunTraceLine { + line: number = 0; + pc: number = 0; + stack: DryrunStackValue[] = []; + + constructor(line: Record) { + this.line = line.line; + this.pc = line.pc; + this.stack = line.stack.map( + (sv: Record) => new DryrunStackValue(sv) + ); + } + + traceLine(): [number, number, string] { + return [ + this.line, + this.pc, + `[${this.stack.map((sv) => sv.toString()).join(',')}]`, + ]; + } +} + +class DryrunTrace { + trace: DryrunTraceLine[] = []; + + constructor(t: Record[]) { + if (t === undefined) return; + this.trace = t.map((line) => new DryrunTraceLine(line)); + } + + getTrace(): any[] { + return this.trace.map((dtl) => dtl.traceLine()); + } +} +class DryrunTransactionResult { + defaultSpaces: number = 50; + + disassembly: string[] = []; + appCallMessages: string[] | undefined = []; + localDeltas: any[] | undefined = []; + globalDelta: any[] | undefined = []; + cost: number | undefined = 0; + logicSigMessages: string[] | undefined = []; + logicSigDisassemly: string[] | undefined = []; + logs: string[] | undefined = []; + + appCallTrace: DryrunTrace | undefined = undefined; + logicSigTrace: DryrunTrace | undefined = undefined; + + required = ['disassembly']; + optionals = [ + 'app-call-messages', + 'local-deltas', + 'global-delta', + 'cost', + 'logic-sig-messages', + 'logic-sig-disassembly', + 'logs', + ]; + + traces = ['app-call-trace', 'logic-sig-trace']; + + constructor(dtr: Record) { + this.disassembly = dtr.disassembly; + this.appCallMessages = dtr['app-call-messages']; + this.localDeltas = dtr['local-deltas']; + this.globalDelta = dtr['global-delta']; + this.cost = dtr.cost; + this.logicSigMessages = dtr['logic-sig-messages']; + this.logicSigDisassemly = dtr['logic-sig-messages']; + this.logs = dtr.logs; + this.appCallTrace = new DryrunTrace(dtr['app-call-trace']); + this.logicSigTrace = new DryrunTrace(dtr['logic-sig-trace']); + } + + trace(drt: DryrunTrace, disassembly: string[], spaces?: number): string { + // eslint-disable-next-line no-param-reassign + if (spaces === undefined) spaces = this.defaultSpaces; + + const lines = [`pc# line# source${' '.repeat(spaces - 16)}stack`]; + for (const [line, pc, stack] of drt.getTrace()) { + const linePadding = ' '.repeat(4 - line.toString().length); + const pcPadding = ' '.repeat(4 - pc.toString().length); + const dis = disassembly[line]; + + const srcLine = `${pcPadding}${pc} ${linePadding}${line} ${dis}`; + + const stackPadding = ' '.repeat(Math.max(1, spaces - srcLine.length)); + + lines.push(`${srcLine}${stackPadding}${stack}`); + } + + return lines.join('\n'); + } + + appTrace(): string { + if (this.appCallTrace === undefined || !this.disassembly) return ''; + return this.trace(this.appCallTrace, this.disassembly); + } + + lsigTrace(): string { + if ( + this.logicSigTrace === undefined || + this.logicSigDisassemly === undefined + ) + return ''; + return this.trace(this.logicSigTrace, this.logicSigDisassemly); + } +} + +export class DryrunResult { + error: string = ''; + protocolVersion: string = ''; + txns: DryrunTransactionResult[] = []; + constructor(drrResp: Record) { + this.error = drrResp.error; + this.protocolVersion = drrResp['protocol-version']; + this.txns = drrResp.txns.map( + (txn: any) => new DryrunTransactionResult(txn) + ); + } +} From 18dc21bb38f95c3d6ea41ff5e2b72bc6a48f1dfe Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Wed, 9 Feb 2022 10:20:29 -0500 Subject: [PATCH 02/37] adding rejection check --- src/dryrun.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/dryrun.ts b/src/dryrun.ts index 0700fb23b..1d6d048bb 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -262,6 +262,20 @@ class DryrunTransactionResult { this.logicSigTrace = new DryrunTrace(dtr['logic-sig-trace']); } + appCallRejected(): boolean { + return ( + this.appCallMessages !== undefined && + this.appCallMessages.includes('REJECT') + ); + } + + logicSigRejected(): boolean { + return ( + this.logicSigMessages !== undefined && + this.logicSigMessages.includes('REJECT') + ); + } + trace(drt: DryrunTrace, disassembly: string[], spaces?: number): string { // eslint-disable-next-line no-param-reassign if (spaces === undefined) spaces = this.defaultSpaces; From 501bd40ceb8b29af2293363a5bf354f553b523a7 Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Wed, 9 Feb 2022 10:24:48 -0500 Subject: [PATCH 03/37] fix typo --- src/dryrun.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dryrun.ts b/src/dryrun.ts index 1d6d048bb..c2b7ebba7 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -256,7 +256,7 @@ class DryrunTransactionResult { this.globalDelta = dtr['global-delta']; this.cost = dtr.cost; this.logicSigMessages = dtr['logic-sig-messages']; - this.logicSigDisassemly = dtr['logic-sig-messages']; + this.logicSigDisassemly = dtr['logic-sig-disassembly']; this.logs = dtr.logs; this.appCallTrace = new DryrunTrace(dtr['app-call-trace']); this.logicSigTrace = new DryrunTrace(dtr['logic-sig-trace']); From a6d1827af3937eda32dd4f1dbafee6b33dcc602b Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Thu, 10 Feb 2022 11:48:59 -0500 Subject: [PATCH 04/37] make it work with 0 spaces passed --- src/dryrun.ts | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/dryrun.ts b/src/dryrun.ts index c2b7ebba7..d47f0ea00 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -278,9 +278,22 @@ class DryrunTransactionResult { trace(drt: DryrunTrace, disassembly: string[], spaces?: number): string { // eslint-disable-next-line no-param-reassign - if (spaces === undefined) spaces = this.defaultSpaces; + let padSpaces = spaces; + if (padSpaces === undefined) padSpaces = this.defaultSpaces; + if (padSpaces === 0) { + for (const l of disassembly) { + if (l.length > padSpaces) { + padSpaces = l.length; + } + } + + // Add 10 to account for line number and pc padding we apply later + padSpaces += 10; + } - const lines = [`pc# line# source${' '.repeat(spaces - 16)}stack`]; + // 16 is the length of header prior to pad spacing + const padSpacing = padSpaces - 16 > 0 ? ' '.repeat(padSpaces - 16) : ''; + const lines = [`pc# line# source${padSpacing}stack`]; for (const [line, pc, stack] of drt.getTrace()) { const linePadding = ' '.repeat(4 - line.toString().length); const pcPadding = ' '.repeat(4 - pc.toString().length); @@ -288,7 +301,10 @@ class DryrunTransactionResult { const srcLine = `${pcPadding}${pc} ${linePadding}${line} ${dis}`; - const stackPadding = ' '.repeat(Math.max(1, spaces - srcLine.length)); + const stackPadding = + padSpaces - srcLine.length > 0 + ? ' '.repeat(padSpaces - srcLine.length) + : ''; lines.push(`${srcLine}${stackPadding}${stack}`); } @@ -296,18 +312,18 @@ class DryrunTransactionResult { return lines.join('\n'); } - appTrace(): string { + appTrace(spaces?: number): string { if (this.appCallTrace === undefined || !this.disassembly) return ''; - return this.trace(this.appCallTrace, this.disassembly); + return this.trace(this.appCallTrace, this.disassembly, spaces); } - lsigTrace(): string { + lsigTrace(spaces?: number): string { if ( this.logicSigTrace === undefined || this.logicSigDisassemly === undefined ) return ''; - return this.trace(this.logicSigTrace, this.logicSigDisassemly); + return this.trace(this.logicSigTrace, this.logicSigDisassemly, spaces); } } From 2e4f74ac6724b41dc416664cd1e3b6d8ca275397 Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Thu, 10 Feb 2022 12:02:17 -0500 Subject: [PATCH 05/37] make types types --- src/dryrun.ts | 72 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 55 insertions(+), 17 deletions(-) diff --git a/src/dryrun.ts b/src/dryrun.ts index d47f0ea00..55bf7d250 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -1,10 +1,12 @@ import AlgodClient from './client/v2/algod/algod'; import { + AccountStateDelta, Application, ApplicationParams, ApplicationStateSchema, DryrunRequest, DryrunSource, + EvalDeltaKeyValue, } from './client/v2/algod/models/types'; import { SignedTransaction } from './transaction'; import { TransactionType } from './types/transactions'; @@ -168,12 +170,17 @@ export async function createDryrun({ }); } +interface StackValueResponse { + type: number; + bytes: string; + uint: number; +} class DryrunStackValue { type: number = 0; bytes: string = ''; uint: number = 0; - constructor(sv: Record) { + constructor(sv: StackValueResponse) { this.type = sv.type; this.bytes = sv.bytes; this.uint = sv.uint; @@ -187,47 +194,72 @@ class DryrunStackValue { } } +interface TraceLine { + line: number; + pc: number; + stack: string; +} + +interface DryrunTraceLineResponse { + line: number; + pc: number; + stack: StackValueResponse[]; +} class DryrunTraceLine { line: number = 0; pc: number = 0; stack: DryrunStackValue[] = []; - constructor(line: Record) { + constructor(line: DryrunTraceLineResponse) { this.line = line.line; this.pc = line.pc; this.stack = line.stack.map( - (sv: Record) => new DryrunStackValue(sv) + (sv: StackValueResponse) => new DryrunStackValue(sv) ); } - traceLine(): [number, number, string] { - return [ - this.line, - this.pc, - `[${this.stack.map((sv) => sv.toString()).join(',')}]`, - ]; + traceLine(): TraceLine { + return { + line: this.line, + pc: this.pc, + stack: `[${this.stack.map((sv) => sv.toString()).join(',')}]`, + }; } } class DryrunTrace { trace: DryrunTraceLine[] = []; - constructor(t: Record[]) { + constructor(t: DryrunTraceLineResponse[]) { if (t === undefined) return; this.trace = t.map((line) => new DryrunTraceLine(line)); } - getTrace(): any[] { + getTrace(): TraceLine[] { return this.trace.map((dtl) => dtl.traceLine()); } } + +interface DryrunTransactionResultResponse { + disassembly: string[]; + appCallMessages: string[] | undefined; + localDeltas: AccountStateDelta[] | undefined; + globalDelta: EvalDeltaKeyValue[] | undefined; + cost: number | undefined; + logicSigMessages: string[] | undefined; + logicSigDisassemly: string[] | undefined; + logs: string[] | undefined; + appCallTrace: DryrunTrace | undefined; + logicSigTrace: DryrunTrace | undefined; +} + class DryrunTransactionResult { defaultSpaces: number = 50; disassembly: string[] = []; appCallMessages: string[] | undefined = []; - localDeltas: any[] | undefined = []; - globalDelta: any[] | undefined = []; + localDeltas: AccountStateDelta[] | undefined = []; + globalDelta: EvalDeltaKeyValue[] | undefined = []; cost: number | undefined = 0; logicSigMessages: string[] | undefined = []; logicSigDisassemly: string[] | undefined = []; @@ -249,7 +281,7 @@ class DryrunTransactionResult { traces = ['app-call-trace', 'logic-sig-trace']; - constructor(dtr: Record) { + constructor(dtr: DryrunTransactionResultResponse) { this.disassembly = dtr.disassembly; this.appCallMessages = dtr['app-call-messages']; this.localDeltas = dtr['local-deltas']; @@ -294,7 +326,7 @@ class DryrunTransactionResult { // 16 is the length of header prior to pad spacing const padSpacing = padSpaces - 16 > 0 ? ' '.repeat(padSpaces - 16) : ''; const lines = [`pc# line# source${padSpacing}stack`]; - for (const [line, pc, stack] of drt.getTrace()) { + for (const { line, pc, stack } of drt.getTrace()) { const linePadding = ' '.repeat(4 - line.toString().length); const pcPadding = ' '.repeat(4 - pc.toString().length); const dis = disassembly[line]; @@ -327,15 +359,21 @@ class DryrunTransactionResult { } } +interface DryrunResultResponse { + ['error']: string; + ['protocol-version']: string; + ['txns']: DryrunTransactionResultResponse[]; +} + export class DryrunResult { error: string = ''; protocolVersion: string = ''; txns: DryrunTransactionResult[] = []; - constructor(drrResp: Record) { + constructor(drrResp: DryrunResultResponse) { this.error = drrResp.error; this.protocolVersion = drrResp['protocol-version']; this.txns = drrResp.txns.map( - (txn: any) => new DryrunTransactionResult(txn) + (txn: DryrunTransactionResultResponse) => new DryrunTransactionResult(txn) ); } } From bb216d88037604e16babf0710a1b5c3d60812b89 Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Fri, 11 Feb 2022 14:29:27 -0500 Subject: [PATCH 06/37] adding tests for dryrun printer --- Makefile | 2 +- src/dryrun.ts | 6 +++--- tests/cucumber/docker/run_docker.sh | 2 +- tests/cucumber/steps/steps.js | 18 ++++++++++++++++++ 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 0c06ec980..40b1b8bdf 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ unit: - node_modules/.bin/cucumber-js --tags "@unit.offline or @unit.algod or @unit.indexer or @unit.rekey or @unit.tealsign or @unit.dryrun or @unit.applications or @unit.responses or @unit.transactions or @unit.transactions.payment or @unit.responses.231 or @unit.feetest or @unit.indexer.logs or @unit.abijson or @unit.atomic_transaction_composer" tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js + node_modules/.bin/cucumber-js --tags "@unit.offline or @unit.algod or @unit.indexer or @unit.rekey or @unit.tealsign or @unit.dryrun or @unit.applications or @unit.responses or @unit.transactions or @unit.transactions.payment or @unit.responses.231 or @unit.feetest or @unit.indexer.logs or @unit.abijson or @unit.atomic_transaction_composer or @unit.dryrun.trace.application" tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js integration: node_modules/.bin/cucumber-js --tags "@algod or @assets or @auction or @kmd or @send or @indexer or @rekey or @dryrun or @compile or @applications or @indexer.applications or @applications.verified or @indexer.231 or @abi or @c2c" tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js diff --git a/src/dryrun.ts b/src/dryrun.ts index 55bf7d250..582a590d8 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -188,7 +188,7 @@ class DryrunStackValue { toString(): string { if (this.type === 1) { - return this.bytes; + return `0x${Buffer.from(this.bytes, 'base64').toString('hex')}`; } return this.uint.toString(); } @@ -222,7 +222,7 @@ class DryrunTraceLine { return { line: this.line, pc: this.pc, - stack: `[${this.stack.map((sv) => sv.toString()).join(',')}]`, + stack: `[${this.stack.map((sv) => sv.toString()).join(', ')}]`, }; } } @@ -254,7 +254,7 @@ interface DryrunTransactionResultResponse { } class DryrunTransactionResult { - defaultSpaces: number = 50; + defaultSpaces: number = 20; disassembly: string[] = []; appCallMessages: string[] | undefined = []; diff --git a/tests/cucumber/docker/run_docker.sh b/tests/cucumber/docker/run_docker.sh index 87da13e5c..e92dccd9a 100755 --- a/tests/cucumber/docker/run_docker.sh +++ b/tests/cucumber/docker/run_docker.sh @@ -7,7 +7,7 @@ rm -rf test-harness rm -rf tests/cucumber/features # clone test harness -git clone --single-branch --branch master https://github.com/algorand/algorand-sdk-testing.git test-harness +git clone --single-branch --branch dryrun-trace https://github.com/algorand/algorand-sdk-testing.git test-harness # move feature files and example files to destination mv test-harness/features tests/cucumber/features diff --git a/tests/cucumber/steps/steps.js b/tests/cucumber/steps/steps.js index 05ad59570..ea1097b95 100644 --- a/tests/cucumber/steps/steps.js +++ b/tests/cucumber/steps/steps.js @@ -5085,6 +5085,24 @@ module.exports = function getSteps(options) { } ); + Given( + 'a dryrun response file {string} and a transaction id {string}', + async function (drrFile, txId) { + const drContents = await loadResource(drrFile); + const js = parseJSON(drContents); + const drr = new algosdk.DryrunResult(js); + this.txtrace = drr.txns[parseInt(txId)]; + } + ); + + When('I call app trace', function () { + this.traceString = this.txtrace.appTrace(); + }); + + Then('the output should equal {string}', async function (expected) { + assert.equal(this.traceString, (await loadResource(expected)).toString()); + }); + if (!options.ignoreReturn) { return steps; } From ecc3fd6ca462d693e8344b532f282e22f4b68c31 Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Wed, 23 Feb 2022 11:29:25 -0500 Subject: [PATCH 07/37] revert back to master --- tests/cucumber/docker/run_docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cucumber/docker/run_docker.sh b/tests/cucumber/docker/run_docker.sh index e92dccd9a..87da13e5c 100755 --- a/tests/cucumber/docker/run_docker.sh +++ b/tests/cucumber/docker/run_docker.sh @@ -7,7 +7,7 @@ rm -rf test-harness rm -rf tests/cucumber/features # clone test harness -git clone --single-branch --branch dryrun-trace https://github.com/algorand/algorand-sdk-testing.git test-harness +git clone --single-branch --branch master https://github.com/algorand/algorand-sdk-testing.git test-harness # move feature files and example files to destination mv test-harness/features tests/cucumber/features From 6d529d393a1cb39245e4a9a2345b39588fd7d3cf Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Tue, 15 Mar 2022 09:35:00 -0400 Subject: [PATCH 08/37] reworking logic to match new formatting --- src/dryrun.ts | 168 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 112 insertions(+), 56 deletions(-) diff --git a/src/dryrun.ts b/src/dryrun.ts index 582a590d8..748077e34 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -7,12 +7,14 @@ import { DryrunRequest, DryrunSource, EvalDeltaKeyValue, + TealValue, } from './client/v2/algod/models/types'; import { SignedTransaction } from './transaction'; import { TransactionType } from './types/transactions'; import { encodeAddress, getApplicationAddress } from './encoding/address'; const defaultAppId = 1380011588; +const defaultMaxWidth = 30; // When writing the DryrunRequest object as msgpack the output needs to be the byte arrays not b64 string interface AppParamsWithPrograms { @@ -194,37 +196,26 @@ class DryrunStackValue { } } -interface TraceLine { - line: number; - pc: number; - stack: string; -} - interface DryrunTraceLineResponse { line: number; pc: number; + scratch: TealValue[]; stack: StackValueResponse[]; } class DryrunTraceLine { line: number = 0; pc: number = 0; + scratch: TealValue[] = []; stack: DryrunStackValue[] = []; constructor(line: DryrunTraceLineResponse) { this.line = line.line; this.pc = line.pc; + this.scratch = line.scratch; this.stack = line.stack.map( (sv: StackValueResponse) => new DryrunStackValue(sv) ); } - - traceLine(): TraceLine { - return { - line: this.line, - pc: this.pc, - stack: `[${this.stack.map((sv) => sv.toString()).join(', ')}]`, - }; - } } class DryrunTrace { @@ -234,10 +225,6 @@ class DryrunTrace { if (t === undefined) return; this.trace = t.map((line) => new DryrunTraceLine(line)); } - - getTrace(): TraceLine[] { - return this.trace.map((dtl) => dtl.traceLine()); - } } interface DryrunTransactionResultResponse { @@ -253,9 +240,64 @@ interface DryrunTransactionResultResponse { logicSigTrace: DryrunTrace | undefined; } -class DryrunTransactionResult { - defaultSpaces: number = 20; +interface StackPrinterConfig { + maxWidth: number | undefined; + topOfStackFirst: boolean | undefined; +} + +function truncate(str: string, maxWidth: number): string { + if (maxWidth > 0) { + return `${str.slice(0, maxWidth)}...`; + } + return str; +} + +function scratchToString( + prevScratch: TealValue[], + currScratch: TealValue[] +): string { + let newScratchIdx = 0; + let newScratch = {} as TealValue; + for (let idx = 0; idx < currScratch.length; idx++) { + if ( + idx > prevScratch.length || + Object.entries(prevScratch[idx]).toString() !== + Object.entries(currScratch[idx]).toString() + ) { + newScratch = currScratch[idx]; + newScratchIdx = idx; + } + } + + switch (newScratch.type) { + case 1: + return `${newScratchIdx} = 0x${Buffer.from(this.bytes, 'base64').toString( + 'hex' + )}`; + case 2: + return `${newScratchIdx} = ${newScratch.uint.toString()}`; + default: + return ''; + } +} +function stackToString(stack: DryrunStackValue[], reverse: boolean): string { + const svs = reverse ? stack.reverse() : stack; + return `[${svs + .map((sv: DryrunStackValue) => { + switch (sv.type) { + case 1: + return `0x${Buffer.from(sv.bytes, 'base64').toString('hex')}`; + case 2: + return `${sv.uint.toString()}`; + default: + return ''; + } + }) + .join(', ')}]`; +} + +class DryrunTransactionResult { disassembly: string[] = []; appCallMessages: string[] | undefined = []; localDeltas: AccountStateDelta[] | undefined = []; @@ -308,54 +350,68 @@ class DryrunTransactionResult { ); } - trace(drt: DryrunTrace, disassembly: string[], spaces?: number): string { - // eslint-disable-next-line no-param-reassign - let padSpaces = spaces; - if (padSpaces === undefined) padSpaces = this.defaultSpaces; - if (padSpaces === 0) { - for (const l of disassembly) { - if (l.length > padSpaces) { - padSpaces = l.length; - } - } - - // Add 10 to account for line number and pc padding we apply later - padSpaces += 10; + static trace( + drt: DryrunTrace, + disassembly: string[], + spc: StackPrinterConfig + ): string { + let maxWidth = defaultMaxWidth; + if (spc.maxWidth === undefined) maxWidth = spc.maxWidth; + + const lines = [['pc#', 'ln#', 'source', 'scratch', 'stack']]; + for (let idx = 0; idx < drt.trace.length; idx++) { + const { line, pc, scratch, stack } = drt.trace[idx]; + const prevScratch = idx > 0 ? drt.trace[idx].scratch : []; + lines.push([ + pc.toString(), + line.toString(), + truncate(disassembly[line], maxWidth), + truncate(scratchToString(prevScratch, scratch), maxWidth), + truncate(stackToString(stack, spc.topOfStackFirst), maxWidth), + ]); } - // 16 is the length of header prior to pad spacing - const padSpacing = padSpaces - 16 > 0 ? ' '.repeat(padSpaces - 16) : ''; - const lines = [`pc# line# source${padSpacing}stack`]; - for (const { line, pc, stack } of drt.getTrace()) { - const linePadding = ' '.repeat(4 - line.toString().length); - const pcPadding = ' '.repeat(4 - pc.toString().length); - const dis = disassembly[line]; - - const srcLine = `${pcPadding}${pc} ${linePadding}${line} ${dis}`; - - const stackPadding = - padSpaces - srcLine.length > 0 - ? ' '.repeat(padSpaces - srcLine.length) - : ''; - - lines.push(`${srcLine}${stackPadding}${stack}`); - } - - return lines.join('\n'); + // TODO: Join lines with correct spacing... + return ''; + // return lines.join('\n'); } - appTrace(spaces?: number): string { + appTrace(spc?: StackPrinterConfig): string { if (this.appCallTrace === undefined || !this.disassembly) return ''; - return this.trace(this.appCallTrace, this.disassembly, spaces); + + let conf = spc; + if (spc === undefined) + conf = { + maxWidth: defaultMaxWidth, + topOfStackFirst: true, + } as StackPrinterConfig; + + return DryrunTransactionResult.trace( + this.appCallTrace, + this.disassembly, + conf + ); } - lsigTrace(spaces?: number): string { + lsigTrace(spc?: StackPrinterConfig): string { if ( this.logicSigTrace === undefined || this.logicSigDisassemly === undefined ) return ''; - return this.trace(this.logicSigTrace, this.logicSigDisassemly, spaces); + + let conf = spc; + if (spc === undefined) + conf = { + maxWidth: defaultMaxWidth, + topOfStackFirst: true, + } as StackPrinterConfig; + + return DryrunTransactionResult.trace( + this.logicSigTrace, + this.logicSigDisassemly, + conf + ); } } From f48ccfc3c1fc12b77d29fd7640be8f6830cc214c Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Tue, 15 Mar 2022 09:52:11 -0400 Subject: [PATCH 09/37] add length checker for each line --- src/dryrun.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/dryrun.ts b/src/dryrun.ts index 748077e34..6d93adfb3 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -371,9 +371,19 @@ class DryrunTransactionResult { ]); } - // TODO: Join lines with correct spacing... - return ''; - // return lines.join('\n'); + const maxLengths = lines.reduce((prev, curr) => { + const newVal = new Array(lines[0].length).fill(0); + for (let idx = 0; idx < prev.length; idx++) { + newVal[idx] = + curr[idx].length > prev[idx] ? curr[idx].length : prev[idx]; + } + return newVal; + }, new Array(lines[0].length).fill(0)); + + console.log(maxLengths); + + // TODO: ensure correct spacing + lines.map((line) => line.join('|')).join('\n'); } appTrace(spc?: StackPrinterConfig): string { From fec573b34894d83b473eb779386e672c621319fc Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Tue, 15 Mar 2022 09:58:58 -0400 Subject: [PATCH 10/37] use maxLengths to create the print out table --- src/dryrun.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/dryrun.ts b/src/dryrun.ts index 6d93adfb3..94bd5b3d8 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -358,6 +358,7 @@ class DryrunTransactionResult { let maxWidth = defaultMaxWidth; if (spc.maxWidth === undefined) maxWidth = spc.maxWidth; + // Create the array of arrays, each sub array contains N columns const lines = [['pc#', 'ln#', 'source', 'scratch', 'stack']]; for (let idx = 0; idx < drt.trace.length; idx++) { const { line, pc, scratch, stack } = drt.trace[idx]; @@ -371,6 +372,7 @@ class DryrunTransactionResult { ]); } + // Get the max length for each column const maxLengths = lines.reduce((prev, curr) => { const newVal = new Array(lines[0].length).fill(0); for (let idx = 0; idx < prev.length; idx++) { @@ -380,10 +382,12 @@ class DryrunTransactionResult { return newVal; }, new Array(lines[0].length).fill(0)); - console.log(maxLengths); - // TODO: ensure correct spacing - lines.map((line) => line.join('|')).join('\n'); + return lines + .map((line) => + line.map((v, idx) => v.padEnd(maxLengths[idx], ' ')).join('|') + ) + .join('\n'); } appTrace(spc?: StackPrinterConfig): string { From 4e5823f2933893caafdfd6c923197408ce846e3d Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Tue, 15 Mar 2022 11:52:57 -0400 Subject: [PATCH 11/37] closer --- Makefile | 3 ++- src/dryrun.ts | 33 +++++++++++++++++++-------------- tests/cucumber/steps/steps.js | 11 ++++------- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index 00f5aa964..b96e23418 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ unit: - node_modules/.bin/cucumber-js --tags "@unit.offline or @unit.algod or @unit.indexer or @unit.rekey or @unit.tealsign or @unit.dryrun or @unit.applications or @unit.responses or @unit.transactions or @unit.transactions.keyreg or @unit.transactions.payment or @unit.responses.231 or @unit.feetest or @unit.indexer.logs or @unit.abijson or @unit.atomic_transaction_composer or @unit.dryrun.trace.application" tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js + #node_modules/.bin/cucumber-js --tags "@unit.offline or @unit.algod or @unit.indexer or @unit.rekey or @unit.tealsign or @unit.dryrun or @unit.applications or @unit.responses or @unit.transactions or @unit.transactions.keyreg or @unit.transactions.payment or @unit.responses.231 or @unit.feetest or @unit.indexer.logs or @unit.abijson or @unit.atomic_transaction_composer or @unit.dryrun.trace.application" tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js + node_modules/.bin/cucumber-js --tags "@unit.dryrun.trace.application" tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js integration: node_modules/.bin/cucumber-js --tags "@algod or @assets or @auction or @kmd or @send or @indexer or @rekey or @send.keyregtxn or @dryrun or @compile or @applications or @indexer.applications or @applications.verified or @indexer.231 or @abi or @c2c" tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js diff --git a/src/dryrun.ts b/src/dryrun.ts index 94bd5b3d8..acea38549 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -202,6 +202,7 @@ interface DryrunTraceLineResponse { scratch: TealValue[]; stack: StackValueResponse[]; } + class DryrunTraceLine { line: number = 0; pc: number = 0; @@ -220,7 +221,6 @@ class DryrunTraceLine { class DryrunTrace { trace: DryrunTraceLine[] = []; - constructor(t: DryrunTraceLineResponse[]) { if (t === undefined) return; this.trace = t.map((line) => new DryrunTraceLine(line)); @@ -246,7 +246,7 @@ interface StackPrinterConfig { } function truncate(str: string, maxWidth: number): string { - if (maxWidth > 0) { + if (str.length > maxWidth && maxWidth > 0) { return `${str.slice(0, maxWidth)}...`; } return str; @@ -258,11 +258,11 @@ function scratchToString( ): string { let newScratchIdx = 0; let newScratch = {} as TealValue; + for (let idx = 0; idx < currScratch.length; idx++) { if ( - idx > prevScratch.length || - Object.entries(prevScratch[idx]).toString() !== - Object.entries(currScratch[idx]).toString() + idx >= prevScratch.length || + JSON.stringify(prevScratch[idx]) !== JSON.stringify(currScratch[idx]) ) { newScratch = currScratch[idx]; newScratchIdx = idx; @@ -271,9 +271,10 @@ function scratchToString( switch (newScratch.type) { case 1: - return `${newScratchIdx} = 0x${Buffer.from(this.bytes, 'base64').toString( - 'hex' - )}`; + return `${newScratchIdx} = 0x${Buffer.from( + newScratch.bytes, + 'base64' + ).toString('hex')}`; case 2: return `${newScratchIdx} = ${newScratch.uint.toString()}`; default: @@ -362,12 +363,16 @@ class DryrunTransactionResult { const lines = [['pc#', 'ln#', 'source', 'scratch', 'stack']]; for (let idx = 0; idx < drt.trace.length; idx++) { const { line, pc, scratch, stack } = drt.trace[idx]; - const prevScratch = idx > 0 ? drt.trace[idx].scratch : []; + const currScratch = scratch !== undefined ? scratch : []; + const prevScratch = + idx > 0 && drt.trace[idx - 1].scratch !== undefined + ? drt.trace[idx - 1].scratch + : []; lines.push([ - pc.toString(), - line.toString(), + pc.toString().padEnd(3, ' '), + line.toString().padEnd(3, ' '), truncate(disassembly[line], maxWidth), - truncate(scratchToString(prevScratch, scratch), maxWidth), + truncate(scratchToString(prevScratch, currScratch), maxWidth), truncate(stackToString(stack, spc.topOfStackFirst), maxWidth), ]); } @@ -385,7 +390,7 @@ class DryrunTransactionResult { // TODO: ensure correct spacing return lines .map((line) => - line.map((v, idx) => v.padEnd(maxLengths[idx], ' ')).join('|') + line.map((v, idx) => v.padEnd(maxLengths[idx] + 1, ' ')).join('|') ) .join('\n'); } @@ -397,7 +402,7 @@ class DryrunTransactionResult { if (spc === undefined) conf = { maxWidth: defaultMaxWidth, - topOfStackFirst: true, + topOfStackFirst: false, } as StackPrinterConfig; return DryrunTransactionResult.trace( diff --git a/tests/cucumber/steps/steps.js b/tests/cucumber/steps/steps.js index 84dbed713..9f7074d96 100644 --- a/tests/cucumber/steps/steps.js +++ b/tests/cucumber/steps/steps.js @@ -5173,7 +5173,7 @@ module.exports = function getSteps(options) { ); Given( - 'a dryrun response file {string} and a transaction id {string}', + 'a dryrun response file {string} and a transaction at index {string}', async function (drrFile, txId) { const drContents = await loadResource(drrFile); const js = parseJSON(drContents); @@ -5182,12 +5182,9 @@ module.exports = function getSteps(options) { } ); - When('I call app trace', function () { - this.traceString = this.txtrace.appTrace(); - }); - - Then('the output should equal {string}', async function (expected) { - assert.equal(this.traceString, (await loadResource(expected)).toString()); + Then('calling app trace produces {string}', async function (expected) { + const traceString = this.txtrace.appTrace(); + assert.equal(traceString, (await loadResource(expected)).toString()); }); if (!options.ignoreReturn) { From 515727c996996971a52cd9f43e4de7a5ddd619c6 Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Tue, 15 Mar 2022 12:36:59 -0400 Subject: [PATCH 12/37] fix makefile --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b96e23418..00f5aa964 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ unit: - #node_modules/.bin/cucumber-js --tags "@unit.offline or @unit.algod or @unit.indexer or @unit.rekey or @unit.tealsign or @unit.dryrun or @unit.applications or @unit.responses or @unit.transactions or @unit.transactions.keyreg or @unit.transactions.payment or @unit.responses.231 or @unit.feetest or @unit.indexer.logs or @unit.abijson or @unit.atomic_transaction_composer or @unit.dryrun.trace.application" tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js - node_modules/.bin/cucumber-js --tags "@unit.dryrun.trace.application" tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js + node_modules/.bin/cucumber-js --tags "@unit.offline or @unit.algod or @unit.indexer or @unit.rekey or @unit.tealsign or @unit.dryrun or @unit.applications or @unit.responses or @unit.transactions or @unit.transactions.keyreg or @unit.transactions.payment or @unit.responses.231 or @unit.feetest or @unit.indexer.logs or @unit.abijson or @unit.atomic_transaction_composer or @unit.dryrun.trace.application" tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js integration: node_modules/.bin/cucumber-js --tags "@algod or @assets or @auction or @kmd or @send or @indexer or @rekey or @send.keyregtxn or @dryrun or @compile or @applications or @indexer.applications or @applications.verified or @indexer.231 or @abi or @c2c" tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js From 0b5cdfc0c1add0c946037e03580f0c43325e97a7 Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Tue, 15 Mar 2022 12:57:25 -0400 Subject: [PATCH 13/37] fix trailing spaces --- src/dryrun.ts | 9 ++++++--- tests/cucumber/steps/steps.js | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/dryrun.ts b/src/dryrun.ts index 2599fca28..f0254c0e2 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -388,11 +388,14 @@ class DryrunTransactionResult { }, new Array(lines[0].length).fill(0)); // TODO: ensure correct spacing - return lines + return `${lines .map((line) => - line.map((v, idx) => v.padEnd(maxLengths[idx] + 1, ' ')).join('|') + line + .map((v, idx) => v.padEnd(maxLengths[idx] + 1, ' ')) + .join('|') + .trim() ) - .join('\n'); + .join('\n')}\n`; } appTrace(spc?: StackPrinterConfig): string { diff --git a/tests/cucumber/steps/steps.js b/tests/cucumber/steps/steps.js index b7bf579e8..3bf8d9c76 100644 --- a/tests/cucumber/steps/steps.js +++ b/tests/cucumber/steps/steps.js @@ -5182,7 +5182,8 @@ module.exports = function getSteps(options) { Then('calling app trace produces {string}', async function (expected) { const traceString = this.txtrace.appTrace(); - assert.equal(traceString, (await loadResource(expected)).toString()); + const expectedString = (await loadResource(expected)).toString(); + assert.equal(traceString, expectedString); }); if (!options.ignoreReturn) { From 77253f1d30d0772651f0bd204d063191e693d0fa Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Tue, 15 Mar 2022 13:44:50 -0400 Subject: [PATCH 14/37] adding error condition --- src/dryrun.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/dryrun.ts b/src/dryrun.ts index f0254c0e2..e3cbe1c72 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -197,6 +197,7 @@ class DryrunStackValue { } interface DryrunTraceLineResponse { + error: string; line: number; pc: number; scratch: TealValue[]; @@ -204,12 +205,14 @@ interface DryrunTraceLineResponse { } class DryrunTraceLine { + error: string = undefined; line: number = 0; pc: number = 0; scratch: TealValue[] = []; stack: DryrunStackValue[] = []; constructor(line: DryrunTraceLineResponse) { + this.error = line.error; this.line = line.line; this.pc = line.pc; this.scratch = line.scratch; @@ -362,16 +365,20 @@ class DryrunTransactionResult { // Create the array of arrays, each sub array contains N columns const lines = [['pc#', 'ln#', 'source', 'scratch', 'stack']]; for (let idx = 0; idx < drt.trace.length; idx++) { - const { line, pc, scratch, stack } = drt.trace[idx]; + const { line, error, pc, scratch, stack } = drt.trace[idx]; + const currScratch = scratch !== undefined ? scratch : []; const prevScratch = idx > 0 && drt.trace[idx - 1].scratch !== undefined ? drt.trace[idx - 1].scratch : []; + + const src = error === undefined ? disassembly[line] : `!! ${error} !!`; + lines.push([ pc.toString().padEnd(3, ' '), line.toString().padEnd(3, ' '), - truncate(disassembly[line], maxWidth), + truncate(src, maxWidth), truncate(scratchToString(prevScratch, currScratch), maxWidth), truncate(stackToString(stack, spc.topOfStackFirst), maxWidth), ]); @@ -387,7 +394,6 @@ class DryrunTransactionResult { return newVal; }, new Array(lines[0].length).fill(0)); - // TODO: ensure correct spacing return `${lines .map((line) => line From 36b81323424d39457e1c55dfc09f79dc1dd3dcb8 Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Mon, 21 Mar 2022 12:53:24 -0400 Subject: [PATCH 15/37] add test back in --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a1fc52b76..888c0ed8c 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ unit: - node_modules/.bin/cucumber-js --tags "@unit.offline or @unit.algod or @unit.indexer or @unit.rekey or @unit.tealsign or @unit.dryrun or @unit.applications or @unit.responses or @unit.transactions or @unit.transactions.keyreg or @unit.transactions.payment or @unit.responses.231 or @unit.feetest or @unit.indexer.logs or @unit.abijson or @unit.atomic_transaction_composer or @unit.responses.unlimited_assets or @unit.indexer.ledger_refactoring or @unit.algod.ledger_refactoring" tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js + node_modules/.bin/cucumber-js --tags "@unit.offline or @unit.algod or @unit.indexer or @unit.rekey or @unit.tealsign or @unit.dryrun or @unit.applications or @unit.responses or @unit.transactions or @unit.transactions.keyreg or @unit.transactions.payment or @unit.responses.231 or @unit.feetest or @unit.indexer.logs or @unit.abijson or @unit.atomic_transaction_composer or @unit.responses.unlimited_assets or @unit.indexer.ledger_refactoring or @unit.algod.ledger_refactoring or @unit.dryrun.trace.application" tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js + integration: node_modules/.bin/cucumber-js --tags "@algod or @assets or @auction or @kmd or @send or @indexer or @rekey or @send.keyregtxn or @dryrun or @compile or @applications or @indexer.applications or @applications.verified or @indexer.231 or @abi or @c2c" tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js From a7f7c002696c7c0ed1cac98ec50a72f1a3f27d55 Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Tue, 22 Mar 2022 13:31:09 -0400 Subject: [PATCH 16/37] dont look at the type, it isnt correct in some cases --- src/dryrun.ts | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/dryrun.ts b/src/dryrun.ts index e3cbe1c72..79bb4c08c 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -259,30 +259,30 @@ function scratchToString( prevScratch: TealValue[], currScratch: TealValue[] ): string { - let newScratchIdx = 0; - let newScratch = {} as TealValue; + if (currScratch.length === 0) return ''; + let newScratchIdx = null; for (let idx = 0; idx < currScratch.length; idx++) { - if ( - idx >= prevScratch.length || - JSON.stringify(prevScratch[idx]) !== JSON.stringify(currScratch[idx]) - ) { - newScratch = currScratch[idx]; + if (idx > prevScratch.length) { + newScratchIdx = idx; + continue; + } + + if (JSON.stringify(prevScratch[idx]) !== JSON.stringify(currScratch[idx])) { newScratchIdx = idx; } } - switch (newScratch.type) { - case 1: - return `${newScratchIdx} = 0x${Buffer.from( - newScratch.bytes, - 'base64' - ).toString('hex')}`; - case 2: - return `${newScratchIdx} = ${newScratch.uint.toString()}`; - default: - return ''; + if (newScratchIdx == null) return ''; + + const newScratch = currScratch[newScratchIdx]; + if (newScratch.bytes.length > 0) { + return `${newScratchIdx} = 0x${Buffer.from( + newScratch.bytes, + 'base64' + ).toString('hex')}`; } + return `${newScratchIdx} = ${newScratch.uint.toString()}`; } function stackToString(stack: DryrunStackValue[], reverse: boolean): string { From 2b05cdc8ce0031518c3210f0d3cbcfcd19ff2ebf Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Tue, 12 Apr 2022 15:07:23 -0400 Subject: [PATCH 17/37] change err to empty string --- src/dryrun.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dryrun.ts b/src/dryrun.ts index 79bb4c08c..5122f095a 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -205,7 +205,7 @@ interface DryrunTraceLineResponse { } class DryrunTraceLine { - error: string = undefined; + error: string = ''; line: number = 0; pc: number = 0; scratch: TealValue[] = []; @@ -373,7 +373,7 @@ class DryrunTransactionResult { ? drt.trace[idx - 1].scratch : []; - const src = error === undefined ? disassembly[line] : `!! ${error} !!`; + const src = error === '' ? disassembly[line] : `!! ${error} !!`; lines.push([ pc.toString().padEnd(3, ' '), From b4d5fc483f6fad47dbbbf7666b5d81cabd4a40e9 Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Tue, 12 Apr 2022 15:09:06 -0400 Subject: [PATCH 18/37] change name of maxwidth setting to match pysdk --- src/dryrun.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/dryrun.ts b/src/dryrun.ts index 5122f095a..87b1dc3c8 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -244,13 +244,13 @@ interface DryrunTransactionResultResponse { } interface StackPrinterConfig { - maxWidth: number | undefined; + maxValueWidth: number | undefined; topOfStackFirst: boolean | undefined; } -function truncate(str: string, maxWidth: number): string { - if (str.length > maxWidth && maxWidth > 0) { - return `${str.slice(0, maxWidth)}...`; +function truncate(str: string, maxValueWidth: number): string { + if (str.length > maxValueWidth && maxValueWidth > 0) { + return `${str.slice(0, maxValueWidth)}...`; } return str; } @@ -360,7 +360,7 @@ class DryrunTransactionResult { spc: StackPrinterConfig ): string { let maxWidth = defaultMaxWidth; - if (spc.maxWidth === undefined) maxWidth = spc.maxWidth; + if (spc.maxValueWidth === undefined) maxWidth = spc.maxValueWidth; // Create the array of arrays, each sub array contains N columns const lines = [['pc#', 'ln#', 'source', 'scratch', 'stack']]; @@ -410,7 +410,7 @@ class DryrunTransactionResult { let conf = spc; if (spc === undefined) conf = { - maxWidth: defaultMaxWidth, + maxValueWidth: defaultMaxWidth, topOfStackFirst: false, } as StackPrinterConfig; @@ -431,7 +431,7 @@ class DryrunTransactionResult { let conf = spc; if (spc === undefined) conf = { - maxWidth: defaultMaxWidth, + maxValueWidth: defaultMaxWidth, topOfStackFirst: true, } as StackPrinterConfig; From 3a9cf7956d2a98dc662b467648bdac1ffd4da2bf Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Tue, 12 Apr 2022 15:10:38 -0400 Subject: [PATCH 19/37] fix undefined check --- src/dryrun.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dryrun.ts b/src/dryrun.ts index 87b1dc3c8..0453c50b8 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -212,7 +212,7 @@ class DryrunTraceLine { stack: DryrunStackValue[] = []; constructor(line: DryrunTraceLineResponse) { - this.error = line.error; + this.error = line.error === undefined ? '' : line.error; this.line = line.line; this.pc = line.pc; this.scratch = line.scratch; From cdc8a6aaa8898ffa2fab06c5e5382533eaac464f Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Tue, 12 Apr 2022 15:53:15 -0400 Subject: [PATCH 20/37] Update src/dryrun.ts Co-authored-by: algochoi <86622919+algochoi@users.noreply.github.com> --- src/dryrun.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dryrun.ts b/src/dryrun.ts index 0453c50b8..5f9b85036 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -237,7 +237,7 @@ interface DryrunTransactionResultResponse { globalDelta: EvalDeltaKeyValue[] | undefined; cost: number | undefined; logicSigMessages: string[] | undefined; - logicSigDisassemly: string[] | undefined; + logicSigDisassembly: string[] | undefined; logs: string[] | undefined; appCallTrace: DryrunTrace | undefined; logicSigTrace: DryrunTrace | undefined; From 837f4885e0d385a602aeae63f6f11c3c039b4836 Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Tue, 12 Apr 2022 15:54:30 -0400 Subject: [PATCH 21/37] fmt --- src/dryrun.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dryrun.ts b/src/dryrun.ts index 5f9b85036..ea0eeaabb 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -177,6 +177,7 @@ interface StackValueResponse { bytes: string; uint: number; } + class DryrunStackValue { type: number = 0; bytes: string = ''; From 991647deee5f1b570a950598d01abbffb99ba02b Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Tue, 12 Apr 2022 15:54:30 -0400 Subject: [PATCH 22/37] fmt --- src/dryrun.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dryrun.ts b/src/dryrun.ts index 5f9b85036..ea0eeaabb 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -177,6 +177,7 @@ interface StackValueResponse { bytes: string; uint: number; } + class DryrunStackValue { type: number = 0; bytes: string = ''; From 0f5a9fa262292d774f2df38cb1fbabf6ade8a4fa Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Tue, 12 Apr 2022 16:24:48 -0400 Subject: [PATCH 23/37] typo --- src/dryrun.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dryrun.ts b/src/dryrun.ts index ea0eeaabb..d724fde1a 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -309,7 +309,7 @@ class DryrunTransactionResult { globalDelta: EvalDeltaKeyValue[] | undefined = []; cost: number | undefined = 0; logicSigMessages: string[] | undefined = []; - logicSigDisassemly: string[] | undefined = []; + logicSigDisassembly: string[] | undefined = []; logs: string[] | undefined = []; appCallTrace: DryrunTrace | undefined = undefined; @@ -335,7 +335,7 @@ class DryrunTransactionResult { this.globalDelta = dtr['global-delta']; this.cost = dtr.cost; this.logicSigMessages = dtr['logic-sig-messages']; - this.logicSigDisassemly = dtr['logic-sig-disassembly']; + this.logicSigDisassembly = dtr['logic-sig-disassembly']; this.logs = dtr.logs; this.appCallTrace = new DryrunTrace(dtr['app-call-trace']); this.logicSigTrace = new DryrunTrace(dtr['logic-sig-trace']); @@ -425,7 +425,7 @@ class DryrunTransactionResult { lsigTrace(spc?: StackPrinterConfig): string { if ( this.logicSigTrace === undefined || - this.logicSigDisassemly === undefined + this.logicSigDisassembly === undefined ) return ''; @@ -438,7 +438,7 @@ class DryrunTransactionResult { return DryrunTransactionResult.trace( this.logicSigTrace, - this.logicSigDisassemly, + this.logicSigDisassembly, conf ); } From 2858723b45534dbca651e5884cd4d7e102217ab9 Mon Sep 17 00:00:00 2001 From: Jack <87339414+algojack@users.noreply.github.com> Date: Mon, 25 Apr 2022 14:09:31 -0400 Subject: [PATCH 24/37] fixing openssh upgrade error --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 99d0dddd8..1674d884b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -123,7 +123,7 @@ commands: - run: name: Install Dependencies command: | - << parameters.sudo >> apt -y update && << parameters.sudo >> apt -y upgrade + << parameters.sudo >> apt -y update << parameters.sudo >> apt -y install curl make git build-essential jq unzip - node/install: node-version: '12' From c9fd4b8bf4fa8474c59123c2bf577a7ba7bfb126 Mon Sep 17 00:00:00 2001 From: Jack <87339414+algojack@users.noreply.github.com> Date: Mon, 25 Apr 2022 14:17:43 -0400 Subject: [PATCH 25/37] fixing chrome --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1674d884b..76a52d2cc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -124,7 +124,7 @@ commands: name: Install Dependencies command: | << parameters.sudo >> apt -y update - << parameters.sudo >> apt -y install curl make git build-essential jq unzip + << parameters.sudo >> apt -y install curl make git build-essential jq unzip google-chrome-stable - node/install: node-version: '12' - run: From 9be35623f82b3818e1ad1ebb0277c1a00dc37cfd Mon Sep 17 00:00:00 2001 From: Jack <87339414+algojack@users.noreply.github.com> Date: Mon, 25 Apr 2022 14:24:23 -0400 Subject: [PATCH 26/37] fixing chrome install --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 76a52d2cc..16a0f0cda 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -82,6 +82,7 @@ jobs: command: | export SUDO=sudo $SUDO apt update + if [ "<< parameters.browser >>" == "chrome" ]; $SUDO apt -y install google-chrome-stable; fi $SUDO apt -y install ca-certificates curl gnupg lsb-release $SUDO curl -fsSL https://download.docker.com/linux/ubuntu/gpg | $SUDO gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg $SUDO echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ @@ -124,7 +125,7 @@ commands: name: Install Dependencies command: | << parameters.sudo >> apt -y update - << parameters.sudo >> apt -y install curl make git build-essential jq unzip google-chrome-stable + << parameters.sudo >> apt -y install curl make git build-essential jq unzip - node/install: node-version: '12' - run: From 47d4d45eede4a6f49f3a0d403a300e66ebbffb05 Mon Sep 17 00:00:00 2001 From: Jack <87339414+algojack@users.noreply.github.com> Date: Mon, 25 Apr 2022 14:27:49 -0400 Subject: [PATCH 27/37] fixing chrome install --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 16a0f0cda..e84020c12 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -82,7 +82,7 @@ jobs: command: | export SUDO=sudo $SUDO apt update - if [ "<< parameters.browser >>" == "chrome" ]; $SUDO apt -y install google-chrome-stable; fi + if [ "<< parameters.browser >>" == "chrome" ]; then $SUDO apt -y install google-chrome-stable; else echo "skipping chrome install" ; fi $SUDO apt -y install ca-certificates curl gnupg lsb-release $SUDO curl -fsSL https://download.docker.com/linux/ubuntu/gpg | $SUDO gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg $SUDO echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ From 2d3aa000de76a0b470a83b8297e5b08a21b273b5 Mon Sep 17 00:00:00 2001 From: Fionna Chan Date: Tue, 26 Apr 2022 03:01:44 +0800 Subject: [PATCH 28/37] Document all Indexer methods (#524) * Minor formatting for existing indexer docs * Add docs for lookupAssetTransactions * Add docs for searchForAssets * Add docs for lookupAccountByID * Add docs for lookupApplications * Minor formatting * Add docs for searchForApplications * Add docs for lookupTransactionsByID * Add docs for lookupBlock * Add docs for searchForTransations * Fix typo in examples * Add docs for searchAccounts * Add docs for lookupApplicationLogs * Minor formatting * Add npm scripts docs:dev to watch docs changes * Merge remote-tracking branch 'origin/develop' into indexer-method-docs * Add docs for indexer new query params * Update according to review comments * Add an explanation to deprecated query of lookupAssetTransactions --- package-lock.json | 116 ++++-- package.json | 3 +- src/client/v2/indexer/indexer.ts | 16 +- .../v2/indexer/lookupAccountAppLocalStates.ts | 33 +- src/client/v2/indexer/lookupAccountAssets.ts | 32 +- src/client/v2/indexer/lookupAccountByID.ts | 79 +++- .../lookupAccountCreatedApplications.ts | 34 +- .../v2/indexer/lookupAccountCreatedAssets.ts | 33 +- .../v2/indexer/lookupAccountTransactions.ts | 55 +-- .../v2/indexer/lookupApplicationLogs.ts | 118 +++++- src/client/v2/indexer/lookupApplications.ts | 41 ++- src/client/v2/indexer/lookupAssetBalances.ts | 35 +- src/client/v2/indexer/lookupAssetByID.ts | 2 + .../v2/indexer/lookupAssetTransactions.ts | 316 +++++++++++++++- src/client/v2/indexer/lookupBlock.ts | 16 + .../v2/indexer/lookupTransactionByID.ts | 16 + src/client/v2/indexer/makeHealthCheck.ts | 15 + src/client/v2/indexer/searchAccounts.ts | 220 ++++++++++- .../v2/indexer/searchForApplications.ts | 106 +++++- src/client/v2/indexer/searchForAssets.ts | 139 ++++++- .../v2/indexer/searchForTransactions.ts | 347 +++++++++++++++++- 21 files changed, 1623 insertions(+), 149 deletions(-) diff --git a/package-lock.json b/package-lock.json index 27f8775c7..9f4ba1f59 100644 --- a/package-lock.json +++ b/package-lock.json @@ -51,7 +51,7 @@ "source-map-loader": "^2.0.2", "ts-loader": "^8.3.0", "ts-node": "^10.0.0", - "typedoc": "^0.22.11", + "typedoc": "^0.22.13", "typedoc-plugin-missing-exports": "^0.22.6", "typedoc-plugin-rename-defaults": "^0.4.0", "typescript": "^4.2.3", @@ -6597,9 +6597,9 @@ } }, "node_modules/shiki": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.10.0.tgz", - "integrity": "sha512-iczxaIYeBFHTFrQPb9DVy2SKgYxC4Wo7Iucm7C17cCh2Ge/refnvHscUOxM85u57MfLoNOtjoEFUWt9gBexblA==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.10.1.tgz", + "integrity": "sha512-VsY7QJVzU51j5o1+DguUd+6vmCmZ5v/6gYu4vyYAhzjuNQU6P/vmSy4uQaOhvje031qQMiW0d2BwgMH52vqMng==", "dev": true, "dependencies": { "jsonc-parser": "^3.0.0", @@ -7530,16 +7530,16 @@ } }, "node_modules/typedoc": { - "version": "0.22.11", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.11.tgz", - "integrity": "sha512-pVr3hh6dkS3lPPaZz1fNpvcrqLdtEvXmXayN55czlamSgvEjh+57GUqfhAI1Xsuu/hNHUT1KNSx8LH2wBP/7SA==", + "version": "0.22.13", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.13.tgz", + "integrity": "sha512-NHNI7Dr6JHa/I3+c62gdRNXBIyX7P33O9TafGLd07ur3MqzcKgwTvpg18EtvCLHJyfeSthAtCLpM7WkStUmDuQ==", "dev": true, "dependencies": { "glob": "^7.2.0", "lunr": "^2.3.9", - "marked": "^4.0.10", - "minimatch": "^3.0.4", - "shiki": "^0.10.0" + "marked": "^4.0.12", + "minimatch": "^5.0.1", + "shiki": "^0.10.1" }, "bin": { "typedoc": "bin/typedoc" @@ -7548,7 +7548,7 @@ "node": ">= 12.10.0" }, "peerDependencies": { - "typescript": "4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x || 4.5.x" + "typescript": "4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x || 4.5.x || 4.6.x" } }, "node_modules/typedoc-plugin-missing-exports": { @@ -7589,6 +7589,39 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/typedoc/node_modules/glob/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/typedoc/node_modules/minimatch": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/typedoc/node_modules/minimatch/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, "node_modules/typescript": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", @@ -7752,9 +7785,9 @@ } }, "node_modules/vscode-oniguruma": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.6.1.tgz", - "integrity": "sha512-vc4WhSIaVpgJ0jJIejjYxPvURJavX6QG41vu0mGhqywMkQqulezEqEQ3cO3gc8GvcOpX6ycmKGqRoROEMBNXTQ==", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.6.2.tgz", + "integrity": "sha512-KH8+KKov5eS/9WhofZR8M8dMHWN2gTxjMsG4jd04YhpbPR91fUj7rYQ2/XjeHCJWbg7X++ApRIU9NUwM2vTvLA==", "dev": true }, "node_modules/vscode-textmate": { @@ -13350,9 +13383,9 @@ "dev": true }, "shiki": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.10.0.tgz", - "integrity": "sha512-iczxaIYeBFHTFrQPb9DVy2SKgYxC4Wo7Iucm7C17cCh2Ge/refnvHscUOxM85u57MfLoNOtjoEFUWt9gBexblA==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.10.1.tgz", + "integrity": "sha512-VsY7QJVzU51j5o1+DguUd+6vmCmZ5v/6gYu4vyYAhzjuNQU6P/vmSy4uQaOhvje031qQMiW0d2BwgMH52vqMng==", "dev": true, "requires": { "jsonc-parser": "^3.0.0", @@ -14074,16 +14107,16 @@ } }, "typedoc": { - "version": "0.22.11", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.11.tgz", - "integrity": "sha512-pVr3hh6dkS3lPPaZz1fNpvcrqLdtEvXmXayN55czlamSgvEjh+57GUqfhAI1Xsuu/hNHUT1KNSx8LH2wBP/7SA==", + "version": "0.22.13", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.13.tgz", + "integrity": "sha512-NHNI7Dr6JHa/I3+c62gdRNXBIyX7P33O9TafGLd07ur3MqzcKgwTvpg18EtvCLHJyfeSthAtCLpM7WkStUmDuQ==", "dev": true, "requires": { "glob": "^7.2.0", "lunr": "^2.3.9", - "marked": "^4.0.10", - "minimatch": "^3.0.4", - "shiki": "^0.10.0" + "marked": "^4.0.12", + "minimatch": "^5.0.1", + "shiki": "^0.10.1" }, "dependencies": { "glob": { @@ -14098,6 +14131,37 @@ "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" + }, + "dependencies": { + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "minimatch": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + } } } } @@ -14250,9 +14314,9 @@ } }, "vscode-oniguruma": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.6.1.tgz", - "integrity": "sha512-vc4WhSIaVpgJ0jJIejjYxPvURJavX6QG41vu0mGhqywMkQqulezEqEQ3cO3gc8GvcOpX6ycmKGqRoROEMBNXTQ==", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.6.2.tgz", + "integrity": "sha512-KH8+KKov5eS/9WhofZR8M8dMHWN2gTxjMsG4jd04YhpbPR91fUj7rYQ2/XjeHCJWbg7X++ApRIU9NUwM2vTvLA==", "dev": true }, "vscode-textmate": { diff --git a/package.json b/package.json index ece58b792..d50bfc468 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "source-map-loader": "^2.0.2", "ts-loader": "^8.3.0", "ts-node": "^10.0.0", - "typedoc": "^0.22.11", + "typedoc": "^0.22.13", "typedoc-plugin-missing-exports": "^0.22.6", "typedoc-plugin-rename-defaults": "^0.4.0", "typescript": "^4.2.3", @@ -72,6 +72,7 @@ "prepare-browser-tests": "npm run build && mkdir -p tests/cucumber/browser/build && cp dist/browser/algosdk.min.* tests/cucumber/browser/build/ && webpack --config tests/cucumber/browser/webpack.config.js", "build": "concurrently \"webpack --config webpack.config.js\" \"tsc -p tsconfig-esm.json\" \"tsc -p tsconfig-cjs.json\"", "docs": "typedoc src/main.ts --options typedoc.config.json", + "docs:dev": "typedoc src/main.ts --options typedoc.config.json --watch --preserveWatchOutput", "lint": "eslint .", "lint:fix": "eslint --fix .", "format": "prettier --write .", diff --git a/src/client/v2/indexer/indexer.ts b/src/client/v2/indexer/indexer.ts index 0257a64a7..ed90f7474 100644 --- a/src/client/v2/indexer/indexer.ts +++ b/src/client/v2/indexer/indexer.ts @@ -196,10 +196,10 @@ export default class IndexerClient extends ServiceClient { * #### Example * ```typescript * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; - * const accountInfo = await indexerClient.lookupAccountAssets(address).do(); + * const accountAssets = await indexerClient.lookupAccountAssets(address).do(); * ``` * - * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-id) + * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-idassets) * @param account - The address of the account to look up. * @category GET */ @@ -213,10 +213,10 @@ export default class IndexerClient extends ServiceClient { * #### Example * ```typescript * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; - * const accountInfo = await indexerClient.lookupAccountCreatedAssets(address).do(); + * const accountCreatedAssets = await indexerClient.lookupAccountCreatedAssets(address).do(); * ``` * - * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-id) + * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-idcreated-assets) * @param account - The address of the account to look up. * @category GET */ @@ -230,10 +230,10 @@ export default class IndexerClient extends ServiceClient { * #### Example * ```typescript * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; - * const accountInfo = await indexerClient.lookupAccountAppLocalStates(address).do(); + * const accountAppLocalStates = await indexerClient.lookupAccountAppLocalStates(address).do(); * ``` * - * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-id) + * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-idapps-local-state) * @param account - The address of the account to look up. * @category GET */ @@ -247,10 +247,10 @@ export default class IndexerClient extends ServiceClient { * #### Example * ```typescript * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; - * const accountInfo = await indexerClient.lookupAccountCreatedApplications(address).do(); + * const accountCreatedApps = await indexerClient.lookupAccountCreatedApplications(address).do(); * ``` * - * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-id) + * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-idcreated-applications) * @param account - The address of the account to look up. * @category GET */ diff --git a/src/client/v2/indexer/lookupAccountAppLocalStates.ts b/src/client/v2/indexer/lookupAccountAppLocalStates.ts index b434656e0..4a2c2da76 100644 --- a/src/client/v2/indexer/lookupAccountAppLocalStates.ts +++ b/src/client/v2/indexer/lookupAccountAppLocalStates.ts @@ -3,6 +3,19 @@ import HTTPClient from '../../client'; import IntDecoding from '../../../types/intDecoding'; export default class LookupAccountAppLocalStates extends JSONRequest { + /** + * Returns application local state about the given account. + * + * #### Example + * ```typescript + * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; + * const accountAppLocalStates = await indexerClient.lookupAccountAppLocalStates(address).do(); + * ``` + * + * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-idapps-local-state) + * @param account - The address of the account to look up. + * @category GET + */ constructor( c: HTTPClient, intDecoding: IntDecoding, @@ -12,6 +25,9 @@ export default class LookupAccountAppLocalStates extends JSONRequest { this.account = account; } + /** + * @returns `/v2/accounts/${account}/apps-local-state` + */ path() { return `/v2/accounts/${this.account}/apps-local-state`; } @@ -30,6 +46,7 @@ export default class LookupAccountAppLocalStates extends JSONRequest { * ``` * * @param limit - maximum number of results to return. + * @category query */ limit(limit: number) { this.query.limit = limit; @@ -49,6 +66,7 @@ export default class LookupAccountAppLocalStates extends JSONRequest { * .do(); * ``` * @param round + * @category query */ round(round: number) { this.query.round = round; @@ -62,11 +80,16 @@ export default class LookupAccountAppLocalStates extends JSONRequest { * ```typescript * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; * const maxResults = 20; - * const nextToken = "APA6C7C3NCANRPIBUWQOF7WSKLJMK6RPQUVFLLDV4U5WCQE4DEF26D4E3E"; - * const accountAssets = await indexerClient + * + * const accountAssetsPage1 = await indexerClient + * .lookupAccountAppLocalStates(address) + * .limit(maxResults) + * .do(); + * + * const accountAssetsPage2 = await indexerClient * .lookupAccountAppLocalStates(address) * .limit(maxResults) - * .next(nextToken) + * .next(accountAssetsPage1["next-token"]) * .do(); * ``` * @param nextToken - provided by the previous results. @@ -88,6 +111,7 @@ export default class LookupAccountAppLocalStates extends JSONRequest { * .do(); * ``` * @param value + * @category query */ includeAll(value = true) { this.query['include-all'] = value; @@ -95,7 +119,7 @@ export default class LookupAccountAppLocalStates extends JSONRequest { } /** - * Specify an applicationID to search for + * Specify an applicationID to search for. * * #### Example * ```typescript @@ -107,6 +131,7 @@ export default class LookupAccountAppLocalStates extends JSONRequest { * .do(); * ``` * @param index - the applicationID + * @category query */ applicationID(index: number) { this.query['application-id'] = index; diff --git a/src/client/v2/indexer/lookupAccountAssets.ts b/src/client/v2/indexer/lookupAccountAssets.ts index 5b56d615e..2d6194f4f 100644 --- a/src/client/v2/indexer/lookupAccountAssets.ts +++ b/src/client/v2/indexer/lookupAccountAssets.ts @@ -3,6 +3,19 @@ import HTTPClient from '../../client'; import IntDecoding from '../../../types/intDecoding'; export default class LookupAccountAssets extends JSONRequest { + /** + * Returns asset about the given account. + * + * #### Example + * ```typescript + * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; + * const accountAssets = await indexerClient.lookupAccountAssets(address).do(); + * ``` + * + * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-idassets) + * @param account - The address of the account to look up. + * @category GET + */ constructor( c: HTTPClient, intDecoding: IntDecoding, @@ -12,6 +25,9 @@ export default class LookupAccountAssets extends JSONRequest { this.account = account; } + /** + * @returns `/v2/accounts/${account}/assets` + */ path() { return `/v2/accounts/${this.account}/assets`; } @@ -30,6 +46,7 @@ export default class LookupAccountAssets extends JSONRequest { * ``` * * @param limit - maximum number of results to return. + * @category query */ limit(limit: number) { this.query.limit = limit; @@ -49,6 +66,7 @@ export default class LookupAccountAssets extends JSONRequest { * .do(); * ``` * @param round + * @category query */ round(round: number) { this.query.round = round; @@ -62,14 +80,20 @@ export default class LookupAccountAssets extends JSONRequest { * ```typescript * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; * const maxResults = 20; - * const nextToken = "APA6C7C3NCANRPIBUWQOF7WSKLJMK6RPQUVFLLDV4U5WCQE4DEF26D4E3E"; - * const accountAssets = await indexerClient + * + * const accountAssetsPage1 = await indexerClient + * .lookupAccountAssets(address) + * .limit(maxResults) + * .do(); + * + * const accountAssetsPage2 = await indexerClient * .lookupAccountAssets(address) * .limit(maxResults) - * .next(nextToken) + * .next(accountAssetsPage1["next-token"]) * .do(); * ``` * @param nextToken - provided by the previous results. + * @category query */ nextToken(nextToken: string) { this.query.next = nextToken; @@ -88,6 +112,7 @@ export default class LookupAccountAssets extends JSONRequest { * .do(); * ``` * @param value + * @category query */ includeAll(value = true) { this.query['include-all'] = value; @@ -107,6 +132,7 @@ export default class LookupAccountAssets extends JSONRequest { * .do(); * ``` * @param index - the assetID + * @category query */ assetId(index: number) { this.query['asset-id'] = index; diff --git a/src/client/v2/indexer/lookupAccountByID.ts b/src/client/v2/indexer/lookupAccountByID.ts index 0a03fb16c..8c024ec31 100644 --- a/src/client/v2/indexer/lookupAccountByID.ts +++ b/src/client/v2/indexer/lookupAccountByID.ts @@ -3,6 +3,19 @@ import HTTPClient from '../../client'; import IntDecoding from '../../../types/intDecoding'; export default class LookupAccountByID extends JSONRequest { + /** + * Returns information about the given account. + * + * #### Example + * ```typescript + * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; + * const accountInfo = await indexerClient.lookupAccountByID(address).do(); + * ``` + * + * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-id) + * @param account - The address of the account to look up. + * @category GET + */ constructor( c: HTTPClient, intDecoding: IntDecoding, @@ -12,23 +25,83 @@ export default class LookupAccountByID extends JSONRequest { this.account = account; } + /** + * @returns `/v2/accounts/${account}` + */ path() { return `/v2/accounts/${this.account}`; } - // specific round to search + /** + * Specify round to filter with. + * + * #### Example + * ```typescript + * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; + * const targetBlock = 18309917; + * const accountInfo = await indexerClient + * .lookupAccountByID(address) + * .round(targetBlock) + * .do(); + * ``` + * @param round + */ round(round: number) { this.query.round = round; return this; } - // include all items including closed accounts, deleted applications, destroyed assets, opted-out asset holdings, and closed-out application localstates + /** + * Include all items including closed accounts, deleted applications, destroyed assets, opted-out asset holdings, and closed-out application localstates. + * + * #### Example 1 + * ```typescript + * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; + * const accountInfo = await indexerClient + * .lookupAccountByID(address) + * .includeAll(false) + * .do(); + * ``` + * + * #### Example 2 + * ```typescript + * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; + * const accountInfo = await indexerClient + * .lookupAccountByID(address) + * .includeAll() + * .do(); + * ``` + * @param value + */ includeAll(value = true) { this.query['include-all'] = value; return this; } - // exclude + /** + * Exclude additional items such as asset holdings, application local data stored for this account, asset parameters created by this account, and application parameters created by this account. + * + * #### Example 1 + * ```typescript + * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; + * const accountInfo = await indexerClient + * .lookupAccountByID(address) + * .exclude("all") + * .do(); + * ``` + * + * #### Example 2 + * ```typescript + * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; + * const accountInfo = await indexerClient + * .lookupAccountByID(address) + * .exclude("assets,created-assets") + * .do(); + * ``` + * @remarks By default, it behaves as exclude=none + * @param exclude - Array of `all`, `assets`, `created-assets`, `apps-local-state`, `created-apps`, `none` + * @category query + */ exclude(exclude: string) { this.query.exclude = exclude; return this; diff --git a/src/client/v2/indexer/lookupAccountCreatedApplications.ts b/src/client/v2/indexer/lookupAccountCreatedApplications.ts index d93b90826..187ab3363 100644 --- a/src/client/v2/indexer/lookupAccountCreatedApplications.ts +++ b/src/client/v2/indexer/lookupAccountCreatedApplications.ts @@ -3,6 +3,19 @@ import HTTPClient from '../../client'; import IntDecoding from '../../../types/intDecoding'; export default class LookupAccountCreatedApplications extends JSONRequest { + /** + * Returns application information created by the given account. + * + * #### Example + * ```typescript + * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; + * const accountCreatedApps = await indexerClient.lookupAccountCreatedApplications(address).do(); + * ``` + * + * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-idcreated-applications) + * @param account - The address of the account to look up. + * @category GET + */ constructor( c: HTTPClient, intDecoding: IntDecoding, @@ -12,6 +25,9 @@ export default class LookupAccountCreatedApplications extends JSONRequest { this.account = account; } + /** + * @returns `/v2/accounts/${account}/created-applications` + */ path() { return `/v2/accounts/${this.account}/created-applications`; } @@ -30,6 +46,7 @@ export default class LookupAccountCreatedApplications extends JSONRequest { * ``` * * @param limit - maximum number of results to return. + * @category query */ limit(limit: number) { this.query.limit = limit; @@ -49,6 +66,7 @@ export default class LookupAccountCreatedApplications extends JSONRequest { * .do(); * ``` * @param round + * @category query */ round(round: number) { this.query.round = round; @@ -62,14 +80,20 @@ export default class LookupAccountCreatedApplications extends JSONRequest { * ```typescript * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; * const maxResults = 20; - * const nextToken = "APA6C7C3NCANRPIBUWQOF7WSKLJMK6RPQUVFLLDV4U5WCQE4DEF26D4E3E"; - * const accountAssets = await indexerClient + * + * const accountAssetsPage1 = await indexerClient + * .lookupAccountCreatedApplications(address) + * .limit(maxResults) + * .do(); + * + * const accountAssetsPage2 = await indexerClient * .lookupAccountCreatedApplications(address) * .limit(maxResults) - * .next(nextToken) + * .next(accountAssetsPage1["next-token"]) * .do(); * ``` * @param nextToken - provided by the previous results. + * @category query */ nextToken(nextToken: string) { this.query.next = nextToken; @@ -88,6 +112,7 @@ export default class LookupAccountCreatedApplications extends JSONRequest { * .do(); * ``` * @param value + * @category query */ includeAll(value = true) { this.query['include-all'] = value; @@ -95,7 +120,7 @@ export default class LookupAccountCreatedApplications extends JSONRequest { } /** - * Specify an applicationID to search for + * Specify an applicationID to search for. * * #### Example * ```typescript @@ -107,6 +132,7 @@ export default class LookupAccountCreatedApplications extends JSONRequest { * .do(); * ``` * @param index - the applicationID + * @category query */ applicationID(index: number) { this.query['application-id'] = index; diff --git a/src/client/v2/indexer/lookupAccountCreatedAssets.ts b/src/client/v2/indexer/lookupAccountCreatedAssets.ts index a27e3c778..f64a4e1e8 100644 --- a/src/client/v2/indexer/lookupAccountCreatedAssets.ts +++ b/src/client/v2/indexer/lookupAccountCreatedAssets.ts @@ -3,6 +3,19 @@ import HTTPClient from '../../client'; import IntDecoding from '../../../types/intDecoding'; export default class LookupAccountCreatedAssets extends JSONRequest { + /** + * Returns asset information created by the given account. + * + * #### Example + * ```typescript + * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; + * const accountCreatedAssets = await indexerClient.lookupAccountCreatedAssets(address).do(); + * ``` + * + * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-idcreated-assets) + * @param account - The address of the account to look up. + * @category GET + */ constructor( c: HTTPClient, intDecoding: IntDecoding, @@ -12,6 +25,9 @@ export default class LookupAccountCreatedAssets extends JSONRequest { this.account = account; } + /** + * @returns `/v2/accounts/${account}/created-assets` + */ path() { return `/v2/accounts/${this.account}/created-assets`; } @@ -30,6 +46,7 @@ export default class LookupAccountCreatedAssets extends JSONRequest { * ``` * * @param limit - maximum number of results to return. + * @category query */ limit(limit: number) { this.query.limit = limit; @@ -49,6 +66,7 @@ export default class LookupAccountCreatedAssets extends JSONRequest { * .do(); * ``` * @param round + * @category query */ round(round: number) { this.query.round = round; @@ -62,14 +80,21 @@ export default class LookupAccountCreatedAssets extends JSONRequest { * ```typescript * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; * const maxResults = 20; - * const nextToken = "APA6C7C3NCANRPIBUWQOF7WSKLJMK6RPQUVFLLDV4U5WCQE4DEF26D4E3E"; - * const accountAssets = await indexerClient + * + * const accountAssetsPage1 = await indexerClient + * .lookupAccountCreatedAssets(address) + * .limit(maxResults) + * .do(); + * ``` + * + * const accountAssetsPage2 = await indexerClient * .lookupAccountCreatedAssets(address) * .limit(maxResults) - * .next(nextToken) + * .next(accountAssetsPage1["next-token"]) * .do(); * ``` * @param nextToken - provided by the previous results. + * @category query */ nextToken(nextToken: string) { this.query.next = nextToken; @@ -88,6 +113,7 @@ export default class LookupAccountCreatedAssets extends JSONRequest { * .do(); * ``` * @param value + * @category query */ includeAll(value = true) { this.query['include-all'] = value; @@ -107,6 +133,7 @@ export default class LookupAccountCreatedAssets extends JSONRequest { * .do(); * ``` * @param index - the assetID + * @category query */ assetID(index: number) { this.query['asset-id'] = index; diff --git a/src/client/v2/indexer/lookupAccountTransactions.ts b/src/client/v2/indexer/lookupAccountTransactions.ts index 56c36b55e..69f41cd9b 100644 --- a/src/client/v2/indexer/lookupAccountTransactions.ts +++ b/src/client/v2/indexer/lookupAccountTransactions.ts @@ -37,14 +37,14 @@ export default class LookupAccountTransactions extends JSONRequest { } /** - * @returns /v2/accounts/`${account}`/transactions + * @returns `/v2/accounts/${account}/transactions` */ path() { return `/v2/accounts/${this.account}/transactions`; } /** - * Specifies a prefix which must be contained in the note field + * Specifies a prefix which must be contained in the note field. * * #### Example * ```typescript @@ -65,7 +65,7 @@ export default class LookupAccountTransactions extends JSONRequest { } /** - * Type of transaction to filter with + * Type of transaction to filter with. * * #### Example * ```typescript @@ -76,7 +76,7 @@ export default class LookupAccountTransactions extends JSONRequest { * .do(); * ``` * - * @param type - one of “pay”, “keyreg”, “acfg”, “axfer”, “afrz”, "appl" + * @param type - one of `pay`, `keyreg`, `acfg`, `axfer`, `afrz`, `appl` * @category query */ txType(type: string) { @@ -85,7 +85,7 @@ export default class LookupAccountTransactions extends JSONRequest { } /** - * Type of signature to filter with + * Type of signature to filter with. * - sig: Standard * - msig: MultiSig * - lsig: LogicSig @@ -99,7 +99,7 @@ export default class LookupAccountTransactions extends JSONRequest { * .do(); * ``` * - * @param type - one of “sig”, “msig”, “lsig” + * @param type - one of `sig`, `msig`, `lsig` * @category query */ sigType(type: string) { @@ -108,7 +108,7 @@ export default class LookupAccountTransactions extends JSONRequest { } /** - * Lookup the specific transaction by ID + * Lookup the specific transaction by ID. * * #### Example * ```typescript @@ -119,7 +119,7 @@ export default class LookupAccountTransactions extends JSONRequest { * .txid(txId) * .do(); * ``` - * + * @remarks Alternatively, use `indexerClient.lookupTransactionByID(txnId).do()` * @param txid * @category query */ @@ -129,7 +129,7 @@ export default class LookupAccountTransactions extends JSONRequest { } /** - * Include results for the specified round + * Include results for the specified round. * * #### Example * ```typescript @@ -150,7 +150,7 @@ export default class LookupAccountTransactions extends JSONRequest { } /** - * Include results at or after the specified min-round + * Include results at or after the specified min-round. * * #### Example * ```typescript @@ -171,7 +171,7 @@ export default class LookupAccountTransactions extends JSONRequest { } /** - * Include results at or before the specified max-round + * Include results at or before the specified max-round. * * #### Example * ```typescript @@ -192,7 +192,7 @@ export default class LookupAccountTransactions extends JSONRequest { } /** - * Asset ID to filter with + * Asset ID to filter with. * * #### Example * ```typescript @@ -213,15 +213,15 @@ export default class LookupAccountTransactions extends JSONRequest { } /** - * Maximum number of results to return + * Maximum number of results to return. * * #### Example * ```typescript - * const limit = 25; + * const maxResults = 25; * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; * const accountTxns = await indexerClient * .lookupAccountTransactions(address) - * .limit(limit) + * .limit(maxResults) * .do(); * ``` * @@ -234,7 +234,7 @@ export default class LookupAccountTransactions extends JSONRequest { } /** - * Include results before the given time + * Include results before the given time. * * #### Example * ```typescript @@ -255,7 +255,7 @@ export default class LookupAccountTransactions extends JSONRequest { } /** - * Include results after the given time + * Include results after the given time. * * #### Example * ```typescript @@ -311,7 +311,7 @@ export default class LookupAccountTransactions extends JSONRequest { } /** - * Filtered results should have an amount less than this value, as int, representing microAlgos, unless an asset-id is provided, in which case units are in the asset's units + * Filtered results should have an amount less than this value, as int, representing microAlgos, unless an asset-id is provided, in which case units are in the asset's units. * * #### Example 1 * ```typescript @@ -348,17 +348,22 @@ export default class LookupAccountTransactions extends JSONRequest { * * #### Example * ```typescript - * const limit = 25; - * const nextToken = "the next token returned in the previous query response"; + * const maxResults = 25; * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; - * const accountTxns = await indexerClient + * + * const accountTxnsPage1 = await indexerClient + * .lookupAccountTransactions(address) + * .limit(maxResults) + * .do(); + * + * const accountTxnsPage2 = await indexerClient * .lookupAccountTransactions(address) - * .limit(limit) - * .nextToken(nextToken) + * .limit(maxResults) + * .nextToken(accountTxnsPage1["next-token"]) * .do(); * ``` * - * @param nextToken + * @param nextToken - provided by the previous results. * @category query */ nextToken(nextToken: string) { @@ -367,7 +372,7 @@ export default class LookupAccountTransactions extends JSONRequest { } /** - * Include results which include the rekey-to field + * Whether or not to include rekeying transactions. * * #### Example * ```typescript diff --git a/src/client/v2/indexer/lookupApplicationLogs.ts b/src/client/v2/indexer/lookupApplicationLogs.ts index 3d11f8c26..2b945ba7a 100644 --- a/src/client/v2/indexer/lookupApplicationLogs.ts +++ b/src/client/v2/indexer/lookupApplicationLogs.ts @@ -3,46 +3,152 @@ import HTTPClient from '../../client'; import IntDecoding from '../../../types/intDecoding'; export default class LookupApplicationLogs extends JSONRequest { + /** + * Returns log messages generated by the passed in application. + * + * #### Example + * ```typescript + * const appId = 60553466; + * const appLogs = await indexerClient.lookupApplicationLogs(appId).do(); + * ``` + * + * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2applicationsapplication-idlogs) + * @param appID - The ID of the application which generated the logs. + * @category GET + */ constructor(c: HTTPClient, intDecoding: IntDecoding, private appID: number) { super(c, intDecoding); this.appID = appID; } + /** + * @returns `/v2/applications/${appID}/logs` + */ path() { return `/v2/applications/${this.appID}/logs`; } - /** limit for filter, as int */ + /** + * Limit results for pagination. + * + * #### Example + * ```typescript + * const maxResults = 20; + * const appLogs = await indexerClient + * .lookupApplicationLogs(appId) + * .limit(maxResults) + * .do(); + * ``` + * + * @param limit - maximum number of results to return. + */ limit(limit: number) { this.query.limit = limit; return this; } - /** min round to filter with, as int */ + /** + * Include results at or after the specified min-round. + * + * #### Example + * ```typescript + * const minRound = 18309917; + * const appLogs = await indexerClient + * .lookupApplicationLogs(appId) + * .minRound(minRound) + * .do(); + * ``` + * + * @param round + * @category query + */ minRound(round: number) { this.query['min-round'] = round; return this; } - /** max round to filter with, as int */ + /** + * Include results at or before the specified max-round. + * + * #### Example + * ```typescript + * const maxRound = 18309917; + * const appLogs = await indexerClient + * .lookupApplicationLogs(appId) + * .maxRound(maxRound) + * .do(); + * ``` + * + * @param round + * @category query + */ maxRound(round: number) { this.query['max-round'] = round; return this; } - /** used for pagination */ + /** + * The next page of results. + * + * #### Example + * ```typescript + * const maxResults = 25; + * + * const appLogsPage1 = await indexerClient + * .lookupApplicationLogs(appId) + * .limit(maxResults) + * .do(); + * + * const appLogsPage2 = await indexerClient + * .lookupApplicationLogs(appId) + * .limit(maxResults) + * .nextToken(appLogsPage1["next-token"]) + * .do(); + * ``` + * + * @param nextToken - provided by the previous results. + * @category query + */ nextToken(nextToken: string) { this.query.next = nextToken; return this; } - /** only include transactions with this sender address */ + /** + * Only include transactions with this sender address. + * + * #### Example + * ```typescript + * const sender = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; + * const appLogs = await indexerClient + * .lookupApplicationLogs(appId) + * .sender(sender) + * .do(); + * ``` + * + * @param senderAddress + * @category query + */ sender(senderAddress: string) { this.query['sender-address'] = senderAddress; return this; } - /** txid to filter with, as string */ + /** + * Lookup the specific transaction by ID. + * + * #### Example + * ```typescript + * const txId = "MEUOC4RQJB23CQZRFRKYEI6WBO73VTTPST5A7B3S5OKBUY6LFUDA"; + * const appLogs = await indexerClient + * .lookupApplicationLogs(appId) + * .txid(txId) + * .do(); + * ``` + * + * @param txid + * @category query + */ txid(txid: string) { this.query.txid = txid; return this; diff --git a/src/client/v2/indexer/lookupApplications.ts b/src/client/v2/indexer/lookupApplications.ts index b0267083e..8fb44291f 100644 --- a/src/client/v2/indexer/lookupApplications.ts +++ b/src/client/v2/indexer/lookupApplications.ts @@ -3,16 +3,55 @@ import HTTPClient from '../../client'; import IntDecoding from '../../../types/intDecoding'; export default class LookupApplications extends JSONRequest { + /** + * Returns information about the passed application. + * + * #### Example + * ```typescript + * const appId = 60553466; + * const appInfo = await indexerClient.lookupApplications(appId).do(); + * ``` + * + * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2applicationsapplication-id) + * @param index - The ID of the application to look up. + * @category GET + */ constructor(c: HTTPClient, intDecoding: IntDecoding, private index: number) { super(c, intDecoding); this.index = index; } + /** + * @returns `/v2/applications/${index}` + */ path() { return `/v2/applications/${this.index}`; } - // include all items including closed accounts, deleted applications, destroyed assets, opted-out asset holdings, and closed-out application localstates + /** + * Includes all items including closed accounts, deleted applications, destroyed assets, opted-out asset holdings, and closed-out application localstates + * + * #### Example 1 + * ```typescript + * const appId = 60553466; + * const appInfo = await indexerClient + * .lookupApplications(appId) + * .includeAll(false) + * .do(); + * ``` + * + * #### Example 2 + * ```typescript + * const appId = 60553466; + * const appInfo = await indexerClient + * .lookupApplications(appId) + * .includeAll() + * .do(); + * ``` + * + * @param value - default true when called without passing a value + * @category query + */ includeAll(value = true) { this.query['include-all'] = value; return this; diff --git a/src/client/v2/indexer/lookupAssetBalances.ts b/src/client/v2/indexer/lookupAssetBalances.ts index 04ab81345..d11795bcb 100644 --- a/src/client/v2/indexer/lookupAssetBalances.ts +++ b/src/client/v2/indexer/lookupAssetBalances.ts @@ -20,12 +20,15 @@ export default class LookupAssetBalances extends JSONRequest { this.index = index; } + /** + * @returns `/v2/assets/${index}/balances` + */ path() { return `/v2/assets/${this.index}/balances`; } /** - * Add a limit for filter. + * Limit results for pagination. * * #### Example * ```typescript @@ -38,6 +41,7 @@ export default class LookupAssetBalances extends JSONRequest { * ``` * * @param limit - maximum number of results to return. + * @category query */ limit(limit: number) { this.query.limit = limit; @@ -57,6 +61,7 @@ export default class LookupAssetBalances extends JSONRequest { * .do(); * ``` * @param greater + * @category query */ currencyGreaterThan(greater: number) { this.query['currency-greater-than'] = greater; @@ -76,6 +81,7 @@ export default class LookupAssetBalances extends JSONRequest { * .do(); * ``` * @param lesser + * @category query */ currencyLessThan(lesser: number) { this.query['currency-less-than'] = lesser; @@ -89,14 +95,20 @@ export default class LookupAssetBalances extends JSONRequest { * ```typescript * const assetId = 163650; * const maxResults = 20; - * const nextToken = "APA6C7C3NCANRPIBUWQOF7WSKLJMK6RPQUVFLLDV4U5WCQE4DEF26D4E3E"; - * const assetBalances = await indexerClient + * + * const assetBalancesPage1 = await indexerClient * .lookupAssetBalances(assetId) * .limit(maxResults) - * .next(nextToken) + * .do(); + * + * const assetBalancesPage2 = await indexerClient + * .lookupAssetBalances(assetId) + * .limit(maxResults) + * .nextToken(assetBalancesPage1["next-token"]) * .do(); * ``` * @param nextToken - provided by the previous results. + * @category query */ nextToken(nextToken: string) { this.query.next = nextToken; @@ -104,9 +116,9 @@ export default class LookupAssetBalances extends JSONRequest { } /** - * Include all items including closed accounts, deleted applications, destroyed assets, opted-out asset holdings, and closed-out application localstates + * Include all items including closed accounts, deleted applications, destroyed assets, opted-out asset holdings, and closed-out application localstates. * - * #### Example + * #### Example 1 * ```typescript * const assetId = 163650; * const assetBalances = await indexerClient @@ -114,7 +126,18 @@ export default class LookupAssetBalances extends JSONRequest { * .includeAll(false) * .do(); * ``` + * + * #### Example 2 + * ```typescript + * const assetId = 163650; + * const assetBalances = await indexerClient + * .lookupAssetBalances(assetId) + * .includeAll() + * .do(); + * ``` + * * @param value + * @category query */ includeAll(value = true) { this.query['include-all'] = value; diff --git a/src/client/v2/indexer/lookupAssetByID.ts b/src/client/v2/indexer/lookupAssetByID.ts index 01f9fe866..76331fb2c 100644 --- a/src/client/v2/indexer/lookupAssetByID.ts +++ b/src/client/v2/indexer/lookupAssetByID.ts @@ -32,6 +32,7 @@ export default class LookupAssetByID extends JSONRequest { * * #### Example 1 * ```typescript + * const assetId = 163650; * const assetInfo = await indexerClient * .lookupAssetByID(assetId) * .includeAll(false) @@ -40,6 +41,7 @@ export default class LookupAssetByID extends JSONRequest { * * #### Example 2 * ```typescript + * const assetId = 163650; * const assetInfo = await indexerClient * .lookupAssetByID(assetId) * .includeAll() diff --git a/src/client/v2/indexer/lookupAssetTransactions.ts b/src/client/v2/indexer/lookupAssetTransactions.ts index 92ca064c1..45f1589aa 100644 --- a/src/client/v2/indexer/lookupAssetTransactions.ts +++ b/src/client/v2/indexer/lookupAssetTransactions.ts @@ -4,121 +4,401 @@ import IntDecoding from '../../../types/intDecoding'; import { base64StringFunnel } from './lookupAccountTransactions'; export default class LookupAssetTransactions extends JSONRequest { + /** + * Returns transactions relating to the given asset. + * + * #### Example + * ```typescript + * const assetId = 163650; + * const assetTxns = await indexerClient.lookupAssetTransactions(assetId).do(); + * ``` + * + * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2assetsasset-idtransactions) + * @param index - The asset ID to look up. + */ constructor(c: HTTPClient, intDecoding: IntDecoding, private index: number) { super(c, intDecoding); this.index = index; } + /** + * @returns `/v2/assets/${index}/transactions` + */ path() { return `/v2/assets/${this.index}/transactions`; } /** - * notePrefix to filter with + * Specifies a prefix which must be contained in the note field. + * + * #### Example + * ```typescript + * const notePrefixBase64Encoded = "Y3JlYXRl"; + * const assetId = 163650; + * const assetTxns = await indexerClient + * .lookupAssetTransactions(assetId) + * .notePrefix(notePrefixBase64Encoded) + * .do(); + * ``` + * * @param prefix - base64 string or uint8array + * @category query */ notePrefix(prefix: Uint8Array | string) { this.query['note-prefix'] = base64StringFunnel(prefix); return this; } - // txtype to filter with, as string + /** + * Type of transaction to filter with. + * + * #### Example + * ```typescript + * const assetId = 163650; + * const assetTxns = await indexerClient + * .lookupAssetTransactions(assetId) + * .txType("axfer") + * .do(); + * ``` + * + * @param type - one of `pay`, `keyreg`, `acfg`, `axfer`, `afrz`, `appl` + * @category query + */ txType(type: string) { this.query['tx-type'] = type; return this; } - // sigtype to filter with, as string + /** + * Type of signature to filter with. + * - sig: Standard + * - msig: MultiSig + * - lsig: LogicSig + * + * #### Example + * ```typescript + * const assetId = 163650; + * const assetTxns = await indexerClient + * .lookupAssetTransactions(assetId) + * .sigType("lsig") + * .do(); + * ``` + * + * @param type - one of `sig`, `msig`, `lsig` + * @category query + */ sigType(type: string) { this.query['sig-type'] = type; return this; } - // txid to filter with, as string + /** + * Lookup the specific transaction by ID. + * + * #### Example + * ```typescript + * const txId = "MEUOC4RQJB23CQZRFRKYEI6WBO73VTTPST5A7B3S5OKBUY6LFUDA"; + * const assetId = 163650; + * const assetTxns = await indexerClient + * .lookupAssetTransactions(assetId) + * .txid(txId) + * .do(); + * ``` + * + * @param txid + * @category query + */ txid(txid: string) { this.query.txid = txid; return this; } - // round to filter with, as int + /** + * Include results for the specified round. + * + * #### Example + * ```typescript + * const targetBlock = 18309917; + * const assetId = 163650; + * const assetTxns = await indexerClient + * .lookupAssetTransactions(assetId) + * .round(targetBlock) + * .do(); + * ``` + * + * @param round + * @category query + */ round(round: number) { this.query.round = round; return this; } - // min round to filter with, as int + /** + * Include results at or after the specified min-round. + * + * #### Example + * ```typescript + * const minRound = 18309917; + * const assetId = 163650; + * const assetTxns = await indexerClient + * .lookupAssetTransactions(assetId) + * .minRound(minRound) + * .do(); + * ``` + * + * @param round + * @category query + */ minRound(round: number) { this.query['min-round'] = round; return this; } - // max round to filter with, as int + /** + * Include results at or before the specified max-round. + * + * #### Example + * ```typescript + * const maxRound = 18309917; + * const assetId = 163650; + * const assetTxns = await indexerClient + * .lookupAssetTransactions(assetId) + * .maxRound(maxRound) + * .do(); + * ``` + * + * @param round + * @category query + */ maxRound(round: number) { this.query['max-round'] = round; return this; } - // asset ID to filter with, as int + /** + * @deprecated Redundant query parameter. Asset ID is already passed into the method. + */ assetID(id: number) { this.query['asset-id'] = id; return this; } - // limit for filter, as int + /** + * Maximum number of results to return. + * + * #### Example + * ```typescript + * const maxResults = 25; + * const assetId = 163650; + * const assetTxns = await indexerClient + * .lookupAssetTransactions(assetId) + * .limit(maxResults) + * .do(); + * ``` + * + * @param limit + * @category query + */ limit(limit: number) { this.query.limit = limit; return this; } - // before-time to filter with, as rfc3339 string + /** + * Include results before the given time. + * + * #### Example + * ```typescript + * const beforeTime = "2022-02-02T20:20:22.02Z"; + * const assetId = 163650; + * const assetTxns = await indexerClient + * .lookupAssetTransactions(assetId) + * .beforeTime(beforeTime) + * .do(); + * ``` + * + * @param before - rfc3339 string + * @category query + */ beforeTime(before: string) { this.query['before-time'] = before; return this; } - // after-time to filter with, as rfc3339 string + /** + * Include results after the given time. + * + * #### Example + * ```typescript + * const afterTime = "2022-10-21T00:00:11.55Z"; + * const assetId = 163650; + * const assetTxns = await indexerClient + * .lookupAssetTransactions(assetId) + * .afterTime(afterTime) + * .do(); + * ``` + * + * @param after - rfc3339 string + * @category query + */ afterTime(after: string) { this.query['after-time'] = after; return this; } - // filtered results should have an amount greater than this value, as int, representing asset units + /** + * Filtered results should have an amount greater than this value, as int, representing asset units. + * + * #### Example + * ```typescript + * const minBalance = 300000; + * const assetId = 163650; + * const assetTxns = await indexerClient + * .lookupAssetTransactions(assetId) + * .currencyGreaterThan(minBalance - 1) + * .do(); + * ``` + * + * @remarks + * If you are looking for transactions with the currency amount greater than 0, simply construct the query without `currencyGreaterThan` because it doesn't accept `-1`, and passing the `0` `currency-greater-than` value would exclude transactions with a 0 amount. + * + * @param greater + * @category query + */ currencyGreaterThan(greater: number) { this.query['currency-greater-than'] = greater; return this; } - // filtered results should have an amount less than this value, as int, representing asset units + /** + * Filtered results should have an amount less than this value, as int, representing asset units. + * + * #### Example + * ```typescript + * const maxBalance = 500000; + * const assetId = 163650; + * const assetTxns = await indexerClient + * .lookupAssetTransactions(assetId) + * .currencyLessThan(maxBalance + 1) + * .do(); + * ``` + * + * @param lesser + * @category query + */ currencyLessThan(lesser: number) { this.query['currency-less-than'] = lesser; return this; } - // combined with address, defines what address to filter on, as string + /** + * Combined with address, defines what address to filter on, as string. + * + * #### Example + * ```typescript + * const assetId = 163650; + * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; + * const role = "sender"; + * const assetTxns = await indexerClient + * .lookupAssetTransactions(assetId) + * .address(address) + * .addressRole(role) + * .do(); + * ``` + * + * @param role - one of `sender`, `receiver`, `freeze-target` + * @category query + */ addressRole(role: string) { this.query['address-role'] = role; return this; } - // address to filter on as string + /** + * Only include transactions with this address in one of the transaction fields. + * + * #### Example + * ```typescript + * const assetId = 163650; + * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; + * const assetTxns = await indexerClient + * .lookupAssetTransactions(assetId) + * .address(address) + * .do(); + * ``` + * + * @param address + * @category query + */ address(address: string) { this.query.address = address; return this; } - // whether or not to consider the close-to field as a receiver when filtering transactions, as bool. set to true to ignore close-to + /** + * Whether or not to consider the `close-to` field as a receiver when filtering transactions, as bool. Set to `true` to ignore `close-to`. + * + * #### Example + * ```typescript + * const assetId = 163650; + * const assetTxns = await indexerClient + * .lookupAssetTransactions(assetId) + * .excludeCloseTo(true) + * .do(); + * ``` + * + * @param exclude + * @category query + */ excludeCloseTo(exclude: boolean) { this.query['exclude-close-to'] = exclude; return this; } - // used for pagination + /** + * The next page of results. + * + * #### Example + * ```typescript + * const maxResults = 25; + * const assetId = 163650; + * + * const assetTxnsPage1 = await indexerClient + * .lookupAssetTransactions(assetId) + * .limit(maxResults) + * .do(); + * + * const assetTxnsPage2 = await indexerClient + * .lookupAssetTransactions(assetId) + * .limit(maxResults) + * .nextToken(assetTxnsPage1["next-token"]) + * .do(); + * ``` + * + * @param nextToken - provided by the previous results. + * @category query + */ nextToken(nextToken: string) { this.query.next = nextToken; return this; } - // whether or not to include rekeying transactions + /** + * Whether or not to include rekeying transactions. + * + * #### Example + * ```typescript + * const assetId = 163650; + * const assetTxns = await indexerClient + * .lookupAssetTransactions(assetId) + * .rekeyTo(false) + * .do(); + * ``` + * + * @param rekeyTo + * @category query + */ rekeyTo(rekeyTo: boolean) { this.query['rekey-to'] = rekeyTo; return this; diff --git a/src/client/v2/indexer/lookupBlock.ts b/src/client/v2/indexer/lookupBlock.ts index 9261b52ca..d722827cf 100644 --- a/src/client/v2/indexer/lookupBlock.ts +++ b/src/client/v2/indexer/lookupBlock.ts @@ -3,11 +3,27 @@ import HTTPClient from '../../client'; import IntDecoding from '../../../types/intDecoding'; export default class LookupBlock extends JSONRequest { + /** + * Returns the block for the passed round. + * + * #### Example + * ```typescript + * const targetBlock = 18309917; + * const blockInfo = await indexerClient.lookupBlock(targetBlock).do(); + * ``` + * + * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2blocksround-number) + * @param round - The number of the round to look up. + * @category GET + */ constructor(c: HTTPClient, intDecoding: IntDecoding, private round: number) { super(c, intDecoding); this.round = round; } + /** + * @returns `/v2/blocks/${round}` + */ path() { return `/v2/blocks/${this.round}`; } diff --git a/src/client/v2/indexer/lookupTransactionByID.ts b/src/client/v2/indexer/lookupTransactionByID.ts index 4cd98700a..d834db3ff 100644 --- a/src/client/v2/indexer/lookupTransactionByID.ts +++ b/src/client/v2/indexer/lookupTransactionByID.ts @@ -3,11 +3,27 @@ import HTTPClient from '../../client'; import IntDecoding from '../../../types/intDecoding'; export default class LookupTransactionByID extends JSONRequest { + /** + * Returns information about the given transaction. + * + * #### Example + * ```typescript + * const txnId = "MEUOC4RQJB23CQZRFRKYEI6WBO73VTTPST5A7B3S5OKBUY6LFUDA"; + * const txnInfo = await indexerClient.lookupTransactionByID(txnId).do(); + * ``` + * + * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2transactionstxid) + * @param txID - The ID of the transaction to look up. + * @category GET + */ constructor(c: HTTPClient, intDecoding: IntDecoding, private txID: string) { super(c, intDecoding); this.txID = txID; } + /** + * @returns `/v2/transactions/${txID}` + */ path() { return `/v2/transactions/${this.txID}`; } diff --git a/src/client/v2/indexer/makeHealthCheck.ts b/src/client/v2/indexer/makeHealthCheck.ts index 0b5137ccb..61059b045 100644 --- a/src/client/v2/indexer/makeHealthCheck.ts +++ b/src/client/v2/indexer/makeHealthCheck.ts @@ -1,6 +1,21 @@ import JSONRequest from '../jsonrequest'; +/** + * Returns the health object for the service. + * Returns 200 if healthy. + * + * #### Example + * ```typescript + * const health = await indexerClient.makeHealthCheck().do(); + * ``` + * + * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-health) + * @category GET + */ export default class MakeHealthCheck extends JSONRequest { + /** + * @returns `/health` + */ // eslint-disable-next-line class-methods-use-this path() { return '/health'; diff --git a/src/client/v2/indexer/searchAccounts.ts b/src/client/v2/indexer/searchAccounts.ts index 34a99c99b..31a62f02d 100644 --- a/src/client/v2/indexer/searchAccounts.ts +++ b/src/client/v2/indexer/searchAccounts.ts @@ -1,66 +1,266 @@ import JSONRequest from '../jsonrequest'; +/** + * Returns information about indexed accounts. + * + * #### Example + * ```typescript + * const accounts = await indexerClient.searchAccounts().do(); + * ``` + * + * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accounts) + * @category GET + */ export default class SearchAccounts extends JSONRequest { + /** + * @returns `/v2/accounts` + */ // eslint-disable-next-line class-methods-use-this path() { return '/v2/accounts'; } - // filtered results should have an amount greater than this value, as int, representing microAlgos, unless an asset-id is provided, in which case units are in the asset's units + /** + * Filtered results should have an amount greater than this value, as int, representing microAlgos, unless an asset-id is provided, in which case units are in the asset's units. + * + * #### Example 1 + * ```typescript + * const minBalance = 300000; + * const accounts = await indexerClient + * .searchAccounts() + * .currencyGreaterThan(minBalance - 1) + * .do(); + * ``` + * + * #### Example 2 + * ```typescript + * const assetID = 163650; + * const minBalance = 300000; + * const accounts = await indexerClient + * .searchAccounts() + * .assetID(assetID) + * .currencyGreaterThan(minBalance - 1) + * .do(); + * ``` + * @remarks + * If you are looking for accounts with the currency amount greater than 0, simply construct the query without `currencyGreaterThan` because it doesn't accept `-1`, and passing the `0` `currency-greater-than` value would exclude transactions with a 0 amount. + * + * @param greater + * @category query + */ currencyGreaterThan(greater: number) { this.query['currency-greater-than'] = greater; return this; } - // filtered results should have an amount less than this value, as int, representing microAlgos, unless an asset-id is provided, in which case units are in the asset's units + /** + * Filtered results should have an amount less than this value, as int, representing microAlgos, unless an asset-id is provided, in which case units are in the asset's units. + * + * #### Example 1 + * ```typescript + * const maxBalance = 500000; + * const accounts = await indexerClient + * .searchAccounts() + * .currencyLessThan(maxBalance + 1) + * .do(); + * ``` + * + * #### Example 2 + * ```typescript + * const assetID = 163650; + * const maxBalance = 500000; + * const accounts = await indexerClient + * .searchAccounts() + * .assetID(assetID) + * .currencyLessThan(maxBalance + 1) + * .do(); + * ``` + * + * @param lesser + * @category query + */ currencyLessThan(lesser: number) { this.query['currency-less-than'] = lesser; return this; } - // limit for filter, as int + /** + * Maximum number of results to return. + * + * #### Example + * ```typescript + * const maxResults = 25; + * const accounts = await indexerClient + * .searchAccounts() + * .limit(maxResults) + * .do(); + * ``` + * + * @param limit + * @category query + */ limit(limit: number) { this.query.limit = limit; return this; } - // asset ID to filter with, as int + /** + * Asset ID to filter with. + * + * #### Example + * ```typescript + * const assetID = 163650; + * const accounts = await indexerClient + * .searchAccounts() + * .assetID(assetID) + * .do(); + * ``` + * + * @param id + * @category query + */ assetID(id: number) { this.query['asset-id'] = id; return this; } - // used for pagination + /** + * The next page of results. + * + * #### Example + * ```typescript + * const maxResults = 25; + * + * const accountsPage1 = await indexerClient + * .searchAccounts() + * .limit(maxResults) + * .do(); + * + * const accountsPage2 = await indexerClient + * .searchAccounts() + * .limit(maxResults) + * .nextToken(accountsPage1["next-token"]) + * .do(); + * ``` + * + * @param nextToken - provided by the previous results + * @category query + */ nextToken(nextToken: string) { this.query.next = nextToken; return this; } - // specific round to search + /** + * Include results for the specified round. + * + * #### Example + * ```typescript + * const targetBlock = 18309917; + * const accounts = await indexerClient + * .searchAccounts() + * .round(targetBlock) + * .do(); + * ``` + * @remarks For performance reasons, this parameter may be disabled on some configurations. + * @param round + * @category query + */ round(round: number) { this.query.round = round; return this; } - // include accounts that use this spending key + /** + * Include accounts that use this spending key. + * + * #### Example + * ```typescript + * const authAddr = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; + * const accounts = await indexerClient + * .searchAccounts() + * .authAddr(authAddr) + * .do(); + * ``` + * + * @param authAddr + */ authAddr(authAddr: string) { this.query['auth-addr'] = authAddr; return this; } - // filter for this application + /** + * Filter for this application. + * + * #### Example + * ```typescript + * const appId = 60553466; + * const accounts = await indexerClient + * .searchAccounts() + * .applicationID(appId) + * .do(); + * ``` + * + * @param applicationID + * @category query + */ applicationID(applicationID: number) { this.query['application-id'] = applicationID; return this; } - // include all items including closed accounts, deleted applications, destroyed assets, opted-out asset holdings, and closed-out application localstates + /** + * Includes all items including closed accounts, deleted applications, destroyed assets, opted-out asset holdings, and closed-out application localstates + * + * #### Example 1 + * ```typescript + * const assetId = 163650; + * const accounts = await indexerClient + * .searchAccounts() + * .includeAll(false) + * .do(); + * ``` + * + * #### Example 2 + * ```typescript + * const assetId = 163650; + * const accounts = await indexerClient + * .searchAccounts() + * .includeAll() + * .do(); + * ``` + * + * @param value - default true when called without passing a value + * @category query + */ includeAll(value = true) { this.query['include-all'] = value; return this; } - // exclude + /** + * Exclude additional items such as asset holdings, application local data stored for this account, asset parameters created by this account, and application parameters created by this account. + * + * #### Example 1 + * ```typescript + * const accounts = await indexerClient + * .searchAccounts() + * .exclude("all") + * .do(); + * ``` + * + * #### Example 2 + * ```typescript + * const accounts = await indexerClient + * .searchAccounts() + * .exclude("assets,created-assets") + * .do(); + * ``` + * @remarks By default, it behaves as exclude=none + * @param exclude - Array of `all`, `assets`, `created-assets`, `apps-local-state`, `created-apps`, `none` + * @category query + */ exclude(exclude: string) { this.query.exclude = exclude; return this; diff --git a/src/client/v2/indexer/searchForApplications.ts b/src/client/v2/indexer/searchForApplications.ts index ec6f272ea..abf122fef 100644 --- a/src/client/v2/indexer/searchForApplications.ts +++ b/src/client/v2/indexer/searchForApplications.ts @@ -1,36 +1,132 @@ import JSONRequest from '../jsonrequest'; +/** + * Returns information about indexed applications. + * + * #### Example + * ```typescript + * const apps = await indexerClient.searchForApplications().do(); + * ``` + * + * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2applications) + * @category GET + */ export default class SearchForApplications extends JSONRequest { + /** + * @returns `/v2/applications` + */ // eslint-disable-next-line class-methods-use-this path() { return '/v2/applications'; } - // application ID for filter, as int + /** + * Application ID for filter, as int + * + * #### Example + * ```typescript + * const appId = 60553466; + * const apps = await indexerClient + * .searchForApplications() + * .index(appId) + * .do(); + * ``` + * @remarks Alternatively, use `indexerClient.lookupApplications(appId).do()` + * @param index + * @category query + */ index(index: number) { this.query['application-id'] = index; return this; } - // creator for filter, as string + /** + * Creator for filter, as string + * + * #### Example + * ```typescript + * const creator = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; + * const apps = await indexerClient + * .searchForApplications() + * .creator(creator) + * .do(); + * ``` + * @param creator + * @category query + */ creator(creator: string) { this.query.creator = creator; return this; } - // token for pagination + /** + * Specify the next page of results. + * + * #### Example + * ```typescript + * const maxResults = 20; + * + * const appsPage1 = await indexerClient + * .searchForApplications() + * .limit(maxResults) + * .do(); + * + * const appsPage2 = await indexerClient + * .searchForApplications() + * .limit(maxResults) + * .nextToken(appsPage1["next-token"]) + * .do(); + * ``` + * @param nextToken - provided by the previous results. + * @category query + */ nextToken(next: string) { this.query.next = next; return this; } - // limit results for pagination + /** + * Limit results for pagination. + * + * #### Example + * ```typescript + * const maxResults = 20; + * const apps = await indexerClient + * .searchForApplications() + * .limit(maxResults) + * .do(); + * ``` + * + * @param limit - maximum number of results to return. + * @category query + */ limit(limit: number) { this.query.limit = limit; return this; } - // include all items including closed accounts, deleted applications, destroyed assets, opted-out asset holdings, and closed-out application localstates + /** + * Includes all items including closed accounts, deleted applications, destroyed assets, opted-out asset holdings, and closed-out application localstates + * + * #### Example 1 + * ```typescript + * const apps = await indexerClient + * .searchForApplications() + * .includeAll(false) + * .do(); + * ``` + * + * #### Example 2 + * ```typescript + * const apps = await indexerClient + * .searchForApplications() + * .includeAll() + * .do(); + * ``` + * + * @param value - default true when called without passing a value + * @category query + */ includeAll(value = true) { this.query['include-all'] = value; return this; diff --git a/src/client/v2/indexer/searchForAssets.ts b/src/client/v2/indexer/searchForAssets.ts index 9f49bbda9..79fa8c66d 100644 --- a/src/client/v2/indexer/searchForAssets.ts +++ b/src/client/v2/indexer/searchForAssets.ts @@ -1,48 +1,173 @@ import JSONRequest from '../jsonrequest'; +/** + * Returns information about indexed assets. + * + * #### Example + * ```typescript + * const assets = await indexerClient.searchForAssets().do(); + * ``` + * + * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2assets) + * @category GET + */ export default class SearchForAssets extends JSONRequest { + /** + * @returns `/v2/assets` + */ // eslint-disable-next-line class-methods-use-this path() { return '/v2/assets'; } - // limit for filter, as int + /** + * Limit results for pagination. + * + * #### Example + * ```typescript + * const maxResults = 20; + * const assets = await indexerClient + * .searchForAssets() + * .limit(maxResults) + * .do(); + * ``` + * + * @param limit - maximum number of results to return. + * @category query + */ limit(limit: number) { this.query.limit = limit; return this; } - // asset creator address for filter, as string + /** + * Filter just assets with the given creator address. + * + * #### Example + * ```typescript + * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; + * const assets = await indexerClient + * .searchForAssets() + * .creator(address) + * .do(); + * ``` + * + * @param creator + * @category query + */ creator(creator: string) { this.query.creator = creator; return this; } - // asset name for filter, as string + /** + * Filter just assets with the given name. + * + * #### Example + * ```typescript + * const name = "Test Token"; + * const assets = await indexerClient + * .searchForAssets() + * .name(name) + * .do(); + * ``` + * + * @param name + * @category query + */ name(name: string) { this.query.name = name; return this; } - // asset unit name for filter, as string + /** + * Filter just assets with the given unit. + * + * #### Example + * ```typescript + * const unit = "test"; + * const assets = await indexerClient + * .searchForAssets() + * .unit(unit) + * .do(); + * ``` + * + * @param unit + * @category query + */ unit(unit: string) { this.query.unit = unit; return this; } - // asset ID for filter, as int + /** + * Asset ID for filter, as int. + * + * #### Example + * ```typescript + * const assetId = 163650; + * const assets = await indexerClient + * .searchForAssets() + * .index(assetId) + * .do(); + * ``` + * @remarks Alternatively, use `indexerClient.lookupAssetByID(assetId).do();` + * @param index + * @category query + */ index(index: number) { this.query['asset-id'] = index; return this; } - // used for pagination + /** + * Specify the next page of results. + * + * #### Example + * ```typescript + * const maxResults = 20; + * + * const assetsPage1 = await indexerClient + * .searchForAssets() + * .limit(maxResults) + * .do(); + * + * const assetsPage2 = await indexerClient + * .searchForAssets() + * .limit(maxResults) + * .nextToken(assetsPage1["next-token"]) + * .do(); + * ``` + * @param nextToken - provided by the previous results. + * @category query + */ nextToken(nextToken: string) { this.query.next = nextToken; return this; } - // include all items including closed accounts, deleted applications, destroyed assets, opted-out asset holdings, and closed-out application localstates + /** + * Includes all items including closed accounts, deleted applications, destroyed assets, opted-out asset holdings, and closed-out application localstates + * + * #### Example 1 + * ```typescript + * const assets = await indexerClient + * .searchForAssets() + * .includeAll(false) + * .do(); + * ``` + * + * #### Example 2 + * ```typescript + * const assets = await indexerClient + * .searchForAssets() + * .includeAll() + * .do(); + * ``` + * + * @param value - default true when called without passing a value + * @category query + */ includeAll(value = true) { this.query['include-all'] = value; return this; diff --git a/src/client/v2/indexer/searchForTransactions.ts b/src/client/v2/indexer/searchForTransactions.ts index 8ee5e55aa..5afa84c29 100644 --- a/src/client/v2/indexer/searchForTransactions.ts +++ b/src/client/v2/indexer/searchForTransactions.ts @@ -1,124 +1,433 @@ import JSONRequest from '../jsonrequest'; import { base64StringFunnel } from './lookupAccountTransactions'; +/** + * Returns information about indexed transactions. + * + * #### Example + * ```typescript + * const txns = await indexerClient.searchForTransactions().do(); + * ``` + * + * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2transactions) + * @category GET + */ export default class SearchForTransactions extends JSONRequest { + /** + * @returns `/v2/transactions` + */ // eslint-disable-next-line class-methods-use-this path() { return '/v2/transactions'; } /** - * notePrefix to filter with + * Specifies a prefix which must be contained in the note field. + * + * #### Example + * ```typescript + * const notePrefixBase64Encoded = "Y3JlYXRl"; + * const txns = await indexerClient + * .searchForTransactions() + * .notePrefix(notePrefixBase64Encoded) + * .do(); + * ``` + * * @param prefix - base64 string or uint8array + * @category query */ notePrefix(prefix: Uint8Array | string) { this.query['note-prefix'] = base64StringFunnel(prefix); return this; } - // txtype to filter with, as string + /** + * Type of transaction to filter with. + * + * #### Example + * ```typescript + * const txns = await indexerClient + * .searchForTransactions() + * .txType("keyreg") + * .do(); + * ``` + * + * @param type - one of `pay`, `keyreg`, `acfg`, `axfer`, `afrz`, `appl` + * @category query + */ txType(type: string) { this.query['tx-type'] = type; return this; } - // sigtype to filter with, as string + /** + * Type of signature to filter with. + * - sig: Standard + * - msig: MultiSig + * - lsig: LogicSig + * + * #### Example + * ```typescript + * const txns = await indexerClient + * .searchForTransactions() + * .sigType("sig") + * .do(); + * ``` + * + * @param type - one of `sig`, `msig`, `lsig` + * @category query + */ sigType(type: string) { this.query['sig-type'] = type; return this; } - // txid to filter with, as string + /** + * Lookup the specific transaction by ID. + * + * #### Example + * ```typescript + * const txId = "MEUOC4RQJB23CQZRFRKYEI6WBO73VTTPST5A7B3S5OKBUY6LFUDA"; + * const txns = await indexerClient + * .searchForTransactions() + * .txid(txId) + * .do(); + * ``` + * @remarks Alternatively, use `indexerClient.lookupTransactionByID(txnId).do()` + * @param txid + * @category query + */ txid(txid: string) { this.query.txid = txid; return this; } - // round to filter with, as int + /** + * Include results for the specified round. + * + * #### Example + * ```typescript + * const targetBlock = 18309917; + * const txns = await indexerClient + * .searchForTransactions() + * .round(targetBlock) + * .do(); + * ``` + * @remarks Alternatively, use `indexerClient.lookupBlock(targetBlock).do()` + * @param round + * @category query + */ round(round: number) { this.query.round = round; return this; } - // min round to filter with, as int + /** + * Include results at or after the specified min-round. + * + * #### Example + * ```typescript + * const minRound = 18309917; + * const txns = await indexerClient + * .searchForTransactions() + * .minRound(minRound) + * .do(); + * ``` + * + * @param round + * @category query + */ minRound(round: number) { this.query['min-round'] = round; return this; } - // max round to filter with, as int + /** + * Include results at or before the specified max-round. + * + * #### Example + * ```typescript + * const maxRound = 18309917; + * const txns = await indexerClient + * .searchForTransactions() + * .maxRound(maxRound) + * .do(); + * ``` + * + * @param round + * @category query + */ maxRound(round: number) { this.query['max-round'] = round; return this; } - // asset ID to filter with, as int + /** + * Asset ID to filter with. + * + * #### Example + * ```typescript + * const assetID = 163650; + * const txns = await indexerClient + * .searchForTransactions() + * .assetID(assetID) + * .do(); + * ``` + * @remarks Alternatively, use `indexerClient.lookupAssetTransactions(assetId).do()` + * @param id + * @category query + */ assetID(id: number) { this.query['asset-id'] = id; return this; } - // limit for filter, as int + /** + * Maximum number of results to return. + * + * #### Example + * ```typescript + * const maxResults = 25; + * const txns = await indexerClient + * .searchForTransactions() + * .limit(maxResults) + * .do(); + * ``` + * + * @param limit + * @category query + */ limit(limit: number) { this.query.limit = limit; return this; } - // before-time to filter with, as rfc3339 string + /** + * Include results before the given time. + * + * #### Example + * ```typescript + * const beforeTime = "2022-02-02T20:20:22.02Z"; + * const txns = await indexerClient + * .searchForTransactions() + * .beforeTime(beforeTime) + * .do(); + * ``` + * + * @param before - rfc3339 string + * @category query + */ beforeTime(before: string) { this.query['before-time'] = before; return this; } - // after-time to filter with, as rfc3339 string + /** + * Include results after the given time. + * + * #### Example + * ```typescript + * const afterTime = "2022-10-21T00:00:11.55Z"; + * const txns = await indexerClient + * .searchForTransactions() + * .afterTime(afterTime) + * .do(); + * ``` + * + * @param after - rfc3339 string + * @category query + */ afterTime(after: string) { this.query['after-time'] = after; return this; } - // filtered results should have an amount greater than this value, as int, representing microAlgos, unless an asset-id is provided, in which case units are in the asset's units + /** + * Filtered results should have an amount greater than this value, as int, representing microAlgos, unless an asset-id is provided, in which case units are in the asset's units. + * + * #### Example 1 + * ```typescript + * const minBalance = 300000; + * const txns = await indexerClient + * .searchForTransactions() + * .currencyGreaterThan(minBalance - 1) + * .do(); + * ``` + * + * #### Example 2 + * ```typescript + * const assetID = 163650; + * const minBalance = 300000; + * const txns = await indexerClient + * .searchForTransactions() + * .assetID(assetID) + * .currencyGreaterThan(minBalance - 1) + * .do(); + * ``` + * @remarks + * If you are looking for transactions with the currency amount greater than 0, simply construct the query without `currencyGreaterThan` because it doesn't accept `-1`, and passing the `0` `currency-greater-than` value would exclude transactions with a 0 amount. + * + * @param greater + * @category query + */ currencyGreaterThan(greater: number) { this.query['currency-greater-than'] = greater; return this; } - // filtered results should have an amount less than this value, as int, representing microAlgos, unless an asset-id is provided, in which case units are in the asset's units + /** + * Filtered results should have an amount less than this value, as int, representing microAlgos, unless an asset-id is provided, in which case units are in the asset's units. + * + * #### Example 1 + * ```typescript + * const maxBalance = 500000; + * const txns = await indexerClient + * .searchForTransactions() + * .currencyLessThan(maxBalance + 1) + * .do(); + * ``` + * + * #### Example 2 + * ```typescript + * const assetID = 163650; + * const maxBalance = 500000; + * const txns = await indexerClient + * .searchForTransactions() + * .assetID(assetID) + * .currencyLessThan(maxBalance + 1) + * .do(); + * ``` + * + * @param lesser + * @category query + */ currencyLessThan(lesser: number) { this.query['currency-less-than'] = lesser; return this; } - // combined with address, defines what address to filter on, as string + /** + * Combined with address, defines what address to filter on, as string. + * + * #### Example + * ```typescript + * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; + * const role = "freeze-target"; + * const txns = await indexerClient + * .searchForTransactions() + * .address(address) + * .addressRole(role) + * .do(); + * ``` + * + * @param role - one of `sender`, `receiver`, `freeze-target` + * @category query + */ addressRole(role: string) { this.query['address-role'] = role; return this; } - // address to filter with, as string + /** + * Only include transactions with this address in one of the transaction fields. + * + * #### Example + * ```typescript + * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA"; + * const txns = await indexerClient + * .searchForTransactions() + * .address(address) + * .do(); + * ``` + * @remarks Alternatively, use `indexerClient.lookupAccountTransactions(address).do()` + * @param address + * @category query + */ address(address: string) { this.query.address = address; return this; } - // whether or not to consider the close-to field as a receiver when filtering transactions, as bool. set to true to ignore close-to + /** + * Whether or not to consider the `close-to` field as a receiver when filtering transactions, as bool. Set to `true` to ignore `close-to`. + * + * #### Example + * ```typescript + * const txns = await indexerClient + * .searchForTransactions() + * .excludeCloseTo(true) + * .do(); + * ``` + * + * @param exclude + * @category query + */ excludeCloseTo(exclude: boolean) { this.query['exclude-close-to'] = exclude; return this; } - // used for pagination + /** + * The next page of results. + * + * #### Example + * ```typescript + * const maxResults = 25; + * + * const txnsPage1 = await indexerClient + * .searchForTransactions() + * .limit(maxResults) + * .do(); + * + * const txnsPage2 = await indexerClient + * .searchForTransactions() + * .limit(maxResults) + * .nextToken(txnsPage1["next-token"]) + * .do(); + * ``` + * + * @param nextToken - provided by the previous results + * @category query + */ nextToken(nextToken: string) { this.query.next = nextToken; return this; } - // whether or not to include rekeying transactions + /** + * Whether or not to include rekeying transactions. + * + * #### Example + * ```typescript + * const txns = await indexerClient + * .searchForTransactions() + * .rekeyTo(false) + * .do(); + * ``` + * + * @param rekeyTo + * @category query + */ rekeyTo(rekeyTo: boolean) { this.query['rekey-to'] = rekeyTo; return this; } - // filter for this application + /** + * Filter for this application. + * + * #### Example + * ```typescript + * const appId = 60553466; + * const txns = await indexerClient + * .searchForTransactions() + * .applicationID(appId) + * .do(); + * ``` + * + * @param applicationID + * @category query + */ applicationID(applicationID: number) { this.query['application-id'] = applicationID; return this; From c6a2e5a04748a55658ae818ed8b14748a7d33ec6 Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Mon, 25 Apr 2022 16:41:56 -0400 Subject: [PATCH 29/37] pass a Uint8Array instead of a string for importing a key (#557) * pass a Uint8Array instead of a string for importing a key * update wallet master deriv key --- src/client/kmd.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/kmd.ts b/src/client/kmd.ts index 86f8884b4..b34a3dd97 100644 --- a/src/client/kmd.ts +++ b/src/client/kmd.ts @@ -42,7 +42,7 @@ export default class Kmd extends ServiceClient { async createWallet( walletName: string, walletPassword: string, - walletMDK = '', + walletMDK: Uint8Array = new Uint8Array(), walletDriverName = 'sqlite' ) { const req = { @@ -170,7 +170,7 @@ export default class Kmd extends ServiceClient { * @param walletHandle * @param secretKey */ - async importKey(walletHandle: string, secretKey: string) { + async importKey(walletHandle: string, secretKey: Uint8Array) { const req = { wallet_handle_token: walletHandle, private_key: Buffer.from(secretKey).toString('base64'), From 642a2a0bda0f50d74d051ab0964c5a13e072f2f9 Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Tue, 26 Apr 2022 12:46:49 -0400 Subject: [PATCH 30/37] adding foreign app addr to dryrun (#561) --- src/dryrun.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dryrun.ts b/src/dryrun.ts index d724fde1a..f80a04c3b 100644 --- a/src/dryrun.ts +++ b/src/dryrun.ts @@ -80,7 +80,12 @@ export async function createDryrun({ if (t.txn.appAccounts) accts.push(...t.txn.appAccounts.map((a) => encodeAddress(a.publicKey))); - if (t.txn.appForeignApps) apps.push(...t.txn.appForeignApps); + if (t.txn.appForeignApps) { + apps.push(...t.txn.appForeignApps); + accts.push( + ...t.txn.appForeignApps.map((aidx) => getApplicationAddress(aidx)) + ); + } if (t.txn.appForeignAssets) assets.push(...t.txn.appForeignAssets); From a1e9d0d9a078d0ab5e1b49dcdde233b201b1cf9d Mon Sep 17 00:00:00 2001 From: Jack Smith Date: Mon, 2 May 2022 17:21:42 +0300 Subject: [PATCH 31/37] update README.md with new hash --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3a21b4134..a908a41db 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,8 @@ Include a minified browser bundle directly in your HTML like so: ```html ``` @@ -32,8 +32,8 @@ or ```html ``` From b855f085622cffdeb6b65e20bc0ef44ffe5b8717 Mon Sep 17 00:00:00 2001 From: Jack Smith Date: Mon, 2 May 2022 17:29:31 +0300 Subject: [PATCH 32/37] Updating package files for new version --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9f4ba1f59..4a4dad08e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "algosdk", - "version": "1.15.0", + "version": "1.16.0", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index d50bfc468..1d9ddf150 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "algosdk", - "version": "1.15.0", + "version": "1.16.0", "description": "The official JavaScript SDK for Algorand", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", From 32cf190f847c4a6b8531f55fd55569c12048055e Mon Sep 17 00:00:00 2001 From: Jack Smith Date: Mon, 2 May 2022 18:37:25 +0300 Subject: [PATCH 33/37] Upgrading chromedriver --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1d9ddf150..c54b8c01b 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "@typescript-eslint/eslint-plugin": "^4.26.1", "@typescript-eslint/parser": "^4.26.1", "assert": "^2.0.0", - "chromedriver": "^99.0.0", + "chromedriver": "latest", "concurrently": "^6.2.0", "coveralls": "^3.1.0", "cucumber": "^5.1.0", From 6e7390801f1e6730532fc59da8cfee0bc2def9c8 Mon Sep 17 00:00:00 2001 From: Jason Paulos Date: Mon, 2 May 2022 09:09:37 -0700 Subject: [PATCH 34/37] Revert "Upgrading chromedriver" This reverts commit 32cf190f847c4a6b8531f55fd55569c12048055e. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c54b8c01b..1d9ddf150 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "@typescript-eslint/eslint-plugin": "^4.26.1", "@typescript-eslint/parser": "^4.26.1", "assert": "^2.0.0", - "chromedriver": "latest", + "chromedriver": "^99.0.0", "concurrently": "^6.2.0", "coveralls": "^3.1.0", "cucumber": "^5.1.0", From 228b7dcad81615b5478408826b5beaf08fb537b8 Mon Sep 17 00:00:00 2001 From: Jason Paulos Date: Mon, 2 May 2022 09:11:28 -0700 Subject: [PATCH 35/37] Update chromedriver --- package-lock.json | 16 ++++++++-------- package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4a4dad08e..1fc3cb632 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "algosdk", - "version": "1.15.0", + "version": "1.16.0", "license": "MIT", "dependencies": { "algo-msgpack-with-bigint": "^2.1.1", @@ -28,7 +28,7 @@ "@typescript-eslint/eslint-plugin": "^4.26.1", "@typescript-eslint/parser": "^4.26.1", "assert": "^2.0.0", - "chromedriver": "^99.0.0", + "chromedriver": "^101.0.0", "concurrently": "^6.2.0", "coveralls": "^3.1.0", "cucumber": "^5.1.0", @@ -1514,9 +1514,9 @@ } }, "node_modules/chromedriver": { - "version": "99.0.0", - "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-99.0.0.tgz", - "integrity": "sha512-pyB+5LuyZdb7EBPL3i5D5yucZUD+SlkdiUtmpjaEnLd9zAXp+SvD/hP5xF4l/ZmWvUo/1ZLxAI1YBdhazGTpgA==", + "version": "101.0.0", + "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-101.0.0.tgz", + "integrity": "sha512-LkkWxy6KM/0YdJS8qBeg5vfkTZTRamhBfOttb4oic4echDgWvCU1E8QcBbUBOHqZpSrYMyi7WMKmKMhXFUaZ+w==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -9511,9 +9511,9 @@ "dev": true }, "chromedriver": { - "version": "99.0.0", - "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-99.0.0.tgz", - "integrity": "sha512-pyB+5LuyZdb7EBPL3i5D5yucZUD+SlkdiUtmpjaEnLd9zAXp+SvD/hP5xF4l/ZmWvUo/1ZLxAI1YBdhazGTpgA==", + "version": "101.0.0", + "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-101.0.0.tgz", + "integrity": "sha512-LkkWxy6KM/0YdJS8qBeg5vfkTZTRamhBfOttb4oic4echDgWvCU1E8QcBbUBOHqZpSrYMyi7WMKmKMhXFUaZ+w==", "dev": true, "requires": { "@testim/chrome-version": "^1.1.2", diff --git a/package.json b/package.json index 1d9ddf150..571107834 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "@typescript-eslint/eslint-plugin": "^4.26.1", "@typescript-eslint/parser": "^4.26.1", "assert": "^2.0.0", - "chromedriver": "^99.0.0", + "chromedriver": "^101.0.0", "concurrently": "^6.2.0", "coveralls": "^3.1.0", "cucumber": "^5.1.0", From 267633aa1f56fccf15e5acc930b298a37e0efd70 Mon Sep 17 00:00:00 2001 From: Jason Paulos Date: Mon, 2 May 2022 09:11:43 -0700 Subject: [PATCH 36/37] Always use latest chromedriver in CI --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index e84020c12..81c7a0a09 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -133,3 +133,4 @@ commands: command: | set -e npm ci + npm install chromedriver@latest From 848c899ac8b4c61fbf247570a2e1fb13abda26df Mon Sep 17 00:00:00 2001 From: Jack Smith Date: Mon, 2 May 2022 19:24:42 +0300 Subject: [PATCH 37/37] Updated changelog for new version --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4812b28c9..10f42ca44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# v1.16.0 + +## Added + +- Dryrun stack printer +- Document more Indexer methods + +## Fixed + +- Corrected type of KMD keys +- Include foreign app addr in dryrun requests + # v1.15.0 ## Added