@agentdomain/shared 0.1.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/README.md +15 -0
- package/dist/constants.d.ts +93 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +100 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas.d.ts +132 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +62 -0
- package/dist/schemas.js.map +1 -0
- package/dist/types.d.ts +137 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +42 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +109 -0
- package/dist/utils.js.map +1 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @agentdomain/shared
|
|
2
|
+
|
|
3
|
+
Shared constants, schemas, types, and utility helpers for AgentDomain packages.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import {
|
|
7
|
+
AGENTDOMAIN_API_BASE_URL,
|
|
8
|
+
SERVICE_PLAN_CATALOG,
|
|
9
|
+
registrationParamsSchema,
|
|
10
|
+
} from '@agentdomain/shared';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Default API base: `https://agentdomain.app/api/v1`.
|
|
14
|
+
|
|
15
|
+
This package is used by the SDK, MCP server, AgentKit plugin, ElizaOS plugin, and AgentDomain web app.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export declare const ETHEREUM_MAINNET_CHAIN_ID = 1;
|
|
2
|
+
export declare const BASE_CHAIN_ID = 8453;
|
|
3
|
+
export declare const USDC_DECIMALS = 6;
|
|
4
|
+
export declare const RENEWAL_TRIGGER_DAYS_BEFORE = 30;
|
|
5
|
+
export declare const MIN_COMMITMENT_AGE_SECONDS = 60;
|
|
6
|
+
export declare const MIN_REGISTRATION_DURATION_SECONDS = 31536000;
|
|
7
|
+
export declare const SERVICE_FEE_USDC_ATOMIC = 2390000n;
|
|
8
|
+
export declare const EMAIL_FEE_USDC_ATOMIC = 1200000n;
|
|
9
|
+
export declare const SSL_CERTIFICATION_FEE_USDC_ATOMIC = 1200000n;
|
|
10
|
+
export declare const MINIMUM_RENEWAL_FEE_USDC_ATOMIC = 1200000n;
|
|
11
|
+
export declare const BASENAME_FEE_USDC_ATOMIC = 0n;
|
|
12
|
+
export declare const ENS_FEE_USDC_ATOMIC = 0n;
|
|
13
|
+
export declare const BASENAME_PRICE_BUFFER_BPS = 12000n;
|
|
14
|
+
export declare const BASENAME_REGISTRATION_GAS_UNITS = 400000n;
|
|
15
|
+
export declare const BASENAME_RENEWAL_GAS_UNITS = 180000n;
|
|
16
|
+
export declare const ENS_PRICE_BUFFER_BPS = 12000n;
|
|
17
|
+
export declare const ENS_L1_REGISTRATION_GAS_UNITS = 250000n;
|
|
18
|
+
export declare const ENS_L1_RENEWAL_GAS_UNITS = 180000n;
|
|
19
|
+
export declare const USDC_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
20
|
+
export declare const USDC_BASE_SEPOLIA = "0x036CbD53842c5426634e7929541eC2318f3dCF7e";
|
|
21
|
+
export declare const X402_PAYMENT_HEADER = "X-Payment";
|
|
22
|
+
export declare const X402_PAYMENT_REQUIRED_HEADER = "X-Payment-Required";
|
|
23
|
+
export declare const AGENTDOMAIN_API_BASE_URL = "https://agentdomain.app/api/v1";
|
|
24
|
+
export declare const SERVICE_PLAN_KEYS: readonly ["included", "pro", "enterprise"];
|
|
25
|
+
export declare const SERVICE_PLAN_INTERVALS: readonly ["monthly", "yearly"];
|
|
26
|
+
export declare const SERVICE_PLAN_CATALOG: {
|
|
27
|
+
readonly included: {
|
|
28
|
+
readonly key: "included";
|
|
29
|
+
readonly label: "Included";
|
|
30
|
+
readonly monthlyPriceUsdcAtomic: 0n;
|
|
31
|
+
readonly yearlyPriceUsdcAtomic: 0n;
|
|
32
|
+
readonly limits: {
|
|
33
|
+
readonly emailPerHour: 20;
|
|
34
|
+
readonly emailPerDay: 200;
|
|
35
|
+
readonly apiKeys: 1;
|
|
36
|
+
readonly dnsRecords: 20;
|
|
37
|
+
readonly emailRetentionDays: 180;
|
|
38
|
+
};
|
|
39
|
+
readonly supportTier: "standard";
|
|
40
|
+
readonly registryPriority: false;
|
|
41
|
+
};
|
|
42
|
+
readonly pro: {
|
|
43
|
+
readonly key: "pro";
|
|
44
|
+
readonly label: "Pro";
|
|
45
|
+
readonly monthlyPriceUsdcAtomic: 9000000n;
|
|
46
|
+
readonly yearlyPriceUsdcAtomic: 90000000n;
|
|
47
|
+
readonly limits: {
|
|
48
|
+
readonly emailPerHour: 100;
|
|
49
|
+
readonly emailPerDay: 2000;
|
|
50
|
+
readonly apiKeys: 5;
|
|
51
|
+
readonly dnsRecords: 100;
|
|
52
|
+
readonly emailRetentionDays: 365;
|
|
53
|
+
};
|
|
54
|
+
readonly supportTier: "priority";
|
|
55
|
+
readonly registryPriority: false;
|
|
56
|
+
};
|
|
57
|
+
readonly enterprise: {
|
|
58
|
+
readonly key: "enterprise";
|
|
59
|
+
readonly label: "Enterprise";
|
|
60
|
+
readonly monthlyPriceUsdcAtomic: 99000000n;
|
|
61
|
+
readonly yearlyPriceUsdcAtomic: 990000000n;
|
|
62
|
+
readonly limits: {
|
|
63
|
+
readonly emailPerHour: 1000;
|
|
64
|
+
readonly emailPerDay: 20000;
|
|
65
|
+
readonly apiKeys: 25;
|
|
66
|
+
readonly dnsRecords: 500;
|
|
67
|
+
readonly emailRetentionDays: 730;
|
|
68
|
+
};
|
|
69
|
+
readonly supportTier: "enterprise";
|
|
70
|
+
readonly registryPriority: true;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
export declare const ENS_MAINNET: {
|
|
74
|
+
readonly registrarController: "0x253553366Da8546fC250F225fe3d25d0C782303b";
|
|
75
|
+
readonly publicResolver: "0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63";
|
|
76
|
+
readonly registry: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
|
|
77
|
+
readonly baseRegistrar: "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85";
|
|
78
|
+
readonly ethUsdPriceFeed: "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
|
|
79
|
+
};
|
|
80
|
+
export declare const BASENAMES_MAINNET: {
|
|
81
|
+
readonly baseRegistrar: "0x03c4738ee98ae44591e1a4a4f3cab6641d95dd9a";
|
|
82
|
+
readonly registrarController: "0xa7d2607c6BD39Ae9521e514026CBB078405Ab322";
|
|
83
|
+
readonly l2Resolver: "0x426fA03fB86E510d0Dd9F70335Cf102a98b10875";
|
|
84
|
+
};
|
|
85
|
+
export declare const BASENAMES_SEPOLIA: {
|
|
86
|
+
readonly baseRegistrar: "0xa0c70ec36c010b55e3c434d6c6ebeec50c705794";
|
|
87
|
+
readonly registrarController: "0x82c858CDF64b3D893Fe54962680edFDDC37e94C8";
|
|
88
|
+
readonly l2Resolver: "0x85C87e548091f204C2d0350b39ce1874f02197c6";
|
|
89
|
+
};
|
|
90
|
+
export declare const SUPPORTED_TLDS: readonly ["xyz", "com", "ai", "org", "io", "net", "co", "app"];
|
|
91
|
+
export declare const PRIMARY_SUPPORTED_TLDS: readonly ["xyz", "com", "ai", "org", "io", "net", "co", "app"];
|
|
92
|
+
export declare const SUPPORTED_FRAMEWORKS: readonly ["agentkit", "eliza", "crewai", "langchain", "openai", "anthropic"];
|
|
93
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,aAAa,OAAO,CAAC;AAClC,eAAO,MAAM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CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export const ETHEREUM_MAINNET_CHAIN_ID = 1;
|
|
2
|
+
export const BASE_CHAIN_ID = 8453;
|
|
3
|
+
export const USDC_DECIMALS = 6;
|
|
4
|
+
export const RENEWAL_TRIGGER_DAYS_BEFORE = 30;
|
|
5
|
+
export const MIN_COMMITMENT_AGE_SECONDS = 60;
|
|
6
|
+
export const MIN_REGISTRATION_DURATION_SECONDS = 31_536_000;
|
|
7
|
+
export const SERVICE_FEE_USDC_ATOMIC = 2390000n;
|
|
8
|
+
export const EMAIL_FEE_USDC_ATOMIC = 1200000n;
|
|
9
|
+
export const SSL_CERTIFICATION_FEE_USDC_ATOMIC = 1200000n;
|
|
10
|
+
export const MINIMUM_RENEWAL_FEE_USDC_ATOMIC = SSL_CERTIFICATION_FEE_USDC_ATOMIC;
|
|
11
|
+
export const BASENAME_FEE_USDC_ATOMIC = 0n;
|
|
12
|
+
export const ENS_FEE_USDC_ATOMIC = 0n;
|
|
13
|
+
export const BASENAME_PRICE_BUFFER_BPS = 12000n;
|
|
14
|
+
export const BASENAME_REGISTRATION_GAS_UNITS = 400000n;
|
|
15
|
+
export const BASENAME_RENEWAL_GAS_UNITS = 180000n;
|
|
16
|
+
export const ENS_PRICE_BUFFER_BPS = 12000n;
|
|
17
|
+
export const ENS_L1_REGISTRATION_GAS_UNITS = 250000n;
|
|
18
|
+
export const ENS_L1_RENEWAL_GAS_UNITS = 180000n;
|
|
19
|
+
export const USDC_BASE = '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913';
|
|
20
|
+
export const USDC_BASE_SEPOLIA = '0x036CbD53842c5426634e7929541eC2318f3dCF7e';
|
|
21
|
+
export const X402_PAYMENT_HEADER = 'X-Payment';
|
|
22
|
+
export const X402_PAYMENT_REQUIRED_HEADER = 'X-Payment-Required';
|
|
23
|
+
export const AGENTDOMAIN_API_BASE_URL = 'https://agentdomain.app/api/v1';
|
|
24
|
+
export const SERVICE_PLAN_KEYS = ['included', 'pro', 'enterprise'];
|
|
25
|
+
export const SERVICE_PLAN_INTERVALS = ['monthly', 'yearly'];
|
|
26
|
+
export const SERVICE_PLAN_CATALOG = {
|
|
27
|
+
included: {
|
|
28
|
+
key: 'included',
|
|
29
|
+
label: 'Included',
|
|
30
|
+
monthlyPriceUsdcAtomic: 0n,
|
|
31
|
+
yearlyPriceUsdcAtomic: 0n,
|
|
32
|
+
limits: {
|
|
33
|
+
emailPerHour: 20,
|
|
34
|
+
emailPerDay: 200,
|
|
35
|
+
apiKeys: 1,
|
|
36
|
+
dnsRecords: 20,
|
|
37
|
+
emailRetentionDays: 180,
|
|
38
|
+
},
|
|
39
|
+
supportTier: 'standard',
|
|
40
|
+
registryPriority: false,
|
|
41
|
+
},
|
|
42
|
+
pro: {
|
|
43
|
+
key: 'pro',
|
|
44
|
+
label: 'Pro',
|
|
45
|
+
monthlyPriceUsdcAtomic: 9000000n,
|
|
46
|
+
yearlyPriceUsdcAtomic: 90000000n,
|
|
47
|
+
limits: {
|
|
48
|
+
emailPerHour: 100,
|
|
49
|
+
emailPerDay: 2_000,
|
|
50
|
+
apiKeys: 5,
|
|
51
|
+
dnsRecords: 100,
|
|
52
|
+
emailRetentionDays: 365,
|
|
53
|
+
},
|
|
54
|
+
supportTier: 'priority',
|
|
55
|
+
registryPriority: false,
|
|
56
|
+
},
|
|
57
|
+
enterprise: {
|
|
58
|
+
key: 'enterprise',
|
|
59
|
+
label: 'Enterprise',
|
|
60
|
+
monthlyPriceUsdcAtomic: 99000000n,
|
|
61
|
+
yearlyPriceUsdcAtomic: 990000000n,
|
|
62
|
+
limits: {
|
|
63
|
+
emailPerHour: 1_000,
|
|
64
|
+
emailPerDay: 20_000,
|
|
65
|
+
apiKeys: 25,
|
|
66
|
+
dnsRecords: 500,
|
|
67
|
+
emailRetentionDays: 730,
|
|
68
|
+
},
|
|
69
|
+
supportTier: 'enterprise',
|
|
70
|
+
registryPriority: true,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
export const ENS_MAINNET = {
|
|
74
|
+
registrarController: '0x253553366Da8546fC250F225fe3d25d0C782303b',
|
|
75
|
+
publicResolver: '0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63',
|
|
76
|
+
registry: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
|
|
77
|
+
baseRegistrar: '0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85',
|
|
78
|
+
ethUsdPriceFeed: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419',
|
|
79
|
+
};
|
|
80
|
+
export const BASENAMES_MAINNET = {
|
|
81
|
+
baseRegistrar: '0x03c4738ee98ae44591e1a4a4f3cab6641d95dd9a',
|
|
82
|
+
registrarController: '0xa7d2607c6BD39Ae9521e514026CBB078405Ab322',
|
|
83
|
+
l2Resolver: '0x426fA03fB86E510d0Dd9F70335Cf102a98b10875',
|
|
84
|
+
};
|
|
85
|
+
export const BASENAMES_SEPOLIA = {
|
|
86
|
+
baseRegistrar: '0xa0c70ec36c010b55e3c434d6c6ebeec50c705794',
|
|
87
|
+
registrarController: '0x82c858CDF64b3D893Fe54962680edFDDC37e94C8',
|
|
88
|
+
l2Resolver: '0x85C87e548091f204C2d0350b39ce1874f02197c6',
|
|
89
|
+
};
|
|
90
|
+
export const SUPPORTED_TLDS = ['xyz', 'com', 'ai', 'org', 'io', 'net', 'co', 'app'];
|
|
91
|
+
export const PRIMARY_SUPPORTED_TLDS = SUPPORTED_TLDS;
|
|
92
|
+
export const SUPPORTED_FRAMEWORKS = [
|
|
93
|
+
'agentkit',
|
|
94
|
+
'eliza',
|
|
95
|
+
'crewai',
|
|
96
|
+
'langchain',
|
|
97
|
+
'openai',
|
|
98
|
+
'anthropic',
|
|
99
|
+
];
|
|
100
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAA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Aa,EAAE,4CAA4C;IAC3D,eAAe,EAAE,4CAA4C;CACrD,CAAC;AAEX,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,aAAa,EAAE,4CAA4C;IAC3D,mBAAmB,EAAE,4CAA4C;IACjE,UAAU,EAAE,4CAA4C;CAChD,CAAC;AAEX,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,aAAa,EAAE,4CAA4C;IAC3D,mBAAmB,EAAE,4CAA4C;IACjE,UAAU,EAAE,4CAA4C;CAChD,CAAC;AAEX,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAU,CAAC;AAE7F,MAAM,CAAC,MAAM,sBAAsB,GAAG,cAAc,CAAC;AAErD,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,UAAU;IACV,OAAO;IACP,QAAQ;IACR,WAAW;IACX,QAAQ;IACR,WAAW;CACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const addressSchema: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
3
|
+
export declare const domainLabelSchema: z.ZodString;
|
|
4
|
+
export declare const tldSchema: z.ZodEnum<["xyz", "com", "ai", "org", "io", "net", "co", "app"]>;
|
|
5
|
+
export declare const registrationParamsSchema: z.ZodObject<{
|
|
6
|
+
preferredName: z.ZodString;
|
|
7
|
+
tld: z.ZodEnum<["xyz", "com", "ai", "org", "io", "net", "co", "app"]>;
|
|
8
|
+
registerBasename: z.ZodDefault<z.ZodBoolean>;
|
|
9
|
+
basenameLabel: z.ZodOptional<z.ZodString>;
|
|
10
|
+
registerEns: z.ZodDefault<z.ZodBoolean>;
|
|
11
|
+
ensLabel: z.ZodOptional<z.ZodString>;
|
|
12
|
+
ownerAddress: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
13
|
+
emailEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
14
|
+
years: z.ZodDefault<z.ZodNumber>;
|
|
15
|
+
autoRenew: z.ZodDefault<z.ZodBoolean>;
|
|
16
|
+
discountCode: z.ZodOptional<z.ZodString>;
|
|
17
|
+
dnsTarget: z.ZodOptional<z.ZodString>;
|
|
18
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
name: z.ZodOptional<z.ZodString>;
|
|
20
|
+
description: z.ZodOptional<z.ZodString>;
|
|
21
|
+
imageUri: z.ZodOptional<z.ZodString>;
|
|
22
|
+
framework: z.ZodOptional<z.ZodString>;
|
|
23
|
+
capabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
24
|
+
x402Endpoint: z.ZodOptional<z.ZodString>;
|
|
25
|
+
socials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
name?: string | undefined;
|
|
28
|
+
description?: string | undefined;
|
|
29
|
+
imageUri?: string | undefined;
|
|
30
|
+
framework?: string | undefined;
|
|
31
|
+
capabilities?: string[] | undefined;
|
|
32
|
+
x402Endpoint?: string | undefined;
|
|
33
|
+
socials?: Record<string, string> | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
name?: string | undefined;
|
|
36
|
+
description?: string | undefined;
|
|
37
|
+
imageUri?: string | undefined;
|
|
38
|
+
framework?: string | undefined;
|
|
39
|
+
capabilities?: string[] | undefined;
|
|
40
|
+
x402Endpoint?: string | undefined;
|
|
41
|
+
socials?: Record<string, string> | undefined;
|
|
42
|
+
}>>;
|
|
43
|
+
wallet: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
44
|
+
turnstileToken: z.ZodOptional<z.ZodString>;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
preferredName: string;
|
|
47
|
+
tld: "xyz" | "com" | "ai" | "org" | "io" | "net" | "co" | "app";
|
|
48
|
+
registerBasename: boolean;
|
|
49
|
+
registerEns: boolean;
|
|
50
|
+
emailEnabled: boolean;
|
|
51
|
+
years: number;
|
|
52
|
+
autoRenew: boolean;
|
|
53
|
+
wallet: `0x${string}`;
|
|
54
|
+
basenameLabel?: string | undefined;
|
|
55
|
+
ensLabel?: string | undefined;
|
|
56
|
+
ownerAddress?: `0x${string}` | undefined;
|
|
57
|
+
discountCode?: string | undefined;
|
|
58
|
+
dnsTarget?: string | undefined;
|
|
59
|
+
metadata?: {
|
|
60
|
+
name?: string | undefined;
|
|
61
|
+
description?: string | undefined;
|
|
62
|
+
imageUri?: string | undefined;
|
|
63
|
+
framework?: string | undefined;
|
|
64
|
+
capabilities?: string[] | undefined;
|
|
65
|
+
x402Endpoint?: string | undefined;
|
|
66
|
+
socials?: Record<string, string> | undefined;
|
|
67
|
+
} | undefined;
|
|
68
|
+
turnstileToken?: string | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
preferredName: string;
|
|
71
|
+
tld: "xyz" | "com" | "ai" | "org" | "io" | "net" | "co" | "app";
|
|
72
|
+
wallet: string;
|
|
73
|
+
registerBasename?: boolean | undefined;
|
|
74
|
+
basenameLabel?: string | undefined;
|
|
75
|
+
registerEns?: boolean | undefined;
|
|
76
|
+
ensLabel?: string | undefined;
|
|
77
|
+
ownerAddress?: string | undefined;
|
|
78
|
+
emailEnabled?: boolean | undefined;
|
|
79
|
+
years?: number | undefined;
|
|
80
|
+
autoRenew?: boolean | undefined;
|
|
81
|
+
discountCode?: string | undefined;
|
|
82
|
+
dnsTarget?: string | undefined;
|
|
83
|
+
metadata?: {
|
|
84
|
+
name?: string | undefined;
|
|
85
|
+
description?: string | undefined;
|
|
86
|
+
imageUri?: string | undefined;
|
|
87
|
+
framework?: string | undefined;
|
|
88
|
+
capabilities?: string[] | undefined;
|
|
89
|
+
x402Endpoint?: string | undefined;
|
|
90
|
+
socials?: Record<string, string> | undefined;
|
|
91
|
+
} | undefined;
|
|
92
|
+
turnstileToken?: string | undefined;
|
|
93
|
+
}>;
|
|
94
|
+
export declare const searchQuerySchema: z.ZodObject<{
|
|
95
|
+
q: z.ZodOptional<z.ZodString>;
|
|
96
|
+
framework: z.ZodOptional<z.ZodString>;
|
|
97
|
+
capability: z.ZodOptional<z.ZodString>;
|
|
98
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
99
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
100
|
+
}, "strip", z.ZodTypeAny, {
|
|
101
|
+
limit: number;
|
|
102
|
+
offset: number;
|
|
103
|
+
framework?: string | undefined;
|
|
104
|
+
q?: string | undefined;
|
|
105
|
+
capability?: string | undefined;
|
|
106
|
+
}, {
|
|
107
|
+
framework?: string | undefined;
|
|
108
|
+
q?: string | undefined;
|
|
109
|
+
capability?: string | undefined;
|
|
110
|
+
limit?: number | undefined;
|
|
111
|
+
offset?: number | undefined;
|
|
112
|
+
}>;
|
|
113
|
+
export declare const dnsRecordSchema: z.ZodObject<{
|
|
114
|
+
type: z.ZodEnum<["A", "AAAA", "ALIAS", "CNAME", "MX", "TXT", "NS", "SRV"]>;
|
|
115
|
+
name: z.ZodString;
|
|
116
|
+
value: z.ZodString;
|
|
117
|
+
ttl: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
118
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
119
|
+
}, "strip", z.ZodTypeAny, {
|
|
120
|
+
name: string;
|
|
121
|
+
value: string;
|
|
122
|
+
type: "A" | "AAAA" | "ALIAS" | "CNAME" | "MX" | "TXT" | "NS" | "SRV";
|
|
123
|
+
ttl?: number | undefined;
|
|
124
|
+
priority?: number | undefined;
|
|
125
|
+
}, {
|
|
126
|
+
name: string;
|
|
127
|
+
value: string;
|
|
128
|
+
type: "A" | "AAAA" | "ALIAS" | "CNAME" | "MX" | "TXT" | "NS" | "SRV";
|
|
129
|
+
ttl?: number | undefined;
|
|
130
|
+
priority?: number | undefined;
|
|
131
|
+
}>;
|
|
132
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,aAAa,kDAGO,CAAC;AAElC,eAAO,MAAM,iBAAiB,aAO3B,CAAC;AAEJ,eAAO,MAAM,SAAS,kEASpB,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BnC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;EAM5B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;EAM1B,CAAC"}
|
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const addressSchema = z
|
|
3
|
+
.string()
|
|
4
|
+
.regex(/^0x[a-fA-F0-9]{40}$/)
|
|
5
|
+
.transform((v) => v);
|
|
6
|
+
export const domainLabelSchema = z
|
|
7
|
+
.string()
|
|
8
|
+
.min(3)
|
|
9
|
+
.max(63)
|
|
10
|
+
.regex(/^[a-z0-9][a-z0-9-]*[a-z0-9]$/, 'Must be lowercase alphanumeric with hyphens, no leading/trailing hyphens');
|
|
11
|
+
export const tldSchema = z.enum([
|
|
12
|
+
'xyz',
|
|
13
|
+
'com',
|
|
14
|
+
'ai',
|
|
15
|
+
'org',
|
|
16
|
+
'io',
|
|
17
|
+
'net',
|
|
18
|
+
'co',
|
|
19
|
+
'app',
|
|
20
|
+
]);
|
|
21
|
+
export const registrationParamsSchema = z.object({
|
|
22
|
+
preferredName: domainLabelSchema,
|
|
23
|
+
tld: tldSchema,
|
|
24
|
+
registerBasename: z.boolean().default(true),
|
|
25
|
+
basenameLabel: domainLabelSchema.optional(),
|
|
26
|
+
registerEns: z.boolean().default(false),
|
|
27
|
+
ensLabel: domainLabelSchema.optional(),
|
|
28
|
+
ownerAddress: addressSchema.optional(),
|
|
29
|
+
emailEnabled: z.boolean().default(false),
|
|
30
|
+
years: z.number().int().min(1).max(10).default(1),
|
|
31
|
+
autoRenew: z.boolean().default(false),
|
|
32
|
+
discountCode: z.string().max(50).optional(),
|
|
33
|
+
dnsTarget: z.string().optional(),
|
|
34
|
+
metadata: z
|
|
35
|
+
.object({
|
|
36
|
+
name: z.string().optional(),
|
|
37
|
+
description: z.string().optional(),
|
|
38
|
+
imageUri: z.string().optional(),
|
|
39
|
+
framework: z.string().optional(),
|
|
40
|
+
capabilities: z.array(z.string()).optional(),
|
|
41
|
+
x402Endpoint: z.string().optional(),
|
|
42
|
+
socials: z.record(z.string()).optional(),
|
|
43
|
+
})
|
|
44
|
+
.optional(),
|
|
45
|
+
wallet: addressSchema,
|
|
46
|
+
turnstileToken: z.string().optional(),
|
|
47
|
+
});
|
|
48
|
+
export const searchQuerySchema = z.object({
|
|
49
|
+
q: z.string().optional(),
|
|
50
|
+
framework: z.string().optional(),
|
|
51
|
+
capability: z.string().optional(),
|
|
52
|
+
limit: z.coerce.number().int().min(1).max(100).default(20),
|
|
53
|
+
offset: z.coerce.number().int().min(0).default(0),
|
|
54
|
+
});
|
|
55
|
+
export const dnsRecordSchema = z.object({
|
|
56
|
+
type: z.enum(['A', 'AAAA', 'ALIAS', 'CNAME', 'MX', 'TXT', 'NS', 'SRV']),
|
|
57
|
+
name: z.string().min(1).max(253),
|
|
58
|
+
value: z.string().min(1).max(4096),
|
|
59
|
+
ttl: z.number().int().min(60).max(3600).default(3600).optional(),
|
|
60
|
+
priority: z.number().int().min(0).optional(),
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KAC3B,MAAM,EAAE;KACR,KAAK,CAAC,qBAAqB,CAAC;KAC5B,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAY,CAAC,CAAC;AAElC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,EAAE,CAAC;KACP,KAAK,CACJ,8BAA8B,EAC9B,0EAA0E,CAC3E,CAAC;AAEJ,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC;IAC9B,KAAK;IACL,KAAK;IACL,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,KAAK;CACN,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,aAAa,EAAE,iBAAiB;IAChC,GAAG,EAAE,SAAS;IACd,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3C,aAAa,EAAE,iBAAiB,CAAC,QAAQ,EAAE;IAC3C,WAAW,EAA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EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC7C,CAAC,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { Address, Hex } from 'viem';
|
|
2
|
+
import { SERVICE_PLAN_INTERVALS, SERVICE_PLAN_KEYS, SUPPORTED_TLDS } from './constants';
|
|
3
|
+
export type SupportedTld = (typeof SUPPORTED_TLDS)[number];
|
|
4
|
+
export type ServicePlanKey = (typeof SERVICE_PLAN_KEYS)[number];
|
|
5
|
+
export type ServicePlanInterval = (typeof SERVICE_PLAN_INTERVALS)[number];
|
|
6
|
+
export interface ServicePlanLimits {
|
|
7
|
+
emailPerHour: number;
|
|
8
|
+
emailPerDay: number;
|
|
9
|
+
apiKeys: number;
|
|
10
|
+
dnsRecords: number;
|
|
11
|
+
emailRetentionDays: number;
|
|
12
|
+
}
|
|
13
|
+
export interface ServicePlanEntitlement {
|
|
14
|
+
plan: ServicePlanKey;
|
|
15
|
+
status: 'included' | 'active' | 'expired' | 'canceled';
|
|
16
|
+
interval: ServicePlanInterval | null;
|
|
17
|
+
autoRenew: boolean;
|
|
18
|
+
currentPeriodStart: string | null;
|
|
19
|
+
currentPeriodEnd: string | null;
|
|
20
|
+
limits: ServicePlanLimits;
|
|
21
|
+
supportTier: string;
|
|
22
|
+
registryPriority: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface RegistrationParams {
|
|
25
|
+
preferredName: string;
|
|
26
|
+
tld: SupportedTld;
|
|
27
|
+
registerBasename: boolean;
|
|
28
|
+
basenameLabel?: string;
|
|
29
|
+
registerEns: boolean;
|
|
30
|
+
ensLabel?: string;
|
|
31
|
+
ownerAddress?: Address;
|
|
32
|
+
emailEnabled: boolean;
|
|
33
|
+
years: number;
|
|
34
|
+
autoRenew: boolean;
|
|
35
|
+
discountCode?: string;
|
|
36
|
+
dnsTarget?: string;
|
|
37
|
+
metadata?: AgentMetadata;
|
|
38
|
+
wallet: Address;
|
|
39
|
+
turnstileToken?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface RegistrationResult {
|
|
42
|
+
registrationId?: string;
|
|
43
|
+
agentId: string;
|
|
44
|
+
nftTokenId: number;
|
|
45
|
+
domain: string;
|
|
46
|
+
basename: string | null;
|
|
47
|
+
ensName: string | null;
|
|
48
|
+
txHash: Hex;
|
|
49
|
+
sslStatus: string;
|
|
50
|
+
estimatedReadyAt: string;
|
|
51
|
+
metadataUri: string;
|
|
52
|
+
renewalSnapshot?: RenewalPriceSnapshot;
|
|
53
|
+
provisioningStatus?: 'completed' | 'processing' | 'recovery_required';
|
|
54
|
+
provisioningMessage?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface AgentMetadata {
|
|
57
|
+
name?: string;
|
|
58
|
+
description?: string;
|
|
59
|
+
imageUri?: string;
|
|
60
|
+
framework?: string;
|
|
61
|
+
capabilities?: string[];
|
|
62
|
+
x402Endpoint?: string;
|
|
63
|
+
socials?: Record<string, string>;
|
|
64
|
+
}
|
|
65
|
+
export interface PricingBreakdown {
|
|
66
|
+
domainCostUsdc: string;
|
|
67
|
+
basenameCostUsdc: string;
|
|
68
|
+
ensCostUsdc: string;
|
|
69
|
+
serviceFeeUsdc: string;
|
|
70
|
+
emailFeeUsdc: string;
|
|
71
|
+
sslCertificationFeeUsdc: string;
|
|
72
|
+
providerCostUsdc: string;
|
|
73
|
+
treasuryFeeUsdc: string;
|
|
74
|
+
totalUsdc: string;
|
|
75
|
+
}
|
|
76
|
+
export type RenewalSnapshotItemKey = 'domain' | 'ssl' | 'email' | 'basename' | 'ens';
|
|
77
|
+
export interface RenewalPriceSnapshotItem {
|
|
78
|
+
key: RenewalSnapshotItemKey;
|
|
79
|
+
label: string;
|
|
80
|
+
name?: string;
|
|
81
|
+
selected: boolean;
|
|
82
|
+
provisioned: boolean;
|
|
83
|
+
includedInAutoRenew: boolean;
|
|
84
|
+
amountUsdc: string | null;
|
|
85
|
+
amountAtomic: string | null;
|
|
86
|
+
source: 'spaceship' | 'agentdomain' | 'ses' | 'basenames' | 'ens';
|
|
87
|
+
note?: string;
|
|
88
|
+
}
|
|
89
|
+
export interface RenewalPriceSnapshot {
|
|
90
|
+
version: 1;
|
|
91
|
+
capturedAt: string;
|
|
92
|
+
years: number;
|
|
93
|
+
currency: 'USDC';
|
|
94
|
+
autoRenewTotalUsdc: string;
|
|
95
|
+
autoRenewTotalAtomic: string;
|
|
96
|
+
fullServiceTotalUsdc: string | null;
|
|
97
|
+
fullServiceTotalAtomic: string | null;
|
|
98
|
+
items: RenewalPriceSnapshotItem[];
|
|
99
|
+
warnings: string[];
|
|
100
|
+
}
|
|
101
|
+
export type DnsRecordType = 'A' | 'AAAA' | 'ALIAS' | 'CNAME' | 'MX' | 'TXT' | 'NS' | 'SRV';
|
|
102
|
+
export interface DnsRecord {
|
|
103
|
+
id: string;
|
|
104
|
+
type: DnsRecordType;
|
|
105
|
+
name: string;
|
|
106
|
+
value: string;
|
|
107
|
+
ttl: number;
|
|
108
|
+
priority?: number | null;
|
|
109
|
+
systemManaged?: boolean;
|
|
110
|
+
purpose?: string | null;
|
|
111
|
+
}
|
|
112
|
+
export interface EmailMessage {
|
|
113
|
+
id: string;
|
|
114
|
+
direction: 'inbound' | 'outbound';
|
|
115
|
+
providerMessageId?: string | null;
|
|
116
|
+
fromAddress: string;
|
|
117
|
+
toAddress?: string | null;
|
|
118
|
+
subject?: string | null;
|
|
119
|
+
text?: string | null;
|
|
120
|
+
verificationCodes?: string[] | null;
|
|
121
|
+
spamVerdict?: string | null;
|
|
122
|
+
virusVerdict?: string | null;
|
|
123
|
+
receivedAt: string;
|
|
124
|
+
read: boolean;
|
|
125
|
+
}
|
|
126
|
+
export interface X402PaymentRequirement {
|
|
127
|
+
scheme: string;
|
|
128
|
+
network: string;
|
|
129
|
+
maxAmountRequired: string;
|
|
130
|
+
resource: string;
|
|
131
|
+
description: string;
|
|
132
|
+
mimeType: string;
|
|
133
|
+
payTo: Address;
|
|
134
|
+
maxTimeoutSeconds: number;
|
|
135
|
+
asset: Address;
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAExF,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAC3D,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAChE,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1E,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,EAAE,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;IACvD,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,YAAY,CAAC;I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C;IACf,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,OAAO,CAAC;CAChB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ServicePlanInterval, ServicePlanKey } from './types';
|
|
2
|
+
export declare function parseUsdc(amount: string): bigint;
|
|
3
|
+
export declare function formatUsdcAtomic(value: bigint): string;
|
|
4
|
+
export declare function getServicePlanPriceAtomic(plan: ServicePlanKey, interval: ServicePlanInterval): bigint;
|
|
5
|
+
export declare function addServicePlanInterval(date: Date, interval: ServicePlanInterval): Date;
|
|
6
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
7
|
+
export declare function retry<T>(fn: () => Promise<T>, opts?: {
|
|
8
|
+
attempts?: number;
|
|
9
|
+
baseDelayMs?: number;
|
|
10
|
+
}): Promise<T>;
|
|
11
|
+
export declare function buildDomain(name: string, tld: string): string;
|
|
12
|
+
export declare function buildBasename(label: string): string;
|
|
13
|
+
export declare function buildEnsName(label: string): string;
|
|
14
|
+
export declare function usesRenewalPriceForFirstYear(tld: string): boolean;
|
|
15
|
+
export declare function isReservedName(name: string): boolean;
|
|
16
|
+
export interface ComputeRegistrationCostOptions {
|
|
17
|
+
tld: string;
|
|
18
|
+
registerBasename: boolean;
|
|
19
|
+
registerEns: boolean;
|
|
20
|
+
emailEnabled?: boolean;
|
|
21
|
+
years?: number;
|
|
22
|
+
serviceFee: bigint;
|
|
23
|
+
emailFee?: bigint;
|
|
24
|
+
sslCertificationFee?: bigint;
|
|
25
|
+
domainMarkup: bigint;
|
|
26
|
+
domainCost: bigint;
|
|
27
|
+
basenameFee: bigint;
|
|
28
|
+
basenameCost: bigint;
|
|
29
|
+
ensFee: bigint;
|
|
30
|
+
ensCost: bigint;
|
|
31
|
+
}
|
|
32
|
+
export interface ComputeRegistrationCostResult {
|
|
33
|
+
domainCost: bigint;
|
|
34
|
+
basenameCost: bigint;
|
|
35
|
+
ensCost: bigint;
|
|
36
|
+
serviceFee: bigint;
|
|
37
|
+
emailFee: bigint;
|
|
38
|
+
sslCertificationFee: bigint;
|
|
39
|
+
total: bigint;
|
|
40
|
+
}
|
|
41
|
+
export declare function computeRegistrationCost(opts: ComputeRegistrationCostOptions): ComputeRegistrationCostResult;
|
|
42
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEnE,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAIhD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMtD;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,mBAAmB,GAC5B,MAAM,CAGR;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAQtF;AAED,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED,wBAAsB,KAAK,CAAC,CAAC,EAC3B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GACjD,OAAO,CAAC,CAAC,CAAC,CAeZ;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAKjE;AAkBD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,MAAM,WAAW,8BAA8B;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,6BAA6B;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,8BAA8B,GACnC,6BAA6B,CA2B/B"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { SERVICE_PLAN_CATALOG, SSL_CERTIFICATION_FEE_USDC_ATOMIC, USDC_DECIMALS, } from './constants';
|
|
2
|
+
export function parseUsdc(amount) {
|
|
3
|
+
const [whole, frac = ''] = amount.replace(/[^0-9.]/g, '').split('.');
|
|
4
|
+
const padded = (frac || '').padEnd(USDC_DECIMALS, '0').slice(0, USDC_DECIMALS);
|
|
5
|
+
return BigInt(whole + padded);
|
|
6
|
+
}
|
|
7
|
+
export function formatUsdcAtomic(value) {
|
|
8
|
+
const base = 10n ** BigInt(USDC_DECIMALS);
|
|
9
|
+
const whole = value / base;
|
|
10
|
+
const fraction = value % base;
|
|
11
|
+
if (fraction === 0n)
|
|
12
|
+
return whole.toString();
|
|
13
|
+
return `${whole}.${fraction.toString().padStart(USDC_DECIMALS, '0').replace(/0+$/, '')}`;
|
|
14
|
+
}
|
|
15
|
+
export function getServicePlanPriceAtomic(plan, interval) {
|
|
16
|
+
const entry = SERVICE_PLAN_CATALOG[plan];
|
|
17
|
+
return interval === 'monthly' ? entry.monthlyPriceUsdcAtomic : entry.yearlyPriceUsdcAtomic;
|
|
18
|
+
}
|
|
19
|
+
export function addServicePlanInterval(date, interval) {
|
|
20
|
+
const out = new Date(date);
|
|
21
|
+
if (interval === 'monthly') {
|
|
22
|
+
out.setUTCMonth(out.getUTCMonth() + 1);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
out.setUTCFullYear(out.getUTCFullYear() + 1);
|
|
26
|
+
}
|
|
27
|
+
return out;
|
|
28
|
+
}
|
|
29
|
+
export function sleep(ms) {
|
|
30
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
31
|
+
}
|
|
32
|
+
export async function retry(fn, opts) {
|
|
33
|
+
const maxAttempts = opts?.attempts ?? 3;
|
|
34
|
+
const baseDelay = opts?.baseDelayMs ?? 1000;
|
|
35
|
+
let lastError;
|
|
36
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
37
|
+
try {
|
|
38
|
+
return await fn();
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
lastError = e;
|
|
42
|
+
if (i < maxAttempts - 1) {
|
|
43
|
+
await sleep(baseDelay * Math.pow(2, i));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
throw lastError;
|
|
48
|
+
}
|
|
49
|
+
export function buildDomain(name, tld) {
|
|
50
|
+
return `${name}.${tld}`;
|
|
51
|
+
}
|
|
52
|
+
export function buildBasename(label) {
|
|
53
|
+
return `${label}.base.eth`;
|
|
54
|
+
}
|
|
55
|
+
export function buildEnsName(label) {
|
|
56
|
+
return `${label}.eth`;
|
|
57
|
+
}
|
|
58
|
+
export function usesRenewalPriceForFirstYear(tld) {
|
|
59
|
+
// Some TLDs always use renewal pricing; others use promo pricing for the first year.
|
|
60
|
+
// This is a simplified version — adjust per registrar partner pricing.
|
|
61
|
+
const renewalTlds = new Set(['com', 'net', 'org', 'io', 'co', 'ai']);
|
|
62
|
+
return renewalTlds.has(tld);
|
|
63
|
+
}
|
|
64
|
+
const RESERVED_NAMES = new Set([
|
|
65
|
+
'admin',
|
|
66
|
+
'root',
|
|
67
|
+
'system',
|
|
68
|
+
'www',
|
|
69
|
+
'mail',
|
|
70
|
+
'smtp',
|
|
71
|
+
'pop',
|
|
72
|
+
'imap',
|
|
73
|
+
'ftp',
|
|
74
|
+
'api',
|
|
75
|
+
'app',
|
|
76
|
+
'ns1',
|
|
77
|
+
'ns2',
|
|
78
|
+
]);
|
|
79
|
+
export function isReservedName(name) {
|
|
80
|
+
return RESERVED_NAMES.has(name.toLowerCase());
|
|
81
|
+
}
|
|
82
|
+
export function computeRegistrationCost(opts) {
|
|
83
|
+
const years = Math.max(1, opts.years ?? 1);
|
|
84
|
+
const yearlyServiceFee = opts.serviceFee;
|
|
85
|
+
const serviceFee = yearlyServiceFee * BigInt(years);
|
|
86
|
+
const emailFee = opts.emailEnabled ? (opts.emailFee ?? 0n) * BigInt(years) : 0n;
|
|
87
|
+
const sslCertificationFee = (opts.sslCertificationFee ?? SSL_CERTIFICATION_FEE_USDC_ATOMIC) * BigInt(years);
|
|
88
|
+
let total = opts.domainCost + opts.domainMarkup + serviceFee + emailFee + sslCertificationFee;
|
|
89
|
+
const result = {
|
|
90
|
+
domainCost: opts.domainCost,
|
|
91
|
+
basenameCost: 0n,
|
|
92
|
+
ensCost: 0n,
|
|
93
|
+
serviceFee,
|
|
94
|
+
emailFee,
|
|
95
|
+
sslCertificationFee,
|
|
96
|
+
total: 0n,
|
|
97
|
+
};
|
|
98
|
+
if (opts.registerBasename) {
|
|
99
|
+
total += opts.basenameFee + opts.basenameCost;
|
|
100
|
+
result.basenameCost = opts.basenameCost;
|
|
101
|
+
}
|
|
102
|
+
if (opts.registerEns) {
|
|
103
|
+
total += opts.ensFee + opts.ensCost;
|
|
104
|
+
result.ensCost = opts.ensCost;
|
|
105
|
+
}
|
|
106
|
+
result.total = total;
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,iCAAiC,EACjC,aAAa,GACd,MAAM,aAAa,CAAC;AAGrB,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,MAAM,CAAC,KAAK,EAAE,IAAI,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrE,MAAM,MAAM,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;IAC/E,OAAO,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,MAAM,IAAI,GAAG,GAAG,IAAI,MAAM,CAAC,aAAa,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC;IAC3B,MAAM,QAAQ,GAAG,KAAK,GAAG,IAAI,CA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,OAAO,CAAC;IAChC,CAAC;IACD,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentdomain/shared",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared constants, schemas, types, and utilities for AgentDomain",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./constants": {
|
|
15
|
+
"types": "./dist/constants.d.ts",
|
|
16
|
+
"import": "./dist/constants.js"
|
|
17
|
+
},
|
|
18
|
+
"./types": {
|
|
19
|
+
"types": "./dist/types.d.ts",
|
|
20
|
+
"import": "./dist/types.js"
|
|
21
|
+
},
|
|
22
|
+
"./schemas": {
|
|
23
|
+
"types": "./dist/schemas.d.ts",
|
|
24
|
+
"import": "./dist/schemas.js"
|
|
25
|
+
},
|
|
26
|
+
"./utils": {
|
|
27
|
+
"types": "./dist/utils.d.ts",
|
|
28
|
+
"import": "./dist/utils.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"README.md",
|
|
34
|
+
"package.json"
|
|
35
|
+
],
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsc",
|
|
41
|
+
"prepublishOnly": "pnpm run build",
|
|
42
|
+
"typecheck": "tsc --noEmit",
|
|
43
|
+
"lint": "echo ok"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"viem": "^2.21.55",
|
|
47
|
+
"zod": "^3.24.1"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"typescript": "^5.7.2"
|
|
51
|
+
}
|
|
52
|
+
}
|