@arkiv-network/sdk 0.7.0 → 0.8.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/README.md +29 -16
- package/dist/attr/index.cjs +34 -0
- package/dist/attr/index.d.cts +2 -0
- package/dist/attr/index.d.ts +2 -0
- package/dist/attr/index.js +3 -0
- package/dist/attr-BDZ-APg5.js +809 -0
- package/dist/attr-BDZ-APg5.js.map +1 -0
- package/dist/attr-BvxHN99W.cjs +1029 -0
- package/dist/chains/index.cjs +2 -3
- package/dist/chains/index.d.cts +39 -77
- package/dist/chains/index.d.cts.map +1 -1
- package/dist/chains/index.d.ts +22 -60
- package/dist/chains/index.d.ts.map +1 -1
- package/dist/chains/index.js +2 -2
- package/dist/chains-BJrZs6sG.js +57 -0
- package/dist/chains-BJrZs6sG.js.map +1 -0
- package/dist/chains-BYRTTipa.cjs +73 -0
- package/dist/changeOwnership-B7bEgla4.d.cts +509 -0
- package/dist/changeOwnership-B7bEgla4.d.cts.map +1 -0
- package/dist/changeOwnership-DwgtdSFc.d.ts +509 -0
- package/dist/changeOwnership-DwgtdSFc.d.ts.map +1 -0
- package/dist/entity/index.cjs +19 -0
- package/dist/entity/index.d.cts +4 -0
- package/dist/entity/index.d.ts +4 -0
- package/dist/entity/index.js +6 -0
- package/dist/entity-B0t6sN7F.cjs +71 -0
- package/dist/entity-BIp_df9u.js +67 -0
- package/dist/entity-BIp_df9u.js.map +1 -0
- package/dist/entity-CFhbAv0R.js +70 -0
- package/dist/entity-CFhbAv0R.js.map +1 -0
- package/dist/entity-wfBnZd91.cjs +98 -0
- package/dist/errors-D-eJkGVc.cjs +56 -0
- package/dist/errors-DGB8AgT2.js +33 -0
- package/dist/errors-DGB8AgT2.js.map +1 -0
- package/dist/expiry-BUYIXTGb.cjs +135 -0
- package/dist/expiry-BxOlvVWC.d.ts +79 -0
- package/dist/expiry-BxOlvVWC.d.ts.map +1 -0
- package/dist/expiry-DGRzrSan.js +95 -0
- package/dist/expiry-DGRzrSan.js.map +1 -0
- package/dist/expiry-DRV29F1r.d.cts +79 -0
- package/dist/expiry-DRV29F1r.d.cts.map +1 -0
- package/dist/flags-0Vl5rrHq.d.cts +41 -0
- package/dist/flags-0Vl5rrHq.d.cts.map +1 -0
- package/dist/flags-Ct8k0gpB.cjs +43 -0
- package/dist/flags-ZtlvOIIk.js +33 -0
- package/dist/flags-ZtlvOIIk.js.map +1 -0
- package/dist/flags-wmcMoAnN.d.ts +41 -0
- package/dist/flags-wmcMoAnN.d.ts.map +1 -0
- package/dist/index-Cgw1u5aY.d.cts +278 -0
- package/dist/index-Cgw1u5aY.d.cts.map +1 -0
- package/dist/index-ClgIuxJ8.d.ts +159 -0
- package/dist/index-ClgIuxJ8.d.ts.map +1 -0
- package/dist/index-D0CmtiWT.d.cts +159 -0
- package/dist/index-D0CmtiWT.d.cts.map +1 -0
- package/dist/index-D8LZt-3J.d.cts +417 -0
- package/dist/index-D8LZt-3J.d.cts.map +1 -0
- package/dist/index-DVYFaXNV.d.ts +417 -0
- package/dist/index-DVYFaXNV.d.ts.map +1 -0
- package/dist/index-VCqgn29D.d.ts +278 -0
- package/dist/index-VCqgn29D.d.ts.map +1 -0
- package/dist/index.cjs +675 -357
- package/dist/index.d.cts +251 -203
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +251 -203
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +626 -355
- package/dist/index.js.map +1 -1
- package/dist/payload-Bnw1hrvb.cjs +83 -0
- package/dist/payload-CIxSn_DW.js +67 -0
- package/dist/payload-CIxSn_DW.js.map +1 -0
- package/dist/payload-Dgx3PQeK.d.ts +94 -0
- package/dist/payload-Dgx3PQeK.d.ts.map +1 -0
- package/dist/payload-P0nWyjLg.d.cts +94 -0
- package/dist/payload-P0nWyjLg.d.cts.map +1 -0
- package/dist/query/index.cjs +24 -149
- package/dist/query/index.d.cts +5 -3
- package/dist/query/index.d.ts +5 -3
- package/dist/query/index.js +6 -137
- package/dist/queryBuilder-BXDvX1K_.cjs +1123 -0
- package/dist/queryBuilder-CbLL4pG5.js +963 -0
- package/dist/queryBuilder-CbLL4pG5.js.map +1 -0
- package/dist/selection-BvK6yX0g.d.cts +433 -0
- package/dist/selection-BvK6yX0g.d.cts.map +1 -0
- package/dist/selection-fpmI3ADQ.d.ts +433 -0
- package/dist/selection-fpmI3ADQ.d.ts.map +1 -0
- package/dist/types/index.cjs +4 -1
- package/dist/types/index.d.cts +7 -2
- package/dist/types/index.d.ts +7 -2
- package/dist/types/index.js +4 -1
- package/dist/utils/index.cjs +4 -17
- package/dist/utils/index.d.cts +3 -17
- package/dist/utils/index.d.ts +3 -17
- package/dist/utils/index.js +4 -18
- package/package.json +26 -5
- package/src/actions/public/getEntity.ts +27 -43
- package/src/actions/public/getEntityNonce.ts +30 -0
- package/src/actions/public/predictEntityKeys.test.ts +143 -0
- package/src/actions/public/predictEntityKeys.ts +138 -0
- package/src/actions/public/query.ts +33 -69
- package/src/actions/public/watchEntityEvents.test.ts +414 -0
- package/src/actions/public/watchEntityEvents.ts +225 -0
- package/src/actions/wallet/changeOwnership.ts +8 -8
- package/src/actions/wallet/createEntity.ts +104 -26
- package/src/actions/wallet/deleteEntity.ts +2 -3
- package/src/actions/wallet/extendEntity.ts +39 -16
- package/src/actions/wallet/mutateEntities.test.ts +76 -0
- package/src/actions/wallet/mutateEntities.ts +29 -74
- package/src/actions/wallet/patchEntity.ts +90 -0
- package/src/attr/attributes.test.ts +120 -0
- package/src/attr/attributes.ts +190 -0
- package/src/attr/codec.test.ts +162 -0
- package/src/attr/codec.ts +220 -0
- package/src/attr/decimal.ts +86 -0
- package/src/attr/errors.ts +145 -0
- package/src/attr/index.ts +50 -0
- package/src/attr/names.ts +106 -0
- package/src/attr/types.ts +150 -0
- package/src/attr/values.test.ts +271 -0
- package/src/attr/values.ts +502 -0
- package/src/chains/cheesecake.ts +22 -0
- package/src/chains/index.ts +1 -2
- package/src/clients/createPublicClient.test.ts +3 -5
- package/src/clients/createPublicClient.ts +5 -4
- package/src/clients/createWalletClient.test.ts +2 -2
- package/src/clients/createWalletClient.ts +13 -7
- package/src/clients/decorators/arkivPublic.ts +160 -139
- package/src/clients/decorators/arkivWallet.ts +91 -95
- package/src/consts.ts +2 -1
- package/src/entity/create.test.ts +184 -0
- package/src/entity/errors.ts +38 -0
- package/src/entity/events.ts +16 -0
- package/src/entity/expiry.test.ts +195 -0
- package/src/entity/expiry.ts +181 -0
- package/src/entity/flags.ts +65 -0
- package/src/entity/index.ts +14 -0
- package/src/entity/key.ts +68 -0
- package/src/entity/operations.ts +134 -0
- package/src/entity/params.ts +15 -0
- package/src/errors.ts +33 -28
- package/src/index.ts +6 -0
- package/src/query/engine.ts +59 -134
- package/src/query/errors.ts +151 -0
- package/src/query/expression.test.ts +286 -0
- package/src/query/expression.ts +493 -0
- package/src/query/index.ts +40 -4
- package/src/query/injection.test.ts +151 -0
- package/src/query/queryBuilder.test.ts +322 -637
- package/src/query/queryBuilder.ts +126 -359
- package/src/query/queryResult.ts +54 -51
- package/src/query/selection.test.ts +48 -98
- package/src/query/selection.ts +77 -65
- package/src/types/entity.test.ts +44 -155
- package/src/types/entity.ts +62 -44
- package/src/types/events.ts +64 -23
- package/src/types/index.ts +20 -16
- package/src/types/rpcSchema.ts +70 -33
- package/src/utils/arkivTransactions.test.ts +681 -38
- package/src/utils/arkivTransactions.ts +249 -104
- package/src/utils/chains.test.ts +21 -24
- package/src/utils/compression.ts +1 -1
- package/src/utils/entities.test.ts +62 -0
- package/src/utils/entities.ts +111 -29
- package/src/utils/expirationTime.ts +114 -10
- package/src/utils/logger.ts +2 -2
- package/src/utils/payload.ts +4 -2
- package/src/utils/revert.test.ts +99 -0
- package/src/utils/revert.ts +145 -0
- package/dist/chains-BifaY04V.cjs +0 -108
- package/dist/chains-CrtkVbBh.js +0 -86
- package/dist/chains-CrtkVbBh.js.map +0 -1
- package/dist/consts-AUoL-v42.cjs +0 -18
- package/dist/consts-BV4PR-de.js +0 -7
- package/dist/consts-BV4PR-de.js.map +0 -1
- package/dist/entity-B6g_EPm1.d.cts +0 -382
- package/dist/entity-B6g_EPm1.d.cts.map +0 -1
- package/dist/entity-qoLMAuuk.d.ts +0 -382
- package/dist/entity-qoLMAuuk.d.ts.map +0 -1
- package/dist/index-DdspxNAA.d.ts +0 -481
- package/dist/index-DdspxNAA.d.ts.map +0 -1
- package/dist/index-Ds9dwqb5.d.cts +0 -481
- package/dist/index-Ds9dwqb5.d.cts.map +0 -1
- package/dist/payload-B2kFJyah.d.ts +0 -6
- package/dist/payload-B2kFJyah.d.ts.map +0 -1
- package/dist/payload-CJN8fTvX.d.cts +0 -6
- package/dist/payload-CJN8fTvX.d.cts.map +0 -1
- package/dist/payload-Claf2jUO.js +0 -13
- package/dist/payload-Claf2jUO.js.map +0 -1
- package/dist/payload-DpA5PA-w.cjs +0 -23
- package/dist/query/index.js.map +0 -1
- package/dist/queryBuilder-D2uwP9jI.js +0 -704
- package/dist/queryBuilder-D2uwP9jI.js.map +0 -1
- package/dist/queryBuilder-UW2MCaX4.cjs +0 -792
- package/dist/utils/index.d.cts.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js.map +0 -1
- package/src/actions/public/buildQuery.ts +0 -10
- package/src/actions/public/subscribeEntityEvents.ts +0 -119
- package/src/actions/wallet/updateEntity.ts +0 -60
- package/src/chains/braga.ts +0 -26
- package/src/chains/kaolin.ts +0 -29
- package/src/query/engine.test.ts +0 -526
- package/src/query/predicate.test.ts +0 -461
- package/src/query/predicate.ts +0 -144
- package/src/query/queryResult.test.ts +0 -270
- package/src/query/selectQueryBuilder.test.ts +0 -210
- package/src/types/attributes.ts +0 -16
- package/src/utils/validation.test.ts +0 -60
- package/src/utils/validation.ts +0 -32
- /package/dist/{types-H-TSmRpm.js → types-Bx1EKe0v.js} +0 -0
- /package/dist/{types-o3zWarRp.cjs → types-CKPddlfS.cjs} +0 -0
|
@@ -1,382 +0,0 @@
|
|
|
1
|
-
import { Account, Chain, Client, Hash, Hex, RpcSchema, Transport } from "viem";
|
|
2
|
-
|
|
3
|
-
//#region src/types/mimeTypes.d.ts
|
|
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";
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/types/rpcSchema.d.ts
|
|
7
|
-
type RpcEntity = {
|
|
8
|
-
key: Hex;
|
|
9
|
-
contentType: MimeType;
|
|
10
|
-
value: string;
|
|
11
|
-
expiresAt: Hex;
|
|
12
|
-
createdAtBlock: Hex;
|
|
13
|
-
lastModifiedAtBlock: Hex;
|
|
14
|
-
transactionIndexInBlock: Hex;
|
|
15
|
-
operationIndexInTransaction: Hex;
|
|
16
|
-
owner: Hex;
|
|
17
|
-
creator: Hex;
|
|
18
|
-
stringAttributes?: [{
|
|
19
|
-
key: string;
|
|
20
|
-
value: string;
|
|
21
|
-
}];
|
|
22
|
-
numericAttributes?: [{
|
|
23
|
-
key: string;
|
|
24
|
-
value: Hex;
|
|
25
|
-
}];
|
|
26
|
-
};
|
|
27
|
-
type RpcOrderByAttribute = {
|
|
28
|
-
name: string;
|
|
29
|
-
type: "string" | "numeric";
|
|
30
|
-
desc: boolean;
|
|
31
|
-
};
|
|
32
|
-
type RpcQueryOptions = {
|
|
33
|
-
atBlock?: Hex;
|
|
34
|
-
includeData?: RpcIncludeData;
|
|
35
|
-
orderBy?: RpcOrderByAttribute[];
|
|
36
|
-
resultsPerPage?: Hex;
|
|
37
|
-
cursor?: string;
|
|
38
|
-
};
|
|
39
|
-
type RpcIncludeData = {
|
|
40
|
-
key?: boolean;
|
|
41
|
-
attributes?: boolean;
|
|
42
|
-
payload?: boolean;
|
|
43
|
-
contentType?: boolean;
|
|
44
|
-
expiration?: boolean;
|
|
45
|
-
owner?: boolean;
|
|
46
|
-
creator?: boolean;
|
|
47
|
-
createdAtBlock?: boolean;
|
|
48
|
-
lastModifiedAtBlock?: boolean;
|
|
49
|
-
transactionIndexInBlock?: boolean;
|
|
50
|
-
operationIndexInTransaction?: boolean;
|
|
51
|
-
};
|
|
52
|
-
type ArkivRpcSchema = [{
|
|
53
|
-
Method: "arkiv_query";
|
|
54
|
-
Parameters?: [query: string, queryOptions?: RpcQueryOptions];
|
|
55
|
-
ReturnType: {
|
|
56
|
-
data: RpcEntity[];
|
|
57
|
-
blockNumber: Hex;
|
|
58
|
-
cursor: string;
|
|
59
|
-
};
|
|
60
|
-
}, {
|
|
61
|
-
Method: "arkiv_getBlockTiming";
|
|
62
|
-
Parameters?: [];
|
|
63
|
-
ReturnType: {
|
|
64
|
-
current_block: bigint;
|
|
65
|
-
current_block_time: number;
|
|
66
|
-
duration: number;
|
|
67
|
-
};
|
|
68
|
-
}, {
|
|
69
|
-
Method: "arkiv_getEntityCount";
|
|
70
|
-
Parameters?: [];
|
|
71
|
-
ReturnType: number;
|
|
72
|
-
}];
|
|
73
|
-
//#endregion
|
|
74
|
-
//#region src/clients/baseClient.d.ts
|
|
75
|
-
type ArkivClient<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, accountOrAddress extends Account | undefined = Account | undefined, rpcSchema extends RpcSchema | undefined = ArkivRpcSchema> = Client<transport, chain, accountOrAddress, rpcSchema>;
|
|
76
|
-
//#endregion
|
|
77
|
-
//#region src/actions/public/getBlockTiming.d.ts
|
|
78
|
-
type GetBlockTimingReturnType = {
|
|
79
|
-
currentBlock: bigint;
|
|
80
|
-
currentBlockTime: number;
|
|
81
|
-
blockDuration: number;
|
|
82
|
-
};
|
|
83
|
-
//#endregion
|
|
84
|
-
//#region src/actions/public/query.d.ts
|
|
85
|
-
type QueryOptionsIncludeData = {
|
|
86
|
-
attributes?: boolean;
|
|
87
|
-
payload?: boolean;
|
|
88
|
-
metadata?: boolean;
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* @deprecated Server-side ordering is not supported by the network. Sort the fetched
|
|
92
|
-
* entities in JavaScript instead (e.g. `entities.sort(...)`). This type will be removed
|
|
93
|
-
* in a future release.
|
|
94
|
-
*/
|
|
95
|
-
type QueryOptionsOrderBy = {
|
|
96
|
-
name: string;
|
|
97
|
-
type: "string" | "numeric";
|
|
98
|
-
desc: "asc" | "desc";
|
|
99
|
-
};
|
|
100
|
-
type QueryOptions = {
|
|
101
|
-
includeData?: QueryOptionsIncludeData;
|
|
102
|
-
atBlock?: bigint;
|
|
103
|
-
/**
|
|
104
|
-
* @deprecated Server-side ordering is not supported by the network, so this option has no
|
|
105
|
-
* effect on the returned order. Sort the fetched entities in JavaScript instead
|
|
106
|
-
* (e.g. `entities.sort(...)`). This option will be removed in a future release.
|
|
107
|
-
*/
|
|
108
|
-
orderBy?: QueryOptionsOrderBy[];
|
|
109
|
-
resultsPerPage?: number | undefined;
|
|
110
|
-
cursor?: string | undefined;
|
|
111
|
-
};
|
|
112
|
-
type QueryReturnType = {
|
|
113
|
-
entities: Entity[];
|
|
114
|
-
cursor: string | undefined;
|
|
115
|
-
blockNumber: bigint | undefined;
|
|
116
|
-
};
|
|
117
|
-
//#endregion
|
|
118
|
-
//#region src/actions/wallet/changeOwnership.d.ts
|
|
119
|
-
/**
|
|
120
|
-
* Parameters for the deleteEntity function.
|
|
121
|
-
* - entityKey: The key of the entity to delete.
|
|
122
|
-
*/
|
|
123
|
-
type ChangeOwnershipParameters = {
|
|
124
|
-
entityKey: Hex;
|
|
125
|
-
newOwner: Hex;
|
|
126
|
-
};
|
|
127
|
-
/**
|
|
128
|
-
* Return type for the deleteEntity function.
|
|
129
|
-
* - entityKey: The key of the entity.
|
|
130
|
-
* - txHash: The transaction hash.
|
|
131
|
-
*/
|
|
132
|
-
type ChangeOwnershipReturnType = {
|
|
133
|
-
entityKey: Hex;
|
|
134
|
-
txHash: string;
|
|
135
|
-
};
|
|
136
|
-
//#endregion
|
|
137
|
-
//#region src/actions/wallet/createEntity.d.ts
|
|
138
|
-
/**
|
|
139
|
-
* Parameters for the createEntity function.
|
|
140
|
-
* - payload: The payload of the entity.
|
|
141
|
-
* - attributes: The attributes of the entity. Attribute values may be strings
|
|
142
|
-
* or numbers, but numeric values **must be integers**. To store a non-integer,
|
|
143
|
-
* scale it to an integer (e.g. `1.5` -> `1500`) to preserve numeric ordering,
|
|
144
|
-
* or pass it as a string (e.g. `"1.5"`). A non-integer numeric value throws an
|
|
145
|
-
* {@link InvalidAttributeError}.
|
|
146
|
-
* - contentType: The content type of the entity.
|
|
147
|
-
* - expiresIn: How long until the entity expires, in seconds. Because Arkiv
|
|
148
|
-
* measures expiration in blocks (1 block = 2 seconds), this **must be a
|
|
149
|
-
* positive integer and a multiple of the block time (2 seconds)**
|
|
150
|
-
* Invalid values throw an {@link InvalidExpirationError}.
|
|
151
|
-
*/
|
|
152
|
-
type CreateEntityParameters = {
|
|
153
|
-
payload: Uint8Array;
|
|
154
|
-
/** Entity attributes. Numeric values must be integers (scale non-integers, e.g. `1.5` -> `1500`, or use a string). Throws {@link InvalidAttributeError} otherwise. */
|
|
155
|
-
attributes: Attribute[];
|
|
156
|
-
contentType: MimeType | string;
|
|
157
|
-
/** Seconds until expiry. Must be a positive integer and a multiple of the 2s block time.
|
|
158
|
-
* Throws {@link InvalidExpirationError} otherwise. */
|
|
159
|
-
expiresIn: number;
|
|
160
|
-
};
|
|
161
|
-
/**
|
|
162
|
-
* Return type for the createEntity function.
|
|
163
|
-
* - entityKey: The key of the entity.
|
|
164
|
-
* - txHash: The transaction hash.
|
|
165
|
-
*/
|
|
166
|
-
type CreateEntityReturnType = {
|
|
167
|
-
entityKey: Hex;
|
|
168
|
-
txHash: Hash;
|
|
169
|
-
};
|
|
170
|
-
//#endregion
|
|
171
|
-
//#region src/actions/wallet/deleteEntity.d.ts
|
|
172
|
-
/**
|
|
173
|
-
* Parameters for the deleteEntity function.
|
|
174
|
-
* - entityKey: The key of the entity to delete.
|
|
175
|
-
*/
|
|
176
|
-
type DeleteEntityParameters = {
|
|
177
|
-
entityKey: Hex;
|
|
178
|
-
};
|
|
179
|
-
/**
|
|
180
|
-
* Return type for the deleteEntity function.
|
|
181
|
-
* - entityKey: The key of the entity.
|
|
182
|
-
* - txHash: The transaction hash.
|
|
183
|
-
*/
|
|
184
|
-
type DeleteEntityReturnType = {
|
|
185
|
-
entityKey: Hex;
|
|
186
|
-
txHash: Hash;
|
|
187
|
-
};
|
|
188
|
-
//#endregion
|
|
189
|
-
//#region src/actions/wallet/extendEntity.d.ts
|
|
190
|
-
/**
|
|
191
|
-
* Parameters for the extendEntity function.
|
|
192
|
-
* - entityKey: The key of the entity to extend.
|
|
193
|
-
* - expiresIn: How long to extend the entity by, in seconds. Because Arkiv
|
|
194
|
-
* measures expiration in blocks (1 block = 2 seconds), this **must be a
|
|
195
|
-
* positive integer and a multiple of the block time (2 seconds)**.
|
|
196
|
-
* Invalid values throw an {@link InvalidExpirationError}.
|
|
197
|
-
*/
|
|
198
|
-
type ExtendEntityParameters = {
|
|
199
|
-
entityKey: Hex;
|
|
200
|
-
/** Seconds to extend by. Must be a positive integer and a multiple of the 2s block time.
|
|
201
|
-
* Throws {@link InvalidExpirationError} otherwise. */
|
|
202
|
-
expiresIn: number;
|
|
203
|
-
};
|
|
204
|
-
/**
|
|
205
|
-
* Return type for the extendEntity function.
|
|
206
|
-
* - entityKey: The key of the entity.
|
|
207
|
-
* - txHash: The transaction hash.
|
|
208
|
-
*/
|
|
209
|
-
type ExtendEntityReturnType = {
|
|
210
|
-
entityKey: Hex;
|
|
211
|
-
txHash: Hash;
|
|
212
|
-
};
|
|
213
|
-
//#endregion
|
|
214
|
-
//#region src/actions/wallet/updateEntity.d.ts
|
|
215
|
-
/**
|
|
216
|
-
* Parameters for the updateEntity function.
|
|
217
|
-
* - entityKey: The key of the entity to update.
|
|
218
|
-
* - payload: The payload of the entity.
|
|
219
|
-
* - attributes: The attributes of the entity. Attribute values may be strings
|
|
220
|
-
* or numbers, but numeric values **must be integers**. To store a non-integer,
|
|
221
|
-
* scale it to an integer (e.g. `1.5` -> `1500`) to preserve numeric ordering,
|
|
222
|
-
* or pass it as a string (e.g. `"1.5"`). A non-integer numeric value throws an
|
|
223
|
-
* {@link InvalidAttributeError}.
|
|
224
|
-
* - contentType: The content type of the entity.
|
|
225
|
-
* - expiresIn: How long until the entity expires, in seconds. Because Arkiv
|
|
226
|
-
* measures expiration in blocks (1 block = 2 seconds), this **must be a
|
|
227
|
-
* positive integer and a multiple of the block time (2 seconds)**.
|
|
228
|
-
* Invalid values throw an {@link InvalidExpirationError}.
|
|
229
|
-
*/
|
|
230
|
-
type UpdateEntityParameters = {
|
|
231
|
-
entityKey: Hex;
|
|
232
|
-
payload: Uint8Array;
|
|
233
|
-
/** Entity attributes. Numeric values must be integers (scale non-integers, e.g. `1.5` -> `1500`, or use a string). Throws {@link InvalidAttributeError} otherwise. */
|
|
234
|
-
attributes: Attribute[];
|
|
235
|
-
contentType: MimeType | string;
|
|
236
|
-
/** Seconds until expiry. Must be a positive integer and a multiple of the 2s block time.
|
|
237
|
-
* Throws {@link InvalidExpirationError} otherwise. */
|
|
238
|
-
expiresIn: number;
|
|
239
|
-
};
|
|
240
|
-
/**
|
|
241
|
-
* Return type for the updateEntity function.
|
|
242
|
-
* - entityKey: The key of the entity.
|
|
243
|
-
* - txHash: The transaction hash.
|
|
244
|
-
*/
|
|
245
|
-
type UpdateEntityReturnType = {
|
|
246
|
-
entityKey: Hex;
|
|
247
|
-
txHash: Hash;
|
|
248
|
-
};
|
|
249
|
-
//#endregion
|
|
250
|
-
//#region src/actions/wallet/mutateEntities.d.ts
|
|
251
|
-
/**
|
|
252
|
-
* Parameters for the mutateEntities function.
|
|
253
|
-
* - creates: The creates to perform.
|
|
254
|
-
* - updates: The updates to perform.
|
|
255
|
-
* - deletes: The deletes to perform.
|
|
256
|
-
* - extensions: The extensions to perform.
|
|
257
|
-
*/
|
|
258
|
-
type MutateEntitiesParameters = {
|
|
259
|
-
creates?: CreateEntityParameters[];
|
|
260
|
-
updates?: UpdateEntityParameters[];
|
|
261
|
-
deletes?: DeleteEntityParameters[];
|
|
262
|
-
extensions?: ExtendEntityParameters[];
|
|
263
|
-
ownershipChanges?: ChangeOwnershipParameters[];
|
|
264
|
-
};
|
|
265
|
-
/**
|
|
266
|
-
* Return type for the mutateEntities function.
|
|
267
|
-
* - txHash: The transaction hash.
|
|
268
|
-
* - createdEntities: The keys of the created entities.
|
|
269
|
-
* - updatedEntities: The keys of the updated entities.
|
|
270
|
-
* - deletedEntities: The keys of the deleted entities.
|
|
271
|
-
* - extendedEntities: The keys of the extended entities.
|
|
272
|
-
* - ownershipChanges: The keys of the ownership changes.
|
|
273
|
-
*/
|
|
274
|
-
type MutateEntitiesReturnType = {
|
|
275
|
-
txHash: Hash;
|
|
276
|
-
createdEntities: Hex[];
|
|
277
|
-
updatedEntities: Hex[];
|
|
278
|
-
deletedEntities: Hex[];
|
|
279
|
-
extendedEntities: Hex[];
|
|
280
|
-
ownershipChanges: Hex[];
|
|
281
|
-
};
|
|
282
|
-
//#endregion
|
|
283
|
-
//#region src/types/attributes.d.ts
|
|
284
|
-
/**
|
|
285
|
-
* An entity attribute (key/value pair).
|
|
286
|
-
*
|
|
287
|
-
* Arkiv supports both string and number values. Numeric values **must be
|
|
288
|
-
* integers** — passing a non-integer number (e.g. `1.5`) throws an
|
|
289
|
-
* {@link InvalidAttributeError} at mutation time. To store a non-integer value:
|
|
290
|
-
* - Scale it to an integer (e.g. `1.5` -> `1500`, dividing by the same factor on
|
|
291
|
-
* read) to keep numeric ordering and range queries working.
|
|
292
|
-
* - Or pass it as a string (e.g. `"1.5"`), which sorts lexicographically and so
|
|
293
|
-
* does not support numeric comparisons.
|
|
294
|
-
*/
|
|
295
|
-
type Attribute = {
|
|
296
|
-
key: string;
|
|
297
|
-
/** Attribute value. A `number` must be an integer (scale non-integers, e.g. `1.5` -> `1500`, or use a string). Throws {@link InvalidAttributeError} otherwise. */
|
|
298
|
-
value: string | number;
|
|
299
|
-
};
|
|
300
|
-
//#endregion
|
|
301
|
-
//#region src/types/events.d.ts
|
|
302
|
-
type OnEntityCreatedEvent = {
|
|
303
|
-
entityKey: Hex;
|
|
304
|
-
owner: Hex;
|
|
305
|
-
expirationBlock: number;
|
|
306
|
-
cost: bigint;
|
|
307
|
-
};
|
|
308
|
-
type OnEntityUpdatedEvent = {
|
|
309
|
-
entityKey: Hex;
|
|
310
|
-
owner: Hex;
|
|
311
|
-
oldExpirationBlock: number;
|
|
312
|
-
newExpirationBlock: number;
|
|
313
|
-
cost: bigint;
|
|
314
|
-
};
|
|
315
|
-
type OnEntityDeletedEvent = {
|
|
316
|
-
entityKey: Hex;
|
|
317
|
-
owner: Hex;
|
|
318
|
-
};
|
|
319
|
-
type OnEntityExpiredEvent = {
|
|
320
|
-
entityKey: Hex;
|
|
321
|
-
owner: Hex;
|
|
322
|
-
};
|
|
323
|
-
type OnEntityExpiresInExtendedEvent = {
|
|
324
|
-
entityKey: Hex;
|
|
325
|
-
owner: Hex;
|
|
326
|
-
oldExpirationBlock: number;
|
|
327
|
-
newExpirationBlock: number;
|
|
328
|
-
cost: bigint;
|
|
329
|
-
};
|
|
330
|
-
type OnEntityOwnerChangedEvent = {
|
|
331
|
-
entityKey: Hex;
|
|
332
|
-
oldOwner: Hex;
|
|
333
|
-
newOwner: Hex;
|
|
334
|
-
};
|
|
335
|
-
//#endregion
|
|
336
|
-
//#region src/types/txParams.d.ts
|
|
337
|
-
type TxParams = {
|
|
338
|
-
gas?: bigint;
|
|
339
|
-
nonce?: number;
|
|
340
|
-
gasPrice?: bigint;
|
|
341
|
-
maxFeePerGas?: never;
|
|
342
|
-
maxPriorityFeePerGas?: never;
|
|
343
|
-
} | {
|
|
344
|
-
gas?: bigint;
|
|
345
|
-
nonce?: number;
|
|
346
|
-
maxFeePerGas?: bigint;
|
|
347
|
-
maxPriorityFeePerGas?: bigint;
|
|
348
|
-
gasPrice?: never;
|
|
349
|
-
};
|
|
350
|
-
//#endregion
|
|
351
|
-
//#region src/types/entity.d.ts
|
|
352
|
-
declare class Entity {
|
|
353
|
-
key: Hex;
|
|
354
|
-
contentType: MimeType | undefined;
|
|
355
|
-
owner: Hex | undefined;
|
|
356
|
-
creator: Hex | undefined;
|
|
357
|
-
expiresAtBlock: bigint | undefined;
|
|
358
|
-
createdAtBlock: bigint | undefined;
|
|
359
|
-
lastModifiedAtBlock: bigint | undefined;
|
|
360
|
-
transactionIndexInBlock: bigint | undefined;
|
|
361
|
-
operationIndexInTransaction: bigint | undefined;
|
|
362
|
-
payload: Uint8Array | undefined;
|
|
363
|
-
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[]);
|
|
365
|
-
/**
|
|
366
|
-
* Converts the entity payload from bytes to a string and returns it.
|
|
367
|
-
* Throws an error if the payload is undefined, which may occur if the entity was not queried with the withPayload option.
|
|
368
|
-
* Throws an error if the conversion from bytes to string fails.
|
|
369
|
-
* @returns The entity payload as a string.
|
|
370
|
-
*/
|
|
371
|
-
toText(): string;
|
|
372
|
-
/**
|
|
373
|
-
* Parses the entity payload as JSON and returns the resulting object.
|
|
374
|
-
* Throws an error if the payload is undefined, which may occur if the entity was not queried with the withPayload option.
|
|
375
|
-
* Throws an error if the payload is empty or cannot be parsed as JSON.
|
|
376
|
-
* @returns The parsed JSON object from the entity payload.
|
|
377
|
-
*/
|
|
378
|
-
toJson(): any;
|
|
379
|
-
}
|
|
380
|
-
//#endregion
|
|
381
|
-
export { RpcIncludeData as A, QueryOptionsIncludeData as C, ArkivClient as D, GetBlockTimingReturnType as E, RpcQueryOptions as M, MimeType as N, ArkivRpcSchema as O, QueryOptions as S, QueryReturnType as T, DeleteEntityReturnType as _, OnEntityExpiredEvent as a, ChangeOwnershipParameters as b, OnEntityUpdatedEvent as c, MutateEntitiesReturnType as d, UpdateEntityParameters as f, DeleteEntityParameters as g, ExtendEntityReturnType as h, OnEntityDeletedEvent as i, RpcOrderByAttribute as j, RpcEntity as k, Attribute as l, ExtendEntityParameters as m, TxParams as n, OnEntityExpiresInExtendedEvent as o, UpdateEntityReturnType as p, OnEntityCreatedEvent as r, OnEntityOwnerChangedEvent as s, Entity as t, MutateEntitiesParameters as u, CreateEntityParameters as v, QueryOptionsOrderBy as w, ChangeOwnershipReturnType as x, CreateEntityReturnType as y };
|
|
382
|
-
//# sourceMappingURL=entity-qoLMAuuk.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entity-qoLMAuuk.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,gBAAA,CAAA,EAAA,CAAA;IACI,GAAA,EAAA,MAAA;IACtB,KAAA,EAAA,MAAA;EACE,CAAA,CAAA;EAEkC,i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