uvd-x402-sdk 2.109.0 → 2.111.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 CHANGED
@@ -10,7 +10,7 @@ Users sign a message or transaction, and the Ultravioleta facilitator handles on
10
10
 
11
11
  ## Features
12
12
 
13
- **Arras NEAR escrow (v2.108.0):** offline local-key NEP-366 authorization, canonical Rust payment IDs and pull lifecycle helpers through `uvd-x402-sdk/near`. [Guide and agent example](docs/near-escrow.md). As of 2026-11-02 the facilitator advertises escrow only on testnet, and the SDK's escrow contract registry has no mainnet row yet.
13
+ **Arras NEAR escrow (v2.110.0):** offline local-key NEP-366 authorization, canonical Rust payment IDs and pull lifecycle helpers through `uvd-x402-sdk/near`. [Guide and agent example](docs/near-escrow.md). As of 2026-11-03 the production facilitator relays NEAR escrow only on testnet. Since 2.110.0 the registry allows mainnet escrow signing only for `v1.arras-escrow.near`; testnet keeps `arras-v1b-1101.testnet`.
14
14
 
15
15
  - **31 Networks**: EVM (19 including HashKey Chain, Arc, Scroll, SKALE Base, Robinhood Chain), Solana, Fogo, Stellar, NEAR, Algorand, Sui, XRP Ledger, Hedera (mainnet + testnet)
16
16
  - **Multi-Stablecoin**: USDC, EURC, AUSD, PYUSD, USDT, USDG (Robinhood Chain)
@@ -65,7 +65,7 @@ declare const NEAR_ESCROW_TOKENS: Readonly<Record<NearEscrowNetwork, string>>;
65
65
  /**
66
66
  * The Arras escrow deployments this SDK signs for, per network. Any other escrowContract is refused before the
67
67
  * signer is called, for authorization and lifecycle alike: a signed delegate can be relayed by anyone, so a 402
68
- * server must not be able to point it at its own account. Mainnet stays empty until its contract ships in a release.
68
+ * server must not be able to point it at its own account. Only deployed Arras v1 contracts are registered.
69
69
  */
70
70
  declare const NEAR_ESCROW_CONTRACTS: Readonly<Record<NearEscrowNetwork, readonly string[]>>;
71
71
  /** Canonical Arras JSON: field order, decimal-string timestamps, lowercase hex, no spaces. */
@@ -154,7 +154,7 @@ interface NearStorageOptions {
154
154
  /** YoctoNEAR, not NEAR. Query storage_balance_bounds for the live contract minimum. */
155
155
  deposit?: NearUnsigned;
156
156
  }
157
- /** Explicit trusted deployment configuration; this unsigned builder does not select an account parent. */
157
+ /** Explicit deployment from NEAR_ESCROW_CONTRACTS for the selected network. */
158
158
  interface ArrasStorageOptions extends NearStorageOptions {
159
159
  escrowContract: string;
160
160
  }
