Skip to content

Commit

Permalink
Refactor VisitReturns class to remove unused import and update fields…
Browse files Browse the repository at this point in the history
… property in index.ts
  • Loading branch information
b3hr4d committed May 2, 2024
1 parent a8e9e70 commit bd8af66
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
3 changes: 1 addition & 2 deletions packages/visitor/src/fields/returns/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import type {
ListReturns,
} from "./types"
import type { BaseActor, FunctionName } from "../../types"
import { VisitFields } from ".."

/**
* Visit the candid file and extract the fields.
Expand All @@ -44,7 +43,7 @@ export class VisitReturns<A = BaseActor> extends IDL.Visitor<
return {
type: "function",
label: functionName,
fields: t.name,
fields: t,
} as unknown as MethodReturns<A>
}

Expand Down
3 changes: 1 addition & 2 deletions packages/visitor/test/candid-field.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,7 @@
"fields": [
{
"type": "function",
"label": "callback",
"fields": "(record {start:nat64; length:nat64}) -> (variant {Ok:record {blocks:vec record {transaction:record {memo:nat64; icrc1_memo:opt vec nat8; operation:opt variant {Approve:record {fee:record {e8s:nat64}; from:vec nat8; allowance_e8s:int; allowance:record {e8s:nat64}; expected_allowance:opt record {e8s:nat64}; expires_at:opt record {timestamp_nanos:nat64}; spender:vec nat8}; Burn:record {from:vec nat8; amount:record {e8s:nat64}; spender:opt vec nat8}; Mint:record {to:vec nat8; amount:record {e8s:nat64}}; Transfer:record {to:vec nat8; fee:record {e8s:nat64}; from:vec nat8; amount:record {e8s:nat64}; spender:opt vec nat8}}; created_at_time:record {timestamp_nanos:nat64}}; timestamp:record {timestamp_nanos:nat64}; parent_hash:opt vec nat8}}; Err:variant {BadFirstBlockIndex:record {requested_index:nat64; first_valid_index:nat64}; Other:record {error_message:text; error_code:nat64}}}) query"
"label": "callback"
},
{
"type": "number",
Expand Down
1 change: 0 additions & 1 deletion packages/visitor/test/candid.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ describe("createReactorStore", () => {

it("should visitFunction", () => {
const json = jsonToString(visitedField())
console.log("🚀 ~ it ~ json:", json)
// execute json with fx in the terminal
writeFileSync(path.join(__dirname, "candid-field.json"), json)
})
Expand Down

0 comments on commit bd8af66

Please sign in to comment.