@veridex/sdk 1.1.6 → 1.1.7
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/{EVMClient-CTOtNY8I.d.mts → EVMClient-DqDiFak8.d.mts} +1 -1
- package/dist/auth/prepareAuth.d.mts +5 -4
- package/dist/auth/prepareAuth.js +57 -1415
- package/dist/auth/prepareAuth.js.map +1 -1
- package/dist/auth/prepareAuth.mjs +17 -96
- package/dist/auth/prepareAuth.mjs.map +1 -1
- package/dist/chains/aptos/index.d.mts +1 -1
- package/dist/chains/aptos/index.js +11 -33
- package/dist/chains/aptos/index.js.map +1 -1
- package/dist/chains/aptos/index.mjs +2 -2
- package/dist/chains/avalanche/index.d.mts +2 -2
- package/dist/chains/avalanche/index.js +19 -115
- package/dist/chains/avalanche/index.js.map +1 -1
- package/dist/chains/avalanche/index.mjs +3 -3
- package/dist/chains/evm/index.d.mts +3 -3
- package/dist/chains/evm/index.js +19 -115
- package/dist/chains/evm/index.js.map +1 -1
- package/dist/chains/evm/index.mjs +2 -2
- package/dist/chains/solana/index.d.mts +1 -1
- package/dist/chains/solana/index.js +11 -33
- package/dist/chains/solana/index.js.map +1 -1
- package/dist/chains/solana/index.mjs +2 -2
- package/dist/chains/stacks/index.d.mts +1 -1
- package/dist/chains/stacks/index.js +11 -38
- package/dist/chains/stacks/index.js.map +1 -1
- package/dist/chains/stacks/index.mjs +2 -2
- package/dist/chains/starknet/index.d.mts +36 -2
- package/dist/chains/starknet/index.js +208 -37
- package/dist/chains/starknet/index.js.map +1 -1
- package/dist/chains/starknet/index.mjs +9 -4
- package/dist/chains/sui/index.d.mts +1 -1
- package/dist/chains/sui/index.js +11 -27
- package/dist/chains/sui/index.js.map +1 -1
- package/dist/chains/sui/index.mjs +2 -2
- package/dist/{chunk-ZNIVNPGF.mjs → chunk-3PCAVZUZ.mjs} +173 -37
- package/dist/chunk-3PCAVZUZ.mjs.map +1 -0
- package/dist/{chunk-DQOW3G7M.mjs → chunk-6BINP4RT.mjs} +48 -9
- package/dist/{chunk-DQOW3G7M.mjs.map → chunk-6BINP4RT.mjs.map} +1 -1
- package/dist/{chunk-7KN6Y4GX.mjs → chunk-AK5HWYX4.mjs} +12 -40
- package/dist/chunk-AK5HWYX4.mjs.map +1 -0
- package/dist/{chunk-QVTADARB.mjs → chunk-FPSCAGYS.mjs} +12 -35
- package/dist/chunk-FPSCAGYS.mjs.map +1 -0
- package/dist/{chunk-USVZH4QC.mjs → chunk-H3WRT6Y4.mjs} +20 -117
- package/dist/chunk-H3WRT6Y4.mjs.map +1 -0
- package/dist/{chunk-GXJUY2SC.mjs → chunk-MNH22BM2.mjs} +12 -35
- package/dist/chunk-MNH22BM2.mjs.map +1 -0
- package/dist/chunk-N42LPFPJ.mjs +177 -0
- package/dist/chunk-N42LPFPJ.mjs.map +1 -0
- package/dist/{chunk-D57UJ4L5.mjs → chunk-NKSRF45N.mjs} +12 -29
- package/dist/chunk-NKSRF45N.mjs.map +1 -0
- package/dist/{chunk-2CALEUER.mjs → chunk-SKZLZFE2.mjs} +5 -58
- package/dist/chunk-SKZLZFE2.mjs.map +1 -0
- package/dist/{chunk-NVRAQPSF.mjs → chunk-UF5NWMSQ.mjs} +20 -4
- package/dist/chunk-UF5NWMSQ.mjs.map +1 -0
- package/dist/chunk-WC4X3MAO.mjs +58 -0
- package/dist/chunk-WC4X3MAO.mjs.map +1 -0
- package/dist/{chunk-5FH67KLG.mjs → chunk-XHDOSV2F.mjs} +2 -2
- package/dist/{index-9ercn1sa.d.mts → index-D1nb2JV9.d.mts} +1 -1
- package/dist/index-qyOqd8tx.d.mts +517 -0
- package/dist/index.d.mts +27 -364
- package/dist/index.js +2316 -2473
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +978 -51
- package/dist/index.mjs.map +1 -1
- package/dist/passkey.mjs +2 -1
- package/dist/payload.d.mts +22 -28
- package/dist/payload.js +50 -9
- package/dist/payload.js.map +1 -1
- package/dist/payload.mjs +7 -3
- package/dist/platform/index.d.mts +3 -0
- package/dist/platform/index.js +216 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/platform/index.mjs +21 -0
- package/dist/platform/index.mjs.map +1 -0
- package/dist/{portfolio-W2FQ2G3O.mjs → portfolio-MLP2JIFK.mjs} +2 -3
- package/dist/queries/index.mjs +324 -10
- package/dist/queries/index.mjs.map +1 -1
- package/dist/{types-DQ5dtU9x.d.mts → types-CdlEbixV.d.mts} +11 -1
- package/package.json +7 -1
- package/dist/chunk-2CALEUER.mjs.map +0 -1
- package/dist/chunk-72ZA3OYQ.mjs +0 -20
- package/dist/chunk-72ZA3OYQ.mjs.map +0 -1
- package/dist/chunk-7KN6Y4GX.mjs.map +0 -1
- package/dist/chunk-D57UJ4L5.mjs.map +0 -1
- package/dist/chunk-GXJUY2SC.mjs.map +0 -1
- package/dist/chunk-NVRAQPSF.mjs.map +0 -1
- package/dist/chunk-QVTADARB.mjs.map +0 -1
- package/dist/chunk-USVZH4QC.mjs.map +0 -1
- package/dist/chunk-XDIIFIW6.mjs +0 -330
- package/dist/chunk-XDIIFIW6.mjs.map +0 -1
- package/dist/chunk-ZNIVNPGF.mjs.map +0 -1
- package/dist/chunk-ZXMTPBSP.mjs +0 -857
- package/dist/chunk-ZXMTPBSP.mjs.map +0 -1
- /package/dist/{chunk-5FH67KLG.mjs.map → chunk-XHDOSV2F.mjs.map} +0 -0
- /package/dist/{portfolio-W2FQ2G3O.mjs.map → portfolio-MLP2JIFK.mjs.map} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AvalancheClient
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-XHDOSV2F.mjs";
|
|
4
|
+
import "../../chunk-H3WRT6Y4.mjs";
|
|
5
|
+
import "../../chunk-6BINP4RT.mjs";
|
|
6
6
|
import "../../chunk-KYOOTSRA.mjs";
|
|
7
7
|
export {
|
|
8
8
|
AvalancheClient
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { E as EVMClient, a as EVMClientConfig } from '../../EVMClient-
|
|
2
|
-
export { E as EVMHubClientAdapter } from '../../index-
|
|
1
|
+
export { E as EVMClient, a as EVMClientConfig } from '../../EVMClient-DqDiFak8.mjs';
|
|
2
|
+
export { E as EVMHubClientAdapter } from '../../index-D1nb2JV9.mjs';
|
|
3
3
|
import '../../types.mjs';
|
|
4
4
|
import 'ethers';
|
|
5
|
-
import '../../types-
|
|
5
|
+
import '../../types-CdlEbixV.mjs';
|
|
6
6
|
import '../../types-C564CfsE.mjs';
|
|
7
7
|
import '../../passkey-fh8bo2w-.mjs';
|
|
8
8
|
import '@simplewebauthn/types';
|
package/dist/chains/evm/index.js
CHANGED
|
@@ -101,6 +101,7 @@ function padTo32Bytes(address) {
|
|
|
101
101
|
}
|
|
102
102
|
return "0x" + hex.padStart(64, "0");
|
|
103
103
|
}
|
|
104
|
+
var CHALLENGE_DOMAIN = import_ethers.ethers.sha256(import_ethers.ethers.toUtf8Bytes("veridex.challenge.v1"));
|
|
104
105
|
|
|
105
106
|
// src/chains/evm/EVMClient.ts
|
|
106
107
|
var PROXY_BYTECODE_PREFIX = "0x3d602d80600a3d3981f3363d3d373d3d3d363d73";
|
|
@@ -392,129 +393,32 @@ var EVMClient = class {
|
|
|
392
393
|
);
|
|
393
394
|
}
|
|
394
395
|
async dispatch(signature, publicKeyX, publicKeyY, targetChain, actionPayload, nonce, signer) {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
const messageFee = await this.getMessageFee();
|
|
405
|
-
const tx = await hubWithSigner.dispatch(
|
|
406
|
-
signatureTuple,
|
|
407
|
-
publicKeyX,
|
|
408
|
-
publicKeyY,
|
|
409
|
-
targetChain,
|
|
410
|
-
actionPayload,
|
|
411
|
-
nonce,
|
|
412
|
-
{ value: messageFee }
|
|
413
|
-
);
|
|
414
|
-
const receipt = await tx.wait();
|
|
415
|
-
const dispatchEvent = receipt.logs.find((log) => {
|
|
416
|
-
try {
|
|
417
|
-
const parsed = hubWithSigner.interface.parseLog(log);
|
|
418
|
-
return parsed?.name === "ActionDispatched";
|
|
419
|
-
} catch {
|
|
420
|
-
return false;
|
|
421
|
-
}
|
|
422
|
-
});
|
|
423
|
-
let sequence = 0n;
|
|
424
|
-
if (dispatchEvent) {
|
|
425
|
-
const parsed = hubWithSigner.interface.parseLog(dispatchEvent);
|
|
426
|
-
sequence = BigInt(parsed?.args?.sequence?.toString() ?? "0");
|
|
427
|
-
}
|
|
428
|
-
const keyHash = import_ethers2.ethers.keccak256(
|
|
429
|
-
import_ethers2.ethers.AbiCoder.defaultAbiCoder().encode(
|
|
430
|
-
["uint256", "uint256"],
|
|
431
|
-
[publicKeyX, publicKeyY]
|
|
432
|
-
)
|
|
396
|
+
void signature;
|
|
397
|
+
void publicKeyX;
|
|
398
|
+
void publicKeyY;
|
|
399
|
+
void targetChain;
|
|
400
|
+
void actionPayload;
|
|
401
|
+
void nonce;
|
|
402
|
+
void signer;
|
|
403
|
+
throw new Error(
|
|
404
|
+
"Direct Hub dispatch requires pinned v3 destination metadata. Use VeridexSDK.transferViaRelayer() or bridgeViaRelayer()."
|
|
433
405
|
);
|
|
434
|
-
return {
|
|
435
|
-
transactionHash: receipt.hash,
|
|
436
|
-
sequence,
|
|
437
|
-
userKeyHash: keyHash,
|
|
438
|
-
targetChain,
|
|
439
|
-
blockNumber: receipt.blockNumber
|
|
440
|
-
};
|
|
441
406
|
}
|
|
442
407
|
/**
|
|
443
408
|
* Dispatch an action to the Hub via relayer (gasless)
|
|
444
409
|
* The relayer pays for gas and submits the transaction on behalf of the user
|
|
445
410
|
*/
|
|
446
411
|
async dispatchGasless(signature, publicKeyX, publicKeyY, targetChain, actionPayload, nonce, relayerUrl) {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
412
|
+
void signature;
|
|
413
|
+
void publicKeyX;
|
|
414
|
+
void publicKeyY;
|
|
415
|
+
void targetChain;
|
|
416
|
+
void actionPayload;
|
|
417
|
+
void nonce;
|
|
418
|
+
void relayerUrl;
|
|
419
|
+
throw new Error(
|
|
420
|
+
"ChainClient.dispatchGasless() cannot bind v3 destination metadata. Use VeridexSDK.transferViaRelayer() or bridgeViaRelayer()."
|
|
452
421
|
);
|
|
453
|
-
const message = import_ethers2.ethers.keccak256(
|
|
454
|
-
import_ethers2.ethers.AbiCoder.defaultAbiCoder().encode(
|
|
455
|
-
["bytes32", "uint16", "bytes", "uint256"],
|
|
456
|
-
[keyHash, targetChain, actionPayload, nonce]
|
|
457
|
-
)
|
|
458
|
-
);
|
|
459
|
-
const request = {
|
|
460
|
-
messageHash: message,
|
|
461
|
-
r: "0x" + signature.r.toString(16).padStart(64, "0"),
|
|
462
|
-
s: "0x" + signature.s.toString(16).padStart(64, "0"),
|
|
463
|
-
publicKeyX: "0x" + publicKeyX.toString(16).padStart(64, "0"),
|
|
464
|
-
publicKeyY: "0x" + publicKeyY.toString(16).padStart(64, "0"),
|
|
465
|
-
targetChain,
|
|
466
|
-
actionPayload,
|
|
467
|
-
nonce: Number(nonce)
|
|
468
|
-
};
|
|
469
|
-
const MAX_ATTEMPTS = 3;
|
|
470
|
-
const baseDelayMs = 1e3;
|
|
471
|
-
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
472
|
-
let response;
|
|
473
|
-
let lastError;
|
|
474
|
-
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
|
|
475
|
-
try {
|
|
476
|
-
response = await fetch(`${relayerUrl}/api/v1/submit`, {
|
|
477
|
-
method: "POST",
|
|
478
|
-
headers: {
|
|
479
|
-
"Content-Type": "application/json"
|
|
480
|
-
},
|
|
481
|
-
body: JSON.stringify(request)
|
|
482
|
-
});
|
|
483
|
-
const retryable = response.status >= 500 || response.status === 408 || response.status === 429;
|
|
484
|
-
if (!retryable) {
|
|
485
|
-
break;
|
|
486
|
-
}
|
|
487
|
-
if (attempt === MAX_ATTEMPTS) break;
|
|
488
|
-
const retryAfter = response.headers.get("retry-after");
|
|
489
|
-
const explicitDelay = retryAfter ? parseInt(retryAfter, 10) * 1e3 : 0;
|
|
490
|
-
const backoff = explicitDelay > 0 ? explicitDelay : baseDelayMs * 2 ** (attempt - 1) + Math.floor(Math.random() * 200);
|
|
491
|
-
await sleep(backoff);
|
|
492
|
-
} catch (err) {
|
|
493
|
-
lastError = err;
|
|
494
|
-
if (attempt === MAX_ATTEMPTS) break;
|
|
495
|
-
const backoff = baseDelayMs * 2 ** (attempt - 1) + Math.floor(Math.random() * 200);
|
|
496
|
-
await sleep(backoff);
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
if (!response) {
|
|
500
|
-
throw new Error(
|
|
501
|
-
`Relayer submission failed after ${MAX_ATTEMPTS} attempts: ${lastError instanceof Error ? lastError.message : String(lastError)}`
|
|
502
|
-
);
|
|
503
|
-
}
|
|
504
|
-
if (!response.ok) {
|
|
505
|
-
const error = await response.json().catch(() => ({ error: response.statusText }));
|
|
506
|
-
throw new Error(`Relayer submission failed: ${error.error || response.statusText}`);
|
|
507
|
-
}
|
|
508
|
-
const result = await response.json();
|
|
509
|
-
if (!result.success) {
|
|
510
|
-
throw new Error(`Relayer submission failed: ${result.error}`);
|
|
511
|
-
}
|
|
512
|
-
return {
|
|
513
|
-
transactionHash: result.txHash,
|
|
514
|
-
sequence: BigInt(result.sequence || "0"),
|
|
515
|
-
userKeyHash: keyHash,
|
|
516
|
-
targetChain
|
|
517
|
-
};
|
|
518
422
|
}
|
|
519
423
|
async getVaultAddress(userKeyHash) {
|
|
520
424
|
try {
|