@arkiv-network/sdk 0.6.8-dev.5 → 0.7.0-dev.1
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/chains/index.d.ts +25 -25
- package/dist/consts-Bz0LZQZY.js +7 -0
- package/dist/consts-Bz0LZQZY.js.map +1 -0
- package/dist/{consts-AUoL-v42.cjs → consts-CxT1-RXU.cjs} +1 -1
- package/dist/entity-BhSXaB23.cjs +81 -0
- package/dist/{entity-B6g_EPm1.d.cts → entity-CN41IOrq.d.cts} +53 -34
- package/dist/entity-CN41IOrq.d.cts.map +1 -0
- package/dist/entity-DGfVyB-a.js +71 -0
- package/dist/entity-DGfVyB-a.js.map +1 -0
- package/dist/{entity-qoLMAuuk.d.ts → entity-NnEVlePN.d.ts} +53 -34
- package/dist/entity-NnEVlePN.d.ts.map +1 -0
- package/dist/{index-DdspxNAA.d.ts → index-ClkpS6s_.d.ts} +2 -2
- package/dist/{index-DdspxNAA.d.ts.map → index-ClkpS6s_.d.ts.map} +1 -1
- package/dist/{index-Ds9dwqb5.d.cts → index-w4qop0Pe.d.cts} +2 -2
- package/dist/{index-Ds9dwqb5.d.cts.map → index-w4qop0Pe.d.cts.map} +1 -1
- package/dist/index.cjs +281 -264
- package/dist/index.d.cts +13 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +14 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +279 -266
- package/dist/index.js.map +1 -1
- package/dist/{payload-Claf2jUO.js → payload-BpNUPOnY.js} +3 -3
- package/dist/payload-BpNUPOnY.js.map +1 -0
- package/dist/{payload-B2kFJyah.d.ts → payload-C2KHOUoj.d.ts} +1 -1
- package/dist/{payload-B2kFJyah.d.ts.map → payload-C2KHOUoj.d.ts.map} +1 -1
- package/dist/{payload-DpA5PA-w.cjs → payload-D8YLKcJj.cjs} +1 -1
- package/dist/query/index.cjs +3 -2
- package/dist/query/index.d.cts +2 -2
- package/dist/query/index.d.ts +2 -2
- package/dist/query/index.js +3 -2
- package/dist/query/index.js.map +1 -1
- package/dist/{queryBuilder-D2uwP9jI.js → queryBuilder-BE_XhLLa.js} +98 -67
- package/dist/queryBuilder-BE_XhLLa.js.map +1 -0
- package/dist/{queryBuilder-UW2MCaX4.cjs → queryBuilder-J37buGCi.cjs} +137 -64
- package/dist/types/index.cjs +4 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +4 -1
- package/dist/utils/index.cjs +2 -2
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +2 -2
- package/package.json +1 -1
- package/src/actions/public/subscribeEntityEvents.ts +25 -51
- package/src/actions/wallet/changeOwnership.ts +6 -6
- package/src/actions/wallet/createEntity.ts +7 -4
- package/src/actions/wallet/deleteEntity.ts +2 -3
- package/src/actions/wallet/extendEntity.ts +3 -4
- package/src/actions/wallet/mutateEntities.ts +11 -54
- package/src/actions/wallet/updateEntity.ts +3 -4
- package/src/clients/decorators/arkivWallet.ts +5 -1
- package/src/consts.ts +2 -1
- package/src/errors.ts +29 -1
- package/src/query/engine.test.ts +45 -0
- package/src/query/engine.ts +6 -1
- package/src/query/selectQueryBuilder.test.ts +5 -2
- package/src/types/attributes.ts +17 -5
- package/src/types/entity.ts +12 -2
- package/src/types/events.ts +14 -16
- package/src/types/index.ts +1 -0
- package/src/types/rpcSchema.ts +7 -2
- package/src/utils/arkivTransactions.test.ts +234 -36
- package/src/utils/arkivTransactions.ts +255 -101
- package/src/utils/entities.ts +17 -7
- package/src/utils/payload.ts +4 -2
- package/src/utils/validation.test.ts +52 -6
- package/src/utils/validation.ts +54 -6
- package/dist/consts-BV4PR-de.js +0 -7
- package/dist/consts-BV4PR-de.js.map +0 -1
- package/dist/entity-B6g_EPm1.d.cts.map +0 -1
- package/dist/entity-qoLMAuuk.d.ts.map +0 -1
- package/dist/payload-Claf2jUO.js.map +0 -1
- package/dist/queryBuilder-D2uwP9jI.js.map +0 -1
- /package/dist/{types-H-TSmRpm.js → types-Ci4BRClw.js} +0 -0
- /package/dist/{types-o3zWarRp.cjs → types-a8gm_IaQ.cjs} +0 -0
package/dist/chains/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as viem8 from "viem";
|
|
2
2
|
|
|
3
3
|
//#region src/chains/braga.d.ts
|
|
4
4
|
declare const braga: {
|
|
@@ -11,13 +11,13 @@ declare const braga: {
|
|
|
11
11
|
};
|
|
12
12
|
blockTime?: number | undefined | undefined;
|
|
13
13
|
contracts?: {
|
|
14
|
-
[x: string]:
|
|
15
|
-
[sourceId: number]:
|
|
14
|
+
[x: string]: viem8.ChainContract | {
|
|
15
|
+
[sourceId: number]: viem8.ChainContract | undefined;
|
|
16
16
|
} | undefined;
|
|
17
|
-
ensRegistry?:
|
|
18
|
-
ensUniversalResolver?:
|
|
19
|
-
multicall3?:
|
|
20
|
-
erc6492Verifier?:
|
|
17
|
+
ensRegistry?: viem8.ChainContract | undefined;
|
|
18
|
+
ensUniversalResolver?: viem8.ChainContract | undefined;
|
|
19
|
+
multicall3?: viem8.ChainContract | undefined;
|
|
20
|
+
erc6492Verifier?: viem8.ChainContract | undefined;
|
|
21
21
|
} | undefined;
|
|
22
22
|
ensTlds?: readonly string[] | undefined;
|
|
23
23
|
id: 60138453102;
|
|
@@ -37,9 +37,9 @@ declare const braga: {
|
|
|
37
37
|
sourceId?: number | undefined | undefined;
|
|
38
38
|
testnet: true;
|
|
39
39
|
custom?: Record<string, unknown> | undefined;
|
|
40
|
-
fees?:
|
|
40
|
+
fees?: viem8.ChainFees<undefined> | undefined;
|
|
41
41
|
formatters?: undefined;
|
|
42
|
-
serializers?:
|
|
42
|
+
serializers?: viem8.ChainSerializers<undefined, viem8.TransactionSerializable> | undefined;
|
|
43
43
|
readonly network: "braga";
|
|
44
44
|
};
|
|
45
45
|
//#endregion
|
|
@@ -57,13 +57,13 @@ declare const kaolin: {
|
|
|
57
57
|
};
|
|
58
58
|
blockTime?: number | undefined | undefined;
|
|
59
59
|
contracts?: {
|
|
60
|
-
[x: string]:
|
|
61
|
-
[sourceId: number]:
|
|
60
|
+
[x: string]: viem8.ChainContract | {
|
|
61
|
+
[sourceId: number]: viem8.ChainContract | undefined;
|
|
62
62
|
} | undefined;
|
|
63
|
-
ensRegistry?:
|
|
64
|
-
ensUniversalResolver?:
|
|
65
|
-
multicall3?:
|
|
66
|
-
erc6492Verifier?:
|
|
63
|
+
ensRegistry?: viem8.ChainContract | undefined;
|
|
64
|
+
ensUniversalResolver?: viem8.ChainContract | undefined;
|
|
65
|
+
multicall3?: viem8.ChainContract | undefined;
|
|
66
|
+
erc6492Verifier?: viem8.ChainContract | undefined;
|
|
67
67
|
} | undefined;
|
|
68
68
|
ensTlds?: readonly string[] | undefined;
|
|
69
69
|
id: 60138453025;
|
|
@@ -83,9 +83,9 @@ declare const kaolin: {
|
|
|
83
83
|
sourceId?: number | undefined | undefined;
|
|
84
84
|
testnet: true;
|
|
85
85
|
custom?: Record<string, unknown> | undefined;
|
|
86
|
-
fees?:
|
|
86
|
+
fees?: viem8.ChainFees<undefined> | undefined;
|
|
87
87
|
formatters?: undefined;
|
|
88
|
-
serializers?:
|
|
88
|
+
serializers?: viem8.ChainSerializers<undefined, viem8.TransactionSerializable> | undefined;
|
|
89
89
|
readonly network: "kaolin";
|
|
90
90
|
};
|
|
91
91
|
//#endregion
|
|
@@ -105,13 +105,13 @@ declare const localhost: {
|
|
|
105
105
|
} | undefined | undefined;
|
|
106
106
|
blockTime?: number | undefined | undefined;
|
|
107
107
|
contracts?: {
|
|
108
|
-
[x: string]:
|
|
109
|
-
[sourceId: number]:
|
|
108
|
+
[x: string]: viem8.ChainContract | {
|
|
109
|
+
[sourceId: number]: viem8.ChainContract | undefined;
|
|
110
110
|
} | undefined;
|
|
111
|
-
ensRegistry?:
|
|
112
|
-
ensUniversalResolver?:
|
|
113
|
-
multicall3?:
|
|
114
|
-
erc6492Verifier?:
|
|
111
|
+
ensRegistry?: viem8.ChainContract | undefined;
|
|
112
|
+
ensUniversalResolver?: viem8.ChainContract | undefined;
|
|
113
|
+
multicall3?: viem8.ChainContract | undefined;
|
|
114
|
+
erc6492Verifier?: viem8.ChainContract | undefined;
|
|
115
115
|
} | undefined;
|
|
116
116
|
ensTlds?: readonly string[] | undefined;
|
|
117
117
|
id: 1337;
|
|
@@ -130,9 +130,9 @@ declare const localhost: {
|
|
|
130
130
|
sourceId?: number | undefined | undefined;
|
|
131
131
|
testnet?: boolean | undefined | undefined;
|
|
132
132
|
custom?: Record<string, unknown> | undefined;
|
|
133
|
-
fees?:
|
|
133
|
+
fees?: viem8.ChainFees<undefined> | undefined;
|
|
134
134
|
formatters?: undefined;
|
|
135
|
-
serializers?:
|
|
135
|
+
serializers?: viem8.ChainSerializers<undefined, viem8.TransactionSerializable> | undefined;
|
|
136
136
|
};
|
|
137
137
|
//#endregion
|
|
138
138
|
export { braga, kaolin, localhost };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts-Bz0LZQZY.js","names":[],"sources":["../src/consts.ts"],"sourcesContent":["//export const ARKIV_ADDRESS = \"0x00000000000000000000000000000061726b6976\" as `0x${string}`\nexport const ARKIV_ADDRESS = \"0x4400000000000000000000000000000000000044\" as `0x${string}`\nexport const BLOCK_TIME = 2 // 2 seconds\n"],"mappings":";AACA,MAAa,gBAAgB;AAC7B,MAAa,aAAa"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
let viem = require("viem");
|
|
2
|
+
|
|
3
|
+
//#region src/types/entity.ts
|
|
4
|
+
let EntityOperationType = /* @__PURE__ */ function(EntityOperationType$1) {
|
|
5
|
+
EntityOperationType$1[EntityOperationType$1["Create"] = 1] = "Create";
|
|
6
|
+
EntityOperationType$1[EntityOperationType$1["Update"] = 2] = "Update";
|
|
7
|
+
EntityOperationType$1[EntityOperationType$1["Extend"] = 3] = "Extend";
|
|
8
|
+
EntityOperationType$1[EntityOperationType$1["Transfer"] = 4] = "Transfer";
|
|
9
|
+
EntityOperationType$1[EntityOperationType$1["Delete"] = 5] = "Delete";
|
|
10
|
+
EntityOperationType$1[EntityOperationType$1["Expire"] = 6] = "Expire";
|
|
11
|
+
return EntityOperationType$1;
|
|
12
|
+
}({});
|
|
13
|
+
var Entity = class {
|
|
14
|
+
key;
|
|
15
|
+
contentType;
|
|
16
|
+
owner;
|
|
17
|
+
creator;
|
|
18
|
+
expiresAtBlock;
|
|
19
|
+
createdAtBlock;
|
|
20
|
+
lastModifiedAtBlock;
|
|
21
|
+
transactionIndexInBlock;
|
|
22
|
+
operationIndexInTransaction;
|
|
23
|
+
payload;
|
|
24
|
+
attributes;
|
|
25
|
+
constructor(key, contentType = void 0, owner = void 0, creator = void 0, expiresAtBlock = void 0, createdAtBlock = void 0, lastModifiedAtBlock = void 0, transactionIndexInBlock = void 0, operationIndexInTransaction = void 0, payload = void 0, attributes) {
|
|
26
|
+
this.key = key;
|
|
27
|
+
this.owner = owner;
|
|
28
|
+
this.creator = creator;
|
|
29
|
+
this.expiresAtBlock = expiresAtBlock;
|
|
30
|
+
this.createdAtBlock = createdAtBlock;
|
|
31
|
+
this.lastModifiedAtBlock = lastModifiedAtBlock;
|
|
32
|
+
this.transactionIndexInBlock = transactionIndexInBlock;
|
|
33
|
+
this.operationIndexInTransaction = operationIndexInTransaction;
|
|
34
|
+
this.payload = payload;
|
|
35
|
+
this.attributes = attributes;
|
|
36
|
+
this.contentType = contentType;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Converts the entity payload from bytes to a string and returns it.
|
|
40
|
+
* Throws an error if the payload is undefined, which may occur if the entity was not queried with the withPayload option.
|
|
41
|
+
* Throws an error if the conversion from bytes to string fails.
|
|
42
|
+
* @returns The entity payload as a string.
|
|
43
|
+
*/
|
|
44
|
+
toText() {
|
|
45
|
+
if (this.payload === void 0) throw new Error("Entity has no payload – it was probably queried without withPayload(true) via QueryBuilder");
|
|
46
|
+
try {
|
|
47
|
+
return (0, viem.bytesToString)(this.payload);
|
|
48
|
+
} catch (e) {
|
|
49
|
+
throw new Error(`Failed to convert entity payload to text: ${e instanceof Error ? e.message : String(e)}`, { cause: e });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Parses the entity payload as JSON and returns the resulting object.
|
|
54
|
+
* Throws an error if the payload is undefined, which may occur if the entity was not queried with the withPayload option.
|
|
55
|
+
* Throws an error if the payload is empty or cannot be parsed as JSON.
|
|
56
|
+
* @returns The parsed JSON object from the entity payload.
|
|
57
|
+
*/
|
|
58
|
+
toJson() {
|
|
59
|
+
const text = this.toText();
|
|
60
|
+
if (!text) throw new Error("Entity has empty payload, cannot parse as JSON");
|
|
61
|
+
try {
|
|
62
|
+
return JSON.parse(text);
|
|
63
|
+
} catch (e) {
|
|
64
|
+
throw new Error(`Failed to parse entity payload as JSON: ${e instanceof Error ? e.message : String(e)}`, { cause: e });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
Object.defineProperty(exports, 'Entity', {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: function () {
|
|
73
|
+
return Entity;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(exports, 'EntityOperationType', {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return EntityOperationType;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Account, Chain, Client, Hash, Hex, RpcSchema, Transport } from "viem";
|
|
1
|
+
import { Account, Address, Chain, Client, Hash, Hex, RpcSchema, Transport } from "viem";
|
|
2
2
|
|
|
3
3
|
//#region src/types/mimeTypes.d.ts
|
|
4
4
|
type MimeType = "text/plain" | "text/html" | "text/css" | "text/csv" | "text/xml" | "text/javascript" | "application/json" | "application/xml" | "application/pdf" | "application/zip" | "application/gzip" | "application/octet-stream" | "application/javascript" | "application/x-www-form-urlencoded" | "image/png" | "image/jpeg" | "image/webp" | "image/gif" | "image/svg+xml" | "audio/mpeg" | "audio/wav" | "audio/ogg" | "video/mp4" | "video/webm" | "video/ogg" | "multipart/form-data";
|
|
@@ -15,15 +15,17 @@ type RpcEntity = {
|
|
|
15
15
|
operationIndexInTransaction: Hex;
|
|
16
16
|
owner: Hex;
|
|
17
17
|
creator: Hex;
|
|
18
|
-
|
|
18
|
+
attributes?: {
|
|
19
19
|
key: string;
|
|
20
20
|
value: string;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
key: string;
|
|
24
|
-
value: Hex;
|
|
25
|
-
}];
|
|
21
|
+
valueType: RpcAttributeValueType;
|
|
22
|
+
}[];
|
|
26
23
|
};
|
|
24
|
+
declare enum RpcAttributeValueType {
|
|
25
|
+
Uint = 1,
|
|
26
|
+
String = 2,
|
|
27
|
+
EntityKey = 3,
|
|
28
|
+
}
|
|
27
29
|
type RpcOrderByAttribute = {
|
|
28
30
|
name: string;
|
|
29
31
|
type: "string" | "numeric";
|
|
@@ -117,15 +119,16 @@ type QueryReturnType = {
|
|
|
117
119
|
//#endregion
|
|
118
120
|
//#region src/actions/wallet/changeOwnership.d.ts
|
|
119
121
|
/**
|
|
120
|
-
* Parameters for the
|
|
121
|
-
* - entityKey: The key of the entity
|
|
122
|
+
* Parameters for the changeOwnership function.
|
|
123
|
+
* - entityKey: The key of the entity.
|
|
124
|
+
* - newOwner: The address of the new owner.
|
|
122
125
|
*/
|
|
123
126
|
type ChangeOwnershipParameters = {
|
|
124
127
|
entityKey: Hex;
|
|
125
128
|
newOwner: Hex;
|
|
126
129
|
};
|
|
127
130
|
/**
|
|
128
|
-
* Return type for the
|
|
131
|
+
* Return type for the changeOwnership function.
|
|
129
132
|
* - entityKey: The key of the entity.
|
|
130
133
|
* - txHash: The transaction hash.
|
|
131
134
|
*/
|
|
@@ -284,53 +287,61 @@ type MutateEntitiesReturnType = {
|
|
|
284
287
|
/**
|
|
285
288
|
* An entity attribute (key/value pair).
|
|
286
289
|
*
|
|
287
|
-
* Arkiv supports
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
+
* Arkiv supports string, Hex and number values.
|
|
291
|
+
*
|
|
292
|
+
* Hex values are stored as the on-chain `EntityKey` type **only when they are
|
|
293
|
+
* exactly 32 bytes** (66 characters, e.g. an entity key). Hex-looking strings
|
|
294
|
+
* of any other length are stored as plain strings: they round-trip unchanged
|
|
295
|
+
* and compare lexicographically, not as hex.
|
|
296
|
+
*
|
|
297
|
+
* Numeric values **must be non-negative integers** (they are stored on-chain
|
|
298
|
+
* as unsigned 256-bit) — passing a non-integer (e.g. `1.5`) or negative number
|
|
299
|
+
* throws an {@link InvalidAttributeError} at mutation time. To store a
|
|
300
|
+
* non-integer value:
|
|
290
301
|
* - Scale it to an integer (e.g. `1.5` -> `1500`, dividing by the same factor on
|
|
291
302
|
* read) to keep numeric ordering and range queries working.
|
|
292
303
|
* - Or pass it as a string (e.g. `"1.5"`), which sorts lexicographically and so
|
|
293
304
|
* does not support numeric comparisons.
|
|
305
|
+
*
|
|
306
|
+
* To store a negative value, offset it into the non-negative range (subtracting
|
|
307
|
+
* the offset on read) or store it as a string.
|
|
294
308
|
*/
|
|
295
309
|
type Attribute = {
|
|
296
310
|
key: string;
|
|
297
|
-
|
|
298
|
-
value: string | number;
|
|
311
|
+
value: number | string | Hex;
|
|
299
312
|
};
|
|
300
313
|
//#endregion
|
|
301
314
|
//#region src/types/events.d.ts
|
|
302
315
|
type OnEntityCreatedEvent = {
|
|
303
316
|
entityKey: Hex;
|
|
304
|
-
owner:
|
|
305
|
-
|
|
306
|
-
|
|
317
|
+
owner: Address;
|
|
318
|
+
expiresAt: number;
|
|
319
|
+
entityHash: Hex;
|
|
307
320
|
};
|
|
308
321
|
type OnEntityUpdatedEvent = {
|
|
309
322
|
entityKey: Hex;
|
|
310
|
-
owner:
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
cost: bigint;
|
|
323
|
+
owner: Address;
|
|
324
|
+
expiresAt: number;
|
|
325
|
+
entityHash: Hex;
|
|
314
326
|
};
|
|
315
327
|
type OnEntityDeletedEvent = {
|
|
316
328
|
entityKey: Hex;
|
|
317
|
-
owner:
|
|
329
|
+
owner: Address;
|
|
318
330
|
};
|
|
319
331
|
type OnEntityExpiredEvent = {
|
|
320
332
|
entityKey: Hex;
|
|
321
|
-
owner:
|
|
333
|
+
owner: Address;
|
|
322
334
|
};
|
|
323
335
|
type OnEntityExpiresInExtendedEvent = {
|
|
324
336
|
entityKey: Hex;
|
|
325
|
-
owner:
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
cost: bigint;
|
|
337
|
+
owner: Address;
|
|
338
|
+
expiresAt: number;
|
|
339
|
+
entityHash: Hex;
|
|
329
340
|
};
|
|
330
341
|
type OnEntityOwnerChangedEvent = {
|
|
331
342
|
entityKey: Hex;
|
|
332
|
-
|
|
333
|
-
|
|
343
|
+
owner: Address;
|
|
344
|
+
entityHash: Hex;
|
|
334
345
|
};
|
|
335
346
|
//#endregion
|
|
336
347
|
//#region src/types/txParams.d.ts
|
|
@@ -349,9 +360,17 @@ type TxParams = {
|
|
|
349
360
|
};
|
|
350
361
|
//#endregion
|
|
351
362
|
//#region src/types/entity.d.ts
|
|
363
|
+
declare enum EntityOperationType {
|
|
364
|
+
Create = 1,
|
|
365
|
+
Update = 2,
|
|
366
|
+
Extend = 3,
|
|
367
|
+
Transfer = 4,
|
|
368
|
+
Delete = 5,
|
|
369
|
+
Expire = 6,
|
|
370
|
+
}
|
|
352
371
|
declare class Entity {
|
|
353
372
|
key: Hex;
|
|
354
|
-
contentType: MimeType | undefined;
|
|
373
|
+
contentType: MimeType | `${string}/${string}` | undefined;
|
|
355
374
|
owner: Hex | undefined;
|
|
356
375
|
creator: Hex | undefined;
|
|
357
376
|
expiresAtBlock: bigint | undefined;
|
|
@@ -361,7 +380,7 @@ declare class Entity {
|
|
|
361
380
|
operationIndexInTransaction: bigint | undefined;
|
|
362
381
|
payload: Uint8Array | undefined;
|
|
363
382
|
attributes: Attribute[];
|
|
364
|
-
constructor(key: Hex, contentType: MimeType | undefined, owner: Hex | undefined, creator: Hex | undefined, expiresAtBlock: bigint | undefined, createdAtBlock: bigint | undefined, lastModifiedAtBlock: bigint | undefined, transactionIndexInBlock: bigint | undefined, operationIndexInTransaction: bigint | undefined, payload: Uint8Array | undefined, attributes: Attribute[]);
|
|
383
|
+
constructor(key: Hex, contentType: MimeType | `${string}/${string}` | undefined, owner: Hex | undefined, creator: Hex | undefined, expiresAtBlock: bigint | undefined, createdAtBlock: bigint | undefined, lastModifiedAtBlock: bigint | undefined, transactionIndexInBlock: bigint | undefined, operationIndexInTransaction: bigint | undefined, payload: Uint8Array | undefined, attributes: Attribute[]);
|
|
365
384
|
/**
|
|
366
385
|
* Converts the entity payload from bytes to a string and returns it.
|
|
367
386
|
* Throws an error if the payload is undefined, which may occur if the entity was not queried with the withPayload option.
|
|
@@ -378,5 +397,5 @@ declare class Entity {
|
|
|
378
397
|
toJson(): any;
|
|
379
398
|
}
|
|
380
399
|
//#endregion
|
|
381
|
-
export {
|
|
382
|
-
//# sourceMappingURL=entity-
|
|
400
|
+
export { RpcEntity as A, QueryOptions as C, GetBlockTimingReturnType as D, QueryReturnType as E, RpcOrderByAttribute as M, RpcQueryOptions as N, ArkivClient as O, MimeType as P, ChangeOwnershipReturnType as S, QueryOptionsOrderBy as T, DeleteEntityParameters as _, OnEntityDeletedEvent as a, CreateEntityReturnType as b, OnEntityOwnerChangedEvent as c, MutateEntitiesParameters as d, MutateEntitiesReturnType as f, ExtendEntityReturnType as g, ExtendEntityParameters as h, OnEntityCreatedEvent as i, RpcIncludeData as j, ArkivRpcSchema as k, OnEntityUpdatedEvent as l, UpdateEntityReturnType as m, EntityOperationType as n, OnEntityExpiredEvent as o, UpdateEntityParameters as p, TxParams as r, OnEntityExpiresInExtendedEvent as s, Entity as t, Attribute as u, DeleteEntityReturnType as v, QueryOptionsIncludeData as w, ChangeOwnershipParameters as x, CreateEntityParameters as y };
|
|
401
|
+
//# sourceMappingURL=entity-CN41IOrq.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-CN41IOrq.d.cts","names":[],"sources":["../src/types/mimeTypes.ts","../src/types/rpcSchema.ts","../src/clients/baseClient.ts","../src/actions/public/getBlockTiming.ts","../src/actions/public/query.ts","../src/actions/wallet/changeOwnership.ts","../src/actions/wallet/createEntity.ts","../src/actions/wallet/deleteEntity.ts","../src/actions/wallet/extendEntity.ts","../src/actions/wallet/updateEntity.ts","../src/actions/wallet/mutateEntities.ts","../src/types/attributes.ts","../src/types/events.ts","../src/types/txParams.ts","../src/types/entity.ts"],"sourcesContent":[],"mappings":";;;KAAY,QAAA;;;KCGA,SAAA;EDHA,GAAA,ECIL,GDJK;eCKG;;aAEF;EAJD,cAAS,EAKH,GALG;EACd,mBAAA,EAKgB,GALhB;EACQ,uBAAA,EAKY,GALZ;EAEF,2BAAA,EAIkB,GAJlB;EACK,KAAA,EAIT,GAJS;EACK,OAAA,EAIZ,GAJY;EACI,UAAA,CAAA,EAAA;IACI,GAAA,EAAA,MAAA;IACtB,KAAA,EAAA,MAAA;IACE,SAAA,EAC6C,qBAD7C;EAC6C,CAAA,EAAA;CAAqB;AAGjE,aAAA,qBAAA;EAMA,IAAA,GAAA,CAAA;EAMA,MAAA,GAAA,CAAA;EACA,SAAA,GAAA,CAAA;;AAEA,KATA,mBAAA,GASA;EACO,IAAA,EAAA,MAAA;EAAG,IAAA,EAAA,QAAA,GAAA,SAAA;EAIV,IAAA,EAAA,OAAA;AAcZ,CAAA;AAGgD,KAzBpC,eAAA,GAyBoC;EAEpC,OAAA,CAAA,EA1BA,GA0BA;EACO,WAAA,CAAA,EA1BH,cA0BG;EAAG,OAAA,CAAA,EAzBV,mBAyBU,EAAA;mBAxBH;;;AC9BP,KDkCA,cAAA,GClCW;EACH,GAAA,CAAA,EAAA,OAAA;EAAY,UAAA,CAAA,EAAA,O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
+
let EntityOperationType = /* @__PURE__ */ function(EntityOperationType$1) {
|
|
5
|
+
EntityOperationType$1[EntityOperationType$1["Create"] = 1] = "Create";
|
|
6
|
+
EntityOperationType$1[EntityOperationType$1["Update"] = 2] = "Update";
|
|
7
|
+
EntityOperationType$1[EntityOperationType$1["Extend"] = 3] = "Extend";
|
|
8
|
+
EntityOperationType$1[EntityOperationType$1["Transfer"] = 4] = "Transfer";
|
|
9
|
+
EntityOperationType$1[EntityOperationType$1["Delete"] = 5] = "Delete";
|
|
10
|
+
EntityOperationType$1[EntityOperationType$1["Expire"] = 6] = "Expire";
|
|
11
|
+
return EntityOperationType$1;
|
|
12
|
+
}({});
|
|
13
|
+
var Entity = class {
|
|
14
|
+
key;
|
|
15
|
+
contentType;
|
|
16
|
+
owner;
|
|
17
|
+
creator;
|
|
18
|
+
expiresAtBlock;
|
|
19
|
+
createdAtBlock;
|
|
20
|
+
lastModifiedAtBlock;
|
|
21
|
+
transactionIndexInBlock;
|
|
22
|
+
operationIndexInTransaction;
|
|
23
|
+
payload;
|
|
24
|
+
attributes;
|
|
25
|
+
constructor(key, contentType = void 0, owner = void 0, creator = void 0, expiresAtBlock = void 0, createdAtBlock = void 0, lastModifiedAtBlock = void 0, transactionIndexInBlock = void 0, operationIndexInTransaction = void 0, payload = void 0, attributes) {
|
|
26
|
+
this.key = key;
|
|
27
|
+
this.owner = owner;
|
|
28
|
+
this.creator = creator;
|
|
29
|
+
this.expiresAtBlock = expiresAtBlock;
|
|
30
|
+
this.createdAtBlock = createdAtBlock;
|
|
31
|
+
this.lastModifiedAtBlock = lastModifiedAtBlock;
|
|
32
|
+
this.transactionIndexInBlock = transactionIndexInBlock;
|
|
33
|
+
this.operationIndexInTransaction = operationIndexInTransaction;
|
|
34
|
+
this.payload = payload;
|
|
35
|
+
this.attributes = attributes;
|
|
36
|
+
this.contentType = contentType;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Converts the entity payload from bytes to a string and returns it.
|
|
40
|
+
* Throws an error if the payload is undefined, which may occur if the entity was not queried with the withPayload option.
|
|
41
|
+
* Throws an error if the conversion from bytes to string fails.
|
|
42
|
+
* @returns The entity payload as a string.
|
|
43
|
+
*/
|
|
44
|
+
toText() {
|
|
45
|
+
if (this.payload === void 0) throw new Error("Entity has no payload – it was probably queried without withPayload(true) via QueryBuilder");
|
|
46
|
+
try {
|
|
47
|
+
return bytesToString(this.payload);
|
|
48
|
+
} catch (e) {
|
|
49
|
+
throw new Error(`Failed to convert entity payload to text: ${e instanceof Error ? e.message : String(e)}`, { cause: e });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Parses the entity payload as JSON and returns the resulting object.
|
|
54
|
+
* Throws an error if the payload is undefined, which may occur if the entity was not queried with the withPayload option.
|
|
55
|
+
* Throws an error if the payload is empty or cannot be parsed as JSON.
|
|
56
|
+
* @returns The parsed JSON object from the entity payload.
|
|
57
|
+
*/
|
|
58
|
+
toJson() {
|
|
59
|
+
const text = this.toText();
|
|
60
|
+
if (!text) throw new Error("Entity has empty payload, cannot parse as JSON");
|
|
61
|
+
try {
|
|
62
|
+
return JSON.parse(text);
|
|
63
|
+
} catch (e) {
|
|
64
|
+
throw new Error(`Failed to parse entity payload as JSON: ${e instanceof Error ? e.message : String(e)}`, { cause: e });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
export { EntityOperationType as n, Entity as t };
|
|
71
|
+
//# sourceMappingURL=entity-DGfVyB-a.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-DGfVyB-a.js","names":[],"sources":["../src/types/entity.ts"],"sourcesContent":["import { bytesToString, type Hex } from \"viem\"\n\nexport enum EntityOperationType {\n Create = 1,\n Update = 2,\n Extend = 3,\n Transfer = 4,\n Delete = 5,\n Expire = 6,\n}\n\nimport type { MimeType } from \"../types\"\nimport type { Attribute } from \"./attributes\"\n\nexport class Entity {\n key: Hex\n contentType: MimeType | `${string}/${string}` | undefined\n owner: Hex | undefined\n creator: Hex | undefined\n expiresAtBlock: bigint | undefined\n createdAtBlock: bigint | undefined\n lastModifiedAtBlock: bigint | undefined\n transactionIndexInBlock: bigint | undefined\n operationIndexInTransaction: bigint | undefined\n payload: Uint8Array | undefined\n attributes: Attribute[]\n\n constructor(\n key: Hex,\n contentType: MimeType | `${string}/${string}` | undefined = undefined,\n owner: Hex | undefined = undefined,\n creator: Hex | undefined = undefined,\n expiresAtBlock: bigint | undefined = undefined,\n createdAtBlock: bigint | undefined = undefined,\n lastModifiedAtBlock: bigint | undefined = undefined,\n transactionIndexInBlock: bigint | undefined = undefined,\n operationIndexInTransaction: bigint | undefined = undefined,\n payload: Uint8Array | undefined = undefined,\n attributes: Attribute[],\n ) {\n this.key = key\n this.owner = owner\n this.creator = creator\n this.expiresAtBlock = expiresAtBlock\n this.createdAtBlock = createdAtBlock\n this.lastModifiedAtBlock = lastModifiedAtBlock\n this.transactionIndexInBlock = transactionIndexInBlock\n this.operationIndexInTransaction = operationIndexInTransaction\n this.payload = payload\n this.attributes = attributes\n this.contentType = contentType\n }\n\n /**\n * Converts the entity payload from bytes to a string and returns it.\n * Throws an error if the payload is undefined, which may occur if the entity was not queried with the withPayload option.\n * Throws an error if the conversion from bytes to string fails.\n * @returns The entity payload as a string.\n */\n toText(): string {\n if (this.payload === undefined) {\n throw new Error(\n \"Entity has no payload – it was probably queried without withPayload(true) via QueryBuilder\",\n )\n }\n try {\n return bytesToString(this.payload)\n } catch (e) {\n throw new Error(\n `Failed to convert entity payload to text: ${e instanceof Error ? e.message : String(e)}`,\n { cause: e },\n )\n }\n }\n\n /**\n * Parses the entity payload as JSON and returns the resulting object.\n * Throws an error if the payload is undefined, which may occur if the entity was not queried with the withPayload option.\n * Throws an error if the payload is empty or cannot be parsed as JSON.\n * @returns The parsed JSON object from the entity payload.\n */\n toJson(): any {\n const text = this.toText()\n if (!text) {\n throw new Error(\"Entity has empty payload, cannot parse as JSON\")\n }\n try {\n return JSON.parse(text)\n } catch (e) {\n throw new Error(\n `Failed to parse entity payload as JSON: ${e instanceof Error ? e.message : String(e)}`,\n { cause: e },\n )\n }\n }\n}\n"],"mappings":";;;AAEA,IAAY,sEAAL;AACL;AACA;AACA;AACA;AACA;AACA;;;AAMF,IAAa,SAAb,MAAoB;CAClB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YACE,KACA,cAA4D,QAC5D,QAAyB,QACzB,UAA2B,QAC3B,iBAAqC,QACrC,iBAAqC,QACrC,sBAA0C,QAC1C,0BAA8C,QAC9C,8BAAkD,QAClD,UAAkC,QAClC,YACA;AACA,OAAK,MAAM;AACX,OAAK,QAAQ;AACb,OAAK,UAAU;AACf,OAAK,iBAAiB;AACtB,OAAK,iBAAiB;AACtB,OAAK,sBAAsB;AAC3B,OAAK,0BAA0B;AAC/B,OAAK,8BAA8B;AACnC,OAAK,UAAU;AACf,OAAK,aAAa;AAClB,OAAK,cAAc;;;;;;;;CASrB,SAAiB;AACf,MAAI,KAAK,YAAY,OACnB,OAAM,IAAI,MACR,6FACD;AAEH,MAAI;AACF,UAAO,cAAc,KAAK,QAAQ;WAC3B,GAAG;AACV,SAAM,IAAI,MACR,6CAA6C,aAAa,QAAQ,EAAE,UAAU,OAAO,EAAE,IACvF,EAAE,OAAO,GAAG,CACb;;;;;;;;;CAUL,SAAc;EACZ,MAAM,OAAO,KAAK,QAAQ;AAC1B,MAAI,CAAC,KACH,OAAM,IAAI,MAAM,iDAAiD;AAEnE,MAAI;AACF,UAAO,KAAK,MAAM,KAAK;WAChB,GAAG;AACV,SAAM,IAAI,MACR,2CAA2C,aAAa,QAAQ,EAAE,UAAU,OAAO,EAAE,IACrF,EAAE,OAAO,GAAG,CACb"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Account, Chain, Client, Hash, Hex, RpcSchema, Transport } from "viem";
|
|
1
|
+
import { Account, Address, Chain, Client, Hash, Hex, RpcSchema, Transport } from "viem";
|
|
2
2
|
|
|
3
3
|
//#region src/types/mimeTypes.d.ts
|
|
4
4
|
type MimeType = "text/plain" | "text/html" | "text/css" | "text/csv" | "text/xml" | "text/javascript" | "application/json" | "application/xml" | "application/pdf" | "application/zip" | "application/gzip" | "application/octet-stream" | "application/javascript" | "application/x-www-form-urlencoded" | "image/png" | "image/jpeg" | "image/webp" | "image/gif" | "image/svg+xml" | "audio/mpeg" | "audio/wav" | "audio/ogg" | "video/mp4" | "video/webm" | "video/ogg" | "multipart/form-data";
|
|
@@ -15,15 +15,17 @@ type RpcEntity = {
|
|
|
15
15
|
operationIndexInTransaction: Hex;
|
|
16
16
|
owner: Hex;
|
|
17
17
|
creator: Hex;
|
|
18
|
-
|
|
18
|
+
attributes?: {
|
|
19
19
|
key: string;
|
|
20
20
|
value: string;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
key: string;
|
|
24
|
-
value: Hex;
|
|
25
|
-
}];
|
|
21
|
+
valueType: RpcAttributeValueType;
|
|
22
|
+
}[];
|
|
26
23
|
};
|
|
24
|
+
declare enum RpcAttributeValueType {
|
|
25
|
+
Uint = 1,
|
|
26
|
+
String = 2,
|
|
27
|
+
EntityKey = 3,
|
|
28
|
+
}
|
|
27
29
|
type RpcOrderByAttribute = {
|
|
28
30
|
name: string;
|
|
29
31
|
type: "string" | "numeric";
|
|
@@ -117,15 +119,16 @@ type QueryReturnType = {
|
|
|
117
119
|
//#endregion
|
|
118
120
|
//#region src/actions/wallet/changeOwnership.d.ts
|
|
119
121
|
/**
|
|
120
|
-
* Parameters for the
|
|
121
|
-
* - entityKey: The key of the entity
|
|
122
|
+
* Parameters for the changeOwnership function.
|
|
123
|
+
* - entityKey: The key of the entity.
|
|
124
|
+
* - newOwner: The address of the new owner.
|
|
122
125
|
*/
|
|
123
126
|
type ChangeOwnershipParameters = {
|
|
124
127
|
entityKey: Hex;
|
|
125
128
|
newOwner: Hex;
|
|
126
129
|
};
|
|
127
130
|
/**
|
|
128
|
-
* Return type for the
|
|
131
|
+
* Return type for the changeOwnership function.
|
|
129
132
|
* - entityKey: The key of the entity.
|
|
130
133
|
* - txHash: The transaction hash.
|
|
131
134
|
*/
|
|
@@ -284,53 +287,61 @@ type MutateEntitiesReturnType = {
|
|
|
284
287
|
/**
|
|
285
288
|
* An entity attribute (key/value pair).
|
|
286
289
|
*
|
|
287
|
-
* Arkiv supports
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
+
* Arkiv supports string, Hex and number values.
|
|
291
|
+
*
|
|
292
|
+
* Hex values are stored as the on-chain `EntityKey` type **only when they are
|
|
293
|
+
* exactly 32 bytes** (66 characters, e.g. an entity key). Hex-looking strings
|
|
294
|
+
* of any other length are stored as plain strings: they round-trip unchanged
|
|
295
|
+
* and compare lexicographically, not as hex.
|
|
296
|
+
*
|
|
297
|
+
* Numeric values **must be non-negative integers** (they are stored on-chain
|
|
298
|
+
* as unsigned 256-bit) — passing a non-integer (e.g. `1.5`) or negative number
|
|
299
|
+
* throws an {@link InvalidAttributeError} at mutation time. To store a
|
|
300
|
+
* non-integer value:
|
|
290
301
|
* - Scale it to an integer (e.g. `1.5` -> `1500`, dividing by the same factor on
|
|
291
302
|
* read) to keep numeric ordering and range queries working.
|
|
292
303
|
* - Or pass it as a string (e.g. `"1.5"`), which sorts lexicographically and so
|
|
293
304
|
* does not support numeric comparisons.
|
|
305
|
+
*
|
|
306
|
+
* To store a negative value, offset it into the non-negative range (subtracting
|
|
307
|
+
* the offset on read) or store it as a string.
|
|
294
308
|
*/
|
|
295
309
|
type Attribute = {
|
|
296
310
|
key: string;
|
|
297
|
-
|
|
298
|
-
value: string | number;
|
|
311
|
+
value: number | string | Hex;
|
|
299
312
|
};
|
|
300
313
|
//#endregion
|
|
301
314
|
//#region src/types/events.d.ts
|
|
302
315
|
type OnEntityCreatedEvent = {
|
|
303
316
|
entityKey: Hex;
|
|
304
|
-
owner:
|
|
305
|
-
|
|
306
|
-
|
|
317
|
+
owner: Address;
|
|
318
|
+
expiresAt: number;
|
|
319
|
+
entityHash: Hex;
|
|
307
320
|
};
|
|
308
321
|
type OnEntityUpdatedEvent = {
|
|
309
322
|
entityKey: Hex;
|
|
310
|
-
owner:
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
cost: bigint;
|
|
323
|
+
owner: Address;
|
|
324
|
+
expiresAt: number;
|
|
325
|
+
entityHash: Hex;
|
|
314
326
|
};
|
|
315
327
|
type OnEntityDeletedEvent = {
|
|
316
328
|
entityKey: Hex;
|
|
317
|
-
owner:
|
|
329
|
+
owner: Address;
|
|
318
330
|
};
|
|
319
331
|
type OnEntityExpiredEvent = {
|
|
320
332
|
entityKey: Hex;
|
|
321
|
-
owner:
|
|
333
|
+
owner: Address;
|
|
322
334
|
};
|
|
323
335
|
type OnEntityExpiresInExtendedEvent = {
|
|
324
336
|
entityKey: Hex;
|
|
325
|
-
owner:
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
cost: bigint;
|
|
337
|
+
owner: Address;
|
|
338
|
+
expiresAt: number;
|
|
339
|
+
entityHash: Hex;
|
|
329
340
|
};
|
|
330
341
|
type OnEntityOwnerChangedEvent = {
|
|
331
342
|
entityKey: Hex;
|
|
332
|
-
|
|
333
|
-
|
|
343
|
+
owner: Address;
|
|
344
|
+
entityHash: Hex;
|
|
334
345
|
};
|
|
335
346
|
//#endregion
|
|
336
347
|
//#region src/types/txParams.d.ts
|
|
@@ -349,9 +360,17 @@ type TxParams = {
|
|
|
349
360
|
};
|
|
350
361
|
//#endregion
|
|
351
362
|
//#region src/types/entity.d.ts
|
|
363
|
+
declare enum EntityOperationType {
|
|
364
|
+
Create = 1,
|
|
365
|
+
Update = 2,
|
|
366
|
+
Extend = 3,
|
|
367
|
+
Transfer = 4,
|
|
368
|
+
Delete = 5,
|
|
369
|
+
Expire = 6,
|
|
370
|
+
}
|
|
352
371
|
declare class Entity {
|
|
353
372
|
key: Hex;
|
|
354
|
-
contentType: MimeType | undefined;
|
|
373
|
+
contentType: MimeType | `${string}/${string}` | undefined;
|
|
355
374
|
owner: Hex | undefined;
|
|
356
375
|
creator: Hex | undefined;
|
|
357
376
|
expiresAtBlock: bigint | undefined;
|
|
@@ -361,7 +380,7 @@ declare class Entity {
|
|
|
361
380
|
operationIndexInTransaction: bigint | undefined;
|
|
362
381
|
payload: Uint8Array | undefined;
|
|
363
382
|
attributes: Attribute[];
|
|
364
|
-
constructor(key: Hex, contentType: MimeType | undefined, owner: Hex | undefined, creator: Hex | undefined, expiresAtBlock: bigint | undefined, createdAtBlock: bigint | undefined, lastModifiedAtBlock: bigint | undefined, transactionIndexInBlock: bigint | undefined, operationIndexInTransaction: bigint | undefined, payload: Uint8Array | undefined, attributes: Attribute[]);
|
|
383
|
+
constructor(key: Hex, contentType: MimeType | `${string}/${string}` | undefined, owner: Hex | undefined, creator: Hex | undefined, expiresAtBlock: bigint | undefined, createdAtBlock: bigint | undefined, lastModifiedAtBlock: bigint | undefined, transactionIndexInBlock: bigint | undefined, operationIndexInTransaction: bigint | undefined, payload: Uint8Array | undefined, attributes: Attribute[]);
|
|
365
384
|
/**
|
|
366
385
|
* Converts the entity payload from bytes to a string and returns it.
|
|
367
386
|
* Throws an error if the payload is undefined, which may occur if the entity was not queried with the withPayload option.
|
|
@@ -378,5 +397,5 @@ declare class Entity {
|
|
|
378
397
|
toJson(): any;
|
|
379
398
|
}
|
|
380
399
|
//#endregion
|
|
381
|
-
export {
|
|
382
|
-
//# sourceMappingURL=entity-
|
|
400
|
+
export { RpcEntity as A, QueryOptions as C, GetBlockTimingReturnType as D, QueryReturnType as E, RpcOrderByAttribute as M, RpcQueryOptions as N, ArkivClient as O, MimeType as P, ChangeOwnershipReturnType as S, QueryOptionsOrderBy as T, DeleteEntityParameters as _, OnEntityDeletedEvent as a, CreateEntityReturnType as b, OnEntityOwnerChangedEvent as c, MutateEntitiesParameters as d, MutateEntitiesReturnType as f, ExtendEntityReturnType as g, ExtendEntityParameters as h, OnEntityCreatedEvent as i, RpcIncludeData as j, ArkivRpcSchema as k, OnEntityUpdatedEvent as l, UpdateEntityReturnType as m, EntityOperationType as n, OnEntityExpiredEvent as o, UpdateEntityParameters as p, TxParams as r, OnEntityExpiresInExtendedEvent as s, Entity as t, Attribute as u, DeleteEntityReturnType as v, QueryOptionsIncludeData as w, ChangeOwnershipParameters as x, CreateEntityParameters as y };
|
|
401
|
+
//# sourceMappingURL=entity-NnEVlePN.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-NnEVlePN.d.ts","names":[],"sources":["../src/types/mimeTypes.ts","../src/types/rpcSchema.ts","../src/clients/baseClient.ts","../src/actions/public/getBlockTiming.ts","../src/actions/public/query.ts","../src/actions/wallet/changeOwnership.ts","../src/actions/wallet/createEntity.ts","../src/actions/wallet/deleteEntity.ts","../src/actions/wallet/extendEntity.ts","../src/actions/wallet/updateEntity.ts","../src/actions/wallet/mutateEntities.ts","../src/types/attributes.ts","../src/types/events.ts","../src/types/txParams.ts","../src/types/entity.ts"],"sourcesContent":[],"mappings":";;;KAAY,QAAA;;;KCGA,SAAA;EDHA,GAAA,ECIL,GDJK;eCKG;;aAEF;EAJD,cAAS,EAKH,GALG;EACd,mBAAA,EAKgB,GALhB;EACQ,uBAAA,EAKY,GALZ;EAEF,2BAAA,EAIkB,GAJlB;EACK,KAAA,EAIT,GAJS;EACK,OAAA,EAIZ,GAJY;EACI,UAAA,CAAA,EAAA;IACI,GAAA,EAAA,MAAA;IACtB,KAAA,EAAA,MAAA;IACE,SAAA,EAC6C,qBAD7C;EAC6C,CAAA,EAAA;CAAqB;AAGjE,aAAA,qBAAA;EAMA,IAAA,GAAA,CAAA;EAMA,MAAA,GAAA,CAAA;EACA,SAAA,GAAA,CAAA;;AAEA,KATA,mBAAA,GASA;EACO,IAAA,EAAA,MAAA;EAAG,IAAA,EAAA,QAAA,GAAA,SAAA;EAIV,IAAA,EAAA,OAAA;AAcZ,CAAA;AAGgD,KAzBpC,eA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