@solana/signers 2.0.0-20241006045741

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 (49) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +602 -0
  3. package/dist/index.browser.cjs +358 -0
  4. package/dist/index.browser.cjs.map +1 -0
  5. package/dist/index.browser.mjs +325 -0
  6. package/dist/index.browser.mjs.map +1 -0
  7. package/dist/index.native.mjs +325 -0
  8. package/dist/index.native.mjs.map +1 -0
  9. package/dist/index.node.cjs +358 -0
  10. package/dist/index.node.cjs.map +1 -0
  11. package/dist/index.node.mjs +325 -0
  12. package/dist/index.node.mjs.map +1 -0
  13. package/dist/types/account-signer-meta.d.ts +21 -0
  14. package/dist/types/account-signer-meta.d.ts.map +1 -0
  15. package/dist/types/add-signers.d.ts +9 -0
  16. package/dist/types/add-signers.d.ts.map +1 -0
  17. package/dist/types/deduplicate-signers.d.ts +5 -0
  18. package/dist/types/deduplicate-signers.d.ts.map +1 -0
  19. package/dist/types/fee-payer-signer.d.ts +9 -0
  20. package/dist/types/fee-payer-signer.d.ts.map +1 -0
  21. package/dist/types/index.d.ts +17 -0
  22. package/dist/types/index.d.ts.map +1 -0
  23. package/dist/types/keypair-signer.d.ts +27 -0
  24. package/dist/types/keypair-signer.d.ts.map +1 -0
  25. package/dist/types/message-modifying-signer.d.ts +20 -0
  26. package/dist/types/message-modifying-signer.d.ts.map +1 -0
  27. package/dist/types/message-partial-signer.d.ts +20 -0
  28. package/dist/types/message-partial-signer.d.ts.map +1 -0
  29. package/dist/types/message-signer.d.ts +16 -0
  30. package/dist/types/message-signer.d.ts.map +1 -0
  31. package/dist/types/noop-signer.d.ts +8 -0
  32. package/dist/types/noop-signer.d.ts.map +1 -0
  33. package/dist/types/sign-transaction.d.ts +33 -0
  34. package/dist/types/sign-transaction.d.ts.map +1 -0
  35. package/dist/types/signable-message.d.ts +12 -0
  36. package/dist/types/signable-message.d.ts.map +1 -0
  37. package/dist/types/transaction-modifying-signer.d.ts +20 -0
  38. package/dist/types/transaction-modifying-signer.d.ts.map +1 -0
  39. package/dist/types/transaction-partial-signer.d.ts +20 -0
  40. package/dist/types/transaction-partial-signer.d.ts.map +1 -0
  41. package/dist/types/transaction-sending-signer.d.ts +21 -0
  42. package/dist/types/transaction-sending-signer.d.ts.map +1 -0
  43. package/dist/types/transaction-signer.d.ts +17 -0
  44. package/dist/types/transaction-signer.d.ts.map +1 -0
  45. package/dist/types/transaction-with-single-sending-signer.d.ts +11 -0
  46. package/dist/types/transaction-with-single-sending-signer.d.ts.map +1 -0
  47. package/dist/types/types.d.ts +11 -0
  48. package/dist/types/types.d.ts.map +1 -0
  49. package/package.json +95 -0
