@multiagency/sdk 0.3.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 (78) hide show
  1. package/CHANGES.md +21 -0
  2. package/LICENSE +21 -0
  3. package/README.md +142 -0
  4. package/THIRD-PARTY-NOTICES +127 -0
  5. package/bin/release-server.d.mts +29 -0
  6. package/bin/release-server.mjs +143 -0
  7. package/dist/compensation-contract.d.ts +370 -0
  8. package/dist/compensation-contract.js +51 -0
  9. package/dist/contract/agent-connection.d.ts +86 -0
  10. package/dist/contract/agent-connection.js +36 -0
  11. package/dist/contract/app-access.d.ts +141 -0
  12. package/dist/contract/app-access.js +57 -0
  13. package/dist/contract/app-client.d.ts +140 -0
  14. package/dist/contract/app-client.js +61 -0
  15. package/dist/contract/app-consent.d.ts +68 -0
  16. package/dist/contract/app-consent.js +91 -0
  17. package/dist/contract/assets.d.ts +6 -0
  18. package/dist/contract/assets.js +6 -0
  19. package/dist/contract/client.d.ts +347 -0
  20. package/dist/contract/client.js +81 -0
  21. package/dist/contract/gateway.d.ts +74 -0
  22. package/dist/contract/gateway.js +47 -0
  23. package/dist/contract/index.d.ts +26 -0
  24. package/dist/contract/index.js +25 -0
  25. package/dist/contract/inputs.d.ts +230 -0
  26. package/dist/contract/inputs.js +99 -0
  27. package/dist/contract/intents-account.d.ts +5 -0
  28. package/dist/contract/intents-account.js +8 -0
  29. package/dist/contract/orpc-client.js +2037 -0
  30. package/dist/contract/owner-capabilities.d.ts +81 -0
  31. package/dist/contract/owner-capabilities.js +33 -0
  32. package/dist/contract/owner-client.d.ts +99 -0
  33. package/dist/contract/owner-client.js +146 -0
  34. package/dist/contract/owner-contract.d.ts +1156 -0
  35. package/dist/contract/owner-contract.js +37 -0
  36. package/dist/contract/owner-inputs.d.ts +166 -0
  37. package/dist/contract/owner-inputs.js +1 -0
  38. package/dist/contract/owner-outputs.d.ts +5749 -0
  39. package/dist/contract/owner-outputs.js +751 -0
  40. package/dist/contract/package-version.d.ts +5 -0
  41. package/dist/contract/package-version.js +2 -0
  42. package/dist/contract/payee-entry.d.ts +10 -0
  43. package/dist/contract/payee-entry.js +10 -0
  44. package/dist/contract/payee.d.ts +326 -0
  45. package/dist/contract/payee.js +32 -0
  46. package/dist/contract/permissions.d.ts +20 -0
  47. package/dist/contract/permissions.js +64 -0
  48. package/dist/contract/proposals.d.ts +178 -0
  49. package/dist/contract/proposals.js +27 -0
  50. package/dist/contract/run-log-schema.d.ts +888 -0
  51. package/dist/contract/run-log-schema.js +150 -0
  52. package/dist/contract/run-progress-schema.d.ts +104 -0
  53. package/dist/contract/run-progress-schema.js +20 -0
  54. package/dist/payee-contract.d.ts +9 -0
  55. package/dist/payee-contract.js +15 -0
  56. package/package.json +58 -0
  57. package/provenance.json +61 -0
  58. package/schemas/agentConnection.json +76 -0
  59. package/schemas/agentConnectionIssue.json +22 -0
  60. package/schemas/agentConnectionList.json +88 -0
  61. package/schemas/agentConnectionStarted.json +90 -0
  62. package/schemas/compensationSend.json +40 -0
  63. package/schemas/errorBody.json +16 -0
  64. package/schemas/fileResult.json +67 -0
  65. package/schemas/invoicesView.json +130 -0
  66. package/schemas/ownerCompensationView.json +556 -0
  67. package/schemas/payeeCompensationView.json +546 -0
  68. package/schemas/payeeWorkOrderRequest.json +31 -0
  69. package/schemas/publicWorkOrder.json +94 -0
  70. package/schemas/reportCommand.json +82 -0
  71. package/schemas/requestRecord.json +149 -0
  72. package/schemas/session.json +20 -0
  73. package/schemas/workOrderList.json +43 -0
  74. package/schemas/workOrderRequestResult.json +20 -0
  75. package/skills/app-server/SKILL.md +190 -0
  76. package/skills/getting-started/SKILL.md +90 -0
  77. package/skills/owner-workflows/SKILL.md +157 -0
  78. package/skills/payee-workflows/SKILL.md +200 -0
