@otim/sdk-core 0.0.9 → 0.0.10
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/dist/.tsbuildinfo +1 -1
- package/dist/account/index.cjs +1 -1
- package/dist/{account-CRvC_dXT.cjs → account-Bwm5PTcc.cjs} +3 -8
- package/dist/account-Bwm5PTcc.cjs.map +1 -0
- package/dist/clients/index.cjs +4 -1
- package/dist/{clients-CXapnxYY.cjs → clients-CeCv_iST.cjs} +60 -28
- package/dist/clients-CeCv_iST.cjs.map +1 -0
- package/dist/config/index.cjs +1 -1
- package/dist/{config-CjGpscVk.cjs → config-BrvU6CD_.cjs} +2 -2
- package/dist/{config-CjGpscVk.cjs.map → config-BrvU6CD_.cjs.map} +1 -1
- package/dist/context/index.cjs +1 -1
- package/dist/{context-B-Wcmhb3.cjs → context-DK5bXjx4.cjs} +1 -1
- package/dist/{context-B-Wcmhb3.cjs.map → context-DK5bXjx4.cjs.map} +1 -1
- package/dist/index.cjs +18 -9
- package/dist/signing/index.cjs +10 -0
- package/dist/signing-BaJMYH0K.cjs +1096 -0
- package/dist/signing-BaJMYH0K.cjs.map +1 -0
- package/dist/utils/index.cjs +5 -5
- package/dist/{utils-CVQFvsfl.cjs → vrs-Do0jfo3H.cjs} +1 -1
- package/dist/vrs-Do0jfo3H.cjs.map +1 -0
- package/package.json +19 -7
- package/dist/abi-DW6AS0eM.d.mts +0 -339
- package/dist/abi-DW6AS0eM.d.mts.map +0 -1
- package/dist/abi-OUq-mx1W.d.cts +0 -339
- package/dist/abi-OUq-mx1W.d.cts.map +0 -1
- package/dist/account/index.d.cts +0 -5
- package/dist/account/index.d.mts +0 -5
- package/dist/account/index.mjs +0 -3
- package/dist/account-CRvC_dXT.cjs.map +0 -1
- package/dist/account-D1NVta26.mjs +0 -31
- package/dist/account-D1NVta26.mjs.map +0 -1
- package/dist/authorization-6anhDdQX.d.cts +0 -210
- package/dist/authorization-6anhDdQX.d.cts.map +0 -1
- package/dist/authorization-DnNpWjxB.d.mts +0 -210
- package/dist/authorization-DnNpWjxB.d.mts.map +0 -1
- package/dist/clients/index.d.cts +0 -3
- package/dist/clients/index.d.mts +0 -3
- package/dist/clients/index.mjs +0 -3
- package/dist/clients-CXapnxYY.cjs.map +0 -1
- package/dist/clients-exLOdQVD.mjs +0 -217
- package/dist/clients-exLOdQVD.mjs.map +0 -1
- package/dist/config/index.d.cts +0 -3
- package/dist/config/index.d.mts +0 -3
- package/dist/config/index.mjs +0 -3
- package/dist/config-C_nc1DXn.mjs +0 -67
- package/dist/config-C_nc1DXn.mjs.map +0 -1
- package/dist/context/index.d.cts +0 -5
- package/dist/context/index.d.mts +0 -5
- package/dist/context/index.mjs +0 -3
- package/dist/context-uTye69B0.mjs +0 -20
- package/dist/context-uTye69B0.mjs.map +0 -1
- package/dist/index-BQMXYh9N.d.cts +0 -14
- package/dist/index-BQMXYh9N.d.cts.map +0 -1
- package/dist/index-C5c51xs0.d.mts +0 -51
- package/dist/index-C5c51xs0.d.mts.map +0 -1
- package/dist/index-C8H-BPGH.d.cts +0 -51
- package/dist/index-C8H-BPGH.d.cts.map +0 -1
- package/dist/index-CBQ5I-Uz.d.cts +0 -103
- package/dist/index-CBQ5I-Uz.d.cts.map +0 -1
- package/dist/index-CnjY7cyS.d.mts +0 -14
- package/dist/index-CnjY7cyS.d.mts.map +0 -1
- package/dist/index-D8OoAxEI.d.mts +0 -103
- package/dist/index-D8OoAxEI.d.mts.map +0 -1
- package/dist/index-DWE1xfOE.d.mts +0 -23
- package/dist/index-DWE1xfOE.d.mts.map +0 -1
- package/dist/index-D_7CTJDl.d.mts +0 -27
- package/dist/index-D_7CTJDl.d.mts.map +0 -1
- package/dist/index-GSspyLr3.d.cts +0 -23
- package/dist/index-GSspyLr3.d.cts.map +0 -1
- package/dist/index-lW-Oor1B.d.cts +0 -27
- package/dist/index-lW-Oor1B.d.cts.map +0 -1
- package/dist/index.d.cts +0 -9
- package/dist/index.d.mts +0 -9
- package/dist/index.mjs +0 -7
- package/dist/rpc-BDoNl1Sp.d.cts +0 -6885
- package/dist/rpc-BDoNl1Sp.d.cts.map +0 -1
- package/dist/rpc-CygBD_f7.d.mts +0 -6885
- package/dist/rpc-CygBD_f7.d.mts.map +0 -1
- package/dist/utils/index.d.cts +0 -4
- package/dist/utils/index.d.mts +0 -4
- package/dist/utils/index.mjs +0 -3
- package/dist/utils-CVQFvsfl.cjs.map +0 -1
- package/dist/utils-DziAHBiz.mjs +0 -81
- package/dist/utils-DziAHBiz.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signing-BaJMYH0K.cjs","names":["z","PENDING_STATUSES: ActivityStatus[]","FAILED_STATUSES: ActivityStatus[]","requestPayload: SignRawPayloadsRequest","walletClient: WalletClient","WalletType","WalletStamper","instructionRegistry: InstructionRegistry","config: SignerConfig","instructionRegistry"],"sources":["../src/turnkey/api/schemas.ts","../src/errors/base.ts","../src/errors/auth.ts","../src/errors/turnkey.ts","../src/turnkey/config.ts","../src/turnkey/api/account-api.ts","../src/signing/services/api-key-client.ts","../src/signing/adapters/ethereum-wallet-adapter.ts","../src/signing/services/server-wallet.ts","../src/errors/validation.ts","../src/signing/utils/authorization-digest.ts","../src/signing/utils/instruction-digest.ts","../src/signing/utils/signature-formatter.ts","../src/signing/unified-payment-signer.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/**\n * Turnkey API Schemas\n *\n * Zod schemas for Turnkey API requests and responses.\n */\n\nexport interface Signature {\n r: string;\n s: string;\n v: string;\n}\n\nexport const signatureSchema = z.object({\n r: z.string(),\n s: z.string(),\n v: z.string(),\n});\n\nexport interface Timestamp {\n seconds: string;\n nanos: string;\n}\n\nexport const timestampSchema = z.object({\n seconds: z.string(),\n nanos: z.string(),\n});\n\nexport interface SignRawPayloadsParams {\n organizationId: string;\n signWith: string;\n payloads: string[];\n}\n\nexport interface SignRawPayloadsRequest {\n type: \"ACTIVITY_TYPE_SIGN_RAW_PAYLOADS\";\n timestampMs: string;\n organizationId: string;\n parameters: {\n signWith: string;\n payloads: string[];\n encoding: \"PAYLOAD_ENCODING_HEXADECIMAL\";\n hashFunction: \"HASH_FUNCTION_NO_OP\";\n };\n}\n\nexport const signRawPayloadsRequestSchema = z.object({\n type: z.literal(\"ACTIVITY_TYPE_SIGN_RAW_PAYLOADS\"),\n timestampMs: z.string(),\n organizationId: z.string(),\n parameters: z.object({\n signWith: z.string(),\n payloads: z.array(z.string()),\n encoding: z.literal(\"PAYLOAD_ENCODING_HEXADECIMAL\"),\n hashFunction: z.literal(\"HASH_FUNCTION_NO_OP\"),\n }),\n});\n\nexport type ActivityStatus =\n | \"ACTIVITY_STATUS_CREATED\"\n | \"ACTIVITY_STATUS_PENDING\"\n | \"ACTIVITY_STATUS_COMPLETED\"\n | \"ACTIVITY_STATUS_FAILED\"\n | \"ACTIVITY_STATUS_CONSENSUS_NEEDED\"\n | \"ACTIVITY_STATUS_REJECTED\";\n\nexport const activityStatusSchema = z.enum([\n \"ACTIVITY_STATUS_CREATED\",\n \"ACTIVITY_STATUS_PENDING\",\n \"ACTIVITY_STATUS_COMPLETED\",\n \"ACTIVITY_STATUS_FAILED\",\n \"ACTIVITY_STATUS_CONSENSUS_NEEDED\",\n \"ACTIVITY_STATUS_REJECTED\",\n]);\n\nexport interface SignRawPayloadsResult {\n signRawPayloadsResult: {\n signatures: Signature[];\n };\n}\n\nexport const signRawPayloadsResultSchema = z.object({\n signRawPayloadsResult: z.object({\n signatures: z.array(signatureSchema),\n }),\n});\n\nexport interface SignRawPayloadsResponse {\n activity: {\n id: string;\n status: ActivityStatus;\n result: SignRawPayloadsResult | null;\n };\n}\n\nexport const signRawPayloadsResponseSchema = z.object({\n activity: z.object({\n id: z.string(),\n status: activityStatusSchema,\n result: signRawPayloadsResultSchema.nullable(),\n }),\n});\n\nexport interface GetActivityRequest {\n organizationId: string;\n activityId: string;\n}\n\nexport interface GetActivityResponse {\n activity: {\n id: string;\n status: ActivityStatus;\n result: SignRawPayloadsResult | null;\n };\n}\n\nexport const getActivityResponseSchema = z.object({\n activity: z.object({\n id: z.string(),\n status: activityStatusSchema,\n result: signRawPayloadsResultSchema.nullable(),\n }),\n});\n\nexport interface GetWalletsRequest {\n organizationId: string;\n}\n\nexport const getWalletsRequestSchema = z.object({\n organizationId: z.string(),\n});\n\nexport interface Wallet {\n walletId: string;\n walletName: string;\n createdAt: Timestamp;\n updatedAt: Timestamp;\n exported: boolean;\n imported: boolean;\n}\n\nexport const walletSchema = z.object({\n walletId: z.string(),\n walletName: z.string(),\n createdAt: timestampSchema,\n updatedAt: timestampSchema,\n exported: z.boolean(),\n imported: z.boolean(),\n});\n\nexport interface GetWalletsResponse {\n wallets: Wallet[];\n}\n\nexport const getWalletsResponseSchema = z.object({\n wallets: z.array(walletSchema),\n});\n\nexport interface DeleteWalletsRequest {\n type: \"ACTIVITY_TYPE_DELETE_WALLETS\";\n timestampMs: string;\n organizationId: string;\n parameters: {\n walletIds: string[];\n deleteWithoutExport?: boolean;\n };\n}\n\nexport const deleteWalletsRequestSchema = z.object({\n type: z.literal(\"ACTIVITY_TYPE_DELETE_WALLETS\"),\n timestampMs: z.string(),\n organizationId: z.string(),\n parameters: z.object({\n walletIds: z.array(z.string()),\n deleteWithoutExport: z.boolean().optional(),\n }),\n});\n\nexport interface DeleteWalletsResponse {\n activity: {\n result: {\n deleteWalletsResult: {\n walletIds: string[];\n };\n };\n };\n}\n\nexport const deleteWalletsResponseSchema = z.object({\n activity: z.object({\n result: z.object({\n deleteWalletsResult: z.object({\n walletIds: z.array(z.string()),\n }),\n }),\n }),\n});\n\nexport interface GetWalletAccountsRequest {\n organizationId: string;\n walletId?: string;\n}\n\nexport const getWalletAccountsRequestSchema = z.object({\n organizationId: z.string(),\n walletId: z.string().optional(),\n});\n\nexport interface WalletDetails {\n walletId: string;\n walletName: string;\n createdAt: Timestamp;\n updatedAt: Timestamp;\n exported: boolean;\n imported: boolean;\n}\n\nexport const walletDetailsSchema = z.object({\n walletId: z.string(),\n walletName: z.string(),\n createdAt: timestampSchema,\n updatedAt: timestampSchema,\n exported: z.boolean(),\n imported: z.boolean(),\n});\n\nexport interface WalletAccount {\n walletAccountId: string;\n organizationId: string;\n walletId: string;\n curve: string;\n pathFormat: string;\n path: string;\n addressFormat: string;\n address: string;\n createdAt: Timestamp;\n updatedAt: Timestamp;\n publicKey: string;\n walletDetails?: WalletDetails;\n}\n\nexport const walletAccountSchema = z.object({\n walletAccountId: z.string(),\n organizationId: z.string(),\n walletId: z.string(),\n curve: z.string(),\n pathFormat: z.string(),\n path: z.string(),\n addressFormat: z.string(),\n address: z.string(),\n createdAt: timestampSchema,\n updatedAt: timestampSchema,\n publicKey: z.string(),\n walletDetails: walletDetailsSchema.optional(),\n});\n\nexport interface GetWalletAccountsResponse {\n accounts: WalletAccount[];\n}\n\nexport const getWalletAccountsResponseSchema = z.object({\n accounts: z.array(walletAccountSchema),\n});\n\nexport interface GetWhoamiRequest {\n organizationId: string;\n}\n\nexport const getWhoamiRequestSchema = z.object({\n organizationId: z.string(),\n});\n\nexport interface GetWhoamiResponse {\n organizationId: string;\n organizationName: string;\n userId: string;\n username: string;\n}\n\nexport const getWhoamiResponseSchema = z.object({\n organizationId: z.string(),\n organizationName: z.string(),\n userId: z.string(),\n username: z.string(),\n});\n\nexport interface GetApiKeysRequest {\n organizationId: string;\n userId: string;\n}\n\nexport const getApiKeysRequestSchema = z.object({\n organizationId: z.string(),\n userId: z.string(),\n});\n\nexport const apiKeyCredentialSchema = z.object({\n publicKey: z.string(),\n curveType: z.string().optional(),\n});\n\nexport interface ApiKey {\n apiKeyId: string;\n apiKeyName: string;\n credential?: {\n publicKey: string;\n curveType?: string;\n };\n createdAt?: Timestamp;\n updatedAt?: Timestamp;\n}\n\nexport const apiKeySchema = z.object({\n apiKeyId: z.string(),\n apiKeyName: z.string(),\n credential: apiKeyCredentialSchema.optional(),\n createdAt: timestampSchema.optional(),\n updatedAt: timestampSchema.optional(),\n});\n\nexport interface GetApiKeysResponse {\n apiKeys: ApiKey[];\n}\n\nexport const getApiKeysResponseSchema = z.object({\n apiKeys: z.array(apiKeySchema),\n});\n\nexport interface CreateApiKeysRequest {\n type: \"ACTIVITY_TYPE_CREATE_API_KEYS_V2\";\n timestampMs: string;\n organizationId: string;\n parameters: {\n apiKeys: {\n apiKeyName: string;\n publicKey: string;\n curveType: \"API_KEY_CURVE_SECP256K1\";\n }[];\n userId: string;\n };\n}\n\nexport const createApiKeysRequestSchema = z.object({\n type: z.literal(\"ACTIVITY_TYPE_CREATE_API_KEYS_V2\"),\n timestampMs: z.string(),\n organizationId: z.string(),\n parameters: z.object({\n apiKeys: z.array(\n z.object({\n apiKeyName: z.string(),\n publicKey: z.string(),\n curveType: z.literal(\"API_KEY_CURVE_SECP256K1\"),\n }),\n ),\n userId: z.string(),\n }),\n});\n\nexport interface CreateApiKeysResponse {\n activity: {\n id: string;\n result: {\n createApiKeysResult: {\n apiKeyIds: string[];\n };\n };\n };\n}\n\nexport const createApiKeysResponseSchema = z.object({\n activity: z.object({\n id: z.string(),\n result: z.object({\n createApiKeysResult: z.object({\n apiKeyIds: z.array(z.string()),\n }),\n }),\n }),\n});\n\nexport interface DeleteApiKeysRequest {\n type: \"ACTIVITY_TYPE_DELETE_API_KEYS\";\n timestampMs: string;\n organizationId: string;\n parameters: {\n apiKeyIds: string[];\n userId: string;\n };\n}\n\nexport const deleteApiKeysRequestSchema = z.object({\n type: z.literal(\"ACTIVITY_TYPE_DELETE_API_KEYS\"),\n timestampMs: z.string(),\n organizationId: z.string(),\n parameters: z.object({\n apiKeyIds: z.array(z.string()),\n userId: z.string(),\n }),\n});\n\nexport interface DeleteApiKeysResponse {\n activity: {\n id: string;\n result: {\n deleteApiKeysResult: {\n apiKeyIds: string[];\n };\n };\n };\n}\n\nexport const deleteApiKeysResponseSchema = z.object({\n activity: z.object({\n id: z.string(),\n result: z.object({\n deleteApiKeysResult: z.object({\n apiKeyIds: z.array(z.string()),\n }),\n }),\n }),\n});\n\n/**\n * Authenticator Schemas\n *\n * Types and schemas for managing passkey authenticators via Turnkey API.\n */\n\n/* Turnkey authenticator transport types */\nexport type AuthenticatorTransport =\n | \"AUTHENTICATOR_TRANSPORT_BLE\"\n | \"AUTHENTICATOR_TRANSPORT_INTERNAL\"\n | \"AUTHENTICATOR_TRANSPORT_NFC\"\n | \"AUTHENTICATOR_TRANSPORT_USB\"\n | \"AUTHENTICATOR_TRANSPORT_HYBRID\";\n\nexport const authenticatorTransportSchema = z.enum([\n \"AUTHENTICATOR_TRANSPORT_BLE\",\n \"AUTHENTICATOR_TRANSPORT_INTERNAL\",\n \"AUTHENTICATOR_TRANSPORT_NFC\",\n \"AUTHENTICATOR_TRANSPORT_USB\",\n \"AUTHENTICATOR_TRANSPORT_HYBRID\",\n]);\n\n/* Authenticator attestation for creating new authenticators */\nexport interface AuthenticatorAttestation {\n credentialId: string;\n clientDataJson: string;\n attestationObject: string;\n transports: AuthenticatorTransport[];\n}\n\nexport const authenticatorAttestationSchema = z.object({\n credentialId: z.string(),\n clientDataJson: z.string(),\n attestationObject: z.string(),\n transports: z.array(authenticatorTransportSchema),\n});\n\n/* Authenticator object returned from Turnkey */\nexport interface Authenticator {\n authenticatorId: string;\n authenticatorName: string;\n userId: string;\n credentialId: string;\n model: string;\n transports: AuthenticatorTransport[];\n createdAt: Timestamp;\n updatedAt: Timestamp;\n}\n\nexport const authenticatorSchema = z.object({\n authenticatorId: z.string(),\n authenticatorName: z.string(),\n userId: z.string(),\n credentialId: z.string(),\n model: z.string(),\n transports: z.array(authenticatorTransportSchema),\n createdAt: timestampSchema,\n updatedAt: timestampSchema,\n});\n\n/* Get Authenticators Request */\nexport interface GetAuthenticatorsRequest {\n organizationId: string;\n userId: string;\n}\n\nexport const getAuthenticatorsRequestSchema = z.object({\n organizationId: z.string(),\n userId: z.string(),\n});\n\n/* Get Authenticators Response */\nexport interface GetAuthenticatorsResponse {\n authenticators: Authenticator[];\n}\n\nexport const getAuthenticatorsResponseSchema = z.object({\n authenticators: z.array(authenticatorSchema),\n});\n\n/* Create Authenticators Request */\nexport interface CreateAuthenticatorsRequest {\n type: \"ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2\";\n timestampMs: string;\n organizationId: string;\n parameters: {\n authenticators: {\n authenticatorName: string;\n challenge: string;\n attestation: AuthenticatorAttestation;\n }[];\n userId: string;\n };\n}\n\nexport const createAuthenticatorsRequestSchema = z.object({\n type: z.literal(\"ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2\"),\n timestampMs: z.string(),\n organizationId: z.string(),\n parameters: z.object({\n authenticators: z.array(\n z.object({\n authenticatorName: z.string(),\n challenge: z.string(),\n attestation: authenticatorAttestationSchema,\n }),\n ),\n userId: z.string(),\n }),\n});\n\n/* Create Authenticators Response */\nexport interface CreateAuthenticatorsResponse {\n activity: {\n id: string;\n result: {\n createAuthenticatorsResult: {\n authenticatorIds: string[];\n };\n };\n };\n}\n\nexport const createAuthenticatorsResponseSchema = z.object({\n activity: z.object({\n id: z.string(),\n result: z.object({\n createAuthenticatorsResult: z.object({\n authenticatorIds: z.array(z.string()),\n }),\n }),\n }),\n});\n\n/* Delete Authenticators Request */\nexport interface DeleteAuthenticatorsRequest {\n type: \"ACTIVITY_TYPE_DELETE_AUTHENTICATORS\";\n timestampMs: string;\n organizationId: string;\n parameters: {\n authenticatorIds: string[];\n userId: string;\n };\n}\n\nexport const deleteAuthenticatorsRequestSchema = z.object({\n type: z.literal(\"ACTIVITY_TYPE_DELETE_AUTHENTICATORS\"),\n timestampMs: z.string(),\n organizationId: z.string(),\n parameters: z.object({\n authenticatorIds: z.array(z.string()),\n userId: z.string(),\n }),\n});\n\n/* Delete Authenticators Response */\nexport interface DeleteAuthenticatorsResponse {\n activity: {\n id: string;\n result: {\n deleteAuthenticatorsResult: {\n authenticatorIds: string[];\n };\n };\n };\n}\n\nexport const deleteAuthenticatorsResponseSchema = z.object({\n activity: z.object({\n id: z.string(),\n result: z.object({\n deleteAuthenticatorsResult: z.object({\n authenticatorIds: z.array(z.string()),\n }),\n }),\n }),\n});\n","/**\n * Signing Error Codes\n *\n * Centralized error codes for signing-related operations.\n */\n\nexport const SigningErrorCode = {\n // Authentication errors\n AuthenticationFailed: \"AUTHENTICATION_FAILED\",\n WalletNotConnected: \"WALLET_NOT_CONNECTED\",\n\n // Validation errors\n ValidationFailed: \"VALIDATION_FAILED\",\n InvalidParams: \"INVALID_PARAMS\",\n InvalidAddress: \"INVALID_ADDRESS\",\n\n // Turnkey errors\n TurnkeyError: \"TURNKEY_ERROR\",\n TurnkeyActivityFailed: \"TURNKEY_ACTIVITY_FAILED\",\n TurnkeyActivityTimeout: \"TURNKEY_ACTIVITY_TIMEOUT\",\n\n // Generic errors\n UnknownError: \"UNKNOWN_ERROR\",\n OperationFailed: \"OPERATION_FAILED\",\n} as const;\n\nexport type SigningErrorCode =\n (typeof SigningErrorCode)[keyof typeof SigningErrorCode];\n\nexport interface SigningErrorOptions {\n cause?: unknown;\n details?: string;\n metaMessages?: string[];\n context?: Record<string, unknown>;\n}\n\n/**\n * Base error class for all signing-related errors.\n *\n * Provides structured error information with:\n * - Error codes for programmatic handling\n * - Detailed messages with context\n * - Cause chain for debugging\n */\nexport class SigningError extends Error {\n readonly code: SigningErrorCode;\n readonly details?: string;\n readonly metaMessages?: string[];\n readonly shortMessage: string;\n readonly context?: Record<string, unknown>;\n\n declare cause?: unknown;\n override name = \"SigningError\";\n\n constructor(\n shortMessage: string,\n code: SigningErrorCode = SigningErrorCode.UnknownError,\n options: SigningErrorOptions = {},\n ) {\n super();\n\n const causeMessage =\n options.cause instanceof Error ? options.cause.message : undefined;\n const causeDetails =\n options.cause instanceof SigningError\n ? options.cause.details\n : causeMessage;\n const details = causeDetails ?? options.details;\n\n this.message = [\n shortMessage || \"An error occurred.\",\n \"\",\n ...(options.metaMessages ? [...options.metaMessages, \"\"] : []),\n ...(details ? [`Details: ${details}`] : []),\n ].join(\"\\n\");\n\n this.code = code;\n this.shortMessage = shortMessage;\n this.details = details;\n this.metaMessages = options.metaMessages;\n this.context = options.context;\n\n if (options.cause !== undefined) {\n this.cause = options.cause;\n }\n\n Error.captureStackTrace?.(this, this.constructor);\n }\n\n /**\n * Walks the error cause chain looking for an error that matches the predicate.\n */\n walk(fn?: (err: unknown) => boolean): unknown {\n return this._walkInternal(this, fn);\n }\n\n toJSON(): Record<string, unknown> {\n return {\n name: this.name,\n code: this.code,\n shortMessage: this.shortMessage,\n message: this.message,\n details: this.details,\n metaMessages: this.metaMessages,\n context: this.context,\n cause: this.cause instanceof Error ? this.cause.message : this.cause,\n stack: this.stack,\n };\n }\n\n private _walkInternal(err: unknown, fn?: (err: unknown) => boolean): unknown {\n if (fn?.(err)) return err;\n const errorCause =\n err instanceof Error ? (err as { cause?: unknown }).cause : undefined;\n if (errorCause !== undefined) {\n return this._walkInternal(errorCause, fn);\n }\n return err;\n }\n}\n","import type { SigningErrorOptions } from \"./base\";\n\nimport { SigningError, SigningErrorCode } from \"./base\";\n\n/**\n * Authentication Errors\n *\n * Errors related to user authentication and wallet connection.\n */\n\n/**\n * Base class for authentication-related errors.\n */\nexport class AuthError extends SigningError {\n override name = \"AuthError\";\n\n constructor(\n message: string,\n code: SigningErrorCode = SigningErrorCode.AuthenticationFailed,\n options?: SigningErrorOptions,\n ) {\n super(message, code, options);\n }\n}\n\n/**\n * Thrown when authentication fails.\n */\nexport class AuthenticationError extends AuthError {\n override name = \"AuthenticationError\";\n\n constructor(\n message = \"Authentication failed. Please try again.\",\n options?: SigningErrorOptions,\n ) {\n super(message, SigningErrorCode.AuthenticationFailed, options);\n }\n}\n\n/**\n * Thrown when wallet is not connected.\n */\nexport class WalletNotConnectedError extends AuthError {\n override name = \"WalletNotConnectedError\";\n\n constructor(\n message = \"Wallet not connected. Please connect your wallet.\",\n options?: SigningErrorOptions,\n ) {\n super(message, SigningErrorCode.WalletNotConnected, options);\n }\n}\n","import type { SigningErrorOptions } from \"./base\";\n\nimport { SigningError, SigningErrorCode } from \"./base\";\n\n/**\n * Turnkey Errors\n *\n * Errors related to Turnkey infrastructure and operations.\n */\n\n/**\n * Base class for Turnkey-related errors.\n */\nexport class TurnkeyError extends SigningError {\n override name = \"TurnkeyError\";\n\n constructor(\n message: string,\n code: SigningErrorCode = SigningErrorCode.TurnkeyError,\n options?: SigningErrorOptions,\n ) {\n super(message, code, options);\n }\n}\n\n/**\n * Thrown when a Turnkey activity/operation fails.\n */\nexport class TurnkeyActivityError extends TurnkeyError {\n override name = \"TurnkeyActivityError\";\n\n readonly activityId?: string;\n\n constructor(\n message = \"Turnkey operation failed.\",\n options?: SigningErrorOptions & { activityId?: string },\n ) {\n super(message, SigningErrorCode.TurnkeyActivityFailed, {\n ...options,\n metaMessages: options?.activityId\n ? [`Activity ID: ${options.activityId}`]\n : undefined,\n });\n this.activityId = options?.activityId;\n }\n}\n\n/**\n * Thrown when a Turnkey activity times out.\n */\nexport class TurnkeyActivityTimeoutError extends TurnkeyError {\n override name = \"TurnkeyActivityTimeoutError\";\n\n readonly activityId?: string;\n readonly timeoutMs?: number;\n\n constructor(\n message = \"Turnkey operation timed out.\",\n options?: SigningErrorOptions & { activityId?: string; timeoutMs?: number },\n ) {\n super(message, SigningErrorCode.TurnkeyActivityTimeout, {\n ...options,\n metaMessages: [\n ...(options?.activityId ? [`Activity ID: ${options.activityId}`] : []),\n ...(options?.timeoutMs ? [`Timeout: ${options.timeoutMs}ms`] : []),\n \"The operation took longer than expected. Please try again.\",\n ],\n });\n this.activityId = options?.activityId;\n this.timeoutMs = options?.timeoutMs;\n }\n}\n","/**\n * Turnkey API Configuration\n *\n * Turnkey API URL is constant across all environments.\n */\nexport const TURNKEY_API_URL = \"https://api.turnkey.com\" as const;\n","import type {\n ActivityStatus,\n CreateApiKeysRequest,\n CreateApiKeysResponse,\n CreateAuthenticatorsRequest,\n CreateAuthenticatorsResponse,\n DeleteApiKeysRequest,\n DeleteApiKeysResponse,\n DeleteAuthenticatorsRequest,\n DeleteAuthenticatorsResponse,\n DeleteWalletsRequest,\n DeleteWalletsResponse,\n GetActivityRequest,\n GetActivityResponse,\n GetApiKeysRequest,\n GetApiKeysResponse,\n GetAuthenticatorsRequest,\n GetAuthenticatorsResponse,\n GetWalletAccountsRequest,\n GetWalletAccountsResponse,\n GetWalletsRequest,\n GetWalletsResponse,\n GetWhoamiRequest,\n GetWhoamiResponse,\n Signature,\n SignRawPayloadsParams,\n SignRawPayloadsRequest,\n SignRawPayloadsResponse,\n} from \"./schemas\";\n\nimport { isNull, isObject, parseSchema } from \"@otim/utils/helpers\";\nimport { getAddress } from \"viem/utils\";\n\nimport {\n createApiKeysResponseSchema,\n createAuthenticatorsResponseSchema,\n deleteApiKeysResponseSchema,\n deleteAuthenticatorsResponseSchema,\n deleteWalletsResponseSchema,\n getActivityResponseSchema,\n getApiKeysResponseSchema,\n getAuthenticatorsResponseSchema,\n getWalletAccountsResponseSchema,\n getWalletsResponseSchema,\n getWhoamiResponseSchema,\n signRawPayloadsResponseSchema,\n} from \"./schemas\";\nimport { AuthenticationError } from \"../../errors/auth\";\nimport { TurnkeyError } from \"../../errors/turnkey\";\nimport { TURNKEY_API_URL } from \"../config\";\n\n/**\n * Turnkey API Client\n *\n * HTTP client for direct Turnkey API operations.\n * Uses native fetch for compatibility across environments.\n */\n\nconst TURNKEY_API_BASE_URL = TURNKEY_API_URL;\nconst TURNKEY_API_TIMEOUT = 30000;\nconst DEFAULT_POLLING_MAX_ATTEMPTS = 30;\nconst DEFAULT_POLLING_INTERVAL_MS = 1000;\n\n/** Activity statuses that indicate the activity is still in progress */\nconst PENDING_STATUSES: ActivityStatus[] = [\n \"ACTIVITY_STATUS_CREATED\",\n \"ACTIVITY_STATUS_PENDING\",\n];\n\n/** Activity statuses that indicate the activity has failed */\nconst FAILED_STATUSES: ActivityStatus[] = [\n \"ACTIVITY_STATUS_FAILED\",\n \"ACTIVITY_STATUS_CONSENSUS_NEEDED\",\n \"ACTIVITY_STATUS_REJECTED\",\n];\n\nexport interface ActivityPollingConfig {\n maxAttempts?: number;\n pollInterval?: number;\n}\n\nexport class AccountApi {\n private readonly baseUrl: string;\n private readonly timeout: number;\n private readonly pollingConfig: Required<ActivityPollingConfig>;\n\n constructor(\n baseUrl: string = TURNKEY_API_BASE_URL,\n timeout: number = TURNKEY_API_TIMEOUT,\n pollingConfig: ActivityPollingConfig = {},\n ) {\n this.baseUrl = baseUrl;\n this.timeout = timeout;\n this.pollingConfig = {\n maxAttempts: pollingConfig.maxAttempts ?? DEFAULT_POLLING_MAX_ATTEMPTS,\n pollInterval: pollingConfig.pollInterval ?? DEFAULT_POLLING_INTERVAL_MS,\n };\n }\n\n /* Signs multiple raw payloads using Turnkey's API. */\n async signRawPayloads(\n { organizationId, signWith, payloads }: SignRawPayloadsParams,\n stamp: string,\n ): Promise<Signature[]> {\n const requestPayload: SignRawPayloadsRequest = {\n type: \"ACTIVITY_TYPE_SIGN_RAW_PAYLOADS\",\n timestampMs: String(Date.now()),\n organizationId,\n parameters: {\n payloads,\n signWith: getAddress(signWith),\n encoding: \"PAYLOAD_ENCODING_HEXADECIMAL\",\n hashFunction: \"HASH_FUNCTION_NO_OP\",\n },\n };\n\n return this.signRawPayloadsWithRequest(requestPayload, stamp);\n }\n\n /** Type for a function that creates stamps for requests */\n private stamper?: (payload: unknown) => Promise<string>;\n\n /** Sets the stamper function for creating request stamps */\n setStamper(stamper: (payload: unknown) => Promise<string>): void {\n this.stamper = stamper;\n }\n\n /* Signs raw payloads using a pre-built request. */\n async signRawPayloadsWithRequest(\n requestPayload: SignRawPayloadsRequest,\n stamp: string,\n ): Promise<Signature[]> {\n const response = await this.post<SignRawPayloadsResponse>(\n \"/public/v1/submit/sign_raw_payloads\",\n requestPayload,\n stamp,\n );\n\n const parsed = parseSchema(response, signRawPayloadsResponseSchema);\n const { activity } = parsed;\n\n /* If result is available, return immediately */\n if (activity.result !== null) {\n return activity.result.signRawPayloadsResult.signatures;\n }\n\n /* Check if activity requires consensus (approval) - this is not something we can poll for */\n if (activity.status === \"ACTIVITY_STATUS_CONSENSUS_NEEDED\") {\n throw new TurnkeyError(\n `Activity ${activity.id} requires consensus approval. This activity cannot be completed automatically.`,\n );\n }\n\n /* Only poll if we have a stamper and activity is pending */\n if (!this.stamper) {\n throw new TurnkeyError(\n `Activity ${activity.id} returned without result and no stamper configured for polling`,\n );\n }\n\n /* Poll for the activity result if it's still pending */\n const completedActivity = await this.pollForActivityResult(\n requestPayload.organizationId,\n activity.id,\n );\n\n if (completedActivity.result === null) {\n throw new TurnkeyError(\n `Activity ${activity.id} completed without result`,\n );\n }\n\n return completedActivity.result.signRawPayloadsResult.signatures;\n }\n\n /** Gets the status and result of an activity. */\n async getActivity(\n request: GetActivityRequest,\n ): Promise<GetActivityResponse> {\n if (!this.stamper) {\n throw new TurnkeyError(\"Stamper not configured for getActivity\");\n }\n\n const stamp = await this.stamper(request);\n const response = await this.post<GetActivityResponse>(\n \"/public/v1/query/get_activity\",\n request,\n stamp,\n );\n\n return parseSchema<GetActivityResponse>(response, getActivityResponseSchema);\n }\n\n /** Polls for an activity result until it reaches a terminal state. */\n private async pollForActivityResult(\n organizationId: string,\n activityId: string,\n ): Promise<GetActivityResponse[\"activity\"]> {\n const { maxAttempts, pollInterval } = this.pollingConfig;\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n await this.sleep(pollInterval);\n\n const response = await this.getActivity({ organizationId, activityId });\n const { activity } = response;\n\n if (FAILED_STATUSES.includes(activity.status)) {\n throw new TurnkeyError(\n `Activity ${activityId} failed with status: ${activity.status}`,\n );\n }\n\n if (\n activity.status === \"ACTIVITY_STATUS_COMPLETED\" &&\n activity.result !== null\n ) {\n return activity;\n }\n\n if (!PENDING_STATUSES.includes(activity.status)) {\n throw new TurnkeyError(\n `Activity ${activityId} has unexpected status: ${activity.status}`,\n );\n }\n }\n\n throw new TurnkeyError(\n `Activity ${activityId} timed out after ${maxAttempts} polling attempts`,\n );\n }\n\n /** Helper to sleep for a specified duration. */\n private sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n\n /* Lists wallets for an organization. */\n async getWallets(\n request: GetWalletsRequest,\n stamp: string,\n ): Promise<GetWalletsResponse> {\n const response = await this.post<GetWalletsResponse>(\n \"/public/v1/query/list_wallets\",\n request,\n stamp,\n );\n\n return parseSchema<GetWalletsResponse>(response, getWalletsResponseSchema);\n }\n\n /* Lists wallet accounts for a wallet. */\n async getWalletAccounts(\n request: GetWalletAccountsRequest,\n stamp: string,\n ): Promise<GetWalletAccountsResponse> {\n const response = await this.post<GetWalletAccountsResponse>(\n \"/public/v1/query/list_wallet_accounts\",\n request,\n stamp,\n );\n\n return parseSchema<GetWalletAccountsResponse>(\n response,\n getWalletAccountsResponseSchema,\n );\n }\n\n /* Deletes wallets using a pre-built request. */\n async deleteWalletsWithRequest(\n requestPayload: DeleteWalletsRequest,\n stamp: string,\n ): Promise<string[]> {\n const response = await this.post<DeleteWalletsResponse>(\n \"/public/v1/submit/delete_wallets\",\n requestPayload,\n stamp,\n );\n\n const parsed = parseSchema<DeleteWalletsResponse>(\n response,\n deleteWalletsResponseSchema,\n );\n return parsed.activity.result.deleteWalletsResult.walletIds;\n }\n\n /* Gets the current user's identity. */\n async getWhoami(\n request: GetWhoamiRequest,\n stamp: string,\n ): Promise<GetWhoamiResponse> {\n const response = await this.post<GetWhoamiResponse>(\n \"/public/v1/query/whoami\",\n request,\n stamp,\n );\n\n return parseSchema<GetWhoamiResponse>(response, getWhoamiResponseSchema);\n }\n\n /* Gets API keys for a user. */\n async getApiKeys(\n request: GetApiKeysRequest,\n stamp: string,\n ): Promise<GetApiKeysResponse> {\n const response = await this.post<GetApiKeysResponse>(\n \"/public/v1/query/get_api_keys\",\n request,\n stamp,\n );\n\n return parseSchema<GetApiKeysResponse>(response, getApiKeysResponseSchema);\n }\n\n /* Creates API keys. */\n async createApiKeys(\n requestPayload: CreateApiKeysRequest,\n stamp: string,\n ): Promise<CreateApiKeysResponse> {\n const response = await this.post<CreateApiKeysResponse>(\n \"/public/v1/submit/create_api_keys\",\n requestPayload,\n stamp,\n );\n\n return parseSchema<CreateApiKeysResponse>(\n response,\n createApiKeysResponseSchema,\n );\n }\n\n /* Deletes API keys. */\n async deleteApiKeys(\n requestPayload: DeleteApiKeysRequest,\n stamp: string,\n ): Promise<DeleteApiKeysResponse> {\n const response = await this.post<DeleteApiKeysResponse>(\n \"/public/v1/submit/delete_api_keys\",\n requestPayload,\n stamp,\n );\n\n return parseSchema<DeleteApiKeysResponse>(\n response,\n deleteApiKeysResponseSchema,\n );\n }\n\n /* Gets authenticators (passkeys) for a user. */\n async getAuthenticators(\n request: GetAuthenticatorsRequest,\n stamp: string,\n ): Promise<GetAuthenticatorsResponse> {\n const response = await this.post<GetAuthenticatorsResponse>(\n \"/public/v1/query/get_authenticators\",\n request,\n stamp,\n );\n\n return parseSchema<GetAuthenticatorsResponse>(\n response,\n getAuthenticatorsResponseSchema,\n );\n }\n\n /* Creates new authenticators (passkeys). */\n async createAuthenticators(\n requestPayload: CreateAuthenticatorsRequest,\n stamp: string,\n ): Promise<CreateAuthenticatorsResponse> {\n const response = await this.post<CreateAuthenticatorsResponse>(\n \"/public/v1/submit/create_authenticators\",\n requestPayload,\n stamp,\n );\n\n return parseSchema<CreateAuthenticatorsResponse>(\n response,\n createAuthenticatorsResponseSchema,\n );\n }\n\n /* Deletes authenticators (passkeys). */\n async deleteAuthenticators(\n requestPayload: DeleteAuthenticatorsRequest,\n stamp: string,\n ): Promise<DeleteAuthenticatorsResponse> {\n const response = await this.post<DeleteAuthenticatorsResponse>(\n \"/public/v1/submit/delete_authenticators\",\n requestPayload,\n stamp,\n );\n\n return parseSchema<DeleteAuthenticatorsResponse>(\n response,\n deleteAuthenticatorsResponseSchema,\n );\n }\n\n /* Makes a POST request to the Turnkey API. */\n private async post<T>(\n path: string,\n body: unknown,\n stamp: string,\n ): Promise<T> {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.timeout);\n\n try {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n \"X-Stamp\": stamp,\n },\n body: JSON.stringify(body),\n signal: controller.signal,\n });\n\n if (!response.ok) {\n if (response.status === 401) {\n const errorData = await response.json().catch(() => ({}));\n const errorMessage =\n isObject(errorData) && !isNull(errorData) && \"message\" in errorData\n ? String(errorData.message)\n : \"Authentication failed\";\n\n throw new AuthenticationError(\n `Turnkey API authentication failed (401): ${errorMessage}. This may indicate an invalid public key or corrupted session. Please try logging in again.`,\n );\n }\n\n throw new TurnkeyError(\n `Turnkey API request failed: ${response.status} ${response.statusText}`,\n );\n }\n\n return (await response.json()) as T;\n } finally {\n clearTimeout(timeoutId);\n }\n }\n}\n\n/**\n * Factory function to create an AccountApi instance.\n * Follows the same pattern as createAPIClient in @otim/utils/api.\n */\nexport const createAccountApiClient = (\n baseUrl?: string,\n timeout?: number,\n pollingConfig?: ActivityPollingConfig,\n): AccountApi => {\n return new AccountApi(baseUrl, timeout, pollingConfig);\n};\n","import type { SignRawPayloadsRequest } from \"../../turnkey/api/schemas\";\nimport type { ISigningService, Signature } from \"../types\";\n\nimport { toDerSignature } from \"@turnkey/crypto\";\nimport { stringToBase64urlString } from \"@turnkey/encoding\";\nimport { getAddress } from \"viem\";\nimport { signMessage } from \"viem/accounts\";\n\nimport { createAccountApiClient } from \"../../turnkey/api/account-api\";\n\n/**\n * Signing service using Turnkey API key credentials.\n *\n * This strategy enables federated signing using API key authentication,\n * following the same pattern as PasskeyClientSigningService but suitable\n * for server-side or automated workflows.\n *\n * @implements {ISigningService}\n */\nexport class ApiKeyClientSigningService implements ISigningService {\n private readonly apiClient: ReturnType<typeof createAccountApiClient>;\n private readonly publicKey: string;\n private readonly privateKey: `0x${string}`;\n\n constructor(publicKey: string, privateKey: string) {\n this.apiClient = createAccountApiClient();\n\n // Store public key without 0x prefix (Turnkey format)\n this.publicKey = publicKey.startsWith(\"0x\")\n ? publicKey.slice(2)\n : publicKey;\n\n // Ensure private key has 0x prefix (viem format)\n this.privateKey = privateKey.startsWith(\"0x\")\n ? (privateKey as `0x${string}`)\n : `0x${privateKey}`;\n\n // Configure the stamper for polling operations\n this.apiClient.setStamper((payload: unknown) => this.createStamp(payload));\n }\n\n /**\n * Creates a stamp for any request payload.\n * This is used for both signing requests and polling operations.\n */\n private async createStamp(payload: unknown): Promise<string> {\n const payloadString = JSON.stringify(payload);\n\n // Sign the payload string using EIP-191 (personal_sign)\n const signature = await signMessage({\n message: payloadString,\n privateKey: this.privateKey,\n });\n\n // Convert to DER format (required by Turnkey)\n const derSignature = toDerSignature(signature.replace(\"0x\", \"\"));\n\n // Create stamp with API key scheme\n const stamp = {\n publicKey: this.publicKey,\n scheme: \"SIGNATURE_SCHEME_TK_API_SECP256K1_EIP191\",\n signature: derSignature,\n };\n\n // Encode as base64url for X-Stamp header\n return stringToBase64urlString(JSON.stringify(stamp));\n }\n\n /**\n * Signs multiple payloads using the API key stamping flow.\n *\n * This follows the federated access pattern where:\n * 1. We create a request payload for Turnkey's sign_raw_payloads API\n * 2. We sign the request with our API key to create a stamp\n * 3. We submit the stamped request to Turnkey's API\n *\n * @param payloads - Array of hex-encoded payloads to sign\n * @param ephemeralSubOrgId - Ephemeral sub org ID (from buildResponse)\n * @param ephemeralWalletAddress - Ephemeral wallet address (from buildResponse)\n * @returns Array of signatures with r, s, v components\n */\n async signPayloads(\n payloads: `0x${string}`[],\n ephemeralSubOrgId: string,\n ephemeralWalletAddress: `0x${string}`,\n ): Promise<Signature[]> {\n const requestPayload = this.buildSignRawPayloadsRequest(\n payloads,\n ephemeralSubOrgId,\n ephemeralWalletAddress,\n );\n\n const stamp = await this.stampRequest(requestPayload);\n\n const signatures = await this.apiClient.signRawPayloadsWithRequest(\n requestPayload,\n stamp,\n );\n\n return signatures;\n }\n\n /**\n * Builds the request payload for Turnkey's sign_raw_payloads API.\n * Uses the ephemeral wallet's sub org and address for signing the payloads.\n */\n private buildSignRawPayloadsRequest(\n payloads: `0x${string}`[],\n ephemeralSubOrgId: string,\n ephemeralWalletAddress: `0x${string}`,\n ): SignRawPayloadsRequest {\n const checksummedAddress = getAddress(ephemeralWalletAddress);\n\n return {\n type: \"ACTIVITY_TYPE_SIGN_RAW_PAYLOADS\",\n timestampMs: String(Date.now()),\n organizationId: ephemeralSubOrgId,\n parameters: {\n signWith: checksummedAddress,\n payloads,\n encoding: \"PAYLOAD_ENCODING_HEXADECIMAL\",\n hashFunction: \"HASH_FUNCTION_NO_OP\",\n },\n };\n }\n\n /**\n * Stamps the request payload using API key credentials (EIP-191 signing).\n * Delegates to createStamp for consistency.\n */\n private async stampRequest(\n requestPayload: SignRawPayloadsRequest,\n ): Promise<string> {\n return this.createStamp(requestPayload);\n }\n}\n","import type { EthereumWalletInterface } from \"@turnkey/wallet-stamper\";\nimport type { WalletClient } from \"viem\";\n\nimport { WalletType } from \"@turnkey/wallet-stamper\";\nimport { hashMessage, recoverPublicKey } from \"viem\";\n\nimport { WalletNotConnectedError } from \"../../errors/auth\";\n\n/**\n * Ethereum Wallet Adapter\n *\n * Adapts a Viem WalletClient to implement Turnkey's EthereumWalletInterface\n * for use with WalletStamper. This allows using any Viem-compatible wallet\n * (e.g., private key accounts, hardware wallets) for server-side authentication\n * with Turnkey's API.\n */\nexport class EthereumWalletAdapter implements EthereumWalletInterface {\n readonly type = WalletType.Ethereum;\n\n constructor(private readonly walletClient: WalletClient) {\n if (!walletClient.account) {\n throw new WalletNotConnectedError(\n \"WalletClient must have an account to be used with EthereumWalletAdapter\",\n );\n }\n }\n\n async signMessage(message: string): Promise<string> {\n if (!this.walletClient.account) {\n throw new WalletNotConnectedError(\n \"No account available in wallet client\",\n );\n }\n\n const signature = await this.walletClient.signMessage({\n account: this.walletClient.account,\n message,\n });\n\n return signature.startsWith(\"0x\") ? signature.slice(2) : signature;\n }\n\n async getPublicKey(): Promise<string> {\n if (!this.walletClient.account) {\n throw new WalletNotConnectedError(\n \"No account available in wallet client\",\n );\n }\n\n const testMessage = \"Turnkey public key recovery\";\n const signature = await this.signMessage(testMessage);\n\n return await this.recoverPublicKey(testMessage, signature);\n }\n\n async recoverPublicKey(message: string, signature: string): Promise<string> {\n const messageHash = hashMessage(message);\n\n const sig: `0x${string}` = signature.startsWith(\"0x\")\n ? (signature as `0x${string}`)\n : `0x${signature}`;\n\n const publicKey = await recoverPublicKey({\n hash: messageHash,\n signature: sig,\n });\n\n return publicKey.startsWith(\"0x\") ? publicKey.slice(2) : publicKey;\n }\n}\n","import type { SignRawPayloadsRequest } from \"../../turnkey/api/schemas\";\nimport type { ISigningService, Signature } from \"../types\";\nimport type { EthereumWalletInterface } from \"@turnkey/wallet-stamper\";\nimport type { WalletClient } from \"viem\";\n\nimport { WalletStamper } from \"@turnkey/wallet-stamper\";\nimport { getAddress } from \"viem\";\n\nimport { createAccountApiClient } from \"../../turnkey/api/account-api\";\nimport { EthereumWalletAdapter } from \"../adapters/ethereum-wallet-adapter\";\n\n/**\n * Signing service using an Ethereum wallet interface.\n *\n * This strategy enables signing using any wallet that implements the\n * EthereumWalletInterface. It uses the Turnkey WalletStamper to authenticate\n * requests with the wallet's signature.\n *\n * @implements {ISigningService}\n */\nexport class ServerWalletSigningService implements ISigningService {\n private readonly apiClient: ReturnType<typeof createAccountApiClient>;\n private readonly walletStamper: WalletStamper;\n\n constructor(wallet: EthereumWalletInterface) {\n this.apiClient = createAccountApiClient();\n this.walletStamper = new WalletStamper(wallet);\n }\n\n /**\n * Creates a ServerWalletSigningService from a Viem WalletClient.\n *\n * This is a convenience factory method that handles the adapter creation\n * internally, allowing you to pass a Viem WalletClient directly.\n *\n * @param walletClient - Viem WalletClient with an account\n * @returns New ServerWalletSigningService instance\n */\n static fromViemWallet(\n walletClient: WalletClient,\n ): ServerWalletSigningService {\n const adapter = new EthereumWalletAdapter(walletClient);\n return new ServerWalletSigningService(adapter);\n }\n\n /**\n * Signs multiple payloads using the wallet stamping flow.\n *\n * This follows the federated access pattern where:\n * 1. We create a request payload for Turnkey's sign_raw_payloads API\n * 2. We sign the request with the wallet to create a stamp\n * 3. We submit the stamped request to Turnkey's API\n *\n * @param payloads - Array of hex-encoded payloads to sign\n * @param ephemeralSubOrgId - Ephemeral sub org ID (from buildResponse)\n * @param ephemeralWalletAddress - Ephemeral wallet address (from buildResponse)\n * @returns Array of signatures with r, s, v components\n */\n async signPayloads(\n payloads: `0x${string}`[],\n ephemeralSubOrgId: string,\n ephemeralWalletAddress: `0x${string}`,\n ): Promise<Signature[]> {\n const requestPayload = this.buildSignRawPayloadsRequest(\n payloads,\n ephemeralSubOrgId,\n ephemeralWalletAddress,\n );\n\n const stamp = await this.stampRequest(requestPayload);\n\n const signatures = await this.apiClient.signRawPayloadsWithRequest(\n requestPayload,\n stamp,\n );\n\n return signatures;\n }\n\n /**\n * Builds the request payload for Turnkey's sign_raw_payloads API.\n * Uses the ephemeral wallet's sub org and address for signing the payloads.\n */\n private buildSignRawPayloadsRequest(\n payloads: `0x${string}`[],\n ephemeralSubOrgId: string,\n ephemeralWalletAddress: `0x${string}`,\n ): SignRawPayloadsRequest {\n const checksummedAddress = getAddress(ephemeralWalletAddress);\n\n return {\n type: \"ACTIVITY_TYPE_SIGN_RAW_PAYLOADS\",\n timestampMs: String(Date.now()),\n organizationId: ephemeralSubOrgId,\n parameters: {\n signWith: checksummedAddress,\n payloads,\n encoding: \"PAYLOAD_ENCODING_HEXADECIMAL\",\n hashFunction: \"HASH_FUNCTION_NO_OP\",\n },\n };\n }\n\n /**\n * Stamps the request payload using the wallet.\n *\n * This creates an X-Stamp header that authenticates the request to Turnkey's API.\n *\n * The WalletStamper handles:\n * 1. Signing the request payload string with the wallet's private key\n * 2. Recovering the public key from the signature\n * 3. Creating a stamp object with the appropriate scheme (EVM or Solana)\n * 4. Encoding the stamp for the X-Stamp header\n */\n private async stampRequest(\n requestPayload: SignRawPayloadsRequest,\n ): Promise<string> {\n const payloadString = JSON.stringify(requestPayload);\n\n const { stampHeaderValue } = await this.walletStamper.stamp(payloadString);\n\n return stampHeaderValue;\n }\n}\n","import type { SigningErrorOptions } from \"./base\";\n\nimport { SigningError, SigningErrorCode } from \"./base\";\n\n/**\n * Validation Errors\n *\n * Errors related to input validation and data format.\n */\n\n/**\n * Base class for validation-related errors.\n */\nexport class ValidationError extends SigningError {\n override name = \"ValidationError\";\n\n constructor(\n message: string,\n code: SigningErrorCode = SigningErrorCode.ValidationFailed,\n options?: SigningErrorOptions,\n ) {\n super(message, code, options);\n }\n}\n\n/**\n * Thrown when function parameters are invalid.\n */\nexport class InvalidParamsError extends ValidationError {\n override name = \"InvalidParamsError\";\n\n constructor(message: string, options?: SigningErrorOptions) {\n super(message, SigningErrorCode.InvalidParams, options);\n }\n}\n\n/**\n * Thrown when an invalid Ethereum address is provided.\n */\nexport class InvalidAddressError extends ValidationError {\n override name = \"InvalidAddressError\";\n\n readonly address?: string;\n\n constructor(\n message = \"Invalid Ethereum address.\",\n options?: SigningErrorOptions & { address?: string },\n ) {\n super(message, SigningErrorCode.InvalidAddress, {\n ...options,\n metaMessages: options?.address\n ? [`Address: ${options.address}`]\n : undefined,\n });\n this.address = options?.address;\n }\n}\n","import type { Address, HexString } from \"@otim/utils/schemas\";\nimport type { PublicClient } from \"viem\";\n\nimport { hashAuthorization } from \"viem/utils\";\n\ninterface AuthorizationDigestResult {\n digest: HexString;\n nonce: number;\n}\n\n/**\n * Computes EIP-7702 authorization digests for payment signing.\n *\n * This class handles the computation of authorization hashes that are signed\n * to delegate control to the Otim delegate contract.\n */\nexport class AuthorizationDigestComputer {\n /**\n * Computes the authorization digest for an ephemeral wallet.\n *\n * @param ephemeralWalletAddress - The ephemeral wallet address\n * @param delegateAddress - The delegate contract address\n * @param publicClient - Viem public client for blockchain queries\n * @returns The digest hash and current nonce\n */\n async compute(\n ephemeralWalletAddress: Address,\n delegateAddress: Address,\n publicClient: PublicClient,\n ): Promise<AuthorizationDigestResult> {\n const nonce = await this.fetchNonce(ephemeralWalletAddress, publicClient);\n\n const digest = hashAuthorization({\n contractAddress: delegateAddress,\n chainId: 0,\n nonce,\n });\n\n return { digest, nonce };\n }\n\n private async fetchNonce(\n address: Address,\n publicClient: PublicClient,\n ): Promise<number> {\n return await publicClient.getTransactionCount({ address });\n }\n}\n","import type { AbiParameter } from \"viem\";\n\nimport {\n decodeAbiParameters,\n hashTypedData,\n keccak256,\n pad,\n toHex,\n} from \"viem\";\n\nimport { ValidationError } from \"../../errors/validation\";\n\ninterface InstructionTypeDefinition {\n abi: readonly AbiParameter[];\n eip712Types: {\n types: {\n [key: string]: ReadonlyArray<{ name: string; type: string }>;\n Instruction: ReadonlyArray<{ name: string; type: string }>;\n };\n };\n}\n\ninterface InstructionRegistry {\n get(actionName: string): InstructionTypeDefinition;\n}\n\ninterface UnsignedInstruction {\n chainId: number;\n salt: `0x${string}`;\n maxExecutions: `0x${string}`;\n action: `0x${string}`;\n arguments: `0x${string}`;\n actionName?: string;\n}\n\ninterface DecodedInstructionData {\n arguments: unknown;\n salt: bigint;\n maxExecutions: bigint;\n}\n\n/**\n * Computes EIP-712 typed data digests for instruction signing.\n *\n * This class handles the computation of instruction hashes following\n * the EIP-712 standard for structured data signing.\n */\nexport class InstructionDigestComputer {\n constructor(private readonly instructionRegistry: InstructionRegistry) {}\n\n /**\n * Computes the EIP-712 digest for an instruction.\n *\n * @param instruction - The unsigned instruction to compute digest for\n * @param delegateAddress - The delegate contract address (verifying contract)\n * @returns The EIP-712 digest hash\n */\n async compute(\n instruction: UnsignedInstruction,\n delegateAddress: `0x${string}`,\n ): Promise<`0x${string}`> {\n this.validateInstruction(instruction);\n\n const typeDefinition = this.instructionRegistry.get(\n instruction.actionName!,\n );\n const decodedData = this.decodeInstruction(instruction, typeDefinition);\n const actionFieldName = this.extractActionFieldName(typeDefinition);\n const domain = this.createDomain(instruction.chainId, delegateAddress);\n\n return hashTypedData({\n domain,\n types: typeDefinition.eip712Types.types,\n primaryType: \"Instruction\",\n message: {\n salt: decodedData.salt,\n maxExecutions: decodedData.maxExecutions,\n action: instruction.action,\n [actionFieldName]: decodedData.arguments,\n },\n });\n }\n\n private validateInstruction(instruction: UnsignedInstruction): void {\n if (!instruction.actionName) {\n throw new ValidationError(\n \"Action name is required. Ensure action names are stored during payment request build.\",\n );\n }\n }\n\n private decodeInstruction(\n instruction: UnsignedInstruction,\n typeDefinition: InstructionTypeDefinition,\n ): DecodedInstructionData {\n const [decodedArguments] = decodeAbiParameters(\n typeDefinition.abi,\n instruction.arguments,\n );\n\n const [salt] = decodeAbiParameters(\n [{ name: \"salt\", type: \"uint256\" }],\n pad(instruction.salt),\n );\n\n const [maxExecutions] = decodeAbiParameters(\n [{ name: \"maxExecutions\", type: \"uint256\" }],\n pad(instruction.maxExecutions),\n );\n\n return { arguments: decodedArguments, salt, maxExecutions };\n }\n\n private createDomain(chainId: number, delegateAddress: `0x${string}`) {\n return {\n chainId,\n name: \"OtimDelegate\",\n salt: keccak256(toHex(\"ON_TIME_INSTRUCTED_MONEY\")),\n verifyingContract: delegateAddress,\n version: \"1\",\n } as const;\n }\n\n private extractActionFieldName(\n typeDefinition: InstructionTypeDefinition,\n ): string {\n const instructionFields = typeDefinition.eip712Types.types.Instruction;\n const excludedFields = new Set([\"salt\", \"maxExecutions\", \"action\"]);\n\n const actionField = instructionFields.find(\n (field) => !excludedFields.has(field.name),\n );\n\n if (!actionField) {\n throw new ValidationError(\n \"Could not find action field in Instruction type\",\n );\n }\n\n return actionField.name;\n }\n}\n","import type { FormattedSignature, Signature } from \"../types\";\nimport type { Address, HexString } from \"@otim/utils/schemas\";\n\nimport { formatSignatureToEIP2098 } from \"@otim/utils/helpers\";\nimport { toHex, toRlp } from \"viem\";\n\n/**\n * Ensures a hex string has the 0x prefix.\n */\nconst ensureHexPrefix = (value: string): `0x${string}` =>\n value.startsWith(\"0x\") ? (value as `0x${string}`) : `0x${value}`;\n\n/**\n * Creates an RLP-encoded authorization for EIP-7702 delegation.\n *\n * @param chainId - The chain ID for the authorization\n * @param delegateAddress - The delegate contract address\n * @param nonce - The account nonce\n * @param yParity - The signature y-parity (0 or 1)\n * @param r - The signature r component\n * @param s - The signature s component\n * @returns RLP-encoded authorization as hex string\n */\nexport const createRlpEncodedAuthorization = (\n chainId: number,\n delegateAddress: string,\n nonce: number,\n yParity: number,\n r: `0x${string}`,\n s: `0x${string}`,\n): `0x${string}` => {\n const rlpInput = [\n toHex(chainId),\n ensureHexPrefix(delegateAddress),\n nonce === 0 ? \"0x\" : toHex(nonce),\n yParity === 0 ? \"0x\" : toHex(yParity),\n r,\n s,\n ] as const;\n\n return toRlp(rlpInput);\n};\n\ninterface UnsignedInstruction {\n actionName?: string;\n chainId: number;\n salt: HexString;\n maxExecutions: HexString;\n action: Address;\n arguments: HexString;\n}\n\nexport interface FormattedInstruction {\n actionName?: string;\n address: Address;\n chainId: number;\n salt: HexString;\n maxExecutions: HexString;\n action: Address;\n arguments: HexString;\n activationSignature: FormattedSignature;\n}\n\n/**\n * Formats signatures for on-chain verification.\n *\n * This class handles the conversion of raw signatures to formats\n * required for EIP-7702 authorization and instruction activation.\n */\nexport class SignatureFormatter {\n /**\n * Formats an authorization signature as RLP-encoded data.\n *\n * @param signature - The raw signature\n * @param nonce - The account nonce\n * @param delegateAddress - The delegate contract address\n * @returns RLP-encoded authorization\n */\n formatAuthorization(\n signature: Signature,\n nonce: number,\n delegateAddress: `0x${string}`,\n ): `0x${string}` {\n const { yParity, r, s } = this.formatToEIP2098(signature);\n\n return toRlp([\n \"0x\",\n delegateAddress,\n this.encodeNonce(nonce),\n this.encodeYParity(yParity),\n r,\n s,\n ] as const);\n }\n\n /**\n * Formats an instruction with its activation signature.\n *\n * @param instruction - The unsigned instruction\n * @param signature - The raw signature\n * @param ephemeralWalletAddress - The ephemeral wallet address\n * @returns The formatted instruction with signature\n */\n formatInstruction(\n instruction: UnsignedInstruction,\n signature: Signature,\n ephemeralWalletAddress: `0x${string}`,\n ): FormattedInstruction {\n const formattedSignature = this.formatToEIP2098(signature);\n\n return {\n actionName: instruction.actionName,\n address: ephemeralWalletAddress,\n chainId: instruction.chainId,\n salt: instruction.salt,\n maxExecutions: instruction.maxExecutions,\n action: instruction.action,\n arguments: instruction.arguments,\n activationSignature: formattedSignature,\n };\n }\n\n private formatToEIP2098(signature: Signature): FormattedSignature {\n return formatSignatureToEIP2098(signature);\n }\n\n private encodeNonce(nonce: number): `0x${string}` {\n return nonce === 0 ? \"0x\" : toHex(nonce);\n }\n\n private encodeYParity(yParity: number): `0x${string}` {\n return yParity === 0 ? \"0x\" : toHex(yParity);\n }\n}\n","import type {\n DigestComputationResult,\n ISigningService,\n SignatureResult,\n SignedInstruction,\n SignerConfig,\n} from \"./types\";\nimport type { PaymentResponseWithActionNames } from \"@otim/utils/payments\";\nimport type { Address } from \"@otim/utils/schemas\";\nimport type { PublicClient } from \"viem\";\n\nimport {\n assertSignatureCount,\n instructionRegistry,\n} from \"@otim/utils/payments\";\n\nimport { ValidationError } from \"../errors/validation\";\nimport { AuthorizationDigestComputer } from \"./utils/authorization-digest\";\nimport { InstructionDigestComputer } from \"./utils/instruction-digest\";\nimport { SignatureFormatter } from \"./utils/signature-formatter\";\n\n/**\n * Orchestrates EIP-7702 authorization and instruction signing for payment requests.\n *\n * This class coordinates the complete signing workflow:\n * 1. Computes digests for authorization and all instructions\n * 2. Batches all payloads for efficient signing via the signing service\n * 3. Formats signatures for on-chain verification\n *\n * The signer is agnostic to the authentication method - it delegates actual\n * signing to the provided {@link ISigningService} implementation.\n */\nexport class UnifiedPaymentSigner {\n private readonly authDigestComputer = new AuthorizationDigestComputer();\n private readonly instructionDigestComputer = new InstructionDigestComputer(\n instructionRegistry,\n );\n private readonly signatureFormatter = new SignatureFormatter();\n private readonly signingService: ISigningService;\n\n constructor(private readonly config: SignerConfig) {\n this.signingService = config.signingService;\n }\n\n /**\n * Signs all components of a payment request.\n *\n * @returns The signed authorization and all signed instructions\n */\n async signAll(): Promise<SignatureResult> {\n const { publicClient, delegateAddressMap, buildResponse } = this.config;\n\n this.validateDelegateAddresses(delegateAddressMap);\n\n const allDigests = await this.computeAllDigests(\n delegateAddressMap,\n publicClient,\n );\n\n // Pass ephemeral data from buildResponse for passkey client signing\n const signatures = await this.signingService.signPayloads(\n allDigests.payloads,\n buildResponse.subOrgId,\n buildResponse.ephemeralWalletAddress,\n );\n\n return this.formatAllSignatures(\n signatures,\n allDigests.nonce,\n allDigests.authDelegateAddress,\n );\n }\n\n private async computeAllDigests(\n delegateAddressMap: Map<number, Address>,\n publicClient: PublicClient,\n ): Promise<DigestComputationResult> {\n const authDelegateAddress = this.extractDelegateAddress(delegateAddressMap);\n\n const { digest: authDigest, nonce } = await this.computeAuthorizationDigest(\n authDelegateAddress,\n publicClient,\n );\n\n const completionInstructionDigests = await this.computeInstructionDigests(\n this.config.buildResponse.completionInstructions,\n delegateAddressMap,\n );\n\n const regularInstructionDigests = await this.computeInstructionDigests(\n this.config.buildResponse.instructions,\n delegateAddressMap,\n );\n\n return {\n payloads: [\n authDigest,\n ...completionInstructionDigests,\n ...regularInstructionDigests,\n ],\n nonce,\n authDelegateAddress,\n };\n }\n\n private formatAllSignatures(\n signatures: Array<{ r: string; s: string; v: string }>,\n nonce: number,\n delegateAddress: Address,\n ): SignatureResult {\n const { buildResponse } = this.config;\n\n this.validateSignatureCount(signatures, buildResponse);\n\n const [authSignature, ...instructionSignatures] = signatures;\n\n const signedAuthorization = this.signatureFormatter.formatAuthorization(\n authSignature!,\n nonce,\n delegateAddress,\n );\n\n const completionInstructions = this.formatInstructions(\n buildResponse.completionInstructions,\n instructionSignatures,\n 0,\n );\n\n const instructions = this.formatInstructions(\n buildResponse.instructions,\n instructionSignatures,\n buildResponse.completionInstructions.length,\n );\n\n return {\n signedAuthorization,\n completionInstructions,\n instructions,\n };\n }\n\n private validateDelegateAddresses(\n delegateAddressMap: Map<number, Address>,\n ): void {\n const uniqueDelegates = new Set(delegateAddressMap.values());\n\n if (uniqueDelegates.size > 1) {\n const delegatesList = Array.from(uniqueDelegates).join(\", \");\n throw new ValidationError(\n `EIP-7702 requires single delegate address. Found: ${delegatesList}`,\n );\n }\n }\n\n private validateSignatureCount(\n signatures: Array<{ r: string; s: string; v: string }>,\n buildResponse: PaymentResponseWithActionNames,\n ): void {\n const expectedCount =\n 1 + // Authorization signature\n buildResponse.completionInstructions.length +\n buildResponse.instructions.length;\n\n assertSignatureCount(signatures, expectedCount);\n }\n\n private extractDelegateAddress(\n delegateAddressMap: Map<number, Address>,\n ): Address {\n const address = delegateAddressMap.values().next().value;\n return address as Address;\n }\n\n private getDelegateAddressForChain(\n chainId: number,\n delegateAddressMap: Map<number, Address>,\n ): Address {\n const delegateAddress = delegateAddressMap.get(chainId);\n\n if (!delegateAddress) {\n throw new ValidationError(\n `Delegate address not found for chainId ${chainId}`,\n );\n }\n\n return delegateAddress;\n }\n\n private async computeAuthorizationDigest(\n delegateAddress: Address,\n publicClient: PublicClient,\n ) {\n return await this.authDigestComputer.compute(\n this.config.buildResponse.ephemeralWalletAddress,\n delegateAddress,\n publicClient,\n );\n }\n\n private async computeInstructionDigests(\n instructions: PaymentResponseWithActionNames[\"instructions\"],\n delegateAddressMap: Map<number, Address>,\n ): Promise<Address[]> {\n return await Promise.all(\n instructions.map((instruction) => {\n const delegateAddress = this.getDelegateAddressForChain(\n instruction.chainId,\n delegateAddressMap,\n );\n return this.instructionDigestComputer.compute(\n instruction,\n delegateAddress,\n );\n }),\n );\n }\n\n private formatInstructions(\n instructions: PaymentResponseWithActionNames[\"instructions\"],\n signatures: Array<{ r: string; s: string; v: string }>,\n offset: number,\n ): SignedInstruction[] {\n return instructions.map((instruction, idx) =>\n this.signatureFormatter.formatInstruction(\n instruction,\n signatures[offset + idx]!,\n this.config.buildResponse.ephemeralWalletAddress,\n ),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;AAcA,MAAa,kBAAkBA,MAAE,OAAO;CACtC,GAAGA,MAAE,QAAQ;CACb,GAAGA,MAAE,QAAQ;CACb,GAAGA,MAAE,QAAQ;CACd,CAAC;AAOF,MAAa,kBAAkBA,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K,OAAO,cAAc,wBAC1B,iBACA,aACD;;CAGH,MAAc,0BACZ,cACA,oBACoB;AACpB,SAAO,MAAM,QAAQ,IACnB,aAAa,KAAK,gBAAgB;GAChC,MAAM,kBAAkB,KAAK,2BAC3B,YAAY,SACZ,mBACD;AACD,UAAO,KAAK,0BAA0B,QACpC,aACA,gBACD;IACD,CACH;;CAGH,AAAQ,mBACN,cACA,YACA,QACqB;AACrB,SAAO,aAAa,KAAK,aAAa,QACpC,KAAK,mBAAmB,kBACtB,aACA,WAAW,SAAS,MACpB,KAAK,OAAO,cAAc,uBAC3B,CACF"}
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_vrs = require('../vrs-Do0jfo3H.cjs');
|
|
2
2
|
|
|
3
|
-
exports.createEIP2098Signature =
|
|
4
|
-
exports.createRlpEncodedAuthorization =
|
|
5
|
-
exports.normalizeYParityValue =
|
|
6
|
-
exports.parseSignatureToVRS =
|
|
3
|
+
exports.createEIP2098Signature = require_vrs.createEIP2098Signature;
|
|
4
|
+
exports.createRlpEncodedAuthorization = require_vrs.createRlpEncodedAuthorization;
|
|
5
|
+
exports.normalizeYParityValue = require_vrs.normalizeYParityValue;
|
|
6
|
+
exports.parseSignatureToVRS = require_vrs.parseSignatureToVRS;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vrs-Do0jfo3H.cjs","names":["numericValue: number"],"sources":["../src/utils/rlp.ts","../src/utils/vrs.ts"],"sourcesContent":["import type { Authorization } from \"viem\";\n\nimport { toHex, toRlp } from \"viem\";\n\n/*\n * RLP (recursive length prefix) encoding utilities for EIP-7702 auth tuples.\n * RLP is a serialization format used in Ethereum to encode structured data.\n *\n * EIP-7702 authorizations are encoded as:\n * [chainId, address, nonce, yParity, r, s]\n */\n\n// Ensures the value has a \"0x\" prefix for proper hex encoding.\nconst ensureHexPrefix = (value: string): `0x${string}` =>\n value.startsWith(\"0x\") ? (value as `0x${string}`) : `0x${value}`;\n\n/*\n * Normalizes yParity to 0 or 1 for EIP-2098 compact signatures.\n * yParity indicate which of two possible points on the elliptic curve was used.\n * Handles various input formats: number, bigint, hex string, or decimal string.\n * - Even values (0, 2, 4, 27, etc.) normalize to 0\n * - Odd values (1, 3, 5, 28, etc.) normalize to 1\n */\nexport const normalizeYParityValue = (\n value: number | bigint | string | undefined | null,\n): 0 | 1 => {\n if (value === undefined || value === null) return 0;\n\n let numericValue: number;\n if (typeof value === \"number\") {\n numericValue = value;\n } else if (typeof value === \"bigint\") {\n numericValue = Number(value);\n } else if (typeof value === \"string\") {\n const trimmed = value.trim();\n const parsed = trimmed.startsWith(\"0x\")\n ? parseInt(trimmed, 16)\n : parseInt(trimmed, 10);\n if (Number.isNaN(parsed)) throw new Error(\"invalid yParity value\");\n numericValue = parsed;\n } else {\n throw new Error(\"invalid yParity type\");\n }\n\n return (Math.abs(numericValue) % 2 === 0 ? 0 : 1) as 0 | 1;\n};\n\n/*\n * Creates an RLP-encoded authorization tuple for EIP-7702 delegations.\n * This encoded value is submitted to the Otim API for processing on-chain.\n *\n * Accepts either:\n * 1. A complete authorization object (from viem)\n * 2. Individual parameters (chainId, address, nonce, signature components)\n *\n * Returns hex-encoded RLP bytes ready for submission.\n */\nexport function createRlpEncodedAuthorization(\n authorization: Authorization,\n): `0x${string}`;\nexport function createRlpEncodedAuthorization(\n chainId: number,\n delegateAddress: string,\n nonce: number,\n yParity: number | bigint,\n r: `0x${string}`,\n s: `0x${string}`,\n): `0x${string}`;\nexport function createRlpEncodedAuthorization(\n authorizationOrChainId: Authorization | number,\n delegateAddress?: string,\n nonce?: number,\n yParity?: number | bigint,\n r?: `0x${string}`,\n s?: `0x${string}`,\n) {\n if (typeof authorizationOrChainId === \"object\") {\n // Authorization object provided - extract fields.\n const authorization = authorizationOrChainId;\n const normalizedYParity = normalizeYParityValue(authorization.yParity);\n /**\n * RLP encoding requires specific format for zero values:\n * - \"0x\" instead of \"0x00\".\n */\n const rlpInput = [\n toHex(authorization.chainId),\n ensureHexPrefix(authorization.address),\n authorization.nonce === 0 ? \"0x\" : toHex(authorization.nonce),\n normalizedYParity === 0 ? \"0x\" : toHex(normalizedYParity),\n authorization.r!,\n authorization.s!,\n ] as const;\n\n return toRlp(rlpInput);\n } else {\n // Individual parameters provided - construct tuple.\n const chainId = authorizationOrChainId;\n const normalizedYParity = normalizeYParityValue(yParity);\n const rlpInput = [\n toHex(chainId),\n ensureHexPrefix(delegateAddress!),\n nonce === 0 ? \"0x\" : toHex(nonce!),\n normalizedYParity === 0 ? \"0x\" : toHex(normalizedYParity),\n r!,\n s!,\n ] as const;\n\n return toRlp(rlpInput);\n }\n}\n","import type { EIP2098Signature, VRS } from \"@otim/utils/schemas\";\n\n/*\n * Signature utilities for handling ECDSA signature components.\n * VRS = {v, r, s} where:\n * - v: Recovery id (indicates which point on elliptic curve)\n * - r: First 32 bytes of signature\n * - s: Last 32 bytes of signature\n */\n\n/*\n * Checks if the v value is valid according to Ethereum signature standards.\n * - 0/1: EIP-2098 compact format (yParity)\n * - 27/28: Legacy Ethereum format\n * - 35+: EIP-155 format (includes chain id)\n */\nconst isValidV = (v: number): boolean => {\n return v === 0 || v === 1 || v === 27 || v === 28 || v >= 35;\n};\n\n/*\n * Normalizes v to yParity (0 or 1) for EIP-2098 compact signatures.\n * Handles all v formats: 0/1 (yParity), 27/28 (legacy), 35+ (EIP-155).\n * Returns 0 or 1 based on parity.\n */\nconst normalizeV = (v: number) => {\n if (!isValidV(v)) return 0;\n\n const cmp = v <= 1 ? 1 : 0;\n const result = v % 2 === cmp;\n\n return Number(result) % 2;\n};\n\n/*\n * Converts a standard VRS signature to EIP-2098 compact format.\n * EIP-2098 uses yParity (0/1) instead of v (27/28 or higher).\n * This saves 1 byte in the signature encoding.\n */\nexport const createEIP2098Signature = (vrs: VRS): EIP2098Signature => {\n const v = vrs.v;\n const r = vrs.r as `0x${string}`;\n const s = vrs.s as `0x${string}`;\n\n return { yParity: normalizeV(v), r, s };\n};\n\n/*\n * Parses a hex-encoded signature string into VRS components.\n\n * Expects standard Ethereum signature format:\n * 0x + 64 chars (r) + 64 chars (s) + 2 chars (v).\n *\n * Total length: 132 characters (0x + 130 hex chars = 65 bytes).\n *\n * Example: \"0x\" + r (32 bytes) + s (32 bytes) + v (1 byte).\n */\nexport const parseSignatureToVRS = (signature: string): VRS => {\n if (typeof signature !== \"string\") {\n throw new Error(\"Signature must be a string\");\n }\n\n if (!signature.startsWith(\"0x\")) {\n throw new Error('Signature must start with \"0x\"');\n }\n\n if (signature.length !== 132) {\n throw new Error(\n 'Signature must be 65 bytes (130 hex chars) plus \"0x\" = 132 total length',\n );\n }\n\n /* Extract components: r (bytes 0-32), s (bytes 32-64), v (byte 64). */\n const r = signature.slice(2, 66);\n const s = signature.slice(66, 130);\n const vHex = signature.slice(130, 132);\n const v = parseInt(vHex, 16);\n return { v, r: `0x${r}`, s: `0x${s}` };\n};\n"],"mappings":";;;AAaA,MAAM,mBAAmB,UACvB,MAAM,WAAW,KAAK,GAAI,QAA0B,KAAK;AAS3D,MAAa,yBACX,UACU;AACV,KAAI,UAAU,UAAa,UAAU,KAAM,QAAO;CAElD,IAAIA;AACJ,KAAI,OAAO,UAAU,SACnB,gBAAe;UACN,OAAO,UAAU,SAC1B,gBAAe,OAAO,MAAM;UACnB,OAAO,UAAU,UAAU;EACpC,MAAM,UAAU,MAAM,MAAM;EAC5B,MAAM,SAAS,QAAQ,WAAW,KAAK,GACnC,SAAS,SAAS,GAAG,GACrB,SAAS,SAAS,GAAG;AACzB,MAAI,OAAO,MAAM,OAAO,CAAE,OAAM,IAAI,MAAM,wBAAwB;AAClE,iBAAe;OAEf,OAAM,IAAI,MAAM,uBAAuB;AAGzC,QAAQ,KAAK,IAAI,aAAa,GAAG,MAAM,IAAI,IAAI;;AAwBjD,SAAgB,8BACd,wBACA,iBACA,OACA,SACA,GACA,GACA;AACA,KAAI,OAAO,2BAA2B,UAAU;EAE9C,MAAM,gBAAgB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G,KAAK;EAAK,GAAG,KAAK;EAAK"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@otim/sdk-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -66,6 +66,16 @@
|
|
|
66
66
|
"default": "./dist/utils/index.cjs"
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
|
+
"./signing": {
|
|
70
|
+
"import": {
|
|
71
|
+
"types": "./dist/signing/index.d.mts",
|
|
72
|
+
"default": "./dist/signing/index.mjs"
|
|
73
|
+
},
|
|
74
|
+
"require": {
|
|
75
|
+
"types": "./dist/signing/index.d.cts",
|
|
76
|
+
"default": "./dist/signing/index.cjs"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
69
79
|
"./package.json": "./package.json"
|
|
70
80
|
},
|
|
71
81
|
"files": [
|
|
@@ -95,7 +105,6 @@
|
|
|
95
105
|
"homepage": "https://github.com/otimlabs/otim-ts-sdk#readme",
|
|
96
106
|
"devDependencies": {
|
|
97
107
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
98
|
-
"@otim/utils": "0.0.6",
|
|
99
108
|
"@playwright/test": "^1.56.1",
|
|
100
109
|
"@types/adm-zip": "^0.5.7",
|
|
101
110
|
"@types/node": "^24.10.1",
|
|
@@ -108,23 +117,26 @@
|
|
|
108
117
|
"tsdown": "^0.16.5",
|
|
109
118
|
"typescript-eslint": "^8.47.0",
|
|
110
119
|
"vitest": "^4.0.10",
|
|
111
|
-
"@
|
|
112
|
-
"@otim/eslint-config": "0.0.1"
|
|
120
|
+
"@testing-library/user-event": "^14.6.1",
|
|
121
|
+
"@otim/eslint-config": "0.0.1",
|
|
122
|
+
"@otim/typescript-config": "0.0.0"
|
|
113
123
|
},
|
|
114
124
|
"dependencies": {
|
|
115
|
-
"@otim/
|
|
125
|
+
"@otim/utils": "0.0.7",
|
|
116
126
|
"@t3-oss/env-core": "^0.13.8",
|
|
117
|
-
"@testing-library/user-event": "^14.6.1",
|
|
118
127
|
"@turnkey/api-key-stamper": "^0.5.0",
|
|
119
128
|
"@turnkey/core": "^1.7.0",
|
|
129
|
+
"@turnkey/crypto": "^2.3.0",
|
|
130
|
+
"@turnkey/encoding": "^0.3.0",
|
|
120
131
|
"@turnkey/sdk-server": "^4.12.0",
|
|
121
132
|
"@turnkey/viem": "^0.14.13",
|
|
133
|
+
"@turnkey/wallet-stamper": "^1.0.0",
|
|
122
134
|
"@wagmi/connectors": "^7.0.0",
|
|
123
135
|
"@wagmi/core": "^3.0.0",
|
|
124
136
|
"abitype": "^1.1.2",
|
|
125
137
|
"axios": "^1.13.2",
|
|
126
138
|
"viem": "^2.39.3",
|
|
127
|
-
"zod": "^4.1
|
|
139
|
+
"zod": "^4.2.1"
|
|
128
140
|
},
|
|
129
141
|
"peerDependencies": {
|
|
130
142
|
"typescript": ">=5.0.4",
|
package/dist/abi-DW6AS0eM.d.mts
DELETED
|
@@ -1,339 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/abitype@1.1.0_typescript@5.9.3_zod@4.1.12/node_modules/abitype/dist/types/register.d.ts
|
|
2
|
-
interface Register {}
|
|
3
|
-
type ResolvedRegister = {
|
|
4
|
-
/**
|
|
5
|
-
* TypeScript type to use for `address` values
|
|
6
|
-
* @default `0x${string}`
|
|
7
|
-
*/
|
|
8
|
-
addressType: Register extends {
|
|
9
|
-
addressType: infer type;
|
|
10
|
-
} ? type : Register extends {
|
|
11
|
-
AddressType: infer type;
|
|
12
|
-
} ? type : DefaultRegister['addressType'];
|
|
13
|
-
/**
|
|
14
|
-
* TypeScript type to use for `int<M>` and `uint<M>` values, where `M > 48`
|
|
15
|
-
* @default bigint
|
|
16
|
-
*/
|
|
17
|
-
bigIntType: Register extends {
|
|
18
|
-
bigIntType: infer type;
|
|
19
|
-
} ? type : Register extends {
|
|
20
|
-
BigIntType: infer type;
|
|
21
|
-
} ? type : DefaultRegister['bigIntType'];
|
|
22
|
-
/**
|
|
23
|
-
* TypeScript type to use for `bytes` values
|
|
24
|
-
* @default { inputs: `0x${string}`; outputs: `0x${string}`; }
|
|
25
|
-
*/
|
|
26
|
-
bytesType: Register extends {
|
|
27
|
-
bytesType: infer type extends {
|
|
28
|
-
inputs: unknown;
|
|
29
|
-
outputs: unknown;
|
|
30
|
-
};
|
|
31
|
-
} ? type : Register extends {
|
|
32
|
-
BytesType: infer type extends {
|
|
33
|
-
inputs: unknown;
|
|
34
|
-
outputs: unknown;
|
|
35
|
-
};
|
|
36
|
-
} ? type : DefaultRegister['bytesType'];
|
|
37
|
-
/**
|
|
38
|
-
* TypeScript type to use for `int<M>` and `uint<M>` values, where `M <= 48`
|
|
39
|
-
* @default number
|
|
40
|
-
*/
|
|
41
|
-
intType: Register extends {
|
|
42
|
-
intType: infer type;
|
|
43
|
-
} ? type : Register extends {
|
|
44
|
-
IntType: infer type;
|
|
45
|
-
} ? type : DefaultRegister['intType'];
|
|
46
|
-
/**
|
|
47
|
-
* Maximum depth for nested array types (e.g. string[][])
|
|
48
|
-
*
|
|
49
|
-
* Note: You probably only want to set this to a specific number if parsed types are returning as `unknown`
|
|
50
|
-
* and you want to figure out why. If you set this, you should probably also reduce `FixedArrayMaxLength`.
|
|
51
|
-
*
|
|
52
|
-
* @default false
|
|
53
|
-
*/
|
|
54
|
-
arrayMaxDepth: Register extends {
|
|
55
|
-
arrayMaxDepth: infer type extends number | false;
|
|
56
|
-
} ? type : Register extends {
|
|
57
|
-
ArrayMaxDepth: infer type extends number | false;
|
|
58
|
-
} ? type : DefaultRegister['arrayMaxDepth'];
|
|
59
|
-
/**
|
|
60
|
-
* Lower bound for fixed array length
|
|
61
|
-
* @default 1
|
|
62
|
-
*/
|
|
63
|
-
fixedArrayMinLength: Register extends {
|
|
64
|
-
fixedArrayMinLength: infer type extends number;
|
|
65
|
-
} ? type : Register extends {
|
|
66
|
-
FixedArrayMinLength: infer type extends number;
|
|
67
|
-
} ? type : DefaultRegister['fixedArrayMinLength'];
|
|
68
|
-
/**
|
|
69
|
-
* Upper bound for fixed array length
|
|
70
|
-
* @default 99
|
|
71
|
-
*/
|
|
72
|
-
fixedArrayMaxLength: Register extends {
|
|
73
|
-
fixedArrayMaxLength: infer type extends number;
|
|
74
|
-
} ? type : Register extends {
|
|
75
|
-
FixedArrayMaxLength: infer type extends number;
|
|
76
|
-
} ? type : DefaultRegister['fixedArrayMaxLength'];
|
|
77
|
-
/**
|
|
78
|
-
* When set, validates {@link AbiParameter}'s `type` against {@link AbiType}
|
|
79
|
-
*
|
|
80
|
-
* Note: You probably only want to set this to `true` if parsed types are returning as `unknown`
|
|
81
|
-
* and you want to figure out why.
|
|
82
|
-
*
|
|
83
|
-
* @default false
|
|
84
|
-
*/
|
|
85
|
-
strictAbiType: Register extends {
|
|
86
|
-
strictAbiType: infer type extends boolean;
|
|
87
|
-
} ? type : Register extends {
|
|
88
|
-
StrictAbiType: infer type extends boolean;
|
|
89
|
-
} ? type : DefaultRegister['strictAbiType'];
|
|
90
|
-
/** @deprecated Use `addressType` instead */
|
|
91
|
-
AddressType: ResolvedRegister['addressType'];
|
|
92
|
-
/** @deprecated Use `addressType` instead */
|
|
93
|
-
BigIntType: ResolvedRegister['bigIntType'];
|
|
94
|
-
/** @deprecated Use `bytesType` instead */
|
|
95
|
-
BytesType: ResolvedRegister['bytesType'];
|
|
96
|
-
/** @deprecated Use `intType` instead */
|
|
97
|
-
IntType: ResolvedRegister['intType'];
|
|
98
|
-
/** @deprecated Use `arrayMaxDepth` instead */
|
|
99
|
-
ArrayMaxDepth: ResolvedRegister['arrayMaxDepth'];
|
|
100
|
-
/** @deprecated Use `fixedArrayMinLength` instead */
|
|
101
|
-
FixedArrayMinLength: ResolvedRegister['fixedArrayMinLength'];
|
|
102
|
-
/** @deprecated Use `fixedArrayMaxLength` instead */
|
|
103
|
-
FixedArrayMaxLength: ResolvedRegister['fixedArrayMaxLength'];
|
|
104
|
-
/** @deprecated Use `strictAbiType` instead */
|
|
105
|
-
StrictAbiType: ResolvedRegister['strictAbiType'];
|
|
106
|
-
};
|
|
107
|
-
type DefaultRegister = {
|
|
108
|
-
/** Maximum depth for nested array types (e.g. string[][]) */
|
|
109
|
-
arrayMaxDepth: false;
|
|
110
|
-
/** Lower bound for fixed array length */
|
|
111
|
-
fixedArrayMinLength: 1;
|
|
112
|
-
/** Upper bound for fixed array length */
|
|
113
|
-
fixedArrayMaxLength: 99;
|
|
114
|
-
/** TypeScript type to use for `address` values */
|
|
115
|
-
addressType: `0x${string}`;
|
|
116
|
-
/** TypeScript type to use for `bytes` values */
|
|
117
|
-
bytesType: {
|
|
118
|
-
/** TypeScript type to use for `bytes` input values */
|
|
119
|
-
inputs: `0x${string}`;
|
|
120
|
-
/** TypeScript type to use for `bytes` output values */
|
|
121
|
-
outputs: `0x${string}`;
|
|
122
|
-
};
|
|
123
|
-
/** TypeScript type to use for `int<M>` and `uint<M>` values, where `M > 48` */
|
|
124
|
-
bigIntType: bigint;
|
|
125
|
-
/** TypeScript type to use for `int<M>` and `uint<M>` values, where `M <= 48` */
|
|
126
|
-
intType: number;
|
|
127
|
-
/** When set, validates {@link AbiParameter}'s `type` against {@link AbiType} */
|
|
128
|
-
strictAbiType: false;
|
|
129
|
-
/** @deprecated Use `arrayMaxDepth` instead */
|
|
130
|
-
ArrayMaxDepth: DefaultRegister['arrayMaxDepth'];
|
|
131
|
-
/** @deprecated Use `fixedArrayMinLength` instead */
|
|
132
|
-
FixedArrayMinLength: DefaultRegister['fixedArrayMinLength'];
|
|
133
|
-
/** @deprecated Use `fixedArrayMaxLength` instead */
|
|
134
|
-
FixedArrayMaxLength: DefaultRegister['fixedArrayMaxLength'];
|
|
135
|
-
/** @deprecated Use `addressType` instead */
|
|
136
|
-
AddressType: DefaultRegister['addressType'];
|
|
137
|
-
/** @deprecated Use `bytesType` instead */
|
|
138
|
-
BytesType: {
|
|
139
|
-
inputs: DefaultRegister['bytesType']['inputs'];
|
|
140
|
-
outputs: DefaultRegister['bytesType']['outputs'];
|
|
141
|
-
};
|
|
142
|
-
/** @deprecated Use `bigIntType` instead */
|
|
143
|
-
BigIntType: DefaultRegister['bigIntType'];
|
|
144
|
-
/** @deprecated Use `intType` instead */
|
|
145
|
-
IntType: DefaultRegister['intType'];
|
|
146
|
-
/** @deprecated Use `strictAbiType` instead */
|
|
147
|
-
StrictAbiType: DefaultRegister['strictAbiType'];
|
|
148
|
-
};
|
|
149
|
-
//#endregion
|
|
150
|
-
//#region ../../node_modules/.pnpm/abitype@1.1.0_typescript@5.9.3_zod@4.1.12/node_modules/abitype/dist/types/types.d.ts
|
|
151
|
-
/**
|
|
152
|
-
* Prints custom error message
|
|
153
|
-
*
|
|
154
|
-
* @param messages - Error message
|
|
155
|
-
* @returns Custom error message
|
|
156
|
-
*
|
|
157
|
-
* @example
|
|
158
|
-
* type Result = Error<'Custom error message'>
|
|
159
|
-
* // ^? type Result = ['Error: Custom error message']
|
|
160
|
-
*/
|
|
161
|
-
type Error<messages extends string | string[]> = messages extends string ? [`Error: ${messages}`] : { [key in keyof messages]: messages[key] extends infer message extends string ? `Error: ${message}` : never };
|
|
162
|
-
/**
|
|
163
|
-
* Merges two object types into new type
|
|
164
|
-
*
|
|
165
|
-
* @param object1 - Object to merge into
|
|
166
|
-
* @param object2 - Object to merge and override keys from {@link object1}
|
|
167
|
-
* @returns New object type with keys from {@link object1} and {@link object2}. If a key exists in both {@link object1} and {@link object2}, the key from {@link object2} will be used.
|
|
168
|
-
*
|
|
169
|
-
* @example
|
|
170
|
-
* type Result = Merge<{ foo: string }, { foo: number; bar: string }>
|
|
171
|
-
* // ^? type Result = { foo: number; bar: string }
|
|
172
|
-
*/
|
|
173
|
-
type Merge<object1, object2> = Omit<object1, keyof object2> & object2;
|
|
174
|
-
/**
|
|
175
|
-
* Combines members of an intersection into a readable type.
|
|
176
|
-
*
|
|
177
|
-
* @link https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg
|
|
178
|
-
* @example
|
|
179
|
-
* type Result = Pretty<{ a: string } | { b: string } | { c: number, d: bigint }>
|
|
180
|
-
* // ^? type Result = { a: string; b: string; c: number; d: bigint }
|
|
181
|
-
*/
|
|
182
|
-
type Pretty<type$1> = { [key in keyof type$1]: type$1[key] } & unknown;
|
|
183
|
-
/**
|
|
184
|
-
* Creates range between two positive numbers using [tail recursion](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#tail-recursion-elimination-on-conditional-types).
|
|
185
|
-
*
|
|
186
|
-
* @param start - Number to start range
|
|
187
|
-
* @param stop - Number to end range
|
|
188
|
-
* @returns Array with inclusive range from {@link start} to {@link stop}
|
|
189
|
-
*
|
|
190
|
-
* @example
|
|
191
|
-
* type Result = Range<1, 3>
|
|
192
|
-
* // ^? type Result = [1, 2, 3]
|
|
193
|
-
*/
|
|
194
|
-
type Range<start extends number, stop extends number, result extends number[] = [], padding extends 0[] = [], current extends number = [...padding, ...result]['length'] & number> = current extends stop ? current extends start ? [current] : result extends [] ? [] : [...result, current] : current extends start ? Range<start, stop, [current], padding> : result extends [] ? Range<start, stop, [], [...padding, 0]> : Range<start, stop, [...result, current], padding>;
|
|
195
|
-
/**
|
|
196
|
-
* Create tuple of {@link type} type with {@link size} size
|
|
197
|
-
*
|
|
198
|
-
* @param Type - Type of tuple
|
|
199
|
-
* @param Size - Size of tuple
|
|
200
|
-
* @returns Tuple of {@link type} type with {@link size} size
|
|
201
|
-
*
|
|
202
|
-
* @example
|
|
203
|
-
* type Result = Tuple<string, 2>
|
|
204
|
-
* // ^? type Result = [string, string]
|
|
205
|
-
*/
|
|
206
|
-
type Tuple<type$1, size extends number> = size extends size ? number extends size ? type$1[] : _TupleOf<type$1, size, []> : never;
|
|
207
|
-
type _TupleOf<length, size extends number, acc extends readonly unknown[]> = acc['length'] extends size ? acc : _TupleOf<length, size, readonly [length, ...acc]>;
|
|
208
|
-
//#endregion
|
|
209
|
-
//#region ../../node_modules/.pnpm/abitype@1.1.0_typescript@5.9.3_zod@4.1.12/node_modules/abitype/dist/types/abi.d.ts
|
|
210
|
-
type Address = ResolvedRegister['addressType'];
|
|
211
|
-
type MBytes = '' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32;
|
|
212
|
-
type MBits = '' | 8 | 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72 | 80 | 88 | 96 | 104 | 112 | 120 | 128 | 136 | 144 | 152 | 160 | 168 | 176 | 184 | 192 | 200 | 208 | 216 | 224 | 232 | 240 | 248 | 256;
|
|
213
|
-
type SolidityAddress = 'address';
|
|
214
|
-
type SolidityBool = 'bool';
|
|
215
|
-
type SolidityBytes = `bytes${MBytes}`;
|
|
216
|
-
type SolidityFunction = 'function';
|
|
217
|
-
type SolidityString = 'string';
|
|
218
|
-
type SolidityTuple = 'tuple';
|
|
219
|
-
type SolidityInt = `${'u' | ''}int${MBits}`;
|
|
220
|
-
type SolidityFixedArrayRange = Range<ResolvedRegister['fixedArrayMinLength'], ResolvedRegister['fixedArrayMaxLength']>[number];
|
|
221
|
-
type SolidityFixedArraySizeLookup = { [Prop in SolidityFixedArrayRange as `${Prop}`]: Prop };
|
|
222
|
-
/**
|
|
223
|
-
* Recursively build arrays up to maximum depth
|
|
224
|
-
* or use a more broad type when maximum depth is switched "off"
|
|
225
|
-
*/
|
|
226
|
-
type _BuildArrayTypes<T extends string, Depth extends readonly number[] = []> = ResolvedRegister['arrayMaxDepth'] extends false ? `${T}[${string}]` : Depth['length'] extends ResolvedRegister['arrayMaxDepth'] ? T : T extends `${any}[${SolidityFixedArrayRange | ''}]` ? _BuildArrayTypes<T | `${T}[${SolidityFixedArrayRange | ''}]`, [...Depth, 1]> : _BuildArrayTypes<`${T}[${SolidityFixedArrayRange | ''}]`, [...Depth, 1]>;
|
|
227
|
-
type SolidityArrayWithoutTuple = _BuildArrayTypes<SolidityAddress | SolidityBool | SolidityBytes | SolidityFunction | SolidityInt | SolidityString>;
|
|
228
|
-
type SolidityArrayWithTuple = _BuildArrayTypes<SolidityTuple>;
|
|
229
|
-
type SolidityArray = SolidityArrayWithoutTuple | SolidityArrayWithTuple;
|
|
230
|
-
type AbiType = SolidityArray | SolidityAddress | SolidityBool | SolidityBytes | SolidityFunction | SolidityInt | SolidityString | SolidityTuple;
|
|
231
|
-
type ResolvedAbiType = ResolvedRegister['strictAbiType'] extends true ? AbiType : string;
|
|
232
|
-
type AbiInternalType = ResolvedAbiType | `address ${string}` | `contract ${string}` | `enum ${string}` | `struct ${string}`;
|
|
233
|
-
type AbiParameter = Pretty<{
|
|
234
|
-
type: ResolvedAbiType;
|
|
235
|
-
name?: string | undefined;
|
|
236
|
-
/** Representation used by Solidity compiler */
|
|
237
|
-
internalType?: AbiInternalType | undefined;
|
|
238
|
-
} & ({
|
|
239
|
-
type: Exclude<ResolvedAbiType, SolidityTuple | SolidityArrayWithTuple>;
|
|
240
|
-
} | {
|
|
241
|
-
type: SolidityTuple | SolidityArrayWithTuple;
|
|
242
|
-
components: readonly AbiParameter[];
|
|
243
|
-
})>;
|
|
244
|
-
type AbiEventParameter = AbiParameter & {
|
|
245
|
-
indexed?: boolean | undefined;
|
|
246
|
-
};
|
|
247
|
-
/**
|
|
248
|
-
* State mutability for {@link AbiFunction}
|
|
249
|
-
*
|
|
250
|
-
* @see https://docs.soliditylang.org/en/latest/contracts.html#state-mutability
|
|
251
|
-
*/
|
|
252
|
-
type AbiStateMutability = 'pure' | 'view' | 'nonpayable' | 'payable';
|
|
253
|
-
/** Kind of {@link AbiParameter} */
|
|
254
|
-
type AbiParameterKind = 'inputs' | 'outputs';
|
|
255
|
-
/** ABI ["function"](https://docs.soliditylang.org/en/latest/abi-spec.html#json) type */
|
|
256
|
-
type AbiFunction = {
|
|
257
|
-
type: 'function';
|
|
258
|
-
/**
|
|
259
|
-
* @deprecated use `pure` or `view` from {@link AbiStateMutability} instead
|
|
260
|
-
* @see https://github.com/ethereum/solidity/issues/992
|
|
261
|
-
*/
|
|
262
|
-
constant?: boolean | undefined;
|
|
263
|
-
/**
|
|
264
|
-
* @deprecated Vyper used to provide gas estimates
|
|
265
|
-
* @see https://github.com/vyperlang/vyper/issues/2151
|
|
266
|
-
*/
|
|
267
|
-
gas?: number | undefined;
|
|
268
|
-
inputs: readonly AbiParameter[];
|
|
269
|
-
name: string;
|
|
270
|
-
outputs: readonly AbiParameter[];
|
|
271
|
-
/**
|
|
272
|
-
* @deprecated use `payable` or `nonpayable` from {@link AbiStateMutability} instead
|
|
273
|
-
* @see https://github.com/ethereum/solidity/issues/992
|
|
274
|
-
*/
|
|
275
|
-
payable?: boolean | undefined;
|
|
276
|
-
stateMutability: AbiStateMutability;
|
|
277
|
-
};
|
|
278
|
-
/** ABI ["constructor"](https://docs.soliditylang.org/en/latest/abi-spec.html#json) type */
|
|
279
|
-
type AbiConstructor = {
|
|
280
|
-
type: 'constructor';
|
|
281
|
-
inputs: readonly AbiParameter[];
|
|
282
|
-
/**
|
|
283
|
-
* @deprecated use `payable` or `nonpayable` from {@link AbiStateMutability} instead
|
|
284
|
-
* @see https://github.com/ethereum/solidity/issues/992
|
|
285
|
-
*/
|
|
286
|
-
payable?: boolean | undefined;
|
|
287
|
-
stateMutability: Extract<AbiStateMutability, 'payable' | 'nonpayable'>;
|
|
288
|
-
};
|
|
289
|
-
/** ABI ["fallback"](https://docs.soliditylang.org/en/latest/abi-spec.html#json) type */
|
|
290
|
-
type AbiFallback = {
|
|
291
|
-
type: 'fallback';
|
|
292
|
-
/**
|
|
293
|
-
* @deprecated use `payable` or `nonpayable` from {@link AbiStateMutability} instead
|
|
294
|
-
* @see https://github.com/ethereum/solidity/issues/992
|
|
295
|
-
*/
|
|
296
|
-
payable?: boolean | undefined;
|
|
297
|
-
stateMutability: Extract<AbiStateMutability, 'payable' | 'nonpayable'>;
|
|
298
|
-
};
|
|
299
|
-
/** ABI ["receive"](https://docs.soliditylang.org/en/latest/contracts.html#receive-ether-function) type */
|
|
300
|
-
type AbiReceive = {
|
|
301
|
-
type: 'receive';
|
|
302
|
-
stateMutability: Extract<AbiStateMutability, 'payable'>;
|
|
303
|
-
};
|
|
304
|
-
/** ABI ["event"](https://docs.soliditylang.org/en/latest/abi-spec.html#events) type */
|
|
305
|
-
type AbiEvent = {
|
|
306
|
-
type: 'event';
|
|
307
|
-
anonymous?: boolean | undefined;
|
|
308
|
-
inputs: readonly AbiEventParameter[];
|
|
309
|
-
name: string;
|
|
310
|
-
};
|
|
311
|
-
/** ABI ["error"](https://docs.soliditylang.org/en/latest/abi-spec.html#errors) type */
|
|
312
|
-
type AbiError = {
|
|
313
|
-
type: 'error';
|
|
314
|
-
inputs: readonly AbiParameter[];
|
|
315
|
-
name: string;
|
|
316
|
-
};
|
|
317
|
-
/**
|
|
318
|
-
* Contract [ABI Specification](https://docs.soliditylang.org/en/latest/abi-spec.html#json)
|
|
319
|
-
*/
|
|
320
|
-
type Abi = readonly (AbiConstructor | AbiError | AbiEvent | AbiFallback | AbiFunction | AbiReceive)[];
|
|
321
|
-
type TypedDataDomain = {
|
|
322
|
-
chainId?: number | bigint | undefined;
|
|
323
|
-
name?: string | undefined;
|
|
324
|
-
salt?: ResolvedRegister['bytesType']['outputs'] | undefined;
|
|
325
|
-
verifyingContract?: Address | undefined;
|
|
326
|
-
version?: string | undefined;
|
|
327
|
-
};
|
|
328
|
-
type TypedDataType = Exclude<AbiType, SolidityFunction | SolidityTuple | SolidityArrayWithTuple | 'int' | 'uint'>;
|
|
329
|
-
type TypedDataParameter = {
|
|
330
|
-
name: string;
|
|
331
|
-
type: TypedDataType | keyof TypedData | `${keyof TypedData}[${string | ''}]`;
|
|
332
|
-
};
|
|
333
|
-
/**
|
|
334
|
-
* [EIP-712](https://eips.ethereum.org/EIPS/eip-712#definition-of-typed-structured-data-%F0%9D%95%8A) Typed Data Specification
|
|
335
|
-
*/
|
|
336
|
-
type TypedData = Pretty<Record<string, readonly TypedDataParameter[]> & { [_ in TypedDataType]?: never }>;
|
|
337
|
-
//#endregion
|
|
338
|
-
export { Tuple as C, Pretty as S, TypedDataDomain as _, AbiParameterKind as a, Error as b, Address as c, SolidityBytes as d, SolidityFixedArrayRange as f, TypedData as g, SolidityTuple as h, AbiParameter as i, MBits as l, SolidityInt as m, AbiEvent as n, AbiStateMutability as o, SolidityFixedArraySizeLookup as p, AbiFunction as r, AbiType as s, Abi as t, SolidityArray as u, TypedDataParameter as v, ResolvedRegister as w, Merge as x, TypedDataType as y };
|
|
339
|
-
//# sourceMappingURL=abi-DW6AS0eM.d.mts.map
|