@@ -0,0 +1,16 @@
1
+ import { Address } from '@solana/addresses';
2
+ import { MessageModifyingSigner } from './message-modifying-signer';
3
+ import { MessagePartialSigner } from './message-partial-signer';
4
+ /** Defines a signer capable of signing messages. */
5
+ export type MessageSigner<TAddress extends string = string> = MessageModifyingSigner<TAddress> | MessagePartialSigner<TAddress>;
6
+ /** Checks whether the provided value implements the {@link MessageSigner} interface. */
7
+ export declare function isMessageSigner<TAddress extends string>(value: {
8
+ [key: string]: unknown;
9
+ address: Address<TAddress>;
10
+ }): value is MessageSigner<TAddress>;
11
+ /** Asserts that the provided value implements the {@link MessageSigner} interface. */
12
+ export declare function assertIsMessageSigner<TAddress extends string>(value: {
13
+ [key: string]: unknown;
14
+ address: Address<TAddress>;
15
+ }): asserts value is MessageSigner<TAddress>;
16
+ //# sourceMappingURL=message-signer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-signer.d.ts","sourceRoot":"","sources":["../../src/message-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAA4B,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAC9F,OAAO,EAA0B,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAExF,oDAAoD;AACpD,MAAM,MAAM,aAAa,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IACpD,sBAAsB,CAAC,QAAQ,CAAC,GAChC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;AAErC,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IAC5D,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC9B,GAAG,KAAK,IAAI,aAAa,CAAC,QAAQ,CAAC,CAEnC;AAED,sFAAsF;AACtF,wBAAgB,qBAAqB,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IAClE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC9B,GAAG,OAAO,CAAC,KAAK,IAAI,aAAa,CAAC,QAAQ,CAAC,CAM3C"}
@@ -0,0 +1,8 @@
1
+ import { Address } from '@solana/addresses';
2
+ import { MessagePartialSigner } from './message-partial-signer';
3
+ import { TransactionPartialSigner } from './transaction-partial-signer';
4
+ /** Defines a no-operation signer that pretends to partially sign messages and transactions. */
5
+ export type NoopSigner<TAddress extends string = string> = MessagePartialSigner<TAddress> & TransactionPartialSigner<TAddress>;
6
+ /** Creates a NoopSigner from the provided Address. */
7
+ export declare function createNoopSigner(address: Address): NoopSigner;
8
+ //# sourceMappingURL=noop-signer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noop-signer.d.ts","sourceRoot":"","sources":["../../src/noop-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE,+FAA+F;AAC/F,MAAM,MAAM,UAAU,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IAAI,oBAAoB,CAAC,QAAQ,CAAC,GACrF,wBAAwB,CAAC,QAAQ,CAAC,CAAC;AAEvC,sDAAsD;AACtD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,CAQ7D"}
@@ -0,0 +1,33 @@
1
+ import { SignatureBytes } from '@solana/keys';
2
+ import { CompilableTransactionMessage, TransactionMessageWithBlockhashLifetime, TransactionMessageWithDurableNonceLifetime } from '@solana/transaction-messages';
3
+ import { FullySignedTransaction, Transaction, TransactionWithBlockhashLifetime, TransactionWithDurableNonceLifetime, TransactionWithLifetime } from '@solana/transactions';
4
+ import { ITransactionMessageWithSigners } from './account-signer-meta';
5
+ import { TransactionPartialSignerConfig } from './transaction-partial-signer';
6
+ import { TransactionSendingSignerConfig } from './transaction-sending-signer';
7
+ type CompilableTransactionMessageWithSigners = CompilableTransactionMessage & ITransactionMessageWithSigners;
8
+ /**
9
+ * Signs a transaction using any signers that may be stored in IAccountSignerMeta instruction accounts
10
+ * as well as any signers provided explicitly to this function.
11
+ * It will ignore TransactionSendingSigners since this function does not send the transaction.
12
+ */
13
+ export declare function partiallySignTransactionMessageWithSigners<TTransactionMessage extends CompilableTransactionMessageWithSigners & TransactionMessageWithBlockhashLifetime = CompilableTransactionMessageWithSigners & TransactionMessageWithBlockhashLifetime>(transactionMessage: TTransactionMessage, config?: TransactionPartialSignerConfig): Promise<Transaction & TransactionWithBlockhashLifetime>;
14
+ export declare function partiallySignTransactionMessageWithSigners<TTransactionMessage extends CompilableTransactionMessageWithSigners & TransactionMessageWithDurableNonceLifetime = CompilableTransactionMessageWithSigners & TransactionMessageWithDurableNonceLifetime>(transactionMessage: TTransactionMessage, config?: TransactionPartialSignerConfig): Promise<Readonly<Transaction & TransactionWithDurableNonceLifetime>>;
15
+ export declare function partiallySignTransactionMessageWithSigners<TTransactionMessage extends CompilableTransactionMessageWithSigners = CompilableTransactionMessageWithSigners>(transactionMessage: TTransactionMessage, config?: TransactionPartialSignerConfig): Promise<Readonly<Transaction & TransactionWithLifetime>>;
16
+ /**
17
+ * Signs a transaction using any signers that may be stored in IAccountSignerMeta instruction accounts
18
+ * as well as any signers provided explicitly to this function.
19
+ * It will assert that the transaction is fully signed before returning.
20
+ * It will ignore TransactionSendingSigners since this function does not send the transaction.
21
+ */
22
+ export declare function signTransactionMessageWithSigners<TTransactionMessage extends CompilableTransactionMessageWithSigners & TransactionMessageWithBlockhashLifetime = CompilableTransactionMessageWithSigners & TransactionMessageWithBlockhashLifetime>(transactionMessage: TTransactionMessage, config?: TransactionPartialSignerConfig): Promise<Readonly<FullySignedTransaction & TransactionWithBlockhashLifetime>>;
23
+ export declare function signTransactionMessageWithSigners<TTransactionMessage extends CompilableTransactionMessageWithSigners & TransactionMessageWithDurableNonceLifetime = CompilableTransactionMessageWithSigners & TransactionMessageWithDurableNonceLifetime>(transactionMessage: TTransactionMessage, config?: TransactionPartialSignerConfig): Promise<Readonly<FullySignedTransaction & TransactionWithDurableNonceLifetime>>;
24
+ export declare function signTransactionMessageWithSigners<TTransactionMessage extends CompilableTransactionMessageWithSigners = CompilableTransactionMessageWithSigners>(transactionMessage: TTransactionMessage, config?: TransactionPartialSignerConfig): Promise<Readonly<FullySignedTransaction & TransactionWithLifetime>>;
25
+ /**
26
+ * Signs and sends a transaction using any signers that may be stored in IAccountSignerMeta
27
+ * instruction accounts as well as any signers provided explicitly to this function.
28
+ * It will identify a single TransactionSendingSigners to use for sending the transaction, if any.
29
+ * Otherwise, it will send the transaction using the provided fallbackSender.
30
+ */
31
+ export declare function signAndSendTransactionMessageWithSigners<TTransactionMessage extends CompilableTransactionMessageWithSigners = CompilableTransactionMessageWithSigners>(transaction: TTransactionMessage, config?: TransactionSendingSignerConfig): Promise<SignatureBytes>;
32
+ export {};
33
+ //# sourceMappingURL=sign-transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign-transaction.d.ts","sourceRoot":"","sources":["../../src/sign-transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACH,4BAA4B,EAC5B,uCAAuC,EACvC,0CAA0C,EAC7C,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAGH,sBAAsB,EACtB,WAAW,EACX,gCAAgC,EAChC,mCAAmC,EACnC,uBAAuB,EAC1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAoC,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAOzG,OAAO,EAGH,8BAA8B,EACjC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAGH,8BAA8B,EACjC,MAAM,8BAA8B,CAAC;AAItC,KAAK,uCAAuC,GAAG,4BAA4B,GAAG,8BAA8B,CAAC;AAE7G;;;;GAIG;AACH,wBAAsB,0CAA0C,CAC5D,mBAAmB,SAAS,uCAAuC,GAC/D,uCAAuC,GAAG,uCAAuC,GACjF,uCAAuC,EAE3C,kBAAkB,EAAE,mBAAmB,EACvC,MAAM,CAAC,EAAE,8BAA8B,GACxC,OAAO,CAAC,WAAW,GAAG,gCAAgC,CAAC,CAAC;AAE3D,wBAAsB,0CAA0C,CAC5D,mBAAmB,SAAS,uCAAuC,GAC/D,0CAA0C,GAAG,uCAAuC,GACpF,0CAA0C,EAE9C,kBAAkB,EAAE,mBAAmB,EACvC,MAAM,CAAC,EAAE,8BAA8B,GACxC,OAAO,CAAC,QAAQ,CAAC,WAAW,GAAG,mCAAmC,CAAC,CAAC,CAAC;AAExE,wBAAsB,0CAA0C,CAC5D,mBAAmB,SAAS,uCAAuC,GAAG,uCAAuC,EAE7G,kBAAkB,EAAE,mBAAmB,EACvC,MAAM,CAAC,EAAE,8BAA8B,GACxC,OAAO,CAAC,QAAQ,CAAC,WAAW,GAAG,uBAAuB,CAAC,CAAC,CAAC;AAqB5D;;;;;GAKG;AACH,wBAAsB,iCAAiC,CACnD,mBAAmB,SAAS,uCAAuC,GAC/D,uCAAuC,GAAG,uCAAuC,GACjF,uCAAuC,EAE3C,kBAAkB,EAAE,mBAAmB,EACvC,MAAM,CAAC,EAAE,8BAA8B,GACxC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,GAAG,gCAAgC,CAAC,CAAC,CAAC;AAEhF,wBAAsB,iCAAiC,CACnD,mBAAmB,SAAS,uCAAuC,GAC/D,0CAA0C,GAAG,uCAAuC,GACpF,0CAA0C,EAE9C,kBAAkB,EAAE,mBAAmB,EACvC,MAAM,CAAC,EAAE,8BAA8B,GACxC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,GAAG,mCAAmC,CAAC,CAAC,CAAC;AAEnF,wBAAsB,iCAAiC,CACnD,mBAAmB,SAAS,uCAAuC,GAAG,uCAAuC,EAE7G,kBAAkB,EAAE,mBAAmB,EACvC,MAAM,CAAC,EAAE,8BAA8B,GACxC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,GAAG,uBAAuB,CAAC,CAAC,CAAC;AAavE;;;;;GAKG;AACH,wBAAsB,wCAAwC,CAC1D,mBAAmB,SAAS,uCAAuC,GAAG,uCAAuC,EAC/G,WAAW,EAAE,mBAAmB,EAAE,MAAM,CAAC,EAAE,8BAA8B,GAAG,OAAO,CAAC,cAAc,CAAC,CAyBpG"}
@@ -0,0 +1,12 @@
1
+ import { SignatureDictionary } from './types';
2
+ /** Defines a message that needs signing and its current set of signatures if any. */
3
+ export type SignableMessage = Readonly<{
4
+ content: Uint8Array;
5
+ signatures: SignatureDictionary;
6
+ }>;
7
+ /**
8
+ * Creates a signable message from a provided content.
9
+ * If a string is provided, it will be UTF-8 encoded.
10
+ */
11
+ export declare function createSignableMessage(content: Uint8Array | string, signatures?: SignatureDictionary): SignableMessage;
12
+ //# sourceMappingURL=signable-message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signable-message.d.ts","sourceRoot":"","sources":["../../src/signable-message.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,qFAAqF;AACrF,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACnC,OAAO,EAAE,UAAU,CAAC;IACpB,UAAU,EAAE,mBAAmB,CAAC;CACnC,CAAC,CAAC;AAEH;;;GAGG;AACH,wBAAgB,qBAAqB,CACjC,OAAO,EAAE,UAAU,GAAG,MAAM,EAC5B,UAAU,GAAE,mBAAwB,GACrC,eAAe,CAKjB"}
@@ -0,0 +1,20 @@
1
+ import { Address } from '@solana/addresses';
2
+ import { Transaction } from '@solana/transactions';
3
+ import { BaseTransactionSignerConfig } from './types';
4
+ export type TransactionModifyingSignerConfig = BaseTransactionSignerConfig;
5
+ /** Defines a signer capable of signing transactions. */
6
+ export type TransactionModifyingSigner<TAddress extends string = string> = Readonly<{
7
+ address: Address<TAddress>;
8
+ modifyAndSignTransactions<T extends Transaction>(transactions: readonly T[], config?: TransactionModifyingSignerConfig): Promise<readonly T[]>;
9
+ }>;
10
+ /** Checks whether the provided value implements the {@link TransactionModifyingSigner} interface. */
11
+ export declare function isTransactionModifyingSigner<TAddress extends string>(value: {
12
+ [key: string]: unknown;
13
+ address: Address<TAddress>;
14
+ }): value is TransactionModifyingSigner<TAddress>;
15
+ /** Asserts that the provided value implements the {@link TransactionModifyingSigner} interface. */
16
+ export declare function assertIsTransactionModifyingSigner<TAddress extends string>(value: {
17
+ [key: string]: unknown;
18
+ address: Address<TAddress>;
19
+ }): asserts value is TransactionModifyingSigner<TAddress>;
20
+ //# sourceMappingURL=transaction-modifying-signer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-modifying-signer.d.ts","sourceRoot":"","sources":["../../src/transaction-modifying-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,MAAM,gCAAgC,GAAG,2BAA2B,CAAC;AAE3E,wDAAwD;AACxD,MAAM,MAAM,0BAA0B,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IAAI,QAAQ,CAAC;IAChF,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,yBAAyB,CAAC,CAAC,SAAS,WAAW,EAC3C,YAAY,EAAE,SAAS,CAAC,EAAE,EAC1B,MAAM,CAAC,EAAE,gCAAgC,GAC1C,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;CAC5B,CAAC,CAAC;AAEH,qGAAqG;AACrG,wBAAgB,4BAA4B,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IACzE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC9B,GAAG,KAAK,IAAI,0BAA0B,CAAC,QAAQ,CAAC,CAEhD;AAED,mGAAmG;AACnG,wBAAgB,kCAAkC,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IAC/E,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC9B,GAAG,OAAO,CAAC,KAAK,IAAI,0BAA0B,CAAC,QAAQ,CAAC,CAMxD"}
@@ -0,0 +1,20 @@
1
+ import { Address } from '@solana/addresses';
2
+ import { Transaction } from '@solana/transactions';
3
+ import { BaseTransactionSignerConfig, SignatureDictionary } from './types';
4
+ export type TransactionPartialSignerConfig = BaseTransactionSignerConfig;
5
+ /** Defines a signer capable of signing transactions. */
6
+ export type TransactionPartialSigner<TAddress extends string = string> = Readonly<{
7
+ address: Address<TAddress>;
8
+ signTransactions(transactions: readonly Transaction[], config?: TransactionPartialSignerConfig): Promise<readonly SignatureDictionary[]>;
9
+ }>;
10
+ /** Checks whether the provided value implements the {@link TransactionPartialSigner} interface. */
11
+ export declare function isTransactionPartialSigner<TAddress extends string>(value: {
12
+ [key: string]: unknown;
13
+ address: Address<TAddress>;
14
+ }): value is TransactionPartialSigner<TAddress>;
15
+ /** Asserts that the provided value implements the {@link TransactionPartialSigner} interface. */
16
+ export declare function assertIsTransactionPartialSigner<TAddress extends string>(value: {
17
+ [key: string]: unknown;
18
+ address: Address<TAddress>;
19
+ }): asserts value is TransactionPartialSigner<TAddress>;
20
+ //# sourceMappingURL=transaction-partial-signer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-partial-signer.d.ts","sourceRoot":"","sources":["../../src/transaction-partial-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE3E,MAAM,MAAM,8BAA8B,GAAG,2BAA2B,CAAC;AAEzE,wDAAwD;AACxD,MAAM,MAAM,wBAAwB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IAAI,QAAQ,CAAC;IAC9E,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,gBAAgB,CACZ,YAAY,EAAE,SAAS,WAAW,EAAE,EACpC,MAAM,CAAC,EAAE,8BAA8B,GACxC,OAAO,CAAC,SAAS,mBAAmB,EAAE,CAAC,CAAC;CAC9C,CAAC,CAAC;AAEH,mGAAmG;AACnG,wBAAgB,0BAA0B,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IACvE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC9B,GAAG,KAAK,IAAI,wBAAwB,CAAC,QAAQ,CAAC,CAE9C;AAED,iGAAiG;AACjG,wBAAgB,gCAAgC,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IAC7E,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC9B,GAAG,OAAO,CAAC,KAAK,IAAI,wBAAwB,CAAC,QAAQ,CAAC,CAMtD"}
@@ -0,0 +1,21 @@
1
+ import { Address } from '@solana/addresses';
2
+ import { SignatureBytes } from '@solana/keys';
3
+ import { Transaction } from '@solana/transactions';
4
+ import { BaseTransactionSignerConfig } from './types';
5
+ export type TransactionSendingSignerConfig = BaseTransactionSignerConfig;
6
+ /** Defines a signer capable of signing and sending transactions simultaneously. */
7
+ export type TransactionSendingSigner<TAddress extends string = string> = Readonly<{
8
+ address: Address<TAddress>;
9
+ signAndSendTransactions(transactions: readonly Transaction[], config?: TransactionSendingSignerConfig): Promise<readonly SignatureBytes[]>;
10
+ }>;
11
+ /** Checks whether the provided value implements the {@link TransactionSendingSigner} interface. */
12
+ export declare function isTransactionSendingSigner<TAddress extends string>(value: {
13
+ [key: string]: unknown;
14
+ address: Address<TAddress>;
15
+ }): value is TransactionSendingSigner<TAddress>;
16
+ /** Asserts that the provided value implements the {@link TransactionSendingSigner} interface. */
17
+ export declare function assertIsTransactionSendingSigner<TAddress extends string>(value: {
18
+ [key: string]: unknown;
19
+ address: Address<TAddress>;
20
+ }): asserts value is TransactionSendingSigner<TAddress>;
21
+ //# sourceMappingURL=transaction-sending-signer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-sending-signer.d.ts","sourceRoot":"","sources":["../../src/transaction-sending-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,MAAM,8BAA8B,GAAG,2BAA2B,CAAC;AAEzE,mFAAmF;AACnF,MAAM,MAAM,wBAAwB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IAAI,QAAQ,CAAC;IAC9E,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,uBAAuB,CACnB,YAAY,EAAE,SAAS,WAAW,EAAE,EACpC,MAAM,CAAC,EAAE,8BAA8B,GACxC,OAAO,CAAC,SAAS,cAAc,EAAE,CAAC,CAAC;CACzC,CAAC,CAAC;AAEH,mGAAmG;AACnG,wBAAgB,0BAA0B,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IACvE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC9B,GAAG,KAAK,IAAI,wBAAwB,CAAC,QAAQ,CAAC,CAE9C;AAED,iGAAiG;AACjG,wBAAgB,gCAAgC,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IAC7E,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC9B,GAAG,OAAO,CAAC,KAAK,IAAI,wBAAwB,CAAC,QAAQ,CAAC,CAMtD"}
@@ -0,0 +1,17 @@
1
+ import { Address } from '@solana/addresses';
2
+ import { TransactionModifyingSigner } from './transaction-modifying-signer';
3
+ import { TransactionPartialSigner } from './transaction-partial-signer';
4
+ import { TransactionSendingSigner } from './transaction-sending-signer';
5
+ /** Defines a signer capable of signing transactions. */
6
+ export type TransactionSigner<TAddress extends string = string> = TransactionModifyingSigner<TAddress> | TransactionPartialSigner<TAddress> | TransactionSendingSigner<TAddress>;
7
+ /** Checks whether the provided value implements the {@link TransactionSigner} interface. */
8
+ export declare function isTransactionSigner<TAddress extends string>(value: {
9
+ [key: string]: unknown;
10
+ address: Address<TAddress>;
11
+ }): value is TransactionSigner<TAddress>;
12
+ /** Asserts that the provided value implements the {@link TransactionSigner} interface. */
13
+ export declare function assertIsTransactionSigner<TAddress extends string>(value: {
14
+ [key: string]: unknown;
15
+ address: Address<TAddress>;
16
+ }): asserts value is TransactionSigner<TAddress>;
17
+ //# sourceMappingURL=transaction-signer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-signer.d.ts","sourceRoot":"","sources":["../../src/transaction-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAgC,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC1G,OAAO,EAA8B,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACpG,OAAO,EAA8B,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAEpG,wDAAwD;AACxD,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IACxD,0BAA0B,CAAC,QAAQ,CAAC,GACpC,wBAAwB,CAAC,QAAQ,CAAC,GAClC,wBAAwB,CAAC,QAAQ,CAAC,CAAC;AAEzC,4FAA4F;AAC5F,wBAAgB,mBAAmB,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IAChE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC9B,GAAG,KAAK,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAIvC;AAED,0FAA0F;AAC1F,wBAAgB,yBAAyB,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE;IACtE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC9B,GAAG,OAAO,CAAC,KAAK,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAM/C"}
@@ -0,0 +1,11 @@
1
+ import { CompilableTransactionMessage } from '@solana/transaction-messages';
2
+ import { ITransactionMessageWithSigners } from './account-signer-meta';
3
+ /** Defines a transaction message with exactly one {@link TransactionSendingSigner}. */
4
+ export type ITransactionMessageWithSingleSendingSigner = ITransactionMessageWithSigners & {
5
+ readonly __transactionWithSingleSendingSigner: unique symbol;
6
+ };
7
+ /** Checks whether the provided transaction has exactly one {@link TransactionSendingSigner}. */
8
+ export declare function isTransactionMessageWithSingleSendingSigner<TTransactionMessage extends CompilableTransactionMessage>(transaction: TTransactionMessage): transaction is ITransactionMessageWithSingleSendingSigner & TTransactionMessage;
9
+ /** Asserts that the provided transaction has exactly one {@link TransactionSendingSigner}. */
10
+ export declare function assertIsTransactionMessageWithSingleSendingSigner<TTransactionMessage extends CompilableTransactionMessage>(transaction: TTransactionMessage): asserts transaction is ITransactionMessageWithSingleSendingSigner & TTransactionMessage;
11
+ //# sourceMappingURL=transaction-with-single-sending-signer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-with-single-sending-signer.d.ts","sourceRoot":"","sources":["../../src/transaction-with-single-sending-signer.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAE5E,OAAO,EAAoC,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAKzG,uFAAuF;AACvF,MAAM,MAAM,0CAA0C,GAAG,8BAA8B,GAAG;IACtF,QAAQ,CAAC,oCAAoC,EAAE,OAAO,MAAM,CAAC;CAChE,CAAC;AAEF,gGAAgG;AAChG,wBAAgB,2CAA2C,CAAC,mBAAmB,SAAS,4BAA4B,EAChH,WAAW,EAAE,mBAAmB,GACjC,WAAW,IAAI,0CAA0C,GAAG,mBAAmB,CAOjF;AAED,8FAA8F;AAC9F,wBAAgB,iDAAiD,CAC7D,mBAAmB,SAAS,4BAA4B,EAExD,WAAW,EAAE,mBAAmB,GACjC,OAAO,CAAC,WAAW,IAAI,0CAA0C,GAAG,mBAAmB,CAkBzF"}
@@ -0,0 +1,11 @@
1
+ import { Address } from '@solana/addresses';
2
+ import { SignatureBytes } from '@solana/keys';
3
+ import { Slot } from '@solana/rpc-types';
4
+ export type SignatureDictionary = Readonly<Record<Address, SignatureBytes>>;
5
+ export type BaseSignerConfig = Readonly<{
6
+ abortSignal?: AbortSignal;
7
+ }>;
8
+ export interface BaseTransactionSignerConfig extends BaseSignerConfig {
9
+ minContextSlot?: Slot;
10
+ }
11
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;AAE5E,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACpC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,WAAW,2BAA4B,SAAQ,gBAAgB;IAIjE,cAAc,CAAC,EAAE,IAAI,CAAC;CACzB"}
package/package.json ADDED
@@ -0,0 +1,95 @@
1
+ {
2
+ "name": "@solana/signers",
3
+ "version": "2.0.0-20241006045741",
4
+ "description": "An abstraction layer over signing messages and transactions in Solana",
5
+ "exports": {
6
+ "edge-light": {
7
+ "import": "./dist/index.node.mjs",
8
+ "require": "./dist/index.node.cjs"
9
+ },
10
+ "workerd": {
11
+ "import": "./dist/index.node.mjs",
12
+ "require": "./dist/index.node.cjs"
13
+ },
14
+ "browser": {
15
+ "import": "./dist/index.browser.mjs",
16
+ "require": "./dist/index.browser.cjs"
17
+ },
18
+ "node": {
19
+ "import": "./dist/index.node.mjs",
20
+ "require": "./dist/index.node.cjs"
21
+ },
22
+ "react-native": "./dist/index.native.mjs",
23
+ "types": "./dist/types/index.d.ts"
24
+ },
25
+ "browser": {
26
+ "./dist/index.node.cjs": "./dist/index.browser.cjs",
27
+ "./dist/index.node.mjs": "./dist/index.browser.mjs"
28
+ },
29
+ "main": "./dist/index.node.cjs",
30
+ "module": "./dist/index.node.mjs",
31
+ "react-native": "./dist/index.native.mjs",
32
+ "types": "./dist/types/index.d.ts",
33
+ "type": "commonjs",
34
+ "files": [
35
+ "./dist/"
36
+ ],
37
+ "sideEffects": false,
38
+ "keywords": [
39
+ "blockchain",
40
+ "solana",
41
+ "web3"
42
+ ],
43
+ "author": "Solana Labs Maintainers <maintainers@solanalabs.com>",
44
+ "license": "MIT",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "https://github.com/solana-labs/solana-web3.js"
48
+ },
49
+ "bugs": {
50
+ "url": "http://github.com/solana-labs/solana-web3.js/issues"
51
+ },
52
+ "browserslist": [
53
+ "supports bigint and not dead",
54
+ "maintained node versions"
55
+ ],
56
+ "engine": {
57
+ "node": ">=17.4"
58
+ },
59
+ "dependencies": {
60
+ "@solana/addresses": "2.0.0-20241006045741",
61
+ "@solana/codecs-core": "2.0.0-20241006045741",
62
+ "@solana/errors": "2.0.0-20241006045741",
63
+ "@solana/keys": "2.0.0-20241006045741",
64
+ "@solana/transaction-messages": "2.0.0-20241006045741",
65
+ "@solana/instructions": "2.0.0-20241006045741",
66
+ "@solana/transactions": "2.0.0-20241006045741"
67
+ },
68
+ "peerDependencies": {
69
+ "typescript": ">=5"
70
+ },
71
+ "bundlewatch": {
72
+ "defaultCompression": "gzip",
73
+ "files": [
74
+ {
75
+ "path": "./dist/index*.js"
76
+ }
77
+ ]
78
+ },
79
+ "scripts": {
80
+ "compile:js": "tsup --config build-scripts/tsup.config.package.ts",
81
+ "compile:typedefs": "tsc -p ./tsconfig.declarations.json",
82
+ "dev": "jest -c ../../node_modules/@solana/test-config/jest-dev.config.ts --rootDir . --watch",
83
+ "publish-impl": "npm view $npm_package_name@$npm_package_version > /dev/null 2>&1 || pnpm publish --tag ${PUBLISH_TAG:-canary} --access public --no-git-checks",
84
+ "publish-packages": "pnpm prepublishOnly && pnpm publish-impl",
85
+ "style:fix": "pnpm eslint --fix src && pnpm prettier --log-level warn --ignore-unknown --write ./*",
86
+ "test:lint": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-lint.config.ts --rootDir . --silent",
87
+ "test:prettier": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-prettier.config.ts --rootDir . --silent",
88
+ "test:treeshakability:browser": "agadoo dist/index.browser.mjs",
89
+ "test:treeshakability:native": "agadoo dist/index.native.mjs",
90
+ "test:treeshakability:node": "agadoo dist/index.node.mjs",
91
+ "test:typecheck": "tsc --noEmit",
92
+ "test:unit:browser": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-unit.config.browser.ts --rootDir . --silent",
93
+ "test:unit:node": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-unit.config.node.ts --rootDir . --silent"
94
+ }
95
+ }