@@ -0,0 +1,230 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Owner procedure inputs: the one source the server implements (src/rpc/*) and clients are typed from
4
+ * (owner-contract.ts). Pure schemas only, so the package stays browser-safe.
5
+ */
6
+ export declare const run: z.ZodObject<{
7
+ execute: z.ZodBoolean;
8
+ }, z.core.$strip>;
9
+ export declare const account: z.ZodString;
10
+ export declare const transferAccount: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
11
+ export declare const units: z.ZodString;
12
+ /** A NEAR account paid by withdrawal to chain `near`: never a `nearcom:` address, which is not on any chain. */
13
+ export declare const nearAccount: z.ZodString;
14
+ /** A USD amount in the policy's budget; null leaves that window uncapped. */
15
+ export declare const usdAmount: z.ZodNullable<z.ZodString>;
16
+ /** Per-asset caps in raw units. */
17
+ export declare const caps: z.ZodRecord<z.ZodString, z.ZodString>;
18
+ export declare const reviewedPolicy: z.ZodObject<{
19
+ revision: z.ZodNumber;
20
+ digest: z.ZodString;
21
+ }, z.core.$strip>;
22
+ /**
23
+ * What a grant's label says it is for: the agent's own strategies, its payouts, or invoices (the
24
+ * public invoice page). Each purpose (see authorize.ts) names the grant labels that may act for it.
25
+ */
26
+ export declare const GRANT_LABELS: readonly ["treasury", "payout", "invoices"];
27
+ export type GrantLabel = (typeof GRANT_LABELS)[number];
28
+ /** An owner action to prepare for signature (owner-intents.ts `prepare`). */
29
+ export declare const ownerAction: z.ZodDiscriminatedUnion<[z.ZodObject<{
30
+ type: z.ZodLiteral<"agent_create">;
31
+ owner: z.ZodOptional<z.ZodObject<{
32
+ type: z.ZodLiteral<"near">;
33
+ account_id: z.ZodString;
34
+ public_key: z.ZodString;
35
+ }, z.core.$strip>>;
36
+ role: z.ZodOptional<z.ZodEnum<{
37
+ payout: "payout";
38
+ treasury: "treasury";
39
+ }>>;
40
+ payees: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
41
+ }, z.core.$strip>, z.ZodObject<{
42
+ type: z.ZodLiteral<"grant_issue">;
43
+ label: z.ZodOptional<z.ZodEnum<{
44
+ invoices: "invoices";
45
+ payout: "payout";
46
+ treasury: "treasury";
47
+ }>>;
48
+ suffix: z.ZodOptional<z.ZodString>;
49
+ expectedStrategyDigest: z.ZodOptional<z.ZodString>;
50
+ }, z.core.$strip>, z.ZodObject<{
51
+ type: z.ZodLiteral<"grant_revoke">;
52
+ grantId: z.ZodString;
53
+ }, z.core.$strip>, z.ZodObject<{
54
+ type: z.ZodLiteral<"agent_freeze">;
55
+ }, z.core.$strip>, z.ZodObject<{
56
+ type: z.ZodLiteral<"agent_unfreeze">;
57
+ }, z.core.$strip>, z.ZodObject<{
58
+ type: z.ZodLiteral<"policy_update">;
59
+ expectedPolicy: z.ZodObject<{
60
+ revision: z.ZodNumber;
61
+ digest: z.ZodString;
62
+ }, z.core.$strip>;
63
+ changes: z.ZodObject<{
64
+ swap: z.ZodOptional<z.ZodBoolean>;
65
+ destinations: z.ZodOptional<z.ZodArray<z.ZodObject<{
66
+ address: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
67
+ confidential: z.ZodBoolean;
68
+ }, z.core.$strip>>>;
69
+ withdrawals: z.ZodOptional<z.ZodArray<z.ZodObject<{
70
+ address: z.ZodString;
71
+ }, z.core.$strip>>>;
72
+ assets: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"any">, z.ZodArray<z.ZodString>]>>;
73
+ owner_approval: z.ZodOptional<z.ZodBoolean>;
74
+ max_actions_per_hour: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
75
+ budget: z.ZodOptional<z.ZodObject<{
76
+ daily_usd: z.ZodNullable<z.ZodString>;
77
+ weekly_usd: z.ZodNullable<z.ZodString>;
78
+ monthly_usd: z.ZodNullable<z.ZodString>;
79
+ }, z.core.$strip>>;
80
+ limits: z.ZodOptional<z.ZodObject<{
81
+ per_transaction: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
82
+ hourly: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
83
+ daily: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
84
+ monthly: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
85
+ }, z.core.$strip>>;
86
+ }, z.core.$strip>;
87
+ }, z.core.$strip>, z.ZodObject<{
88
+ type: z.ZodLiteral<"approval_vote">;
89
+ approvalId: z.ZodUUID;
90
+ verdict: z.ZodEnum<{
91
+ approve: "approve";
92
+ reject: "reject";
93
+ }>;
94
+ correlationId: z.ZodString;
95
+ }, z.core.$strip>], "type">;
96
+ export declare const ownerPrepareInput: z.ZodObject<{
97
+ action: z.ZodDiscriminatedUnion<[z.ZodObject<{
98
+ type: z.ZodLiteral<"agent_create">;
99
+ owner: z.ZodOptional<z.ZodObject<{
100
+ type: z.ZodLiteral<"near">;
101
+ account_id: z.ZodString;
102
+ public_key: z.ZodString;
103
+ }, z.core.$strip>>;
104
+ role: z.ZodOptional<z.ZodEnum<{
105
+ payout: "payout";
106
+ treasury: "treasury";
107
+ }>>;
108
+ payees: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
109
+ }, z.core.$strip>, z.ZodObject<{
110
+ type: z.ZodLiteral<"grant_issue">;
111
+ label: z.ZodOptional<z.ZodEnum<{
112
+ invoices: "invoices";
113
+ payout: "payout";
114
+ treasury: "treasury";
115
+ }>>;
116
+ suffix: z.ZodOptional<z.ZodString>;
117
+ expectedStrategyDigest: z.ZodOptional<z.ZodString>;
118
+ }, z.core.$strip>, z.ZodObject<{
119
+ type: z.ZodLiteral<"grant_revoke">;
120
+ grantId: z.ZodString;
121
+ }, z.core.$strip>, z.ZodObject<{
122
+ type: z.ZodLiteral<"agent_freeze">;
123
+ }, z.core.$strip>, z.ZodObject<{
124
+ type: z.ZodLiteral<"agent_unfreeze">;
125
+ }, z.core.$strip>, z.ZodObject<{
126
+ type: z.ZodLiteral<"policy_update">;
127
+ expectedPolicy: z.ZodObject<{
128
+ revision: z.ZodNumber;
129
+ digest: z.ZodString;
130
+ }, z.core.$strip>;
131
+ changes: z.ZodObject<{
132
+ swap: z.ZodOptional<z.ZodBoolean>;
133
+ destinations: z.ZodOptional<z.ZodArray<z.ZodObject<{
134
+ address: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
135
+ confidential: z.ZodBoolean;
136
+ }, z.core.$strip>>>;
137
+ withdrawals: z.ZodOptional<z.ZodArray<z.ZodObject<{
138
+ address: z.ZodString;
139
+ }, z.core.$strip>>>;
140
+ assets: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"any">, z.ZodArray<z.ZodString>]>>;
141
+ owner_approval: z.ZodOptional<z.ZodBoolean>;
142
+ max_actions_per_hour: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
143
+ budget: z.ZodOptional<z.ZodObject<{
144
+ daily_usd: z.ZodNullable<z.ZodString>;
145
+ weekly_usd: z.ZodNullable<z.ZodString>;
146
+ monthly_usd: z.ZodNullable<z.ZodString>;
147
+ }, z.core.$strip>>;
148
+ limits: z.ZodOptional<z.ZodObject<{
149
+ per_transaction: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
150
+ hourly: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
151
+ daily: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
152
+ monthly: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
153
+ }, z.core.$strip>>;
154
+ }, z.core.$strip>;
155
+ }, z.core.$strip>, z.ZodObject<{
156
+ type: z.ZodLiteral<"approval_vote">;
157
+ approvalId: z.ZodUUID;
158
+ verdict: z.ZodEnum<{
159
+ approve: "approve";
160
+ reject: "reject";
161
+ }>;
162
+ correlationId: z.ZodString;
163
+ }, z.core.$strip>], "type">;
164
+ signer: z.ZodEnum<{
165
+ dao: "dao";
166
+ wallet: "wallet";
167
+ }>;
168
+ }, z.core.$strip>;
169
+ /**
170
+ * A payout an app or owner asks for under its own `requestId`, stored before calling: the same request is sent at
171
+ * most once, and `payouts/status` answers it by `requestId`. A new attempt is a new `requestId`, after a refusal.
172
+ */
173
+ export declare const payoutRequestId: z.ZodString;
174
+ export declare const payoutRequestInput: z.ZodPipe<z.ZodObject<{
175
+ requestId: z.ZodString;
176
+ asset: z.ZodString;
177
+ delivery: z.ZodUnion<readonly [z.ZodLiteral<"intents">, z.ZodObject<{
178
+ chain: z.ZodString;
179
+ }, z.core.$strip>]>;
180
+ recipient: z.ZodString;
181
+ amount: z.ZodString;
182
+ expectedPolicy: z.ZodObject<{
183
+ revision: z.ZodNumber;
184
+ digest: z.ZodString;
185
+ }, z.core.$strip>;
186
+ }, z.core.$strip>, z.ZodTransform<{
187
+ requestId: string;
188
+ asset: string;
189
+ delivery: "intents" | {
190
+ chain: string;
191
+ };
192
+ recipient: string;
193
+ amount: string;
194
+ expectedPolicy: {
195
+ revision: number;
196
+ digest: string;
197
+ };
198
+ }, {
199
+ requestId: string;
200
+ asset: string;
201
+ delivery: "intents" | {
202
+ chain: string;
203
+ };
204
+ recipient: string;
205
+ amount: string;
206
+ expectedPolicy: {
207
+ revision: number;
208
+ digest: string;
209
+ };
210
+ }>>;
211
+ export declare const payoutStatusInput: z.ZodObject<{
212
+ requestId: z.ZodString;
213
+ }, z.core.$strip>;
214
+ /** A deposit address for the asset to fund (default USDC); wNEAR funds withdrawals that arrive as native NEAR. */
215
+ export declare const depositInput: z.ZodOptional<z.ZodObject<{
216
+ asset: z.ZodOptional<z.ZodEnum<{
217
+ "nep141:17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1": "nep141:17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1";
218
+ "nep141:wrap.near": "nep141:wrap.near";
219
+ }>>;
220
+ }, z.core.$strip>>;
221
+ export declare const ownerSubmitInput: z.ZodObject<{
222
+ correlationId: z.ZodString;
223
+ signedData: z.ZodRecord<z.ZodString, z.ZodUnknown>;
224
+ }, z.core.$strip>;
225
+ export declare const ownerStatusInput: z.ZodObject<{
226
+ correlationId: z.ZodString;
227
+ }, z.core.$strip>;
228
+ export declare const executePlanInput: z.ZodObject<{
229
+ planId: z.ZodUUID;
230
+ }, z.core.$strip>;
@@ -0,0 +1,99 @@
1
+ import { z } from "zod";
2
+ import { intentsAccount, isNearcomAddress, validIntentsAccount } from "./intents-account.js";
3
+ /**
4
+ * Owner procedure inputs: the one source the server implements (src/rpc/*) and clients are typed from
5
+ * (owner-contract.ts). Pure schemas only, so the package stays browser-safe.
6
+ */
7
+ export const run = z.object({ execute: z.boolean() });
8
+ export const account = z.string().trim().min(2).max(64);
9
+ // Only owner-entered Intents destinations: owner identities and provider evidence stay unchanged.
10
+ export const transferAccount = z.string().transform(intentsAccount).refine(validIntentsAccount, "Enter a NEAR Intents account or nearcom: address");
11
+ export const units = z.string().regex(/^[0-9]{1,40}$/, "an atomic integer amount");
12
+ /** A NEAR account paid by withdrawal to chain `near`: never a `nearcom:` address, which is not on any chain. */
13
+ export const nearAccount = z.string().trim().refine((value) => !isNearcomAddress(value) && validIntentsAccount(value), "Enter a NEAR account");
14
+ /** A USD amount in the policy's budget; null leaves that window uncapped. */
15
+ export const usdAmount = z.string().regex(/^\d+(\.\d+)?$/).nullable();
16
+ /** Per-asset caps in raw units. */
17
+ export const caps = z.record(z.string(), units);
18
+ export const reviewedPolicy = z.object({ revision: z.number().int().nonnegative(), digest: z.string().regex(/^sha256:[0-9a-f]{64}$/) });
19
+ const digest = z.string().regex(/^sha256:[0-9a-f]{64}$/);
20
+ /**
21
+ * What a grant's label says it is for: the agent's own strategies, its payouts, or invoices (the
22
+ * public invoice page). Each purpose (see authorize.ts) names the grant labels that may act for it.
23
+ */
24
+ export const GRANT_LABELS = ["treasury", "payout", "invoices"];
25
+ /** An owner action to prepare for signature (owner-intents.ts `prepare`). */
26
+ export const ownerAction = z.discriminatedUnion("type", [
27
+ z.object({
28
+ type: z.literal("agent_create"),
29
+ owner: z.object({ type: z.literal("near"), account_id: z.string(), public_key: z.string() }).optional(),
30
+ role: z.enum(["treasury", "payout"]).optional(),
31
+ payees: z.array(transferAccount).max(256).optional(),
32
+ }),
33
+ z.object({
34
+ type: z.literal("grant_issue"),
35
+ label: z.enum(GRANT_LABELS).optional(),
36
+ suffix: z.string().min(1).max(64).optional(),
37
+ expectedStrategyDigest: digest.optional(),
38
+ }),
39
+ z.object({ type: z.literal("grant_revoke"), grantId: z.string().min(1) }),
40
+ z.object({ type: z.literal("agent_freeze") }),
41
+ z.object({ type: z.literal("agent_unfreeze") }),
42
+ z.object({
43
+ type: z.literal("policy_update"),
44
+ expectedPolicy: reviewedPolicy,
45
+ changes: z.object({
46
+ swap: z.boolean().optional(),
47
+ destinations: z.array(z.object({ address: transferAccount, confidential: z.boolean() })).max(64).optional(),
48
+ /** NEAR accounts paid by withdrawal to chain `near` (no memo); withdrawals are on exactly while there is one. */
49
+ withdrawals: z.array(z.object({ address: nearAccount })).max(64).optional(),
50
+ assets: z.union([z.literal("any"), z.array(z.string())]).optional(),
51
+ owner_approval: z.boolean().optional(),
52
+ max_actions_per_hour: z.number().int().positive().nullable().optional(),
53
+ budget: z.object({ daily_usd: usdAmount, weekly_usd: usdAmount, monthly_usd: usdAmount }).optional(),
54
+ limits: z
55
+ .object({ per_transaction: caps, hourly: caps, daily: caps, monthly: caps })
56
+ .partial()
57
+ .optional(),
58
+ }),
59
+ }),
60
+ z.object({
61
+ type: z.literal("approval_vote"),
62
+ approvalId: z.uuid(),
63
+ verdict: z.enum(["approve", "reject"]),
64
+ correlationId: z.string(),
65
+ }),
66
+ ]);
67
+ export const ownerPrepareInput = z.object({ action: ownerAction, signer: z.enum(["wallet", "dao"]) });
68
+ /**
69
+ * A payout an app or owner asks for under its own `requestId`, stored before calling: the same request is sent at
70
+ * most once, and `payouts/status` answers it by `requestId`. A new attempt is a new `requestId`, after a refusal.
71
+ */
72
+ export const payoutRequestId = z.string().regex(/^[A-Za-z0-9_-]{1,64}$/);
73
+ export const payoutRequestInput = z.object({
74
+ requestId: payoutRequestId,
75
+ /** The token paid, as the provider names it (for example `nep141:…`). The agent's signed policy decides which are allowed. */
76
+ asset: z.string().min(1).max(256),
77
+ /**
78
+ * How it reaches the payee: `intents`, a confidential transfer inside NEAR Intents to an agreed payee (confidential
79
+ * USDC), or `{ chain: "near" }`, a withdrawal from the confidential balance to an agreed NEAR account (wNEAR arrives as
80
+ * native NEAR, or USDC). Other chains are refused before anything is recorded.
81
+ */
82
+ delivery: z.union([z.literal("intents"), z.object({ chain: z.string().min(1).max(64) })]),
83
+ /** A NEAR Intents account or `nearcom:` address for `intents`; a NEAR account for a withdrawal (never `nearcom:`). */
84
+ recipient: z.string().trim().min(1).max(80),
85
+ amount: units,
86
+ expectedPolicy: reviewedPolicy,
87
+ }).superRefine((input, ctx) => {
88
+ const valid = input.delivery === "intents" ? validIntentsAccount(intentsAccount(input.recipient))
89
+ : !isNearcomAddress(input.recipient) && validIntentsAccount(input.recipient);
90
+ if (!valid)
91
+ ctx.addIssue({ code: "custom", path: ["recipient"],
92
+ message: input.delivery === "intents" ? "Enter a NEAR Intents account or nearcom: address" : "Enter a NEAR account: a nearcom: address is not on any chain" });
93
+ }).transform((input) => input.delivery === "intents" ? { ...input, recipient: intentsAccount(input.recipient) } : input);
94
+ export const payoutStatusInput = z.object({ requestId: payoutRequestId });
95
+ /** A deposit address for the asset to fund (default USDC); wNEAR funds withdrawals that arrive as native NEAR. */
96
+ export const depositInput = z.object({ asset: z.enum(["nep141:17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1", "nep141:wrap.near"]).optional() }).optional();
97
+ export const ownerSubmitInput = z.object({ correlationId: z.string(), signedData: z.record(z.string(), z.unknown()) });
98
+ export const ownerStatusInput = z.object({ correlationId: z.string() });
99
+ export const executePlanInput = z.object({ planId: z.uuid() });
@@ -0,0 +1,5 @@
1
+ /** near.com displays an Intents account with this prefix; the API takes the bare account. */
2
+ export declare const isNearcomAddress: (value: string) => boolean;
3
+ /** Normalize owner-entered transfer destinations, never signed/provider evidence or chain addresses. */
4
+ export declare function intentsAccount(value: string): string;
5
+ export declare const validIntentsAccount: (value: string) => boolean;
@@ -0,0 +1,8 @@
1
+ /** near.com displays an Intents account with this prefix; the API takes the bare account. */
2
+ export const isNearcomAddress = (value) => /^nearcom:/i.test(value.trim());
3
+ /** Normalize owner-entered transfer destinations, never signed/provider evidence or chain addresses. */
4
+ export function intentsAccount(value) {
5
+ const trimmed = value.trim();
6
+ return isNearcomAddress(trimmed) ? trimmed.slice("nearcom:".length).toLowerCase() : trimmed;
7
+ }
8
+ export const validIntentsAccount = (value) => /^(?=.{2,64}$)[a-z0-9]+(?:[._-][a-z0-9]+)*$/.test(value);