Skip to content

Commit

Permalink
Correcting the typegen code interface
Browse files Browse the repository at this point in the history
	modified:   docs/solana-indexing/how-to-start/indexing-orca.mdx
	modified:   docs/solana-indexing/sdk/solana-batch/field-selection.md
	modified:   docs/solana-indexing/sdk/typegen.md
  • Loading branch information
abernatskiy committed May 10, 2024
1 parent b37096a commit 26aba24
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions docs/solana-indexing/how-to-start/indexing-orca.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ const dataSource = new DataSourceBuilder()
// were executed by the Whirlpool program, and
programId: [whirlpool.programId],
// have the first eight bytes of .data equal to swap descriptor, and
d8: [whirlpool.swap.d8],
d8: [whirlpool.instructions.swap.d8],
// limiting to USDC-SOL pair only
...whirlpool.swap.accountSelection({
...whirlpool.instructions.swap.accountSelection({
whirlpool: ['7qbRF6YsyGuLUVs6Y1q64bdVrfe4ZcUUz1JRdoVNUJnm']
}),
// were successfully committed
Expand Down Expand Up @@ -177,7 +177,7 @@ run(dataSource, database, async ctx => {
for (let ins of block.instructions) {
// https://read.cryptodatabytes.com/p/starter-guide-to-solana-data-analysis
if (ins.programId === whirlpool.programId &&
ins.d8 === whirlpool.swap.d8) {
ins.d8 === whirlpool.instructions.swap.d8) {

let exchange = new Exchange({
id: ins.id,
Expand Down
2 changes: 1 addition & 1 deletion docs/solana-indexing/sdk/solana-batch/field-selection.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ const dataSource = new DataSourceBuilder()
// were executed by the Whirlpool program
programId: [whirlpool.programId],
// have the first 8 bytes of .data equal to swap descriptor
d8: [whirlpool.swap.d8],
d8: [whirlpool.instructions.swap.d8],
// were successfully committed
isCommitted: true,
},
Expand Down
14 changes: 7 additions & 7 deletions docs/solana-indexing/sdk/typegen.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ The generated utility modules have three intended uses:
.addInstruction({
where: {
programId: [whirlpool.programId],
d8: [whirlpool.swap.d8]
d8: [whirlpool.instructions.swap.d8]
}
})
.build();
Expand All @@ -72,11 +72,11 @@ The generated utility modules have three intended uses:
for (let block of blocks) {
for (let ins of block.instructions) {
if (ins.programId === whirlpool.programId &&
ins.d8 === whirlpool.swap.d8) {
ins.d8 === whirlpool.instructions.swap.d8) {

let decodedSwap = whirlpool.swap.decode(ins)
let decodedAccounts = whirlpool.swap.decodeAccounts(ins.accounts)
let decodedData = whirlpool.swap.decodeData(ins.data)
let decodedSwap = whirlpool.instructions.swap.decode(ins)
let decodedAccounts = whirlpool.instructions.swap.decodeAccounts(ins.accounts)
let decodedData = whirlpool.instructions.swap.decodeData(ins.data)
}
}
}
Expand All @@ -88,9 +88,9 @@ The generated utility modules have three intended uses:
.addInstruction({
where: {
programId: [whirlpool.programId],
d8: [whirlpool.swap.d8],
d8: [whirlpool.instructions.swap.d8],
// select instructions for the USDC-SOL pair only
...whirlpool.swap.accountSelection({
...whirlpool.instructions.swap.accountSelection({
whirlpool: ['7qbRF6YsyGuLUVs6Y1q64bdVrfe4ZcUUz1JRdoVNUJnm']
})
}
Expand Down

0 comments on commit 26aba24

Please sign in to comment.