signet.js 0.0.10-beta13 → 0.0.10-beta15

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signet.js",
3
- "version": "0.0.10-beta13",
3
+ "version": "0.0.10-beta15",
4
4
  "description": "A TypeScript library for handling multi-chain transactions and signatures using Signet MPC",
5
5
  "type": "module",
6
6
  "exports": {
package/types/index.d.cts CHANGED
@@ -928,9 +928,8 @@ interface SignOptions {
928
928
  };
929
929
  retry: RetryOptions;
930
930
  }
931
- interface SignatureErrorData$1 {
931
+ interface SignatureErrorData {
932
932
  requestId: string;
933
- responder: string;
934
933
  error: string;
935
934
  }
936
935
 
@@ -969,6 +968,17 @@ declare class ChainSignatureContract$1 extends ChainSignatureContract$3 {
969
968
  }): Promise<UncompressedPubKeySEC1>;
970
969
  getPublicKey(): Promise<UncompressedPubKeySEC1>;
971
970
  getLatestKeyVersion(): Promise<number>;
971
+ /**
972
+ * Sends a sign request transaction and return the transaction hash.
973
+ *
974
+ * @param args - The signature arguments
975
+ * @param options - The signing options
976
+ * @returns The transaction hash
977
+ */
978
+ createSignatureRequest(args: SignArgs, options?: Pick<SignOptions, 'sign'>): Promise<{
979
+ txHash: Hex;
980
+ requestId: Hex;
981
+ }>;
972
982
  /**
973
983
  * Sends a transaction to the contract to request a signature, then
974
984
  * polls for the signature result. If the signature is not found within the retry
@@ -981,7 +991,7 @@ declare class ChainSignatureContract$1 extends ChainSignatureContract$3 {
981
991
  path: string;
982
992
  fromBlock: bigint;
983
993
  options?: RetryOptions;
984
- }): Promise<RSVSignature | SignatureErrorData$1 | undefined>;
994
+ }): Promise<RSVSignature | SignatureErrorData | undefined>;
985
995
  getSignRequestParams(args: SignArgs, options?: SignOptions['sign']): Promise<{
986
996
  target: Hex;
987
997
  data: Hex;
@@ -1011,7 +1021,7 @@ declare class ChainSignatureContract$1 extends ChainSignatureContract$3 {
1011
1021
  * ```
1012
1022
  */
1013
1023
  getRequestId(args: SignArgs, options?: SignOptions['sign']): Hex;
1014
- getErrorFromEvents(requestId: Hex, fromBlock: bigint): Promise<SignatureErrorData$1 | undefined>;
1024
+ getErrorFromEvents(requestId: Hex, fromBlock: bigint): Promise<SignatureErrorData | undefined>;
1015
1025
  /**
1016
1026
  * Searches for SignatureResponded events that match the given requestId.
1017
1027
  * It works in conjunction with the getRequestId method which generates the unique
@@ -1033,11 +1043,6 @@ declare namespace index$2 {
1033
1043
  export { ChainSignatureContract$1 as ChainSignatureContract, utils$1 as utils };
1034
1044
  }
1035
1045
 
1036
- type SignatureErrorData = {
1037
- requestId: Uint8Array;
1038
- responder: PublicKey;
1039
- error: string;
1040
- };
1041
1046
  declare class SignatureNotFoundError extends Error {
1042
1047
  readonly requestId?: string;
1043
1048
  readonly hash?: string;
@@ -1048,7 +1053,9 @@ declare class SignatureNotFoundError extends Error {
1048
1053
  declare class SignatureContractError extends Error {
1049
1054
  readonly requestId?: string;
1050
1055
  readonly hash?: string;
1051
- readonly originalError?: any;
1056
+ readonly originalError?: {
1057
+ hash: string;
1058
+ };
1052
1059
  constructor(message: string, requestId?: string, metadata?: {
1053
1060
  hash?: string;
1054
1061
  });
@@ -1069,13 +1076,12 @@ type errors_ResponseError = ResponseError;
1069
1076
  declare const errors_ResponseError: typeof ResponseError;
1070
1077
  type errors_SignatureContractError = SignatureContractError;
1071
1078
  declare const errors_SignatureContractError: typeof SignatureContractError;
1072
- type errors_SignatureErrorData = SignatureErrorData;
1073
1079
  type errors_SignatureNotFoundError = SignatureNotFoundError;
1074
1080
  declare const errors_SignatureNotFoundError: typeof SignatureNotFoundError;
1075
1081
  type errors_SigningError = SigningError;
1076
1082
  declare const errors_SigningError: typeof SigningError;
1077
1083
  declare namespace errors {
1078
- export { errors_ResponseError as ResponseError, errors_SignatureContractError as SignatureContractError, type errors_SignatureErrorData as SignatureErrorData, errors_SignatureNotFoundError as SignatureNotFoundError, errors_SigningError as SigningError };
1084
+ export { errors_ResponseError as ResponseError, errors_SignatureContractError as SignatureContractError, errors_SignatureNotFoundError as SignatureNotFoundError, errors_SigningError as SigningError };
1079
1085
  }
1080
1086
 
1081
1087
  declare class ChainSignatureContract extends ChainSignatureContract$3 {
@@ -1091,7 +1097,7 @@ declare class ChainSignatureContract extends ChainSignatureContract$3 {
1091
1097
  * @param args.provider - An Anchor Provider for interacting with Solana
1092
1098
  * @param args.programId - The program ID as a string or PublicKey
1093
1099
  * @param args.rootPublicKey - Optional root public key. If not provided, it will be derived from the program ID
1094
- * @param args.requesterAddress - Provider wallet address is always the fee payer but can be overridden
1100
+ * @param args.requesterAddress - Provider wallet address is always the fee payer but requester can be overridden
1095
1101
  */
