@skalenetwork/skale-contracts-ethers-v5 0.0.2-main.3 → 0.0.3-develop.0

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -8,13 +8,12 @@ The library simplifies development of dApps that interact with smart contracts i
8
8
 
9
9
  - resolving of addresses of SKALE contracts on different networks
10
10
  - providing up to date ABI for SKALE contracts (they may change over time due to upgradeable nature of some contracts)
11
- - automatic creation of `Contract` objects. Currently supported libraries:
12
- - ethers v5
11
+ - automatic creation of `Contract` objects.
13
12
 
14
13
  ## Installation
15
14
 
16
15
  ```bash
17
- yarn add @skalenetwork/skale-contracts
16
+ yarn add @skalenetwork/skale-contracts-ethers-v5
18
17
  ```
19
18
 
20
19
  ## Glossary
@@ -54,7 +53,7 @@ When target instance is received it can be queried for information (address, AB
54
53
  ### Example
55
54
 
56
55
  ```typescript
57
- import { skaleContracts } from "@skalenetwork/skale-contracts";
56
+ import { skaleContracts } from "@skalenetwork/skale-contracts-ethers-v5";
58
57
  import { ethers } from "ethers";
59
58
 
60
59
  const provider = new ethers.providers.JsonRpcProvider(endpoint)
@@ -1,10 +1,11 @@
1
1
  import { Abi, Adapter, ContractData, FunctionCall } from "@skalenetwork/skale-contracts";
2
2
  import { BaseContract, ethers } from "ethers";
3
3
  import { Provider } from "@ethersproject/providers";
4
- export declare class Ethers5Adapter extends Adapter<BaseContract> {
4
+ export declare class Ethers5Adapter implements Adapter<BaseContract> {
5
5
  provider: Provider;
6
6
  constructor(provider: Provider);
7
7
  createContract(address: string, abi: Abi): ethers.Contract;
8
8
  makeCall(contract: ContractData, targetFunction: FunctionCall): Promise<unknown>;
9
9
  getChainId(): Promise<bigint>;
10
+ isAddress(value: string): boolean;
10
11
  }
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Ethers5Adapter = void 0;
4
- const skale_contracts_1 = require("@skalenetwork/skale-contracts");
5
4
  const ethers_1 = require("ethers");
6
- class Ethers5Adapter extends skale_contracts_1.Adapter {
5
+ class Ethers5Adapter {
7
6
  constructor(provider) {
8
- super();
9
7
  this.provider = provider;
10
8
  }
11
9
  createContract(address, abi) {
@@ -22,6 +20,10 @@ class Ethers5Adapter extends skale_contracts_1.Adapter {
22
20
  const { chainId } = await this.provider.getNetwork();
23
21
  return BigInt(chainId);
24
22
  }
23
+ // eslint-disable-next-line class-methods-use-this
24
+ isAddress(value) {
25
+ return ethers_1.ethers.utils.isAddress(value);
26
+ }
25
27
  }
26
28
  exports.Ethers5Adapter = Ethers5Adapter;
27
29
  //# sourceMappingURL=ethers5Adapter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ethers5Adapter.js","sourceRoot":"","sources":["../src/ethers5Adapter.ts"],"names":[],"mappings":";;;AAAA,mEAKuC;AACvC,mCAA8C;AAI9C,MAAa,cAAe,SAAQ,yBAAqB;IAGrD,YAAa,QAAkB;QAC3B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED,cAAc,CAAE,OAAe,EAAE,GAAQ;QACrC,OAAO,IAAI,eAAM,CAAC,QAAQ,CACtB,OAAO,EACP,IAAI,eAAM,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,EAC/B,IAAI,CAAC,QAAQ,CACA,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,QAAQ,CACV,QAAsB,EACtB,cAA4B;QAE5B,MACI,iBAAiB,GAAG,IAAI,eAAM,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAC5D,CAAC,MAAM,CAAC,GAAG,iBAAiB,CAAC,oBAAoB,CAC7C,cAAc,CAAC,YAAY,EAC3B,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;YACrB,MAAM,EAAE,iBAAiB,CAAC,kBAAkB,CACxC,cAAc,CAAC,YAAY,EAC3B,cAAc,CAAC,IAAI,CACtB;YACD,IAAI,EAAE,QAAQ,CAAC,OAAO;SACzB,CA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CAAC;IAC3B,CAAC;IAED,kDAAkD;IAClD,SAAS,CAAE,KAAa;QACpB,OAAO,eAAM,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;CACJ;AA3CD,wCA2CC"}
package/package.json CHANGED
@@ -23,8 +23,8 @@
23
23
  },
24
24
  "types": "lib/index.d.ts",
25
25
  "dependencies": {
26
- "@skalenetwork/skale-contracts": "0.0.2-main.3",
26
+ "@skalenetwork/skale-contracts": "0.0.3-develop.0",
27
27
  "ethers": "^5.7.2"
28
28
  },
29
- "version": "0.0.2-main.3"
29
+ "version": "0.0.3-develop.0"
30
30
  }