Skip to content

Commit

Permalink
version 0.3.3 snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jul 20, 2024
1 parent 5237351 commit f61463b
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 33 deletions.
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"useTabs": false,
"tabWidth": 2,
"arrowParens": "always",
"printWidth": 80
}
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions clients/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
"eslint": "^8.57.0",
"prettier": "^3.3.3",
"rimraf": "^5.0.5",
"tsup": "8.1.0",
"tsup": ">=8.0.0 <8.1.1",
"tsup": "^8.1.2",
"typedoc": "^0.25.12",
"typedoc-plugin-missing-exports": "^2.2.0",
"typescript": "^5.5.3"
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 21 additions & 21 deletions scripts/generate-clients.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env zx
import "zx/globals";
import * as k from "kinobi";
import { rootNodeFromAnchor } from "@kinobi-so/nodes-from-anchor";
import { renderVisitor as renderJavaScriptVisitor } from "@kinobi-so/renderers-js";
import { renderVisitor as renderRustVisitor } from "@kinobi-so/renderers-rust";
import { getAllProgramIdls } from "./utils.mjs";
import 'zx/globals';
import * as k from 'kinobi';
import { rootNodeFromAnchor } from '@kinobi-so/nodes-from-anchor';
import { renderVisitor as renderJavaScriptVisitor } from '@kinobi-so/renderers-js';
import { renderVisitor as renderRustVisitor } from '@kinobi-so/renderers-rust';
import { getAllProgramIdls } from './utils.mjs';

// Instanciate Kinobi.
const [idl, ...additionalIdls] = getAllProgramIdls().map(idl => rootNodeFromAnchor(require(idl)))
Expand All @@ -13,7 +13,7 @@ const kinobi = k.createFromRoot(idl, additionalIdls);
// Update programs.
kinobi.update(
k.updateProgramsVisitor({
"solanaProgramCounter": { name: "counter" },
'solanaProgramCounter': { name: 'counter' },
})
);

Expand All @@ -22,11 +22,11 @@ kinobi.update(
k.updateAccountsVisitor({
counter: {
seeds: [
k.constantPdaSeedNodeFromString("utf8", "counter"),
k.constantPdaSeedNodeFromString('utf8', 'counter'),
k.variablePdaSeedNode(
"authority",
'authority',
k.publicKeyTypeNode(),
"The authority of the counter account"
'The authority of the counter account'
),
],
},
Expand All @@ -37,15 +37,15 @@ kinobi.update(
kinobi.update(
k.updateInstructionsVisitor({
create: {
byteDeltas: [k.instructionByteDeltaNode(k.accountLinkNode("counter"))],
byteDeltas: [k.instructionByteDeltaNode(k.accountLinkNode('counter'))],
accounts: {
counter: { defaultValue: k.pdaValueNode("counter") },
payer: { defaultValue: k.accountValueNode("authority") },
counter: { defaultValue: k.pdaValueNode('counter') },
payer: { defaultValue: k.accountValueNode('authority') },
},
},
increment: {
accounts: {
counter: { defaultValue: k.pdaValueNode("counter") },
counter: { defaultValue: k.pdaValueNode('counter') },
},
arguments: {
amount: { defaultValue: k.noneValueNode() },
Expand All @@ -55,25 +55,25 @@ kinobi.update(
);

// Set account discriminators.
const key = (name) => ({ field: "key", value: k.enumValueNode("Key", name) });
const key = (name) => ({ field: 'key', value: k.enumValueNode('Key', name) });
kinobi.update(
k.setAccountDiscriminatorFromFieldVisitor({
counter: key("counter"),
counter: key('counter'),
})
);

// Render JavaScript.
const jsClient = path.join(__dirname, "..", "clients", "js");
const jsClient = path.join(__dirname, '..', 'clients', 'js');
kinobi.accept(
renderJavaScriptVisitor(path.join(jsClient, "src", "generated"), {
prettier: require(path.join(jsClient, ".prettierrc.json"))
renderJavaScriptVisitor(path.join(jsClient, 'src', 'generated'), {
prettierOptions: require(path.join(jsClient, '.prettierrc.json'))
})
);

// Render Rust.
const rustClient = path.join(__dirname, "..", "clients", "rust");
const rustClient = path.join(__dirname, '..', 'clients', 'rust');
kinobi.accept(
renderRustVisitor(path.join(rustClient, "src", "generated"), {
renderRustVisitor(path.join(rustClient, 'src', 'generated'), {
formatCode: true,
crateFolder: rustClient,
})
Expand Down

0 comments on commit f61463b

Please sign in to comment.