Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 0bb43f5

Browse files
committed
Remove OrderedMap export and use SignatureSMap
Not sure what I was doing here, but OrderedMap is just used for SignaturesMap, and all the uses were just using it as that
1 parent 3e81a8e commit 0bb43f5

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

packages/transactions/src/__tests__/signatures-test.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ import {
1616
partiallySignTransaction,
1717
signTransaction,
1818
} from '../signatures';
19-
import { OrderedMap, Transaction, TransactionMessageBytes } from '../transaction';
19+
import { SignaturesMap, Transaction, TransactionMessageBytes } from '../transaction';
2020

2121
jest.mock('@solana/addresses');
2222
jest.mock('@solana/keys');
2323

2424
describe('getSignatureFromTransaction', () => {
2525
it("returns the signature associated with a transaction's fee payer", () => {
26-
const signatures: OrderedMap<Address, SignatureBytes | null> = {};
26+
const signatures: SignaturesMap = {};
2727
signatures['123' as Address] = new Uint8Array(new Array(64).fill(9)) as SignatureBytes;
2828
const transactionWithFeePayerSignature: Transaction = {
2929
messageBytes: new Uint8Array() as ReadonlyUint8Array as TransactionMessageBytes,
@@ -405,7 +405,7 @@ describe('assertTransactionIsFullySigned', () => {
405405
const mockSignatureB = new Uint8Array(1) as SignatureBytes;
406406

407407
it('throws if the transaction has no signature for the fee payer', () => {
408-
const signatures: OrderedMap<Address, SignatureBytes | null> = {};
408+
const signatures: SignaturesMap = {};
409409
signatures[mockPublicKeyAddressA] = null;
410410
const transaction: Transaction = {
411411
messageBytes: new Uint8Array() as ReadonlyUint8Array as TransactionMessageBytes,
@@ -420,7 +420,7 @@ describe('assertTransactionIsFullySigned', () => {
420420
});
421421

422422
it('throws all missing signers if the transaction has no signature for multiple signers', () => {
423-
const signatures: OrderedMap<Address, SignatureBytes | null> = {};
423+
const signatures: SignaturesMap = {};
424424
signatures[mockPublicKeyAddressA] = null;
425425
signatures[mockPublicKeyAddressB] = null;
426426
const transaction: Transaction = {
@@ -436,7 +436,7 @@ describe('assertTransactionIsFullySigned', () => {
436436
});
437437

438438
it('does not throw if the transaction is signed by its only signer', () => {
439-
const signatures: OrderedMap<Address, SignatureBytes | null> = {};
439+
const signatures: SignaturesMap = {};
440440
signatures[mockPublicKeyAddressA] = mockSignatureA;
441441
const transaction: Transaction = {
442442
messageBytes: new Uint8Array() as ReadonlyUint8Array as TransactionMessageBytes,
@@ -447,7 +447,7 @@ describe('assertTransactionIsFullySigned', () => {
447447
});
448448

449449
it('does not throw if the transaction is signed by all its signers', () => {
450-
const signatures: OrderedMap<Address, SignatureBytes | null> = {};
450+
const signatures: SignaturesMap = {};
451451
signatures[mockPublicKeyAddressA] = mockSignatureA;
452452
signatures[mockPublicKeyAddressB] = mockSignatureB;
453453
const transaction: Transaction = {
@@ -459,7 +459,7 @@ describe('assertTransactionIsFullySigned', () => {
459459
});
460460

461461
it('does not throw if the transaction has no signatures', () => {
462-
const signatures: OrderedMap<Address, SignatureBytes | null> = {};
462+
const signatures: SignaturesMap = {};
463463
const transaction: Transaction = {
464464
messageBytes: new Uint8Array() as ReadonlyUint8Array as TransactionMessageBytes,
465465
signatures,

packages/transactions/src/compile-transaction.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { Address } from '@solana/addresses';
21
import { ReadonlyUint8Array } from '@solana/codecs-core';
3-
import { SignatureBytes } from '@solana/keys';
42
import {
53
CompilableTransactionMessage,
64
getCompiledTransactionMessageEncoder,
@@ -15,7 +13,7 @@ import {
1513
TransactionWithDurableNonceLifetime,
1614
TransactionWithLifetime,
1715
} from './lifetime';
18-
import { OrderedMap, Transaction, TransactionMessageBytes } from './transaction';
16+
import { SignaturesMap, Transaction, TransactionMessageBytes } from './transaction';
1917

2018
export function compileTransaction(
2119
transactionMessage: CompilableTransactionMessage & ITransactionMessageWithBlockhashLifetime,
@@ -38,7 +36,7 @@ export function compileTransaction(
3836
) as ReadonlyUint8Array as TransactionMessageBytes;
3937

4038
const transactionSigners = compiledMessage.staticAccounts.slice(0, compiledMessage.header.numSignerAccounts);
41-
const signatures: OrderedMap<Address, SignatureBytes | null> = {};
39+
const signatures: SignaturesMap = {};
4240
for (const signerAddress of transactionSigners) {
4341
signatures[signerAddress] = null;
4442
}

packages/transactions/src/transaction.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { SignatureBytes } from '@solana/keys';
55
export type TransactionMessageBytes = ReadonlyUint8Array & { readonly __brand: unique symbol };
66
export type TransactionMessageBytesBase64 = string & { readonly __serializedMessageBytesBase64: unique symbol };
77

8-
export type OrderedMap<K extends string, V> = Record<K, V>;
8+
type OrderedMap<K extends string, V> = Record<K, V>;
99
export type SignaturesMap = OrderedMap<Address, SignatureBytes | null>;
1010

1111
export type Transaction = Readonly<{

0 commit comments

Comments
 (0)