Skip to content

Commit

Permalink
Merge pull request solana-labs#117 from jarry-xiao/api-refactor
Browse files Browse the repository at this point in the history
api init refactor to real api
  • Loading branch information
austbot authored Jun 29, 2022
2 parents 1d02d76 + ef5aef0 commit 32e4f89
Show file tree
Hide file tree
Showing 6 changed files with 526 additions and 10 deletions.
14 changes: 8 additions & 6 deletions contracts/programs/bubblegum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use {
Nonce, Voucher,
metaplex_adapter::{MetadataArgs, TokenProgramVersion},
NewNFTEvent,
NFTDecompressionEvent
NFTDecompressionEvent,
},
gummyroll::{program::Gummyroll, Node},
crate::error::BubblegumError,
Expand Down Expand Up @@ -226,8 +226,9 @@ pub struct DecompressV1<'info> {
#[account(
mut,
seeds = [
voucher.leaf_schema.id().as_ref(),
token_program.key().as_ref()
ASSET_PREFIX.as_ref(),
voucher.merkle_slab.as_ref(),
voucher.leaf_schema.nonce().to_le_bytes().as_ref()
],
bump
)]
Expand Down Expand Up @@ -603,7 +604,7 @@ pub mod bubblegum {
version: Version::V1,
tree_id: ctx.accounts.voucher.merkle_slab.key(),
id: get_asset_id(&ctx.accounts.voucher.merkle_slab.key(), nonce),
nonce: nonce
nonce: nonce,
})
}
_ => Err(BubblegumError::UnsupportedSchemaVersion)
Expand All @@ -626,8 +627,9 @@ pub mod bubblegum {
ctx.accounts.system_program.to_account_info(),
],
&[&[
voucher.leaf_schema.id().as_ref(),
spl_token::id().as_ref(),
ASSET_PREFIX.as_bytes(),
voucher.merkle_slab.key().as_ref(),
voucher.leaf_schema.nonce().to_le_bytes().as_ref(),
&[*ctx.bumps.get("mint").unwrap()],
]],
)?;
Expand Down
1 change: 0 additions & 1 deletion contracts/programs/bubblegum/src/state/leaf_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ impl LeafSchema {
LeafSchema::V1 { data_hash, .. } => *data_hash,
}
}


pub fn to_event(&self) -> LeafSchemaEvent {
LeafSchemaEvent {
Expand Down
3 changes: 2 additions & 1 deletion contracts/sdk/indexer/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ async function main() {
(logs, ctx) => handleLogsAtomic(db, logs, ctx, { Gummyroll, Bubblegum }),
"confirmed"
);
let maxSeq = 0;
while (true) {
try {
const trees = await db.getTrees();
for (const [treeId, depth] of trees) {
console.log("Scanning for gaps");
let maxSeq = await fetchAndPlugGaps(connection, db, 0, treeId, {
maxSeq = await fetchAndPlugGaps(connection, db, maxSeq, treeId, {
Gummyroll,
Bubblegum,
});
Expand Down
2 changes: 2 additions & 0 deletions contracts/sdk/indexer/indexer/bubblegum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ export async function parseBubblegumMint(
await db.updateChangeLogs(changeLog, optionalInfo.txId, slot, treeId);
}



export async function parseReplaceLeaf(
db: NFTDatabaseConnection,
logs: (string | ParsedLog)[],
Expand Down
Loading

0 comments on commit 32e4f89

Please sign in to comment.