@opendatalabs/vana-sdk 3.4.1 → 3.5.1

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.
Files changed (37) hide show
  1. package/dist/account/personal-server-lite-owner-binding.cjs +3 -3
  2. package/dist/account/personal-server-lite-owner-binding.cjs.map +1 -1
  3. package/dist/account/personal-server-lite-owner-binding.d.ts +2 -2
  4. package/dist/account/personal-server-lite-owner-binding.js +1 -1
  5. package/dist/account/personal-server-lite-owner-binding.js.map +1 -1
  6. package/dist/index.browser.d.ts +2 -1
  7. package/dist/index.browser.js +208 -23
  8. package/dist/index.browser.js.map +4 -4
  9. package/dist/index.node.cjs +213 -23
  10. package/dist/index.node.cjs.map +4 -4
  11. package/dist/index.node.d.ts +2 -1
  12. package/dist/index.node.js +208 -23
  13. package/dist/index.node.js.map +4 -4
  14. package/dist/{protocol/personal-server-lite-owner-binding.cjs → personal-server-lite/owner-binding.cjs} +5 -5
  15. package/dist/personal-server-lite/owner-binding.cjs.map +1 -0
  16. package/dist/{protocol/personal-server-lite-owner-binding.d.ts → personal-server-lite/owner-binding.d.ts} +3 -3
  17. package/dist/{protocol/personal-server-lite-owner-binding.js → personal-server-lite/owner-binding.js} +2 -2
  18. package/dist/personal-server-lite/owner-binding.js.map +1 -0
  19. package/dist/protocol/escrow.cjs +146 -0
  20. package/dist/protocol/escrow.cjs.map +1 -0
  21. package/dist/protocol/escrow.d.ts +336 -0
  22. package/dist/protocol/escrow.js +118 -0
  23. package/dist/protocol/escrow.js.map +1 -0
  24. package/dist/protocol/escrow.test.d.ts +1 -0
  25. package/dist/protocol/personal-server-registration.cjs +16 -4
  26. package/dist/protocol/personal-server-registration.cjs.map +1 -1
  27. package/dist/protocol/personal-server-registration.d.ts +5 -2
  28. package/dist/protocol/personal-server-registration.js +16 -4
  29. package/dist/protocol/personal-server-registration.js.map +1 -1
  30. package/dist/storage/providers/vana-storage.cjs +75 -17
  31. package/dist/storage/providers/vana-storage.cjs.map +1 -1
  32. package/dist/storage/providers/vana-storage.js +75 -17
  33. package/dist/storage/providers/vana-storage.js.map +1 -1
  34. package/package.json +1 -1
  35. package/dist/protocol/personal-server-lite-owner-binding.cjs.map +0 -1
  36. package/dist/protocol/personal-server-lite-owner-binding.js.map +0 -1
  37. /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 import_personal_server_lite_owner_binding = require("../protocol/personal-server-lite-owner-binding");
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, import_personal_server_lite_owner_binding.buildPersonalServerLiteOwnerBindingMessage)(address);
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: import_personal_server_lite_owner_binding.PERSONAL_SERVER_LITE_OWNER_BINDING_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 protocol helper lives in `protocol/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 \"../protocol/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,gDAIO;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,sFAA2C,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
+ {"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 protocol helper lives in `protocol/personal-server-lite-owner-binding`.
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 "../protocol/personal-server-lite-owner-binding";
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 "../protocol/personal-server-lite-owner-binding.js";
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 protocol helper lives in `protocol/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 \"../protocol/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":[]}
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":[]}
@@ -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 "./protocol/personal-server-lite-owner-binding";
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";
@@ -29009,6 +29009,8 @@ async function buildWeb3SignedHeader(params) {
29009
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
+ var MAX_UPLOAD_ATTEMPTS = 4;
29013
+ var MAX_RATE_LIMIT_DELAY_MS = 3e4;
29012
29014
  var VanaStorage = class {
29013
29015
  endpoint;
29014
29016
  signer;
@@ -29047,27 +29049,46 @@ var VanaStorage = class {
29047
29049
  const body = new Uint8Array(await file.arrayBuffer());
29048
29050
  const contentType = file.type !== "" ? file.type : "application/octet-stream";
29049
29051
  const header = await this.signRequest("PUT", path, body);
29050
- let response;
29051
- try {
29052
- response = await this.fetchImpl(`${this.endpoint}${path}`, {
29053
- method: "PUT",
29054
- headers: {
29055
- authorization: header,
29056
- "content-type": contentType
29057
- },
29058
- body
29059
- });
29060
- } catch (cause) {
29052
+ let response = null;
29053
+ let responseText = "";
29054
+ for (let attempt = 1; attempt <= MAX_UPLOAD_ATTEMPTS; attempt++) {
29055
+ try {
29056
+ response = await this.fetchImpl(`${this.endpoint}${path}`, {
29057
+ method: "PUT",
29058
+ headers: {
29059
+ authorization: header,
29060
+ "content-type": contentType
29061
+ },
29062
+ body
29063
+ });
29064
+ } catch (cause) {
29065
+ throw new StorageError(
29066
+ `vana-storage upload network error: ${describe(cause)}`,
29067
+ "UPLOAD_ERROR",
29068
+ "vana-storage",
29069
+ { cause: cause instanceof Error ? cause : void 0 }
29070
+ );
29071
+ }
29072
+ if (response.ok) {
29073
+ break;
29074
+ }
29075
+ responseText = await safeText(response);
29076
+ if (response.status === 429 && attempt < MAX_UPLOAD_ATTEMPTS) {
29077
+ const delayMs = retryDelayMs(response, responseText);
29078
+ if (delayMs > 0) {
29079
+ await sleep(delayMs);
29080
+ }
29081
+ continue;
29082
+ }
29061
29083
  throw new StorageError(
29062
- `vana-storage upload network error: ${describe(cause)}`,
29063
- "UPLOAD_ERROR",
29064
- "vana-storage",
29065
- { cause: cause instanceof Error ? cause : void 0 }
29084
+ `vana-storage upload failed: ${response.status} ${response.statusText} - ${responseText}`,
29085
+ "UPLOAD_FAILED",
29086
+ "vana-storage"
29066
29087
  );
29067
29088
  }
29068
- if (!response.ok) {
29089
+ if (!response?.ok) {
29069
29090
  throw new StorageError(
29070
- `vana-storage upload failed: ${response.status} ${response.statusText} - ${await safeText(response)}`,
29091
+ `vana-storage upload failed after ${MAX_UPLOAD_ATTEMPTS} attempts - ${responseText}`,
29071
29092
  "UPLOAD_FAILED",
29072
29093
  "vana-storage"
29073
29094
  );
@@ -29220,6 +29241,43 @@ function describe(value) {
29220
29241
  if (value instanceof Error) return value.message;
29221
29242
  return String(value);
29222
29243
  }
29244
+ function retryDelayMs(response, responseText) {
29245
+ const headerDelayMs = parseRetryAfterHeaderMs(
29246
+ response.headers.get("retry-after")
29247
+ );
29248
+ if (headerDelayMs !== null) {
29249
+ return clampRateLimitDelay(headerDelayMs);
29250
+ }
29251
+ return clampRateLimitDelay(parseRetryAfterBodyMs(responseText) ?? 0);
29252
+ }
29253
+ function parseRetryAfterHeaderMs(value) {
29254
+ if (!value) return null;
29255
+ const seconds = Number(value);
29256
+ if (Number.isFinite(seconds)) {
29257
+ return seconds * 1e3;
29258
+ }
29259
+ const dateMs = Date.parse(value);
29260
+ if (Number.isFinite(dateMs)) {
29261
+ return Math.max(0, dateMs - Date.now());
29262
+ }
29263
+ return null;
29264
+ }
29265
+ function parseRetryAfterBodyMs(responseText) {
29266
+ if (!responseText) return null;
29267
+ try {
29268
+ const parsed = JSON.parse(responseText);
29269
+ const seconds = Number(parsed.retryAfter);
29270
+ return Number.isFinite(seconds) ? seconds * 1e3 : null;
29271
+ } catch {
29272
+ return null;
29273
+ }
29274
+ }
29275
+ function clampRateLimitDelay(delayMs) {
29276
+ return Math.min(Math.max(0, delayMs), MAX_RATE_LIMIT_DELAY_MS);
29277
+ }
29278
+ function sleep(ms) {
29279
+ return new Promise((resolve) => setTimeout(resolve, ms));
29280
+ }
29223
29281
  async function safeText(response) {
29224
29282
  try {
29225
29283
  return await response.text();
@@ -31974,8 +32032,11 @@ var BUILDER_REGISTRATION_TYPES = {
31974
32032
  import {
31975
32033
  isAddress
31976
32034
  } from "viem";
31977
- var PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID = 1480;
31978
- var PERSONAL_SERVER_REGISTRATION_DEFAULT_VERIFYING_CONTRACT = "0x1483B1F634DBA75AeaE60da7f01A679aabd5ee2c";
32035
+ var PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID = vanaMainnet2.id;
32036
+ var PERSONAL_SERVER_REGISTRATION_DEFAULT_VERIFYING_CONTRACT = getContractAddress(
32037
+ PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID,
32038
+ "DataPortabilityServers"
32039
+ );
31979
32040
  function assertAddress(value, name) {
31980
32041
  if (!isAddress(value)) {
31981
32042
  throw new Error(`${name} must be a valid EVM address`);
@@ -31990,6 +32051,12 @@ function getAccountAddress(account) {
31990
32051
  function isPersonalServerRegistrationSigner(source) {
31991
32052
  return "address" in source && typeof source.signTypedData === "function";
31992
32053
  }
32054
+ function getDefaultServerRegistrationContract(chainId) {
32055
+ return getContractAddress(
32056
+ chainId,
32057
+ "DataPortabilityServers"
32058
+ );
32059
+ }
31993
32060
  function createViemPersonalServerRegistrationSigner(source, options = {}) {
31994
32061
  if (isPersonalServerRegistrationSigner(source)) {
31995
32062
  return source;
@@ -32012,12 +32079,13 @@ function personalServerRegistrationDomain(input = {}) {
32012
32079
  if (input.config) {
32013
32080
  return serverRegistrationDomain(input.config);
32014
32081
  }
32015
- const verifyingContract = input.verifyingContract ?? PERSONAL_SERVER_REGISTRATION_DEFAULT_VERIFYING_CONTRACT;
32082
+ const chainId = input.chainId ?? PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID;
32083
+ const verifyingContract = input.verifyingContract ?? getDefaultServerRegistrationContract(chainId);
32016
32084
  assertAddress(verifyingContract, "verifyingContract");
32017
32085
  return {
32018
32086
  name: "Vana Data Portability",
32019
32087
  version: "1",
32020
- chainId: input.chainId ?? PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID,
32088
+ chainId,
32021
32089
  verifyingContract
32022
32090
  };
32023
32091
  }
@@ -32055,11 +32123,11 @@ async function buildPersonalServerRegistrationSignature(input) {
32055
32123
  }
32056
32124
  var registerPersonalServerSignature = buildPersonalServerRegistrationSignature;
32057
32125
 
32058
- // src/protocol/personal-server-lite-owner-binding.ts
32126
+ // src/personal-server-lite/owner-binding.ts
32059
32127
  import {
32060
32128
  isAddress as isAddress2
32061
32129
  } from "viem";
32062
- var PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION = "vana.account.v1";
32130
+ var PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION = "vana.ps-lite.owner-binding.v1";
32063
32131
  var PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE = "ps-lite-owner";
32064
32132
  var PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX = `${PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION}:${PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE}:`;
32065
32133
  function assertAddress2(value, name) {
@@ -32802,6 +32870,118 @@ function createGatewayClient(baseUrl) {
32802
32870
  };
32803
32871
  }
32804
32872
 
32873
+ // src/protocol/escrow.ts
32874
+ var GENERIC_PAYMENT_TYPES = {
32875
+ GenericPayment: [
32876
+ { name: "payerAddress", type: "address" },
32877
+ { name: "opType", type: "string" },
32878
+ { name: "opId", type: "bytes32" },
32879
+ { name: "asset", type: "address" },
32880
+ { name: "amount", type: "uint256" },
32881
+ { name: "paymentNonce", type: "uint256" }
32882
+ ]
32883
+ };
32884
+ function genericPaymentDomain(chainId, escrowContract) {
32885
+ return {
32886
+ name: "Vana Data Portability",
32887
+ version: "1",
32888
+ chainId,
32889
+ verifyingContract: escrowContract
32890
+ };
32891
+ }
32892
+ var ESCROW_DEPOSIT_ABI = [
32893
+ {
32894
+ type: "function",
32895
+ name: "depositNative",
32896
+ stateMutability: "payable",
32897
+ inputs: [{ name: "account", type: "address" }],
32898
+ outputs: []
32899
+ },
32900
+ {
32901
+ type: "function",
32902
+ name: "depositToken",
32903
+ stateMutability: "nonpayable",
32904
+ inputs: [
32905
+ { name: "account", type: "address" },
32906
+ { name: "token", type: "address" },
32907
+ { name: "amount", type: "uint256" }
32908
+ ],
32909
+ outputs: []
32910
+ }
32911
+ ];
32912
+ var NATIVE_ASSET_ADDRESS = "0x0000000000000000000000000000000000000000";
32913
+ function createEscrowGatewayClient(baseUrl) {
32914
+ const base = baseUrl.replace(/\/+$/, "");
32915
+ async function throwOnError(res, context) {
32916
+ if (!res.ok) {
32917
+ let detail = "";
32918
+ try {
32919
+ const body = await res.json();
32920
+ if (body.error) detail = `: ${body.error}`;
32921
+ } catch {
32922
+ }
32923
+ throw new Error(
32924
+ `Escrow gateway error (${context}): ${res.status} ${res.statusText}${detail}`
32925
+ );
32926
+ }
32927
+ }
32928
+ return {
32929
+ async submitDeposit({ txHash }) {
32930
+ const res = await fetch(`${base}/v1/escrow/deposit`, {
32931
+ method: "POST",
32932
+ headers: { "Content-Type": "application/json" },
32933
+ body: JSON.stringify({ txHash })
32934
+ });
32935
+ if (res.status !== 200 && res.status !== 202) {
32936
+ await throwOnError(res, "POST /v1/escrow/deposit");
32937
+ }
32938
+ return res.json();
32939
+ },
32940
+ async getEscrowBalance(account) {
32941
+ const res = await fetch(
32942
+ `${base}/v1/escrow/balance?account=${encodeURIComponent(account)}`
32943
+ );
32944
+ await throwOnError(res, "GET /v1/escrow/balance");
32945
+ return res.json();
32946
+ },
32947
+ async syncEscrowBalance(account) {
32948
+ const res = await fetch(
32949
+ `${base}/v1/escrow/balance/sync?account=${encodeURIComponent(account)}`,
32950
+ { method: "POST" }
32951
+ );
32952
+ await throwOnError(res, "POST /v1/escrow/balance/sync");
32953
+ return res.json();
32954
+ },
32955
+ async payForOp({
32956
+ payerAddress,
32957
+ opType,
32958
+ opId,
32959
+ asset,
32960
+ amount,
32961
+ paymentNonce,
32962
+ signature
32963
+ }) {
32964
+ const res = await fetch(`${base}/v1/escrow/pay`, {
32965
+ method: "POST",
32966
+ headers: {
32967
+ "Content-Type": "application/json",
32968
+ Authorization: `Web3Signed ${signature}`
32969
+ },
32970
+ body: JSON.stringify({
32971
+ payerAddress,
32972
+ opType,
32973
+ opId,
32974
+ asset,
32975
+ amount,
32976
+ paymentNonce
32977
+ })
32978
+ });
32979
+ await throwOnError(res, "POST /v1/escrow/pay");
32980
+ return res.json();
32981
+ }
32982
+ };
32983
+ }
32984
+
32805
32985
  // src/types/ps-errors.ts
32806
32986
  var PSError = class extends Error {
32807
32987
  constructor(code, message) {
@@ -32879,9 +33059,11 @@ export {
32879
33059
  DataFileEnvelopeSchema,
32880
33060
  DropboxStorage,
32881
33061
  ECIESError,
33062
+ ESCROW_DEPOSIT_ABI,
32882
33063
  ExpiredTokenError,
32883
33064
  FILE_DELETION_TYPES,
32884
33065
  FILE_REGISTRATION_TYPES,
33066
+ GENERIC_PAYMENT_TYPES,
32885
33067
  GRANT_REGISTRATION_TYPES,
32886
33068
  GRANT_REVOCATION_TYPES,
32887
33069
  GoogleDriveStorage,
@@ -32892,6 +33074,7 @@ export {
32892
33074
  IpfsStorage,
32893
33075
  MASTER_KEY_MESSAGE,
32894
33076
  MissingAuthError,
33077
+ NATIVE_ASSET_ADDRESS,
32895
33078
  NetworkError,
32896
33079
  NonceError,
32897
33080
  OAuthClient,
@@ -32934,6 +33117,7 @@ export {
32934
33117
  contractCacheForTesting,
32935
33118
  createBrowserPlatformAdapter,
32936
33119
  createDataFileEnvelope,
33120
+ createEscrowGatewayClient,
32937
33121
  createGatewayClient,
32938
33122
  createPlatformAdapterSafe,
32939
33123
  createVanaStorageProvider,
@@ -32948,6 +33132,7 @@ export {
32948
33132
  fileDeletionDomain,
32949
33133
  fileRegistrationDomain,
32950
33134
  generatePkceVerifier,
33135
+ genericPaymentDomain,
32951
33136
  getAbi,
32952
33137
  getAllChains,
32953
33138
  getChainConfig,