@solana/transactions 2.0.0-experimental.ee9f3d8 → 2.0.0-experimental.ef09aec

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.
Files changed (41) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +272 -5
  3. package/dist/index.browser.cjs +1019 -39
  4. package/dist/index.browser.cjs.map +1 -1
  5. package/dist/index.browser.js +1003 -38
  6. package/dist/index.browser.js.map +1 -1
  7. package/dist/index.development.js +1734 -37
  8. package/dist/index.development.js.map +1 -1
  9. package/dist/index.native.js +1003 -38
  10. package/dist/index.native.js.map +1 -1
  11. package/dist/index.node.cjs +1019 -37
  12. package/dist/index.node.cjs.map +1 -1
  13. package/dist/index.node.js +1005 -38
  14. package/dist/index.node.js.map +1 -1
  15. package/dist/index.production.min.js +22 -5
  16. package/dist/types/accounts.d.ts +28 -0
  17. package/dist/types/blockhash.d.ts +9 -1
  18. package/dist/types/compilable-transaction.d.ts +7 -0
  19. package/dist/types/compile-address-table-lookups.d.ts +10 -0
  20. package/dist/types/compile-header.d.ts +9 -0
  21. package/dist/types/compile-instructions.d.ts +10 -0
  22. package/dist/types/compile-lifetime-token.d.ts +3 -0
  23. package/dist/types/compile-static-accounts.d.ts +4 -0
  24. package/dist/types/compile-transaction.d.ts +10 -0
  25. package/dist/types/decompile-transaction.d.ts +5 -0
  26. package/dist/types/durable-nonce.d.ts +23 -10
  27. package/dist/types/fee-payer.d.ts +4 -3
  28. package/dist/types/index.d.ts +4 -0
  29. package/dist/types/message.d.ts +26 -0
  30. package/dist/types/serializers/address-table-lookup.d.ts +8 -0
  31. package/dist/types/serializers/header.d.ts +8 -0
  32. package/dist/types/serializers/index.d.ts +3 -0
  33. package/dist/types/serializers/instruction.d.ts +8 -0
  34. package/dist/types/serializers/message.d.ts +6 -0
  35. package/dist/types/serializers/transaction-version.d.ts +6 -0
  36. package/dist/types/serializers/transaction.d.ts +7 -0
  37. package/dist/types/signatures.d.ts +10 -7
  38. package/dist/types/types.d.ts +13 -13
  39. package/dist/types/unsigned-transaction.d.ts +4 -0
  40. package/dist/types/wire-transaction.d.ts +6 -0
  41. package/package.json +22 -20
@@ -0,0 +1,8 @@
1
+ import { Codec, Decoder, Encoder } from '@solana/codecs-core';
2
+ import { getCompiledInstructions } from '../compile-instructions';
3
+ type Instruction = ReturnType<typeof getCompiledInstructions>[number];
4
+ export declare function getInstructionEncoder(): Encoder<Instruction>;
5
+ export declare function getInstructionDecoder(): Decoder<Instruction>;
6
+ export declare function getInstructionCodec(): Codec<Instruction>;
7
+ export {};
8
+ //# sourceMappingURL=instruction.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { Codec, Decoder, Encoder } from '@solana/codecs-core';
2
+ import { CompiledMessage } from '../message';
3
+ export declare function getCompiledMessageEncoder(): Encoder<CompiledMessage>;
4
+ export declare function getCompiledMessageDecoder(): Decoder<CompiledMessage>;
5
+ export declare function getCompiledMessageCodec(): Codec<CompiledMessage>;
6
+ //# sourceMappingURL=message.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { Codec, Decoder, Encoder } from '@solana/codecs-core';
2
+ import { TransactionVersion } from '../types';
3
+ export declare function getTransactionVersionDecoder(): Decoder<TransactionVersion>;
4
+ export declare function getTransactionVersionEncoder(): Encoder<TransactionVersion>;
5
+ export declare function getTransactionVersionCodec(): Codec<TransactionVersion>;
6
+ //# sourceMappingURL=transaction-version.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { Codec, Decoder, Encoder } from '@solana/codecs-core';
2
+ import { CompilableTransaction } from '../compilable-transaction';
3
+ import { ITransactionWithSignatures } from '../signatures';
4
+ export declare function getTransactionEncoder(): Encoder<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
5
+ export declare function getTransactionDecoder(lastValidBlockHeight?: bigint): Decoder<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
6
+ export declare function getTransactionCodec(lastValidBlockHeight?: bigint): Codec<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
7
+ //# sourceMappingURL=transaction.d.ts.map
@@ -1,12 +1,15 @@
1
- import { Base58EncodedAddress } from '@solana/keys';
2
- type Base64EncodedSignature = string & {
3
- readonly __base64EncodedSignature: unique symbol;
4
- };
1
+ import { Address } from '@solana/addresses';
2
+ import { Signature, SignatureBytes } from '@solana/keys';
3
+ import { CompilableTransaction } from './compilable-transaction';
4
+ import { ITransactionWithFeePayer } from './fee-payer';
5
5
  export interface IFullySignedTransaction extends ITransactionWithSignatures {
6
- readonly __fullySignedTransaction: unique symbol;
6
+ readonly __brand: unique symbol;
7
7
  }
