@opendatalabs/vana-sdk 3.4.1 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account/personal-server-lite-owner-binding.cjs +3 -3
- package/dist/account/personal-server-lite-owner-binding.cjs.map +1 -1
- package/dist/account/personal-server-lite-owner-binding.d.ts +2 -2
- package/dist/account/personal-server-lite-owner-binding.js +1 -1
- package/dist/account/personal-server-lite-owner-binding.js.map +1 -1
- package/dist/index.browser.d.ts +2 -1
- package/dist/index.browser.js +133 -6
- package/dist/index.browser.js.map +4 -4
- package/dist/index.node.cjs +138 -6
- package/dist/index.node.cjs.map +4 -4
- package/dist/index.node.d.ts +2 -1
- package/dist/index.node.js +133 -6
- package/dist/index.node.js.map +4 -4
- package/dist/{protocol/personal-server-lite-owner-binding.cjs → personal-server-lite/owner-binding.cjs} +5 -5
- package/dist/personal-server-lite/owner-binding.cjs.map +1 -0
- package/dist/{protocol/personal-server-lite-owner-binding.d.ts → personal-server-lite/owner-binding.d.ts} +3 -3
- package/dist/{protocol/personal-server-lite-owner-binding.js → personal-server-lite/owner-binding.js} +2 -2
- package/dist/personal-server-lite/owner-binding.js.map +1 -0
- package/dist/protocol/escrow.cjs +146 -0
- package/dist/protocol/escrow.cjs.map +1 -0
- package/dist/protocol/escrow.d.ts +336 -0
- package/dist/protocol/escrow.js +118 -0
- package/dist/protocol/escrow.js.map +1 -0
- package/dist/protocol/escrow.test.d.ts +1 -0
- package/dist/protocol/personal-server-registration.cjs +16 -4
- package/dist/protocol/personal-server-registration.cjs.map +1 -1
- package/dist/protocol/personal-server-registration.d.ts +5 -2
- package/dist/protocol/personal-server-registration.js +16 -4
- package/dist/protocol/personal-server-registration.js.map +1 -1
- package/package.json +1 -1
- package/dist/protocol/personal-server-lite-owner-binding.cjs.map +0 -1
- package/dist/protocol/personal-server-lite-owner-binding.js.map +0 -1
- /package/dist/{protocol/personal-server-lite-owner-binding.test.d.ts → personal-server-lite/owner-binding.test.d.ts} +0 -0
|
@@ -22,7 +22,7 @@ __export(personal_server_lite_owner_binding_exports, {
|
|
|
22
22
|
signPersonalServerLiteOwnerBindingWithAccountClient: () => signPersonalServerLiteOwnerBindingWithAccountClient
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(personal_server_lite_owner_binding_exports);
|
|
25
|
-
var
|
|
25
|
+
var import_owner_binding = require("../personal-server-lite/owner-binding");
|
|
26
26
|
class AccountPersonalServerLiteOwnerBindingError extends Error {
|
|
27
27
|
code;
|
|
28
28
|
details;
|
|
@@ -46,7 +46,7 @@ async function signPersonalServerLiteOwnerBindingWithAccountClient(config) {
|
|
|
46
46
|
code: "account_address_required"
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
const message = (0,
|
|
49
|
+
const message = (0, import_owner_binding.buildPersonalServerLiteOwnerBindingMessage)(address);
|
|
50
50
|
let signature;
|
|
51
51
|
try {
|
|
52
52
|
signature = await config.client.signMessage({ message });
|
|
@@ -57,7 +57,7 @@ async function signPersonalServerLiteOwnerBindingWithAccountClient(config) {
|
|
|
57
57
|
signature,
|
|
58
58
|
signerAddress: address,
|
|
59
59
|
message,
|
|
60
|
-
purpose:
|
|
60
|
+
purpose: import_owner_binding.PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
function accountOwnerBindingError(error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/account/personal-server-lite-owner-binding.ts"],"sourcesContent":["/**\n * Optional first-party Account integration for PS Lite owner binding.\n *\n * The
|
|
1
|
+
{"version":3,"sources":["../../src/account/personal-server-lite-owner-binding.ts"],"sourcesContent":["/**\n * Optional first-party Account integration for PS Lite owner binding.\n *\n * The PS Lite helper lives in `personal-server-lite/owner-binding`.\n * This module adapts any Account-style client exposing `getAddress` and\n * `signMessage` to the SDK owner-binding signature shape.\n *\n * @category Account\n */\n\nimport type { Address, Hex } from \"viem\";\nimport {\n buildPersonalServerLiteOwnerBindingMessage,\n PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE,\n type PersonalServerLiteOwnerBindingSignature,\n} from \"../personal-server-lite/owner-binding\";\n\nexport interface AccountPersonalServerLiteOwnerBindingClient {\n getAddress(): Promise<Address | null> | Address | null;\n signMessage(input: {\n message: ReturnType<typeof buildPersonalServerLiteOwnerBindingMessage>;\n }): Promise<Hex> | Hex;\n}\n\nexport interface SignPersonalServerLiteOwnerBindingWithAccountClientConfig {\n client: AccountPersonalServerLiteOwnerBindingClient;\n}\n\nexport class AccountPersonalServerLiteOwnerBindingError extends Error {\n code?: number | string;\n details?: unknown;\n\n constructor(input: {\n message: string;\n code?: number | string;\n details?: unknown;\n }) {\n super(input.message);\n this.name = \"AccountPersonalServerLiteOwnerBindingError\";\n this.code = input.code;\n this.details = input.details;\n }\n}\n\nexport async function signPersonalServerLiteOwnerBindingWithAccountClient(\n config: SignPersonalServerLiteOwnerBindingWithAccountClientConfig,\n): Promise<PersonalServerLiteOwnerBindingSignature> {\n let address: Address | null;\n try {\n address = await config.client.getAddress();\n } catch (error) {\n throw accountOwnerBindingError(error);\n }\n\n if (!address) {\n throw new AccountPersonalServerLiteOwnerBindingError({\n message: \"Account did not return a wallet address\",\n code: \"account_address_required\",\n });\n }\n\n const message = buildPersonalServerLiteOwnerBindingMessage(address);\n let signature: Hex;\n try {\n signature = await config.client.signMessage({ message });\n } catch (error) {\n throw accountOwnerBindingError(error);\n }\n\n return {\n signature,\n signerAddress: address,\n message,\n purpose: PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE,\n };\n}\n\nfunction accountOwnerBindingError(\n error: unknown,\n): AccountPersonalServerLiteOwnerBindingError {\n if (error instanceof AccountPersonalServerLiteOwnerBindingError) {\n return error;\n }\n\n const rpcError = error as\n | { code?: number | string; message?: string }\n | undefined;\n const code = rpcError?.code;\n const message =\n typeof rpcError?.message === \"string\" && rpcError.message.length > 0\n ? rpcError.message\n : \"Account PS Lite owner-binding signature failed\";\n\n return new AccountPersonalServerLiteOwnerBindingError({\n message,\n code,\n details: error,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,2BAIO;AAaA,MAAM,mDAAmD,MAAM;AAAA,EACpE;AAAA,EACA;AAAA,EAEA,YAAY,OAIT;AACD,UAAM,MAAM,OAAO;AACnB,SAAK,OAAO;AACZ,SAAK,OAAO,MAAM;AAClB,SAAK,UAAU,MAAM;AAAA,EACvB;AACF;AAEA,eAAsB,oDACpB,QACkD;AAClD,MAAI;AACJ,MAAI;AACF,cAAU,MAAM,OAAO,OAAO,WAAW;AAAA,EAC3C,SAAS,OAAO;AACd,UAAM,yBAAyB,KAAK;AAAA,EACtC;AAEA,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,2CAA2C;AAAA,MACnD,SAAS;AAAA,MACT,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AAEA,QAAM,cAAU,iEAA2C,OAAO;AAClE,MAAI;AACJ,MAAI;AACF,gBAAY,MAAM,OAAO,OAAO,YAAY,EAAE,QAAQ,CAAC;AAAA,EACzD,SAAS,OAAO;AACd,UAAM,yBAAyB,KAAK;AAAA,EACtC;AAEA,SAAO;AAAA,IACL;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA,SAAS;AAAA,EACX;AACF;AAEA,SAAS,yBACP,OAC4C;AAC5C,MAAI,iBAAiB,4CAA4C;AAC/D,WAAO;AAAA,EACT;AAEA,QAAM,WAAW;AAGjB,QAAM,OAAO,UAAU;AACvB,QAAM,UACJ,OAAO,UAAU,YAAY,YAAY,SAAS,QAAQ,SAAS,IAC/D,SAAS,UACT;AAEN,SAAO,IAAI,2CAA2C;AAAA,IACpD;AAAA,IACA;AAAA,IACA,SAAS;AAAA,EACX,CAAC;AACH;","names":[]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Optional first-party Account integration for PS Lite owner binding.
|
|
3
3
|
*
|
|
4
|
-
* The
|
|
4
|
+
* The PS Lite helper lives in `personal-server-lite/owner-binding`.
|
|
5
5
|
* This module adapts any Account-style client exposing `getAddress` and
|
|
6
6
|
* `signMessage` to the SDK owner-binding signature shape.
|
|
7
7
|
*
|
|
8
8
|
* @category Account
|
|
9
9
|
*/
|
|
10
10
|
import type { Address, Hex } from "viem";
|
|
11
|
-
import { buildPersonalServerLiteOwnerBindingMessage, type PersonalServerLiteOwnerBindingSignature } from "../
|
|
11
|
+
import { buildPersonalServerLiteOwnerBindingMessage, type PersonalServerLiteOwnerBindingSignature } from "../personal-server-lite/owner-binding";
|
|
12
12
|
export interface AccountPersonalServerLiteOwnerBindingClient {
|
|
13
13
|
getAddress(): Promise<Address | null> | Address | null;
|
|
14
14
|
signMessage(input: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildPersonalServerLiteOwnerBindingMessage,
|
|
3
3
|
PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE
|
|
4
|
-
} from "../
|
|
4
|
+
} from "../personal-server-lite/owner-binding.js";
|
|
5
5
|
class AccountPersonalServerLiteOwnerBindingError extends Error {
|
|
6
6
|
code;
|
|
7
7
|
details;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/account/personal-server-lite-owner-binding.ts"],"sourcesContent":["/**\n * Optional first-party Account integration for PS Lite owner binding.\n *\n * The
|
|
1
|
+
{"version":3,"sources":["../../src/account/personal-server-lite-owner-binding.ts"],"sourcesContent":["/**\n * Optional first-party Account integration for PS Lite owner binding.\n *\n * The PS Lite helper lives in `personal-server-lite/owner-binding`.\n * This module adapts any Account-style client exposing `getAddress` and\n * `signMessage` to the SDK owner-binding signature shape.\n *\n * @category Account\n */\n\nimport type { Address, Hex } from \"viem\";\nimport {\n buildPersonalServerLiteOwnerBindingMessage,\n PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE,\n type PersonalServerLiteOwnerBindingSignature,\n} from \"../personal-server-lite/owner-binding\";\n\nexport interface AccountPersonalServerLiteOwnerBindingClient {\n getAddress(): Promise<Address | null> | Address | null;\n signMessage(input: {\n message: ReturnType<typeof buildPersonalServerLiteOwnerBindingMessage>;\n }): Promise<Hex> | Hex;\n}\n\nexport interface SignPersonalServerLiteOwnerBindingWithAccountClientConfig {\n client: AccountPersonalServerLiteOwnerBindingClient;\n}\n\nexport class AccountPersonalServerLiteOwnerBindingError extends Error {\n code?: number | string;\n details?: unknown;\n\n constructor(input: {\n message: string;\n code?: number | string;\n details?: unknown;\n }) {\n super(input.message);\n this.name = \"AccountPersonalServerLiteOwnerBindingError\";\n this.code = input.code;\n this.details = input.details;\n }\n}\n\nexport async function signPersonalServerLiteOwnerBindingWithAccountClient(\n config: SignPersonalServerLiteOwnerBindingWithAccountClientConfig,\n): Promise<PersonalServerLiteOwnerBindingSignature> {\n let address: Address | null;\n try {\n address = await config.client.getAddress();\n } catch (error) {\n throw accountOwnerBindingError(error);\n }\n\n if (!address) {\n throw new AccountPersonalServerLiteOwnerBindingError({\n message: \"Account did not return a wallet address\",\n code: \"account_address_required\",\n });\n }\n\n const message = buildPersonalServerLiteOwnerBindingMessage(address);\n let signature: Hex;\n try {\n signature = await config.client.signMessage({ message });\n } catch (error) {\n throw accountOwnerBindingError(error);\n }\n\n return {\n signature,\n signerAddress: address,\n message,\n purpose: PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE,\n };\n}\n\nfunction accountOwnerBindingError(\n error: unknown,\n): AccountPersonalServerLiteOwnerBindingError {\n if (error instanceof AccountPersonalServerLiteOwnerBindingError) {\n return error;\n }\n\n const rpcError = error as\n | { code?: number | string; message?: string }\n | undefined;\n const code = rpcError?.code;\n const message =\n typeof rpcError?.message === \"string\" && rpcError.message.length > 0\n ? rpcError.message\n : \"Account PS Lite owner-binding signature failed\";\n\n return new AccountPersonalServerLiteOwnerBindingError({\n message,\n code,\n details: error,\n });\n}\n"],"mappings":"AAWA;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AAaA,MAAM,mDAAmD,MAAM;AAAA,EACpE;AAAA,EACA;AAAA,EAEA,YAAY,OAIT;AACD,UAAM,MAAM,OAAO;AACnB,SAAK,OAAO;AACZ,SAAK,OAAO,MAAM;AAClB,SAAK,UAAU,MAAM;AAAA,EACvB;AACF;AAEA,eAAsB,oDACpB,QACkD;AAClD,MAAI;AACJ,MAAI;AACF,cAAU,MAAM,OAAO,OAAO,WAAW;AAAA,EAC3C,SAAS,OAAO;AACd,UAAM,yBAAyB,KAAK;AAAA,EACtC;AAEA,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,2CAA2C;AAAA,MACnD,SAAS;AAAA,MACT,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AAEA,QAAM,UAAU,2CAA2C,OAAO;AAClE,MAAI;AACJ,MAAI;AACF,gBAAY,MAAM,OAAO,OAAO,YAAY,EAAE,QAAQ,CAAC;AAAA,EACzD,SAAS,OAAO;AACd,UAAM,yBAAyB,KAAK;AAAA,EACtC;AAEA,SAAO;AAAA,IACL;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA,SAAS;AAAA,EACX;AACF;AAEA,SAAS,yBACP,OAC4C;AAC5C,MAAI,iBAAiB,4CAA4C;AAC/D,WAAO;AAAA,EACT;AAEA,QAAM,WAAW;AAGjB,QAAM,OAAO,UAAU;AACvB,QAAM,UACJ,OAAO,UAAU,YAAY,YAAY,SAAS,QAAQ,SAAS,IAC/D,SAAS,UACT;AAEN,SAAO,IAAI,2CAA2C;AAAA,IACpD;AAAA,IACA;AAAA,IACA,SAAS;AAAA,EACX,CAAC;AACH;","names":[]}
|
package/dist/index.browser.d.ts
CHANGED
|
@@ -37,11 +37,12 @@ export { buildWeb3SignedHeader, computeBodyHash, type Web3SignedSignFn, } from "
|
|
|
37
37
|
export { MissingAuthError, InvalidSignatureError, ExpiredTokenError, } from "./auth/errors";
|
|
38
38
|
export { fileRegistrationDomain, fileDeletionDomain, grantRegistrationDomain, grantRevocationDomain, serverRegistrationDomain, builderRegistrationDomain, FILE_REGISTRATION_TYPES, FILE_DELETION_TYPES, GRANT_REGISTRATION_TYPES, GRANT_REVOCATION_TYPES, SERVER_REGISTRATION_TYPES, BUILDER_REGISTRATION_TYPES, type DataPortabilityContracts, type DataPortabilityGatewayConfig, type FileRegistrationMessage, type FileDeletionMessage, type GrantRegistrationMessage, type GrantRevocationMessage, type ServerRegistrationMessage, type BuilderRegistrationMessage, } from "./protocol/eip712";
|
|
39
39
|
export { PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID, PERSONAL_SERVER_REGISTRATION_DEFAULT_VERIFYING_CONTRACT, personalServerRegistrationDomain, createViemPersonalServerRegistrationSigner, buildPersonalServerRegistrationTypedData, buildPersonalServerRegistrationSignature, registerPersonalServerSignature, type PersonalServerRegistrationTypedData, type PersonalServerRegistrationSigner, type PersonalServerRegistrationDomainInput, type ViemPersonalServerRegistrationWalletClient, type ViemPersonalServerRegistrationSignerSource, type BuildPersonalServerRegistrationTypedDataInput, type BuildPersonalServerRegistrationSignatureInput, type PersonalServerRegistrationSignature, } from "./protocol/personal-server-registration";
|
|
40
|
-
export { PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION, PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE, PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX, buildPersonalServerLiteOwnerBindingMessage, createViemPersonalServerLiteOwnerBindingSigner, buildPersonalServerLiteOwnerBindingSignature, signPersonalServerLiteOwnerBinding, type PersonalServerLiteOwnerBindingPurpose, type PersonalServerLiteOwnerBindingMessage, type PersonalServerLiteOwnerBindingSigner, type ViemPersonalServerLiteOwnerBindingWalletClient, type ViemPersonalServerLiteOwnerBindingSignerSource, type BuildPersonalServerLiteOwnerBindingSignatureInput, type PersonalServerLiteOwnerBindingSignature, } from "./
|
|
40
|
+
export { PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION, PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE, PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX, buildPersonalServerLiteOwnerBindingMessage, createViemPersonalServerLiteOwnerBindingSigner, buildPersonalServerLiteOwnerBindingSignature, signPersonalServerLiteOwnerBinding, type PersonalServerLiteOwnerBindingPurpose, type PersonalServerLiteOwnerBindingMessage, type PersonalServerLiteOwnerBindingSigner, type ViemPersonalServerLiteOwnerBindingWalletClient, type ViemPersonalServerLiteOwnerBindingSignerSource, type BuildPersonalServerLiteOwnerBindingSignatureInput, type PersonalServerLiteOwnerBindingSignature, } from "./personal-server-lite/owner-binding";
|
|
41
41
|
export { ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT, AccountPersonalServerRegistrationError, signPersonalServerRegistrationWithAccount, type AccountPersonalServerRegistrationIntent, type AccountPersonalServerRegistrationSignature, type AccountPersonalServerRegistrationStatus, type AccountPersonalServerRegistrationRequest, type AccountPersonalServerRegistrationConfig, type AccountSignedPersonalServerRegistration, type AccountConfirmationRequiredPersonalServerRegistration, type AccountFallbackSignedPersonalServerRegistration, type AccountPersonalServerRegistrationResult, } from "./account/personal-server-registration";
|
|
42
42
|
export { AccountPersonalServerLiteOwnerBindingError, signPersonalServerLiteOwnerBindingWithAccountClient, type AccountPersonalServerLiteOwnerBindingClient, type SignPersonalServerLiteOwnerBindingWithAccountClientConfig, } from "./account/personal-server-lite-owner-binding";
|
|
43
43
|
export { isDataPortabilityGatewayConfig, parseGrantRegistrationPayload, verifyGrantRegistration, type DataPortabilityGrantPayload, type VerifyGrantRegistrationInput, type VerifyGrantRegistrationResult, } from "./protocol/grants";
|
|
44
44
|
export { ScopeSchema, parseScope, scopeToPathSegments, scopeMatchesPattern, scopeCoveredByGrant, type Scope, type ParsedScope, } from "./protocol/scopes";
|
|
45
45
|
export { DataFileEnvelopeSchema, createDataFileEnvelope, IngestResponseSchema, type DataFileEnvelope, type IngestResponse, } from "./protocol/data-file";
|
|
46
46
|
export { createGatewayClient, type GatewayEnvelope, type GatewayProof, type Builder, type Schema, type ServerInfo, type GatewayGrantResponse, type GrantListItem, type FileRecord, type FileListResult, type ListFilesOptions, type RegisterServerParams, type RegisterServerResult, type RegisterFileParams, type CreateGrantParams, type RevokeGrantParams, type DeleteFileParams, type GatewayClient, } from "./protocol/gateway";
|
|
47
|
+
export { createEscrowGatewayClient, genericPaymentDomain, GENERIC_PAYMENT_TYPES, ESCROW_DEPOSIT_ABI, NATIVE_ASSET_ADDRESS, type GenericPaymentMessage, type EscrowBalanceEntry, type EscrowBalanceResult, type EscrowBalanceSyncResult, type DepositSubmissionResult, type PaymentBreakdown, type EscrowPayResult, type SubmitDepositParams, type PayForOpParams, type EscrowGatewayClient, type SubmittedDepositEntry, type FinalizedDepositEntry, type FailedDepositEntry, } from "./protocol/escrow";
|
|
47
48
|
export { PSError, parsePSError, type PSErrorCode } from "./types/ps-errors";
|
package/dist/index.browser.js
CHANGED
|
@@ -31974,8 +31974,11 @@ var BUILDER_REGISTRATION_TYPES = {
|
|
|
31974
31974
|
import {
|
|
31975
31975
|
isAddress
|
|
31976
31976
|
} from "viem";
|
|
31977
|
-
var PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID =
|
|
31978
|
-
var PERSONAL_SERVER_REGISTRATION_DEFAULT_VERIFYING_CONTRACT =
|
|
31977
|
+
var PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID = vanaMainnet2.id;
|
|
31978
|
+
var PERSONAL_SERVER_REGISTRATION_DEFAULT_VERIFYING_CONTRACT = getContractAddress(
|
|
31979
|
+
PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID,
|
|
31980
|
+
"DataPortabilityServers"
|
|
31981
|
+
);
|
|
31979
31982
|
function assertAddress(value, name) {
|
|
31980
31983
|
if (!isAddress(value)) {
|
|
31981
31984
|
throw new Error(`${name} must be a valid EVM address`);
|
|
@@ -31990,6 +31993,12 @@ function getAccountAddress(account) {
|
|
|
31990
31993
|
function isPersonalServerRegistrationSigner(source) {
|
|
31991
31994
|
return "address" in source && typeof source.signTypedData === "function";
|
|
31992
31995
|
}
|
|
31996
|
+
function getDefaultServerRegistrationContract(chainId) {
|
|
31997
|
+
return getContractAddress(
|
|
31998
|
+
chainId,
|
|
31999
|
+
"DataPortabilityServers"
|
|
32000
|
+
);
|
|
32001
|
+
}
|
|
31993
32002
|
function createViemPersonalServerRegistrationSigner(source, options = {}) {
|
|
31994
32003
|
if (isPersonalServerRegistrationSigner(source)) {
|
|
31995
32004
|
return source;
|
|
@@ -32012,12 +32021,13 @@ function personalServerRegistrationDomain(input = {}) {
|
|
|
32012
32021
|
if (input.config) {
|
|
32013
32022
|
return serverRegistrationDomain(input.config);
|
|
32014
32023
|
}
|
|
32015
|
-
const
|
|
32024
|
+
const chainId = input.chainId ?? PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID;
|
|
32025
|
+
const verifyingContract = input.verifyingContract ?? getDefaultServerRegistrationContract(chainId);
|
|
32016
32026
|
assertAddress(verifyingContract, "verifyingContract");
|
|
32017
32027
|
return {
|
|
32018
32028
|
name: "Vana Data Portability",
|
|
32019
32029
|
version: "1",
|
|
32020
|
-
chainId
|
|
32030
|
+
chainId,
|
|
32021
32031
|
verifyingContract
|
|
32022
32032
|
};
|
|
32023
32033
|
}
|
|
@@ -32055,11 +32065,11 @@ async function buildPersonalServerRegistrationSignature(input) {
|
|
|
32055
32065
|
}
|
|
32056
32066
|
var registerPersonalServerSignature = buildPersonalServerRegistrationSignature;
|
|
32057
32067
|
|
|
32058
|
-
// src/
|
|
32068
|
+
// src/personal-server-lite/owner-binding.ts
|
|
32059
32069
|
import {
|
|
32060
32070
|
isAddress as isAddress2
|
|
32061
32071
|
} from "viem";
|
|
32062
|
-
var PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION = "vana.
|
|
32072
|
+
var PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION = "vana.ps-lite.owner-binding.v1";
|
|
32063
32073
|
var PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE = "ps-lite-owner";
|
|
32064
32074
|
var PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX = `${PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION}:${PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE}:`;
|
|
32065
32075
|
function assertAddress2(value, name) {
|
|
@@ -32802,6 +32812,118 @@ function createGatewayClient(baseUrl) {
|
|
|
32802
32812
|
};
|
|
32803
32813
|
}
|
|
32804
32814
|
|
|
32815
|
+
// src/protocol/escrow.ts
|
|
32816
|
+
var GENERIC_PAYMENT_TYPES = {
|
|
32817
|
+
GenericPayment: [
|
|
32818
|
+
{ name: "payerAddress", type: "address" },
|
|
32819
|
+
{ name: "opType", type: "string" },
|
|
32820
|
+
{ name: "opId", type: "bytes32" },
|
|
32821
|
+
{ name: "asset", type: "address" },
|
|
32822
|
+
{ name: "amount", type: "uint256" },
|
|
32823
|
+
{ name: "paymentNonce", type: "uint256" }
|
|
32824
|
+
]
|
|
32825
|
+
};
|
|
32826
|
+
function genericPaymentDomain(chainId, escrowContract) {
|
|
32827
|
+
return {
|
|
32828
|
+
name: "Vana Data Portability",
|
|
32829
|
+
version: "1",
|
|
32830
|
+
chainId,
|
|
32831
|
+
verifyingContract: escrowContract
|
|
32832
|
+
};
|
|
32833
|
+
}
|
|
32834
|
+
var ESCROW_DEPOSIT_ABI = [
|
|
32835
|
+
{
|
|
32836
|
+
type: "function",
|
|
32837
|
+
name: "depositNative",
|
|
32838
|
+
stateMutability: "payable",
|
|
32839
|
+
inputs: [{ name: "account", type: "address" }],
|
|
32840
|
+
outputs: []
|
|
32841
|
+
},
|
|
32842
|
+
{
|
|
32843
|
+
type: "function",
|
|
32844
|
+
name: "depositToken",
|
|
32845
|
+
stateMutability: "nonpayable",
|
|
32846
|
+
inputs: [
|
|
32847
|
+
{ name: "account", type: "address" },
|
|
32848
|
+
{ name: "token", type: "address" },
|
|
32849
|
+
{ name: "amount", type: "uint256" }
|
|
32850
|
+
],
|
|
32851
|
+
outputs: []
|
|
32852
|
+
}
|
|
32853
|
+
];
|
|
32854
|
+
var NATIVE_ASSET_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
32855
|
+
function createEscrowGatewayClient(baseUrl) {
|
|
32856
|
+
const base = baseUrl.replace(/\/+$/, "");
|
|
32857
|
+
async function throwOnError(res, context) {
|
|
32858
|
+
if (!res.ok) {
|
|
32859
|
+
let detail = "";
|
|
32860
|
+
try {
|
|
32861
|
+
const body = await res.json();
|
|
32862
|
+
if (body.error) detail = `: ${body.error}`;
|
|
32863
|
+
} catch {
|
|
32864
|
+
}
|
|
32865
|
+
throw new Error(
|
|
32866
|
+
`Escrow gateway error (${context}): ${res.status} ${res.statusText}${detail}`
|
|
32867
|
+
);
|
|
32868
|
+
}
|
|
32869
|
+
}
|
|
32870
|
+
return {
|
|
32871
|
+
async submitDeposit({ txHash }) {
|
|
32872
|
+
const res = await fetch(`${base}/v1/escrow/deposit`, {
|
|
32873
|
+
method: "POST",
|
|
32874
|
+
headers: { "Content-Type": "application/json" },
|
|
32875
|
+
body: JSON.stringify({ txHash })
|
|
32876
|
+
});
|
|
32877
|
+
if (res.status !== 200 && res.status !== 202) {
|
|
32878
|
+
await throwOnError(res, "POST /v1/escrow/deposit");
|
|
32879
|
+
}
|
|
32880
|
+
return res.json();
|
|
32881
|
+
},
|
|
32882
|
+
async getEscrowBalance(account) {
|
|
32883
|
+
const res = await fetch(
|
|
32884
|
+
`${base}/v1/escrow/balance?account=${encodeURIComponent(account)}`
|
|
32885
|
+
);
|
|
32886
|
+
await throwOnError(res, "GET /v1/escrow/balance");
|
|
32887
|
+
return res.json();
|
|
32888
|
+
},
|
|
32889
|
+
async syncEscrowBalance(account) {
|
|
32890
|
+
const res = await fetch(
|
|
32891
|
+
`${base}/v1/escrow/balance/sync?account=${encodeURIComponent(account)}`,
|
|
32892
|
+
{ method: "POST" }
|
|
32893
|
+
);
|
|
32894
|
+
await throwOnError(res, "POST /v1/escrow/balance/sync");
|
|
32895
|
+
return res.json();
|
|
32896
|
+
},
|
|
32897
|
+
async payForOp({
|
|
32898
|
+
payerAddress,
|
|
32899
|
+
opType,
|
|
32900
|
+
opId,
|
|
32901
|
+
asset,
|
|
32902
|
+
amount,
|
|
32903
|
+
paymentNonce,
|
|
32904
|
+
signature
|
|
32905
|
+
}) {
|
|
32906
|
+
const res = await fetch(`${base}/v1/escrow/pay`, {
|
|
32907
|
+
method: "POST",
|
|
32908
|
+
headers: {
|
|
32909
|
+
"Content-Type": "application/json",
|
|
32910
|
+
Authorization: `Web3Signed ${signature}`
|
|
32911
|
+
},
|
|
32912
|
+
body: JSON.stringify({
|
|
32913
|
+
payerAddress,
|
|
32914
|
+
opType,
|
|
32915
|
+
opId,
|
|
32916
|
+
asset,
|
|
32917
|
+
amount,
|
|
32918
|
+
paymentNonce
|
|
32919
|
+
})
|
|
32920
|
+
});
|
|
32921
|
+
await throwOnError(res, "POST /v1/escrow/pay");
|
|
32922
|
+
return res.json();
|
|
32923
|
+
}
|
|
32924
|
+
};
|
|
32925
|
+
}
|
|
32926
|
+
|
|
32805
32927
|
// src/types/ps-errors.ts
|
|
32806
32928
|
var PSError = class extends Error {
|
|
32807
32929
|
constructor(code, message) {
|
|
@@ -32879,9 +33001,11 @@ export {
|
|
|
32879
33001
|
DataFileEnvelopeSchema,
|
|
32880
33002
|
DropboxStorage,
|
|
32881
33003
|
ECIESError,
|
|
33004
|
+
ESCROW_DEPOSIT_ABI,
|
|
32882
33005
|
ExpiredTokenError,
|
|
32883
33006
|
FILE_DELETION_TYPES,
|
|
32884
33007
|
FILE_REGISTRATION_TYPES,
|
|
33008
|
+
GENERIC_PAYMENT_TYPES,
|
|
32885
33009
|
GRANT_REGISTRATION_TYPES,
|
|
32886
33010
|
GRANT_REVOCATION_TYPES,
|
|
32887
33011
|
GoogleDriveStorage,
|
|
@@ -32892,6 +33016,7 @@ export {
|
|
|
32892
33016
|
IpfsStorage,
|
|
32893
33017
|
MASTER_KEY_MESSAGE,
|
|
32894
33018
|
MissingAuthError,
|
|
33019
|
+
NATIVE_ASSET_ADDRESS,
|
|
32895
33020
|
NetworkError,
|
|
32896
33021
|
NonceError,
|
|
32897
33022
|
OAuthClient,
|
|
@@ -32934,6 +33059,7 @@ export {
|
|
|
32934
33059
|
contractCacheForTesting,
|
|
32935
33060
|
createBrowserPlatformAdapter,
|
|
32936
33061
|
createDataFileEnvelope,
|
|
33062
|
+
createEscrowGatewayClient,
|
|
32937
33063
|
createGatewayClient,
|
|
32938
33064
|
createPlatformAdapterSafe,
|
|
32939
33065
|
createVanaStorageProvider,
|
|
@@ -32948,6 +33074,7 @@ export {
|
|
|
32948
33074
|
fileDeletionDomain,
|
|
32949
33075
|
fileRegistrationDomain,
|
|
32950
33076
|
generatePkceVerifier,
|
|
33077
|
+
genericPaymentDomain,
|
|
32951
33078
|
getAbi,
|
|
32952
33079
|
getAllChains,
|
|
32953
33080
|
getChainConfig,
|