Skip to content

Commit 3ff2c55

Browse files
npm run doc
1 parent 60159f7 commit 3ff2c55

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

docs/reference/kvstore.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ export interface KVStoreEntry {
169169
value: string;
170170
controller: PubKeyHex;
171171
protocolID: WalletProtocol;
172+
tags?: string[];
172173
token?: KVStoreToken;
173174
history?: string[];
174175
}
@@ -246,6 +247,7 @@ export interface KVStoreQuery {
246247
key?: string;
247248
controller?: PubKeyHex;
248249
protocolID?: WalletProtocol;
250+
tags?: string[];
249251
limit?: number;
250252
skip?: number;
251253
sortOrder?: "asc" | "desc";
@@ -279,6 +281,7 @@ export interface KVStoreSetOptions {
279281
tokenSetDescription?: string;
280282
tokenUpdateDescription?: string;
281283
tokenAmount?: number;
284+
tags?: string[];
282285
}
283286
```
284287

@@ -577,7 +580,8 @@ kvProtocol = {
577580
key: 1,
578581
value: 2,
579582
controller: 3,
580-
signature: 4
583+
tags: 4,
584+
signature: 5
581585
}
582586
```
583587

@@ -595,7 +599,10 @@ kvStoreInterpreter: InterpreterFunction<string, KVContext> = async (transaction:
595599
if (ctx == null || ctx.key == null)
596600
return undefined;
597601
const decoded = PushDrop.decode(output.lockingScript);
598-
if (decoded.fields.length !== Object.keys(kvProtocol).length)
602+
const expectedFieldCount = Object.keys(kvProtocol).length;
603+
const hasTagsField = decoded.fields.length === expectedFieldCount;
604+
const isOldFormat = decoded.fields.length === expectedFieldCount - 1;
605+
if (!isOldFormat && !hasTagsField)
599606
return undefined;
600607
const key = Utils.toUTF8(decoded.fields[kvProtocol.key]);
601608
const protocolID = Utils.toUTF8(decoded.fields[kvProtocol.protocolID]);

0 commit comments

Comments
 (0)