1096
1102
  constructor(args: {
1097
1103
  provider: AnchorProvider;
@@ -1113,7 +1119,7 @@ declare class ChainSignatureContract extends ChainSignatureContract$3 {
1113
1119
  predecessor: string;
1114
1120
  }): Promise<UncompressedPubKeySEC1>;
1115
1121
  getPublicKey(): Promise<UncompressedPubKeySEC1>;
1116
- getSignRequestInstruction(args: SignArgs, options?: SignOptions & {
1122
+ getSignRequestInstruction(args: SignArgs, options?: Pick<SignOptions, 'sign'> & {
1117
1123
  remainingAccounts?: Array<AccountMeta>;
1118
1124
  }): Promise<TransactionInstruction>;
1119
1125
  /**
@@ -1121,7 +1127,7 @@ declare class ChainSignatureContract extends ChainSignatureContract$3 {
1121
1127
  * polls for the signature result. If the signature is not found within the retry
1122
1128
  * parameters, it will throw an error.
1123
1129
  */
1124
- sign(args: SignArgs, options?: SignOptions & {
1130
+ sign(args: SignArgs, options?: Partial<SignOptions> & {
1125
1131
  remainingAccounts?: Array<AccountMeta>;
1126
1132
  }): Promise<RSVSignature>;
1127
1133
  /**
@@ -1134,7 +1140,7 @@ declare class ChainSignatureContract extends ChainSignatureContract$3 {
1134
1140
  payload: number[];
1135
1141
  path: string;
1136
1142
  options?: RetryOptions;
1137
- }): Promise<RSVSignature | SignatureErrorData$1 | undefined>;
1143
+ }): Promise<RSVSignature | SignatureErrorData | undefined>;
1138
1144
  /**
1139
1145
  * Generates the request ID for a signature request allowing to track the response.
1140
1146
  */
package/types/index.d.ts CHANGED
@@ -928,9 +928,8 @@ interface SignOptions {
928
928
  };
929
929
  retry: RetryOptions;
930
930
  }
931
- interface SignatureErrorData$1 {
931
+ interface SignatureErrorData {
932
932
  requestId: string;
933
- responder: string;
934
933
  error: string;
935
934
  }
936
935
 
@@ -969,6 +968,17 @@ declare class ChainSignatureContract$1 extends ChainSignatureContract$3 {
969
968
  }): Promise<UncompressedPubKeySEC1>;
970
969
  getPublicKey(): Promise<UncompressedPubKeySEC1>;
971
970
  getLatestKeyVersion(): Promise<number>;
971
+ /**
972
+ * Sends a sign request transaction and return the transaction hash.
973
+ *
974
+ * @param args - The signature arguments
975
+ * @param options - The signing options
976
+ * @returns The transaction hash
977
+ */
978
+ createSignatureRequest(args: SignArgs, options?: Pick<SignOptions, 'sign'>): Promise<{
979
+ txHash: Hex;
980
+ requestId: Hex;
981
+ }>;
972
982
  /**
973
983
  * Sends a transaction to the contract to request a signature, then
974
984
  * polls for the signature result. If the signature is not found within the retry
@@ -981,7 +991,7 @@ declare class ChainSignatureContract$1 extends ChainSignatureContract$3 {
981
991
  path: string;
982
992
  fromBlock: bigint;
983
993
  options?: RetryOptions;
984
- }): Promise<RSVSignature | SignatureErrorData$1 | undefined>;
994
+ }): Promise<RSVSignature | SignatureErrorData | undefined>;
985
995
  getSignRequestParams(args: SignArgs, options?: SignOptions['sign']): Promise<{
986
996
  target: Hex;
987
997
  data: Hex;
@@ -1011,7 +1021,7 @@ declare class ChainSignatureContract$1 extends ChainSignatureContract$3 {
1011
1021
  * ```
1012
1022
  */
1013
1023
  getRequestId(args: SignArgs, options?: SignOptions['sign']): Hex;
1014
- getErrorFromEvents(requestId: Hex, fromBlock: bigint): Promise<SignatureErrorData$1 | undefined>;
1024
+ getErrorFromEvents(requestId: Hex, fromBlock: bigint): Promise<SignatureErrorData | undefined>;
1015
1025
  /**
1016
1026
  * Searches for SignatureResponded events that match the given requestId.
1017
1027
  * It works in conjunction with the getRequestId method which generates the unique
@@ -1033,11 +1043,6 @@ declare namespace index$2 {
1033
1043
  export { ChainSignatureContract$1 as ChainSignatureContract, utils$1 as utils };
1034
1044
  }
1035
1045
 
1036
- type SignatureErrorData = {
1037
- requestId: Uint8Array;
1038
- responder: PublicKey;
1039
- error: string;
1040
- };
1041
1046
  declare class SignatureNotFoundError extends Error {
1042
1047
  readonly requestId?: string;
1043
1048
  readonly hash?: string;
@@ -1048,7 +1053,9 @@ declare class SignatureNotFoundError extends Error {
1048
1053
  declare class SignatureContractError extends Error {
1049
1054
  readonly requestId?: string;
1050
1055
  readonly hash?: string;
1051
- readonly originalError?: any;
1056
+ readonly originalError?: {
1057
+ hash: string;
1058
+ };
1052
1059
  constructor(message: string, requestId?: string, metadata?: {
1053
1060
  hash?: string;
1054
1061
  });
@@ -1069,13 +1076,12 @@ type errors_ResponseError = ResponseError;
1069
1076
  declare const errors_ResponseError: typeof ResponseError;
1070
1077
  type errors_SignatureContractError = SignatureContractError;
1071
1078
  declare const errors_SignatureContractError: typeof SignatureContractError;
1072
- type errors_SignatureErrorData = SignatureErrorData;
1073
1079
  type errors_SignatureNotFoundError = SignatureNotFoundError;
1074
1080
  declare const errors_SignatureNotFoundError: typeof SignatureNotFoundError;
1075
1081
  type errors_SigningError = SigningError;
1076
1082
  declare const errors_SigningError: typeof SigningError;
1077
1083
  declare namespace errors {
1078
- export { errors_ResponseError as ResponseError, errors_SignatureContractError as SignatureContractError, type errors_SignatureErrorData as SignatureErrorData, errors_SignatureNotFoundError as SignatureNotFoundError, errors_SigningError as SigningError };
1084
+ export { errors_ResponseError as ResponseError, errors_SignatureContractError as SignatureContractError, errors_SignatureNotFoundError as SignatureNotFoundError, errors_SigningError as SigningError };
1079
1085
  }
1080
1086
 
1081
1087
  declare class ChainSignatureContract extends ChainSignatureContract$3 {
@@ -1091,7 +1097,7 @@ declare class ChainSignatureContract extends ChainSignatureContract$3 {
1091
1097
  * @param args.provider - An Anchor Provider for interacting with Solana
1092
1098
  * @param args.programId - The program ID as a string or PublicKey
1093
1099
  * @param args.rootPublicKey - Optional root public key. If not provided, it will be derived from the program ID
1094
- * @param args.requesterAddress - Provider wallet address is always the fee payer but can be overridden
1100
+ * @param args.requesterAddress - Provider wallet address is always the fee payer but requester can be overridden
1095
1101
  */
1096
1102
  constructor(args: {
1097
1103
  provider: AnchorProvider;
@@ -1113,7 +1119,7 @@ declare class ChainSignatureContract extends ChainSignatureContract$3 {
1113
1119
  predecessor: string;
1114
1120
  }): Promise<UncompressedPubKeySEC1>;
1115
1121
  getPublicKey(): Promise<UncompressedPubKeySEC1>;
1116
- getSignRequestInstruction(args: SignArgs, options?: SignOptions & {
1122
+ getSignRequestInstruction(args: SignArgs, options?: Pick<SignOptions, 'sign'> & {
1117
1123
  remainingAccounts?: Array<AccountMeta>;
1118
1124
  }): Promise<TransactionInstruction>;
1119
1125
  /**
@@ -1121,7 +1127,7 @@ declare class ChainSignatureContract extends ChainSignatureContract$3 {
1121
1127
  * polls for the signature result. If the signature is not found within the retry
1122
1128
  * parameters, it will throw an error.
1123
1129
  */
1124
- sign(args: SignArgs, options?: SignOptions & {
1130
+ sign(args: SignArgs, options?: Partial<SignOptions> & {
1125
1131
  remainingAccounts?: Array<AccountMeta>;
1126
1132
  }): Promise<RSVSignature>;
1127
1133
  /**
@@ -1134,7 +1140,7 @@ declare class ChainSignatureContract extends ChainSignatureContract$3 {
1134
1140
  payload: number[];
1135
1141
  path: string;
1136
1142
  options?: RetryOptions;
1137
- }): Promise<RSVSignature | SignatureErrorData$1 | undefined>;
1143
+ }): Promise<RSVSignature | SignatureErrorData | undefined>;
1138
1144
  /**
1139
1145
  * Generates the request ID for a signature request allowing to track the response.
1140
1146
  */