Skip to content

Commit

Permalink
Merge pull request #20 from cosmology-tech/injective-test
Browse files Browse the repository at this point in the history
Injective test
  • Loading branch information
Zetazzz authored Jun 10, 2024
2 parents b5ac417 + 81450a6 commit f094491
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 124 deletions.
9 changes: 4 additions & 5 deletions networks/injective/starship/__tests__/gov.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ describe("Governance tests for injective", () => {
denom = getCoin().base;

// Initialize auth
const directAuth = Secp256k1Auth.fromMnemonic(generateMnemonic());
const aminoAuth = Secp256k1Auth.fromMnemonic(generateMnemonic());
const directAuth = Secp256k1Auth.fromMnemonic(generateMnemonic()).derive('injective');
const aminoAuth = Secp256k1Auth.fromMnemonic(generateMnemonic()).derive('injective');
directSigner = new DirectSigner(
directAuth,
toEncoders(MsgDelegate, TextProposal, MsgSubmitProposal, MsgVote),
Expand Down Expand Up @@ -81,7 +81,7 @@ describe("Governance tests for injective", () => {
denom,
});

expect(balance!.amount).toEqual("10000000000");
expect(balance!.amount).toEqual("10000000000000000000000");
}, 10000);

it("check amino address has tokens", async () => {
Expand All @@ -90,7 +90,7 @@ describe("Governance tests for injective", () => {
denom,
});

expect(balance!.amount).toEqual("10000000000");
expect(balance!.amount).toEqual("10000000000000000000000");
}, 10000);

it("query validator address", async () => {
Expand Down Expand Up @@ -153,7 +153,6 @@ describe("Governance tests for injective", () => {
description: "Test text proposal for the e2e testing",
});

// Stake half of the tokens
const msg = {
typeUrl: MsgSubmitProposal.typeUrl,
value: MsgSubmitProposal.fromPartial({
Expand Down
6 changes: 3 additions & 3 deletions networks/injective/starship/__tests__/staking.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("Staking tokens testing", () => {

const mnemonic = generateMnemonic();
// Initialize auth
const auth = Secp256k1Auth.fromMnemonic(mnemonic);
const auth = Secp256k1Auth.fromMnemonic(mnemonic).derive("injective");
directSigner = new DirectSigner(
auth,
toEncoders(MsgDelegate),
Expand All @@ -51,7 +51,7 @@ describe("Staking tokens testing", () => {
// Create custom cosmos interchain client
queryClient = new RpcQuery(getRpcEndpoint());

// Transfer injective and ibc tokens to address, send only osmo to address
// Transfer injective and ibc tokens to address, send only inj to address
await creditFromFaucet(address);
}, 200000);

Expand All @@ -61,7 +61,7 @@ describe("Staking tokens testing", () => {
denom,
});

expect(balance!.amount).toEqual("10000000000");
expect(balance!.amount).toEqual("10000000000000000000000");
}, 10000);

it("query validator address", async () => {
Expand Down
110 changes: 0 additions & 110 deletions networks/injective/starship/__tests__/testnet.test.ts

This file was deleted.

12 changes: 6 additions & 6 deletions networks/injective/starship/__tests__/token.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("Token transfers", () => {

const mnemonic = generateMnemonic();
// Initialize auth
const auth = Secp256k1Auth.fromMnemonic(mnemonic);
const auth = Secp256k1Auth.fromMnemonic(mnemonic).derive("injective");
directSigner = new DirectSigner(auth, [], getRpcEndpoint(), {
prefix: chainInfo.chain.bech32_prefix,
});
Expand All @@ -45,7 +45,7 @@ describe("Token transfers", () => {
it("send injective token to address", async () => {
const mnemonic = generateMnemonic();
// Initialize wallet
const auth2 = Secp256k1Auth.fromMnemonic(mnemonic);
const auth2 = Secp256k1Auth.fromMnemonic(mnemonic).derive("injective");
const address2 = defaultSignerOptions.publicKey
.hash(auth2.getPublicKey(defaultSignerOptions.publicKey.isCompressed))
.toBech32(chainInfo.chain.bech32_prefix);
Expand All @@ -65,7 +65,7 @@ describe("Token transfers", () => {
denom,
};

// Transfer uosmo tokens from faceut
// Transfer inj tokens from faceut
directSigner.addEncoders(toEncoders(MsgSend));
await directSigner.signAndBroadcast(
[
Expand All @@ -85,13 +85,13 @@ describe("Token transfers", () => {
expect(balance!.denom).toEqual(denom);
}, 10000);

it("send ibc osmo tokens to address on cosmos chain", async () => {
it("send ibc inj tokens to address on cosmos chain", async () => {
const {
chainInfo: cosmosChainInfo,
getRpcEndpoint: cosmosRpcEndpoint,
} = useChain("cosmos");

const { getRpcEndpoint: osmosisRpcEndpoint } = useChain("injective");
// const { getRpcEndpoint: injRpcEndpoint } = useChain("injective");

// Initialize wallet address for cosmos chain
const cosmosAuth = Secp256k1Auth.fromMnemonic(generateMnemonic());
Expand Down Expand Up @@ -163,7 +163,7 @@ describe("Token transfers", () => {

await new Promise((resolve) => setTimeout(resolve, 6000));

// Check osmos in address on cosmos chain
// Check injs in address on cosmos chain
const cosmosQueryClient = new RpcQuery(cosmosRpcEndpoint());
const { balances } = await cosmosQueryClient.allBalances({
address: cosmosAddress,
Expand Down

0 comments on commit f094491

Please sign in to comment.