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

apply changed event in v1.0.0-rc6 #88

Merged
merged 6 commits into from
Apr 26, 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
18 changes: 13 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ and this project adheres to
## [Unreleased]

### Added
- [\#69](https://github.com/Finschia/finschia-js/pull/69) apply the changes of `x/token` and `x/collection` protos
- [\#71](https://github.com/Finschia/finschia-js/pull/71) @lbmjs/finschia: Add custom GetBlockWithTxs for lbm
- [\#77](https://github.com/Finschia/finschia-js/pull/77) @lbmjs/finschia: Enable amino sign store msgs in `wasm` and `wasmplus`
- [\#80](https://github.com/Finschia/finschia-js/pull/80) add MsgInstantiateContract2

- [\#69](https://github.com/Finschia/finschia-js/pull/69) apply the changes of
loin3 marked this conversation as resolved.
Show resolved Hide resolved
`x/token` and `x/collection` protos
- [\#71](https://github.com/Finschia/finschia-js/pull/71) @lbmjs/finschia: Add
custom GetBlockWithTxs for lbm
- [\#77](https://github.com/Finschia/finschia-js/pull/77) @lbmjs/finschia:
Enable amino sign store msgs in `wasm` and `wasmplus`
- [\#80](https://github.com/Finschia/finschia-js/pull/80) add
MsgInstantiateContract2
- [\#81](https://github.com/Finschia/finschia-js/pull/81) add git PR template
- [\#87](https://github.com/Finschia/finschia-js/pull/87) @lbmjs/finschia: add tests for grpc errors in collection, token
- [\#87](https://github.com/Finschia/finschia-js/pull/87) @lbmjs/finschia: add
tests for grpc errors in collection, token

### Changed

Expand All @@ -29,6 +35,8 @@ and this project adheres to

- [\#73](https://github.com/Finschia/finschia-js/pull/73) fix the local unit
test error
- [\#88](https://github.com/Finschia/finschia-js/pull/88) apply changed event in
finschia v1.0.0-rc6 to pass tests

### Security

Expand Down
11 changes: 11 additions & 0 deletions packages/finschia/src/errors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// error class for https://github.com/cosmos/cosmjs/blob/main/packages/stargate/src/queryclient/queryclient.ts#L582
export class QueryRpcFailError extends Error {
public readonly code: number;
public readonly log: string;

public constructor(code: number, log: string) {
super(`Query failed with (${code}): ${log}`);
this.code = code;
this.log = log;
}
}
19 changes: 13 additions & 6 deletions packages/finschia/src/modules/collection/queries.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describe("CollectionExtension (fungible token)", () => {
};
const result = await client.signAndBroadcast(owner, [msgIssueFT], defaultFee);
const parsedLogs = logs.parseRawLog(result.rawLog);
tokenId = logs.findAttribute(parsedLogs, "issue_ft", "token_id").value;
tokenId = logs.findAttribute(parsedLogs, "lbm.collection.v1.EventCreatedFTClass", "token_id").value;
assert(tokenId, "Missing token ID");
tokenId = tokenId.replace(/^"(.*)"$/, "$1");
assertIsDeliverTxSuccess(result);
Expand Down Expand Up @@ -298,7 +298,11 @@ describe("CollectionExtension (non-fungible token)", () => {
};
const result = await client.signAndBroadcast(owner, [msgIssueNFT], defaultFee);
const parsedLogs = logs.parseRawLog(result.rawLog);
tokenType = logs.findAttribute(parsedLogs, "issue_nft", "token_type").value;
tokenType = logs.findAttribute(
parsedLogs,
"lbm.collection.v1.EventCreatedNFTClass",
"token_type",
).value;
assert(tokenType, "Missing contract ID");
tokenType = tokenType.replace(/^"(.*)"$/, "$1");
assertIsDeliverTxSuccess(result);
Expand All @@ -323,7 +327,8 @@ describe("CollectionExtension (non-fungible token)", () => {
};
const result = await client.signAndBroadcast(owner, [msgMintNFT], defaultFee);
const parsedLogs = logs.parseRawLog(result.rawLog);
tokenId1 = logs.findAttribute(parsedLogs, "mint_nft", "token_id").value;
const tokens = logs.findAttribute(parsedLogs, "lbm.collection.v1.EventMintedNFT", "tokens").value;
tokenId1 = JSON.parse(tokens)[0].token_id;
assertIsDeliverTxSuccess(result);
}

Expand All @@ -346,7 +351,8 @@ describe("CollectionExtension (non-fungible token)", () => {
};
const result = await client.signAndBroadcast(owner, [msgMintNFT], defaultFee);
const parsedLogs = logs.parseRawLog(result.rawLog);
tokenId2 = logs.findAttribute(parsedLogs, "mint_nft", "token_id").value;
const tokens = logs.findAttribute(parsedLogs, "lbm.collection.v1.EventMintedNFT", "tokens").value;
tokenId2 = JSON.parse(tokens)[0].token_id;
assertIsDeliverTxSuccess(result);
}

Expand All @@ -369,7 +375,8 @@ describe("CollectionExtension (non-fungible token)", () => {
};
const result = await client.signAndBroadcast(owner, [msgMintNFT], defaultFee);
const parsedLogs = logs.parseRawLog(result.rawLog);
tokenId3 = logs.findAttribute(parsedLogs, "mint_nft", "token_id").value;
const tokens = logs.findAttribute(parsedLogs, "lbm.collection.v1.EventMintedNFT", "tokens").value;
tokenId3 = JSON.parse(tokens)[0].token_id;
assertIsDeliverTxSuccess(result);
}

Expand All @@ -381,7 +388,7 @@ describe("CollectionExtension (non-fungible token)", () => {
contractId: contractId,
from: owner,
to: toAddr,
tokenIds: [tokenId2],
tokenIds: [tokenId2!],
},
};
const result = await client.signAndBroadcast(owner, [MsgSendNFT], defaultFee);
Expand Down
Loading