fix: recent blockhash decoding for conf transactions
This commit is contained in:
committed by
Michael Vines
parent
c5802bcbb6
commit
09d1b7f39f
@ -537,7 +537,7 @@ export class Transaction {
|
|||||||
numReadonlySignedAccounts,
|
numReadonlySignedAccounts,
|
||||||
numReadonlyUnsignedAccounts,
|
numReadonlyUnsignedAccounts,
|
||||||
},
|
},
|
||||||
recentBlockhash: bs58.encode(Buffer.from(recentBlockhash)),
|
recentBlockhash,
|
||||||
accountKeys: accounts.map(account => new PublicKey(account)),
|
accountKeys: accounts.map(account => new PublicKey(account)),
|
||||||
instructions,
|
instructions,
|
||||||
};
|
};
|
||||||
|
@ -160,7 +160,7 @@ test('parse wire format and serialize', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('transaction from rpc result', () => {
|
test('transaction from rpc result', () => {
|
||||||
const rawBlockhash = new PublicKey(0).toBuffer();
|
const recentBlockhash = new PublicKey(1).toString();
|
||||||
const rpcResult = {
|
const rpcResult = {
|
||||||
message: {
|
message: {
|
||||||
accountKeys: [
|
accountKeys: [
|
||||||
@ -182,7 +182,7 @@ test('transaction from rpc result', () => {
|
|||||||
programIdIndex: 4,
|
programIdIndex: 4,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
recentBlockhash: rawBlockhash,
|
recentBlockhash,
|
||||||
},
|
},
|
||||||
signatures: [
|
signatures: [
|
||||||
bs58.encode(Buffer.alloc(64).fill(1)),
|
bs58.encode(Buffer.alloc(64).fill(1)),
|
||||||
@ -190,7 +190,6 @@ test('transaction from rpc result', () => {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const recentBlockhash = new PublicKey(rawBlockhash).toBase58();
|
|
||||||
const transaction = Transaction.fromRpcResult(rpcResult);
|
const transaction = Transaction.fromRpcResult(rpcResult);
|
||||||
expect(transaction.instructions.length).toEqual(1);
|
expect(transaction.instructions.length).toEqual(1);
|
||||||
expect(transaction.signatures.length).toEqual(2);
|
expect(transaction.signatures.length).toEqual(2);
|
||||||
|
Reference in New Issue
Block a user