@opendatalabs/vana-sdk 3.4.0 → 3.4.1-canary.7afbfe0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.d.ts +7 -3
- package/dist/index.browser.js +423 -128
- package/dist/index.browser.js.map +4 -4
- package/dist/index.node.cjs +448 -133
- package/dist/index.node.cjs.map +4 -4
- package/dist/index.node.d.ts +7 -3
- package/dist/index.node.js +423 -128
- package/dist/index.node.js.map +4 -4
- package/dist/protocol/data-point-status.cjs +80 -0
- package/dist/protocol/data-point-status.cjs.map +1 -0
- package/dist/protocol/data-point-status.d.ts +34 -0
- package/dist/protocol/data-point-status.js +51 -0
- package/dist/protocol/data-point-status.js.map +1 -0
- package/dist/protocol/data-point-status.test.d.ts +1 -0
- package/dist/protocol/eip712.cjs +53 -31
- package/dist/protocol/eip712.cjs.map +1 -1
- package/dist/protocol/eip712.d.ts +98 -43
- package/dist/protocol/eip712.js +47 -27
- package/dist/protocol/eip712.js.map +1 -1
- package/dist/protocol/escrow-deposit.cjs +89 -0
- package/dist/protocol/escrow-deposit.cjs.map +1 -0
- package/dist/protocol/escrow-deposit.d.ts +47 -0
- package/dist/protocol/escrow-deposit.js +60 -0
- package/dist/protocol/escrow-deposit.js.map +1 -0
- package/dist/protocol/escrow-deposit.test.d.ts +1 -0
- package/dist/protocol/escrow-flow.test.d.ts +21 -0
- package/dist/protocol/fee-registry.cjs +116 -0
- package/dist/protocol/fee-registry.cjs.map +1 -0
- package/dist/protocol/fee-registry.d.ts +151 -0
- package/dist/protocol/fee-registry.js +89 -0
- package/dist/protocol/fee-registry.js.map +1 -0
- package/dist/protocol/fee-registry.test.d.ts +1 -0
- package/dist/protocol/gateway.cjs +110 -38
- package/dist/protocol/gateway.cjs.map +1 -1
- package/dist/protocol/gateway.d.ts +238 -56
- package/dist/protocol/gateway.js +110 -38
- package/dist/protocol/gateway.js.map +1 -1
- package/dist/protocol/grants.cjs +27 -64
- package/dist/protocol/grants.cjs.map +1 -1
- package/dist/protocol/grants.d.ts +6 -13
- package/dist/protocol/grants.js +27 -63
- package/dist/protocol/grants.js.map +1 -1
- package/dist/protocol/personal-server-data.cjs +71 -0
- package/dist/protocol/personal-server-data.cjs.map +1 -0
- package/dist/protocol/personal-server-data.d.ts +16 -0
- package/dist/protocol/personal-server-data.js +47 -0
- package/dist/protocol/personal-server-data.js.map +1 -0
- package/dist/protocol/personal-server-data.test.d.ts +1 -0
- package/package.json +3 -2
package/dist/index.node.cjs
CHANGED
|
@@ -1174,6 +1174,7 @@ var init_browser2 = __esm({
|
|
|
1174
1174
|
var index_node_exports = {};
|
|
1175
1175
|
__export(index_node_exports, {
|
|
1176
1176
|
ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT: () => ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT,
|
|
1177
|
+
ADD_DATA_TYPES: () => ADD_DATA_TYPES,
|
|
1177
1178
|
AccountPersonalServerLiteOwnerBindingError: () => AccountPersonalServerLiteOwnerBindingError,
|
|
1178
1179
|
AccountPersonalServerRegistrationError: () => AccountPersonalServerRegistrationError,
|
|
1179
1180
|
BUILDER_REGISTRATION_TYPES: () => BUILDER_REGISTRATION_TYPES,
|
|
@@ -1183,12 +1184,15 @@ __export(index_node_exports, {
|
|
|
1183
1184
|
CallbackStorage: () => CallbackStorage,
|
|
1184
1185
|
ContractFactory: () => ContractFactory,
|
|
1185
1186
|
ContractNotFoundError: () => ContractNotFoundError,
|
|
1187
|
+
DATA_REGISTRY_STATUS_ABI: () => DATA_REGISTRY_STATUS_ABI,
|
|
1186
1188
|
DataFileEnvelopeSchema: () => DataFileEnvelopeSchema,
|
|
1189
|
+
DataPointStatus: () => DataPointStatus,
|
|
1187
1190
|
DropboxStorage: () => DropboxStorage,
|
|
1188
1191
|
ECIESError: () => ECIESError,
|
|
1192
|
+
ESCROW_DEPOSIT_ABI: () => ESCROW_DEPOSIT_ABI,
|
|
1189
1193
|
ExpiredTokenError: () => ExpiredTokenError,
|
|
1190
|
-
|
|
1191
|
-
|
|
1194
|
+
FEE_REGISTRY_ABI: () => FEE_REGISTRY_ABI,
|
|
1195
|
+
GENERIC_PAYMENT_TYPES: () => GENERIC_PAYMENT_TYPES,
|
|
1192
1196
|
GRANT_REGISTRATION_TYPES: () => GRANT_REGISTRATION_TYPES,
|
|
1193
1197
|
GRANT_REVOCATION_TYPES: () => GRANT_REVOCATION_TYPES,
|
|
1194
1198
|
GoogleDriveStorage: () => GoogleDriveStorage,
|
|
@@ -1199,6 +1203,7 @@ __export(index_node_exports, {
|
|
|
1199
1203
|
IpfsStorage: () => IpfsStorage,
|
|
1200
1204
|
MASTER_KEY_MESSAGE: () => MASTER_KEY_MESSAGE,
|
|
1201
1205
|
MissingAuthError: () => MissingAuthError,
|
|
1206
|
+
NATIVE_VANA_ASSET: () => NATIVE_VANA_ASSET,
|
|
1202
1207
|
NetworkError: () => NetworkError,
|
|
1203
1208
|
NodeECIESProvider: () => NodeECIESUint8Provider,
|
|
1204
1209
|
NodePlatformAdapter: () => NodePlatformAdapter,
|
|
@@ -1216,6 +1221,8 @@ __export(index_node_exports, {
|
|
|
1216
1221
|
PersonalServerError: () => PersonalServerError,
|
|
1217
1222
|
PinataStorage: () => PinataStorage,
|
|
1218
1223
|
R2Storage: () => R2Storage,
|
|
1224
|
+
RECORD_DATA_ACCESS_TYPES: () => RECORD_DATA_ACCESS_TYPES,
|
|
1225
|
+
REGISTRATION_KIND_FOR_OP: () => REGISTRATION_KIND_FOR_OP,
|
|
1219
1226
|
ReadOnlyError: () => ReadOnlyError,
|
|
1220
1227
|
RelayerError: () => RelayerError,
|
|
1221
1228
|
SERVER_REGISTRATION_TYPES: () => SERVER_REGISTRATION_TYPES,
|
|
@@ -1230,10 +1237,15 @@ __export(index_node_exports, {
|
|
|
1230
1237
|
VanaError: () => VanaError,
|
|
1231
1238
|
VanaStorage: () => VanaStorage,
|
|
1232
1239
|
assertValidPkceVerifier: () => assertValidPkceVerifier,
|
|
1240
|
+
buildDepositNativeRequest: () => buildDepositNativeRequest,
|
|
1241
|
+
buildDepositTokenRequest: () => buildDepositTokenRequest,
|
|
1242
|
+
buildMarkDataPointUnavailableRequest: () => buildMarkDataPointUnavailableRequest,
|
|
1243
|
+
buildPersonalServerDataReadRequest: () => buildPersonalServerDataReadRequest,
|
|
1233
1244
|
buildPersonalServerLiteOwnerBindingMessage: () => buildPersonalServerLiteOwnerBindingMessage,
|
|
1234
1245
|
buildPersonalServerLiteOwnerBindingSignature: () => buildPersonalServerLiteOwnerBindingSignature,
|
|
1235
1246
|
buildPersonalServerRegistrationSignature: () => buildPersonalServerRegistrationSignature,
|
|
1236
1247
|
buildPersonalServerRegistrationTypedData: () => buildPersonalServerRegistrationTypedData,
|
|
1248
|
+
buildSetDataPointStatusRequest: () => buildSetDataPointStatusRequest,
|
|
1237
1249
|
buildWeb3SignedHeader: () => buildWeb3SignedHeader,
|
|
1238
1250
|
builderRegistrationDomain: () => builderRegistrationDomain,
|
|
1239
1251
|
chains: () => chains,
|
|
@@ -1251,14 +1263,19 @@ __export(index_node_exports, {
|
|
|
1251
1263
|
createVanaStorageProvider: () => createVanaStorageProvider,
|
|
1252
1264
|
createViemPersonalServerLiteOwnerBindingSigner: () => createViemPersonalServerLiteOwnerBindingSigner,
|
|
1253
1265
|
createViemPersonalServerRegistrationSigner: () => createViemPersonalServerRegistrationSigner,
|
|
1266
|
+
dataRegistryContractAddress: () => dataRegistryContractAddress,
|
|
1267
|
+
dataRegistryDomain: () => dataRegistryDomain,
|
|
1254
1268
|
decryptWithPassword: () => decryptWithPassword,
|
|
1255
1269
|
deriveMasterKey: () => deriveMasterKey,
|
|
1256
1270
|
deriveScopeKey: () => deriveScopeKey,
|
|
1257
1271
|
deserializeECIES: () => deserializeECIES,
|
|
1258
1272
|
detectPlatform: () => detectPlatform,
|
|
1273
|
+
encodeDepositNativeData: () => encodeDepositNativeData,
|
|
1274
|
+
encodeDepositTokenData: () => encodeDepositTokenData,
|
|
1275
|
+
encodeSetDataPointStatusData: () => encodeSetDataPointStatusData,
|
|
1259
1276
|
encryptWithPassword: () => encryptWithPassword,
|
|
1260
|
-
|
|
1261
|
-
|
|
1277
|
+
escrowContractAddress: () => escrowContractAddress,
|
|
1278
|
+
escrowPaymentDomain: () => escrowPaymentDomain,
|
|
1262
1279
|
generatePkceVerifier: () => generatePkceVerifier,
|
|
1263
1280
|
getAbi: () => getAbi,
|
|
1264
1281
|
getAllChains: () => getAllChains,
|
|
@@ -1266,6 +1283,8 @@ __export(index_node_exports, {
|
|
|
1266
1283
|
getContractAddress: () => getContractAddress,
|
|
1267
1284
|
getContractController: () => getContractController,
|
|
1268
1285
|
getContractInfo: () => getContractInfo,
|
|
1286
|
+
getFee: () => getFee,
|
|
1287
|
+
getOpFee: () => getOpFee,
|
|
1269
1288
|
getPlatformCapabilities: () => getPlatformCapabilities,
|
|
1270
1289
|
getServiceEndpoints: () => getServiceEndpoints,
|
|
1271
1290
|
grantRegistrationDomain: () => grantRegistrationDomain,
|
|
@@ -1277,11 +1296,12 @@ __export(index_node_exports, {
|
|
|
1277
1296
|
moksha: () => moksha,
|
|
1278
1297
|
mokshaServices: () => mokshaServices,
|
|
1279
1298
|
mokshaTestnet: () => mokshaTestnet2,
|
|
1280
|
-
parseGrantRegistrationPayload: () => parseGrantRegistrationPayload,
|
|
1281
1299
|
parsePSError: () => parsePSError,
|
|
1282
1300
|
parseScope: () => parseScope,
|
|
1283
1301
|
parseWeb3SignedHeader: () => parseWeb3SignedHeader,
|
|
1302
|
+
personalServerDataReadPath: () => personalServerDataReadPath,
|
|
1284
1303
|
personalServerRegistrationDomain: () => personalServerRegistrationDomain,
|
|
1304
|
+
readPersonalServerData: () => readPersonalServerData,
|
|
1285
1305
|
recoverServerOwner: () => recoverServerOwner,
|
|
1286
1306
|
registerPersonalServerSignature: () => registerPersonalServerSignature,
|
|
1287
1307
|
scopeCoveredByGrant: () => scopeCoveredByGrant,
|
|
@@ -32649,6 +32669,7 @@ function formatOAuthError(body, status) {
|
|
|
32649
32669
|
// src/protocol/eip712.ts
|
|
32650
32670
|
var DOMAIN_NAME = "Vana Data Portability";
|
|
32651
32671
|
var DOMAIN_VERSION = "1";
|
|
32672
|
+
var NATIVE_VANA_ASSET = "0x0000000000000000000000000000000000000000";
|
|
32652
32673
|
function buildDomain(chainId, verifyingContract) {
|
|
32653
32674
|
return {
|
|
32654
32675
|
name: DOMAIN_NAME,
|
|
@@ -32657,13 +32678,7 @@ function buildDomain(chainId, verifyingContract) {
|
|
|
32657
32678
|
verifyingContract
|
|
32658
32679
|
};
|
|
32659
32680
|
}
|
|
32660
|
-
function
|
|
32661
|
-
return buildDomain(
|
|
32662
|
-
config.chainId,
|
|
32663
|
-
config.contracts.dataRegistry
|
|
32664
|
-
);
|
|
32665
|
-
}
|
|
32666
|
-
function fileDeletionDomain(config) {
|
|
32681
|
+
function dataRegistryDomain(config) {
|
|
32667
32682
|
return buildDomain(
|
|
32668
32683
|
config.chainId,
|
|
32669
32684
|
config.contracts.dataRegistry
|
|
@@ -32693,31 +32708,26 @@ function builderRegistrationDomain(config) {
|
|
|
32693
32708
|
config.contracts.dataPortabilityGrantees
|
|
32694
32709
|
);
|
|
32695
32710
|
}
|
|
32696
|
-
|
|
32697
|
-
|
|
32698
|
-
|
|
32699
|
-
|
|
32700
|
-
|
|
32701
|
-
|
|
32702
|
-
};
|
|
32703
|
-
var FILE_DELETION_TYPES = {
|
|
32704
|
-
FileDeletion: [
|
|
32705
|
-
{ name: "ownerAddress", type: "address" },
|
|
32706
|
-
{ name: "fileId", type: "bytes32" }
|
|
32707
|
-
]
|
|
32708
|
-
};
|
|
32711
|
+
function escrowPaymentDomain(config) {
|
|
32712
|
+
return buildDomain(
|
|
32713
|
+
config.chainId,
|
|
32714
|
+
config.contracts.dataPortabilityEscrow
|
|
32715
|
+
);
|
|
32716
|
+
}
|
|
32709
32717
|
var GRANT_REGISTRATION_TYPES = {
|
|
32710
32718
|
GrantRegistration: [
|
|
32711
32719
|
{ name: "grantorAddress", type: "address" },
|
|
32712
32720
|
{ name: "granteeId", type: "bytes32" },
|
|
32713
|
-
{ name: "
|
|
32714
|
-
{ name: "
|
|
32721
|
+
{ name: "scopes", type: "string[]" },
|
|
32722
|
+
{ name: "grantVersion", type: "uint256" },
|
|
32723
|
+
{ name: "expiresAt", type: "uint256" }
|
|
32715
32724
|
]
|
|
32716
32725
|
};
|
|
32717
32726
|
var GRANT_REVOCATION_TYPES = {
|
|
32718
32727
|
GrantRevocation: [
|
|
32719
32728
|
{ name: "grantorAddress", type: "address" },
|
|
32720
|
-
{ name: "grantId", type: "bytes32" }
|
|
32729
|
+
{ name: "grantId", type: "bytes32" },
|
|
32730
|
+
{ name: "grantVersion", type: "uint256" }
|
|
32721
32731
|
]
|
|
32722
32732
|
};
|
|
32723
32733
|
var SERVER_REGISTRATION_TYPES = {
|
|
@@ -32736,6 +32746,34 @@ var BUILDER_REGISTRATION_TYPES = {
|
|
|
32736
32746
|
{ name: "appUrl", type: "string" }
|
|
32737
32747
|
]
|
|
32738
32748
|
};
|
|
32749
|
+
var GENERIC_PAYMENT_TYPES = {
|
|
32750
|
+
GenericPayment: [
|
|
32751
|
+
{ name: "payerAddress", type: "address" },
|
|
32752
|
+
{ name: "opType", type: "string" },
|
|
32753
|
+
{ name: "opId", type: "bytes32" },
|
|
32754
|
+
{ name: "asset", type: "address" },
|
|
32755
|
+
{ name: "amount", type: "uint256" },
|
|
32756
|
+
{ name: "paymentNonce", type: "uint256" }
|
|
32757
|
+
]
|
|
32758
|
+
};
|
|
32759
|
+
var ADD_DATA_TYPES = {
|
|
32760
|
+
AddData: [
|
|
32761
|
+
{ name: "ownerAddress", type: "address" },
|
|
32762
|
+
{ name: "scope", type: "string" },
|
|
32763
|
+
{ name: "dataHash", type: "bytes32" },
|
|
32764
|
+
{ name: "metadataHash", type: "bytes32" },
|
|
32765
|
+
{ name: "expectedVersion", type: "uint256" }
|
|
32766
|
+
]
|
|
32767
|
+
};
|
|
32768
|
+
var RECORD_DATA_ACCESS_TYPES = {
|
|
32769
|
+
RecordDataAccess: [
|
|
32770
|
+
{ name: "ownerAddress", type: "address" },
|
|
32771
|
+
{ name: "scope", type: "string" },
|
|
32772
|
+
{ name: "version", type: "uint256" },
|
|
32773
|
+
{ name: "accessor", type: "address" },
|
|
32774
|
+
{ name: "recordId", type: "bytes32" }
|
|
32775
|
+
]
|
|
32776
|
+
};
|
|
32739
32777
|
|
|
32740
32778
|
// src/protocol/personal-server-registration.ts
|
|
32741
32779
|
var import_viem14 = require("viem");
|
|
@@ -33173,67 +33211,34 @@ function isDataPortabilityGatewayConfig(value) {
|
|
|
33173
33211
|
return false;
|
|
33174
33212
|
}
|
|
33175
33213
|
const c = contracts;
|
|
33176
|
-
return isHexString(c["dataRegistry"]) && isHexString(c["dataPortabilityPermissions"]) && isHexString(c["dataPortabilityServer"]) && isHexString(c["dataPortabilityGrantees"]);
|
|
33177
|
-
}
|
|
33178
|
-
function parseGrantRegistrationPayload(grant) {
|
|
33179
|
-
let parsed;
|
|
33180
|
-
try {
|
|
33181
|
-
parsed = JSON.parse(grant);
|
|
33182
|
-
} catch {
|
|
33183
|
-
return null;
|
|
33184
|
-
}
|
|
33185
|
-
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
33186
|
-
return null;
|
|
33187
|
-
}
|
|
33188
|
-
const value = parsed;
|
|
33189
|
-
if (!Array.isArray(value["scopes"]) || value["scopes"].length === 0) {
|
|
33190
|
-
return null;
|
|
33191
|
-
}
|
|
33192
|
-
if (!value["scopes"].every((scope) => typeof scope === "string")) {
|
|
33193
|
-
return null;
|
|
33194
|
-
}
|
|
33195
|
-
if (typeof value["expiresAt"] !== "number" || !Number.isFinite(value["expiresAt"])) {
|
|
33196
|
-
return null;
|
|
33197
|
-
}
|
|
33198
|
-
if (value["user"] !== void 0 && !isHexString(value["user"])) {
|
|
33199
|
-
return null;
|
|
33200
|
-
}
|
|
33201
|
-
if (value["builder"] !== void 0 && !isHexString(value["builder"])) {
|
|
33202
|
-
return null;
|
|
33203
|
-
}
|
|
33204
|
-
if (value["nonce"] !== void 0 && (typeof value["nonce"] !== "number" || !Number.isFinite(value["nonce"]))) {
|
|
33205
|
-
return null;
|
|
33206
|
-
}
|
|
33207
|
-
return {
|
|
33208
|
-
user: value["user"],
|
|
33209
|
-
builder: value["builder"],
|
|
33210
|
-
scopes: value["scopes"],
|
|
33211
|
-
expiresAt: value["expiresAt"],
|
|
33212
|
-
nonce: value["nonce"]
|
|
33213
|
-
};
|
|
33214
|
+
return isHexString(c["dataRegistry"]) && isHexString(c["dataPortabilityPermissions"]) && isHexString(c["dataPortabilityServer"]) && isHexString(c["dataPortabilityGrantees"]) && isHexString(c["dataPortabilityEscrow"]) && isHexString(c["feeRegistry"]);
|
|
33214
33215
|
}
|
|
33215
|
-
function
|
|
33216
|
+
function toUint256(value) {
|
|
33216
33217
|
try {
|
|
33217
|
-
|
|
33218
|
-
|
|
33219
|
-
|
|
33220
|
-
|
|
33221
|
-
|
|
33218
|
+
if (typeof value === "number" && !Number.isSafeInteger(value)) {
|
|
33219
|
+
return null;
|
|
33220
|
+
}
|
|
33221
|
+
const big = typeof value === "bigint" ? value : BigInt(value);
|
|
33222
|
+
if (big < 0n) return null;
|
|
33223
|
+
return big;
|
|
33222
33224
|
} catch {
|
|
33223
33225
|
return null;
|
|
33224
33226
|
}
|
|
33225
33227
|
}
|
|
33226
33228
|
async function verifyGrantRegistration(input) {
|
|
33227
|
-
|
|
33228
|
-
|
|
33229
|
-
return {
|
|
33230
|
-
valid: false,
|
|
33231
|
-
error: "Grant must be JSON with scopes and expiresAt"
|
|
33232
|
-
};
|
|
33229
|
+
if (!Array.isArray(input.scopes) || input.scopes.length === 0) {
|
|
33230
|
+
return { valid: false, error: "scopes must be a non-empty array" };
|
|
33233
33231
|
}
|
|
33234
|
-
|
|
33235
|
-
|
|
33236
|
-
|
|
33232
|
+
if (!input.scopes.every((scope) => typeof scope === "string")) {
|
|
33233
|
+
return { valid: false, error: "scopes must contain only strings" };
|
|
33234
|
+
}
|
|
33235
|
+
const grantVersion = toUint256(input.grantVersion);
|
|
33236
|
+
if (grantVersion === null || grantVersion < 1n) {
|
|
33237
|
+
return { valid: false, error: "grantVersion must be a uint256 >= 1" };
|
|
33238
|
+
}
|
|
33239
|
+
const expiresAt = toUint256(input.expiresAt);
|
|
33240
|
+
if (expiresAt === null) {
|
|
33241
|
+
return { valid: false, error: "expiresAt must be a non-negative uint256" };
|
|
33237
33242
|
}
|
|
33238
33243
|
let valid;
|
|
33239
33244
|
try {
|
|
@@ -33245,8 +33250,9 @@ async function verifyGrantRegistration(input) {
|
|
|
33245
33250
|
message: {
|
|
33246
33251
|
grantorAddress: input.grantorAddress,
|
|
33247
33252
|
granteeId: input.granteeId,
|
|
33248
|
-
|
|
33249
|
-
|
|
33253
|
+
scopes: input.scopes,
|
|
33254
|
+
grantVersion,
|
|
33255
|
+
expiresAt
|
|
33250
33256
|
},
|
|
33251
33257
|
signature: input.signature
|
|
33252
33258
|
});
|
|
@@ -33257,19 +33263,197 @@ async function verifyGrantRegistration(input) {
|
|
|
33257
33263
|
return { valid: false, error: "Grant signature does not match grantor" };
|
|
33258
33264
|
}
|
|
33259
33265
|
const nowSeconds = input.nowSeconds ?? Math.floor(Date.now() / 1e3);
|
|
33260
|
-
if (
|
|
33266
|
+
if (expiresAt > 0n && expiresAt < BigInt(nowSeconds)) {
|
|
33261
33267
|
return { valid: false, error: "Grant has expired" };
|
|
33262
33268
|
}
|
|
33263
|
-
if (payload.user !== void 0 && payload.user.toLowerCase() !== input.grantorAddress.toLowerCase()) {
|
|
33264
|
-
return { valid: false, error: "Grant user does not match grantorAddress" };
|
|
33265
|
-
}
|
|
33266
33269
|
return {
|
|
33267
33270
|
valid: true,
|
|
33268
33271
|
grantorAddress: input.grantorAddress,
|
|
33269
33272
|
granteeId: input.granteeId,
|
|
33270
|
-
|
|
33271
|
-
|
|
33272
|
-
|
|
33273
|
+
scopes: input.scopes,
|
|
33274
|
+
grantVersion: grantVersion.toString(),
|
|
33275
|
+
expiresAt: expiresAt.toString()
|
|
33276
|
+
};
|
|
33277
|
+
}
|
|
33278
|
+
|
|
33279
|
+
// src/protocol/escrow-deposit.ts
|
|
33280
|
+
var import_viem18 = require("viem");
|
|
33281
|
+
var ESCROW_DEPOSIT_ABI = [
|
|
33282
|
+
{
|
|
33283
|
+
type: "function",
|
|
33284
|
+
name: "depositNative",
|
|
33285
|
+
stateMutability: "payable",
|
|
33286
|
+
inputs: [{ name: "account", type: "address" }],
|
|
33287
|
+
outputs: []
|
|
33288
|
+
},
|
|
33289
|
+
{
|
|
33290
|
+
type: "function",
|
|
33291
|
+
name: "depositToken",
|
|
33292
|
+
stateMutability: "nonpayable",
|
|
33293
|
+
inputs: [
|
|
33294
|
+
{ name: "account", type: "address" },
|
|
33295
|
+
{ name: "token", type: "address" },
|
|
33296
|
+
{ name: "amount", type: "uint256" }
|
|
33297
|
+
],
|
|
33298
|
+
outputs: []
|
|
33299
|
+
}
|
|
33300
|
+
];
|
|
33301
|
+
function escrowContractAddress(config) {
|
|
33302
|
+
return config.contracts.dataPortabilityEscrow;
|
|
33303
|
+
}
|
|
33304
|
+
function encodeDepositNativeData(input) {
|
|
33305
|
+
return (0, import_viem18.encodeFunctionData)({
|
|
33306
|
+
abi: ESCROW_DEPOSIT_ABI,
|
|
33307
|
+
functionName: "depositNative",
|
|
33308
|
+
args: [input.account]
|
|
33309
|
+
});
|
|
33310
|
+
}
|
|
33311
|
+
function encodeDepositTokenData(input) {
|
|
33312
|
+
return (0, import_viem18.encodeFunctionData)({
|
|
33313
|
+
abi: ESCROW_DEPOSIT_ABI,
|
|
33314
|
+
functionName: "depositToken",
|
|
33315
|
+
args: [input.account, input.token, input.amount]
|
|
33316
|
+
});
|
|
33317
|
+
}
|
|
33318
|
+
function buildDepositNativeRequest(config, input) {
|
|
33319
|
+
return {
|
|
33320
|
+
to: escrowContractAddress(config),
|
|
33321
|
+
data: encodeDepositNativeData({ account: input.account }),
|
|
33322
|
+
value: input.amount
|
|
33323
|
+
};
|
|
33324
|
+
}
|
|
33325
|
+
function buildDepositTokenRequest(config, input) {
|
|
33326
|
+
return {
|
|
33327
|
+
to: escrowContractAddress(config),
|
|
33328
|
+
data: encodeDepositTokenData(input)
|
|
33329
|
+
};
|
|
33330
|
+
}
|
|
33331
|
+
|
|
33332
|
+
// src/protocol/data-point-status.ts
|
|
33333
|
+
var import_viem19 = require("viem");
|
|
33334
|
+
var DataPointStatus = /* @__PURE__ */ ((DataPointStatus2) => {
|
|
33335
|
+
DataPointStatus2[DataPointStatus2["None"] = 0] = "None";
|
|
33336
|
+
DataPointStatus2[DataPointStatus2["Active"] = 1] = "Active";
|
|
33337
|
+
DataPointStatus2[DataPointStatus2["Inactive"] = 2] = "Inactive";
|
|
33338
|
+
DataPointStatus2[DataPointStatus2["Unavailable"] = 3] = "Unavailable";
|
|
33339
|
+
return DataPointStatus2;
|
|
33340
|
+
})(DataPointStatus || {});
|
|
33341
|
+
var DATA_REGISTRY_STATUS_ABI = [
|
|
33342
|
+
{
|
|
33343
|
+
type: "function",
|
|
33344
|
+
name: "setStatus",
|
|
33345
|
+
stateMutability: "nonpayable",
|
|
33346
|
+
inputs: [
|
|
33347
|
+
{ name: "scope", type: "string" },
|
|
33348
|
+
{ name: "newStatus", type: "uint8" }
|
|
33349
|
+
],
|
|
33350
|
+
outputs: []
|
|
33351
|
+
}
|
|
33352
|
+
];
|
|
33353
|
+
function dataRegistryContractAddress(config) {
|
|
33354
|
+
return config.contracts.dataRegistry;
|
|
33355
|
+
}
|
|
33356
|
+
function encodeSetDataPointStatusData(input) {
|
|
33357
|
+
return (0, import_viem19.encodeFunctionData)({
|
|
33358
|
+
abi: DATA_REGISTRY_STATUS_ABI,
|
|
33359
|
+
functionName: "setStatus",
|
|
33360
|
+
args: [input.scope, input.status]
|
|
33361
|
+
});
|
|
33362
|
+
}
|
|
33363
|
+
function buildSetDataPointStatusRequest(config, input) {
|
|
33364
|
+
return {
|
|
33365
|
+
to: dataRegistryContractAddress(config),
|
|
33366
|
+
data: encodeSetDataPointStatusData(input)
|
|
33367
|
+
};
|
|
33368
|
+
}
|
|
33369
|
+
function buildMarkDataPointUnavailableRequest(config, input) {
|
|
33370
|
+
return buildSetDataPointStatusRequest(config, {
|
|
33371
|
+
scope: input.scope,
|
|
33372
|
+
status: 3 /* Unavailable */
|
|
33373
|
+
});
|
|
33374
|
+
}
|
|
33375
|
+
|
|
33376
|
+
// src/protocol/fee-registry.ts
|
|
33377
|
+
var import_viem20 = require("viem");
|
|
33378
|
+
var FEE_REGISTRY_ABI = (0, import_viem20.parseAbi)([
|
|
33379
|
+
"struct Fee { uint256 amount; address asset; address payee; bool enabled; }",
|
|
33380
|
+
"function fees(bytes32 operation) view returns (Fee)",
|
|
33381
|
+
"function operationKey(string name) pure returns (bytes32)"
|
|
33382
|
+
]);
|
|
33383
|
+
var REGISTRATION_KIND_FOR_OP = {
|
|
33384
|
+
grant: "grant_registration",
|
|
33385
|
+
data: "data_registration",
|
|
33386
|
+
server: "server_registration",
|
|
33387
|
+
builder: "builder_registration"
|
|
33388
|
+
};
|
|
33389
|
+
function operationNameFor(kind, opts) {
|
|
33390
|
+
switch (kind) {
|
|
33391
|
+
case "grant_registration":
|
|
33392
|
+
return opts?.grantRegistrationOpName ?? "grant_registration";
|
|
33393
|
+
case "data_access":
|
|
33394
|
+
return opts?.dataAccessOpName ?? "data_access";
|
|
33395
|
+
case "data_registration":
|
|
33396
|
+
return opts?.dataRegistrationOpName ?? "data_registration";
|
|
33397
|
+
case "server_registration":
|
|
33398
|
+
return opts?.serverRegistrationOpName ?? "server_registration";
|
|
33399
|
+
case "builder_registration":
|
|
33400
|
+
return opts?.builderRegistrationOpName ?? "builder_registration";
|
|
33401
|
+
}
|
|
33402
|
+
}
|
|
33403
|
+
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
33404
|
+
async function getFee(client, config, kind, opts) {
|
|
33405
|
+
const address = config.contracts.feeRegistry;
|
|
33406
|
+
const opName = operationNameFor(kind, opts);
|
|
33407
|
+
const opKey = await client.readContract({
|
|
33408
|
+
address,
|
|
33409
|
+
abi: FEE_REGISTRY_ABI,
|
|
33410
|
+
functionName: "operationKey",
|
|
33411
|
+
args: [opName]
|
|
33412
|
+
});
|
|
33413
|
+
const fee = await client.readContract({
|
|
33414
|
+
address,
|
|
33415
|
+
abi: FEE_REGISTRY_ABI,
|
|
33416
|
+
functionName: "fees",
|
|
33417
|
+
args: [opKey]
|
|
33418
|
+
});
|
|
33419
|
+
if (fee.enabled && fee.payee === ZERO_ADDRESS) {
|
|
33420
|
+
throw new Error(
|
|
33421
|
+
`FeeRegistry: enabled operation "${opName}" has zero-address payee \u2014 contract pre-flight rejects payouts to 0x0`
|
|
33422
|
+
);
|
|
33423
|
+
}
|
|
33424
|
+
return fee;
|
|
33425
|
+
}
|
|
33426
|
+
async function getOpFee(client, config, opType, opts) {
|
|
33427
|
+
const registrationKind = REGISTRATION_KIND_FOR_OP[opType];
|
|
33428
|
+
if (!registrationKind) {
|
|
33429
|
+
throw new Error(
|
|
33430
|
+
`getOpFee: unknown opType "${opType}" \u2014 supported types are ${Object.keys(REGISTRATION_KIND_FOR_OP).join(", ")}`
|
|
33431
|
+
);
|
|
33432
|
+
}
|
|
33433
|
+
const includeDataAccess = opType === "grant";
|
|
33434
|
+
const [registration, dataAccess] = await Promise.all([
|
|
33435
|
+
getFee(client, config, registrationKind, opts),
|
|
33436
|
+
includeDataAccess ? getFee(client, config, "data_access", opts) : Promise.resolve({
|
|
33437
|
+
amount: 0n,
|
|
33438
|
+
asset: ZERO_ADDRESS,
|
|
33439
|
+
payee: ZERO_ADDRESS,
|
|
33440
|
+
enabled: false
|
|
33441
|
+
})
|
|
33442
|
+
]);
|
|
33443
|
+
if (registration.enabled && dataAccess.enabled && registration.asset.toLowerCase() !== dataAccess.asset.toLowerCase()) {
|
|
33444
|
+
throw new Error(
|
|
33445
|
+
`FeeRegistry asset mismatch for "${opType}": registration=${registration.asset} vs data_access=${dataAccess.asset}. The gateway requires both kinds to settle in the same asset when both are enabled.`
|
|
33446
|
+
);
|
|
33447
|
+
}
|
|
33448
|
+
const asset = registration.enabled ? registration.asset : dataAccess.enabled ? dataAccess.asset : ZERO_ADDRESS;
|
|
33449
|
+
return {
|
|
33450
|
+
asset,
|
|
33451
|
+
registrationFee: registration.enabled ? registration.amount : 0n,
|
|
33452
|
+
dataAccessFee: dataAccess.enabled ? dataAccess.amount : 0n,
|
|
33453
|
+
registrationEnabled: registration.enabled,
|
|
33454
|
+
dataAccessEnabled: dataAccess.enabled,
|
|
33455
|
+
registrationPayee: registration.enabled ? registration.payee : ZERO_ADDRESS,
|
|
33456
|
+
dataAccessPayee: dataAccess.enabled ? dataAccess.payee : ZERO_ADDRESS
|
|
33273
33457
|
};
|
|
33274
33458
|
}
|
|
33275
33459
|
|
|
@@ -33343,6 +33527,45 @@ var IngestResponseSchema = import_zod2.z.object({
|
|
|
33343
33527
|
status: import_zod2.z.enum(["stored", "syncing"])
|
|
33344
33528
|
});
|
|
33345
33529
|
|
|
33530
|
+
// src/protocol/personal-server-data.ts
|
|
33531
|
+
function personalServerDataReadPath(scope) {
|
|
33532
|
+
return `/v1/data/${encodeURIComponent(scope)}`;
|
|
33533
|
+
}
|
|
33534
|
+
async function buildPersonalServerDataReadRequest(params) {
|
|
33535
|
+
const path = personalServerDataReadPath(params.scope);
|
|
33536
|
+
const baseUrl = params.personalServerUrl.replace(/\/+$/, "");
|
|
33537
|
+
const audience = params.audience ?? baseUrl;
|
|
33538
|
+
const headers = new Headers(params.headers);
|
|
33539
|
+
headers.set(
|
|
33540
|
+
"Authorization",
|
|
33541
|
+
await buildWeb3SignedHeader({
|
|
33542
|
+
aud: audience,
|
|
33543
|
+
grantId: params.grantId,
|
|
33544
|
+
method: "GET",
|
|
33545
|
+
signMessage: params.signMessage,
|
|
33546
|
+
uri: path
|
|
33547
|
+
})
|
|
33548
|
+
);
|
|
33549
|
+
return new Request(`${baseUrl}${path}`, {
|
|
33550
|
+
headers,
|
|
33551
|
+
method: "GET"
|
|
33552
|
+
});
|
|
33553
|
+
}
|
|
33554
|
+
async function readPersonalServerData(params) {
|
|
33555
|
+
const fetchFn = params.fetch ?? globalThis.fetch;
|
|
33556
|
+
if (fetchFn === void 0) {
|
|
33557
|
+
throw new Error("No fetch implementation available");
|
|
33558
|
+
}
|
|
33559
|
+
const request = await buildPersonalServerDataReadRequest(params);
|
|
33560
|
+
const response = await fetchFn(request);
|
|
33561
|
+
if (!response.ok) {
|
|
33562
|
+
throw new Error(
|
|
33563
|
+
`Personal Server data read failed: ${response.status} ${response.statusText}`
|
|
33564
|
+
);
|
|
33565
|
+
}
|
|
33566
|
+
return DataFileEnvelopeSchema.parse(await response.json());
|
|
33567
|
+
}
|
|
33568
|
+
|
|
33346
33569
|
// src/protocol/gateway.ts
|
|
33347
33570
|
function createGatewayClient(baseUrl) {
|
|
33348
33571
|
const base = baseUrl.replace(/\/+$/, "");
|
|
@@ -33350,16 +33573,6 @@ function createGatewayClient(baseUrl) {
|
|
|
33350
33573
|
const envelope = await res.json();
|
|
33351
33574
|
return envelope.data;
|
|
33352
33575
|
}
|
|
33353
|
-
function normalizeFileRecord(record) {
|
|
33354
|
-
return {
|
|
33355
|
-
fileId: record.fileId ?? record.id ?? "",
|
|
33356
|
-
owner: record.owner ?? record.ownerAddress ?? "",
|
|
33357
|
-
url: record.url,
|
|
33358
|
-
schemaId: record.schemaId,
|
|
33359
|
-
createdAt: record.createdAt ?? record.addedAt ?? "",
|
|
33360
|
-
deletedAt: record.deletedAt ?? null
|
|
33361
|
-
};
|
|
33362
|
-
}
|
|
33363
33576
|
function getMutationId(body, key) {
|
|
33364
33577
|
const value = body[key] ?? body["id"];
|
|
33365
33578
|
return typeof value === "string" ? value : void 0;
|
|
@@ -33409,30 +33622,34 @@ function createGatewayClient(baseUrl) {
|
|
|
33409
33622
|
}
|
|
33410
33623
|
return unwrapEnvelope(res);
|
|
33411
33624
|
},
|
|
33412
|
-
async
|
|
33413
|
-
const res = await fetch(`${base}/v1/
|
|
33625
|
+
async getDataPoint(dataPointId) {
|
|
33626
|
+
const res = await fetch(`${base}/v1/data/${dataPointId}`);
|
|
33414
33627
|
if (res.status === 404) return null;
|
|
33415
33628
|
if (!res.ok) {
|
|
33416
33629
|
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
33417
33630
|
}
|
|
33418
|
-
return
|
|
33631
|
+
return unwrapEnvelope(res);
|
|
33419
33632
|
},
|
|
33420
|
-
async
|
|
33633
|
+
async listDataPointsByOwner(owner, cursor, options) {
|
|
33421
33634
|
const params = new URLSearchParams({ user: owner });
|
|
33422
33635
|
if (cursor !== null) {
|
|
33423
|
-
params.set("
|
|
33636
|
+
params.set("cursor", cursor);
|
|
33424
33637
|
}
|
|
33425
|
-
if (options?.
|
|
33426
|
-
params.set("
|
|
33638
|
+
if (options?.since) {
|
|
33639
|
+
params.set("since", options.since);
|
|
33427
33640
|
}
|
|
33428
|
-
|
|
33641
|
+
if (options?.limit !== void 0) {
|
|
33642
|
+
params.set("limit", String(options.limit));
|
|
33643
|
+
}
|
|
33644
|
+
const res = await fetch(`${base}/v1/data?${params.toString()}`);
|
|
33429
33645
|
if (!res.ok) {
|
|
33430
33646
|
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
33431
33647
|
}
|
|
33432
|
-
const
|
|
33648
|
+
const envelope = await res.json();
|
|
33649
|
+
const nextCursor = envelope.pagination?.hasMore === false ? null : envelope.pagination?.nextCursor ?? null;
|
|
33433
33650
|
return {
|
|
33434
|
-
|
|
33435
|
-
cursor:
|
|
33651
|
+
dataPoints: envelope.data.dataPoints,
|
|
33652
|
+
cursor: nextCursor
|
|
33436
33653
|
};
|
|
33437
33654
|
},
|
|
33438
33655
|
async getSchema(schemaId) {
|
|
@@ -33473,8 +33690,8 @@ function createGatewayClient(baseUrl) {
|
|
|
33473
33690
|
alreadyRegistered: false
|
|
33474
33691
|
};
|
|
33475
33692
|
},
|
|
33476
|
-
async
|
|
33477
|
-
const res = await fetch(`${base}/v1/
|
|
33693
|
+
async registerBuilder(params) {
|
|
33694
|
+
const res = await fetch(`${base}/v1/builders`, {
|
|
33478
33695
|
method: "POST",
|
|
33479
33696
|
headers: {
|
|
33480
33697
|
"Content-Type": "application/json",
|
|
@@ -33482,22 +33699,57 @@ function createGatewayClient(baseUrl) {
|
|
|
33482
33699
|
},
|
|
33483
33700
|
body: JSON.stringify({
|
|
33484
33701
|
ownerAddress: params.ownerAddress,
|
|
33485
|
-
|
|
33486
|
-
|
|
33702
|
+
granteeAddress: params.granteeAddress,
|
|
33703
|
+
publicKey: params.publicKey,
|
|
33704
|
+
appUrl: params.appUrl
|
|
33487
33705
|
})
|
|
33488
33706
|
});
|
|
33489
33707
|
if (res.status === 409) {
|
|
33490
33708
|
const body2 = await res.json().catch(() => ({}));
|
|
33491
33709
|
return {
|
|
33492
|
-
|
|
33710
|
+
builderId: getMutationId(
|
|
33711
|
+
body2,
|
|
33712
|
+
"builderId"
|
|
33713
|
+
),
|
|
33714
|
+
alreadyRegistered: true
|
|
33493
33715
|
};
|
|
33494
33716
|
}
|
|
33495
33717
|
if (!res.ok) {
|
|
33496
33718
|
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
33497
33719
|
}
|
|
33498
|
-
const body = await res.json();
|
|
33720
|
+
const body = await res.json().catch(() => ({}));
|
|
33721
|
+
return {
|
|
33722
|
+
builderId: getMutationId(body, "builderId"),
|
|
33723
|
+
alreadyRegistered: false
|
|
33724
|
+
};
|
|
33725
|
+
},
|
|
33726
|
+
async registerDataPoint(params) {
|
|
33727
|
+
const res = await fetch(`${base}/v1/data`, {
|
|
33728
|
+
method: "POST",
|
|
33729
|
+
headers: {
|
|
33730
|
+
"Content-Type": "application/json",
|
|
33731
|
+
Authorization: `Web3Signed ${params.signature}`
|
|
33732
|
+
},
|
|
33733
|
+
body: JSON.stringify({
|
|
33734
|
+
ownerAddress: params.ownerAddress,
|
|
33735
|
+
scope: params.scope,
|
|
33736
|
+
dataHash: params.dataHash,
|
|
33737
|
+
metadataHash: params.metadataHash,
|
|
33738
|
+
expectedVersion: params.expectedVersion
|
|
33739
|
+
})
|
|
33740
|
+
});
|
|
33741
|
+
if (!res.ok) {
|
|
33742
|
+
const body2 = await res.json().catch(() => ({}));
|
|
33743
|
+
const detail = body2.error ?? res.statusText;
|
|
33744
|
+
throw new Error(`Gateway error: ${res.status} ${detail}`);
|
|
33745
|
+
}
|
|
33746
|
+
const body = await res.json().catch(() => ({}));
|
|
33499
33747
|
return {
|
|
33500
|
-
|
|
33748
|
+
dataPointId: getMutationId(
|
|
33749
|
+
body,
|
|
33750
|
+
"dataPointId"
|
|
33751
|
+
),
|
|
33752
|
+
expectedVersion: body.expectedVersion
|
|
33501
33753
|
};
|
|
33502
33754
|
},
|
|
33503
33755
|
async createGrant(params) {
|
|
@@ -33510,8 +33762,9 @@ function createGatewayClient(baseUrl) {
|
|
|
33510
33762
|
body: JSON.stringify({
|
|
33511
33763
|
grantorAddress: params.grantorAddress,
|
|
33512
33764
|
granteeId: params.granteeId,
|
|
33513
|
-
|
|
33514
|
-
|
|
33765
|
+
scopes: params.scopes,
|
|
33766
|
+
grantVersion: params.grantVersion,
|
|
33767
|
+
expiresAt: params.expiresAt
|
|
33515
33768
|
})
|
|
33516
33769
|
});
|
|
33517
33770
|
if (res.status === 409) {
|
|
@@ -33536,7 +33789,8 @@ function createGatewayClient(baseUrl) {
|
|
|
33536
33789
|
Authorization: `Web3Signed ${params.signature}`
|
|
33537
33790
|
},
|
|
33538
33791
|
body: JSON.stringify({
|
|
33539
|
-
grantorAddress: params.grantorAddress
|
|
33792
|
+
grantorAddress: params.grantorAddress,
|
|
33793
|
+
grantVersion: params.grantVersion
|
|
33540
33794
|
})
|
|
33541
33795
|
});
|
|
33542
33796
|
if (res.status === 409) return;
|
|
@@ -33544,21 +33798,62 @@ function createGatewayClient(baseUrl) {
|
|
|
33544
33798
|
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
33545
33799
|
}
|
|
33546
33800
|
},
|
|
33547
|
-
async
|
|
33548
|
-
const res = await fetch(`${base}/v1/
|
|
33549
|
-
|
|
33801
|
+
async getEscrowBalance(account) {
|
|
33802
|
+
const res = await fetch(`${base}/v1/escrow/balance?account=${account}`);
|
|
33803
|
+
if (!res.ok) {
|
|
33804
|
+
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
33805
|
+
}
|
|
33806
|
+
return await res.json();
|
|
33807
|
+
},
|
|
33808
|
+
async submitEscrowDeposit(params) {
|
|
33809
|
+
const res = await fetch(`${base}/v1/escrow/deposit`, {
|
|
33810
|
+
method: "POST",
|
|
33811
|
+
headers: { "Content-Type": "application/json" },
|
|
33812
|
+
body: JSON.stringify({ txHash: params.txHash })
|
|
33813
|
+
});
|
|
33814
|
+
if (res.status !== 200 && res.status !== 202) {
|
|
33815
|
+
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
33816
|
+
}
|
|
33817
|
+
return await res.json();
|
|
33818
|
+
},
|
|
33819
|
+
async payForOperation(params) {
|
|
33820
|
+
const body = {
|
|
33821
|
+
payerAddress: params.payerAddress,
|
|
33822
|
+
opType: params.opType,
|
|
33823
|
+
opId: params.opId,
|
|
33824
|
+
asset: params.asset,
|
|
33825
|
+
amount: params.amount,
|
|
33826
|
+
paymentNonce: params.paymentNonce
|
|
33827
|
+
};
|
|
33828
|
+
if (params.accessRecord) {
|
|
33829
|
+
body["accessRecord"] = params.accessRecord;
|
|
33830
|
+
}
|
|
33831
|
+
const res = await fetch(`${base}/v1/escrow/pay`, {
|
|
33832
|
+
method: "POST",
|
|
33550
33833
|
headers: {
|
|
33551
33834
|
"Content-Type": "application/json",
|
|
33552
33835
|
Authorization: `Web3Signed ${params.signature}`
|
|
33553
33836
|
},
|
|
33554
|
-
body: JSON.stringify(
|
|
33555
|
-
|
|
33556
|
-
|
|
33837
|
+
body: JSON.stringify(body)
|
|
33838
|
+
});
|
|
33839
|
+
if (!res.ok) {
|
|
33840
|
+
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
33841
|
+
}
|
|
33842
|
+
return await res.json();
|
|
33843
|
+
},
|
|
33844
|
+
async settle(params) {
|
|
33845
|
+
const res = await fetch(`${base}/v1/settle`, {
|
|
33846
|
+
method: "POST",
|
|
33847
|
+
headers: { "Content-Type": "application/json" },
|
|
33848
|
+
// The gateway accepts an empty body; only `limit` is recognised.
|
|
33849
|
+
// Always send a JSON body so the gateway's req.body shape parse
|
|
33850
|
+
// doesn't have to deal with an undefined.
|
|
33851
|
+
body: JSON.stringify(params ?? {})
|
|
33557
33852
|
});
|
|
33558
|
-
if (res.status === 409) return;
|
|
33559
33853
|
if (!res.ok) {
|
|
33560
33854
|
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
33561
33855
|
}
|
|
33856
|
+
return await res.json();
|
|
33562
33857
|
}
|
|
33563
33858
|
};
|
|
33564
33859
|
}
|
|
@@ -33628,6 +33923,7 @@ async function parsePSError(response) {
|
|
|
33628
33923
|
// Annotate the CommonJS export names for ESM import in node:
|
|
33629
33924
|
0 && (module.exports = {
|
|
33630
33925
|
ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT,
|
|
33926
|
+
ADD_DATA_TYPES,
|
|
33631
33927
|
AccountPersonalServerLiteOwnerBindingError,
|
|
33632
33928
|
AccountPersonalServerRegistrationError,
|
|
33633
33929
|
BUILDER_REGISTRATION_TYPES,
|
|
@@ -33637,12 +33933,15 @@ async function parsePSError(response) {
|
|
|
33637
33933
|
CallbackStorage,
|
|
33638
33934
|
ContractFactory,
|
|
33639
33935
|
ContractNotFoundError,
|
|
33936
|
+
DATA_REGISTRY_STATUS_ABI,
|
|
33640
33937
|
DataFileEnvelopeSchema,
|
|
33938
|
+
DataPointStatus,
|
|
33641
33939
|
DropboxStorage,
|
|
33642
33940
|
ECIESError,
|
|
33941
|
+
ESCROW_DEPOSIT_ABI,
|
|
33643
33942
|
ExpiredTokenError,
|
|
33644
|
-
|
|
33645
|
-
|
|
33943
|
+
FEE_REGISTRY_ABI,
|
|
33944
|
+
GENERIC_PAYMENT_TYPES,
|
|
33646
33945
|
GRANT_REGISTRATION_TYPES,
|
|
33647
33946
|
GRANT_REVOCATION_TYPES,
|
|
33648
33947
|
GoogleDriveStorage,
|
|
@@ -33653,6 +33952,7 @@ async function parsePSError(response) {
|
|
|
33653
33952
|
IpfsStorage,
|
|
33654
33953
|
MASTER_KEY_MESSAGE,
|
|
33655
33954
|
MissingAuthError,
|
|
33955
|
+
NATIVE_VANA_ASSET,
|
|
33656
33956
|
NetworkError,
|
|
33657
33957
|
NodeECIESProvider,
|
|
33658
33958
|
NodePlatformAdapter,
|
|
@@ -33670,6 +33970,8 @@ async function parsePSError(response) {
|
|
|
33670
33970
|
PersonalServerError,
|
|
33671
33971
|
PinataStorage,
|
|
33672
33972
|
R2Storage,
|
|
33973
|
+
RECORD_DATA_ACCESS_TYPES,
|
|
33974
|
+
REGISTRATION_KIND_FOR_OP,
|
|
33673
33975
|
ReadOnlyError,
|
|
33674
33976
|
RelayerError,
|
|
33675
33977
|
SERVER_REGISTRATION_TYPES,
|
|
@@ -33684,10 +33986,15 @@ async function parsePSError(response) {
|
|
|
33684
33986
|
VanaError,
|
|
33685
33987
|
VanaStorage,
|
|
33686
33988
|
assertValidPkceVerifier,
|
|
33989
|
+
buildDepositNativeRequest,
|
|
33990
|
+
buildDepositTokenRequest,
|
|
33991
|
+
buildMarkDataPointUnavailableRequest,
|
|
33992
|
+
buildPersonalServerDataReadRequest,
|
|
33687
33993
|
buildPersonalServerLiteOwnerBindingMessage,
|
|
33688
33994
|
buildPersonalServerLiteOwnerBindingSignature,
|
|
33689
33995
|
buildPersonalServerRegistrationSignature,
|
|
33690
33996
|
buildPersonalServerRegistrationTypedData,
|
|
33997
|
+
buildSetDataPointStatusRequest,
|
|
33691
33998
|
buildWeb3SignedHeader,
|
|
33692
33999
|
builderRegistrationDomain,
|
|
33693
34000
|
chains,
|
|
@@ -33705,14 +34012,19 @@ async function parsePSError(response) {
|
|
|
33705
34012
|
createVanaStorageProvider,
|
|
33706
34013
|
createViemPersonalServerLiteOwnerBindingSigner,
|
|
33707
34014
|
createViemPersonalServerRegistrationSigner,
|
|
34015
|
+
dataRegistryContractAddress,
|
|
34016
|
+
dataRegistryDomain,
|
|
33708
34017
|
decryptWithPassword,
|
|
33709
34018
|
deriveMasterKey,
|
|
33710
34019
|
deriveScopeKey,
|
|
33711
34020
|
deserializeECIES,
|
|
33712
34021
|
detectPlatform,
|
|
34022
|
+
encodeDepositNativeData,
|
|
34023
|
+
encodeDepositTokenData,
|
|
34024
|
+
encodeSetDataPointStatusData,
|
|
33713
34025
|
encryptWithPassword,
|
|
33714
|
-
|
|
33715
|
-
|
|
34026
|
+
escrowContractAddress,
|
|
34027
|
+
escrowPaymentDomain,
|
|
33716
34028
|
generatePkceVerifier,
|
|
33717
34029
|
getAbi,
|
|
33718
34030
|
getAllChains,
|
|
@@ -33720,6 +34032,8 @@ async function parsePSError(response) {
|
|
|
33720
34032
|
getContractAddress,
|
|
33721
34033
|
getContractController,
|
|
33722
34034
|
getContractInfo,
|
|
34035
|
+
getFee,
|
|
34036
|
+
getOpFee,
|
|
33723
34037
|
getPlatformCapabilities,
|
|
33724
34038
|
getServiceEndpoints,
|
|
33725
34039
|
grantRegistrationDomain,
|
|
@@ -33731,11 +34045,12 @@ async function parsePSError(response) {
|
|
|
33731
34045
|
moksha,
|
|
33732
34046
|
mokshaServices,
|
|
33733
34047
|
mokshaTestnet,
|
|
33734
|
-
parseGrantRegistrationPayload,
|
|
33735
34048
|
parsePSError,
|
|
33736
34049
|
parseScope,
|
|
33737
34050
|
parseWeb3SignedHeader,
|
|
34051
|
+
personalServerDataReadPath,
|
|
33738
34052
|
personalServerRegistrationDomain,
|
|
34053
|
+
readPersonalServerData,
|
|
33739
34054
|
recoverServerOwner,
|
|
33740
34055
|
registerPersonalServerSignature,
|
|
33741
34056
|
scopeCoveredByGrant,
|