Skip to content

Commit

Permalink
fix: add cosmos.tx to registry
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-Ixo committed Apr 9, 2023
1 parent 54c49a8 commit ddec336
Show file tree
Hide file tree
Showing 23 changed files with 575 additions and 191 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
RPC_URL=https://testnet.ixo.earth/rpc/ #https://impacthub-rpc.lavenderfive.com/ #http://localhost:26658/
# NEVER COMMIT MAINNET MNENOMICS!! Please be careful.
TESTER_MNEMONIC-"mango tattoo civil foam frog wheat venue rebuild cloth example alien taste"
ED_KEYS_MNEMONIC="office dance method praise twenty flush bacon stereo claw music what satisfy"
IBC_FROM_MNEMONIC="mango tattoo civil foam frog wheat venue rebuild cloth example alien taste"
IBC_TO_ADDRESS=ixo1tumrhpa5tpegdcs2nhwzft8maprttz66pvntc9
2 changes: 2 additions & 0 deletions __tests__/flows/claims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const claimsBasic = () =>
const res = await Entity.CreateEntity(
"protocol",
undefined,
"",
WalletUsers.charlie
);
protocol = utils.common.getValueFromEvents(res, "wasm", "token_id");
Expand Down Expand Up @@ -130,6 +131,7 @@ export const devnetClaims = () =>
const res = await Entity.CreateEntity(
"protocol",
undefined,
"",
WalletUsers.charlie
);
protocol = utils.common.getValueFromEvents(res, "wasm", "token_id");
Expand Down
4 changes: 2 additions & 2 deletions __tests__/flows/cosmos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ export const sendTokens = () =>
});

export const govDeposit = () =>
describe("/cosmos.gov.v1beta1.MsgDeposit", () => {
testMsg("/cosmos.bank.v1beta1.MsgSend", () => Cosmos.MsgDeposit(404));
describe("Testing deposit funds into proposals", () => {
testMsg("/cosmos.bank.v1beta1.MsgDeposit", () => Cosmos.MsgDeposit(434));
});
122 changes: 60 additions & 62 deletions __tests__/flows/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,68 +163,68 @@ export const supamotoEntities = () =>
});

// Save supamoto creator CELLNODE emerging cellnode
// let creator = "4kavdefz12wlefltwxr";
// test("Saving creator", async () => {
// const tester = getUser();
// const file = JSON.parse(
// getFileFromPath(["documents", "test-supamoto-creator.jsonld"], "ascii")
// );
// file["issuer"] = tester.did;
// file["credentialSubject"]["id"] = daoCredsIssuerDid;
// file["credentialSubject"]["logo"] = ecsLogo;
// let buff = Buffer.from(JSON.stringify(file));
// creator = (
// await customQueries.cellnode.uploadPublicDoc(
// "application/ld+json",
// buff.toString("base64"),
// undefined,
// cellNodeNetwork
// )
// ).key;
// console.log({ creator });
// expect(creator).toBeTruthy();
// });
let creator = "4kavdefz12wlefltwxr";
test("Saving creator", async () => {
const tester = getUser();
const file = JSON.parse(
getFileFromPath(["documents", "test-supamoto-creator.jsonld"], "ascii")
);
file["issuer"] = tester.did;
file["credentialSubject"]["id"] = daoCredsIssuerDid;
file["credentialSubject"]["logo"] = ecsLogo;
let buff = Buffer.from(JSON.stringify(file));
creator = (
await customQueries.cellnode.uploadPublicDoc(
"application/ld+json",
buff.toString("base64"),
undefined,
cellNodeNetwork
)
).key;
console.log({ creator });
expect(creator).toBeTruthy();
});

// Save supamoto administrator CELLNODE
// let administrator = "gm7528l8xd4lefltxcz";
// test("Saving administrator", async () => {
// const tester = getUser();
// const file = JSON.parse(
// getFileFromPath(
// ["documents", "test-supamoto-administrator.jsonld"],
// "ascii"
// )
// );
// file["issuer"] = tester.did;
// file["credentialSubject"]["id"] = daoCredsIssuerDid;
// file["credentialSubject"]["logo"] = ecsLogo;
// let buff = Buffer.from(JSON.stringify(file));
// administrator = (
// await customQueries.cellnode.uploadPublicDoc(
// "application/ld+json",
// buff.toString("base64"),
// undefined,
// cellNodeNetwork
// )
// ).key;
// console.log({ administrator });
// expect(administrator).toBeTruthy();
// });
let administrator = "gm7528l8xd4lefltxcz";
test("Saving administrator", async () => {
const tester = getUser();
const file = JSON.parse(
getFileFromPath(
["documents", "test-supamoto-administrator.jsonld"],
"ascii"
)
);
file["issuer"] = tester.did;
file["credentialSubject"]["id"] = daoCredsIssuerDid;
file["credentialSubject"]["logo"] = ecsLogo;
let buff = Buffer.from(JSON.stringify(file));
administrator = (
await customQueries.cellnode.uploadPublicDoc(
"application/ld+json",
buff.toString("base64"),
undefined,
cellNodeNetwork
)
).key;
console.log({ administrator });
expect(administrator).toBeTruthy();
});

// Save supamoto page CELLNODE
// let page = "zh211j0pb0llefltxre";
// test("Saving page", async () => {
// page = (
// await customQueries.cellnode.uploadPublicDoc(
// "application/json",
// getFileFromPath(["documents", "test-supamoto-page.json"]),
// undefined,
// cellNodeNetwork
// )
// ).key;
// console.log({ page });
// expect(page).toBeTruthy();
// });
let page = "zh211j0pb0llefltxre";
test("Saving page", async () => {
page = (
await customQueries.cellnode.uploadPublicDoc(
"application/json",
getFileFromPath(["documents", "test-supamoto-page.json"]),
undefined,
cellNodeNetwork
)
).key;
console.log({ page });
expect(page).toBeTruthy();
});

