Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Commit

Permalink
chore: update hosts for ARK and LSK (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
faustbrian authored Jul 21, 2021
1 parent b7b4c36 commit 8fd2fd9
Show file tree
Hide file tree
Showing 18 changed files with 22,157 additions and 80 deletions.
6 changes: 3 additions & 3 deletions packages/sdk-ark/source/coin.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ export class ServiceProvider extends IoC.AbstractServiceProvider implements IoC.
]);

const dataCrypto = crypto.json().data;
const dataStatus = status.json().data;
const { height } = status.json().data;

if (dataCrypto.network.client.token !== this.configRepository.get(Coins.ConfigKey.CurrencyTicker)) {
throw new Error(`Failed to connect to ${peer} because it is on another network.`);
}

Managers.configManager.setConfig(dataCrypto);
Managers.configManager.setHeight(dataStatus.height);
Managers.configManager.setHeight(height);

if (container.missing(BindingType.Crypto)) {
container.constant(BindingType.Crypto, dataCrypto);
}

if (container.missing(BindingType.Height)) {
container.constant(BindingType.Height, dataStatus.height);
container.constant(BindingType.Height, height);
}
}
}
4 changes: 2 additions & 2 deletions packages/sdk-ark/source/networks/ark.devnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ const network: Networks.NetworkManifest = {
hosts: [
{
type: "full",
host: "https://dwallets.ark.io/api",
host: "https://ark-test.payvo.com/api",
},
{
type: "musig",
host: "https://dmusig1.ark.io",
host: "https://ark-test-musig.payvo.com",
},
{
type: "explorer",
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk-ark/source/networks/ark.mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ const network: Networks.NetworkManifest = {
hosts: [
{
type: "full",
host: "https://wallets.ark.io/api",
host: "https://ark-live.payvo.com/api",
},
{
type: "musig",
host: "https://musig1.ark.io",
host: "https://ark-live-musig.payvo.com",
},
{
type: "explorer",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-lsk/source/client-three.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class ClientService extends Services.AbstractClientService {

@IoC.postConstruct()
private onPostConstruct(): void {
this.#peer = Helpers.randomHostFromConfig(this.configRepository, "archival");
this.#peer = Helpers.randomHostFromConfig(this.configRepository, "full");
}

public override async transaction(
Expand Down
62 changes: 3 additions & 59 deletions packages/sdk-lsk/source/networks/lsk.mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,67 +18,11 @@ const network: Networks.NetworkManifest = {
hosts: [
{
type: "full",
host: "https://hub21.lisk.io",
host: "https://lsk-live.payvo.com",
},
{
type: "full",
host: "https://hub22.lisk.io",
},
{
type: "full",
host: "https://hub23.lisk.io",
},
{
type: "full",
host: "https://hub24.lisk.io",
},
{
type: "full",
host: "https://hub25.lisk.io",
},
{
type: "full",
host: "https://hub26.lisk.io",
},
{
type: "full",
host: "https://hub27.lisk.io",
},
{
type: "full",
host: "https://hub28.lisk.io",
},
{
type: "full",
host: "https://hub31.lisk.io",
},
{
type: "full",
host: "https://hub32.lisk.io",
},
{
type: "full",
host: "https://hub33.lisk.io",
},
{
type: "full",
host: "https://hub34.lisk.io",
},
{
type: "full",
host: "https://hub35.lisk.io",
},
{
type: "full",
host: "https://hub36.lisk.io",
},
{
type: "full",
host: "https://hub37.lisk.io",
},
{
type: "full",
host: "https://hub38.lisk.io",
type: "musig",
host: "https://lsk-live-musig.payvo.com",
},
{
type: "explorer",
Expand Down
8 changes: 2 additions & 6 deletions packages/sdk-lsk/source/networks/lsk.testnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@ const network: Networks.NetworkManifest = {
hosts: [
{
type: "full",
host: "https://testnet.lisk.io",
},
{
type: "archival",
host: "https://testnet-service.lisktools.eu/api/v2",
host: "https://lsk-test.payvo.com/api/v2",
},
{
type: "musig",
host: "http://localhost:3000",
host: "https://lsk-test-musig.payvo.com",
},
{
type: "explorer",
Expand Down
29 changes: 29 additions & 0 deletions packages/sdk/source/coins/coin-factory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,42 @@ import "jest-extended";
import "reflect-metadata";

import { Request } from "@payvo/http-got";
import nock from "nock";

import { ARK } from "../../../sdk-ark/source";
import { Coin } from "./coin";
import { CoinFactory } from "./coin-factory";

const options = { network: "ark.mainnet", httpClient: new Request() };

beforeAll(async () => {
nock.disableNetConnect();

nock("https://ark-live.payvo.com")
.get("/api/blockchain")
.reply(200, require("../../test/livenet/blockchain.json"))
.get("/api/node/configuration")
.reply(200, require("../../test/livenet/configuration.json"))
.get("/api/node/configuration/crypto")
.reply(200, require("../../test/livenet/configuration-crypto.json"))
.get("/api/node/syncing")
.reply(200, require("../../test/livenet/syncing.json"))
.persist();

nock("https://ark-test.payvo.com")
.get("/api/blockchain")
.reply(200, require("../../test/testnet/blockchain.json"))
.get("/api/node/configuration")
.reply(200, require("../../test/testnet/configuration.json"))
.get("/api/node/configuration/crypto")
.reply(200, require("../../test/testnet/configuration-crypto.json"))
.get("/api/node/syncing")
.reply(200, require("../../test/testnet/syncing.json"))
.persist();
});

afterAll(() => nock.cleanAll());

it("should create an instance", async () => {
expect(CoinFactory.make(ARK, options)).toBeInstanceOf(Coin);
});
Expand Down
16 changes: 16 additions & 0 deletions packages/sdk/source/coins/coin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import "jest-extended";
import "reflect-metadata";

import { Request } from "@payvo/http-got";
import nock from "nock";

import { ARK } from "../../../sdk-ark/source";
import { Network, NetworkRepository } from "../networks";
Expand All @@ -13,12 +14,27 @@ import { Manifest } from "./manifest";
let subject: Coin;

beforeEach(async () => {
nock.disableNetConnect();

nock(/.+/)
.get("/api/blockchain")
.reply(200, require("../../test/testnet/blockchain.json"))
.get("/api/node/configuration")
.reply(200, require("../../test/testnet/configuration.json"))
.get("/api/node/configuration/crypto")
.reply(200, require("../../test/testnet/configuration-crypto.json"))
.get("/api/node/syncing")
.reply(200, require("../../test/testnet/syncing.json"))
.persist();

subject = CoinFactory.make(ARK, {
network: "ark.devnet",
httpClient: new Request(),
});
});

afterEach(() => nock.cleanAll());

test("#construct", async () => {
expect(() => subject.address()).toThrow(/No matching bindings found for serviceIdentifier/);
expect(() => subject.bigNumber()).toThrow(/No matching bindings found for serviceIdentifier/);
Expand Down
8 changes: 4 additions & 4 deletions packages/sdk/source/networks/network-repository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ test("#all", () => {
},
"hosts": Array [
Object {
"host": "https://dwallets.ark.io/api",
"host": "https://ark-test.payvo.com/api",
"type": "full",
},
Object {
"host": "https://dmusig1.ark.io",
"host": "https://ark-test-musig.payvo.com",
"type": "musig",
},
Object {
Expand Down Expand Up @@ -284,11 +284,11 @@ test("#all", () => {
},
"hosts": Array [
Object {
"host": "https://wallets.ark.io/api",
"host": "https://ark-live.payvo.com/api",
"type": "full",
},
Object {
"host": "https://musig1.ark.io",
"host": "https://ark-live-musig.payvo.com",
"type": "musig",
},
Object {
Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/source/networks/network.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,11 @@ it("should have an object representation", () => {
},
"hosts": Array [
Object {
"host": "https://dwallets.ark.io/api",
"host": "https://ark-test.payvo.com/api",
"type": "full",
},
Object {
"host": "https://dmusig1.ark.io",
"host": "https://ark-test-musig.payvo.com",
"type": "musig",
},
Object {
Expand Down Expand Up @@ -304,7 +304,7 @@ it("should have an object representation", () => {

it("should have an string representation", () => {
expect(subject.toJson()).toMatchInlineSnapshot(
`"{\\"id\\":\\"ark.devnet\\",\\"type\\":\\"test\\",\\"name\\":\\"Devnet\\",\\"coin\\":\\"ARK\\",\\"currency\\":{\\"ticker\\":\\"DARK\\",\\"symbol\\":\\"DѦ\\",\\"decimals\\":8},\\"constants\\":{\\"slip44\\":1},\\"hosts\\":[{\\"type\\":\\"full\\",\\"host\\":\\"https://dwallets.ark.io/api\\"},{\\"type\\":\\"musig\\",\\"host\\":\\"https://dmusig1.ark.io\\"},{\\"type\\":\\"explorer\\",\\"host\\":\\"https://dexplorer.ark.io\\"}],\\"governance\\":{\\"delegateCount\\":51,\\"votesPerWallet\\":1,\\"votesPerTransaction\\":1},\\"transactions\\":{\\"expirationType\\":\\"height\\",\\"types\\":[\\"delegate-registration\\",\\"delegate-resignation\\",\\"htlc-claim\\",\\"htlc-lock\\",\\"htlc-refund\\",\\"ipfs\\",\\"multi-payment\\",\\"multi-signature\\",\\"second-signature\\",\\"transfer\\",\\"vote\\"],\\"fees\\":{\\"type\\":\\"dynamic\\",\\"ticker\\":\\"DARK\\"},\\"memo\\":true,\\"multiPaymentRecipients\\":128},\\"importMethods\\":{\\"address\\":{\\"default\\":false,\\"permissions\\":[\\"read\\"]},\\"bip39\\":{\\"default\\":true,\\"permissions\\":[\\"read\\",\\"write\\"],\\"canBeEncrypted\\":true},\\"publicKey\\":{\\"default\\":false,\\"permissions\\":[\\"read\\"]},\\"secret\\":{\\"default\\":false,\\"permissions\\":[\\"read\\",\\"write\\"],\\"canBeEncrypted\\":true}},\\"featureFlags\\":{\\"Client\\":[\\"transaction\\",\\"transactions\\",\\"wallet\\",\\"wallets\\",\\"delegate\\",\\"delegates\\",\\"votes\\",\\"voters\\",\\"broadcast\\"],\\"Fee\\":[\\"all\\"],\\"Address\\":[\\"mnemonic.bip39\\",\\"multiSignature\\",\\"privateKey\\",\\"publicKey\\",\\"validate\\",\\"wif\\"],\\"KeyPair\\":[\\"mnemonic.bip39\\",\\"privateKey\\",\\"wif\\"],\\"PrivateKey\\":[\\"mnemonic.bip39\\",\\"wif\\"],\\"PublicKey\\":[\\"mnemonic.bip39\\",\\"multiSignature\\",\\"wif\\"],\\"WIF\\":[\\"mnemonic.bip39\\"],\\"Ledger\\":[\\"getVersion\\",\\"getPublicKey\\",\\"signTransaction\\",\\"signMessage\\"],\\"Message\\":[\\"sign\\",\\"verify\\"],\\"Transaction\\":[\\"delegateRegistration\\",\\"delegateResignation\\",\\"estimateExpiration\\",\\"htlcClaim\\",\\"htlcLock\\",\\"htlcRefund\\",\\"ipfs.ledgerS\\",\\"ipfs.ledgerX\\",\\"ipfs.musig\\",\\"ipfs\\",\\"multiPayment.ledgerS\\",\\"multiPayment.ledgerX\\",\\"multiPayment.musig\\",\\"multiPayment\\",\\"multiSignature.ledgerX\\",\\"multiSignature.musig\\",\\"multiSignature\\",\\"secondSignature\\",\\"transfer.ledgerS\\",\\"transfer.ledgerX\\",\\"transfer.musig\\",\\"transfer\\",\\"vote.ledgerS\\",\\"vote.ledgerX\\",\\"vote.musig\\",\\"vote\\"]},\\"explorer\\":{\\"block\\":\\"block/{0}\\",\\"transaction\\":\\"transaction/{0}\\",\\"wallet\\":\\"wallets/{0}\\"},\\"knownWallets\\":\\"https://raw.githubusercontent.com/ArkEcosystem/common/master/devnet/known-wallets-extended.json\\",\\"meta\\":{\\"fastDelegateSync\\":true}}"`,
`"{\\"id\\":\\"ark.devnet\\",\\"type\\":\\"test\\",\\"name\\":\\"Devnet\\",\\"coin\\":\\"ARK\\",\\"currency\\":{\\"ticker\\":\\"DARK\\",\\"symbol\\":\\"DѦ\\",\\"decimals\\":8},\\"constants\\":{\\"slip44\\":1},\\"hosts\\":[{\\"type\\":\\"full\\",\\"host\\":\\"https://ark-test.payvo.com/api\\"},{\\"type\\":\\"musig\\",\\"host\\":\\"https://ark-test-musig.payvo.com\\"},{\\"type\\":\\"explorer\\",\\"host\\":\\"https://dexplorer.ark.io\\"}],\\"governance\\":{\\"delegateCount\\":51,\\"votesPerWallet\\":1,\\"votesPerTransaction\\":1},\\"transactions\\":{\\"expirationType\\":\\"height\\",\\"types\\":[\\"delegate-registration\\",\\"delegate-resignation\\",\\"htlc-claim\\",\\"htlc-lock\\",\\"htlc-refund\\",\\"ipfs\\",\\"multi-payment\\",\\"multi-signature\\",\\"second-signature\\",\\"transfer\\",\\"vote\\"],\\"fees\\":{\\"type\\":\\"dynamic\\",\\"ticker\\":\\"DARK\\"},\\"memo\\":true,\\"multiPaymentRecipients\\":128},\\"importMethods\\":{\\"address\\":{\\"default\\":false,\\"permissions\\":[\\"read\\"]},\\"bip39\\":{\\"default\\":true,\\"permissions\\":[\\"read\\",\\"write\\"],\\"canBeEncrypted\\":true},\\"publicKey\\":{\\"default\\":false,\\"permissions\\":[\\"read\\"]},\\"secret\\":{\\"default\\":false,\\"permissions\\":[\\"read\\",\\"write\\"],\\"canBeEncrypted\\":true}},\\"featureFlags\\":{\\"Client\\":[\\"transaction\\",\\"transactions\\",\\"wallet\\",\\"wallets\\",\\"delegate\\",\\"delegates\\",\\"votes\\",\\"voters\\",\\"broadcast\\"],\\"Fee\\":[\\"all\\"],\\"Address\\":[\\"mnemonic.bip39\\",\\"multiSignature\\",\\"privateKey\\",\\"publicKey\\",\\"validate\\",\\"wif\\"],\\"KeyPair\\":[\\"mnemonic.bip39\\",\\"privateKey\\",\\"wif\\"],\\"PrivateKey\\":[\\"mnemonic.bip39\\",\\"wif\\"],\\"PublicKey\\":[\\"mnemonic.bip39\\",\\"multiSignature\\",\\"wif\\"],\\"WIF\\":[\\"mnemonic.bip39\\"],\\"Ledger\\":[\\"getVersion\\",\\"getPublicKey\\",\\"signTransaction\\",\\"signMessage\\"],\\"Message\\":[\\"sign\\",\\"verify\\"],\\"Transaction\\":[\\"delegateRegistration\\",\\"delegateResignation\\",\\"estimateExpiration\\",\\"htlcClaim\\",\\"htlcLock\\",\\"htlcRefund\\",\\"ipfs.ledgerS\\",\\"ipfs.ledgerX\\",\\"ipfs.musig\\",\\"ipfs\\",\\"multiPayment.ledgerS\\",\\"multiPayment.ledgerX\\",\\"multiPayment.musig\\",\\"multiPayment\\",\\"multiSignature.ledgerX\\",\\"multiSignature.musig\\",\\"multiSignature\\",\\"secondSignature\\",\\"transfer.ledgerS\\",\\"transfer.ledgerX\\",\\"transfer.musig\\",\\"transfer\\",\\"vote.ledgerS\\",\\"vote.ledgerX\\",\\"vote.musig\\",\\"vote\\"]},\\"explorer\\":{\\"block\\":\\"block/{0}\\",\\"transaction\\":\\"transaction/{0}\\",\\"wallet\\":\\"wallets/{0}\\"},\\"knownWallets\\":\\"https://raw.githubusercontent.com/ArkEcosystem/common/master/devnet/known-wallets-extended.json\\",\\"meta\\":{\\"fastDelegateSync\\":true}}"`,
);
});

Expand Down
9 changes: 9 additions & 0 deletions packages/sdk/test/livenet/blockchain.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"data": {
"block": {
"height": 16936265,
"id": "79f50b4523712563026520580d7e068274ba52801367eb7418c6327d0518f2d3"
},
"supply": "15872133200000004"
}
}
Loading

0 comments on commit 8fd2fd9

Please sign in to comment.