@otim/sdk-core 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/LICENSE +201 -0
  2. package/dist/.tsbuildinfo +1 -0
  3. package/dist/abi-Bd3X6gV9.d.mts +154 -0
  4. package/dist/abi-Bd3X6gV9.d.mts.map +1 -0
  5. package/dist/abi-CQuxrNCU.d.cts +154 -0
  6. package/dist/abi-CQuxrNCU.d.cts.map +1 -0
  7. package/dist/account/index.cjs +7 -0
  8. package/dist/account/index.d.cts +3 -0
  9. package/dist/account/index.d.mts +3 -0
  10. package/dist/account/index.mjs +3 -0
  11. package/dist/account-Bwm5PTcc.cjs +56 -0
  12. package/dist/account-Bwm5PTcc.cjs.map +1 -0
  13. package/dist/account-p4sxzIt3.mjs +26 -0
  14. package/dist/account-p4sxzIt3.mjs.map +1 -0
  15. package/dist/clients/index.cjs +7 -0
  16. package/dist/clients/index.d.cts +3 -0
  17. package/dist/clients/index.d.mts +3 -0
  18. package/dist/clients/index.mjs +3 -0
  19. package/dist/clients-DBRhkU4y.cjs +297 -0
  20. package/dist/clients-DBRhkU4y.cjs.map +1 -0
  21. package/dist/clients-DMKeLhcJ.mjs +268 -0
  22. package/dist/clients-DMKeLhcJ.mjs.map +1 -0
  23. package/dist/config/index.cjs +10 -0
  24. package/dist/config/index.d.cts +3 -0
  25. package/dist/config/index.d.mts +3 -0
  26. package/dist/config/index.mjs +3 -0
  27. package/dist/config-C_nc1DXn.mjs +67 -0
  28. package/dist/config-C_nc1DXn.mjs.map +1 -0
  29. package/dist/config-CjGpscVk.cjs +114 -0
  30. package/dist/config-CjGpscVk.cjs.map +1 -0
  31. package/dist/context/index.cjs +5 -0
  32. package/dist/context/index.d.cts +2 -0
  33. package/dist/context/index.d.mts +2 -0
  34. package/dist/context/index.mjs +3 -0
  35. package/dist/context-B-Wcmhb3.cjs +38 -0
  36. package/dist/context-B-Wcmhb3.cjs.map +1 -0
  37. package/dist/context-uTye69B0.mjs +20 -0
  38. package/dist/context-uTye69B0.mjs.map +1 -0
  39. package/dist/index-B4fkcFy5.d.mts +54 -0
  40. package/dist/index-B4fkcFy5.d.mts.map +1 -0
  41. package/dist/index-BnP8vpJJ.d.cts +25 -0
  42. package/dist/index-BnP8vpJJ.d.cts.map +1 -0
  43. package/dist/index-C1HSAemv.d.cts +20 -0
  44. package/dist/index-C1HSAemv.d.cts.map +1 -0
  45. package/dist/index-C4N2Xixk.d.mts +27 -0
  46. package/dist/index-C4N2Xixk.d.mts.map +1 -0
  47. package/dist/index-CcCMIBgF.d.mts +20 -0
  48. package/dist/index-CcCMIBgF.d.mts.map +1 -0
  49. package/dist/index-DK-40z4V.d.cts +54 -0
  50. package/dist/index-DK-40z4V.d.cts.map +1 -0
  51. package/dist/index-DW_zBRKz.d.mts +25 -0
  52. package/dist/index-DW_zBRKz.d.mts.map +1 -0
  53. package/dist/index-De8OZ-Be.d.cts +96 -0
  54. package/dist/index-De8OZ-Be.d.cts.map +1 -0
  55. package/dist/index-UnaahQgb.d.cts +27 -0
  56. package/dist/index-UnaahQgb.d.cts.map +1 -0
  57. package/dist/index-e5BLgzcW.d.mts +96 -0
  58. package/dist/index-e5BLgzcW.d.mts.map +1 -0
  59. package/dist/index.cjs +31 -0
  60. package/dist/index.d.cts +8 -0
  61. package/dist/index.d.mts +8 -0
  62. package/dist/index.mjs +7 -0
  63. package/dist/misc-CX4pLJaA.d.mts +42 -0
  64. package/dist/misc-CX4pLJaA.d.mts.map +1 -0
  65. package/dist/misc-CpZxSPCP.d.cts +42 -0
  66. package/dist/misc-CpZxSPCP.d.cts.map +1 -0
  67. package/dist/utils/index.cjs +6 -0
  68. package/dist/utils/index.d.cts +4 -0
  69. package/dist/utils/index.d.mts +4 -0
  70. package/dist/utils/index.mjs +3 -0
  71. package/dist/utils-CVQFvsfl.cjs +104 -0
  72. package/dist/utils-CVQFvsfl.cjs.map +1 -0
  73. package/dist/utils-DziAHBiz.mjs +81 -0
  74. package/dist/utils-DziAHBiz.mjs.map +1 -0
  75. package/package.json +162 -0
