Save solana signTransaction progress
This commit is contained in:
parent
4d593758e7
commit
dd81e04445
@ -28,9 +28,6 @@ export default function useWalletConnectEventsManager(initialized: boolean) {
|
||||
const { method } = request
|
||||
const requestSession = await walletConnectClient.session.get(topic)
|
||||
|
||||
console.log(requestEvent, requestSession)
|
||||
console.log(method)
|
||||
|
||||
switch (method) {
|
||||
case EIP155_SIGNING_METHODS.ETH_SIGN:
|
||||
case EIP155_SIGNING_METHODS.PERSONAL_SIGN:
|
||||
|
@ -54,7 +54,6 @@ export default class CosmosLib {
|
||||
}
|
||||
|
||||
public async signDirect(address: string, signDoc: SignDoc) {
|
||||
console.log(signDoc)
|
||||
const signDocBytes = makeSignBytes(signDoc)
|
||||
// @ts-expect-error
|
||||
return await this.directSigner.signDirect(address, signDocBytes)
|
||||
|
@ -58,7 +58,6 @@ export class EIP155 {
|
||||
}
|
||||
|
||||
public async signDirect(address: string, signDoc: SignDoc) {
|
||||
console.log(signDoc)
|
||||
const signDocBytes = makeSignBytes(signDoc)
|
||||
// @ts-expect-error
|
||||
return await this.directSigner.signDirect(address, signDocBytes)
|
||||
|
@ -28,17 +28,28 @@ export class Solana {
|
||||
public async signTransaction(
|
||||
feePayer: string,
|
||||
recentBlockhash: string,
|
||||
instructions: TransactionInstructionCtorFields
|
||||
instructions: TransactionInstructionCtorFields[]
|
||||
) {
|
||||
const tx = new Transaction({
|
||||
feePayer: new PublicKey(feePayer),
|
||||
recentBlockhash
|
||||
})
|
||||
tx.add(instructions)
|
||||
|
||||
tx.add(
|
||||
...instructions.map(i => ({
|
||||
programId: new PublicKey(i.programId),
|
||||
data: i.data ? Buffer.from(i.data) : Buffer.from([]),
|
||||
keys: i.keys.map(k => ({
|
||||
...k,
|
||||
pubkey: new PublicKey(k.pubkey)
|
||||
}))
|
||||
}))
|
||||
)
|
||||
|
||||
await tx.sign(this.keypair)
|
||||
console.log(tx)
|
||||
|
||||
const { signature } = tx.signatures[tx.signatures.length - 1]
|
||||
|
||||
return signature
|
||||
return { signature }
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ export async function approveSolanaRequest(requestEvent: RequestEvent) {
|
||||
params.recentBlockhash,
|
||||
params.instructions
|
||||
)
|
||||
|
||||
return formatJsonRpcResult(id, signedTransaction)
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user