@opendatalabs/vana-sdk 3.1.0 → 3.2.0-canary.a8087c5
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/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.js +2 -2
- 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 +8 -3
- package/dist/index.browser.js +706 -72
- package/dist/index.browser.js.map +4 -4
- package/dist/index.node.cjs +733 -73
- package/dist/index.node.cjs.map +4 -4
- package/dist/index.node.d.ts +8 -3
- package/dist/index.node.js +706 -72
- 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 +98 -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/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.js +10 -10
- 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.js +2 -2
- package/dist/types/index.js +2 -2
- package/dist/types.js +1 -1
- package/package.json +6 -3
package/dist/node.js
CHANGED
package/dist/platform/browser.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { getPGPKeyGenParams } from "./shared/pgp-utils";
|
|
2
|
-
import { wrapCryptoError } from "./shared/error-utils";
|
|
3
|
-
import { lazyImport } from "../utils/lazy-import";
|
|
4
|
-
import { WalletKeyEncryptionService } from "../crypto/services/WalletKeyEncryptionService";
|
|
5
|
-
import { parseEncryptedDataBuffer } from "../utils/crypto-utils";
|
|
1
|
+
import { getPGPKeyGenParams } from "./shared/pgp-utils.js";
|
|
2
|
+
import { wrapCryptoError } from "./shared/error-utils.js";
|
|
3
|
+
import { lazyImport } from "../utils/lazy-import.js";
|
|
4
|
+
import { WalletKeyEncryptionService } from "../crypto/services/WalletKeyEncryptionService.js";
|
|
5
|
+
import { parseEncryptedDataBuffer } from "../utils/crypto-utils.js";
|
|
6
6
|
import { toHex, fromHex, stringToBytes, bytesToString, concat } from "viem";
|
|
7
7
|
import * as secp256k1 from "@noble/secp256k1";
|
|
8
|
-
import { BrowserECIESUint8Provider } from "../crypto/ecies/browser";
|
|
8
|
+
import { BrowserECIESUint8Provider } from "../crypto/ecies/browser.js";
|
|
9
9
|
const getOpenPGP = lazyImport(() => import("openpgp"));
|
|
10
10
|
class BrowserCryptoAdapter {
|
|
11
11
|
eciesProvider = new BrowserECIESUint8Provider();
|
package/dist/platform/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { NodePlatformAdapter } from "./node";
|
|
2
|
-
import { BrowserPlatformAdapter } from "./browser";
|
|
1
|
+
import { NodePlatformAdapter } from "./node.js";
|
|
2
|
+
import { BrowserPlatformAdapter } from "./browser.js";
|
|
3
3
|
import {
|
|
4
4
|
detectPlatform,
|
|
5
5
|
createPlatformAdapter,
|
|
6
6
|
createPlatformAdapterFor,
|
|
7
7
|
isPlatformSupported,
|
|
8
8
|
getPlatformCapabilities
|
|
9
|
-
} from "./utils";
|
|
9
|
+
} from "./utils.js";
|
|
10
10
|
import {
|
|
11
11
|
createNodePlatformAdapter,
|
|
12
12
|
createBrowserPlatformAdapter,
|
|
13
13
|
createPlatformAdapterSafe
|
|
14
|
-
} from "./browser-safe";
|
|
14
|
+
} from "./browser-safe.js";
|
|
15
15
|
export {
|
|
16
16
|
BrowserPlatformAdapter,
|
|
17
17
|
NodePlatformAdapter,
|
package/dist/platform/node.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { getPGPKeyGenParams } from "./shared/pgp-utils";
|
|
2
|
-
import { wrapCryptoError } from "./shared/error-utils";
|
|
3
|
-
import { streamToUint8Array } from "./shared/stream-utils";
|
|
4
|
-
import { lazyImport } from "../utils/lazy-import";
|
|
5
|
-
import { WalletKeyEncryptionService } from "../crypto/services/WalletKeyEncryptionService";
|
|
1
|
+
import { getPGPKeyGenParams } from "./shared/pgp-utils.js";
|
|
2
|
+
import { wrapCryptoError } from "./shared/error-utils.js";
|
|
3
|
+
import { streamToUint8Array } from "./shared/stream-utils.js";
|
|
4
|
+
import { lazyImport } from "../utils/lazy-import.js";
|
|
5
|
+
import { WalletKeyEncryptionService } from "../crypto/services/WalletKeyEncryptionService.js";
|
|
6
6
|
import {
|
|
7
7
|
processWalletPrivateKey,
|
|
8
8
|
parseEncryptedDataBuffer,
|
|
9
9
|
processWalletPublicKey
|
|
10
|
-
} from "../utils/crypto-utils";
|
|
10
|
+
} from "../utils/crypto-utils.js";
|
|
11
11
|
const getOpenPGP = lazyImport(() => import("openpgp"));
|
|
12
|
-
import { NodeECIESUint8Provider } from "../crypto/ecies/node";
|
|
13
|
-
import { ECIESError } from "../crypto/ecies/interface";
|
|
12
|
+
import { NodeECIESUint8Provider } from "../crypto/ecies/node.js";
|
|
13
|
+
import { ECIESError } from "../crypto/ecies/interface.js";
|
|
14
14
|
import { randomBytes } from "crypto";
|
|
15
15
|
import secp256k1Import from "secp256k1";
|
|
16
16
|
class NodeCryptoAdapter {
|
package/dist/platform/utils.js
CHANGED
|
@@ -20,7 +20,7 @@ async function createPlatformAdapter() {
|
|
|
20
20
|
const { NodePlatformAdapter } = await import(moduleName);
|
|
21
21
|
return new NodePlatformAdapter();
|
|
22
22
|
} else {
|
|
23
|
-
const { BrowserPlatformAdapter } = await import("./browser");
|
|
23
|
+
const { BrowserPlatformAdapter } = await import("./browser.js");
|
|
24
24
|
return new BrowserPlatformAdapter();
|
|
25
25
|
}
|
|
26
26
|
} catch (error) {
|
|
@@ -41,7 +41,7 @@ async function createPlatformAdapterFor(platformType) {
|
|
|
41
41
|
const { NodePlatformAdapter } = await import(moduleName);
|
|
42
42
|
return new NodePlatformAdapter();
|
|
43
43
|
} else {
|
|
44
|
-
const { BrowserPlatformAdapter } = await import("./browser");
|
|
44
|
+
const { BrowserPlatformAdapter } = await import("./browser.js");
|
|
45
45
|
return new BrowserPlatformAdapter();
|
|
46
46
|
}
|
|
47
47
|
} catch (error) {
|
package/dist/platform.browser.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { BrowserPlatformAdapter } from "./platform/browser";
|
|
1
|
+
import { BrowserPlatformAdapter } from "./platform/browser.js";
|
|
2
2
|
import {
|
|
3
3
|
createBrowserPlatformAdapter,
|
|
4
4
|
createPlatformAdapterSafe
|
|
5
|
-
} from "./platform/browser-only";
|
|
5
|
+
} from "./platform/browser-only.js";
|
|
6
6
|
import {
|
|
7
7
|
detectPlatform,
|
|
8
8
|
isPlatformSupported,
|
|
9
9
|
getPlatformCapabilities
|
|
10
|
-
} from "./platform/utils";
|
|
10
|
+
} from "./platform/utils.js";
|
|
11
11
|
export {
|
|
12
12
|
BrowserPlatformAdapter,
|
|
13
13
|
createBrowserPlatformAdapter,
|
package/dist/platform.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { BrowserPlatformAdapter } from "./platform/browser";
|
|
2
|
-
import { NodePlatformAdapter } from "./platform/node";
|
|
1
|
+
import { BrowserPlatformAdapter } from "./platform/browser.js";
|
|
2
|
+
import { NodePlatformAdapter } from "./platform/node.js";
|
|
3
3
|
import {
|
|
4
4
|
detectPlatform,
|
|
5
5
|
createPlatformAdapter,
|
|
6
6
|
createPlatformAdapterFor,
|
|
7
7
|
isPlatformSupported,
|
|
8
8
|
getPlatformCapabilities
|
|
9
|
-
} from "./platform/utils";
|
|
9
|
+
} from "./platform/utils.js";
|
|
10
10
|
import {
|
|
11
11
|
createNodePlatformAdapter,
|
|
12
12
|
createBrowserPlatformAdapter,
|
|
13
13
|
createPlatformAdapterSafe
|
|
14
|
-
} from "./platform/browser-safe";
|
|
14
|
+
} from "./platform/browser-safe.js";
|
|
15
15
|
export {
|
|
16
16
|
BrowserPlatformAdapter,
|
|
17
17
|
NodePlatformAdapter,
|
package/dist/platform.node.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { BrowserPlatformAdapter } from "./platform/browser";
|
|
2
|
-
import { NodePlatformAdapter } from "./platform/node";
|
|
1
|
+
import { BrowserPlatformAdapter } from "./platform/browser.js";
|
|
2
|
+
import { NodePlatformAdapter } from "./platform/node.js";
|
|
3
3
|
import {
|
|
4
4
|
detectPlatform,
|
|
5
5
|
createPlatformAdapter,
|
|
6
6
|
createPlatformAdapterFor,
|
|
7
7
|
isPlatformSupported,
|
|
8
8
|
getPlatformCapabilities
|
|
9
|
-
} from "./platform/utils";
|
|
9
|
+
} from "./platform/utils.js";
|
|
10
10
|
import {
|
|
11
11
|
createNodePlatformAdapter,
|
|
12
12
|
createBrowserPlatformAdapter,
|
|
13
13
|
createPlatformAdapterSafe
|
|
14
|
-
} from "./platform/browser-safe";
|
|
14
|
+
} from "./platform/browser-safe.js";
|
|
15
15
|
export {
|
|
16
16
|
BrowserPlatformAdapter,
|
|
17
17
|
NodePlatformAdapter,
|
package/dist/protocol/eip712.cjs
CHANGED
|
@@ -18,12 +18,18 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var eip712_exports = {};
|
|
20
20
|
__export(eip712_exports, {
|
|
21
|
+
ADD_DATA_TYPES: () => ADD_DATA_TYPES,
|
|
21
22
|
BUILDER_REGISTRATION_TYPES: () => BUILDER_REGISTRATION_TYPES,
|
|
22
23
|
FILE_REGISTRATION_TYPES: () => FILE_REGISTRATION_TYPES,
|
|
24
|
+
GENERIC_PAYMENT_TYPES: () => GENERIC_PAYMENT_TYPES,
|
|
23
25
|
GRANT_REGISTRATION_TYPES: () => GRANT_REGISTRATION_TYPES,
|
|
24
26
|
GRANT_REVOCATION_TYPES: () => GRANT_REVOCATION_TYPES,
|
|
27
|
+
NATIVE_VANA_ASSET: () => NATIVE_VANA_ASSET,
|
|
28
|
+
RECORD_DATA_ACCESS_TYPES: () => RECORD_DATA_ACCESS_TYPES,
|
|
25
29
|
SERVER_REGISTRATION_TYPES: () => SERVER_REGISTRATION_TYPES,
|
|
26
30
|
builderRegistrationDomain: () => builderRegistrationDomain,
|
|
31
|
+
dataRegistryDomain: () => dataRegistryDomain,
|
|
32
|
+
escrowPaymentDomain: () => escrowPaymentDomain,
|
|
27
33
|
fileRegistrationDomain: () => fileRegistrationDomain,
|
|
28
34
|
grantRegistrationDomain: () => grantRegistrationDomain,
|
|
29
35
|
grantRevocationDomain: () => grantRevocationDomain,
|
|
@@ -32,6 +38,7 @@ __export(eip712_exports, {
|
|
|
32
38
|
module.exports = __toCommonJS(eip712_exports);
|
|
33
39
|
const DOMAIN_NAME = "Vana Data Portability";
|
|
34
40
|
const DOMAIN_VERSION = "1";
|
|
41
|
+
const NATIVE_VANA_ASSET = "0x0000000000000000000000000000000000000000";
|
|
35
42
|
function buildDomain(chainId, verifyingContract) {
|
|
36
43
|
return {
|
|
37
44
|
name: DOMAIN_NAME,
|
|
@@ -46,6 +53,12 @@ function fileRegistrationDomain(config) {
|
|
|
46
53
|
config.contracts.dataRegistry
|
|
47
54
|
);
|
|
48
55
|
}
|
|
56
|
+
function dataRegistryDomain(config) {
|
|
57
|
+
return buildDomain(
|
|
58
|
+
config.chainId,
|
|
59
|
+
config.contracts.dataRegistry
|
|
60
|
+
);
|
|
61
|
+
}
|
|
49
62
|
function grantRegistrationDomain(config) {
|
|
50
63
|
return buildDomain(
|
|
51
64
|
config.chainId,
|
|
@@ -70,6 +83,12 @@ function builderRegistrationDomain(config) {
|
|
|
70
83
|
config.contracts.dataPortabilityGrantees
|
|
71
84
|
);
|
|
72
85
|
}
|
|
86
|
+
function escrowPaymentDomain(config) {
|
|
87
|
+
return buildDomain(
|
|
88
|
+
config.chainId,
|
|
89
|
+
config.contracts.dataPortabilityEscrow
|
|
90
|
+
);
|
|
91
|
+
}
|
|
73
92
|
const FILE_REGISTRATION_TYPES = {
|
|
74
93
|
FileRegistration: [
|
|
75
94
|
{ name: "ownerAddress", type: "address" },
|
|
@@ -81,14 +100,16 @@ const GRANT_REGISTRATION_TYPES = {
|
|
|
81
100
|
GrantRegistration: [
|
|
82
101
|
{ name: "grantorAddress", type: "address" },
|
|
83
102
|
{ name: "granteeId", type: "bytes32" },
|
|
84
|
-
{ name: "
|
|
85
|
-
{ name: "
|
|
103
|
+
{ name: "scopes", type: "string[]" },
|
|
104
|
+
{ name: "grantVersion", type: "uint256" },
|
|
105
|
+
{ name: "expiresAt", type: "uint256" }
|
|
86
106
|
]
|
|
87
107
|
};
|
|
88
108
|
const GRANT_REVOCATION_TYPES = {
|
|
89
109
|
GrantRevocation: [
|
|
90
110
|
{ name: "grantorAddress", type: "address" },
|
|
91
|
-
{ name: "grantId", type: "bytes32" }
|
|
111
|
+
{ name: "grantId", type: "bytes32" },
|
|
112
|
+
{ name: "grantVersion", type: "uint256" }
|
|
92
113
|
]
|
|
93
114
|
};
|
|
94
115
|
const SERVER_REGISTRATION_TYPES = {
|
|
@@ -107,14 +128,48 @@ const BUILDER_REGISTRATION_TYPES = {
|
|
|
107
128
|
{ name: "appUrl", type: "string" }
|
|
108
129
|
]
|
|
109
130
|
};
|
|
131
|
+
const GENERIC_PAYMENT_TYPES = {
|
|
132
|
+
GenericPayment: [
|
|
133
|
+
{ name: "payerAddress", type: "address" },
|
|
134
|
+
{ name: "opType", type: "string" },
|
|
135
|
+
{ name: "opId", type: "bytes32" },
|
|
136
|
+
{ name: "asset", type: "address" },
|
|
137
|
+
{ name: "amount", type: "uint256" },
|
|
138
|
+
{ name: "paymentNonce", type: "uint256" }
|
|
139
|
+
]
|
|
140
|
+
};
|
|
141
|
+
const ADD_DATA_TYPES = {
|
|
142
|
+
AddData: [
|
|
143
|
+
{ name: "ownerAddress", type: "address" },
|
|
144
|
+
{ name: "scope", type: "string" },
|
|
145
|
+
{ name: "dataHash", type: "bytes32" },
|
|
146
|
+
{ name: "metadataHash", type: "bytes32" },
|
|
147
|
+
{ name: "expectedVersion", type: "uint256" }
|
|
148
|
+
]
|
|
149
|
+
};
|
|
150
|
+
const RECORD_DATA_ACCESS_TYPES = {
|
|
151
|
+
RecordDataAccess: [
|
|
152
|
+
{ name: "ownerAddress", type: "address" },
|
|
153
|
+
{ name: "scope", type: "string" },
|
|
154
|
+
{ name: "version", type: "uint256" },
|
|
155
|
+
{ name: "accessor", type: "address" },
|
|
156
|
+
{ name: "recordId", type: "bytes32" }
|
|
157
|
+
]
|
|
158
|
+
};
|
|
110
159
|
// Annotate the CommonJS export names for ESM import in node:
|
|
111
160
|
0 && (module.exports = {
|
|
161
|
+
ADD_DATA_TYPES,
|
|
112
162
|
BUILDER_REGISTRATION_TYPES,
|
|
113
163
|
FILE_REGISTRATION_TYPES,
|
|
164
|
+
GENERIC_PAYMENT_TYPES,
|
|
114
165
|
GRANT_REGISTRATION_TYPES,
|
|
115
166
|
GRANT_REVOCATION_TYPES,
|
|
167
|
+
NATIVE_VANA_ASSET,
|
|
168
|
+
RECORD_DATA_ACCESS_TYPES,
|
|
116
169
|
SERVER_REGISTRATION_TYPES,
|
|
117
170
|
builderRegistrationDomain,
|
|
171
|
+
dataRegistryDomain,
|
|
172
|
+
escrowPaymentDomain,
|
|
118
173
|
fileRegistrationDomain,
|
|
119
174
|
grantRegistrationDomain,
|
|
120
175
|
grantRevocationDomain,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/protocol/eip712.ts"],"sourcesContent":["/**\n * EIP-712 domain and type builders for Data Portability protocol writes.\n *\n * These helpers are shared primitives only. Personal Server runtimes own when\n * to sign and submit these payloads.\n *\n * @category Protocol\n */\n\nimport type { TypedDataDomain } from \"viem\";\n\nconst DOMAIN_NAME = \"Vana Data Portability\";\nconst DOMAIN_VERSION = \"1\";\n\nexport interface DataPortabilityContracts {\n dataRegistry: string;\n dataPortabilityPermissions: string;\n dataPortabilityServer: string;\n dataPortabilityGrantees: string;\n}\n\nexport interface DataPortabilityGatewayConfig {\n chainId: number;\n contracts: DataPortabilityContracts;\n}\n\nfunction buildDomain(\n chainId: number,\n verifyingContract: `0x${string}`,\n): TypedDataDomain {\n return {\n name: DOMAIN_NAME,\n version: DOMAIN_VERSION,\n chainId,\n verifyingContract,\n };\n}\n\nexport function fileRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataRegistry as `0x${string}`,\n );\n}\n\nexport function grantRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityPermissions as `0x${string}`,\n );\n}\n\nexport function grantRevocationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityPermissions as `0x${string}`,\n );\n}\n\nexport function serverRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityServer as `0x${string}`,\n );\n}\n\nexport function builderRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityGrantees as `0x${string}`,\n );\n}\n\nexport const FILE_REGISTRATION_TYPES = {\n FileRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"url\", type: \"string\" },\n { name: \"schemaId\", type: \"bytes32\" },\n ],\n} as const;\n\nexport const GRANT_REGISTRATION_TYPES = {\n GrantRegistration: [\n { name: \"grantorAddress\", type: \"address\" },\n { name: \"granteeId\", type: \"bytes32\" },\n { name: \"grant\", type: \"string\" },\n { name: \"fileIds\", type: \"uint256[]\" },\n ],\n} as const;\n\nexport const GRANT_REVOCATION_TYPES = {\n GrantRevocation: [\n { name: \"grantorAddress\", type: \"address\" },\n { name: \"grantId\", type: \"bytes32\" },\n ],\n} as const;\n\nexport const SERVER_REGISTRATION_TYPES = {\n ServerRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"serverAddress\", type: \"address\" },\n { name: \"publicKey\", type: \"string\" },\n { name: \"serverUrl\", type: \"string\" },\n ],\n} as const;\n\nexport const BUILDER_REGISTRATION_TYPES = {\n BuilderRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"granteeAddress\", type: \"address\" },\n { name: \"publicKey\", type: \"string\" },\n { name: \"appUrl\", type: \"string\" },\n ],\n} as const;\n\nexport interface FileRegistrationMessage {\n ownerAddress: `0x${string}`;\n url: string;\n schemaId: `0x${string}`;\n}\n\nexport interface GrantRegistrationMessage {\n grantorAddress: `0x${string}`;\n granteeId: `0x${string}`;\n grant: string;\n fileIds: bigint[];\n}\n\nexport interface GrantRevocationMessage {\n grantorAddress: `0x${string}`;\n grantId: `0x${string}`;\n}\n\nexport interface ServerRegistrationMessage {\n ownerAddress: `0x${string}`;\n serverAddress: `0x${string}`;\n publicKey: `0x${string}`;\n serverUrl: string;\n}\n\nexport interface BuilderRegistrationMessage {\n ownerAddress: `0x${string}`;\n granteeAddress: `0x${string}`;\n publicKey: string;\n appUrl: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,MAAM,cAAc;AACpB,MAAM,iBAAiB;AAcvB,SAAS,YACP,SACA,mBACiB;AACjB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,uBACd,QACiB;AACjB,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,UAAU;AAAA,EACnB;AACF;AAEO,SAAS,wBACd,QACiB;AACjB,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,UAAU;AAAA,EACnB;AACF;AAEO,SAAS,sBACd,QACiB;AACjB,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,UAAU;AAAA,EACnB;AACF;AAEO,SAAS,yBACd,QACiB;AACjB,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,UAAU;AAAA,EACnB;AACF;AAEO,SAAS,0BACd,QACiB;AACjB,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,UAAU;AAAA,EACnB;AACF;AAEO,MAAM,0BAA0B;AAAA,EACrC,kBAAkB;AAAA,IAChB,EAAE,MAAM,gBAAgB,MAAM,UAAU;AAAA,IACxC,EAAE,MAAM,OAAO,MAAM,SAAS;AAAA,IAC9B,EAAE,MAAM,YAAY,MAAM,UAAU;AAAA,EACtC;AACF;AAEO,MAAM,2BAA2B;AAAA,EACtC,mBAAmB;AAAA,IACjB,EAAE,MAAM,kBAAkB,MAAM,UAAU;AAAA,IAC1C,EAAE,MAAM,aAAa,MAAM,UAAU;AAAA,IACrC,EAAE,MAAM,SAAS,MAAM,SAAS;AAAA,IAChC,EAAE,MAAM,WAAW,MAAM,YAAY;AAAA,EACvC;AACF;AAEO,MAAM,yBAAyB;AAAA,EACpC,iBAAiB;AAAA,IACf,EAAE,MAAM,kBAAkB,MAAM,UAAU;AAAA,IAC1C,EAAE,MAAM,WAAW,MAAM,UAAU;AAAA,EACrC;AACF;AAEO,MAAM,4BAA4B;AAAA,EACvC,oBAAoB;AAAA,IAClB,EAAE,MAAM,gBAAgB,MAAM,UAAU;AAAA,IACxC,EAAE,MAAM,iBAAiB,MAAM,UAAU;AAAA,IACzC,EAAE,MAAM,aAAa,MAAM,SAAS;AAAA,IACpC,EAAE,MAAM,aAAa,MAAM,SAAS;AAAA,EACtC;AACF;AAEO,MAAM,6BAA6B;AAAA,EACxC,qBAAqB;AAAA,IACnB,EAAE,MAAM,gBAAgB,MAAM,UAAU;AAAA,IACxC,EAAE,MAAM,kBAAkB,MAAM,UAAU;AAAA,IAC1C,EAAE,MAAM,aAAa,MAAM,SAAS;AAAA,IACpC,EAAE,MAAM,UAAU,MAAM,SAAS;AAAA,EACnC;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/protocol/eip712.ts"],"sourcesContent":["/**\n * EIP-712 domain and type builders for Data Portability protocol writes.\n *\n * These helpers are shared primitives only. Personal Server runtimes own when\n * to sign and submit these payloads.\n *\n * @category Protocol\n */\n\nimport type { TypedDataDomain } from \"viem\";\n\nconst DOMAIN_NAME = \"Vana Data Portability\";\nconst DOMAIN_VERSION = \"1\";\n\nexport interface DataPortabilityContracts {\n dataRegistry: string;\n dataPortabilityPermissions: string;\n dataPortabilityServer: string;\n dataPortabilityGrantees: string;\n // DataPortabilityEscrow — verifies GENERIC_PAYMENT_TYPES signatures backing\n // /v1/escrow/pay (the data-access payment path).\n dataPortabilityEscrow: string;\n}\n\n// Native VANA asset sentinel used by /v1/escrow/pay's `asset` field — pay any\n// other ERC-20 by passing its contract address instead.\nexport const NATIVE_VANA_ASSET =\n \"0x0000000000000000000000000000000000000000\" as const;\n\nexport interface DataPortabilityGatewayConfig {\n chainId: number;\n contracts: DataPortabilityContracts;\n}\n\nfunction buildDomain(\n chainId: number,\n verifyingContract: `0x${string}`,\n): TypedDataDomain {\n return {\n name: DOMAIN_NAME,\n version: DOMAIN_VERSION,\n chainId,\n verifyingContract,\n };\n}\n\nexport function fileRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataRegistry as `0x${string}`,\n );\n}\n\n// Domain for the DataRegistryV2 contract — verifies the AddData and\n// RecordDataAccess EIP-712 signatures. The verifyingContract is the same as\n// `fileRegistrationDomain` (both point at `dataRegistry`); the distinction\n// lives in the primaryType, not the domain. Exported as a separate helper\n// so callers reading data-point flows aren't routed through a name that\n// reads as file-registration-only.\nexport function dataRegistryDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataRegistry as `0x${string}`,\n );\n}\n\nexport function grantRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityPermissions as `0x${string}`,\n );\n}\n\nexport function grantRevocationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityPermissions as `0x${string}`,\n );\n}\n\nexport function serverRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityServer as `0x${string}`,\n );\n}\n\nexport function builderRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityGrantees as `0x${string}`,\n );\n}\n\n// Domain for the generic-payment EIP-712 signature consumed by\n// /v1/escrow/pay. The verifyingContract is the escrow itself (not the per-op\n// contract), so a single signature debits the payer's escrow balance for any\n// supported op — `grant` today; file/builder/schema in the future.\nexport function escrowPaymentDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityEscrow as `0x${string}`,\n );\n}\n\nexport const FILE_REGISTRATION_TYPES = {\n FileRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"url\", type: \"string\" },\n { name: \"schemaId\", type: \"bytes32\" },\n ],\n} as const;\n\n// grantVersion is a monotonic uint256 nonce per (grantor, grantee) pair. The\n// gateway rejects any registration whose version is <= the stored value,\n// which is the replay-attack defence now that re-registering the same pair\n// is a permitted override. expiresAt is unix seconds; 0 = no expiry.\nexport const GRANT_REGISTRATION_TYPES = {\n GrantRegistration: [\n { name: \"grantorAddress\", type: \"address\" },\n { name: \"granteeId\", type: \"bytes32\" },\n { name: \"scopes\", type: \"string[]\" },\n { name: \"grantVersion\", type: \"uint256\" },\n { name: \"expiresAt\", type: \"uint256\" },\n ],\n} as const;\n\n// Revocation shares the (grantor, grantee) monotonic nonce with registration —\n// both events advance the same grantVersion counter so an old revocation sig\n// can't be replayed across a revoke → re-register cycle.\nexport const GRANT_REVOCATION_TYPES = {\n GrantRevocation: [\n { name: \"grantorAddress\", type: \"address\" },\n { name: \"grantId\", type: \"bytes32\" },\n { name: \"grantVersion\", type: \"uint256\" },\n ],\n} as const;\n\nexport const SERVER_REGISTRATION_TYPES = {\n ServerRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"serverAddress\", type: \"address\" },\n { name: \"publicKey\", type: \"string\" },\n { name: \"serverUrl\", type: \"string\" },\n ],\n} as const;\n\nexport const BUILDER_REGISTRATION_TYPES = {\n BuilderRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"granteeAddress\", type: \"address\" },\n { name: \"publicKey\", type: \"string\" },\n { name: \"appUrl\", type: \"string\" },\n ],\n} as const;\n\n// Generic payment for the escrow flow. The (opType, opId) pair routes the\n// debit to the right op-row; paymentNonce is per-payer monotonic so the same\n// signed message can't be replayed after a revoke + re-register cycle.\n//\n// Today opType is always 'grant' and opId is the bytes32 grantId.\nexport const GENERIC_PAYMENT_TYPES = {\n GenericPayment: [\n { name: \"payerAddress\", type: \"address\" },\n { name: \"opType\", type: \"string\" },\n { name: \"opId\", type: \"bytes32\" },\n { name: \"asset\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"paymentNonce\", type: \"uint256\" },\n ],\n} as const;\n\n// AddData is signed by the data point's owner — registers (scope, dataHash,\n// metadataHash) on DataRegistryV2. expectedVersion is the version the caller\n// believes is current; the contract rejects with a CAS error if it isn't.\n// Used at POST /v1/data.\nexport const ADD_DATA_TYPES = {\n AddData: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"scope\", type: \"string\" },\n { name: \"dataHash\", type: \"bytes32\" },\n { name: \"metadataHash\", type: \"bytes32\" },\n { name: \"expectedVersion\", type: \"uint256\" },\n ],\n} as const;\n\n// RecordDataAccess is signed by a *trusted personal server* of `ownerAddress`\n// — attests that (scope, version) was served to `accessor`. recordId is a\n// per-event bytes32 the contract pins in `_usedRecordIds` to prevent replay.\n// Used as the optional `accessRecord` on POST /v1/escrow/pay.\nexport const RECORD_DATA_ACCESS_TYPES = {\n RecordDataAccess: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"scope\", type: \"string\" },\n { name: \"version\", type: \"uint256\" },\n { name: \"accessor\", type: \"address\" },\n { name: \"recordId\", type: \"bytes32\" },\n ],\n} as const;\n\nexport interface FileRegistrationMessage {\n ownerAddress: `0x${string}`;\n url: string;\n schemaId: `0x${string}`;\n}\n\nexport interface GrantRegistrationMessage {\n grantorAddress: `0x${string}`;\n granteeId: `0x${string}`;\n scopes: string[];\n grantVersion: bigint;\n expiresAt: bigint;\n}\n\nexport interface GrantRevocationMessage {\n grantorAddress: `0x${string}`;\n grantId: `0x${string}`;\n grantVersion: bigint;\n}\n\nexport interface ServerRegistrationMessage {\n ownerAddress: `0x${string}`;\n serverAddress: `0x${string}`;\n publicKey: string;\n serverUrl: string;\n}\n\nexport interface BuilderRegistrationMessage {\n ownerAddress: `0x${string}`;\n granteeAddress: `0x${string}`;\n publicKey: string;\n appUrl: string;\n}\n\nexport interface GenericPaymentMessage {\n payerAddress: `0x${string}`;\n // 'grant' today — extensible to 'file' | 'builder' | 'schema' as those\n // op-types become payable. Sent verbatim over the wire and into the\n // typed-data string field, so callers must match the gateway's spelling.\n opType: string;\n opId: `0x${string}`;\n // NATIVE_VANA_ASSET for native VANA; an ERC-20 contract address otherwise.\n asset: `0x${string}`;\n amount: bigint;\n paymentNonce: bigint;\n}\n\nexport interface AddDataMessage {\n ownerAddress: `0x${string}`;\n scope: string;\n dataHash: `0x${string}`;\n metadataHash: `0x${string}`;\n expectedVersion: bigint;\n}\n\nexport interface RecordDataAccessMessage {\n ownerAddress: `0x${string}`;\n scope: string;\n version: bigint;\n accessor: `0x${string}`;\n recordId: `0x${string}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,MAAM,cAAc;AACpB,MAAM,iBAAiB;AAchB,MAAM,oBACX;AAOF,SAAS,YACP,SACA,mBACiB;AACjB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,uBACd,QACiB;AACjB,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,UAAU;AAAA,EACnB;AACF;AAQO,SAAS,mBACd,QACiB;AACjB,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,UAAU;AAAA,EACnB;AACF;AAEO,SAAS,wBACd,QACiB;AACjB,SAAO;AAAA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dataPortabilityPermissions: string;
|
|
13
13
|
dataPortabilityServer: string;
|
|
14
14
|
dataPortabilityGrantees: string;
|
|
15
|
+
dataPortabilityEscrow: string;
|
|
15
16
|
}
|
|
17
|
+
export declare const NATIVE_VANA_ASSET: "0x0000000000000000000000000000000000000000";
|
|
16
18
|
export interface DataPortabilityGatewayConfig {
|
|
17
19
|
chainId: number;
|
|
18
20
|
contracts: DataPortabilityContracts;
|
|
19
21
|
}
|
|
20
22
|
export declare function fileRegistrationDomain(config: DataPortabilityGatewayConfig): TypedDataDomain;
|
|
23
|
+
export declare function dataRegistryDomain(config: DataPortabilityGatewayConfig): TypedDataDomain;
|
|
21
24
|
export declare function grantRegistrationDomain(config: DataPortabilityGatewayConfig): TypedDataDomain;
|
|
22
25
|
export declare function grantRevocationDomain(config: DataPortabilityGatewayConfig): TypedDataDomain;
|
|
23
26
|
export declare function serverRegistrationDomain(config: DataPortabilityGatewayConfig): TypedDataDomain;
|
|
24
27
|
export declare function builderRegistrationDomain(config: DataPortabilityGatewayConfig): TypedDataDomain;
|
|
28
|
+
export declare function escrowPaymentDomain(config: DataPortabilityGatewayConfig): TypedDataDomain;
|
|
25
29
|
export declare const FILE_REGISTRATION_TYPES: {
|
|
26
30
|
readonly FileRegistration: readonly [{
|
|
27
31
|
readonly name: "ownerAddress";
|
|
@@ -42,11 +46,14 @@ export declare const GRANT_REGISTRATION_TYPES: {
|
|
|
42
46
|
readonly name: "granteeId";
|
|
43
47
|
readonly type: "bytes32";
|
|
44
48
|
}, {
|
|
45
|
-
readonly name: "
|
|
46
|
-
readonly type: "string";
|
|
49
|
+
readonly name: "scopes";
|
|
50
|
+
readonly type: "string[]";
|
|
51
|
+
}, {
|
|
52
|
+
readonly name: "grantVersion";
|
|
53
|
+
readonly type: "uint256";
|
|
47
54
|
}, {
|
|
48
|
-
readonly name: "
|
|
49
|
-
readonly type: "uint256
|
|
55
|
+
readonly name: "expiresAt";
|
|
56
|
+
readonly type: "uint256";
|
|
50
57
|
}];
|
|
51
58
|
};
|
|
52
59
|
export declare const GRANT_REVOCATION_TYPES: {
|
|
@@ -56,6 +63,9 @@ export declare const GRANT_REVOCATION_TYPES: {
|
|
|
56
63
|
}, {
|
|
57
64
|
readonly name: "grantId";
|
|
58
65
|
readonly type: "bytes32";
|
|
66
|
+
}, {
|
|
67
|
+
readonly name: "grantVersion";
|
|
68
|
+
readonly type: "uint256";
|
|
59
69
|
}];
|
|
60
70
|
};
|
|
61
71
|
export declare const SERVER_REGISTRATION_TYPES: {
|
|
@@ -88,6 +98,63 @@ export declare const BUILDER_REGISTRATION_TYPES: {
|
|
|
88
98
|
readonly type: "string";
|
|
89
99
|
}];
|
|
90
100
|
};
|
|
101
|
+
export declare const GENERIC_PAYMENT_TYPES: {
|
|
102
|
+
readonly GenericPayment: readonly [{
|
|
103
|
+
readonly name: "payerAddress";
|
|
104
|
+
readonly type: "address";
|
|
105
|
+
}, {
|
|
106
|
+
readonly name: "opType";
|
|
107
|
+
readonly type: "string";
|
|
108
|
+
}, {
|
|
109
|
+
readonly name: "opId";
|
|
110
|
+
readonly type: "bytes32";
|
|
111
|
+
}, {
|
|
112
|
+
readonly name: "asset";
|
|
113
|
+
readonly type: "address";
|
|
114
|
+
}, {
|
|
115
|
+
readonly name: "amount";
|
|
116
|
+
readonly type: "uint256";
|
|
117
|
+
}, {
|
|
118
|
+
readonly name: "paymentNonce";
|
|
119
|
+
readonly type: "uint256";
|
|
120
|
+
}];
|
|
121
|
+
};
|
|
122
|
+
export declare const ADD_DATA_TYPES: {
|
|
123
|
+
readonly AddData: readonly [{
|
|
124
|
+
readonly name: "ownerAddress";
|
|
125
|
+
readonly type: "address";
|
|
126
|
+
}, {
|
|
127
|
+
readonly name: "scope";
|
|
128
|
+
readonly type: "string";
|
|
129
|
+
}, {
|
|
130
|
+
readonly name: "dataHash";
|
|
131
|
+
readonly type: "bytes32";
|
|
132
|
+
}, {
|
|
133
|
+
readonly name: "metadataHash";
|
|
134
|
+
readonly type: "bytes32";
|
|
135
|
+
}, {
|
|
136
|
+
readonly name: "expectedVersion";
|
|
137
|
+
readonly type: "uint256";
|
|
138
|
+
}];
|
|
139
|
+
};
|
|
140
|
+
export declare const RECORD_DATA_ACCESS_TYPES: {
|
|
141
|
+
readonly RecordDataAccess: readonly [{
|
|
142
|
+
readonly name: "ownerAddress";
|
|
143
|
+
readonly type: "address";
|
|
144
|
+
}, {
|
|
145
|
+
readonly name: "scope";
|
|
146
|
+
readonly type: "string";
|
|
147
|
+
}, {
|
|
148
|
+
readonly name: "version";
|
|
149
|
+
readonly type: "uint256";
|
|
150
|
+
}, {
|
|
151
|
+
readonly name: "accessor";
|
|
152
|
+
readonly type: "address";
|
|
153
|
+
}, {
|
|
154
|
+
readonly name: "recordId";
|
|
155
|
+
readonly type: "bytes32";
|
|
156
|
+
}];
|
|
157
|
+
};
|
|
91
158
|
export interface FileRegistrationMessage {
|
|
92
159
|
ownerAddress: `0x${string}`;
|
|
93
160
|
url: string;
|
|
@@ -96,17 +163,19 @@ export interface FileRegistrationMessage {
|
|
|
96
163
|
export interface GrantRegistrationMessage {
|
|
97
164
|
grantorAddress: `0x${string}`;
|
|
98
165
|
granteeId: `0x${string}`;
|
|
99
|
-
|
|
100
|
-
|
|
166
|
+
scopes: string[];
|
|
167
|
+
grantVersion: bigint;
|
|
168
|
+
expiresAt: bigint;
|
|
101
169
|
}
|
|
102
170
|
export interface GrantRevocationMessage {
|
|
103
171
|
grantorAddress: `0x${string}`;
|
|
104
172
|
grantId: `0x${string}`;
|
|
173
|
+
grantVersion: bigint;
|
|
105
174
|
}
|
|
106
175
|
export interface ServerRegistrationMessage {
|
|
107
176
|
ownerAddress: `0x${string}`;
|
|
108
177
|
serverAddress: `0x${string}`;
|
|
109
|
-
publicKey:
|
|
178
|
+
publicKey: string;
|
|
110
179
|
serverUrl: string;
|
|
111
180
|
}
|
|
112
181
|
export interface BuilderRegistrationMessage {
|
|
@@ -115,3 +184,25 @@ export interface BuilderRegistrationMessage {
|
|
|
115
184
|
publicKey: string;
|
|
116
185
|
appUrl: string;
|
|
117
186
|
}
|
|
187
|
+
export interface GenericPaymentMessage {
|
|
188
|
+
payerAddress: `0x${string}`;
|
|
189
|
+
opType: string;
|
|
190
|
+
opId: `0x${string}`;
|
|
191
|
+
asset: `0x${string}`;
|
|
192
|
+
amount: bigint;
|
|
193
|
+
paymentNonce: bigint;
|
|
194
|
+
}
|
|
195
|
+
export interface AddDataMessage {
|
|
196
|
+
ownerAddress: `0x${string}`;
|
|
197
|
+
scope: string;
|
|
198
|
+
dataHash: `0x${string}`;
|
|
199
|
+
metadataHash: `0x${string}`;
|
|
200
|
+
expectedVersion: bigint;
|
|
201
|
+
}
|
|
202
|
+
export interface RecordDataAccessMessage {
|
|
203
|
+
ownerAddress: `0x${string}`;
|
|
204
|
+
scope: string;
|
|
205
|
+
version: bigint;
|
|
206
|
+
accessor: `0x${string}`;
|
|
207
|
+
recordId: `0x${string}`;
|
|
208
|
+
}
|
package/dist/protocol/eip712.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const DOMAIN_NAME = "Vana Data Portability";
|
|
2
2
|
const DOMAIN_VERSION = "1";
|
|
3
|
+
const NATIVE_VANA_ASSET = "0x0000000000000000000000000000000000000000";
|
|
3
4
|
function buildDomain(chainId, verifyingContract) {
|
|
4
5
|
return {
|
|
5
6
|
name: DOMAIN_NAME,
|
|
@@ -14,6 +15,12 @@ function fileRegistrationDomain(config) {
|
|
|
14
15
|
config.contracts.dataRegistry
|
|
15
16
|
);
|
|
16
17
|
}
|
|
18
|
+
function dataRegistryDomain(config) {
|
|
19
|
+
return buildDomain(
|
|
20
|
+
config.chainId,
|
|
21
|
+
config.contracts.dataRegistry
|
|
22
|
+
);
|
|
23
|
+
}
|
|
17
24
|
function grantRegistrationDomain(config) {
|
|
18
25
|
return buildDomain(
|
|
19
26
|
config.chainId,
|
|
@@ -38,6 +45,12 @@ function builderRegistrationDomain(config) {
|
|
|
38
45
|
config.contracts.dataPortabilityGrantees
|
|
39
46
|
);
|
|
40
47
|
}
|
|
48
|
+
function escrowPaymentDomain(config) {
|
|
49
|
+
return buildDomain(
|
|
50
|
+
config.chainId,
|
|
51
|
+
config.contracts.dataPortabilityEscrow
|
|
52
|
+
);
|
|
53
|
+
}
|
|
41
54
|
const FILE_REGISTRATION_TYPES = {
|
|
42
55
|
FileRegistration: [
|
|
43
56
|
{ name: "ownerAddress", type: "address" },
|
|
@@ -49,14 +62,16 @@ const GRANT_REGISTRATION_TYPES = {
|
|
|
49
62
|
GrantRegistration: [
|
|
50
63
|
{ name: "grantorAddress", type: "address" },
|
|
51
64
|
{ name: "granteeId", type: "bytes32" },
|
|
52
|
-
{ name: "
|
|
53
|
-
{ name: "
|
|
65
|
+
{ name: "scopes", type: "string[]" },
|
|
66
|
+
{ name: "grantVersion", type: "uint256" },
|
|
67
|
+
{ name: "expiresAt", type: "uint256" }
|
|
54
68
|
]
|
|
55
69
|
};
|
|
56
70
|
const GRANT_REVOCATION_TYPES = {
|
|
57
71
|
GrantRevocation: [
|
|
58
72
|
{ name: "grantorAddress", type: "address" },
|
|
59
|
-
{ name: "grantId", type: "bytes32" }
|
|
73
|
+
{ name: "grantId", type: "bytes32" },
|
|
74
|
+
{ name: "grantVersion", type: "uint256" }
|
|
60
75
|
]
|
|
61
76
|
};
|
|
62
77
|
const SERVER_REGISTRATION_TYPES = {
|
|
@@ -75,13 +90,47 @@ const BUILDER_REGISTRATION_TYPES = {
|
|
|
75
90
|
{ name: "appUrl", type: "string" }
|
|
76
91
|
]
|
|
77
92
|
};
|
|
93
|
+
const GENERIC_PAYMENT_TYPES = {
|
|
94
|
+
GenericPayment: [
|
|
95
|
+
{ name: "payerAddress", type: "address" },
|
|
96
|
+
{ name: "opType", type: "string" },
|
|
97
|
+
{ name: "opId", type: "bytes32" },
|
|
98
|
+
{ name: "asset", type: "address" },
|
|
99
|
+
{ name: "amount", type: "uint256" },
|
|
100
|
+
{ name: "paymentNonce", type: "uint256" }
|
|
101
|
+
]
|
|
102
|
+
};
|
|
103
|
+
const ADD_DATA_TYPES = {
|
|
104
|
+
AddData: [
|
|
105
|
+
{ name: "ownerAddress", type: "address" },
|
|
106
|
+
{ name: "scope", type: "string" },
|
|
107
|
+
{ name: "dataHash", type: "bytes32" },
|
|
108
|
+
{ name: "metadataHash", type: "bytes32" },
|
|
109
|
+
{ name: "expectedVersion", type: "uint256" }
|
|
110
|
+
]
|
|
111
|
+
};
|
|
112
|
+
const RECORD_DATA_ACCESS_TYPES = {
|
|
113
|
+
RecordDataAccess: [
|
|
114
|
+
{ name: "ownerAddress", type: "address" },
|
|
115
|
+
{ name: "scope", type: "string" },
|
|
116
|
+
{ name: "version", type: "uint256" },
|
|
117
|
+
{ name: "accessor", type: "address" },
|
|
118
|
+
{ name: "recordId", type: "bytes32" }
|
|
119
|
+
]
|
|
120
|
+
};
|
|
78
121
|
export {
|
|
122
|
+
ADD_DATA_TYPES,
|
|
79
123
|
BUILDER_REGISTRATION_TYPES,
|
|
80
124
|
FILE_REGISTRATION_TYPES,
|
|
125
|
+
GENERIC_PAYMENT_TYPES,
|
|
81
126
|
GRANT_REGISTRATION_TYPES,
|
|
82
127
|
GRANT_REVOCATION_TYPES,
|
|
128
|
+
NATIVE_VANA_ASSET,
|
|
129
|
+
RECORD_DATA_ACCESS_TYPES,
|
|
83
130
|
SERVER_REGISTRATION_TYPES,
|
|
84
131
|
builderRegistrationDomain,
|
|
132
|
+
dataRegistryDomain,
|
|
133
|
+
escrowPaymentDomain,
|
|
85
134
|
fileRegistrationDomain,
|
|
86
135
|
grantRegistrationDomain,
|
|
87
136
|
grantRevocationDomain,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/protocol/eip712.ts"],"sourcesContent":["/**\n * EIP-712 domain and type builders for Data Portability protocol writes.\n *\n * These helpers are shared primitives only. Personal Server runtimes own when\n * to sign and submit these payloads.\n *\n * @category Protocol\n */\n\nimport type { TypedDataDomain } from \"viem\";\n\nconst DOMAIN_NAME = \"Vana Data Portability\";\nconst DOMAIN_VERSION = \"1\";\n\nexport interface DataPortabilityContracts {\n dataRegistry: string;\n dataPortabilityPermissions: string;\n dataPortabilityServer: string;\n dataPortabilityGrantees: string;\n}\n\nexport interface DataPortabilityGatewayConfig {\n chainId: number;\n contracts: DataPortabilityContracts;\n}\n\nfunction buildDomain(\n chainId: number,\n verifyingContract: `0x${string}`,\n): TypedDataDomain {\n return {\n name: DOMAIN_NAME,\n version: DOMAIN_VERSION,\n chainId,\n verifyingContract,\n };\n}\n\nexport function fileRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataRegistry as `0x${string}`,\n );\n}\n\nexport function grantRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityPermissions as `0x${string}`,\n );\n}\n\nexport function grantRevocationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityPermissions as `0x${string}`,\n );\n}\n\nexport function serverRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityServer as `0x${string}`,\n );\n}\n\nexport function builderRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityGrantees as `0x${string}`,\n );\n}\n\nexport const FILE_REGISTRATION_TYPES = {\n FileRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"url\", type: \"string\" },\n { name: \"schemaId\", type: \"bytes32\" },\n ],\n} as const;\n\nexport const GRANT_REGISTRATION_TYPES = {\n GrantRegistration: [\n { name: \"grantorAddress\", type: \"address\" },\n { name: \"granteeId\", type: \"bytes32\" },\n { name: \"grant\", type: \"string\" },\n { name: \"fileIds\", type: \"uint256[]\" },\n ],\n} as const;\n\nexport const GRANT_REVOCATION_TYPES = {\n GrantRevocation: [\n { name: \"grantorAddress\", type: \"address\" },\n { name: \"grantId\", type: \"bytes32\" },\n ],\n} as const;\n\nexport const SERVER_REGISTRATION_TYPES = {\n ServerRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"serverAddress\", type: \"address\" },\n { name: \"publicKey\", type: \"string\" },\n { name: \"serverUrl\", type: \"string\" },\n ],\n} as const;\n\nexport const BUILDER_REGISTRATION_TYPES = {\n BuilderRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"granteeAddress\", type: \"address\" },\n { name: \"publicKey\", type: \"string\" },\n { name: \"appUrl\", type: \"string\" },\n ],\n} as const;\n\nexport interface FileRegistrationMessage {\n ownerAddress: `0x${string}`;\n url: string;\n schemaId: `0x${string}`;\n}\n\nexport interface GrantRegistrationMessage {\n grantorAddress: `0x${string}`;\n granteeId: `0x${string}`;\n grant: string;\n fileIds: bigint[];\n}\n\nexport interface GrantRevocationMessage {\n grantorAddress: `0x${string}`;\n grantId: `0x${string}`;\n}\n\nexport interface ServerRegistrationMessage {\n ownerAddress: `0x${string}`;\n serverAddress: `0x${string}`;\n publicKey: `0x${string}`;\n serverUrl: string;\n}\n\nexport interface BuilderRegistrationMessage {\n ownerAddress: `0x${string}`;\n granteeAddress: `0x${string}`;\n publicKey: string;\n appUrl: string;\n}\n"],"mappings":"AAWA,MAAM,cAAc;AACpB,MAAM,iBAAiB;AAcvB,SAAS,YACP,SACA,mBACiB;AACjB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,uBACd,QACiB;AACjB,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,UAAU;AAAA,EACnB;AACF;AAEO,SAAS,wBACd,QACiB;AACjB,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,UAAU;AAAA,EACnB;AACF;AAEO,SAAS,sBACd,QACiB;AACjB,SAAO;AAA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U,MAAM,SAAS;AAAA,EACnC;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/protocol/eip712.ts"],"sourcesContent":["/**\n * EIP-712 domain and type builders for Data Portability protocol writes.\n *\n * These helpers are shared primitives only. Personal Server runtimes own when\n * to sign and submit these payloads.\n *\n * @category Protocol\n */\n\nimport type { TypedDataDomain } from \"viem\";\n\nconst DOMAIN_NAME = \"Vana Data Portability\";\nconst DOMAIN_VERSION = \"1\";\n\nexport interface DataPortabilityContracts {\n dataRegistry: string;\n dataPortabilityPermissions: string;\n dataPortabilityServer: string;\n dataPortabilityGrantees: string;\n // DataPortabilityEscrow — verifies GENERIC_PAYMENT_TYPES signatures backing\n // /v1/escrow/pay (the data-access payment path).\n dataPortabilityEscrow: string;\n}\n\n// Native VANA asset sentinel used by /v1/escrow/pay's `asset` field — pay any\n// other ERC-20 by passing its contract address instead.\nexport const NATIVE_VANA_ASSET =\n \"0x0000000000000000000000000000000000000000\" as const;\n\nexport interface DataPortabilityGatewayConfig {\n chainId: number;\n contracts: DataPortabilityContracts;\n}\n\nfunction buildDomain(\n chainId: number,\n verifyingContract: `0x${string}`,\n): TypedDataDomain {\n return {\n name: DOMAIN_NAME,\n version: DOMAIN_VERSION,\n chainId,\n verifyingContract,\n };\n}\n\nexport function fileRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataRegistry as `0x${string}`,\n );\n}\n\n// Domain for the DataRegistryV2 contract — verifies the AddData and\n// RecordDataAccess EIP-712 signatures. The verifyingContract is the same as\n// `fileRegistrationDomain` (both point at `dataRegistry`); the distinction\n// lives in the primaryType, not the domain. Exported as a separate helper\n// so callers reading data-point flows aren't routed through a name that\n// reads as file-registration-only.\nexport function dataRegistryDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataRegistry as `0x${string}`,\n );\n}\n\nexport function grantRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityPermissions as `0x${string}`,\n );\n}\n\nexport function grantRevocationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityPermissions as `0x${string}`,\n );\n}\n\nexport function serverRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityServer as `0x${string}`,\n );\n}\n\nexport function builderRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityGrantees as `0x${string}`,\n );\n}\n\n// Domain for the generic-payment EIP-712 signature consumed by\n// /v1/escrow/pay. The verifyingContract is the escrow itself (not the per-op\n// contract), so a single signature debits the payer's escrow balance for any\n// supported op — `grant` today; file/builder/schema in the future.\nexport function escrowPaymentDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityEscrow as `0x${string}`,\n );\n}\n\nexport const FILE_REGISTRATION_TYPES = {\n FileRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"url\", type: \"string\" },\n { name: \"schemaId\", type: \"bytes32\" },\n ],\n} as const;\n\n// grantVersion is a monotonic uint256 nonce per (grantor, grantee) pair. The\n// gateway rejects any registration whose version is <= the stored value,\n// which is the replay-attack defence now that re-registering the same pair\n// is a permitted override. expiresAt is unix seconds; 0 = no expiry.\nexport const GRANT_REGISTRATION_TYPES = {\n GrantRegistration: [\n { name: \"grantorAddress\", type: \"address\" },\n { name: \"granteeId\", type: \"bytes32\" },\n { name: \"scopes\", type: \"string[]\" },\n { name: \"grantVersion\", type: \"uint256\" },\n { name: \"expiresAt\", type: \"uint256\" },\n ],\n} as const;\n\n// Revocation shares the (grantor, grantee) monotonic nonce with registration —\n// both events advance the same grantVersion counter so an old revocation sig\n// can't be replayed across a revoke → re-register cycle.\nexport const GRANT_REVOCATION_TYPES = {\n GrantRevocation: [\n { name: \"grantorAddress\", type: \"address\" },\n { name: \"grantId\", type: \"bytes32\" },\n { name: \"grantVersion\", type: \"uint256\" },\n ],\n} as const;\n\nexport const SERVER_REGISTRATION_TYPES = {\n ServerRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"serverAddress\", type: \"address\" },\n { name: \"publicKey\", type: \"string\" },\n { name: \"serverUrl\", type: \"string\" },\n ],\n} as const;\n\nexport const BUILDER_REGISTRATION_TYPES = {\n BuilderRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"granteeAddress\", type: \"address\" },\n { name: \"publicKey\", type: \"string\" },\n { name: \"appUrl\", type: \"string\" },\n ],\n} as const;\n\n// Generic payment for the escrow flow. The (opType, opId) pair routes the\n// debit to the right op-row; paymentNonce is per-payer monotonic so the same\n// signed message can't be replayed after a revoke + re-register cycle.\n//\n// Today opType is always 'grant' and opId is the bytes32 grantId.\nexport const GENERIC_PAYMENT_TYPES = {\n GenericPayment: [\n { name: \"payerAddress\", type: \"address\" },\n { name: \"opType\", type: \"string\" },\n { name: \"opId\", type: \"bytes32\" },\n { name: \"asset\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"paymentNonce\", type: \"uint256\" },\n ],\n} as const;\n\n// AddData is signed by the data point's owner — registers (scope, dataHash,\n// metadataHash) on DataRegistryV2. expectedVersion is the version the caller\n// believes is current; the contract rejects with a CAS error if it isn't.\n// Used at POST /v1/data.\nexport const ADD_DATA_TYPES = {\n AddData: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"scope\", type: \"string\" },\n { name: \"dataHash\", type: \"bytes32\" },\n { name: \"metadataHash\", type: \"bytes32\" },\n { name: \"expectedVersion\", type: \"uint256\" },\n ],\n} as const;\n\n// RecordDataAccess is signed by a *trusted personal server* of `ownerAddress`\n// — attests that (scope, version) was served to `accessor`. recordId is a\n// per-event bytes32 the contract pins in `_usedRecordIds` to prevent replay.\n// Used as the optional `accessRecord` on POST /v1/escrow/pay.\nexport const RECORD_DATA_ACCESS_TYPES = {\n RecordDataAccess: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"scope\", type: \"string\" },\n { name: \"version\", type: \"uint256\" },\n { name: \"accessor\", type: \"address\" },\n { name: \"recordId\", type: \"bytes32\" },\n ],\n} as const;\n\nexport interface FileRegistrationMessage {\n ownerAddress: `0x${string}`;\n url: string;\n schemaId: `0x${string}`;\n}\n\nexport interface GrantRegistrationMessage {\n grantorAddress: `0x${string}`;\n granteeId: `0x${string}`;\n scopes: string[];\n grantVersion: bigint;\n expiresAt: bigint;\n}\n\nexport interface GrantRevocationMessage {\n grantorAddress: `0x${string}`;\n grantId: `0x${string}`;\n grantVersion: bigint;\n}\n\nexport interface ServerRegistrationMessage {\n ownerAddress: `0x${string}`;\n serverAddress: `0x${string}`;\n publicKey: string;\n serverUrl: string;\n}\n\nexport interface BuilderRegistrationMessage {\n ownerAddress: `0x${string}`;\n granteeAddress: `0x${string}`;\n publicKey: string;\n appUrl: string;\n}\n\nexport interface GenericPaymentMessage {\n payerAddress: `0x${string}`;\n // 'grant' today — extensible to 'file' | 'builder' | 'schema' as those\n // op-types become payable. Sent verbatim over the wire and into the\n // typed-data string field, so callers must match the gateway's spelling.\n opType: string;\n opId: `0x${string}`;\n // NATIVE_VANA_ASSET for native VANA; an ERC-20 contract address otherwise.\n asset: `0x${string}`;\n amount: bigint;\n paymentNonce: bigint;\n}\n\nexport interface AddDataMessage {\n ownerAddress: `0x${string}`;\n scope: string;\n dataHash: `0x${string}`;\n metadataHash: `0x${string}`;\n expectedVersion: bigint;\n}\n\nexport interface RecordDataAccessMessage {\n ownerAddress: `0x${string}`;\n scope: string;\n version: bigint;\n accessor: `0x${string}`;\n recordId: `0x${string}`;\n}\n"],"mappings":"AAWA,MAAM,cAAc;AACpB,MAAM,iBAAiB;AAchB,MAAM,oBACX;AAOF,SAAS,YACP,SACA,mB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