@arkiv-network/sdk 0.8.0-advanced.2 → 0.8.0-advanced.3
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/actions/advanced/index.cjs +6 -6
- package/dist/actions/advanced/index.d.cts +5 -5
- package/dist/actions/advanced/index.d.ts +6 -6
- package/dist/actions/advanced/index.js +6 -6
- package/dist/{advanced-fPImL6lW.cjs → advanced-Ds2XRflQ.cjs} +6 -6
- package/dist/{advanced-8ZPTmmaN.js → advanced-FZy7WoYR.js} +7 -7
- package/dist/advanced-FZy7WoYR.js.map +1 -0
- package/dist/{arkivTransactions-D74gERHG.d.cts → arkivTransactions-BpARZOsH.d.cts} +60 -47
- package/dist/arkivTransactions-BpARZOsH.d.cts.map +1 -0
- package/dist/{arkivTransactions-NtGD6uk5.d.ts → arkivTransactions-DfZ_yVDD.d.ts} +60 -47
- package/dist/arkivTransactions-DfZ_yVDD.d.ts.map +1 -0
- package/dist/attr/index.cjs +1 -1
- package/dist/attr/index.d.cts +1 -1
- package/dist/attr/index.d.ts +2 -2
- package/dist/attr/index.js +1 -1
- package/dist/{attributes-BhY5DwJp.js → attributes-BJGuhsqp.js} +14 -4
- package/dist/attributes-BJGuhsqp.js.map +1 -0
- package/dist/{attributes-Df9IsCVs.cjs → attributes-CMJlp1wn.cjs} +13 -3
- package/dist/chains/index.cjs +1 -1
- package/dist/chains/index.d.cts +3 -0
- package/dist/chains/index.d.cts.map +1 -1
- package/dist/chains/index.d.ts +3 -0
- package/dist/chains/index.d.ts.map +1 -1
- package/dist/chains/index.js +1 -1
- package/dist/{chains-BYRTTipa.cjs → chains-BfNQliHU.cjs} +3 -0
- package/dist/{chains-BJrZs6sG.js → chains-Du8tql7I.js} +4 -1
- package/dist/chains-Du8tql7I.js.map +1 -0
- package/dist/{codec-Car3KkFF.d.ts → codec-M74UR1_0.d.ts} +3 -4
- package/dist/codec-M74UR1_0.d.ts.map +1 -0
- package/dist/entity/index.cjs +5 -4
- package/dist/entity/index.d.cts +2 -2
- package/dist/entity/index.d.ts +3 -3
- package/dist/entity/index.js +5 -5
- package/dist/{errors-BVbjKVMN.cjs → errors-51znTSB1.cjs} +1 -1
- package/dist/{errors-LTe7bOYS.js → errors-CwPJ16bn.js} +2 -2
- package/dist/errors-CwPJ16bn.js.map +1 -0
- package/dist/{expiry-BjpxZZQU.js → expiry-CZErShX6.js} +2 -2
- package/dist/expiry-CZErShX6.js.map +1 -0
- package/dist/expiry-DRV29F1r.d.cts.map +1 -1
- package/dist/expiry-nDbCgZX4.d.ts.map +1 -1
- package/dist/{expiry-BELY2Kpw.cjs → expiry-xr6mx4f7.cjs} +1 -1
- package/dist/{flags-kr276q6i.cjs → flags-Bh0HJldY.cjs} +1 -1
- package/dist/{flags-DFBs2J94.js → flags-Cr76ldwF.js} +2 -2
- package/dist/{flags-DFBs2J94.js.map → flags-Cr76ldwF.js.map} +1 -1
- package/dist/{index-BF7Mq9Is.d.cts → index-CMeD8uEq.d.cts} +4 -4
- package/dist/{index-BF7Mq9Is.d.cts.map → index-CMeD8uEq.d.cts.map} +1 -1
- package/dist/{index-B5j76711.d.ts → index-CTDI5pXZ.d.ts} +5 -5
- package/dist/{index-B5j76711.d.ts.map → index-CTDI5pXZ.d.ts.map} +1 -1
- package/dist/{index-EeUO0nnJ.d.cts → index-CekGjkRx.d.cts} +5 -5
- package/dist/{index-EeUO0nnJ.d.cts.map → index-CekGjkRx.d.cts.map} +1 -1
- package/dist/{index-DvYvrkdk.d.ts → index-D0IzFwMX.d.ts} +12 -4
- package/dist/index-D0IzFwMX.d.ts.map +1 -0
- package/dist/{index-fX_XyqLp.d.ts → index-DZxwz2Ky.d.cts} +53 -43
- package/dist/index-DZxwz2Ky.d.cts.map +1 -0
- package/dist/{index-DHDud2hC.d.ts → index-Dz4SkQWg.d.ts} +4 -4
- package/dist/{index-DHDud2hC.d.ts.map → index-Dz4SkQWg.d.ts.map} +1 -1
- package/dist/{index-CA4V7Pdh.d.cts → index-JP31fjyM.d.ts} +53 -43
- package/dist/index-JP31fjyM.d.ts.map +1 -0
- package/dist/{index-CV5zCdpa.d.cts → index-NbfnXxgr.d.cts} +13 -6
- package/dist/index-NbfnXxgr.d.cts.map +1 -0
- package/dist/index.cjs +41 -42
- package/dist/index.d.cts +58 -52
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +59 -53
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -43
- package/dist/index.js.map +1 -1
- package/dist/{key-WKhXnXuU.cjs → key-E7mv0BYf.cjs} +23 -5
- package/dist/{key-D1Bh7MF0.js → key-XQkpw2xh.js} +17 -5
- package/dist/key-XQkpw2xh.js.map +1 -0
- package/dist/{payload-KC14SDlN.cjs → payload-Cvrir3Q-.cjs} +27 -2
- package/dist/{payload-CcUj85ys.d.ts → payload-D53ms-Mg.d.ts} +60 -1
- package/dist/payload-D53ms-Mg.d.ts.map +1 -0
- package/dist/{payload-Bz6651ax.js → payload-DaPzUvEh.js} +28 -3
- package/dist/payload-DaPzUvEh.js.map +1 -0
- package/dist/{payload-BNoud2KZ.d.cts → payload-hluX1rc0.d.cts} +60 -1
- package/dist/payload-hluX1rc0.d.cts.map +1 -0
- package/dist/query/index.cjs +4 -4
- package/dist/query/index.d.cts +3 -3
- package/dist/query/index.d.ts +4 -4
- package/dist/query/index.js +4 -4
- package/dist/{queryBuilder-DbUMEZln.cjs → queryBuilder-BXR-HxD9.cjs} +13 -10
- package/dist/{queryBuilder-DM6AWCBa.js → queryBuilder-BwauPaGO.js} +14 -11
- package/dist/queryBuilder-BwauPaGO.js.map +1 -0
- package/dist/{selection-DPg0uyJf.d.cts → selection-C6KeWJ7g.d.cts} +16 -8
- package/dist/selection-C6KeWJ7g.d.cts.map +1 -0
- package/dist/{selection-C4UhsMOO.d.ts → selection-mjiiAGDO.d.ts} +17 -9
- package/dist/selection-mjiiAGDO.d.ts.map +1 -0
- package/dist/types/index.d.cts +5 -5
- package/dist/types/index.d.ts +6 -6
- package/dist/utils/index.cjs +3 -3
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +3 -3
- package/package.json +1 -5
- package/src/actions/advanced/index.ts +1 -1
- package/src/actions/advanced/sendMutation.ts +1 -1
- package/src/actions/public/getEntity.ts +1 -0
- package/src/actions/public/predictEntityKeys.test.ts +17 -1
- package/src/actions/public/predictEntityKeys.ts +28 -14
- package/src/actions/wallet/createEntity.ts +7 -6
- package/src/actions/wallet/{mutateEntities.test.ts → executeBatch.test.ts} +7 -7
- package/src/actions/wallet/{mutateEntities.ts → executeBatch.ts} +9 -9
- package/src/actions/wallet/extendEntity.ts +1 -0
- package/src/actions/wallet/patchEntity.ts +3 -3
- package/src/attr/attributes.ts +8 -2
- package/src/attr/errors.ts +2 -2
- package/src/attr/types.ts +3 -3
- package/src/attr/values.ts +5 -1
- package/src/chains/localhost.ts +3 -0
- package/src/clients/createPublicClient.test.ts +1 -1
- package/src/clients/createPublicClient.ts +5 -5
- package/src/clients/createWalletClient.test.ts +2 -2
- package/src/clients/createWalletClient.ts +3 -5
- package/src/clients/decorators/arkivAdvanced.ts +1 -1
- package/src/clients/decorators/arkivPublic.ts +13 -12
- package/src/clients/decorators/arkivWallet.ts +40 -32
- package/src/entity/create.test.ts +20 -1
- package/src/entity/errors.ts +4 -3
- package/src/entity/expiry.ts +1 -0
- package/src/entity/index.ts +2 -1
- package/src/entity/key.ts +23 -3
- package/src/entity/operations.ts +1 -0
- package/src/query/errors.ts +1 -1
- package/src/query/expression.ts +14 -7
- package/src/query/queryBuilder.ts +1 -1
- package/src/types/index.ts +4 -4
- package/src/types/rpcSchema.ts +1 -0
- package/src/types/txParams.ts +8 -0
- package/src/utils/arkivTransactions.test.ts +7 -1
- package/src/utils/arkivTransactions.ts +2 -2
- package/src/utils/expirationTime.ts +39 -0
- package/src/utils/payload.ts +25 -0
- package/dist/advanced-8ZPTmmaN.js.map +0 -1
- package/dist/arkivTransactions-D74gERHG.d.cts.map +0 -1
- package/dist/arkivTransactions-NtGD6uk5.d.ts.map +0 -1
- package/dist/attributes-BhY5DwJp.js.map +0 -1
- package/dist/chains-BJrZs6sG.js.map +0 -1
- package/dist/codec-Car3KkFF.d.ts.map +0 -1
- package/dist/errors-LTe7bOYS.js.map +0 -1
- package/dist/expiry-BjpxZZQU.js.map +0 -1
- package/dist/index-CA4V7Pdh.d.cts.map +0 -1
- package/dist/index-CV5zCdpa.d.cts.map +0 -1
- package/dist/index-DvYvrkdk.d.ts.map +0 -1
- package/dist/index-fX_XyqLp.d.ts.map +0 -1
- package/dist/key-D1Bh7MF0.js.map +0 -1
- package/dist/payload-BNoud2KZ.d.cts.map +0 -1
- package/dist/payload-Bz6651ax.js.map +0 -1
- package/dist/payload-CcUj85ys.d.ts.map +0 -1
- package/dist/queryBuilder-DM6AWCBa.js.map +0 -1
- package/dist/selection-C4UhsMOO.d.ts.map +0 -1
- package/dist/selection-DPg0uyJf.d.cts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ValueInput, G as StrValue, R as ArkivValue, Y as UserTypeTag, h as Attributes, m as AttributeSchema } from "./index-
|
|
1
|
+
import { C as ValueInput, G as StrValue, R as ArkivValue, Y as UserTypeTag, h as Attributes, m as AttributeSchema } from "./index-NbfnXxgr.cjs";
|
|
2
2
|
import { n as ResolvedCreationFlags } from "./flags-CRjPpoh3.cjs";
|
|
3
3
|
import { Account, Chain, Client, Hex, RpcSchema, Transport } from "viem";
|
|
4
4
|
|
|
@@ -68,6 +68,7 @@ type RpcSelect = {
|
|
|
68
68
|
attributeSchema?: boolean;
|
|
69
69
|
attributes?: boolean | Record<string, boolean>;
|
|
70
70
|
};
|
|
71
|
+
/** The second parameter of `arkiv_query` — what to return, and where in the results to start. */
|
|
71
72
|
type RpcQueryOptions = {
|
|
72
73
|
/** Block height to read at, as a hex quantity. Defaults to the head, and must be within the node's retained range. */
|
|
73
74
|
atBlock?: Hex;
|
|
@@ -105,6 +106,10 @@ type ArkivRpcSchema = [{
|
|
|
105
106
|
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>;
|
|
106
107
|
//#endregion
|
|
107
108
|
//#region src/query/expression.d.ts
|
|
109
|
+
/**
|
|
110
|
+
* The comparison operators the query language defines. `<` `<=` `>` `>=` need an ordered type —
|
|
111
|
+
* `i32`, `u64`, `u256` or `dec`; every type accepts `=` and `!=`.
|
|
112
|
+
*/
|
|
108
113
|
type ComparisonOperator = "=" | "!=" | "<" | "<=" | ">" | ">=";
|
|
109
114
|
/** A comparison between an attribute and a typed literal. */
|
|
110
115
|
type ComparisonNode = {
|
|
@@ -181,7 +186,7 @@ declare function eq(name: string, value: ValueInput): ComparisonNode;
|
|
|
181
186
|
*/
|
|
182
187
|
declare function ne(name: string, value: ValueInput): ComparisonNode;
|
|
183
188
|
/**
|
|
184
|
-
* Attribute is greater than value. Ordered types only (`i32`, `u256`, `dec`).
|
|
189
|
+
* Attribute is greater than value. Ordered types only (`i32`, `u64`, `u256`, `dec`).
|
|
185
190
|
*
|
|
186
191
|
* @throws {UnsupportedOperatorError} If the value's type carries no ordered index.
|
|
187
192
|
*
|
|
@@ -191,7 +196,7 @@ declare function ne(name: string, value: ValueInput): ComparisonNode;
|
|
|
191
196
|
*/
|
|
192
197
|
declare function gt(name: string, value: ValueInput): ComparisonNode;
|
|
193
198
|
/**
|
|
194
|
-
* Attribute is greater than or equal to value. Ordered types only (`i32`, `u256`, `dec`).
|
|
199
|
+
* Attribute is greater than or equal to value. Ordered types only (`i32`, `u64`, `u256`, `dec`).
|
|
195
200
|
*
|
|
196
201
|
* @throws {UnsupportedOperatorError} If the value's type carries no ordered index.
|
|
197
202
|
*
|
|
@@ -200,7 +205,7 @@ declare function gt(name: string, value: ValueInput): ComparisonNode;
|
|
|
200
205
|
*/
|
|
201
206
|
declare function gte(name: string, value: ValueInput): ComparisonNode;
|
|
202
207
|
/**
|
|
203
|
-
* Attribute is less than value. Ordered types only (`i32`, `u256`, `dec`).
|
|
208
|
+
* Attribute is less than value. Ordered types only (`i32`, `u64`, `u256`, `dec`).
|
|
204
209
|
*
|
|
205
210
|
* @throws {UnsupportedOperatorError} If the value's type carries no ordered index.
|
|
206
211
|
*
|
|
@@ -209,7 +214,7 @@ declare function gte(name: string, value: ValueInput): ComparisonNode;
|
|
|
209
214
|
*/
|
|
210
215
|
declare function lt(name: string, value: ValueInput): ComparisonNode;
|
|
211
216
|
/**
|
|
212
|
-
* Attribute is less than or equal to value. Ordered types only (`i32`, `u256`, `dec`).
|
|
217
|
+
* Attribute is less than or equal to value. Ordered types only (`i32`, `u64`, `u256`, `dec`).
|
|
213
218
|
*
|
|
214
219
|
* @throws {UnsupportedOperatorError} If the value's type carries no ordered index.
|
|
215
220
|
*
|
|
@@ -224,7 +229,9 @@ declare function lte(name: string, value: ValueInput): ComparisonNode;
|
|
|
224
229
|
* `startsWith("name", "é")` matches only the same byte sequence, not another normal form of it.
|
|
225
230
|
*
|
|
226
231
|
* @param prefix - The prefix, as a bare string or a `str` value.
|
|
227
|
-
* @throws {
|
|
232
|
+
* @throws {InvalidPredicateError} If the name is not a queryable attribute.
|
|
233
|
+
* @throws {UnsupportedOperatorError} If given a value that is not a `str`, or a system attribute
|
|
234
|
+
* (none of which is a `str`).
|
|
228
235
|
*
|
|
229
236
|
* @example
|
|
230
237
|
* startsWith("desc", "ab") // desc STARTSWITH str('ab')
|
|
@@ -247,7 +254,8 @@ declare function exists(name: string): ExistsNode;
|
|
|
247
254
|
* Useful when the same name is written with different types across entities — a comparison already
|
|
248
255
|
* asserts the type, so this is for asking about the type alone.
|
|
249
256
|
*
|
|
250
|
-
* @param tag - The type tag: `bool`, `i32`, `u256`, `dec`, `bytes32`, `str`, `addr` or
|
|
257
|
+
* @param tag - The type tag: `bool`, `i32`, `u64`, `u256`, `dec`, `bytes32`, `str`, `addr` or
|
|
258
|
+
* `key`.
|
|
251
259
|
* @throws {InvalidPredicateError} If the tag is not a settable type, or the name is a system
|
|
252
260
|
* attribute (whose type is fixed).
|
|
253
261
|
*
|
|
@@ -430,4 +438,4 @@ type FullEntity = ProjectedEntity<AllSelected>;
|
|
|
430
438
|
declare function toRpcSelect(selection?: SelectArg): RpcSelect;
|
|
431
439
|
//#endregion
|
|
432
440
|
export { startsWith as A, hasType as C, not as D, ne as E, RpcCreationFlags as F, RpcEntity as I, RpcQueryOptions as L, ArkivRpcSchema as M, RpcAttribute as N, or as O, RpcAttributeSchemaEntry as P, RpcSelect as R, gte as S, lte as T, TypeOfNode as _, SelectionFields as a, exists as b, EntityFields as c, ComparisonOperator as d, ExistsNode as f, StartsWithNode as g, OrNode as h, SelectArg as i, ArkivClient as j, render as k, AndNode as l, NotNode as m, FullEntity as n, toRpcSelect as o, Expression as p, ProjectedEntity as r, Entity as s, EntitySelection as t, ComparisonNode as u, and as v, lt as w, gt as x, eq as y };
|
|
433
|
-
//# sourceMappingURL=selection-
|
|
441
|
+
//# sourceMappingURL=selection-C6KeWJ7g.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-C6KeWJ7g.d.cts","names":[],"sources":["../src/types/rpcSchema.ts","../src/clients/baseClient.ts","../src/query/expression.ts","../src/types/entity.ts","../src/query/selection.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAWA;AAOA;AAQA;AAUA;;AAEU,KA3BE,YAAA,GA2BF;EACE,IAAA,EAAA,MAAA;EACE,IAAA,EAAA,MAAA;EACA,KAAA,EAAA,OAAA;CACA;;AAGF,KA3BA,uBAAA,GA2BA;EACQ,IAAA,EAAA,MAAA;EACL,IAAA,EAAA,MAAA;CAAY;AAU3B;AAeA;;AAIW,KAlDC,gBAAA,GAkDD;EAED,QAAA,CAAA,EAAA,OAAA;EAAG,uBAAA,CAAA,EAAA,OAAA;EAKD,GAAA,EAAA,MAAA;CAG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AAA,IAAA;;;;;;;;;AAEjB,KG4DE,eH5DF,CAAA,CAAA,CAAA,GAAA,uBG6Da,KAAK,SAAS,EAAE,mBAAmB,YAAY,gBAAgB,SAChF,YAAY,OAAO,iBAEpB;;AFtDL,CAAA,GEsDmC,IFtDvB,CEsD4B,MFtD5B,EAAA,QAAkB,GAAA,QAAA,CAAA,GAAA,OAAA,CAAA;AAG9B;AAQA,KE8CK,WAAA,GF9CO,QAOA,CAAA,OEuCuB,cFvCb,CAAA,CAAA,MAAA,CAAA,GAAA,IAAA,EAMtB;AAOA;AAMY,KEuBA,UAAA,GAAa,eFrBkB,CEqBF,WFrBE,CAAA;AAI3C;AAaA;;;;;;;;;AAiIA;AAcA;AAaA;AAYA;AAYA;AAYA;AAkBgB,iBE5LA,WAAA,CF4L0C,SAAyB,CAAd,EE5L7B,SF4L2C,CAAA,EE5L/B,SF4L+B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as UserTypeTag, r as ArkivValue, u as StrValue } from "./codec-
|
|
2
|
-
import { C as ValueInput, h as Attributes, m as AttributeSchema } from "./index-
|
|
1
|
+
import { m as UserTypeTag, r as ArkivValue, u as StrValue } from "./codec-M74UR1_0.js";
|
|
2
|
+
import { C as ValueInput, h as Attributes, m as AttributeSchema } from "./index-D0IzFwMX.js";
|
|
3
3
|
import { n as ResolvedCreationFlags } from "./flags-5dTNRnow.js";
|
|
4
4
|
import { Account, Chain, Client, Hex, RpcSchema, Transport } from "viem";
|
|
5
5
|
|
|
@@ -69,6 +69,7 @@ type RpcSelect = {
|
|
|
69
69
|
attributeSchema?: boolean;
|
|
70
70
|
attributes?: boolean | Record<string, boolean>;
|
|
71
71
|
};
|
|
72
|
+
/** The second parameter of `arkiv_query` — what to return, and where in the results to start. */
|
|
72
73
|
type RpcQueryOptions = {
|
|
73
74
|
/** Block height to read at, as a hex quantity. Defaults to the head, and must be within the node's retained range. */
|
|
74
75
|
atBlock?: Hex;
|
|
@@ -106,6 +107,10 @@ type ArkivRpcSchema = [{
|
|
|
106
107
|
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>;
|
|
107
108
|
//#endregion
|
|
108
109
|
//#region src/query/expression.d.ts
|
|
110
|
+
/**
|
|
111
|
+
* The comparison operators the query language defines. `<` `<=` `>` `>=` need an ordered type —
|
|
112
|
+
* `i32`, `u64`, `u256` or `dec`; every type accepts `=` and `!=`.
|
|
113
|
+
*/
|
|
109
114
|
type ComparisonOperator = "=" | "!=" | "<" | "<=" | ">" | ">=";
|
|
110
115
|
/** A comparison between an attribute and a typed literal. */
|
|
111
116
|
type ComparisonNode = {
|
|
@@ -182,7 +187,7 @@ declare function eq(name: string, value: ValueInput): ComparisonNode;
|
|
|
182
187
|
*/
|
|
183
188
|
declare function ne(name: string, value: ValueInput): ComparisonNode;
|
|
184
189
|
/**
|
|
185
|
-
* Attribute is greater than value. Ordered types only (`i32`, `u256`, `dec`).
|
|
190
|
+
* Attribute is greater than value. Ordered types only (`i32`, `u64`, `u256`, `dec`).
|
|
186
191
|
*
|
|
187
192
|
* @throws {UnsupportedOperatorError} If the value's type carries no ordered index.
|
|
188
193
|
*
|
|
@@ -192,7 +197,7 @@ declare function ne(name: string, value: ValueInput): ComparisonNode;
|
|
|
192
197
|
*/
|
|
193
198
|
declare function gt(name: string, value: ValueInput): ComparisonNode;
|
|
194
199
|
/**
|
|
195
|
-
* Attribute is greater than or equal to value. Ordered types only (`i32`, `u256`, `dec`).
|
|
200
|
+
* Attribute is greater than or equal to value. Ordered types only (`i32`, `u64`, `u256`, `dec`).
|
|
196
201
|
*
|
|
197
202
|
* @throws {UnsupportedOperatorError} If the value's type carries no ordered index.
|
|
198
203
|
*
|
|
@@ -201,7 +206,7 @@ declare function gt(name: string, value: ValueInput): ComparisonNode;
|
|
|
201
206
|
*/
|
|
202
207
|
declare function gte(name: string, value: ValueInput): ComparisonNode;
|
|
203
208
|
/**
|
|
204
|
-
* Attribute is less than value. Ordered types only (`i32`, `u256`, `dec`).
|
|
209
|
+
* Attribute is less than value. Ordered types only (`i32`, `u64`, `u256`, `dec`).
|
|
205
210
|
*
|
|
206
211
|
* @throws {UnsupportedOperatorError} If the value's type carries no ordered index.
|
|
207
212
|
*
|
|
@@ -210,7 +215,7 @@ declare function gte(name: string, value: ValueInput): ComparisonNode;
|
|
|
210
215
|
*/
|
|
211
216
|
declare function lt(name: string, value: ValueInput): ComparisonNode;
|
|
212
217
|
/**
|
|
213
|
-
* Attribute is less than or equal to value. Ordered types only (`i32`, `u256`, `dec`).
|
|
218
|
+
* Attribute is less than or equal to value. Ordered types only (`i32`, `u64`, `u256`, `dec`).
|
|
214
219
|
*
|
|
215
220
|
* @throws {UnsupportedOperatorError} If the value's type carries no ordered index.
|
|
216
221
|
*
|
|
@@ -225,7 +230,9 @@ declare function lte(name: string, value: ValueInput): ComparisonNode;
|
|
|
225
230
|
* `startsWith("name", "é")` matches only the same byte sequence, not another normal form of it.
|
|
226
231
|
*
|
|
227
232
|
* @param prefix - The prefix, as a bare string or a `str` value.
|
|
228
|
-
* @throws {
|
|
233
|
+
* @throws {InvalidPredicateError} If the name is not a queryable attribute.
|
|
234
|
+
* @throws {UnsupportedOperatorError} If given a value that is not a `str`, or a system attribute
|
|
235
|
+
* (none of which is a `str`).
|
|
229
236
|
*
|
|
230
237
|
* @example
|
|
231
238
|
* startsWith("desc", "ab") // desc STARTSWITH str('ab')
|
|
@@ -248,7 +255,8 @@ declare function exists(name: string): ExistsNode;
|
|
|
248
255
|
* Useful when the same name is written with different types across entities — a comparison already
|
|
249
256
|
* asserts the type, so this is for asking about the type alone.
|
|
250
257
|
*
|
|
251
|
-
* @param tag - The type tag: `bool`, `i32`, `u256`, `dec`, `bytes32`, `str`, `addr` or
|
|
258
|
+
* @param tag - The type tag: `bool`, `i32`, `u64`, `u256`, `dec`, `bytes32`, `str`, `addr` or
|
|
259
|
+
* `key`.
|
|
252
260
|
* @throws {InvalidPredicateError} If the tag is not a settable type, or the name is a system
|
|
253
261
|
* attribute (whose type is fixed).
|
|
254
262
|
*
|
|
@@ -431,4 +439,4 @@ type FullEntity = ProjectedEntity<AllSelected>;
|
|
|
431
439
|
declare function toRpcSelect(selection?: SelectArg): RpcSelect;
|
|
432
440
|
//#endregion
|
|
433
441
|
export { startsWith as A, hasType as C, not as D, ne as E, RpcCreationFlags as F, RpcEntity as I, RpcQueryOptions as L, ArkivRpcSchema as M, RpcAttribute as N, or as O, RpcAttributeSchemaEntry as P, RpcSelect as R, gte as S, lte as T, TypeOfNode as _, SelectionFields as a, exists as b, EntityFields as c, ComparisonOperator as d, ExistsNode as f, StartsWithNode as g, OrNode as h, SelectArg as i, ArkivClient as j, render as k, AndNode as l, NotNode as m, FullEntity as n, toRpcSelect as o, Expression as p, ProjectedEntity as r, Entity as s, EntitySelection as t, ComparisonNode as u, and as v, lt as w, gt as x, eq as y };
|
|
434
|
-
//# sourceMappingURL=selection-
|
|
442
|
+
//# sourceMappingURL=selection-mjiiAGDO.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-mjiiAGDO.d.ts","names":[],"sources":["../src/types/rpcSchema.ts","../src/clients/baseClient.ts","../src/query/expression.ts","../src/types/entity.ts","../src/query/selection.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;AAWA;AAOA;AAQA;AAUA;AACQ,KA1BI,YAAA,GA0BJ;EACE,IAAA,EAAA,MAAA;EACE,IAAA,EAAA,MAAA;EACE,KAAA,EAAA,OAAA;CACA;;AAEI,KAzBN,uBAAA,GAyBM;EAEN,IAAA,EAAA,MAAA;EACQ,IAAA,EAAA,MAAA;CACL;;AAUf;AAeA;AAEY,KAhDA,gBAAA,GAgDA;EAED,QAAA,CAAA,EAAA,OAAA;EAED,uBAAA,CAAA,EAAA,OAAA;EAAG,GAAA,EAAA,MAAA;AAKb,CAAA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M,MG6Da,CH7Db,IG6DkB,QH7DlB,CG6D2B,CH7D3B,CG6D6B,CH7D7B,CAAA,CAAA,SAAA,IAAA,GG6DgD,CH7DhD,GAAA,KAAA,GG6D4D,CH7D5D,SAAA,MG6D4E,MH7D5E,GG8DJ,WH9DI,CG8DQ,MH9DR,CG8De,CH9Df,CAAA,CAAA,GAAA,KAAA,MGgEL;;IAA8B,KAAK;AFtDxC;AAGA,KEsDK,WAAA,GFtDO,QAQA,CAAA,OE8CuB,cF9CT,CAAA,CAGR,MAAA,CAAA,GAAQ,IAAA,EAI1B;AAMA;AAOY,KE6BA,UAAA,GAAa,eF3BQ,CE2BQ,WF3BR,CAAA;AAIjC;AAMA;AAaA;;;;;;;;;AAiIA;AAcA;AAaA;AAYA;AAYA;AAYgB,iBE1KA,WAAA,CF0KsC,SAAc,CAAd,EE1Kd,SF0K4B,CAAA,EE1KhB,SF0KgB"}
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { F as RpcCreationFlags, I as RpcEntity, L as RpcQueryOptions, M as ArkivRpcSchema, N as RpcAttribute, P as RpcAttributeSchemaEntry, R as RpcSelect, c as EntityFields, s as Entity } from "../selection-
|
|
2
|
-
import "../index-
|
|
1
|
+
import { F as RpcCreationFlags, I as RpcEntity, L as RpcQueryOptions, M as ArkivRpcSchema, N as RpcAttribute, P as RpcAttributeSchemaEntry, R as RpcSelect, c as EntityFields, s as Entity } from "../selection-C6KeWJ7g.cjs";
|
|
2
|
+
import "../index-NbfnXxgr.cjs";
|
|
3
3
|
import "../expiry-DRV29F1r.cjs";
|
|
4
|
-
import "../index-
|
|
5
|
-
import { A as PredictEntityKeysParameters, C as EntityEvent, D as OwnershipTransferredEvent, E as ExpiryExtendedEvent, M as PredictedEntityKey, N as GetBlockTimingReturnType, O as QueryOptions, S as EntityDeletedEvent, T as EntityPatchedEvent, _ as DeleteEntityReturnType, b as WatchEntityEventsParameters, c as TxParams, d as PatchEntityReturnType, f as
|
|
4
|
+
import "../index-DZxwz2Ky.cjs";
|
|
5
|
+
import { A as PredictEntityKeysParameters, C as EntityEvent, D as OwnershipTransferredEvent, E as ExpiryExtendedEvent, M as PredictedEntityKey, N as GetBlockTimingReturnType, O as QueryOptions, S as EntityDeletedEvent, T as EntityPatchedEvent, _ as DeleteEntityReturnType, b as WatchEntityEventsParameters, c as TxParams, d as PatchEntityReturnType, f as ExtendEntityParameters, g as DeleteEntityParameters, h as ExecuteBatchReturnType, j as PredictEntityKeysReturnType, k as QueryReturnType, l as MimeType, m as ExecuteBatchParameters, o as ChangeOwnershipParameters, p as ExtendEntityReturnType, s as ChangeOwnershipReturnType, u as PatchEntityParameters, v as CreateEntityParameters, w as EntityEventContext, x as EntityCreatedEvent, y as CreateEntityReturnType } from "../arkivTransactions-BpARZOsH.cjs";
|
|
6
6
|
import "../flags-CRjPpoh3.cjs";
|
|
7
|
-
export { ArkivRpcSchema, ChangeOwnershipParameters, ChangeOwnershipReturnType, CreateEntityParameters, CreateEntityReturnType, DeleteEntityParameters, DeleteEntityReturnType, Entity, EntityCreatedEvent, EntityDeletedEvent, EntityEvent, EntityEventContext, EntityFields, EntityPatchedEvent, ExpiryExtendedEvent, ExtendEntityParameters, ExtendEntityReturnType, GetBlockTimingReturnType, MimeType,
|
|
7
|
+
export { ArkivRpcSchema, ChangeOwnershipParameters, ChangeOwnershipReturnType, CreateEntityParameters, CreateEntityReturnType, DeleteEntityParameters, DeleteEntityReturnType, Entity, EntityCreatedEvent, EntityDeletedEvent, EntityEvent, EntityEventContext, EntityFields, EntityPatchedEvent, ExecuteBatchParameters, ExecuteBatchReturnType, ExpiryExtendedEvent, ExtendEntityParameters, ExtendEntityReturnType, GetBlockTimingReturnType, MimeType, OwnershipTransferredEvent, PatchEntityParameters, PatchEntityReturnType, PredictEntityKeysParameters, PredictEntityKeysReturnType, PredictedEntityKey, QueryOptions, QueryReturnType, RpcAttribute, RpcAttributeSchemaEntry, RpcCreationFlags, RpcEntity, RpcQueryOptions, RpcSelect, TxParams, WatchEntityEventsParameters };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { F as RpcCreationFlags, I as RpcEntity, L as RpcQueryOptions, M as ArkivRpcSchema, N as RpcAttribute, P as RpcAttributeSchemaEntry, R as RpcSelect, c as EntityFields, s as Entity } from "../selection-
|
|
2
|
-
import "../codec-
|
|
1
|
+
import { F as RpcCreationFlags, I as RpcEntity, L as RpcQueryOptions, M as ArkivRpcSchema, N as RpcAttribute, P as RpcAttributeSchemaEntry, R as RpcSelect, c as EntityFields, s as Entity } from "../selection-mjiiAGDO.js";
|
|
2
|
+
import "../codec-M74UR1_0.js";
|
|
3
3
|
import "../expiry-nDbCgZX4.js";
|
|
4
|
-
import "../index-
|
|
5
|
-
import { A as PredictEntityKeysParameters, C as EntityEvent, D as OwnershipTransferredEvent, E as ExpiryExtendedEvent, M as PredictedEntityKey, N as GetBlockTimingReturnType, O as QueryOptions, S as EntityDeletedEvent, T as EntityPatchedEvent, _ as DeleteEntityReturnType, b as WatchEntityEventsParameters, c as TxParams, d as PatchEntityReturnType, f as
|
|
6
|
-
import "../index-
|
|
4
|
+
import "../index-JP31fjyM.js";
|
|
5
|
+
import { A as PredictEntityKeysParameters, C as EntityEvent, D as OwnershipTransferredEvent, E as ExpiryExtendedEvent, M as PredictedEntityKey, N as GetBlockTimingReturnType, O as QueryOptions, S as EntityDeletedEvent, T as EntityPatchedEvent, _ as DeleteEntityReturnType, b as WatchEntityEventsParameters, c as TxParams, d as PatchEntityReturnType, f as ExtendEntityParameters, g as DeleteEntityParameters, h as ExecuteBatchReturnType, j as PredictEntityKeysReturnType, k as QueryReturnType, l as MimeType, m as ExecuteBatchParameters, o as ChangeOwnershipParameters, p as ExtendEntityReturnType, s as ChangeOwnershipReturnType, u as PatchEntityParameters, v as CreateEntityParameters, w as EntityEventContext, x as EntityCreatedEvent, y as CreateEntityReturnType } from "../arkivTransactions-DfZ_yVDD.js";
|
|
6
|
+
import "../index-D0IzFwMX.js";
|
|
7
7
|
import "../flags-5dTNRnow.js";
|
|
8
|
-
export { ArkivRpcSchema, ChangeOwnershipParameters, ChangeOwnershipReturnType, CreateEntityParameters, CreateEntityReturnType, DeleteEntityParameters, DeleteEntityReturnType, Entity, EntityCreatedEvent, EntityDeletedEvent, EntityEvent, EntityEventContext, EntityFields, EntityPatchedEvent, ExpiryExtendedEvent, ExtendEntityParameters, ExtendEntityReturnType, GetBlockTimingReturnType, MimeType,
|
|
8
|
+
export { ArkivRpcSchema, ChangeOwnershipParameters, ChangeOwnershipReturnType, CreateEntityParameters, CreateEntityReturnType, DeleteEntityParameters, DeleteEntityReturnType, Entity, EntityCreatedEvent, EntityDeletedEvent, EntityEvent, EntityEventContext, EntityFields, EntityPatchedEvent, ExecuteBatchParameters, ExecuteBatchReturnType, ExpiryExtendedEvent, ExtendEntityParameters, ExtendEntityReturnType, GetBlockTimingReturnType, MimeType, OwnershipTransferredEvent, PatchEntityParameters, PatchEntityReturnType, PredictEntityKeysParameters, PredictEntityKeysReturnType, PredictedEntityKey, QueryOptions, QueryReturnType, RpcAttribute, RpcAttributeSchemaEntry, RpcCreationFlags, RpcEntity, RpcQueryOptions, RpcSelect, TxParams, WatchEntityEventsParameters };
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
require('../expiry-
|
|
2
|
-
require('../errors-
|
|
3
|
-
const require_payload = require('../payload-
|
|
1
|
+
require('../expiry-xr6mx4f7.cjs');
|
|
2
|
+
require('../errors-51znTSB1.cjs');
|
|
3
|
+
const require_payload = require('../payload-Cvrir3Q-.cjs');
|
|
4
4
|
|
|
5
5
|
exports.ExpirationTime = require_payload.ExpirationTime;
|
|
6
6
|
exports.jsonToPayload = require_payload.jsonToPayload;
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "../expiry-DRV29F1r.cjs";
|
|
2
|
-
import { i as ExpirationTime, n as stringToPayload, r as DeadlineOptions, t as jsonToPayload } from "../payload-
|
|
2
|
+
import { i as ExpirationTime, n as stringToPayload, r as DeadlineOptions, t as jsonToPayload } from "../payload-hluX1rc0.cjs";
|
|
3
3
|
export { DeadlineOptions, ExpirationTime, jsonToPayload, stringToPayload };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "../expiry-nDbCgZX4.js";
|
|
2
|
-
import { i as ExpirationTime, n as stringToPayload, r as DeadlineOptions, t as jsonToPayload } from "../payload-
|
|
2
|
+
import { i as ExpirationTime, n as stringToPayload, r as DeadlineOptions, t as jsonToPayload } from "../payload-D53ms-Mg.js";
|
|
3
3
|
export { DeadlineOptions, ExpirationTime, jsonToPayload, stringToPayload };
|
package/dist/utils/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../expiry-
|
|
2
|
-
import "../errors-
|
|
3
|
-
import { n as stringToPayload, r as ExpirationTime, t as jsonToPayload } from "../payload-
|
|
1
|
+
import "../expiry-CZErShX6.js";
|
|
2
|
+
import "../errors-CwPJ16bn.js";
|
|
3
|
+
import { n as stringToPayload, r as ExpirationTime, t as jsonToPayload } from "../payload-DaPzUvEh.js";
|
|
4
4
|
|
|
5
5
|
export { ExpirationTime, jsonToPayload, stringToPayload };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkiv-network/sdk",
|
|
3
|
-
"version": "0.8.0-advanced.
|
|
3
|
+
"version": "0.8.0-advanced.3",
|
|
4
4
|
"description": "TypeScript client library for Arkiv's blockchains interactions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"target": "esnext",
|
|
@@ -85,8 +85,6 @@
|
|
|
85
85
|
"lint": "biome check src/",
|
|
86
86
|
"lint:fix": "biome check --write src/",
|
|
87
87
|
"test:unit": "bun test src/**/*",
|
|
88
|
-
"docs": "bunx typedoc --plugin typedoc-plugin-markdown",
|
|
89
|
-
"docs:verify": "bunx typedoc --emit none --plugin typedoc-plugin-markdown",
|
|
90
88
|
"package": "rimraf arkiv-network-sdk-*.tgz && bun run build && bun pm pack --no-cache",
|
|
91
89
|
"package:test": "bun run package && mv arkiv-network-sdk-*.tgz arkiv-network-sdk-latest.tgz",
|
|
92
90
|
"prepublishOnly": "bun run build && bun run package && mv arkiv-network-sdk-*.tgz arkiv-network-sdk-latest.tgz",
|
|
@@ -102,8 +100,6 @@
|
|
|
102
100
|
"@types/bun": "latest",
|
|
103
101
|
"rimraf": "^6.0.1",
|
|
104
102
|
"tsdown": "^0.16.0",
|
|
105
|
-
"typedoc": "^0.28.14",
|
|
106
|
-
"typedoc-plugin-markdown": "^4.9.0",
|
|
107
103
|
"typescript": "^5.9.2",
|
|
108
104
|
"viem": "^2.38.2"
|
|
109
105
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The advanced path: send, ping and read results as separate, single-RPC-call steps.
|
|
3
3
|
*
|
|
4
|
-
* The everyday actions (`createEntity`, `
|
|
4
|
+
* The everyday actions (`createEntity`, `executeBatch`, …) bundle send + wait + decode into one
|
|
5
5
|
* call, which is convenient and spends several RPC requests. These actions unbundle that so a
|
|
6
6
|
* caller can hit the theoretical minimum:
|
|
7
7
|
*
|
|
@@ -31,7 +31,7 @@ export type SendMutationReturnType = {
|
|
|
31
31
|
/**
|
|
32
32
|
* Signs and sends a mutation batch, returning as soon as the transaction is submitted.
|
|
33
33
|
*
|
|
34
|
-
* The fire-and-forget half of the advanced path. Unlike `
|
|
34
|
+
* The fire-and-forget half of the advanced path. Unlike `executeBatch`, this does **not** wait
|
|
35
35
|
* for a receipt, does not poll, and runs no revert diagnosis — it spends only what submitting
|
|
36
36
|
* costs. With `options.currentBlock` and full `txParams` (nonce, gas, fees) that is exactly one
|
|
37
37
|
* RPC call; each omitted piece adds only the lookup viem needs to fill it.
|
|
@@ -5,6 +5,7 @@ import { NoEntityFoundError } from "../../errors"
|
|
|
5
5
|
import { runQuery } from "../../query/engine"
|
|
6
6
|
import { eq } from "../../query/expression"
|
|
7
7
|
import { type FullEntity, toRpcSelect } from "../../query/selection"
|
|
8
|
+
import type { Entity } from "../../types/entity"
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Reads one entity by key, with every field selected.
|
|
@@ -2,7 +2,7 @@ import { describe, expect, it, vi } from "bun:test"
|
|
|
2
2
|
import { encodeFunctionResult, type Hex } from "viem"
|
|
3
3
|
import type { ArkivClient } from "../../clients/baseClient"
|
|
4
4
|
import { ARKIV_ADDRESS } from "../../consts"
|
|
5
|
-
import { predictEntityKey } from "../../entity/key"
|
|
5
|
+
import { NO_SALT, predictEntityKey } from "../../entity/key"
|
|
6
6
|
import { ENTITY_NONCE_ABI } from "../../entity/operations"
|
|
7
7
|
import { getEntityNonce } from "./getEntityNonce"
|
|
8
8
|
import { predictEntityKeys } from "./predictEntityKeys"
|
|
@@ -105,6 +105,22 @@ describe("predictEntityKeys", () => {
|
|
|
105
105
|
)
|
|
106
106
|
})
|
|
107
107
|
|
|
108
|
+
it("takes NO_SALT in a slot, and pairs the key with the zero it resolves to", async () => {
|
|
109
|
+
const { client } = makeClient(4n)
|
|
110
|
+
const [first, second] = await predictEntityKeys(client, {
|
|
111
|
+
owner: OWNER,
|
|
112
|
+
salts: [NO_SALT, 5n],
|
|
113
|
+
})
|
|
114
|
+
expect(first).toEqual({
|
|
115
|
+
salt: 0n,
|
|
116
|
+
key: predictEntityKey({ owner: OWNER, nonce: 4n, salt: 0n, chainId: CHAIN_ID }),
|
|
117
|
+
})
|
|
118
|
+
expect(second).toEqual({
|
|
119
|
+
salt: 5n,
|
|
120
|
+
key: predictEntityKey({ owner: OWNER, nonce: 5n, salt: 5n, chainId: CHAIN_ID }),
|
|
121
|
+
})
|
|
122
|
+
})
|
|
123
|
+
|
|
108
124
|
it("prefers the salts it was given over the count", async () => {
|
|
109
125
|
const { client } = makeClient(0n)
|
|
110
126
|
const pairs = await predictEntityKeys(client, { owner: OWNER, count: 5, salts: [9n] })
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { Address, Hex } from "viem"
|
|
2
2
|
import { getChainId } from "viem/actions"
|
|
3
3
|
import type { ArkivClient } from "../../clients/baseClient"
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
NO_SALT,
|
|
6
|
+
predictEntityKey,
|
|
7
|
+
randomSalt,
|
|
8
|
+
resolveSalt,
|
|
9
|
+
type SaltInput,
|
|
10
|
+
} from "../../entity/key"
|
|
5
11
|
import { getEntityNonce } from "./getEntityNonce"
|
|
6
12
|
|
|
7
13
|
/**
|
|
@@ -13,14 +19,18 @@ import { getEntityNonce } from "./getEntityNonce"
|
|
|
13
19
|
export type PredictedEntityKey = {
|
|
14
20
|
/** The key the create will be given. */
|
|
15
21
|
key: Hex
|
|
16
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* The salt the create must carry for its key to come out as {@link PredictedEntityKey.key}.
|
|
24
|
+
* Always a plain `uint128` — a requested {@link NO_SALT} comes back as the `0n` it resolves to,
|
|
25
|
+
* which a create accepts just the same.
|
|
26
|
+
*/
|
|
17
27
|
salt: bigint
|
|
18
28
|
}
|
|
19
29
|
|
|
20
|
-
/** Parameters for
|
|
30
|
+
/** Parameters for `client.predictEntityKeys`. */
|
|
21
31
|
export type PredictEntityKeysParameters<
|
|
22
32
|
TCount extends number = number,
|
|
23
|
-
TSalts extends readonly
|
|
33
|
+
TSalts extends readonly SaltInput[] | undefined = readonly SaltInput[] | undefined,
|
|
24
34
|
> = {
|
|
25
35
|
/** The account that will sign the creates. Its nonce is what the keys are derived from. */
|
|
26
36
|
owner: Address
|
|
@@ -34,7 +44,8 @@ export type PredictEntityKeysParameters<
|
|
|
34
44
|
count?: TCount | undefined
|
|
35
45
|
/**
|
|
36
46
|
* The salt each create will carry, in batch order. Defaults to `count` fresh random salts —
|
|
37
|
-
* either way each key comes back paired with the salt that mints it.
|
|
47
|
+
* either way each key comes back paired with the salt that mints it. Pass {@link NO_SALT} in a
|
|
48
|
+
* slot whose create opts out of salting.
|
|
38
49
|
*/
|
|
39
50
|
salts?: TSalts
|
|
40
51
|
}
|
|
@@ -46,13 +57,13 @@ export type PredictEntityKeysParameters<
|
|
|
46
57
|
* tuple, gives a fixed-length tuple; a count computed at runtime gives a plain array.
|
|
47
58
|
*
|
|
48
59
|
* `TSalts` is wrapped in a tuple to stop the conditional distributing over it. Left naked, the
|
|
49
|
-
* `readonly
|
|
50
|
-
* which widens the length straight back to `number`.
|
|
60
|
+
* `readonly SaltInput[] | undefined` default would take both branches and union a tuple with an
|
|
61
|
+
* array, which widens the length straight back to `number`.
|
|
51
62
|
*/
|
|
52
63
|
export type PredictEntityKeysReturnType<
|
|
53
64
|
TCount extends number = number,
|
|
54
|
-
TSalts extends readonly
|
|
55
|
-
> = [TSalts] extends [readonly
|
|
65
|
+
TSalts extends readonly SaltInput[] | undefined = readonly SaltInput[] | undefined,
|
|
66
|
+
> = [TSalts] extends [readonly SaltInput[]]
|
|
56
67
|
? { -readonly [Index in keyof TSalts]: PredictedEntityKey }
|
|
57
68
|
: Repeat<PredictedEntityKey, TCount>
|
|
58
69
|
|
|
@@ -79,7 +90,7 @@ type Repeat<T, TLength extends number, TAcc extends T[] = []> = number extends T
|
|
|
79
90
|
*
|
|
80
91
|
* The prediction is valid only while nothing else from this owner is in flight. Every create that
|
|
81
92
|
* lands first takes the nonce with it and moves these keys. For a key you can rely on
|
|
82
|
-
* unconditionally, read it back from the create instead — `createEntity` and `
|
|
93
|
+
* unconditionally, read it back from the create instead — `createEntity` and `executeBatch`
|
|
83
94
|
* report the keys the engine actually minted.
|
|
84
95
|
*
|
|
85
96
|
* @param parameters - Owner, and either a count or the salts. {@link PredictEntityKeysParameters}
|
|
@@ -89,7 +100,7 @@ type Repeat<T, TLength extends number, TAcc extends T[] = []> = number extends T
|
|
|
89
100
|
* import { key } from "@arkiv-network/sdk/attr"
|
|
90
101
|
*
|
|
91
102
|
* const [parent, child] = await client.predictEntityKeys({ owner: account.address, count: 2 })
|
|
92
|
-
* await
|
|
103
|
+
* await client.executeBatch({
|
|
93
104
|
* creates: [
|
|
94
105
|
* { payload, contentType, expires, salt: parent.salt },
|
|
95
106
|
* {
|
|
@@ -104,7 +115,7 @@ type Repeat<T, TLength extends number, TAcc extends T[] = []> = number extends T
|
|
|
104
115
|
*/
|
|
105
116
|
export async function predictEntityKeys<
|
|
106
117
|
const TCount extends number = number,
|
|
107
|
-
const TSalts extends readonly
|
|
118
|
+
const TSalts extends readonly SaltInput[] | undefined = undefined,
|
|
108
119
|
>(
|
|
109
120
|
client: ArkivClient,
|
|
110
121
|
{ owner, count, salts }: PredictEntityKeysParameters<TCount, TSalts>,
|
|
@@ -121,12 +132,15 @@ export async function predictEntityKeys<
|
|
|
121
132
|
}
|
|
122
133
|
|
|
123
134
|
/** The salts to derive from: the ones given, or `count` fresh random ones. */
|
|
124
|
-
function resolveSalts(
|
|
135
|
+
function resolveSalts(
|
|
136
|
+
count: number | undefined,
|
|
137
|
+
salts: readonly SaltInput[] | undefined,
|
|
138
|
+
): bigint[] {
|
|
125
139
|
if (salts !== undefined) {
|
|
126
140
|
if (salts.length === 0) {
|
|
127
141
|
throw new Error("predictEntityKeys: `salts` is empty — there is nothing to predict")
|
|
128
142
|
}
|
|
129
|
-
return salts.map(
|
|
143
|
+
return salts.map(resolveSalt)
|
|
130
144
|
}
|
|
131
145
|
if (count === undefined) {
|
|
132
146
|
throw new Error("predictEntityKeys: pass either `count` or `salts`")
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Hash, Hex } from "viem"
|
|
2
2
|
import type { AttributeInputs } from "../../attr"
|
|
3
3
|
import type { ArkivClient } from "../../clients/baseClient"
|
|
4
|
-
import type { CreationFlags, Expiry } from "../../entity"
|
|
4
|
+
import type { CreationFlags, Expiry, NO_SALT, SaltInput } from "../../entity"
|
|
5
5
|
import { EntityMutationError } from "../../errors"
|
|
6
6
|
import type { MimeType, TxParams } from "../../types"
|
|
7
7
|
import { sendArkivTransaction } from "../../utils/arkivTransactions"
|
|
8
|
+
import type { ExpirationTime } from "../../utils/expirationTime"
|
|
8
9
|
import { getLogger } from "../../utils/logger"
|
|
9
10
|
|
|
10
11
|
const logger = getLogger("actions:wallet:create-entity")
|
|
@@ -66,8 +67,8 @@ export type CreateEntityParameters = {
|
|
|
66
67
|
contentType: MimeType | (string & {})
|
|
67
68
|
/**
|
|
68
69
|
* The entity's queryable attributes, keyed by name. Values are the tagged constructors from
|
|
69
|
-
* `@arkiv-network/sdk/attr` — `i32`, `u256`, `dec`, `str`, `addr`, `key`, `bytes32`,
|
|
70
|
-
* a bare `boolean`, `number`, `bigint` or `string` where the type is unambiguous.
|
|
70
|
+
* `@arkiv-network/sdk/attr` — `i32`, `u64`, `u256`, `dec`, `str`, `addr`, `key`, `bytes32`,
|
|
71
|
+
* `bool` — or a bare `boolean`, `number`, `bigint` or `string` where the type is unambiguous.
|
|
71
72
|
*
|
|
72
73
|
* @throws {InvalidAttributeNameError} If a name violates the attribute-name grammar.
|
|
73
74
|
* @throws {InvalidValueError} If a value does not fit the type it names or defaults to.
|
|
@@ -82,10 +83,10 @@ export type CreateEntityParameters = {
|
|
|
82
83
|
* The salt mixed into the entity key. Defaults to 128 random bits, which makes the key
|
|
83
84
|
* unpredictable to everyone but the creator.
|
|
84
85
|
*
|
|
85
|
-
* Pass
|
|
86
|
-
* what you want only when a third party must be able to compute the key in advance.
|
|
86
|
+
* Pass {@link NO_SALT} for a key derived from the owner and nonce alone — predictable by anyone,
|
|
87
|
+
* which is what you want only when a third party must be able to compute the key in advance.
|
|
87
88
|
*/
|
|
88
|
-
salt?:
|
|
89
|
+
salt?: SaltInput | undefined
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it, vi } from "bun:test"
|
|
2
2
|
import type { ArkivClient } from "../../clients/baseClient"
|
|
3
|
-
import {
|
|
3
|
+
import { executeBatch } from "./executeBatch"
|
|
4
4
|
|
|
5
5
|
const ENTITY_KEY = `0x${"ab".repeat(32)}` as const
|
|
6
6
|
const NEW_OWNER = "0x2222222222222222222222222222222222222222"
|
|
@@ -29,7 +29,7 @@ describe("the empty-batch guard", () => {
|
|
|
29
29
|
// An ownership-only batch is a batch: it used to be rejected because the guard listed
|
|
30
30
|
// creates/updates/deletes/extensions and forgot ownershipChanges.
|
|
31
31
|
const { client, writeContract } = makeClient()
|
|
32
|
-
const result = await
|
|
32
|
+
const result = await executeBatch(client, {
|
|
33
33
|
ownershipChanges: [{ entityKey: ENTITY_KEY, newOwner: NEW_OWNER }],
|
|
34
34
|
})
|
|
35
35
|
expect(writeContract).toHaveBeenCalledTimes(1)
|
|
@@ -38,9 +38,9 @@ describe("the empty-batch guard", () => {
|
|
|
38
38
|
|
|
39
39
|
it("rejects a batch with nothing in it", async () => {
|
|
40
40
|
const { client, writeContract } = makeClient()
|
|
41
|
-
await expect(
|
|
41
|
+
await expect(executeBatch(client, {})).rejects.toThrow(/No operations/)
|
|
42
42
|
// Present but empty is just as empty — the engine would revert with EmptyBatch().
|
|
43
|
-
await expect(
|
|
43
|
+
await expect(executeBatch(client, { deletes: [], ownershipChanges: [] })).rejects.toThrow(
|
|
44
44
|
/No operations/,
|
|
45
45
|
)
|
|
46
46
|
expect(writeContract).not.toHaveBeenCalled()
|
|
@@ -52,10 +52,10 @@ describe("the empty-batch guard", () => {
|
|
|
52
52
|
// keys would score this batch as non-empty and then drop it on the way to the wire, sending
|
|
53
53
|
// execute([]) — so the guard counts the five kinds that actually reach the transaction.
|
|
54
54
|
const stale = { updates: [{ entityKey: ENTITY_KEY, set: { level: 1 } }] } as never
|
|
55
|
-
await expect(
|
|
55
|
+
await expect(executeBatch(client, stale)).rejects.toThrow(/No operations/)
|
|
56
56
|
// A typo is the same mistake with a different name.
|
|
57
57
|
await expect(
|
|
58
|
-
|
|
58
|
+
executeBatch(client, { delete: [{ entityKey: ENTITY_KEY }] } as never),
|
|
59
59
|
).rejects.toThrow(/No operations/)
|
|
60
60
|
expect(writeContract).not.toHaveBeenCalled()
|
|
61
61
|
})
|
|
@@ -65,7 +65,7 @@ describe("the empty-batch guard", () => {
|
|
|
65
65
|
// The dangerous shape: the creates apply and the transaction succeeds, so nothing surfaces the
|
|
66
66
|
// fact that the `updates` never happened. The guard cannot catch this one — only the caller's
|
|
67
67
|
// types can — but the result must at least not claim they did.
|
|
68
|
-
const result = await
|
|
68
|
+
const result = await executeBatch(client, {
|
|
69
69
|
deletes: [{ entityKey: ENTITY_KEY }],
|
|
70
70
|
updates: [{ entityKey: ENTITY_KEY, set: { level: 1 } }],
|
|
71
71
|
} as never)
|
|
@@ -4,19 +4,19 @@ import type { TxParams } from "../../types"
|
|
|
4
4
|
import { type EntityMutationOps, sendArkivTransaction } from "../../utils/arkivTransactions"
|
|
5
5
|
import { getLogger } from "../../utils/logger"
|
|
6
6
|
|
|
7
|
-
const logger = getLogger("actions:wallet:
|
|
7
|
+
const logger = getLogger("actions:wallet:execute-batch")
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Parameters for the
|
|
10
|
+
* Parameters for the executeBatch function — the same batch shape the advanced path takes
|
|
11
11
|
* ({@link EntityMutationOps}), so the two surfaces cannot drift apart.
|
|
12
12
|
*
|
|
13
13
|
* At least one operation is required; a batch with nothing in it throws rather than spending gas on
|
|
14
14
|
* an empty transaction.
|
|
15
15
|
*/
|
|
16
|
-
export type
|
|
16
|
+
export type ExecuteBatchParameters = EntityMutationOps
|
|
17
17
|
|
|
18
|
-
/** Return type for the
|
|
19
|
-
export type
|
|
18
|
+
/** Return type for the executeBatch function. */
|
|
19
|
+
export type ExecuteBatchReturnType = {
|
|
20
20
|
/** The transaction hash. */
|
|
21
21
|
txHash: Hash
|
|
22
22
|
/** The keys of the created entities, in batch order. */
|
|
@@ -31,14 +31,14 @@ export type MutateEntitiesReturnType = {
|
|
|
31
31
|
ownershipChanges: Hex[]
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export async function
|
|
34
|
+
export async function executeBatch(
|
|
35
35
|
client: ArkivClient,
|
|
36
|
-
data:
|
|
36
|
+
data: ExecuteBatchParameters,
|
|
37
37
|
txParams?: TxParams,
|
|
38
|
-
): Promise<
|
|
38
|
+
): Promise<ExecuteBatchReturnType> {
|
|
39
39
|
const { receipt, createdEntityKeys } = await sendArkivTransaction(client, data, txParams)
|
|
40
40
|
|
|
41
|
-
logger("Receipt from
|
|
41
|
+
logger("Receipt from executeBatch %o", receipt)
|
|
42
42
|
|
|
43
43
|
return {
|
|
44
44
|
txHash: receipt.transactionHash as Hash,
|
|
@@ -4,6 +4,7 @@ import type { Expiry } from "../../entity"
|
|
|
4
4
|
import { EntityMutationError } from "../../errors"
|
|
5
5
|
import type { TxParams } from "../../types"
|
|
6
6
|
import { sendArkivTransaction } from "../../utils/arkivTransactions"
|
|
7
|
+
import type { ExpirationTime } from "../../utils/expirationTime"
|
|
7
8
|
import { getLogger } from "../../utils/logger"
|
|
8
9
|
|
|
9
10
|
const logger = getLogger("actions:wallet:extend-entity")
|