abstract-signer.d.ts 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import type { TypedDataDomain, TypedDataField } from "../hash/index.js";
  2. import type { TransactionLike } from "../transaction/index.js";
  3. import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js";
  4. import type { Signer } from "./signer.js";
  5. /**
  6. * An **AbstractSigner** includes most of teh functionality required
  7. * to get a [[Signer]] working as expected, but requires a few
  8. * Signer-specific methods be overridden.
  9. *
  10. */
  11. export declare abstract class AbstractSigner<P extends null | Provider = null | Provider> implements Signer {
  12. /**
  13. * The provider this signer is connected to.
  14. */
  15. readonly provider: P;
  16. /**
  17. * Creates a new Signer connected to %%provider%%.
  18. */
  19. constructor(provider?: P);
  20. /**
  21. * Resolves to the Signer address.
  22. */
  23. abstract getAddress(): Promise<string>;
  24. /**
  25. * Returns the signer connected to %%provider%%.
  26. *
  27. * This may throw, for example, a Signer connected over a Socket or
  28. * to a specific instance of a node may not be transferrable.
  29. */
  30. abstract connect(provider: null | Provider): Signer;
  31. getNonce(blockTag?: BlockTag): Promise<number>;
  32. populateCall(tx: TransactionRequest): Promise<TransactionLike<string>>;
  33. populateTransaction(tx: TransactionRequest): Promise<TransactionLike<string>>;
  34. estimateGas(tx: TransactionRequest): Promise<bigint>;
  35. call(tx: TransactionRequest): Promise<string>;
  36. resolveName(name: string): Promise<null | string>;
  37. sendTransaction(tx: TransactionRequest): Promise<TransactionResponse>;
  38. abstract signTransaction(tx: TransactionRequest): Promise<string>;
  39. abstract signMessage(message: string | Uint8Array): Promise<string>;
  40. abstract signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
  41. }
  42. /**
  43. * A **VoidSigner** is a class deisgned to allow an address to be used
  44. * in any API which accepts a Signer, but for which there are no
  45. * credentials available to perform any actual signing.
  46. *
  47. * This for example allow impersonating an account for the purpose of
  48. * static calls or estimating gas, but does not allow sending transactions.
  49. */
  50. export declare class VoidSigner extends AbstractSigner {
  51. #private;
  52. /**
  53. * The signer address.
  54. */
  55. readonly address: string;
  56. /**
  57. * Creates a new **VoidSigner** with %%address%% attached to
  58. * %%provider%%.
  59. */
  60. constructor(address: string, provider?: null | Provider);
  61. getAddress(): Promise<string>;
  62. connect(provider: null | Provider): VoidSigner;
  63. signTransaction(tx: TransactionRequest): Promise<string>;
  64. signMessage(message: string | Uint8Array): Promise<string>;
  65. signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
  66. }
  67. //# sourceMappingURL=abstract-signer.d.ts.map