Skip to content

Commit

Permalink
fix: createAuctionV2 scheme (#88)
Browse files Browse the repository at this point in the history
* fix: createAuctionV2 scheme

* fix: add params

* fix: update tests
  • Loading branch information
dkchv committed Dec 2, 2021
1 parent e2f8c43 commit ac808ad
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/programs/auction/transactions/CreateAuctionV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import BN from 'bn.js';
import { AuctionProgram } from '../AuctionProgram';
import { Transaction } from '../../../Transaction';
import { PriceFloor } from '../accounts/Auction';
import { Args as CreateAuctionArgsType, CreateAuctionArgs, WinnerLimit } from './CreateAuction';
import { Args as CreateAuctionArgsType, WinnerLimit } from './CreateAuction';

type Args = CreateAuctionArgsType & {
instantSalePrice: BN | null;
Expand All @@ -20,8 +20,19 @@ type Args = CreateAuctionArgsType & {

export class CreateAuctionV2Args extends Borsh.Data<Args> {
static readonly SCHEMA = new Map([
...CreateAuctionArgs.SCHEMA,
...WinnerLimit.SCHEMA,
...PriceFloor.SCHEMA,
...this.struct([
['instruction', 'u8'],
['winners', WinnerLimit],
['endAuctionAt', { kind: 'option', type: 'u64' }],
['auctionGap', { kind: 'option', type: 'u64' }],
['tokenMint', 'pubkeyAsString'],
['authority', 'pubkeyAsString'],
['resource', 'pubkeyAsString'],
['priceFloor', PriceFloor],
['tickSize', { kind: 'option', type: 'u64' }],
['gapTickSizePercentage', { kind: 'option', type: 'u8' }],
['instantSalePrice', { kind: 'option', type: 'u64' }],
['name', { kind: 'option', type: [32] }],
]),
Expand Down
2 changes: 1 addition & 1 deletion test/transactions/__snapshots__/auction.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

exports[`Auction transactions CreateAuction 1`] = `"{\\"type\\":\\"Buffer\\",\\"data\\":[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,3,7,93,135,29,120,250,13,109,171,35,122,77,213,58,178,208,153,32,156,150,192,153,14,177,253,172,197,7,247,216,61,254,175,187,209,148,182,34,149,175,173,192,85,175,252,231,130,76,40,175,177,44,111,250,168,3,236,149,34,236,19,46,9,66,138,155,76,202,43,34,141,168,115,82,176,65,170,75,45,110,185,97,234,236,43,234,0,144,234,95,255,33,107,30,38,145,153,130,131,135,32,113,60,44,78,85,97,231,146,60,57,129,72,71,229,99,140,205,42,175,85,79,60,2,195,134,224,132,55,6,167,213,23,25,44,92,81,33,140,201,76,61,74,241,127,88,218,238,8,155,161,253,68,227,219,217,138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,175,169,191,10,132,153,239,245,177,12,199,221,36,59,224,20,103,70,219,249,150,85,157,145,130,193,93,188,24,246,87,131,79,219,30,88,36,153,69,200,48,40,136,227,246,197,102,213,141,122,4,186,57,98,62,139,154,145,152,59,13,211,149,1,6,5,1,2,3,4,5,168,1,1,1,1,0,0,0,0,0,0,0,1,195,115,146,97,0,0,0,0,1,30,0,0,0,0,0,0,0,113,178,77,47,3,206,165,188,130,225,172,175,199,64,162,55,188,104,159,223,218,116,88,247,167,60,131,209,170,44,208,98,70,65,21,141,143,89,143,146,210,57,211,217,223,24,20,153,223,130,92,14,226,188,44,87,44,70,212,74,67,174,21,67,151,236,219,224,54,47,112,197,46,29,246,29,105,42,66,214,178,206,61,219,206,132,245,159,159,124,100,29,253,0,131,115,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,10,0,0,0,0,0,0,0,1,1]}"`;

exports[`Auction transactions CreateAuctionV2 1`] = `"{\\"type\\":\\"Buffer\\",\\"data\\":[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,3,7,93,135,29,120,250,13,109,171,35,122,77,213,58,178,208,153,32,156,150,192,153,14,177,253,172,197,7,247,216,61,254,175,187,209,148,182,34,149,175,173,192,85,175,252,231,130,76,40,175,177,44,111,250,168,3,236,149,34,236,19,46,9,66,138,155,76,202,43,34,141,168,115,82,176,65,170,75,45,110,185,97,234,236,43,234,0,144,234,95,255,33,107,30,38,145,153,130,131,135,32,113,60,44,78,85,97,231,146,60,57,129,72,71,229,99,140,205,42,175,85,79,60,2,195,134,224,132,55,6,167,213,23,25,44,92,81,33,140,201,76,61,74,241,127,88,218,238,8,155,161,253,68,227,219,217,138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,175,169,191,10,132,153,239,245,177,12,199,221,36,59,224,20,103,70,219,249,150,85,157,145,130,193,93,188,24,246,87,131,79,219,30,88,36,153,69,200,48,40,136,227,246,197,102,213,141,122,4,186,57,98,62,139,154,145,152,59,13,211,149,1,6,5,1,2,3,4,5,10,1,0,202,154,59,0,0,0,0,0]}"`;
exports[`Auction transactions CreateAuctionV2 1`] = `"{\\"type\\":\\"Buffer\\",\\"data\\":[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,3,7,93,135,29,120,250,13,109,171,35,122,77,213,58,178,208,153,32,156,150,192,153,14,177,253,172,197,7,247,216,61,254,175,187,209,148,182,34,149,175,173,192,85,175,252,231,130,76,40,175,177,44,111,250,168,3,236,149,34,236,19,46,9,66,138,155,76,202,43,34,141,168,115,82,176,65,170,75,45,110,185,97,234,236,43,234,0,144,234,95,255,33,107,30,38,145,153,130,131,135,32,113,60,44,78,85,97,231,146,60,57,129,72,71,229,99,140,205,42,175,85,79,60,2,195,134,224,132,55,6,167,213,23,25,44,92,81,33,140,201,76,61,74,241,127,88,218,238,8,155,161,253,68,227,219,217,138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,175,169,191,10,132,153,239,245,177,12,199,221,36,59,224,20,103,70,219,249,150,85,157,145,130,193,93,188,24,246,87,131,79,219,30,88,36,153,69,200,48,40,136,227,246,197,102,213,141,122,4,186,57,98,62,139,154,145,152,59,13,211,149,1,6,5,1,2,3,4,5,178,1,7,1,1,0,0,0,0,0,0,0,1,195,115,146,97,0,0,0,0,1,30,0,0,0,0,0,0,0,113,178,77,47,3,206,165,188,130,225,172,175,199,64,162,55,188,104,159,223,218,116,88,247,167,60,131,209,170,44,208,98,70,65,21,141,143,89,143,146,210,57,211,217,223,24,20,153,223,130,92,14,226,188,44,87,44,70,212,74,67,174,21,67,151,236,219,224,54,47,112,197,46,29,246,29,105,42,66,214,178,206,61,219,206,132,245,159,159,124,100,29,253,0,131,115,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,10,0,0,0,0,0,0,0,1,1,1,0,202,154,59,0,0,0,0,0]}"`;

0 comments on commit ac808ad

Please sign in to comment.