@opendatalabs/vana-sdk 3.4.1 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account/personal-server-lite-owner-binding.cjs +3 -3
- package/dist/account/personal-server-lite-owner-binding.cjs.map +1 -1
- package/dist/account/personal-server-lite-owner-binding.d.ts +2 -2
- package/dist/account/personal-server-lite-owner-binding.js +1 -1
- package/dist/account/personal-server-lite-owner-binding.js.map +1 -1
- package/dist/index.browser.d.ts +2 -1
- package/dist/index.browser.js +208 -23
- package/dist/index.browser.js.map +4 -4
- package/dist/index.node.cjs +213 -23
- package/dist/index.node.cjs.map +4 -4
- package/dist/index.node.d.ts +2 -1
- package/dist/index.node.js +208 -23
- package/dist/index.node.js.map +4 -4
- package/dist/{protocol/personal-server-lite-owner-binding.cjs → personal-server-lite/owner-binding.cjs} +5 -5
- package/dist/personal-server-lite/owner-binding.cjs.map +1 -0
- package/dist/{protocol/personal-server-lite-owner-binding.d.ts → personal-server-lite/owner-binding.d.ts} +3 -3
- package/dist/{protocol/personal-server-lite-owner-binding.js → personal-server-lite/owner-binding.js} +2 -2
- package/dist/personal-server-lite/owner-binding.js.map +1 -0
- package/dist/protocol/escrow.cjs +146 -0
- package/dist/protocol/escrow.cjs.map +1 -0
- package/dist/protocol/escrow.d.ts +336 -0
- package/dist/protocol/escrow.js +118 -0
- package/dist/protocol/escrow.js.map +1 -0
- package/dist/protocol/escrow.test.d.ts +1 -0
- package/dist/protocol/personal-server-registration.cjs +16 -4
- package/dist/protocol/personal-server-registration.cjs.map +1 -1
- package/dist/protocol/personal-server-registration.d.ts +5 -2
- package/dist/protocol/personal-server-registration.js +16 -4
- package/dist/protocol/personal-server-registration.js.map +1 -1
- package/dist/storage/providers/vana-storage.cjs +75 -17
- package/dist/storage/providers/vana-storage.cjs.map +1 -1
- package/dist/storage/providers/vana-storage.js +75 -17
- package/dist/storage/providers/vana-storage.js.map +1 -1
- package/package.json +1 -1
- package/dist/protocol/personal-server-lite-owner-binding.cjs.map +0 -1
- package/dist/protocol/personal-server-lite-owner-binding.js.map +0 -1
- /package/dist/{protocol/personal-server-lite-owner-binding.test.d.ts → personal-server-lite/owner-binding.test.d.ts} +0 -0
package/dist/index.node.d.ts
CHANGED
|
@@ -37,11 +37,12 @@ export { InMemoryTokenStore, type TokenStore, type TokenRecord, } from "./auth/t
|
|
|
37
37
|
export { OAuthClient, type OAuthClientConfig, type AuthorizationUrlResult, } from "./auth/oauth-client";
|
|
38
38
|
export { fileRegistrationDomain, fileDeletionDomain, grantRegistrationDomain, grantRevocationDomain, serverRegistrationDomain, builderRegistrationDomain, FILE_REGISTRATION_TYPES, FILE_DELETION_TYPES, GRANT_REGISTRATION_TYPES, GRANT_REVOCATION_TYPES, SERVER_REGISTRATION_TYPES, BUILDER_REGISTRATION_TYPES, type DataPortabilityContracts, type DataPortabilityGatewayConfig, type FileRegistrationMessage, type FileDeletionMessage, type GrantRegistrationMessage, type GrantRevocationMessage, type ServerRegistrationMessage, type BuilderRegistrationMessage, } from "./protocol/eip712";
|
|
39
39
|
export { PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID, PERSONAL_SERVER_REGISTRATION_DEFAULT_VERIFYING_CONTRACT, personalServerRegistrationDomain, createViemPersonalServerRegistrationSigner, buildPersonalServerRegistrationTypedData, buildPersonalServerRegistrationSignature, registerPersonalServerSignature, type PersonalServerRegistrationTypedData, type PersonalServerRegistrationSigner, type PersonalServerRegistrationDomainInput, type ViemPersonalServerRegistrationWalletClient, type ViemPersonalServerRegistrationSignerSource, type BuildPersonalServerRegistrationTypedDataInput, type BuildPersonalServerRegistrationSignatureInput, type PersonalServerRegistrationSignature, } from "./protocol/personal-server-registration";
|
|
40
|
-
export { PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION, PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE, PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX, buildPersonalServerLiteOwnerBindingMessage, createViemPersonalServerLiteOwnerBindingSigner, buildPersonalServerLiteOwnerBindingSignature, signPersonalServerLiteOwnerBinding, type PersonalServerLiteOwnerBindingPurpose, type PersonalServerLiteOwnerBindingMessage, type PersonalServerLiteOwnerBindingSigner, type ViemPersonalServerLiteOwnerBindingWalletClient, type ViemPersonalServerLiteOwnerBindingSignerSource, type BuildPersonalServerLiteOwnerBindingSignatureInput, type PersonalServerLiteOwnerBindingSignature, } from "./
|
|
40
|
+
export { PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION, PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE, PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX, buildPersonalServerLiteOwnerBindingMessage, createViemPersonalServerLiteOwnerBindingSigner, buildPersonalServerLiteOwnerBindingSignature, signPersonalServerLiteOwnerBinding, type PersonalServerLiteOwnerBindingPurpose, type PersonalServerLiteOwnerBindingMessage, type PersonalServerLiteOwnerBindingSigner, type ViemPersonalServerLiteOwnerBindingWalletClient, type ViemPersonalServerLiteOwnerBindingSignerSource, type BuildPersonalServerLiteOwnerBindingSignatureInput, type PersonalServerLiteOwnerBindingSignature, } from "./personal-server-lite/owner-binding";
|
|
41
41
|
export { ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT, AccountPersonalServerRegistrationError, signPersonalServerRegistrationWithAccount, type AccountPersonalServerRegistrationIntent, type AccountPersonalServerRegistrationSignature, type AccountPersonalServerRegistrationStatus, type AccountPersonalServerRegistrationRequest, type AccountPersonalServerRegistrationConfig, type AccountSignedPersonalServerRegistration, type AccountConfirmationRequiredPersonalServerRegistration, type AccountFallbackSignedPersonalServerRegistration, type AccountPersonalServerRegistrationResult, } from "./account/personal-server-registration";
|
|
42
42
|
export { AccountPersonalServerLiteOwnerBindingError, signPersonalServerLiteOwnerBindingWithAccountClient, type AccountPersonalServerLiteOwnerBindingClient, type SignPersonalServerLiteOwnerBindingWithAccountClientConfig, } from "./account/personal-server-lite-owner-binding";
|
|
43
43
|
export { isDataPortabilityGatewayConfig, parseGrantRegistrationPayload, verifyGrantRegistration, type DataPortabilityGrantPayload, type VerifyGrantRegistrationInput, type VerifyGrantRegistrationResult, } from "./protocol/grants";
|
|
44
44
|
export { ScopeSchema, parseScope, scopeToPathSegments, scopeMatchesPattern, scopeCoveredByGrant, type Scope, type ParsedScope, } from "./protocol/scopes";
|
|
45
45
|
export { DataFileEnvelopeSchema, createDataFileEnvelope, IngestResponseSchema, type DataFileEnvelope, type IngestResponse, } from "./protocol/data-file";
|
|
46
46
|
export { createGatewayClient, type GatewayEnvelope, type GatewayProof, type Builder, type Schema, type ServerInfo, type GatewayGrantResponse, type GrantListItem, type FileRecord, type FileListResult, type ListFilesOptions, type RegisterServerParams, type RegisterServerResult, type RegisterFileParams, type CreateGrantParams, type RevokeGrantParams, type DeleteFileParams, type GatewayClient, } from "./protocol/gateway";
|
|
47
|
+
export { createEscrowGatewayClient, genericPaymentDomain, GENERIC_PAYMENT_TYPES, ESCROW_DEPOSIT_ABI, NATIVE_ASSET_ADDRESS, type GenericPaymentMessage, type EscrowBalanceEntry, type EscrowBalanceResult, type EscrowBalanceSyncResult, type DepositSubmissionResult, type PaymentBreakdown, type EscrowPayResult, type SubmitDepositParams, type PayForOpParams, type EscrowGatewayClient, type SubmittedDepositEntry, type FinalizedDepositEntry, type FailedDepositEntry, } from "./protocol/escrow";
|
|
47
48
|
export { PSError, parsePSError, type PSErrorCode } from "./types/ps-errors";
|
package/dist/index.node.js
CHANGED
|
@@ -29018,6 +29018,8 @@ async function buildWeb3SignedHeader(params) {
|
|
|
29018
29018
|
var DEFAULT_ENDPOINT = "https://storage.vana.org";
|
|
29019
29019
|
var BLOB_PATH_PREFIX = "/v1/blobs";
|
|
29020
29020
|
var DEFAULT_TOKEN_TTL_SECONDS = 300;
|
|
29021
|
+
var MAX_UPLOAD_ATTEMPTS = 4;
|
|
29022
|
+
var MAX_RATE_LIMIT_DELAY_MS = 3e4;
|
|
29021
29023
|
var VanaStorage = class {
|
|
29022
29024
|
endpoint;
|
|
29023
29025
|
signer;
|
|
@@ -29056,27 +29058,46 @@ var VanaStorage = class {
|
|
|
29056
29058
|
const body = new Uint8Array(await file.arrayBuffer());
|
|
29057
29059
|
const contentType = file.type !== "" ? file.type : "application/octet-stream";
|
|
29058
29060
|
const header = await this.signRequest("PUT", path, body);
|
|
29059
|
-
let response;
|
|
29060
|
-
|
|
29061
|
-
|
|
29062
|
-
|
|
29063
|
-
|
|
29064
|
-
|
|
29065
|
-
|
|
29066
|
-
|
|
29067
|
-
|
|
29068
|
-
|
|
29069
|
-
|
|
29061
|
+
let response = null;
|
|
29062
|
+
let responseText = "";
|
|
29063
|
+
for (let attempt = 1; attempt <= MAX_UPLOAD_ATTEMPTS; attempt++) {
|
|
29064
|
+
try {
|
|
29065
|
+
response = await this.fetchImpl(`${this.endpoint}${path}`, {
|
|
29066
|
+
method: "PUT",
|
|
29067
|
+
headers: {
|
|
29068
|
+
authorization: header,
|
|
29069
|
+
"content-type": contentType
|
|
29070
|
+
},
|
|
29071
|
+
body
|
|
29072
|
+
});
|
|
29073
|
+
} catch (cause) {
|
|
29074
|
+
throw new StorageError(
|
|
29075
|
+
`vana-storage upload network error: ${describe(cause)}`,
|
|
29076
|
+
"UPLOAD_ERROR",
|
|
29077
|
+
"vana-storage",
|
|
29078
|
+
{ cause: cause instanceof Error ? cause : void 0 }
|
|
29079
|
+
);
|
|
29080
|
+
}
|
|
29081
|
+
if (response.ok) {
|
|
29082
|
+
break;
|
|
29083
|
+
}
|
|
29084
|
+
responseText = await safeText(response);
|
|
29085
|
+
if (response.status === 429 && attempt < MAX_UPLOAD_ATTEMPTS) {
|
|
29086
|
+
const delayMs = retryDelayMs(response, responseText);
|
|
29087
|
+
if (delayMs > 0) {
|
|
29088
|
+
await sleep(delayMs);
|
|
29089
|
+
}
|
|
29090
|
+
continue;
|
|
29091
|
+
}
|
|
29070
29092
|
throw new StorageError(
|
|
29071
|
-
`vana-storage upload
|
|
29072
|
-
"
|
|
29073
|
-
"vana-storage"
|
|
29074
|
-
{ cause: cause instanceof Error ? cause : void 0 }
|
|
29093
|
+
`vana-storage upload failed: ${response.status} ${response.statusText} - ${responseText}`,
|
|
29094
|
+
"UPLOAD_FAILED",
|
|
29095
|
+
"vana-storage"
|
|
29075
29096
|
);
|
|
29076
29097
|
}
|
|
29077
|
-
if (!response
|
|
29098
|
+
if (!response?.ok) {
|
|
29078
29099
|
throw new StorageError(
|
|
29079
|
-
`vana-storage upload failed
|
|
29100
|
+
`vana-storage upload failed after ${MAX_UPLOAD_ATTEMPTS} attempts - ${responseText}`,
|
|
29080
29101
|
"UPLOAD_FAILED",
|
|
29081
29102
|
"vana-storage"
|
|
29082
29103
|
);
|
|
@@ -29229,6 +29250,43 @@ function describe(value) {
|
|
|
29229
29250
|
if (value instanceof Error) return value.message;
|
|
29230
29251
|
return String(value);
|
|
29231
29252
|
}
|
|
29253
|
+
function retryDelayMs(response, responseText) {
|
|
29254
|
+
const headerDelayMs = parseRetryAfterHeaderMs(
|
|
29255
|
+
response.headers.get("retry-after")
|
|
29256
|
+
);
|
|
29257
|
+
if (headerDelayMs !== null) {
|
|
29258
|
+
return clampRateLimitDelay(headerDelayMs);
|
|
29259
|
+
}
|
|
29260
|
+
return clampRateLimitDelay(parseRetryAfterBodyMs(responseText) ?? 0);
|
|
29261
|
+
}
|
|
29262
|
+
function parseRetryAfterHeaderMs(value) {
|
|
29263
|
+
if (!value) return null;
|
|
29264
|
+
const seconds = Number(value);
|
|
29265
|
+
if (Number.isFinite(seconds)) {
|
|
29266
|
+
return seconds * 1e3;
|
|
29267
|
+
}
|
|
29268
|
+
const dateMs = Date.parse(value);
|
|
29269
|
+
if (Number.isFinite(dateMs)) {
|
|
29270
|
+
return Math.max(0, dateMs - Date.now());
|
|
29271
|
+
}
|
|
29272
|
+
return null;
|
|
29273
|
+
}
|
|
29274
|
+
function parseRetryAfterBodyMs(responseText) {
|
|
29275
|
+
if (!responseText) return null;
|
|
29276
|
+
try {
|
|
29277
|
+
const parsed = JSON.parse(responseText);
|
|
29278
|
+
const seconds = Number(parsed.retryAfter);
|
|
29279
|
+
return Number.isFinite(seconds) ? seconds * 1e3 : null;
|
|
29280
|
+
} catch {
|
|
29281
|
+
return null;
|
|
29282
|
+
}
|
|
29283
|
+
}
|
|
29284
|
+
function clampRateLimitDelay(delayMs) {
|
|
29285
|
+
return Math.min(Math.max(0, delayMs), MAX_RATE_LIMIT_DELAY_MS);
|
|
29286
|
+
}
|
|
29287
|
+
function sleep(ms) {
|
|
29288
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
29289
|
+
}
|
|
29232
29290
|
async function safeText(response) {
|
|
29233
29291
|
try {
|
|
29234
29292
|
return await response.text();
|
|
@@ -32601,8 +32659,11 @@ var BUILDER_REGISTRATION_TYPES = {
|
|
|
32601
32659
|
import {
|
|
32602
32660
|
isAddress
|
|
32603
32661
|
} from "viem";
|
|
32604
|
-
var PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID =
|
|
32605
|
-
var PERSONAL_SERVER_REGISTRATION_DEFAULT_VERIFYING_CONTRACT =
|
|
32662
|
+
var PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID = vanaMainnet2.id;
|
|
32663
|
+
var PERSONAL_SERVER_REGISTRATION_DEFAULT_VERIFYING_CONTRACT = getContractAddress(
|
|
32664
|
+
PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID,
|
|
32665
|
+
"DataPortabilityServers"
|
|
32666
|
+
);
|
|
32606
32667
|
function assertAddress(value, name) {
|
|
32607
32668
|
if (!isAddress(value)) {
|
|
32608
32669
|
throw new Error(`${name} must be a valid EVM address`);
|
|
@@ -32617,6 +32678,12 @@ function getAccountAddress(account) {
|
|
|
32617
32678
|
function isPersonalServerRegistrationSigner(source) {
|
|
32618
32679
|
return "address" in source && typeof source.signTypedData === "function";
|
|
32619
32680
|
}
|
|
32681
|
+
function getDefaultServerRegistrationContract(chainId) {
|
|
32682
|
+
return getContractAddress(
|
|
32683
|
+
chainId,
|
|
32684
|
+
"DataPortabilityServers"
|
|
32685
|
+
);
|
|
32686
|
+
}
|
|
32620
32687
|
function createViemPersonalServerRegistrationSigner(source, options = {}) {
|
|
32621
32688
|
if (isPersonalServerRegistrationSigner(source)) {
|
|
32622
32689
|
return source;
|
|
@@ -32639,12 +32706,13 @@ function personalServerRegistrationDomain(input = {}) {
|
|
|
32639
32706
|
if (input.config) {
|
|
32640
32707
|
return serverRegistrationDomain(input.config);
|
|
32641
32708
|
}
|
|
32642
|
-
const
|
|
32709
|
+
const chainId = input.chainId ?? PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID;
|
|
32710
|
+
const verifyingContract = input.verifyingContract ?? getDefaultServerRegistrationContract(chainId);
|
|
32643
32711
|
assertAddress(verifyingContract, "verifyingContract");
|
|
32644
32712
|
return {
|
|
32645
32713
|
name: "Vana Data Portability",
|
|
32646
32714
|
version: "1",
|
|
32647
|
-
chainId
|
|
32715
|
+
chainId,
|
|
32648
32716
|
verifyingContract
|
|
32649
32717
|
};
|
|
32650
32718
|
}
|
|
@@ -32682,11 +32750,11 @@ async function buildPersonalServerRegistrationSignature(input) {
|
|
|
32682
32750
|
}
|
|
32683
32751
|
var registerPersonalServerSignature = buildPersonalServerRegistrationSignature;
|
|
32684
32752
|
|
|
32685
|
-
// src/
|
|
32753
|
+
// src/personal-server-lite/owner-binding.ts
|
|
32686
32754
|
import {
|
|
32687
32755
|
isAddress as isAddress2
|
|
32688
32756
|
} from "viem";
|
|
32689
|
-
var PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION = "vana.
|
|
32757
|
+
var PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION = "vana.ps-lite.owner-binding.v1";
|
|
32690
32758
|
var PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE = "ps-lite-owner";
|
|
32691
32759
|
var PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX = `${PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION}:${PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE}:`;
|
|
32692
32760
|
function assertAddress2(value, name) {
|
|
@@ -33429,6 +33497,118 @@ function createGatewayClient(baseUrl) {
|
|
|
33429
33497
|
};
|
|
33430
33498
|
}
|
|
33431
33499
|
|
|
33500
|
+
// src/protocol/escrow.ts
|
|
33501
|
+
var GENERIC_PAYMENT_TYPES = {
|
|
33502
|
+
GenericPayment: [
|
|
33503
|
+
{ name: "payerAddress", type: "address" },
|
|
33504
|
+
{ name: "opType", type: "string" },
|
|
33505
|
+
{ name: "opId", type: "bytes32" },
|
|
33506
|
+
{ name: "asset", type: "address" },
|
|
33507
|
+
{ name: "amount", type: "uint256" },
|
|
33508
|
+
{ name: "paymentNonce", type: "uint256" }
|
|
33509
|
+
]
|
|
33510
|
+
};
|
|
33511
|
+
function genericPaymentDomain(chainId, escrowContract) {
|
|
33512
|
+
return {
|
|
33513
|
+
name: "Vana Data Portability",
|
|
33514
|
+
version: "1",
|
|
33515
|
+
chainId,
|
|
33516
|
+
verifyingContract: escrowContract
|
|
33517
|
+
};
|
|
33518
|
+
}
|
|
33519
|
+
var ESCROW_DEPOSIT_ABI = [
|
|
33520
|
+
{
|
|
33521
|
+
type: "function",
|
|
33522
|
+
name: "depositNative",
|
|
33523
|
+
stateMutability: "payable",
|
|
33524
|
+
inputs: [{ name: "account", type: "address" }],
|
|
33525
|
+
outputs: []
|
|
33526
|
+
},
|
|
33527
|
+
{
|
|
33528
|
+
type: "function",
|
|
33529
|
+
name: "depositToken",
|
|
33530
|
+
stateMutability: "nonpayable",
|
|
33531
|
+
inputs: [
|
|
33532
|
+
{ name: "account", type: "address" },
|
|
33533
|
+
{ name: "token", type: "address" },
|
|
33534
|
+
{ name: "amount", type: "uint256" }
|
|
33535
|
+
],
|
|
33536
|
+
outputs: []
|
|
33537
|
+
}
|
|
33538
|
+
];
|
|
33539
|
+
var NATIVE_ASSET_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
33540
|
+
function createEscrowGatewayClient(baseUrl) {
|
|
33541
|
+
const base = baseUrl.replace(/\/+$/, "");
|
|
33542
|
+
async function throwOnError(res, context) {
|
|
33543
|
+
if (!res.ok) {
|
|
33544
|
+
let detail = "";
|
|
33545
|
+
try {
|
|
33546
|
+
const body = await res.json();
|
|
33547
|
+
if (body.error) detail = `: ${body.error}`;
|
|
33548
|
+
} catch {
|
|
33549
|
+
}
|
|
33550
|
+
throw new Error(
|
|
33551
|
+
`Escrow gateway error (${context}): ${res.status} ${res.statusText}${detail}`
|
|
33552
|
+
);
|
|
33553
|
+
}
|
|
33554
|
+
}
|
|
33555
|
+
return {
|
|
33556
|
+
async submitDeposit({ txHash }) {
|
|
33557
|
+
const res = await fetch(`${base}/v1/escrow/deposit`, {
|
|
33558
|
+
method: "POST",
|
|
33559
|
+
headers: { "Content-Type": "application/json" },
|
|
33560
|
+
body: JSON.stringify({ txHash })
|
|
33561
|
+
});
|
|
33562
|
+
if (res.status !== 200 && res.status !== 202) {
|
|
33563
|
+
await throwOnError(res, "POST /v1/escrow/deposit");
|
|
33564
|
+
}
|
|
33565
|
+
return res.json();
|
|
33566
|
+
},
|
|
33567
|
+
async getEscrowBalance(account) {
|
|
33568
|
+
const res = await fetch(
|
|
33569
|
+
`${base}/v1/escrow/balance?account=${encodeURIComponent(account)}`
|
|
33570
|
+
);
|
|
33571
|
+
await throwOnError(res, "GET /v1/escrow/balance");
|
|
33572
|
+
return res.json();
|
|
33573
|
+
},
|
|
33574
|
+
async syncEscrowBalance(account) {
|
|
33575
|
+
const res = await fetch(
|
|
33576
|
+
`${base}/v1/escrow/balance/sync?account=${encodeURIComponent(account)}`,
|
|
33577
|
+
{ method: "POST" }
|
|
33578
|
+
);
|
|
33579
|
+
await throwOnError(res, "POST /v1/escrow/balance/sync");
|
|
33580
|
+
return res.json();
|
|
33581
|
+
},
|
|
33582
|
+
async payForOp({
|
|
33583
|
+
payerAddress,
|
|
33584
|
+
opType,
|
|
33585
|
+
opId,
|
|
33586
|
+
asset,
|
|
33587
|
+
amount,
|
|
33588
|
+
paymentNonce,
|
|
33589
|
+
signature
|
|
33590
|
+
}) {
|
|
33591
|
+
const res = await fetch(`${base}/v1/escrow/pay`, {
|
|
33592
|
+
method: "POST",
|
|
33593
|
+
headers: {
|
|
33594
|
+
"Content-Type": "application/json",
|
|
33595
|
+
Authorization: `Web3Signed ${signature}`
|
|
33596
|
+
},
|
|
33597
|
+
body: JSON.stringify({
|
|
33598
|
+
payerAddress,
|
|
33599
|
+
opType,
|
|
33600
|
+
opId,
|
|
33601
|
+
asset,
|
|
33602
|
+
amount,
|
|
33603
|
+
paymentNonce
|
|
33604
|
+
})
|
|
33605
|
+
});
|
|
33606
|
+
await throwOnError(res, "POST /v1/escrow/pay");
|
|
33607
|
+
return res.json();
|
|
33608
|
+
}
|
|
33609
|
+
};
|
|
33610
|
+
}
|
|
33611
|
+
|
|
33432
33612
|
// src/types/ps-errors.ts
|
|
33433
33613
|
var PSError = class extends Error {
|
|
33434
33614
|
constructor(code, message) {
|
|
@@ -33505,9 +33685,11 @@ export {
|
|
|
33505
33685
|
DataFileEnvelopeSchema,
|
|
33506
33686
|
DropboxStorage,
|
|
33507
33687
|
ECIESError,
|
|
33688
|
+
ESCROW_DEPOSIT_ABI,
|
|
33508
33689
|
ExpiredTokenError,
|
|
33509
33690
|
FILE_DELETION_TYPES,
|
|
33510
33691
|
FILE_REGISTRATION_TYPES,
|
|
33692
|
+
GENERIC_PAYMENT_TYPES,
|
|
33511
33693
|
GRANT_REGISTRATION_TYPES,
|
|
33512
33694
|
GRANT_REVOCATION_TYPES,
|
|
33513
33695
|
GoogleDriveStorage,
|
|
@@ -33518,6 +33700,7 @@ export {
|
|
|
33518
33700
|
IpfsStorage,
|
|
33519
33701
|
MASTER_KEY_MESSAGE,
|
|
33520
33702
|
MissingAuthError,
|
|
33703
|
+
NATIVE_ASSET_ADDRESS,
|
|
33521
33704
|
NetworkError,
|
|
33522
33705
|
NodeECIESUint8Provider as NodeECIESProvider,
|
|
33523
33706
|
NodePlatformAdapter,
|
|
@@ -33562,6 +33745,7 @@ export {
|
|
|
33562
33745
|
contractCacheForTesting,
|
|
33563
33746
|
createBrowserPlatformAdapter,
|
|
33564
33747
|
createDataFileEnvelope,
|
|
33748
|
+
createEscrowGatewayClient,
|
|
33565
33749
|
createGatewayClient,
|
|
33566
33750
|
createNodePlatformAdapter,
|
|
33567
33751
|
createPlatformAdapter,
|
|
@@ -33579,6 +33763,7 @@ export {
|
|
|
33579
33763
|
fileDeletionDomain,
|
|
33580
33764
|
fileRegistrationDomain,
|
|
33581
33765
|
generatePkceVerifier,
|
|
33766
|
+
genericPaymentDomain,
|
|
33582
33767
|
getAbi,
|
|
33583
33768
|
getAllChains,
|
|
33584
33769
|
getChainConfig,
|