fix all errors resulting from running 'npx lerna bootstrap', hoist github actions to top, hoist vscode config to top

This commit is contained in:
Greg Weisbrod
2021-11-07 18:13:47 -05:00
parent 1106ad1405
commit 99c817ca8a
34 changed files with 15138 additions and 15703 deletions

View File

@@ -18,7 +18,7 @@ const {
* @returns the JSON representation of the transaction
*/
function decode(binary: string): JsonObject {
assert(typeof binary === "string", "binary must be a hex string");
assert.ok(typeof binary === "string", "binary must be a hex string");
return binaryToJSON(binary);
}
@@ -29,7 +29,7 @@ function decode(binary: string): JsonObject {
* @returns A hex-string of the encoded transaction
*/
function encode(json: object): string {
assert(typeof json === "object");
assert.ok(typeof json === "object");
return serializeObject(json as JsonObject)
.toString("hex")
.toUpperCase();
@@ -43,7 +43,7 @@ function encode(json: object): string {
* @returns a hex string of the encoded transaction
*/
function encodeForSigning(json: object): string {
assert(typeof json === "object");
assert.ok(typeof json === "object");
return signingData(json as JsonObject)
.toString("hex")
.toUpperCase();
@@ -57,7 +57,7 @@ function encodeForSigning(json: object): string {
* @returns a hex string of the encoded transaction
*/
function encodeForSigningClaim(json: object): string {
assert(typeof json === "object");
assert.ok(typeof json === "object");
return signingClaimData(json as ClaimObject)
.toString("hex")
.toUpperCase();
@@ -71,7 +71,7 @@ function encodeForSigningClaim(json: object): string {
* @returns a hex string of the encoded transaction
*/
function encodeForMultisigning(json: object, signer: string): string {
assert(typeof json === "object");
assert.ok(typeof json === "object");
assert.equal(json["SigningPubKey"], "");
return multiSigningData(json as JsonObject, signer)
.toString("hex")
@@ -85,7 +85,7 @@ function encodeForMultisigning(json: object, signer: string): string {
* @returns a hex-string representing the quality
*/
function encodeQuality(value: string): string {
assert(typeof value === "string");
assert.ok(typeof value === "string");
return quality.encode(value).toString("hex").toUpperCase();
}
@@ -96,7 +96,7 @@ function encodeQuality(value: string): string {
* @returns a string representing the quality
*/
function decodeQuality(value: string): string {
assert(typeof value === "string");
assert.ok(typeof value === "string");
return quality.decode(value).toString();
}

View File

@@ -45,7 +45,7 @@ interface transactionItemObject extends JsonObject {
function transactionItemizer(
json: transactionItemObject
): [Hash256, ShaMapNode, undefined] {
assert(json.hash);
assert.ok(json.hash);
const index = Hash256.from(json.hash);
const item = {
hashPrefix() {
@@ -139,8 +139,8 @@ interface ledgerObject {
function ledgerHash(header: ledgerObject): Hash256 {
const hash = new Sha512Half();
hash.put(HashPrefix.ledgerHeader);
assert(header.parent_close_time !== undefined);
assert(header.close_flags !== undefined);
assert.ok(header.parent_close_time !== undefined);
assert.ok(header.close_flags !== undefined);
UInt32.from<number>(header.ledger_index).toBytesSink(hash);
UInt64.from<bigInt.BigInteger>(
@@ -163,7 +163,7 @@ function ledgerHash(header: ledgerObject): Hash256 {
* @returns A JSON object describing a ledger header
*/
function decodeLedgerData(binary: string): object {
assert(typeof binary === "string", "binary must be a hex string");
assert.ok(typeof binary === "string", "binary must be a hex string");
const parser = new BinaryParser(binary);
return {
ledger_index: parser.readUInt32(),

View File

@@ -24,7 +24,7 @@ class BinaryParser {
* @returns The first byte of the BinaryParser
*/
peek(): number {
assert(this.bytes.byteLength !== 0);
assert.ok(this.bytes.byteLength !== 0);
return this.bytes[0];
}
@@ -34,7 +34,7 @@ class BinaryParser {
* @param n the number of bytes to skip
*/
skip(n: number): void {
assert(n <= this.bytes.byteLength);
assert.ok(n <= this.bytes.byteLength);
this.bytes = this.bytes.slice(n);
}
@@ -45,7 +45,7 @@ class BinaryParser {
* @return The bytes
*/
read(n: number): Buffer {
assert(n <= this.bytes.byteLength);
assert.ok(n <= this.bytes.byteLength);
const slice = this.bytes.slice(0, n);
this.skip(n);
@@ -59,7 +59,7 @@ class BinaryParser {
* @return The number represented by those bytes
*/
readUIntN(n: number): number {
assert(0 < n && n <= 4, "invalid n");
assert.ok(0 < n && n <= 4, "invalid n");
return this.read(n).reduce((a, b) => (a << 8) | b) >>> 0;
}

View File

@@ -128,8 +128,8 @@ class BinarySerializer {
*/
writeFieldAndValue(field: FieldInstance, value: SerializedType): void {
const associatedValue = field.associatedType.from(value);
assert(associatedValue.toBytesSink !== undefined);
assert(field.name !== undefined);
assert.ok(associatedValue.toBytesSink !== undefined);
assert.ok(field.name !== undefined);
this.sink.put(field.header);

View File

@@ -158,7 +158,7 @@ class ShaMapInner extends ShaMapNode {
* @param leaf Leaf node to insert when branch doesn't exist
*/
addItem(index?: Hash256, item?: ShaMapNode, leaf?: ShaMapLeaf): void {
assert(index !== undefined);
assert.ok(index !== undefined);
const nibble = index.nibblet(this.depth);
const existing = this.branches[nibble];

View File

@@ -101,8 +101,8 @@ class STObject extends SerializedType {
const xAddressDecoded = Object.entries(value).reduce((acc, [key, val]) => {
let handled: JsonObject | undefined = undefined;
if (isValidXAddress(val)) {
handled = handleXAddress(key, val);
if (val && isValidXAddress(val.toString())) {
handled = handleXAddress(key, val.toString());
checkForDuplicateTags(handled, value as JsonObject);
}
return Object.assign(acc, handled ?? { [key]: val });