Эх сурвалжийг харах

lang: add missing #[serde(rename = "type")] to IdlConst (#1107)

Kevin Heavey 3 жил өмнө
parent
commit
105bb203c0

+ 1 - 0
lang/syn/src/idl/mod.rs

@@ -27,6 +27,7 @@ pub struct Idl {
 #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
 #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
 pub struct IdlConst {
 pub struct IdlConst {
     pub name: String,
     pub name: String,
+    #[serde(rename = "type")]
     pub ty: IdlType,
     pub ty: IdlType,
     pub value: String,
     pub value: String,
 }
 }

+ 3 - 3
tests/misc/tests/misc.js

@@ -839,7 +839,7 @@ describe("misc", () => {
   it("Should include BASE const in IDL", async () => {
   it("Should include BASE const in IDL", async () => {
     assert(
     assert(
       miscIdl.constants.find(
       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
       ) !== undefined
     );
     );
   });
   });
@@ -847,7 +847,7 @@ describe("misc", () => {
   it("Should include DECIMALS const in IDL", async () => {
   it("Should include DECIMALS const in IDL", async () => {
     assert(
     assert(
       miscIdl.constants.find(
       miscIdl.constants.find(
-        (c) => c.name === "DECIMALS" && c.ty === "u8" && c.value === "6"
+        (c) => c.name === "DECIMALS" && c.type === "u8" && c.value === "6"
       ) !== undefined
       ) !== undefined
     );
     );
   });
   });
@@ -858,7 +858,7 @@ describe("misc", () => {
       undefined
       undefined
     );
     );
   });
   });
-  
+
   it("Can use multidimensional array", async () => {
   it("Can use multidimensional array", async () => {
     const array2d = new Array(10).fill(new Array(10).fill(99));
     const array2d = new Array(10).fill(new Array(10).fill(99));
     const data = anchor.web3.Keypair.generate();
     const data = anchor.web3.Keypair.generate();