@solana/transactions 2.0.0-experimental.762ff13 → 2.0.0-experimental.76cf6b4

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 (69) hide show
  1. package/README.md +1 -43
  2. package/dist/index.browser.cjs +260 -429
  3. package/dist/index.browser.cjs.map +1 -1
  4. package/dist/index.browser.js +256 -430
  5. package/dist/index.browser.js.map +1 -1
  6. package/dist/index.development.js +679 -829
  7. package/dist/index.development.js.map +1 -1
  8. package/dist/index.native.js +256 -432
  9. package/dist/index.native.js.map +1 -1
  10. package/dist/index.node.cjs +260 -429
  11. package/dist/index.node.cjs.map +1 -1
  12. package/dist/index.node.js +256 -432
  13. package/dist/index.node.js.map +1 -1
  14. package/dist/index.production.min.js +23 -20
  15. package/dist/types/accounts.d.ts +2 -2
  16. package/dist/types/accounts.d.ts.map +1 -0
  17. package/dist/types/blockhash.d.ts +4 -3
  18. package/dist/types/blockhash.d.ts.map +1 -0
  19. package/dist/types/compilable-transaction.d.ts +7 -0
  20. package/dist/types/compilable-transaction.d.ts.map +1 -0
  21. package/dist/types/compile-address-table-lookups.d.ts +3 -3
  22. package/dist/types/compile-address-table-lookups.d.ts.map +1 -0
  23. package/dist/types/compile-header.d.ts +1 -1
  24. package/dist/types/compile-header.d.ts.map +1 -0
  25. package/dist/types/compile-instructions.d.ts +1 -1
  26. package/dist/types/compile-instructions.d.ts.map +1 -0
  27. package/dist/types/compile-lifetime-token.d.ts +1 -1
  28. package/dist/types/compile-lifetime-token.d.ts.map +1 -0
  29. package/dist/types/compile-static-accounts.d.ts +3 -3
  30. package/dist/types/compile-static-accounts.d.ts.map +1 -0
  31. package/dist/types/compile-transaction.d.ts +6 -7
  32. package/dist/types/compile-transaction.d.ts.map +1 -0
  33. package/dist/types/create-transaction.d.ts +1 -1
  34. package/dist/types/create-transaction.d.ts.map +1 -0
  35. package/dist/types/decompile-transaction.d.ts +3 -5
  36. package/dist/types/decompile-transaction.d.ts.map +1 -0
  37. package/dist/types/durable-nonce.d.ts +5 -5
  38. package/dist/types/durable-nonce.d.ts.map +1 -0
  39. package/dist/types/fee-payer.d.ts +6 -6
  40. package/dist/types/fee-payer.d.ts.map +1 -0
  41. package/dist/types/index.d.ts +11 -9
  42. package/dist/types/index.d.ts.map +1 -0
  43. package/dist/types/instructions.d.ts +2 -2
  44. package/dist/types/instructions.d.ts.map +1 -0
  45. package/dist/types/message.d.ts +6 -10
  46. package/dist/types/message.d.ts.map +1 -0
  47. package/dist/types/serializers/address-table-lookup.d.ts +5 -5
  48. package/dist/types/serializers/address-table-lookup.d.ts.map +1 -0
  49. package/dist/types/serializers/header.d.ts +5 -5
  50. package/dist/types/serializers/header.d.ts.map +1 -0
  51. package/dist/types/serializers/index.d.ts +2 -1
  52. package/dist/types/serializers/index.d.ts.map +1 -0
  53. package/dist/types/serializers/instruction.d.ts +5 -5
  54. package/dist/types/serializers/instruction.d.ts.map +1 -0
  55. package/dist/types/serializers/message.d.ts +5 -5
  56. package/dist/types/serializers/message.d.ts.map +1 -0
  57. package/dist/types/serializers/transaction-version.d.ts +5 -5
  58. package/dist/types/serializers/transaction-version.d.ts.map +1 -0
  59. package/dist/types/serializers/transaction.d.ts +6 -8
  60. package/dist/types/serializers/transaction.d.ts.map +1 -0
  61. package/dist/types/signatures.d.ts +9 -14
  62. package/dist/types/signatures.d.ts.map +1 -0
  63. package/dist/types/types.d.ts +6 -13
  64. package/dist/types/types.d.ts.map +1 -0
  65. package/dist/types/unsigned-transaction.d.ts +1 -1
  66. package/dist/types/unsigned-transaction.d.ts.map +1 -0
  67. package/dist/types/wire-transaction.d.ts +1 -1
  68. package/dist/types/wire-transaction.d.ts.map +1 -0
  69. package/package.json +15 -15
