Skip to content

Commit

Permalink
Update ui wrapper idl for making refer optional (#264)
Browse files Browse the repository at this point in the history
* Update ui wrapper idl for making refer optional

* version bump

* update version
  • Loading branch information
brittcyr authored Nov 8, 2024
1 parent ddb5322 commit e991c07
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions client/idl/ui_wrapper.json
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@
"name": "referrerTokenAccount",
"isMut": true,
"isSigner": false,
"isOptional": true,
"docs": [
"Referrer fee token account"
]
Expand Down
18 changes: 13 additions & 5 deletions client/ts/src/ui_wrapper/instructions/SettleFunds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const SettleFundsStruct = new beet.BeetArgsStruct<
* @property [] tokenProgramQuote
* @property [] manifestProgram
* @property [_writable_] platformTokenAccount
* @property [_writable_] referrerTokenAccount
* @property [_writable_] referrerTokenAccount (optional)
* @category Instructions
* @category SettleFunds
* @category generated
Expand All @@ -71,14 +71,19 @@ export type SettleFundsInstructionAccounts = {
tokenProgramQuote: web3.PublicKey;
manifestProgram: web3.PublicKey;
platformTokenAccount: web3.PublicKey;
referrerTokenAccount: web3.PublicKey;
referrerTokenAccount?: web3.PublicKey;
};

export const settleFundsInstructionDiscriminator = 5;

/**
* Creates a _SettleFunds_ instruction.
*
* Optional accounts that are not provided will be omitted from the accounts
* array passed with the instruction.
* An optional account that is set cannot follow an optional account that is unset.
* Otherwise an Error is raised.
*
* @param accounts that will be accessed while the instruction is processed
* @param args to provide as instruction data to the program
*
Expand Down Expand Up @@ -161,12 +166,15 @@ export function createSettleFundsInstruction(
isWritable: true,
isSigner: false,
},
{
];

if (accounts.referrerTokenAccount != null) {
keys.push({
pubkey: accounts.referrerTokenAccount,
isWritable: true,
isSigner: false,
},
];
});
}

const ix = new web3.TransactionInstruction({
programId,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cks-systems/manifest-sdk",
"version": "0.1.66",
"version": "0.1.67",
"files": [
"dist/",
"README.md",
Expand Down
3 changes: 1 addition & 2 deletions programs/ui-wrapper/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ pub enum ManifestWrapperInstruction {
#[account(10, name = "token_program_quote", desc = "Token program for quote token")]
#[account(11, name = "manifest_program", desc = "Manifest program")]
#[account(12, writable, name = "platform_token_account", desc = "Platform fee token account")]
// optional
#[account(13, writable, name = "referrer_token_account", desc = "Referrer fee token account")]
#[account(13, writable, name = "referrer_token_account", desc = "Referrer fee token account", optional)]
SettleFunds = 5,
}

Expand Down

0 comments on commit e991c07

Please sign in to comment.