@opendatalabs/vana-sdk 3.13.4-pr.186.afb5a4f → 3.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/contracts.config.cjs +1 -1
- package/dist/config/contracts.config.cjs.map +1 -1
- package/dist/config/contracts.config.js +1 -1
- package/dist/config/contracts.config.js.map +1 -1
- package/dist/direct/access-request-client.cjs +3 -1
- package/dist/direct/access-request-client.cjs.map +1 -1
- package/dist/direct/access-request-client.js +3 -1
- package/dist/direct/access-request-client.js.map +1 -1
- package/dist/direct/controller.cjs +72 -32
- package/dist/direct/controller.cjs.map +1 -1
- package/dist/direct/controller.d.ts +41 -3
- package/dist/direct/controller.js +77 -33
- package/dist/direct/controller.js.map +1 -1
- package/dist/direct/errors.cjs +11 -2
- package/dist/direct/errors.cjs.map +1 -1
- package/dist/direct/errors.d.ts +13 -0
- package/dist/direct/errors.js +9 -1
- package/dist/direct/errors.js.map +1 -1
- package/dist/direct/escrow-payment.cjs.map +1 -1
- package/dist/direct/escrow-payment.d.ts +2 -2
- package/dist/direct/escrow-payment.js.map +1 -1
- package/dist/direct/types.cjs.map +1 -1
- package/dist/direct/types.d.ts +33 -1
- package/dist/direct/types.js.map +1 -1
- package/dist/generated/addresses.cjs +6 -6
- package/dist/generated/addresses.cjs.map +1 -1
- package/dist/generated/addresses.d.ts +6 -6
- package/dist/generated/addresses.js +6 -6
- package/dist/generated/addresses.js.map +1 -1
- package/dist/index.browser.d.ts +2 -2
- package/dist/index.browser.js +7 -136
- package/dist/index.browser.js.map +2 -2
- package/dist/index.node.cjs +18 -151
- package/dist/index.node.cjs.map +3 -3
- package/dist/index.node.d.ts +2 -2
- package/dist/index.node.js +17 -146
- package/dist/index.node.js.map +3 -3
- package/dist/protocol/eip712.cjs +2 -28
- package/dist/protocol/eip712.cjs.map +1 -1
- package/dist/protocol/eip712.d.ts +0 -70
- package/dist/protocol/eip712.js +1 -24
- package/dist/protocol/eip712.js.map +1 -1
- package/dist/protocol/escrow.cjs +2 -118
- package/dist/protocol/escrow.cjs.map +1 -1
- package/dist/protocol/escrow.d.ts +2 -108
- package/dist/protocol/escrow.js +1 -116
- package/dist/protocol/escrow.js.map +1 -1
- package/dist/protocol/gateway.cjs.map +1 -1
- package/dist/protocol/gateway.d.ts +38 -8
- package/dist/protocol/gateway.js.map +1 -1
- package/dist/server.cjs +2 -0
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -0
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/index.node.cjs
CHANGED
|
@@ -1191,7 +1191,6 @@ __export(index_node_exports, {
|
|
|
1191
1191
|
DropboxStorage: () => DropboxStorage,
|
|
1192
1192
|
ECIESError: () => ECIESError,
|
|
1193
1193
|
ESCROW_DEPOSIT_ABI: () => ESCROW_DEPOSIT_ABI2,
|
|
1194
|
-
EscrowWithdrawalLifecycleError: () => EscrowWithdrawalLifecycleError,
|
|
1195
1194
|
ExpiredTokenError: () => ExpiredTokenError,
|
|
1196
1195
|
FEE_REGISTRY_ABI: () => FEE_REGISTRY_ABI,
|
|
1197
1196
|
GENERIC_PAYMENT_TYPES: () => GENERIC_PAYMENT_TYPES,
|
|
@@ -1240,7 +1239,6 @@ __export(index_node_exports, {
|
|
|
1240
1239
|
UserRejectedRequestError: () => UserRejectedRequestError,
|
|
1241
1240
|
VanaError: () => VanaError,
|
|
1242
1241
|
VanaStorage: () => VanaStorage,
|
|
1243
|
-
WITHDRAW_AUTHORIZATION_TYPES: () => WITHDRAW_AUTHORIZATION_TYPES,
|
|
1244
1242
|
assertValidPkceVerifier: () => assertValidPkceVerifier,
|
|
1245
1243
|
authorizeEscrowPayment: () => authorizeEscrowPayment,
|
|
1246
1244
|
authorizeGrantPayment: () => authorizeGrantPayment,
|
|
@@ -1256,7 +1254,6 @@ __export(index_node_exports, {
|
|
|
1256
1254
|
buildPersonalServerRegistrationTypedData: () => buildPersonalServerRegistrationTypedData,
|
|
1257
1255
|
buildSetDataPointStatusRequest: () => buildSetDataPointStatusRequest,
|
|
1258
1256
|
buildWeb3SignedHeader: () => buildWeb3SignedHeader,
|
|
1259
|
-
buildWithdrawAuthorizationTypedData: () => buildWithdrawAuthorizationTypedData,
|
|
1260
1257
|
builderRegistrationDomain: () => builderRegistrationDomain,
|
|
1261
1258
|
chains: () => chains,
|
|
1262
1259
|
clearContractCache: () => clearContractCache,
|
|
@@ -1333,8 +1330,7 @@ __export(index_node_exports, {
|
|
|
1333
1330
|
vanaMainnet: () => vanaMainnet2,
|
|
1334
1331
|
verifyGrantRegistration: () => verifyGrantRegistration,
|
|
1335
1332
|
verifyPkceChallenge: () => verifyPkceChallenge,
|
|
1336
|
-
verifyWeb3Signed: () => verifyWeb3Signed
|
|
1337
|
-
withdrawAuthorizationDomain: () => withdrawAuthorizationDomain
|
|
1333
|
+
verifyWeb3Signed: () => verifyWeb3Signed
|
|
1338
1334
|
});
|
|
1339
1335
|
module.exports = __toCommonJS(index_node_exports);
|
|
1340
1336
|
|
|
@@ -28652,7 +28648,7 @@ var CONTRACTS = {
|
|
|
28652
28648
|
},
|
|
28653
28649
|
DataPortabilityServers: {
|
|
28654
28650
|
addresses: {
|
|
28655
|
-
14800: "
|
|
28651
|
+
14800: "0xCae2CE0e9caa6643ed28186cF57bd40Bd9E17Eab",
|
|
28656
28652
|
1480: "0x1483B1F634DBA75AeaE60da7f01A679aabd5ee2c"
|
|
28657
28653
|
}
|
|
28658
28654
|
},
|
|
@@ -28810,7 +28806,7 @@ var CONTRACTS = {
|
|
|
28810
28806
|
},
|
|
28811
28807
|
_meta: {
|
|
28812
28808
|
discoveredFrom: "ComputeEngine",
|
|
28813
|
-
lastUpdated: "2026-
|
|
28809
|
+
lastUpdated: "2026-08-18"
|
|
28814
28810
|
}
|
|
28815
28811
|
},
|
|
28816
28812
|
VanaTreasury: {
|
|
@@ -28820,7 +28816,7 @@ var CONTRACTS = {
|
|
|
28820
28816
|
},
|
|
28821
28817
|
_meta: {
|
|
28822
28818
|
discoveredFrom: "QueryEngine",
|
|
28823
|
-
lastUpdated: "2026-
|
|
28819
|
+
lastUpdated: "2026-08-18"
|
|
28824
28820
|
}
|
|
28825
28821
|
},
|
|
28826
28822
|
DLPRegistryTreasury: {
|
|
@@ -28830,7 +28826,7 @@ var CONTRACTS = {
|
|
|
28830
28826
|
},
|
|
28831
28827
|
_meta: {
|
|
28832
28828
|
discoveredFrom: "DLPRegistry",
|
|
28833
|
-
lastUpdated: "2026-
|
|
28829
|
+
lastUpdated: "2026-08-18"
|
|
28834
28830
|
}
|
|
28835
28831
|
},
|
|
28836
28832
|
VanaPoolTreasury: {
|
|
@@ -28840,7 +28836,7 @@ var CONTRACTS = {
|
|
|
28840
28836
|
},
|
|
28841
28837
|
_meta: {
|
|
28842
28838
|
discoveredFrom: "VanaPoolStaking",
|
|
28843
|
-
lastUpdated: "2026-
|
|
28839
|
+
lastUpdated: "2026-08-18"
|
|
28844
28840
|
}
|
|
28845
28841
|
},
|
|
28846
28842
|
VanaPoolEntity: {
|
|
@@ -28850,7 +28846,7 @@ var CONTRACTS = {
|
|
|
28850
28846
|
},
|
|
28851
28847
|
_meta: {
|
|
28852
28848
|
discoveredFrom: "VanaPoolStaking",
|
|
28853
|
-
lastUpdated: "2026-
|
|
28849
|
+
lastUpdated: "2026-08-18"
|
|
28854
28850
|
}
|
|
28855
28851
|
}
|
|
28856
28852
|
};
|
|
@@ -32894,9 +32890,6 @@ function escrowPaymentDomain(config) {
|
|
|
32894
32890
|
config.contracts.dataPortabilityEscrow
|
|
32895
32891
|
);
|
|
32896
32892
|
}
|
|
32897
|
-
function withdrawAuthorizationDomain(config) {
|
|
32898
|
-
return escrowPaymentDomain(config);
|
|
32899
|
-
}
|
|
32900
32893
|
var GRANT_REGISTRATION_TYPES = {
|
|
32901
32894
|
GrantRegistration: [
|
|
32902
32895
|
{ name: "grantorAddress", type: "address" },
|
|
@@ -32929,15 +32922,6 @@ var BUILDER_REGISTRATION_TYPES = {
|
|
|
32929
32922
|
{ name: "appUrl", type: "string" }
|
|
32930
32923
|
]
|
|
32931
32924
|
};
|
|
32932
|
-
var WITHDRAW_AUTHORIZATION_TYPES = {
|
|
32933
|
-
WithdrawAuthorization: [
|
|
32934
|
-
{ name: "account", type: "address" },
|
|
32935
|
-
{ name: "asset", type: "address" },
|
|
32936
|
-
{ name: "amount", type: "uint256" },
|
|
32937
|
-
{ name: "withdrawNonce", type: "uint256" },
|
|
32938
|
-
{ name: "deadline", type: "uint256" }
|
|
32939
|
-
]
|
|
32940
|
-
};
|
|
32941
32925
|
var ADD_DATA_TYPES = {
|
|
32942
32926
|
AddData: [
|
|
32943
32927
|
{ name: "ownerAddress", type: "address" },
|
|
@@ -32956,14 +32940,6 @@ var RECORD_DATA_ACCESS_TYPES = {
|
|
|
32956
32940
|
{ name: "recordId", type: "bytes32" }
|
|
32957
32941
|
]
|
|
32958
32942
|
};
|
|
32959
|
-
function buildWithdrawAuthorizationTypedData(config, message) {
|
|
32960
|
-
return {
|
|
32961
|
-
domain: withdrawAuthorizationDomain(config),
|
|
32962
|
-
types: WITHDRAW_AUTHORIZATION_TYPES,
|
|
32963
|
-
primaryType: "WithdrawAuthorization",
|
|
32964
|
-
message
|
|
32965
|
-
};
|
|
32966
|
-
}
|
|
32967
32943
|
|
|
32968
32944
|
// src/protocol/personal-server-registration.ts
|
|
32969
32945
|
var import_viem14 = require("viem");
|
|
@@ -34070,7 +34046,6 @@ function createGatewayClient(baseUrl) {
|
|
|
34070
34046
|
}
|
|
34071
34047
|
|
|
34072
34048
|
// src/protocol/escrow.ts
|
|
34073
|
-
var import_viem21 = require("viem");
|
|
34074
34049
|
var GENERIC_PAYMENT_TYPES = {
|
|
34075
34050
|
GenericPayment: [
|
|
34076
34051
|
{ name: "payerAddress", type: "address" },
|
|
@@ -34110,26 +34085,6 @@ var ESCROW_DEPOSIT_ABI2 = [
|
|
|
34110
34085
|
}
|
|
34111
34086
|
];
|
|
34112
34087
|
var NATIVE_ASSET_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
34113
|
-
var EscrowWithdrawalLifecycleError = class extends Error {
|
|
34114
|
-
constructor(httpStatus, result) {
|
|
34115
|
-
super(result.error);
|
|
34116
|
-
this.httpStatus = httpStatus;
|
|
34117
|
-
this.result = result;
|
|
34118
|
-
}
|
|
34119
|
-
httpStatus;
|
|
34120
|
-
result;
|
|
34121
|
-
name = "EscrowWithdrawalLifecycleError";
|
|
34122
|
-
};
|
|
34123
|
-
var EscrowWithdrawalRejectionError = class extends Error {
|
|
34124
|
-
constructor(httpStatus, result) {
|
|
34125
|
-
super(result.error);
|
|
34126
|
-
this.httpStatus = httpStatus;
|
|
34127
|
-
this.result = result;
|
|
34128
|
-
}
|
|
34129
|
-
httpStatus;
|
|
34130
|
-
result;
|
|
34131
|
-
name = "EscrowWithdrawalRejectionError";
|
|
34132
|
-
};
|
|
34133
34088
|
function createEscrowGatewayClient(baseUrl) {
|
|
34134
34089
|
const base = baseUrl.replace(/\/+$/, "");
|
|
34135
34090
|
async function throwOnError(res, context) {
|
|
@@ -34145,27 +34100,6 @@ function createEscrowGatewayClient(baseUrl) {
|
|
|
34145
34100
|
);
|
|
34146
34101
|
}
|
|
34147
34102
|
}
|
|
34148
|
-
async function throwOnWithdrawError(res) {
|
|
34149
|
-
if (res.ok) return;
|
|
34150
|
-
let body;
|
|
34151
|
-
try {
|
|
34152
|
-
body = await res.json();
|
|
34153
|
-
} catch {
|
|
34154
|
-
throw new Error(
|
|
34155
|
-
`Escrow gateway error (POST /v1/escrow/withdraw): ${res.status} ${res.statusText}`
|
|
34156
|
-
);
|
|
34157
|
-
}
|
|
34158
|
-
if (isEscrowWithdrawalFailureResult(body)) {
|
|
34159
|
-
throw new EscrowWithdrawalLifecycleError(res.status, body);
|
|
34160
|
-
}
|
|
34161
|
-
if (isEscrowWithdrawalRejectedResult(body)) {
|
|
34162
|
-
throw new EscrowWithdrawalRejectionError(res.status, body);
|
|
34163
|
-
}
|
|
34164
|
-
const error = getGatewayErrorMessage(body);
|
|
34165
|
-
throw new Error(
|
|
34166
|
-
`Escrow gateway error (POST /v1/escrow/withdraw): ${res.status} ${res.statusText}${error ? `: ${error}` : ""}`
|
|
34167
|
-
);
|
|
34168
|
-
}
|
|
34169
34103
|
return {
|
|
34170
34104
|
async submitDeposit({ txHash }) {
|
|
34171
34105
|
const res = await fetch(`${base}/v1/escrow/deposit`, {
|
|
@@ -34221,72 +34155,9 @@ function createEscrowGatewayClient(baseUrl) {
|
|
|
34221
34155
|
});
|
|
34222
34156
|
await throwOnError(res, "POST /v1/escrow/pay");
|
|
34223
34157
|
return res.json();
|
|
34224
|
-
},
|
|
34225
|
-
async withdraw({
|
|
34226
|
-
account,
|
|
34227
|
-
asset,
|
|
34228
|
-
amount,
|
|
34229
|
-
withdrawNonce,
|
|
34230
|
-
deadline,
|
|
34231
|
-
signature
|
|
34232
|
-
}) {
|
|
34233
|
-
const res = await fetch(`${base}/v1/escrow/withdraw`, {
|
|
34234
|
-
method: "POST",
|
|
34235
|
-
headers: {
|
|
34236
|
-
"Content-Type": "application/json",
|
|
34237
|
-
Authorization: `Web3Signed ${signature}`
|
|
34238
|
-
},
|
|
34239
|
-
body: JSON.stringify({
|
|
34240
|
-
account,
|
|
34241
|
-
asset,
|
|
34242
|
-
amount,
|
|
34243
|
-
withdrawNonce,
|
|
34244
|
-
deadline
|
|
34245
|
-
})
|
|
34246
|
-
});
|
|
34247
|
-
await throwOnWithdrawError(res);
|
|
34248
|
-
return res.json();
|
|
34249
34158
|
}
|
|
34250
34159
|
};
|
|
34251
34160
|
}
|
|
34252
|
-
function getGatewayErrorMessage(body) {
|
|
34253
|
-
if (typeof body === "object" && body !== null && "error" in body && typeof body.error === "string") {
|
|
34254
|
-
return body.error;
|
|
34255
|
-
}
|
|
34256
|
-
return void 0;
|
|
34257
|
-
}
|
|
34258
|
-
function isEscrowWithdrawalFailureResult(body) {
|
|
34259
|
-
if (typeof body !== "object" || body === null) return false;
|
|
34260
|
-
const value = body;
|
|
34261
|
-
return value.success === false && (value.status === "retryable" || value.status === "reorged" || value.status === "failed") && typeof value.error === "string" && isAddressHex(value.account) && isAddressHex(value.asset) && isUint256Decimal(value.amount) && isUint256Decimal(value.withdrawNonce) && isUint256Decimal(value.deadline) && (isHash(value.txHash) || value.txHash === null) && (!("blockNumber" in value) || isBlockNumber(value.blockNumber));
|
|
34262
|
-
}
|
|
34263
|
-
function isEscrowWithdrawalRejectedResult(body) {
|
|
34264
|
-
if (typeof body !== "object" || body === null) return false;
|
|
34265
|
-
const value = body;
|
|
34266
|
-
return value.success === false && value.status === "rejected" && isWithdrawalRejectionCode(value.code) && typeof value.error === "string" && isAddressHex(value.account) && isAddressHex(value.asset) && isUint256Decimal(value.amount) && isUint256Decimal(value.withdrawNonce) && isUint256Decimal(value.deadline) && optionalUint256Decimal(value.balance) && optionalUint256Decimal(value.authorizedAmount) && optionalUint256Decimal(value.withdrawingAmount) && optionalUint256Decimal(value.availableAmount) && optionalUint256Decimal(value.requestedAmount) && optionalUint256Decimal(value.minimumAmount);
|
|
34267
|
-
}
|
|
34268
|
-
function isWithdrawalRejectionCode(value) {
|
|
34269
|
-
return value === "below_minimum" || value === "deadline_too_far" || value === "expired" || value === "insufficient_available" || value === "stale_nonce";
|
|
34270
|
-
}
|
|
34271
|
-
function optionalUint256Decimal(value) {
|
|
34272
|
-
return value === void 0 || isUint256Decimal(value);
|
|
34273
|
-
}
|
|
34274
|
-
function isAddressHex(value) {
|
|
34275
|
-
return typeof value === "string" && (0, import_viem21.isHex)(value, { strict: true }) && value.length === 42;
|
|
34276
|
-
}
|
|
34277
|
-
function isHash(value) {
|
|
34278
|
-
return typeof value === "string" && (0, import_viem21.isHex)(value, { strict: true }) && value.length === 66;
|
|
34279
|
-
}
|
|
34280
|
-
function isUint256Decimal(value) {
|
|
34281
|
-
if (typeof value !== "string" || value.length === 0 || value.length > 78) {
|
|
34282
|
-
return false;
|
|
34283
|
-
}
|
|
34284
|
-
if (!/^(0|[1-9]\d*)$/.test(value)) return false;
|
|
34285
|
-
return BigInt(value) <= 2n ** 256n - 1n;
|
|
34286
|
-
}
|
|
34287
|
-
function isBlockNumber(value) {
|
|
34288
|
-
return value === null || isUint256Decimal(value);
|
|
34289
|
-
}
|
|
34290
34161
|
|
|
34291
34162
|
// src/direct/escrow-payment.ts
|
|
34292
34163
|
var GRANT_OP_TYPE = "grant";
|
|
@@ -34323,12 +34194,12 @@ var UINT256_MAX = (1n << 256n) - 1n;
|
|
|
34323
34194
|
var ADDRESS_RE = /^0x[0-9a-fA-F]{40}$/;
|
|
34324
34195
|
var BYTES32_RE = /^0x[0-9a-fA-F]{64}$/;
|
|
34325
34196
|
var SIGNATURE_RE = /^0x[0-9a-fA-F]{130}$/;
|
|
34326
|
-
function
|
|
34197
|
+
function isUint256Decimal(value, allowZero) {
|
|
34327
34198
|
const pattern = allowZero ? /^(0|[1-9]\d*)$/ : /^[1-9]\d*$/;
|
|
34328
34199
|
return value.length <= UINT256_MAX.toString().length && pattern.test(value) && BigInt(value) <= UINT256_MAX;
|
|
34329
34200
|
}
|
|
34330
34201
|
function isValidAccessRecord(record) {
|
|
34331
|
-
return BYTES32_RE.test(record.dataPointId) &&
|
|
34202
|
+
return BYTES32_RE.test(record.dataPointId) && isUint256Decimal(record.version, false) && ADDRESS_RE.test(record.accessor) && BYTES32_RE.test(record.recordId) && SIGNATURE_RE.test(record.signature);
|
|
34332
34203
|
}
|
|
34333
34204
|
function validateSigningOperation(payerAddress, required) {
|
|
34334
34205
|
if (!ADDRESS_RE.test(payerAddress)) {
|
|
@@ -34340,10 +34211,10 @@ function validateSigningOperation(payerAddress, required) {
|
|
|
34340
34211
|
if (!ADDRESS_RE.test(required.asset || NATIVE_ASSET_ADDRESS)) {
|
|
34341
34212
|
throw new Error("Payment asset must be a 20-byte EVM address");
|
|
34342
34213
|
}
|
|
34343
|
-
if (!
|
|
34214
|
+
if (!isUint256Decimal(required.amount, true)) {
|
|
34344
34215
|
throw new Error("Payment amount must be a canonical uint256 decimal");
|
|
34345
34216
|
}
|
|
34346
|
-
if (required.paymentNonce !== void 0 && !
|
|
34217
|
+
if (required.paymentNonce !== void 0 && !isUint256Decimal(required.paymentNonce, false)) {
|
|
34347
34218
|
throw new Error("Payment nonce must be a positive uint256 decimal");
|
|
34348
34219
|
}
|
|
34349
34220
|
const accessRecord = required.accessRecord;
|
|
@@ -34474,7 +34345,7 @@ function paymentResponseMetadataFromHeader(header) {
|
|
|
34474
34345
|
const registrationFee = stringField(breakdown, "registrationFee");
|
|
34475
34346
|
const dataAccessFee = stringField(breakdown, "dataAccessFee");
|
|
34476
34347
|
const paidAt = stringField(result, "paidAt");
|
|
34477
|
-
if (result?.success !== true || !opType || !opId || !BYTES32_RE.test(opId) || !payerAddress || !ADDRESS_RE.test(payerAddress) || !asset || !ADDRESS_RE.test(asset) || !amount || !
|
|
34348
|
+
if (result?.success !== true || !opType || !opId || !BYTES32_RE.test(opId) || !payerAddress || !ADDRESS_RE.test(payerAddress) || !asset || !ADDRESS_RE.test(asset) || !amount || !isUint256Decimal(amount, true) || !paymentNonce || !isUint256Decimal(paymentNonce, false) || !registrationFee || !isUint256Decimal(registrationFee, true) || !dataAccessFee || !isUint256Decimal(dataAccessFee, true) || typeof breakdown?.registrationPaid !== "boolean" || !paidAt || !isCanonicalIsoTimestamp(paidAt)) {
|
|
34478
34349
|
return void 0;
|
|
34479
34350
|
}
|
|
34480
34351
|
return {
|
|
@@ -34564,15 +34435,15 @@ function isBytes32Hex(value) {
|
|
|
34564
34435
|
return /^0x[0-9a-fA-F]{64}$/.test(value);
|
|
34565
34436
|
}
|
|
34566
34437
|
var UINT256_MAX2 = (1n << 256n) - 1n;
|
|
34567
|
-
function
|
|
34438
|
+
function isAddressHex(value) {
|
|
34568
34439
|
return /^0x[0-9a-fA-F]{40}$/.test(value);
|
|
34569
34440
|
}
|
|
34570
|
-
function
|
|
34441
|
+
function isUint256Decimal2(value, allowZero) {
|
|
34571
34442
|
const pattern = allowZero ? /^(0|[1-9]\d*)$/ : /^[1-9]\d*$/;
|
|
34572
34443
|
return value.length <= UINT256_MAX2.toString().length && pattern.test(value) && BigInt(value) <= UINT256_MAX2;
|
|
34573
34444
|
}
|
|
34574
34445
|
function isValidDataAccessRecord(record) {
|
|
34575
|
-
return isBytes32Hex(record.dataPointId) &&
|
|
34446
|
+
return isBytes32Hex(record.dataPointId) && isUint256Decimal2(record.version, false) && isAddressHex(record.accessor) && isBytes32Hex(record.recordId) && /^0x[0-9a-fA-F]{130}$/.test(record.signature);
|
|
34576
34447
|
}
|
|
34577
34448
|
function parseLegacyGrantOperation(params) {
|
|
34578
34449
|
const { challengeGrantId, challengeOpId, challengeOpType, grantId } = params;
|
|
@@ -34623,7 +34494,7 @@ function parseCanonicalDataAccessAccept(value) {
|
|
|
34623
34494
|
const accessRecord = parseAccessRecord(accept?.accessRecord);
|
|
34624
34495
|
const acceptAsset = stringField2(accept, "asset");
|
|
34625
34496
|
const acceptAmount = stringField2(accept, "amount");
|
|
34626
|
-
if (!network || !payerAddress || !
|
|
34497
|
+
if (!network || !payerAddress || !isAddressHex(payerAddress) || !opId || !isBytes32Hex(opId) || !asset || !isAddressHex(asset) || !amount || !isUint256Decimal2(amount, true) || !paymentNonce || !isUint256Decimal2(paymentNonce, false) || !accessRecord || !isValidDataAccessRecord(accessRecord) || payerAddress.toLowerCase() !== accessRecord.accessor.toLowerCase() || opId.toLowerCase() !== accessRecord.recordId.toLowerCase() || !acceptAsset || acceptAsset.toLowerCase() !== asset.toLowerCase() || acceptAmount !== amount) {
|
|
34627
34498
|
return null;
|
|
34628
34499
|
}
|
|
34629
34500
|
return {
|
|
@@ -34708,7 +34579,7 @@ async function parsePersonalServerPaymentRequired(res, grantId) {
|
|
|
34708
34579
|
const acceptAmount = stringField2(accept, "amount");
|
|
34709
34580
|
const accessRecord2 = parseAccessRecord(accept.accessRecord);
|
|
34710
34581
|
const hasAccessRecord = accept.accessRecord !== void 0;
|
|
34711
|
-
if (!network || !payerAddress || !
|
|
34582
|
+
if (!network || !payerAddress || !isAddressHex(payerAddress) || !opId || !isBytes32Hex(opId) || !asset || !isAddressHex(asset) || !amount || !isUint256Decimal2(amount, true) || !paymentNonce || !isUint256Decimal2(paymentNonce, false) || !acceptAsset || acceptAsset.toLowerCase() !== asset.toLowerCase() || acceptAmount !== amount || hasAccessRecord && (!accessRecord2 || !isValidDataAccessRecord(accessRecord2) || accessRecord2.accessor.toLowerCase() !== payerAddress.toLowerCase()) || amount === "0" && !accessRecord2) {
|
|
34712
34583
|
throw new PersonalServerReadError(
|
|
34713
34584
|
"Personal Server grant payment challenge was untrusted or incomplete",
|
|
34714
34585
|
402
|
|
@@ -34838,7 +34709,6 @@ async function parsePSError(response) {
|
|
|
34838
34709
|
DropboxStorage,
|
|
34839
34710
|
ECIESError,
|
|
34840
34711
|
ESCROW_DEPOSIT_ABI,
|
|
34841
|
-
EscrowWithdrawalLifecycleError,
|
|
34842
34712
|
ExpiredTokenError,
|
|
34843
34713
|
FEE_REGISTRY_ABI,
|
|
34844
34714
|
GENERIC_PAYMENT_TYPES,
|
|
@@ -34887,7 +34757,6 @@ async function parsePSError(response) {
|
|
|
34887
34757
|
UserRejectedRequestError,
|
|
34888
34758
|
VanaError,
|
|
34889
34759
|
VanaStorage,
|
|
34890
|
-
WITHDRAW_AUTHORIZATION_TYPES,
|
|
34891
34760
|
assertValidPkceVerifier,
|
|
34892
34761
|
authorizeEscrowPayment,
|
|
34893
34762
|
authorizeGrantPayment,
|
|
@@ -34903,7 +34772,6 @@ async function parsePSError(response) {
|
|
|
34903
34772
|
buildPersonalServerRegistrationTypedData,
|
|
34904
34773
|
buildSetDataPointStatusRequest,
|
|
34905
34774
|
buildWeb3SignedHeader,
|
|
34906
|
-
buildWithdrawAuthorizationTypedData,
|
|
34907
34775
|
builderRegistrationDomain,
|
|
34908
34776
|
chains,
|
|
34909
34777
|
clearContractCache,
|
|
@@ -34980,7 +34848,6 @@ async function parsePSError(response) {
|
|
|
34980
34848
|
vanaMainnet,
|
|
34981
34849
|
verifyGrantRegistration,
|
|
34982
34850
|
verifyPkceChallenge,
|
|
34983
|
-
verifyWeb3Signed
|
|
34984
|
-
withdrawAuthorizationDomain
|
|
34851
|
+
verifyWeb3Signed
|
|
34985
34852
|
});
|
|
34986
34853
|
//# sourceMappingURL=index.node.cjs.map
|