@woof-software/contracts-tools-sdk-ethers 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- import { Contract as EthersContract, Wallet, WebSocketProvider, } from "ethers";
1
+ import { Contract as EthersContract, WebSocketProvider, } from "ethers";
2
2
  import { config } from "../config.js";
3
3
  import { CONTRACTS_ERRORS } from "../errors/index.js";
4
- import { isSigner, isStaticMethod } from "../helpers/index.js";
4
+ import { isSigner, isStaticMethod, priorityCall } from "../helpers/index.js";
5
5
  import { CallMutability, } from "../types/index.js";
6
- import { checkSignals, createTimeoutSignal, priorityCall, raceWithSignals, waitWithSignals, } from "../utils/index.js";
6
+ import { checkSignals, createTimeoutSignal, raceWithSignals, waitWithSignals, } from "../utils/index.js";
7
7
  import { contractCreateCallName } from "./contract-create-call-name.js";
8
8
  export class BaseContract {
9
9
  static createAutoClass(abi, address, driver, options) {
@@ -43,7 +43,7 @@ export class BaseContract {
43
43
  this.address = address;
44
44
  this.driver = driver;
45
45
  this.isCallable = !!address && !!driver;
46
- this.isReadonly = !this.isCallable || !(driver instanceof Wallet);
46
+ this.isReadonly = !this.isCallable || !isSigner(driver);
47
47
  this.contract = new EthersContract(address, abi, driver);
48
48
  this.contractOptions = {
49
49
  staticCallsTimeoutMs: config.contract.staticCalls.timeoutMs,
@@ -1,2 +1,2 @@
1
- import type { Signer } from "ethers";
2
- export declare const isSigner: (driver: Signer) => boolean;
1
+ import type { Provider, Signer } from "ethers";
2
+ export declare const isSigner: (driver: Signer | Provider) => boolean;
@@ -1,3 +1,4 @@
1
1
  export const isSigner = (driver) => {
2
- return typeof driver?.getAddress === "function";
2
+ // @ts-ignore
3
+ return typeof driver.getAddress === "function";
3
4
  };
@@ -1,5 +1,3 @@
1
- import type { Contract, Provider, TransactionRequest } from "ethers";
1
+ import type { Contract, Provider, Signer } from "ethers";
2
2
  import type { PriorityCallOptions } from "../types";
3
- export declare function priorityCall(provider: Provider, signer: {
4
- sendTransaction: (txn: TransactionRequest) => Promise<any>;
5
- }, contract: Contract, method: string, args?: any[], options?: PriorityCallOptions): Promise<any>;
3
+ export declare function priorityCall(provider: Provider, signer: Signer, contract: Contract, method: string, args?: any[], options?: PriorityCallOptions): Promise<any>;
@@ -1,6 +1,5 @@
1
1
  export * from "./create-timeout-signal";
2
2
  export * from "./race-with-signals";
3
3
  export * from "./create-signals-promise";
4
- export * from "../helpers/priority-call";
5
4
  export * from "./check-signals";
6
5
  export * from "./wait-with-signals";
@@ -1,6 +1,5 @@
1
1
  export * from "./create-timeout-signal.js";
2
2
  export * from "./race-with-signals.js";
3
3
  export * from "./create-signals-promise.js";
4
- export * from "../helpers/priority-call.js";
5
4
  export * from "./check-signals.js";
6
5
  export * from "./wait-with-signals.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@woof-software/contracts-tools-sdk-ethers",
3
3
  "description": "Module simplify smart contract interactions and multicall3 aggregation on the Ethereum blockchain and other EVM-compatible networks.",
4
- "version": "0.0.8",
4
+ "version": "0.0.10",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/woof-compound/sandbox-sdks.git"
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "typescript": "^5.7.2",
29
- "vitest": "^3.0.5"
29
+ "vitest": "^3.0.6"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"
@@ -34,6 +34,7 @@
34
34
  "scripts": {
35
35
  "prepublish": "$npm_execpath build",
36
36
  "build": "tsc --build tsconfig.build.json --force && node ../../scripts/compile/post-compile.js",
37
+ "anvil": "cp ./test/local/anvil-data ./anvil-data-tmp && anvil --state ./anvil-data-tmp --block-time 3",
37
38
  "test": "vitest run --coverage --config test/vitest-config/vitest.config.unit.ts",
38
39
  "test:unit": "vitest run --coverage --config test/vitest-config/vitest.config.unit.ts",
39
40
  "test:e2e": "vitest run --coverage --config test/vitest-config/vitest.config.e2e.ts",