@solana/transactions 2.0.0-experimental.f291d36 → 2.0.0-experimental.f2a2e5b

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 (70) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +272 -5
  3. package/dist/index.browser.cjs +928 -37
  4. package/dist/index.browser.cjs.map +1 -1
  5. package/dist/index.browser.js +908 -38
  6. package/dist/index.browser.js.map +1 -1
  7. package/dist/index.native.js +908 -38
  8. package/dist/index.native.js.map +1 -1
  9. package/dist/index.node.cjs +928 -37
  10. package/dist/index.node.cjs.map +1 -1
  11. package/dist/index.node.js +908 -38
  12. package/dist/index.node.js.map +1 -1
  13. package/dist/types/accounts.d.ts +28 -0
  14. package/dist/types/accounts.d.ts.map +1 -0
  15. package/dist/types/blockhash.d.ts +7 -1
  16. package/dist/types/blockhash.d.ts.map +1 -0
  17. package/dist/types/compilable-transaction.d.ts +7 -0
  18. package/dist/types/compilable-transaction.d.ts.map +1 -0
  19. package/dist/types/compile-address-table-lookups.d.ts +10 -0
  20. package/dist/types/compile-address-table-lookups.d.ts.map +1 -0
  21. package/dist/types/compile-header.d.ts +9 -0
  22. package/dist/types/compile-header.d.ts.map +1 -0
  23. package/dist/types/compile-instructions.d.ts +10 -0
  24. package/dist/types/compile-instructions.d.ts.map +1 -0
  25. package/dist/types/compile-lifetime-token.d.ts +3 -0
  26. package/dist/types/compile-lifetime-token.d.ts.map +1 -0
  27. package/dist/types/compile-static-accounts.d.ts +4 -0
  28. package/dist/types/compile-static-accounts.d.ts.map +1 -0
  29. package/dist/types/compile-transaction.d.ts +10 -0
  30. package/dist/types/compile-transaction.d.ts.map +1 -0
  31. package/dist/types/create-transaction.d.ts +1 -1
  32. package/dist/types/create-transaction.d.ts.map +1 -0
  33. package/dist/types/decompile-transaction.d.ts +13 -0
  34. package/dist/types/decompile-transaction.d.ts.map +1 -0
  35. package/dist/types/durable-nonce.d.ts +23 -10
  36. package/dist/types/durable-nonce.d.ts.map +1 -0
  37. package/dist/types/fee-payer.d.ts +6 -5
  38. package/dist/types/fee-payer.d.ts.map +1 -0
  39. package/dist/types/index.d.ts +12 -7
  40. package/dist/types/index.d.ts.map +1 -0
  41. package/dist/types/instructions.d.ts +2 -2
  42. package/dist/types/instructions.d.ts.map +1 -0
  43. package/dist/types/message.d.ts +26 -0
  44. package/dist/types/message.d.ts.map +1 -0
  45. package/dist/types/serializers/address-table-lookup.d.ts +8 -0
  46. package/dist/types/serializers/address-table-lookup.d.ts.map +1 -0
  47. package/dist/types/serializers/header.d.ts +8 -0
  48. package/dist/types/serializers/header.d.ts.map +1 -0
  49. package/dist/types/serializers/index.d.ts +3 -0
  50. package/dist/types/serializers/index.d.ts.map +1 -0
  51. package/dist/types/serializers/instruction.d.ts +8 -0
  52. package/dist/types/serializers/instruction.d.ts.map +1 -0
  53. package/dist/types/serializers/message.d.ts +6 -0
  54. package/dist/types/serializers/message.d.ts.map +1 -0
  55. package/dist/types/serializers/transaction-version.d.ts +6 -0
  56. package/dist/types/serializers/transaction-version.d.ts.map +1 -0
  57. package/dist/types/serializers/transaction.d.ts +10 -0
  58. package/dist/types/serializers/transaction.d.ts.map +1 -0
  59. package/dist/types/signatures.d.ts +10 -7
  60. package/dist/types/signatures.d.ts.map +1 -0
  61. package/dist/types/types.d.ts +13 -13
  62. package/dist/types/types.d.ts.map +1 -0
  63. package/dist/types/unsigned-transaction.d.ts +4 -0
  64. package/dist/types/unsigned-transaction.d.ts.map +1 -0
  65. package/dist/types/wire-transaction.d.ts +6 -0
  66. package/dist/types/wire-transaction.d.ts.map +1 -0
  67. package/package.json +28 -24
  68. package/dist/index.development.js +0 -86
  69. package/dist/index.development.js.map +0 -1
  70. package/dist/index.production.min.js +0 -14
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address-table-lookup.d.ts","sourceRoot":"","sources":["../../../src/serializers/address-table-lookup.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EAC3B,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAEvF,KAAK,kBAAkB,GAAG,UAAU,CAAC,OAAO,8BAA8B,CAAC,CAAC,MAAM,CAAC,CAAC;AAGpF,wBAAgB,4BAA4B,IAAI,mBAAmB,CAAC,kBAAkB,CAAC,CAgBtF;AAGD,wBAAgB,4BAA4B,IAAI,mBAAmB,CAAC,kBAAkB,CAAC,CAUtF;AAED,wBAAgB,0BAA0B,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,CAElF"}
@@ -0,0 +1,8 @@
1
+ import { FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder } from '@solana/codecs-core';
2
+ import { getCompiledMessageHeader } from '../compile-header.js';
3
+ type MessageHeader = ReturnType<typeof getCompiledMessageHeader>;
4
+ export declare function getMessageHeaderEncoder(): FixedSizeEncoder<MessageHeader, 3>;
5
+ export declare function getMessageHeaderDecoder(): FixedSizeDecoder<MessageHeader, 3>;
6
+ export declare function getMessageHeaderCodec(): FixedSizeCodec<MessageHeader, MessageHeader, 3>;
7
+ export {};
8
+ //# sourceMappingURL=header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../src/serializers/header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAoBjE,wBAAgB,uBAAuB,IAAI,gBAAgB,CAAC,aAAa,EAAE,CAAC,CAAC,CAM5E;AAED,wBAAgB,uBAAuB,IAAI,gBAAgB,CAAC,aAAa,EAAE,CAAC,CAAC,CAM5E;AAED,wBAAgB,qBAAqB,IAAI,cAAc,CAAC,aAAa,EAAE,aAAa,EAAE,CAAC,CAAC,CAMvF"}
@@ -0,0 +1,3 @@
1
+ export * from './message.js';
2
+ export * from './transaction.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/serializers/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
2
+ import { getCompiledInstructions } from '../compile-instructions.js';
3
+ type Instruction = ReturnType<typeof getCompiledInstructions>[number];
4
+ export declare function getInstructionEncoder(): VariableSizeEncoder<Instruction>;
5
+ export declare function getInstructionDecoder(): VariableSizeDecoder<Instruction>;
6
+ export declare function getInstructionCodec(): VariableSizeCodec<Instruction>;
7
+ export {};
8
+ //# sourceMappingURL=instruction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instruction.d.ts","sourceRoot":"","sources":["../../../src/serializers/instruction.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAW7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAElE,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAGtE,wBAAgB,qBAAqB,IAAI,mBAAmB,CAAC,WAAW,CAAC,CAuBxE;AAGD,wBAAgB,qBAAqB,IAAI,mBAAmB,CAAC,WAAW,CAAC,CAuBxE;AAED,wBAAgB,mBAAmB,IAAI,iBAAiB,CAAC,WAAW,CAAC,CAEpE"}
@@ -0,0 +1,6 @@
1
+ import { VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
2
+ import { CompiledMessage } from '../message.js';
3
+ export declare function getCompiledMessageEncoder(): VariableSizeEncoder<CompiledMessage>;
4
+ export declare function getCompiledMessageDecoder(): VariableSizeDecoder<CompiledMessage>;
5
+ export declare function getCompiledMessageCodec(): VariableSizeCodec<CompiledMessage>;
6
+ //# sourceMappingURL=message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/serializers/message.ts"],"names":[],"mappings":"AACA,OAAO,EAMH,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAa7B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AA2D7C,wBAAgB,yBAAyB,IAAI,mBAAmB,CAAC,eAAe,CAAC,CAiBhF;AAED,wBAAgB,yBAAyB,IAAI,mBAAmB,CAAC,eAAe,CAAC,CAOhF;AAED,wBAAgB,uBAAuB,IAAI,iBAAiB,CAAC,eAAe,CAAC,CAE5E"}
@@ -0,0 +1,6 @@
1
+ import { VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
2
+ import { TransactionVersion } from '../types.js';
3
+ export declare function getTransactionVersionEncoder(): VariableSizeEncoder<TransactionVersion>;
4
+ export declare function getTransactionVersionDecoder(): VariableSizeDecoder<TransactionVersion>;
5
+ export declare function getTransactionVersionCodec(): VariableSizeCodec<TransactionVersion>;
6
+ //# sourceMappingURL=transaction-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-version.d.ts","sourceRoot":"","sources":["../../../src/serializers/transaction-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAI9C,wBAAgB,4BAA4B,IAAI,mBAAmB,CAAC,kBAAkB,CAAC,CAgBtF;AAED,wBAAgB,4BAA4B,IAAI,mBAAmB,CAAC,kBAAkB,CAAC,CActF;AAED,wBAAgB,0BAA0B,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,CAElF"}
@@ -0,0 +1,10 @@
1
+ import { VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
2
+ import { CompilableTransaction } from '../compilable-transaction.js';
3
+ import { CompiledTransaction } from '../compile-transaction.js';
4
+ import { DecompileTransactionConfig } from '../decompile-transaction.js';
5
+ import { ITransactionWithSignatures } from '../signatures.js';
6
+ export declare function getCompiledTransactionDecoder(): VariableSizeDecoder<CompiledTransaction>;
7
+ export declare function getTransactionEncoder(): VariableSizeEncoder<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
8
+ export declare function getTransactionDecoder(config?: DecompileTransactionConfig): VariableSizeDecoder<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
9
+ export declare function getTransactionCodec(config?: DecompileTransactionConfig): VariableSizeCodec<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)>;
10
+ //# 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;AAClE,OAAO,EAAE,mBAAmB,EAA0B,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAwB,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAC5F,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAU3D,wBAAgB,6BAA6B,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,CAUxF;AAED,wBAAgB,qBAAqB,IAAI,mBAAmB,CACxD,qBAAqB,GAAG,CAAC,qBAAqB,GAAG,0BAA0B,CAAC,CAC/E,CAEA;AAED,wBAAgB,qBAAqB,CACjC,MAAM,CAAC,EAAE,0BAA0B,GACpC,mBAAmB,CAAC,qBAAqB,GAAG,CAAC,qBAAqB,GAAG,0BAA0B,CAAC,CAAC,CAInG;AAED,wBAAgB,mBAAmB,CAC/B,MAAM,CAAC,EAAE,0BAA0B,GACpC,iBAAiB,CAAC,qBAAqB,GAAG,CAAC,qBAAqB,GAAG,0BAA0B,CAAC,CAAC,CAEjG"}
@@ -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.js';
4
+ import { ITransactionWithFeePayer } from './fee-payer.js';
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
@@ -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,CAiB/D"}
@@ -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 @@
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"}
@@ -0,0 +1,4 @@
1
+ import { ITransactionWithSignatures } from '.';
2
+ import { BaseTransaction } from './types.js';
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 @@
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"}
@@ -0,0 +1,6 @@
1
+ import { getTransactionEncoder } from './serializers/transaction.js';
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
@@ -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.f291d36",
3
+ "version": "2.0.0-experimental.f2a2e5b",
4
4
  "description": "Helpers for creating and serializing transactions",
5
5
  "exports": {
6
6
  "browser": {
@@ -46,32 +46,35 @@
46
46
  "maintained node versions"
47
47
  ],
48
48
  "dependencies": {
49
- "@metaplex-foundation/umi-serializers": "^0.8.2"
49
+ "@solana/codecs-core": "2.0.0-experimental.f2a2e5b",
50
+ "@solana/addresses": "2.0.0-experimental.f2a2e5b",
51
+ "@solana/codecs-numbers": "2.0.0-experimental.f2a2e5b",
52
+ "@solana/codecs-data-structures": "2.0.0-experimental.f2a2e5b",
53
+ "@solana/codecs-strings": "2.0.0-experimental.f2a2e5b",
54
+ "@solana/functional": "2.0.0-experimental.f2a2e5b",
55
+ "@solana/keys": "2.0.0-experimental.f2a2e5b"
50
56
  },
51
57
  "devDependencies": {
52
- "@solana/eslint-config-solana": "^1.0.0",
53
- "@swc/core": "^1.3.18",
54
- "@swc/jest": "^0.2.23",
55
- "@types/jest": "^29.5.0",
56
- "@typescript-eslint/eslint-plugin": "^5.57.1",
57
- "@typescript-eslint/parser": "^5.57.1",
58
+ "@solana/eslint-config-solana": "^1.0.2",
59
+ "@swc/jest": "^0.2.29",
60
+ "@types/jest": "^29.5.11",
61
+ "@types/node": "18.11.19",
62
+ "@typescript-eslint/eslint-plugin": "^6.13.2",
63
+ "@typescript-eslint/parser": "^6.3.0",
58
64
  "agadoo": "^3.0.0",
59
- "eslint": "^8.37.0",
65
+ "eslint": "^8.45.0",
60
66
  "eslint-plugin-sort-keys-fix": "^1.1.2",
61
- "jest": "^29.5.0",
62
- "jest-runner-eslint": "^2.0.0",
67
+ "jest": "^29.7.0",
68
+ "jest-runner-eslint": "^2.1.2",
63
69
  "jest-runner-prettier": "^1.0.0",
64
- "postcss": "^8.4.12",
65
- "prettier": "^2.7.1",
66
- "ts-node": "^10.9.1",
67
- "tsup": "6.7.0",
68
- "typescript": "^5.0.3",
70
+ "prettier": "^3.1",
71
+ "tsup": "^8.0.1",
72
+ "typescript": "^5.2.2",
69
73
  "version-from-git": "^1.1.1",
70
- "@solana/instructions": "2.0.0-experimental.f291d36",
71
- "@solana/keys": "2.0.0-experimental.f291d36",
72
- "@solana/rpc-core": "2.0.0-experimental.f291d36",
73
- "build-scripts": "0.0.0",
74
+ "@solana/instructions": "2.0.0-experimental.f2a2e5b",
74
75
  "test-config": "0.0.0",
76
+ "@solana/rpc-types": "2.0.0-experimental.f2a2e5b",
77
+ "build-scripts": "0.0.0",
75
78
  "test-matchers": "0.0.0",
76
79
  "tsconfig": "0.0.0"
77
80
  },
@@ -84,15 +87,16 @@
84
87
  ]
85
88
  },
86
89
  "scripts": {
87
- "compile:js": "tsup --config build-scripts/tsup.config.library.ts",
88
- "compile:typedefs": "tsc -p ./tsconfig.declarations.json",
90
+ "compile:js": "tsup --config build-scripts/tsup.config.package.ts",
91
+ "compile:typedefs": "tsc -p ./tsconfig.declarations.json && node node_modules/build-scripts/add-js-extension-to-types.mjs",
89
92
  "dev": "jest -c node_modules/test-config/jest-dev.config.ts --rootDir . --watch",
90
93
  "publish-packages": "pnpm publish --tag experimental --access public --no-git-checks",
94
+ "style:fix": "pnpm eslint --fix src/* && pnpm prettier -w src/* package.json",
91
95
  "test:lint": "jest -c node_modules/test-config/jest-lint.config.ts --rootDir . --silent",
92
96
  "test:prettier": "jest -c node_modules/test-config/jest-prettier.config.ts --rootDir . --silent",
93
97
  "test:treeshakability:browser": "agadoo dist/index.browser.js",
94
- "test:treeshakability:native": "agadoo dist/index.node.js",
95
- "test:treeshakability:node": "agadoo dist/index.native.js",
98
+ "test:treeshakability:native": "agadoo dist/index.native.js",
99
+ "test:treeshakability:node": "agadoo dist/index.node.js",
96
100
  "test:typecheck": "tsc --noEmit",
97
101
  "test:unit:browser": "jest -c node_modules/test-config/jest-unit.config.browser.ts --rootDir . --silent",
98
102
  "test:unit:node": "jest -c node_modules/test-config/jest-unit.config.node.ts --rootDir . --silent"
@@ -1,86 +0,0 @@
1
- this.globalThis = this.globalThis || {};
2
- this.globalThis.solanaWeb3 = (function (exports) {
3
- 'use strict';
4
-
5
- // src/create-transaction.ts
6
- function createTransaction({
7
- version
8
- }) {
9
- const out = {
10
- instructions: [],
11
- version
12
- };
13
- Object.freeze(out);
14
- return out;
15
- }
16
-
17
- // src/fee-payer.ts
18
- function setTransactionFeePayer(feePayer, transaction) {
19
- if ("feePayer" in transaction && feePayer === transaction.feePayer) {
20
- return transaction;
21
- }
22
- let out;
23
- if ("signatures" in transaction) {
24
- const {
25
- signatures: _,
26
- // eslint-disable-line @typescript-eslint/no-unused-vars
27
- ...unsignedTransaction
28
- } = transaction;
29
- out = {
30
- ...unsignedTransaction,
31
- feePayer
32
- };
33
- } else {
34
- out = {
35
- ...transaction,
36
- feePayer
37
- };
38
- }
39
- Object.freeze(out);
40
- return out;
41
- }
42
-
43
- // src/instructions.ts
44
- function replaceInstructions(transaction, nextInstructions) {
45
- let out;
46
- if ("signatures" in transaction) {
47
- const {
48
- signatures: _,
49
- // eslint-disable-line @typescript-eslint/no-unused-vars
50
- ...unsignedTransaction
51
- } = transaction;
52
- out = {
53
- ...unsignedTransaction,
54
- instructions: nextInstructions
55
- };
56
- } else {
57
- out = {
58
- ...transaction,
59
- instructions: nextInstructions
60
- };
61
- }
62
- return out;
63
- }
64
- function appendTransactionInstruction(instruction, transaction) {
65
- const nextInstructions = [...transaction.instructions, instruction];
66
- const out = replaceInstructions(transaction, nextInstructions);
67
- Object.freeze(out);
68
- return out;
69
- }
70
- function prependTransactionInstruction(instruction, transaction) {
71
- const nextInstructions = [instruction, ...transaction.instructions];
72
- const out = replaceInstructions(transaction, nextInstructions);
73
- Object.freeze(out);
74
- return out;
75
- }
76
-
77
- exports.appendTransactionInstruction = appendTransactionInstruction;
78
- exports.createTransaction = createTransaction;
79
- exports.prependTransactionInstruction = prependTransactionInstruction;
80
- exports.setTransactionFeePayer = setTransactionFeePayer;
81
-
82
- return exports;
83
-
84
- })({});
85
- //# sourceMappingURL=out.js.map
86
- //# sourceMappingURL=index.development.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/create-transaction.ts","../src/fee-payer.ts","../src/instructions.ts"],"names":[],"mappings":";AASO,SAAS,kBAAuD;AAAA,EACnE;AACJ,GAA6C;AACzC,QAAM,MAAmB;AAAA,IACrB,cAAc,CAAC;AAAA,IACf;AAAA,EACJ;AACA,SAAO,OAAO,GAAG;AACjB,SAAO;AACX;;;ACTO,SAAS,uBACZ,UACA,aAOsG;AACtG,MAAI,cAAc,eAAe,aAAa,YAAY,UAAU;AAChE,WAAO;AAAA,EACX;AACA,MAAI;AACJ,MAAI,gBAAgB,aAAa;AAE7B,UAAM;AAAA,MACF,YAAY;AAAA;AAAA,MACZ,GAAG;AAAA,IACP,IAAI;AACJ,UAAM;AAAA,MACF,GAAG;AAAA,MACH;AAAA,IACJ;AAAA,EACJ,OAAO;AACH,UAAM;AAAA,MACF,GAAG;AAAA,MACH;AAAA,IACJ;AAAA,EACJ;AACA,SAAO,OAAO,GAAG;AACjB,SAAO;AACX;;;ACtCA,SAAS,oBACL,aACA,kBACmE;AACnE,MAAI;AACJ,MAAI,gBAAgB,aAAa;AAE7B,UAAM;AAAA,MACF,YAAY;AAAA;AAAA,MACZ,GAAG;AAAA,IACP,IAAI;AACJ,UAAM;AAAA,MACF,GAAG;AAAA,MACH,cAAc;AAAA,IAClB;AAAA,EACJ,OAAO;AACH,UAAM;AAAA,MACF,GAAG;AAAA,MACH,cAAc;AAAA,IAClB;AAAA,EACJ;AACA,SAAO;AACX;AAEO,SAAS,6BACZ,aACA,aACmE;AACnE,QAAM,mBAAmB,CAAC,GAAG,YAAY,cAAc,WAAW;AAClE,QAAM,MAAM,oBAAoB,aAAa,gBAAgB;AAC7D,SAAO,OAAO,GAAG;AACjB,SAAO;AACX;AAEO,SAAS,8BACZ,aACA,aACmE;AACnE,QAAM,mBAAmB,CAAC,aAAa,GAAG,YAAY,YAAY;AAClE,QAAM,MAAM,oBAAoB,aAAa,gBAAgB;AAC7D,SAAO,OAAO,GAAG;AACjB,SAAO;AACX","sourcesContent":["import { Transaction, TransactionVersion } from './types';\n\ntype TransactionConfig<TVersion extends TransactionVersion> = Readonly<{\n version: TVersion;\n}>;\n\nexport function createTransaction<TVersion extends TransactionVersion>(\n config: TransactionConfig<TVersion>\n): Extract<Transaction, { version: TVersion }>;\nexport function createTransaction<TVersion extends TransactionVersion>({\n version,\n}: TransactionConfig<TVersion>): Transaction {\n const out: Transaction = {\n instructions: [],\n version,\n };\n Object.freeze(out);\n return out;\n}\n","import { Base58EncodedAddress } from '@solana/keys';\n\nimport { ITransactionWithSignatures } from './signatures';\nimport { BaseTransaction } from './types';\n\nexport interface ITransactionWithFeePayer<TAddress extends string = string> {\n readonly feePayer: Base58EncodedAddress<TAddress>;\n}\n\nexport function setTransactionFeePayer<TFeePayerAddress extends string, TTransaction extends BaseTransaction>(\n feePayer: Base58EncodedAddress<TFeePayerAddress>,\n transaction:\n | TTransaction\n | (TTransaction & ITransactionWithFeePayer<TFeePayerAddress>)\n | (TTransaction & ITransactionWithSignatures)\n | (TTransaction & ITransactionWithFeePayer<TFeePayerAddress> & ITransactionWithSignatures)\n):\n | (TTransaction & ITransactionWithFeePayer<TFeePayerAddress>)\n | (Omit<TTransaction, keyof ITransactionWithSignatures> & ITransactionWithFeePayer<TFeePayerAddress>) {\n if ('feePayer' in transaction && feePayer === transaction.feePayer) {\n return transaction;\n }\n let out;\n if ('signatures' in transaction) {\n // The implication of the fee payer changing is that any existing signatures are invalid.\n const {\n signatures: _, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...unsignedTransaction\n } = transaction;\n out = {\n ...unsignedTransaction,\n feePayer,\n };\n } else {\n out = {\n ...transaction,\n feePayer,\n };\n }\n Object.freeze(out);\n return out;\n}\n","import { ITransactionWithSignatures } from './signatures';\nimport { BaseTransaction } from './types';\n\nfunction replaceInstructions<TTransaction extends BaseTransaction, TInstructions>(\n transaction: TTransaction | (TTransaction & ITransactionWithSignatures),\n nextInstructions: TInstructions\n): TTransaction | Omit<TTransaction, keyof ITransactionWithSignatures> {\n let out;\n if ('signatures' in transaction) {\n // The implication of the instructions changing is that any existing signatures are invalid.\n const {\n signatures: _, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...unsignedTransaction\n } = transaction;\n out = {\n ...unsignedTransaction,\n instructions: nextInstructions,\n };\n } else {\n out = {\n ...transaction,\n instructions: nextInstructions,\n };\n }\n return out;\n}\n\nexport function appendTransactionInstruction<TTransaction extends BaseTransaction>(\n instruction: TTransaction['instructions'][number],\n transaction: TTransaction | (TTransaction & ITransactionWithSignatures)\n): TTransaction | Omit<TTransaction, keyof ITransactionWithSignatures> {\n const nextInstructions = [...transaction.instructions, instruction] as const;\n const out = replaceInstructions(transaction, nextInstructions);\n Object.freeze(out);\n return out;\n}\n\nexport function prependTransactionInstruction<TTransaction extends BaseTransaction>(\n instruction: TTransaction['instructions'][number],\n transaction: TTransaction | (TTransaction & ITransactionWithSignatures)\n): TTransaction | Omit<TTransaction, keyof ITransactionWithSignatures> {\n const nextInstructions = [instruction, ...transaction.instructions] as const;\n const out = replaceInstructions(transaction, nextInstructions);\n Object.freeze(out);\n return out;\n}\n"]}
@@ -1,14 +0,0 @@
1
- this.globalThis = this.globalThis || {};
2
- this.globalThis.solanaWeb3 = (function (exports) {
3
- 'use strict';
4
-
5
- function T({version:r}){let n={instructions:[],version:r};return Object.freeze(n),n}function d(r,n){if("feePayer"in n&&r===n.feePayer)return n;let t;if("signatures"in n){let{signatures:e,...s}=n;t={...s,feePayer:r};}else t={...n,feePayer:r};return Object.freeze(t),t}function i(r,n){let t;if("signatures"in r){let{signatures:e,...s}=r;t={...s,instructions:n};}else t={...r,instructions:n};return t}function m(r,n){let t=[...n.instructions,r],e=i(n,t);return Object.freeze(e),e}function x(r,n){let t=[r,...n.instructions],e=i(n,t);return Object.freeze(e),e}
6
-
7
- exports.appendTransactionInstruction = m;
8
- exports.createTransaction = T;
9
- exports.prependTransactionInstruction = x;
10
- exports.setTransactionFeePayer = d;
11
-
12
- return exports;
13
-
14
- })({});