@chipi-stack/backend 14.15.1 → 14.17.0
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/README.md +48 -0
- package/dist/index.d.mts +543 -65
- package/dist/index.d.ts +543 -65
- package/dist/index.js +1026 -317
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +997 -319
- package/dist/index.mjs.map +1 -1
- package/dist/skuPurchases.js +16 -2
- package/dist/skuPurchases.js.map +1 -1
- package/dist/skuPurchases.mjs +16 -2
- package/dist/skuPurchases.mjs.map +1 -1
- package/dist/transactions.js +16 -2
- package/dist/transactions.js.map +1 -1
- package/dist/transactions.mjs +16 -2
- package/dist/transactions.mjs.map +1 -1
- package/dist/wallets.js +25 -3
- package/dist/wallets.js.map +1 -1
- package/dist/wallets.mjs +25 -3
- package/dist/wallets.mjs.map +1 -1
- package/package.json +4 -4
package/dist/wallets.js
CHANGED
|
@@ -352,6 +352,7 @@ var init_stark = __esm({
|
|
|
352
352
|
var execute_paymaster_raw_exports = {};
|
|
353
353
|
__export(execute_paymaster_raw_exports, {
|
|
354
354
|
executeShhhSponsoredRaw: () => executeShhhSponsoredRaw,
|
|
355
|
+
newOeNonce: () => newOeNonce,
|
|
355
356
|
resolveShhhChainId: () => resolveShhhChainId,
|
|
356
357
|
serializeExecuteFromOutsideV2Calldata: () => serializeExecuteFromOutsideV2Calldata
|
|
357
358
|
});
|
|
@@ -478,13 +479,26 @@ init_encryption2();
|
|
|
478
479
|
|
|
479
480
|
// src/execute-paymaster-transaction.ts
|
|
480
481
|
init_encryption2();
|
|
482
|
+
function feltEquals(value, expected) {
|
|
483
|
+
try {
|
|
484
|
+
return BigInt(value) === expected;
|
|
485
|
+
} catch {
|
|
486
|
+
return false;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
481
489
|
function normalizeSignature(signature) {
|
|
482
490
|
if (Array.isArray(signature)) {
|
|
483
491
|
if (signature.length < 2) {
|
|
484
492
|
throw new Error(`Array signature must have at least 2 elements, got ${signature.length}`);
|
|
485
493
|
}
|
|
486
|
-
const
|
|
487
|
-
|
|
494
|
+
const isArgentSingle = signature.length === 5 && feltEquals(signature[0], 1n) && feltEquals(signature[1], 0n);
|
|
495
|
+
if (signature.length !== 2 && !isArgentSingle) {
|
|
496
|
+
throw new Error(
|
|
497
|
+
`Unsupported ${signature.length}-felt signature: expected [r, s] or Argent [1, 0, pubkey, r, s].`
|
|
498
|
+
);
|
|
499
|
+
}
|
|
500
|
+
const r = isArgentSingle ? signature[3] : signature[0];
|
|
501
|
+
const s = isArgentSingle ? signature[4] : signature[1];
|
|
488
502
|
if (r == null || s == null) {
|
|
489
503
|
throw new Error(`Signature elements must not be null/undefined. Got r=${r}, s=${s}`);
|
|
490
504
|
}
|
|
@@ -923,7 +937,10 @@ var ChipiWallets = class {
|
|
|
923
937
|
publicKey,
|
|
924
938
|
walletType,
|
|
925
939
|
starkKeyPubAX,
|
|
926
|
-
|
|
940
|
+
// The class the address above was computed with. SHHH always
|
|
941
|
+
// names it: chipi-back's default for clients that name none is
|
|
942
|
+
// the class SDKs up to 14.16 used (V8.4), not ours.
|
|
943
|
+
...(customClassHash || isShhh) && { classHash: accountClassHash },
|
|
927
944
|
// SHHH: tell chipi-back which signer kind + pubkey felts
|
|
928
945
|
// produced this deployment so it can validate against the
|
|
929
946
|
// expected SHHH constructor shape and populate the new
|
|
@@ -935,6 +952,11 @@ var ChipiWallets = class {
|
|
|
935
952
|
}
|
|
936
953
|
});
|
|
937
954
|
const { typedData: typedData2, accountClassHash: accountClassHashResponse } = typedDataResponse;
|
|
955
|
+
if (isShhh && (!accountClassHashResponse || BigInt(accountClassHashResponse) !== BigInt(accountClassHash))) {
|
|
956
|
+
throw new Error(
|
|
957
|
+
`prepare-creation returned class ${accountClassHashResponse ?? "(none)"}, but the wallet address was computed with ${accountClassHash}. Not deploying.`
|
|
958
|
+
);
|
|
959
|
+
}
|
|
938
960
|
let userSignaturePayload;
|
|
939
961
|
if (isShhh) {
|
|
940
962
|
userSignaturePayload = {
|