@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.browser.js
CHANGED
|
@@ -29006,7 +29006,7 @@ async function buildWeb3SignedHeader(params) {
|
|
|
29006
29006
|
}
|
|
29007
29007
|
|
|
29008
29008
|
// src/storage/providers/vana-storage.ts
|
|
29009
|
-
var DEFAULT_ENDPOINT = "https://storage.vana.
|
|
29009
|
+
var DEFAULT_ENDPOINT = "https://storage.vana.org";
|
|
29010
29010
|
var BLOB_PATH_PREFIX = "/v1/blobs";
|
|
29011
29011
|
var DEFAULT_TOKEN_TTL_SECONDS = 300;
|
|
29012
29012
|
var VanaStorage = class {
|
|
@@ -31432,6 +31432,228 @@ var InMemoryTokenStore = class {
|
|
|
31432
31432
|
}
|
|
31433
31433
|
};
|
|
31434
31434
|
|
|
31435
|
+
// src/auth/oauth-client.ts
|
|
31436
|
+
var VERIFIER_TTL_SECONDS = 600;
|
|
31437
|
+
var RESERVED_AUTHORIZE_PARAMS = /* @__PURE__ */ new Set([
|
|
31438
|
+
"response_type",
|
|
31439
|
+
"client_id",
|
|
31440
|
+
"redirect_uri",
|
|
31441
|
+
"scope",
|
|
31442
|
+
"state",
|
|
31443
|
+
"code_challenge",
|
|
31444
|
+
"code_challenge_method"
|
|
31445
|
+
]);
|
|
31446
|
+
var OAuthClient = class {
|
|
31447
|
+
#config;
|
|
31448
|
+
constructor(config) {
|
|
31449
|
+
const fetchImpl = config.fetchImpl ?? globalThis.fetch;
|
|
31450
|
+
if (typeof fetchImpl !== "function") {
|
|
31451
|
+
throw new TypeError(
|
|
31452
|
+
"OAuthClient requires a global `fetch` or an explicit `fetchImpl`"
|
|
31453
|
+
);
|
|
31454
|
+
}
|
|
31455
|
+
this.#config = {
|
|
31456
|
+
authorizationEndpoint: config.authorizationEndpoint,
|
|
31457
|
+
tokenEndpoint: config.tokenEndpoint,
|
|
31458
|
+
clientId: config.clientId,
|
|
31459
|
+
redirectUri: config.redirectUri,
|
|
31460
|
+
scope: config.scope,
|
|
31461
|
+
tokenStore: config.tokenStore ?? new InMemoryTokenStore(),
|
|
31462
|
+
fetchImpl,
|
|
31463
|
+
generateState: config.generateState ?? defaultGenerateState
|
|
31464
|
+
};
|
|
31465
|
+
}
|
|
31466
|
+
/** Build the authorize URL and persist the PKCE verifier keyed by `state`. */
|
|
31467
|
+
async buildAuthorizationUrl(opts = {}) {
|
|
31468
|
+
const state = opts.state ?? this.#config.generateState();
|
|
31469
|
+
const scope = opts.scope ?? this.#config.scope;
|
|
31470
|
+
const verifier = generatePkceVerifier();
|
|
31471
|
+
const challenge = await computePkceChallenge(verifier);
|
|
31472
|
+
await this.#config.tokenStore.set(this.#verifierKey(state), {
|
|
31473
|
+
token: verifier,
|
|
31474
|
+
expiresAt: Math.floor(Date.now() / 1e3) + VERIFIER_TTL_SECONDS
|
|
31475
|
+
});
|
|
31476
|
+
const params = new URLSearchParams();
|
|
31477
|
+
params.set("response_type", "code");
|
|
31478
|
+
params.set("client_id", this.#config.clientId);
|
|
31479
|
+
params.set("redirect_uri", this.#config.redirectUri);
|
|
31480
|
+
if (scope !== void 0 && scope.length > 0) {
|
|
31481
|
+
params.set("scope", scope);
|
|
31482
|
+
}
|
|
31483
|
+
params.set("state", state);
|
|
31484
|
+
params.set("code_challenge", challenge);
|
|
31485
|
+
params.set("code_challenge_method", "S256");
|
|
31486
|
+
if (opts.extraParams !== void 0) {
|
|
31487
|
+
for (const k of Object.keys(opts.extraParams)) {
|
|
31488
|
+
if (RESERVED_AUTHORIZE_PARAMS.has(k)) {
|
|
31489
|
+
throw new Error(
|
|
31490
|
+
`extraParams may not override the reserved OAuth/PKCE parameter "${k}"`
|
|
31491
|
+
);
|
|
31492
|
+
}
|
|
31493
|
+
}
|
|
31494
|
+
for (const [k, v] of Object.entries(opts.extraParams)) {
|
|
31495
|
+
params.set(k, v);
|
|
31496
|
+
}
|
|
31497
|
+
}
|
|
31498
|
+
const sep = this.#config.authorizationEndpoint.includes("?") ? "&" : "?";
|
|
31499
|
+
const url = `${this.#config.authorizationEndpoint}${sep}${params.toString()}`;
|
|
31500
|
+
return { url, state };
|
|
31501
|
+
}
|
|
31502
|
+
/**
|
|
31503
|
+
* Handle the redirect-callback URL. Validates `state`, retrieves the saved
|
|
31504
|
+
* verifier, exchanges the authorization code + verifier for tokens, and
|
|
31505
|
+
* persists them. Returns the access {@link TokenRecord}.
|
|
31506
|
+
*/
|
|
31507
|
+
async handleCallback(callbackUrl) {
|
|
31508
|
+
const parsed = new URL(callbackUrl);
|
|
31509
|
+
const params = parsed.searchParams;
|
|
31510
|
+
const errorCode = params.get("error");
|
|
31511
|
+
if (errorCode !== null) {
|
|
31512
|
+
throw new Error(
|
|
31513
|
+
formatOAuthError({
|
|
31514
|
+
error: errorCode,
|
|
31515
|
+
error_description: params.get("error_description") ?? void 0
|
|
31516
|
+
})
|
|
31517
|
+
);
|
|
31518
|
+
}
|
|
31519
|
+
const code = params.get("code");
|
|
31520
|
+
const state = params.get("state");
|
|
31521
|
+
if (code === null || state === null) {
|
|
31522
|
+
throw new Error("OAuth callback is missing `code` or `state`");
|
|
31523
|
+
}
|
|
31524
|
+
const verifierRecord = await this.#config.tokenStore.get(
|
|
31525
|
+
this.#verifierKey(state)
|
|
31526
|
+
);
|
|
31527
|
+
if (verifierRecord === null) {
|
|
31528
|
+
throw new Error(
|
|
31529
|
+
"OAuth callback state does not match any in-flight verifier (possible CSRF or expired flow)"
|
|
31530
|
+
);
|
|
31531
|
+
}
|
|
31532
|
+
const body = new URLSearchParams();
|
|
31533
|
+
body.set("grant_type", "authorization_code");
|
|
31534
|
+
body.set("code", code);
|
|
31535
|
+
body.set("redirect_uri", this.#config.redirectUri);
|
|
31536
|
+
body.set("client_id", this.#config.clientId);
|
|
31537
|
+
body.set("code_verifier", verifierRecord.token);
|
|
31538
|
+
let tokens;
|
|
31539
|
+
try {
|
|
31540
|
+
tokens = await this.#tokenRequest(body);
|
|
31541
|
+
} finally {
|
|
31542
|
+
await this.#config.tokenStore.delete(this.#verifierKey(state));
|
|
31543
|
+
}
|
|
31544
|
+
return this.#persistTokens(tokens);
|
|
31545
|
+
}
|
|
31546
|
+
/**
|
|
31547
|
+
* Exchange a stored refresh token for a fresh access token. Throws if no
|
|
31548
|
+
* refresh token is available.
|
|
31549
|
+
*/
|
|
31550
|
+
async refresh() {
|
|
31551
|
+
const refreshRecord = await this.#config.tokenStore.get(this.#refreshKey());
|
|
31552
|
+
if (refreshRecord === null) {
|
|
31553
|
+
throw new Error("OAuth refresh failed: no refresh token stored");
|
|
31554
|
+
}
|
|
31555
|
+
const body = new URLSearchParams();
|
|
31556
|
+
body.set("grant_type", "refresh_token");
|
|
31557
|
+
body.set("refresh_token", refreshRecord.token);
|
|
31558
|
+
body.set("client_id", this.#config.clientId);
|
|
31559
|
+
const tokens = await this.#tokenRequest(body);
|
|
31560
|
+
return this.#persistTokens(tokens, refreshRecord.token);
|
|
31561
|
+
}
|
|
31562
|
+
/**
|
|
31563
|
+
* Get the current access token if valid (refreshing first if expired and a
|
|
31564
|
+
* refresh token is available). Returns `null` when no usable token exists.
|
|
31565
|
+
*/
|
|
31566
|
+
async getAccessToken() {
|
|
31567
|
+
const stored = await this.#config.tokenStore.get(this.#accessKey());
|
|
31568
|
+
if (stored !== null) return stored.token;
|
|
31569
|
+
const refresh = await this.#config.tokenStore.get(this.#refreshKey());
|
|
31570
|
+
if (refresh === null) return null;
|
|
31571
|
+
try {
|
|
31572
|
+
const refreshed = await this.refresh();
|
|
31573
|
+
return refreshed.token;
|
|
31574
|
+
} catch {
|
|
31575
|
+
return null;
|
|
31576
|
+
}
|
|
31577
|
+
}
|
|
31578
|
+
/** Forget tokens (logout). Does NOT call any remote revocation endpoint. */
|
|
31579
|
+
async signOut() {
|
|
31580
|
+
await this.#config.tokenStore.delete(this.#accessKey());
|
|
31581
|
+
await this.#config.tokenStore.delete(this.#refreshKey());
|
|
31582
|
+
}
|
|
31583
|
+
#accessKey() {
|
|
31584
|
+
return `oauth:tokens:${this.#config.clientId}`;
|
|
31585
|
+
}
|
|
31586
|
+
#refreshKey() {
|
|
31587
|
+
return `oauth:refresh:${this.#config.clientId}`;
|
|
31588
|
+
}
|
|
31589
|
+
#verifierKey(state) {
|
|
31590
|
+
return `oauth:verifier:${state}`;
|
|
31591
|
+
}
|
|
31592
|
+
async #tokenRequest(body) {
|
|
31593
|
+
const response = await this.#config.fetchImpl(this.#config.tokenEndpoint, {
|
|
31594
|
+
method: "POST",
|
|
31595
|
+
headers: {
|
|
31596
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
31597
|
+
Accept: "application/json"
|
|
31598
|
+
},
|
|
31599
|
+
body: body.toString()
|
|
31600
|
+
});
|
|
31601
|
+
const text = await response.text();
|
|
31602
|
+
const parsed = parseJsonBody(text);
|
|
31603
|
+
if (!response.ok) {
|
|
31604
|
+
throw new Error(formatOAuthError(parsed ?? {}, response.status));
|
|
31605
|
+
}
|
|
31606
|
+
if (parsed === null || typeof parsed !== "object" || typeof parsed.access_token !== "string") {
|
|
31607
|
+
throw new Error(
|
|
31608
|
+
"OAuth token endpoint returned a response without an `access_token` string"
|
|
31609
|
+
);
|
|
31610
|
+
}
|
|
31611
|
+
return parsed;
|
|
31612
|
+
}
|
|
31613
|
+
async #persistTokens(tokens, previousRefreshToken) {
|
|
31614
|
+
const record = { token: tokens.access_token };
|
|
31615
|
+
if (typeof tokens.expires_in === "number" && tokens.expires_in > 0) {
|
|
31616
|
+
record.expiresAt = Math.floor(Date.now() / 1e3) + tokens.expires_in;
|
|
31617
|
+
}
|
|
31618
|
+
await this.#config.tokenStore.set(this.#accessKey(), record);
|
|
31619
|
+
const newRefresh = tokens.refresh_token ?? previousRefreshToken;
|
|
31620
|
+
if (newRefresh !== void 0) {
|
|
31621
|
+
await this.#config.tokenStore.set(this.#refreshKey(), {
|
|
31622
|
+
token: newRefresh
|
|
31623
|
+
});
|
|
31624
|
+
}
|
|
31625
|
+
return record;
|
|
31626
|
+
}
|
|
31627
|
+
};
|
|
31628
|
+
function defaultGenerateState() {
|
|
31629
|
+
const bytes = new Uint8Array(24);
|
|
31630
|
+
crypto.getRandomValues(bytes);
|
|
31631
|
+
let binary = "";
|
|
31632
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
31633
|
+
binary += String.fromCharCode(bytes[i]);
|
|
31634
|
+
}
|
|
31635
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
31636
|
+
}
|
|
31637
|
+
function parseJsonBody(text) {
|
|
31638
|
+
if (text.length === 0) return null;
|
|
31639
|
+
try {
|
|
31640
|
+
return JSON.parse(text);
|
|
31641
|
+
} catch {
|
|
31642
|
+
return null;
|
|
31643
|
+
}
|
|
31644
|
+
}
|
|
31645
|
+
function formatOAuthError(body, status) {
|
|
31646
|
+
const parts = ["OAuth token request failed"];
|
|
31647
|
+
if (status !== void 0) parts.push(`(HTTP ${String(status)})`);
|
|
31648
|
+
if (body.error !== void 0 && body.error.length > 0) {
|
|
31649
|
+
parts.push(`: ${body.error}`);
|
|
31650
|
+
if (body.error_description !== void 0 && body.error_description.length > 0) {
|
|
31651
|
+
parts.push(`- ${body.error_description}`);
|
|
31652
|
+
}
|
|
31653
|
+
}
|
|
31654
|
+
return parts.join(" ").replace(" : ", ": ").replace(" - ", " - ");
|
|
31655
|
+
}
|
|
31656
|
+
|
|
31435
31657
|
// src/platform/utils.ts
|
|
31436
31658
|
function detectPlatform() {
|
|
31437
31659
|
if (typeof process !== "undefined" && process.versions && process.versions.node) {
|
|
@@ -31660,6 +31882,7 @@ async function verifyWeb3Signed(params) {
|
|
|
31660
31882
|
// src/protocol/eip712.ts
|
|
31661
31883
|
var DOMAIN_NAME = "Vana Data Portability";
|
|
31662
31884
|
var DOMAIN_VERSION = "1";
|
|
31885
|
+
var NATIVE_VANA_ASSET = "0x0000000000000000000000000000000000000000";
|
|
31663
31886
|
function buildDomain(chainId, verifyingContract) {
|
|
31664
31887
|
return {
|
|
31665
31888
|
name: DOMAIN_NAME,
|
|
@@ -31674,6 +31897,12 @@ function fileRegistrationDomain(config) {
|
|
|
31674
31897
|
config.contracts.dataRegistry
|
|
31675
31898
|
);
|
|
31676
31899
|
}
|
|
31900
|
+
function dataRegistryDomain(config) {
|
|
31901
|
+
return buildDomain(
|
|
31902
|
+
config.chainId,
|
|
31903
|
+
config.contracts.dataRegistry
|
|
31904
|
+
);
|
|
31905
|
+
}
|
|
31677
31906
|
function grantRegistrationDomain(config) {
|
|
31678
31907
|
return buildDomain(
|
|
31679
31908
|
config.chainId,
|
|
@@ -31698,6 +31927,12 @@ function builderRegistrationDomain(config) {
|
|
|
31698
31927
|
config.contracts.dataPortabilityGrantees
|
|
31699
31928
|
);
|
|
31700
31929
|
}
|
|
31930
|
+
function escrowPaymentDomain(config) {
|
|
31931
|
+
return buildDomain(
|
|
31932
|
+
config.chainId,
|
|
31933
|
+
config.contracts.dataPortabilityEscrow
|
|
31934
|
+
);
|
|
31935
|
+
}
|
|
31701
31936
|
var FILE_REGISTRATION_TYPES = {
|
|
31702
31937
|
FileRegistration: [
|
|
31703
31938
|
{ name: "ownerAddress", type: "address" },
|
|
@@ -31709,14 +31944,16 @@ var GRANT_REGISTRATION_TYPES = {
|
|
|
31709
31944
|
GrantRegistration: [
|
|
31710
31945
|
{ name: "grantorAddress", type: "address" },
|
|
31711
31946
|
{ name: "granteeId", type: "bytes32" },
|
|
31712
|
-
{ name: "
|
|
31713
|
-
{ name: "
|
|
31947
|
+
{ name: "scopes", type: "string[]" },
|
|
31948
|
+
{ name: "grantVersion", type: "uint256" },
|
|
31949
|
+
{ name: "expiresAt", type: "uint256" }
|
|
31714
31950
|
]
|
|
31715
31951
|
};
|
|
31716
31952
|
var GRANT_REVOCATION_TYPES = {
|
|
31717
31953
|
GrantRevocation: [
|
|
31718
31954
|
{ name: "grantorAddress", type: "address" },
|
|
31719
|
-
{ name: "grantId", type: "bytes32" }
|
|
31955
|
+
{ name: "grantId", type: "bytes32" },
|
|
31956
|
+
{ name: "grantVersion", type: "uint256" }
|
|
31720
31957
|
]
|
|
31721
31958
|
};
|
|
31722
31959
|
var SERVER_REGISTRATION_TYPES = {
|
|
@@ -31735,83 +31972,500 @@ var BUILDER_REGISTRATION_TYPES = {
|
|
|
31735
31972
|
{ name: "appUrl", type: "string" }
|
|
31736
31973
|
]
|
|
31737
31974
|
};
|
|
31975
|
+
var GENERIC_PAYMENT_TYPES = {
|
|
31976
|
+
GenericPayment: [
|
|
31977
|
+
{ name: "payerAddress", type: "address" },
|
|
31978
|
+
{ name: "opType", type: "string" },
|
|
31979
|
+
{ name: "opId", type: "bytes32" },
|
|
31980
|
+
{ name: "asset", type: "address" },
|
|
31981
|
+
{ name: "amount", type: "uint256" },
|
|
31982
|
+
{ name: "paymentNonce", type: "uint256" }
|
|
31983
|
+
]
|
|
31984
|
+
};
|
|
31985
|
+
var ADD_DATA_TYPES = {
|
|
31986
|
+
AddData: [
|
|
31987
|
+
{ name: "ownerAddress", type: "address" },
|
|
31988
|
+
{ name: "scope", type: "string" },
|
|
31989
|
+
{ name: "dataHash", type: "bytes32" },
|
|
31990
|
+
{ name: "metadataHash", type: "bytes32" },
|
|
31991
|
+
{ name: "expectedVersion", type: "uint256" }
|
|
31992
|
+
]
|
|
31993
|
+
};
|
|
31994
|
+
var RECORD_DATA_ACCESS_TYPES = {
|
|
31995
|
+
RecordDataAccess: [
|
|
31996
|
+
{ name: "ownerAddress", type: "address" },
|
|
31997
|
+
{ name: "scope", type: "string" },
|
|
31998
|
+
{ name: "version", type: "uint256" },
|
|
31999
|
+
{ name: "accessor", type: "address" },
|
|
32000
|
+
{ name: "recordId", type: "bytes32" }
|
|
32001
|
+
]
|
|
32002
|
+
};
|
|
31738
32003
|
|
|
31739
|
-
// src/protocol/
|
|
31740
|
-
import {
|
|
31741
|
-
|
|
31742
|
-
|
|
32004
|
+
// src/protocol/personal-server-registration.ts
|
|
32005
|
+
import {
|
|
32006
|
+
isAddress
|
|
32007
|
+
} from "viem";
|
|
32008
|
+
var PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID = 1480;
|
|
32009
|
+
var PERSONAL_SERVER_REGISTRATION_DEFAULT_VERIFYING_CONTRACT = "0x1483B1F634DBA75AeaE60da7f01A679aabd5ee2c";
|
|
32010
|
+
function assertAddress(value, name) {
|
|
32011
|
+
if (!isAddress(value)) {
|
|
32012
|
+
throw new Error(`${name} must be a valid EVM address`);
|
|
32013
|
+
}
|
|
31743
32014
|
}
|
|
31744
|
-
function
|
|
31745
|
-
if (
|
|
31746
|
-
return
|
|
32015
|
+
function getAccountAddress(account) {
|
|
32016
|
+
if (!account) {
|
|
32017
|
+
return void 0;
|
|
31747
32018
|
}
|
|
31748
|
-
|
|
31749
|
-
|
|
31750
|
-
|
|
31751
|
-
|
|
32019
|
+
return typeof account === "string" ? account : account.address;
|
|
32020
|
+
}
|
|
32021
|
+
function isPersonalServerRegistrationSigner(source) {
|
|
32022
|
+
return "address" in source && typeof source.signTypedData === "function";
|
|
32023
|
+
}
|
|
32024
|
+
function createViemPersonalServerRegistrationSigner(source, options = {}) {
|
|
32025
|
+
if (isPersonalServerRegistrationSigner(source)) {
|
|
32026
|
+
return source;
|
|
31752
32027
|
}
|
|
31753
|
-
const
|
|
31754
|
-
|
|
32028
|
+
const accountAddress = getAccountAddress(options.account) ?? getAccountAddress(source.account);
|
|
32029
|
+
if (accountAddress) {
|
|
32030
|
+
return {
|
|
32031
|
+
address: accountAddress,
|
|
32032
|
+
signTypedData: (typedData) => source.signTypedData({
|
|
32033
|
+
...typedData,
|
|
32034
|
+
account: options.account ?? source.account ?? accountAddress
|
|
32035
|
+
})
|
|
32036
|
+
};
|
|
32037
|
+
}
|
|
32038
|
+
throw new Error(
|
|
32039
|
+
"Viem wallet client requires an account option or account property"
|
|
32040
|
+
);
|
|
31755
32041
|
}
|
|
31756
|
-
function
|
|
31757
|
-
|
|
31758
|
-
|
|
31759
|
-
parsed = JSON.parse(grant);
|
|
31760
|
-
} catch {
|
|
31761
|
-
return null;
|
|
32042
|
+
function personalServerRegistrationDomain(input = {}) {
|
|
32043
|
+
if (input.config) {
|
|
32044
|
+
return serverRegistrationDomain(input.config);
|
|
31762
32045
|
}
|
|
31763
|
-
|
|
31764
|
-
|
|
32046
|
+
const verifyingContract = input.verifyingContract ?? PERSONAL_SERVER_REGISTRATION_DEFAULT_VERIFYING_CONTRACT;
|
|
32047
|
+
assertAddress(verifyingContract, "verifyingContract");
|
|
32048
|
+
return {
|
|
32049
|
+
name: "Vana Data Portability",
|
|
32050
|
+
version: "1",
|
|
32051
|
+
chainId: input.chainId ?? PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID,
|
|
32052
|
+
verifyingContract
|
|
32053
|
+
};
|
|
32054
|
+
}
|
|
32055
|
+
function buildPersonalServerRegistrationTypedData(input) {
|
|
32056
|
+
assertAddress(input.ownerAddress, "ownerAddress");
|
|
32057
|
+
assertAddress(input.serverAddress, "serverAddress");
|
|
32058
|
+
return {
|
|
32059
|
+
domain: personalServerRegistrationDomain(input),
|
|
32060
|
+
types: SERVER_REGISTRATION_TYPES,
|
|
32061
|
+
primaryType: "ServerRegistration",
|
|
32062
|
+
message: {
|
|
32063
|
+
ownerAddress: input.ownerAddress,
|
|
32064
|
+
serverAddress: input.serverAddress,
|
|
32065
|
+
publicKey: input.serverPublicKey,
|
|
32066
|
+
serverUrl: input.serverUrl
|
|
32067
|
+
}
|
|
32068
|
+
};
|
|
32069
|
+
}
|
|
32070
|
+
async function buildPersonalServerRegistrationSignature(input) {
|
|
32071
|
+
const typedData = buildPersonalServerRegistrationTypedData({
|
|
32072
|
+
ownerAddress: input.signer.address,
|
|
32073
|
+
serverAddress: input.serverAddress,
|
|
32074
|
+
serverPublicKey: input.serverPublicKey,
|
|
32075
|
+
serverUrl: input.serverUrl,
|
|
32076
|
+
config: input.config,
|
|
32077
|
+
chainId: input.chainId,
|
|
32078
|
+
verifyingContract: input.verifyingContract
|
|
32079
|
+
});
|
|
32080
|
+
const signature = await input.signer.signTypedData(typedData);
|
|
32081
|
+
return {
|
|
32082
|
+
signature,
|
|
32083
|
+
signerAddress: input.signer.address,
|
|
32084
|
+
typedData
|
|
32085
|
+
};
|
|
32086
|
+
}
|
|
32087
|
+
var registerPersonalServerSignature = buildPersonalServerRegistrationSignature;
|
|
32088
|
+
|
|
32089
|
+
// src/protocol/personal-server-lite-owner-binding.ts
|
|
32090
|
+
import {
|
|
32091
|
+
isAddress as isAddress2
|
|
32092
|
+
} from "viem";
|
|
32093
|
+
var PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION = "vana.account.v1";
|
|
32094
|
+
var PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE = "ps-lite-owner";
|
|
32095
|
+
var PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX = `${PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION}:${PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE}:`;
|
|
32096
|
+
function assertAddress2(value, name) {
|
|
32097
|
+
if (!isAddress2(value)) {
|
|
32098
|
+
throw new Error(`${name} must be a valid EVM address`);
|
|
31765
32099
|
}
|
|
31766
|
-
|
|
31767
|
-
|
|
31768
|
-
|
|
32100
|
+
}
|
|
32101
|
+
function getAccountAddress2(account) {
|
|
32102
|
+
if (!account) {
|
|
32103
|
+
return void 0;
|
|
31769
32104
|
}
|
|
31770
|
-
|
|
31771
|
-
|
|
32105
|
+
return typeof account === "string" ? account : account.address;
|
|
32106
|
+
}
|
|
32107
|
+
function isPersonalServerLiteOwnerBindingSigner(source) {
|
|
32108
|
+
return "address" in source && typeof source.signMessage === "function";
|
|
32109
|
+
}
|
|
32110
|
+
function buildPersonalServerLiteOwnerBindingMessage(ownerAddress) {
|
|
32111
|
+
assertAddress2(ownerAddress, "ownerAddress");
|
|
32112
|
+
return `${PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX}${ownerAddress.toLowerCase()}`;
|
|
32113
|
+
}
|
|
32114
|
+
function createViemPersonalServerLiteOwnerBindingSigner(source, options = {}) {
|
|
32115
|
+
if (isPersonalServerLiteOwnerBindingSigner(source)) {
|
|
32116
|
+
return source;
|
|
31772
32117
|
}
|
|
31773
|
-
|
|
31774
|
-
|
|
32118
|
+
const accountAddress = getAccountAddress2(options.account) ?? getAccountAddress2(source.account);
|
|
32119
|
+
if (accountAddress) {
|
|
32120
|
+
return {
|
|
32121
|
+
address: accountAddress,
|
|
32122
|
+
signMessage: ({ message }) => source.signMessage({
|
|
32123
|
+
account: options.account ?? source.account ?? accountAddress,
|
|
32124
|
+
message
|
|
32125
|
+
})
|
|
32126
|
+
};
|
|
31775
32127
|
}
|
|
31776
|
-
|
|
31777
|
-
|
|
32128
|
+
throw new Error(
|
|
32129
|
+
"Viem wallet client requires an account option or account property"
|
|
32130
|
+
);
|
|
32131
|
+
}
|
|
32132
|
+
async function buildPersonalServerLiteOwnerBindingSignature(input) {
|
|
32133
|
+
const message = buildPersonalServerLiteOwnerBindingMessage(
|
|
32134
|
+
input.signer.address
|
|
32135
|
+
);
|
|
32136
|
+
const signature = await input.signer.signMessage({ message });
|
|
32137
|
+
return {
|
|
32138
|
+
signature,
|
|
32139
|
+
signerAddress: input.signer.address,
|
|
32140
|
+
message,
|
|
32141
|
+
purpose: PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE
|
|
32142
|
+
};
|
|
32143
|
+
}
|
|
32144
|
+
var signPersonalServerLiteOwnerBinding = buildPersonalServerLiteOwnerBindingSignature;
|
|
32145
|
+
|
|
32146
|
+
// src/account/personal-server-registration.ts
|
|
32147
|
+
import { isAddress as isAddress3 } from "viem";
|
|
32148
|
+
var ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT = "personal_server.server_registration.v1";
|
|
32149
|
+
var AccountPersonalServerRegistrationError = class extends Error {
|
|
32150
|
+
status;
|
|
32151
|
+
code;
|
|
32152
|
+
details;
|
|
32153
|
+
constructor(input) {
|
|
32154
|
+
super(input.message);
|
|
32155
|
+
this.name = "AccountPersonalServerRegistrationError";
|
|
32156
|
+
this.status = input.status;
|
|
32157
|
+
this.code = input.code;
|
|
32158
|
+
this.details = input.details;
|
|
31778
32159
|
}
|
|
31779
|
-
|
|
31780
|
-
|
|
32160
|
+
};
|
|
32161
|
+
var DEFAULT_ACCOUNT_PS_REGISTRATION_PATH = "/api/v1/intents/personal-server-registration/sign";
|
|
32162
|
+
function trimTrailingSlash(value) {
|
|
32163
|
+
return value.replace(/\/+$/, "");
|
|
32164
|
+
}
|
|
32165
|
+
function assertAddress3(value, name) {
|
|
32166
|
+
if (!isAddress3(value)) {
|
|
32167
|
+
throw new Error(`${name} must be a valid EVM address`);
|
|
31781
32168
|
}
|
|
31782
|
-
|
|
31783
|
-
|
|
32169
|
+
}
|
|
32170
|
+
async function parseAccountResponse(response) {
|
|
32171
|
+
const body = await response.json().catch(() => void 0);
|
|
32172
|
+
if (!response.ok) {
|
|
32173
|
+
throw new AccountPersonalServerRegistrationError({
|
|
32174
|
+
status: response.status,
|
|
32175
|
+
code: accountErrorCode(body),
|
|
32176
|
+
message: accountErrorMessage(response.status, body),
|
|
32177
|
+
details: body
|
|
32178
|
+
});
|
|
32179
|
+
}
|
|
32180
|
+
return body;
|
|
32181
|
+
}
|
|
32182
|
+
function accountErrorMessage(status, body) {
|
|
32183
|
+
const nestedMessage = nestedAccountErrorField(body, "message");
|
|
32184
|
+
if (nestedMessage) {
|
|
32185
|
+
return nestedMessage;
|
|
32186
|
+
}
|
|
32187
|
+
if (isRecord(body) && typeof body.message === "string") {
|
|
32188
|
+
return body.message;
|
|
32189
|
+
}
|
|
32190
|
+
const code = accountErrorCode(body);
|
|
32191
|
+
if (code) {
|
|
32192
|
+
return `Account PS registration signing failed: ${code}`;
|
|
32193
|
+
}
|
|
32194
|
+
return `Account PS registration signing failed: ${status}`;
|
|
32195
|
+
}
|
|
32196
|
+
function accountErrorCode(body) {
|
|
32197
|
+
const nestedCode = nestedAccountErrorField(body, "code");
|
|
32198
|
+
if (nestedCode) {
|
|
32199
|
+
return nestedCode;
|
|
32200
|
+
}
|
|
32201
|
+
if (isRecord(body)) {
|
|
32202
|
+
if (typeof body.code === "string") {
|
|
32203
|
+
return body.code;
|
|
32204
|
+
}
|
|
32205
|
+
if (typeof body.error === "string") {
|
|
32206
|
+
return body.error;
|
|
32207
|
+
}
|
|
32208
|
+
}
|
|
32209
|
+
return void 0;
|
|
32210
|
+
}
|
|
32211
|
+
function nestedAccountErrorField(body, field) {
|
|
32212
|
+
if (!isRecord(body) || !isRecord(body.error)) {
|
|
32213
|
+
return void 0;
|
|
32214
|
+
}
|
|
32215
|
+
const value = body.error[field];
|
|
32216
|
+
return typeof value === "string" ? value : void 0;
|
|
32217
|
+
}
|
|
32218
|
+
function isRecord(value) {
|
|
32219
|
+
return typeof value === "object" && value !== null;
|
|
32220
|
+
}
|
|
32221
|
+
function normalizeAccountResponse(response) {
|
|
32222
|
+
return {
|
|
32223
|
+
...response,
|
|
32224
|
+
status: response.status === "fallback_required" ? "confirmation_required" : response.status,
|
|
32225
|
+
signerAddress: response.signerAddress ?? response.signer?.address,
|
|
32226
|
+
typedData: response.typedData ?? response.typed_data
|
|
32227
|
+
};
|
|
32228
|
+
}
|
|
32229
|
+
function buildSignedResult(response, request) {
|
|
32230
|
+
assertAddress3(response.signerAddress, "signerAddress");
|
|
32231
|
+
if (response.typedData) {
|
|
32232
|
+
assertTypedDataMatchesRequest(
|
|
32233
|
+
response.typedData,
|
|
32234
|
+
request,
|
|
32235
|
+
response.signerAddress
|
|
32236
|
+
);
|
|
31784
32237
|
}
|
|
31785
32238
|
return {
|
|
31786
|
-
|
|
31787
|
-
|
|
31788
|
-
|
|
31789
|
-
|
|
31790
|
-
|
|
32239
|
+
signature: response.signature,
|
|
32240
|
+
signerAddress: response.signerAddress,
|
|
32241
|
+
typedData: response.typedData ?? buildPersonalServerRegistrationTypedData({
|
|
32242
|
+
ownerAddress: response.signerAddress,
|
|
32243
|
+
...request
|
|
32244
|
+
}),
|
|
32245
|
+
intent: ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT
|
|
31791
32246
|
};
|
|
31792
32247
|
}
|
|
31793
|
-
function
|
|
31794
|
-
|
|
31795
|
-
|
|
32248
|
+
function assertTypedDataMatchesRequest(typedData, request, expectedSignerAddress) {
|
|
32249
|
+
assertAddress3(
|
|
32250
|
+
typedData.message.ownerAddress,
|
|
32251
|
+
"typedData.message.ownerAddress"
|
|
32252
|
+
);
|
|
32253
|
+
assertAddress3(
|
|
32254
|
+
typedData.message.serverAddress,
|
|
32255
|
+
"typedData.message.serverAddress"
|
|
32256
|
+
);
|
|
32257
|
+
if (expectedSignerAddress && !sameAddress(typedData.message.ownerAddress, expectedSignerAddress)) {
|
|
32258
|
+
throw new Error(
|
|
32259
|
+
"Account typedData ownerAddress must match the expected signer address"
|
|
32260
|
+
);
|
|
32261
|
+
}
|
|
32262
|
+
if (!sameAddress(typedData.message.serverAddress, request.serverAddress)) {
|
|
32263
|
+
throw new Error(
|
|
32264
|
+
"Account typedData serverAddress must match the requested serverAddress"
|
|
32265
|
+
);
|
|
32266
|
+
}
|
|
32267
|
+
if (typedData.message.publicKey !== request.serverPublicKey) {
|
|
32268
|
+
throw new Error(
|
|
32269
|
+
"Account typedData publicKey must match the requested serverPublicKey"
|
|
32270
|
+
);
|
|
32271
|
+
}
|
|
32272
|
+
if (typedData.message.serverUrl !== request.serverUrl) {
|
|
32273
|
+
throw new Error(
|
|
32274
|
+
"Account typedData serverUrl must match the requested serverUrl"
|
|
32275
|
+
);
|
|
32276
|
+
}
|
|
32277
|
+
if (typedData.primaryType !== "ServerRegistration") {
|
|
32278
|
+
throw new Error("Account typedData primaryType must be ServerRegistration");
|
|
32279
|
+
}
|
|
32280
|
+
if (JSON.stringify(typedData.types) !== JSON.stringify(SERVER_REGISTRATION_TYPES)) {
|
|
32281
|
+
throw new Error("Account typedData types must be ServerRegistration types");
|
|
32282
|
+
}
|
|
32283
|
+
const expectedDomain = personalServerRegistrationDomain({
|
|
32284
|
+
config: request.config,
|
|
32285
|
+
chainId: request.chainId,
|
|
32286
|
+
verifyingContract: request.verifyingContract
|
|
32287
|
+
});
|
|
32288
|
+
if (!domainsEqual(typedData.domain, expectedDomain)) {
|
|
32289
|
+
throw new Error("Account typedData domain must match the requested domain");
|
|
32290
|
+
}
|
|
32291
|
+
}
|
|
32292
|
+
function sameAddress(a, b) {
|
|
32293
|
+
return a.toLowerCase() === b.toLowerCase();
|
|
32294
|
+
}
|
|
32295
|
+
function domainsEqual(a, b) {
|
|
32296
|
+
if (!a || !b) {
|
|
32297
|
+
return false;
|
|
32298
|
+
}
|
|
32299
|
+
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;
|
|
32300
|
+
}
|
|
32301
|
+
async function signPersonalServerRegistrationWithAccount(config, request) {
|
|
32302
|
+
assertAddress3(request.serverAddress, "serverAddress");
|
|
32303
|
+
const fetchImpl = config.fetchImpl ?? globalThis.fetch.bind(globalThis);
|
|
32304
|
+
const endpoint = new URL(
|
|
32305
|
+
config.endpointPath ?? DEFAULT_ACCOUNT_PS_REGISTRATION_PATH,
|
|
32306
|
+
`${trimTrailingSlash(config.accountOrigin)}/`
|
|
32307
|
+
);
|
|
32308
|
+
const response = await fetchImpl(endpoint, {
|
|
32309
|
+
method: "POST",
|
|
32310
|
+
headers: { "content-type": "application/json" },
|
|
32311
|
+
credentials: "include",
|
|
32312
|
+
body: JSON.stringify({
|
|
32313
|
+
intent: ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT,
|
|
32314
|
+
serverAddress: request.serverAddress,
|
|
32315
|
+
serverPublicKey: request.serverPublicKey,
|
|
32316
|
+
serverUrl: request.serverUrl,
|
|
32317
|
+
config: request.config,
|
|
32318
|
+
chainId: request.chainId,
|
|
32319
|
+
verifyingContract: request.verifyingContract
|
|
32320
|
+
})
|
|
32321
|
+
});
|
|
32322
|
+
const body = normalizeAccountResponse(await parseAccountResponse(response));
|
|
32323
|
+
if (body.status === "signed") {
|
|
32324
|
+
if (!body.signature || !body.signerAddress) {
|
|
32325
|
+
throw new Error(
|
|
32326
|
+
"Account signed response must include signature and signerAddress"
|
|
32327
|
+
);
|
|
32328
|
+
}
|
|
31796
32329
|
return {
|
|
31797
|
-
|
|
31798
|
-
|
|
32330
|
+
status: "signed",
|
|
32331
|
+
result: buildSignedResult(
|
|
32332
|
+
{
|
|
32333
|
+
signature: body.signature,
|
|
32334
|
+
signerAddress: body.signerAddress,
|
|
32335
|
+
typedData: body.typedData
|
|
32336
|
+
},
|
|
32337
|
+
request
|
|
32338
|
+
)
|
|
31799
32339
|
};
|
|
32340
|
+
}
|
|
32341
|
+
if (body.status === "confirmation_required") {
|
|
32342
|
+
if (!body.typedData) {
|
|
32343
|
+
throw new Error(
|
|
32344
|
+
"Account confirmation_required response must include typedData"
|
|
32345
|
+
);
|
|
32346
|
+
}
|
|
32347
|
+
assertTypedDataMatchesRequest(body.typedData, request, body.signerAddress);
|
|
32348
|
+
if (!config.fallbackSigner) {
|
|
32349
|
+
return {
|
|
32350
|
+
status: "confirmation_required",
|
|
32351
|
+
typedData: body.typedData,
|
|
32352
|
+
signerAddress: body.signerAddress
|
|
32353
|
+
};
|
|
32354
|
+
}
|
|
32355
|
+
assertTypedDataMatchesRequest(
|
|
32356
|
+
body.typedData,
|
|
32357
|
+
request,
|
|
32358
|
+
config.fallbackSigner.address
|
|
32359
|
+
);
|
|
32360
|
+
const signature = await config.fallbackSigner.signTypedData(body.typedData);
|
|
32361
|
+
return {
|
|
32362
|
+
status: "fallback_signed",
|
|
32363
|
+
accountStatus: "confirmation_required",
|
|
32364
|
+
result: {
|
|
32365
|
+
signature,
|
|
32366
|
+
signerAddress: config.fallbackSigner.address,
|
|
32367
|
+
typedData: body.typedData,
|
|
32368
|
+
intent: ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT
|
|
32369
|
+
}
|
|
32370
|
+
};
|
|
32371
|
+
}
|
|
32372
|
+
throw new Error(
|
|
32373
|
+
`Unsupported Account PS registration signing status: ${String(body.status)}`
|
|
32374
|
+
);
|
|
32375
|
+
}
|
|
32376
|
+
|
|
32377
|
+
// src/account/personal-server-lite-owner-binding.ts
|
|
32378
|
+
var AccountPersonalServerLiteOwnerBindingError = class extends Error {
|
|
32379
|
+
code;
|
|
32380
|
+
details;
|
|
32381
|
+
constructor(input) {
|
|
32382
|
+
super(input.message);
|
|
32383
|
+
this.name = "AccountPersonalServerLiteOwnerBindingError";
|
|
32384
|
+
this.code = input.code;
|
|
32385
|
+
this.details = input.details;
|
|
32386
|
+
}
|
|
32387
|
+
};
|
|
32388
|
+
async function signPersonalServerLiteOwnerBindingWithAccountClient(config) {
|
|
32389
|
+
let address;
|
|
32390
|
+
try {
|
|
32391
|
+
address = await config.client.getAddress();
|
|
32392
|
+
} catch (error) {
|
|
32393
|
+
throw accountOwnerBindingError(error);
|
|
32394
|
+
}
|
|
32395
|
+
if (!address) {
|
|
32396
|
+
throw new AccountPersonalServerLiteOwnerBindingError({
|
|
32397
|
+
message: "Account did not return a wallet address",
|
|
32398
|
+
code: "account_address_required"
|
|
32399
|
+
});
|
|
32400
|
+
}
|
|
32401
|
+
const message = buildPersonalServerLiteOwnerBindingMessage(address);
|
|
32402
|
+
let signature;
|
|
32403
|
+
try {
|
|
32404
|
+
signature = await config.client.signMessage({ message });
|
|
32405
|
+
} catch (error) {
|
|
32406
|
+
throw accountOwnerBindingError(error);
|
|
32407
|
+
}
|
|
32408
|
+
return {
|
|
32409
|
+
signature,
|
|
32410
|
+
signerAddress: address,
|
|
32411
|
+
message,
|
|
32412
|
+
purpose: PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE
|
|
32413
|
+
};
|
|
32414
|
+
}
|
|
32415
|
+
function accountOwnerBindingError(error) {
|
|
32416
|
+
if (error instanceof AccountPersonalServerLiteOwnerBindingError) {
|
|
32417
|
+
return error;
|
|
32418
|
+
}
|
|
32419
|
+
const rpcError = error;
|
|
32420
|
+
const code = rpcError?.code;
|
|
32421
|
+
const message = typeof rpcError?.message === "string" && rpcError.message.length > 0 ? rpcError.message : "Account PS Lite owner-binding signature failed";
|
|
32422
|
+
return new AccountPersonalServerLiteOwnerBindingError({
|
|
32423
|
+
message,
|
|
32424
|
+
code,
|
|
32425
|
+
details: error
|
|
32426
|
+
});
|
|
32427
|
+
}
|
|
32428
|
+
|
|
32429
|
+
// src/protocol/grants.ts
|
|
32430
|
+
import { verifyTypedData } from "viem";
|
|
32431
|
+
function isHexString(value) {
|
|
32432
|
+
return typeof value === "string" && value.startsWith("0x");
|
|
32433
|
+
}
|
|
32434
|
+
function isDataPortabilityGatewayConfig(value) {
|
|
32435
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
32436
|
+
return false;
|
|
32437
|
+
}
|
|
32438
|
+
const config = value;
|
|
32439
|
+
const contracts = config["contracts"];
|
|
32440
|
+
if (typeof config["chainId"] !== "number" || !Number.isInteger(config["chainId"]) || config["chainId"] <= 0 || contracts === null || typeof contracts !== "object" || Array.isArray(contracts)) {
|
|
32441
|
+
return false;
|
|
32442
|
+
}
|
|
32443
|
+
const c = contracts;
|
|
32444
|
+
return isHexString(c["dataRegistry"]) && isHexString(c["dataPortabilityPermissions"]) && isHexString(c["dataPortabilityServer"]) && isHexString(c["dataPortabilityGrantees"]) && isHexString(c["dataPortabilityEscrow"]) && isHexString(c["feeRegistry"]);
|
|
32445
|
+
}
|
|
32446
|
+
function toUint256(value) {
|
|
32447
|
+
try {
|
|
32448
|
+
const big = typeof value === "bigint" ? value : BigInt(value);
|
|
32449
|
+
if (big < 0n) return null;
|
|
32450
|
+
return big;
|
|
31800
32451
|
} catch {
|
|
31801
32452
|
return null;
|
|
31802
32453
|
}
|
|
31803
32454
|
}
|
|
31804
32455
|
async function verifyGrantRegistration(input) {
|
|
31805
|
-
|
|
31806
|
-
|
|
31807
|
-
return {
|
|
31808
|
-
valid: false,
|
|
31809
|
-
error: "Grant must be JSON with scopes and expiresAt"
|
|
31810
|
-
};
|
|
32456
|
+
if (!Array.isArray(input.scopes) || input.scopes.length === 0) {
|
|
32457
|
+
return { valid: false, error: "scopes must be a non-empty array" };
|
|
31811
32458
|
}
|
|
31812
|
-
|
|
31813
|
-
|
|
31814
|
-
|
|
32459
|
+
if (!input.scopes.every((scope) => typeof scope === "string")) {
|
|
32460
|
+
return { valid: false, error: "scopes must contain only strings" };
|
|
32461
|
+
}
|
|
32462
|
+
const grantVersion = toUint256(input.grantVersion);
|
|
32463
|
+
if (grantVersion === null || grantVersion < 1n) {
|
|
32464
|
+
return { valid: false, error: "grantVersion must be a uint256 >= 1" };
|
|
32465
|
+
}
|
|
32466
|
+
const expiresAt = toUint256(input.expiresAt);
|
|
32467
|
+
if (expiresAt === null) {
|
|
32468
|
+
return { valid: false, error: "expiresAt must be a non-negative uint256" };
|
|
31815
32469
|
}
|
|
31816
32470
|
let valid;
|
|
31817
32471
|
try {
|
|
@@ -31823,8 +32477,9 @@ async function verifyGrantRegistration(input) {
|
|
|
31823
32477
|
message: {
|
|
31824
32478
|
grantorAddress: input.grantorAddress,
|
|
31825
32479
|
granteeId: input.granteeId,
|
|
31826
|
-
|
|
31827
|
-
|
|
32480
|
+
scopes: input.scopes,
|
|
32481
|
+
grantVersion,
|
|
32482
|
+
expiresAt
|
|
31828
32483
|
},
|
|
31829
32484
|
signature: input.signature
|
|
31830
32485
|
});
|
|
@@ -31835,19 +32490,128 @@ async function verifyGrantRegistration(input) {
|
|
|
31835
32490
|
return { valid: false, error: "Grant signature does not match grantor" };
|
|
31836
32491
|
}
|
|
31837
32492
|
const nowSeconds = input.nowSeconds ?? Math.floor(Date.now() / 1e3);
|
|
31838
|
-
if (
|
|
32493
|
+
if (expiresAt > 0n && expiresAt < BigInt(nowSeconds)) {
|
|
31839
32494
|
return { valid: false, error: "Grant has expired" };
|
|
31840
32495
|
}
|
|
31841
|
-
if (payload.user !== void 0 && payload.user.toLowerCase() !== input.grantorAddress.toLowerCase()) {
|
|
31842
|
-
return { valid: false, error: "Grant user does not match grantorAddress" };
|
|
31843
|
-
}
|
|
31844
32496
|
return {
|
|
31845
32497
|
valid: true,
|
|
31846
32498
|
grantorAddress: input.grantorAddress,
|
|
31847
32499
|
granteeId: input.granteeId,
|
|
31848
|
-
|
|
31849
|
-
|
|
31850
|
-
|
|
32500
|
+
scopes: input.scopes,
|
|
32501
|
+
grantVersion: grantVersion.toString(),
|
|
32502
|
+
expiresAt: expiresAt.toString()
|
|
32503
|
+
};
|
|
32504
|
+
}
|
|
32505
|
+
|
|
32506
|
+
// src/protocol/escrow-deposit.ts
|
|
32507
|
+
import { encodeFunctionData } from "viem";
|
|
32508
|
+
var ESCROW_DEPOSIT_ABI = [
|
|
32509
|
+
{
|
|
32510
|
+
type: "function",
|
|
32511
|
+
name: "depositNative",
|
|
32512
|
+
stateMutability: "payable",
|
|
32513
|
+
inputs: [{ name: "account", type: "address" }],
|
|
32514
|
+
outputs: []
|
|
32515
|
+
},
|
|
32516
|
+
{
|
|
32517
|
+
type: "function",
|
|
32518
|
+
name: "depositToken",
|
|
32519
|
+
stateMutability: "nonpayable",
|
|
32520
|
+
inputs: [
|
|
32521
|
+
{ name: "account", type: "address" },
|
|
32522
|
+
{ name: "token", type: "address" },
|
|
32523
|
+
{ name: "amount", type: "uint256" }
|
|
32524
|
+
],
|
|
32525
|
+
outputs: []
|
|
32526
|
+
}
|
|
32527
|
+
];
|
|
32528
|
+
function escrowContractAddress(config) {
|
|
32529
|
+
return config.contracts.dataPortabilityEscrow;
|
|
32530
|
+
}
|
|
32531
|
+
function encodeDepositNativeData(input) {
|
|
32532
|
+
return encodeFunctionData({
|
|
32533
|
+
abi: ESCROW_DEPOSIT_ABI,
|
|
32534
|
+
functionName: "depositNative",
|
|
32535
|
+
args: [input.account]
|
|
32536
|
+
});
|
|
32537
|
+
}
|
|
32538
|
+
function encodeDepositTokenData(input) {
|
|
32539
|
+
return encodeFunctionData({
|
|
32540
|
+
abi: ESCROW_DEPOSIT_ABI,
|
|
32541
|
+
functionName: "depositToken",
|
|
32542
|
+
args: [input.account, input.token, input.amount]
|
|
32543
|
+
});
|
|
32544
|
+
}
|
|
32545
|
+
function buildDepositNativeRequest(config, input) {
|
|
32546
|
+
return {
|
|
32547
|
+
to: escrowContractAddress(config),
|
|
32548
|
+
data: encodeDepositNativeData({ account: input.account }),
|
|
32549
|
+
value: input.amount
|
|
32550
|
+
};
|
|
32551
|
+
}
|
|
32552
|
+
function buildDepositTokenRequest(config, input) {
|
|
32553
|
+
return {
|
|
32554
|
+
to: escrowContractAddress(config),
|
|
32555
|
+
data: encodeDepositTokenData(input)
|
|
32556
|
+
};
|
|
32557
|
+
}
|
|
32558
|
+
|
|
32559
|
+
// src/protocol/fee-registry.ts
|
|
32560
|
+
import { parseAbi } from "viem";
|
|
32561
|
+
var FEE_REGISTRY_ABI = parseAbi([
|
|
32562
|
+
"struct Fee { uint256 amount; address asset; address payee; bool enabled; }",
|
|
32563
|
+
"function fees(bytes32 operation) view returns (Fee)",
|
|
32564
|
+
"function operationKey(string name) pure returns (bytes32)"
|
|
32565
|
+
]);
|
|
32566
|
+
function operationNameFor(kind, opts) {
|
|
32567
|
+
if (kind === "registration") {
|
|
32568
|
+
return opts?.registrationOpName ?? "registration";
|
|
32569
|
+
}
|
|
32570
|
+
return opts?.dataAccessOpName ?? "data_access";
|
|
32571
|
+
}
|
|
32572
|
+
async function getFee(client, config, kind, opts) {
|
|
32573
|
+
const address = config.contracts.feeRegistry;
|
|
32574
|
+
const opName = operationNameFor(kind, opts);
|
|
32575
|
+
const opKey = await client.readContract({
|
|
32576
|
+
address,
|
|
32577
|
+
abi: FEE_REGISTRY_ABI,
|
|
32578
|
+
functionName: "operationKey",
|
|
32579
|
+
args: [opName]
|
|
32580
|
+
});
|
|
32581
|
+
const fee = await client.readContract({
|
|
32582
|
+
address,
|
|
32583
|
+
abi: FEE_REGISTRY_ABI,
|
|
32584
|
+
functionName: "fees",
|
|
32585
|
+
args: [opKey]
|
|
32586
|
+
});
|
|
32587
|
+
if (!fee.enabled) {
|
|
32588
|
+
throw new Error(
|
|
32589
|
+
`FeeRegistry: operation "${opName}" (kind=${kind}) is not enabled \u2014 operator must call setFeeByName before payments will validate`
|
|
32590
|
+
);
|
|
32591
|
+
}
|
|
32592
|
+
if (fee.payee === "0x0000000000000000000000000000000000000000") {
|
|
32593
|
+
throw new Error(
|
|
32594
|
+
`FeeRegistry: operation "${opName}" has zero-address payee \u2014 contract pre-flight rejects payouts to 0x0`
|
|
32595
|
+
);
|
|
32596
|
+
}
|
|
32597
|
+
return fee;
|
|
32598
|
+
}
|
|
32599
|
+
async function getOpFee(client, config, opts) {
|
|
32600
|
+
const [registration, dataAccess] = await Promise.all([
|
|
32601
|
+
getFee(client, config, "registration", opts),
|
|
32602
|
+
getFee(client, config, "data_access", opts)
|
|
32603
|
+
]);
|
|
32604
|
+
if (registration.asset.toLowerCase() !== dataAccess.asset.toLowerCase()) {
|
|
32605
|
+
throw new Error(
|
|
32606
|
+
`FeeRegistry asset mismatch: registration=${registration.asset} vs data_access=${dataAccess.asset}. The gateway requires both fees to settle in the same asset.`
|
|
32607
|
+
);
|
|
32608
|
+
}
|
|
32609
|
+
return {
|
|
32610
|
+
asset: registration.asset,
|
|
32611
|
+
registrationFee: registration.amount,
|
|
32612
|
+
dataAccessFee: dataAccess.amount,
|
|
32613
|
+
registrationPayee: registration.payee,
|
|
32614
|
+
dataAccessPayee: dataAccess.payee
|
|
31851
32615
|
};
|
|
31852
32616
|
}
|
|
31853
32617
|
|
|
@@ -32047,6 +32811,68 @@ function createGatewayClient(baseUrl) {
|
|
|
32047
32811
|
alreadyRegistered: false
|
|
32048
32812
|
};
|
|
32049
32813
|
},
|
|
32814
|
+
async registerBuilder(params) {
|
|
32815
|
+
const res = await fetch(`${base}/v1/builders`, {
|
|
32816
|
+
method: "POST",
|
|
32817
|
+
headers: {
|
|
32818
|
+
"Content-Type": "application/json",
|
|
32819
|
+
Authorization: `Web3Signed ${params.signature}`
|
|
32820
|
+
},
|
|
32821
|
+
body: JSON.stringify({
|
|
32822
|
+
ownerAddress: params.ownerAddress,
|
|
32823
|
+
granteeAddress: params.granteeAddress,
|
|
32824
|
+
publicKey: params.publicKey,
|
|
32825
|
+
appUrl: params.appUrl
|
|
32826
|
+
})
|
|
32827
|
+
});
|
|
32828
|
+
if (res.status === 409) {
|
|
32829
|
+
const body2 = await res.json().catch(() => ({}));
|
|
32830
|
+
return {
|
|
32831
|
+
builderId: getMutationId(
|
|
32832
|
+
body2,
|
|
32833
|
+
"builderId"
|
|
32834
|
+
),
|
|
32835
|
+
alreadyRegistered: true
|
|
32836
|
+
};
|
|
32837
|
+
}
|
|
32838
|
+
if (!res.ok) {
|
|
32839
|
+
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
32840
|
+
}
|
|
32841
|
+
const body = await res.json().catch(() => ({}));
|
|
32842
|
+
return {
|
|
32843
|
+
builderId: getMutationId(body, "builderId"),
|
|
32844
|
+
alreadyRegistered: false
|
|
32845
|
+
};
|
|
32846
|
+
},
|
|
32847
|
+
async registerDataPoint(params) {
|
|
32848
|
+
const res = await fetch(`${base}/v1/data`, {
|
|
32849
|
+
method: "POST",
|
|
32850
|
+
headers: {
|
|
32851
|
+
"Content-Type": "application/json",
|
|
32852
|
+
Authorization: `Web3Signed ${params.signature}`
|
|
32853
|
+
},
|
|
32854
|
+
body: JSON.stringify({
|
|
32855
|
+
ownerAddress: params.ownerAddress,
|
|
32856
|
+
scope: params.scope,
|
|
32857
|
+
dataHash: params.dataHash,
|
|
32858
|
+
metadataHash: params.metadataHash,
|
|
32859
|
+
expectedVersion: params.expectedVersion
|
|
32860
|
+
})
|
|
32861
|
+
});
|
|
32862
|
+
if (!res.ok) {
|
|
32863
|
+
const body2 = await res.json().catch(() => ({}));
|
|
32864
|
+
const detail = body2.error ?? res.statusText;
|
|
32865
|
+
throw new Error(`Gateway error: ${res.status} ${detail}`);
|
|
32866
|
+
}
|
|
32867
|
+
const body = await res.json().catch(() => ({}));
|
|
32868
|
+
return {
|
|
32869
|
+
dataPointId: getMutationId(
|
|
32870
|
+
body,
|
|
32871
|
+
"dataPointId"
|
|
32872
|
+
),
|
|
32873
|
+
expectedVersion: body.expectedVersion
|
|
32874
|
+
};
|
|
32875
|
+
},
|
|
32050
32876
|
async registerFile(params) {
|
|
32051
32877
|
const res = await fetch(`${base}/v1/files`, {
|
|
32052
32878
|
method: "POST",
|
|
@@ -32084,8 +32910,9 @@ function createGatewayClient(baseUrl) {
|
|
|
32084
32910
|
body: JSON.stringify({
|
|
32085
32911
|
grantorAddress: params.grantorAddress,
|
|
32086
32912
|
granteeId: params.granteeId,
|
|
32087
|
-
|
|
32088
|
-
|
|
32913
|
+
scopes: params.scopes,
|
|
32914
|
+
grantVersion: params.grantVersion,
|
|
32915
|
+
expiresAt: params.expiresAt
|
|
32089
32916
|
})
|
|
32090
32917
|
});
|
|
32091
32918
|
if (res.status === 409) {
|
|
@@ -32110,13 +32937,71 @@ function createGatewayClient(baseUrl) {
|
|
|
32110
32937
|
Authorization: `Web3Signed ${params.signature}`
|
|
32111
32938
|
},
|
|
32112
32939
|
body: JSON.stringify({
|
|
32113
|
-
grantorAddress: params.grantorAddress
|
|
32940
|
+
grantorAddress: params.grantorAddress,
|
|
32941
|
+
grantVersion: params.grantVersion
|
|
32114
32942
|
})
|
|
32115
32943
|
});
|
|
32116
32944
|
if (res.status === 409) return;
|
|
32117
32945
|
if (!res.ok) {
|
|
32118
32946
|
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
32119
32947
|
}
|
|
32948
|
+
},
|
|
32949
|
+
async getEscrowBalance(account) {
|
|
32950
|
+
const res = await fetch(`${base}/v1/escrow/balance?account=${account}`);
|
|
32951
|
+
if (!res.ok) {
|
|
32952
|
+
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
32953
|
+
}
|
|
32954
|
+
return await res.json();
|
|
32955
|
+
},
|
|
32956
|
+
async submitEscrowDeposit(params) {
|
|
32957
|
+
const res = await fetch(`${base}/v1/escrow/deposit`, {
|
|
32958
|
+
method: "POST",
|
|
32959
|
+
headers: { "Content-Type": "application/json" },
|
|
32960
|
+
body: JSON.stringify({ txHash: params.txHash })
|
|
32961
|
+
});
|
|
32962
|
+
if (res.status !== 200 && res.status !== 202) {
|
|
32963
|
+
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
32964
|
+
}
|
|
32965
|
+
return await res.json();
|
|
32966
|
+
},
|
|
32967
|
+
async payForOperation(params) {
|
|
32968
|
+
const body = {
|
|
32969
|
+
payerAddress: params.payerAddress,
|
|
32970
|
+
opType: params.opType,
|
|
32971
|
+
opId: params.opId,
|
|
32972
|
+
asset: params.asset,
|
|
32973
|
+
amount: params.amount,
|
|
32974
|
+
paymentNonce: params.paymentNonce
|
|
32975
|
+
};
|
|
32976
|
+
if (params.accessRecord) {
|
|
32977
|
+
body["accessRecord"] = params.accessRecord;
|
|
32978
|
+
}
|
|
32979
|
+
const res = await fetch(`${base}/v1/escrow/pay`, {
|
|
32980
|
+
method: "POST",
|
|
32981
|
+
headers: {
|
|
32982
|
+
"Content-Type": "application/json",
|
|
32983
|
+
Authorization: `Web3Signed ${params.signature}`
|
|
32984
|
+
},
|
|
32985
|
+
body: JSON.stringify(body)
|
|
32986
|
+
});
|
|
32987
|
+
if (!res.ok) {
|
|
32988
|
+
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
32989
|
+
}
|
|
32990
|
+
return await res.json();
|
|
32991
|
+
},
|
|
32992
|
+
async settle(params) {
|
|
32993
|
+
const res = await fetch(`${base}/v1/settle`, {
|
|
32994
|
+
method: "POST",
|
|
32995
|
+
headers: { "Content-Type": "application/json" },
|
|
32996
|
+
// The gateway accepts an empty body; only `limit` is recognised.
|
|
32997
|
+
// Always send a JSON body so the gateway's req.body shape parse
|
|
32998
|
+
// doesn't have to deal with an undefined.
|
|
32999
|
+
body: JSON.stringify(params ?? {})
|
|
33000
|
+
});
|
|
33001
|
+
if (!res.ok) {
|
|
33002
|
+
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
33003
|
+
}
|
|
33004
|
+
return await res.json();
|
|
32120
33005
|
}
|
|
32121
33006
|
};
|
|
32122
33007
|
}
|
|
@@ -32146,7 +33031,7 @@ var KNOWN_CODES = /* @__PURE__ */ new Set([
|
|
|
32146
33031
|
"server_not_configured",
|
|
32147
33032
|
"content_too_large"
|
|
32148
33033
|
]);
|
|
32149
|
-
function
|
|
33034
|
+
function isRecord2(value) {
|
|
32150
33035
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
32151
33036
|
}
|
|
32152
33037
|
function normalizeCode(value) {
|
|
@@ -32157,10 +33042,10 @@ function normalizeCode(value) {
|
|
|
32157
33042
|
return KNOWN_CODES.has(code) ? code : null;
|
|
32158
33043
|
}
|
|
32159
33044
|
function extractPSErrorBody(body) {
|
|
32160
|
-
if (!
|
|
33045
|
+
if (!isRecord2(body)) {
|
|
32161
33046
|
return null;
|
|
32162
33047
|
}
|
|
32163
|
-
const nested =
|
|
33048
|
+
const nested = isRecord2(body.error) ? body.error : null;
|
|
32164
33049
|
const code = normalizeCode(
|
|
32165
33050
|
nested?.errorCode ?? nested?.code ?? body.errorCode ?? body.code
|
|
32166
33051
|
);
|
|
@@ -32184,6 +33069,10 @@ async function parsePSError(response) {
|
|
|
32184
33069
|
return errorBody ? new PSError(errorBody.code, errorBody.message) : null;
|
|
32185
33070
|
}
|
|
32186
33071
|
export {
|
|
33072
|
+
ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT,
|
|
33073
|
+
ADD_DATA_TYPES,
|
|
33074
|
+
AccountPersonalServerLiteOwnerBindingError,
|
|
33075
|
+
AccountPersonalServerRegistrationError,
|
|
32187
33076
|
BUILDER_REGISTRATION_TYPES,
|
|
32188
33077
|
BlockchainError,
|
|
32189
33078
|
BrowserECIESUint8Provider as BrowserECIESProvider,
|
|
@@ -32195,8 +33084,11 @@ export {
|
|
|
32195
33084
|
DataFileEnvelopeSchema,
|
|
32196
33085
|
DropboxStorage,
|
|
32197
33086
|
ECIESError,
|
|
33087
|
+
ESCROW_DEPOSIT_ABI,
|
|
32198
33088
|
ExpiredTokenError,
|
|
33089
|
+
FEE_REGISTRY_ABI,
|
|
32199
33090
|
FILE_REGISTRATION_TYPES,
|
|
33091
|
+
GENERIC_PAYMENT_TYPES,
|
|
32200
33092
|
GRANT_REGISTRATION_TYPES,
|
|
32201
33093
|
GRANT_REVOCATION_TYPES,
|
|
32202
33094
|
GoogleDriveStorage,
|
|
@@ -32207,8 +33099,15 @@ export {
|
|
|
32207
33099
|
IpfsStorage,
|
|
32208
33100
|
MASTER_KEY_MESSAGE,
|
|
32209
33101
|
MissingAuthError,
|
|
33102
|
+
NATIVE_VANA_ASSET,
|
|
32210
33103
|
NetworkError,
|
|
32211
33104
|
NonceError,
|
|
33105
|
+
OAuthClient,
|
|
33106
|
+
PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX,
|
|
33107
|
+
PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE,
|
|
33108
|
+
PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION,
|
|
33109
|
+
PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID,
|
|
33110
|
+
PERSONAL_SERVER_REGISTRATION_DEFAULT_VERIFYING_CONTRACT,
|
|
32212
33111
|
PKCE_CHALLENGE_PATTERN,
|
|
32213
33112
|
PKCE_VERIFIER_PATTERN,
|
|
32214
33113
|
PSError,
|
|
@@ -32216,6 +33115,7 @@ export {
|
|
|
32216
33115
|
PersonalServerError,
|
|
32217
33116
|
PinataStorage,
|
|
32218
33117
|
R2Storage,
|
|
33118
|
+
RECORD_DATA_ACCESS_TYPES,
|
|
32219
33119
|
ReadOnlyError,
|
|
32220
33120
|
RelayerError,
|
|
32221
33121
|
SERVER_REGISTRATION_TYPES,
|
|
@@ -32230,6 +33130,12 @@ export {
|
|
|
32230
33130
|
VanaError,
|
|
32231
33131
|
VanaStorage,
|
|
32232
33132
|
assertValidPkceVerifier,
|
|
33133
|
+
buildDepositNativeRequest,
|
|
33134
|
+
buildDepositTokenRequest,
|
|
33135
|
+
buildPersonalServerLiteOwnerBindingMessage,
|
|
33136
|
+
buildPersonalServerLiteOwnerBindingSignature,
|
|
33137
|
+
buildPersonalServerRegistrationSignature,
|
|
33138
|
+
buildPersonalServerRegistrationTypedData,
|
|
32233
33139
|
buildWeb3SignedHeader,
|
|
32234
33140
|
builderRegistrationDomain,
|
|
32235
33141
|
chains,
|
|
@@ -32242,12 +33148,19 @@ export {
|
|
|
32242
33148
|
createGatewayClient,
|
|
32243
33149
|
createPlatformAdapterSafe,
|
|
32244
33150
|
createVanaStorageProvider,
|
|
33151
|
+
createViemPersonalServerLiteOwnerBindingSigner,
|
|
33152
|
+
createViemPersonalServerRegistrationSigner,
|
|
33153
|
+
dataRegistryDomain,
|
|
32245
33154
|
decryptWithPassword,
|
|
32246
33155
|
deriveMasterKey,
|
|
32247
33156
|
deriveScopeKey,
|
|
32248
33157
|
deserializeECIES,
|
|
32249
33158
|
detectPlatform,
|
|
33159
|
+
encodeDepositNativeData,
|
|
33160
|
+
encodeDepositTokenData,
|
|
32250
33161
|
encryptWithPassword,
|
|
33162
|
+
escrowContractAddress,
|
|
33163
|
+
escrowPaymentDomain,
|
|
32251
33164
|
fileRegistrationDomain,
|
|
32252
33165
|
generatePkceVerifier,
|
|
32253
33166
|
getAbi,
|
|
@@ -32256,6 +33169,8 @@ export {
|
|
|
32256
33169
|
getContractAddress,
|
|
32257
33170
|
getContractController,
|
|
32258
33171
|
getContractInfo,
|
|
33172
|
+
getFee,
|
|
33173
|
+
getOpFee,
|
|
32259
33174
|
getPlatformCapabilities,
|
|
32260
33175
|
getServiceEndpoints,
|
|
32261
33176
|
grantRegistrationDomain,
|
|
@@ -32267,16 +33182,20 @@ export {
|
|
|
32267
33182
|
moksha,
|
|
32268
33183
|
mokshaServices,
|
|
32269
33184
|
mokshaTestnet2 as mokshaTestnet,
|
|
32270
|
-
parseGrantRegistrationPayload,
|
|
32271
33185
|
parsePSError,
|
|
32272
33186
|
parseScope,
|
|
32273
33187
|
parseWeb3SignedHeader,
|
|
33188
|
+
personalServerRegistrationDomain,
|
|
32274
33189
|
recoverServerOwner,
|
|
33190
|
+
registerPersonalServerSignature,
|
|
32275
33191
|
scopeCoveredByGrant,
|
|
32276
33192
|
scopeMatchesPattern,
|
|
32277
33193
|
scopeToPathSegments,
|
|
32278
33194
|
serializeECIES,
|
|
32279
33195
|
serverRegistrationDomain,
|
|
33196
|
+
signPersonalServerLiteOwnerBinding,
|
|
33197
|
+
signPersonalServerLiteOwnerBindingWithAccountClient,
|
|
33198
|
+
signPersonalServerRegistrationWithAccount,
|
|
32280
33199
|
vanaMainnet2 as vanaMainnet,
|
|
32281
33200
|
verifyGrantRegistration,
|
|
32282
33201
|
verifyPkceChallenge,
|