uvd-x402-sdk 2.111.0 → 2.112.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 +2 -0
- package/dist/providers/near/index.d.mts +579 -1
- package/dist/providers/near/index.d.ts +579 -1
- package/dist/providers/near/index.js +739 -31
- package/dist/providers/near/index.js.map +1 -1
- package/dist/providers/near/index.mjs +713 -32
- package/dist/providers/near/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/providers/near/erc8004-schema.ts +81 -0
- package/src/providers/near/erc8004.ts +541 -0
- package/src/providers/near/index.ts +2 -0
- package/src/providers/near/vectors/near-erc8004.json +5050 -0
|
@@ -1247,8 +1247,8 @@ var CHAIN_ALIASES = {
|
|
|
1247
1247
|
"xrpl-mainnet": "xrpl"
|
|
1248
1248
|
};
|
|
1249
1249
|
function getChainByName(name) {
|
|
1250
|
-
const
|
|
1251
|
-
return SUPPORTED_CHAINS[
|
|
1250
|
+
const key2 = name.toLowerCase();
|
|
1251
|
+
return SUPPORTED_CHAINS[key2] ?? SUPPORTED_CHAINS[CHAIN_ALIASES[key2] ?? ""];
|
|
1252
1252
|
}
|
|
1253
1253
|
|
|
1254
1254
|
// src/utils/base64.ts
|
|
@@ -1264,9 +1264,9 @@ function encodeBase64Json(value) {
|
|
|
1264
1264
|
return encodeBase64Utf8(JSON.stringify(value));
|
|
1265
1265
|
}
|
|
1266
1266
|
var PLAIN_DECIMAL = /^(?:\d+\.?\d*|\.\d+)$/;
|
|
1267
|
-
function toAtomicUnits(amount,
|
|
1268
|
-
if (!Number.isInteger(
|
|
1269
|
-
throw new X402Error(`Invalid token decimals: ${
|
|
1267
|
+
function toAtomicUnits(amount, decimals2) {
|
|
1268
|
+
if (!Number.isInteger(decimals2) || decimals2 < 0) {
|
|
1269
|
+
throw new X402Error(`Invalid token decimals: ${decimals2}`, "INVALID_CONFIG");
|
|
1270
1270
|
}
|
|
1271
1271
|
if (typeof amount !== "string" || !PLAIN_DECIMAL.test(amount)) {
|
|
1272
1272
|
const shown = typeof amount === "string" ? JSON.stringify(amount) : `a ${typeof amount}`;
|
|
@@ -1276,13 +1276,13 @@ function toAtomicUnits(amount, decimals) {
|
|
|
1276
1276
|
);
|
|
1277
1277
|
}
|
|
1278
1278
|
const fraction = amount.split(".")[1] ?? "";
|
|
1279
|
-
if (/[1-9]/.test(fraction.slice(
|
|
1279
|
+
if (/[1-9]/.test(fraction.slice(decimals2))) {
|
|
1280
1280
|
throw new X402Error(
|
|
1281
|
-
`Payment amount "${amount}" has more decimal places than the token's ${
|
|
1281
|
+
`Payment amount "${amount}" has more decimal places than the token's ${decimals2}; it cannot be paid exactly.`,
|
|
1282
1282
|
"INVALID_AMOUNT"
|
|
1283
1283
|
);
|
|
1284
1284
|
}
|
|
1285
|
-
return ethers.parseUnits(amount,
|
|
1285
|
+
return ethers.parseUnits(amount, decimals2);
|
|
1286
1286
|
}
|
|
1287
1287
|
|
|
1288
1288
|
// src/utils/x402.ts
|
|
@@ -1507,12 +1507,12 @@ async function signDelegate(o, d, scheme = "escrow") {
|
|
|
1507
1507
|
if (!(signature instanceof Uint8Array) || signature.length !== 64 || !ed25519.ed25519.verify(signature, digest, pk)) {
|
|
1508
1508
|
throw new Error("Invalid Ed25519 delegate signature");
|
|
1509
1509
|
}
|
|
1510
|
-
const
|
|
1510
|
+
const signed2 = concat(bytes, Uint8Array.of(0), signature);
|
|
1511
1511
|
return {
|
|
1512
1512
|
x402Version: 2,
|
|
1513
1513
|
scheme,
|
|
1514
1514
|
network: network2,
|
|
1515
|
-
payload: { signedDelegateAction: btoa(Array.from(
|
|
1515
|
+
payload: { signedDelegateAction: btoa(Array.from(signed2, (b) => String.fromCharCode(b)).join("")) }
|
|
1516
1516
|
};
|
|
1517
1517
|
}
|
|
1518
1518
|
async function signEscrowAuthorization(options) {
|
|
@@ -1671,7 +1671,7 @@ var fee = (v) => typeof v === "number" && Number.isInteger(v) && v >= 0 && v <=
|
|
|
1671
1671
|
var strings = (v) => Array.isArray(v) && v.every(string);
|
|
1672
1672
|
var object = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
1673
1673
|
function record(required, optional = {}) {
|
|
1674
|
-
return (v) => object(v) && Object.entries(required).every(([k,
|
|
1674
|
+
return (v) => object(v) && Object.entries(required).every(([k, check2]) => Object.hasOwn(v, k) && check2(v[k])) && Object.entries(optional).every(([k, check2]) => !Object.hasOwn(v, k) || check2(v[k]));
|
|
1675
1675
|
}
|
|
1676
1676
|
var operator = record({ operator_id: string }, {
|
|
1677
1677
|
owner: string,
|
|
@@ -1720,8 +1720,8 @@ function parseArrasEvents(logs) {
|
|
|
1720
1720
|
continue;
|
|
1721
1721
|
}
|
|
1722
1722
|
if (!object(value) || value.standard !== "arras" || value.version !== "1.0.0" || typeof value.event !== "string" || !Object.hasOwn(checks, value.event) || !Array.isArray(value.data)) continue;
|
|
1723
|
-
const
|
|
1724
|
-
if (!value.data.every(
|
|
1723
|
+
const check2 = checks[value.event];
|
|
1724
|
+
if (!value.data.every(check2)) continue;
|
|
1725
1725
|
result.push({ standard: "arras", version: "1.0.0", event: value.event, data: value.data });
|
|
1726
1726
|
}
|
|
1727
1727
|
return result;
|
|
@@ -1816,7 +1816,7 @@ function codedUint(value, bits, code) {
|
|
|
1816
1816
|
}
|
|
1817
1817
|
function canonicalArgs(method, input, net) {
|
|
1818
1818
|
const allowed = method === "register" || method === "update" ? ["agent_uri", "metadata"] : method === "give_feedback" ? ["escrow", "payment_id", "score", "tag1", "tag2", "feedback_uri", "feedback_hash"] : ["escrow", "payment_id"];
|
|
1819
|
-
if (Object.keys(input).some((
|
|
1819
|
+
if (Object.keys(input).some((key2) => !allowed.includes(key2))) throw new Error("Unexpected registry argument");
|
|
1820
1820
|
const args = {};
|
|
1821
1821
|
if (method === "register" || method === "update") {
|
|
1822
1822
|
requireRule(validUri(input.agent_uri), "E01_AGENT_URI_INVALIDA" /* E01 */);
|
|
@@ -1915,8 +1915,8 @@ async function signRegistryTransaction(descriptor, signer, nonce, blockHash) {
|
|
|
1915
1915
|
const a = d.actions[0].params;
|
|
1916
1916
|
const n = uint(nonce, 64, "nonce");
|
|
1917
1917
|
if (n === 0n) throw new Error("nonce must be positive");
|
|
1918
|
-
const
|
|
1919
|
-
if (
|
|
1918
|
+
const hash2 = unbase58(blockHash);
|
|
1919
|
+
if (hash2.length !== 32) throw new Error("Expected 32-byte block hash");
|
|
1920
1920
|
const pk = new Uint8Array(signer.publicKey);
|
|
1921
1921
|
if (pk.length !== 32) throw new Error("Expected 32-byte Ed25519 public key");
|
|
1922
1922
|
const bytes = concat(
|
|
@@ -1925,7 +1925,7 @@ async function signRegistryTransaction(descriptor, signer, nonce, blockHash) {
|
|
|
1925
1925
|
pk,
|
|
1926
1926
|
le(n, 8),
|
|
1927
1927
|
str(d.receiverId),
|
|
1928
|
-
|
|
1928
|
+
hash2,
|
|
1929
1929
|
le(1n, 4),
|
|
1930
1930
|
Uint8Array.of(2),
|
|
1931
1931
|
str(a.methodName),
|
|
@@ -1943,10 +1943,10 @@ async function signRegistryTransaction(descriptor, signer, nonce, blockHash) {
|
|
|
1943
1943
|
var object2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
1944
1944
|
var string2 = (v) => typeof v === "string";
|
|
1945
1945
|
var boolean2 = (v) => typeof v === "boolean";
|
|
1946
|
-
var nullable = (
|
|
1947
|
-
var array = (
|
|
1946
|
+
var nullable = (check2) => (v) => v === null || check2(v);
|
|
1947
|
+
var array = (check2) => (v) => Array.isArray(v) && v.every(check2);
|
|
1948
1948
|
function record2(required, optional = {}) {
|
|
1949
|
-
return (v) => object2(v) && Object.entries(required).every(([k,
|
|
1949
|
+
return (v) => object2(v) && Object.entries(required).every(([k, check2]) => Object.hasOwn(v, k) && check2(v[k])) && Object.entries(optional).every(([k, check2]) => !Object.hasOwn(v, k) || check2(v[k]));
|
|
1950
1950
|
}
|
|
1951
1951
|
var integer2 = (bits) => (v) => {
|
|
1952
1952
|
if (typeof v !== "string") return false;
|
|
@@ -2022,7 +2022,7 @@ var rpcUrls = {
|
|
|
2022
2022
|
"near:mainnet": "https://rpc.mainnet.near.org",
|
|
2023
2023
|
"near:testnet": "https://rpc.testnet.near.org"
|
|
2024
2024
|
};
|
|
2025
|
-
async function view(options, method, args,
|
|
2025
|
+
async function view(options, method, args, check2) {
|
|
2026
2026
|
const o = { ...options };
|
|
2027
2027
|
const id = receiver(o);
|
|
2028
2028
|
const rpc = o.rpc ?? (async (method2, params) => {
|
|
@@ -2045,7 +2045,7 @@ async function view(options, method, args, check) {
|
|
|
2045
2045
|
});
|
|
2046
2046
|
if (!object2(response) || !Array.isArray(response.result) || !response.result.every((v) => Number.isInteger(v) && v >= 0 && v <= 255)) throw new Error("Invalid call_function response");
|
|
2047
2047
|
const value = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(Uint8Array.from(response.result)));
|
|
2048
|
-
if (!
|
|
2048
|
+
if (!check2(value)) throw new Error(`Invalid ${method} response shape`);
|
|
2049
2049
|
return value;
|
|
2050
2050
|
}
|
|
2051
2051
|
function accountArgs(accountId) {
|
|
@@ -2145,10 +2145,10 @@ var rejectionCodes = [
|
|
|
2145
2145
|
"E26_REEMPLAZADO" /* E26 */
|
|
2146
2146
|
];
|
|
2147
2147
|
function panic(value) {
|
|
2148
|
-
const
|
|
2149
|
-
const number =
|
|
2148
|
+
const text2 = typeof value === "string" ? value : JSON.stringify(value);
|
|
2149
|
+
const number = text2?.match(/ARRAS_REG_(E[0-9]{2}):/)?.[1];
|
|
2150
2150
|
const code = Object.values(RegistryErrorCode).find((c) => c.slice(0, 3) === number);
|
|
2151
|
-
if (code) return { status: "error", code, message:
|
|
2151
|
+
if (code) return { status: "error", code, message: text2 };
|
|
2152
2152
|
return void 0;
|
|
2153
2153
|
}
|
|
2154
2154
|
function parseGiveFeedbackOutcome(outcome) {
|
|
@@ -2210,13 +2210,694 @@ function summarizeFeedback(feedbacks, escrow2, operatorId) {
|
|
|
2210
2210
|
weighted_average_x100: released ? Number(weighted * 100n / released) : null
|
|
2211
2211
|
};
|
|
2212
2212
|
}
|
|
2213
|
-
function safeLink(
|
|
2214
|
-
return validUri(
|
|
2213
|
+
function safeLink(uri2) {
|
|
2214
|
+
return validUri(uri2) && /^(https|ipfs|ar):/i.test(uri2) ? uri2 : null;
|
|
2215
2215
|
}
|
|
2216
2216
|
function displayText(s) {
|
|
2217
2217
|
return s.replace(/[\p{Cc}\p{Cf}\p{Cs}\p{Default_Ignorable_Code_Point}]/gu, "");
|
|
2218
2218
|
}
|
|
2219
2219
|
|
|
2220
|
+
// src/providers/near/erc8004-schema.ts
|
|
2221
|
+
var object3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
2222
|
+
var text = (v) => typeof v === "string" && !/[\ud800-\udfff]/u.test(v);
|
|
2223
|
+
var bool = (v) => typeof v === "boolean";
|
|
2224
|
+
var nullable2 = (check2) => (v) => v === null || check2(v);
|
|
2225
|
+
var list = (check2, max = 100) => (v) => Array.isArray(v) && v.length <= max && v.every(check2);
|
|
2226
|
+
var num = (max) => (v) => typeof v === "number" && Number.isSafeInteger(v) && v >= 0 && v <= max;
|
|
2227
|
+
var exact = (expected) => (v) => v === expected;
|
|
2228
|
+
function shape(required, optional = {}) {
|
|
2229
|
+
return (v) => object3(v) && Object.keys(v).every((k) => Object.hasOwn(required, k) || Object.hasOwn(optional, k)) && Object.entries(required).every(([k, check2]) => Object.hasOwn(v, k) && check2(v[k])) && Object.entries(optional).every(([k, check2]) => !Object.hasOwn(v, k) || check2(v[k]));
|
|
2230
|
+
}
|
|
2231
|
+
var unsigned = (bits) => (v) => {
|
|
2232
|
+
if (typeof v !== "string" || v.length > 78) return false;
|
|
2233
|
+
try {
|
|
2234
|
+
uint(v, bits, "integer");
|
|
2235
|
+
return true;
|
|
2236
|
+
} catch {
|
|
2237
|
+
return false;
|
|
2238
|
+
}
|
|
2239
|
+
};
|
|
2240
|
+
var u643 = unsigned(64);
|
|
2241
|
+
var u1283 = unsigned(128);
|
|
2242
|
+
var u256 = unsigned(256);
|
|
2243
|
+
var positiveIndex = (v) => u643(v) && v !== "0";
|
|
2244
|
+
var signed = (digits) => (v) => typeof v === "string" && v.length <= digits + 1 && fullMatch(/^(0|-?[1-9][0-9]*)$/, v) && v.replace("-", "").length <= digits;
|
|
2245
|
+
var valueCheck = (v) => signed(39)(v) && BigInt(v) >= -(10n ** 38n) && BigInt(v) <= 10n ** 38n;
|
|
2246
|
+
var decimals = num(18);
|
|
2247
|
+
var accountCheck2 = (v) => {
|
|
2248
|
+
try {
|
|
2249
|
+
account(v, "account");
|
|
2250
|
+
return true;
|
|
2251
|
+
} catch {
|
|
2252
|
+
return false;
|
|
2253
|
+
}
|
|
2254
|
+
};
|
|
2255
|
+
var byteLength = (v) => new TextEncoder().encode(v).length;
|
|
2256
|
+
var boundedText = (max) => (v) => text(v) && byteLength(v) <= max;
|
|
2257
|
+
var tag = (v) => boundedText(64)(v) && !/\p{Cc}/u.test(v);
|
|
2258
|
+
var label = (v) => typeof v === "string" && fullMatch(/^[a-z0-9_-]{0,32}$/, v);
|
|
2259
|
+
var proof = (v) => typeof v === "string" && fullMatch(/^[\x21-\x7e]{1,128}$/, v);
|
|
2260
|
+
var hash = (v) => typeof v === "string" && fullMatch(/^[0-9a-f]{64}$/, v);
|
|
2261
|
+
var key = (v) => typeof v === "string" && fullMatch(/^[A-Za-z0-9._:/-]{1,64}$/, v);
|
|
2262
|
+
var uri = (max, empty = false) => (v) => typeof v === "string" && (empty && v === "" || v.length <= max && fullMatch(/^[A-Za-z][A-Za-z0-9+.-]*:[A-Za-z0-9\-._~:/?#\[\]@!$&'()*+,;=%]+$/, v));
|
|
2263
|
+
function base642(bytes) {
|
|
2264
|
+
return btoa(Array.from(bytes, (b) => String.fromCharCode(b)).join(""));
|
|
2265
|
+
}
|
|
2266
|
+
function unbase64(value) {
|
|
2267
|
+
if (typeof value !== "string" || !fullMatch(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/, value)) throw new Error("Invalid base64");
|
|
2268
|
+
const bytes = Uint8Array.from(atob(value), (c) => c.charCodeAt(0));
|
|
2269
|
+
if (base642(bytes) !== value) throw new Error("Noncanonical base64");
|
|
2270
|
+
return bytes;
|
|
2271
|
+
}
|
|
2272
|
+
var base64Check = (max) => (v) => {
|
|
2273
|
+
if (typeof v !== "string" || v.length > Math.ceil(max / 3) * 4) return false;
|
|
2274
|
+
try {
|
|
2275
|
+
return unbase64(v).length <= max;
|
|
2276
|
+
} catch {
|
|
2277
|
+
return false;
|
|
2278
|
+
}
|
|
2279
|
+
};
|
|
2280
|
+
function check(v, valid, name) {
|
|
2281
|
+
if (!valid(v)) throw new Error(`Invalid ${name}`);
|
|
2282
|
+
}
|
|
2283
|
+
var metadataEntry = shape({ metadata_key: (v) => key(v) && v !== "agentWallet", metadata_value: base64Check(1024) });
|
|
2284
|
+
var version = { erc8004_version: exact("2.0.0"), events_standard: exact("erc8004"), events_version: exact("1.0.0") };
|
|
2285
|
+
var identityConfigCheck = shape({
|
|
2286
|
+
contract: exact("erc8004-identity"),
|
|
2287
|
+
...version,
|
|
2288
|
+
total_agents: u643,
|
|
2289
|
+
register_deposit: u1283,
|
|
2290
|
+
token_reserve_bytes: exact(77),
|
|
2291
|
+
storage_byte_cost: u1283,
|
|
2292
|
+
min_gas_nft_transfer_call: u643,
|
|
2293
|
+
limits: shape({
|
|
2294
|
+
max_agent_uri_len: exact(8192),
|
|
2295
|
+
max_metadata_key_len: exact(64),
|
|
2296
|
+
max_metadata_value_len: exact(1024),
|
|
2297
|
+
max_register_metadata: exact(4),
|
|
2298
|
+
max_approvals: exact(8),
|
|
2299
|
+
max_memo_len: exact(256),
|
|
2300
|
+
max_deadline_delay_ns: exact("300000000000"),
|
|
2301
|
+
max_list_limit: exact(100)
|
|
2302
|
+
})
|
|
2303
|
+
});
|
|
2304
|
+
var reputationConfigCheck = shape({
|
|
2305
|
+
contract: exact("erc8004-reputation"),
|
|
2306
|
+
...version,
|
|
2307
|
+
identity_registry: accountCheck2,
|
|
2308
|
+
feedback_deposit: u1283,
|
|
2309
|
+
min_gas_give_feedback: u643,
|
|
2310
|
+
feedback_proof_deposit: u1283,
|
|
2311
|
+
min_gas_give_feedback_with_proof: u643,
|
|
2312
|
+
max_endpoint_len: exact(1024),
|
|
2313
|
+
max_feedback_uri_len: exact(4096),
|
|
2314
|
+
max_response_uri_len: exact(4096),
|
|
2315
|
+
max_tag_len: exact(64),
|
|
2316
|
+
max_list_limit: exact(100)
|
|
2317
|
+
});
|
|
2318
|
+
var verifierConfigCheck = shape({
|
|
2319
|
+
contract: exact("erc8004-arras-verifier"),
|
|
2320
|
+
escrow: accountCheck2,
|
|
2321
|
+
min_gas_verify: u643,
|
|
2322
|
+
gas_get_payment: u643,
|
|
2323
|
+
gas_on_payment: u643
|
|
2324
|
+
});
|
|
2325
|
+
var feedbackFields2 = { value: valueCheck, value_decimals: decimals, tag1: tag, tag2: tag };
|
|
2326
|
+
var feedbackCheck2 = shape({ ...feedbackFields2, is_revoked: bool });
|
|
2327
|
+
var proofFields = { verifier: accountCheck2, proof, counterparty: accountCheck2, role: label, context: label, weight: u1283 };
|
|
2328
|
+
var proofCheck = shape(proofFields);
|
|
2329
|
+
var refFields = { agent_id: u643, client_address: accountCheck2, feedback_index: positiveIndex };
|
|
2330
|
+
var refCheck = shape(refFields);
|
|
2331
|
+
var summaryFields2 = { count: u643, summary_value: signed(56), summary_value_decimals: decimals };
|
|
2332
|
+
var summaryCheck2 = shape(summaryFields2);
|
|
2333
|
+
var verifiedSummaryCheck = shape({ ...summaryFields2, weight_sum: u256 });
|
|
2334
|
+
var tokenMetadataCheck = shape({
|
|
2335
|
+
title: nullable2(text),
|
|
2336
|
+
description: nullable2(text),
|
|
2337
|
+
media: nullable2(uri(8192)),
|
|
2338
|
+
media_hash: nullable2(base64Check(32)),
|
|
2339
|
+
copies: nullable2(num(Number.MAX_SAFE_INTEGER)),
|
|
2340
|
+
issued_at: nullable2(text),
|
|
2341
|
+
expires_at: nullable2(text),
|
|
2342
|
+
starts_at: nullable2(text),
|
|
2343
|
+
updated_at: nullable2(text),
|
|
2344
|
+
extra: nullable2(text),
|
|
2345
|
+
reference: nullable2(uri(8192)),
|
|
2346
|
+
reference_hash: nullable2(base64Check(32))
|
|
2347
|
+
});
|
|
2348
|
+
var tokenCheck = shape({
|
|
2349
|
+
token_id: u643,
|
|
2350
|
+
owner_id: accountCheck2,
|
|
2351
|
+
metadata: tokenMetadataCheck,
|
|
2352
|
+
approved_account_ids: (v) => object3(v) && Object.keys(v).length <= 8 && Object.entries(v).every(([k, v2]) => accountCheck2(k) && num(Number.MAX_SAFE_INTEGER)(v2))
|
|
2353
|
+
});
|
|
2354
|
+
var nftMetadataCheck = shape({
|
|
2355
|
+
spec: exact("nft-1.0.0"),
|
|
2356
|
+
name: text,
|
|
2357
|
+
symbol: text,
|
|
2358
|
+
icon: nullable2(uri(8192)),
|
|
2359
|
+
base_uri: nullable2(uri(8192)),
|
|
2360
|
+
reference: nullable2(uri(8192)),
|
|
2361
|
+
reference_hash: nullable2(base64Check(32))
|
|
2362
|
+
});
|
|
2363
|
+
var pendingWalletCheck = shape({ wallet: accountCheck2, deadline: u643 });
|
|
2364
|
+
var agentCheck2 = shape({ owner_id: accountCheck2, agent_wallet: nullable2(accountCheck2), authorized: bool });
|
|
2365
|
+
var allFields = {
|
|
2366
|
+
clients: list(accountCheck2),
|
|
2367
|
+
feedback_indexes: list(positiveIndex),
|
|
2368
|
+
values: list(valueCheck),
|
|
2369
|
+
value_decimals: list(decimals),
|
|
2370
|
+
tag1s: list(tag),
|
|
2371
|
+
tag2s: list(tag),
|
|
2372
|
+
revoked_statuses: list(bool)
|
|
2373
|
+
};
|
|
2374
|
+
var allFeedbackCheck = (v) => shape(allFields)(v) && object3(v) && Object.values(v).every((a) => a.length === v.clients.length);
|
|
2375
|
+
|
|
2376
|
+
// src/providers/near/erc8004.ts
|
|
2377
|
+
var NEAR_ERC8004_CONTRACTS = Object.freeze({
|
|
2378
|
+
"near:mainnet": Object.freeze({
|
|
2379
|
+
identity: "identity-registry.erc-8004.near",
|
|
2380
|
+
reputation: "reputation-registry.erc-8004.near",
|
|
2381
|
+
verifier: "erc8004-verifier.arras-escrow.near",
|
|
2382
|
+
escrow: "v1.arras-escrow.near",
|
|
2383
|
+
agentRegistry: "near:mainnet:identity-registry.erc-8004.near"
|
|
2384
|
+
}),
|
|
2385
|
+
"near:testnet": Object.freeze({
|
|
2386
|
+
identity: "identity-registry.erc-8004.testnet",
|
|
2387
|
+
reputation: "reputation-registry.erc-8004.testnet",
|
|
2388
|
+
verifier: "erc8004-verifier.arras-dev.testnet",
|
|
2389
|
+
escrow: "arras-v1b-1101.testnet",
|
|
2390
|
+
agentRegistry: "near:testnet:identity-registry.erc-8004.testnet"
|
|
2391
|
+
})
|
|
2392
|
+
});
|
|
2393
|
+
var ceiling = (measured) => ((measured * 105n + 99n) / 100n).toString();
|
|
2394
|
+
var NEAR_ERC8004_DEPOSIT_CAPS = Object.freeze({
|
|
2395
|
+
register: ceiling(132790000000000000000000n),
|
|
2396
|
+
feedback: ceiling(5910000000000000000000n),
|
|
2397
|
+
feedbackProof: ceiling(14720000000000000000000n),
|
|
2398
|
+
storageByte: ceiling(10000000000000000000n),
|
|
2399
|
+
uri: ceiling(81920000000000000000000n),
|
|
2400
|
+
metadata: ceiling(12160000000000000000000n),
|
|
2401
|
+
approval: ceiling(2560000000000000000000n),
|
|
2402
|
+
response: ceiling(5120000000000000000000n)
|
|
2403
|
+
});
|
|
2404
|
+
var TGAS = 1000000000000n;
|
|
2405
|
+
function targets(network2) {
|
|
2406
|
+
if (network2 !== "near:mainnet" && network2 !== "near:testnet") throw new Error("Unsupported NEAR ERC-8004 network");
|
|
2407
|
+
return NEAR_ERC8004_CONTRACTS[network2];
|
|
2408
|
+
}
|
|
2409
|
+
function boundedAmount(v, cap, name) {
|
|
2410
|
+
check(v, u1283, name);
|
|
2411
|
+
if (BigInt(v) < 1n || BigInt(v) > BigInt(cap)) throw new Error(`${name}: outside SDK safety ceiling`);
|
|
2412
|
+
}
|
|
2413
|
+
function configuredGas(v, min) {
|
|
2414
|
+
check(v, u643, "config gas");
|
|
2415
|
+
if (BigInt(v) < min || BigInt(v) > 300n * TGAS) throw new Error("Invalid config gas range");
|
|
2416
|
+
}
|
|
2417
|
+
function validateContractConfig(kind, value, net) {
|
|
2418
|
+
const t = targets(net);
|
|
2419
|
+
if (kind === "identity") {
|
|
2420
|
+
check(value, identityConfigCheck, "identity config");
|
|
2421
|
+
const c = value;
|
|
2422
|
+
boundedAmount(c.register_deposit, NEAR_ERC8004_DEPOSIT_CAPS.register, "register_deposit");
|
|
2423
|
+
boundedAmount(c.storage_byte_cost, NEAR_ERC8004_DEPOSIT_CAPS.storageByte, "storage_byte_cost");
|
|
2424
|
+
configuredGas(c.min_gas_nft_transfer_call, 50n * TGAS);
|
|
2425
|
+
} else if (kind === "reputation") {
|
|
2426
|
+
check(value, reputationConfigCheck, "reputation config");
|
|
2427
|
+
const c = value;
|
|
2428
|
+
if (c.identity_registry !== t.identity) throw new Error("Config contract binding mismatch");
|
|
2429
|
+
boundedAmount(c.feedback_deposit, NEAR_ERC8004_DEPOSIT_CAPS.feedback, "feedback_deposit");
|
|
2430
|
+
boundedAmount(c.feedback_proof_deposit, NEAR_ERC8004_DEPOSIT_CAPS.feedbackProof, "feedback_proof_deposit");
|
|
2431
|
+
configuredGas(c.min_gas_give_feedback, 40n * TGAS);
|
|
2432
|
+
configuredGas(c.min_gas_give_feedback_with_proof, 120n * TGAS);
|
|
2433
|
+
} else {
|
|
2434
|
+
check(value, verifierConfigCheck, "verifier config");
|
|
2435
|
+
const c = value;
|
|
2436
|
+
if (c.escrow !== t.escrow) throw new Error("Config contract binding mismatch");
|
|
2437
|
+
configuredGas(c.min_gas_verify, 25n * TGAS);
|
|
2438
|
+
configuredGas(c.gas_get_payment, 1n);
|
|
2439
|
+
configuredGas(c.gas_on_payment, 1n);
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2442
|
+
function validateConfig(config, net) {
|
|
2443
|
+
targets(net);
|
|
2444
|
+
if (!object3(config) || config.network !== net) throw new Error("Config network mismatch");
|
|
2445
|
+
for (const kind of ["identity", "reputation", "verifier"]) validateContractConfig(kind, config[kind], net);
|
|
2446
|
+
}
|
|
2447
|
+
var agent = { agent_id: u643 };
|
|
2448
|
+
var token = { token_id: u643 };
|
|
2449
|
+
var feedbackRequired = { ...agent, value: valueCheck, value_decimals: decimals };
|
|
2450
|
+
var feedbackOptional = { tag1: tag, tag2: tag, endpoint: uri(1024, true), feedback_uri: uri(4096, true), feedback_hash: hash };
|
|
2451
|
+
var transfer = { receiver_id: accountCheck2, ...token };
|
|
2452
|
+
var transferOptional = { approval_id: num(Number.MAX_SAFE_INTEGER), memo: boundedText(256) };
|
|
2453
|
+
var methods = {
|
|
2454
|
+
register: { target: "identity", required: {}, optional: { agent_uri: uri(8192, true), metadata: list(metadataEntry, 4) } },
|
|
2455
|
+
set_agent_uri: { target: "identity", required: { ...agent, new_uri: uri(8192, true) } },
|
|
2456
|
+
set_metadata: { target: "identity", required: { ...agent, metadata_key: (v) => key(v) && v !== "agentWallet", metadata_value: base64Check(1024) } },
|
|
2457
|
+
set_agent_wallet: { target: "identity", required: { ...agent, new_wallet: accountCheck2, deadline: u643 } },
|
|
2458
|
+
accept_agent_wallet: { target: "identity", required: agent },
|
|
2459
|
+
unset_agent_wallet: { target: "identity", required: agent },
|
|
2460
|
+
nft_transfer: { target: "identity", required: transfer, optional: transferOptional },
|
|
2461
|
+
nft_transfer_call: { target: "identity", required: { ...transfer, msg: boundedText(16384) }, optional: transferOptional },
|
|
2462
|
+
nft_approve: { target: "identity", required: { ...token, account_id: accountCheck2 }, optional: { msg: boundedText(16384) } },
|
|
2463
|
+
nft_revoke: { target: "identity", required: { ...token, account_id: accountCheck2 } },
|
|
2464
|
+
nft_revoke_all: { target: "identity", required: token },
|
|
2465
|
+
give_feedback: { target: "reputation", required: feedbackRequired, optional: feedbackOptional },
|
|
2466
|
+
give_feedback_with_proof: { target: "reputation", required: { ...feedbackRequired, verifier: accountCheck2, proof }, optional: feedbackOptional },
|
|
2467
|
+
revoke_feedback: { target: "reputation", required: { ...agent, feedback_index: positiveIndex } },
|
|
2468
|
+
append_response: { target: "reputation", required: { ...refFields, response_uri: uri(4096) }, optional: { response_hash: hash } },
|
|
2469
|
+
verify_feedback_proof: { target: "verifier", required: { client: accountCheck2, proof } }
|
|
2470
|
+
};
|
|
2471
|
+
function canonicalArgs2(required, optional, input) {
|
|
2472
|
+
if (!object3(input) || Object.keys(input).some((k) => !Object.hasOwn(required, k) && !Object.hasOwn(optional, k))) throw new Error("Unexpected ERC-8004 argument");
|
|
2473
|
+
const source = JSON.parse(JSON.stringify(input));
|
|
2474
|
+
const args = {};
|
|
2475
|
+
for (const [k, check2] of Object.entries(required)) {
|
|
2476
|
+
check(source[k], check2, k);
|
|
2477
|
+
args[k] = source[k];
|
|
2478
|
+
}
|
|
2479
|
+
for (const [k, check2] of Object.entries(optional)) if (source[k] != null) {
|
|
2480
|
+
check(source[k], check2, k);
|
|
2481
|
+
args[k] = source[k];
|
|
2482
|
+
}
|
|
2483
|
+
return JSON.parse(JSON.stringify(args));
|
|
2484
|
+
}
|
|
2485
|
+
function normalizeNearErc8004Uri(uri2) {
|
|
2486
|
+
check(uri2, text, "URI");
|
|
2487
|
+
const encoded = encodeURI(uri2).replace(/%25([0-9A-Fa-f]{2})/g, "%$1");
|
|
2488
|
+
check(encoded, uri(8192), "URI");
|
|
2489
|
+
return encoded;
|
|
2490
|
+
}
|
|
2491
|
+
function buildNearErc8004Transaction(method, options, input) {
|
|
2492
|
+
const o = { ...options }, t = targets(o.network);
|
|
2493
|
+
o.config = JSON.parse(JSON.stringify(o.config));
|
|
2494
|
+
validateConfig(o.config, o.network);
|
|
2495
|
+
account(o.signerId, "signerId");
|
|
2496
|
+
if (!Object.hasOwn(methods, method)) throw new Error("Unknown ERC-8004 method");
|
|
2497
|
+
const spec = methods[method];
|
|
2498
|
+
const args = canonicalArgs2(spec.required, spec.optional ?? {}, input);
|
|
2499
|
+
if (method === "set_agent_wallet") {
|
|
2500
|
+
const now = o.nowNs === void 0 ? (BigInt(Date.now()) * 1000000n).toString() : o.nowNs;
|
|
2501
|
+
check(now, u643, "nowNs");
|
|
2502
|
+
const deadline = BigInt(args.deadline);
|
|
2503
|
+
if (deadline < BigInt(now) || deadline > BigInt(now) + BigInt(o.config.identity.limits.max_deadline_delay_ns)) throw new Error("deadline outside five-minute window");
|
|
2504
|
+
}
|
|
2505
|
+
if (method === "give_feedback_with_proof") {
|
|
2506
|
+
if (args.verifier !== t.verifier) throw new Error("Verifier is not registered for network");
|
|
2507
|
+
}
|
|
2508
|
+
const c = o.config;
|
|
2509
|
+
let minimum = 1n, recommended = 1n, cap = 1n, minGas = 1n, gasDefault = 30n * TGAS;
|
|
2510
|
+
const byte = BigInt(c.identity.storage_byte_cost);
|
|
2511
|
+
if (method === "register") {
|
|
2512
|
+
minimum = recommended = BigInt(c.identity.register_deposit);
|
|
2513
|
+
cap = BigInt(NEAR_ERC8004_DEPOSIT_CAPS.register);
|
|
2514
|
+
} else if (method === "give_feedback" || method === "give_feedback_with_proof") {
|
|
2515
|
+
const proof2 = method === "give_feedback_with_proof";
|
|
2516
|
+
minimum = recommended = BigInt(proof2 ? c.reputation.feedback_proof_deposit : c.reputation.feedback_deposit);
|
|
2517
|
+
cap = BigInt(proof2 ? NEAR_ERC8004_DEPOSIT_CAPS.feedbackProof : NEAR_ERC8004_DEPOSIT_CAPS.feedback);
|
|
2518
|
+
minGas = BigInt(proof2 ? c.reputation.min_gas_give_feedback_with_proof : c.reputation.min_gas_give_feedback);
|
|
2519
|
+
gasDefault = (proof2 ? 150n : 60n) * TGAS;
|
|
2520
|
+
} else if (method === "set_agent_uri") {
|
|
2521
|
+
recommended = 1n + byte * BigInt(byteLength(args.new_uri));
|
|
2522
|
+
cap = BigInt(NEAR_ERC8004_DEPOSIT_CAPS.uri) + 1n;
|
|
2523
|
+
} else if (method === "set_metadata") {
|
|
2524
|
+
recommended = 1n + byte * BigInt(128 + byteLength(args.metadata_key) + unbase64(args.metadata_value).length);
|
|
2525
|
+
cap = BigInt(NEAR_ERC8004_DEPOSIT_CAPS.metadata) + 1n;
|
|
2526
|
+
} else if (method === "nft_approve") {
|
|
2527
|
+
recommended = 1n + byte * 256n;
|
|
2528
|
+
cap = BigInt(NEAR_ERC8004_DEPOSIT_CAPS.approval) + 1n;
|
|
2529
|
+
} else if (method === "append_response") {
|
|
2530
|
+
recommended = 1n + byte * 512n;
|
|
2531
|
+
cap = BigInt(NEAR_ERC8004_DEPOSIT_CAPS.response) + 1n;
|
|
2532
|
+
} else if (method === "verify_feedback_proof") {
|
|
2533
|
+
minimum = recommended = cap = 0n;
|
|
2534
|
+
minGas = BigInt(c.verifier.min_gas_verify);
|
|
2535
|
+
}
|
|
2536
|
+
if (method === "nft_transfer_call") {
|
|
2537
|
+
minGas = BigInt(c.identity.min_gas_nft_transfer_call);
|
|
2538
|
+
gasDefault = 50n * TGAS;
|
|
2539
|
+
}
|
|
2540
|
+
if (gasDefault < minGas) gasDefault = minGas;
|
|
2541
|
+
const deposit = o.deposit === void 0 ? recommended.toString() : o.deposit, gas = o.gas === void 0 ? gasDefault.toString() : o.gas;
|
|
2542
|
+
check(deposit, u1283, "deposit");
|
|
2543
|
+
check(gas, u643, "gas");
|
|
2544
|
+
if (BigInt(deposit) < minimum || BigInt(deposit) > cap) throw new Error("deposit outside permitted range");
|
|
2545
|
+
if (BigInt(gas) < minGas || BigInt(gas) > 300n * TGAS) throw new Error("gas outside permitted range");
|
|
2546
|
+
return { signerId: o.signerId, receiverId: t[spec.target], actions: [{ type: "FunctionCall", params: { methodName: method, args, gas, deposit } }] };
|
|
2547
|
+
}
|
|
2548
|
+
function builder(method) {
|
|
2549
|
+
return (options) => {
|
|
2550
|
+
const { network: network2, signerId, config, deposit, gas, nowNs, ...args } = options;
|
|
2551
|
+
return buildNearErc8004Transaction(method, { network: network2, signerId, config, deposit, gas, nowNs }, args);
|
|
2552
|
+
};
|
|
2553
|
+
}
|
|
2554
|
+
var buildNearErc8004Register = builder("register");
|
|
2555
|
+
var buildNearErc8004SetAgentUri = builder("set_agent_uri");
|
|
2556
|
+
var buildNearErc8004SetMetadata = builder("set_metadata");
|
|
2557
|
+
var buildNearErc8004SetAgentWallet = builder("set_agent_wallet");
|
|
2558
|
+
var buildNearErc8004AcceptAgentWallet = builder("accept_agent_wallet");
|
|
2559
|
+
var buildNearErc8004UnsetAgentWallet = builder("unset_agent_wallet");
|
|
2560
|
+
var buildNearErc8004NftTransfer = builder("nft_transfer");
|
|
2561
|
+
var buildNearErc8004NftTransferCall = builder("nft_transfer_call");
|
|
2562
|
+
var buildNearErc8004NftApprove = builder("nft_approve");
|
|
2563
|
+
var buildNearErc8004NftRevoke = builder("nft_revoke");
|
|
2564
|
+
var buildNearErc8004NftRevokeAll = builder("nft_revoke_all");
|
|
2565
|
+
var buildNearErc8004GiveFeedback = builder("give_feedback");
|
|
2566
|
+
var buildNearErc8004GiveFeedbackWithProof = builder("give_feedback_with_proof");
|
|
2567
|
+
var buildNearErc8004RevokeFeedback = builder("revoke_feedback");
|
|
2568
|
+
var buildNearErc8004AppendResponse = builder("append_response");
|
|
2569
|
+
var buildNearErc8004VerifyFeedbackProof = builder("verify_feedback_proof");
|
|
2570
|
+
async function signNearErc8004Transaction(descriptor, signer, options) {
|
|
2571
|
+
if (!object3(descriptor) || !Array.isArray(descriptor.actions) || descriptor.actions.length !== 1) throw new Error("Expected one ERC-8004 action");
|
|
2572
|
+
const a = descriptor.actions[0];
|
|
2573
|
+
if (!object3(a) || a.type !== "FunctionCall" || !object3(a.params)) throw new Error("Expected FunctionCall");
|
|
2574
|
+
const p = a.params;
|
|
2575
|
+
check(p.deposit, u1283, "descriptor deposit");
|
|
2576
|
+
check(p.gas, u643, "descriptor gas");
|
|
2577
|
+
const d = buildNearErc8004Transaction(p.methodName, {
|
|
2578
|
+
network: options.network,
|
|
2579
|
+
config: options.config,
|
|
2580
|
+
signerId: descriptor.signerId,
|
|
2581
|
+
deposit: p.deposit,
|
|
2582
|
+
gas: p.gas,
|
|
2583
|
+
nowNs: options.nowNs
|
|
2584
|
+
}, p.args);
|
|
2585
|
+
if (descriptor.receiverId !== d.receiverId) throw new Error("Descriptor receiver/network mismatch");
|
|
2586
|
+
const n = uint(options.nonce, 64, "nonce");
|
|
2587
|
+
if (n === 0n) throw new Error("nonce must be positive");
|
|
2588
|
+
const hash2 = unbase58(options.blockHash);
|
|
2589
|
+
if (hash2.length !== 32) throw new Error("Expected 32-byte block hash");
|
|
2590
|
+
const pk = new Uint8Array(signer.publicKey);
|
|
2591
|
+
if (pk.length !== 32) throw new Error("Expected Ed25519 public key");
|
|
2592
|
+
const call = d.actions[0].params;
|
|
2593
|
+
const bytes = concat(
|
|
2594
|
+
str(d.signerId),
|
|
2595
|
+
Uint8Array.of(0),
|
|
2596
|
+
pk,
|
|
2597
|
+
le(n, 8),
|
|
2598
|
+
str(d.receiverId),
|
|
2599
|
+
hash2,
|
|
2600
|
+
le(1n, 4),
|
|
2601
|
+
Uint8Array.of(2),
|
|
2602
|
+
str(call.methodName),
|
|
2603
|
+
str(JSON.stringify(call.args)),
|
|
2604
|
+
le(BigInt(call.gas), 8),
|
|
2605
|
+
le(BigInt(call.deposit), 16)
|
|
2606
|
+
);
|
|
2607
|
+
const digest = sha256.sha256(bytes), signature = await signer.sign(digest.slice());
|
|
2608
|
+
if (!(signature instanceof Uint8Array) || signature.length !== 64 || !ed25519.ed25519.verify(signature, digest, pk)) throw new Error("Invalid Ed25519 transaction signature");
|
|
2609
|
+
return base642(concat(bytes, Uint8Array.of(0), signature));
|
|
2610
|
+
}
|
|
2611
|
+
var pageFields = { from_index: num(Number.MAX_SAFE_INTEGER), limit: num(100) };
|
|
2612
|
+
var nftPageFields = { from_index: u1283, limit: num(100) };
|
|
2613
|
+
var filterFields = { client_addresses: list(accountCheck2), tag1: tag, tag2: tag };
|
|
2614
|
+
var proofKeyFields = { verifier: accountCheck2, proof, client_address: accountCheck2 };
|
|
2615
|
+
var views = {
|
|
2616
|
+
identity_config: { target: "identity", method: "get_config", required: {}, result: identityConfigCheck },
|
|
2617
|
+
reputation_config: { target: "reputation", method: "get_config", required: {}, result: reputationConfigCheck },
|
|
2618
|
+
verifier_config: { target: "verifier", method: "get_config", required: {}, result: verifierConfigCheck },
|
|
2619
|
+
identity_version: { target: "identity", method: "get_version", required: {}, result: exact("2.0.0") },
|
|
2620
|
+
reputation_version: { target: "reputation", method: "get_version", required: {}, result: exact("2.0.0") },
|
|
2621
|
+
nft_token: { target: "identity", required: token, result: nullable2(tokenCheck) },
|
|
2622
|
+
nft_tokens: { target: "identity", required: {}, optional: nftPageFields, result: list(tokenCheck), page: true },
|
|
2623
|
+
nft_supply_for_owner: { target: "identity", required: { account_id: accountCheck2 }, result: u1283 },
|
|
2624
|
+
nft_tokens_for_owner: { target: "identity", required: { account_id: accountCheck2 }, optional: nftPageFields, result: list(tokenCheck), page: true },
|
|
2625
|
+
nft_total_supply: { target: "identity", required: {}, result: u1283 },
|
|
2626
|
+
nft_metadata: { target: "identity", required: {}, result: nftMetadataCheck },
|
|
2627
|
+
nft_is_approved: { target: "identity", required: { ...token, approved_account_id: accountCheck2 }, optional: { approval_id: num(Number.MAX_SAFE_INTEGER) }, result: bool },
|
|
2628
|
+
token_uri: { target: "identity", required: agent, result: nullable2(uri(8192, true)) },
|
|
2629
|
+
get_metadata: { target: "identity", required: { ...agent, metadata_key: key }, result: nullable2(base64Check(1024)) },
|
|
2630
|
+
get_agent_wallet: { target: "identity", required: agent, result: nullable2(accountCheck2) },
|
|
2631
|
+
get_pending_agent_wallet: { target: "identity", required: agent, result: nullable2(pendingWalletCheck) },
|
|
2632
|
+
is_authorized_or_owner: { target: "identity", required: { spender: accountCheck2, ...agent }, result: bool },
|
|
2633
|
+
check_agent: { target: "identity", required: { ...agent, account_id: accountCheck2 }, result: nullable2(agentCheck2) },
|
|
2634
|
+
get_summary: { target: "reputation", required: { ...agent, client_addresses: (v) => list(accountCheck2)(v) && v.length > 0 }, optional: { tag1: tag, tag2: tag }, result: summaryCheck2 },
|
|
2635
|
+
read_feedback: { target: "reputation", required: { ...refFields, feedback_index: u643 }, result: nullable2(feedbackCheck2) },
|
|
2636
|
+
read_feedback_proof: { target: "reputation", required: { ...refFields, feedback_index: u643 }, result: nullable2(proofCheck) },
|
|
2637
|
+
read_all_feedback: { target: "reputation", required: agent, optional: { ...filterFields, include_revoked: bool }, result: allFeedbackCheck },
|
|
2638
|
+
get_response_count: { target: "reputation", required: agent, optional: { client_address: accountCheck2, feedback_index: u643, responders: list(accountCheck2) }, result: u643 },
|
|
2639
|
+
get_clients: { target: "reputation", required: agent, optional: pageFields, result: list(accountCheck2), page: true },
|
|
2640
|
+
get_last_index: { target: "reputation", required: { ...agent, client_address: accountCheck2 }, result: u643 },
|
|
2641
|
+
get_identity_registry: { target: "reputation", required: {}, result: accountCheck2 },
|
|
2642
|
+
get_proof_feedback: { target: "reputation", required: proofKeyFields, result: nullable2(refCheck) },
|
|
2643
|
+
is_proof_pending: { target: "reputation", required: proofKeyFields, result: bool },
|
|
2644
|
+
list_verified_feedback: { target: "reputation", required: { ...agent, verifier: accountCheck2 }, optional: pageFields, result: list(refCheck), page: true },
|
|
2645
|
+
get_verified_summary: { target: "reputation", required: { ...agent, verifier: accountCheck2 }, optional: { ...filterFields, context: label }, result: verifiedSummaryCheck }
|
|
2646
|
+
};
|
|
2647
|
+
var MAX_VIEW_BYTES = 1048576;
|
|
2648
|
+
async function defaultRpc(network2, method, params, signal) {
|
|
2649
|
+
const url = network2 === "near:mainnet" ? "https://rpc.mainnet.near.org" : "https://rpc.testnet.near.org";
|
|
2650
|
+
const response = await fetch(url, {
|
|
2651
|
+
method: "POST",
|
|
2652
|
+
headers: { "Content-Type": "application/json" },
|
|
2653
|
+
body: JSON.stringify({ jsonrpc: "2.0", id: "near-erc8004", method, params }),
|
|
2654
|
+
signal
|
|
2655
|
+
});
|
|
2656
|
+
if (!response.ok || !response.body) throw new Error(`NEAR RPC HTTP ${response.status}`);
|
|
2657
|
+
const reader = response.body.getReader(), chunks = [];
|
|
2658
|
+
let size = 0;
|
|
2659
|
+
try {
|
|
2660
|
+
for (; ; ) {
|
|
2661
|
+
const { value, done } = await reader.read();
|
|
2662
|
+
if (done) break;
|
|
2663
|
+
size += value.length;
|
|
2664
|
+
if (size > 4 * MAX_VIEW_BYTES) throw new Error("RPC response exceeds byte limit");
|
|
2665
|
+
chunks.push(value);
|
|
2666
|
+
}
|
|
2667
|
+
} finally {
|
|
2668
|
+
await reader.cancel();
|
|
2669
|
+
reader.releaseLock();
|
|
2670
|
+
}
|
|
2671
|
+
const data = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(concat(...chunks)));
|
|
2672
|
+
if (!object3(data) || Object.hasOwn(data, "error") || !Object.hasOwn(data, "result")) throw new Error("Invalid NEAR RPC envelope");
|
|
2673
|
+
return data.result;
|
|
2674
|
+
}
|
|
2675
|
+
var NearErc8004Client = class {
|
|
2676
|
+
network;
|
|
2677
|
+
rpc;
|
|
2678
|
+
timeoutMs;
|
|
2679
|
+
constructor(options) {
|
|
2680
|
+
targets(options.network);
|
|
2681
|
+
this.network = options.network;
|
|
2682
|
+
this.timeoutMs = options.timeoutMs ?? 15e3;
|
|
2683
|
+
if (!Number.isInteger(this.timeoutMs) || this.timeoutMs < 1 || this.timeoutMs > 6e4) throw new Error("Invalid RPC timeout");
|
|
2684
|
+
this.rpc = options.rpc ?? ((method, params, signal) => defaultRpc(this.network, method, params, signal));
|
|
2685
|
+
}
|
|
2686
|
+
async view(method, input) {
|
|
2687
|
+
const t = targets(this.network);
|
|
2688
|
+
if (!Object.hasOwn(views, method)) throw new Error("Unknown ERC-8004 view");
|
|
2689
|
+
const spec = views[method], args = canonicalArgs2(spec.required, spec.optional ?? {}, input);
|
|
2690
|
+
if (spec.page && args.limit === void 0) args.limit = 100;
|
|
2691
|
+
if (args.verifier !== void 0 && args.verifier !== t.verifier) throw new Error("Verifier is not registered for network");
|
|
2692
|
+
const controller = new AbortController();
|
|
2693
|
+
let timer;
|
|
2694
|
+
const timeout = new Promise((_, reject) => {
|
|
2695
|
+
timer = setTimeout(() => {
|
|
2696
|
+
controller.abort();
|
|
2697
|
+
reject(new Error("NEAR RPC timeout"));
|
|
2698
|
+
}, this.timeoutMs);
|
|
2699
|
+
});
|
|
2700
|
+
let response;
|
|
2701
|
+
try {
|
|
2702
|
+
response = await Promise.race([this.rpc("query", {
|
|
2703
|
+
request_type: "call_function",
|
|
2704
|
+
finality: "final",
|
|
2705
|
+
account_id: t[spec.target],
|
|
2706
|
+
method_name: spec.method ?? method,
|
|
2707
|
+
args_base64: base642(new TextEncoder().encode(JSON.stringify(args)))
|
|
2708
|
+
}, controller.signal), timeout]);
|
|
2709
|
+
} finally {
|
|
2710
|
+
clearTimeout(timer);
|
|
2711
|
+
}
|
|
2712
|
+
if (!object3(response) || !Array.isArray(response.result) || response.result.length > MAX_VIEW_BYTES || !response.result.every((v) => typeof v === "number" && Number.isInteger(v) && v >= 0 && v <= 255)) throw new Error("Invalid call_function response");
|
|
2713
|
+
const value = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(Uint8Array.from(response.result)));
|
|
2714
|
+
check(value, spec.result, `${method} response`);
|
|
2715
|
+
if (spec.method === "get_config") validateContractConfig(spec.target, value, this.network);
|
|
2716
|
+
if (method === "get_identity_registry" && value !== t.identity) throw new Error("Identity registry binding mismatch");
|
|
2717
|
+
return value;
|
|
2718
|
+
}
|
|
2719
|
+
async getConfig() {
|
|
2720
|
+
const config = {
|
|
2721
|
+
network: this.network,
|
|
2722
|
+
identity: await this.view("identity_config", {}),
|
|
2723
|
+
reputation: await this.view("reputation_config", {}),
|
|
2724
|
+
verifier: await this.view("verifier_config", {})
|
|
2725
|
+
};
|
|
2726
|
+
validateConfig(config, this.network);
|
|
2727
|
+
return config;
|
|
2728
|
+
}
|
|
2729
|
+
getIdentityConfig() {
|
|
2730
|
+
return this.view("identity_config", {});
|
|
2731
|
+
}
|
|
2732
|
+
getReputationConfig() {
|
|
2733
|
+
return this.view("reputation_config", {});
|
|
2734
|
+
}
|
|
2735
|
+
getVerifierConfig() {
|
|
2736
|
+
return this.view("verifier_config", {});
|
|
2737
|
+
}
|
|
2738
|
+
getVersion(contract = "identity") {
|
|
2739
|
+
return this.view(contract === "identity" ? "identity_version" : "reputation_version", {});
|
|
2740
|
+
}
|
|
2741
|
+
getAgent(agent_id) {
|
|
2742
|
+
return this.view("nft_token", { token_id: agent_id });
|
|
2743
|
+
}
|
|
2744
|
+
getAgentUri(agent_id) {
|
|
2745
|
+
return this.view("token_uri", { agent_id });
|
|
2746
|
+
}
|
|
2747
|
+
getMetadata(agent_id, metadata_key) {
|
|
2748
|
+
return this.view("get_metadata", { agent_id, metadata_key });
|
|
2749
|
+
}
|
|
2750
|
+
getAgentWallet(agent_id) {
|
|
2751
|
+
return this.view("get_agent_wallet", { agent_id });
|
|
2752
|
+
}
|
|
2753
|
+
getPendingAgentWallet(agent_id) {
|
|
2754
|
+
return this.view("get_pending_agent_wallet", { agent_id });
|
|
2755
|
+
}
|
|
2756
|
+
readFeedback(args) {
|
|
2757
|
+
return this.view("read_feedback", args);
|
|
2758
|
+
}
|
|
2759
|
+
readFeedbackProof(args) {
|
|
2760
|
+
return this.view("read_feedback_proof", args);
|
|
2761
|
+
}
|
|
2762
|
+
getSummary(args) {
|
|
2763
|
+
return this.view("get_summary", args);
|
|
2764
|
+
}
|
|
2765
|
+
getVerifiedSummary(args) {
|
|
2766
|
+
return this.view("get_verified_summary", args);
|
|
2767
|
+
}
|
|
2768
|
+
listVerifiedFeedback(args) {
|
|
2769
|
+
return this.view("list_verified_feedback", args);
|
|
2770
|
+
}
|
|
2771
|
+
};
|
|
2772
|
+
var NearErc8004RejectionCode = /* @__PURE__ */ ((NearErc8004RejectionCode2) => {
|
|
2773
|
+
NearErc8004RejectionCode2["IdentityViewFailed"] = "E20_VISTA_DE_IDENTIDAD_FALLO";
|
|
2774
|
+
NearErc8004RejectionCode2["InvalidIdentityResponse"] = "E21_RESPUESTA_DE_IDENTIDAD_INVALIDA";
|
|
2775
|
+
NearErc8004RejectionCode2["AgentNotFound"] = "E22_AGENTE_INEXISTENTE";
|
|
2776
|
+
NearErc8004RejectionCode2["SelfFeedback"] = "E23_AUTO_CALIFICACION";
|
|
2777
|
+
NearErc8004RejectionCode2["ProofAlreadyUsed"] = "E42_PRUEBA_YA_USADA";
|
|
2778
|
+
NearErc8004RejectionCode2["Replaced"] = "E44_REEMPLAZADO";
|
|
2779
|
+
NearErc8004RejectionCode2["VerifierFailed"] = "E45_VERIFICADOR_FALLO";
|
|
2780
|
+
NearErc8004RejectionCode2["InvalidVerifierResponse"] = "E46_RESPUESTA_DEL_VERIFICADOR_INVALIDA";
|
|
2781
|
+
NearErc8004RejectionCode2["CounterpartyMismatch"] = "E47_NO_ES_EL_AGENTE";
|
|
2782
|
+
NearErc8004RejectionCode2["AgentWalletFeedback"] = "E48_AGENT_WALLET_CALIFICA";
|
|
2783
|
+
return NearErc8004RejectionCode2;
|
|
2784
|
+
})(NearErc8004RejectionCode || {});
|
|
2785
|
+
var eventSpecs = {
|
|
2786
|
+
registered: { target: "identity", standard: "erc8004", check: shape({ ...agent, agent_uri: uri(8192, true), owner: accountCheck2 }) },
|
|
2787
|
+
metadata_set: { target: "identity", standard: "erc8004", check: shape({ ...agent, metadata_key: key, metadata_value: base64Check(1024) }) },
|
|
2788
|
+
uri_updated: { target: "identity", standard: "erc8004", check: shape({ ...agent, new_uri: uri(8192, true), updated_by: accountCheck2 }) },
|
|
2789
|
+
agent_wallet_pending: { target: "identity", standard: "erc8004", check: (v) => shape({ ...agent, wallet: nullable2(accountCheck2), deadline: u643 })(v) && object3(v) && (v.wallet !== null || v.deadline === "0") },
|
|
2790
|
+
nft_mint: { target: "identity", standard: "nep171", check: shape({ owner_id: accountCheck2, token_ids: (v) => list(u643, 1)(v) && v.length === 1 }, { memo: nullable2(boundedText(256)) }) },
|
|
2791
|
+
nft_transfer: { target: "identity", standard: "nep171", check: shape({
|
|
2792
|
+
old_owner_id: accountCheck2,
|
|
2793
|
+
new_owner_id: accountCheck2,
|
|
2794
|
+
token_ids: (v) => list(u643, 1)(v) && v.length === 1
|
|
2795
|
+
}, { authorized_id: nullable2(accountCheck2), memo: nullable2(boundedText(256)) }) },
|
|
2796
|
+
new_feedback: { target: "reputation", standard: "erc8004", check: shape({
|
|
2797
|
+
...refFields,
|
|
2798
|
+
...feedbackFields2,
|
|
2799
|
+
endpoint: uri(1024, true),
|
|
2800
|
+
feedback_uri: uri(4096, true),
|
|
2801
|
+
feedback_hash: nullable2(hash),
|
|
2802
|
+
proof: nullable2(proofCheck)
|
|
2803
|
+
}) },
|
|
2804
|
+
feedback_revoked: { target: "reputation", standard: "erc8004", check: refCheck },
|
|
2805
|
+
response_appended: { target: "reputation", standard: "erc8004", check: shape({ ...refFields, responder: accountCheck2, response_uri: uri(4096), response_hash: nullable2(hash) }) }
|
|
2806
|
+
};
|
|
2807
|
+
function successful(status) {
|
|
2808
|
+
return object3(status) && Object.keys(status).length === 1 && (typeof status.SuccessValue === "string" || typeof status.SuccessReceiptId === "string");
|
|
2809
|
+
}
|
|
2810
|
+
function receiptOutcomes(receipts, network2, target) {
|
|
2811
|
+
const t = targets(network2);
|
|
2812
|
+
if (!Array.isArray(receipts) || receipts.length > 1e4) return [];
|
|
2813
|
+
return receipts.flatMap((r) => {
|
|
2814
|
+
if (!object3(r) || !object3(r.outcome) || !successful(r.outcome.status)) return [];
|
|
2815
|
+
const o = r.outcome;
|
|
2816
|
+
if (target && o.executor_id !== t[target]) return [];
|
|
2817
|
+
return [o];
|
|
2818
|
+
});
|
|
2819
|
+
}
|
|
2820
|
+
function parseNearErc8004ReceiptEvents(receipts, network2) {
|
|
2821
|
+
const t = targets(network2), events = [];
|
|
2822
|
+
for (const o of receiptOutcomes(receipts, network2)) {
|
|
2823
|
+
if (!Array.isArray(o.logs)) continue;
|
|
2824
|
+
for (const log of o.logs) {
|
|
2825
|
+
if (typeof log !== "string" || log.length > 65536 || !log.startsWith("EVENT_JSON:")) continue;
|
|
2826
|
+
let v;
|
|
2827
|
+
try {
|
|
2828
|
+
v = JSON.parse(log.slice(11));
|
|
2829
|
+
} catch {
|
|
2830
|
+
continue;
|
|
2831
|
+
}
|
|
2832
|
+
if (!object3(v) || Object.keys(v).length !== 4 || v.version !== "1.0.0" || typeof v.event !== "string" || !Object.hasOwn(eventSpecs, v.event)) continue;
|
|
2833
|
+
const spec = eventSpecs[v.event];
|
|
2834
|
+
if (o.executor_id !== t[spec.target] || v.standard !== spec.standard || !Array.isArray(v.data) || v.data.length !== 1 || !spec.check(v.data[0])) continue;
|
|
2835
|
+
events.push(v);
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
return events;
|
|
2839
|
+
}
|
|
2840
|
+
function finalExecution(outcome) {
|
|
2841
|
+
return !Object.hasOwn(outcome, "final_execution_status") || outcome.final_execution_status === "FINAL";
|
|
2842
|
+
}
|
|
2843
|
+
function parseNearErc8004Events(outcome, network2) {
|
|
2844
|
+
targets(network2);
|
|
2845
|
+
if (!object3(outcome) || !finalExecution(outcome) || !successful(outcome.status) || !object3(outcome.status) || typeof outcome.status.SuccessValue !== "string") return [];
|
|
2846
|
+
return parseNearErc8004ReceiptEvents(outcome.receipts_outcome, network2);
|
|
2847
|
+
}
|
|
2848
|
+
function transaction(outcome, network2, allowed) {
|
|
2849
|
+
const t = targets(network2);
|
|
2850
|
+
if (!object3(outcome) || !finalExecution(outcome) || !object3(outcome.transaction)) throw new Error("Expected final ERC-8004 transaction outcome");
|
|
2851
|
+
const tx = outcome.transaction;
|
|
2852
|
+
check(tx.signer_id, accountCheck2, "transaction signer");
|
|
2853
|
+
if (!Array.isArray(tx.actions) || tx.actions.length !== 1 || !object3(tx.actions[0]) || !object3(tx.actions[0].FunctionCall)) throw new Error("Expected one FunctionCall outcome");
|
|
2854
|
+
const call = tx.actions[0].FunctionCall;
|
|
2855
|
+
if (!allowed.includes(call.method_name)) throw new Error("Wrong transaction method");
|
|
2856
|
+
const method = call.method_name;
|
|
2857
|
+
if (tx.receiver_id !== t[methods[method].target]) throw new Error("Outcome receiver/network mismatch");
|
|
2858
|
+
if (typeof call.args !== "string" || call.args.length > 65536) throw new Error("Invalid transaction args");
|
|
2859
|
+
const args = canonicalArgs2(
|
|
2860
|
+
methods[method].required,
|
|
2861
|
+
methods[method].optional ?? {},
|
|
2862
|
+
JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(unbase64(call.args)))
|
|
2863
|
+
);
|
|
2864
|
+
if (!object3(outcome.status)) throw new Error("Expected final transaction status");
|
|
2865
|
+
return { outcome, tx, args, status: outcome.status };
|
|
2866
|
+
}
|
|
2867
|
+
function returnValue(status) {
|
|
2868
|
+
if (!successful(status) || typeof status.SuccessValue !== "string" || status.SuccessValue.length > 1024) throw new Error("Expected final SuccessValue");
|
|
2869
|
+
return JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(unbase64(status.SuccessValue)));
|
|
2870
|
+
}
|
|
2871
|
+
function parseNearErc8004RegisterOutcome(outcome, network2) {
|
|
2872
|
+
const parsed = transaction(outcome, network2, ["register"]);
|
|
2873
|
+
const value = returnValue(parsed.status);
|
|
2874
|
+
check(value, u643, "register agent_id");
|
|
2875
|
+
const registered = parseNearErc8004Events(outcome, network2).filter((e) => e.event === "registered");
|
|
2876
|
+
if (registered.length !== 1 || registered[0].data[0].agent_id !== value || registered[0].data[0].owner !== parsed.tx.signer_id || registered[0].data[0].agent_uri !== (parsed.args.agent_uri ?? "")) throw new Error("Register result/event mismatch");
|
|
2877
|
+
return value;
|
|
2878
|
+
}
|
|
2879
|
+
function parseNearErc8004GiveFeedbackOutcome(outcome, network2) {
|
|
2880
|
+
const parsed = transaction(outcome, network2, ["give_feedback", "give_feedback_with_proof"]);
|
|
2881
|
+
if (parsed.args.verifier !== void 0 && parsed.args.verifier !== targets(network2).verifier) throw new Error("Verifier is not registered for network");
|
|
2882
|
+
if (Object.hasOwn(parsed.status, "Failure")) {
|
|
2883
|
+
if (Object.keys(parsed.status).length !== 1) throw new Error("Ambiguous transaction status");
|
|
2884
|
+
const message = JSON.stringify(parsed.status.Failure);
|
|
2885
|
+
return { status: "failed", code: message.match(/\bERC8004_(?:ID|REP|ARV)_E[0-9]{2}\b/)?.[0] ?? null, message };
|
|
2886
|
+
}
|
|
2887
|
+
const value = returnValue(parsed.status);
|
|
2888
|
+
const logs = receiptOutcomes(parsed.outcome.receipts_outcome, network2, "reputation").flatMap((o) => Array.isArray(o.logs) ? o.logs : []);
|
|
2889
|
+
const rejections = logs.filter((v) => typeof v === "string" && v.startsWith("erc8004:rechazo:")).map((v) => v.slice("erc8004:rechazo:".length));
|
|
2890
|
+
const events = parseNearErc8004Events(outcome, network2).filter((e) => e.event === "new_feedback");
|
|
2891
|
+
if (value === null && rejections.length === 1 && events.length === 0 && Object.values(NearErc8004RejectionCode).includes(rejections[0])) {
|
|
2892
|
+
return { status: "rejected", code: rejections[0] };
|
|
2893
|
+
}
|
|
2894
|
+
check(value, positiveIndex, "feedback_index");
|
|
2895
|
+
if (rejections.length !== 0 || events.length !== 1) throw new Error("Feedback result/event mismatch");
|
|
2896
|
+
const event = events[0].data[0];
|
|
2897
|
+
if (event.feedback_index !== value || event.agent_id !== parsed.args.agent_id || event.client_address !== parsed.tx.signer_id || event.value !== parsed.args.value || event.value_decimals !== parsed.args.value_decimals || event.tag1 !== (parsed.args.tag1 ?? "") || event.tag2 !== (parsed.args.tag2 ?? "") || event.endpoint !== (parsed.args.endpoint ?? "") || event.feedback_uri !== (parsed.args.feedback_uri ?? "") || event.feedback_hash !== (parsed.args.feedback_hash ?? null) || (parsed.args.verifier === void 0 ? event.proof !== null : !event.proof || event.proof.verifier !== parsed.args.verifier || event.proof.proof !== parsed.args.proof)) throw new Error("Feedback result/event mismatch");
|
|
2898
|
+
return { status: "accepted", feedbackIndex: value };
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2220
2901
|
// src/providers/near/index.ts
|
|
2221
2902
|
var NEAR_CONFIG = {
|
|
2222
2903
|
nodeUrl: "https://rpc.mainnet.near.org"};
|
|
@@ -2296,7 +2977,7 @@ function serializeSignedDelegateAction(delegateActionBytes, signatureBytes) {
|
|
|
2296
2977
|
ser.writeFixedBytes(signatureBytes);
|
|
2297
2978
|
return ser.getBytes();
|
|
2298
2979
|
}
|
|
2299
|
-
async function
|
|
2980
|
+
async function sha2565(data) {
|
|
2300
2981
|
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
|
2301
2982
|
return new Uint8Array(hashBuffer);
|
|
2302
2983
|
}
|
|
@@ -2540,7 +3221,7 @@ var NEARProvider = class {
|
|
|
2540
3221
|
const hashInput = new Uint8Array(NEP366_PREFIX.length + delegateActionBytes.length);
|
|
2541
3222
|
hashInput.set(NEP366_PREFIX, 0);
|
|
2542
3223
|
hashInput.set(delegateActionBytes, NEP366_PREFIX.length);
|
|
2543
|
-
const delegateHash = await
|
|
3224
|
+
const delegateHash = await sha2565(hashInput);
|
|
2544
3225
|
const signature = await this.signMessage(delegateHash);
|
|
2545
3226
|
const signedDelegateActionBytes = serializeSignedDelegateAction(
|
|
2546
3227
|
delegateActionBytes,
|
|
@@ -2575,12 +3256,12 @@ var NEARProvider = class {
|
|
|
2575
3256
|
* @param version - x402 protocol version (1 or 2, defaults to 1)
|
|
2576
3257
|
* @returns Base64-encoded X-PAYMENT header value
|
|
2577
3258
|
*/
|
|
2578
|
-
encodePaymentHeader(paymentPayload,
|
|
3259
|
+
encodePaymentHeader(paymentPayload, version2 = 1) {
|
|
2579
3260
|
const payload = JSON.parse(paymentPayload);
|
|
2580
3261
|
const payloadData = {
|
|
2581
3262
|
signedDelegateAction: payload.signedDelegateAction
|
|
2582
3263
|
};
|
|
2583
|
-
const x402Payload =
|
|
3264
|
+
const x402Payload = version2 === 2 ? {
|
|
2584
3265
|
x402Version: 2,
|
|
2585
3266
|
scheme: "exact",
|
|
2586
3267
|
network: chainToCAIP2("near"),
|
|
@@ -2753,6 +3434,8 @@ exports.GIVE_FEEDBACK_GAS = GIVE_FEEDBACK_GAS;
|
|
|
2753
3434
|
exports.MIN_GIVE_FEEDBACK_GAS = MIN_GIVE_FEEDBACK_GAS;
|
|
2754
3435
|
exports.NEARProvider = NEARProvider;
|
|
2755
3436
|
exports.NEAR_ARRAS_STORAGE_DEPOSIT = NEAR_ARRAS_STORAGE_DEPOSIT;
|
|
3437
|
+
exports.NEAR_ERC8004_CONTRACTS = NEAR_ERC8004_CONTRACTS;
|
|
3438
|
+
exports.NEAR_ERC8004_DEPOSIT_CAPS = NEAR_ERC8004_DEPOSIT_CAPS;
|
|
2756
3439
|
exports.NEAR_ESCROW_CONTRACTS = NEAR_ESCROW_CONTRACTS;
|
|
2757
3440
|
exports.NEAR_ESCROW_MAX_GAS = NEAR_ESCROW_MAX_GAS;
|
|
2758
3441
|
exports.NEAR_ESCROW_MIN_GAS = NEAR_ESCROW_MIN_GAS;
|
|
@@ -2760,6 +3443,8 @@ exports.NEAR_ESCROW_TOKENS = NEAR_ESCROW_TOKENS;
|
|
|
2760
3443
|
exports.NEAR_REGISTRY_CONTRACTS = NEAR_REGISTRY_CONTRACTS;
|
|
2761
3444
|
exports.NEAR_REGISTRY_ESCROWS = NEAR_REGISTRY_ESCROWS;
|
|
2762
3445
|
exports.NEAR_USDC_STORAGE_DEPOSIT = NEAR_USDC_STORAGE_DEPOSIT;
|
|
3446
|
+
exports.NearErc8004Client = NearErc8004Client;
|
|
3447
|
+
exports.NearErc8004RejectionCode = NearErc8004RejectionCode;
|
|
2763
3448
|
exports.REGISTER_DEPOSIT = REGISTER_DEPOSIT;
|
|
2764
3449
|
exports.REGISTRY_GAS = REGISTRY_GAS;
|
|
2765
3450
|
exports.RegistryErrorCode = RegistryErrorCode;
|
|
@@ -2768,6 +3453,23 @@ exports.buildArrasStorageDeposit = buildArrasStorageDeposit;
|
|
|
2768
3453
|
exports.buildEscrowAuthorizationDelegate = buildEscrowAuthorizationDelegate;
|
|
2769
3454
|
exports.buildEscrowMsg = buildEscrowMsg;
|
|
2770
3455
|
exports.buildGiveFeedback = buildGiveFeedback;
|
|
3456
|
+
exports.buildNearErc8004AcceptAgentWallet = buildNearErc8004AcceptAgentWallet;
|
|
3457
|
+
exports.buildNearErc8004AppendResponse = buildNearErc8004AppendResponse;
|
|
3458
|
+
exports.buildNearErc8004GiveFeedback = buildNearErc8004GiveFeedback;
|
|
3459
|
+
exports.buildNearErc8004GiveFeedbackWithProof = buildNearErc8004GiveFeedbackWithProof;
|
|
3460
|
+
exports.buildNearErc8004NftApprove = buildNearErc8004NftApprove;
|
|
3461
|
+
exports.buildNearErc8004NftRevoke = buildNearErc8004NftRevoke;
|
|
3462
|
+
exports.buildNearErc8004NftRevokeAll = buildNearErc8004NftRevokeAll;
|
|
3463
|
+
exports.buildNearErc8004NftTransfer = buildNearErc8004NftTransfer;
|
|
3464
|
+
exports.buildNearErc8004NftTransferCall = buildNearErc8004NftTransferCall;
|
|
3465
|
+
exports.buildNearErc8004Register = buildNearErc8004Register;
|
|
3466
|
+
exports.buildNearErc8004RevokeFeedback = buildNearErc8004RevokeFeedback;
|
|
3467
|
+
exports.buildNearErc8004SetAgentUri = buildNearErc8004SetAgentUri;
|
|
3468
|
+
exports.buildNearErc8004SetAgentWallet = buildNearErc8004SetAgentWallet;
|
|
3469
|
+
exports.buildNearErc8004SetMetadata = buildNearErc8004SetMetadata;
|
|
3470
|
+
exports.buildNearErc8004Transaction = buildNearErc8004Transaction;
|
|
3471
|
+
exports.buildNearErc8004UnsetAgentWallet = buildNearErc8004UnsetAgentWallet;
|
|
3472
|
+
exports.buildNearErc8004VerifyFeedbackProof = buildNearErc8004VerifyFeedbackProof;
|
|
2771
3473
|
exports.buildRegistryRegister = buildRegistryRegister;
|
|
2772
3474
|
exports.buildRegistryUpdate = buildRegistryUpdate;
|
|
2773
3475
|
exports.buildRevokeFeedback = buildRevokeFeedback;
|
|
@@ -2786,8 +3488,13 @@ exports.isFeedbackPending = isFeedbackPending;
|
|
|
2786
3488
|
exports.listAgents = listAgents;
|
|
2787
3489
|
exports.listFeedback = listFeedback;
|
|
2788
3490
|
exports.nep413Preimage = nep413Preimage;
|
|
3491
|
+
exports.normalizeNearErc8004Uri = normalizeNearErc8004Uri;
|
|
2789
3492
|
exports.parseArrasEvents = parseArrasEvents;
|
|
2790
3493
|
exports.parseGiveFeedbackOutcome = parseGiveFeedbackOutcome;
|
|
3494
|
+
exports.parseNearErc8004Events = parseNearErc8004Events;
|
|
3495
|
+
exports.parseNearErc8004GiveFeedbackOutcome = parseNearErc8004GiveFeedbackOutcome;
|
|
3496
|
+
exports.parseNearErc8004ReceiptEvents = parseNearErc8004ReceiptEvents;
|
|
3497
|
+
exports.parseNearErc8004RegisterOutcome = parseNearErc8004RegisterOutcome;
|
|
2791
3498
|
exports.parseRegistryEvents = parseRegistryEvents;
|
|
2792
3499
|
exports.parseRegistryReceiptEvents = parseRegistryReceiptEvents;
|
|
2793
3500
|
exports.paymentIdPreimage = paymentIdPreimage;
|
|
@@ -2798,6 +3505,7 @@ exports.safeLink = safeLink;
|
|
|
2798
3505
|
exports.signEscrowAuthorization = signEscrowAuthorization;
|
|
2799
3506
|
exports.signEscrowLifecycle = signEscrowLifecycle;
|
|
2800
3507
|
exports.signExactNearDelegate = signExactNearDelegate;
|
|
3508
|
+
exports.signNearErc8004Transaction = signNearErc8004Transaction;
|
|
2801
3509
|
exports.signNep413 = signNep413;
|
|
2802
3510
|
exports.signRegistryTransaction = signRegistryTransaction;
|
|
2803
3511
|
exports.summarizeFeedback = summarizeFeedback;
|