Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ui wrapper idl for making refer optional #264

Merged
merged 4 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading