@arkiv-network/sdk 0.6.8-dev.2 → 0.6.8-dev.4
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/consts-AUoL-v42.cjs +18 -0
- package/dist/consts-BV4PR-de.js +7 -0
- package/dist/consts-BV4PR-de.js.map +1 -0
- package/dist/{entity-BOra9GVW.d.ts → entity-BSU5-vyY.d.cts} +43 -6
- package/dist/entity-BSU5-vyY.d.cts.map +1 -0
- package/dist/{entity-B3qWIdug.d.cts → entity-CHiZ2Qu1.d.ts} +43 -6
- package/dist/entity-CHiZ2Qu1.d.ts.map +1 -0
- package/dist/{index-t3wvdqvC.d.ts → index-ByaanQGD.d.ts} +20 -16
- package/dist/index-ByaanQGD.d.ts.map +1 -0
- package/dist/{index-Dushe05u.d.cts → index-CS6sxVJC.d.cts} +20 -16
- package/dist/index-CS6sxVJC.d.cts.map +1 -0
- package/dist/index.cjs +61 -21
- package/dist/index.d.cts +27 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +28 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -19
- package/dist/index.js.map +1 -1
- package/dist/{payload-Da9gJMG5.d.ts → payload-B2kFJyah.d.ts} +1 -1
- package/dist/{payload-Da9gJMG5.d.ts.map → payload-B2kFJyah.d.ts.map} +1 -1
- package/dist/payload-Claf2jUO.js +13 -0
- package/dist/payload-Claf2jUO.js.map +1 -0
- package/dist/{payload-vwU3Rc6P.cjs → payload-DpA5PA-w.cjs} +0 -17
- package/dist/query/index.cjs +6 -27
- package/dist/query/index.d.cts +2 -2
- package/dist/query/index.d.ts +2 -2
- package/dist/query/index.js +6 -27
- package/dist/query/index.js.map +1 -1
- package/dist/{queryBuilder-D7iYS0vU.js → queryBuilder-C3XSUYpn.js} +17 -21
- package/dist/queryBuilder-C3XSUYpn.js.map +1 -0
- package/dist/{queryBuilder-BlMPfusd.cjs → queryBuilder-K0ZkQGnx.cjs} +27 -19
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/index.cjs +3 -2
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/actions/wallet/createEntity.ts +12 -2
- package/src/actions/wallet/extendEntity.ts +6 -1
- package/src/actions/wallet/updateEntity.ts +12 -2
- package/src/clients/decorators/arkivWallet.ts +18 -0
- package/src/errors.ts +18 -0
- package/src/query/predicate.test.ts +43 -0
- package/src/query/predicate.ts +14 -10
- package/src/query/queryBuilder.test.ts +22 -0
- package/src/query/queryBuilder.ts +12 -13
- package/src/types/attributes.ts +12 -0
- package/src/utils/arkivTransactions.test.ts +62 -0
- package/src/utils/arkivTransactions.ts +36 -27
- package/src/utils/validation.test.ts +60 -0
- package/src/utils/validation.ts +32 -0
- package/dist/entity-B3qWIdug.d.cts.map +0 -1
- package/dist/entity-BOra9GVW.d.ts.map +0 -1
- package/dist/index-Dushe05u.d.cts.map +0 -1
- package/dist/index-t3wvdqvC.d.ts.map +0 -1
- package/dist/payload-DKBYYjeA.js +0 -18
- package/dist/payload-DKBYYjeA.js.map +0 -1
- package/dist/queryBuilder-D7iYS0vU.js.map +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/consts.ts
|
|
3
|
+
const ARKIV_ADDRESS = "0x00000000000000000000000000000061726b6976";
|
|
4
|
+
const BLOCK_TIME = 2;
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
Object.defineProperty(exports, 'ARKIV_ADDRESS', {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return ARKIV_ADDRESS;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, 'BLOCK_TIME', {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return BLOCK_TIME;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts-BV4PR-de.js","names":[],"sources":["../src/consts.ts"],"sourcesContent":["export const ARKIV_ADDRESS = \"0x00000000000000000000000000000061726b6976\" as `0x${string}`\nexport const BLOCK_TIME = 2 // 2 seconds\n"],"mappings":";AAAA,MAAa,gBAAgB;AAC7B,MAAa,aAAa"}
|
|
@@ -128,14 +128,24 @@ type ChangeOwnershipReturnType = {
|
|
|
128
128
|
/**
|
|
129
129
|
* Parameters for the createEntity function.
|
|
130
130
|
* - payload: The payload of the entity.
|
|
131
|
-
* - attributes: The attributes of the entity.
|
|
131
|
+
* - attributes: The attributes of the entity. Attribute values may be strings
|
|
132
|
+
* or numbers, but numeric values **must be integers**. To store a non-integer,
|
|
133
|
+
* scale it to an integer (e.g. `1.5` -> `1500`) to preserve numeric ordering,
|
|
134
|
+
* or pass it as a string (e.g. `"1.5"`). A non-integer numeric value throws an
|
|
135
|
+
* {@link InvalidAttributeError}.
|
|
132
136
|
* - contentType: The content type of the entity.
|
|
133
|
-
* - expiresIn:
|
|
137
|
+
* - expiresIn: How long until the entity expires, in seconds. Because Arkiv
|
|
138
|
+
* measures expiration in blocks (1 block = 2 seconds), this **must be a
|
|
139
|
+
* positive integer and a multiple of the block time (2 seconds)**
|
|
140
|
+
* Invalid values throw an {@link InvalidExpirationError}.
|
|
134
141
|
*/
|
|
135
142
|
type CreateEntityParameters = {
|
|
136
143
|
payload: Uint8Array;
|
|
144
|
+
/** Entity attributes. Numeric values must be integers (scale non-integers, e.g. `1.5` -> `1500`, or use a string). Throws {@link InvalidAttributeError} otherwise. */
|
|
137
145
|
attributes: Attribute[];
|
|
138
146
|
contentType: MimeType | string;
|
|
147
|
+
/** Seconds until expiry. Must be a positive integer and a multiple of the 2s block time.
|
|
148
|
+
* Throws {@link InvalidExpirationError} otherwise. */
|
|
139
149
|
expiresIn: number;
|
|
140
150
|
};
|
|
141
151
|
/**
|
|
@@ -170,10 +180,15 @@ type DeleteEntityReturnType = {
|
|
|
170
180
|
/**
|
|
171
181
|
* Parameters for the extendEntity function.
|
|
172
182
|
* - entityKey: The key of the entity to extend.
|
|
173
|
-
* - expiresIn:
|
|
183
|
+
* - expiresIn: How long to extend the entity by, in seconds. Because Arkiv
|
|
184
|
+
* measures expiration in blocks (1 block = 2 seconds), this **must be a
|
|
185
|
+
* positive integer and a multiple of the block time (2 seconds)**.
|
|
186
|
+
* Invalid values throw an {@link InvalidExpirationError}.
|
|
174
187
|
*/
|
|
175
188
|
type ExtendEntityParameters = {
|
|
176
189
|
entityKey: Hex;
|
|
190
|
+
/** Seconds to extend by. Must be a positive integer and a multiple of the 2s block time.
|
|
191
|
+
* Throws {@link InvalidExpirationError} otherwise. */
|
|
177
192
|
expiresIn: number;
|
|
178
193
|
};
|
|
179
194
|
/**
|
|
@@ -191,15 +206,25 @@ type ExtendEntityReturnType = {
|
|
|
191
206
|
* Parameters for the updateEntity function.
|
|
192
207
|
* - entityKey: The key of the entity to update.
|
|
193
208
|
* - payload: The payload of the entity.
|
|
194
|
-
* - attributes: The attributes of the entity.
|
|
209
|
+
* - attributes: The attributes of the entity. Attribute values may be strings
|
|
210
|
+
* or numbers, but numeric values **must be integers**. To store a non-integer,
|
|
211
|
+
* scale it to an integer (e.g. `1.5` -> `1500`) to preserve numeric ordering,
|
|
212
|
+
* or pass it as a string (e.g. `"1.5"`). A non-integer numeric value throws an
|
|
213
|
+
* {@link InvalidAttributeError}.
|
|
195
214
|
* - contentType: The content type of the entity.
|
|
196
|
-
* - expiresIn:
|
|
215
|
+
* - expiresIn: How long until the entity expires, in seconds. Because Arkiv
|
|
216
|
+
* measures expiration in blocks (1 block = 2 seconds), this **must be a
|
|
217
|
+
* positive integer and a multiple of the block time (2 seconds)**.
|
|
218
|
+
* Invalid values throw an {@link InvalidExpirationError}.
|
|
197
219
|
*/
|
|
198
220
|
type UpdateEntityParameters = {
|
|
199
221
|
entityKey: Hex;
|
|
200
222
|
payload: Uint8Array;
|
|
223
|
+
/** Entity attributes. Numeric values must be integers (scale non-integers, e.g. `1.5` -> `1500`, or use a string). Throws {@link InvalidAttributeError} otherwise. */
|
|
201
224
|
attributes: Attribute[];
|
|
202
225
|
contentType: MimeType | string;
|
|
226
|
+
/** Seconds until expiry. Must be a positive integer and a multiple of the 2s block time.
|
|
227
|
+
* Throws {@link InvalidExpirationError} otherwise. */
|
|
203
228
|
expiresIn: number;
|
|
204
229
|
};
|
|
205
230
|
/**
|
|
@@ -246,8 +271,20 @@ type MutateEntitiesReturnType = {
|
|
|
246
271
|
};
|
|
247
272
|
//#endregion
|
|
248
273
|
//#region src/types/attributes.d.ts
|
|
274
|
+
/**
|
|
275
|
+
* An entity attribute (key/value pair).
|
|
276
|
+
*
|
|
277
|
+
* Arkiv supports both string and number values. Numeric values **must be
|
|
278
|
+
* integers** — passing a non-integer number (e.g. `1.5`) throws an
|
|
279
|
+
* {@link InvalidAttributeError} at mutation time. To store a non-integer value:
|
|
280
|
+
* - Scale it to an integer (e.g. `1.5` -> `1500`, dividing by the same factor on
|
|
281
|
+
* read) to keep numeric ordering and range queries working.
|
|
282
|
+
* - Or pass it as a string (e.g. `"1.5"`), which sorts lexicographically and so
|
|
283
|
+
* does not support numeric comparisons.
|
|
284
|
+
*/
|
|
249
285
|
type Attribute = {
|
|
250
286
|
key: string;
|
|
287
|
+
/** Attribute value. A `number` must be an integer (scale non-integers, e.g. `1.5` -> `1500`, or use a string). Throws {@link InvalidAttributeError} otherwise. */
|
|
251
288
|
value: string | number;
|
|
252
289
|
};
|
|
253
290
|
//#endregion
|
|
@@ -332,4 +369,4 @@ declare class Entity {
|
|
|
332
369
|
}
|
|
333
370
|
//#endregion
|
|
334
371
|
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 };
|
|
335
|
-
//# sourceMappingURL=entity-
|
|
372
|
+
//# sourceMappingURL=entity-BSU5-vyY.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-BSU5-vyY.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,gBAAA,CAAA,EAAA,CAAA;IACI,GAAA,EAAA,MAAA;IACtB,KAAA,EAAA,MAAA;EACE,CAAA,CAAA;EAEkC,iBAAA,CAAA,EAAA,CAAA;IAAG,GAAA,EAAA,MAAA;IAGpC,KAAA,EAHiC,GAGjC;EAMA,CAAA,CAAA;CACA;AACI,KARJ,mBA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: The payload of the entity.
|
|
131
|
-
* - attributes: The attributes of the entity.
|
|
131
|
+
* - attributes: The attributes of the entity. Attribute values may be strings
|
|
132
|
+
* or numbers, but numeric values **must be integers**. To store a non-integer,
|
|
133
|
+
* scale it to an integer (e.g. `1.5` -> `1500`) to preserve numeric ordering,
|
|
134
|
+
* or pass it as a string (e.g. `"1.5"`). A non-integer numeric value throws an
|
|
135
|
+
* {@link InvalidAttributeError}.
|
|
132
136
|
* - contentType: The content type of the entity.
|
|
133
|
-
* - expiresIn:
|
|
137
|
+
* - expiresIn: How long until the entity expires, in seconds. Because Arkiv
|
|
138
|
+
* measures expiration in blocks (1 block = 2 seconds), this **must be a
|
|
139
|
+
* positive integer and a multiple of the block time (2 seconds)**
|
|
140
|
+
* Invalid values throw an {@link InvalidExpirationError}.
|
|
134
141
|
*/
|
|
135
142
|
type CreateEntityParameters = {
|
|
136
143
|
payload: Uint8Array;
|
|
144
|
+
/** Entity attributes. Numeric values must be integers (scale non-integers, e.g. `1.5` -> `1500`, or use a string). Throws {@link InvalidAttributeError} otherwise. */
|
|
137
145
|
attributes: Attribute[];
|
|
138
146
|
contentType: MimeType | string;
|
|
147
|
+
/** Seconds until expiry. Must be a positive integer and a multiple of the 2s block time.
|
|
148
|
+
* Throws {@link InvalidExpirationError} otherwise. */
|
|
139
149
|
expiresIn: number;
|
|
140
150
|
};
|
|
141
151
|
/**
|
|
@@ -170,10 +180,15 @@ type DeleteEntityReturnType = {
|
|
|
170
180
|
/**
|
|
171
181
|
* Parameters for the extendEntity function.
|
|
172
182
|
* - entityKey: The key of the entity to extend.
|
|
173
|
-
* - expiresIn:
|
|
183
|
+
* - expiresIn: How long to extend the entity by, in seconds. Because Arkiv
|
|
184
|
+
* measures expiration in blocks (1 block = 2 seconds), this **must be a
|
|
185
|
+
* positive integer and a multiple of the block time (2 seconds)**.
|
|
186
|
+
* Invalid values throw an {@link InvalidExpirationError}.
|
|
174
187
|
*/
|
|
175
188
|
type ExtendEntityParameters = {
|
|
176
189
|
entityKey: Hex;
|
|
190
|
+
/** Seconds to extend by. Must be a positive integer and a multiple of the 2s block time.
|
|
191
|
+
* Throws {@link InvalidExpirationError} otherwise. */
|
|
177
192
|
expiresIn: number;
|
|
178
193
|
};
|
|
179
194
|
/**
|
|
@@ -191,15 +206,25 @@ type ExtendEntityReturnType = {
|
|
|
191
206
|
* Parameters for the updateEntity function.
|
|
192
207
|
* - entityKey: The key of the entity to update.
|
|
193
208
|
* - payload: The payload of the entity.
|
|
194
|
-
* - attributes: The attributes of the entity.
|
|
209
|
+
* - attributes: The attributes of the entity. Attribute values may be strings
|
|
210
|
+
* or numbers, but numeric values **must be integers**. To store a non-integer,
|
|
211
|
+
* scale it to an integer (e.g. `1.5` -> `1500`) to preserve numeric ordering,
|
|
212
|
+
* or pass it as a string (e.g. `"1.5"`). A non-integer numeric value throws an
|
|
213
|
+
* {@link InvalidAttributeError}.
|
|
195
214
|
* - contentType: The content type of the entity.
|
|
196
|
-
* - expiresIn:
|
|
215
|
+
* - expiresIn: How long until the entity expires, in seconds. Because Arkiv
|
|
216
|
+
* measures expiration in blocks (1 block = 2 seconds), this **must be a
|
|
217
|
+
* positive integer and a multiple of the block time (2 seconds)**.
|
|
218
|
+
* Invalid values throw an {@link InvalidExpirationError}.
|
|
197
219
|
*/
|
|
198
220
|
type UpdateEntityParameters = {
|
|
199
221
|
entityKey: Hex;
|
|
200
222
|
payload: Uint8Array;
|
|
223
|
+
/** Entity attributes. Numeric values must be integers (scale non-integers, e.g. `1.5` -> `1500`, or use a string). Throws {@link InvalidAttributeError} otherwise. */
|
|
201
224
|
attributes: Attribute[];
|
|
202
225
|
contentType: MimeType | string;
|
|
226
|
+
/** Seconds until expiry. Must be a positive integer and a multiple of the 2s block time.
|
|
227
|
+
* Throws {@link InvalidExpirationError} otherwise. */
|
|
203
228
|
expiresIn: number;
|
|
204
229
|
};
|
|
205
230
|
/**
|
|
@@ -246,8 +271,20 @@ type MutateEntitiesReturnType = {
|
|
|
246
271
|
};
|
|
247
272
|
//#endregion
|
|
248
273
|
//#region src/types/attributes.d.ts
|
|
274
|
+
/**
|
|
275
|
+
* An entity attribute (key/value pair).
|
|
276
|
+
*
|
|
277
|
+
* Arkiv supports both string and number values. Numeric values **must be
|
|
278
|
+
* integers** — passing a non-integer number (e.g. `1.5`) throws an
|
|
279
|
+
* {@link InvalidAttributeError} at mutation time. To store a non-integer value:
|
|
280
|
+
* - Scale it to an integer (e.g. `1.5` -> `1500`, dividing by the same factor on
|
|
281
|
+
* read) to keep numeric ordering and range queries working.
|
|
282
|
+
* - Or pass it as a string (e.g. `"1.5"`), which sorts lexicographically and so
|
|
283
|
+
* does not support numeric comparisons.
|
|
284
|
+
*/
|
|
249
285
|
type Attribute = {
|
|
250
286
|
key: string;
|
|
287
|
+
/** Attribute value. A `number` must be an integer (scale non-integers, e.g. `1.5` -> `1500`, or use a string). Throws {@link InvalidAttributeError} otherwise. */
|
|
251
288
|
value: string | number;
|
|
252
289
|
};
|
|
253
290
|
//#endregion
|
|
@@ -332,4 +369,4 @@ declare class Entity {
|
|
|
332
369
|
}
|
|
333
370
|
//#endregion
|
|
334
371
|
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 };
|
|
335
|
-
//# sourceMappingURL=entity-
|
|
372
|
+
//# sourceMappingURL=entity-CHiZ2Qu1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-CHiZ2Qu1.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,iBAAA,CAAA,EAAA,CAAA;IAAG,GAAA,EAAA,MAAA;IAGpC,KAAA,EAHiC,GAGjC;EAMA,CAAA,CAAA;CACA;AACI,KARJ,mBAAA,GAQI;EACJ,IAAA,EAAA,MAAA;EACO,IAAA,EAAA,QAAA,GAAA,SAAA;EAAG,IAAA,EAAA,OAAA;AAItB,CAAA;AAcY,KAtBA,eAAA,GAsBc;EAGsB,OAAA,CAAA,EAxBpC,GAwBoC;EAEpC,WAAA,CAAA,EAzBI,cAyBJ;EACO,OAAA,CAAA,EAzBP,mBAyBO,EAAA;EAAG,cAAA,CAAA,EAxBH,GAwBG;;;KApBV,cAAA;EC7BA,GAAA,CAAA,EAAA,OAAA;EACQ,UAAA,CAAA,EAAA,O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GAAA,SAAA;EACd,cAAA,EAAA,MAAA,GAAA,SAAA;EACQ,cAAA,EAAA,MAAA,GAAA,SAAA;EAEF,mBAAA,EAAA,MAAA,GAAA,SAAA;EACK,uBAAA,EAAA,MAAA,GAAA,SAAA;EACK,2BAAA,EAAA,MAAA,GAAA,SAAA;EACI,OAAA,EaIhB,UbJgB,GAAA,SAAA;EACI,UAAA,EaIjB,SbJiB,EAAA;EACtB,WAAA,CAAA,GAAA,EaMA,GbNA,EAAA,WAAA,EaOQ,QbPR,GAAA,SAAA,EAAA,KAAA,EaQE,GbRF,GAAA,SAAA,EAAA,OAAA,EaSI,GbTJ,GAAA,SAAA,EAAA,cAAA,EAAA,MAAA,GAAA,SAAA,EAAA,cAAA,EAAA,MAAA,GAAA,SAAA,EAAA,mBAAA,EAAA,MAAA,GAAA,SAAA,EAAA,uBAAA,EAAA,MAAA,GAAA,SAAA,EAAA,2BAAA,EAAA,MAAA,GAAA,SAAA,EAAA,OAAA,EaeI,UbfJ,GAAA,SAAA,EAAA,UAAA,EagBO,SbhBP,EAAA;EACE;;;AAKX;AAMA;;EAEgB,MAAA,CAAA,CAAA,EAAA,MAAA;EACJ;;;AAKZ;AAcA;;EAKY,MAAA,CAAA,CAAA,EAAA,GAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as RpcIncludeData, D as ArkivClient, j as RpcOrderByAttribute, k as RpcEntity, t as Entity } from "./entity-
|
|
1
|
+
import { A as RpcIncludeData, D as ArkivClient, j as RpcOrderByAttribute, k as RpcEntity, t as Entity } from "./entity-CHiZ2Qu1.js";
|
|
2
2
|
import { Hex } from "viem";
|
|
3
3
|
|
|
4
4
|
//#region src/query/predicate.d.ts
|
|
@@ -14,28 +14,30 @@ type Predicate = {
|
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
16
|
* Creates an OR predicate
|
|
17
|
-
* @param predicates - The predicates to combine
|
|
17
|
+
* @param predicates - The predicates to combine, either as a single array or as separate arguments
|
|
18
18
|
* @returns The OR predicate
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
21
|
-
* const
|
|
22
|
-
*
|
|
21
|
+
* const result = or(eq("name", "John"), eq("age", 30))
|
|
22
|
+
* // or equivalently: or([eq("name", "John"), eq("age", 30)])
|
|
23
23
|
* // result = { type: "or", predicates: [eq("name", "John"), eq("age", 30)] }
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
26
|
declare function or(predicates: Predicate[]): Predicate;
|
|
27
|
+
declare function or(...predicates: Predicate[]): Predicate;
|
|
27
28
|
/**
|
|
28
29
|
* Creates an AND predicate
|
|
29
|
-
* @param predicates - The predicates to combine
|
|
30
|
+
* @param predicates - The predicates to combine, either as a single array or as separate arguments
|
|
30
31
|
* @returns The AND predicate
|
|
31
32
|
*
|
|
32
33
|
* @example
|
|
33
|
-
* const
|
|
34
|
-
*
|
|
34
|
+
* const result = and(eq("name", "John"), eq("age", 30))
|
|
35
|
+
* // or equivalently: and([eq("name", "John"), eq("age", 30)])
|
|
35
36
|
* // result = { type: "and", predicates: [eq("name", "John"), eq("age", 30)] }
|
|
36
37
|
*
|
|
37
38
|
*/
|
|
38
39
|
declare function and(predicates: Predicate[]): Predicate;
|
|
40
|
+
declare function and(...predicates: Predicate[]): Predicate;
|
|
39
41
|
/**
|
|
40
42
|
* Creates an equality predicate
|
|
41
43
|
* @param key - The key to compare
|
|
@@ -325,22 +327,24 @@ declare abstract class BaseQueryBuilder<TEntity> {
|
|
|
325
327
|
*/
|
|
326
328
|
validAtBlock(validAtBlock: bigint): this;
|
|
327
329
|
/**
|
|
328
|
-
* Sets the predicates for the query limiting the results. It can be a single predicate
|
|
330
|
+
* Sets the predicates for the query limiting the results. It can be a single predicate,
|
|
331
|
+
* multiple predicates passed as separate arguments, or an array of predicates - all combined with 'and'.
|
|
329
332
|
* Predicates can be nested using 'or' and 'and' predicates.
|
|
330
|
-
* @param predicates - The predicates to set
|
|
333
|
+
* @param predicates - The predicates to set, either as a single array or as separate arguments
|
|
331
334
|
* @returns The query builder instance
|
|
332
335
|
*
|
|
333
336
|
* @example
|
|
334
337
|
* const builder = client.select()
|
|
335
338
|
* builder.where(eq("name", "John"))
|
|
339
|
+
* builder.where(eq("name", "John"), eq("age", 30))
|
|
336
340
|
* builder.where([eq("name", "John"), eq("age", 30)])
|
|
337
|
-
* builder.where(
|
|
338
|
-
* builder.where(
|
|
339
|
-
* builder.where(
|
|
340
|
-
* builder.where(
|
|
341
|
-
* builder.where([eq("name", "John"), and([eq("age", 30), or([eq("age", 31), and([eq("age", 32), eq("age", 33)])])])])
|
|
341
|
+
* builder.where(eq("name", "John"), or(eq("age", 30), eq("age", 31)))
|
|
342
|
+
* builder.where(eq("name", "John"), and(eq("age", 30), eq("age", 31)))
|
|
343
|
+
* builder.where(eq("name", "John"), or(eq("age", 30), and(eq("age", 31), eq("age", 32))))
|
|
344
|
+
* builder.where(eq("name", "John"), and(eq("age", 30), or(eq("age", 31), eq("age", 32))))
|
|
342
345
|
*/
|
|
343
|
-
where(predicates: Predicate[]
|
|
346
|
+
where(predicates: Predicate[]): this;
|
|
347
|
+
where(...predicates: Predicate[]): this;
|
|
344
348
|
/**
|
|
345
349
|
* Returns the data-selection parameters forwarded to the query engine.
|
|
346
350
|
* Subclasses decide which parts of an entity are fetched.
|
|
@@ -453,4 +457,4 @@ declare class SelectQueryBuilder<TEntity> extends BaseQueryBuilder<TEntity> {
|
|
|
453
457
|
}
|
|
454
458
|
//#endregion
|
|
455
459
|
export { neq as C, lte as S, or as T, and as _, asc as a, gte as b, FullEntity as c, SelectionFields as d, selectionToIncludeData as f, PredicateType as g, PredicateContainerType as h, SelectQueryBuilder as i, ProjectedEntity as l, Predicate as m, OrderByAttribute as n, desc as o, QueryResult as p, QueryBuilder as r, EntitySelection as s, BaseQueryBuilder as t, SelectArg as u, eq as v, not as w, lt as x, gt as y };
|
|
456
|
-
//# sourceMappingURL=index-
|
|
460
|
+
//# sourceMappingURL=index-ByaanQGD.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-ByaanQGD.d.ts","names":[],"sources":["../src/query/predicate.ts","../src/query/queryResult.ts","../src/query/selection.ts","../src/query/queryBuilder.ts"],"sourcesContent":[],"mappings":";;;;KAAY,aAAA;KACA,sBAAA;KAEA,SAAA;QAEA;EALA,GAAA,EAAA,MAAA;EACA,KAAA,EAAA,MAAA,GAAA,MAAA;AAEZ,CAAA,GAAY;EAEA,IAAA,EAKA,sBALA;EAKA,UAAA,EACM,SADN,EAAA;CACM;;AAclB;AACA;AAgBA;AACA;AAeA;AAcA;AAcA;AAcA;AAcA;AAcA;AAagB,iBApHA,EAAA,CAoHkB,UAAS,EApHZ,SAoHY,EAAA,CAAA,EApHE,SAoHF;iBAnH3B,EAAA,gBAAkB,cAAc;;;ACbhD;;;;;;;;;AAgCY,iBDHI,GAAA,CCGJ,UAAA,EDHoB,SCGpB,EAAA,CAAA,EDHkC,SCGlC;iBDFI,GAAA,gBAAmB,cAAc;;;AE1CO;AAoBxD;AAA0D;;;;;;AAOrC,iBF8BL,EAAA,CE9BK,GAAA,EAAA,MAAA,EAAA,KAAA,EAAA,MAAA,GAAA,MAAA,CAAA,EF8BoC,SE9BpC;;;;;;;;AAOrB;AAGA;AAWA;AACuB,iBFsBP,GAAA,CEtBO,GAAA,EAAA,MAAA,EAAA,KAAA,EAAA,MAAA,GAAA,MAAA,CAAA,EFsBmC,SEtBnC;;;;;;;;;;;AAGY,iBFiCnB,EAAA,CEjCmB,GAAA,EAAA,MAAA,EAAA,KAAA,EAAA,MAAA,GAAA,MAAA,CAAA,EFiCsB,SEjCtB;;AAA4C;AAM/E;AAiBA;;;;AClEA;AAeA;AAiBA;AAYK,iBH8CW,GAAA,CG9CI,GAAA,EAAA,MAIJ,EAAA,KAAA,EAAA,MAAc,GAAA,MAAA,CAAA,EH0C4B,SG1C5B;AAa9B;;;;;;;;;;AAsKoB,iBH3HJ,EAAA,CG2HI,GAAA,EAAA,MAAA,EAAA,KAAA,EA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AAQ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as RpcIncludeData, D as ArkivClient, j as RpcOrderByAttribute, k as RpcEntity, t as Entity } from "./entity-
|
|
1
|
+
import { A as RpcIncludeData, D as ArkivClient, j as RpcOrderByAttribute, k as RpcEntity, t as Entity } from "./entity-BSU5-vyY.cjs";
|
|
2
2
|
import { Hex } from "viem";
|
|
3
3
|
|
|
4
4
|
//#region src/query/predicate.d.ts
|
|
@@ -14,28 +14,30 @@ type Predicate = {
|
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
16
|
* Creates an OR predicate
|
|
17
|
-
* @param predicates - The predicates to combine
|
|
17
|
+
* @param predicates - The predicates to combine, either as a single array or as separate arguments
|
|
18
18
|
* @returns The OR predicate
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
21
|
-
* const
|
|
22
|
-
*
|
|
21
|
+
* const result = or(eq("name", "John"), eq("age", 30))
|
|
22
|
+
* // or equivalently: or([eq("name", "John"), eq("age", 30)])
|
|
23
23
|
* // result = { type: "or", predicates: [eq("name", "John"), eq("age", 30)] }
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
26
|
declare function or(predicates: Predicate[]): Predicate;
|
|
27
|
+
declare function or(...predicates: Predicate[]): Predicate;
|
|
27
28
|
/**
|
|
28
29
|
* Creates an AND predicate
|
|
29
|
-
* @param predicates - The predicates to combine
|
|
30
|
+
* @param predicates - The predicates to combine, either as a single array or as separate arguments
|
|
30
31
|
* @returns The AND predicate
|
|
31
32
|
*
|
|
32
33
|
* @example
|
|
33
|
-
* const
|
|
34
|
-
*
|
|
34
|
+
* const result = and(eq("name", "John"), eq("age", 30))
|
|
35
|
+
* // or equivalently: and([eq("name", "John"), eq("age", 30)])
|
|
35
36
|
* // result = { type: "and", predicates: [eq("name", "John"), eq("age", 30)] }
|
|
36
37
|
*
|
|
37
38
|
*/
|
|
38
39
|
declare function and(predicates: Predicate[]): Predicate;
|
|
40
|
+
declare function and(...predicates: Predicate[]): Predicate;
|
|
39
41
|
/**
|
|
40
42
|
* Creates an equality predicate
|
|
41
43
|
* @param key - The key to compare
|
|
@@ -325,22 +327,24 @@ declare abstract class BaseQueryBuilder<TEntity> {
|
|
|
325
327
|
*/
|
|
326
328
|
validAtBlock(validAtBlock: bigint): this;
|
|
327
329
|
/**
|
|
328
|
-
* Sets the predicates for the query limiting the results. It can be a single predicate
|
|
330
|
+
* Sets the predicates for the query limiting the results. It can be a single predicate,
|
|
331
|
+
* multiple predicates passed as separate arguments, or an array of predicates - all combined with 'and'.
|
|
329
332
|
* Predicates can be nested using 'or' and 'and' predicates.
|
|
330
|
-
* @param predicates - The predicates to set
|
|
333
|
+
* @param predicates - The predicates to set, either as a single array or as separate arguments
|
|
331
334
|
* @returns The query builder instance
|
|
332
335
|
*
|
|
333
336
|
* @example
|
|
334
337
|
* const builder = client.select()
|
|
335
338
|
* builder.where(eq("name", "John"))
|
|
339
|
+
* builder.where(eq("name", "John"), eq("age", 30))
|
|
336
340
|
* builder.where([eq("name", "John"), eq("age", 30)])
|
|
337
|
-
* builder.where(
|
|
338
|
-
* builder.where(
|
|
339
|
-
* builder.where(
|
|
340
|
-
* builder.where(
|
|
341
|
-
* builder.where([eq("name", "John"), and([eq("age", 30), or([eq("age", 31), and([eq("age", 32), eq("age", 33)])])])])
|
|
341
|
+
* builder.where(eq("name", "John"), or(eq("age", 30), eq("age", 31)))
|
|
342
|
+
* builder.where(eq("name", "John"), and(eq("age", 30), eq("age", 31)))
|
|
343
|
+
* builder.where(eq("name", "John"), or(eq("age", 30), and(eq("age", 31), eq("age", 32))))
|
|
344
|
+
* builder.where(eq("name", "John"), and(eq("age", 30), or(eq("age", 31), eq("age", 32))))
|
|
342
345
|
*/
|
|
343
|
-
where(predicates: Predicate[]
|
|
346
|
+
where(predicates: Predicate[]): this;
|
|
347
|
+
where(...predicates: Predicate[]): this;
|
|
344
348
|
/**
|
|
345
349
|
* Returns the data-selection parameters forwarded to the query engine.
|
|
346
350
|
* Subclasses decide which parts of an entity are fetched.
|
|
@@ -453,4 +457,4 @@ declare class SelectQueryBuilder<TEntity> extends BaseQueryBuilder<TEntity> {
|
|
|
453
457
|
}
|
|
454
458
|
//#endregion
|
|
455
459
|
export { neq as C, lte as S, or as T, and as _, asc as a, gte as b, FullEntity as c, SelectionFields as d, selectionToIncludeData as f, PredicateType as g, PredicateContainerType as h, SelectQueryBuilder as i, ProjectedEntity as l, Predicate as m, OrderByAttribute as n, desc as o, QueryResult as p, QueryBuilder as r, EntitySelection as s, BaseQueryBuilder as t, SelectArg as u, eq as v, not as w, lt as x, gt as y };
|
|
456
|
-
//# sourceMappingURL=index-
|
|
460
|
+
//# sourceMappingURL=index-CS6sxVJC.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CS6sxVJC.d.cts","names":[],"sources":["../src/query/predicate.ts","../src/query/queryResult.ts","../src/query/selection.ts","../src/query/queryBuilder.ts"],"sourcesContent":[],"mappings":";;;;KAAY,aAAA;KACA,sBAAA;KAEA,SAAA;QAEA;EALA,GAAA,EAAA,MAAA;EACA,KAAA,EAAA,MAAA,GAAA,MAAA;AAEZ,CAAA,GAAY;EAEA,IAAA,EAKA,sBALA;EAKA,UAAA,EACM,SADN,EAAA;CACM;;AAclB;AACA;AAgBA;AACA;AAeA;AAcA;AAcA;AAcA;AAcA;AAcA;AAagB,iBApHA,EAAA,CAoHkB,UAAS,EApHZ,SAoHY,EAAA,CAAA,EApHE,SAoHF;iBAnH3B,EAAA,gBAAkB,cAAc;;;ACbhD;;;;;;;;;AAgCY,iBDHI,GAAA,CCGJ,UAAA,EDHoB,SCGpB,EAAA,CAAA,EDHkC,SCGlC;iBDFI,GAAA,gBAAmB,cAAc;;;AE1CO;AAoBxD;AAA0D;;;;;;AAOrC,iBF8BL,EAAA,CE9BK,GAAA,EAAA,MAAA,EAAA,KAAA,EAAA,MAAA,GAAA,MAAA,CAAA,EF8BoC,SE9BpC;;;;;;;;AAOrB;AAGA;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;;;;;;;;AAgFA;EAAkE,OAAA,CAAA,gBAAA,EAzQtC,gBAyQsC,CAAA,EAAA,IAAA;EAG5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA9KF;uBACG;;;;;wCAUiB;;;;;8CAMM,YAAY,UAAU,QAAQ;;;;;;;;;;;WAY3D,QAAQ,YAAY;;;;;;;;;;WA6BxB;;;;;;;;;;;;;;;;;cAiCA,YAAA,SAAqB,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BA+CpB;qCAQM,YAAY,QAAQ;;;;;;;;;;;;;;;;;;;;;;cAyB5C,oCAAoC,iBAAiB;;sBAG5C,yBAAyB;+BAKhB;qCAIY,YAAY,QAAQ"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const require_chains = require('./chains-BifaY04V.cjs');
|
|
2
|
-
const require_queryBuilder = require('./queryBuilder-
|
|
3
|
-
const
|
|
2
|
+
const require_queryBuilder = require('./queryBuilder-K0ZkQGnx.cjs');
|
|
3
|
+
const require_consts = require('./consts-AUoL-v42.cjs');
|
|
4
4
|
require('./types-o3zWarRp.cjs');
|
|
5
|
+
const require_payload = require('./payload-DpA5PA-w.cjs');
|
|
5
6
|
let viem = require("viem");
|
|
6
7
|
|
|
7
8
|
//#region src/actions/public/getBlockTiming.ts
|
|
@@ -282,6 +283,32 @@ async function compress(data) {
|
|
|
282
283
|
return brotliCompressed;
|
|
283
284
|
}
|
|
284
285
|
|
|
286
|
+
//#endregion
|
|
287
|
+
//#region src/utils/validation.ts
|
|
288
|
+
/**
|
|
289
|
+
* Expiration on Arkiv is measured in blocks (1 block =
|
|
290
|
+
* 2 seconds), so the value must be a positive integer that is
|
|
291
|
+
* a multiple of the block time.
|
|
292
|
+
*
|
|
293
|
+
* @param expiresIn - The expiration in seconds.
|
|
294
|
+
* @throws {InvalidExpirationError} If the value is not a positive integer that
|
|
295
|
+
* is a multiple of the block time.
|
|
296
|
+
*/
|
|
297
|
+
function validateExpiresIn(expiresIn) {
|
|
298
|
+
if (!Number.isInteger(expiresIn) || expiresIn <= 0 || expiresIn % require_consts.BLOCK_TIME !== 0) throw new require_queryBuilder.InvalidExpirationError(expiresIn);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Validates a single attribute. Arkiv supports string and number attribute
|
|
302
|
+
* values, but numeric values must be integers.
|
|
303
|
+
*
|
|
304
|
+
* @param attribute - The attribute to validate.
|
|
305
|
+
* @throws {InvalidAttributeError} If the attribute has a non-integer numeric
|
|
306
|
+
* value.
|
|
307
|
+
*/
|
|
308
|
+
function validateAttribute(attribute) {
|
|
309
|
+
if (typeof attribute.value === "number" && !Number.isInteger(attribute.value)) throw new require_queryBuilder.InvalidAttributeError(attribute.key, attribute.value);
|
|
310
|
+
}
|
|
311
|
+
|
|
285
312
|
//#endregion
|
|
286
313
|
//#region src/utils/arkivTransactions.ts
|
|
287
314
|
const logger$6 = require_queryBuilder.getLogger("utils:arkiv-transactions");
|
|
@@ -290,23 +317,34 @@ function opsToTxData({ creates, updates, deletes, extensions, ownershipChanges }
|
|
|
290
317
|
return [(0, viem.toHex)(attribute.key), (0, viem.toHex)(typeof attribute.value === "number" && attribute.value === 0 ? "" : attribute.value)];
|
|
291
318
|
}
|
|
292
319
|
const payload = [
|
|
293
|
-
(creates ?? []).map((item) =>
|
|
294
|
-
(
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
item.
|
|
306
|
-
item.attributes.
|
|
307
|
-
|
|
320
|
+
(creates ?? []).map((item) => {
|
|
321
|
+
validateExpiresIn(item.expiresIn);
|
|
322
|
+
item.attributes.forEach(validateAttribute);
|
|
323
|
+
return [
|
|
324
|
+
(0, viem.toHex)(item.expiresIn / require_consts.BLOCK_TIME),
|
|
325
|
+
(0, viem.toHex)(item.contentType),
|
|
326
|
+
(0, viem.toHex)(item.payload),
|
|
327
|
+
item.attributes.filter((attribute) => typeof attribute.value === "string").map(formatAttributes),
|
|
328
|
+
item.attributes.filter((attribute) => typeof attribute.value === "number").map(formatAttributes)
|
|
329
|
+
];
|
|
330
|
+
}),
|
|
331
|
+
(updates ?? []).map((item) => {
|
|
332
|
+
validateExpiresIn(item.expiresIn);
|
|
333
|
+
item.attributes.forEach(validateAttribute);
|
|
334
|
+
return [
|
|
335
|
+
item.entityKey,
|
|
336
|
+
(0, viem.toHex)(item.contentType),
|
|
337
|
+
(0, viem.toHex)(item.expiresIn / require_consts.BLOCK_TIME),
|
|
338
|
+
(0, viem.toHex)(item.payload),
|
|
339
|
+
item.attributes.filter((attribute) => typeof attribute.value === "string").map(formatAttributes),
|
|
340
|
+
item.attributes.filter((attribute) => typeof attribute.value === "number").map(formatAttributes)
|
|
341
|
+
];
|
|
342
|
+
}),
|
|
308
343
|
(deletes ?? []).map((item) => item.entityKey),
|
|
309
|
-
(extensions ?? []).map((item) =>
|
|
344
|
+
(extensions ?? []).map((item) => {
|
|
345
|
+
validateExpiresIn(item.expiresIn);
|
|
346
|
+
return [item.entityKey, (0, viem.toHex)(item.expiresIn / require_consts.BLOCK_TIME)];
|
|
347
|
+
}),
|
|
310
348
|
(ownershipChanges ?? []).map((item) => [item.entityKey, item.newOwner])
|
|
311
349
|
];
|
|
312
350
|
logger$6("txData to send as RLP %o length %d", payload, payload.length);
|
|
@@ -318,7 +356,7 @@ async function sendArkivTransaction(client, data, txParams) {
|
|
|
318
356
|
logger$6("Sending transaction %o", {
|
|
319
357
|
account: client.account,
|
|
320
358
|
chain: client.chain,
|
|
321
|
-
to:
|
|
359
|
+
to: require_consts.ARKIV_ADDRESS,
|
|
322
360
|
value: 0n,
|
|
323
361
|
data,
|
|
324
362
|
...txParams
|
|
@@ -328,7 +366,7 @@ async function sendArkivTransaction(client, data, txParams) {
|
|
|
328
366
|
const txHash = await walletClient.sendTransaction({
|
|
329
367
|
account: client.account,
|
|
330
368
|
chain: client.chain,
|
|
331
|
-
to:
|
|
369
|
+
to: require_consts.ARKIV_ADDRESS,
|
|
332
370
|
value: 0n,
|
|
333
371
|
data: (0, viem.toHex)(compressed),
|
|
334
372
|
...txParams
|
|
@@ -338,7 +376,7 @@ async function sendArkivTransaction(client, data, txParams) {
|
|
|
338
376
|
if (receipt.status === "reverted") try {
|
|
339
377
|
const callResult = await walletClient.call({
|
|
340
378
|
account: client.account,
|
|
341
|
-
to:
|
|
379
|
+
to: require_consts.ARKIV_ADDRESS,
|
|
342
380
|
value: 0n,
|
|
343
381
|
data: (0, viem.toHex)(compressed),
|
|
344
382
|
...txParams
|
|
@@ -535,6 +573,8 @@ function chainFromName(name) {
|
|
|
535
573
|
|
|
536
574
|
//#endregion
|
|
537
575
|
exports.EntityMutationError = require_queryBuilder.EntityMutationError;
|
|
576
|
+
exports.InvalidAttributeError = require_queryBuilder.InvalidAttributeError;
|
|
577
|
+
exports.InvalidExpirationError = require_queryBuilder.InvalidExpirationError;
|
|
538
578
|
exports.NoCursorOrLimitError = require_queryBuilder.NoCursorOrLimitError;
|
|
539
579
|
exports.NoEntityFoundError = require_queryBuilder.NoEntityFoundError;
|
|
540
580
|
exports.NoMoreResultsError = require_queryBuilder.NoMoreResultsError;
|