8
8
  export interface ITransactionWithSignatures {
9
- readonly signatures: Readonly<Record<Base58EncodedAddress, Base64EncodedSignature>>;
9
+ readonly signatures: Readonly<Record<Address, SignatureBytes>>;
10
10
  }
11
- export {};
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;
12
15
  //# sourceMappingURL=signatures.d.ts.map
@@ -1,18 +1,18 @@
1
1
  import { IAccountMeta, IInstruction } from '@solana/instructions';
2
- export type BaseTransaction = Readonly<{
3
- instructions: readonly IInstruction[];
4
- version: TransactionVersion;
5
- }>;
6
- type LegacyTransaction = BaseTransaction & Readonly<{
7
- instructions: readonly (Omit<IInstruction, 'accounts'> & Readonly<{
8
- readonly accounts?: readonly IAccountMeta[];
9
- }>)[];
10
- version: 'legacy';
11
- }>;
12
- type V0Transaction = BaseTransaction & Readonly<{
13
- instructions: readonly IInstruction[];
14
- version: 0;
2
+ /** A string of bytes that are definitely a serialized message */
3
+ export type SerializedMessageBytes = Uint8Array & {
4
+ readonly __serializedMessageBytes: unique symbol;
5
+ };
6
+ export type SerializedMessageBytesBase64 = string & {
7
+ readonly __serializedMessageBytesBase64: unique symbol;
8
+ };
9
+ export type BaseTransaction<TVersion extends TransactionVersion = TransactionVersion, TInstruction extends IInstruction = IInstruction> = Readonly<{
10
+ instructions: readonly TInstruction[];
11
+ version: TVersion;
15
12
  }>;
13
+ type ILegacyInstruction<TProgramAddress extends string = string> = IInstruction<TProgramAddress, readonly IAccountMeta[]>;
14
+ type LegacyTransaction = BaseTransaction<'legacy', ILegacyInstruction>;
15
+ type V0Transaction = BaseTransaction<0, IInstruction>;
16
16
  export type Transaction = LegacyTransaction | V0Transaction;
17
17
  export type TransactionVersion = 'legacy' | 0;
18
18
  export {};
@@ -0,0 +1,4 @@
1
+ import { ITransactionWithSignatures } from '.';
2
+ import { BaseTransaction } from './types';
3
+ export declare function getUnsignedTransaction<TTransaction extends BaseTransaction>(transaction: TTransaction | (TTransaction & ITransactionWithSignatures)): TTransaction | Omit<TTransaction & ITransactionWithSignatures, keyof ITransactionWithSignatures>;
4
+ //# sourceMappingURL=unsigned-transaction.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { getTransactionEncoder } from './serializers/transaction';
2
+ export type Base64EncodedWireTransaction = string & {
3
+ readonly __brand: unique symbol;
4
+ };
5
+ export declare function getBase64EncodedWireTransaction(transaction: Parameters<ReturnType<typeof getTransactionEncoder>['encode']>[0]): Base64EncodedWireTransaction;
6
+ //# sourceMappingURL=wire-transaction.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/transactions",
3
- "version": "2.0.0-experimental.ee9f3d8",
3
+ "version": "2.0.0-experimental.ef09aec",
4
4
  "description": "Helpers for creating and serializing transactions",
5
5
  "exports": {
6
6
  "browser": {
@@ -46,32 +46,33 @@
46
46
  "maintained node versions"
47
47
  ],
48
48
  "dependencies": {
49
- "@metaplex-foundation/umi-serializers": "^0.8.2",
50
- "@solana/keys": "2.0.0-experimental.ee9f3d8"
49
+ "@solana/addresses": "2.0.0-experimental.ef09aec",
50
+ "@solana/codecs-data-structures": "2.0.0-experimental.ef09aec",
51
+ "@solana/codecs-core": "2.0.0-experimental.ef09aec",
52
+ "@solana/codecs-numbers": "2.0.0-experimental.ef09aec",
53
+ "@solana/codecs-strings": "2.0.0-experimental.ef09aec",
54
+ "@solana/functional": "2.0.0-experimental.ef09aec",
55
+ "@solana/keys": "2.0.0-experimental.ef09aec"
51
56
  },
52
57
  "devDependencies": {
53
58
  "@solana/eslint-config-solana": "^1.0.2",
54
- "@swc/core": "^1.3.18",
55
- "@swc/jest": "^0.2.23",
56
- "@types/jest": "^29.5.2",
57
- "@typescript-eslint/eslint-plugin": "^6.0.0",
58
- "@typescript-eslint/parser": "^6.0.0",
59
+ "@swc/jest": "^0.2.29",
60
+ "@types/jest": "^29.5.6",
61
+ "@types/node": "^20.6.3",
62
+ "@typescript-eslint/eslint-plugin": "^6.7.0",
63
+ "@typescript-eslint/parser": "^6.3.0",
59
64
  "agadoo": "^3.0.0",
60
65
  "eslint": "^8.45.0",
61
66
  "eslint-plugin-sort-keys-fix": "^1.1.2",
62
- "jest": "^29.6.1",
63
- "jest-runner-eslint": "^2.0.0",
67
+ "jest": "^29.7.0",
68
+ "jest-runner-eslint": "^2.1.2",
64
69
  "jest-runner-prettier": "^1.0.0",
65
- "postcss": "^8.4.12",
66
- "prettier": "^2.7.1",
67
- "ts-node": "^10.9.1",
68
- "tsup": "6.7.0",
69
- "typescript": "^5.1.6",
70
+ "prettier": "^2.8",
71
+ "tsup": "^8.0.1",
72
+ "typescript": "^5.2.2",
70
73
  "version-from-git": "^1.1.1",
71
- "@solana/instructions": "2.0.0-experimental.ee9f3d8",
72
- "@solana/keys": "2.0.0-experimental.ee9f3d8",
73
- "@solana/rpc-core": "2.0.0-experimental.ee9f3d8",
74
74
  "build-scripts": "0.0.0",
75
+ "@solana/instructions": "2.0.0-experimental.ef09aec",
75
76
  "test-config": "0.0.0",
76
77
  "test-matchers": "0.0.0",
77
78
  "tsconfig": "0.0.0"
@@ -89,11 +90,12 @@
89
90
  "compile:typedefs": "tsc -p ./tsconfig.declarations.json",
90
91
  "dev": "jest -c node_modules/test-config/jest-dev.config.ts --rootDir . --watch",
91
92
  "publish-packages": "pnpm publish --tag experimental --access public --no-git-checks",
93
+ "style:fix": "pnpm eslint --fix src/* && pnpm prettier -w src/* package.json",
92
94
  "test:lint": "jest -c node_modules/test-config/jest-lint.config.ts --rootDir . --silent",
93
95
  "test:prettier": "jest -c node_modules/test-config/jest-prettier.config.ts --rootDir . --silent",
94
96
  "test:treeshakability:browser": "agadoo dist/index.browser.js",
95
- "test:treeshakability:native": "agadoo dist/index.node.js",
96
- "test:treeshakability:node": "agadoo dist/index.native.js",
97
+ "test:treeshakability:native": "agadoo dist/index.native.js",
98
+ "test:treeshakability:node": "agadoo dist/index.node.js",
97
99
  "test:typecheck": "tsc --noEmit",
98
100
  "test:unit:browser": "jest -c node_modules/test-config/jest-unit.config.browser.ts --rootDir . --silent",
99
101
  "test:unit:node": "jest -c node_modules/test-config/jest-unit.config.node.ts --rootDir . --silent"