@veridex/sdk 1.1.4 → 1.1.5
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.mts +38 -10
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -3597,19 +3597,47 @@ declare function createMainnetSDK(chain?: ChainName, config?: Omit<SimpleSDKConf
|
|
|
3597
3597
|
*
|
|
3598
3598
|
* @example
|
|
3599
3599
|
* ```typescript
|
|
3600
|
-
* import {
|
|
3600
|
+
* import {
|
|
3601
|
+
* createSessionSDK,
|
|
3602
|
+
* SessionManager,
|
|
3603
|
+
* EVMHubClientAdapter,
|
|
3604
|
+
* } from '@veridex/sdk';
|
|
3605
|
+
* import { JsonRpcProvider, Wallet, parseEther } from 'ethers';
|
|
3606
|
+
*
|
|
3607
|
+
* const sdk = createSessionSDK('base', { network: 'testnet' });
|
|
3608
|
+
* await sdk.passkey.register('user@example.com', 'My Wallet');
|
|
3601
3609
|
*
|
|
3602
|
-
*
|
|
3603
|
-
*
|
|
3610
|
+
* // SessionManager is positional (credential, hubClient, passkeySign, config).
|
|
3611
|
+
* // The hub client needs an ethers signer because session registration is an
|
|
3612
|
+
* // on-chain transaction.
|
|
3613
|
+
* const provider = new JsonRpcProvider('https://sepolia.base.org');
|
|
3614
|
+
* const signer = new Wallet(process.env.PRIVATE_KEY!, provider);
|
|
3615
|
+
* const hubClient = new EVMHubClientAdapter(
|
|
3616
|
+
* sdk.getChainClient() as any,
|
|
3617
|
+
* signer as any,
|
|
3618
|
+
* );
|
|
3604
3619
|
*
|
|
3605
|
-
*
|
|
3606
|
-
*
|
|
3607
|
-
*
|
|
3608
|
-
*
|
|
3609
|
-
* }
|
|
3620
|
+
* const manager = new SessionManager(
|
|
3621
|
+
* sdk.getCredential()!,
|
|
3622
|
+
* hubClient,
|
|
3623
|
+
* (challenge) => sdk.passkey.sign(challenge),
|
|
3624
|
+
* { duration: 3600, maxValue: parseEther('0.05') },
|
|
3625
|
+
* );
|
|
3626
|
+
*
|
|
3627
|
+
* const session = await manager.createSession();
|
|
3610
3628
|
*
|
|
3611
|
-
* //
|
|
3612
|
-
* await
|
|
3629
|
+
* // Sign and submit each action explicitly via the relayer.
|
|
3630
|
+
* const signed = await manager.signAction({
|
|
3631
|
+
* action: 'transfer',
|
|
3632
|
+
* targetChain: 10004,
|
|
3633
|
+
* payload,
|
|
3634
|
+
* nonce,
|
|
3635
|
+
* value,
|
|
3636
|
+
* });
|
|
3637
|
+
* await sdk.relayer!.submitSignedAction({
|
|
3638
|
+
* ...signed.action,
|
|
3639
|
+
* signature: signed.signature,
|
|
3640
|
+
* } as any);
|
|
3613
3641
|
* ```
|
|
3614
3642
|
*/
|
|
3615
3643
|
declare function createSessionSDK(chain?: ChainName, config?: SimpleSDKConfig): VeridexSDK;
|
package/dist/index.js
CHANGED
|
@@ -15224,6 +15224,10 @@ init_presets();
|
|
|
15224
15224
|
init_featureFlags();
|
|
15225
15225
|
init_presets();
|
|
15226
15226
|
init_featureFlags();
|
|
15227
|
+
var DEFAULT_PUBLIC_RELAYER_URLS = {
|
|
15228
|
+
testnet: "https://relayer.veridex.network"
|
|
15229
|
+
// mainnet: '<set when public mainnet relayer ships>',
|
|
15230
|
+
};
|
|
15227
15231
|
function createChainClient(chain, network, customRpcUrl) {
|
|
15228
15232
|
const preset = getChainPreset(chain);
|
|
15229
15233
|
const config = preset[network];
|
|
@@ -15336,7 +15340,7 @@ function createSDK(chain, config = {}) {
|
|
|
15336
15340
|
return new VeridexSDK({
|
|
15337
15341
|
chain: chainClient,
|
|
15338
15342
|
testnet: network === "testnet",
|
|
15339
|
-
relayerUrl: config.relayerUrl,
|
|
15343
|
+
relayerUrl: config.relayerUrl ?? DEFAULT_PUBLIC_RELAYER_URLS[network],
|
|
15340
15344
|
relayerApiKey: config.relayerApiKey,
|
|
15341
15345
|
sponsorPrivateKey: config.sponsorPrivateKey,
|
|
15342
15346
|
integratorSponsorKey: config.integratorSponsorKey,
|