@oasisprotocol/privana-sdk 0.5.6 → 0.5.8

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/on-ramp.cjs CHANGED
@@ -1,17 +1,25 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkTNR7AA52_cjs = require('./chunk-TNR7AA52.cjs');
4
+ var chunkEXFISDHQ_cjs = require('./chunk-EXFISDHQ.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "FiatOnRampForm", {
9
9
  enumerable: true,
10
- get: function () { return chunkTNR7AA52_cjs.FiatOnRampForm; }
10
+ get: function () { return chunkEXFISDHQ_cjs.FiatOnRampForm; }
11
+ });
12
+ Object.defineProperty(exports, "getTransakMinimumTargetBaseUnits", {
13
+ enumerable: true,
14
+ get: function () { return chunkEXFISDHQ_cjs.getTransakMinimumTargetBaseUnits; }
11
15
  });
12
16
  Object.defineProperty(exports, "useFiatOnRamp", {
13
17
  enumerable: true,
14
- get: function () { return chunkTNR7AA52_cjs.useFiatOnRamp; }
18
+ get: function () { return chunkEXFISDHQ_cjs.useFiatOnRamp; }
19
+ });
20
+ Object.defineProperty(exports, "useTransakOnRamp", {
21
+ enumerable: true,
22
+ get: function () { return chunkEXFISDHQ_cjs.useTransakOnRamp; }
15
23
  });
16
24
  //# sourceMappingURL=on-ramp.cjs.map
17
25
  //# sourceMappingURL=on-ramp.cjs.map
@@ -1,6 +1,7 @@
1
1
  import { MoonPayBuyWidget } from '@moonpay/moonpay-react';
2
- import { _ as OnRampProvider, A as Address, B as Bytes32, C as CreateOnRampIntentRequest, P as PrivanaClient, $ as OnRampRecord, Z as OnRampPostDepositLockConfig, e as TransactionSubmissionResponse, f as PostDepositLockError, T as TokenConfig } from './pending-lock-BIMYw4gd.cjs';
3
- export { n as CreateOnRampIntentResponse, a0 as OnRampStatus, a3 as PendingOnRampsResponse, a7 as SignOnRampUrlRequest, a8 as SignOnRampUrlResponse, am as UpdateOnRampRequest, an as UpdateOnRampResponse } from './pending-lock-BIMYw4gd.cjs';
2
+ import { a1 as OnRampProvider, A as Address, B as Bytes32, C as CreateOnRampIntentRequest, P as PrivanaClient, a2 as OnRampRecord, a as HexString, a0 as OnRampPostDepositLockConfig, e as TransactionSubmissionResponse, f as PostDepositLockError, T as TokenConfig } from './pending-lock-DIL2jCaT.cjs';
3
+ export { n as CreateOnRampIntentResponse, o as CreateOnRampSessionRequest, $ as OnRampIpAttestation, a3 as OnRampSessionResponse, a4 as OnRampStatus, a7 as PendingOnRampsResponse, ab as SignOnRampUrlRequest, ac as SignOnRampUrlResponse, aq as UpdateOnRampRequest, ar as UpdateOnRampResponse } from './pending-lock-DIL2jCaT.cjs';
4
+ import { ReactNode } from 'react';
4
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
6
  import 'viem';
6
7
 
@@ -17,6 +18,11 @@ interface OnRampProviderTransactionContext {
17
18
  tokenId: Bytes32;
18
19
  chainId: number;
19
20
  }
21
+ interface OnRampProviderDepositContext {
22
+ client: PrivanaClient;
23
+ record: OnRampRecord;
24
+ depositTxHash: HexString;
25
+ }
20
26
  /**
21
27
  * The deliberately small backend-facing provider seam. Provider launch UI
22
28
  * normalizes its callbacks into `OnRampProviderEvent`; the shared hook owns
@@ -27,6 +33,11 @@ interface OnRampProviderAdapter {
27
33
  pollPendingWhileOpen: boolean;
28
34
  buildIntentRequest(input: OnRampProviderIntentInput): CreateOnRampIntentRequest;
29
35
  registerTransaction?(context: OnRampProviderTransactionContext): Promise<OnRampRecord | undefined>;
36
+ /**
37
+ * Optional provider compatibility write after Privana has already credited
38
+ * the verified on-chain deposit. It never authorizes or gates credit.
39
+ */
40
+ recordDeposit?(context: OnRampProviderDepositContext): Promise<OnRampRecord | undefined>;
30
41
  }
31
42
  type OnRampProviderEventKind = 'transaction-created' | 'transaction-completed';