@@ -244,6 +244,242 @@ type ArrasEvent = {
244
244
  */
245
245
  declare function parseArrasEvents(logs: readonly unknown[]): ArrasEvent[];
246
246
 
247
+ declare const NEAR_REGISTRY_CONTRACTS: Readonly<Record<NearEscrowNetwork, readonly string[]>>;
248
+ declare const NEAR_REGISTRY_ESCROWS: Readonly<Record<NearEscrowNetwork, readonly string[]>>;
249
+ declare const REGISTER_DEPOSIT = "17510000000000000000000";
250
+ declare const FEEDBACK_DEPOSIT = "18640000000000000000000";
251
+ declare const REGISTRY_GAS = "30000000000000";
252
+ declare const GIVE_FEEDBACK_GAS = "100000000000000";
253
+ declare const MIN_GIVE_FEEDBACK_GAS = "60000000000000";
254
+ declare enum RegistryErrorCode {
255
+ E01 = "E01_AGENT_URI_INVALIDA",
256
+ E02 = "E02_METADATA_INVALIDA",
257
+ E03 = "E03_YA_REGISTRADO",
258
+ E04 = "E04_NO_REGISTRADO",
259
+ E05 = "E05_DEPOSITO_INSUFICIENTE",
260
+ E06 = "E06_REQUIERE_DEPOSITO",
261
+ E10 = "E10_ESCROW_NO_PERMITIDO",
262
+ E11 = "E11_PAYMENT_ID_INVALIDO",
263
+ E12 = "E12_SCORE_INVALIDO",
264
+ E13 = "E13_TAG_INVALIDO",
265
+ E14 = "E14_FEEDBACK_URI_INVALIDA",
266
+ E15 = "E15_FEEDBACK_HASH_INVALIDO",
267
+ E16 = "E16_DEPOSITO_FEEDBACK",
268
+ E17 = "E17_GAS_INSUFICIENTE",
269
+ E18 = "E18_YA_CALIFICADO",
270
+ E19 = "E19_EN_VUELO",
271
+ E20 = "E20_GET_PAYMENT_FALLO",
272
+ E21 = "E21_RESPUESTA_INVALIDA",
273
+ E22 = "E22_PAGO_INEXISTENTE",
274
+ E23 = "E23_PAGO_SIN_LIBERAR",
275
+ E24 = "E24_NO_ES_PARTE",
276
+ E25 = "E25_AUTO_CALIFICACION",
277
+ E26 = "E26_REEMPLAZADO",
278
+ E30 = "E30_FEEDBACK_INEXISTENTE",
279
+ E31 = "E31_YA_REVOCADO",
280
+ E40 = "E40_ESCROWS_INVALIDOS"
281
+ }
282
+ declare class RegistryValidationError extends Error {
283
+ readonly code: RegistryErrorCode;
284
+ constructor(code: RegistryErrorCode);
285
+ }
286
+ interface RegistryTarget {
287
+ network: NearEscrowNetwork;
288
+ registryContract?: string;
289
+ }
290
+ interface RegistryBuildOptions extends RegistryTarget {
291
+ signerId: string;
292
+ /** YoctoNEAR: register/feedback use getConfig floors; update accepts >= 1; revoke requires 1. */
293
+ deposit?: NearUnsigned;
294
+ /** Gas units, not TGas. give_feedback needs at least 60 TGas. */
295
+ gas?: NearUnsigned;
296
+ }
297
+ interface RegistryIdentityArgs {
298
+ agent_uri: string;
299
+ metadata?: string | null;
300
+ }
301
+ interface RegistryPaymentArgs {
302
+ escrow: string;
303
+ payment_id: string;
304
+ }
305
+ interface GiveFeedbackArgs extends RegistryPaymentArgs {
306
+ score: number;
307
+ tag1?: string | null;
308
+ tag2?: string | null;
309
+ feedback_uri?: string | null;
310
+ feedback_hash?: string | null;
311
+ }
312
+ type RegistryMethod = 'register' | 'update' | 'give_feedback' | 'revoke_feedback';
313
+ interface RegistryTransaction {
314
+ signerId: string;
315
+ receiverId: string;
316
+ actions: [
317
+ {
318
+ type: 'FunctionCall';
319
+ params: {
320
+ methodName: RegistryMethod;
321
+ args: Record<string, string | number>;
322
+ gas: string;
323
+ deposit: string;
324
+ };
325
+ }
326
+ ];
327
+ }
328
+ declare const buildRegistryRegister: (options: RegistryBuildOptions & RegistryIdentityArgs) => RegistryTransaction;
329
+ /** Replaces URI and metadata. Omitted/null metadata clears the previous value. */
330
+ declare const buildRegistryUpdate: (options: RegistryBuildOptions & RegistryIdentityArgs) => RegistryTransaction;
331
+ declare const buildGiveFeedback: (options: RegistryBuildOptions & GiveFeedbackArgs) => RegistryTransaction;
332
+ declare const buildRevokeFeedback: (options: RegistryBuildOptions & RegistryPaymentArgs) => RegistryTransaction;
333
+ /**
334
+ * Normal SignedTransaction Borsh, base64 for send_tx. No NEP-366 prefix, RPC or submission.
335
+ * The access key MUST be FullAccess: FunctionCall keys cannot attach a deposit. The caller
336
+ * verifies access-key permission and supplies the next nonce and a recent base58 block hash.
337
+ * Revalidates the descriptor before asking the signer to sign, and verifies the returned signature.
338
+ */
339
+ declare function signRegistryTransaction(descriptor: RegistryTransaction, signer: NearLocalSigner, nonce: NearUnsigned, blockHash: string): Promise<string>;
340
+ interface AgentView {
341
+ account_id: string;
342
+ agent_uri: string;
343
+ metadata: string | null;
344
+ registered_at: string;
345
+ updated_at: string;
346
+ }
347
+ interface FeedbackView {
348
+ feedback_id: number;
349
+ rater: string;
350
+ ratee: string;
351
+ ratee_role: 'payer' | 'receiver';
352
+ escrow: string;
353
+ payment_id: string;
354
+ operator_id: string;
355
+ released: string;
356
+ score: number;
357
+ tag1: string | null;
358
+ tag2: string | null;
359
+ feedback_uri: string | null;
360
+ feedback_hash: string | null;
361
+ created_at: string;
362
+ revoked: boolean;
363
+ revoked_at: string | null;
364
+ }
365
+ interface RoleSummaryView {
366
+ count: number;
367
+ revoked: number;
368
+ score_sum: string;
369
+ average_x100: number | null;
370
+ }
371
+ interface SummaryView extends RoleSummaryView {
372
+ account_id: string;
373
+ operator_id?: string;
374
+ as_payer: RoleSummaryView;
375
+ as_receiver: RoleSummaryView;
376
+ last_feedback_id: number | null;
377
+ last_at: string | null;
378
+ }
379
+ interface RegistryConfigView {
380
+ version: 'arras-registry-v1';
381
+ escrows: string[];
382
+ agents: number;
383
+ feedbacks: number;
384
+ register_deposit: string;
385
+ feedback_deposit: string;
386
+ min_gas_give_feedback: string;
387
+ limits: {
388
+ max_agent_uri_len: number;
389
+ max_metadata_len: number;
390
+ max_feedback_uri_len: number;
391
+ max_tag_len: number;
392
+ max_payment_id_len: number;
393
+ max_score: number;
394
+ max_list_limit: number;
395
+ pending_ttl_blocks: string;
396
+ };
397
+ }
398
+ /** Return the JSON-RPC result (call_function response with result: number[]), not its outer envelope. */
399
+ type RegistryRpc = (method: string, params: Record<string, unknown>) => Promise<unknown>;
400
+ interface RegistryViewOptions extends RegistryTarget {
401
+ rpc?: RegistryRpc;
402
+ }
403
+ interface RegistryPage {
404
+ from_index?: number;
405
+ limit?: number;
406
+ }
407
+ declare const getConfig: (o: RegistryViewOptions) => Promise<RegistryConfigView>;
408
+ declare const getAgent: (o: RegistryViewOptions, accountId: string) => Promise<AgentView | null>;
409
+ declare const listAgents: (o: RegistryViewOptions, p?: RegistryPage) => Promise<AgentView[]>;
410
+ declare const getFeedback: (o: RegistryViewOptions, feedbackId: number) => Promise<FeedbackView | null>;
411
+ declare const getFeedbackForPayment: (o: RegistryViewOptions, p: RegistryPaymentArgs & {
412
+ rater: string;
413
+ }) => Promise<FeedbackView | null>;
414
+ declare const listFeedback: (o: RegistryViewOptions, accountId: string, p?: RegistryPage) => Promise<FeedbackView[]>;
415
+ declare const getSummary: (o: RegistryViewOptions, accountId: string) => Promise<SummaryView>;
416
+ declare const getSummaryByOperator: (o: RegistryViewOptions, accountId: string, operatorId: string) => Promise<SummaryView>;
417
+ declare const isFeedbackPending: (o: RegistryViewOptions, p: RegistryPaymentArgs & {
418
+ rater: string;
419
+ }) => Promise<boolean>;
420
+ interface RegistryEventData {
421
+ agent_registered: {
422
+ account_id: string;
423
+ agent_uri: string;
424
+ metadata: string | null;
425
+ at: string;
426
+ };
427
+ agent_updated: RegistryEventData['agent_registered'];
428
+ feedback_given: Omit<FeedbackView, 'revoked' | 'revoked_at'>;
429
+ feedback_revoked: Pick<FeedbackView, 'feedback_id' | 'rater' | 'ratee' | 'escrow' | 'payment_id'> & {
430
+ revoked_at: string;
431
+ };
432
+ }
433
+ type RegistryEvent = {
434
+ [K in keyof RegistryEventData]: {
435
+ standard: 'arras-registry';
436
+ version: '1.0.0';
437
+ event: K;
438
+ data: RegistryEventData[K][];
439
+ };
440
+ }[keyof RegistryEventData];
441
+ /**
442
+ * Skip malformed/foreign/unknown logs; preserve valid batches. Raw logs are safe only
443
+ * when the caller has already filtered receipts by executor_id for the selected network
444
+ * and successful execution status.
445
+ * Prefer parseRegistryReceiptEvents for transaction receipts_outcome from the RPC.
446
+ */
447
+ declare function parseRegistryEvents(logs: readonly unknown[]): RegistryEvent[];
448
+ /** Parse RPC receipts_outcome, accepting only successful receipts from the selected network's registries. */
449
+ declare function parseRegistryReceiptEvents(receiptsOutcome: unknown, net: NearEscrowNetwork): RegistryEvent[];
450
+ type GiveFeedbackOutcome = {
451
+ status: 'accepted';
452
+ feedbackId: number;
453
+ } | {
454
+ status: 'rejected';
455
+ code: RegistryErrorCode;
456
+ } | {
457
+ status: 'error';
458
+ code: RegistryErrorCode;
459
+ message: string;
460
+ };
461
+ /** Accept a decoded number, {value, logs}, or the final NEAR execution outcome (not a pending send_tx result). */
462
+ declare function parseGiveFeedbackOutcome(outcome: unknown): GiveFeedbackOutcome;
463
+ interface FeedbackSummary {
464
+ count: number;
465
+ distinct_raters: number;
466
+ revoked: number;
467
+ released_total: string;
468
+ average_x100: number | null;
469
+ weighted_average_x100: number | null;
470
+ }
471
+ /**
472
+ * Summarize the supplied rows for one escrow/operator. Revoked rows only increment revoked.
473
+ * Active rows count equally in average_x100; released weights weighted_average_x100. Both
474
+ * use exact bigint sums and floor. No deduplication/pagination: supply each feedback once,
475
+ * for the intended ratee. Zero total weight returns null, as does an empty active set.
476
+ */
477
+ declare function summarizeFeedback(feedbacks: readonly FeedbackView[], escrow: string, operatorId: string): FeedbackSummary;
478
+ /** Allow only display links with these schemes; never normalize contract bytes or accept whitespace. */
479
+ declare function safeLink(uri: string): string | null;
480
+ /** Plain text only; remove Unicode control/format characters (including bidi and zero width). Not HTML escaping. */
481
+ declare function displayText(s: string): string;
482
+
247
483
  /**
248
484
  * uvd-x402-sdk - NEAR Provider
249
485
  *
@@ -382,4 +618,4 @@ declare class NEARProvider implements WalletAdapter {
382
618
  private base58Encode;
383
619
  }
384
620
 
385
- export { type ArrasAuthorizedData, type ArrasCapsSetData, type ArrasCompactedData, type ArrasEvent, type ArrasEventData, type ArrasOperatorData, type ArrasPauseData, type ArrasPaymentAmountData, type ArrasReleasedData, type ArrasStorageOptions, type ArrasWithdrawnData, type AuthorizeFromBudget, type EscrowAuthorizationOptions, type EscrowMsgParams, NEARProvider, NEAR_ARRAS_STORAGE_DEPOSIT, NEAR_ESCROW_CONTRACTS, NEAR_ESCROW_MAX_GAS, NEAR_ESCROW_MIN_GAS, NEAR_ESCROW_TOKENS, NEAR_USDC_STORAGE_DEPOSIT, type NearEscrowDelegate, type NearEscrowDelegateOptions, type NearEscrowFunctionCall, type NearEscrowLifecycleMethod, type NearEscrowNetwork, type NearEscrowPayment, type NearExactDelegateOptions, type NearExactPayment, type NearLocalSigner, type NearStorageOptions, type NearStorageTransaction, type NearUnsigned, type Nep413Message, type Nep413SignedMessage, type PaymentIdParams, type SignNep413Options, type WalletSelectorOptions, buildArrasStorageDeposit, buildEscrowAuthorizationDelegate, buildEscrowMsg, buildUsdcStorageDeposit, computePaymentId, createNearLocalSigner, NEARProvider as default, nep413Preimage, parseArrasEvents, paymentIdPreimage, reclaim, refund, release, signEscrowAuthorization, signEscrowLifecycle, signExactNearDelegate, signNep413, validateEscrowAuthorizationDelegate, withdraw, withdrawFor };
621
+ export { type AgentView, type ArrasAuthorizedData, type ArrasCapsSetData, type ArrasCompactedData, type ArrasEvent, type ArrasEventData, type ArrasOperatorData, type ArrasPauseData, type ArrasPaymentAmountData, type ArrasReleasedData, type ArrasStorageOptions, type ArrasWithdrawnData, type AuthorizeFromBudget, type EscrowAuthorizationOptions, type EscrowMsgParams, FEEDBACK_DEPOSIT, type FeedbackSummary, type FeedbackView, GIVE_FEEDBACK_GAS, type GiveFeedbackArgs, type GiveFeedbackOutcome, MIN_GIVE_FEEDBACK_GAS, NEARProvider, NEAR_ARRAS_STORAGE_DEPOSIT, NEAR_ESCROW_CONTRACTS, NEAR_ESCROW_MAX_GAS, NEAR_ESCROW_MIN_GAS, NEAR_ESCROW_TOKENS, NEAR_REGISTRY_CONTRACTS, NEAR_REGISTRY_ESCROWS, NEAR_USDC_STORAGE_DEPOSIT, type NearEscrowDelegate, type NearEscrowDelegateOptions, type NearEscrowFunctionCall, type NearEscrowLifecycleMethod, type NearEscrowNetwork, type NearEscrowPayment, type NearExactDelegateOptions, type NearExactPayment, type NearLocalSigner, type NearStorageOptions, type NearStorageTransaction, type NearUnsigned, type Nep413Message, type Nep413SignedMessage, type PaymentIdParams, REGISTER_DEPOSIT, REGISTRY_GAS, type RegistryBuildOptions, type RegistryConfigView, RegistryErrorCode, type RegistryEvent, type RegistryEventData, type RegistryIdentityArgs, type RegistryMethod, type RegistryPage, type RegistryPaymentArgs, type RegistryRpc, type RegistryTarget, type RegistryTransaction, RegistryValidationError, type RegistryViewOptions, type RoleSummaryView, type SignNep413Options, type SummaryView, type WalletSelectorOptions, buildArrasStorageDeposit, buildEscrowAuthorizationDelegate, buildEscrowMsg, buildGiveFeedback, buildRegistryRegister, buildRegistryUpdate, buildRevokeFeedback, buildUsdcStorageDeposit, computePaymentId, createNearLocalSigner, NEARProvider as default, displayText, getAgent, getConfig, getFeedback, getFeedbackForPayment, getSummary, getSummaryByOperator, isFeedbackPending, listAgents, listFeedback, nep413Preimage, parseArrasEvents, parseGiveFeedbackOutcome, parseRegistryEvents, parseRegistryReceiptEvents, paymentIdPreimage, reclaim, refund, release, safeLink, signEscrowAuthorization, signEscrowLifecycle, signExactNearDelegate, signNep413, signRegistryTransaction, summarizeFeedback, validateEscrowAuthorizationDelegate, withdraw, withdrawFor };
@@ -65,7 +65,7 @@ declare const NEAR_ESCROW_TOKENS: Readonly<Record<NearEscrowNetwork, string>>;
65
65
  /**
66
66
  * The Arras escrow deployments this SDK signs for, per network. Any other escrowContract is refused before the
67
67
  * signer is called, for authorization and lifecycle alike: a signed delegate can be relayed by anyone, so a 402
68
- * server must not be able to point it at its own account. Mainnet stays empty until its contract ships in a release.
68
+ * server must not be able to point it at its own account. Only deployed Arras v1 contracts are registered.
69
69
  */
70
70
  declare const NEAR_ESCROW_CONTRACTS: Readonly<Record<NearEscrowNetwork, readonly string[]>>;
71
71
  /** Canonical Arras JSON: field order, decimal-string timestamps, lowercase hex, no spaces. */
@@ -154,7 +154,7 @@ interface NearStorageOptions {
154
154
  /** YoctoNEAR, not NEAR. Query storage_balance_bounds for the live contract minimum. */
155
155
  deposit?: NearUnsigned;
156
156
  }
157
- /** Explicit trusted deployment configuration; this unsigned builder does not select an account parent. */
157
+ /** Explicit deployment from NEAR_ESCROW_CONTRACTS for the selected network. */
158
158
  interface ArrasStorageOptions extends NearStorageOptions {
159
159
  escrowContract: string;
160
160
  }
@@ -244,6 +244,242 @@ type ArrasEvent = {
244
244
  */
245
245
  declare function parseArrasEvents(logs: readonly unknown[]): ArrasEvent[];
246
246
 
247
+ declare const NEAR_REGISTRY_CONTRACTS: Readonly<Record<NearEscrowNetwork, readonly string[]>>;
248
+ declare const NEAR_REGISTRY_ESCROWS: Readonly<Record<NearEscrowNetwork, readonly string[]>>;
249
+ declare const REGISTER_DEPOSIT = "17510000000000000000000";
250
+ declare const FEEDBACK_DEPOSIT = "18640000000000000000000";
251
+ declare const REGISTRY_GAS = "30000000000000";
252
+ declare const GIVE_FEEDBACK_GAS = "100000000000000";
253
+ declare const MIN_GIVE_FEEDBACK_GAS = "60000000000000";
254
+ declare enum RegistryErrorCode {
255
+ E01 = "E01_AGENT_URI_INVALIDA",
256
+ E02 = "E02_METADATA_INVALIDA",
257
+ E03 = "E03_YA_REGISTRADO",
258
+ E04 = "E04_NO_REGISTRADO",
259
+ E05 = "E05_DEPOSITO_INSUFICIENTE",
260
+ E06 = "E06_REQUIERE_DEPOSITO",
261
+ E10 = "E10_ESCROW_NO_PERMITIDO",
262
+ E11 = "E11_PAYMENT_ID_INVALIDO",
263
+ E12 = "E12_SCORE_INVALIDO",
264
+ E13 = "E13_TAG_INVALIDO",
265
+ E14 = "E14_FEEDBACK_URI_INVALIDA",
266
+ E15 = "E15_FEEDBACK_HASH_INVALIDO",
267
+ E16 = "E16_DEPOSITO_FEEDBACK",
268
+ E17 = "E17_GAS_INSUFICIENTE",
269
+ E18 = "E18_YA_CALIFICADO",
270
+ E19 = "E19_EN_VUELO",
271
+ E20 = "E20_GET_PAYMENT_FALLO",
272
+ E21 = "E21_RESPUESTA_INVALIDA",
273
+ E22 = "E22_PAGO_INEXISTENTE",
274
+ E23 = "E23_PAGO_SIN_LIBERAR",
275
+ E24 = "E24_NO_ES_PARTE",
276
+ E25 = "E25_AUTO_CALIFICACION",
277
+ E26 = "E26_REEMPLAZADO",
278
+ E30 = "E30_FEEDBACK_INEXISTENTE",
279
+ E31 = "E31_YA_REVOCADO",
280
+ E40 = "E40_ESCROWS_INVALIDOS"
281
+ }
282
+ declare class RegistryValidationError extends Error {
283
+ readonly code: RegistryErrorCode;
284
+ constructor(code: RegistryErrorCode);
285
+ }
286
+ interface RegistryTarget {
287
+ network: NearEscrowNetwork;
288
+ registryContract?: string;
289
+ }
290
+ interface RegistryBuildOptions extends RegistryTarget {
291
+ signerId: string;
292
+ /** YoctoNEAR: register/feedback use getConfig floors; update accepts >= 1; revoke requires 1. */
293
+ deposit?: NearUnsigned;
294
+ /** Gas units, not TGas. give_feedback needs at least 60 TGas. */
295
+ gas?: NearUnsigned;
296
+ }
297
+ interface RegistryIdentityArgs {
298
+ agent_uri: string;
299
+ metadata?: string | null;
300
+ }
301
+ interface RegistryPaymentArgs {
302
+ escrow: string;
303
+ payment_id: string;
304
+ }
305
+ interface GiveFeedbackArgs extends RegistryPaymentArgs {
306
+ score: number;
307
+ tag1?: string | null;
308
+ tag2?: string | null;
309
+ feedback_uri?: string | null;
310
+ feedback_hash?: string | null;
311
+ }
312
+ type RegistryMethod = 'register' | 'update' | 'give_feedback' | 'revoke_feedback';
313
+ interface RegistryTransaction {
314
+ signerId: string;
315
+ receiverId: string;
316
+ actions: [
317
+ {
318
+ type: 'FunctionCall';
319
+ params: {
320
+ methodName: RegistryMethod;
321
+ args: Record<string, string | number>;
322
+ gas: string;
323
+ deposit: string;
324
+ };
325
+ }
326
+ ];
327
+ }
328
+ declare const buildRegistryRegister: (options: RegistryBuildOptions & RegistryIdentityArgs) => RegistryTransaction;
329
+ /** Replaces URI and metadata. Omitted/null metadata clears the previous value. */
330
+ declare const buildRegistryUpdate: (options: RegistryBuildOptions & RegistryIdentityArgs) => RegistryTransaction;
331
+ declare const buildGiveFeedback: (options: RegistryBuildOptions & GiveFeedbackArgs) => RegistryTransaction;
332
+ declare const buildRevokeFeedback: (options: RegistryBuildOptions & RegistryPaymentArgs) => RegistryTransaction;
333
+ /**
334
+ * Normal SignedTransaction Borsh, base64 for send_tx. No NEP-366 prefix, RPC or submission.
335
+ * The access key MUST be FullAccess: FunctionCall keys cannot attach a deposit. The caller
336
+ * verifies access-key permission and supplies the next nonce and a recent base58 block hash.
337
+ * Revalidates the descriptor before asking the signer to sign, and verifies the returned signature.
338
+ */
339
+ declare function signRegistryTransaction(descriptor: RegistryTransaction, signer: NearLocalSigner, nonce: NearUnsigned, blockHash: string): Promise<string>;
340
+ interface AgentView {
341
+ account_id: string;
342
+ agent_uri: string;
343
+ metadata: string | null;
344
+ registered_at: string;
345
+ updated_at: string;
346
+ }
347
+ interface FeedbackView {
348
+ feedback_id: number;
349
+ rater: string;
350
+ ratee: string;
351
+ ratee_role: 'payer' | 'receiver';
352
+ escrow: string;
353
+ payment_id: string;
354
+ operator_id: string;
355
+ released: string;
356
+ score: number;
357
+ tag1: string | null;
358
+ tag2: string | null;
359
+ feedback_uri: string | null;
360
+ feedback_hash: string | null;
361
+ created_at: string;
362
+ revoked: boolean;
363
+ revoked_at: string | null;
364
+ }
365
+ interface RoleSummaryView {
366
+ count: number;
367
+ revoked: number;
368
+ score_sum: string;
369
+ average_x100: number | null;
370
+ }
371
+ interface SummaryView extends RoleSummaryView {
372
+ account_id: string;
373
+ operator_id?: string;
374
+ as_payer: RoleSummaryView;
375
+ as_receiver: RoleSummaryView;
376
+ last_feedback_id: number | null;
377
+ last_at: string | null;
378
+ }
379
+ interface RegistryConfigView {
380
+ version: 'arras-registry-v1';
381
+ escrows: string[];
382
+ agents: number;
383
+ feedbacks: number;
384
+ register_deposit: string;
385
+ feedback_deposit: string;
386
+ min_gas_give_feedback: string;
387
+ limits: {
388
+ max_agent_uri_len: number;
389
+ max_metadata_len: number;
390
+ max_feedback_uri_len: number;
391
+ max_tag_len: number;
392
+ max_payment_id_len: number;
393
+ max_score: number;
394
+ max_list_limit: number;
395
+ pending_ttl_blocks: string;
396
+ };
397
+ }
398
+ /** Return the JSON-RPC result (call_function response with result: number[]), not its outer envelope. */
399
+ type RegistryRpc = (method: string, params: Record<string, unknown>) => Promise<unknown>;
400
+ interface RegistryViewOptions extends RegistryTarget {
401
+ rpc?: RegistryRpc;
402
+ }
403
+ interface RegistryPage {
404
+ from_index?: number;
405
+ limit?: number;
406
+ }
407
+ declare const getConfig: (o: RegistryViewOptions) => Promise<RegistryConfigView>;
408
+ declare const getAgent: (o: RegistryViewOptions, accountId: string) => Promise<AgentView | null>;
409
+ declare const listAgents: (o: RegistryViewOptions, p?: RegistryPage) => Promise<AgentView[]>;
410
+ declare const getFeedback: (o: RegistryViewOptions, feedbackId: number) => Promise<FeedbackView | null>;
411
+ declare const getFeedbackForPayment: (o: RegistryViewOptions, p: RegistryPaymentArgs & {
412
+ rater: string;
413
+ }) => Promise<FeedbackView | null>;
414
+ declare const listFeedback: (o: RegistryViewOptions, accountId: string, p?: RegistryPage) => Promise<FeedbackView[]>;
415
+ declare const getSummary: (o: RegistryViewOptions, accountId: string) => Promise<SummaryView>;
416
+ declare const getSummaryByOperator: (o: RegistryViewOptions, accountId: string, operatorId: string) => Promise<SummaryView>;
417
+ declare const isFeedbackPending: (o: RegistryViewOptions, p: RegistryPaymentArgs & {
418
+ rater: string;
419
+ }) => Promise<boolean>;
420
+ interface RegistryEventData {
421
+ agent_registered: {
422
+ account_id: string;
423
+ agent_uri: string;
424
+ metadata: string | null;
425
+ at: string;
426
+ };
427
+ agent_updated: RegistryEventData['agent_registered'];
428
+ feedback_given: Omit<FeedbackView, 'revoked' | 'revoked_at'>;
429
+ feedback_revoked: Pick<FeedbackView, 'feedback_id' | 'rater' | 'ratee' | 'escrow' | 'payment_id'> & {
430
+ revoked_at: string;
431
+ };
432
+ }
433
+ type RegistryEvent = {
434
+ [K in keyof RegistryEventData]: {
435
+ standard: 'arras-registry';
436
+ version: '1.0.0';
437
+ event: K;
438
+ data: RegistryEventData[K][];
439
+ };
440
+ }[keyof RegistryEventData];
441
+ /**
442
+ * Skip malformed/foreign/unknown logs; preserve valid batches. Raw logs are safe only
443
+ * when the caller has already filtered receipts by executor_id for the selected network
444
+ * and successful execution status.
445
+ * Prefer parseRegistryReceiptEvents for transaction receipts_outcome from the RPC.
446
+ */
447
+ declare function parseRegistryEvents(logs: readonly unknown[]): RegistryEvent[];
448
+ /** Parse RPC receipts_outcome, accepting only successful receipts from the selected network's registries. */
449
+ declare function parseRegistryReceiptEvents(receiptsOutcome: unknown, net: NearEscrowNetwork): RegistryEvent[];
450
+ type GiveFeedbackOutcome = {
451
+ status: 'accepted';
452
+ feedbackId: number;
453
+ } | {
454
+ status: 'rejected';
455
+ code: RegistryErrorCode;
456
+ } | {
457
+ status: 'error';
458
+ code: RegistryErrorCode;
459
+ message: string;
460
+ };
461
+ /** Accept a decoded number, {value, logs}, or the final NEAR execution outcome (not a pending send_tx result). */
462
+ declare function parseGiveFeedbackOutcome(outcome: unknown): GiveFeedbackOutcome;
463
+ interface FeedbackSummary {
464
+ count: number;
465
+ distinct_raters: number;
466
+ revoked: number;
467
+ released_total: string;
468
+ average_x100: number | null;
469
+ weighted_average_x100: number | null;
470
+ }
471
+ /**
472
+ * Summarize the supplied rows for one escrow/operator. Revoked rows only increment revoked.
473
+ * Active rows count equally in average_x100; released weights weighted_average_x100. Both
474
+ * use exact bigint sums and floor. No deduplication/pagination: supply each feedback once,
475
+ * for the intended ratee. Zero total weight returns null, as does an empty active set.
476
+ */
477
+ declare function summarizeFeedback(feedbacks: readonly FeedbackView[], escrow: string, operatorId: string): FeedbackSummary;
478
+ /** Allow only display links with these schemes; never normalize contract bytes or accept whitespace. */
479
+ declare function safeLink(uri: string): string | null;
480
+ /** Plain text only; remove Unicode control/format characters (including bidi and zero width). Not HTML escaping. */
481
+ declare function displayText(s: string): string;
482
+
247
483
  /**
248
484
  * uvd-x402-sdk - NEAR Provider
249
485
  *
@@ -382,4 +618,4 @@ declare class NEARProvider implements WalletAdapter {
382
618
  private base58Encode;
383
619
  }
384
620
 
385
- export { type ArrasAuthorizedData, type ArrasCapsSetData, type ArrasCompactedData, type ArrasEvent, type ArrasEventData, type ArrasOperatorData, type ArrasPauseData, type ArrasPaymentAmountData, type ArrasReleasedData, type ArrasStorageOptions, type ArrasWithdrawnData, type AuthorizeFromBudget, type EscrowAuthorizationOptions, type EscrowMsgParams, NEARProvider, NEAR_ARRAS_STORAGE_DEPOSIT, NEAR_ESCROW_CONTRACTS, NEAR_ESCROW_MAX_GAS, NEAR_ESCROW_MIN_GAS, NEAR_ESCROW_TOKENS, NEAR_USDC_STORAGE_DEPOSIT, type NearEscrowDelegate, type NearEscrowDelegateOptions, type NearEscrowFunctionCall, type NearEscrowLifecycleMethod, type NearEscrowNetwork, type NearEscrowPayment, type NearExactDelegateOptions, type NearExactPayment, type NearLocalSigner, type NearStorageOptions, type NearStorageTransaction, type NearUnsigned, type Nep413Message, type Nep413SignedMessage, type PaymentIdParams, type SignNep413Options, type WalletSelectorOptions, buildArrasStorageDeposit, buildEscrowAuthorizationDelegate, buildEscrowMsg, buildUsdcStorageDeposit, computePaymentId, createNearLocalSigner, NEARProvider as default, nep413Preimage, parseArrasEvents, paymentIdPreimage, reclaim, refund, release, signEscrowAuthorization, signEscrowLifecycle, signExactNearDelegate, signNep413, validateEscrowAuthorizationDelegate, withdraw, withdrawFor };
621
+ export { type AgentView, type ArrasAuthorizedData, type ArrasCapsSetData, type ArrasCompactedData, type ArrasEvent, type ArrasEventData, type ArrasOperatorData, type ArrasPauseData, type ArrasPaymentAmountData, type ArrasReleasedData, type ArrasStorageOptions, type ArrasWithdrawnData, type AuthorizeFromBudget, type EscrowAuthorizationOptions, type EscrowMsgParams, FEEDBACK_DEPOSIT, type FeedbackSummary, type FeedbackView, GIVE_FEEDBACK_GAS, type GiveFeedbackArgs, type GiveFeedbackOutcome, MIN_GIVE_FEEDBACK_GAS, NEARProvider, NEAR_ARRAS_STORAGE_DEPOSIT, NEAR_ESCROW_CONTRACTS, NEAR_ESCROW_MAX_GAS, NEAR_ESCROW_MIN_GAS, NEAR_ESCROW_TOKENS, NEAR_REGISTRY_CONTRACTS, NEAR_REGISTRY_ESCROWS, NEAR_USDC_STORAGE_DEPOSIT, type NearEscrowDelegate, type NearEscrowDelegateOptions, type NearEscrowFunctionCall, type NearEscrowLifecycleMethod, type NearEscrowNetwork, type NearEscrowPayment, type NearExactDelegateOptions, type NearExactPayment, type NearLocalSigner, type NearStorageOptions, type NearStorageTransaction, type NearUnsigned, type Nep413Message, type Nep413SignedMessage, type PaymentIdParams, REGISTER_DEPOSIT, REGISTRY_GAS, type RegistryBuildOptions, type RegistryConfigView, RegistryErrorCode, type RegistryEvent, type RegistryEventData, type RegistryIdentityArgs, type RegistryMethod, type RegistryPage, type RegistryPaymentArgs, type RegistryRpc, type RegistryTarget, type RegistryTransaction, RegistryValidationError, type RegistryViewOptions, type RoleSummaryView, type SignNep413Options, type SummaryView, type WalletSelectorOptions, buildArrasStorageDeposit, buildEscrowAuthorizationDelegate, buildEscrowMsg, buildGiveFeedback, buildRegistryRegister, buildRegistryUpdate, buildRevokeFeedback, buildUsdcStorageDeposit, computePaymentId, createNearLocalSigner, NEARProvider as default, displayText, getAgent, getConfig, getFeedback, getFeedbackForPayment, getSummary, getSummaryByOperator, isFeedbackPending, listAgents, listFeedback, nep413Preimage, parseArrasEvents, parseGiveFeedbackOutcome, parseRegistryEvents, parseRegistryReceiptEvents, paymentIdPreimage, reclaim, refund, release, safeLink, signEscrowAuthorization, signEscrowLifecycle, signExactNearDelegate, signNep413, signRegistryTransaction, summarizeFeedback, validateEscrowAuthorizationDelegate, withdraw, withdrawFor };