// Save supamoto projectCreds WEB3
let projectCreds =
Expand Down Expand Up @@ -299,7 +299,6 @@ export const supamotoEntities = () =>
expect(tokenMetadata).toBeTruthy();
});

// TODO need protocol to add as template id
// Save supamoto claims CELLNODE
let claims = "gf9m2u5ds6tleflu4a8";
test("Saving claims", async () => {
Expand All @@ -315,11 +314,10 @@ export const supamotoEntities = () =>
expect(claims).toBeTruthy();
});

// TODO cookstove-asset-protocol
// Create a base Protocol entity
let protocolDid = "did:ixo:entity:065ba0b99948e2e8ff3228836dee423b";
testMsg("/ixo.entity.v1beta1.MsgCreateEntity protocol", async () => {
const res = await Entity.CreateEntity("protocol");
const res = await Entity.CreateEntity("protocol/asset");
protocolDid = utils.common.getValueFromEvents(res, "wasm", "token_id");
console.log({ protocolDid });
return res;
Expand All @@ -338,7 +336,7 @@ export const supamotoEntities = () =>
claims,
tokenMetadata,
projectCert: projectCreds,
oracle: daoCredsIssuerDid,
oracles: [daoCredsIssuerDid],
});
protocolAssetDid = utils.common.getValueFromEvents(
res,
Expand Down
16 changes: 8 additions & 8 deletions __tests__/flows/iids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ export const registerIids = () =>
Iid.CreateIidDoc(user)
);
});

// testQry(
// "test query",
// () => queryClient.ixo.bonds.v1beta1.bond({ bondDid: "adsf" }),
// {
// bonds: [],
// }
// );
});

// ------------------------------------------------------------
Expand Down Expand Up @@ -107,6 +99,14 @@ export const iidsBasic = () =>
testMsg("/ixo.iid.v1beta1.MsgDeleteService", () => Iid.DeleteService());
});

export const iidAddEdKeys = () =>
describe("Testing the Iid module adding ED keys to iid doc", () => {
testMsg("/ixo.iid.v1beta1.MsgAddVerification", () => Iid.AddVerification());
// testMsg("/ixo.iid.v1beta1.MsgRevokeVerification", () =>
// Iid.RevokeVerification()
// );
});

export const generateBlockchainTestUsers = () => {
beforeAll(() =>
generateNewWallet(
Expand Down
32 changes: 22 additions & 10 deletions __tests__/flows/quickQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,29 @@ export const quickQueries = () =>
describe("Quick queries to see states", () => {
test("Quick queries to see states filler", () => expect(true).toBeTruthy());

// test("Query cosmos.tx.v1beta1.getBlockWithTxs", async () => {
// const res = await queryClient.cosmos.tx.v1beta1.getTx({
// hash: "C35404333376CD5FC1AFD57903061394F0333CF6B8047E9A693E0E59350AE695",
// test("Query ixo.bonds.v1beta1", async () => {
// const res = await queryClient.ixo.bonds.v1beta1.bondsDetailed();
// console.log(res.bondsDetailed);
// expect(res).toBeTruthy();
// });

// test("Query cosmos.tx.v1beta1.getTxsEvent", async () => {
// const res = await queryClient.cosmos.tx.v1beta1.getTxsEvent({
// events: [`tx.height=${15955}`],
// orderBy: 1,
// });
// console.log(res.txResponse?.events);
// // console.log(res);
// console.log(res.txResponses[0]);
// console.log(createRegistry().decode(res.txResponses[0].tx!));
// expect(res).toBeTruthy();
// });

// test("Query cosmos.tx.v1beta1.getBlockByHeight", async () => {
// const res =
// await queryClient.cosmos.base.tendermint.v1beta1.getBlockByHeight({
// height: Long.fromNumber(15955),
// });
// console.log(res);
// expect(res).toBeTruthy();
// });

Expand Down Expand Up @@ -68,12 +86,6 @@ export const quickQueries = () =>
// expect(res).toBeTruthy();
// });

// test("query wasm store codes", async () => {
// const res = await queryClient.cosmwasm.wasm.v1.codes();
// console.log(res.codeInfos);
// expect(res).toBeTruthy();
// });

// test("query tokens list by did", async () => {
// const user = (await getUser(WalletUsers.tester).getAccounts())[0].address;
// const res = await queryClient.ixo.token.v1beta1.tokenList({
Expand Down
2 changes: 2 additions & 0 deletions __tests__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
registerIids,
registerIidsDev,
generateBlockchainTestUsers,
iidAddEdKeys,
} from "./flows/iids";
import { enititiesBasic, supamotoEntities } from "./flows/entities";
import { ibcBasic } from "./flows/ibc";
Expand All @@ -37,6 +38,7 @@ generateBlockchainTestUsers();
// registerIids();
// instantiateModulesProposals();
// iidsBasic();
// iidAddEdKeys();
// bondsBasic();
// bondsSellsDisabled();
// bondsSellsEnabled();
Expand Down
2 changes: 1 addition & 1 deletion __tests__/modules/Cosmos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const MsgSubmitProposalStoreCW = async (
value: cosmwasm.wasm.v1.StoreCodeProposal.encode(
cosmwasm.wasm.v1.StoreCodeProposal.fromPartial({
title: `Upload ${contract} smart contract`,
description: "Description",
description: "A cosmwasm smart contract",
runAs: myAddress,
wasmByteCode: new Uint8Array(
getFileFromPath(
Expand Down
Loading

0 comments on commit ddec336

Please sign in to comment.