@@ -1,9 +1,7 @@
1
- import { Codec, Decoder, Encoder } from '@solana/codecs-core';
2
- import { compileMessage } from '../message';
3
- import { ITransactionWithSignatures } from '../signatures';
4
- type CompilableTransaction = Parameters<typeof compileMessage>[0];
5
- export declare function getTransactionEncoder(): Encoder<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
6
- export declare function getTransactionDecoder(lastValidBlockHeight?: bigint): Decoder<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
7
- export declare function getTransactionCodec(lastValidBlockHeight?: bigint): Codec<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
8
- export {};
1
+ import { VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
2
+ import { CompilableTransaction } from '../compilable-transaction.js';
3
+ import { ITransactionWithSignatures } from '../signatures.js';
4
+ export declare function getTransactionEncoder(): VariableSizeEncoder<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
5
+ export declare function getTransactionDecoder(lastValidBlockHeight?: bigint): VariableSizeDecoder<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
6
+ export declare function getTransactionCodec(lastValidBlockHeight?: bigint): VariableSizeCodec<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
9
7
  //# sourceMappingURL=transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/serializers/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAY7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAsB3D,wBAAgB,qBAAqB,IAAI,mBAAmB,CACxD,qBAAqB,GAAG,CAAC,qBAAqB,GAAG,0BAA0B,CAAC,CAC/E,CAEA;AAED,wBAAgB,qBAAqB,CACjC,oBAAoB,CAAC,EAAE,MAAM,GAC9B,mBAAmB,CAAC,qBAAqB,GAAG,CAAC,qBAAqB,GAAG,0BAA0B,CAAC,CAAC,CAInG;AAED,wBAAgB,mBAAmB,CAC/B,oBAAoB,CAAC,EAAE,MAAM,GAC9B,iBAAiB,CAAC,qBAAqB,GAAG,CAAC,qBAAqB,GAAG,0BAA0B,CAAC,CAAC,CAEjG"}
@@ -1,20 +1,15 @@
1
- import { Base58EncodedAddress } from '@solana/addresses';
2
- import { Ed25519Signature } from '@solana/keys';
3
- import { ITransactionWithFeePayer } from './fee-payer';
4
- import { compileMessage } from './message';
1
+ import { Address } from '@solana/addresses';
2
+ import { Signature, SignatureBytes } from '@solana/keys';
3
+ import { CompilableTransaction } from './compilable-transaction.js';
4
+ import { ITransactionWithFeePayer } from './fee-payer.js';
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;
19
- export declare function assertTransactionIsFullySigned<TTransaction extends Parameters<typeof compileMessage>[0]>(transaction: TTransaction & ITransactionWithSignatures): asserts transaction is TTransaction & IFullySignedTransaction;
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;
20
15
  //# sourceMappingURL=signatures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signatures.d.ts","sourceRoot":"","sources":["../../src/signatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA2B,MAAM,mBAAmB,CAAC;AAIrE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAa,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAIvD,MAAM,WAAW,uBAAwB,SAAQ,0BAA0B;IACvE,QAAQ,CAAC,OAAO,EAAE,OAAO,MAAM,CAAC;CACnC;AACD,MAAM,WAAW,0BAA0B;IACvC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;CAClE;AAID,wBAAgB,2BAA2B,CACvC,WAAW,EAAE,wBAAwB,GAAG,0BAA0B,GACnE,SAAS,CAaX;AAED,wBAAsB,wBAAwB,CAAC,YAAY,SAAS,qBAAqB,EACrF,QAAQ,EAAE,aAAa,EAAE,EACzB,WAAW,EAAE,YAAY,GAAG,CAAC,YAAY,GAAG,0BAA0B,CAAC,GACxE,OAAO,CAAC,YAAY,GAAG,0BAA0B,CAAC,CAmBpD;AAED,wBAAsB,eAAe,CAAC,YAAY,SAAS,qBAAqB,EAC5E,QAAQ,EAAE,aAAa,EAAE,EACzB,WAAW,EAAE,YAAY,GAAG,CAAC,YAAY,GAAG,0BAA0B,CAAC,GACxE,OAAO,CAAC,YAAY,GAAG,uBAAuB,CAAC,CAKjD;AAED,wBAAgB,8BAA8B,CAAC,YAAY,SAAS,qBAAqB,EACrF,WAAW,EAAE,YAAY,GAAG,0BAA0B,GACvD,OAAO,CAAC,WAAW,IAAI,YAAY,GAAG,uBAAuB,CAY/D"}
@@ -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 {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAElE,iEAAiE;AACjE,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG;IAAE,QAAQ,CAAC,wBAAwB,EAAE,OAAO,MAAM,CAAA;CAAE,CAAC;AACvG,MAAM,MAAM,4BAA4B,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,8BAA8B,EAAE,OAAO,MAAM,CAAA;CAAE,CAAC;AAE/G,MAAM,MAAM,eAAe,CACvB,QAAQ,SAAS,kBAAkB,GAAG,kBAAkB,EACxD,YAAY,SAAS,YAAY,GAAG,YAAY,IAChD,QAAQ,CAAC;IACT,YAAY,EAAE,SAAS,YAAY,EAAE,CAAC;IACtC,OAAO,EAAE,QAAQ,CAAC;CACrB,CAAC,CAAC;AAEH,KAAK,kBAAkB,CAAC,eAAe,SAAS,MAAM,GAAG,MAAM,IAAI,YAAY,CAC3E,eAAe,EACf,SAAS,YAAY,EAAE,CAC1B,CAAC;AACF,KAAK,iBAAiB,GAAG,eAAe,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;AACvE,KAAK,aAAa,GAAG,eAAe,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;AAEtD,MAAM,MAAM,WAAW,GAAG,iBAAiB,GAAG,aAAa,CAAC;AAC5D,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { ITransactionWithSignatures } from '.';
2
- import { BaseTransaction } from './types';
2
+ import { BaseTransaction } from './types.js';
3
3
  export declare function getUnsignedTransaction<TTransaction extends BaseTransaction>(transaction: TTransaction | (TTransaction & ITransactionWithSignatures)): TTransaction | Omit<TTransaction & ITransactionWithSignatures, keyof ITransactionWithSignatures>;
4
4
  //# sourceMappingURL=unsigned-transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unsigned-transaction.d.ts","sourceRoot":"","sources":["../../src/unsigned-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,GAAG,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,sBAAsB,CAAC,YAAY,SAAS,eAAe,EACvE,WAAW,EAAE,YAAY,GAAG,CAAC,YAAY,GAAG,0BAA0B,CAAC,GACxE,YAAY,GAAG,IAAI,CAAC,YAAY,GAAG,0BAA0B,EAAE,MAAM,0BAA0B,CAAC,CAWlG"}
@@ -1,4 +1,4 @@
1
- import { getTransactionEncoder } from './serializers/transaction';
1
+ import { getTransactionEncoder } from './serializers/transaction.js';
2
2
  export type Base64EncodedWireTransaction = string & {
3
3
  readonly __brand: unique symbol;
4
4
  };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wire-transaction.d.ts","sourceRoot":"","sources":["../../src/wire-transaction.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,MAAM,MAAM,4BAA4B,GAAG,MAAM,GAAG;IAChD,QAAQ,CAAC,OAAO,EAAE,OAAO,MAAM,CAAC;CACnC,CAAC;AAEF,wBAAgB,+BAA+B,CAC3C,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAC/E,4BAA4B,CAG9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/transactions",
3
- "version": "2.0.0-experimental.762ff13",
3
+ "version": "2.0.0-experimental.76cf6b4",
4
4
  "description": "Helpers for creating and serializing transactions",
5
5
  "exports": {
6
6
  "browser": {
@@ -46,19 +46,19 @@
46
46
  "maintained node versions"
47
47
  ],
48
48
  "dependencies": {
49
- "@solana/addresses": "2.0.0-experimental.762ff13",
50
- "@solana/codecs-core": "2.0.0-experimental.762ff13",
51
- "@solana/codecs-data-structures": "2.0.0-experimental.762ff13",
52
- "@solana/codecs-numbers": "2.0.0-experimental.762ff13",
53
- "@solana/codecs-strings": "2.0.0-experimental.762ff13",
54
- "@solana/functional": "2.0.0-experimental.762ff13",
55
- "@solana/keys": "2.0.0-experimental.762ff13"
49
+ "@solana/addresses": "2.0.0-experimental.76cf6b4",
50
+ "@solana/codecs-core": "2.0.0-experimental.76cf6b4",
51
+ "@solana/codecs-data-structures": "2.0.0-experimental.76cf6b4",
52
+ "@solana/codecs-numbers": "2.0.0-experimental.76cf6b4",
53
+ "@solana/codecs-strings": "2.0.0-experimental.76cf6b4",
54
+ "@solana/keys": "2.0.0-experimental.76cf6b4",
55
+ "@solana/functional": "2.0.0-experimental.76cf6b4"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@solana/eslint-config-solana": "^1.0.2",
59
59
  "@swc/jest": "^0.2.29",
60
- "@types/jest": "^29.5.6",
61
- "@types/node": "^20.6.3",
60
+ "@types/jest": "^29.5.11",
61
+ "@types/node": "18.11.19",
62
62
  "@typescript-eslint/eslint-plugin": "^6.7.0",
63
63
  "@typescript-eslint/parser": "^6.3.0",
64
64
  "agadoo": "^3.0.0",
@@ -67,14 +67,14 @@
67
67
  "jest": "^29.7.0",
68
68
  "jest-runner-eslint": "^2.1.2",
69
69
  "jest-runner-prettier": "^1.0.0",
70
- "prettier": "^2.8",
71
- "tsup": "7.2.0",
70
+ "prettier": "^3.1",
71
+ "tsup": "^8.0.1",
72
72
  "typescript": "^5.2.2",
73
73
  "version-from-git": "^1.1.1",
74
- "@solana/instructions": "2.0.0-experimental.762ff13",
74
+ "@solana/instructions": "2.0.0-experimental.76cf6b4",
75
+ "test-matchers": "0.0.0",
75
76
  "build-scripts": "0.0.0",
76
77
  "test-config": "0.0.0",
77
- "test-matchers": "0.0.0",
78
78
  "tsconfig": "0.0.0"
79
79
  },
80
80
  "bundlewatch": {
@@ -87,7 +87,7 @@
87
87
  },
88
88
  "scripts": {
89
89
  "compile:js": "tsup --config build-scripts/tsup.config.library.ts",
90
- "compile:typedefs": "tsc -p ./tsconfig.declarations.json",
90
+ "compile:typedefs": "tsc -p ./tsconfig.declarations.json && node node_modules/build-scripts/add-js-extension-to-types.mjs",
91
91
  "dev": "jest -c node_modules/test-config/jest-dev.config.ts --rootDir . --watch",
92
92
  "publish-packages": "pnpm publish --tag experimental --access public --no-git-checks",
93
93
  "style:fix": "pnpm eslint --fix src/* && pnpm prettier -w src/* package.json",