@volr/react 0.1.71 → 0.1.72
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.cjs +41 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -1
- package/dist/index.d.ts +34 -1
- package/dist/index.js +41 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { KeyStorageType as KeyStorageType$1, WalletProviderPort, PrecheckInput, PrecheckQuote, RelayInput, RelayResult, Call, PasskeyProviderPort } from '@volr/sdk-core';
|
|
3
|
+
import { KeyStorageType as KeyStorageType$1, WalletProviderPort, PrecheckInput, PrecheckQuote, RelayInput, RelayResult, Call, TypedDataInput, PasskeyProviderPort } from '@volr/sdk-core';
|
|
4
4
|
export { AuthorizationTuple, Call, MpcTransport, PrecheckInput, PrecheckQuote, PrfInput, RelayInput, RelayMode, RelayResult, SessionAuth, UploadBlobOptions, createMasterKeyProvider, createMpcProvider, createPasskeyProvider, deriveEvmKey, deriveWrapKey, sealMasterSeed, uploadBlob } from '@volr/sdk-core';
|
|
5
5
|
import { Address, Abi, PublicClient } from 'viem';
|
|
6
6
|
|
|
@@ -434,6 +434,39 @@ type EvmClient = {
|
|
|
434
434
|
* Send a batch of transactions
|
|
435
435
|
*/
|
|
436
436
|
sendBatch: SendBatchOverloads;
|
|
437
|
+
/**
|
|
438
|
+
* Sign a message (EIP-191 personal_sign)
|
|
439
|
+
* @param message - String or bytes to sign
|
|
440
|
+
* @returns Signature hex string
|
|
441
|
+
* @example
|
|
442
|
+
* ```ts
|
|
443
|
+
* const signature = await evm(1).signMessage('Hello, World!');
|
|
444
|
+
* // or with raw bytes
|
|
445
|
+
* const signature = await evm(1).signMessage(new Uint8Array([1, 2, 3]));
|
|
446
|
+
* ```
|
|
447
|
+
*/
|
|
448
|
+
signMessage: (message: string | Uint8Array) => Promise<`0x${string}`>;
|
|
449
|
+
/**
|
|
450
|
+
* Sign EIP-712 typed data
|
|
451
|
+
* @param typedData - Typed data with domain, types, and message
|
|
452
|
+
* @returns Signature hex string
|
|
453
|
+
* @example
|
|
454
|
+
* ```ts
|
|
455
|
+
* const signature = await evm(1).signTypedData({
|
|
456
|
+
* domain: {
|
|
457
|
+
* name: 'MyApp',
|
|
458
|
+
* version: '1',
|
|
459
|
+
* chainId: 1,
|
|
460
|
+
* verifyingContract: '0x...',
|
|
461
|
+
* },
|
|
462
|
+
* types: {
|
|
463
|
+
* Message: [{ name: 'content', type: 'string' }],
|
|
464
|
+
* },
|
|
465
|
+
* message: { content: 'Hello' },
|
|
466
|
+
* });
|
|
467
|
+
* ```
|
|
468
|
+
*/
|
|
469
|
+
signTypedData: (typedData: TypedDataInput) => Promise<`0x${string}`>;
|
|
437
470
|
};
|
|
438
471
|
/**
|
|
439
472
|
* Volr client interface
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { KeyStorageType as KeyStorageType$1, WalletProviderPort, PrecheckInput, PrecheckQuote, RelayInput, RelayResult, Call, PasskeyProviderPort } from '@volr/sdk-core';
|
|
3
|
+
import { KeyStorageType as KeyStorageType$1, WalletProviderPort, PrecheckInput, PrecheckQuote, RelayInput, RelayResult, Call, TypedDataInput, PasskeyProviderPort } from '@volr/sdk-core';
|
|
4
4
|
export { AuthorizationTuple, Call, MpcTransport, PrecheckInput, PrecheckQuote, PrfInput, RelayInput, RelayMode, RelayResult, SessionAuth, UploadBlobOptions, createMasterKeyProvider, createMpcProvider, createPasskeyProvider, deriveEvmKey, deriveWrapKey, sealMasterSeed, uploadBlob } from '@volr/sdk-core';
|
|
5
5
|
import { Address, Abi, PublicClient } from 'viem';
|
|
6
6
|
|
|
@@ -434,6 +434,39 @@ type EvmClient = {
|
|
|
434
434
|
* Send a batch of transactions
|
|
435
435
|
*/
|
|
436
436
|
sendBatch: SendBatchOverloads;
|
|
437
|
+
/**
|
|
438
|
+
* Sign a message (EIP-191 personal_sign)
|
|
439
|
+
* @param message - String or bytes to sign
|
|
440
|
+
* @returns Signature hex string
|
|
441
|
+
* @example
|
|
442
|
+
* ```ts
|
|
443
|
+
* const signature = await evm(1).signMessage('Hello, World!');
|
|
444
|
+
* // or with raw bytes
|
|
445
|
+
* const signature = await evm(1).signMessage(new Uint8Array([1, 2, 3]));
|
|
446
|
+
* ```
|
|
447
|
+
*/
|
|
448
|
+
signMessage: (message: string | Uint8Array) => Promise<`0x${string}`>;
|
|
449
|
+
/**
|
|
450
|
+
* Sign EIP-712 typed data
|
|
451
|
+
* @param typedData - Typed data with domain, types, and message
|
|
452
|
+
* @returns Signature hex string
|
|
453
|
+
* @example
|
|
454
|
+
* ```ts
|
|
455
|
+
* const signature = await evm(1).signTypedData({
|
|
456
|
+
* domain: {
|
|
457
|
+
* name: 'MyApp',
|
|
458
|
+
* version: '1',
|
|
459
|
+
* chainId: 1,
|
|
460
|
+
* verifyingContract: '0x...',
|
|
461
|
+
* },
|
|
462
|
+
* types: {
|
|
463
|
+
* Message: [{ name: 'content', type: 'string' }],
|
|
464
|
+
* },
|
|
465
|
+
* message: { content: 'Hello' },
|
|
466
|
+
* });
|
|
467
|
+
* ```
|
|
468
|
+
*/
|
|
469
|
+
signTypedData: (typedData: TypedDataInput) => Promise<`0x${string}`>;
|
|
437
470
|
};
|
|
438
471
|
/**
|
|
439
472
|
* Volr client interface
|
package/dist/index.js
CHANGED
|
@@ -18516,7 +18516,37 @@ function useVolr() {
|
|
|
18516
18516
|
setProvider
|
|
18517
18517
|
}
|
|
18518
18518
|
});
|
|
18519
|
-
})
|
|
18519
|
+
}),
|
|
18520
|
+
signMessage: async (message) => {
|
|
18521
|
+
if (!provider) {
|
|
18522
|
+
throw new Error(
|
|
18523
|
+
"No wallet provider available. Please log in with a Passkey or MPC wallet to sign messages."
|
|
18524
|
+
);
|
|
18525
|
+
}
|
|
18526
|
+
await provider.ensureSession({ interactive: true });
|
|
18527
|
+
const messageHash = hashMessage(
|
|
18528
|
+
typeof message === "string" ? message : { raw: message }
|
|
18529
|
+
);
|
|
18530
|
+
const hashBytes = new Uint8Array(32);
|
|
18531
|
+
const hex = messageHash.slice(2);
|
|
18532
|
+
for (let i = 0; i < 32; i++) {
|
|
18533
|
+
hashBytes[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);
|
|
18534
|
+
}
|
|
18535
|
+
const sig = await provider.signMessage(hashBytes);
|
|
18536
|
+
const v = sig.yParity + 27;
|
|
18537
|
+
const rHex = Array.from(sig.r).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
18538
|
+
const sHex = Array.from(sig.s).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
18539
|
+
const vHex = v.toString(16).padStart(2, "0");
|
|
18540
|
+
return `0x${rHex}${sHex}${vHex}`;
|
|
18541
|
+
},
|
|
18542
|
+
signTypedData: async (typedData) => {
|
|
18543
|
+
if (!provider) {
|
|
18544
|
+
throw new Error(
|
|
18545
|
+
"No wallet provider available. Please log in with a Passkey or MPC wallet to sign typed data."
|
|
18546
|
+
);
|
|
18547
|
+
}
|
|
18548
|
+
return provider.signTypedData(typedData);
|
|
18549
|
+
}
|
|
18520
18550
|
};
|
|
18521
18551
|
},
|
|
18522
18552
|
[user, config, provider, precheck, relay, getRpcUrl, setProvider, client]
|
|
@@ -18609,7 +18639,12 @@ function useVolrLogin() {
|
|
|
18609
18639
|
async (provider) => {
|
|
18610
18640
|
if (typeof window !== "undefined") {
|
|
18611
18641
|
const baseUrl = apiBaseUrl.replace(/\/+$/, "");
|
|
18612
|
-
|
|
18642
|
+
const params = new URLSearchParams({
|
|
18643
|
+
projectApiKey: config.projectApiKey,
|
|
18644
|
+
callbackUrl: window.location.href
|
|
18645
|
+
// Return to current page after login
|
|
18646
|
+
});
|
|
18647
|
+
window.location.href = `${baseUrl}/auth/${provider}?${params.toString()}`;
|
|
18613
18648
|
}
|
|
18614
18649
|
},
|
|
18615
18650
|
[apiBaseUrl, config.projectApiKey]
|
|
@@ -18700,6 +18735,10 @@ function useVolrAuthCallback(options = {}) {
|
|
|
18700
18735
|
const authCode = searchParams.get("code");
|
|
18701
18736
|
const errorParam = searchParams.get("error");
|
|
18702
18737
|
const isNew = searchParams.get("isNewUser") === "true";
|
|
18738
|
+
const warning = searchParams.get("warning");
|
|
18739
|
+
if (warning) {
|
|
18740
|
+
console.warn(`[Volr] ${warning}`);
|
|
18741
|
+
}
|
|
18703
18742
|
if (errorParam) {
|
|
18704
18743
|
const errorMsg = `Authentication failed: ${errorParam.replace(/_/g, " ")}`;
|
|
18705
18744
|
setError(errorMsg);
|