@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
package/dist/indexeddb.js
CHANGED
package/dist/memory.cjs
CHANGED
|
@@ -516,25 +516,27 @@ function extractDeliveryCandidates(logs, context, confirmedThrough) {
|
|
|
516
516
|
const tokens = array(a.tokens);
|
|
517
517
|
const cs = array(a.commitments), tree = integer(a.treeId), start = index(a.startLeafIndex), packed = a.packedDeliveries;
|
|
518
518
|
check2(
|
|
519
|
-
typeof packed === "string" && /^0x(?:[0-9a-fA-F]{2})*$/.test(packed)
|
|
519
|
+
typeof packed === "string" && /^0x(?:[0-9a-fA-F]{2})*$/.test(packed),
|
|
520
520
|
"invalid packed deliveries"
|
|
521
521
|
);
|
|
522
522
|
check2(tokens.length === cs.length, "batch token count mismatch");
|
|
523
|
+
check2(start + cs.length <= 65536, "batch exceeds tree capacity");
|
|
524
|
+
let offset = 2;
|
|
523
525
|
cs.forEach((c, i) => {
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
"funds",
|
|
531
|
-
{
|
|
532
|
-
ciphertext: `0x${segment.slice(0, 316)}`,
|
|
533
|
-
clue: `0x${segment.slice(316)}`
|
|
534
|
-
},
|
|
535
|
-
tokens[i]
|
|
526
|
+
check2(offset + 4 <= packed.length, "truncated delivery length prefix");
|
|
527
|
+
const length = Number.parseInt(packed.slice(offset, offset + 4), 16);
|
|
528
|
+
offset += 4;
|
|
529
|
+
check2(
|
|
530
|
+
length >= 160 && length <= 416 && offset + length * 2 + 136 <= packed.length,
|
|
531
|
+
"invalid packed delivery length"
|
|
536
532
|
);
|
|
533
|
+
const ciphertext = `0x${packed.slice(offset, offset + length * 2)}`;
|
|
534
|
+
offset += length * 2;
|
|
535
|
+
const clue = `0x${packed.slice(offset, offset + 136)}`;
|
|
536
|
+
offset += 136;
|
|
537
|
+
add(log, tree, start + i, c, "funds", { ciphertext, clue }, tokens[i]);
|
|
537
538
|
});
|
|
539
|
+
check2(offset === packed.length, "trailing packed delivery bytes");
|
|
538
540
|
} else if (log.eventName === "CreditCreated") creation(log, a, a);
|
|
539
541
|
else if (log.eventName === "CreditToppedUp")
|
|
540
542
|
creation(log, a, object(object(a.params).creation));
|
|
@@ -3146,6 +3148,7 @@ var Preparation = class {
|
|
|
3146
3148
|
const recipient = await import_core8.ReceivingAddress.parse(payment.to).resolve(
|
|
3147
3149
|
this.runtime.options.addressResolver
|
|
3148
3150
|
);
|
|
3151
|
+
const memo = (0, import_core8.encodeMemo)(payment.memo);
|
|
3149
3152
|
const nonce = (0, import_core8.generateNonce)();
|
|
3150
3153
|
const identity = await (0, import_core8.computeNoteIdentity)(BigInt(recipient.walletIdentity), nonce);
|
|
3151
3154
|
const keys = recipient.getReceivingKeys();
|
|
@@ -3155,6 +3158,7 @@ var Preparation = class {
|
|
|
3155
3158
|
tokenAddress: BigInt(context.tokenAddress),
|
|
3156
3159
|
walletIdentity: recipient.walletIdentity,
|
|
3157
3160
|
amount: payment.amount,
|
|
3161
|
+
...memo.length === 0 ? {} : { memo },
|
|
3158
3162
|
nonce
|
|
3159
3163
|
};
|
|
3160
3164
|
const commitment = await (0, import_core8.computeNoteCommitment)(
|
|
@@ -3390,6 +3394,7 @@ var CreditPreparation = class {
|
|
|
3390
3394
|
ownerPayout: BigInt(ownerPayout),
|
|
3391
3395
|
spenderPayout: BigInt(spenderPayout),
|
|
3392
3396
|
amount: options.amount,
|
|
3397
|
+
...options.memo === void 0 ? {} : { memo: options.memo },
|
|
3393
3398
|
expiry,
|
|
3394
3399
|
nonce: (0, import_core9.generateNonce)(),
|
|
3395
3400
|
creditSharedKey: (0, import_core9.generateCreditSharedKey)()
|
|
@@ -3481,7 +3486,16 @@ var CreditPreparation = class {
|
|
|
3481
3486
|
}
|
|
3482
3487
|
const amount = positiveAmount(old.note.amount + options.additionalAmount, 126);
|
|
3483
3488
|
const output = await this.seal(
|
|
3484
|
-
{
|
|
3489
|
+
{
|
|
3490
|
+
...old,
|
|
3491
|
+
note: {
|
|
3492
|
+
...old.note,
|
|
3493
|
+
amount,
|
|
3494
|
+
expiry,
|
|
3495
|
+
nonce: (0, import_core9.generateNonce)(),
|
|
3496
|
+
...options.memo === void 0 ? {} : { memo: options.memo }
|
|
3497
|
+
}
|
|
3498
|
+
},
|
|
3485
3499
|
frame
|
|
3486
3500
|
);
|
|
3487
3501
|
return this.creation(
|
|
@@ -3547,6 +3561,7 @@ var CreditPreparation = class {
|
|
|
3547
3561
|
note: {
|
|
3548
3562
|
...n,
|
|
3549
3563
|
amount: remaining,
|
|
3564
|
+
...options.credits[i].memo === void 0 ? {} : { memo: options.credits[i].memo },
|
|
3550
3565
|
nonce: await (0, import_core9.deriveRemainderNonce)(...args)
|
|
3551
3566
|
}
|
|
3552
3567
|
},
|
|
@@ -4016,6 +4031,10 @@ var InventoryProcessor = class {
|
|
|
4016
4031
|
if (!remainder) {
|
|
4017
4032
|
continue;
|
|
4018
4033
|
}
|
|
4034
|
+
const child = foundByKey.get(
|
|
4035
|
+
params.remainderCommitments[index2] + ":" + previous.role
|
|
4036
|
+
);
|
|
4037
|
+
const memo = child?.state.note.memo;
|
|
4019
4038
|
const record = {
|
|
4020
4039
|
commitment: params.remainderCommitments[index2],
|
|
4021
4040
|
treeId: BigInt(args.outputTreeId),
|
|
@@ -4024,7 +4043,13 @@ var InventoryProcessor = class {
|
|
|
4024
4043
|
blockHash: event.blockHash,
|
|
4025
4044
|
transactionHash: event.transactionHash,
|
|
4026
4045
|
role: previous.role,
|
|
4027
|
-
state: {
|
|
4046
|
+
state: {
|
|
4047
|
+
...clone(previous.state),
|
|
4048
|
+
note: {
|
|
4049
|
+
...remainder,
|
|
4050
|
+
...memo === void 0 ? {} : { memo: (0, import_core10.encodeMemo)(memo) }
|
|
4051
|
+
}
|
|
4052
|
+
},
|
|
4028
4053
|
receivingKeySource: { kind: "draw", commitment: previous.commitment },
|
|
4029
4054
|
spent: "unknown"
|
|
4030
4055
|
};
|