|
@@ -47,18 +47,18 @@ export function {{ instructionParseFunction }}<
|
|
|
accountIndex += 1;
|
|
accountIndex += 1;
|
|
|
return accountMeta;
|
|
return accountMeta;
|
|
|
}
|
|
}
|
|
|
- {% if hasOptionalAccounts and instruction.optionalAccountStrategy === 'programId' %}
|
|
|
|
|
- const getNextOptionalAccount = () => {
|
|
|
|
|
- const accountMeta = getNextAccount();
|
|
|
|
|
- return accountMeta.address === {{ programAddressConstant }} ? undefined : accountMeta;
|
|
|
|
|
- };
|
|
|
|
|
- {% elif hasOptionalAccounts and instruction.optionalAccountStrategy === 'omitted' %}
|
|
|
|
|
|
|
+ {% if hasOptionalAccounts and instruction.optionalAccountStrategy === 'omitted' %}
|
|
|
let optionalAccountsRemaining = instruction.accounts.length - {{ minimumNumberOfAccounts }};
|
|
let optionalAccountsRemaining = instruction.accounts.length - {{ minimumNumberOfAccounts }};
|
|
|
const getNextOptionalAccount = () => {
|
|
const getNextOptionalAccount = () => {
|
|
|
if (optionalAccountsRemaining === 0) return undefined;
|
|
if (optionalAccountsRemaining === 0) return undefined;
|
|
|
optionalAccountsRemaining -= 1;
|
|
optionalAccountsRemaining -= 1;
|
|
|
return getNextAccount();
|
|
return getNextAccount();
|
|
|
};
|
|
};
|
|
|
|
|
+ {% elif hasOptionalAccounts %}
|
|
|
|
|
+ const getNextOptionalAccount = () => {
|
|
|
|
|
+ const accountMeta = getNextAccount();
|
|
|
|
|
+ return accountMeta.address === {{ programAddressConstant }} ? undefined : accountMeta;
|
|
|
|
|
+ };
|
|
|
{% endif %}
|
|
{% endif %}
|
|
|
{% endif %}
|
|
{% endif %}
|
|
|
return {
|
|
return {
|