Skip to content

Commit

Permalink
Replacing asserts with explicit errors + more (#702)
Browse files Browse the repository at this point in the history
* Replacing asserts with explicit errors

- Also
  - Adding new error variants.
  - Updating `get_instruction_type()` to contain new instruction
discriminators.
  - Cargo fmt and clippy fixes.
  - Removing a collection TODO since we solved a different way.
  - Removing unreachable enum variant in match statement for schema
version error after team discussion.

* Regenerating API

* Updating token-metadata version in Bubblegum
  • Loading branch information
danenbm authored Sep 3, 2022
1 parent 8b94bc1 commit f15e31f
Show file tree
Hide file tree
Showing 27 changed files with 408 additions and 249 deletions.
134 changes: 86 additions & 48 deletions bubblegum/js/idl/bubblegum.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions bubblegum/js/src/generated/accounts/Voucher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { LeafSchema, leafSchemaBeet } from '../types/LeafSchema'
export type VoucherArgs = {
leafSchema: LeafSchema
index: number
merkleSlab: web3.PublicKey
merkleTree: web3.PublicKey
}

export const voucherDiscriminator = [191, 204, 149, 234, 213, 165, 13, 65]
Expand All @@ -33,14 +33,14 @@ export class Voucher implements VoucherArgs {
private constructor(
readonly leafSchema: LeafSchema,
readonly index: number,
readonly merkleSlab: web3.PublicKey
readonly merkleTree: web3.PublicKey
) {}

/**
* Creates a {@link Voucher} instance from the provided args.
*/
static fromArgs(args: VoucherArgs) {
return new Voucher(args.leafSchema, args.index, args.merkleSlab)
return new Voucher(args.leafSchema, args.index, args.merkleTree)
}

/**
Expand Down Expand Up @@ -146,7 +146,7 @@ export class Voucher implements VoucherArgs {
return {
leafSchema: this.leafSchema.__kind,
index: this.index,
merkleSlab: this.merkleSlab.toBase58(),
merkleTree: this.merkleTree.toBase58(),
}
}
}
Expand All @@ -165,7 +165,7 @@ export const voucherBeet = new beet.FixableBeetStruct<
['accountDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)],
['leafSchema', leafSchemaBeet],
['index', beet.u32],
['merkleSlab', beetSolana.publicKey],
['merkleTree', beetSolana.publicKey],
],
Voucher.fromArgs,
'Voucher'
Expand Down
Loading

0 comments on commit f15e31f

Please sign in to comment.