@solana/transactions 2.0.0-experimental.68e85dc → 2.0.0-experimental.699bde0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { Base58EncodedAddress } from '@solana/addresses';
1
+ import { Address } from '@solana/addresses';
2
2
  import { IAccountLookupMeta, IAccountMeta, IInstruction, ReadonlyAccount, ReadonlyAccountLookup, ReadonlySignerAccount, WritableAccount, WritableAccountLookup, WritableSignerAccount } from '@solana/instructions';
3
3
  export declare const enum AddressMapEntryType {
4
4
  FEE_PAYER = 0,
@@ -22,7 +22,7 @@ type StaticAccountEntry = Omit<ReadonlyAccount | ReadonlySignerAccount | Writabl
22
22
  };
23
23
  declare const TYPE: unique symbol;
24
24
  export declare const ADDRESS_MAP_TYPE_PROPERTY: typeof TYPE;
25
- export declare function getAddressMapFromInstructions(feePayer: Base58EncodedAddress, instructions: readonly IInstruction[]): AddressMap;
25
+ export declare function getAddressMapFromInstructions(feePayer: Address, instructions: readonly IInstruction[]): AddressMap;
26
26
  export declare function getOrderedAccountsFromAddressMap(addressMap: AddressMap): OrderedAccounts;
27
27
  export {};
28
28
  //# sourceMappingURL=accounts.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { IInstruction } from '@solana/instructions';
2
+ import { ITransactionWithBlockhashLifetime } from './blockhash';
3
+ import { IDurableNonceTransaction } from './durable-nonce';
4
+ import { ITransactionWithFeePayer } from './fee-payer';
5
+ import { BaseTransaction, TransactionVersion } from './types';
6
+ export type CompilableTransaction<TVersion extends TransactionVersion = TransactionVersion, TInstruction extends IInstruction = IInstruction> = BaseTransaction<TVersion, TInstruction> & ITransactionWithFeePayer & (ITransactionWithBlockhashLifetime | IDurableNonceTransaction);
7
+ //# sourceMappingURL=compilable-transaction.d.ts.map
@@ -1,7 +1,7 @@
1
- import { Base58EncodedAddress } from '@solana/addresses';
1
+ import { Address } from '@solana/addresses';
2
2
  import { OrderedAccounts } from './accounts';
3
3
  type AddressTableLookup = Readonly<{
4
- lookupTableAddress: Base58EncodedAddress;
4
+ lookupTableAddress: Address;
5
5
  readableIndices: readonly number[];
6
6
  writableIndices: readonly number[];
7
7
  }>;
@@ -1,4 +1,4 @@
1
- import { Base58EncodedAddress } from '@solana/addresses';
1
+ import { Address } from '@solana/addresses';
2
2
  import { OrderedAccounts } from './accounts';
3
- export declare function getCompiledStaticAccounts(orderedAccounts: OrderedAccounts): Base58EncodedAddress[];
3
+ export declare function getCompiledStaticAccounts(orderedAccounts: OrderedAccounts): Address[];
4
4
  //# sourceMappingURL=compile-static-accounts.d.ts.map
@@ -1,11 +1,10 @@
1
- import { Ed25519Signature } from '@solana/keys';
2
- import { CompiledMessage, compileMessage } from './message';
1
+ import { SignatureBytes } from '@solana/keys';
2
+ import { CompilableTransaction } from './compilable-transaction';
3
+ import { CompiledMessage } from './message';
3
4
  import { ITransactionWithSignatures } from './signatures';
4
- type CompiledTransaction = Readonly<{
5
+ export type CompiledTransaction = Readonly<{
5
6
  compiledMessage: CompiledMessage;
6
- signatures: Ed25519Signature[];
7
+ signatures: SignatureBytes[];
7
8
  }>;
8
- type CompilableTransaction = Parameters<typeof compileMessage>[0];
9
9
  export declare function getCompiledTransaction(transaction: CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)): CompiledTransaction;
10
- export {};
11
10
  //# sourceMappingURL=compile-transaction.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { CompilableTransaction } from './compilable-transaction';
2
+ import { CompiledTransaction } from './compile-transaction';
3
+ import { ITransactionWithSignatures } from './signatures';
4
+ export declare function decompileTransaction(compiledTransaction: CompiledTransaction, lastValidBlockHeight?: bigint): CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures);
5
+ //# sourceMappingURL=decompile-transaction.d.ts.map
@@ -1,20 +1,19 @@
1
- import { Base58EncodedAddress } from '@solana/addresses';
2
- import { IInstruction, IInstructionWithAccounts, IInstructionWithData } from '@solana/instructions';
3
- import { ReadonlyAccount, ReadonlySignerAccount, WritableAccount } from '@solana/instructions/dist/types/accounts';
1
+ import { Address } from '@solana/addresses';
2
+ import { IInstruction, IInstructionWithAccounts, IInstructionWithData, ReadonlyAccount, ReadonlySignerAccount, WritableAccount, WritableSignerAccount } from '@solana/instructions';
4
3
  import { ITransactionWithSignatures } from './signatures';
