Skip to content

Commit

Permalink
Merge pull request #743 from magiclabs/jayhwang-partial-sign
Browse files Browse the repository at this point in the history
Add partialSignTransaction in sol-ext
  • Loading branch information
octave08 committed May 20, 2024
2 parents 99cf131 + 37f66a4 commit 8e0abd3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/@magic-ext/solana/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const SOLANA_PAYLOAD_METHODS = {
SIGN_TRANSACTION: 'sol_signTransaction',
SIGN_MESSAGE: 'sol_signMessage',
PARTIAL_SIGN_TRANSACTION: 'sol_partialSignTransaction',
} as const;
16 changes: 16 additions & 0 deletions packages/@magic-ext/solana/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,20 @@ export class SolanaExtension extends Extension.Internal<'solana', any> {
},
});
};

public partialSignTransaction = (
transaction: Transaction | VersionedTransaction,
serializeConfig?: SerializeConfig,
) => {
return this.request<{ rawTransaction: string }>({
id: 42,
jsonrpc: '2.0',
method: SOLANA_PAYLOAD_METHODS.PARTIAL_SIGN_TRANSACTION,
params: {
type: transaction instanceof Transaction ? 'legacy' : 0,
serialized: transaction.serialize(serializeConfig),
serializeConfig,
},
});
};
}

0 comments on commit 8e0abd3

Please sign in to comment.