@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/ethers.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import { Provider, Signer } from 'ethers';
|
|
|
2
2
|
import { Hex, Address } from '@invisi-labs/protocol/contracts';
|
|
3
3
|
import { ReceivingKeyLookup } from '@invisi-labs/core/address';
|
|
4
4
|
import { RegistryContext, ChainReader, RegistryReader, FactoryReader, CanonicalBlock, DeploymentContext, CanonicalReceipt } from '@invisi-labs/protocol';
|
|
5
|
-
import { F as FundingSigner, j as FundingTypedData, h as FundingAuthorizationVerifier } from './gas-estimation-
|
|
5
|
+
import { F as FundingSigner, j as FundingTypedData, h as FundingAuthorizationVerifier } from './gas-estimation-BV8WdwNF.cjs';
|
|
6
6
|
import '@invisi-labs/core';
|
|
7
7
|
import './state-DHl6j33x.cjs';
|
|
8
8
|
import '@invisi-labs/prover';
|
package/dist/ethers.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Provider, Signer } from 'ethers';
|
|
|
2
2
|
import { Hex, Address } from '@invisi-labs/protocol/contracts';
|
|
3
3
|
import { ReceivingKeyLookup } from '@invisi-labs/core/address';
|
|
4
4
|
import { RegistryContext, ChainReader, RegistryReader, FactoryReader, CanonicalBlock, DeploymentContext, CanonicalReceipt } from '@invisi-labs/protocol';
|
|
5
|
-
import { F as FundingSigner, j as FundingTypedData, h as FundingAuthorizationVerifier } from './gas-estimation-
|
|
5
|
+
import { F as FundingSigner, j as FundingTypedData, h as FundingAuthorizationVerifier } from './gas-estimation-v9OjKMsL.js';
|
|
6
6
|
import '@invisi-labs/core';
|
|
7
7
|
import './state-DHl6j33x.js';
|
|
8
8
|
import '@invisi-labs/prover';
|
|
@@ -37,6 +37,7 @@ interface FundingSource {
|
|
|
37
37
|
permit?: NonNullable<FundingInput["permit"]>;
|
|
38
38
|
}
|
|
39
39
|
interface PaymentOutput {
|
|
40
|
+
memo?: string | Uint8Array;
|
|
40
41
|
to: string;
|
|
41
42
|
amount: bigint;
|
|
42
43
|
}
|
|
@@ -75,6 +76,7 @@ interface PreparedOutput {
|
|
|
75
76
|
change: boolean;
|
|
76
77
|
}
|
|
77
78
|
interface CreateCreditPreparation {
|
|
79
|
+
memo?: string | Uint8Array;
|
|
78
80
|
tokenAddress: Address;
|
|
79
81
|
spender: string;
|
|
80
82
|
amount: bigint;
|
|
@@ -87,10 +89,12 @@ interface DrawCreditPreparation {
|
|
|
87
89
|
credits: readonly {
|
|
88
90
|
credit: Hex;
|
|
89
91
|
amount: bigint;
|
|
92
|
+
memo?: string | Uint8Array;
|
|
90
93
|
}[];
|
|
91
94
|
deadline?: bigint;
|
|
92
95
|
}
|
|
93
96
|
interface TopUpCreditPreparation {
|
|
97
|
+
memo?: string | Uint8Array;
|
|
94
98
|
tokenAddress: Address;
|
|
95
99
|
credit: Hex;
|
|
96
100
|
additionalAmount: bigint;
|
|
@@ -37,6 +37,7 @@ interface FundingSource {
|
|
|
37
37
|
permit?: NonNullable<FundingInput["permit"]>;
|
|
38
38
|
}
|
|
39
39
|
interface PaymentOutput {
|
|
40
|
+
memo?: string | Uint8Array;
|
|
40
41
|
to: string;
|
|
41
42
|
amount: bigint;
|
|
42
43
|
}
|
|
@@ -75,6 +76,7 @@ interface PreparedOutput {
|
|
|
75
76
|
change: boolean;
|
|
76
77
|
}
|
|
77
78
|
interface CreateCreditPreparation {
|
|
79
|
+
memo?: string | Uint8Array;
|
|
78
80
|
tokenAddress: Address;
|
|
79
81
|
spender: string;
|
|
80
82
|
amount: bigint;
|
|
@@ -87,10 +89,12 @@ interface DrawCreditPreparation {
|
|
|
87
89
|
credits: readonly {
|
|
88
90
|
credit: Hex;
|
|
89
91
|
amount: bigint;
|
|
92
|
+
memo?: string | Uint8Array;
|
|
90
93
|
}[];
|
|
91
94
|
deadline?: bigint;
|
|
92
95
|
}
|
|
93
96
|
interface TopUpCreditPreparation {
|
|
97
|
+
memo?: string | Uint8Array;
|
|
94
98
|
tokenAddress: Address;
|
|
95
99
|
credit: Hex;
|
|
96
100
|
additionalAmount: bigint;
|
package/dist/index.cjs
CHANGED
|
@@ -26,6 +26,7 @@ __export(src_exports, {
|
|
|
26
26
|
DisclosureVerifier: () => DisclosureVerifier,
|
|
27
27
|
EncryptedWalletCodec: () => EncryptedWalletCodec,
|
|
28
28
|
Invisi: () => Invisi,
|
|
29
|
+
MAX_MEMO_BYTES: () => import_core15.MAX_MEMO_BYTES,
|
|
29
30
|
MissingCapabilityError: () => import_core15.MissingCapabilityError,
|
|
30
31
|
NullifierCapability: () => import_core15.NullifierCapability,
|
|
31
32
|
Operation: () => Operation,
|
|
@@ -38,7 +39,9 @@ __export(src_exports, {
|
|
|
38
39
|
Wallet: () => import_core15.Wallet,
|
|
39
40
|
WalletAuthorization: () => import_core15.WalletAuthorization,
|
|
40
41
|
WalletSession: () => WalletSession,
|
|
42
|
+
decodeMemoText: () => import_core15.decodeMemoText,
|
|
41
43
|
defineGasBenchmarks: () => defineGasBenchmarks,
|
|
44
|
+
encodeMemo: () => import_core15.encodeMemo,
|
|
42
45
|
walletBalance: () => walletBalance
|
|
43
46
|
});
|
|
44
47
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -1633,6 +1636,7 @@ var Preparation = class {
|
|
|
1633
1636
|
const recipient = await import_core4.ReceivingAddress.parse(payment.to).resolve(
|
|
1634
1637
|
this.runtime.options.addressResolver
|
|
1635
1638
|
);
|
|
1639
|
+
const memo = (0, import_core4.encodeMemo)(payment.memo);
|
|
1636
1640
|
const nonce = (0, import_core4.generateNonce)();
|
|
1637
1641
|
const identity = await (0, import_core4.computeNoteIdentity)(BigInt(recipient.walletIdentity), nonce);
|
|
1638
1642
|
const keys = recipient.getReceivingKeys();
|
|
@@ -1642,6 +1646,7 @@ var Preparation = class {
|
|
|
1642
1646
|
tokenAddress: BigInt(context.tokenAddress),
|
|
1643
1647
|
walletIdentity: recipient.walletIdentity,
|
|
1644
1648
|
amount: payment.amount,
|
|
1649
|
+
...memo.length === 0 ? {} : { memo },
|
|
1645
1650
|
nonce
|
|
1646
1651
|
};
|
|
1647
1652
|
const commitment = await (0, import_core4.computeNoteCommitment)(
|
|
@@ -1901,6 +1906,7 @@ var CreditPreparation = class {
|
|
|
1901
1906
|
ownerPayout: BigInt(ownerPayout),
|
|
1902
1907
|
spenderPayout: BigInt(spenderPayout),
|
|
1903
1908
|
amount: options.amount,
|
|
1909
|
+
...options.memo === void 0 ? {} : { memo: options.memo },
|
|
1904
1910
|
expiry,
|
|
1905
1911
|
nonce: (0, import_core6.generateNonce)(),
|
|
1906
1912
|
creditSharedKey: (0, import_core6.generateCreditSharedKey)()
|
|
@@ -1992,7 +1998,16 @@ var CreditPreparation = class {
|
|
|
1992
1998
|
}
|
|
1993
1999
|
const amount = positiveAmount(old.note.amount + options.additionalAmount, 126);
|
|
1994
2000
|
const output = await this.seal(
|
|
1995
|
-
{
|
|
2001
|
+
{
|
|
2002
|
+
...old,
|
|
2003
|
+
note: {
|
|
2004
|
+
...old.note,
|
|
2005
|
+
amount,
|
|
2006
|
+
expiry,
|
|
2007
|
+
nonce: (0, import_core6.generateNonce)(),
|
|
2008
|
+
...options.memo === void 0 ? {} : { memo: options.memo }
|
|
2009
|
+
}
|
|
2010
|
+
},
|
|
1996
2011
|
frame
|
|
1997
2012
|
);
|
|
1998
2013
|
return this.creation(
|
|
@@ -2058,6 +2073,7 @@ var CreditPreparation = class {
|
|
|
2058
2073
|
note: {
|
|
2059
2074
|
...n,
|
|
2060
2075
|
amount: remaining,
|
|
2076
|
+
...options.credits[i].memo === void 0 ? {} : { memo: options.credits[i].memo },
|
|
2061
2077
|
nonce: await (0, import_core6.deriveRemainderNonce)(...args)
|
|
2062
2078
|
}
|
|
2063
2079
|
},
|
|
@@ -2994,25 +3010,27 @@ function extractDeliveryCandidates(logs, context, confirmedThrough) {
|
|
|
2994
3010
|
const tokens = array(a.tokens);
|
|
2995
3011
|
const cs = array(a.commitments), tree = integer(a.treeId), start = index(a.startLeafIndex), packed = a.packedDeliveries;
|
|
2996
3012
|
check4(
|
|
2997
|
-
typeof packed === "string" && /^0x(?:[0-9a-fA-F]{2})*$/.test(packed)
|
|
3013
|
+
typeof packed === "string" && /^0x(?:[0-9a-fA-F]{2})*$/.test(packed),
|
|
2998
3014
|
"invalid packed deliveries"
|
|
2999
3015
|
);
|
|
3000
3016
|
check4(tokens.length === cs.length, "batch token count mismatch");
|
|
3017
|
+
check4(start + cs.length <= 65536, "batch exceeds tree capacity");
|
|
3018
|
+
let offset = 2;
|
|
3001
3019
|
cs.forEach((c, i) => {
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
"funds",
|
|
3009
|
-
{
|
|
3010
|
-
ciphertext: `0x${segment.slice(0, 316)}`,
|
|
3011
|
-
clue: `0x${segment.slice(316)}`
|
|
3012
|
-
},
|
|
3013
|
-
tokens[i]
|
|
3020
|
+
check4(offset + 4 <= packed.length, "truncated delivery length prefix");
|
|
3021
|
+
const length = Number.parseInt(packed.slice(offset, offset + 4), 16);
|
|
3022
|
+
offset += 4;
|
|
3023
|
+
check4(
|
|
3024
|
+
length >= 160 && length <= 416 && offset + length * 2 + 136 <= packed.length,
|
|
3025
|
+
"invalid packed delivery length"
|
|
3014
3026
|
);
|
|
3027
|
+
const ciphertext = `0x${packed.slice(offset, offset + length * 2)}`;
|
|
3028
|
+
offset += length * 2;
|
|
3029
|
+
const clue = `0x${packed.slice(offset, offset + 136)}`;
|
|
3030
|
+
offset += 136;
|
|
3031
|
+
add(log, tree, start + i, c, "funds", { ciphertext, clue }, tokens[i]);
|
|
3015
3032
|
});
|
|
3033
|
+
check4(offset === packed.length, "trailing packed delivery bytes");
|
|
3016
3034
|
} else if (log.eventName === "CreditCreated") creation(log, a, a);
|
|
3017
3035
|
else if (log.eventName === "CreditToppedUp")
|
|
3018
3036
|
creation(log, a, object(object(a.params).creation));
|
|
@@ -4423,6 +4441,10 @@ var InventoryProcessor = class {
|
|
|
4423
4441
|
if (!remainder) {
|
|
4424
4442
|
continue;
|
|
4425
4443
|
}
|
|
4444
|
+
const child = foundByKey.get(
|
|
4445
|
+
params.remainderCommitments[index2] + ":" + previous.role
|
|
4446
|
+
);
|
|
4447
|
+
const memo = child?.state.note.memo;
|
|
4426
4448
|
const record = {
|
|
4427
4449
|
commitment: params.remainderCommitments[index2],
|
|
4428
4450
|
treeId: BigInt(args.outputTreeId),
|
|
@@ -4431,7 +4453,13 @@ var InventoryProcessor = class {
|
|
|
4431
4453
|
blockHash: event.blockHash,
|
|
4432
4454
|
transactionHash: event.transactionHash,
|
|
4433
4455
|
role: previous.role,
|
|
4434
|
-
state: {
|
|
4456
|
+
state: {
|
|
4457
|
+
...clone(previous.state),
|
|
4458
|
+
note: {
|
|
4459
|
+
...remainder,
|
|
4460
|
+
...memo === void 0 ? {} : { memo: (0, import_core11.encodeMemo)(memo) }
|
|
4461
|
+
}
|
|
4462
|
+
},
|
|
4435
4463
|
receivingKeySource: { kind: "draw", commitment: previous.commitment },
|
|
4436
4464
|
spent: "unknown"
|
|
4437
4465
|
};
|
|
@@ -5132,6 +5160,7 @@ var EncryptedWalletCodec = class _EncryptedWalletCodec {
|
|
|
5132
5160
|
DisclosureVerifier,
|
|
5133
5161
|
EncryptedWalletCodec,
|
|
5134
5162
|
Invisi,
|
|
5163
|
+
MAX_MEMO_BYTES,
|
|
5135
5164
|
MissingCapabilityError,
|
|
5136
5165
|
NullifierCapability,
|
|
5137
5166
|
Operation,
|
|
@@ -5144,7 +5173,9 @@ var EncryptedWalletCodec = class _EncryptedWalletCodec {
|
|
|
5144
5173
|
Wallet,
|
|
5145
5174
|
WalletAuthorization,
|
|
5146
5175
|
WalletSession,
|
|
5176
|
+
decodeMemoText,
|
|
5147
5177
|
defineGasBenchmarks,
|
|
5178
|
+
encodeMemo,
|
|
5148
5179
|
walletBalance
|
|
5149
5180
|
});
|
|
5150
5181
|
//# sourceMappingURL=index.cjs.map
|