@thirdweb-dev/service-utils 0.5.0-nightly-f5aed34d-20230829001006 → 0.5.0
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/cjs/cf-worker/index.js +164 -0
- package/dist/cjs/cf-worker/index.js.map +1 -0
- package/dist/cjs/cf-worker/usage.js +55 -0
- package/dist/cjs/cf-worker/usage.js.map +1 -0
- package/dist/cjs/core/api.js +42 -0
- package/dist/cjs/core/api.js.map +1 -0
- package/dist/cjs/core/authorize/client.js +98 -0
- package/dist/cjs/core/authorize/client.js.map +1 -0
- package/dist/cjs/core/authorize/index.js +109 -0
- package/dist/cjs/core/authorize/index.js.map +1 -0
- package/dist/cjs/core/authorize/service.js +50 -0
- package/dist/cjs/core/authorize/service.js.map +1 -0
- package/dist/cjs/core/authorize/types.js +3 -0
- package/dist/cjs/core/authorize/types.js.map +1 -0
- package/dist/cjs/core/rateLimit/index.js +60 -0
- package/dist/cjs/core/rateLimit/index.js.map +1 -0
- package/dist/cjs/core/rateLimit/types.js +3 -0
- package/dist/cjs/core/rateLimit/types.js.map +1 -0
- package/dist/cjs/core/services.js +85 -0
- package/dist/cjs/core/services.js.map +1 -0
- package/dist/cjs/core/types.js +3 -0
- package/dist/cjs/core/types.js.map +1 -0
- package/dist/cjs/core/usage.js +85 -0
- package/dist/cjs/core/usage.js.map +1 -0
- package/dist/cjs/index.js +13 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/mocks.js +60 -0
- package/dist/cjs/mocks.js.map +1 -0
- package/dist/cjs/node/index.js +182 -0
- package/dist/cjs/node/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/cf-worker/index.js +156 -0
- package/dist/esm/cf-worker/index.js.map +1 -0
- package/dist/esm/cf-worker/usage.js +53 -0
- package/dist/esm/cf-worker/usage.js.map +1 -0
- package/dist/esm/core/api.js +38 -0
- package/dist/esm/core/api.js.map +1 -0
- package/dist/esm/core/authorize/client.js +93 -0
- package/dist/esm/core/authorize/client.js.map +1 -0
- package/dist/esm/core/authorize/index.js +106 -0
- package/dist/esm/core/authorize/index.js.map +1 -0
- package/dist/esm/core/authorize/service.js +47 -0
- package/dist/esm/core/authorize/service.js.map +1 -0
- package/dist/esm/core/authorize/types.js +2 -0
- package/dist/esm/core/authorize/types.js.map +1 -0
- package/dist/esm/core/rateLimit/index.js +57 -0
- package/dist/esm/core/rateLimit/index.js.map +1 -0
- package/dist/esm/core/rateLimit/types.js +2 -0
- package/dist/esm/core/rateLimit/types.js.map +1 -0
- package/dist/esm/core/services.js +81 -0
- package/dist/esm/core/services.js.map +1 -0
- package/dist/esm/core/types.js +2 -0
- package/dist/esm/core/types.js.map +1 -0
- package/dist/esm/core/usage.js +82 -0
- package/dist/esm/core/usage.js.map +1 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/mocks.js +57 -0
- package/dist/esm/mocks.js.map +1 -0
- package/dist/esm/node/index.js +174 -0
- package/dist/esm/node/index.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/{declarations/src → types}/cf-worker/index.d.ts +10 -8
- package/dist/types/cf-worker/index.d.ts.map +1 -0
- package/dist/types/cf-worker/usage.d.ts +24 -0
- package/dist/types/cf-worker/usage.d.ts.map +1 -0
- package/dist/types/core/api.d.ts +121 -0
- package/dist/types/core/api.d.ts.map +1 -0
- package/dist/types/core/authorize/client.d.ts +17 -0
- package/dist/types/core/authorize/client.d.ts.map +1 -0
- package/dist/{declarations/src → types}/core/authorize/index.d.ts +6 -5
- package/dist/types/core/authorize/index.d.ts.map +1 -0
- package/dist/types/core/authorize/service.d.ts +4 -0
- package/dist/types/core/authorize/service.d.ts.map +1 -0
- package/dist/types/core/authorize/types.d.ts +10 -0
- package/dist/types/core/authorize/types.d.ts.map +1 -0
- package/dist/types/core/rateLimit/index.d.ts +20 -0
- package/dist/types/core/rateLimit/index.d.ts.map +1 -0
- package/dist/types/core/rateLimit/types.d.ts +13 -0
- package/dist/types/core/rateLimit/types.d.ts.map +1 -0
- package/dist/{declarations/src → types}/core/services.d.ts +84 -4
- package/dist/types/core/services.d.ts.map +1 -0
- package/dist/types/core/types.d.ts.map +1 -0
- package/dist/types/core/usage.d.ts +196 -0
- package/dist/types/core/usage.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/mocks.d.ts +7 -0
- package/dist/types/mocks.d.ts.map +1 -0
- package/dist/types/node/index.d.ts +41 -0
- package/dist/types/node/index.d.ts.map +1 -0
- package/package.json +42 -44
- package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.cjs.d.ts +0 -2
- package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.cjs.d.ts.map +0 -1
- package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.cjs.dev.js +0 -240
- package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.cjs.js +0 -7
- package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.cjs.prod.js +0 -240
- package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.esm.js +0 -227
- package/cf-worker/package.json +0 -4
- package/dist/declarations/src/cf-worker/index.d.ts.map +0 -1
- package/dist/declarations/src/cf-worker/usage.d.ts +0 -79
- package/dist/declarations/src/cf-worker/usage.d.ts.map +0 -1
- package/dist/declarations/src/core/api.d.ts +0 -48
- package/dist/declarations/src/core/api.d.ts.map +0 -1
- package/dist/declarations/src/core/authorize/client.d.ts +0 -9
- package/dist/declarations/src/core/authorize/client.d.ts.map +0 -1
- package/dist/declarations/src/core/authorize/index.d.ts.map +0 -1
- package/dist/declarations/src/core/authorize/service.d.ts +0 -7
- package/dist/declarations/src/core/authorize/service.d.ts.map +0 -1
- package/dist/declarations/src/core/authorize/types.d.ts +0 -12
- package/dist/declarations/src/core/authorize/types.d.ts.map +0 -1
- package/dist/declarations/src/core/services.d.ts.map +0 -1
- package/dist/declarations/src/core/types.d.ts.map +0 -1
- package/dist/declarations/src/index.d.ts +0 -2
- package/dist/declarations/src/index.d.ts.map +0 -1
- package/dist/declarations/src/node/index.d.ts +0 -23
- package/dist/declarations/src/node/index.d.ts.map +0 -1
- package/dist/index-6e0ecc5f.cjs.prod.js +0 -424
- package/dist/index-cd4f96ef.cjs.dev.js +0 -424
- package/dist/index-ffddf746.esm.js +0 -422
- package/dist/services-86283509.esm.js +0 -44
- package/dist/services-9e185105.cjs.prod.js +0 -49
- package/dist/services-a3f36057.cjs.dev.js +0 -49
- package/dist/thirdweb-dev-service-utils.cjs.d.ts +0 -2
- package/dist/thirdweb-dev-service-utils.cjs.d.ts.map +0 -1
- package/dist/thirdweb-dev-service-utils.cjs.dev.js +0 -12
- package/dist/thirdweb-dev-service-utils.cjs.js +0 -7
- package/dist/thirdweb-dev-service-utils.cjs.prod.js +0 -12
- package/dist/thirdweb-dev-service-utils.esm.js +0 -1
- package/node/dist/thirdweb-dev-service-utils-node.cjs.d.ts +0 -2
- package/node/dist/thirdweb-dev-service-utils-node.cjs.d.ts.map +0 -1
- package/node/dist/thirdweb-dev-service-utils-node.cjs.dev.js +0 -167
- package/node/dist/thirdweb-dev-service-utils-node.cjs.js +0 -7
- package/node/dist/thirdweb-dev-service-utils-node.cjs.prod.js +0 -167
- package/node/dist/thirdweb-dev-service-utils-node.esm.js +0 -155
- package/node/package.json +0 -4
- /package/dist/{declarations/src → types}/core/types.d.ts +0 -0
@@ -21,7 +21,7 @@ export declare const SERVICE_DEFINITIONS: {
|
|
21
21
|
};
|
22
22
|
readonly bundler: {
|
23
23
|
readonly name: "bundler";
|
24
|
-
readonly title: "
|
24
|
+
readonly title: "Account Abstraction";
|
25
25
|
readonly description: "Bundler & Paymaster services";
|
26
26
|
readonly actions: readonly [];
|
27
27
|
};
|
@@ -31,8 +31,38 @@ export declare const SERVICE_DEFINITIONS: {
|
|
31
31
|
readonly description: "Enable gasless transactions";
|
32
32
|
readonly actions: readonly [];
|
33
33
|
};
|
34
|
+
readonly embeddedWallets: {
|
35
|
+
readonly name: "embeddedWallets";
|
36
|
+
readonly title: "In-App Wallets";
|
37
|
+
readonly description: "E-mail and social login wallets for easy web3 onboarding";
|
38
|
+
readonly actions: readonly [];
|
39
|
+
};
|
40
|
+
readonly pay: {
|
41
|
+
readonly name: "pay";
|
42
|
+
readonly title: "Pay";
|
43
|
+
readonly description: "Pay for a blockchain transaction with any currency";
|
44
|
+
readonly actions: readonly [];
|
45
|
+
};
|
46
|
+
readonly chainsaw: {
|
47
|
+
readonly name: "chainsaw";
|
48
|
+
readonly title: "Chainsaw";
|
49
|
+
readonly description: "Indexed data for any EVM chain";
|
50
|
+
readonly actions: readonly [];
|
51
|
+
};
|
52
|
+
readonly insight: {
|
53
|
+
readonly name: "insight";
|
54
|
+
readonly title: "Insight";
|
55
|
+
readonly description: "Insight services";
|
56
|
+
readonly actions: readonly [];
|
57
|
+
};
|
58
|
+
readonly nebula: {
|
59
|
+
readonly name: "nebula";
|
60
|
+
readonly title: "Nebula";
|
61
|
+
readonly description: "Advanced blockchain reasoning and execution capabilities with AI";
|
62
|
+
readonly actions: readonly [];
|
63
|
+
};
|
34
64
|
};
|
35
|
-
export declare const SERVICE_NAMES: (
|
65
|
+
export declare const SERVICE_NAMES: (keyof typeof SERVICE_DEFINITIONS)[];
|
36
66
|
export declare const SERVICES: ({
|
37
67
|
readonly name: "storage";
|
38
68
|
readonly title: "Storage";
|
@@ -53,7 +83,7 @@ export declare const SERVICES: ({
|
|
53
83
|
readonly actions: readonly [];
|
54
84
|
} | {
|
55
85
|
readonly name: "bundler";
|
56
|
-
readonly title: "
|
86
|
+
readonly title: "Account Abstraction";
|
57
87
|
readonly description: "Bundler & Paymaster services";
|
58
88
|
readonly actions: readonly [];
|
59
89
|
} | {
|
@@ -61,6 +91,31 @@ export declare const SERVICES: ({
|
|
61
91
|
readonly title: "Gasless Relayer";
|
62
92
|
readonly description: "Enable gasless transactions";
|
63
93
|
readonly actions: readonly [];
|
94
|
+
} | {
|
95
|
+
readonly name: "embeddedWallets";
|
96
|
+
readonly title: "In-App Wallets";
|
97
|
+
readonly description: "E-mail and social login wallets for easy web3 onboarding";
|
98
|
+
readonly actions: readonly [];
|
99
|
+
} | {
|
100
|
+
readonly name: "pay";
|
101
|
+
readonly title: "Pay";
|
102
|
+
readonly description: "Pay for a blockchain transaction with any currency";
|
103
|
+
readonly actions: readonly [];
|
104
|
+
} | {
|
105
|
+
readonly name: "chainsaw";
|
106
|
+
readonly title: "Chainsaw";
|
107
|
+
readonly description: "Indexed data for any EVM chain";
|
108
|
+
readonly actions: readonly [];
|
109
|
+
} | {
|
110
|
+
readonly name: "insight";
|
111
|
+
readonly title: "Insight";
|
112
|
+
readonly description: "Insight services";
|
113
|
+
readonly actions: readonly [];
|
114
|
+
} | {
|
115
|
+
readonly name: "nebula";
|
116
|
+
readonly title: "Nebula";
|
117
|
+
readonly description: "Advanced blockchain reasoning and execution capabilities with AI";
|
118
|
+
readonly actions: readonly [];
|
64
119
|
})[];
|
65
120
|
export type ServiceName = (typeof SERVICE_NAMES)[number];
|
66
121
|
export type ServiceAction = {
|
@@ -89,7 +144,7 @@ export declare function getServiceByName(name: ServiceName): {
|
|
89
144
|
readonly actions: readonly [];
|
90
145
|
} | {
|
91
146
|
readonly name: "bundler";
|
92
|
-
readonly title: "
|
147
|
+
readonly title: "Account Abstraction";
|
93
148
|
readonly description: "Bundler & Paymaster services";
|
94
149
|
readonly actions: readonly [];
|
95
150
|
} | {
|
@@ -97,5 +152,30 @@ export declare function getServiceByName(name: ServiceName): {
|
|
97
152
|
readonly title: "Gasless Relayer";
|
98
153
|
readonly description: "Enable gasless transactions";
|
99
154
|
readonly actions: readonly [];
|
155
|
+
} | {
|
156
|
+
readonly name: "embeddedWallets";
|
157
|
+
readonly title: "In-App Wallets";
|
158
|
+
readonly description: "E-mail and social login wallets for easy web3 onboarding";
|
159
|
+
readonly actions: readonly [];
|
160
|
+
} | {
|
161
|
+
readonly name: "pay";
|
162
|
+
readonly title: "Pay";
|
163
|
+
readonly description: "Pay for a blockchain transaction with any currency";
|
164
|
+
readonly actions: readonly [];
|
165
|
+
} | {
|
166
|
+
readonly name: "chainsaw";
|
167
|
+
readonly title: "Chainsaw";
|
168
|
+
readonly description: "Indexed data for any EVM chain";
|
169
|
+
readonly actions: readonly [];
|
170
|
+
} | {
|
171
|
+
readonly name: "insight";
|
172
|
+
readonly title: "Insight";
|
173
|
+
readonly description: "Insight services";
|
174
|
+
readonly actions: readonly [];
|
175
|
+
} | {
|
176
|
+
readonly name: "nebula";
|
177
|
+
readonly title: "Nebula";
|
178
|
+
readonly description: "Advanced blockchain reasoning and execution capabilities with AI";
|
179
|
+
readonly actions: readonly [];
|
100
180
|
};
|
101
181
|
//# sourceMappingURL=services.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../src/core/services.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2EtB,CAAC;AAEX,eAAO,MAAM,aAAa,EAErB,CAAC,MAAM,OAAO,mBAAmB,CAAC,EAAE,CAAC;AAE1C,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAqC,CAAC;AAE3D,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,OAAO,GACjB,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEjD"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAE1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACnC,CAAC"}
|
@@ -0,0 +1,196 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export declare const usageEventSchema: z.ZodObject<{
|
3
|
+
source: z.ZodString;
|
4
|
+
action: z.ZodString;
|
5
|
+
/**
|
6
|
+
* The following fields are optional.
|
7
|
+
*/
|
8
|
+
accountId: z.ZodOptional<z.ZodString>;
|
9
|
+
isClientEvent: z.ZodOptional<z.ZodBoolean>;
|
10
|
+
apiKeyId: z.ZodOptional<z.ZodString>;
|
11
|
+
creatorWalletAddress: z.ZodOptional<z.ZodString>;
|
12
|
+
clientId: z.ZodOptional<z.ZodString>;
|
13
|
+
walletAddress: z.ZodOptional<z.ZodString>;
|
14
|
+
walletType: z.ZodOptional<z.ZodString>;
|
15
|
+
chainId: z.ZodOptional<z.ZodNumber>;
|
16
|
+
provider: z.ZodOptional<z.ZodString>;
|
17
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
18
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
19
|
+
fileCid: z.ZodOptional<z.ZodString>;
|
20
|
+
evmMethod: z.ZodOptional<z.ZodString>;
|
21
|
+
userOpHash: z.ZodOptional<z.ZodString>;
|
22
|
+
gasLimit: z.ZodOptional<z.ZodNumber>;
|
23
|
+
gasPricePerUnit: z.ZodOptional<z.ZodString>;
|
24
|
+
transactionFeeUsd: z.ZodOptional<z.ZodNumber>;
|
25
|
+
transactionHash: z.ZodOptional<z.ZodString>;
|
26
|
+
sdkName: z.ZodOptional<z.ZodString>;
|
27
|
+
sdkVersion: z.ZodOptional<z.ZodString>;
|
28
|
+
sdkPlatform: z.ZodOptional<z.ZodString>;
|
29
|
+
sdkOS: z.ZodOptional<z.ZodString>;
|
30
|
+
productName: z.ZodOptional<z.ZodString>;
|
31
|
+
transactionValue: z.ZodOptional<z.ZodString>;
|
32
|
+
pathname: z.ZodOptional<z.ZodString>;
|
33
|
+
contractAddress: z.ZodOptional<z.ZodString>;
|
34
|
+
errorCode: z.ZodOptional<z.ZodString>;
|
35
|
+
httpStatusCode: z.ZodOptional<z.ZodNumber>;
|
36
|
+
functionName: z.ZodOptional<z.ZodString>;
|
37
|
+
extension: z.ZodOptional<z.ZodString>;
|
38
|
+
retryCount: z.ZodOptional<z.ZodNumber>;
|
39
|
+
policyId: z.ZodOptional<z.ZodString>;
|
40
|
+
msSinceQueue: z.ZodOptional<z.ZodNumber>;
|
41
|
+
msSinceSend: z.ZodOptional<z.ZodNumber>;
|
42
|
+
msTotalDuration: z.ZodOptional<z.ZodNumber>;
|
43
|
+
swapId: z.ZodOptional<z.ZodString>;
|
44
|
+
tokenAddress: z.ZodOptional<z.ZodString>;
|
45
|
+
amountWei: z.ZodOptional<z.ZodString>;
|
46
|
+
amountUSDCents: z.ZodOptional<z.ZodNumber>;
|
47
|
+
httpMethod: z.ZodOptional<z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "CONNECT", "OPTIONS", "TRACE"]>>;
|
48
|
+
ecosystemId: z.ZodOptional<z.ZodString>;
|
49
|
+
ecosystemPartnerId: z.ZodOptional<z.ZodString>;
|
50
|
+
authenticationMethod: z.ZodOptional<z.ZodString>;
|
51
|
+
chainName: z.ZodOptional<z.ZodString>;
|
52
|
+
tokenSymbol: z.ZodOptional<z.ZodString>;
|
53
|
+
dstChainId: z.ZodOptional<z.ZodNumber>;
|
54
|
+
dstTokenAddress: z.ZodOptional<z.ZodString>;
|
55
|
+
dstChainName: z.ZodOptional<z.ZodString>;
|
56
|
+
dstTokenSymbol: z.ZodOptional<z.ZodString>;
|
57
|
+
msLatency: z.ZodOptional<z.ZodNumber>;
|
58
|
+
toAmountUSDCents: z.ZodOptional<z.ZodNumber>;
|
59
|
+
secondaryProvider: z.ZodOptional<z.ZodString>;
|
60
|
+
onRampId: z.ZodOptional<z.ZodString>;
|
61
|
+
evmRequestParams: z.ZodOptional<z.ZodString>;
|
62
|
+
providerIp: z.ZodOptional<z.ZodString>;
|
63
|
+
promptTokens: z.ZodOptional<z.ZodNumber>;
|
64
|
+
completionTokens: z.ZodOptional<z.ZodNumber>;
|
65
|
+
modelName: z.ZodOptional<z.ZodString>;
|
66
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
67
|
+
requestId: z.ZodOptional<z.ZodString>;
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
69
|
+
source: string;
|
70
|
+
action: string;
|
71
|
+
errorCode?: string | undefined;
|
72
|
+
accountId?: string | undefined;
|
73
|
+
isClientEvent?: boolean | undefined;
|
74
|
+
apiKeyId?: string | undefined;
|
75
|
+
creatorWalletAddress?: string | undefined;
|
76
|
+
clientId?: string | undefined;
|
77
|
+
walletAddress?: string | undefined;
|
78
|
+
walletType?: string | undefined;
|
79
|
+
chainId?: number | undefined;
|
80
|
+
provider?: string | undefined;
|
81
|
+
mimeType?: string | undefined;
|
82
|
+
fileSize?: number | undefined;
|
83
|
+
fileCid?: string | undefined;
|
84
|
+
evmMethod?: string | undefined;
|
85
|
+
userOpHash?: string | undefined;
|
86
|
+
gasLimit?: number | undefined;
|
87
|
+
gasPricePerUnit?: string | undefined;
|
88
|
+
transactionFeeUsd?: number | undefined;
|
89
|
+
transactionHash?: string | undefined;
|
90
|
+
sdkName?: string | undefined;
|
91
|
+
sdkVersion?: string | undefined;
|
92
|
+
sdkPlatform?: string | undefined;
|
93
|
+
sdkOS?: string | undefined;
|
94
|
+
productName?: string | undefined;
|
95
|
+
transactionValue?: string | undefined;
|
96
|
+
pathname?: string | undefined;
|
97
|
+
contractAddress?: string | undefined;
|
98
|
+
httpStatusCode?: number | undefined;
|
99
|
+
functionName?: string | undefined;
|
100
|
+
extension?: string | undefined;
|
101
|
+
retryCount?: number | undefined;
|
102
|
+
policyId?: string | undefined;
|
103
|
+
msSinceQueue?: number | undefined;
|
104
|
+
msSinceSend?: number | undefined;
|
105
|
+
msTotalDuration?: number | undefined;
|
106
|
+
swapId?: string | undefined;
|
107
|
+
tokenAddress?: string | undefined;
|
108
|
+
amountWei?: string | undefined;
|
109
|
+
amountUSDCents?: number | undefined;
|
110
|
+
httpMethod?: "GET" | "PUT" | "POST" | "DELETE" | "PATCH" | "HEAD" | "CONNECT" | "OPTIONS" | "TRACE" | undefined;
|
111
|
+
ecosystemId?: string | undefined;
|
112
|
+
ecosystemPartnerId?: string | undefined;
|
113
|
+
authenticationMethod?: string | undefined;
|
114
|
+
chainName?: string | undefined;
|
115
|
+
tokenSymbol?: string | undefined;
|
116
|
+
dstChainId?: number | undefined;
|
117
|
+
dstTokenAddress?: string | undefined;
|
118
|
+
dstChainName?: string | undefined;
|
119
|
+
dstTokenSymbol?: string | undefined;
|
120
|
+
msLatency?: number | undefined;
|
121
|
+
toAmountUSDCents?: number | undefined;
|
122
|
+
secondaryProvider?: string | undefined;
|
123
|
+
onRampId?: string | undefined;
|
124
|
+
evmRequestParams?: string | undefined;
|
125
|
+
providerIp?: string | undefined;
|
126
|
+
promptTokens?: number | undefined;
|
127
|
+
completionTokens?: number | undefined;
|
128
|
+
modelName?: string | undefined;
|
129
|
+
sessionId?: string | undefined;
|
130
|
+
requestId?: string | undefined;
|
131
|
+
}, {
|
132
|
+
source: string;
|
133
|
+
action: string;
|
134
|
+
errorCode?: string | undefined;
|
135
|
+
accountId?: string | undefined;
|
136
|
+
isClientEvent?: boolean | undefined;
|
137
|
+
apiKeyId?: string | undefined;
|
138
|
+
creatorWalletAddress?: string | undefined;
|
139
|
+
clientId?: string | undefined;
|
140
|
+
walletAddress?: string | undefined;
|
141
|
+
walletType?: string | undefined;
|
142
|
+
chainId?: number | undefined;
|
143
|
+
provider?: string | undefined;
|
144
|
+
mimeType?: string | undefined;
|
145
|
+
fileSize?: number | undefined;
|
146
|
+
fileCid?: string | undefined;
|
147
|
+
evmMethod?: string | undefined;
|
148
|
+
userOpHash?: string | undefined;
|
149
|
+
gasLimit?: number | undefined;
|
150
|
+
gasPricePerUnit?: string | undefined;
|
151
|
+
transactionFeeUsd?: number | undefined;
|
152
|
+
transactionHash?: string | undefined;
|
153
|
+
sdkName?: string | undefined;
|
154
|
+
sdkVersion?: string | undefined;
|
155
|
+
sdkPlatform?: string | undefined;
|
156
|
+
sdkOS?: string | undefined;
|
157
|
+
productName?: string | undefined;
|
158
|
+
transactionValue?: string | undefined;
|
159
|
+
pathname?: string | undefined;
|
160
|
+
contractAddress?: string | undefined;
|
161
|
+
httpStatusCode?: number | undefined;
|
162
|
+
functionName?: string | undefined;
|
163
|
+
extension?: string | undefined;
|
164
|
+
retryCount?: number | undefined;
|
165
|
+
policyId?: string | undefined;
|
166
|
+
msSinceQueue?: number | undefined;
|
167
|
+
msSinceSend?: number | undefined;
|
168
|
+
msTotalDuration?: number | undefined;
|
169
|
+
swapId?: string | undefined;
|
170
|
+
tokenAddress?: string | undefined;
|
171
|
+
amountWei?: string | undefined;
|
172
|
+
amountUSDCents?: number | undefined;
|
173
|
+
httpMethod?: "GET" | "PUT" | "POST" | "DELETE" | "PATCH" | "HEAD" | "CONNECT" | "OPTIONS" | "TRACE" | undefined;
|
174
|
+
ecosystemId?: string | undefined;
|
175
|
+
ecosystemPartnerId?: string | undefined;
|
176
|
+
authenticationMethod?: string | undefined;
|
177
|
+
chainName?: string | undefined;
|
178
|
+
tokenSymbol?: string | undefined;
|
179
|
+
dstChainId?: number | undefined;
|
180
|
+
dstTokenAddress?: string | undefined;
|
181
|
+
dstChainName?: string | undefined;
|
182
|
+
dstTokenSymbol?: string | undefined;
|
183
|
+
msLatency?: number | undefined;
|
184
|
+
toAmountUSDCents?: number | undefined;
|
185
|
+
secondaryProvider?: string | undefined;
|
186
|
+
onRampId?: string | undefined;
|
187
|
+
evmRequestParams?: string | undefined;
|
188
|
+
providerIp?: string | undefined;
|
189
|
+
promptTokens?: number | undefined;
|
190
|
+
completionTokens?: number | undefined;
|
191
|
+
modelName?: string | undefined;
|
192
|
+
sessionId?: string | undefined;
|
193
|
+
requestId?: string | undefined;
|
194
|
+
}>;
|
195
|
+
export type UsageEvent = z.infer<typeof usageEventSchema>;
|
196
|
+
//# sourceMappingURL=usage.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/core/usage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB;;;IAI3B;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2EH,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
export * from "./core/services.js";
|
2
|
+
export type { ApiResponse, CoreServiceConfig, PolicyResult, UserOpData, ProjectResponse, TeamAndProjectResponse, TeamResponse, } from "./core/api.js";
|
3
|
+
export { fetchTeamAndProject, updateRateLimitedAt } from "./core/api.js";
|
4
|
+
export { authorizeBundleId, authorizeDomain, } from "./core/authorize/client.js";
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAC;AACnC,YAAY,EACV,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,eAAe,EACf,sBAAsB,EACtB,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzE,OAAO,EACL,iBAAiB,EACjB,eAAe,GAChB,MAAM,4BAA4B,CAAC"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { CoreServiceConfig, ProjectResponse, TeamAndProjectResponse, TeamResponse } from "./core/api.js";
|
2
|
+
export declare const validProjectResponse: ProjectResponse;
|
3
|
+
export declare const validTeamResponse: TeamResponse;
|
4
|
+
export declare const validTeamAndProjectResponse: TeamAndProjectResponse;
|
5
|
+
export declare const validServiceConfig: CoreServiceConfig;
|
6
|
+
export declare const validBundlerServiceConfig: CoreServiceConfig;
|
7
|
+
//# sourceMappingURL=mocks.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/mocks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,YAAY,EACb,MAAM,eAAe,CAAC;AAEvB,eAAO,MAAM,oBAAoB,EAAE,eA2BlC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,YAY/B,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,sBAGzC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,iBAKhC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,iBAIvC,CAAC"}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
2
|
+
import type { CoreServiceConfig } from "../core/api.js";
|
3
|
+
import type { AuthorizationInput, CacheOptions } from "../core/authorize/index.js";
|
4
|
+
import type { AuthorizationResult } from "../core/authorize/types.js";
|
5
|
+
import type { CoreAuthInput } from "../core/types.js";
|
6
|
+
export * from "../core/usage.js";
|
7
|
+
export * from "../core/rateLimit/index.js";
|
8
|
+
export * from "../core/services.js";
|
9
|
+
type NodeServiceConfig = CoreServiceConfig;
|
10
|
+
export type AuthInput = CoreAuthInput & {
|
11
|
+
req: IncomingMessage;
|
12
|
+
};
|
13
|
+
/**
|
14
|
+
*
|
15
|
+
* @param {AuthInput['req']} authInput.req - The incoming request from which information will be pulled from. These information includes (checks are in order and terminates on first match):
|
16
|
+
* - clientId: Checks header `x-client-id`, search param `clientId`
|
17
|
+
* - bundleId: Checks header `x-bundle-id`, search param `bundleId`
|
18
|
+
* - secretKey: Checks header `x-secret-key`
|
19
|
+
* - origin (the requesting domain): Checks header `origin`, `referer`
|
20
|
+
* @param {AuthInput['clientId']} authInput.clientId - Overrides any clientId found on the `req` object
|
21
|
+
* @param {AuthInput['targetAddress']} authInput.targetAddress - Only used in smart wallets to determine if the request is authorized to interact with the target address.
|
22
|
+
* @param {NodeServiceConfig['enforceAuth']} serviceConfig - Always `true` unless you need to turn auth off. Tells the service whether or not to enforce auth.
|
23
|
+
* @param {NodeServiceConfig['apiUrl']} serviceConfig.apiUrl - The url of the api server to fetch information for verification. `https://api.thirdweb.com` for production and `https://api.staging.thirdweb.com` for staging
|
24
|
+
* @param {NodeServiceConfig['serviceApiKey']} serviceConfig.serviceApiKey - secret key to be used authenticate the caller of the api-server. Check the api-server's env variable for the keys.
|
25
|
+
* @param {NodeServiceConfig['serviceScope']} serviceConfig.serviceScope - The service that we are requesting authorization for. E.g. `relayer`, `rpc`, 'bundler', 'storage' etc.
|
26
|
+
* @param {NodeServiceConfig['serviceAction']} serviceConfig.serviceAction - Needed when the `serviceScope` is `storage`. Can be either `read` or `write`.
|
27
|
+
* @param {NodeServiceConfig['useWalletAuth']} serviceConfig.useWalletAuth - If true it pings the `wallet/me` or else, `account/me`. You most likely can leave this as false.
|
28
|
+
* @returns {AuthorizationResult} authorizationResult - contains if the request is authorized, and information about the account if it is authorized. Otherwise, it contains the error message and status code.
|
29
|
+
*/
|
30
|
+
export declare function authorizeNode(authInput: AuthInput, serviceConfig: NodeServiceConfig, cacheOptions?: CacheOptions): Promise<AuthorizationResult>;
|
31
|
+
export declare function extractAuthorizationData(authInput: AuthInput): AuthorizationInput;
|
32
|
+
export declare function hashSecretKey(secretKey: string): string;
|
33
|
+
export declare function deriveClientIdFromSecretKeyHash(secretKeyHash: string): string;
|
34
|
+
export declare function logHttpRequest({ clientId, req, res, isAuthed, statusMessage, latencyMs, }: AuthInput & {
|
35
|
+
source: string;
|
36
|
+
res: ServerResponse;
|
37
|
+
isAuthed?: boolean;
|
38
|
+
statusMessage?: Error | string;
|
39
|
+
latencyMs?: number;
|
40
|
+
}): void;
|
41
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,eAAe,EACf,cAAc,EACf,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,KAAK,iBAAiB,GAAG,iBAAiB,CAAC;AAE3C,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG;IACtC,GAAG,EAAE,eAAe,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,aAAa,CACjC,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,iBAAiB,EAChC,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,mBAAmB,CAAC,CAsB9B;AAaD,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,SAAS,GACnB,kBAAkB,CAwGpB;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,UAE9C;AAED,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,MAAM,UAEpE;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,GAAG,EACH,GAAG,EACH,QAAQ,EACR,aAAa,EACb,SAAS,GACV,EAAE,SAAS,GAAG;IAEb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,cAAc,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,QAwBA"}
|
package/package.json
CHANGED
@@ -1,23 +1,39 @@
|
|
1
1
|
{
|
2
2
|
"name": "@thirdweb-dev/service-utils",
|
3
|
-
"version": "0.5.0
|
4
|
-
"
|
5
|
-
"
|
3
|
+
"version": "0.5.0",
|
4
|
+
"type": "module",
|
5
|
+
"main": "dist/cjs/index.js",
|
6
|
+
"module": "dist/esm/index.js",
|
7
|
+
"types": "dist/types/index.d.ts",
|
8
|
+
"typings": "dist/types/index.d.ts",
|
6
9
|
"exports": {
|
7
10
|
".": {
|
8
|
-
"
|
9
|
-
"
|
11
|
+
"types": "./dist/types/index.d.ts",
|
12
|
+
"import": "./dist/esm/index.js",
|
13
|
+
"default": "./dist/cjs/index.js"
|
10
14
|
},
|
11
15
|
"./node": {
|
12
|
-
"
|
13
|
-
"
|
16
|
+
"types": "./dist/types/node/index.d.ts",
|
17
|
+
"import": "./dist/esm/node/index.js",
|
18
|
+
"default": "./dist/cjs/node/index.js"
|
14
19
|
},
|
15
20
|
"./cf-worker": {
|
16
|
-
"
|
17
|
-
"
|
21
|
+
"types": "./dist/types/cf-worker/index.d.ts",
|
22
|
+
"import": "./dist/esm/cf-worker/index.js",
|
23
|
+
"default": "./dist/cjs/cf-worker/index.js"
|
18
24
|
},
|
19
25
|
"./package.json": "./package.json"
|
20
26
|
},
|
27
|
+
"typesVersions": {
|
28
|
+
"*": {
|
29
|
+
"node": [
|
30
|
+
"./dist/types/node/index.d.ts"
|
31
|
+
],
|
32
|
+
"cf-worker": [
|
33
|
+
"./dist/types/cf-worker/index.d.ts"
|
34
|
+
]
|
35
|
+
}
|
36
|
+
},
|
21
37
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/pay",
|
22
38
|
"license": "Apache-2.0",
|
23
39
|
"bugs": {
|
@@ -25,46 +41,28 @@
|
|
25
41
|
},
|
26
42
|
"author": "thirdweb eng <eng@thirdweb.com>",
|
27
43
|
"files": [
|
28
|
-
"dist/"
|
29
|
-
"node/",
|
30
|
-
"cf-worker/"
|
44
|
+
"dist/"
|
31
45
|
],
|
32
|
-
"preconstruct": {
|
33
|
-
"entrypoints": [
|
34
|
-
"index.ts",
|
35
|
-
"cf-worker/index.ts",
|
36
|
-
"node/index.ts"
|
37
|
-
],
|
38
|
-
"exports": true
|
39
|
-
},
|
40
46
|
"sideEffects": false,
|
41
|
-
"devDependencies": {
|
42
|
-
"@cloudflare/workers-types": "^4.20230724.0",
|
43
|
-
"@preconstruct/cli": "2.7.0",
|
44
|
-
"@smithy/types": "^2.0.2",
|
45
|
-
"@thirdweb-dev/tsconfig": "^0.1.7",
|
46
|
-
"@types/jest": "^29.5.3",
|
47
|
-
"@types/node": "^18.17.1",
|
48
|
-
"@typescript-eslint/eslint-plugin": "^6.2.0",
|
49
|
-
"@typescript-eslint/parser": "^6.2.0",
|
50
|
-
"eslint": "^8.45.0",
|
51
|
-
"eslint-config-prettier": "^8.9.0",
|
52
|
-
"eslint-config-thirdweb": "^0.1.6",
|
53
|
-
"jest": "^29.6.2",
|
54
|
-
"prettier": "^3.0.0",
|
55
|
-
"typescript": "^5.1.6"
|
56
|
-
},
|
57
47
|
"dependencies": {
|
58
|
-
"aws4fetch": "
|
59
|
-
"zod": "
|
48
|
+
"aws4fetch": "1.0.20",
|
49
|
+
"zod": "3.24.1"
|
50
|
+
},
|
51
|
+
"devDependencies": {
|
52
|
+
"@cloudflare/workers-types": "4.20241205.0",
|
53
|
+
"@types/node": "22.10.2",
|
54
|
+
"typescript": "5.7.2",
|
55
|
+
"vitest": "2.1.8"
|
60
56
|
},
|
61
57
|
"scripts": {
|
62
|
-
"format": "
|
63
|
-
"lint": "
|
64
|
-
"fix": "
|
58
|
+
"format": "biome format ./src --write",
|
59
|
+
"lint": "biome check ./src && tsc --project ./tsconfig.build.json --module esnext --noEmit",
|
60
|
+
"fix": "biome check ./src --fix",
|
65
61
|
"clean": "rm -rf dist/",
|
66
|
-
"build": "
|
67
|
-
"
|
68
|
-
"
|
62
|
+
"build": "pnpm clean && pnpm build:types && pnpm build:cjs && pnpm build:esm",
|
63
|
+
"build:cjs": "tsc --noCheck --project ./tsconfig.build.json --module commonjs --outDir ./dist/cjs --verbatimModuleSyntax false && printf '{\"type\":\"commonjs\"}' > ./dist/cjs/package.json",
|
64
|
+
"build:esm": "tsc --noCheck --project ./tsconfig.build.json --module es2020 --outDir ./dist/esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/esm/package.json",
|
65
|
+
"build:types": "tsc --project ./tsconfig.build.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
|
66
|
+
"test": "vitest run"
|
69
67
|
}
|
70
68
|
}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"thirdweb-dev-service-utils-cf-worker.cjs.d.ts","sourceRoot":"","sources":["../../dist/declarations/src/cf-worker/index.d.ts"],"names":[],"mappings":"AAAA"}
|