Skip to content

Commit

Permalink
fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
robertlincecum committed Oct 12, 2024
1 parent f30a4a1 commit 231f12a
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 43 deletions.
18 changes: 6 additions & 12 deletions dist/quais.js
Original file line number Diff line number Diff line change
Expand Up @@ -18984,10 +18984,10 @@ function accessListify(value) {
return value.map((set, index) => {
if (Array.isArray(set)) {
assertArgument(set.length === 2, 'invalid slot set', `value[${index}]`, set);
return accessSetify(set[0], set[1]);
return accessSetify(formatMixedCaseChecksumAddress(set[0]), set[1]);
}
assertArgument(set != null && typeof set === 'object', 'invalid address-slot set', 'value', value);
return accessSetify(set.address, set.storageKeys);
return accessSetify(formatMixedCaseChecksumAddress(set.address), set.storageKeys);
});
}
assertArgument(value != null && typeof value === 'object', 'invalid access list', 'value', value);
Expand Down Expand Up @@ -24181,10 +24181,7 @@ class AbstractSigner {
pop.accessList = tx.accessList;
}
else {
pop.accessList = (await this.createAccessList(tx))?.map((it) => {
it.address = formatMixedCaseChecksumAddress(it.address);
return it;
});
pop.accessList = await this.createAccessList(tx);
}
}
//@TOOD: Don't await all over the place; save them up for
Expand Down Expand Up @@ -30510,12 +30507,12 @@ class AbstractProvider {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_wrapTransactionResponse(tx, network) {
try {
if (tx.type === 0 || tx.type === 1) {
if (tx.type === '0x0' || tx.type === '0x1' || tx.type === 0 || tx.type === 1) {
// For QuaiTransaction, format and wrap as before
const formattedTx = formatTransactionResponse(tx);
return new QuaiTransactionResponse(formattedTx, this);
}
else if (tx.type === 2) {
else if (tx.type === '0x2' || tx.type === 2) {
// For QiTransaction, use fromProto() directly
return new QiTransactionResponse(tx, this);
}
Expand Down Expand Up @@ -33071,10 +33068,7 @@ class ContractFactory {
tx.from = this.runner.address;
}
const grindedTx = await this.grindContractAddress(tx);
grindedTx.accessList = (await this.runner.createAccessList?.(grindedTx))?.map((it) => {
it.address = formatMixedCaseChecksumAddress(it.address);
return it;
});
grindedTx.accessList = await this.runner.createAccessList?.(grindedTx);
const sentTx = await this.runner.sendTransaction(grindedTx);
const address = getStatic(this.constructor, 'getContractAddress')?.(tx);
return new BaseContract(address, this.interface, this.runner, sentTx);
Expand Down
2 changes: 1 addition & 1 deletion dist/quais.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/quais.min.js

Large diffs are not rendered by default.

18 changes: 6 additions & 12 deletions dist/quais.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -19006,10 +19006,10 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
return value.map((set, index) => {
if (Array.isArray(set)) {
assertArgument(set.length === 2, 'invalid slot set', `value[${index}]`, set);
return accessSetify(set[0], set[1]);
return accessSetify(formatMixedCaseChecksumAddress(set[0]), set[1]);
}
assertArgument(set != null && typeof set === 'object', 'invalid address-slot set', 'value', value);
return accessSetify(set.address, set.storageKeys);
return accessSetify(formatMixedCaseChecksumAddress(set.address), set.storageKeys);
});
}
assertArgument(value != null && typeof value === 'object', 'invalid access list', 'value', value);
Expand Down Expand Up @@ -24203,10 +24203,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
pop.accessList = tx.accessList;
}
else {
pop.accessList = (await this.createAccessList(tx))?.map((it) => {
it.address = formatMixedCaseChecksumAddress(it.address);
return it;
});
pop.accessList = await this.createAccessList(tx);
}
}
//@TOOD: Don't await all over the place; save them up for
Expand Down Expand Up @@ -30532,12 +30529,12 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_wrapTransactionResponse(tx, network) {
try {
if (tx.type === 0 || tx.type === 1) {
if (tx.type === '0x0' || tx.type === '0x1' || tx.type === 0 || tx.type === 1) {
// For QuaiTransaction, format and wrap as before
const formattedTx = formatTransactionResponse(tx);
return new QuaiTransactionResponse(formattedTx, this);
}
else if (tx.type === 2) {
else if (tx.type === '0x2' || tx.type === 2) {
// For QiTransaction, use fromProto() directly
return new QiTransactionResponse(tx, this);
}
Expand Down Expand Up @@ -33093,10 +33090,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
tx.from = this.runner.address;
}
const grindedTx = await this.grindContractAddress(tx);
grindedTx.accessList = (await this.runner.createAccessList?.(grindedTx))?.map((it) => {
it.address = formatMixedCaseChecksumAddress(it.address);
return it;
});
grindedTx.accessList = await this.runner.createAccessList?.(grindedTx);
const sentTx = await this.runner.sendTransaction(grindedTx);
const address = getStatic(this.constructor, 'getContractAddress')?.(tx);
return new BaseContract(address, this.interface, this.runner, sentTx);
Expand Down
2 changes: 1 addition & 1 deletion dist/quais.umd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/quais.umd.min.js

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions src/contract/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { concat, defineProperties, getBytes, hexlify, assert, assertArgument } f
import { BaseContract, copyOverrides, resolveArgs } from './contract.js';

import type { InterfaceAbi } from '../abi/index.js';
import { formatMixedCaseChecksumAddress, validateAddress } from '../address/index.js';
import { validateAddress } from '../address/index.js';
import type { Addressable } from '../address/index.js';
import type { BytesLike } from '../utils/index.js';
import { getZoneForAddress } from '../utils/index.js';
Expand Down Expand Up @@ -139,10 +139,7 @@ export class ContractFactory<A extends Array<any> = Array<any>, I = BaseContract
}
const grindedTx = await this.grindContractAddress(tx);

grindedTx.accessList = (await this.runner.createAccessList?.(grindedTx))?.map((it) => {
it.address = formatMixedCaseChecksumAddress(it.address);
return it;
});
grindedTx.accessList = await this.runner.createAccessList?.(grindedTx);

const sentTx = await this.runner.sendTransaction(grindedTx);
const address = getStatic<(tx: ContractDeployTransaction) => string>(
Expand Down
4 changes: 2 additions & 2 deletions src/providers/abstract-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1051,11 +1051,11 @@ export class AbstractProvider<C = FetchRequest> implements Provider {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_wrapTransactionResponse(tx: any, network: Network): TransactionResponse {
try {
if (tx.type === 0 || tx.type === 1) {
if (tx.type === '0x0' || tx.type === '0x1' || tx.type === 0 || tx.type === 1) {
// For QuaiTransaction, format and wrap as before
const formattedTx = formatTransactionResponse(tx) as QuaiTransactionResponseParams;
return new QuaiTransactionResponse(formattedTx, this);
} else if (tx.type === 2) {
} else if (tx.type === '0x2' || tx.type === 2) {
// For QiTransaction, use fromProto() directly
return new QiTransactionResponse(tx, this);
} else {
Expand Down
7 changes: 2 additions & 5 deletions src/signers/abstract-signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Generally the [Wallet](../classes/Wallet) and [JsonRpcSigner](../classes/JsonRpcSigner) and their sub-classes are
* sufficent for most developers, but this is provided to fascilitate more complex Signers.
*/
import { AddressLike, formatMixedCaseChecksumAddress, resolveAddress, validateAddress } from '../address/index.js';
import { AddressLike, resolveAddress, validateAddress } from '../address/index.js';
import { defineProperties, getBigInt, resolveProperties, assert, assertArgument } from '../utils/index.js';
import { addressFromTransactionRequest, copyRequest, QuaiTransactionRequest } from '../providers/provider.js';

Expand Down Expand Up @@ -148,10 +148,7 @@ export abstract class AbstractSigner<P extends null | Provider = null | Provider
if (tx.accessList) {
pop.accessList = tx.accessList;
} else {
pop.accessList = (await this.createAccessList(tx))?.map((it) => {
it.address = formatMixedCaseChecksumAddress(it.address);
return it;
});
pop.accessList = await this.createAccessList(tx);
}
}
//@TOOD: Don't await all over the place; save them up for
Expand Down
6 changes: 3 additions & 3 deletions src/transaction/accesslist.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { validateAddress } from '../address/index.js';
import { getAddress } from '../address/index.js';
import { getAddress, formatMixedCaseChecksumAddress } from '../address/index.js';
import { assertArgument, isHexString } from '../utils/index.js';

import type { AccessList, AccessListish } from './index.js';
Expand Down Expand Up @@ -36,10 +36,10 @@ export function accessListify(value: AccessListish): AccessList {
(set, index) => {
if (Array.isArray(set)) {
assertArgument(set.length === 2, 'invalid slot set', `value[${index}]`, set);
return accessSetify(set[0], set[1]);
return accessSetify(formatMixedCaseChecksumAddress(set[0]), set[1]);
}
assertArgument(set != null && typeof set === 'object', 'invalid address-slot set', 'value', value);
return accessSetify(set.address, set.storageKeys);
return accessSetify(formatMixedCaseChecksumAddress(set.address), set.storageKeys);
},
);
}
Expand Down

0 comments on commit 231f12a

Please sign in to comment.