Skip to content

Commit

Permalink
lang: add missing #[serde(rename = "type")] to IdlConst (coral-xyz#1107)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinheavey authored Dec 5, 2021
1 parent 3321a3f commit 105bb20
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions lang/syn/src/idl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub struct Idl {
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct IdlConst {
pub name: String,
#[serde(rename = "type")]
pub ty: IdlType,
pub value: String,
}
Expand Down
6 changes: 3 additions & 3 deletions tests/misc/tests/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -839,15 +839,15 @@ describe("misc", () => {
it("Should include BASE const in IDL", async () => {
assert(
miscIdl.constants.find(
(c) => c.name === "BASE" && c.ty === "u128" && c.value === "1_000_000"
(c) => c.name === "BASE" && c.type === "u128" && c.value === "1_000_000"
) !== undefined
);
});

it("Should include DECIMALS const in IDL", async () => {
assert(
miscIdl.constants.find(
(c) => c.name === "DECIMALS" && c.ty === "u8" && c.value === "6"
(c) => c.name === "DECIMALS" && c.type === "u8" && c.value === "6"
) !== undefined
);
});
Expand All @@ -858,7 +858,7 @@ describe("misc", () => {
undefined
);
});

it("Can use multidimensional array", async () => {
const array2d = new Array(10).fill(new Array(10).fill(99));
const data = anchor.web3.Keypair.generate();
Expand Down

0 comments on commit 105bb20

Please sign in to comment.