@@ -0,0 +1,96 @@
1
+ import { t as Address$1 } from "./abi-CQuxrNCU.cjs";
2
+ import { OtimClientContext } from "@otim/sdk-core/context";
3
+ import { OtimAccount } from "@otim/sdk-core/account";
4
+ import { APIClient, AuthLoginResponse, DelegationCreateRequest, DelegationStatusRequest, DelegationStatusResponse, GetDelegateAddressRequest, GetDelegateAddressResponse, GetMaxPriorityFeePerGasEstimateRequest, GetMaxPriorityFeePerGasEstimateResponse, GetPaymentRequestsRequest, GetPaymentRequestsResponse, MeResponse, PaginatedServiceResponse, PaymentRequestDetailsRequest, PaymentRequestDetailsResponse, PaymentsListRequest, ServiceResponse } from "@otim/utils/api";
5
+ import { SupportedChainId } from "@otim/utils/chains";
6
+ import { Nullable } from "@otim/utils/helpers";
7
+ import { PaymentRequestMetadata, PaymentResponseWithActionNames } from "@otim/utils/payments";
8
+ import { Address, Payments } from "@otim/utils/schemas";
9
+
10
+ //#region src/clients/auth.d.ts
11
+ interface LoginOptions {
12
+ address: Address$1;
13
+ }
14
+ declare class AuthClient {
15
+ private readonly apiClient;
16
+ private readonly account;
17
+ private readonly context;
18
+ constructor(apiClient: APIClient, account: OtimAccount, context: OtimClientContext);
19
+ login({
20
+ address
21
+ }: LoginOptions): Promise<AuthLoginResponse>;
22
+ getCurrentUser(): Promise<MeResponse>;
23
+ }
24
+ //#endregion
25
+ //#region src/clients/config.d.ts
26
+ declare class ConfigClient {
27
+ private readonly apiClient;
28
+ constructor(apiClient: APIClient);
29
+ getMaxPriorityFeeEstimate({
30
+ chainId
31
+ }: GetMaxPriorityFeePerGasEstimateRequest): Promise<GetMaxPriorityFeePerGasEstimateResponse>;
32
+ }
33
+ //#endregion
34
+ //#region src/clients/delegation.d.ts
35
+ declare class DelegationClient {
36
+ private readonly apiClient;
37
+ constructor(apiClient: APIClient);
38
+ getDelegateAddress({
39
+ chainId
40
+ }: GetDelegateAddressRequest): Promise<GetDelegateAddressResponse>;
41
+ getDelegationStatus(options: DelegationStatusRequest): Promise<DelegationStatusResponse>;
42
+ createDelegation(delegationRequest: DelegationCreateRequest): Promise<void>;
43
+ }
44
+ //#endregion
45
+ //#region src/clients/payment-requests.d.ts
46
+ interface CreatePaymentRequestParameters {
47
+ amount: number;
48
+ chainId: SupportedChainId;
49
+ recipient: Address;
50
+ token?: "USDC" | "USDT";
51
+ payer?: Nullable<Address>;
52
+ /**
53
+ * ISO 8601 date format (e.g., "2024-12-31T23:59:59.000Z")
54
+ */
55
+ dueDate?: string;
56
+ metadata?: PaymentRequestMetadata;
57
+ note?: string;
58
+ }
59
+ interface CreatePaymentRequestResponse {
60
+ requestId: string;
61
+ ephemeralWalletAddress: Address;
62
+ }
63
+ interface ActivatePaymentRequestParams {
64
+ buildResponse: PaymentResponseWithActionNames;
65
+ settlementChainId: number;
66
+ }
67
+ declare class PaymentRequestsClient {
68
+ private readonly apiClient;
69
+ private readonly account;
70
+ private readonly context;
71
+ constructor(apiClient: APIClient, account: OtimAccount, context: OtimClientContext);
72
+ create(params: CreatePaymentRequestParameters): Promise<CreatePaymentRequestResponse>;
73
+ activate(params: ActivatePaymentRequestParams): Promise<void>;
74
+ private validateAndGetTokenAddress;
75
+ private buildMetadata;
76
+ private createPayload;
77
+ private buildAndEnhancePaymentRequest;
78
+ private createPublicClient;
79
+ private fetchDelegateAddresses;
80
+ getDetails(request: PaymentRequestDetailsRequest): Promise<ServiceResponse<PaymentRequestDetailsResponse>>;
81
+ listOutgoingPaymentRequests(request: PaymentsListRequest): Promise<PaginatedServiceResponse<Payments>>;
82
+ listIncomingPaymentRequests(request: PaymentsListRequest): Promise<PaginatedServiceResponse<Payments>>;
83
+ list(request: GetPaymentRequestsRequest): Promise<PaginatedServiceResponse<GetPaymentRequestsResponse>>;
84
+ }
85
+ //#endregion
86
+ //#region src/clients/orchestration.d.ts
87
+ declare class OrchestrationClient {
88
+ private readonly apiClient;
89
+ private readonly account;
90
+ private readonly context;
91
+ readonly paymentRequests: PaymentRequestsClient;
92
+ constructor(apiClient: APIClient, account: OtimAccount, context: OtimClientContext);
93
+ }
94
+ //#endregion
95
+ export { PaymentRequestsClient as a, AuthClient as c, CreatePaymentRequestResponse as i, LoginOptions as l, ActivatePaymentRequestParams as n, DelegationClient as o, CreatePaymentRequestParameters as r, ConfigClient as s, OrchestrationClient as t };
96
+ //# sourceMappingURL=index-De8OZ-Be.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-De8OZ-Be.d.cts","names":[],"sources":["../src/clients/auth.ts","../src/clients/config.ts","../src/clients/delegation.ts","../src/clients/payment-requests.ts","../src/clients/orchestration.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;UAUiB,YAAA;WACN;;cAGE,UAAA;;;EAJI,iBAAY,OAAA;EAIhB,WAAA,CAAA,SAAU,EAES,SAFT,EAAA,OAAA,EAGO,WAHP,EAAA,OAAA,EAIO,iBAJP;EAES,KAAA,CAAA;IAAA;EAAA,CAAA,EAKL,YALK,CAAA,EAKU,OALV,CAKkB,iBALlB,CAAA;EACF,cAAA,CAAA,CAAA,EAmBJ,OAnBI,CAmBI,UAnBJ,CAAA;;;;cCXjB,YAAA;;yBAC6B;;;KAIrC,yCAAyC,QAAQ;;;;cCFzC,gBAAA;;yBAC6B;;;KAIrC,4BAA4B,QAAQ;+BAS5B,0BACR,QAAQ;sCAUU,0BAClB;;;;UCOY,8BAAA;;EHhCA,OAAA,EGkCN,gBHlCkB;EAIhB,SAAA,EG+BA,OH/BU;EAES,KAAA,CAAA,EAAA,MAAA,GAAA,MAAA;EACF,KAAA,CAAA,EG8BpB,QH9BoB,CG8BX,OH9BW,CAAA;EACA;;;EAGoB,OAAA,CAAA,EAAA,MAAA;EAAR,QAAA,CAAA,EG+B7B,sBH/B6B;EAeR,IAAA,CAAA,EAAA,MAAA;;AAAD,UGoBhB,4BAAA,CHpBgB;;0BGsBP;;AFpDb,UEuDI,4BAAA,CFvDQ;EACiB,aAAA,EEuDzB,8BFvDyB;EAGtC,iBAAA,EAAA,MAAA;;AACkD,cE0DzC,qBAAA,CF1DyC;EAAR,iBAAA,SAAA;EAAO,iBAAA,OAAA;;yBE4DrB,oBACF,sBACA;iBAIlB,iCACP,QAAQ;EDrEA,QAAA,CAAA,MAAA,ECiHY,4BDjHI,CAAA,ECiH2B,ODjH3B,CAAA,IAAA,CAAA;EACa,QAAA,0BAAA;EAGtC,QAAA,aAAA;EACC,QAAA,aAAA;EAAoC,QAAA,6BAAA;EAAR,QAAA,kBAAA;EASpB,QAAA,sBAAA;EACA,UAAA,CAAA,OAAA,ECkPA,4BDlPA,CAAA,ECmPR,ODnPQ,CCmPA,eDnPA,CCmPgB,6BDnPhB,CAAA,CAAA;EAAR,2BAAA,CAAA,OAAA,ECwPQ,mBDxPR,CAAA,ECyPA,ODzPA,CCyPQ,wBDzPR,CCyPiC,QDzPjC,CAAA,CAAA;EAUkB,2BAAA,CAAA,OAAA,ECoPV,mBDpPU,CAAA,ECqPlB,ODrPkB,CCqPV,wBDrPU,CCqPe,QDrPf,CAAA,CAAA;EAClB,IAAA,CAAA,OAAA,ECyPQ,yBDzPR,CAAA,EC0PA,OD1PA,CC0PQ,wBD1PR,CC0PiC,0BD1PjC,CAAA,CAAA;;;;cE7BQ,mBAAA;;;;4BACsB;yBAGH,oBACF,sBACA;AJF9B"}
@@ -0,0 +1,27 @@
1
+ import { t as Address } from "./abi-CQuxrNCU.cjs";
2
+
3
+ //#region src/config/env.d.ts
4
+ declare const Environment: {
5
+ readonly Sandbox: "sandbox";
6
+ readonly Production: "production";
7
+ };
8
+ type Environment = (typeof Environment)[keyof typeof Environment];
9
+ declare const isEnvironment: (value: string) => value is Environment;
10
+ declare const getApiUrl: (environment: Environment) => string;
11
+ declare const getTurnkeyApiUrl: (environment: Environment) => string;
12
+ declare const env: Readonly<{
13
+ ENVIRONMENT: "sandbox" | "production";
14
+ ENABLE_MSW: boolean;
15
+ CI: boolean;
16
+ }>;
17
+ //#endregion
18
+ //#region src/config/app.d.ts
19
+ /**
20
+ * SIWE default configuration.
21
+ */
22
+ declare const SIWE_CHAIN_ID = 0;
23
+ declare const SIWE_VERSION = "1";
24
+ declare const createLoginSiweMessage: (address: Address, nonce: string) => string;
25
+ //#endregion
26
+ export { env as a, isEnvironment as c, Environment as i, SIWE_VERSION as n, getApiUrl as o, createLoginSiweMessage as r, getTurnkeyApiUrl as s, SIWE_CHAIN_ID as t };
27
+ //# sourceMappingURL=index-UnaahQgb.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-UnaahQgb.d.cts","names":[],"sources":["../src/config/env.ts","../src/config/app.ts"],"sourcesContent":[],"mappings":";;;cAGa;;;AAAb,CAAA;AAIY,KAAA,WAAA,GAAW,CAAA,OAAW,WAA0B,CAAA,CAAA,MAAA,OAAA,WAAW,CAAA;AAE1D,cAAA,aAA0C,EAAA,CAAA,KAAA,EACI,MAAA,EAAA,GAAA,KAAA,IADJ,WACI;cAiB9C,yBAA0B;cAI1B,gCAAiC;cAIjC,KAAG;EC5BH,WAAA,EAAA,SAAa,GAAA,YAAA;EACb,UAAA,EAAA,OAAY;EAEZ,EAAA,EAAA,OAAA;;;;;;ADPb;AAIY,cCAC,aAAA,GDAqB,CAAA;AAErB,cCDA,YAAA,GDC0C,GAAA;AAkB1C,cCjBA,sBDiBqC,EAAA,CAAA,OAAA,EChBvC,ODgBuC,EAAA,KAAA,EAAA,MAAA,EAAA,GAAA,MAAA"}
@@ -0,0 +1,96 @@
1
+ import { t as Address$1 } from "./abi-Bd3X6gV9.mjs";
2
+ import { Nullable } from "@otim/utils/helpers";
3
+ import { OtimClientContext } from "@otim/sdk-core/context";
4
+ import { SupportedChainId } from "@otim/utils/chains";
5
+ import { PaymentRequestMetadata, PaymentResponseWithActionNames } from "@otim/utils/payments";
6
+ import { Address, Payments } from "@otim/utils/schemas";
7
+ import { OtimAccount } from "@otim/sdk-core/account";
8
+ import { APIClient, AuthLoginResponse, DelegationCreateRequest, DelegationStatusRequest, DelegationStatusResponse, GetDelegateAddressRequest, GetDelegateAddressResponse, GetMaxPriorityFeePerGasEstimateRequest, GetMaxPriorityFeePerGasEstimateResponse, GetPaymentRequestsRequest, GetPaymentRequestsResponse, MeResponse, PaginatedServiceResponse, PaymentRequestDetailsRequest, PaymentRequestDetailsResponse, PaymentsListRequest, ServiceResponse } from "@otim/utils/api";
9
+
10
+ //#region src/clients/auth.d.ts
11
+ interface LoginOptions {
12
+ address: Address$1;
13
+ }
14
+ declare class AuthClient {
15
+ private readonly apiClient;
16
+ private readonly account;
17
+ private readonly context;
18
+ constructor(apiClient: APIClient, account: OtimAccount, context: OtimClientContext);
19
+ login({
20
+ address
21
+ }: LoginOptions): Promise<AuthLoginResponse>;
22
+ getCurrentUser(): Promise<MeResponse>;
23
+ }
24
+ //#endregion
25
+ //#region src/clients/config.d.ts
26
+ declare class ConfigClient {
27
+ private readonly apiClient;
28
+ constructor(apiClient: APIClient);
29
+ getMaxPriorityFeeEstimate({
30
+ chainId
31
+ }: GetMaxPriorityFeePerGasEstimateRequest): Promise<GetMaxPriorityFeePerGasEstimateResponse>;
32
+ }
33
+ //#endregion
34
+ //#region src/clients/delegation.d.ts
35
+ declare class DelegationClient {
36
+ private readonly apiClient;
37
+ constructor(apiClient: APIClient);
38
+ getDelegateAddress({
39
+ chainId
40
+ }: GetDelegateAddressRequest): Promise<GetDelegateAddressResponse>;
41
+ getDelegationStatus(options: DelegationStatusRequest): Promise<DelegationStatusResponse>;
42
+ createDelegation(delegationRequest: DelegationCreateRequest): Promise<void>;
43
+ }
44
+ //#endregion
45
+ //#region src/clients/payment-requests.d.ts
46
+ interface CreatePaymentRequestParameters {
47
+ amount: number;
48
+ chainId: SupportedChainId;
49
+ recipient: Address;
50
+ token?: "USDC" | "USDT";
51
+ payer?: Nullable<Address>;
52
+ /**
53
+ * ISO 8601 date format (e.g., "2024-12-31T23:59:59.000Z")
54
+ */
55
+ dueDate?: string;
56
+ metadata?: PaymentRequestMetadata;
57
+ note?: string;
58
+ }
59
+ interface CreatePaymentRequestResponse {
60
+ requestId: string;
61
+ ephemeralWalletAddress: Address;
62
+ }
63
+ interface ActivatePaymentRequestParams {
64
+ buildResponse: PaymentResponseWithActionNames;
65
+ settlementChainId: number;
66
+ }
67
+ declare class PaymentRequestsClient {
68
+ private readonly apiClient;
69
+ private readonly account;
70
+ private readonly context;
71
+ constructor(apiClient: APIClient, account: OtimAccount, context: OtimClientContext);
72
+ create(params: CreatePaymentRequestParameters): Promise<CreatePaymentRequestResponse>;
73
+ activate(params: ActivatePaymentRequestParams): Promise<void>;
74
+ private validateAndGetTokenAddress;
75
+ private buildMetadata;
76
+ private createPayload;
77
+ private buildAndEnhancePaymentRequest;
78
+ private createPublicClient;
79
+ private fetchDelegateAddresses;
80
+ getDetails(request: PaymentRequestDetailsRequest): Promise<ServiceResponse<PaymentRequestDetailsResponse>>;
81
+ listOutgoingPaymentRequests(request: PaymentsListRequest): Promise<PaginatedServiceResponse<Payments>>;
82
+ listIncomingPaymentRequests(request: PaymentsListRequest): Promise<PaginatedServiceResponse<Payments>>;
83
+ list(request: GetPaymentRequestsRequest): Promise<PaginatedServiceResponse<GetPaymentRequestsResponse>>;
84
+ }
85
+ //#endregion
86
+ //#region src/clients/orchestration.d.ts
87
+ declare class OrchestrationClient {
88
+ private readonly apiClient;
89
+ private readonly account;
90
+ private readonly context;
91
+ readonly paymentRequests: PaymentRequestsClient;
92
+ constructor(apiClient: APIClient, account: OtimAccount, context: OtimClientContext);
93
+ }
94
+ //#endregion
95
+ export { PaymentRequestsClient as a, AuthClient as c, CreatePaymentRequestResponse as i, LoginOptions as l, ActivatePaymentRequestParams as n, DelegationClient as o, CreatePaymentRequestParameters as r, ConfigClient as s, OrchestrationClient as t };
96
+ //# sourceMappingURL=index-e5BLgzcW.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-e5BLgzcW.d.mts","names":[],"sources":["../src/clients/auth.ts","../src/clients/config.ts","../src/clients/delegation.ts","../src/clients/payment-requests.ts","../src/clients/orchestration.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;UAUiB,YAAA;WACN;;cAGE,UAAA;;;EAJI,iBAAY,OAAA;EAIhB,WAAA,CAAA,SAAU,EAES,SAFT,EAAA,OAAA,EAGO,WAHP,EAAA,OAAA,EAIO,iBAJP;EAES,KAAA,CAAA;IAAA;EAAA,CAAA,EAKL,YALK,CAAA,EAKU,OALV,CAKkB,iBALlB,CAAA;EACF,cAAA,CAAA,CAAA,EAmBJ,OAnBI,CAmBI,UAnBJ,CAAA;;;;cCXjB,YAAA;;yBAC6B;;;KAIrC,yCAAyC,QAAQ;;;;cCFzC,gBAAA;;yBAC6B;;;KAIrC,4BAA4B,QAAQ;+BAS5B,0BACR,QAAQ;sCAUU,0BAClB;;;;UCOY,8BAAA;;EHhCA,OAAA,EGkCN,gBHlCkB;EAIhB,SAAA,EG+BA,OH/BU;EAES,KAAA,CAAA,EAAA,MAAA,GAAA,MAAA;EACF,KAAA,CAAA,EG8BpB,QH9BoB,CG8BX,OH9BW,CAAA;EACA;;;EAGoB,OAAA,CAAA,EAAA,MAAA;EAAR,QAAA,CAAA,EG+B7B,sBH/B6B;EAeR,IAAA,CAAA,EAAA,MAAA;;AAAD,UGoBhB,4BAAA,CHpBgB;;0BGsBP;;AFpDb,UEuDI,4BAAA,CFvDQ;EACiB,aAAA,EEuDzB,8BFvDyB;EAGtC,iBAAA,EAAA,MAAA;;AACkD,cE0DzC,qBAAA,CF1DyC;EAAR,iBAAA,SAAA;EAAO,iBAAA,OAAA;;yBE4DrB,oBACF,sBACA;iBAIlB,iCACP,QAAQ;EDrEA,QAAA,CAAA,MAAA,ECiHY,4BDjHI,CAAA,ECiH2B,ODjH3B,CAAA,IAAA,CAAA;EACa,QAAA,0BAAA;EAGtC,QAAA,aAAA;EACC,QAAA,aAAA;EAAoC,QAAA,6BAAA;EAAR,QAAA,kBAAA;EASpB,QAAA,sBAAA;EACA,UAAA,CAAA,OAAA,ECkPA,4BDlPA,CAAA,ECmPR,ODnPQ,CCmPA,eDnPA,CCmPgB,6BDnPhB,CAAA,CAAA;EAAR,2BAAA,CAAA,OAAA,ECwPQ,mBDxPR,CAAA,ECyPA,ODzPA,CCyPQ,wBDzPR,CCyPiC,QDzPjC,CAAA,CAAA;EAUkB,2BAAA,CAAA,OAAA,ECoPV,mBDpPU,CAAA,ECqPlB,ODrPkB,CCqPV,wBDrPU,CCqPe,QDrPf,CAAA,CAAA;EAClB,IAAA,CAAA,OAAA,ECyPQ,yBDzPR,CAAA,EC0PA,OD1PA,CC0PQ,wBD1PR,CC0PiC,0BD1PjC,CAAA,CAAA;;;;cE7BQ,mBAAA;;;;4BACsB;yBAGH,oBACF,sBACA;AJF9B"}
package/dist/index.cjs ADDED
@@ -0,0 +1,31 @@
1
+ const require_account = require('./account-Bwm5PTcc.cjs');
2
+ const require_clients = require('./clients-DBRhkU4y.cjs');
3
+ const require_config = require('./config-CjGpscVk.cjs');
4
+ const require_context = require('./context-B-Wcmhb3.cjs');
5
+ const require_utils = require('./utils-CVQFvsfl.cjs');
6
+
7
+ exports.AccountType = require_account.AccountType;
8
+ exports.AuthClient = require_clients.AuthClient;
9
+ exports.ConfigClient = require_clients.ConfigClient;
10
+ exports.DelegationClient = require_clients.DelegationClient;
11
+ exports.Environment = require_config.Environment;
12
+ exports.OrchestrationClient = require_clients.OrchestrationClient;
13
+ exports.PaymentRequestsClient = require_clients.PaymentRequestsClient;
14
+ exports.SIWE_CHAIN_ID = require_config.SIWE_CHAIN_ID;
15
+ exports.SIWE_VERSION = require_config.SIWE_VERSION;
16
+ exports.ServerAccountType = require_account.ServerAccountType;
17
+ exports.assertRequiresAuth = require_context.assertRequiresAuth;
18
+ exports.assertServerContext = require_context.assertServerContext;
19
+ exports.createClientContext = require_account.createClientContext;
20
+ exports.createEIP2098Signature = require_utils.createEIP2098Signature;
21
+ exports.createLoginSiweMessage = require_config.createLoginSiweMessage;
22
+ exports.createRlpEncodedAuthorization = require_utils.createRlpEncodedAuthorization;
23
+ exports.env = require_config.env;
24
+ exports.getApiUrl = require_config.getApiUrl;
25
+ exports.getTurnkeyApiUrl = require_config.getTurnkeyApiUrl;
26
+ exports.isApiAccountConfig = require_account.isApiAccountConfig;
27
+ exports.isEnvironment = require_config.isEnvironment;
28
+ exports.isPrivateKeyAccountConfig = require_account.isPrivateKeyAccountConfig;
29
+ exports.isServerContext = require_context.isServerContext;
30
+ exports.normalizeYParityValue = require_utils.normalizeYParityValue;
31
+ exports.parseSignatureToVRS = require_utils.parseSignatureToVRS;
@@ -0,0 +1,8 @@
1
+ import "./abi-CQuxrNCU.cjs";
2
+ import "./misc-CpZxSPCP.cjs";
3
+ import { i as normalizeYParityValue, n as parseSignatureToVRS, r as createRlpEncodedAuthorization, t as createEIP2098Signature } from "./index-BnP8vpJJ.cjs";
4
+ import { a as AccountType, c as OtimAccountSignMessageArgs, d as ServerAccountType, i as AccountConfig, l as PrivateKeyAccountConfig, n as isApiAccountConfig, o as ApiAccountConfig, r as isPrivateKeyAccountConfig, s as OtimAccount, t as createClientContext, u as ServerAccountConfig } from "./index-DK-40z4V.cjs";
5
+ import { a as PaymentRequestsClient, c as AuthClient, i as CreatePaymentRequestResponse, l as LoginOptions, n as ActivatePaymentRequestParams, o as DelegationClient, r as CreatePaymentRequestParameters, s as ConfigClient, t as OrchestrationClient } from "./index-De8OZ-Be.cjs";
6
+ import { a as env, c as isEnvironment, i as Environment, n as SIWE_VERSION, o as getApiUrl, r as createLoginSiweMessage, s as getTurnkeyApiUrl, t as SIWE_CHAIN_ID } from "./index-UnaahQgb.cjs";
7
+ import { a as OtimReactClientContext, i as OtimClientContext, n as assertRequiresAuth, o as OtimServerClientContext, r as assertServerContext, t as isServerContext } from "./index-C1HSAemv.cjs";
8
+ export { AccountConfig, AccountType, ActivatePaymentRequestParams, ApiAccountConfig, AuthClient, ConfigClient, CreatePaymentRequestParameters, CreatePaymentRequestResponse, DelegationClient, Environment, Environment as EnvironmentType, LoginOptions, OrchestrationClient, OtimAccount, OtimAccountSignMessageArgs, OtimClientContext, OtimReactClientContext, OtimServerClientContext, PaymentRequestsClient, PrivateKeyAccountConfig, SIWE_CHAIN_ID, SIWE_VERSION, ServerAccountConfig, ServerAccountType, assertRequiresAuth, assertServerContext, createClientContext, createEIP2098Signature, createLoginSiweMessage, createRlpEncodedAuthorization, env, getApiUrl, getTurnkeyApiUrl, isApiAccountConfig, isEnvironment, isPrivateKeyAccountConfig, isServerContext, normalizeYParityValue, parseSignatureToVRS };
@@ -0,0 +1,8 @@
1
+ import "./abi-Bd3X6gV9.mjs";
2
+ import "./misc-CX4pLJaA.mjs";
3
+ import { i as normalizeYParityValue, n as parseSignatureToVRS, r as createRlpEncodedAuthorization, t as createEIP2098Signature } from "./index-DW_zBRKz.mjs";
4
+ import { a as AccountType, c as OtimAccountSignMessageArgs, d as ServerAccountType, i as AccountConfig, l as PrivateKeyAccountConfig, n as isApiAccountConfig, o as ApiAccountConfig, r as isPrivateKeyAccountConfig, s as OtimAccount, t as createClientContext, u as ServerAccountConfig } from "./index-B4fkcFy5.mjs";
5
+ import { a as PaymentRequestsClient, c as AuthClient, i as CreatePaymentRequestResponse, l as LoginOptions, n as ActivatePaymentRequestParams, o as DelegationClient, r as CreatePaymentRequestParameters, s as ConfigClient, t as OrchestrationClient } from "./index-e5BLgzcW.mjs";
6
+ import { a as env, c as isEnvironment, i as Environment, n as SIWE_VERSION, o as getApiUrl, r as createLoginSiweMessage, s as getTurnkeyApiUrl, t as SIWE_CHAIN_ID } from "./index-C4N2Xixk.mjs";
7
+ import { a as OtimReactClientContext, i as OtimClientContext, n as assertRequiresAuth, o as OtimServerClientContext, r as assertServerContext, t as isServerContext } from "./index-CcCMIBgF.mjs";
8
+ export { AccountConfig, AccountType, ActivatePaymentRequestParams, ApiAccountConfig, AuthClient, ConfigClient, CreatePaymentRequestParameters, CreatePaymentRequestResponse, DelegationClient, Environment, Environment as EnvironmentType, LoginOptions, OrchestrationClient, OtimAccount, OtimAccountSignMessageArgs, OtimClientContext, OtimReactClientContext, OtimServerClientContext, PaymentRequestsClient, PrivateKeyAccountConfig, SIWE_CHAIN_ID, SIWE_VERSION, ServerAccountConfig, ServerAccountType, assertRequiresAuth, assertServerContext, createClientContext, createEIP2098Signature, createLoginSiweMessage, createRlpEncodedAuthorization, env, getApiUrl, getTurnkeyApiUrl, isApiAccountConfig, isEnvironment, isPrivateKeyAccountConfig, isServerContext, normalizeYParityValue, parseSignatureToVRS };
package/dist/index.mjs ADDED
@@ -0,0 +1,7 @@
1
+ import { a as ServerAccountType, i as AccountType, n as isApiAccountConfig, r as isPrivateKeyAccountConfig, t as createClientContext } from "./account-p4sxzIt3.mjs";
2
+ import { a as AuthClient, i as ConfigClient, n as PaymentRequestsClient, r as DelegationClient, t as OrchestrationClient } from "./clients-DMKeLhcJ.mjs";
3
+ import { a as env, c as isEnvironment, i as Environment, n as SIWE_VERSION, o as getApiUrl, r as createLoginSiweMessage, s as getTurnkeyApiUrl, t as SIWE_CHAIN_ID } from "./config-C_nc1DXn.mjs";
4
+ import { n as assertRequiresAuth, r as assertServerContext, t as isServerContext } from "./context-uTye69B0.mjs";
5
+ import { i as normalizeYParityValue, n as parseSignatureToVRS, r as createRlpEncodedAuthorization, t as createEIP2098Signature } from "./utils-DziAHBiz.mjs";
6
+
7
+ export { AccountType, AuthClient, ConfigClient, DelegationClient, Environment, OrchestrationClient, PaymentRequestsClient, SIWE_CHAIN_ID, SIWE_VERSION, ServerAccountType, assertRequiresAuth, assertServerContext, createClientContext, createEIP2098Signature, createLoginSiweMessage, createRlpEncodedAuthorization, env, getApiUrl, getTurnkeyApiUrl, isApiAccountConfig, isEnvironment, isPrivateKeyAccountConfig, isServerContext, normalizeYParityValue, parseSignatureToVRS };
@@ -0,0 +1,42 @@
1
+ //#region ../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_types/types/utils.d.ts
2
+
3
+ /**
4
+ * @description Combines members of an intersection into a readable type.
5
+ *
6
+ * @see {@link https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg}
7
+ * @example
8
+ * Prettify<{ a: string } & { b: string } & { c: number, d: bigint }>
9
+ * => { a: string, b: string, c: number, d: bigint }
10
+ */
11
+ type Prettify<T> = { [K in keyof T]: T[K] } & {};
12
+ type ExactPartial<type> = { [key in keyof type]?: type[key] | undefined };
13
+ type OneOf<union extends object, fallback extends object | undefined = undefined, keys extends KeyofUnion<union> = KeyofUnion<union>> = union extends infer item ? Prettify<item & { [key in Exclude<keys, keyof item>]?: fallback extends object ? key extends keyof fallback ? fallback[key] : undefined : undefined }> : never;
14
+ type KeyofUnion<type> = type extends type ? keyof type : never;
15
+ /**
16
+ * Loose version of {@link Omit}
17
+ * @internal
18
+ */
19
+ //#endregion
20
+ //#region ../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_types/types/misc.d.ts
21
+ type Hex = `0x${string}`;
22
+ type SignatureLegacy<bigintType = bigint> = {
23
+ r: Hex;
24
+ s: Hex;
25
+ v: bigintType;
26
+ };
27
+ type Signature<numberType = number, bigintType = bigint> = OneOf<SignatureLegacy | {
28
+ r: Hex;
29
+ s: Hex;
30
+ /** @deprecated use `yParity`. */
31
+ v: bigintType;
32
+ yParity?: numberType | undefined;
33
+ } | {
34
+ r: Hex;
35
+ s: Hex;
36
+ /** @deprecated use `yParity`. */
37
+ v?: bigintType | undefined;
38
+ yParity: numberType;
39
+ }>;
40
+ //#endregion
41
+ export { Signature as n, ExactPartial as r, Hex as t };
42
+ //# sourceMappingURL=misc-CX4pLJaA.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"misc-CX4pLJaA.d.mts","names":["symbol","Branded","T","U","Filter","P","Acc","F","Rest","IsNarrowable","IsNever","Mutable","type","key","Or","Head","Tail","IsUndefined","MaybePromise","Promise","MaybeRequired","required","ExactRequired","Assign","Assign_","K","NoInfer","NoUndefined","Omit","keys","Exclude","Pick","PartialBy","ExactPartial","Prettify","Evaluate","RequiredBy","Some","array","value","rest","ValueOf","UnionToTuple","union","last","LastInUnion","UnionToIntersection","l","i","IsUnion","union2","MaybePartial","enabled","OneOf","fallback","KeyofUnion","item","LooseOmit","UnionEvaluate","UnionLooseOmit","UnionOmit","UnionPick","UnionPartialBy","UnionRequiredBy","OneOf","ByteArray","Uint8Array","Hex","Hash","LogTopic","SignableMessage","SignatureLegacy","bigintType","Signature","numberType","CompactSignature"],"sources":["../../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_types/types/utils.d.ts","../../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_types/types/misc.d.ts"],"sourcesContent":["declare const symbol: unique symbol;\n/**\n * Creates a branded type of {@link T} with the brand {@link U}.\n *\n * @param T - Type to brand\n * @param U - Label\n * @returns Branded type\n *\n * @example\n * type Result = Branded<string, 'foo'>\n * // ^? type Result = string & { [symbol]: 'foo' }\n */\nexport type Branded<T, U> = T & {\n [symbol]: U;\n};\n/**\n * Filters out all members of {@link T} that are not {@link P}\n *\n * @param T - Items to filter\n * @param P - Type to filter out\n * @returns Filtered items\n *\n * @example\n * type Result = Filter<['a', 'b', 'c'], 'b'>\n * // ^? type Result = ['a', 'c']\n */\nexport type Filter<T extends readonly unknown[], P, Acc extends readonly unknown[] = []> = T extends readonly [infer F, ...infer Rest extends readonly unknown[]] ? [F] extends [P] ? Filter<Rest, P, [...Acc, F]> : Filter<Rest, P, Acc> : readonly [...Acc];\n/**\n * @description Checks if {@link T} can be narrowed further than {@link U}\n * @param T - Type to check\n * @param U - Type to against\n * @example\n * type Result = IsNarrowable<'foo', string>\n * // ^? true\n */\nexport type IsNarrowable<T, U> = IsNever<(T extends U ? true : false) & (U extends T ? false : true)> extends true ? false : true;\n/**\n * @description Checks if {@link T} is `never`\n * @param T - Type to check\n * @example\n * type Result = IsNever<never>\n * // ^? type Result = true\n */\nexport type IsNever<T> = [T] extends [never] ? true : false;\n/** Removes `readonly` from all properties of an object. */\nexport type Mutable<type extends object> = {\n -readonly [key in keyof type]: type[key];\n};\n/**\n * @description Evaluates boolean \"or\" condition for {@link T} properties.\n * @param T - Type to check\n *\n * * @example\n * type Result = Or<[false, true, false]>\n * // ^? type Result = true\n *\n * @example\n * type Result = Or<[false, false, false]>\n * // ^? type Result = false\n */\nexport type Or<T extends readonly unknown[]> = T extends readonly [\n infer Head,\n ...infer Tail\n] ? Head extends true ? true : Or<Tail> : false;\n/**\n * @description Checks if {@link T} is `undefined`\n * @param T - Type to check\n * @example\n * type Result = IsUndefined<undefined>\n * // ^? type Result = true\n */\nexport type IsUndefined<T> = [undefined] extends [T] ? true : false;\nexport type MaybePromise<T> = T | Promise<T>;\n/**\n * @description Makes attributes on the type T required if required is true.\n *\n * @example\n * MaybeRequired<{ a: string, b?: number }, true>\n * => { a: string, b: number }\n *\n * MaybeRequired<{ a: string, b?: number }, false>\n * => { a: string, b?: number }\n */\nexport type MaybeRequired<T, required extends boolean> = required extends true ? ExactRequired<T> : T;\n/**\n * @description Assigns the properties of U onto T.\n *\n * @example\n * Assign<{ a: string, b: number }, { a: undefined, c: boolean }>\n * => { a: undefined, b: number, c: boolean }\n */\nexport type Assign<T, U> = Assign_<T, U> & U;\ntype Assign_<T, U> = {\n [K in keyof T as K extends keyof U ? U[K] extends void ? never : K : K]: K extends keyof U ? U[K] : T[K];\n};\nexport type NoInfer<type> = [type][type extends any ? 0 : never];\n/**\n * @description Constructs a type by excluding `undefined` from `T`.\n *\n * @example\n * NoUndefined<string | undefined>\n * => string\n *\n * @internal\n */\nexport type NoUndefined<T> = T extends undefined ? never : T;\n/** Strict version of built-in Omit type */\nexport type Omit<type, keys extends keyof type> = Pick<type, Exclude<keyof type, keys>>;\n/**\n * @description Creates a type that is a partial of T, but with the required keys K.\n *\n * @example\n * PartialBy<{ a: string, b: number }, 'a'>\n * => { a?: string, b: number }\n */\nexport type PartialBy<T, K extends keyof T> = Omit<T, K> & ExactPartial<Pick<T, K>>;\n/**\n * @description Combines members of an intersection into a readable type.\n *\n * @see {@link https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg}\n * @example\n * Prettify<{ a: string } & { b: string } & { c: number, d: bigint }>\n * => { a: string, b: string, c: number, d: bigint }\n */\nexport type Prettify<T> = {\n [K in keyof T]: T[K];\n} & {};\n/** @internal */\nexport type Evaluate<type> = {\n [key in keyof type]: type[key];\n} & {};\n/**\n * @description Creates a type that is T with the required keys K.\n *\n * @example\n * RequiredBy<{ a?: string, b: number }, 'a'>\n * => { a: string, b: number }\n */\nexport type RequiredBy<T, K extends keyof T> = Omit<T, K> & ExactRequired<Pick<T, K>>;\n/**\n * @description Returns truthy if `array` contains `value`.\n *\n * @example\n * Some<[1, 2, 3], 2>\n * => true\n */\nexport type Some<array extends readonly unknown[], value> = array extends readonly [value, ...unknown[]] ? true : array extends readonly [unknown, ...infer rest] ? Some<rest, value> : false;\n/**\n * @description Creates a type that extracts the values of T.\n *\n * @example\n * ValueOf<{ a: string, b: number }>\n * => string | number\n *\n * @internal\n */\nexport type ValueOf<T> = T[keyof T];\nexport type UnionToTuple<union, last = LastInUnion<union>> = [union] extends [never] ? [] : [...UnionToTuple<Exclude<union, last>>, last];\ntype LastInUnion<U> = UnionToIntersection<U extends unknown ? (x: U) => 0 : never> extends (x: infer l) => 0 ? l : never;\ntype UnionToIntersection<union> = (union extends unknown ? (arg: union) => 0 : never) extends (arg: infer i) => 0 ? i : never;\nexport type IsUnion<union, union2 = union> = union extends union2 ? ([union2] extends [union] ? false : true) : never;\nexport type MaybePartial<type, enabled extends boolean | undefined> = enabled extends true ? Prettify<ExactPartial<type>> : type;\nexport type ExactPartial<type> = {\n [key in keyof type]?: type[key] | undefined;\n};\nexport type ExactRequired<type> = {\n [P in keyof type]-?: Exclude<type[P], undefined>;\n};\nexport type OneOf<union extends object, fallback extends object | undefined = undefined, keys extends KeyofUnion<union> = KeyofUnion<union>> = union extends infer item ? Prettify<item & {\n [key in Exclude<keys, keyof item>]?: fallback extends object ? key extends keyof fallback ? fallback[key] : undefined : undefined;\n}> : never;\ntype KeyofUnion<type> = type extends type ? keyof type : never;\n/**\n * Loose version of {@link Omit}\n * @internal\n */\nexport type LooseOmit<type, keys extends string> = Pick<type, Exclude<keyof type, keys>>;\nexport type UnionEvaluate<type> = type extends object ? Prettify<type> : type;\nexport type UnionLooseOmit<type, keys extends string> = type extends any ? LooseOmit<type, keys> : never;\n/**\n * @description Construct a type with the properties of union type T except for those in type K.\n * @example\n * type Result = UnionOmit<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>\n * => { b: number } | { b: undefined, c: number }\n */\nexport type UnionOmit<type, keys extends keyof type> = type extends any ? Omit<type, keys> : never;\n/**\n * @description Construct a type with the properties of union type T except for those in type K.\n * @example\n * type Result = UnionOmit<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>\n * => { b: number } | { b: undefined, c: number }\n */\nexport type UnionPick<type, keys extends keyof type> = type extends any ? Pick<type, keys> : never;\n/**\n * @description Creates a type that is a partial of T, but with the required keys K.\n *\n * @example\n * PartialBy<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>\n * => { a?: string, b: number } | { a?: string, b: undefined, c: number }\n */\nexport type UnionPartialBy<T, K extends keyof T> = T extends any ? PartialBy<T, K> : never;\n/**\n * @description Creates a type that is T with the required keys K.\n *\n * @example\n * RequiredBy<{ a?: string, b: number } | { a?: string, c?: number }, 'a'>\n * => { a: string, b: number } | { a: string, c?: number }\n */\nexport type UnionRequiredBy<T, K extends keyof T> = T extends any ? RequiredBy<T, K> : never;\nexport {};\n//# sourceMappingURL=utils.d.ts.map","import type { OneOf } from './utils.js';\nexport type ByteArray = Uint8Array;\nexport type Hex = `0x${string}`;\nexport type Hash = `0x${string}`;\nexport type LogTopic = Hex | Hex[] | null;\nexport type SignableMessage = string | {\n /** Raw data representation of the message. */\n raw: Hex | ByteArray;\n};\nexport type SignatureLegacy<bigintType = bigint> = {\n r: Hex;\n s: Hex;\n v: bigintType;\n};\nexport type Signature<numberType = number, bigintType = bigint> = OneOf<SignatureLegacy | {\n r: Hex;\n s: Hex;\n /** @deprecated use `yParity`. */\n v: bigintType;\n yParity?: numberType | undefined;\n} | {\n r: Hex;\n s: Hex;\n /** @deprecated use `yParity`. */\n v?: bigintType | undefined;\n yParity: numberType;\n}>;\nexport type CompactSignature = {\n r: Hex;\n yParityAndS: Hex;\n};\n//# sourceMappingURL=misc.d.ts.map"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;;;KA4HYkC,4BACIhC,IAAIA,EAAEuB;KAqCVQ,qCACMrB,QAAQA,KAAKC;KAKnBwC,0FAA0FE,WAAWZ,SAASY,WAAWZ,UAAUA,2BAA2BT,SAASsB,iBACvK1B,QAAQD,YAAY2B,SAASF,0BAA0BzC,kBAAkByC,WAAWA,SAASzC;KAEpG0C,mBAAmB3C,aAAaA,aAAaA;;;;;;;AA9ClCV,KC3HJiE,GAAAA,GD2HIjE,KAAAA,MAAAA,EAAAA;AAsCeW,KC1JnB0D,eD0JmB1D,CAAAA,aAAAA,MAAAA,CAAAA,GAAAA;EAAG,CAAA,ECzJ3BsD,GDyJ2B;EAKtBd,CAAAA,EC7JLc,GD6JKd;EAAqGV,CAAAA,EC5J1G6B,UD4J0G7B;CAAXY;AAA+BZ,KC1JzH8B,SD0JyH9B,CAAAA,aAAAA,MAAAA,EAAAA,aAAAA,MAAAA,CAAAA,GC1JnEqB,KD0JmErB,CC1J7D4B,eD0J6D5B,GAAAA;EAAXY,CAAAA,ECzJnHY,GDyJmHZ;EAAqBZ,CAAAA,ECxJxIwB,GDwJwIxB;EAAoCa;EAC/J3B,CAAAA,ECvJb2C,UDuJa3C;EAAY2B,OAAAA,CAAAA,ECtJlBkB,UDsJkBlB,GAAAA,SAAAA;CAApB1B,GAAAA;EAA6BwB,CAAAA,ECpJlCa,GDoJkCb;EAA0BzC,CAAAA,ECnJ5DsD,GDmJ4DtD;EAAkByC;EAAWA,CAAAA,CAAAA,ECjJxFkB,UDiJwFlB,GAAAA,SAAAA;EAASzC,OAAAA,EChJ5F6D,UDgJ4F7D;CADiEqB,CAAAA"}
@@ -0,0 +1,42 @@
1
+ //#region ../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_types/types/utils.d.ts
2
+
3
+ /**
4
+ * @description Combines members of an intersection into a readable type.
5
+ *
6
+ * @see {@link https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg}
7
+ * @example
8
+ * Prettify<{ a: string } & { b: string } & { c: number, d: bigint }>
9
+ * => { a: string, b: string, c: number, d: bigint }
10
+ */
11
+ type Prettify<T> = { [K in keyof T]: T[K] } & {};
12
+ type ExactPartial<type> = { [key in keyof type]?: type[key] | undefined };
13
+ type OneOf<union extends object, fallback extends object | undefined = undefined, keys extends KeyofUnion<union> = KeyofUnion<union>> = union extends infer item ? Prettify<item & { [key in Exclude<keys, keyof item>]?: fallback extends object ? key extends keyof fallback ? fallback[key] : undefined : undefined }> : never;
14
+ type KeyofUnion<type> = type extends type ? keyof type : never;
15
+ /**
16
+ * Loose version of {@link Omit}
17
+ * @internal
18
+ */
19
+ //#endregion
20
+ //#region ../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_types/types/misc.d.ts
21
+ type Hex = `0x${string}`;
22
+ type SignatureLegacy<bigintType = bigint> = {
23
+ r: Hex;
24
+ s: Hex;
25
+ v: bigintType;
26
+ };
27
+ type Signature<numberType = number, bigintType = bigint> = OneOf<SignatureLegacy | {
28
+ r: Hex;
29
+ s: Hex;
30
+ /** @deprecated use `yParity`. */
31
+ v: bigintType;
32
+ yParity?: numberType | undefined;
33
+ } | {
34
+ r: Hex;
35
+ s: Hex;
36
+ /** @deprecated use `yParity`. */
37
+ v?: bigintType | undefined;
38
+ yParity: numberType;
39
+ }>;
40
+ //#endregion
41
+ export { Signature as n, ExactPartial as r, Hex as t };
42
+ //# sourceMappingURL=misc-CpZxSPCP.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"misc-CpZxSPCP.d.cts","names":["symbol","Branded","T","U","Filter","P","Acc","F","Rest","IsNarrowable","IsNever","Mutable","type","key","Or","Head","Tail","IsUndefined","MaybePromise","Promise","MaybeRequired","required","ExactRequired","Assign","Assign_","K","NoInfer","NoUndefined","Omit","keys","Exclude","Pick","PartialBy","ExactPartial","Prettify","Evaluate","RequiredBy","Some","array","value","rest","ValueOf","UnionToTuple","union","last","LastInUnion","UnionToIntersection","l","i","IsUnion","union2","MaybePartial","enabled","OneOf","fallback","KeyofUnion","item","LooseOmit","UnionEvaluate","UnionLooseOmit","UnionOmit","UnionPick","UnionPartialBy","UnionRequiredBy","OneOf","ByteArray","Uint8Array","Hex","Hash","LogTopic","SignableMessage","SignatureLegacy","bigintType","Signature","numberType","CompactSignature"],"sources":["../../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_types/types/utils.d.ts","../../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_types/types/misc.d.ts"],"sourcesContent":["declare const symbol: unique symbol;\n/**\n * Creates a branded type of {@link T} with the brand {@link U}.\n *\n * @param T - Type to brand\n * @param U - Label\n * @returns Branded type\n *\n * @example\n * type Result = Branded<string, 'foo'>\n * // ^? type Result = string & { [symbol]: 'foo' }\n */\nexport type Branded<T, U> = T & {\n [symbol]: U;\n};\n/**\n * Filters out all members of {@link T} that are not {@link P}\n *\n * @param T - Items to filter\n * @param P - Type to filter out\n * @returns Filtered items\n *\n * @example\n * type Result = Filter<['a', 'b', 'c'], 'b'>\n * // ^? type Result = ['a', 'c']\n */\nexport type Filter<T extends readonly unknown[], P, Acc extends readonly unknown[] = []> = T extends readonly [infer F, ...infer Rest extends readonly unknown[]] ? [F] extends [P] ? Filter<Rest, P, [...Acc, F]> : Filter<Rest, P, Acc> : readonly [...Acc];\n/**\n * @description Checks if {@link T} can be narrowed further than {@link U}\n * @param T - Type to check\n * @param U - Type to against\n * @example\n * type Result = IsNarrowable<'foo', string>\n * // ^? true\n */\nexport type IsNarrowable<T, U> = IsNever<(T extends U ? true : false) & (U extends T ? false : true)> extends true ? false : true;\n/**\n * @description Checks if {@link T} is `never`\n * @param T - Type to check\n * @example\n * type Result = IsNever<never>\n * // ^? type Result = true\n */\nexport type IsNever<T> = [T] extends [never] ? true : false;\n/** Removes `readonly` from all properties of an object. */\nexport type Mutable<type extends object> = {\n -readonly [key in keyof type]: type[key];\n};\n/**\n * @description Evaluates boolean \"or\" condition for {@link T} properties.\n * @param T - Type to check\n *\n * * @example\n * type Result = Or<[false, true, false]>\n * // ^? type Result = true\n *\n * @example\n * type Result = Or<[false, false, false]>\n * // ^? type Result = false\n */\nexport type Or<T extends readonly unknown[]> = T extends readonly [\n infer Head,\n ...infer Tail\n] ? Head extends true ? true : Or<Tail> : false;\n/**\n * @description Checks if {@link T} is `undefined`\n * @param T - Type to check\n * @example\n * type Result = IsUndefined<undefined>\n * // ^? type Result = true\n */\nexport type IsUndefined<T> = [undefined] extends [T] ? true : false;\nexport type MaybePromise<T> = T | Promise<T>;\n/**\n * @description Makes attributes on the type T required if required is true.\n *\n * @example\n * MaybeRequired<{ a: string, b?: number }, true>\n * => { a: string, b: number }\n *\n * MaybeRequired<{ a: string, b?: number }, false>\n * => { a: string, b?: number }\n */\nexport type MaybeRequired<T, required extends boolean> = required extends true ? ExactRequired<T> : T;\n/**\n * @description Assigns the properties of U onto T.\n *\n * @example\n * Assign<{ a: string, b: number }, { a: undefined, c: boolean }>\n * => { a: undefined, b: number, c: boolean }\n */\nexport type Assign<T, U> = Assign_<T, U> & U;\ntype Assign_<T, U> = {\n [K in keyof T as K extends keyof U ? U[K] extends void ? never : K : K]: K extends keyof U ? U[K] : T[K];\n};\nexport type NoInfer<type> = [type][type extends any ? 0 : never];\n/**\n * @description Constructs a type by excluding `undefined` from `T`.\n *\n * @example\n * NoUndefined<string | undefined>\n * => string\n *\n * @internal\n */\nexport type NoUndefined<T> = T extends undefined ? never : T;\n/** Strict version of built-in Omit type */\nexport type Omit<type, keys extends keyof type> = Pick<type, Exclude<keyof type, keys>>;\n/**\n * @description Creates a type that is a partial of T, but with the required keys K.\n *\n * @example\n * PartialBy<{ a: string, b: number }, 'a'>\n * => { a?: string, b: number }\n */\nexport type PartialBy<T, K extends keyof T> = Omit<T, K> & ExactPartial<Pick<T, K>>;\n/**\n * @description Combines members of an intersection into a readable type.\n *\n * @see {@link https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg}\n * @example\n * Prettify<{ a: string } & { b: string } & { c: number, d: bigint }>\n * => { a: string, b: string, c: number, d: bigint }\n */\nexport type Prettify<T> = {\n [K in keyof T]: T[K];\n} & {};\n/** @internal */\nexport type Evaluate<type> = {\n [key in keyof type]: type[key];\n} & {};\n/**\n * @description Creates a type that is T with the required keys K.\n *\n * @example\n * RequiredBy<{ a?: string, b: number }, 'a'>\n * => { a: string, b: number }\n */\nexport type RequiredBy<T, K extends keyof T> = Omit<T, K> & ExactRequired<Pick<T, K>>;\n/**\n * @description Returns truthy if `array` contains `value`.\n *\n * @example\n * Some<[1, 2, 3], 2>\n * => true\n */\nexport type Some<array extends readonly unknown[], value> = array extends readonly [value, ...unknown[]] ? true : array extends readonly [unknown, ...infer rest] ? Some<rest, value> : false;\n/**\n * @description Creates a type that extracts the values of T.\n *\n * @example\n * ValueOf<{ a: string, b: number }>\n * => string | number\n *\n * @internal\n */\nexport type ValueOf<T> = T[keyof T];\nexport type UnionToTuple<union, last = LastInUnion<union>> = [union] extends [never] ? [] : [...UnionToTuple<Exclude<union, last>>, last];\ntype LastInUnion<U> = UnionToIntersection<U extends unknown ? (x: U) => 0 : never> extends (x: infer l) => 0 ? l : never;\ntype UnionToIntersection<union> = (union extends unknown ? (arg: union) => 0 : never) extends (arg: infer i) => 0 ? i : never;\nexport type IsUnion<union, union2 = union> = union extends union2 ? ([union2] extends [union] ? false : true) : never;\nexport type MaybePartial<type, enabled extends boolean | undefined> = enabled extends true ? Prettify<ExactPartial<type>> : type;\nexport type ExactPartial<type> = {\n [key in keyof type]?: type[key] | undefined;\n};\nexport type ExactRequired<type> = {\n [P in keyof type]-?: Exclude<type[P], undefined>;\n};\nexport type OneOf<union extends object, fallback extends object | undefined = undefined, keys extends KeyofUnion<union> = KeyofUnion<union>> = union extends infer item ? Prettify<item & {\n [key in Exclude<keys, keyof item>]?: fallback extends object ? key extends keyof fallback ? fallback[key] : undefined : undefined;\n}> : never;\ntype KeyofUnion<type> = type extends type ? keyof type : never;\n/**\n * Loose version of {@link Omit}\n * @internal\n */\nexport type LooseOmit<type, keys extends string> = Pick<type, Exclude<keyof type, keys>>;\nexport type UnionEvaluate<type> = type extends object ? Prettify<type> : type;\nexport type UnionLooseOmit<type, keys extends string> = type extends any ? LooseOmit<type, keys> : never;\n/**\n * @description Construct a type with the properties of union type T except for those in type K.\n * @example\n * type Result = UnionOmit<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>\n * => { b: number } | { b: undefined, c: number }\n */\nexport type UnionOmit<type, keys extends keyof type> = type extends any ? Omit<type, keys> : never;\n/**\n * @description Construct a type with the properties of union type T except for those in type K.\n * @example\n * type Result = UnionOmit<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>\n * => { b: number } | { b: undefined, c: number }\n */\nexport type UnionPick<type, keys extends keyof type> = type extends any ? Pick<type, keys> : never;\n/**\n * @description Creates a type that is a partial of T, but with the required keys K.\n *\n * @example\n * PartialBy<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>\n * => { a?: string, b: number } | { a?: string, b: undefined, c: number }\n */\nexport type UnionPartialBy<T, K extends keyof T> = T extends any ? PartialBy<T, K> : never;\n/**\n * @description Creates a type that is T with the required keys K.\n *\n * @example\n * RequiredBy<{ a?: string, b: number } | { a?: string, c?: number }, 'a'>\n * => { a: string, b: number } | { a: string, c?: number }\n */\nexport type UnionRequiredBy<T, K extends keyof T> = T extends any ? RequiredBy<T, K> : never;\nexport {};\n//# sourceMappingURL=utils.d.ts.map","import type { OneOf } from './utils.js';\nexport type ByteArray = Uint8Array;\nexport type Hex = `0x${string}`;\nexport type Hash = `0x${string}`;\nexport type LogTopic = Hex | Hex[] | null;\nexport type SignableMessage = string | {\n /** Raw data representation of the message. */\n raw: Hex | ByteArray;\n};\nexport type SignatureLegacy<bigintType = bigint> = {\n r: Hex;\n s: Hex;\n v: bigintType;\n};\nexport type Signature<numberType = number, bigintType = bigint> = OneOf<SignatureLegacy | {\n r: Hex;\n s: Hex;\n /** @deprecated use `yParity`. */\n v: bigintType;\n yParity?: numberType | undefined;\n} | {\n r: Hex;\n s: Hex;\n /** @deprecated use `yParity`. */\n v?: bigintType | undefined;\n yParity: numberType;\n}>;\nexport type CompactSignature = {\n r: Hex;\n yParityAndS: Hex;\n};\n//# sourceMappingURL=misc.d.ts.map"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;;;KA4HYkC,4BACIhC,IAAIA,EAAEuB;KAqCVQ,qCACMrB,QAAQA,KAAKC;KAKnBwC,0FAA0FE,WAAWZ,SAASY,WAAWZ,UAAUA,2BAA2BT,SAASsB,iBACvK1B,QAAQD,YAAY2B,SAASF,0BAA0BzC,kBAAkByC,WAAWA,SAASzC;KAEpG0C,mBAAmB3C,aAAaA,aAAaA;;;;;;;AA9ClCV,KC3HJiE,GAAAA,GD2HIjE,KAAAA,MAAAA,EAAAA;AAsCeW,KC1JnB0D,eD0JmB1D,CAAAA,aAAAA,MAAAA,CAAAA,GAAAA;EAAG,CAAA,ECzJ3BsD,GDyJ2B;EAKtBd,CAAAA,EC7JLc,GD6JKd;EAAqGV,CAAAA,EC5J1G6B,UD4J0G7B;CAAXY;AAA+BZ,KC1JzH8B,SD0JyH9B,CAAAA,aAAAA,MAAAA,EAAAA,aAAAA,MAAAA,CAAAA,GC1JnEqB,KD0JmErB,CC1J7D4B,eD0J6D5B,GAAAA;EAAXY,CAAAA,ECzJnHY,GDyJmHZ;EAAqBZ,CAAAA,ECxJxIwB,GDwJwIxB;EAAoCa;EAC/J3B,CAAAA,ECvJb2C,UDuJa3C;EAAY2B,OAAAA,CAAAA,ECtJlBkB,UDsJkBlB,GAAAA,SAAAA;CAApB1B,GAAAA;EAA6BwB,CAAAA,ECpJlCa,GDoJkCb;EAA0BzC,CAAAA,ECnJ5DsD,GDmJ4DtD;EAAkByC;EAAWA,CAAAA,CAAAA,ECjJxFkB,UDiJwFlB,GAAAA,SAAAA;EAASzC,OAAAA,EChJ5F6D,UDgJ4F7D;CADiEqB,CAAAA"}
@@ -0,0 +1,6 @@
1
+ const require_utils = require('../utils-CVQFvsfl.cjs');
2
+
3
+ exports.createEIP2098Signature = require_utils.createEIP2098Signature;
4
+ exports.createRlpEncodedAuthorization = require_utils.createRlpEncodedAuthorization;
5
+ exports.normalizeYParityValue = require_utils.normalizeYParityValue;
6
+ exports.parseSignatureToVRS = require_utils.parseSignatureToVRS;
@@ -0,0 +1,4 @@
1
+ import "../abi-CQuxrNCU.cjs";
2
+ import "../misc-CpZxSPCP.cjs";
3
+ import { i as normalizeYParityValue, n as parseSignatureToVRS, r as createRlpEncodedAuthorization, t as createEIP2098Signature } from "../index-BnP8vpJJ.cjs";
4
+ export { createEIP2098Signature, createRlpEncodedAuthorization, normalizeYParityValue, parseSignatureToVRS };
@@ -0,0 +1,4 @@
1
+ import "../abi-Bd3X6gV9.mjs";
2
+ import "../misc-CX4pLJaA.mjs";
3
+ import { i as normalizeYParityValue, n as parseSignatureToVRS, r as createRlpEncodedAuthorization, t as createEIP2098Signature } from "../index-DW_zBRKz.mjs";
4
+ export { createEIP2098Signature, createRlpEncodedAuthorization, normalizeYParityValue, parseSignatureToVRS };
@@ -0,0 +1,3 @@
1
+ import { i as normalizeYParityValue, n as parseSignatureToVRS, r as createRlpEncodedAuthorization, t as createEIP2098Signature } from "../utils-DziAHBiz.mjs";
2
+
3
+ export { createEIP2098Signature, createRlpEncodedAuthorization, normalizeYParityValue, parseSignatureToVRS };
@@ -0,0 +1,104 @@
1
+ let viem = require("viem");
2
+
3
+ //#region src/utils/rlp.ts
4
+ const ensureHexPrefix = (value) => value.startsWith("0x") ? value : `0x${value}`;
5
+ const normalizeYParityValue = (value) => {
6
+ if (value === void 0 || value === null) return 0;
7
+ let numericValue;
8
+ if (typeof value === "number") numericValue = value;
9
+ else if (typeof value === "bigint") numericValue = Number(value);
10
+ else if (typeof value === "string") {
11
+ const trimmed = value.trim();
12
+ const parsed = trimmed.startsWith("0x") ? parseInt(trimmed, 16) : parseInt(trimmed, 10);
13
+ if (Number.isNaN(parsed)) throw new Error("invalid yParity value");
14
+ numericValue = parsed;
15
+ } else throw new Error("invalid yParity type");
16
+ return Math.abs(numericValue) % 2 === 0 ? 0 : 1;
17
+ };
18
+ function createRlpEncodedAuthorization(authorizationOrChainId, delegateAddress, nonce, yParity, r, s) {
19
+ if (typeof authorizationOrChainId === "object") {
20
+ const authorization = authorizationOrChainId;
21
+ const normalizedYParity = normalizeYParityValue(authorization.yParity);
22
+ return (0, viem.toRlp)([
23
+ (0, viem.toHex)(authorization.chainId),
24
+ ensureHexPrefix(authorization.address),
25
+ authorization.nonce === 0 ? "0x" : (0, viem.toHex)(authorization.nonce),
26
+ normalizedYParity === 0 ? "0x" : (0, viem.toHex)(normalizedYParity),
27
+ authorization.r,
28
+ authorization.s
29
+ ]);
30
+ } else {
31
+ const chainId = authorizationOrChainId;
32
+ const normalizedYParity = normalizeYParityValue(yParity);
33
+ return (0, viem.toRlp)([
34
+ (0, viem.toHex)(chainId),
35
+ ensureHexPrefix(delegateAddress),
36
+ nonce === 0 ? "0x" : (0, viem.toHex)(nonce),
37
+ normalizedYParity === 0 ? "0x" : (0, viem.toHex)(normalizedYParity),
38
+ r,
39
+ s
40
+ ]);
41
+ }
42
+ }
43
+
44
+ //#endregion
45
+ //#region src/utils/vrs.ts
46
+ const isValidV = (v) => {
47
+ return v === 0 || v === 1 || v === 27 || v === 28 || v >= 35;
48
+ };
49
+ const normalizeV = (v) => {
50
+ if (!isValidV(v)) return 0;
51
+ const cmp = v <= 1 ? 1 : 0;
52
+ const result = v % 2 === cmp;
53
+ return Number(result) % 2;
54
+ };
55
+ const createEIP2098Signature = (vrs) => {
56
+ const v = vrs.v;
57
+ const r = vrs.r;
58
+ const s = vrs.s;
59
+ return {
60
+ yParity: normalizeV(v),
61
+ r,
62
+ s
63
+ };
64
+ };
65
+ const parseSignatureToVRS = (signature) => {
66
+ if (typeof signature !== "string") throw new Error("Signature must be a string");
67
+ if (!signature.startsWith("0x")) throw new Error("Signature must start with \"0x\"");
68
+ if (signature.length !== 132) throw new Error("Signature must be 65 bytes (130 hex chars) plus \"0x\" = 132 total length");
69
+ const r = signature.slice(2, 66);
70
+ const s = signature.slice(66, 130);
71
+ const vHex = signature.slice(130, 132);
72
+ return {
73
+ v: parseInt(vHex, 16),
74
+ r: `0x${r}`,
75
+ s: `0x${s}`
76
+ };
77
+ };
78
+
79
+ //#endregion
80
+ Object.defineProperty(exports, 'createEIP2098Signature', {
81
+ enumerable: true,
82
+ get: function () {
83
+ return createEIP2098Signature;
84
+ }
85
+ });
86
+ Object.defineProperty(exports, 'createRlpEncodedAuthorization', {
87
+ enumerable: true,
88
+ get: function () {
89
+ return createRlpEncodedAuthorization;
90
+ }
91
+ });
92
+ Object.defineProperty(exports, 'normalizeYParityValue', {
93
+ enumerable: true,
94
+ get: function () {
95
+ return normalizeYParityValue;
96
+ }
97
+ });
98
+ Object.defineProperty(exports, 'parseSignatureToVRS', {
99
+ enumerable: true,
100
+ get: function () {
101
+ return parseSignatureToVRS;
102
+ }
103
+ });
104
+ //# sourceMappingURL=utils-CVQFvsfl.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-CVQFvsfl.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(\n authorization.yParity as unknown as number | bigint | string | undefined,\n );\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;EACtB,MAAM,oBAAoB,sBACxB,cAAc,QACf;AAcD,yBATiB;mBACT,cAAc,QAAQ;GAC5B,gBAAgB,cAAc,QAAQ;GACtC,cAAc,UAAU,IAAI,uBAAa,cAAc,MAAM;GAC7D,sBAAsB,IAAI,uBAAa,kBAAkB;GACzD,cAAc;GACd,cAAc;GACf,CAEqB;QACjB;EAEL,MAAM,UAAU;EAChB,MAAM,oBAAoB,sBAAsB,QAAQ;AAUxD,yBATiB;mBACT,QAAQ;GACd,gBAAgB,gBAAiB;GACjC,UAAU,IAAI,uBAAa,MAAO;GAClC,sBAAsB,IAAI,uBAAa,kBAAkB;GACzD;GACA;GACD,CAEqB;;;;;;AC7F1B,MAAM,YAAY,MAAuB;AACvC,QAAO,MAAM,KAAK,MAAM,KAAK,MAAM,MAAM,MAAM,MAAM,KAAK;;AAQ5D,MAAM,cAAc,MAAc;AAChC,KAAI,CAAC,SAAS,EAAE,CAAE,QAAO;CAEzB,MAAM,MAAM,KAAK,IAAI,IAAI;CACzB,MAAM,SAAS,IAAI,MAAM;AAEzB,QAAO,OAAO,OAAO,GAAG;;AAQ1B,MAAa,0BAA0B,QAA+B;CACpE,MAAM,IAAI,IAAI;CACd,MAAM,IAAI,IAAI;CACd,MAAM,IAAI,IAAI;AAEd,QAAO;EAAE,SAAS,WAAW,EAAE;EAAE;EAAG;EAAG;;AAazC,MAAa,uBAAuB,cAA2B;AAC7D,KAAI,OAAO,cAAc,SACvB,OAAM,IAAI,MAAM,6BAA6B;AAG/C,KAAI,CAAC,UAAU,WAAW,KAAK,CAC7B,OAAM,IAAI,MAAM,mCAAiC;AAGnD,KAAI,UAAU,WAAW,IACvB,OAAM,IAAI,MACR,4EACD;CAIH,MAAM,IAAI,UAAU,MAAM,GAAG,GAAG;CAChC,MAAM,IAAI,UAAU,MAAM,IAAI,IAAI;CAClC,MAAM,OAAO,UAAU,MAAM,KAAK,IAAI;AAEtC,QAAO;EAAE,GADC,SAAS,MAAM,GAAG;EAChB,GAAG,KAAK;EAAK,GAAG,KAAK;EAAK"}