5
4
  import { BaseTransaction } from './types';
6
5
  type AdvanceNonceAccountInstruction<TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string> = IInstruction<'11111111111111111111111111111111'> & IInstructionWithAccounts<readonly [
7
6
  WritableAccount<TNonceAccountAddress>,
8
7
  ReadonlyAccount<'SysvarRecentB1ockHashes11111111111111111111'>,
9
- ReadonlySignerAccount<TNonceAuthorityAddress>
8
+ ReadonlySignerAccount<TNonceAuthorityAddress> | WritableSignerAccount<TNonceAuthorityAddress>
10
9
  ]> & IInstructionWithData<AdvanceNonceAccountInstructionData>;
11
10
  type AdvanceNonceAccountInstructionData = Uint8Array & {
12
11
  readonly __brand: unique symbol;
13
12
  };
14
13
  type DurableNonceConfig<TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string, TNonceValue extends string = string> = Readonly<{
15
14
  readonly nonce: Nonce<TNonceValue>;
16
- readonly nonceAccountAddress: Base58EncodedAddress<TNonceAccountAddress>;
17
- readonly nonceAuthorityAddress: Base58EncodedAddress<TNonceAuthorityAddress>;
15
+ readonly nonceAccountAddress: Address<TNonceAccountAddress>;
16
+ readonly nonceAuthorityAddress: Address<TNonceAuthorityAddress>;
18
17
  }>;
