@skalenetwork/skale-contracts-ethers-v5 1.0.2-develop.7 → 1.0.2-develop.70
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.
- package/README.md +4 -4
- package/lib/ethers5Adapter.d.ts +3 -1
- package/lib/ethers5Adapter.js +4 -0
- package/lib/ethers5Adapter.js.map +1 -1
- package/lib/skaleContracts.d.ts +2 -1
- package/lib/skaleContracts.js.map +1 -1
- package/package.json +10 -6
package/README.md
CHANGED
@@ -48,7 +48,7 @@ The library provides master object `skaleContracts`.
|
|
48
48
|
|
49
49
|
This object is used to provide desired [network](#network), [project](#project) and [instance](#instance) using it's [alias](#alias) or direct address.
|
50
50
|
|
51
|
-
When target instance is received it can be queried for information
|
51
|
+
When target instance is received it can be queried for information (address, ABI or Contract object) about a particular contract by it's name.
|
52
52
|
|
53
53
|
### Example
|
54
54
|
|
@@ -56,10 +56,10 @@ When target instance is received it can be queried for information (address, AB
|
|
56
56
|
import { skaleContracts } from "@skalenetwork/skale-contracts-ethers-v5";
|
57
57
|
import { ethers } from "ethers";
|
58
58
|
|
59
|
-
const provider = new ethers.providers.JsonRpcProvider(endpoint)
|
59
|
+
const provider = new ethers.providers.JsonRpcProvider(endpoint);
|
60
60
|
const network = await skaleContracts.getNetworkByProvider(provider);
|
61
|
-
const project =
|
61
|
+
const project = network.getProject("skale-manager");
|
62
62
|
const instance = await project.getInstance("production");
|
63
63
|
const distributor = await instance.getContract("Distributor");
|
64
|
-
const fee = await distributor.getEarnedFeeAmount()
|
64
|
+
const fee = await distributor.getEarnedFeeAmount();
|
65
65
|
```
|
package/lib/ethers5Adapter.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Abi, Adapter, ContractData, FunctionCall } from "@skalenetwork/skale-contracts";
|
2
2
|
import { BaseContract, ethers } from "ethers";
|
3
|
+
import { ContractAddress } from "@skalenetwork/skale-contracts/lib/domain/types";
|
3
4
|
import { Provider } from "@ethersproject/providers";
|
4
5
|
export declare class Ethers5Adapter implements Adapter<BaseContract> {
|
5
6
|
provider: Provider;
|
@@ -7,5 +8,6 @@ export declare class Ethers5Adapter implements Adapter<BaseContract> {
|
|
7
8
|
createContract(address: string, abi: Abi): ethers.Contract;
|
8
9
|
makeCall(contract: ContractData, targetFunction: FunctionCall): Promise<unknown>;
|
9
10
|
getChainId(): Promise<bigint>;
|
10
|
-
|
11
|
+
getCode(address: string | Promise<string>): Promise<string>;
|
12
|
+
isAddress(value: string): value is ContractAddress;
|
11
13
|
}
|
package/lib/ethers5Adapter.js
CHANGED
@@ -21,6 +21,10 @@ class Ethers5Adapter {
|
|
21
21
|
const { chainId } = await this.provider.getNetwork();
|
22
22
|
return BigInt(chainId);
|
23
23
|
}
|
24
|
+
async getCode(address) {
|
25
|
+
const code = await this.provider.getCode(address);
|
26
|
+
return code;
|
27
|
+
}
|
24
28
|
// eslint-disable-next-line class-methods-use-this
|
25
29
|
isAddress(value) {
|
26
30
|
return ethers_1.ethers.utils.isAddress(value);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ethers5Adapter.js","sourceRoot":"","sources":["../src/ethers5Adapter.ts"],"names":[],"mappings":";;;AAMA,mCAA8C;
|
1
|
+
{"version":3,"file":"ethers5Adapter.js","sourceRoot":"","sources":["../src/ethers5Adapter.ts"],"names":[],"mappings":";;;AAMA,mCAA8C;AAO9C,MAAa,cAAc;IAGvB,YAAa,QAAkB;QAC3B,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,MAAM,iBAAiB,GAAG,IAAI,eAAM,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACnE,MAAM,CAAC,MAAM,CAAC,GAAG,iBAAiB,CAAC,oBAAoB,CACnD,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,CAAC,CACL,CAAC;QACF,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,UAAU;QACZ,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;QACrD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAAiC;QAC3C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,kDAAkD;IAClD,SAAS,CAAE,KAAa;QACpB,OAAO,eAAM,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;CACJ;AA/CD,wCA+CC"}
|
package/lib/skaleContracts.d.ts
CHANGED
@@ -2,7 +2,8 @@ import { BaseContract } from "ethers";
|
|
2
2
|
import { Instance as BaseInstance } from "@skalenetwork/skale-contracts/lib/instance";
|
3
3
|
import { SkaleContracts as BaseSkaleContracts } from "@skalenetwork/skale-contracts";
|
4
4
|
import { Provider } from "@ethersproject/providers";
|
5
|
-
|
5
|
+
import { SkaleContractNames } from "@skalenetwork/skale-contracts/lib/projects/factory";
|
6
|
+
export type Instance = BaseInstance<BaseContract, SkaleContractNames>;
|
6
7
|
export declare class SkaleContracts extends BaseSkaleContracts<BaseContract> {
|
7
8
|
getNetworkByChainId(chainId: number): Promise<import("@skalenetwork/skale-contracts/lib/network").Network<BaseContract>>;
|
8
9
|
getNetworkByProvider(provider: Provider): Promise<import("@skalenetwork/skale-contracts/lib/network").Network<BaseContract>>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"skaleContracts.js","sourceRoot":"","sources":["../src/skaleContracts.ts"],"names":[],"mappings":";;;AAAA,mCAA8C;AAI9C,mEAEuC;AACvC,qDAAkD;
|
1
|
+
{"version":3,"file":"skaleContracts.js","sourceRoot":"","sources":["../src/skaleContracts.ts"],"names":[],"mappings":";;;AAAA,mCAA8C;AAI9C,mEAEuC;AACvC,qDAAkD;AAMlD,MAAa,cAAe,SAAQ,gCAAgC;IAChE,mBAAmB,CAAE,OAAe;QAChC,OAAO,IAAI,CAAC,oBAAoB,CAAC,eAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;IACzE,CAAC;IAED,oBAAoB,CAAE,QAAkB;QACpC,OAAO,IAAI,CAAC,mBAAmB,CAAC,IAAI,+BAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClE,CAAC;CACJ;AARD,wCAQC"}
|
package/package.json
CHANGED
@@ -3,11 +3,13 @@
|
|
3
3
|
"node": ">=16.0.0"
|
4
4
|
},
|
5
5
|
"devDependencies": {
|
6
|
-
"@types/node": "^
|
6
|
+
"@types/node": "^22.10.2",
|
7
7
|
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
8
|
-
"@typescript-eslint/parser": "^
|
8
|
+
"@typescript-eslint/parser": "^8.15.0",
|
9
|
+
"@vitest/coverage-v8": "^3.1.2",
|
9
10
|
"eslint": "^8.45.0",
|
10
|
-
"typescript": "^5.
|
11
|
+
"typescript": "^5.7.2",
|
12
|
+
"vitest": "^3.1.2"
|
11
13
|
},
|
12
14
|
"files": [
|
13
15
|
"lib/**/*"
|
@@ -19,12 +21,14 @@
|
|
19
21
|
"compile": "npx tsc",
|
20
22
|
"fullCheck": "yarn compile && yarn eslint",
|
21
23
|
"prepare": "yarn compile",
|
22
|
-
"eslint": "npx eslint ."
|
24
|
+
"eslint": "npx eslint .",
|
25
|
+
"test": "yarn vitest run",
|
26
|
+
"test-coverage": "yarn vitest run --coverage"
|
23
27
|
},
|
24
28
|
"types": "lib/index.d.ts",
|
25
29
|
"dependencies": {
|
26
|
-
"@skalenetwork/skale-contracts": "1.0.2-develop.
|
30
|
+
"@skalenetwork/skale-contracts": "1.0.2-develop.70",
|
27
31
|
"ethers": "^5.7.2"
|
28
32
|
},
|
29
|
-
"version": "1.0.2-develop.
|
33
|
+
"version": "1.0.2-develop.70"
|
30
34
|
}
|