Skip to content

Commit ddd58eb

Browse files
authored
Merge pull request #155 from BitGo/BTC-3025-sol-wasm-authorize-customtx
feat(wasm-solana): add authorize and customTx intent handlers
2 parents 9b5ede9 + 2f5fdca commit ddd58eb

3 files changed

Lines changed: 302 additions & 54 deletions

File tree

packages/wasm-solana/js/intentBuilder.ts

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,40 @@ export interface ConsolidateIntent extends BaseIntent {
176176
}>;
177177
}
178178

179+
/** Authorize intent - pre-built transaction message */
180+
export interface AuthorizeIntent extends BaseIntent {
181+
intentType: "authorize";
182+
/** Base64-encoded bincode-serialized Solana Message */
183+
transactionMessage: string;
184+
}
185+
186+
/** Custom transaction intent */
187+
export interface CustomTxIntent extends BaseIntent {
188+
intentType: "customTx";
189+
/** Custom instructions to include in the transaction */
190+
solInstructions: CustomTxInstruction[];
191+
}
192+
193+
/** A single custom instruction */
194+
export interface CustomTxInstruction {
195+
/** Program ID (base58) */
196+
programId: string;
197+
/** Account keys for the instruction */
198+
keys: CustomTxKey[];
199+
/** Instruction data (base64) */
200+
data: string;
201+
}
202+
203+
/** Account key for a custom instruction */
204+
export interface CustomTxKey {
205+
/** Account public key (base58) */
206+
pubkey: string;
207+
/** Whether this account must sign the transaction */
208+
isSigner: boolean;
209+
/** Whether this account is writable */
210+
isWritable: boolean;
211+
}
212+
179213
/** Union of all supported intent types */
180214
export type SolanaIntent =
181215
| PaymentIntent
@@ -186,7 +220,9 @@ export type SolanaIntent =
186220
| DelegateIntent
187221
| EnableTokenIntent
188222
| CloseAtaIntent
189-
| ConsolidateIntent;
223+
| ConsolidateIntent
224+
| AuthorizeIntent
225+
| CustomTxIntent;
190226

191227
// =============================================================================
192228
// Main Function

0 commit comments

Comments
 (0)