19
18
  export type Nonce<TNonceValue extends string = string> = TNonceValue & {
20
19
  readonly __brand: unique symbol;
@@ -1,9 +1,9 @@
1
- import { Base58EncodedAddress } from '@solana/addresses';
1
+ import { Address } from '@solana/addresses';
2
2
  import { ITransactionWithSignatures } from './signatures';
3
3
  import { BaseTransaction } from './types';
4
4
  export interface ITransactionWithFeePayer<TAddress extends string = string> {
5
- readonly feePayer: Base58EncodedAddress<TAddress>;
5
+ readonly feePayer: Address<TAddress>;
6
6
  }
7
- export declare function setTransactionFeePayer<TFeePayerAddress extends string, TTransaction extends BaseTransaction>(feePayer: Base58EncodedAddress<TFeePayerAddress>, transaction: (TTransaction & ITransactionWithSignatures) | (TTransaction & ITransactionWithFeePayer<string> & ITransactionWithSignatures)): Omit<TTransaction, keyof ITransactionWithSignatures> & ITransactionWithFeePayer<TFeePayerAddress>;
8
- export declare function setTransactionFeePayer<TFeePayerAddress extends string, TTransaction extends BaseTransaction>(feePayer: Base58EncodedAddress<TFeePayerAddress>, transaction: TTransaction | (TTransaction & ITransactionWithFeePayer<string>)): TTransaction & ITransactionWithFeePayer<TFeePayerAddress>;
7
+ export declare function setTransactionFeePayer<TFeePayerAddress extends string, TTransaction extends BaseTransaction>(feePayer: Address<TFeePayerAddress>, transaction: (TTransaction & ITransactionWithSignatures) | (TTransaction & ITransactionWithFeePayer<string> & ITransactionWithSignatures)): Omit<TTransaction, keyof ITransactionWithSignatures> & ITransactionWithFeePayer<TFeePayerAddress>;
8
+ export declare function setTransactionFeePayer<TFeePayerAddress extends string, TTransaction extends BaseTransaction>(feePayer: Address<TFeePayerAddress>, transaction: TTransaction | (TTransaction & ITransactionWithFeePayer<string>)): TTransaction & ITransactionWithFeePayer<TFeePayerAddress>;
9
9
  //# sourceMappingURL=fee-payer.d.ts.map
@@ -1,4 +1,5 @@
1
1
  export * from './blockhash';
2
+ export * from './compilable-transaction';
2
3
  export * from './create-transaction';
3
4
  export * from './durable-nonce';
4
5
  export * from './fee-payer';
@@ -1,19 +1,15 @@
1
- import { ITransactionWithBlockhashLifetime } from './blockhash';
1
+ import { CompilableTransaction } from './compilable-transaction';
2
2
  import { getCompiledAddressTableLookups } from './compile-address-table-lookups';
3
3
  import { getCompiledMessageHeader } from './compile-header';
4
4
  import { getCompiledInstructions } from './compile-instructions';
5
5
  import { getCompiledLifetimeToken } from './compile-lifetime-token';
6
6
  import { getCompiledStaticAccounts } from './compile-static-accounts';
7
- import { IDurableNonceTransaction } from './durable-nonce';
8
- import { ITransactionWithFeePayer } from './fee-payer';
9
- import { BaseTransaction } from './types';
10
7
  type BaseCompiledMessage = Readonly<{
11
8
  header: ReturnType<typeof getCompiledMessageHeader>;
12
9
  instructions: ReturnType<typeof getCompiledInstructions>;
13
10
  lifetimeToken: ReturnType<typeof getCompiledLifetimeToken>;
14
11
  staticAccounts: ReturnType<typeof getCompiledStaticAccounts>;
15
12
  }>;
16
- type CompilableTransaction = BaseTransaction & ITransactionWithFeePayer & (ITransactionWithBlockhashLifetime | IDurableNonceTransaction);
17
13
  export type CompiledMessage = LegacyCompiledMessage | VersionedCompiledMessage;
18
14
  type LegacyCompiledMessage = BaseCompiledMessage & Readonly<{
19
15
  version: 'legacy';
@@ -1,7 +1,7 @@
1
- import { Encoder } from '@solana/codecs-core';
2
- import { ITransactionWithSignatures } from '..';
3
- import { compileMessage } from '../message';
4
- type CompilableTransaction = Parameters<typeof compileMessage>[0];
1
+ import { Codec, Decoder, Encoder } from '@solana/codecs-core';
2
+ import { CompilableTransaction } from '../compilable-transaction';
3
+ import { ITransactionWithSignatures } from '../signatures';
5
4
  export declare function getTransactionEncoder(): Encoder<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
6
- export {};
5
+ export declare function getTransactionDecoder(lastValidBlockHeight?: bigint): Decoder<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
6
+ export declare function getTransactionCodec(lastValidBlockHeight?: bigint): Codec<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
7
7
  //# sourceMappingURL=transaction.d.ts.map
@@ -1,19 +1,15 @@
1
- import { Base58EncodedAddress } from '@solana/addresses';
2
- import { Ed25519Signature } from '@solana/keys';
1
+ import { Address } from '@solana/addresses';
2
+ import { Signature, SignatureBytes } from '@solana/keys';
3
+ import { CompilableTransaction } from './compilable-transaction';
3
4
  import { ITransactionWithFeePayer } from './fee-payer';
4
- import { compileMessage } from './message';
5
5
  export interface IFullySignedTransaction extends ITransactionWithSignatures {
6
6
  readonly __brand: unique symbol;
7
7
  }
8
8
  export interface ITransactionWithSignatures {
9
- readonly signatures: Readonly<Record<Base58EncodedAddress, Ed25519Signature>>;
9
+ readonly signatures: Readonly<Record<Address, SignatureBytes>>;
10
10
  }
11
- export type TransactionSignature = string & {
12
- readonly __brand: unique symbol;
13
- };
14
- export declare function assertIsTransactionSignature(putativeTransactionSignature: string): asserts putativeTransactionSignature is TransactionSignature;
15
- export declare function isTransactionSignature(putativeTransactionSignature: string): putativeTransactionSignature is TransactionSignature;
16
- export declare function getSignatureFromTransaction(transaction: ITransactionWithFeePayer & ITransactionWithSignatures): TransactionSignature;
17
- export declare function signTransaction<TTransaction extends Parameters<typeof compileMessage>[0]>(keyPairs: CryptoKeyPair[], transaction: TTransaction | (TTransaction & ITransactionWithSignatures)): Promise<TTransaction & ITransactionWithSignatures>;
18
- export declare function transactionSignature(putativeTransactionSignature: string): TransactionSignature;
11
+ export declare function getSignatureFromTransaction(transaction: ITransactionWithFeePayer & ITransactionWithSignatures): Signature;
12
+ export declare function partiallySignTransaction<TTransaction extends CompilableTransaction>(keyPairs: CryptoKeyPair[], transaction: TTransaction | (TTransaction & ITransactionWithSignatures)): Promise<TTransaction & ITransactionWithSignatures>;
13
+ export declare function signTransaction<TTransaction extends CompilableTransaction>(keyPairs: CryptoKeyPair[], transaction: TTransaction | (TTransaction & ITransactionWithSignatures)): Promise<TTransaction & IFullySignedTransaction>;
14
+ export declare function assertTransactionIsFullySigned<TTransaction extends CompilableTransaction>(transaction: TTransaction & ITransactionWithSignatures): asserts transaction is TTransaction & IFullySignedTransaction;
19
15
  //# sourceMappingURL=signatures.d.ts.map
@@ -6,20 +6,13 @@ export type SerializedMessageBytes = Uint8Array & {
6
6
  export type SerializedMessageBytesBase64 = string & {
7
7
  readonly __serializedMessageBytesBase64: unique symbol;
8
8
  };
9
- export type BaseTransaction = Readonly<{
10
- instructions: readonly IInstruction[];
11
- version: TransactionVersion;
12
- }>;
13
- type LegacyTransaction = BaseTransaction & Readonly<{
14
- instructions: readonly (Omit<IInstruction, 'accounts'> & Readonly<{
15
- readonly accounts?: readonly IAccountMeta[];
16
- }>)[];
17
- version: 'legacy';
18
- }>;
19
- type V0Transaction = BaseTransaction & Readonly<{
20
- instructions: readonly IInstruction[];
21
- version: 0;
9
+ export type BaseTransaction<TVersion extends TransactionVersion = TransactionVersion, TInstruction extends IInstruction = IInstruction> = Readonly<{
10
+ instructions: readonly TInstruction[];
11
+ version: TVersion;
22
12
  }>;
13
+ type ILegacyInstruction<TProgramAddress extends string = string> = IInstruction<TProgramAddress, readonly IAccountMeta[]>;
14
+ type LegacyTransaction = BaseTransaction<'legacy', ILegacyInstruction>;
15
+ type V0Transaction = BaseTransaction<0, IInstruction>;
23
16
  export type Transaction = LegacyTransaction | V0Transaction;
24
17
  export type TransactionVersion = 'legacy' | 0;
25
18
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/transactions",
3
- "version": "2.0.0-experimental.68e85dc",
3
+ "version": "2.0.0-experimental.699bde0",
4
4
  "description": "Helpers for creating and serializing transactions",
5
5
  "exports": {
6
6
  "browser": {
@@ -46,14 +46,13 @@
46
46
  "maintained node versions"
47
47
  ],
48
48
  "dependencies": {
49
- "@metaplex-foundation/umi-serializers": "^0.8.9",
50
- "@solana/addresses": "2.0.0-experimental.68e85dc",
51
- "@solana/codecs-core": "2.0.0-experimental.68e85dc",
52
- "@solana/codecs-data-structures": "2.0.0-experimental.68e85dc",
53
- "@solana/codecs-numbers": "2.0.0-experimental.68e85dc",
54
- "@solana/codecs-strings": "2.0.0-experimental.68e85dc",
55
- "@solana/functional": "2.0.0-experimental.68e85dc",
56
- "@solana/keys": "2.0.0-experimental.68e85dc"
49
+ "@solana/codecs-core": "2.0.0-experimental.699bde0",
50
+ "@solana/addresses": "2.0.0-experimental.699bde0",
51
+ "@solana/codecs-data-structures": "2.0.0-experimental.699bde0",
52
+ "@solana/codecs-numbers": "2.0.0-experimental.699bde0",
53
+ "@solana/functional": "2.0.0-experimental.699bde0",
54
+ "@solana/codecs-strings": "2.0.0-experimental.699bde0",
55
+ "@solana/keys": "2.0.0-experimental.699bde0"
57
56
  },
58
57
  "devDependencies": {
59
58
  "@solana/eslint-config-solana": "^1.0.2",
@@ -69,14 +68,14 @@
69
68
  "jest-runner-eslint": "^2.1.2",
70
69
  "jest-runner-prettier": "^1.0.0",
71
70
  "prettier": "^2.8",
72
- "tsup": "7.2.0",
71
+ "tsup": "^8.0.1",
73
72
  "typescript": "^5.2.2",
74
73
  "version-from-git": "^1.1.1",
75
- "@solana/instructions": "2.0.0-experimental.68e85dc",
76
- "build-scripts": "0.0.0",
74
+ "@solana/instructions": "2.0.0-experimental.699bde0",
77
75
  "test-config": "0.0.0",
78
- "test-matchers": "0.0.0",
79
- "tsconfig": "0.0.0"
76
+ "build-scripts": "0.0.0",
77
+ "tsconfig": "0.0.0",
78
+ "test-matchers": "0.0.0"
80
79
  },
81
80
  "bundlewatch": {
82
81
  "defaultCompression": "gzip",