@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
|
@@ -8,6 +8,56 @@ type Operation = {
|
|
|
8
8
|
operationData: Hex;
|
|
9
9
|
};
|
|
10
10
|
//#endregion
|
|
11
|
+
//#region src/entity/key.d.ts
|
|
12
|
+
/** The widest salt the `uint128` wire field carries. */
|
|
13
|
+
declare const MAX_SALT: bigint;
|
|
14
|
+
/**
|
|
15
|
+
* Opts a create out of salting, as {@link CreateEntityParameters.salt}: the key is then derived
|
|
16
|
+
* from the owner and its nonce alone, so anyone who knows both can work it out before the create
|
|
17
|
+
* lands.
|
|
18
|
+
*/
|
|
19
|
+
declare const NO_SALT: unique symbol;
|
|
20
|
+
/**
|
|
21
|
+
* A salt as a caller expresses it: an explicit `uint128`, or {@link NO_SALT} to opt out of salting.
|
|
22
|
+
*/
|
|
23
|
+
type SaltInput = bigint | typeof NO_SALT;
|
|
24
|
+
/**
|
|
25
|
+
* A cryptographically random 128-bit salt — what {@link CreateEntityParameters.salt} defaults to.
|
|
26
|
+
*
|
|
27
|
+
* The salt exists for unpredictability, not uniqueness: the per-owner nonce already guarantees
|
|
28
|
+
* distinct keys. Random bits mean only the creator can predict the key of an entity they are about
|
|
29
|
+
* to create, so nobody else can reference or squat it in advance.
|
|
30
|
+
*
|
|
31
|
+
* @throws {NoRandomSourceError} If the runtime has no `crypto.getRandomValues`.
|
|
32
|
+
*/
|
|
33
|
+
declare function randomSalt(): bigint;
|
|
34
|
+
/**
|
|
35
|
+
* The key an entity will be created with, derived exactly as the engine derives it:
|
|
36
|
+
* `keccak256(domain ++ owner ++ nonce ++ salt)`.
|
|
37
|
+
*
|
|
38
|
+
* Deriving it client-side is what lets a batch compose: predict the key of a create, then have a
|
|
39
|
+
* later operation in the same transaction reference it, or store it as a `key` attribute on a
|
|
40
|
+
* sibling entity.
|
|
41
|
+
*/
|
|
42
|
+
declare function predictEntityKey({
|
|
43
|
+
owner,
|
|
44
|
+
nonce,
|
|
45
|
+
salt,
|
|
46
|
+
chainId
|
|
47
|
+
}: {
|
|
48
|
+
/** The account creating the entity. */
|
|
49
|
+
owner: Address;
|
|
50
|
+
/**
|
|
51
|
+
* The owner's entity-nonce at creation time. Each create in a batch consumes one, so the *n*th
|
|
52
|
+
* create in a batch uses `nonce + n`.
|
|
53
|
+
*/
|
|
54
|
+
nonce: bigint;
|
|
55
|
+
/** The salt the create will carry, or {@link NO_SALT} if it carries none. */
|
|
56
|
+
salt: SaltInput;
|
|
57
|
+
/** The chain the entity is being created on — half of the derivation domain. */
|
|
58
|
+
chainId: number;
|
|
59
|
+
}): Hex;
|
|
60
|
+
//#endregion
|
|
11
61
|
//#region src/entity/errors.d.ts
|
|
12
62
|
/** An expiry could not be expressed, or would be rejected by the engine. */
|
|
13
63
|
declare class InvalidExpiryError extends Error {
|
|
@@ -19,7 +69,7 @@ declare class InvalidCreationFlagsError extends Error {
|
|
|
19
69
|
}
|
|
20
70
|
/** A key salt was outside the `uint128` the wire carries. */
|
|
21
71
|
declare class InvalidSaltError extends Error {
|
|
22
|
-
constructor(salt:
|
|
72
|
+
constructor(salt: unknown);
|
|
23
73
|
}
|
|
24
74
|
/** No cryptographic randomness was available to generate a salt. */
|
|
25
75
|
declare class NoRandomSourceError extends Error {
|
|
@@ -108,46 +158,6 @@ declare const ENTITY_EVENTS_ABI: readonly [{
|
|
|
108
158
|
/** The name of each event in {@link ENTITY_EVENTS_ABI}. */
|
|
109
159
|
type EntityEventName = (typeof ENTITY_EVENTS_ABI)[number]["name"];
|
|
110
160
|
//#endregion
|
|
111
|
-
//#region src/entity/key.d.ts
|
|
112
|
-
/** The widest salt the `uint128` wire field carries. */
|
|
113
|
-
declare const MAX_SALT: bigint;
|
|
114
|
-
/**
|
|
115
|
-
* A cryptographically random 128-bit salt — what {@link CreateEntityParameters.salt} defaults to.
|
|
116
|
-
*
|
|
117
|
-
* The salt exists for unpredictability, not uniqueness: the per-owner nonce already guarantees
|
|
118
|
-
* distinct keys. Random bits mean only the creator can predict the key of an entity they are about
|
|
119
|
-
* to create, so nobody else can reference or squat it in advance.
|
|
120
|
-
*
|
|
121
|
-
* @throws {NoRandomSourceError} If the runtime has no `crypto.getRandomValues`.
|
|
122
|
-
*/
|
|
123
|
-
declare function randomSalt(): bigint;
|
|
124
|
-
/**
|
|
125
|
-
* The key an entity will be created with, derived exactly as the engine derives it:
|
|
126
|
-
* `keccak256(domain ++ owner ++ nonce ++ salt)`.
|
|
127
|
-
*
|
|
128
|
-
* Deriving it client-side is what lets a batch compose: predict the key of a create, then have a
|
|
129
|
-
* later operation in the same transaction reference it, or store it as a `key` attribute on a
|
|
130
|
-
* sibling entity.
|
|
131
|
-
*/
|
|
132
|
-
declare function predictEntityKey({
|
|
133
|
-
owner,
|
|
134
|
-
nonce,
|
|
135
|
-
salt,
|
|
136
|
-
chainId
|
|
137
|
-
}: {
|
|
138
|
-
/** The account creating the entity. */
|
|
139
|
-
owner: Address;
|
|
140
|
-
/**
|
|
141
|
-
* The owner's entity-nonce at creation time. Each create in a batch consumes one, so the *n*th
|
|
142
|
-
* create in a batch uses `nonce + n`.
|
|
143
|
-
*/
|
|
144
|
-
nonce: bigint;
|
|
145
|
-
/** The salt the create will carry. */
|
|
146
|
-
salt: bigint;
|
|
147
|
-
/** The chain the entity is being created on — half of the derivation domain. */
|
|
148
|
-
chainId: number;
|
|
149
|
-
}): Hex;
|
|
150
|
-
//#endregion
|
|
151
161
|
//#region src/entity/params.d.ts
|
|
152
162
|
/**
|
|
153
163
|
* Max uint64 value
|
|
@@ -163,5 +173,5 @@ declare const OperationType: {
|
|
|
163
173
|
};
|
|
164
174
|
type OperationType = (typeof OperationType)[keyof typeof OperationType];
|
|
165
175
|
//#endregion
|
|
166
|
-
export {
|
|
167
|
-
//# sourceMappingURL=index-
|
|
176
|
+
export { InvalidCreationFlagsError as a, NoRandomSourceError as c, SaltInput as d, predictEntityKey as f, EntityEventName as i, MAX_SALT as l, Operation as m, OperationType as n, InvalidExpiryError as o, randomSalt as p, ENTITY_EVENTS_ABI as r, InvalidSaltError as s, MAX_EXPIRES_AT as t, NO_SALT as u };
|
|
177
|
+
//# sourceMappingURL=index-JP31fjyM.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-JP31fjyM.d.ts","names":[],"sources":["../src/entity/operations.ts","../src/entity/key.ts","../src/entity/errors.ts","../src/entity/events.ts","../src/entity/params.ts"],"sourcesContent":[],"mappings":";;;;;KAiDY,SAAA;;iBAEK;;;;;cC7CJ;AD2Cb;;;;AC3CA;AAOa,cAAA,OAA2B,EAAA,OAAA,MAAA;AAKxC;AAWA;AAkCA;AACE,KA9CU,SAAA,GA8CV,MAAA,GAAA,OA9CsC,OA8CtC;;;;;;;;;;iBAnCc,UAAA,CAAA;;AEvBhB;AASA;;;;ACZA;AAGA;AAQY,iBHiDI,gBAAA,CGjDoB;EAAA,KAA4B;EAAA,KAAA;EAAA,IAAA;EAAa;CAAA,EAAA;;SHwDpE;;;;;;;QAOD;;;IAGJ;;;;cC/ES,kBAAA,SAA2B,KAAA;;AFgDxC;;cExCa,yBAAA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 -45,8 +45,7 @@ type UserTypeTag = Exclude<TypeTag, "bytes">;
|
|
|
45
45
|
/**
|
|
46
46
|
* Marks a value as having passed its constructor's validation. The symbol is module-private, so a
|
|
47
47
|
* hand-written object literal is not assignable to {@link ArkivValue} — every value crossing the
|
|
48
|
-
* wire has been range-, length- and format-checked by
|
|
49
|
-
* friends.
|
|
48
|
+
* wire has been range-, length- and format-checked by `i32`, `u256`, `dec`, and friends.
|
|
50
49
|
*/
|
|
51
50
|
declare const validated: unique symbol;
|
|
52
51
|
/**
|
|
@@ -78,7 +77,7 @@ type U256Value = Value<"u256", bigint>;
|
|
|
78
77
|
type DecValue = Value<"dec", string>;
|
|
79
78
|
/** 32 opaque bytes, as lowercase `0x` hex. */
|
|
80
79
|
type Bytes32Value = Value<"bytes32", Hex>;
|
|
81
|
-
/** A UTF-8 string of at most 128 bytes. */
|
|
80
|
+
/** A UTF-8 string of at most 128 bytes, free of C0 control characters and DEL. */
|
|
82
81
|
type StrValue = Value<"str", string>;
|
|
83
82
|
/** A 20-byte Ethereum address, as EIP-55 checksummed hex. */
|
|
84
83
|
type AddrValue = Value<"addr", Address>;
|
|
@@ -205,7 +204,11 @@ declare function decFromUnits(units: bigint): DecValue;
|
|
|
205
204
|
*
|
|
206
205
|
* The limit is on **bytes**, not characters: a string of 128 emoji does not fit.
|
|
207
206
|
*
|
|
208
|
-
*
|
|
207
|
+
* C0 control characters and DEL are rejected: the query language writes a `str` as `str('...')`,
|
|
208
|
+
* whose only escape is a doubled quote, so a control character could be stored but never queried.
|
|
209
|
+
*
|
|
210
|
+
* @throws {InvalidValueError} If the value is not a string, holds a control character, or exceeds
|
|
211
|
+
* 128 UTF-8 bytes.
|
|
209
212
|
*
|
|
210
213
|
* @example
|
|
211
214
|
* str("Bob")
|
|
@@ -296,11 +299,15 @@ declare function toValue(input: ValueInput, attributeName?: string): ArkivValue;
|
|
|
296
299
|
* The most attribute cells one operation may carry.
|
|
297
300
|
*/
|
|
298
301
|
declare const MAX_ATTRIBUTES = 32;
|
|
302
|
+
/**
|
|
303
|
+
* The largest payload an entity may carry, in bytes. The payload travels as the `$payload` system
|
|
304
|
+
* cell, so this is a bound on that one attribute rather than on the operation as a whole.
|
|
305
|
+
*/
|
|
299
306
|
declare const MAX_PAYLOAD_BYTES: number;
|
|
300
307
|
/**
|
|
301
308
|
* The attributes written on an entity, as a plain object keyed by attribute name.
|
|
302
309
|
*
|
|
303
|
-
* Values may be tagged ({@link
|
|
310
|
+
* Values may be tagged ({@link ArkivValue}) or bare where the type is unambiguous — see
|
|
304
311
|
* {@link toValue} for the bare-form defaults.
|
|
305
312
|
*
|
|
306
313
|
* @example
|
|
@@ -414,4 +421,4 @@ declare function validateAttributeName(name: string): void;
|
|
|
414
421
|
declare function isValidAttributeName(name: string): boolean;
|
|
415
422
|
//#endregion
|
|
416
423
|
export { i32 as A, Bytes32Value as B, ValueInput as C, dec as D, bytes32 as E, u64 as F, StrValue as G, DecValue as H, AddrValue as I, U64Value as J, TypeTag as K, AnyArkivValue as L, str as M, toValue as N, decFromUnits as O, u256 as P, ArkivValue as R, U64_MAX as S, bool as T, I32Value as U, BytesValue as V, KeyValue as W, isArkivValue as X, UserTypeTag as Y, MAX_PAYLOAD_BYTES as _, InvalidAttributeNameError as a, MAX_STRING_BYTES as b, TooManyAttributesError as c, DECIMAL_SCALE as d, DECIMAL_UNIT as f, MAX_ATTRIBUTES as g, Attributes as h, ConflictingMutationError as i, key as j, decUnits as k, UnknownAttributeTypeError as l, AttributeSchema as m, isValidAttributeName as n, InvalidValueError as o, AttributeInputs as p, U256Value as q, validateAttributeName as r, MissingValueError as s, MAX_NAME_BYTES as t, UntypedValueError as u, I32_MAX as v, addr as w, U256_MAX as x, I32_MIN as y, BoolValue as z };
|
|
417
|
-
//# sourceMappingURL=index-
|
|
424
|
+
//# sourceMappingURL=index-NbfnXxgr.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-NbfnXxgr.d.cts","names":[],"sources":["../src/attr/types.ts","../src/attr/values.ts","../src/attr/attributes.ts","../src/attr/decimal.ts","../src/attr/errors.ts","../src/attr/names.ts"],"sourcesContent":[],"mappings":";;;;;;AAwBA;AAcA;AASA;AAKC;AAgBD;;;;;;;AAOA;AAEA;AAIA;AAEA;AAKA;AAEA;AAEA;AAEA;AAEY,cAxEC,QAwEuB,EAAA;EAKxB,SAAA,IAAU,EAAA,CAAA;EAGV,SAAA,GAAA,EAAU,CAAA;EAClB,SAAA,GAAA,EAAA,CAAA;EACA,SAAA,IAAA,EAAA,CAAA;EACA,SAAA,GAAA,EAAA,CAAA;EACA,SAAA,OAAA,EAAA,CAAA;EACA,SAAA,KAAA,EAAA,CAAA;EACA,SAAA,GAAA,EAAA,CAAA;EACA,SAAA,IAAA,EAAA,CAAA;EACA,SAAA,GAAA,EAAA,EAAA;CACA;;AAGQ,KA9EA,OAAA,GA8Ea,MAAA,OA9EU,QA8EP;;;ACvF5B;AAEA;AAEa,KDcD,WAAA,GAAc,OCdW,CDcH,OCdG,EAAA,OAAA,CAAA;AA4BrC;AAkBA;AA8CA;AAoBA;AAgFA;AA6BA,cDnMc,SCmMU,EAAA,OAAQ,MAAQ;AAUxC;AAkBA;AAwCA;AA8BA;;;;AAAsD,KD5R1C,KC4R0C,CAAA,YD5RxB,OC4RwB,EAAA,KAAA,CAAA,GAAA;EAgBtC,SAAA,IAAO,ED3SN,GC2SM;EAAQ,SAAA,KAAA,ED1Sb,KC0Sa;EAAM,UDzSzB,SAAA,CCySyB,EDzSb,GCySa;CAAa;;AA4CtC,KDjVA,SAAA,GAAY,KCiVF,CAAG,MAAA,EAAA,OAAU,CAAA;AAqBnC;KDpWY,QAAA,GAAW;;;AEnEvB;AAMa,KFiED,QAAA,GAAW,KEjEoB,CAAA,KAAA,EAAA,MAAA,CAAA;AAuB3C;AAAsD,KF4C1C,SAAA,GAAY,KE5C8B,CAAA,MAAA,EAAA,MAAA,CAAA;;;;AAQtD;AAAiD,KFyCrC,QAAA,G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
|
|
1
|
-
const require_chains = require('./chains-
|
|
2
|
-
const require_expiry = require('./expiry-
|
|
3
|
-
const require_advanced = require('./advanced-
|
|
4
|
-
const require_attributes = require('./attributes-
|
|
5
|
-
const require_key = require('./key-
|
|
6
|
-
const require_errors = require('./errors-
|
|
7
|
-
const require_flags = require('./flags-
|
|
1
|
+
const require_chains = require('./chains-BfNQliHU.cjs');
|
|
2
|
+
const require_expiry = require('./expiry-xr6mx4f7.cjs');
|
|
3
|
+
const require_advanced = require('./advanced-Ds2XRflQ.cjs');
|
|
4
|
+
const require_attributes = require('./attributes-CMJlp1wn.cjs');
|
|
5
|
+
const require_key = require('./key-E7mv0BYf.cjs');
|
|
6
|
+
const require_errors = require('./errors-51znTSB1.cjs');
|
|
7
|
+
const require_flags = require('./flags-Bh0HJldY.cjs');
|
|
8
8
|
const require_logger = require('./logger-Cr15lPAQ.cjs');
|
|
9
9
|
require('./attr-DlmErkvR.cjs');
|
|
10
10
|
const require_entity = require('./entity-B00Li04j.cjs');
|
|
11
|
-
const require_queryBuilder = require('./queryBuilder-
|
|
11
|
+
const require_queryBuilder = require('./queryBuilder-BXR-HxD9.cjs');
|
|
12
12
|
require('./entity-B7G8q_Eo.cjs');
|
|
13
13
|
require('./types-NRqymi6S.cjs');
|
|
14
|
-
const require_payload = require('./payload-
|
|
14
|
+
const require_payload = require('./payload-Cvrir3Q-.cjs');
|
|
15
15
|
let viem = require("viem");
|
|
16
16
|
let viem_actions = require("viem/actions");
|
|
17
17
|
|
|
@@ -102,7 +102,7 @@ async function getEntityNonce(client, owner) {
|
|
|
102
102
|
*
|
|
103
103
|
* The prediction is valid only while nothing else from this owner is in flight. Every create that
|
|
104
104
|
* lands first takes the nonce with it and moves these keys. For a key you can rely on
|
|
105
|
-
* unconditionally, read it back from the create instead — `createEntity` and `
|
|
105
|
+
* unconditionally, read it back from the create instead — `createEntity` and `executeBatch`
|
|
106
106
|
* report the keys the engine actually minted.
|
|
107
107
|
*
|
|
108
108
|
* @param parameters - Owner, and either a count or the salts. {@link PredictEntityKeysParameters}
|
|
@@ -112,7 +112,7 @@ async function getEntityNonce(client, owner) {
|
|
|
112
112
|
* import { key } from "@arkiv-network/sdk/attr"
|
|
113
113
|
*
|
|
114
114
|
* const [parent, child] = await client.predictEntityKeys({ owner: account.address, count: 2 })
|
|
115
|
-
* await
|
|
115
|
+
* await client.executeBatch({
|
|
116
116
|
* creates: [
|
|
117
117
|
* { payload, contentType, expires, salt: parent.salt },
|
|
118
118
|
* {
|
|
@@ -143,7 +143,7 @@ async function predictEntityKeys(client, { owner, count, salts }) {
|
|
|
143
143
|
function resolveSalts(count, salts) {
|
|
144
144
|
if (salts !== void 0) {
|
|
145
145
|
if (salts.length === 0) throw new Error("predictEntityKeys: `salts` is empty — there is nothing to predict");
|
|
146
|
-
return salts.map(require_key.
|
|
146
|
+
return salts.map(require_key.resolveSalt);
|
|
147
147
|
}
|
|
148
148
|
if (count === void 0) throw new Error("predictEntityKeys: pass either `count` or `salts`");
|
|
149
149
|
if (!Number.isInteger(count) || count <= 0) throw new Error(`predictEntityKeys: \`count\` must be a positive whole number, got ${count}`);
|
|
@@ -358,14 +358,14 @@ function publicArkivActions(client) {
|
|
|
358
358
|
//#endregion
|
|
359
359
|
//#region src/clients/createPublicClient.ts
|
|
360
360
|
/**
|
|
361
|
-
* Creates a Public Client with a given [Transport](https://viem.sh/docs/clients/intro) configured for a [Chain](https://viem.sh/docs/
|
|
361
|
+
* Creates a Public Client with a given [Transport](https://viem.sh/docs/clients/intro) configured for a [Chain](https://viem.sh/docs/chains/introduction).
|
|
362
362
|
*
|
|
363
|
-
* -
|
|
364
|
-
*
|
|
365
|
-
*
|
|
363
|
+
* A Public Client is an interface to the "public" [Ethereum JSON-RPC API](https://ethereum.org/en/developers/docs/apis/json-rpc/)
|
|
364
|
+
* and the Arkiv JSON-RPC API — retrieving block numbers and transactions, reading from
|
|
365
|
+
* contracts, and querying entities — through {@link PublicArkivActions}.
|
|
366
366
|
*
|
|
367
367
|
* @param parameters - Configuration object for the public client (chain, transport, etc.)
|
|
368
|
-
* @returns
|
|
368
|
+
* @returns An Arkiv Public Client. {@link PublicArkivClient}
|
|
369
369
|
*
|
|
370
370
|
* @example
|
|
371
371
|
* import { createPublicClient } from "@arkiv-network/sdk"
|
|
@@ -429,13 +429,29 @@ async function deleteEntity(client, data, txParams) {
|
|
|
429
429
|
};
|
|
430
430
|
}
|
|
431
431
|
|
|
432
|
+
//#endregion
|
|
433
|
+
//#region src/actions/wallet/executeBatch.ts
|
|
434
|
+
const logger$2 = require_logger.getLogger("actions:wallet:execute-batch");
|
|
435
|
+
async function executeBatch(client, data, txParams) {
|
|
436
|
+
const { receipt, createdEntityKeys } = await require_advanced.sendArkivTransaction(client, data, txParams);
|
|
437
|
+
logger$2("Receipt from executeBatch %o", receipt);
|
|
438
|
+
return {
|
|
439
|
+
txHash: receipt.transactionHash,
|
|
440
|
+
createdEntities: createdEntityKeys,
|
|
441
|
+
patchedEntities: (data.patches ?? []).map((p) => p.entityKey),
|
|
442
|
+
deletedEntities: (data.deletes ?? []).map((d) => d.entityKey),
|
|
443
|
+
extendedEntities: (data.extensions ?? []).map((e) => e.entityKey),
|
|
444
|
+
ownershipChanges: (data.ownershipChanges ?? []).map((o) => o.entityKey)
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
|
|
432
448
|
//#endregion
|
|
433
449
|
//#region src/actions/wallet/extendEntity.ts
|
|
434
|
-
const logger$
|
|
450
|
+
const logger$1 = require_logger.getLogger("actions:wallet:extend-entity");
|
|
435
451
|
async function extendEntity(client, data, txParams) {
|
|
436
|
-
logger$
|
|
452
|
+
logger$1("extendEntity %o", data);
|
|
437
453
|
const { receipt, extendedExpiries } = await require_advanced.sendArkivTransaction(client, { extensions: [data] }, txParams);
|
|
438
|
-
logger$
|
|
454
|
+
logger$1("Receipt from extendEntity %o", receipt);
|
|
439
455
|
const [expiresAt] = extendedExpiries;
|
|
440
456
|
if (expiresAt === void 0) throw new require_logger.EntityMutationError(`Transaction ${receipt.transactionHash} succeeded, but the receipt did not carry the expected entity expiry.`);
|
|
441
457
|
return {
|
|
@@ -445,22 +461,6 @@ async function extendEntity(client, data, txParams) {
|
|
|
445
461
|
};
|
|
446
462
|
}
|
|
447
463
|
|
|
448
|
-
//#endregion
|
|
449
|
-
//#region src/actions/wallet/mutateEntities.ts
|
|
450
|
-
const logger$1 = require_logger.getLogger("actions:wallet:mutate-entities");
|
|
451
|
-
async function mutateEntities(client, data, txParams) {
|
|
452
|
-
const { receipt, createdEntityKeys } = await require_advanced.sendArkivTransaction(client, data, txParams);
|
|
453
|
-
logger$1("Receipt from mutateEntities %o", receipt);
|
|
454
|
-
return {
|
|
455
|
-
txHash: receipt.transactionHash,
|
|
456
|
-
createdEntities: createdEntityKeys,
|
|
457
|
-
patchedEntities: (data.patches ?? []).map((p) => p.entityKey),
|
|
458
|
-
deletedEntities: (data.deletes ?? []).map((d) => d.entityKey),
|
|
459
|
-
extendedEntities: (data.extensions ?? []).map((e) => e.entityKey),
|
|
460
|
-
ownershipChanges: (data.ownershipChanges ?? []).map((o) => o.entityKey)
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
|
|
464
464
|
//#endregion
|
|
465
465
|
//#region src/actions/wallet/patchEntity.ts
|
|
466
466
|
const logger = require_logger.getLogger("actions:wallet:patch-entity");
|
|
@@ -483,7 +483,7 @@ function walletArkivActions(client) {
|
|
|
483
483
|
deleteEntity: (data, txParams) => deleteEntity(client, data, txParams),
|
|
484
484
|
extendEntity: (data, txParams) => extendEntity(client, data, txParams),
|
|
485
485
|
changeOwnership: (data, txParams) => changeOwnership(client, data, txParams),
|
|
486
|
-
|
|
486
|
+
executeBatch: (data, txParams) => executeBatch(client, data, txParams),
|
|
487
487
|
advanced: walletAdvancedActions(client)
|
|
488
488
|
};
|
|
489
489
|
}
|
|
@@ -492,16 +492,14 @@ function walletArkivActions(client) {
|
|
|
492
492
|
//#region src/clients/createWalletClient.ts
|
|
493
493
|
/**
|
|
494
494
|
* Creates a Wallet Client with a given [Transport](https://viem.sh/docs/clients/intro) configured
|
|
495
|
-
* for a [Chain](https://viem.sh/docs/
|
|
496
|
-
*
|
|
497
|
-
* - Docs: https://docs.arkiv.network/ts-sdk/clients/wallet
|
|
495
|
+
* for a [Chain](https://viem.sh/docs/chains/introduction) and an account.
|
|
498
496
|
*
|
|
499
497
|
* A Wallet Client signs and sends transactions, so it carries an `account` and exposes everything
|
|
500
498
|
* that mutates state — `createEntity`, `patchEntity`, `deleteEntity`, `extendEntity`,
|
|
501
|
-
* `changeOwnership` and `
|
|
499
|
+
* `changeOwnership` and `executeBatch` — on top of the read actions a Public Client has.
|
|
502
500
|
*
|
|
503
501
|
* @param parameters - Configuration object for the wallet client (chain, transport, account, etc.)
|
|
504
|
-
* @returns
|
|
502
|
+
* @returns An Arkiv Wallet Client. {@link WalletArkivClient}
|
|
505
503
|
*
|
|
506
504
|
* @example
|
|
507
505
|
* import { createWalletClient } from "@arkiv-network/sdk"
|
|
@@ -563,6 +561,7 @@ exports.MAX_PAYLOAD_BYTES = require_attributes.MAX_PAYLOAD_BYTES;
|
|
|
563
561
|
exports.MAX_SALT = require_key.MAX_SALT;
|
|
564
562
|
exports.MAX_STRING_BYTES = require_attributes.MAX_STRING_BYTES;
|
|
565
563
|
exports.MissingValueError = require_attributes.MissingValueError;
|
|
564
|
+
exports.NO_SALT = require_key.NO_SALT;
|
|
566
565
|
exports.NoEntityFoundError = require_logger.NoEntityFoundError;
|
|
567
566
|
exports.NoMoreResultsError = require_logger.NoMoreResultsError;
|
|
568
567
|
exports.NoRandomSourceError = require_errors.NoRandomSourceError;
|