Skip to content

Commit 4806a51

Browse files
committed
updated Add basics/close-account/poseidon
1 parent 715a3b8 commit 4806a51

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

basics/close-account/poseidon/migrations/deploy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// single deploy script that's invoked from the CLI, injecting a provider
33
// configured from the workspace's Anchor.toml.
44

5-
const anchor = require("@coral-xyz/anchor");
5+
const anchor = require('@coral-xyz/anchor');
66

7-
module.exports = async function (provider) {
7+
module.exports = async (provider) => {
88
// Configure client to use the provider.
99
anchor.setProvider(provider);
1010

basics/close-account/poseidon/programs/close-account/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use anchor_lang::prelude::*;
2-
declare_id!("11111111111111111111111111111111");
2+
declare_id!("4So9Jbx672BRL9RvfB8Sux2NMVX5QJRnhmdWyij3kkFg");
33
#[program]
44
pub mod close_account {
55
use super::*;

basics/close-account/poseidon/tests/close-account.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1-
import * as anchor from "@coral-xyz/anchor";
2-
import { Program } from "@coral-xyz/anchor";
3-
import { CloseAccount } from "../target/types/close_account";
4-
import { assert } from "chai";
1+
import * as anchor from '@coral-xyz/anchor';
2+
import { Program } from '@coral-xyz/anchor';
3+
import { assert } from 'chai';
4+
import { CloseAccount } from '../target/types/close_account';
55

6-
describe("close-account", () => {
6+
describe('close-account', () => {
77
// Configure the client to use the local cluster.
88
const provider = anchor.AnchorProvider.env();
99
anchor.setProvider(provider);
1010

1111
const program = anchor.workspace.CloseAccount as Program<CloseAccount>;
1212
const user = provider.wallet;
1313

14-
const accountState = anchor.web3.PublicKey.findProgramAddressSync(
15-
[anchor.utils.bytes.utf8.encode("account")],
16-
program.programId
17-
)[0];
14+
const accountState = anchor.web3.PublicKey.findProgramAddressSync([anchor.utils.bytes.utf8.encode('account')], program.programId)[0];
1815
const someData = Math.floor(Math.random() * 100);
1916

20-
it("Can initalize an account", async () => {
17+
it('Can initalize an account', async () => {
2118
await program.methods
2219
.initalize(someData)
2320
.accounts({
@@ -27,7 +24,7 @@ describe("close-account", () => {
2724
const acc = await program.account.accountState.fetchNullable(accountState);
2825
assert.notEqual(acc, null);
2926
});
30-
it("Can close an account", async () => {
27+
it('Can close an account', async () => {
3128
await program.methods
3229
.close()
3330
.accounts({

basics/close-account/poseidon/ts-programs/closeAccounts.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { Account, Pubkey, Result, u8, Signer } from "@solanaturbine/poseidon";
1+
import { Account, Pubkey, Result, Signer, u8 } from '@solanaturbine/poseidon';
22

33
export default class CloseAccount {
4-
static PROGRAM_ID = new Pubkey("11111111111111111111111111111111");
4+
static PROGRAM_ID = new Pubkey('11111111111111111111111111111111');
55

66
initalize(state: AccountState, user: Signer, data: u8): Result {
7-
state.derive(["account"]).init();
7+
state.derive(['account']).init();
88
state.someData = data;
99
}
1010
close(state: AccountState, user: Signer): Result {
11-
state.derive(["account"]).close(user);
11+
state.derive(['account']).close(user);
1212
}
1313
}
1414

0 commit comments

Comments
 (0)