Skip to content

Commit

Permalink
fix: restore externalPriceAccount argument in UpdateExternalPriceAcco…
Browse files Browse the repository at this point in the history
…unt instruction (#76)

* fix: restore externalPriceAccount

* test: update
  • Loading branch information
dkchv committed Nov 29, 2021
1 parent c3e03b4 commit 823e141
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ export class UpdateExternalPriceAccountArgs extends Borsh.Data<{
}> {
static readonly SCHEMA = new Map([
...ExternalPriceAccountData.SCHEMA,
...this.struct([['instruction', 'u8']]),
...this.struct([
['instruction', 'u8'],
['externalPriceAccount', ExternalPriceAccountData],
]),
]);

instruction = VaultInstructions.UpdateExternalPriceAccount;
Expand Down
2 changes: 1 addition & 1 deletion test/transactions/__snapshots__/vault.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exports[`Vault transactions RedeemShares 1`] = `"{\\"type\\":\\"Buffer\\",\\"dat

exports[`Vault transactions SetVaultAuthority 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,1,2,5,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,207,140,94,235,253,88,52,215,223,250,161,132,68,41,246,210,18,149,185,76,29,184,100,232,184,10,144,98,156,162,27,90,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,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,13,186,28,52,26,119,115,94,210,96,195,36,182,190,250,187,9,244,245,52,7,50,47,49,172,28,41,212,233,209,175,49,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,4,3,2,1,3,1,10]}"`;

exports[`Vault transactions UpdateExternalPriceAccount 1`] = `"{\\"type\\":\\"Buffer\\",\\"data\\":[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,0,0,0,0,0,0,0,0,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,0,1,3,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,91,40,146,183,9,11,253,128,231,91,83,123,247,28,233,135,231,63,61,168,21,167,85,108,218,57,31,176,134,164,233,93,13,186,28,52,26,119,115,94,210,96,195,36,182,190,250,187,9,244,245,52,7,50,47,49,172,28,41,212,233,209,175,49,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,2,1,1,1,9]}"`;
exports[`Vault transactions UpdateExternalPriceAccount 1`] = `"{\\"type\\":\\"Buffer\\",\\"data\\":[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,0,0,0,0,0,0,0,0,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,0,1,3,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,91,40,146,183,9,11,253,128,231,91,83,123,247,28,233,135,231,63,61,168,21,167,85,108,218,57,31,176,134,164,233,93,13,186,28,52,26,119,115,94,210,96,195,36,182,190,250,187,9,244,245,52,7,50,47,49,172,28,41,212,233,209,175,49,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,2,1,1,43,9,2,1,0,0,0,0,0,0,0,71,52,74,64,244,149,107,98,150,13,155,185,184,196,61,57,67,130,233,212,49,232,156,191,78,216,232,55,63,50,139,50,0]}"`;

exports[`Vault transactions WithdrawSharesFromTreasury 1`] = `"{\\"type\\":\\"Buffer\\",\\"data\\":[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,0,0,0,0,0,0,0,0,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,0,5,9,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,171,197,83,63,32,227,187,170,2,133,10,136,67,50,110,186,58,134,128,62,247,67,232,84,214,155,227,247,235,26,44,198,36,67,155,135,122,216,114,67,96,234,147,102,249,24,27,9,131,230,78,162,1,172,150,252,236,227,20,100,149,82,2,127,138,11,212,145,63,217,9,21,73,57,64,165,30,167,185,240,71,134,94,56,188,28,9,24,167,138,107,48,138,120,248,155,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,112,183,8,167,28,77,246,88,240,228,163,187,131,149,126,124,17,224,201,92,232,236,118,234,121,102,91,60,10,237,249,109,6,221,246,225,215,101,161,147,217,203,225,70,206,235,121,172,28,180,133,237,95,91,55,145,58,140,245,133,126,255,0,169,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,13,186,28,52,26,119,115,94,210,96,195,36,182,190,250,187,9,244,245,52,7,50,47,49,172,28,41,212,233,209,175,49,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,8,7,1,2,4,5,3,6,7,2,7,1]}"`;

Expand Down
7 changes: 3 additions & 4 deletions test/transactions/vault.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
WithdrawTokenFromSafetyDepositBox,
} from '../../src/programs/vault/transactions';
import BN from 'bn.js';
import { VaultKey } from '../../src/programs/vault';
import { ExternalPriceAccountData } from '../../src/programs/vault';

describe('Vault transactions', () => {
test('InitVault', async () => {
Expand Down Expand Up @@ -168,12 +168,11 @@ describe('Vault transactions', () => {
test('UpdateExternalPriceAccount', async () => {
const data = new UpdateExternalPriceAccount(mockTransaction, {
externalPriceAccount: EXTERNAL_PRICE_ACCOUNT_PUBKEY,
externalPriceAccountData: {
externalPriceAccountData: new ExternalPriceAccountData({
allowedToCombine: false,
key: VaultKey.ExternalPriceAccountV1,
priceMint: '5nxC9KnUSqr5dNQoPN7xhKfmzS48znM3zfNqcgdKYXrh',
pricePerShare: new BN(1),
},
}),
store: STORE_PUBKEY,
});

Expand Down

0 comments on commit 823e141

Please sign in to comment.