mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-11 14:09:15 +00:00
Test transfer event's amount attribute
This commit is contained in:
parent
a2570f24b3
commit
9e1d369523
@ -214,9 +214,16 @@ describe("RestClient", () => {
|
||||
expect(result.code).toBeFalsy();
|
||||
// console.log("Raw log:", result.raw_log);
|
||||
const [firstLog] = parseSuccess(result.raw_log);
|
||||
const contractAddressAttr = firstLog.events[0].attributes.find(
|
||||
attr => attr.key === "contract_address",
|
||||
);
|
||||
|
||||
const amountAttr = firstLog.events
|
||||
.find(event => event.type === "transfer")
|
||||
?.attributes.find(attr => attr.key === "amount");
|
||||
if (!amountAttr) throw new Error("Could not find amount attribute");
|
||||
expect(amountAttr.value).toEqual("1234ucosm,321ustake");
|
||||
|
||||
const contractAddressAttr = firstLog.events
|
||||
.find(event => event.type === "message")
|
||||
?.attributes.find(attr => attr.key === "contract_address");
|
||||
if (!contractAddressAttr) throw new Error("Could not find contract_address attribute");
|
||||
contractAddress = contractAddressAttr.value || "";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user