@oasisprotocol/privana-sdk 0.5.2 → 0.5.4
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 +35 -38
- package/dist/{chunk-UHXVYWTF.cjs → chunk-FGWMLLEC.cjs} +903 -241
- package/dist/chunk-FGWMLLEC.cjs.map +1 -0
- package/dist/{chunk-ZVUMV4NR.js → chunk-QQG4RPYZ.js} +899 -243
- package/dist/chunk-QQG4RPYZ.js.map +1 -0
- package/dist/index.cjs +1581 -1692
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +33 -52
- package/dist/index.d.ts +33 -52
- package/dist/index.js +1389 -1505
- package/dist/index.js.map +1 -1
- package/dist/on-ramp.cjs +3 -3
- package/dist/on-ramp.d.cts +5 -4
- package/dist/on-ramp.d.ts +5 -4
- package/dist/on-ramp.js +1 -1
- package/dist/{pending-lock-BdkuMjmY.d.cts → pending-lock-DSEqUHOw.d.cts} +42 -8
- package/dist/{pending-lock-BdkuMjmY.d.ts → pending-lock-DSEqUHOw.d.ts} +42 -8
- package/package.json +1 -1
- package/dist/chunk-UHXVYWTF.cjs.map +0 -1
- package/dist/chunk-ZVUMV4NR.js.map +0 -1
package/dist/on-ramp.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkFGWMLLEC_cjs = require('./chunk-FGWMLLEC.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "FiatOnRampForm", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkFGWMLLEC_cjs.FiatOnRampForm; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "useFiatOnRamp", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkFGWMLLEC_cjs.useFiatOnRamp; }
|
|
15
15
|
});
|
|
16
16
|
//# sourceMappingURL=on-ramp.cjs.map
|
|
17
17
|
//# sourceMappingURL=on-ramp.cjs.map
|
package/dist/on-ramp.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MoonPayBuyWidget } from '@moonpay/moonpay-react';
|
|
2
|
-
import { B as Bytes32,
|
|
3
|
-
export { C as CreateOnRampIntentRequest,
|
|
2
|
+
import { B as Bytes32, Z as OnRampPostDepositLockConfig, e as TransactionSubmissionResponse, f as PostDepositLockError, _ as OnRampRecord, T as TokenConfig } from './pending-lock-DSEqUHOw.cjs';
|
|
3
|
+
export { C as CreateOnRampIntentRequest, n as CreateOnRampIntentResponse, $ as OnRampStatus, a2 as PendingOnRampsResponse, a6 as SignOnRampUrlRequest, a7 as SignOnRampUrlResponse, al as UpdateOnRampRequest, am as UpdateOnRampResponse } from './pending-lock-DSEqUHOw.cjs';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import 'viem';
|
|
6
6
|
|
|
@@ -37,8 +37,9 @@ interface UseFiatOnRampOptions {
|
|
|
37
37
|
onLockSubmitted?: (response: TransactionSubmissionResponse) => void;
|
|
38
38
|
/**
|
|
39
39
|
* Fired when the deposit credited but the pre-signed lock could not be
|
|
40
|
-
* submitted. The funds sit in the user's available balance
|
|
41
|
-
*
|
|
40
|
+
* submitted. The funds sit in the user's available balance. Fresh signing
|
|
41
|
+
* is safe only for failures known to precede any API attempt; otherwise
|
|
42
|
+
* retry or reconcile the same signature. Falls back to `onError`.
|
|
42
43
|
*/
|
|
43
44
|
onLockFailed?: (error: PostDepositLockError) => void;
|
|
44
45
|
onError?: (error: Error) => void;
|
package/dist/on-ramp.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MoonPayBuyWidget } from '@moonpay/moonpay-react';
|
|
2
|
-
import { B as Bytes32,
|
|
3
|
-
export { C as CreateOnRampIntentRequest,
|
|
2
|
+
import { B as Bytes32, Z as OnRampPostDepositLockConfig, e as TransactionSubmissionResponse, f as PostDepositLockError, _ as OnRampRecord, T as TokenConfig } from './pending-lock-DSEqUHOw.js';
|
|
3
|
+
export { C as CreateOnRampIntentRequest, n as CreateOnRampIntentResponse, $ as OnRampStatus, a2 as PendingOnRampsResponse, a6 as SignOnRampUrlRequest, a7 as SignOnRampUrlResponse, al as UpdateOnRampRequest, am as UpdateOnRampResponse } from './pending-lock-DSEqUHOw.js';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import 'viem';
|
|
6
6
|
|
|
@@ -37,8 +37,9 @@ interface UseFiatOnRampOptions {
|
|
|
37
37
|
onLockSubmitted?: (response: TransactionSubmissionResponse) => void;
|
|
38
38
|
/**
|
|
39
39
|
* Fired when the deposit credited but the pre-signed lock could not be
|
|
40
|
-
* submitted. The funds sit in the user's available balance
|
|
41
|
-
*
|
|
40
|
+
* submitted. The funds sit in the user's available balance. Fresh signing
|
|
41
|
+
* is safe only for failures known to precede any API attempt; otherwise
|
|
42
|
+
* retry or reconcile the same signature. Falls back to `onError`.
|
|
42
43
|
*/
|
|
43
44
|
onLockFailed?: (error: PostDepositLockError) => void;
|
|
44
45
|
onError?: (error: Error) => void;
|
package/dist/on-ramp.js
CHANGED
|
@@ -4,7 +4,7 @@ var networks = {
|
|
|
4
4
|
testnet: {
|
|
5
5
|
chainId: 23295,
|
|
6
6
|
name: "Sapphire Testnet",
|
|
7
|
-
accountingContract: "
|
|
7
|
+
accountingContract: "0x910CFfe4e8B27bc367F6E34D6D8e3C31DED68B6f",
|
|
8
8
|
apiUrl: "https://api.testnet.privana.finance"
|
|
9
9
|
},
|
|
10
10
|
mainnet: {
|
|
@@ -438,6 +438,7 @@ declare class HttpClient {
|
|
|
438
438
|
type PrivanaClientConfig = HttpClientConfig;
|
|
439
439
|
declare class PrivanaClient {
|
|
440
440
|
private readonly http;
|
|
441
|
+
private readonly baseConfig;
|
|
441
442
|
constructor(config: PrivanaClientConfig);
|
|
442
443
|
getBaseUrl(): string;
|
|
443
444
|
getDepositAddress(request?: DepositAddressRequest): Promise<DepositAddressResponse>;
|
|
@@ -478,20 +479,43 @@ declare class PrivanaClient {
|
|
|
478
479
|
createOnRampIntent(request: CreateOnRampIntentRequest): Promise<CreateOnRampIntentResponse>;
|
|
479
480
|
updateOnRamp(transactionId: string, request: UpdateOnRampRequest): Promise<UpdateOnRampResponse>;
|
|
480
481
|
getPendingOnRamps(): Promise<PendingOnRampsResponse>;
|
|
482
|
+
/**
|
|
483
|
+
* @deprecated This mutates the shared client's headers and displaces its Authorization
|
|
484
|
+
* (JWT bearer) header, which breaks concurrent JWT-authenticated requests. Use
|
|
485
|
+
* {@link PrivanaClient.withPrivateReadToken} instead, which returns a scoped client that
|
|
486
|
+
* authenticates the private read without touching the shared client's headers. Will be
|
|
487
|
+
* removed in a future release.
|
|
488
|
+
*/
|
|
481
489
|
setPrivateReadToken(token: string): void;
|
|
490
|
+
/**
|
|
491
|
+
* @deprecated The shared client no longer carries a private-read token between requests;
|
|
492
|
+
* private reads now run on a scoped client from {@link PrivanaClient.withPrivateReadToken}.
|
|
493
|
+
* Returns whatever X-SIWE-Token is currently set on the shared client's headers. Will be
|
|
494
|
+
* removed in a future release.
|
|
495
|
+
*/
|
|
482
496
|
getPrivateReadToken(): string | undefined;
|
|
483
497
|
clearPrivateReadToken(): void;
|
|
484
498
|
setBearerToken(token: string): void;
|
|
485
499
|
clearBearerToken(): void;
|
|
500
|
+
/**
|
|
501
|
+
* Returns a scoped client whose requests authenticate with the given SIWE private-read
|
|
502
|
+
* token (X-SIWE-Token) instead of the client-wide JWT bearer. The scoped client shares
|
|
503
|
+
* baseUrl/timeout/base headers but owns a separate header set, so private reads issued
|
|
504
|
+
* through it never displace the real client's Authorization header: concurrent
|
|
505
|
+
* JWT-authenticated requests on the real client keep their bearer, and a bearer installed
|
|
506
|
+
* mid-flight (auto-login/hydration) is never erased by a private read.
|
|
507
|
+
*/
|
|
508
|
+
withPrivateReadToken(token: string): PrivanaClient;
|
|
486
509
|
}
|
|
487
510
|
|
|
488
511
|
/**
|
|
489
512
|
* Deposit-and-lock without backend involvement: the user pre-signs a regular
|
|
490
513
|
* `Lock` (EIP-712) for the exact expected amount before the deposit, the SDK
|
|
491
514
|
* persists the payload, and submits it to POST /funds/lock once the deposit is
|
|
492
|
-
* credited. Every failure fails closed
|
|
493
|
-
*
|
|
494
|
-
*
|
|
515
|
+
* credited. Every failure fails closed. Deterministic preflight failures such
|
|
516
|
+
* as a short credit or expired signature can safely request a fresh signature;
|
|
517
|
+
* once an API attempt starts, recovery must replay that signature unless the
|
|
518
|
+
* attempt was cross-tab serialized and definitively rejected.
|
|
495
519
|
* Services must only act on lock confirmation, never on deposit.
|
|
496
520
|
*/
|
|
497
521
|
interface PostDepositLockConfig {
|
|
@@ -532,6 +556,12 @@ declare function applyLockBuffer(amount: bigint, buffer?: number): bigint;
|
|
|
532
556
|
* signed lock must never exceed it, no matter what the flow computed.
|
|
533
557
|
*/
|
|
534
558
|
declare function clampLockAmount(amount: bigint, maxAmount?: bigint): bigint;
|
|
559
|
+
/**
|
|
560
|
+
* The provider's `serviceAddress` is optional; every lock flow needs it set
|
|
561
|
+
* before a `Lock` can be signed.
|
|
562
|
+
*/
|
|
563
|
+
declare function requireServiceAddress(serviceAddress: Address | undefined): Address;
|
|
564
|
+
declare function requireDepositLockOwner(walletAddress: Address | undefined, beneficiary: Address | null): Address;
|
|
535
565
|
interface CreateSignedLockRequestParams {
|
|
536
566
|
client: PrivanaClient;
|
|
537
567
|
walletClient: WalletClient;
|
|
@@ -561,15 +591,17 @@ type PostDepositLockFailureReason =
|
|
|
561
591
|
/** No persisted signed lock for this deposit (storage cleared, other device). */
|
|
562
592
|
| 'not-found';
|
|
563
593
|
/**
|
|
564
|
-
* The deposit itself was credited; only the post-credit lock failed. UIs
|
|
565
|
-
*
|
|
594
|
+
* The deposit itself was credited; only the post-credit lock failed. UIs may
|
|
595
|
+
* request a fresh signature only when no prior API attempt could have landed.
|
|
566
596
|
*/
|
|
567
597
|
declare class PostDepositLockError extends Error {
|
|
568
598
|
readonly reason: PostDepositLockFailureReason;
|
|
569
599
|
readonly signedAmount?: bigint | undefined;
|
|
570
600
|
readonly creditedAmount?: bigint | undefined;
|
|
601
|
+
readonly submissionMayHaveSucceeded: boolean;
|
|
571
602
|
constructor(message: string, reason: PostDepositLockFailureReason, signedAmount?: bigint | undefined, creditedAmount?: bigint | undefined, options?: {
|
|
572
603
|
cause?: unknown;
|
|
604
|
+
submissionMayHaveSucceeded?: boolean;
|
|
573
605
|
});
|
|
574
606
|
}
|
|
575
607
|
interface SubmitPendingLockParams {
|
|
@@ -577,13 +609,15 @@ interface SubmitPendingLockParams {
|
|
|
577
609
|
payload: LockFundsRequest;
|
|
578
610
|
/** Credited amount in base units, when known — skips a guaranteed revert. */
|
|
579
611
|
creditedAmount?: bigint;
|
|
612
|
+
/** Runs after deterministic preflight checks and immediately before the API request. */
|
|
613
|
+
beforeSubmit?: () => void;
|
|
580
614
|
}
|
|
581
615
|
/**
|
|
582
616
|
* Submit a pre-signed lock after the deposit credited. Throws
|
|
583
617
|
* `PostDepositLockError` on every failure path so callers can route to the
|
|
584
618
|
* re-prompt flow.
|
|
585
619
|
*/
|
|
586
|
-
declare function submitPendingLock({ client, payload, creditedAmount, }: SubmitPendingLockParams): Promise<TransactionSubmissionResponse>;
|
|
620
|
+
declare function submitPendingLock({ client, payload, creditedAmount, beforeSubmit, }: SubmitPendingLockParams): Promise<TransactionSubmissionResponse>;
|
|
587
621
|
/**
|
|
588
622
|
* Persist a signed lock so submission survives a page reload between deposit
|
|
589
623
|
* and credit. `correlationId` ties it to the deposit (tx hash) or on-ramp
|
|
@@ -597,4 +631,4 @@ declare function savePendingLock(userAddress: string, correlationId: string, pay
|
|
|
597
631
|
declare function loadPendingLock(userAddress: string, correlationId: string): LockFundsRequest | undefined;
|
|
598
632
|
declare function clearPendingLock(userAddress: string, correlationId: string): void;
|
|
599
633
|
|
|
600
|
-
export { type
|
|
634
|
+
export { type OnRampStatus as $, type Address as A, type Bytes32 as B, type CreateOnRampIntentRequest as C, type DepositAddressResponse as D, type ExpiredLocksResponse as E, type HttpClientConfig as F, type JwtLogoutRequest as G, type HostedAuthTokenExchangeResponse as H, type IntegerLike as I, type JwtRefreshResponse as J, type JwtLogoutResponse as K, type LockInfo as L, type JwtRefreshRequest as M, type NetworkConfig as N, type LockFundsRequest as O, PrivanaClient as P, type LockNonceResponse as Q, type LockedFundsResponse as R, type MinDepositAmounts as S, type TokenConfig as T, type ModifyLockNonceResponse as U, type ModifyLockRequest as V, type WithdrawalInfo as W, NETWORK_CONFIG as X, type Network as Y, type OnRampPostDepositLockConfig as Z, type OnRampRecord as _, type HexString as a, type PendingDepositStatus as a0, type PendingDepositsRequest as a1, type PendingOnRampsResponse as a2, type PendingWithdrawalsResponse as a3, type PostDepositLockFailureReason as a4, type PrivanaClientConfig as a5, type SignOnRampUrlRequest as a6, type SignOnRampUrlResponse as a7, type SiweDomainResponse as a8, type SiweLoginRequest as a9, normalizeAddress as aA, normalizeHex as aB, requireDepositLockOwner as aC, requireServiceAddress as aD, savePendingLock as aE, submitPendingLock as aF, type SiweLoginResponse as aa, type SiweNonceResponse as ab, type SubmitPendingLockParams as ac, type TokenListResponse as ad, type TotalLockedBalanceResponse as ae, type TransferFundsRequest as af, type TransferLockedFundsRequest as ag, type TransferLockedNonceResponse as ah, type TransferNonceResponse as ai, type UnlockAllExpiredRequest as aj, type UnlockFundsRequest as ak, type UpdateOnRampRequest as al, type UpdateOnRampResponse as am, type WithdrawFromLockRequest as an, type WithdrawalInfoResponse as ao, type WithdrawalNonceResponse as ap, type WithdrawalRequest as aq, applyLockBuffer as ar, clampLockAmount as as, clearPendingLock as at, createSignedLockRequest as au, getAccountingContract as av, getApiUrl as aw, getChainId as ax, isSignedLockUsable as ay, loadPendingLock as az, type TokenBalance as b, type PostDepositLockConfig as c, type DepositCheckResponse as d, type TransactionSubmissionResponse as e, PostDepositLockError as f, type PendingDeposit as g, type PendingDepositsResponse as h, type HistoryEntry as i, type TokenInfoResponse as j, type BalanceResponse as k, type BatchBalancesRequest as l, type BatchBalancesResponse as m, type CreateOnRampIntentResponse as n, type CreateSignedLockRequestParams as o, DEFAULT_LOCK_DURATION_SECONDS as p, DEFAULT_ONRAMP_LOCK_BUFFER as q, type DepositAddressRequest as r, type DepositCheckRequest as s, type HistoryKind as t, type HistoryRequest as u, type HistoryResponse as v, type HostedAuthAuthorizeUrlRequest as w, type HostedAuthResponseMode as x, type HostedAuthTokenExchangeRequest as y, HttpClient as z };
|
|
@@ -4,7 +4,7 @@ var networks = {
|
|
|
4
4
|
testnet: {
|
|
5
5
|
chainId: 23295,
|
|
6
6
|
name: "Sapphire Testnet",
|
|
7
|
-
accountingContract: "
|
|
7
|
+
accountingContract: "0x910CFfe4e8B27bc367F6E34D6D8e3C31DED68B6f",
|
|
8
8
|
apiUrl: "https://api.testnet.privana.finance"
|
|
9
9
|
},
|
|
10
10
|
mainnet: {
|
|
@@ -438,6 +438,7 @@ declare class HttpClient {
|
|
|
438
438
|
type PrivanaClientConfig = HttpClientConfig;
|
|
439
439
|
declare class PrivanaClient {
|
|
440
440
|
private readonly http;
|
|
441
|
+
private readonly baseConfig;
|
|
441
442
|
constructor(config: PrivanaClientConfig);
|
|
442
443
|
getBaseUrl(): string;
|
|
443
444
|
getDepositAddress(request?: DepositAddressRequest): Promise<DepositAddressResponse>;
|
|
@@ -478,20 +479,43 @@ declare class PrivanaClient {
|
|
|
478
479
|
createOnRampIntent(request: CreateOnRampIntentRequest): Promise<CreateOnRampIntentResponse>;
|
|
479
480
|
updateOnRamp(transactionId: string, request: UpdateOnRampRequest): Promise<UpdateOnRampResponse>;
|
|
480
481
|
getPendingOnRamps(): Promise<PendingOnRampsResponse>;
|
|
482
|
+
/**
|
|
483
|
+
* @deprecated This mutates the shared client's headers and displaces its Authorization
|
|
484
|
+
* (JWT bearer) header, which breaks concurrent JWT-authenticated requests. Use
|
|
485
|
+
* {@link PrivanaClient.withPrivateReadToken} instead, which returns a scoped client that
|
|
486
|
+
* authenticates the private read without touching the shared client's headers. Will be
|
|
487
|
+
* removed in a future release.
|
|
488
|
+
*/
|
|
481
489
|
setPrivateReadToken(token: string): void;
|
|
490
|
+
/**
|
|
491
|
+
* @deprecated The shared client no longer carries a private-read token between requests;
|
|
492
|
+
* private reads now run on a scoped client from {@link PrivanaClient.withPrivateReadToken}.
|
|
493
|
+
* Returns whatever X-SIWE-Token is currently set on the shared client's headers. Will be
|
|
494
|
+
* removed in a future release.
|
|
495
|
+
*/
|
|
482
496
|
getPrivateReadToken(): string | undefined;
|
|
483
497
|
clearPrivateReadToken(): void;
|
|
484
498
|
setBearerToken(token: string): void;
|
|
485
499
|
clearBearerToken(): void;
|
|
500
|
+
/**
|
|
501
|
+
* Returns a scoped client whose requests authenticate with the given SIWE private-read
|
|
502
|
+
* token (X-SIWE-Token) instead of the client-wide JWT bearer. The scoped client shares
|
|
503
|
+
* baseUrl/timeout/base headers but owns a separate header set, so private reads issued
|
|
504
|
+
* through it never displace the real client's Authorization header: concurrent
|
|
505
|
+
* JWT-authenticated requests on the real client keep their bearer, and a bearer installed
|
|
506
|
+
* mid-flight (auto-login/hydration) is never erased by a private read.
|
|
507
|
+
*/
|
|
508
|
+
withPrivateReadToken(token: string): PrivanaClient;
|
|
486
509
|
}
|
|
487
510
|
|
|
488
511
|
/**
|
|
489
512
|
* Deposit-and-lock without backend involvement: the user pre-signs a regular
|
|
490
513
|
* `Lock` (EIP-712) for the exact expected amount before the deposit, the SDK
|
|
491
514
|
* persists the payload, and submits it to POST /funds/lock once the deposit is
|
|
492
|
-
* credited. Every failure fails closed
|
|
493
|
-
*
|
|
494
|
-
*
|
|
515
|
+
* credited. Every failure fails closed. Deterministic preflight failures such
|
|
516
|
+
* as a short credit or expired signature can safely request a fresh signature;
|
|
517
|
+
* once an API attempt starts, recovery must replay that signature unless the
|
|
518
|
+
* attempt was cross-tab serialized and definitively rejected.
|
|
495
519
|
* Services must only act on lock confirmation, never on deposit.
|
|
496
520
|
*/
|
|
497
521
|
interface PostDepositLockConfig {
|
|
@@ -532,6 +556,12 @@ declare function applyLockBuffer(amount: bigint, buffer?: number): bigint;
|
|
|
532
556
|
* signed lock must never exceed it, no matter what the flow computed.
|
|
533
557
|
*/
|
|
534
558
|
declare function clampLockAmount(amount: bigint, maxAmount?: bigint): bigint;
|
|
559
|
+
/**
|
|
560
|
+
* The provider's `serviceAddress` is optional; every lock flow needs it set
|
|
561
|
+
* before a `Lock` can be signed.
|
|
562
|
+
*/
|
|
563
|
+
declare function requireServiceAddress(serviceAddress: Address | undefined): Address;
|
|
564
|
+
declare function requireDepositLockOwner(walletAddress: Address | undefined, beneficiary: Address | null): Address;
|
|
535
565
|
interface CreateSignedLockRequestParams {
|
|
536
566
|
client: PrivanaClient;
|
|
537
567
|
walletClient: WalletClient;
|
|
@@ -561,15 +591,17 @@ type PostDepositLockFailureReason =
|
|
|
561
591
|
/** No persisted signed lock for this deposit (storage cleared, other device). */
|
|
562
592
|
| 'not-found';
|
|
563
593
|
/**
|
|
564
|
-
* The deposit itself was credited; only the post-credit lock failed. UIs
|
|
565
|
-
*
|
|
594
|
+
* The deposit itself was credited; only the post-credit lock failed. UIs may
|
|
595
|
+
* request a fresh signature only when no prior API attempt could have landed.
|
|
566
596
|
*/
|
|
567
597
|
declare class PostDepositLockError extends Error {
|
|
568
598
|
readonly reason: PostDepositLockFailureReason;
|
|
569
599
|
readonly signedAmount?: bigint | undefined;
|
|
570
600
|
readonly creditedAmount?: bigint | undefined;
|
|
601
|
+
readonly submissionMayHaveSucceeded: boolean;
|
|
571
602
|
constructor(message: string, reason: PostDepositLockFailureReason, signedAmount?: bigint | undefined, creditedAmount?: bigint | undefined, options?: {
|
|
572
603
|
cause?: unknown;
|
|
604
|
+
submissionMayHaveSucceeded?: boolean;
|
|
573
605
|
});
|
|
574
606
|
}
|
|
575
607
|
interface SubmitPendingLockParams {
|
|
@@ -577,13 +609,15 @@ interface SubmitPendingLockParams {
|
|
|
577
609
|
payload: LockFundsRequest;
|
|
578
610
|
/** Credited amount in base units, when known — skips a guaranteed revert. */
|
|
579
611
|
creditedAmount?: bigint;
|
|
612
|
+
/** Runs after deterministic preflight checks and immediately before the API request. */
|
|
613
|
+
beforeSubmit?: () => void;
|
|
580
614
|
}
|
|
581
615
|
/**
|
|
582
616
|
* Submit a pre-signed lock after the deposit credited. Throws
|
|
583
617
|
* `PostDepositLockError` on every failure path so callers can route to the
|
|
584
618
|
* re-prompt flow.
|
|
585
619
|
*/
|
|
586
|
-
declare function submitPendingLock({ client, payload, creditedAmount, }: SubmitPendingLockParams): Promise<TransactionSubmissionResponse>;
|
|
620
|
+
declare function submitPendingLock({ client, payload, creditedAmount, beforeSubmit, }: SubmitPendingLockParams): Promise<TransactionSubmissionResponse>;
|
|
587
621
|
/**
|
|
588
622
|
* Persist a signed lock so submission survives a page reload between deposit
|
|
589
623
|
* and credit. `correlationId` ties it to the deposit (tx hash) or on-ramp
|
|
@@ -597,4 +631,4 @@ declare function savePendingLock(userAddress: string, correlationId: string, pay
|
|
|
597
631
|
declare function loadPendingLock(userAddress: string, correlationId: string): LockFundsRequest | undefined;
|
|
598
632
|
declare function clearPendingLock(userAddress: string, correlationId: string): void;
|
|
599
633
|
|
|
600
|
-
export { type
|
|
634
|
+
export { type OnRampStatus as $, type Address as A, type Bytes32 as B, type CreateOnRampIntentRequest as C, type DepositAddressResponse as D, type ExpiredLocksResponse as E, type HttpClientConfig as F, type JwtLogoutRequest as G, type HostedAuthTokenExchangeResponse as H, type IntegerLike as I, type JwtRefreshResponse as J, type JwtLogoutResponse as K, type LockInfo as L, type JwtRefreshRequest as M, type NetworkConfig as N, type LockFundsRequest as O, PrivanaClient as P, type LockNonceResponse as Q, type LockedFundsResponse as R, type MinDepositAmounts as S, type TokenConfig as T, type ModifyLockNonceResponse as U, type ModifyLockRequest as V, type WithdrawalInfo as W, NETWORK_CONFIG as X, type Network as Y, type OnRampPostDepositLockConfig as Z, type OnRampRecord as _, type HexString as a, type PendingDepositStatus as a0, type PendingDepositsRequest as a1, type PendingOnRampsResponse as a2, type PendingWithdrawalsResponse as a3, type PostDepositLockFailureReason as a4, type PrivanaClientConfig as a5, type SignOnRampUrlRequest as a6, type SignOnRampUrlResponse as a7, type SiweDomainResponse as a8, type SiweLoginRequest as a9, normalizeAddress as aA, normalizeHex as aB, requireDepositLockOwner as aC, requireServiceAddress as aD, savePendingLock as aE, submitPendingLock as aF, type SiweLoginResponse as aa, type SiweNonceResponse as ab, type SubmitPendingLockParams as ac, type TokenListResponse as ad, type TotalLockedBalanceResponse as ae, type TransferFundsRequest as af, type TransferLockedFundsRequest as ag, type TransferLockedNonceResponse as ah, type TransferNonceResponse as ai, type UnlockAllExpiredRequest as aj, type UnlockFundsRequest as ak, type UpdateOnRampRequest as al, type UpdateOnRampResponse as am, type WithdrawFromLockRequest as an, type WithdrawalInfoResponse as ao, type WithdrawalNonceResponse as ap, type WithdrawalRequest as aq, applyLockBuffer as ar, clampLockAmount as as, clearPendingLock as at, createSignedLockRequest as au, getAccountingContract as av, getApiUrl as aw, getChainId as ax, isSignedLockUsable as ay, loadPendingLock as az, type TokenBalance as b, type PostDepositLockConfig as c, type DepositCheckResponse as d, type TransactionSubmissionResponse as e, PostDepositLockError as f, type PendingDeposit as g, type PendingDepositsResponse as h, type HistoryEntry as i, type TokenInfoResponse as j, type BalanceResponse as k, type BatchBalancesRequest as l, type BatchBalancesResponse as m, type CreateOnRampIntentResponse as n, type CreateSignedLockRequestParams as o, DEFAULT_LOCK_DURATION_SECONDS as p, DEFAULT_ONRAMP_LOCK_BUFFER as q, type DepositAddressRequest as r, type DepositCheckRequest as s, type HistoryKind as t, type HistoryRequest as u, type HistoryResponse as v, type HostedAuthAuthorizeUrlRequest as w, type HostedAuthResponseMode as x, type HostedAuthTokenExchangeRequest as y, HttpClient as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oasisprotocol/privana-sdk",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "React SDK for Privana - manage deposits, withdrawals, locks, and transfers",
|
|
5
5
|
"author": "Oasis Protocol Foundation <security@oasisprotocol.org>",
|
|
6
6
|
"license": "Apache-2.0",
|