@volr/react 0.1.11 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -66,12 +66,12 @@ declare class APIClient {
66
66
 
67
67
  /**
68
68
  * API Response DTOs
69
- * Backend API로부터 받는 응답 타입 정의
69
+ * Type definitions for responses from the backend API
70
70
  */
71
71
 
72
72
  /**
73
73
  * PRF Input DTO
74
- * WebAuthn PRF 확장을 위한 입력 파라미터
74
+ * Input parameters for WebAuthn PRF extension
75
75
  */
76
76
  interface PrfInputDto {
77
77
  origin: string;
@@ -81,7 +81,7 @@ interface PrfInputDto {
81
81
  }
82
82
  /**
83
83
  * User DTO
84
- * 백엔드로부터 받는 사용자 정보
84
+ * User information received from the backend
85
85
  */
86
86
  interface UserDto {
87
87
  id: string;
@@ -98,7 +98,7 @@ interface UserDto {
98
98
  }
99
99
  /**
100
100
  * Auth Refresh Response DTO
101
- * /auth/refresh 엔드포인트 응답
101
+ * Response from /auth/refresh endpoint
102
102
  */
103
103
  interface AuthRefreshResponseDto {
104
104
  accessToken: string;
@@ -106,7 +106,7 @@ interface AuthRefreshResponseDto {
106
106
  }
107
107
  /**
108
108
  * Network DTO
109
- * /networks/:chainId 엔드포인트 응답
109
+ * Response from /networks/:chainId endpoint
110
110
  */
111
111
  interface NetworkDto {
112
112
  chainId: string;
@@ -117,12 +117,12 @@ interface NetworkDto {
117
117
  }
118
118
  /**
119
119
  * Transaction Status
120
- * 트랜잭션 상태
120
+ * Possible transaction status values
121
121
  */
122
122
  type TransactionStatus = 'QUEUED' | 'PENDING' | 'CONFIRMED' | 'FAILED';
123
123
  /**
124
124
  * Transaction DTO
125
- * /wallet/transactions/:txId 엔드포인트 응답
125
+ * Response from /wallet/transactions/:txId endpoint
126
126
  */
127
127
  interface TransactionDto {
128
128
  txId: string;
@@ -133,7 +133,7 @@ interface TransactionDto {
133
133
  }
134
134
  /**
135
135
  * API Response Wrapper
136
- * 모든 API 응답의 공통 래퍼
136
+ * Common wrapper for all API responses
137
137
  */
138
138
  interface ApiResponse<T> {
139
139
  ok: boolean;
@@ -356,14 +356,21 @@ declare function buildCalls(options: BuildCallOptions[]): Call[];
356
356
 
357
357
  type SendTxOptions = {
358
358
  /**
359
- * 프로젝트별 policyId. 제공하지 않으면 백엔드에서 자동으로 계산됩니다.
360
- * Zero policyId (0x0000...0000)는 사용할 없습니다.
359
+ * Transaction expiration time in seconds from now.
360
+ * Defaults to backend configuration if not provided.
361
361
  */
362
- policyId?: `0x${string}`;
363
- signer?: SignerPort;
364
362
  expiresInSec?: number;
363
+ /**
364
+ * Idempotency key to prevent duplicate transactions.
365
+ */
365
366
  idempotencyKey?: string;
367
+ /**
368
+ * Transaction mode: 'sponsored' for gas-sponsored, 'self' for self-paid.
369
+ */
366
370
  mode?: 'sponsored' | 'self';
371
+ /**
372
+ * Sender address override. If not provided, uses user.evmAddress.
373
+ */
367
374
  from?: `0x${string}`;
368
375
  /**
369
376
  * Run best-effort RPC preflight (eth_estimateGas) before prompting passkey.
package/dist/index.d.ts CHANGED
@@ -66,12 +66,12 @@ declare class APIClient {
66
66
 
67
67
  /**
68
68
  * API Response DTOs
69
- * Backend API로부터 받는 응답 타입 정의
69
+ * Type definitions for responses from the backend API
70
70
  */
71
71
 
72
72
  /**
73
73
  * PRF Input DTO
74
- * WebAuthn PRF 확장을 위한 입력 파라미터
74
+ * Input parameters for WebAuthn PRF extension
75
75
  */
76
76
  interface PrfInputDto {
77
77
  origin: string;
@@ -81,7 +81,7 @@ interface PrfInputDto {
81
81
  }
82
82
  /**
83
83
  * User DTO
84
- * 백엔드로부터 받는 사용자 정보
84
+ * User information received from the backend
85
85
  */
86
86
  interface UserDto {
87
87
  id: string;
@@ -98,7 +98,7 @@ interface UserDto {
98
98
  }
99
99
  /**
100
100
  * Auth Refresh Response DTO
101
- * /auth/refresh 엔드포인트 응답
101
+ * Response from /auth/refresh endpoint
102
102
  */
103
103
  interface AuthRefreshResponseDto {
104
104
  accessToken: string;
@@ -106,7 +106,7 @@ interface AuthRefreshResponseDto {
106
106
  }
107
107
  /**
108
108
  * Network DTO
109
- * /networks/:chainId 엔드포인트 응답
109
+ * Response from /networks/:chainId endpoint
110
110
  */
111
111
  interface NetworkDto {
112
112
  chainId: string;
@@ -117,12 +117,12 @@ interface NetworkDto {
117
117
  }
118
118
  /**
119
119
  * Transaction Status
120
- * 트랜잭션 상태
120
+ * Possible transaction status values
121
121
  */
122
122
  type TransactionStatus = 'QUEUED' | 'PENDING' | 'CONFIRMED' | 'FAILED';
123
123
  /**
124
124
  * Transaction DTO
125
- * /wallet/transactions/:txId 엔드포인트 응답
125
+ * Response from /wallet/transactions/:txId endpoint
126
126
  */
127
127
  interface TransactionDto {
128
128
  txId: string;
@@ -133,7 +133,7 @@ interface TransactionDto {
133
133
  }
134
134
  /**
135
135
  * API Response Wrapper
136
- * 모든 API 응답의 공통 래퍼
136
+ * Common wrapper for all API responses
137
137
  */
138
138
  interface ApiResponse<T> {
139
139
  ok: boolean;
@@ -356,14 +356,21 @@ declare function buildCalls(options: BuildCallOptions[]): Call[];
356
356
 
357
357
  type SendTxOptions = {
358
358
  /**
359
- * 프로젝트별 policyId. 제공하지 않으면 백엔드에서 자동으로 계산됩니다.
360
- * Zero policyId (0x0000...0000)는 사용할 없습니다.
359
+ * Transaction expiration time in seconds from now.
360
+ * Defaults to backend configuration if not provided.
361
361
  */
362
- policyId?: `0x${string}`;
363
- signer?: SignerPort;
364
362
  expiresInSec?: number;
363
+ /**
364
+ * Idempotency key to prevent duplicate transactions.
365
+ */
365
366
  idempotencyKey?: string;
367
+ /**
368
+ * Transaction mode: 'sponsored' for gas-sponsored, 'self' for self-paid.
369
+ */
366
370
  mode?: 'sponsored' | 'self';
371
+ /**
372
+ * Sender address override. If not provided, uses user.evmAddress.
373
+ */
367
374
  from?: `0x${string}`;
368
375
  /**
369
376
  * Run best-effort RPC preflight (eth_estimateGas) before prompting passkey.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as nc from 'crypto';
2
2
  import { createContext, useRef, useEffect, useMemo, useState, useCallback, useContext } from 'react';
3
- import { signSession, getAuthNonce, signAuthorization, createPasskeyProvider, createMpcProvider, ZERO_HASH, deriveWrapKey, createMasterKeyProvider, sealMasterSeed, uploadBlob, deriveEvmKey, selectSigner, VolrError } from '@volr/sdk-core';
3
+ import { signSession, getAuthNonce, signAuthorization, createPasskeyProvider, createMpcProvider, deriveWrapKey, createMasterKeyProvider, sealMasterSeed, uploadBlob, deriveEvmKey, ZERO_HASH, selectSigner, VolrError } from '@volr/sdk-core';
4
4
  export { createMasterKeyProvider, createMpcProvider, createPasskeyProvider, deriveEvmKey, deriveWrapKey, sealMasterSeed, uploadBlob } from '@volr/sdk-core';
5
5
  import axios from 'axios';
6
6
  import { jsx } from 'react/jsx-runtime';
@@ -18177,7 +18177,9 @@ async function pollTransactionStatus(txId, client, maxAttempts = 60, intervalMs
18177
18177
  return {
18178
18178
  txId,
18179
18179
  status: "CONFIRMED",
18180
- txHash
18180
+ txHash,
18181
+ gasUsed: response.gasUsed ? BigInt(response.gasUsed) : 0n,
18182
+ blockNumber: response.blockNumber ? BigInt(response.blockNumber) : 0n
18181
18183
  };
18182
18184
  }
18183
18185
  if (status === "FAILED") {
@@ -18212,8 +18214,6 @@ async function sendCalls(args) {
18212
18214
  if (chainId === 0) {
18213
18215
  throw new Error("chainId cannot be 0");
18214
18216
  }
18215
- const effectivePolicyId = opts.policyId?.toLowerCase() === ZERO_HASH.toLowerCase() ? void 0 : opts.policyId;
18216
- validatePolicyId2(effectivePolicyId);
18217
18217
  const normalizedFrom = from14;
18218
18218
  const normalizedCalls = normalizeCalls(calls);
18219
18219
  validateCalls2(normalizedCalls);
@@ -18243,32 +18243,28 @@ async function sendCalls(args) {
18243
18243
  { tolerateFundingErrors }
18244
18244
  );
18245
18245
  }
18246
- let projectPolicyId;
18247
- if (!effectivePolicyId) {
18248
- const tempAuthForPrecheck = buildTempAuth({
18249
- chainId,
18250
- from: normalizedFrom,
18251
- policyId: ZERO_HASH,
18252
- calls: normalizedCalls,
18253
- expiresInSec: opts.expiresInSec ?? DEFAULT_EXPIRES_IN_SEC
18246
+ const tempAuthForPrecheck = buildTempAuth({
18247
+ chainId,
18248
+ from: normalizedFrom,
18249
+ policyId: ZERO_HASH,
18250
+ calls: normalizedCalls,
18251
+ expiresInSec: opts.expiresInSec ?? DEFAULT_EXPIRES_IN_SEC
18252
+ });
18253
+ let precheckQuote;
18254
+ try {
18255
+ precheckQuote = await deps.precheck({
18256
+ auth: tempAuthForPrecheck,
18257
+ calls: normalizedCalls
18254
18258
  });
18255
- let precheckQuote;
18256
- try {
18257
- precheckQuote = await deps.precheck({
18258
- auth: tempAuthForPrecheck,
18259
- calls: normalizedCalls
18260
- });
18261
- } catch (err) {
18262
- throw err instanceof Error ? err : new Error(String(err));
18263
- }
18264
- const quotePolicyId = precheckQuote.policyId;
18265
- if (!quotePolicyId) {
18266
- throw new Error("Backend did not return policyId in precheck response");
18267
- }
18268
- projectPolicyId = quotePolicyId;
18269
- } else {
18270
- projectPolicyId = effectivePolicyId;
18259
+ } catch (err) {
18260
+ throw err instanceof Error ? err : new Error(String(err));
18271
18261
  }
18262
+ const quotePolicyId = precheckQuote.policyId;
18263
+ if (!quotePolicyId) {
18264
+ throw new Error("Backend did not return policyId in precheck response");
18265
+ }
18266
+ const projectPolicyId = quotePolicyId;
18267
+ validatePolicyId2(projectPolicyId);
18272
18268
  const tempAuth = buildTempAuth({
18273
18269
  chainId,
18274
18270
  from: normalizedFrom,
@@ -18288,7 +18284,8 @@ async function sendCalls(args) {
18288
18284
  let activeProvider = null;
18289
18285
  try {
18290
18286
  const resolved = await resolveSigner({
18291
- explicitSigner: opts.signer,
18287
+ explicitSigner: void 0,
18288
+ // Always resolve internally
18292
18289
  provider: deps.provider,
18293
18290
  chainId,
18294
18291
  client: deps.client,
@@ -18305,7 +18302,7 @@ async function sendCalls(args) {
18305
18302
  console.log(
18306
18303
  `[useVolrWallet] Transaction ${result.txId} is ${result.status}, starting polling...`
18307
18304
  );
18308
- return await pollTransactionStatus(result.txId, deps.client);
18305
+ return pollTransactionStatus(result.txId, deps.client);
18309
18306
  }
18310
18307
  return result;
18311
18308
  } finally {
@@ -18393,7 +18390,7 @@ function useVolrWallet() {
18393
18390
  return Array.isArray(calls2) && calls2.length > 0 && "data" in calls2[0] && !("abi" in calls2[0]);
18394
18391
  };
18395
18392
  const builtCalls = isCallArray(calls) ? calls : buildCalls(calls);
18396
- return await sendCalls({
18393
+ return sendCalls({
18397
18394
  chainId,
18398
18395
  from: getAddress(from14),
18399
18396
  calls: builtCalls.map((c) => ({