32
43
  interface OnRampProviderEvent {
@@ -63,16 +74,16 @@ interface UseOnRampOptions {
63
74
  */
64
75
  postDepositLock?: OnRampPostDepositLockConfig;
65
76
  /** Fired when the deposit is credited inside the Privana accounting module. */
66
- onCredited?: (txHash: string) => void;
77
+ onCredited?: (txHash: string, record: OnRampRecord) => void;
67
78
  /** Fired when the pre-signed post-deposit lock is accepted by the API. */
68
- onLockSubmitted?: (response: TransactionSubmissionResponse) => void;
79
+ onLockSubmitted?: (response: TransactionSubmissionResponse, record: OnRampRecord) => void;
69
80
  /**
70
81
  * Fired when the deposit credited but the pre-signed lock could not be
71
82
  * submitted. The funds sit in the user's available balance. Fresh signing
72
83
  * is safe only for failures known to precede any API attempt; otherwise
73
84
  * retry or reconcile the same signature. Falls back to `onError`.
74
85
  */
75
- onLockFailed?: (error: PostDepositLockError) => void;
86
+ onLockFailed?: (error: PostDepositLockError, record: OnRampRecord) => void;
76
87
  onError?: (error: Error) => void;
77
88
  /** Optional diagnostic event stream for previews/tests. No auth tokens or signatures are emitted. */
78
89
  onDebugEvent?: (event: OnRampDebugEvent) => void;
@@ -175,6 +186,37 @@ interface UseFiatOnRampResult extends Omit<UseOnRampResult, 'prepareOnRampIntent
175
186
  /** Thin MoonPay compatibility adapter over the shared on-ramp state machine. */
176
187
  declare function useFiatOnRamp(options: UseFiatOnRampOptions): UseFiatOnRampResult;
177
188
 
189
+ type TransakOnRampStatus = OnRampFlowStatus;
190
+ type TransakOnRampDebugEvent = OnRampDebugEvent;
191
+ interface UseTransakOnRampOptions extends Omit<UseOnRampOptions, 'adapter'> {
192
+ iframeTitle?: string;
193
+ iframeClassName?: string;
194
+ }
195
+ interface TransakOnRampLaunchRequest {
196
+ /** Canonical configured Transak asset code, currently `usdc`. */
197
+ providerAssetCode: string;
198
+ /** Required only when `postDepositLock` needs an amount to pre-sign. */
199
+ quoteCurrencyAmount?: string;
200
+ }
201
+ interface UseTransakOnRampResult extends Omit<UseOnRampResult, 'prepareOnRampIntent' | 'handleProviderLaunchReady' | 'handleProviderLaunchFailed' | 'handleProviderEvent' | 'handleProviderClosed'> {
202
+ isLaunching: boolean;
203
+ isWidgetOpen: boolean;
204
+ /** True only while the current intent has never reached a provider UI. */
205
+ canRecreateSession: boolean;
206
+ /** Hardened iframe for the current in-memory session, or null when closed. */
207
+ widget: ReactNode;
208
+ /** Create a fresh intent and session from an explicit user launch. */
209
+ launch: (request: TransakOnRampLaunchRequest) => Promise<void>;
210
+ /** Explicitly request a new single-use URL for the current unresolved intent. */
211
+ recreateSession: () => Promise<void>;
212
+ closeWidget: () => Promise<void>;
213
+ }
214
+ /** Thin Transak session and iframe adapter over the shared on-ramp state machine. */
215
+ declare function useTransakOnRamp(options: UseTransakOnRampOptions): UseTransakOnRampResult;
216
+
217
+ /** Add the provider-delivery margin and round up in token base units. */
218
+ declare function getTransakMinimumTargetBaseUnits(minimum: bigint): bigint;
219
+
178
220
  interface FiatOnRampFormProps {
179
221
  /** Privana token id to deposit into after the on-ramp completes. */
180
222
  tokenId: Bytes32;
@@ -232,9 +274,21 @@ interface FiatOnRampFormProps {
232
274
  /** Fired when the deposit credited but the pre-signed lock failed — re-prompt. */
233
275
  onLockFailed?: (error: PostDepositLockError) => void;
234
276
  onError?: (error: Error) => void;
277
+ /** Leave product UI while retaining its signed intent for exact recovery. */
278
+ onLeaveFlow?: () => void;
235
279
  /** Optional diagnostic event stream for previews/tests. */
236
280
  onDebugEvent?: (event: FiatOnRampDebugEvent) => void;
281
+ /** Product modals must not route callbacks from unrelated recovered rows. */
282
+ onlyRouteActiveIntentCallbacks?: boolean;
283
+ /**
284
+ * Product flows freeze the launch token when the purchase starts. When set,
285
+ * a live-config drift away from this snapshot fails closed instead of
286
+ * launching against a silently different token.
287
+ */
288
+ frozenToken?: TokenConfig;
289
+ onUnsafeToCloseChange?: (unsafe: boolean) => void;
290
+ onActiveFlowChange?: (active: boolean) => void;
237
291
  }
238
- declare function FiatOnRampForm({ tokenId, currencyCode, baseCurrencyCode, defaultBaseCurrencyAmount, quoteCurrencyAmount, tokenSymbol, theme, themeId, colorCode, variant, autoStart, lockAmount, paymentMethod, postDepositLock, onCredited, onLockSubmitted, onLockFailed, onError, onDebugEvent, }: FiatOnRampFormProps): react_jsx_runtime.JSX.Element;
292
+ declare function FiatOnRampForm({ tokenId, currencyCode, baseCurrencyCode, defaultBaseCurrencyAmount, quoteCurrencyAmount, tokenSymbol, theme, themeId, colorCode, variant, autoStart, lockAmount, paymentMethod, postDepositLock, onCredited, onLockSubmitted, onLockFailed, onError, onLeaveFlow, onDebugEvent, onlyRouteActiveIntentCallbacks, frozenToken, onUnsafeToCloseChange, onActiveFlowChange, }: FiatOnRampFormProps): react_jsx_runtime.JSX.Element;
239
293
 
240
- export { CreateOnRampIntentRequest, type FiatOnRampDebugEvent, FiatOnRampForm, type FiatOnRampFormProps, type FiatOnRampStatus, OnRampPostDepositLockConfig, OnRampProvider, OnRampRecord, type UseFiatOnRampOptions, type UseFiatOnRampResult, useFiatOnRamp };
294
+ export { CreateOnRampIntentRequest, type FiatOnRampDebugEvent, FiatOnRampForm, type FiatOnRampFormProps, type FiatOnRampStatus, OnRampPostDepositLockConfig, OnRampProvider, OnRampRecord, type TransakOnRampDebugEvent, type TransakOnRampLaunchRequest, type TransakOnRampStatus, type UseFiatOnRampOptions, type UseFiatOnRampResult, type UseTransakOnRampOptions, type UseTransakOnRampResult, getTransakMinimumTargetBaseUnits, useFiatOnRamp, useTransakOnRamp };
package/dist/on-ramp.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { MoonPayBuyWidget } from '@moonpay/moonpay-react';
2
- import { _ as OnRampProvider, A as Address, B as Bytes32, C as CreateOnRampIntentRequest, P as PrivanaClient, $ as OnRampRecord, Z as OnRampPostDepositLockConfig, e as TransactionSubmissionResponse, f as PostDepositLockError, T as TokenConfig } from './pending-lock-BIMYw4gd.js';
3
- export { n as CreateOnRampIntentResponse, a0 as OnRampStatus, a3 as PendingOnRampsResponse, a7 as SignOnRampUrlRequest, a8 as SignOnRampUrlResponse, am as UpdateOnRampRequest, an as UpdateOnRampResponse } from './pending-lock-BIMYw4gd.js';
2
+ import { a1 as OnRampProvider, A as Address, B as Bytes32, C as CreateOnRampIntentRequest, P as PrivanaClient, a2 as OnRampRecord, a as HexString, a0 as OnRampPostDepositLockConfig, e as TransactionSubmissionResponse, f as PostDepositLockError, T as TokenConfig } from './pending-lock-DIL2jCaT.js';
3
+ export { n as CreateOnRampIntentResponse, o as CreateOnRampSessionRequest, $ as OnRampIpAttestation, a3 as OnRampSessionResponse, a4 as OnRampStatus, a7 as PendingOnRampsResponse, ab as SignOnRampUrlRequest, ac as SignOnRampUrlResponse, aq as UpdateOnRampRequest, ar as UpdateOnRampResponse } from './pending-lock-DIL2jCaT.js';
4
+ import { ReactNode } from 'react';
4
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
6
  import 'viem';
6
7
 
@@ -17,6 +18,11 @@ interface OnRampProviderTransactionContext {
17
18
  tokenId: Bytes32;
18
19
  chainId: number;
19
20
  }
21
+ interface OnRampProviderDepositContext {
22
+ client: PrivanaClient;
23
+ record: OnRampRecord;
24
+ depositTxHash: HexString;
25
+ }
20
26
  /**
21
27
  * The deliberately small backend-facing provider seam. Provider launch UI
22
28
  * normalizes its callbacks into `OnRampProviderEvent`; the shared hook owns
@@ -27,6 +33,11 @@ interface OnRampProviderAdapter {
27
33
  pollPendingWhileOpen: boolean;
28
34
  buildIntentRequest(input: OnRampProviderIntentInput): CreateOnRampIntentRequest;
29
35
  registerTransaction?(context: OnRampProviderTransactionContext): Promise<OnRampRecord | undefined>;
36
+ /**
37
+ * Optional provider compatibility write after Privana has already credited
38
+ * the verified on-chain deposit. It never authorizes or gates credit.
39
+ */
40
+ recordDeposit?(context: OnRampProviderDepositContext): Promise<OnRampRecord | undefined>;
30
41
  }
31
42
  type OnRampProviderEventKind = 'transaction-created' | 'transaction-completed';
32
43
  interface OnRampProviderEvent {
@@ -63,16 +74,16 @@ interface UseOnRampOptions {
63
74
  */
64
75
  postDepositLock?: OnRampPostDepositLockConfig;
65
76
  /** Fired when the deposit is credited inside the Privana accounting module. */
66
- onCredited?: (txHash: string) => void;
77
+ onCredited?: (txHash: string, record: OnRampRecord) => void;
67
78
  /** Fired when the pre-signed post-deposit lock is accepted by the API. */
68
- onLockSubmitted?: (response: TransactionSubmissionResponse) => void;
79
+ onLockSubmitted?: (response: TransactionSubmissionResponse, record: OnRampRecord) => void;
69
80
  /**
70
81
  * Fired when the deposit credited but the pre-signed lock could not be
71
82
  * submitted. The funds sit in the user's available balance. Fresh signing
72
83
  * is safe only for failures known to precede any API attempt; otherwise
73
84
  * retry or reconcile the same signature. Falls back to `onError`.
74
85
  */
75
- onLockFailed?: (error: PostDepositLockError) => void;
86
+ onLockFailed?: (error: PostDepositLockError, record: OnRampRecord) => void;
76
87
  onError?: (error: Error) => void;
77
88
  /** Optional diagnostic event stream for previews/tests. No auth tokens or signatures are emitted. */
78
89
  onDebugEvent?: (event: OnRampDebugEvent) => void;
@@ -175,6 +186,37 @@ interface UseFiatOnRampResult extends Omit<UseOnRampResult, 'prepareOnRampIntent
175
186
  /** Thin MoonPay compatibility adapter over the shared on-ramp state machine. */
176
187
  declare function useFiatOnRamp(options: UseFiatOnRampOptions): UseFiatOnRampResult;
177
188
 
189
+ type TransakOnRampStatus = OnRampFlowStatus;
190
+ type TransakOnRampDebugEvent = OnRampDebugEvent;
191
+ interface UseTransakOnRampOptions extends Omit<UseOnRampOptions, 'adapter'> {
192
+ iframeTitle?: string;
193
+ iframeClassName?: string;
194
+ }
195
+ interface TransakOnRampLaunchRequest {
196
+ /** Canonical configured Transak asset code, currently `usdc`. */
197
+ providerAssetCode: string;
198
+ /** Required only when `postDepositLock` needs an amount to pre-sign. */
199
+ quoteCurrencyAmount?: string;
200
+ }
201
+ interface UseTransakOnRampResult extends Omit<UseOnRampResult, 'prepareOnRampIntent' | 'handleProviderLaunchReady' | 'handleProviderLaunchFailed' | 'handleProviderEvent' | 'handleProviderClosed'> {
202
+ isLaunching: boolean;
203
+ isWidgetOpen: boolean;
204
+ /** True only while the current intent has never reached a provider UI. */
205
+ canRecreateSession: boolean;
206
+ /** Hardened iframe for the current in-memory session, or null when closed. */
207
+ widget: ReactNode;
208
+ /** Create a fresh intent and session from an explicit user launch. */
209
+ launch: (request: TransakOnRampLaunchRequest) => Promise<void>;
210
+ /** Explicitly request a new single-use URL for the current unresolved intent. */
211
+ recreateSession: () => Promise<void>;
212
+ closeWidget: () => Promise<void>;
213
+ }
214
+ /** Thin Transak session and iframe adapter over the shared on-ramp state machine. */
215
+ declare function useTransakOnRamp(options: UseTransakOnRampOptions): UseTransakOnRampResult;
216
+
217
+ /** Add the provider-delivery margin and round up in token base units. */
218
+ declare function getTransakMinimumTargetBaseUnits(minimum: bigint): bigint;
219
+
178
220
  interface FiatOnRampFormProps {
179
221
  /** Privana token id to deposit into after the on-ramp completes. */
180
222
  tokenId: Bytes32;
@@ -232,9 +274,21 @@ interface FiatOnRampFormProps {
232
274
  /** Fired when the deposit credited but the pre-signed lock failed — re-prompt. */
233
275
  onLockFailed?: (error: PostDepositLockError) => void;
234
276
  onError?: (error: Error) => void;
277
+ /** Leave product UI while retaining its signed intent for exact recovery. */
278
+ onLeaveFlow?: () => void;
235
279
  /** Optional diagnostic event stream for previews/tests. */
236
280
  onDebugEvent?: (event: FiatOnRampDebugEvent) => void;
281
+ /** Product modals must not route callbacks from unrelated recovered rows. */
282
+ onlyRouteActiveIntentCallbacks?: boolean;
283
+ /**
284
+ * Product flows freeze the launch token when the purchase starts. When set,
285
+ * a live-config drift away from this snapshot fails closed instead of
286
+ * launching against a silently different token.
287
+ */
288
+ frozenToken?: TokenConfig;
289
+ onUnsafeToCloseChange?: (unsafe: boolean) => void;
290
+ onActiveFlowChange?: (active: boolean) => void;
237
291
  }
238
- declare function FiatOnRampForm({ tokenId, currencyCode, baseCurrencyCode, defaultBaseCurrencyAmount, quoteCurrencyAmount, tokenSymbol, theme, themeId, colorCode, variant, autoStart, lockAmount, paymentMethod, postDepositLock, onCredited, onLockSubmitted, onLockFailed, onError, onDebugEvent, }: FiatOnRampFormProps): react_jsx_runtime.JSX.Element;
292
+ declare function FiatOnRampForm({ tokenId, currencyCode, baseCurrencyCode, defaultBaseCurrencyAmount, quoteCurrencyAmount, tokenSymbol, theme, themeId, colorCode, variant, autoStart, lockAmount, paymentMethod, postDepositLock, onCredited, onLockSubmitted, onLockFailed, onError, onLeaveFlow, onDebugEvent, onlyRouteActiveIntentCallbacks, frozenToken, onUnsafeToCloseChange, onActiveFlowChange, }: FiatOnRampFormProps): react_jsx_runtime.JSX.Element;
239
293
 
240
- export { CreateOnRampIntentRequest, type FiatOnRampDebugEvent, FiatOnRampForm, type FiatOnRampFormProps, type FiatOnRampStatus, OnRampPostDepositLockConfig, OnRampProvider, OnRampRecord, type UseFiatOnRampOptions, type UseFiatOnRampResult, useFiatOnRamp };
294
+ export { CreateOnRampIntentRequest, type FiatOnRampDebugEvent, FiatOnRampForm, type FiatOnRampFormProps, type FiatOnRampStatus, OnRampPostDepositLockConfig, OnRampProvider, OnRampRecord, type TransakOnRampDebugEvent, type TransakOnRampLaunchRequest, type TransakOnRampStatus, type UseFiatOnRampOptions, type UseFiatOnRampResult, type UseTransakOnRampOptions, type UseTransakOnRampResult, getTransakMinimumTargetBaseUnits, useFiatOnRamp, useTransakOnRamp };
package/dist/on-ramp.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use client";
2
- export { FiatOnRampForm, useFiatOnRamp } from './chunk-DLGIPF4N.js';
2
+ export { FiatOnRampForm, getTransakMinimumTargetBaseUnits, useFiatOnRamp, useTransakOnRamp } from './chunk-ONXJGUOH.js';
3
3
  //# sourceMappingURL=on-ramp.js.map
4
4
  //# sourceMappingURL=on-ramp.js.map
@@ -364,6 +364,15 @@ interface JwtLogoutResponse {
364
364
 
365
365
  type OnRampProvider = 'moonpay' | 'transak';
366
366
  type OnRampStatus = 'pending' | 'completed' | 'failed' | 'cancelled';
367
+ /** Product-level card on-ramp selection supplied by the SDK host. */
368
+ interface OnRampConfig {
369
+ /** The only provider the product UI may launch. */
370
+ provider: OnRampProvider;
371
+ /** The only Privana token the configured provider may deposit. */
372
+ tokenId: Bytes32;
373
+ /** Provider-side asset identifier expected in the signed intent. */
374
+ providerAssetCode: string;
375
+ }
367
376
  /** Request body / response of POST /api/onramp/sign-url */
368
377
  interface SignOnRampUrlRequest {
369
378
  url: string;
@@ -380,6 +389,28 @@ interface CreateOnRampIntentRequest {
380
389
  moonpay_currency_code?: string;
381
390
  }
382
391
  type CreateOnRampIntentResponse = OnRampRecord;
392
+ /** Opaque edge-signed claim. Pass through without inspecting or modifying it. */
393
+ interface OnRampIpAttestation {
394
+ readonly v: 1;
395
+ readonly ip: string;
396
+ readonly iat: number;
397
+ readonly exp: number;
398
+ readonly nonce: string;
399
+ readonly sig: string;
400
+ }
401
+ /** Request body / response of POST /v1/accounting/onramp/session. */
402
+ interface CreateOnRampSessionRequest {
403
+ transaction_id: string;
404
+ /** Required by attested mode; omitted only by legacy header-mode callers. */
405
+ ip_attestation?: OnRampIpAttestation;
406
+ }
407
+ interface OnRampSessionResponse {
408
+ provider: 'transak';
409
+ /** Opaque, single-use URL. Do not persist, log, or modify it. */
410
+ url: string;
411
+ /** Unix timestamp in seconds by which the URL must be loaded. */
412
+ expires_at: number;
413
+ }
383
414
  /** Request body / response of POST /api/onramp/{id}. */
384
415
  interface UpdateOnRampRequest {
385
416
  wallet_address?: Address;
@@ -482,6 +513,7 @@ declare class PrivanaClient {
482
513
  logoutJwtSession(request?: JwtLogoutRequest): Promise<JwtLogoutResponse>;
483
514
  signOnRampUrl(request: SignOnRampUrlRequest): Promise<SignOnRampUrlResponse>;
484
515
  createOnRampIntent(request: CreateOnRampIntentRequest): Promise<CreateOnRampIntentResponse>;
516
+ createOnRampSession(request: CreateOnRampSessionRequest): Promise<OnRampSessionResponse>;
485
517
  updateOnRamp(transactionId: string, request: UpdateOnRampRequest): Promise<UpdateOnRampResponse>;
486
518
  getPendingOnRamps(externalTransactionIds?: readonly string[]): Promise<PendingOnRampsResponse>;
487
519
  /**
@@ -636,4 +668,4 @@ declare function savePendingLock(userAddress: string, correlationId: string, pay
636
668
  declare function loadPendingLock(userAddress: string, correlationId: string): LockFundsRequest | undefined;
637
669
  declare function clearPendingLock(userAddress: string, correlationId: string): void;
638
670
 
639
- export { type OnRampRecord 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 OnRampProvider as _, type HexString as a, type OnRampStatus as a0, type PendingDepositStatus as a1, type PendingDepositsRequest as a2, type PendingOnRampsResponse as a3, type PendingWithdrawalsResponse as a4, type PostDepositLockFailureReason as a5, type PrivanaClientConfig as a6, type SignOnRampUrlRequest as a7, type SignOnRampUrlResponse as a8, type SiweDomainResponse as a9, loadPendingLock as aA, normalizeAddress as aB, normalizeHex as aC, requireDepositLockOwner as aD, requireServiceAddress as aE, savePendingLock as aF, submitPendingLock as aG, type SiweLoginRequest as aa, type SiweLoginResponse as ab, type SiweNonceResponse as ac, type SubmitPendingLockParams as ad, type TokenListResponse as ae, type TotalLockedBalanceResponse as af, type TransferFundsRequest as ag, type TransferLockedFundsRequest as ah, type TransferLockedNonceResponse as ai, type TransferNonceResponse as aj, type UnlockAllExpiredRequest as ak, type UnlockFundsRequest as al, type UpdateOnRampRequest as am, type UpdateOnRampResponse as an, type WithdrawFromLockRequest as ao, type WithdrawalInfoResponse as ap, type WithdrawalNonceResponse as aq, type WithdrawalRequest as ar, applyLockBuffer as as, clampLockAmount as at, clearPendingLock as au, createSignedLockRequest as av, getAccountingContract as aw, getApiUrl as ax, getChainId as ay, isSignedLockUsable 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 };
671
+ export { type OnRampIpAttestation as $, type Address as A, type Bytes32 as B, type CreateOnRampIntentRequest as C, type DepositAddressResponse as D, type ExpiredLocksResponse as E, HttpClient as F, type HttpClientConfig as G, type HostedAuthTokenExchangeResponse as H, type IntegerLike as I, type JwtRefreshResponse as J, type JwtLogoutRequest as K, type LockInfo as L, type JwtLogoutResponse as M, type NetworkConfig as N, type OnRampConfig as O, PrivanaClient as P, type JwtRefreshRequest as Q, type LockFundsRequest as R, type LockNonceResponse as S, type TokenConfig as T, type LockedFundsResponse as U, type MinDepositAmounts as V, type WithdrawalInfo as W, type ModifyLockNonceResponse as X, type ModifyLockRequest as Y, NETWORK_CONFIG as Z, type Network as _, type HexString as a, type OnRampPostDepositLockConfig as a0, type OnRampProvider as a1, type OnRampRecord as a2, type OnRampSessionResponse as a3, type OnRampStatus as a4, type PendingDepositStatus as a5, type PendingDepositsRequest as a6, type PendingOnRampsResponse as a7, type PendingWithdrawalsResponse as a8, type PostDepositLockFailureReason as a9, getAccountingContract as aA, getApiUrl as aB, getChainId as aC, isSignedLockUsable as aD, loadPendingLock as aE, normalizeAddress as aF, normalizeHex as aG, requireDepositLockOwner as aH, requireServiceAddress as aI, savePendingLock as aJ, submitPendingLock as aK, type PrivanaClientConfig as aa, type SignOnRampUrlRequest as ab, type SignOnRampUrlResponse as ac, type SiweDomainResponse as ad, type SiweLoginRequest as ae, type SiweLoginResponse as af, type SiweNonceResponse as ag, type SubmitPendingLockParams as ah, type TokenListResponse as ai, type TotalLockedBalanceResponse as aj, type TransferFundsRequest as ak, type TransferLockedFundsRequest as al, type TransferLockedNonceResponse as am, type TransferNonceResponse as an, type UnlockAllExpiredRequest as ao, type UnlockFundsRequest as ap, type UpdateOnRampRequest as aq, type UpdateOnRampResponse as ar, type WithdrawFromLockRequest as as, type WithdrawalInfoResponse as at, type WithdrawalNonceResponse as au, type WithdrawalRequest as av, applyLockBuffer as aw, clampLockAmount as ax, clearPendingLock as ay, createSignedLockRequest 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 CreateOnRampSessionRequest as o, type CreateSignedLockRequestParams as p, DEFAULT_LOCK_DURATION_SECONDS as q, DEFAULT_ONRAMP_LOCK_BUFFER as r, type DepositAddressRequest as s, type DepositCheckRequest as t, type HistoryKind as u, type HistoryRequest as v, type HistoryResponse as w, type HostedAuthAuthorizeUrlRequest as x, type HostedAuthResponseMode as y, type HostedAuthTokenExchangeRequest as z };
@@ -364,6 +364,15 @@ interface JwtLogoutResponse {
364
364
 
365
365
  type OnRampProvider = 'moonpay' | 'transak';
366
366
  type OnRampStatus = 'pending' | 'completed' | 'failed' | 'cancelled';
367
+ /** Product-level card on-ramp selection supplied by the SDK host. */
368
+ interface OnRampConfig {
369
+ /** The only provider the product UI may launch. */
370
+ provider: OnRampProvider;
371
+ /** The only Privana token the configured provider may deposit. */
372
+ tokenId: Bytes32;
373
+ /** Provider-side asset identifier expected in the signed intent. */
374
+ providerAssetCode: string;
375
+ }
367
376
  /** Request body / response of POST /api/onramp/sign-url */
368
377
  interface SignOnRampUrlRequest {
369
378
  url: string;
@@ -380,6 +389,28 @@ interface CreateOnRampIntentRequest {
380
389
  moonpay_currency_code?: string;
381
390
  }
382
391
  type CreateOnRampIntentResponse = OnRampRecord;
392
+ /** Opaque edge-signed claim. Pass through without inspecting or modifying it. */
393
+ interface OnRampIpAttestation {
394
+ readonly v: 1;
395
+ readonly ip: string;
396
+ readonly iat: number;
397
+ readonly exp: number;
398
+ readonly nonce: string;
399
+ readonly sig: string;
400
+ }
401
+ /** Request body / response of POST /v1/accounting/onramp/session. */
402
+ interface CreateOnRampSessionRequest {
403
+ transaction_id: string;
404
+ /** Required by attested mode; omitted only by legacy header-mode callers. */
405
+ ip_attestation?: OnRampIpAttestation;
406
+ }
407
+ interface OnRampSessionResponse {
408
+ provider: 'transak';
409
+ /** Opaque, single-use URL. Do not persist, log, or modify it. */
410
+ url: string;
411
+ /** Unix timestamp in seconds by which the URL must be loaded. */
412
+ expires_at: number;
413
+ }
383
414
  /** Request body / response of POST /api/onramp/{id}. */
384
415
  interface UpdateOnRampRequest {
385
416
  wallet_address?: Address;
@@ -482,6 +513,7 @@ declare class PrivanaClient {
482
513
  logoutJwtSession(request?: JwtLogoutRequest): Promise<JwtLogoutResponse>;
483
514
  signOnRampUrl(request: SignOnRampUrlRequest): Promise<SignOnRampUrlResponse>;
484
515
  createOnRampIntent(request: CreateOnRampIntentRequest): Promise<CreateOnRampIntentResponse>;
516
+ createOnRampSession(request: CreateOnRampSessionRequest): Promise<OnRampSessionResponse>;
485
517
  updateOnRamp(transactionId: string, request: UpdateOnRampRequest): Promise<UpdateOnRampResponse>;
486
518
  getPendingOnRamps(externalTransactionIds?: readonly string[]): Promise<PendingOnRampsResponse>;
487
519
  /**
@@ -636,4 +668,4 @@ declare function savePendingLock(userAddress: string, correlationId: string, pay
636
668
  declare function loadPendingLock(userAddress: string, correlationId: string): LockFundsRequest | undefined;
637
669
  declare function clearPendingLock(userAddress: string, correlationId: string): void;
638
670
 
639
- export { type OnRampRecord 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 OnRampProvider as _, type HexString as a, type OnRampStatus as a0, type PendingDepositStatus as a1, type PendingDepositsRequest as a2, type PendingOnRampsResponse as a3, type PendingWithdrawalsResponse as a4, type PostDepositLockFailureReason as a5, type PrivanaClientConfig as a6, type SignOnRampUrlRequest as a7, type SignOnRampUrlResponse as a8, type SiweDomainResponse as a9, loadPendingLock as aA, normalizeAddress as aB, normalizeHex as aC, requireDepositLockOwner as aD, requireServiceAddress as aE, savePendingLock as aF, submitPendingLock as aG, type SiweLoginRequest as aa, type SiweLoginResponse as ab, type SiweNonceResponse as ac, type SubmitPendingLockParams as ad, type TokenListResponse as ae, type TotalLockedBalanceResponse as af, type TransferFundsRequest as ag, type TransferLockedFundsRequest as ah, type TransferLockedNonceResponse as ai, type TransferNonceResponse as aj, type UnlockAllExpiredRequest as ak, type UnlockFundsRequest as al, type UpdateOnRampRequest as am, type UpdateOnRampResponse as an, type WithdrawFromLockRequest as ao, type WithdrawalInfoResponse as ap, type WithdrawalNonceResponse as aq, type WithdrawalRequest as ar, applyLockBuffer as as, clampLockAmount as at, clearPendingLock as au, createSignedLockRequest as av, getAccountingContract as aw, getApiUrl as ax, getChainId as ay, isSignedLockUsable 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 };
671
+ export { type OnRampIpAttestation as $, type Address as A, type Bytes32 as B, type CreateOnRampIntentRequest as C, type DepositAddressResponse as D, type ExpiredLocksResponse as E, HttpClient as F, type HttpClientConfig as G, type HostedAuthTokenExchangeResponse as H, type IntegerLike as I, type JwtRefreshResponse as J, type JwtLogoutRequest as K, type LockInfo as L, type JwtLogoutResponse as M, type NetworkConfig as N, type OnRampConfig as O, PrivanaClient as P, type JwtRefreshRequest as Q, type LockFundsRequest as R, type LockNonceResponse as S, type TokenConfig as T, type LockedFundsResponse as U, type MinDepositAmounts as V, type WithdrawalInfo as W, type ModifyLockNonceResponse as X, type ModifyLockRequest as Y, NETWORK_CONFIG as Z, type Network as _, type HexString as a, type OnRampPostDepositLockConfig as a0, type OnRampProvider as a1, type OnRampRecord as a2, type OnRampSessionResponse as a3, type OnRampStatus as a4, type PendingDepositStatus as a5, type PendingDepositsRequest as a6, type PendingOnRampsResponse as a7, type PendingWithdrawalsResponse as a8, type PostDepositLockFailureReason as a9, getAccountingContract as aA, getApiUrl as aB, getChainId as aC, isSignedLockUsable as aD, loadPendingLock as aE, normalizeAddress as aF, normalizeHex as aG, requireDepositLockOwner as aH, requireServiceAddress as aI, savePendingLock as aJ, submitPendingLock as aK, type PrivanaClientConfig as aa, type SignOnRampUrlRequest as ab, type SignOnRampUrlResponse as ac, type SiweDomainResponse as ad, type SiweLoginRequest as ae, type SiweLoginResponse as af, type SiweNonceResponse as ag, type SubmitPendingLockParams as ah, type TokenListResponse as ai, type TotalLockedBalanceResponse as aj, type TransferFundsRequest as ak, type TransferLockedFundsRequest as al, type TransferLockedNonceResponse as am, type TransferNonceResponse as an, type UnlockAllExpiredRequest as ao, type UnlockFundsRequest as ap, type UpdateOnRampRequest as aq, type UpdateOnRampResponse as ar, type WithdrawFromLockRequest as as, type WithdrawalInfoResponse as at, type WithdrawalNonceResponse as au, type WithdrawalRequest as av, applyLockBuffer as aw, clampLockAmount as ax, clearPendingLock as ay, createSignedLockRequest 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 CreateOnRampSessionRequest as o, type CreateSignedLockRequestParams as p, DEFAULT_LOCK_DURATION_SECONDS as q, DEFAULT_ONRAMP_LOCK_BUFFER as r, type DepositAddressRequest as s, type DepositCheckRequest as t, type HistoryKind as u, type HistoryRequest as v, type HistoryResponse as w, type HostedAuthAuthorizeUrlRequest as x, type HostedAuthResponseMode as y, type HostedAuthTokenExchangeRequest as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oasisprotocol/privana-sdk",
3
- "version": "0.5.6",
3
+ "version": "0.5.8",
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",