Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade del-osx-lib version 1.0.7 #9

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"@ethersproject/networks": "npm:boa-networks@^5.7.2",
"@ethersproject/providers": "^5.7.0",
"@ethersproject/wallet": "^5.7.0",
"del-osx-lib": "^1.0.6",
"del-osx-lib": "^1.0.7",
"del-sdk-common": "^1.0.0",
"dotenv": "^16.3.1",
"unfetch": "^5.0.0"
Expand Down
10 changes: 9 additions & 1 deletion packages/client/src/internal/client/methods.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { SupportedNetworks, SupportedNetworksArray } from "../../client-common";
import { Contract } from "@ethersproject/contracts";
import { BigNumber } from "@ethersproject/bignumber";
import { getNetwork } from "@ethersproject/networks";

import { LinkCollection__factory } from "del-osx-lib";
import { NoProviderError, NoSignerError } from "del-sdk-common";
import { NoProviderError, NoSignerError, UnsupportedNetworkError } from "del-sdk-common";

import {
AddRequestSteps,
Expand Down Expand Up @@ -132,6 +134,12 @@ export class ClientMethods extends ClientCore implements IClientMethods {
throw new NoProviderError();
}

const network = getNetwork((await signer.provider.getNetwork()).chainId);
const networkName = network.name as SupportedNetworks;
if (!SupportedNetworksArray.includes(networkName)) {
throw new UnsupportedNetworkError(networkName);
}

const contract = LinkCollection__factory.connect(this.web3.getLinkCollectionAddress(), signer);
const address = await signer.getAddress();
const nonce = await contract.nonceOf(address);
Expand Down
2 changes: 1 addition & 1 deletion packages/client/test/helper/FakerValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export class FakerValidator {

private async voteAgreement(signer: Signer, requestId: string) {
try {
await (await this.getContract()).connect(signer).voteRequest(requestId, 1);
await (await this.getContract()).connect(signer).voteRequest(requestId);
} catch (e) {
const message = e instanceof Error && e.message !== undefined ? e.message : "Error when calling contract";
console.error(message);
Expand Down
5 changes: 1 addition & 4 deletions packages/client/test/helper/GanacheServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,7 @@ export class GanacheServer {
}

public static createTestProvider(): JsonRpcProvider {
return new JsonRpcProvider(`http://localhost:${GanacheServer.PORT}`, {
chainId: GanacheServer.CHAIN_ID,
name: "bosagora_devnet",
});
return new JsonRpcProvider(`http://localhost:${GanacheServer.PORT}`, GanacheServer.CHAIN_ID);
}

public static setTestProvider(provider: JsonRpcProvider) {
Expand Down
6 changes: 2 additions & 4 deletions packages/client/test/methods.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { BigNumber } from "@ethersproject/bignumber";

import { Server } from "ganache";
import { GanacheServer } from "./helper/GanacheServer";
import { contextParamsLocalChain } from "./helper/constants";
Expand Down Expand Up @@ -66,8 +64,8 @@ describe("SDK Client", () => {
});

it("Vote request", async () => {
await deployment.linkCollection.connect(validator1).voteRequest(requestId, BigNumber.from(1));
await deployment.linkCollection.connect(validator2).voteRequest(requestId, BigNumber.from(1));
await deployment.linkCollection.connect(validator1).voteRequest(requestId);
await deployment.linkCollection.connect(validator2).voteRequest(requestId);
});

it("Count Vote", async () => {
Expand Down
6 changes: 6 additions & 0 deletions packages/common/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@ export class NoLinkCollection extends Error {
super("A link collection address is needed");
}
}

export class UnsupportedNetworkError extends Error {
constructor(network: string) {
super("Unsupported network: " + network);
}
}
48 changes: 42 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@
dependencies:
"@ethersproject/logger" "^5.7.0"

"@ethersproject/networks@npm:boa-networks@^5.7.2":
"@ethersproject/networks@npm:boa-networks@5.7.2", "@ethersproject/networks@npm:boa-networks@^5.7.2":
version "5.7.2"
resolved "https://registry.yarnpkg.com/boa-networks/-/boa-networks-5.7.2.tgz#eb8f8c1d27f10f1bfd987c25898116376d85e44f"
integrity sha512-vIowYIROUFXTjSB2W+ouxVCHtLAbe/w1Aff314rGtgIZgPcsmSLP056RWi5Iu0jyX/fU6YDs9w5lJ+rNCsmbgQ==
Expand Down Expand Up @@ -3097,12 +3097,12 @@ define-property@^2.0.2:
is-descriptor "^1.0.2"
isobject "^3.0.1"

del-osx-lib@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/del-osx-lib/-/del-osx-lib-1.0.6.tgz#b3d612c8c983edbb43ac6503b5d1f688cde97443"
integrity sha512-jdnOEbuIMYOyyUoJSRJFFvZ8wqYa+NuncCHhiVqM1n9lKsNpQr8s9mUS1uFQ9Vfik3q1Ze8nddwg97PdEo/A6Q==
del-osx-lib@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/del-osx-lib/-/del-osx-lib-1.0.7.tgz#c3bf6c9f843184712beabd96fdae9d15c0a947d5"
integrity sha512-4QSK5s2Ua+kxZjyklrTT8nB2Z1Sq0o0tCeLgjnkl1cC2fFE5EBpG9G9lowSzpKerCtI8S2s/pf7DC2a8ZnRhlA==
dependencies:
ethers "^5.7.0"
ethers "npm:boa-ethers2@^5.7.9"

delayed-stream@~1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -3774,6 +3774,42 @@ ethers@^5.7.0:
"@ethersproject/web" "5.7.1"
"@ethersproject/wordlists" "5.7.0"

"ethers@npm:boa-ethers2@^5.7.9":
version "5.7.9"
resolved "https://registry.yarnpkg.com/boa-ethers2/-/boa-ethers2-5.7.9.tgz#b84ecd2d9370918a700d16dea35533740ca96d71"
integrity sha512-TWmkAAwQuFjxSSJpbDgOIqpMS5EuCwNIsSxxPF31DxQnle1jX98UoAcEt2++/sLD3Zy2fB2pyhseD1e6zATClg==
dependencies:
"@ethersproject/abi" "5.7.0"
"@ethersproject/abstract-provider" "5.7.0"
"@ethersproject/abstract-signer" "5.7.0"
"@ethersproject/address" "5.7.0"
"@ethersproject/base64" "5.7.0"
"@ethersproject/basex" "5.7.0"
"@ethersproject/bignumber" "5.7.0"
"@ethersproject/bytes" "5.7.0"
"@ethersproject/constants" "5.7.0"
"@ethersproject/contracts" "5.7.0"
"@ethersproject/hash" "5.7.0"
"@ethersproject/hdnode" "5.7.0"
"@ethersproject/json-wallets" "5.7.0"
"@ethersproject/keccak256" "5.7.0"
"@ethersproject/logger" "5.7.0"
"@ethersproject/networks" "npm:[email protected]"
"@ethersproject/pbkdf2" "5.7.0"
"@ethersproject/properties" "5.7.0"
"@ethersproject/providers" "5.7.2"
"@ethersproject/random" "5.7.0"
"@ethersproject/rlp" "5.7.0"
"@ethersproject/sha2" "5.7.0"
"@ethersproject/signing-key" "5.7.0"
"@ethersproject/solidity" "5.7.0"
"@ethersproject/strings" "5.7.0"
"@ethersproject/transactions" "5.7.0"
"@ethersproject/units" "5.7.0"
"@ethersproject/wallet" "5.7.0"
"@ethersproject/web" "5.7.1"
"@ethersproject/wordlists" "5.7.0"

exec-sh@^0.3.2:
version "0.3.6"
resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.6.tgz#ff264f9e325519a60cb5e273692943483cca63bc"
Expand Down
Loading