From 7901a3f4df81532eacfd53378b1d3c6680201dd8 Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Sat, 29 Jun 2024 12:12:02 +0400 Subject: [PATCH] fmt --- package.json | 4 +- tests/anchor-example/puppet.json | 159 ++++++++++------------- tests/anchor-example/puppet.ts | 162 ++++++++++-------------- tests/anchor-example/puppet_master.json | 116 +++++++---------- tests/anchor-example/puppet_master.ts | 119 ++++++++--------- tests/main.test.ts | 10 +- 6 files changed, 235 insertions(+), 335 deletions(-) diff --git a/package.json b/package.json index ede71c4..32a8f2f 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,7 @@ "version": "0.4.0", "main": "dist/index.js", "types": "dist/index.d.ts", - "files": [ - "dist/" - ], + "files": ["dist/"], "license": "MIT", "devDependencies": { "@coral-xyz/anchor": "^0.30.0", diff --git a/tests/anchor-example/puppet.json b/tests/anchor-example/puppet.json index 18326eb..3f2d116 100644 --- a/tests/anchor-example/puppet.json +++ b/tests/anchor-example/puppet.json @@ -1,95 +1,68 @@ { - "address": "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS", - "metadata": { - "name": "puppet", - "version": "0.1.0", - "spec": "0.1.0", - "description": "Created with Anchor" - }, - "instructions": [ - { - "name": "initialize", - "discriminator": [ - 175, - 175, - 109, - 31, - 13, - 152, - 155, - 237 - ], - "accounts": [ - { - "name": "puppet", - "writable": true, - "signer": true - }, - { - "name": "user", - "writable": true, - "signer": true - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [] - }, - { - "name": "set_data", - "discriminator": [ - 223, - 114, - 91, - 136, - 197, - 78, - 153, - 153 - ], - "accounts": [ - { - "name": "puppet", - "writable": true - } - ], - "args": [ - { - "name": "data", - "type": "u64" - } - ] - } - ], - "accounts": [ - { - "name": "Data", - "discriminator": [ - 206, - 156, - 59, - 188, - 18, - 79, - 240, - 232 - ] - } - ], - "types": [ - { - "name": "Data", - "type": { - "kind": "struct", - "fields": [ - { - "name": "data", - "type": "u64" - } - ] - } - } - ] + "address": "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS", + "metadata": { + "name": "puppet", + "version": "0.1.0", + "spec": "0.1.0", + "description": "Created with Anchor" + }, + "instructions": [ + { + "name": "initialize", + "discriminator": [175, 175, 109, 31, 13, 152, 155, 237], + "accounts": [ + { + "name": "puppet", + "writable": true, + "signer": true + }, + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ], + "args": [] + }, + { + "name": "set_data", + "discriminator": [223, 114, 91, 136, 197, 78, 153, 153], + "accounts": [ + { + "name": "puppet", + "writable": true + } + ], + "args": [ + { + "name": "data", + "type": "u64" + } + ] + } + ], + "accounts": [ + { + "name": "Data", + "discriminator": [206, 156, 59, 188, 18, 79, 240, 232] + } + ], + "types": [ + { + "name": "Data", + "type": { + "kind": "struct", + "fields": [ + { + "name": "data", + "type": "u64" + } + ] + } + } + ] } diff --git a/tests/anchor-example/puppet.ts b/tests/anchor-example/puppet.ts index ed94213..c9b4cac 100644 --- a/tests/anchor-example/puppet.ts +++ b/tests/anchor-example/puppet.ts @@ -5,98 +5,70 @@ * IDL can be found at `target/idl/puppet.json`. */ export type Puppet = { - "address": "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS", - "metadata": { - "name": "puppet", - "version": "0.1.0", - "spec": "0.1.0", - "description": "Created with Anchor" - }, - "instructions": [ - { - "name": "initialize", - "discriminator": [ - 175, - 175, - 109, - 31, - 13, - 152, - 155, - 237 - ], - "accounts": [ - { - "name": "puppet", - "writable": true, - "signer": true - }, - { - "name": "user", - "writable": true, - "signer": true - }, - { - "name": "systemProgram", - "address": "11111111111111111111111111111111" - } - ], - "args": [] - }, - { - "name": "setData", - "discriminator": [ - 223, - 114, - 91, - 136, - 197, - 78, - 153, - 153 - ], - "accounts": [ - { - "name": "puppet", - "writable": true - } - ], - "args": [ - { - "name": "data", - "type": "u64" - } - ] - } - ], - "accounts": [ - { - "name": "data", - "discriminator": [ - 206, - 156, - 59, - 188, - 18, - 79, - 240, - 232 - ] - } - ], - "types": [ - { - "name": "data", - "type": { - "kind": "struct", - "fields": [ - { - "name": "data", - "type": "u64" - } - ] - } - } - ] - }; - \ No newline at end of file + address: "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"; + metadata: { + name: "puppet"; + version: "0.1.0"; + spec: "0.1.0"; + description: "Created with Anchor"; + }; + instructions: [ + { + name: "initialize"; + discriminator: [175, 175, 109, 31, 13, 152, 155, 237]; + accounts: [ + { + name: "puppet"; + writable: true; + signer: true; + }, + { + name: "user"; + writable: true; + signer: true; + }, + { + name: "systemProgram"; + address: "11111111111111111111111111111111"; + }, + ]; + args: []; + }, + { + name: "setData"; + discriminator: [223, 114, 91, 136, 197, 78, 153, 153]; + accounts: [ + { + name: "puppet"; + writable: true; + }, + ]; + args: [ + { + name: "data"; + type: "u64"; + }, + ]; + }, + ]; + accounts: [ + { + name: "data"; + discriminator: [206, 156, 59, 188, 18, 79, 240, 232]; + }, + ]; + types: [ + { + name: "data"; + type: { + kind: "struct"; + fields: [ + { + name: "data"; + type: "u64"; + }, + ]; + }; + }, + ]; +}; diff --git a/tests/anchor-example/puppet_master.json b/tests/anchor-example/puppet_master.json index 16ccad0..148b7a6 100644 --- a/tests/anchor-example/puppet_master.json +++ b/tests/anchor-example/puppet_master.json @@ -1,69 +1,51 @@ { - "address": "HmbTLCmaGvZhKnn1Zfa1JVnp7vkMV4DYVxPLWBVoN65L", - "metadata": { - "name": "puppet_master", - "version": "0.1.0", - "spec": "0.1.0", - "description": "Created with Anchor" - }, - "instructions": [ - { - "name": "pull_strings", - "discriminator": [ - 13, - 252, - 243, - 149, - 120, - 132, - 189, - 145 - ], - "accounts": [ - { - "name": "puppet", - "writable": true - }, - { - "name": "puppet_program", - "address": "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" - } - ], - "args": [ - { - "name": "data", - "type": "u64" - } - ] - } - ], - "accounts": [ - { - "name": "Data", - "discriminator": [ - 206, - 156, - 59, - 188, - 18, - 79, - 240, - 232 - ] - } - ], - "types": [ - { - "name": "Data", - "type": { - "kind": "struct", - "fields": [ - { - "name": "data", - "type": "u64" - } - ] - } - } - ] + "address": "HmbTLCmaGvZhKnn1Zfa1JVnp7vkMV4DYVxPLWBVoN65L", + "metadata": { + "name": "puppet_master", + "version": "0.1.0", + "spec": "0.1.0", + "description": "Created with Anchor" + }, + "instructions": [ + { + "name": "pull_strings", + "discriminator": [13, 252, 243, 149, 120, 132, 189, 145], + "accounts": [ + { + "name": "puppet", + "writable": true + }, + { + "name": "puppet_program", + "address": "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" + } + ], + "args": [ + { + "name": "data", + "type": "u64" + } + ] + } + ], + "accounts": [ + { + "name": "Data", + "discriminator": [206, 156, 59, 188, 18, 79, 240, 232] + } + ], + "types": [ + { + "name": "Data", + "type": { + "kind": "struct", + "fields": [ + { + "name": "data", + "type": "u64" + } + ] + } + } + ] } diff --git a/tests/anchor-example/puppet_master.ts b/tests/anchor-example/puppet_master.ts index f1388c4..0de19ce 100644 --- a/tests/anchor-example/puppet_master.ts +++ b/tests/anchor-example/puppet_master.ts @@ -5,72 +5,53 @@ * IDL can be found at `target/idl/puppet_master.json`. */ export type PuppetMaster = { - "address": "HmbTLCmaGvZhKnn1Zfa1JVnp7vkMV4DYVxPLWBVoN65L", - "metadata": { - "name": "puppetMaster", - "version": "0.1.0", - "spec": "0.1.0", - "description": "Created with Anchor" - }, - "instructions": [ - { - "name": "pullStrings", - "discriminator": [ - 13, - 252, - 243, - 149, - 120, - 132, - 189, - 145 - ], - "accounts": [ - { - "name": "puppet", - "writable": true - }, - { - "name": "puppetProgram", - "address": "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" - } - ], - "args": [ - { - "name": "data", - "type": "u64" - } - ] - } - ], - "accounts": [ - { - "name": "data", - "discriminator": [ - 206, - 156, - 59, - 188, - 18, - 79, - 240, - 232 - ] - } - ], - "types": [ - { - "name": "data", - "type": { - "kind": "struct", - "fields": [ - { - "name": "data", - "type": "u64" - } - ] - } - } - ] - }; - \ No newline at end of file + address: "HmbTLCmaGvZhKnn1Zfa1JVnp7vkMV4DYVxPLWBVoN65L"; + metadata: { + name: "puppetMaster"; + version: "0.1.0"; + spec: "0.1.0"; + description: "Created with Anchor"; + }; + instructions: [ + { + name: "pullStrings"; + discriminator: [13, 252, 243, 149, 120, 132, 189, 145]; + accounts: [ + { + name: "puppet"; + writable: true; + }, + { + name: "puppetProgram"; + address: "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"; + }, + ]; + args: [ + { + name: "data"; + type: "u64"; + }, + ]; + }, + ]; + accounts: [ + { + name: "data"; + discriminator: [206, 156, 59, 188, 18, 79, 240, 232]; + }, + ]; + types: [ + { + name: "data"; + type: { + kind: "struct"; + fields: [ + { + name: "data"; + type: "u64"; + }, + ]; + }; + }, + ]; +}; diff --git a/tests/main.test.ts b/tests/main.test.ts index 65a2722..29d2153 100644 --- a/tests/main.test.ts +++ b/tests/main.test.ts @@ -11,10 +11,7 @@ test("anchor", async () => { const provider = new BankrunProvider(context); - const puppetProgram = new Program( - IDL, - provider, - ); + const puppetProgram = new Program(IDL, provider); const puppetKeypair = Keypair.generate(); await puppetProgram.methods @@ -44,10 +41,7 @@ test("error test", async () => { const provider = new BankrunProvider(context); - const puppetProgram = new Program( - IDL, - provider, - ); + const puppetProgram = new Program(IDL, provider); const puppetKeypair = Keypair.generate(); await puppetProgram.methods