@invisi-labs/sdk 1.1.1 → 1.1.2
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/{chunk-7TFLU2Z6.js → chunk-Z6NDXVBL.js} +43 -16
- package/dist/chunk-Z6NDXVBL.js.map +1 -0
- package/dist/ethers.d.cts +1 -1
- package/dist/ethers.d.ts +1 -1
- package/dist/{gas-estimation-Byi278aa.d.cts → gas-estimation-BV8WdwNF.d.cts} +4 -0
- package/dist/{gas-estimation-CUZXjsO7.d.ts → gas-estimation-v9OjKMsL.d.ts} +4 -0
- package/dist/index.cjs +46 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/indexeddb.cjs +40 -15
- package/dist/indexeddb.cjs.map +1 -1
- package/dist/indexeddb.js +1 -1
- package/dist/memory.cjs +40 -15
- package/dist/memory.cjs.map +1 -1
- package/dist/memory.js +1 -1
- package/dist/sqlite.cjs +40 -15
- package/dist/sqlite.cjs.map +1 -1
- package/dist/sqlite.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-7TFLU2Z6.js.map +0 -1
|
@@ -1362,25 +1362,27 @@ function extractDeliveryCandidates(logs, context, confirmedThrough) {
|
|
|
1362
1362
|
const tokens = array(a.tokens);
|
|
1363
1363
|
const cs = array(a.commitments), tree = integer(a.treeId), start = index(a.startLeafIndex), packed = a.packedDeliveries;
|
|
1364
1364
|
check(
|
|
1365
|
-
typeof packed === "string" && /^0x(?:[0-9a-fA-F]{2})*$/.test(packed)
|
|
1365
|
+
typeof packed === "string" && /^0x(?:[0-9a-fA-F]{2})*$/.test(packed),
|
|
1366
1366
|
"invalid packed deliveries"
|
|
1367
1367
|
);
|
|
1368
1368
|
check(tokens.length === cs.length, "batch token count mismatch");
|
|
1369
|
+
check(start + cs.length <= 65536, "batch exceeds tree capacity");
|
|
1370
|
+
let offset = 2;
|
|
1369
1371
|
cs.forEach((c, i) => {
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
"funds",
|
|
1377
|
-
{
|
|
1378
|
-
ciphertext: `0x${segment.slice(0, 316)}`,
|
|
1379
|
-
clue: `0x${segment.slice(316)}`
|
|
1380
|
-
},
|
|
1381
|
-
tokens[i]
|
|
1372
|
+
check(offset + 4 <= packed.length, "truncated delivery length prefix");
|
|
1373
|
+
const length = Number.parseInt(packed.slice(offset, offset + 4), 16);
|
|
1374
|
+
offset += 4;
|
|
1375
|
+
check(
|
|
1376
|
+
length >= 160 && length <= 416 && offset + length * 2 + 136 <= packed.length,
|
|
1377
|
+
"invalid packed delivery length"
|
|
1382
1378
|
);
|
|
1379
|
+
const ciphertext = `0x${packed.slice(offset, offset + length * 2)}`;
|
|
1380
|
+
offset += length * 2;
|
|
1381
|
+
const clue = `0x${packed.slice(offset, offset + 136)}`;
|
|
1382
|
+
offset += 136;
|
|
1383
|
+
add(log, tree, start + i, c, "funds", { ciphertext, clue }, tokens[i]);
|
|
1383
1384
|
});
|
|
1385
|
+
check(offset === packed.length, "trailing packed delivery bytes");
|
|
1384
1386
|
} else if (log.eventName === "CreditCreated") creation(log, a, a);
|
|
1385
1387
|
else if (log.eventName === "CreditToppedUp")
|
|
1386
1388
|
creation(log, a, object(object(a.params).creation));
|
|
@@ -2775,6 +2777,7 @@ import {
|
|
|
2775
2777
|
// src/session/prepare-common.ts
|
|
2776
2778
|
import { getAddress, hexlify } from "ethers";
|
|
2777
2779
|
import {
|
|
2780
|
+
encodeMemo,
|
|
2778
2781
|
MissingCapabilityError as MissingCapabilityError2,
|
|
2779
2782
|
ReceivingAddress as ReceivingAddress2,
|
|
2780
2783
|
computeNoteCommitment,
|
|
@@ -2884,6 +2887,7 @@ var Preparation = class {
|
|
|
2884
2887
|
const recipient = await ReceivingAddress2.parse(payment.to).resolve(
|
|
2885
2888
|
this.runtime.options.addressResolver
|
|
2886
2889
|
);
|
|
2890
|
+
const memo = encodeMemo(payment.memo);
|
|
2887
2891
|
const nonce = generateNonce();
|
|
2888
2892
|
const identity = await computeNoteIdentity(BigInt(recipient.walletIdentity), nonce);
|
|
2889
2893
|
const keys = recipient.getReceivingKeys();
|
|
@@ -2893,6 +2897,7 @@ var Preparation = class {
|
|
|
2893
2897
|
tokenAddress: BigInt(context.tokenAddress),
|
|
2894
2898
|
walletIdentity: recipient.walletIdentity,
|
|
2895
2899
|
amount: payment.amount,
|
|
2900
|
+
...memo.length === 0 ? {} : { memo },
|
|
2896
2901
|
nonce
|
|
2897
2902
|
};
|
|
2898
2903
|
const commitment = await computeNoteCommitment(
|
|
@@ -3147,6 +3152,7 @@ var CreditPreparation = class {
|
|
|
3147
3152
|
ownerPayout: BigInt(ownerPayout),
|
|
3148
3153
|
spenderPayout: BigInt(spenderPayout),
|
|
3149
3154
|
amount: options.amount,
|
|
3155
|
+
...options.memo === void 0 ? {} : { memo: options.memo },
|
|
3150
3156
|
expiry,
|
|
3151
3157
|
nonce: generateNonce2(),
|
|
3152
3158
|
creditSharedKey: generateCreditSharedKey()
|
|
@@ -3238,7 +3244,16 @@ var CreditPreparation = class {
|
|
|
3238
3244
|
}
|
|
3239
3245
|
const amount = positiveAmount(old.note.amount + options.additionalAmount, 126);
|
|
3240
3246
|
const output = await this.seal(
|
|
3241
|
-
{
|
|
3247
|
+
{
|
|
3248
|
+
...old,
|
|
3249
|
+
note: {
|
|
3250
|
+
...old.note,
|
|
3251
|
+
amount,
|
|
3252
|
+
expiry,
|
|
3253
|
+
nonce: generateNonce2(),
|
|
3254
|
+
...options.memo === void 0 ? {} : { memo: options.memo }
|
|
3255
|
+
}
|
|
3256
|
+
},
|
|
3242
3257
|
frame
|
|
3243
3258
|
);
|
|
3244
3259
|
return this.creation(
|
|
@@ -3304,6 +3319,7 @@ var CreditPreparation = class {
|
|
|
3304
3319
|
note: {
|
|
3305
3320
|
...n,
|
|
3306
3321
|
amount: remaining,
|
|
3322
|
+
...options.credits[i].memo === void 0 ? {} : { memo: options.credits[i].memo },
|
|
3307
3323
|
nonce: await deriveRemainderNonce(...args)
|
|
3308
3324
|
}
|
|
3309
3325
|
},
|
|
@@ -3637,6 +3653,7 @@ import { NullifierCapability } from "@invisi-labs/core";
|
|
|
3637
3653
|
|
|
3638
3654
|
// src/session/inventory.ts
|
|
3639
3655
|
import {
|
|
3656
|
+
encodeMemo as encodeMemo2,
|
|
3640
3657
|
computeCreditCommitment as computeCreditCommitment2,
|
|
3641
3658
|
computeCreditNullifier as computeCreditNullifier3,
|
|
3642
3659
|
computeCreditSharedKeyHash as computeCreditSharedKeyHash2,
|
|
@@ -3778,6 +3795,10 @@ var InventoryProcessor = class {
|
|
|
3778
3795
|
if (!remainder) {
|
|
3779
3796
|
continue;
|
|
3780
3797
|
}
|
|
3798
|
+
const child = foundByKey.get(
|
|
3799
|
+
params.remainderCommitments[index2] + ":" + previous.role
|
|
3800
|
+
);
|
|
3801
|
+
const memo = child?.state.note.memo;
|
|
3781
3802
|
const record = {
|
|
3782
3803
|
commitment: params.remainderCommitments[index2],
|
|
3783
3804
|
treeId: BigInt(args.outputTreeId),
|
|
@@ -3786,7 +3807,13 @@ var InventoryProcessor = class {
|
|
|
3786
3807
|
blockHash: event.blockHash,
|
|
3787
3808
|
transactionHash: event.transactionHash,
|
|
3788
3809
|
role: previous.role,
|
|
3789
|
-
state: {
|
|
3810
|
+
state: {
|
|
3811
|
+
...clone(previous.state),
|
|
3812
|
+
note: {
|
|
3813
|
+
...remainder,
|
|
3814
|
+
...memo === void 0 ? {} : { memo: encodeMemo2(memo) }
|
|
3815
|
+
}
|
|
3816
|
+
},
|
|
3790
3817
|
receivingKeySource: { kind: "draw", commitment: previous.commitment },
|
|
3791
3818
|
spent: "unknown"
|
|
3792
3819
|
};
|
|
@@ -4327,4 +4354,4 @@ export {
|
|
|
4327
4354
|
WalletSession,
|
|
4328
4355
|
MemoryWalletStore
|
|
4329
4356
|
};
|
|
4330
|
-
//# sourceMappingURL=chunk-
|
|
4357
|
+
//# sourceMappingURL=chunk-Z6NDXVBL.js.map
|