forked from solana-developers/solana-cookbook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add prettier (solana-developers#356)
* Prettier Setup * Messed up a ts file to test * Messing up a .rs file to test * Messing up a .rs file again * Reverted the .rs file back to original * Format Script Added * Code Formatted
- Loading branch information
1 parent
a84f06e
commit 2a6ffb1
Showing
172 changed files
with
2,455 additions
and
1,519 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
docs | ||
node_modules | ||
.github | ||
.devcontainer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
(async () => { | ||
const connection = new Connection("http://localhost:8899", "confirmed"); | ||
async () => { | ||
const connection = new Connection("http://localhost:8899", "confirmed"); | ||
|
||
const [blogAccount] = await PublicKey.findProgramAddress( | ||
[Buffer.from("blog"), user.publicKey.toBuffer()], | ||
MY_PROGRAM_ID | ||
); | ||
const [blogAccount] = await PublicKey.findProgramAddress( | ||
[Buffer.from("blog"), user.publicKey.toBuffer()], | ||
MY_PROGRAM_ID | ||
); | ||
|
||
const [postAccount] = await PublicKey.findProgramAddress( | ||
[Buffer.from("post"), Buffer.from("slug-1"), user.publicKey.toBuffer()], | ||
MY_PROGRAM_ID | ||
); | ||
const [postAccount] = await PublicKey.findProgramAddress( | ||
[Buffer.from("post"), Buffer.from("slug-1"), user.publicKey.toBuffer()], | ||
MY_PROGRAM_ID | ||
); | ||
|
||
const blogAccountInfo = await connection.getAccountInfo(blogAccount); | ||
const blogAccountState = BLOG_ACCOUNT_DATA_LAYOUT.decode( | ||
blogAccountInfo.data | ||
); | ||
console.log("Blog account state: ", blogAccountState); | ||
const blogAccountInfo = await connection.getAccountInfo(blogAccount); | ||
const blogAccountState = BLOG_ACCOUNT_DATA_LAYOUT.decode( | ||
blogAccountInfo.data | ||
); | ||
console.log("Blog account state: ", blogAccountState); | ||
|
||
const postAccountInfo = await connection.getAccountInfo(postAccount); | ||
const postAccountState = POST_ACCOUNT_DATA_LAYOUT.decode( | ||
postAccountInfo.data | ||
); | ||
console.log("Post account state: ", postAccountState); | ||
}) | ||
const postAccountInfo = await connection.getAccountInfo(postAccount); | ||
const postAccountState = POST_ACCOUNT_DATA_LAYOUT.decode( | ||
postAccountInfo.data | ||
); | ||
console.log("Post account state: ", postAccountState); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,71 @@ | ||
const insertABIx = new TransactionInstruction({ | ||
programId: MY_PROGRAM_ID, | ||
keys: [ | ||
programId: MY_PROGRAM_ID, | ||
keys: [ | ||
{ | ||
pubkey: userA.publicKey, | ||
isSigner: true, | ||
isWritable: true, | ||
pubkey: userA.publicKey, | ||
isSigner: true, | ||
isWritable: true, | ||
}, | ||
{ | ||
pubkey: userB.publicKey, | ||
isSigner: false, | ||
isWritable: false, | ||
pubkey: userB.publicKey, | ||
isSigner: false, | ||
isWritable: false, | ||
}, | ||
{ | ||
pubkey: mapKey, | ||
isSigner: false, | ||
isWritable: true, | ||
pubkey: mapKey, | ||
isSigner: false, | ||
isWritable: true, | ||
}, | ||
], | ||
data: Buffer.from(Uint8Array.of(1)), | ||
], | ||
data: Buffer.from(Uint8Array.of(1)), | ||
}); | ||
|
||
const insertBCIx = new TransactionInstruction({ | ||
programId: MY_PROGRAM_ID, | ||
keys: [ | ||
programId: MY_PROGRAM_ID, | ||
keys: [ | ||
{ | ||
pubkey: userB.publicKey, | ||
isSigner: true, | ||
isWritable: true, | ||
pubkey: userB.publicKey, | ||
isSigner: true, | ||
isWritable: true, | ||
}, | ||
{ | ||
pubkey: userC.publicKey, | ||
isSigner: false, | ||
isWritable: false, | ||
pubkey: userC.publicKey, | ||
isSigner: false, | ||
isWritable: false, | ||
}, | ||
{ | ||
pubkey: mapKey, | ||
isSigner: false, | ||
isWritable: true, | ||
pubkey: mapKey, | ||
isSigner: false, | ||
isWritable: true, | ||
}, | ||
], | ||
data: Buffer.from(Uint8Array.of(1)), | ||
], | ||
data: Buffer.from(Uint8Array.of(1)), | ||
}); | ||
|
||
const insertCAIx = new TransactionInstruction({ | ||
programId: MY_PROGRAM_ID, | ||
keys: [ | ||
programId: MY_PROGRAM_ID, | ||
keys: [ | ||
{ | ||
pubkey: userC.publicKey, | ||
isSigner: true, | ||
isWritable: true, | ||
pubkey: userC.publicKey, | ||
isSigner: true, | ||
isWritable: true, | ||
}, | ||
{ | ||
pubkey: userA.publicKey, | ||
isSigner: false, | ||
isWritable: false, | ||
pubkey: userA.publicKey, | ||
isSigner: false, | ||
isWritable: false, | ||
}, | ||
{ | ||
pubkey: mapKey, | ||
isSigner: false, | ||
isWritable: true, | ||
pubkey: mapKey, | ||
isSigner: false, | ||
isWritable: true, | ||
}, | ||
], | ||
data: Buffer.from(Uint8Array.of(1)), | ||
], | ||
data: Buffer.from(Uint8Array.of(1)), | ||
}); | ||
|
||
const tx = new Transaction(); | ||
tx.add(initMapIx); | ||
tx.add(insertABIx); | ||
tx.add(insertBCIx); | ||
tx.add(insertCAIx); | ||
tx.add(insertCAIx); |
Oops, something went wrong.