@opendatalabs/vana-sdk 3.0.1 → 3.2.0-canary.0911ffc
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 -1
- package/dist/__tests__/interop-personal-server.test.d.ts +1 -0
- package/dist/account/personal-server-lite-owner-binding.cjs +81 -0
- package/dist/account/personal-server-lite-owner-binding.cjs.map +1 -0
- package/dist/account/personal-server-lite-owner-binding.d.ts +30 -0
- package/dist/account/personal-server-lite-owner-binding.js +59 -0
- package/dist/account/personal-server-lite-owner-binding.js.map +1 -0
- package/dist/account/personal-server-lite-owner-binding.test.d.ts +1 -0
- package/dist/account/personal-server-registration.cjs +263 -0
- package/dist/account/personal-server-registration.cjs.map +1 -0
- package/dist/account/personal-server-registration.d.ts +66 -0
- package/dist/account/personal-server-registration.js +240 -0
- package/dist/account/personal-server-registration.js.map +1 -0
- package/dist/account/personal-server-registration.test.d.ts +1 -0
- package/dist/auth/errors.js +1 -1
- package/dist/auth/oauth-client.cjs +250 -0
- package/dist/auth/oauth-client.cjs.map +1 -0
- package/dist/auth/oauth-client.d.ts +90 -0
- package/dist/auth/oauth-client.js +228 -0
- package/dist/auth/oauth-client.js.map +1 -0
- package/dist/auth/oauth-client.test.d.ts +1 -0
- package/dist/auth/web3-signed-builder.js +1 -1
- package/dist/auth/web3-signed.js +3 -3
- package/dist/browser.js +1 -1
- package/dist/chains/definitions.js +1 -1
- package/dist/chains/index.js +1 -1
- package/dist/chains.browser.js +1 -1
- package/dist/chains.js +1 -1
- package/dist/chains.node.js +1 -1
- package/dist/contracts/contractController.js +4 -4
- package/dist/core/client.js +1 -1
- package/dist/crypto/ecies/base.js +3 -3
- package/dist/crypto/ecies/browser.js +1 -1
- package/dist/crypto/ecies/index.js +1 -1
- package/dist/crypto/ecies/interface.js +1 -1
- package/dist/crypto/ecies/node.js +1 -1
- package/dist/crypto/services/WalletKeyEncryptionService.js +1 -1
- package/dist/generated/abi/index.js +26 -26
- package/dist/index.browser.d.ts +10 -3
- package/dist/index.browser.js +992 -73
- package/dist/index.browser.js.map +4 -4
- package/dist/index.node.cjs +1023 -74
- package/dist/index.node.cjs.map +4 -4
- package/dist/index.node.d.ts +10 -3
- package/dist/index.node.js +992 -73
- package/dist/index.node.js.map +4 -4
- package/dist/node.js +1 -1
- package/dist/platform/browser-only.js +1 -1
- package/dist/platform/browser-safe.js +1 -1
- package/dist/platform/browser.js +6 -6
- package/dist/platform/index.js +4 -4
- package/dist/platform/node.js +8 -8
- package/dist/platform/utils.js +2 -2
- package/dist/platform.browser.js +3 -3
- package/dist/platform.js +4 -4
- package/dist/platform.node.js +4 -4
- package/dist/protocol/eip712.cjs +58 -3
- package/dist/protocol/eip712.cjs.map +1 -1
- package/dist/protocol/eip712.d.ts +99 -7
- package/dist/protocol/eip712.js +52 -3
- package/dist/protocol/eip712.js.map +1 -1
- package/dist/protocol/escrow-deposit.cjs +89 -0
- package/dist/protocol/escrow-deposit.cjs.map +1 -0
- package/dist/protocol/escrow-deposit.d.ts +47 -0
- package/dist/protocol/escrow-deposit.js +60 -0
- package/dist/protocol/escrow-deposit.js.map +1 -0
- package/dist/protocol/escrow-deposit.test.d.ts +1 -0
- package/dist/protocol/escrow-flow.test.d.ts +21 -0
- package/dist/protocol/fee-registry.cjs +89 -0
- package/dist/protocol/fee-registry.cjs.map +1 -0
- package/dist/protocol/fee-registry.d.ts +105 -0
- package/dist/protocol/fee-registry.js +63 -0
- package/dist/protocol/fee-registry.js.map +1 -0
- package/dist/protocol/fee-registry.test.d.ts +1 -0
- package/dist/protocol/gateway.cjs +124 -3
- package/dist/protocol/gateway.cjs.map +1 -1
- package/dist/protocol/gateway.d.ts +196 -16
- package/dist/protocol/gateway.js +124 -3
- package/dist/protocol/gateway.js.map +1 -1
- package/dist/protocol/grants.cjs +24 -64
- package/dist/protocol/grants.cjs.map +1 -1
- package/dist/protocol/grants.d.ts +6 -13
- package/dist/protocol/grants.js +25 -64
- package/dist/protocol/grants.js.map +1 -1
- package/dist/protocol/personal-server-lite-owner-binding.cjs +93 -0
- package/dist/protocol/personal-server-lite-owner-binding.cjs.map +1 -0
- package/dist/protocol/personal-server-lite-owner-binding.d.ts +44 -0
- package/dist/protocol/personal-server-lite-owner-binding.js +65 -0
- package/dist/protocol/personal-server-lite-owner-binding.js.map +1 -0
- package/dist/protocol/personal-server-lite-owner-binding.test.d.ts +1 -0
- package/dist/protocol/personal-server-registration.cjs +122 -0
- package/dist/protocol/personal-server-registration.cjs.map +1 -0
- package/dist/protocol/personal-server-registration.d.ts +62 -0
- package/dist/protocol/personal-server-registration.js +97 -0
- package/dist/protocol/personal-server-registration.js.map +1 -0
- package/dist/protocol/personal-server-registration.test.d.ts +1 -0
- package/dist/storage/default.js +1 -1
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.js +10 -10
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/manager.js +1 -1
- package/dist/storage/providers/callback-storage.js +1 -1
- package/dist/storage/providers/dropbox.js +1 -1
- package/dist/storage/providers/google-drive.js +1 -1
- package/dist/storage/providers/ipfs.js +2 -2
- package/dist/storage/providers/pinata.js +1 -1
- package/dist/storage/providers/r2.js +1 -1
- package/dist/storage/providers/vana-storage.cjs +1 -1
- package/dist/storage/providers/vana-storage.cjs.map +1 -1
- package/dist/storage/providers/vana-storage.d.ts +2 -2
- package/dist/storage/providers/vana-storage.js +3 -3
- package/dist/storage/providers/vana-storage.js.map +1 -1
- package/dist/types/index.js +2 -2
- package/dist/types.js +1 -1
- package/package.json +7 -3
package/dist/index.node.js
CHANGED
|
@@ -29015,7 +29015,7 @@ async function buildWeb3SignedHeader(params) {
|
|
|
29015
29015
|
}
|
|
29016
29016
|
|
|
29017
29017
|
// src/storage/providers/vana-storage.ts
|
|
29018
|
-
var DEFAULT_ENDPOINT = "https://storage.vana.
|
|
29018
|
+
var DEFAULT_ENDPOINT = "https://storage.vana.org";
|
|
29019
29019
|
var BLOB_PATH_PREFIX = "/v1/blobs";
|
|
29020
29020
|
var DEFAULT_TOKEN_TTL_SECONDS = 300;
|
|
29021
29021
|
var VanaStorage = class {
|
|
@@ -32284,9 +32284,232 @@ var InMemoryTokenStore = class {
|
|
|
32284
32284
|
}
|
|
32285
32285
|
};
|
|
32286
32286
|
|
|
32287
|
+
// src/auth/oauth-client.ts
|
|
32288
|
+
var VERIFIER_TTL_SECONDS = 600;
|
|
32289
|
+
var RESERVED_AUTHORIZE_PARAMS = /* @__PURE__ */ new Set([
|
|
32290
|
+
"response_type",
|
|
32291
|
+
"client_id",
|
|
32292
|
+
"redirect_uri",
|
|
32293
|
+
"scope",
|
|
32294
|
+
"state",
|
|
32295
|
+
"code_challenge",
|
|
32296
|
+
"code_challenge_method"
|
|
32297
|
+
]);
|
|
32298
|
+
var OAuthClient = class {
|
|
32299
|
+
#config;
|
|
32300
|
+
constructor(config) {
|
|
32301
|
+
const fetchImpl = config.fetchImpl ?? globalThis.fetch;
|
|
32302
|
+
if (typeof fetchImpl !== "function") {
|
|
32303
|
+
throw new TypeError(
|
|
32304
|
+
"OAuthClient requires a global `fetch` or an explicit `fetchImpl`"
|
|
32305
|
+
);
|
|
32306
|
+
}
|
|
32307
|
+
this.#config = {
|
|
32308
|
+
authorizationEndpoint: config.authorizationEndpoint,
|
|
32309
|
+
tokenEndpoint: config.tokenEndpoint,
|
|
32310
|
+
clientId: config.clientId,
|
|
32311
|
+
redirectUri: config.redirectUri,
|
|
32312
|
+
scope: config.scope,
|
|
32313
|
+
tokenStore: config.tokenStore ?? new InMemoryTokenStore(),
|
|
32314
|
+
fetchImpl,
|
|
32315
|
+
generateState: config.generateState ?? defaultGenerateState
|
|
32316
|
+
};
|
|
32317
|
+
}
|
|
32318
|
+
/** Build the authorize URL and persist the PKCE verifier keyed by `state`. */
|
|
32319
|
+
async buildAuthorizationUrl(opts = {}) {
|
|
32320
|
+
const state = opts.state ?? this.#config.generateState();
|
|
32321
|
+
const scope = opts.scope ?? this.#config.scope;
|
|
32322
|
+
const verifier = generatePkceVerifier();
|
|
32323
|
+
const challenge = await computePkceChallenge(verifier);
|
|
32324
|
+
await this.#config.tokenStore.set(this.#verifierKey(state), {
|
|
32325
|
+
token: verifier,
|
|
32326
|
+
expiresAt: Math.floor(Date.now() / 1e3) + VERIFIER_TTL_SECONDS
|
|
32327
|
+
});
|
|
32328
|
+
const params = new URLSearchParams();
|
|
32329
|
+
params.set("response_type", "code");
|
|
32330
|
+
params.set("client_id", this.#config.clientId);
|
|
32331
|
+
params.set("redirect_uri", this.#config.redirectUri);
|
|
32332
|
+
if (scope !== void 0 && scope.length > 0) {
|
|
32333
|
+
params.set("scope", scope);
|
|
32334
|
+
}
|
|
32335
|
+
params.set("state", state);
|
|
32336
|
+
params.set("code_challenge", challenge);
|
|
32337
|
+
params.set("code_challenge_method", "S256");
|
|
32338
|
+
if (opts.extraParams !== void 0) {
|
|
32339
|
+
for (const k of Object.keys(opts.extraParams)) {
|
|
32340
|
+
if (RESERVED_AUTHORIZE_PARAMS.has(k)) {
|
|
32341
|
+
throw new Error(
|
|
32342
|
+
`extraParams may not override the reserved OAuth/PKCE parameter "${k}"`
|
|
32343
|
+
);
|
|
32344
|
+
}
|
|
32345
|
+
}
|
|
32346
|
+
for (const [k, v] of Object.entries(opts.extraParams)) {
|
|
32347
|
+
params.set(k, v);
|
|
32348
|
+
}
|
|
32349
|
+
}
|
|
32350
|
+
const sep = this.#config.authorizationEndpoint.includes("?") ? "&" : "?";
|
|
32351
|
+
const url = `${this.#config.authorizationEndpoint}${sep}${params.toString()}`;
|
|
32352
|
+
return { url, state };
|
|
32353
|
+
}
|
|
32354
|
+
/**
|
|
32355
|
+
* Handle the redirect-callback URL. Validates `state`, retrieves the saved
|
|
32356
|
+
* verifier, exchanges the authorization code + verifier for tokens, and
|
|
32357
|
+
* persists them. Returns the access {@link TokenRecord}.
|
|
32358
|
+
*/
|
|
32359
|
+
async handleCallback(callbackUrl) {
|
|
32360
|
+
const parsed = new URL(callbackUrl);
|
|
32361
|
+
const params = parsed.searchParams;
|
|
32362
|
+
const errorCode = params.get("error");
|
|
32363
|
+
if (errorCode !== null) {
|
|
32364
|
+
throw new Error(
|
|
32365
|
+
formatOAuthError({
|
|
32366
|
+
error: errorCode,
|
|
32367
|
+
error_description: params.get("error_description") ?? void 0
|
|
32368
|
+
})
|
|
32369
|
+
);
|
|
32370
|
+
}
|
|
32371
|
+
const code = params.get("code");
|
|
32372
|
+
const state = params.get("state");
|
|
32373
|
+
if (code === null || state === null) {
|
|
32374
|
+
throw new Error("OAuth callback is missing `code` or `state`");
|
|
32375
|
+
}
|
|
32376
|
+
const verifierRecord = await this.#config.tokenStore.get(
|
|
32377
|
+
this.#verifierKey(state)
|
|
32378
|
+
);
|
|
32379
|
+
if (verifierRecord === null) {
|
|
32380
|
+
throw new Error(
|
|
32381
|
+
"OAuth callback state does not match any in-flight verifier (possible CSRF or expired flow)"
|
|
32382
|
+
);
|
|
32383
|
+
}
|
|
32384
|
+
const body = new URLSearchParams();
|
|
32385
|
+
body.set("grant_type", "authorization_code");
|
|
32386
|
+
body.set("code", code);
|
|
32387
|
+
body.set("redirect_uri", this.#config.redirectUri);
|
|
32388
|
+
body.set("client_id", this.#config.clientId);
|
|
32389
|
+
body.set("code_verifier", verifierRecord.token);
|
|
32390
|
+
let tokens;
|
|
32391
|
+
try {
|
|
32392
|
+
tokens = await this.#tokenRequest(body);
|
|
32393
|
+
} finally {
|
|
32394
|
+
await this.#config.tokenStore.delete(this.#verifierKey(state));
|
|
32395
|
+
}
|
|
32396
|
+
return this.#persistTokens(tokens);
|
|
32397
|
+
}
|
|
32398
|
+
/**
|
|
32399
|
+
* Exchange a stored refresh token for a fresh access token. Throws if no
|
|
32400
|
+
* refresh token is available.
|
|
32401
|
+
*/
|
|
32402
|
+
async refresh() {
|
|
32403
|
+
const refreshRecord = await this.#config.tokenStore.get(this.#refreshKey());
|
|
32404
|
+
if (refreshRecord === null) {
|
|
32405
|
+
throw new Error("OAuth refresh failed: no refresh token stored");
|
|
32406
|
+
}
|
|
32407
|
+
const body = new URLSearchParams();
|
|
32408
|
+
body.set("grant_type", "refresh_token");
|
|
32409
|
+
body.set("refresh_token", refreshRecord.token);
|
|
32410
|
+
body.set("client_id", this.#config.clientId);
|
|
32411
|
+
const tokens = await this.#tokenRequest(body);
|
|
32412
|
+
return this.#persistTokens(tokens, refreshRecord.token);
|
|
32413
|
+
}
|
|
32414
|
+
/**
|
|
32415
|
+
* Get the current access token if valid (refreshing first if expired and a
|
|
32416
|
+
* refresh token is available). Returns `null` when no usable token exists.
|
|
32417
|
+
*/
|
|
32418
|
+
async getAccessToken() {
|
|
32419
|
+
const stored = await this.#config.tokenStore.get(this.#accessKey());
|
|
32420
|
+
if (stored !== null) return stored.token;
|
|
32421
|
+
const refresh = await this.#config.tokenStore.get(this.#refreshKey());
|
|
32422
|
+
if (refresh === null) return null;
|
|
32423
|
+
try {
|
|
32424
|
+
const refreshed = await this.refresh();
|
|
32425
|
+
return refreshed.token;
|
|
32426
|
+
} catch {
|
|
32427
|
+
return null;
|
|
32428
|
+
}
|
|
32429
|
+
}
|
|
32430
|
+
/** Forget tokens (logout). Does NOT call any remote revocation endpoint. */
|
|
32431
|
+
async signOut() {
|
|
32432
|
+
await this.#config.tokenStore.delete(this.#accessKey());
|
|
32433
|
+
await this.#config.tokenStore.delete(this.#refreshKey());
|
|
32434
|
+
}
|
|
32435
|
+
#accessKey() {
|
|
32436
|
+
return `oauth:tokens:${this.#config.clientId}`;
|
|
32437
|
+
}
|
|
32438
|
+
#refreshKey() {
|
|
32439
|
+
return `oauth:refresh:${this.#config.clientId}`;
|
|
32440
|
+
}
|
|
32441
|
+
#verifierKey(state) {
|
|
32442
|
+
return `oauth:verifier:${state}`;
|
|
32443
|
+
}
|
|
32444
|
+
async #tokenRequest(body) {
|
|
32445
|
+
const response = await this.#config.fetchImpl(this.#config.tokenEndpoint, {
|
|
32446
|
+
method: "POST",
|
|
32447
|
+
headers: {
|
|
32448
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
32449
|
+
Accept: "application/json"
|
|
32450
|
+
},
|
|
32451
|
+
body: body.toString()
|
|
32452
|
+
});
|
|
32453
|
+
const text = await response.text();
|
|
32454
|
+
const parsed = parseJsonBody(text);
|
|
32455
|
+
if (!response.ok) {
|
|
32456
|
+
throw new Error(formatOAuthError(parsed ?? {}, response.status));
|
|
32457
|
+
}
|
|
32458
|
+
if (parsed === null || typeof parsed !== "object" || typeof parsed.access_token !== "string") {
|
|
32459
|
+
throw new Error(
|
|
32460
|
+
"OAuth token endpoint returned a response without an `access_token` string"
|
|
32461
|
+
);
|
|
32462
|
+
}
|
|
32463
|
+
return parsed;
|
|
32464
|
+
}
|
|
32465
|
+
async #persistTokens(tokens, previousRefreshToken) {
|
|
32466
|
+
const record = { token: tokens.access_token };
|
|
32467
|
+
if (typeof tokens.expires_in === "number" && tokens.expires_in > 0) {
|
|
32468
|
+
record.expiresAt = Math.floor(Date.now() / 1e3) + tokens.expires_in;
|
|
32469
|
+
}
|
|
32470
|
+
await this.#config.tokenStore.set(this.#accessKey(), record);
|
|
32471
|
+
const newRefresh = tokens.refresh_token ?? previousRefreshToken;
|
|
32472
|
+
if (newRefresh !== void 0) {
|
|
32473
|
+
await this.#config.tokenStore.set(this.#refreshKey(), {
|
|
32474
|
+
token: newRefresh
|
|
32475
|
+
});
|
|
32476
|
+
}
|
|
32477
|
+
return record;
|
|
32478
|
+
}
|
|
32479
|
+
};
|
|
32480
|
+
function defaultGenerateState() {
|
|
32481
|
+
const bytes = new Uint8Array(24);
|
|
32482
|
+
crypto.getRandomValues(bytes);
|
|
32483
|
+
let binary = "";
|
|
32484
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
32485
|
+
binary += String.fromCharCode(bytes[i]);
|
|
32486
|
+
}
|
|
32487
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
32488
|
+
}
|
|
32489
|
+
function parseJsonBody(text) {
|
|
32490
|
+
if (text.length === 0) return null;
|
|
32491
|
+
try {
|
|
32492
|
+
return JSON.parse(text);
|
|
32493
|
+
} catch {
|
|
32494
|
+
return null;
|
|
32495
|
+
}
|
|
32496
|
+
}
|
|
32497
|
+
function formatOAuthError(body, status) {
|
|
32498
|
+
const parts = ["OAuth token request failed"];
|
|
32499
|
+
if (status !== void 0) parts.push(`(HTTP ${String(status)})`);
|
|
32500
|
+
if (body.error !== void 0 && body.error.length > 0) {
|
|
32501
|
+
parts.push(`: ${body.error}`);
|
|
32502
|
+
if (body.error_description !== void 0 && body.error_description.length > 0) {
|
|
32503
|
+
parts.push(`- ${body.error_description}`);
|
|
32504
|
+
}
|
|
32505
|
+
}
|
|
32506
|
+
return parts.join(" ").replace(" : ", ": ").replace(" - ", " - ");
|
|
32507
|
+
}
|
|
32508
|
+
|
|
32287
32509
|
// src/protocol/eip712.ts
|
|
32288
32510
|
var DOMAIN_NAME = "Vana Data Portability";
|
|
32289
32511
|
var DOMAIN_VERSION = "1";
|
|
32512
|
+
var NATIVE_VANA_ASSET = "0x0000000000000000000000000000000000000000";
|
|
32290
32513
|
function buildDomain(chainId, verifyingContract) {
|
|
32291
32514
|
return {
|
|
32292
32515
|
name: DOMAIN_NAME,
|
|
@@ -32301,6 +32524,12 @@ function fileRegistrationDomain(config) {
|
|
|
32301
32524
|
config.contracts.dataRegistry
|
|
32302
32525
|
);
|
|
32303
32526
|
}
|
|
32527
|
+
function dataRegistryDomain(config) {
|
|
32528
|
+
return buildDomain(
|
|
32529
|
+
config.chainId,
|
|
32530
|
+
config.contracts.dataRegistry
|
|
32531
|
+
);
|
|
32532
|
+
}
|
|
32304
32533
|
function grantRegistrationDomain(config) {
|
|
32305
32534
|
return buildDomain(
|
|
32306
32535
|
config.chainId,
|
|
@@ -32325,6 +32554,12 @@ function builderRegistrationDomain(config) {
|
|
|
32325
32554
|
config.contracts.dataPortabilityGrantees
|
|
32326
32555
|
);
|
|
32327
32556
|
}
|
|
32557
|
+
function escrowPaymentDomain(config) {
|
|
32558
|
+
return buildDomain(
|
|
32559
|
+
config.chainId,
|
|
32560
|
+
config.contracts.dataPortabilityEscrow
|
|
32561
|
+
);
|
|
32562
|
+
}
|
|
32328
32563
|
var FILE_REGISTRATION_TYPES = {
|
|
32329
32564
|
FileRegistration: [
|
|
32330
32565
|
{ name: "ownerAddress", type: "address" },
|
|
@@ -32336,14 +32571,16 @@ var GRANT_REGISTRATION_TYPES = {
|
|
|
32336
32571
|
GrantRegistration: [
|
|
32337
32572
|
{ name: "grantorAddress", type: "address" },
|
|
32338
32573
|
{ name: "granteeId", type: "bytes32" },
|
|
32339
|
-
{ name: "
|
|
32340
|
-
{ name: "
|
|
32574
|
+
{ name: "scopes", type: "string[]" },
|
|
32575
|
+
{ name: "grantVersion", type: "uint256" },
|
|
32576
|
+
{ name: "expiresAt", type: "uint256" }
|
|
32341
32577
|
]
|
|
32342
32578
|
};
|
|
32343
32579
|
var GRANT_REVOCATION_TYPES = {
|
|
32344
32580
|
GrantRevocation: [
|
|
32345
32581
|
{ name: "grantorAddress", type: "address" },
|
|
32346
|
-
{ name: "grantId", type: "bytes32" }
|
|
32582
|
+
{ name: "grantId", type: "bytes32" },
|
|
32583
|
+
{ name: "grantVersion", type: "uint256" }
|
|
32347
32584
|
]
|
|
32348
32585
|
};
|
|
32349
32586
|
var SERVER_REGISTRATION_TYPES = {
|
|
@@ -32362,83 +32599,500 @@ var BUILDER_REGISTRATION_TYPES = {
|
|
|
32362
32599
|
{ name: "appUrl", type: "string" }
|
|
32363
32600
|
]
|
|
32364
32601
|
};
|
|
32602
|
+
var GENERIC_PAYMENT_TYPES = {
|
|
32603
|
+
GenericPayment: [
|
|
32604
|
+
{ name: "payerAddress", type: "address" },
|
|
32605
|
+
{ name: "opType", type: "string" },
|
|
32606
|
+
{ name: "opId", type: "bytes32" },
|
|
32607
|
+
{ name: "asset", type: "address" },
|
|
32608
|
+
{ name: "amount", type: "uint256" },
|
|
32609
|
+
{ name: "paymentNonce", type: "uint256" }
|
|
32610
|
+
]
|
|
32611
|
+
};
|
|
32612
|
+
var ADD_DATA_TYPES = {
|
|
32613
|
+
AddData: [
|
|
32614
|
+
{ name: "ownerAddress", type: "address" },
|
|
32615
|
+
{ name: "scope", type: "string" },
|
|
32616
|
+
{ name: "dataHash", type: "bytes32" },
|
|
32617
|
+
{ name: "metadataHash", type: "bytes32" },
|
|
32618
|
+
{ name: "expectedVersion", type: "uint256" }
|
|
32619
|
+
]
|
|
32620
|
+
};
|
|
32621
|
+
var RECORD_DATA_ACCESS_TYPES = {
|
|
32622
|
+
RecordDataAccess: [
|
|
32623
|
+
{ name: "ownerAddress", type: "address" },
|
|
32624
|
+
{ name: "scope", type: "string" },
|
|
32625
|
+
{ name: "version", type: "uint256" },
|
|
32626
|
+
{ name: "accessor", type: "address" },
|
|
32627
|
+
{ name: "recordId", type: "bytes32" }
|
|
32628
|
+
]
|
|
32629
|
+
};
|
|
32365
32630
|
|
|
32366
|
-
// src/protocol/
|
|
32367
|
-
import {
|
|
32368
|
-
|
|
32369
|
-
|
|
32631
|
+
// src/protocol/personal-server-registration.ts
|
|
32632
|
+
import {
|
|
32633
|
+
isAddress
|
|
32634
|
+
} from "viem";
|
|
32635
|
+
var PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID = 1480;
|
|
32636
|
+
var PERSONAL_SERVER_REGISTRATION_DEFAULT_VERIFYING_CONTRACT = "0x1483B1F634DBA75AeaE60da7f01A679aabd5ee2c";
|
|
32637
|
+
function assertAddress(value, name) {
|
|
32638
|
+
if (!isAddress(value)) {
|
|
32639
|
+
throw new Error(`${name} must be a valid EVM address`);
|
|
32640
|
+
}
|
|
32370
32641
|
}
|
|
32371
|
-
function
|
|
32372
|
-
if (
|
|
32373
|
-
return
|
|
32642
|
+
function getAccountAddress(account) {
|
|
32643
|
+
if (!account) {
|
|
32644
|
+
return void 0;
|
|
32374
32645
|
}
|
|
32375
|
-
|
|
32376
|
-
|
|
32377
|
-
|
|
32378
|
-
|
|
32646
|
+
return typeof account === "string" ? account : account.address;
|
|
32647
|
+
}
|
|
32648
|
+
function isPersonalServerRegistrationSigner(source) {
|
|
32649
|
+
return "address" in source && typeof source.signTypedData === "function";
|
|
32650
|
+
}
|
|
32651
|
+
function createViemPersonalServerRegistrationSigner(source, options = {}) {
|
|
32652
|
+
if (isPersonalServerRegistrationSigner(source)) {
|
|
32653
|
+
return source;
|
|
32379
32654
|
}
|
|
32380
|
-
const
|
|
32381
|
-
|
|
32655
|
+
const accountAddress = getAccountAddress(options.account) ?? getAccountAddress(source.account);
|
|
32656
|
+
if (accountAddress) {
|
|
32657
|
+
return {
|
|
32658
|
+
address: accountAddress,
|
|
32659
|
+
signTypedData: (typedData) => source.signTypedData({
|
|
32660
|
+
...typedData,
|
|
32661
|
+
account: options.account ?? source.account ?? accountAddress
|
|
32662
|
+
})
|
|
32663
|
+
};
|
|
32664
|
+
}
|
|
32665
|
+
throw new Error(
|
|
32666
|
+
"Viem wallet client requires an account option or account property"
|
|
32667
|
+
);
|
|
32382
32668
|
}
|
|
32383
|
-
function
|
|
32384
|
-
|
|
32385
|
-
|
|
32386
|
-
parsed = JSON.parse(grant);
|
|
32387
|
-
} catch {
|
|
32388
|
-
return null;
|
|
32669
|
+
function personalServerRegistrationDomain(input = {}) {
|
|
32670
|
+
if (input.config) {
|
|
32671
|
+
return serverRegistrationDomain(input.config);
|
|
32389
32672
|
}
|
|
32390
|
-
|
|
32391
|
-
|
|
32673
|
+
const verifyingContract = input.verifyingContract ?? PERSONAL_SERVER_REGISTRATION_DEFAULT_VERIFYING_CONTRACT;
|
|
32674
|
+
assertAddress(verifyingContract, "verifyingContract");
|
|
32675
|
+
return {
|
|
32676
|
+
name: "Vana Data Portability",
|
|
32677
|
+
version: "1",
|
|
32678
|
+
chainId: input.chainId ?? PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID,
|
|
32679
|
+
verifyingContract
|
|
32680
|
+
};
|
|
32681
|
+
}
|
|
32682
|
+
function buildPersonalServerRegistrationTypedData(input) {
|
|
32683
|
+
assertAddress(input.ownerAddress, "ownerAddress");
|
|
32684
|
+
assertAddress(input.serverAddress, "serverAddress");
|
|
32685
|
+
return {
|
|
32686
|
+
domain: personalServerRegistrationDomain(input),
|
|
32687
|
+
types: SERVER_REGISTRATION_TYPES,
|
|
32688
|
+
primaryType: "ServerRegistration",
|
|
32689
|
+
message: {
|
|
32690
|
+
ownerAddress: input.ownerAddress,
|
|
32691
|
+
serverAddress: input.serverAddress,
|
|
32692
|
+
publicKey: input.serverPublicKey,
|
|
32693
|
+
serverUrl: input.serverUrl
|
|
32694
|
+
}
|
|
32695
|
+
};
|
|
32696
|
+
}
|
|
32697
|
+
async function buildPersonalServerRegistrationSignature(input) {
|
|
32698
|
+
const typedData = buildPersonalServerRegistrationTypedData({
|
|
32699
|
+
ownerAddress: input.signer.address,
|
|
32700
|
+
serverAddress: input.serverAddress,
|
|
32701
|
+
serverPublicKey: input.serverPublicKey,
|
|
32702
|
+
serverUrl: input.serverUrl,
|
|
32703
|
+
config: input.config,
|
|
32704
|
+
chainId: input.chainId,
|
|
32705
|
+
verifyingContract: input.verifyingContract
|
|
32706
|
+
});
|
|
32707
|
+
const signature = await input.signer.signTypedData(typedData);
|
|
32708
|
+
return {
|
|
32709
|
+
signature,
|
|
32710
|
+
signerAddress: input.signer.address,
|
|
32711
|
+
typedData
|
|
32712
|
+
};
|
|
32713
|
+
}
|
|
32714
|
+
var registerPersonalServerSignature = buildPersonalServerRegistrationSignature;
|
|
32715
|
+
|
|
32716
|
+
// src/protocol/personal-server-lite-owner-binding.ts
|
|
32717
|
+
import {
|
|
32718
|
+
isAddress as isAddress2
|
|
32719
|
+
} from "viem";
|
|
32720
|
+
var PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION = "vana.account.v1";
|
|
32721
|
+
var PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE = "ps-lite-owner";
|
|
32722
|
+
var PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX = `${PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION}:${PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE}:`;
|
|
32723
|
+
function assertAddress2(value, name) {
|
|
32724
|
+
if (!isAddress2(value)) {
|
|
32725
|
+
throw new Error(`${name} must be a valid EVM address`);
|
|
32392
32726
|
}
|
|
32393
|
-
|
|
32394
|
-
|
|
32395
|
-
|
|
32727
|
+
}
|
|
32728
|
+
function getAccountAddress2(account) {
|
|
32729
|
+
if (!account) {
|
|
32730
|
+
return void 0;
|
|
32396
32731
|
}
|
|
32397
|
-
|
|
32398
|
-
|
|
32732
|
+
return typeof account === "string" ? account : account.address;
|
|
32733
|
+
}
|
|
32734
|
+
function isPersonalServerLiteOwnerBindingSigner(source) {
|
|
32735
|
+
return "address" in source && typeof source.signMessage === "function";
|
|
32736
|
+
}
|
|
32737
|
+
function buildPersonalServerLiteOwnerBindingMessage(ownerAddress) {
|
|
32738
|
+
assertAddress2(ownerAddress, "ownerAddress");
|
|
32739
|
+
return `${PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX}${ownerAddress.toLowerCase()}`;
|
|
32740
|
+
}
|
|
32741
|
+
function createViemPersonalServerLiteOwnerBindingSigner(source, options = {}) {
|
|
32742
|
+
if (isPersonalServerLiteOwnerBindingSigner(source)) {
|
|
32743
|
+
return source;
|
|
32399
32744
|
}
|
|
32400
|
-
|
|
32401
|
-
|
|
32745
|
+
const accountAddress = getAccountAddress2(options.account) ?? getAccountAddress2(source.account);
|
|
32746
|
+
if (accountAddress) {
|
|
32747
|
+
return {
|
|
32748
|
+
address: accountAddress,
|
|
32749
|
+
signMessage: ({ message }) => source.signMessage({
|
|
32750
|
+
account: options.account ?? source.account ?? accountAddress,
|
|
32751
|
+
message
|
|
32752
|
+
})
|
|
32753
|
+
};
|
|
32402
32754
|
}
|
|
32403
|
-
|
|
32404
|
-
|
|
32755
|
+
throw new Error(
|
|
32756
|
+
"Viem wallet client requires an account option or account property"
|
|
32757
|
+
);
|
|
32758
|
+
}
|
|
32759
|
+
async function buildPersonalServerLiteOwnerBindingSignature(input) {
|
|
32760
|
+
const message = buildPersonalServerLiteOwnerBindingMessage(
|
|
32761
|
+
input.signer.address
|
|
32762
|
+
);
|
|
32763
|
+
const signature = await input.signer.signMessage({ message });
|
|
32764
|
+
return {
|
|
32765
|
+
signature,
|
|
32766
|
+
signerAddress: input.signer.address,
|
|
32767
|
+
message,
|
|
32768
|
+
purpose: PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE
|
|
32769
|
+
};
|
|
32770
|
+
}
|
|
32771
|
+
var signPersonalServerLiteOwnerBinding = buildPersonalServerLiteOwnerBindingSignature;
|
|
32772
|
+
|
|
32773
|
+
// src/account/personal-server-registration.ts
|
|
32774
|
+
import { isAddress as isAddress3 } from "viem";
|
|
32775
|
+
var ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT = "personal_server.server_registration.v1";
|
|
32776
|
+
var AccountPersonalServerRegistrationError = class extends Error {
|
|
32777
|
+
status;
|
|
32778
|
+
code;
|
|
32779
|
+
details;
|
|
32780
|
+
constructor(input) {
|
|
32781
|
+
super(input.message);
|
|
32782
|
+
this.name = "AccountPersonalServerRegistrationError";
|
|
32783
|
+
this.status = input.status;
|
|
32784
|
+
this.code = input.code;
|
|
32785
|
+
this.details = input.details;
|
|
32405
32786
|
}
|
|
32406
|
-
|
|
32407
|
-
|
|
32787
|
+
};
|
|
32788
|
+
var DEFAULT_ACCOUNT_PS_REGISTRATION_PATH = "/api/v1/intents/personal-server-registration/sign";
|
|
32789
|
+
function trimTrailingSlash(value) {
|
|
32790
|
+
return value.replace(/\/+$/, "");
|
|
32791
|
+
}
|
|
32792
|
+
function assertAddress3(value, name) {
|
|
32793
|
+
if (!isAddress3(value)) {
|
|
32794
|
+
throw new Error(`${name} must be a valid EVM address`);
|
|
32408
32795
|
}
|
|
32409
|
-
|
|
32410
|
-
|
|
32796
|
+
}
|
|
32797
|
+
async function parseAccountResponse(response) {
|
|
32798
|
+
const body = await response.json().catch(() => void 0);
|
|
32799
|
+
if (!response.ok) {
|
|
32800
|
+
throw new AccountPersonalServerRegistrationError({
|
|
32801
|
+
status: response.status,
|
|
32802
|
+
code: accountErrorCode(body),
|
|
32803
|
+
message: accountErrorMessage(response.status, body),
|
|
32804
|
+
details: body
|
|
32805
|
+
});
|
|
32806
|
+
}
|
|
32807
|
+
return body;
|
|
32808
|
+
}
|
|
32809
|
+
function accountErrorMessage(status, body) {
|
|
32810
|
+
const nestedMessage = nestedAccountErrorField(body, "message");
|
|
32811
|
+
if (nestedMessage) {
|
|
32812
|
+
return nestedMessage;
|
|
32813
|
+
}
|
|
32814
|
+
if (isRecord(body) && typeof body.message === "string") {
|
|
32815
|
+
return body.message;
|
|
32816
|
+
}
|
|
32817
|
+
const code = accountErrorCode(body);
|
|
32818
|
+
if (code) {
|
|
32819
|
+
return `Account PS registration signing failed: ${code}`;
|
|
32820
|
+
}
|
|
32821
|
+
return `Account PS registration signing failed: ${status}`;
|
|
32822
|
+
}
|
|
32823
|
+
function accountErrorCode(body) {
|
|
32824
|
+
const nestedCode = nestedAccountErrorField(body, "code");
|
|
32825
|
+
if (nestedCode) {
|
|
32826
|
+
return nestedCode;
|
|
32827
|
+
}
|
|
32828
|
+
if (isRecord(body)) {
|
|
32829
|
+
if (typeof body.code === "string") {
|
|
32830
|
+
return body.code;
|
|
32831
|
+
}
|
|
32832
|
+
if (typeof body.error === "string") {
|
|
32833
|
+
return body.error;
|
|
32834
|
+
}
|
|
32411
32835
|
}
|
|
32836
|
+
return void 0;
|
|
32837
|
+
}
|
|
32838
|
+
function nestedAccountErrorField(body, field) {
|
|
32839
|
+
if (!isRecord(body) || !isRecord(body.error)) {
|
|
32840
|
+
return void 0;
|
|
32841
|
+
}
|
|
32842
|
+
const value = body.error[field];
|
|
32843
|
+
return typeof value === "string" ? value : void 0;
|
|
32844
|
+
}
|
|
32845
|
+
function isRecord(value) {
|
|
32846
|
+
return typeof value === "object" && value !== null;
|
|
32847
|
+
}
|
|
32848
|
+
function normalizeAccountResponse(response) {
|
|
32412
32849
|
return {
|
|
32413
|
-
|
|
32414
|
-
|
|
32415
|
-
|
|
32416
|
-
|
|
32417
|
-
nonce: value["nonce"]
|
|
32850
|
+
...response,
|
|
32851
|
+
status: response.status === "fallback_required" ? "confirmation_required" : response.status,
|
|
32852
|
+
signerAddress: response.signerAddress ?? response.signer?.address,
|
|
32853
|
+
typedData: response.typedData ?? response.typed_data
|
|
32418
32854
|
};
|
|
32419
32855
|
}
|
|
32420
|
-
function
|
|
32421
|
-
|
|
32422
|
-
|
|
32856
|
+
function buildSignedResult(response, request) {
|
|
32857
|
+
assertAddress3(response.signerAddress, "signerAddress");
|
|
32858
|
+
if (response.typedData) {
|
|
32859
|
+
assertTypedDataMatchesRequest(
|
|
32860
|
+
response.typedData,
|
|
32861
|
+
request,
|
|
32862
|
+
response.signerAddress
|
|
32863
|
+
);
|
|
32864
|
+
}
|
|
32865
|
+
return {
|
|
32866
|
+
signature: response.signature,
|
|
32867
|
+
signerAddress: response.signerAddress,
|
|
32868
|
+
typedData: response.typedData ?? buildPersonalServerRegistrationTypedData({
|
|
32869
|
+
ownerAddress: response.signerAddress,
|
|
32870
|
+
...request
|
|
32871
|
+
}),
|
|
32872
|
+
intent: ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT
|
|
32873
|
+
};
|
|
32874
|
+
}
|
|
32875
|
+
function assertTypedDataMatchesRequest(typedData, request, expectedSignerAddress) {
|
|
32876
|
+
assertAddress3(
|
|
32877
|
+
typedData.message.ownerAddress,
|
|
32878
|
+
"typedData.message.ownerAddress"
|
|
32879
|
+
);
|
|
32880
|
+
assertAddress3(
|
|
32881
|
+
typedData.message.serverAddress,
|
|
32882
|
+
"typedData.message.serverAddress"
|
|
32883
|
+
);
|
|
32884
|
+
if (expectedSignerAddress && !sameAddress(typedData.message.ownerAddress, expectedSignerAddress)) {
|
|
32885
|
+
throw new Error(
|
|
32886
|
+
"Account typedData ownerAddress must match the expected signer address"
|
|
32887
|
+
);
|
|
32888
|
+
}
|
|
32889
|
+
if (!sameAddress(typedData.message.serverAddress, request.serverAddress)) {
|
|
32890
|
+
throw new Error(
|
|
32891
|
+
"Account typedData serverAddress must match the requested serverAddress"
|
|
32892
|
+
);
|
|
32893
|
+
}
|
|
32894
|
+
if (typedData.message.publicKey !== request.serverPublicKey) {
|
|
32895
|
+
throw new Error(
|
|
32896
|
+
"Account typedData publicKey must match the requested serverPublicKey"
|
|
32897
|
+
);
|
|
32898
|
+
}
|
|
32899
|
+
if (typedData.message.serverUrl !== request.serverUrl) {
|
|
32900
|
+
throw new Error(
|
|
32901
|
+
"Account typedData serverUrl must match the requested serverUrl"
|
|
32902
|
+
);
|
|
32903
|
+
}
|
|
32904
|
+
if (typedData.primaryType !== "ServerRegistration") {
|
|
32905
|
+
throw new Error("Account typedData primaryType must be ServerRegistration");
|
|
32906
|
+
}
|
|
32907
|
+
if (JSON.stringify(typedData.types) !== JSON.stringify(SERVER_REGISTRATION_TYPES)) {
|
|
32908
|
+
throw new Error("Account typedData types must be ServerRegistration types");
|
|
32909
|
+
}
|
|
32910
|
+
const expectedDomain = personalServerRegistrationDomain({
|
|
32911
|
+
config: request.config,
|
|
32912
|
+
chainId: request.chainId,
|
|
32913
|
+
verifyingContract: request.verifyingContract
|
|
32914
|
+
});
|
|
32915
|
+
if (!domainsEqual(typedData.domain, expectedDomain)) {
|
|
32916
|
+
throw new Error("Account typedData domain must match the requested domain");
|
|
32917
|
+
}
|
|
32918
|
+
}
|
|
32919
|
+
function sameAddress(a, b) {
|
|
32920
|
+
return a.toLowerCase() === b.toLowerCase();
|
|
32921
|
+
}
|
|
32922
|
+
function domainsEqual(a, b) {
|
|
32923
|
+
if (!a || !b) {
|
|
32924
|
+
return false;
|
|
32925
|
+
}
|
|
32926
|
+
return a.name === b.name && a.version === b.version && Number(a.chainId) === Number(b.chainId) && String(a.verifyingContract ?? "").toLowerCase() === String(b.verifyingContract ?? "").toLowerCase() && a.salt === b.salt;
|
|
32927
|
+
}
|
|
32928
|
+
async function signPersonalServerRegistrationWithAccount(config, request) {
|
|
32929
|
+
assertAddress3(request.serverAddress, "serverAddress");
|
|
32930
|
+
const fetchImpl = config.fetchImpl ?? globalThis.fetch.bind(globalThis);
|
|
32931
|
+
const endpoint = new URL(
|
|
32932
|
+
config.endpointPath ?? DEFAULT_ACCOUNT_PS_REGISTRATION_PATH,
|
|
32933
|
+
`${trimTrailingSlash(config.accountOrigin)}/`
|
|
32934
|
+
);
|
|
32935
|
+
const response = await fetchImpl(endpoint, {
|
|
32936
|
+
method: "POST",
|
|
32937
|
+
headers: { "content-type": "application/json" },
|
|
32938
|
+
credentials: "include",
|
|
32939
|
+
body: JSON.stringify({
|
|
32940
|
+
intent: ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT,
|
|
32941
|
+
serverAddress: request.serverAddress,
|
|
32942
|
+
serverPublicKey: request.serverPublicKey,
|
|
32943
|
+
serverUrl: request.serverUrl,
|
|
32944
|
+
config: request.config,
|
|
32945
|
+
chainId: request.chainId,
|
|
32946
|
+
verifyingContract: request.verifyingContract
|
|
32947
|
+
})
|
|
32948
|
+
});
|
|
32949
|
+
const body = normalizeAccountResponse(await parseAccountResponse(response));
|
|
32950
|
+
if (body.status === "signed") {
|
|
32951
|
+
if (!body.signature || !body.signerAddress) {
|
|
32952
|
+
throw new Error(
|
|
32953
|
+
"Account signed response must include signature and signerAddress"
|
|
32954
|
+
);
|
|
32955
|
+
}
|
|
32423
32956
|
return {
|
|
32424
|
-
|
|
32425
|
-
|
|
32957
|
+
status: "signed",
|
|
32958
|
+
result: buildSignedResult(
|
|
32959
|
+
{
|
|
32960
|
+
signature: body.signature,
|
|
32961
|
+
signerAddress: body.signerAddress,
|
|
32962
|
+
typedData: body.typedData
|
|
32963
|
+
},
|
|
32964
|
+
request
|
|
32965
|
+
)
|
|
32426
32966
|
};
|
|
32967
|
+
}
|
|
32968
|
+
if (body.status === "confirmation_required") {
|
|
32969
|
+
if (!body.typedData) {
|
|
32970
|
+
throw new Error(
|
|
32971
|
+
"Account confirmation_required response must include typedData"
|
|
32972
|
+
);
|
|
32973
|
+
}
|
|
32974
|
+
assertTypedDataMatchesRequest(body.typedData, request, body.signerAddress);
|
|
32975
|
+
if (!config.fallbackSigner) {
|
|
32976
|
+
return {
|
|
32977
|
+
status: "confirmation_required",
|
|
32978
|
+
typedData: body.typedData,
|
|
32979
|
+
signerAddress: body.signerAddress
|
|
32980
|
+
};
|
|
32981
|
+
}
|
|
32982
|
+
assertTypedDataMatchesRequest(
|
|
32983
|
+
body.typedData,
|
|
32984
|
+
request,
|
|
32985
|
+
config.fallbackSigner.address
|
|
32986
|
+
);
|
|
32987
|
+
const signature = await config.fallbackSigner.signTypedData(body.typedData);
|
|
32988
|
+
return {
|
|
32989
|
+
status: "fallback_signed",
|
|
32990
|
+
accountStatus: "confirmation_required",
|
|
32991
|
+
result: {
|
|
32992
|
+
signature,
|
|
32993
|
+
signerAddress: config.fallbackSigner.address,
|
|
32994
|
+
typedData: body.typedData,
|
|
32995
|
+
intent: ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT
|
|
32996
|
+
}
|
|
32997
|
+
};
|
|
32998
|
+
}
|
|
32999
|
+
throw new Error(
|
|
33000
|
+
`Unsupported Account PS registration signing status: ${String(body.status)}`
|
|
33001
|
+
);
|
|
33002
|
+
}
|
|
33003
|
+
|
|
33004
|
+
// src/account/personal-server-lite-owner-binding.ts
|
|
33005
|
+
var AccountPersonalServerLiteOwnerBindingError = class extends Error {
|
|
33006
|
+
code;
|
|
33007
|
+
details;
|
|
33008
|
+
constructor(input) {
|
|
33009
|
+
super(input.message);
|
|
33010
|
+
this.name = "AccountPersonalServerLiteOwnerBindingError";
|
|
33011
|
+
this.code = input.code;
|
|
33012
|
+
this.details = input.details;
|
|
33013
|
+
}
|
|
33014
|
+
};
|
|
33015
|
+
async function signPersonalServerLiteOwnerBindingWithAccountClient(config) {
|
|
33016
|
+
let address;
|
|
33017
|
+
try {
|
|
33018
|
+
address = await config.client.getAddress();
|
|
33019
|
+
} catch (error) {
|
|
33020
|
+
throw accountOwnerBindingError(error);
|
|
33021
|
+
}
|
|
33022
|
+
if (!address) {
|
|
33023
|
+
throw new AccountPersonalServerLiteOwnerBindingError({
|
|
33024
|
+
message: "Account did not return a wallet address",
|
|
33025
|
+
code: "account_address_required"
|
|
33026
|
+
});
|
|
33027
|
+
}
|
|
33028
|
+
const message = buildPersonalServerLiteOwnerBindingMessage(address);
|
|
33029
|
+
let signature;
|
|
33030
|
+
try {
|
|
33031
|
+
signature = await config.client.signMessage({ message });
|
|
33032
|
+
} catch (error) {
|
|
33033
|
+
throw accountOwnerBindingError(error);
|
|
33034
|
+
}
|
|
33035
|
+
return {
|
|
33036
|
+
signature,
|
|
33037
|
+
signerAddress: address,
|
|
33038
|
+
message,
|
|
33039
|
+
purpose: PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE
|
|
33040
|
+
};
|
|
33041
|
+
}
|
|
33042
|
+
function accountOwnerBindingError(error) {
|
|
33043
|
+
if (error instanceof AccountPersonalServerLiteOwnerBindingError) {
|
|
33044
|
+
return error;
|
|
33045
|
+
}
|
|
33046
|
+
const rpcError = error;
|
|
33047
|
+
const code = rpcError?.code;
|
|
33048
|
+
const message = typeof rpcError?.message === "string" && rpcError.message.length > 0 ? rpcError.message : "Account PS Lite owner-binding signature failed";
|
|
33049
|
+
return new AccountPersonalServerLiteOwnerBindingError({
|
|
33050
|
+
message,
|
|
33051
|
+
code,
|
|
33052
|
+
details: error
|
|
33053
|
+
});
|
|
33054
|
+
}
|
|
33055
|
+
|
|
33056
|
+
// src/protocol/grants.ts
|
|
33057
|
+
import { verifyTypedData } from "viem";
|
|
33058
|
+
function isHexString(value) {
|
|
33059
|
+
return typeof value === "string" && value.startsWith("0x");
|
|
33060
|
+
}
|
|
33061
|
+
function isDataPortabilityGatewayConfig(value) {
|
|
33062
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
33063
|
+
return false;
|
|
33064
|
+
}
|
|
33065
|
+
const config = value;
|
|
33066
|
+
const contracts = config["contracts"];
|
|
33067
|
+
if (typeof config["chainId"] !== "number" || !Number.isInteger(config["chainId"]) || config["chainId"] <= 0 || contracts === null || typeof contracts !== "object" || Array.isArray(contracts)) {
|
|
33068
|
+
return false;
|
|
33069
|
+
}
|
|
33070
|
+
const c = contracts;
|
|
33071
|
+
return isHexString(c["dataRegistry"]) && isHexString(c["dataPortabilityPermissions"]) && isHexString(c["dataPortabilityServer"]) && isHexString(c["dataPortabilityGrantees"]) && isHexString(c["dataPortabilityEscrow"]) && isHexString(c["feeRegistry"]);
|
|
33072
|
+
}
|
|
33073
|
+
function toUint256(value) {
|
|
33074
|
+
try {
|
|
33075
|
+
const big = typeof value === "bigint" ? value : BigInt(value);
|
|
33076
|
+
if (big < 0n) return null;
|
|
33077
|
+
return big;
|
|
32427
33078
|
} catch {
|
|
32428
33079
|
return null;
|
|
32429
33080
|
}
|
|
32430
33081
|
}
|
|
32431
33082
|
async function verifyGrantRegistration(input) {
|
|
32432
|
-
|
|
32433
|
-
|
|
32434
|
-
|
|
32435
|
-
|
|
32436
|
-
|
|
32437
|
-
|
|
33083
|
+
if (!Array.isArray(input.scopes) || input.scopes.length === 0) {
|
|
33084
|
+
return { valid: false, error: "scopes must be a non-empty array" };
|
|
33085
|
+
}
|
|
33086
|
+
if (!input.scopes.every((scope) => typeof scope === "string")) {
|
|
33087
|
+
return { valid: false, error: "scopes must contain only strings" };
|
|
33088
|
+
}
|
|
33089
|
+
const grantVersion = toUint256(input.grantVersion);
|
|
33090
|
+
if (grantVersion === null || grantVersion < 1n) {
|
|
33091
|
+
return { valid: false, error: "grantVersion must be a uint256 >= 1" };
|
|
32438
33092
|
}
|
|
32439
|
-
const
|
|
32440
|
-
if (
|
|
32441
|
-
return { valid: false, error: "
|
|
33093
|
+
const expiresAt = toUint256(input.expiresAt);
|
|
33094
|
+
if (expiresAt === null) {
|
|
33095
|
+
return { valid: false, error: "expiresAt must be a non-negative uint256" };
|
|
32442
33096
|
}
|
|
32443
33097
|
let valid;
|
|
32444
33098
|
try {
|
|
@@ -32450,8 +33104,9 @@ async function verifyGrantRegistration(input) {
|
|
|
32450
33104
|
message: {
|
|
32451
33105
|
grantorAddress: input.grantorAddress,
|
|
32452
33106
|
granteeId: input.granteeId,
|
|
32453
|
-
|
|
32454
|
-
|
|
33107
|
+
scopes: input.scopes,
|
|
33108
|
+
grantVersion,
|
|
33109
|
+
expiresAt
|
|
32455
33110
|
},
|
|
32456
33111
|
signature: input.signature
|
|
32457
33112
|
});
|
|
@@ -32462,19 +33117,128 @@ async function verifyGrantRegistration(input) {
|
|
|
32462
33117
|
return { valid: false, error: "Grant signature does not match grantor" };
|
|
32463
33118
|
}
|
|
32464
33119
|
const nowSeconds = input.nowSeconds ?? Math.floor(Date.now() / 1e3);
|
|
32465
|
-
if (
|
|
33120
|
+
if (expiresAt > 0n && expiresAt < BigInt(nowSeconds)) {
|
|
32466
33121
|
return { valid: false, error: "Grant has expired" };
|
|
32467
33122
|
}
|
|
32468
|
-
if (payload.user !== void 0 && payload.user.toLowerCase() !== input.grantorAddress.toLowerCase()) {
|
|
32469
|
-
return { valid: false, error: "Grant user does not match grantorAddress" };
|
|
32470
|
-
}
|
|
32471
33123
|
return {
|
|
32472
33124
|
valid: true,
|
|
32473
33125
|
grantorAddress: input.grantorAddress,
|
|
32474
33126
|
granteeId: input.granteeId,
|
|
32475
|
-
|
|
32476
|
-
|
|
32477
|
-
|
|
33127
|
+
scopes: input.scopes,
|
|
33128
|
+
grantVersion: grantVersion.toString(),
|
|
33129
|
+
expiresAt: expiresAt.toString()
|
|
33130
|
+
};
|
|
33131
|
+
}
|
|
33132
|
+
|
|
33133
|
+
// src/protocol/escrow-deposit.ts
|
|
33134
|
+
import { encodeFunctionData } from "viem";
|
|
33135
|
+
var ESCROW_DEPOSIT_ABI = [
|
|
33136
|
+
{
|
|
33137
|
+
type: "function",
|
|
33138
|
+
name: "depositNative",
|
|
33139
|
+
stateMutability: "payable",
|
|
33140
|
+
inputs: [{ name: "account", type: "address" }],
|
|
33141
|
+
outputs: []
|
|
33142
|
+
},
|
|
33143
|
+
{
|
|
33144
|
+
type: "function",
|
|
33145
|
+
name: "depositToken",
|
|
33146
|
+
stateMutability: "nonpayable",
|
|
33147
|
+
inputs: [
|
|
33148
|
+
{ name: "account", type: "address" },
|
|
33149
|
+
{ name: "token", type: "address" },
|
|
33150
|
+
{ name: "amount", type: "uint256" }
|
|
33151
|
+
],
|
|
33152
|
+
outputs: []
|
|
33153
|
+
}
|
|
33154
|
+
];
|
|
33155
|
+
function escrowContractAddress(config) {
|
|
33156
|
+
return config.contracts.dataPortabilityEscrow;
|
|
33157
|
+
}
|
|
33158
|
+
function encodeDepositNativeData(input) {
|
|
33159
|
+
return encodeFunctionData({
|
|
33160
|
+
abi: ESCROW_DEPOSIT_ABI,
|
|
33161
|
+
functionName: "depositNative",
|
|
33162
|
+
args: [input.account]
|
|
33163
|
+
});
|
|
33164
|
+
}
|
|
33165
|
+
function encodeDepositTokenData(input) {
|
|
33166
|
+
return encodeFunctionData({
|
|
33167
|
+
abi: ESCROW_DEPOSIT_ABI,
|
|
33168
|
+
functionName: "depositToken",
|
|
33169
|
+
args: [input.account, input.token, input.amount]
|
|
33170
|
+
});
|
|
33171
|
+
}
|
|
33172
|
+
function buildDepositNativeRequest(config, input) {
|
|
33173
|
+
return {
|
|
33174
|
+
to: escrowContractAddress(config),
|
|
33175
|
+
data: encodeDepositNativeData({ account: input.account }),
|
|
33176
|
+
value: input.amount
|
|
33177
|
+
};
|
|
33178
|
+
}
|
|
33179
|
+
function buildDepositTokenRequest(config, input) {
|
|
33180
|
+
return {
|
|
33181
|
+
to: escrowContractAddress(config),
|
|
33182
|
+
data: encodeDepositTokenData(input)
|
|
33183
|
+
};
|
|
33184
|
+
}
|
|
33185
|
+
|
|
33186
|
+
// src/protocol/fee-registry.ts
|
|
33187
|
+
import { parseAbi } from "viem";
|
|
33188
|
+
var FEE_REGISTRY_ABI = parseAbi([
|
|
33189
|
+
"struct Fee { uint256 amount; address asset; address payee; bool enabled; }",
|
|
33190
|
+
"function fees(bytes32 operation) view returns (Fee)",
|
|
33191
|
+
"function operationKey(string name) pure returns (bytes32)"
|
|
33192
|
+
]);
|
|
33193
|
+
function operationNameFor(kind, opts) {
|
|
33194
|
+
if (kind === "registration") {
|
|
33195
|
+
return opts?.registrationOpName ?? "registration";
|
|
33196
|
+
}
|
|
33197
|
+
return opts?.dataAccessOpName ?? "data_access";
|
|
33198
|
+
}
|
|
33199
|
+
async function getFee(client, config, kind, opts) {
|
|
33200
|
+
const address = config.contracts.feeRegistry;
|
|
33201
|
+
const opName = operationNameFor(kind, opts);
|
|
33202
|
+
const opKey = await client.readContract({
|
|
33203
|
+
address,
|
|
33204
|
+
abi: FEE_REGISTRY_ABI,
|
|
33205
|
+
functionName: "operationKey",
|
|
33206
|
+
args: [opName]
|
|
33207
|
+
});
|
|
33208
|
+
const fee = await client.readContract({
|
|
33209
|
+
address,
|
|
33210
|
+
abi: FEE_REGISTRY_ABI,
|
|
33211
|
+
functionName: "fees",
|
|
33212
|
+
args: [opKey]
|
|
33213
|
+
});
|
|
33214
|
+
if (!fee.enabled) {
|
|
33215
|
+
throw new Error(
|
|
33216
|
+
`FeeRegistry: operation "${opName}" (kind=${kind}) is not enabled \u2014 operator must call setFeeByName before payments will validate`
|
|
33217
|
+
);
|
|
33218
|
+
}
|
|
33219
|
+
if (fee.payee === "0x0000000000000000000000000000000000000000") {
|
|
33220
|
+
throw new Error(
|
|
33221
|
+
`FeeRegistry: operation "${opName}" has zero-address payee \u2014 contract pre-flight rejects payouts to 0x0`
|
|
33222
|
+
);
|
|
33223
|
+
}
|
|
33224
|
+
return fee;
|
|
33225
|
+
}
|
|
33226
|
+
async function getOpFee(client, config, opts) {
|
|
33227
|
+
const [registration, dataAccess] = await Promise.all([
|
|
33228
|
+
getFee(client, config, "registration", opts),
|
|
33229
|
+
getFee(client, config, "data_access", opts)
|
|
33230
|
+
]);
|
|
33231
|
+
if (registration.asset.toLowerCase() !== dataAccess.asset.toLowerCase()) {
|
|
33232
|
+
throw new Error(
|
|
33233
|
+
`FeeRegistry asset mismatch: registration=${registration.asset} vs data_access=${dataAccess.asset}. The gateway requires both fees to settle in the same asset.`
|
|
33234
|
+
);
|
|
33235
|
+
}
|
|
33236
|
+
return {
|
|
33237
|
+
asset: registration.asset,
|
|
33238
|
+
registrationFee: registration.amount,
|
|
33239
|
+
dataAccessFee: dataAccess.amount,
|
|
33240
|
+
registrationPayee: registration.payee,
|
|
33241
|
+
dataAccessPayee: dataAccess.payee
|
|
32478
33242
|
};
|
|
32479
33243
|
}
|
|
32480
33244
|
|
|
@@ -32674,6 +33438,68 @@ function createGatewayClient(baseUrl) {
|
|
|
32674
33438
|
alreadyRegistered: false
|
|
32675
33439
|
};
|
|
32676
33440
|
},
|
|
33441
|
+
async registerBuilder(params) {
|
|
33442
|
+
const res = await fetch(`${base}/v1/builders`, {
|
|
33443
|
+
method: "POST",
|
|
33444
|
+
headers: {
|
|
33445
|
+
"Content-Type": "application/json",
|
|
33446
|
+
Authorization: `Web3Signed ${params.signature}`
|
|
33447
|
+
},
|
|
33448
|
+
body: JSON.stringify({
|
|
33449
|
+
ownerAddress: params.ownerAddress,
|
|
33450
|
+
granteeAddress: params.granteeAddress,
|
|
33451
|
+
publicKey: params.publicKey,
|
|
33452
|
+
appUrl: params.appUrl
|
|
33453
|
+
})
|
|
33454
|
+
});
|
|
33455
|
+
if (res.status === 409) {
|
|
33456
|
+
const body2 = await res.json().catch(() => ({}));
|
|
33457
|
+
return {
|
|
33458
|
+
builderId: getMutationId(
|
|
33459
|
+
body2,
|
|
33460
|
+
"builderId"
|
|
33461
|
+
),
|
|
33462
|
+
alreadyRegistered: true
|
|
33463
|
+
};
|
|
33464
|
+
}
|
|
33465
|
+
if (!res.ok) {
|
|
33466
|
+
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
33467
|
+
}
|
|
33468
|
+
const body = await res.json().catch(() => ({}));
|
|
33469
|
+
return {
|
|
33470
|
+
builderId: getMutationId(body, "builderId"),
|
|
33471
|
+
alreadyRegistered: false
|
|
33472
|
+
};
|
|
33473
|
+
},
|
|
33474
|
+
async registerDataPoint(params) {
|
|
33475
|
+
const res = await fetch(`${base}/v1/data`, {
|
|
33476
|
+
method: "POST",
|
|
33477
|
+
headers: {
|
|
33478
|
+
"Content-Type": "application/json",
|
|
33479
|
+
Authorization: `Web3Signed ${params.signature}`
|
|
33480
|
+
},
|
|
33481
|
+
body: JSON.stringify({
|
|
33482
|
+
ownerAddress: params.ownerAddress,
|
|
33483
|
+
scope: params.scope,
|
|
33484
|
+
dataHash: params.dataHash,
|
|
33485
|
+
metadataHash: params.metadataHash,
|
|
33486
|
+
expectedVersion: params.expectedVersion
|
|
33487
|
+
})
|
|
33488
|
+
});
|
|
33489
|
+
if (!res.ok) {
|
|
33490
|
+
const body2 = await res.json().catch(() => ({}));
|
|
33491
|
+
const detail = body2.error ?? res.statusText;
|
|
33492
|
+
throw new Error(`Gateway error: ${res.status} ${detail}`);
|
|
33493
|
+
}
|
|
33494
|
+
const body = await res.json().catch(() => ({}));
|
|
33495
|
+
return {
|
|
33496
|
+
dataPointId: getMutationId(
|
|
33497
|
+
body,
|
|
33498
|
+
"dataPointId"
|
|
33499
|
+
),
|
|
33500
|
+
expectedVersion: body.expectedVersion
|
|
33501
|
+
};
|
|
33502
|
+
},
|
|
32677
33503
|
async registerFile(params) {
|
|
32678
33504
|
const res = await fetch(`${base}/v1/files`, {
|
|
32679
33505
|
method: "POST",
|
|
@@ -32711,8 +33537,9 @@ function createGatewayClient(baseUrl) {
|
|
|
32711
33537
|
body: JSON.stringify({
|
|
32712
33538
|
grantorAddress: params.grantorAddress,
|
|
32713
33539
|
granteeId: params.granteeId,
|
|
32714
|
-
|
|
32715
|
-
|
|
33540
|
+
scopes: params.scopes,
|
|
33541
|
+
grantVersion: params.grantVersion,
|
|
33542
|
+
expiresAt: params.expiresAt
|
|
32716
33543
|
})
|
|
32717
33544
|
});
|
|
32718
33545
|
if (res.status === 409) {
|
|
@@ -32737,13 +33564,71 @@ function createGatewayClient(baseUrl) {
|
|
|
32737
33564
|
Authorization: `Web3Signed ${params.signature}`
|
|
32738
33565
|
},
|
|
32739
33566
|
body: JSON.stringify({
|
|
32740
|
-
grantorAddress: params.grantorAddress
|
|
33567
|
+
grantorAddress: params.grantorAddress,
|
|
33568
|
+
grantVersion: params.grantVersion
|
|
32741
33569
|
})
|
|
32742
33570
|
});
|
|
32743
33571
|
if (res.status === 409) return;
|
|
32744
33572
|
if (!res.ok) {
|
|
32745
33573
|
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
32746
33574
|
}
|
|
33575
|
+
},
|
|
33576
|
+
async getEscrowBalance(account) {
|
|
33577
|
+
const res = await fetch(`${base}/v1/escrow/balance?account=${account}`);
|
|
33578
|
+
if (!res.ok) {
|
|
33579
|
+
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
33580
|
+
}
|
|
33581
|
+
return await res.json();
|
|
33582
|
+
},
|
|
33583
|
+
async submitEscrowDeposit(params) {
|
|
33584
|
+
const res = await fetch(`${base}/v1/escrow/deposit`, {
|
|
33585
|
+
method: "POST",
|
|
33586
|
+
headers: { "Content-Type": "application/json" },
|
|
33587
|
+
body: JSON.stringify({ txHash: params.txHash })
|
|
33588
|
+
});
|
|
33589
|
+
if (res.status !== 200 && res.status !== 202) {
|
|
33590
|
+
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
33591
|
+
}
|
|
33592
|
+
return await res.json();
|
|
33593
|
+
},
|
|
33594
|
+
async payForOperation(params) {
|
|
33595
|
+
const body = {
|
|
33596
|
+
payerAddress: params.payerAddress,
|
|
33597
|
+
opType: params.opType,
|
|
33598
|
+
opId: params.opId,
|
|
33599
|
+
asset: params.asset,
|
|
33600
|
+
amount: params.amount,
|
|
33601
|
+
paymentNonce: params.paymentNonce
|
|
33602
|
+
};
|
|
33603
|
+
if (params.accessRecord) {
|
|
33604
|
+
body["accessRecord"] = params.accessRecord;
|
|
33605
|
+
}
|
|
33606
|
+
const res = await fetch(`${base}/v1/escrow/pay`, {
|
|
33607
|
+
method: "POST",
|
|
33608
|
+
headers: {
|
|
33609
|
+
"Content-Type": "application/json",
|
|
33610
|
+
Authorization: `Web3Signed ${params.signature}`
|
|
33611
|
+
},
|
|
33612
|
+
body: JSON.stringify(body)
|
|
33613
|
+
});
|
|
33614
|
+
if (!res.ok) {
|
|
33615
|
+
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
33616
|
+
}
|
|
33617
|
+
return await res.json();
|
|
33618
|
+
},
|
|
33619
|
+
async settle(params) {
|
|
33620
|
+
const res = await fetch(`${base}/v1/settle`, {
|
|
33621
|
+
method: "POST",
|
|
33622
|
+
headers: { "Content-Type": "application/json" },
|
|
33623
|
+
// The gateway accepts an empty body; only `limit` is recognised.
|
|
33624
|
+
// Always send a JSON body so the gateway's req.body shape parse
|
|
33625
|
+
// doesn't have to deal with an undefined.
|
|
33626
|
+
body: JSON.stringify(params ?? {})
|
|
33627
|
+
});
|
|
33628
|
+
if (!res.ok) {
|
|
33629
|
+
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
33630
|
+
}
|
|
33631
|
+
return await res.json();
|
|
32747
33632
|
}
|
|
32748
33633
|
};
|
|
32749
33634
|
}
|
|
@@ -32773,7 +33658,7 @@ var KNOWN_CODES = /* @__PURE__ */ new Set([
|
|
|
32773
33658
|
"server_not_configured",
|
|
32774
33659
|
"content_too_large"
|
|
32775
33660
|
]);
|
|
32776
|
-
function
|
|
33661
|
+
function isRecord2(value) {
|
|
32777
33662
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
32778
33663
|
}
|
|
32779
33664
|
function normalizeCode(value) {
|
|
@@ -32784,10 +33669,10 @@ function normalizeCode(value) {
|
|
|
32784
33669
|
return KNOWN_CODES.has(code) ? code : null;
|
|
32785
33670
|
}
|
|
32786
33671
|
function extractPSErrorBody(body) {
|
|
32787
|
-
if (!
|
|
33672
|
+
if (!isRecord2(body)) {
|
|
32788
33673
|
return null;
|
|
32789
33674
|
}
|
|
32790
|
-
const nested =
|
|
33675
|
+
const nested = isRecord2(body.error) ? body.error : null;
|
|
32791
33676
|
const code = normalizeCode(
|
|
32792
33677
|
nested?.errorCode ?? nested?.code ?? body.errorCode ?? body.code
|
|
32793
33678
|
);
|
|
@@ -32811,6 +33696,10 @@ async function parsePSError(response) {
|
|
|
32811
33696
|
return errorBody ? new PSError(errorBody.code, errorBody.message) : null;
|
|
32812
33697
|
}
|
|
32813
33698
|
export {
|
|
33699
|
+
ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT,
|
|
33700
|
+
ADD_DATA_TYPES,
|
|
33701
|
+
AccountPersonalServerLiteOwnerBindingError,
|
|
33702
|
+
AccountPersonalServerRegistrationError,
|
|
32814
33703
|
BUILDER_REGISTRATION_TYPES,
|
|
32815
33704
|
BlockchainError,
|
|
32816
33705
|
BrowserPlatformAdapter,
|
|
@@ -32821,8 +33710,11 @@ export {
|
|
|
32821
33710
|
DataFileEnvelopeSchema,
|
|
32822
33711
|
DropboxStorage,
|
|
32823
33712
|
ECIESError,
|
|
33713
|
+
ESCROW_DEPOSIT_ABI,
|
|
32824
33714
|
ExpiredTokenError,
|
|
33715
|
+
FEE_REGISTRY_ABI,
|
|
32825
33716
|
FILE_REGISTRATION_TYPES,
|
|
33717
|
+
GENERIC_PAYMENT_TYPES,
|
|
32826
33718
|
GRANT_REGISTRATION_TYPES,
|
|
32827
33719
|
GRANT_REVOCATION_TYPES,
|
|
32828
33720
|
GoogleDriveStorage,
|
|
@@ -32833,10 +33725,17 @@ export {
|
|
|
32833
33725
|
IpfsStorage,
|
|
32834
33726
|
MASTER_KEY_MESSAGE,
|
|
32835
33727
|
MissingAuthError,
|
|
33728
|
+
NATIVE_VANA_ASSET,
|
|
32836
33729
|
NetworkError,
|
|
32837
33730
|
NodeECIESUint8Provider as NodeECIESProvider,
|
|
32838
33731
|
NodePlatformAdapter,
|
|
32839
33732
|
NonceError,
|
|
33733
|
+
OAuthClient,
|
|
33734
|
+
PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX,
|
|
33735
|
+
PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE,
|
|
33736
|
+
PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION,
|
|
33737
|
+
PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID,
|
|
33738
|
+
PERSONAL_SERVER_REGISTRATION_DEFAULT_VERIFYING_CONTRACT,
|
|
32840
33739
|
PKCE_CHALLENGE_PATTERN,
|
|
32841
33740
|
PKCE_VERIFIER_PATTERN,
|
|
32842
33741
|
PSError,
|
|
@@ -32844,6 +33743,7 @@ export {
|
|
|
32844
33743
|
PersonalServerError,
|
|
32845
33744
|
PinataStorage,
|
|
32846
33745
|
R2Storage,
|
|
33746
|
+
RECORD_DATA_ACCESS_TYPES,
|
|
32847
33747
|
ReadOnlyError,
|
|
32848
33748
|
RelayerError,
|
|
32849
33749
|
SERVER_REGISTRATION_TYPES,
|
|
@@ -32858,6 +33758,12 @@ export {
|
|
|
32858
33758
|
VanaError,
|
|
32859
33759
|
VanaStorage,
|
|
32860
33760
|
assertValidPkceVerifier,
|
|
33761
|
+
buildDepositNativeRequest,
|
|
33762
|
+
buildDepositTokenRequest,
|
|
33763
|
+
buildPersonalServerLiteOwnerBindingMessage,
|
|
33764
|
+
buildPersonalServerLiteOwnerBindingSignature,
|
|
33765
|
+
buildPersonalServerRegistrationSignature,
|
|
33766
|
+
buildPersonalServerRegistrationTypedData,
|
|
32861
33767
|
buildWeb3SignedHeader,
|
|
32862
33768
|
builderRegistrationDomain,
|
|
32863
33769
|
chains,
|
|
@@ -32873,12 +33779,19 @@ export {
|
|
|
32873
33779
|
createPlatformAdapterFor,
|
|
32874
33780
|
createPlatformAdapterSafe,
|
|
32875
33781
|
createVanaStorageProvider,
|
|
33782
|
+
createViemPersonalServerLiteOwnerBindingSigner,
|
|
33783
|
+
createViemPersonalServerRegistrationSigner,
|
|
33784
|
+
dataRegistryDomain,
|
|
32876
33785
|
decryptWithPassword,
|
|
32877
33786
|
deriveMasterKey,
|
|
32878
33787
|
deriveScopeKey,
|
|
32879
33788
|
deserializeECIES,
|
|
32880
33789
|
detectPlatform,
|
|
33790
|
+
encodeDepositNativeData,
|
|
33791
|
+
encodeDepositTokenData,
|
|
32881
33792
|
encryptWithPassword,
|
|
33793
|
+
escrowContractAddress,
|
|
33794
|
+
escrowPaymentDomain,
|
|
32882
33795
|
fileRegistrationDomain,
|
|
32883
33796
|
generatePkceVerifier,
|
|
32884
33797
|
getAbi,
|
|
@@ -32887,6 +33800,8 @@ export {
|
|
|
32887
33800
|
getContractAddress,
|
|
32888
33801
|
getContractController,
|
|
32889
33802
|
getContractInfo,
|
|
33803
|
+
getFee,
|
|
33804
|
+
getOpFee,
|
|
32890
33805
|
getPlatformCapabilities,
|
|
32891
33806
|
getServiceEndpoints,
|
|
32892
33807
|
grantRegistrationDomain,
|
|
@@ -32898,16 +33813,20 @@ export {
|
|
|
32898
33813
|
moksha,
|
|
32899
33814
|
mokshaServices,
|
|
32900
33815
|
mokshaTestnet2 as mokshaTestnet,
|
|
32901
|
-
parseGrantRegistrationPayload,
|
|
32902
33816
|
parsePSError,
|
|
32903
33817
|
parseScope,
|
|
32904
33818
|
parseWeb3SignedHeader,
|
|
33819
|
+
personalServerRegistrationDomain,
|
|
32905
33820
|
recoverServerOwner,
|
|
33821
|
+
registerPersonalServerSignature,
|
|
32906
33822
|
scopeCoveredByGrant,
|
|
32907
33823
|
scopeMatchesPattern,
|
|
32908
33824
|
scopeToPathSegments,
|
|
32909
33825
|
serializeECIES,
|
|
32910
33826
|
serverRegistrationDomain,
|
|
33827
|
+
signPersonalServerLiteOwnerBinding,
|
|
33828
|
+
signPersonalServerLiteOwnerBindingWithAccountClient,
|
|
33829
|
+
signPersonalServerRegistrationWithAccount,
|
|
32911
33830
|
vanaMainnet2 as vanaMainnet,
|
|
32912
33831
|
verifyGrantRegistration,
|
|
32913
33832
|
verifyPkceChallenge,
|