@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
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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, i as SelectArg, j as ArkivClient, n as FullEntity, p as Expression, r as ProjectedEntity, s as Entity, t as EntitySelection } from "./selection-
|
|
2
|
-
import { a as Bytes32Value, c as I32Value, d as TypeTag, f as U256Value, h as isArkivValue, i as BoolValue, l as KeyValue, m as UserTypeTag, n as AnyArkivValue, o as BytesValue, p as U64Value, r as ArkivValue, s as DecValue, t as AddrValue, u as StrValue } from "./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, i as SelectArg, j as ArkivClient, n as FullEntity, p as Expression, r as ProjectedEntity, s as Entity, t as EntitySelection } from "./selection-mjiiAGDO.js";
|
|
2
|
+
import { a as Bytes32Value, c as I32Value, d as TypeTag, f as U256Value, h as isArkivValue, i as BoolValue, l as KeyValue, m as UserTypeTag, n as AnyArkivValue, o as BytesValue, p as U64Value, r as ArkivValue, s as DecValue, t as AddrValue, u as StrValue } from "./codec-M74UR1_0.js";
|
|
3
3
|
import { a as ResolvedExpiry, i as Lifetime, n as Expiry, o as resolveExpiry, r as ExpiryContext, s as toBlocks, t as EncodedExpiry } from "./expiry-nDbCgZX4.js";
|
|
4
|
-
import { a as
|
|
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, a as mutationNeedsBlockNumber, b as WatchEntityEventsParameters, c as TxParams, d as PatchEntityReturnType, f as
|
|
6
|
-
import { A as i32, C as ValueInput, D as dec, E as bytes32, F as u64, M as str, N as toValue, O as decFromUnits, P as u256, S as U64_MAX, T as bool, _ as MAX_PAYLOAD_BYTES, a as InvalidAttributeNameError, b as MAX_STRING_BYTES, c as TooManyAttributesError, d as DECIMAL_SCALE, f as DECIMAL_UNIT, g as MAX_ATTRIBUTES, h as Attributes, i as ConflictingMutationError, j as key, k as decUnits, l as UnknownAttributeTypeError, m as AttributeSchema, n as isValidAttributeName, o as InvalidValueError, p as AttributeInputs, r as validateAttributeName, s as MissingValueError, t as MAX_NAME_BYTES, u as UntypedValueError, v as I32_MAX, w as addr, x as U256_MAX, y as I32_MIN } from "./index-
|
|
4
|
+
import { a as InvalidCreationFlagsError, c as NoRandomSourceError, d as SaltInput, f as predictEntityKey, i as EntityEventName, l as MAX_SALT, m as Operation, n as OperationType, o as InvalidExpiryError, p as randomSalt, r as ENTITY_EVENTS_ABI, s as InvalidSaltError, t as MAX_EXPIRES_AT, u as NO_SALT } from "./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, a as mutationNeedsBlockNumber, b as WatchEntityEventsParameters, c as TxParams, d as PatchEntityReturnType, f as ExtendEntityParameters, g as DeleteEntityParameters, h as ExecuteBatchReturnType, i as collectMutationEvents, j as PredictEntityKeysReturnType, k as QueryReturnType, l as MimeType, m as ExecuteBatchParameters, n as MutationEvents, o as ChangeOwnershipParameters, p as ExtendEntityReturnType, r as buildEntityOperations, s as ChangeOwnershipReturnType, t as EntityMutationOps, u as PatchEntityParameters, v as CreateEntityParameters, w as EntityEventContext, x as EntityCreatedEvent, y as CreateEntityReturnType } from "./arkivTransactions-DfZ_yVDD.js";
|
|
6
|
+
import { A as i32, C as ValueInput, D as dec, E as bytes32, F as u64, M as str, N as toValue, O as decFromUnits, P as u256, S as U64_MAX, T as bool, _ as MAX_PAYLOAD_BYTES, a as InvalidAttributeNameError, b as MAX_STRING_BYTES, c as TooManyAttributesError, d as DECIMAL_SCALE, f as DECIMAL_UNIT, g as MAX_ATTRIBUTES, h as Attributes, i as ConflictingMutationError, j as key, k as decUnits, l as UnknownAttributeTypeError, m as AttributeSchema, n as isValidAttributeName, o as InvalidValueError, p as AttributeInputs, r as validateAttributeName, s as MissingValueError, t as MAX_NAME_BYTES, u as UntypedValueError, v as I32_MAX, w as addr, x as U256_MAX, y as I32_MIN } from "./index-D0IzFwMX.js";
|
|
7
7
|
import { i as encodeCreationFlags, n as ResolvedCreationFlags, r as decodeCreationFlags, t as CreationFlags } from "./flags-5dTNRnow.js";
|
|
8
|
-
import { a as pingTransaction, c as decodeMutationResult, d as BuildMutationReturnType, f as buildMutation, i as PingTransactionReturnType, l as getMutationResult, n as SendMutationReturnType, o as GetMutationResultReturnType, r as sendMutation, s as MutationResult, t as SendMutationOptions, u as BuildMutationOptions } from "./index-
|
|
9
|
-
import { t as SelectQueryBuilder } from "./index-
|
|
10
|
-
import { i as ExpirationTime, n as stringToPayload, r as DeadlineOptions, t as jsonToPayload } from "./payload-
|
|
8
|
+
import { a as pingTransaction, c as decodeMutationResult, d as BuildMutationReturnType, f as buildMutation, i as PingTransactionReturnType, l as getMutationResult, n as SendMutationReturnType, o as GetMutationResultReturnType, r as sendMutation, s as MutationResult, t as SendMutationOptions, u as BuildMutationOptions } from "./index-CTDI5pXZ.js";
|
|
9
|
+
import { t as SelectQueryBuilder } from "./index-Dz4SkQWg.js";
|
|
10
|
+
import { i as ExpirationTime, n as stringToPayload, r as DeadlineOptions, t as jsonToPayload } from "./payload-D53ms-Mg.js";
|
|
11
11
|
import { Account, Address, Chain, Client, Hash, Hex, ParseAccount, Prettify, PublicActions, PublicClientConfig, RpcSchema, TransactionReceipt, Transport, WalletActions, WalletClientConfig } from "viem";
|
|
12
12
|
|
|
13
13
|
//#region src/clients/decorators/arkivAdvanced.d.ts
|
|
@@ -60,7 +60,7 @@ type PublicAdvancedActions = {
|
|
|
60
60
|
* costing the minimum number of RPC calls — down to one per transaction when you supply what the
|
|
61
61
|
* SDK would otherwise look up.
|
|
62
62
|
*
|
|
63
|
-
* The everyday actions (`createEntity`, `
|
|
63
|
+
* The everyday actions (`createEntity`, `executeBatch`, …) bundle send + wait + decode and are
|
|
64
64
|
* the right default. This namespace unbundles them for callers optimising their RPC budget.
|
|
65
65
|
*
|
|
66
66
|
* @example Minimal-call flow: one send, one ping, done.
|
|
@@ -105,11 +105,15 @@ type PublicArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
105
105
|
/**
|
|
106
106
|
* Returns the entity with the given key.
|
|
107
107
|
*
|
|
108
|
-
* -
|
|
108
|
+
* - JSON-RPC Methods: `arkiv_query`
|
|
109
109
|
*
|
|
110
110
|
* @param key - The entity key (hex string)
|
|
111
111
|
* @returns The entity with the given key, with every field populated. {@link FullEntity}
|
|
112
112
|
*
|
|
113
|
+
* @throws {InvalidValueError} If the key is not 32 bytes.
|
|
114
|
+
* @throws {NoEntityFoundError} If no live entity has that key — it never existed, or it was
|
|
115
|
+
* deleted or has expired.
|
|
116
|
+
*
|
|
113
117
|
* @example
|
|
114
118
|
* import { createPublicClient } from "@arkiv-network/sdk"
|
|
115
119
|
* import { cheesecake } from "@arkiv-network/sdk/chains"
|
|
@@ -135,7 +139,7 @@ type PublicArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
135
139
|
* read entities. You declare up front which parts of an entity you want returned, so results
|
|
136
140
|
* always contain exactly the data you asked for.
|
|
137
141
|
*
|
|
138
|
-
* -
|
|
142
|
+
* - JSON-RPC Methods: `arkiv_query`
|
|
139
143
|
*
|
|
140
144
|
* @param selection - What to include in the results. Omit it (or pass `"*"`) to select everything,
|
|
141
145
|
* or pass an object to select specific parts (at least one field is required). Every part is
|
|
@@ -195,7 +199,7 @@ type PublicArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
195
199
|
/**
|
|
196
200
|
* Runs one query and returns one page, with no builder in between.
|
|
197
201
|
*
|
|
198
|
-
* Use {@link select} for anything typed — this returns full {@link Entity} objects whatever the
|
|
202
|
+
* Use {@link PublicArkivActions.select} for anything typed — this returns full {@link Entity} objects whatever the
|
|
199
203
|
* selection, and takes a raw string as an escape hatch for a query built elsewhere. A raw string
|
|
200
204
|
* goes to the node exactly as written, with none of the name, type or operator checks the
|
|
201
205
|
* expression combinators apply.
|
|
@@ -286,7 +290,7 @@ type PublicArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
286
290
|
* import { key } from "@arkiv-network/sdk/attr"
|
|
287
291
|
*
|
|
288
292
|
* const [parent, child] = await client.predictEntityKeys({ owner: account.address, count: 2 })
|
|
289
|
-
* await wallet.
|
|
293
|
+
* await wallet.executeBatch({
|
|
290
294
|
* creates: [
|
|
291
295
|
* { payload, contentType, expires, salt: parent.salt },
|
|
292
296
|
* {
|
|
@@ -299,7 +303,7 @@ type PublicArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
299
303
|
* ],
|
|
300
304
|
* })
|
|
301
305
|
*/
|
|
302
|
-
predictEntityKeys: <const TCount extends number = number, const TSalts extends readonly
|
|
306
|
+
predictEntityKeys: <const TCount extends number = number, const TSalts extends readonly SaltInput[] | undefined = undefined>(parameters: PredictEntityKeysParameters<TCount, TSalts>) => Promise<PredictEntityKeysReturnType<TCount, TSalts>>;
|
|
303
307
|
/**
|
|
304
308
|
* Returns the current block timing.
|
|
305
309
|
* @returns The current block timing. {@link GetBlockTimingReturnType}
|
|
@@ -320,11 +324,7 @@ type PublicArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
320
324
|
* // blockDuration: 2, // in seconds
|
|
321
325
|
* // }
|
|
322
326
|
*/
|
|
323
|
-
getBlockTiming: () => Promise<
|
|
324
|
-
currentBlock: bigint;
|
|
325
|
-
currentBlockTime: number;
|
|
326
|
-
blockDuration: number;
|
|
327
|
-
}>;
|
|
327
|
+
getBlockTiming: () => Promise<GetBlockTimingReturnType>;
|
|
328
328
|
/**
|
|
329
329
|
* Watches entity events, calling the handlers you pass as they arrive.
|
|
330
330
|
*
|
|
@@ -366,14 +366,14 @@ type PublicArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
366
366
|
//#region src/clients/createPublicClient.d.ts
|
|
367
367
|
type PublicArkivClient<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, accountOrAddress extends Account | undefined = undefined, rpcSchema extends RpcSchema | undefined = ArkivRpcSchema> = Prettify<Client<transport, chain, accountOrAddress, rpcSchema, PublicArkivActions<transport, chain>>>;
|
|
368
368
|
/**
|
|
369
|
-
* Creates a Public Client with a given [Transport](https://viem.sh/docs/clients/intro) configured for a [Chain](https://viem.sh/docs/
|
|
370
|
-
*
|
|
371
|
-
* - Docs: https://docs.arkiv.network/ts-sdk/clients/public
|
|
369
|
+
* Creates a Public Client with a given [Transport](https://viem.sh/docs/clients/intro) configured for a [Chain](https://viem.sh/docs/chains/introduction).
|
|
372
370
|
*
|
|
373
|
-
* A Public Client is an interface to "public" [Ethereum JSON-RPC API](https://ethereum.org/en/developers/docs/apis/json-rpc/)
|
|
371
|
+
* A Public Client is an interface to the "public" [Ethereum JSON-RPC API](https://ethereum.org/en/developers/docs/apis/json-rpc/)
|
|
372
|
+
* and the Arkiv JSON-RPC API — retrieving block numbers and transactions, reading from
|
|
373
|
+
* contracts, and querying entities — through {@link PublicArkivActions}.
|
|
374
374
|
*
|
|
375
375
|
* @param parameters - Configuration object for the public client (chain, transport, etc.)
|
|
376
|
-
* @returns
|
|
376
|
+
* @returns An Arkiv Public Client. {@link PublicArkivClient}
|
|
377
377
|
*
|
|
378
378
|
* @example
|
|
379
379
|
* import { createPublicClient } from "@arkiv-network/sdk"
|
|
@@ -392,12 +392,12 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
392
392
|
/**
|
|
393
393
|
* Creates a new entity.
|
|
394
394
|
*
|
|
395
|
-
* -
|
|
396
|
-
* - JSON-RPC Methods: [`eth_sendRawTransaction`](https://docs.arkiv.network/dev/json-rpc-api/#mutateEntities)
|
|
395
|
+
* - JSON-RPC Methods: `eth_sendRawTransaction`
|
|
397
396
|
*
|
|
398
397
|
* @param data - The entity creation parameters
|
|
399
398
|
* @param txParams - Optional transaction parameters
|
|
400
|
-
* @returns The
|
|
399
|
+
* @returns The new entity's key, the transaction hash, and the block it is expected to
|
|
400
|
+
* expire at. {@link CreateEntityReturnType}
|
|
401
401
|
*
|
|
402
402
|
* @throws {InvalidExpiryError} If the expiry exceeds a protocol bound or would leave the
|
|
403
403
|
* entity dead on arrival.
|
|
@@ -409,8 +409,10 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
409
409
|
* import { i32 } from "@arkiv-network/sdk/attr"
|
|
410
410
|
* import { cheesecake } from "@arkiv-network/sdk/chains"
|
|
411
411
|
* import { http } from "viem"
|
|
412
|
+
* import { privateKeyToAccount } from "viem/accounts"
|
|
412
413
|
*
|
|
413
414
|
* const client = createWalletClient({
|
|
415
|
+
* account: privateKeyToAccount("0x..."),
|
|
414
416
|
* chain: cheesecake,
|
|
415
417
|
* transport: http(),
|
|
416
418
|
* })
|
|
@@ -426,12 +428,11 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
426
428
|
* Applies a patch to the entity with the given key: sets some fields, unsets others, and leaves
|
|
427
429
|
* everything it does not name alone.
|
|
428
430
|
*
|
|
429
|
-
* -
|
|
430
|
-
* - JSON-RPC Methods: [`eth_sendRawTransaction`](https://docs.arkiv.network/dev/json-rpc-api/#mutateEntities)
|
|
431
|
+
* - JSON-RPC Methods: `eth_sendRawTransaction`
|
|
431
432
|
*
|
|
432
433
|
* @param data - The entity key and the mutations to apply
|
|
433
434
|
* @param txParams - Optional transaction parameters
|
|
434
|
-
* @returns The entity key and the transaction hash
|
|
435
|
+
* @returns The patched entity's key and the transaction hash. {@link PatchEntityReturnType}
|
|
435
436
|
*
|
|
436
437
|
* @throws {EmptyPatchError} If the patch has nothing to apply.
|
|
437
438
|
* @throws {ConflictingMutationError} If a name appears in both `set` and `unset`.
|
|
@@ -443,8 +444,10 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
443
444
|
* import { i32 } from "@arkiv-network/sdk/attr"
|
|
444
445
|
* import { cheesecake } from "@arkiv-network/sdk/chains"
|
|
445
446
|
* import { http } from "viem"
|
|
447
|
+
* import { privateKeyToAccount } from "viem/accounts"
|
|
446
448
|
*
|
|
447
449
|
* const client = createWalletClient({
|
|
450
|
+
* account: privateKeyToAccount("0x..."),
|
|
448
451
|
* chain: cheesecake,
|
|
449
452
|
* transport: http(),
|
|
450
453
|
* })
|
|
@@ -460,19 +463,20 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
460
463
|
/**
|
|
461
464
|
* Deletes the entity with the given key.
|
|
462
465
|
*
|
|
463
|
-
* -
|
|
464
|
-
* - JSON-RPC Methods: [`eth_sendRawTransaction`](https://docs.arkiv.network/dev/json-rpc-api/#mutateEntities)
|
|
466
|
+
* - JSON-RPC Methods: `eth_sendRawTransaction`
|
|
465
467
|
*
|
|
466
468
|
* @param data - The entity deletion parameters
|
|
467
469
|
* @param txParams - Optional transaction parameters
|
|
468
|
-
* @returns The deleted entity
|
|
470
|
+
* @returns The deleted entity's key and the transaction hash. {@link DeleteEntityReturnType}
|
|
469
471
|
*
|
|
470
472
|
* @example
|
|
471
473
|
* import { createWalletClient } from "@arkiv-network/sdk"
|
|
472
474
|
* import { cheesecake } from "@arkiv-network/sdk/chains"
|
|
473
475
|
* import { http } from "viem"
|
|
476
|
+
* import { privateKeyToAccount } from "viem/accounts"
|
|
474
477
|
*
|
|
475
478
|
* const client = createWalletClient({
|
|
479
|
+
* account: privateKeyToAccount("0x..."),
|
|
476
480
|
* chain: cheesecake,
|
|
477
481
|
* transport: http(),
|
|
478
482
|
* })
|
|
@@ -487,12 +491,12 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
487
491
|
* than adding to what the entity has left, and `atBlock` / `atDate` pin an absolute deadline.
|
|
488
492
|
* The engine rejects an extension that would not move the expiry later.
|
|
489
493
|
*
|
|
490
|
-
* -
|
|
491
|
-
* - JSON-RPC Methods: [`eth_sendRawTransaction`](https://docs.arkiv.network/dev/json-rpc-api/#mutateEntities)
|
|
494
|
+
* - JSON-RPC Methods: `eth_sendRawTransaction`
|
|
492
495
|
*
|
|
493
496
|
* @param data - The entity key and its new lifetime
|
|
494
497
|
* @param txParams - Optional transaction parameters
|
|
495
|
-
* @returns The entity key, transaction hash, and the block it is now expected to expire
|
|
498
|
+
* @returns The entity's key, the transaction hash, and the block it is now expected to expire
|
|
499
|
+
* at. {@link ExtendEntityReturnType}
|
|
496
500
|
*
|
|
497
501
|
* @throws {InvalidExpiryError} If the expiry is malformed, exceeds a protocol bound, or would
|
|
498
502
|
* leave the entity dead on arrival.
|
|
@@ -501,8 +505,10 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
501
505
|
* import { createWalletClient, ExpirationTime } from "@arkiv-network/sdk"
|
|
502
506
|
* import { cheesecake } from "@arkiv-network/sdk/chains"
|
|
503
507
|
* import { http } from "viem"
|
|
508
|
+
* import { privateKeyToAccount } from "viem/accounts"
|
|
504
509
|
*
|
|
505
510
|
* const client = createWalletClient({
|
|
511
|
+
* account: privateKeyToAccount("0x..."),
|
|
506
512
|
* chain: cheesecake,
|
|
507
513
|
* transport: http(),
|
|
508
514
|
* })
|
|
@@ -513,28 +519,28 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
513
519
|
*/
|
|
514
520
|
extendEntity: (data: ExtendEntityParameters, txParams?: TxParams) => Promise<ExtendEntityReturnType>;
|
|
515
521
|
/**
|
|
516
|
-
*
|
|
522
|
+
* Hands the entity with the given key to a new owner.
|
|
517
523
|
*
|
|
518
|
-
* -
|
|
519
|
-
* - JSON-RPC Methods: [`eth_sendRawTransaction`](https://docs.arkiv.network/dev/json-rpc-api/#mutateEntities)
|
|
524
|
+
* - JSON-RPC Methods: `eth_sendRawTransaction`
|
|
520
525
|
*
|
|
521
526
|
* @param data - The ownership change parameters
|
|
522
527
|
* @param txParams - Optional transaction parameters
|
|
523
|
-
* @returns The entity
|
|
528
|
+
* @returns The entity's key and the transaction hash. {@link ChangeOwnershipReturnType}
|
|
524
529
|
*/
|
|
525
530
|
changeOwnership: (data: ChangeOwnershipParameters, txParams?: TxParams) => Promise<ChangeOwnershipReturnType>;
|
|
526
531
|
/**
|
|
527
|
-
*
|
|
532
|
+
* Applies a batch of entity operations — creates, patches, deletes, extensions and ownership
|
|
533
|
+
* transfers — in one transaction.
|
|
528
534
|
*
|
|
529
|
-
* -
|
|
530
|
-
* - JSON-RPC Methods: [`eth_sendRawTransaction`](https://docs.arkiv.network/dev/json-rpc-api/#mutateEntities)
|
|
535
|
+
* - JSON-RPC Methods: `eth_sendRawTransaction`
|
|
531
536
|
*
|
|
532
537
|
* Every operation lands in one transaction, so the whole batch applies or none of it does.
|
|
533
538
|
* At least one operation is required.
|
|
534
539
|
*
|
|
535
|
-
* @param data - The
|
|
540
|
+
* @param data - The batch parameters (creates, patches, deletes, extensions, ownershipChanges)
|
|
536
541
|
* @param txParams - Optional transaction parameters
|
|
537
|
-
* @returns The
|
|
542
|
+
* @returns The transaction hash, plus the keys touched by each kind of operation.
|
|
543
|
+
* {@link ExecuteBatchReturnType}
|
|
538
544
|
*
|
|
539
545
|
* @throws {InvalidExpiryError} If an expiry exceeds a protocol bound or would leave the entity
|
|
540
546
|
* dead on arrival.
|
|
@@ -544,12 +550,14 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
544
550
|
* import { createWalletClient, ExpirationTime, jsonToPayload } from "@arkiv-network/sdk"
|
|
545
551
|
* import { cheesecake } from "@arkiv-network/sdk/chains"
|
|
546
552
|
* import { http } from "viem"
|
|
553
|
+
* import { privateKeyToAccount } from "viem/accounts"
|
|
547
554
|
*
|
|
548
555
|
* const client = createWalletClient({
|
|
556
|
+
* account: privateKeyToAccount("0x..."),
|
|
549
557
|
* chain: cheesecake,
|
|
550
558
|
* transport: http(),
|
|
551
559
|
* })
|
|
552
|
-
* const { txHash, createdEntities } = await client.
|
|
560
|
+
* const { txHash, createdEntities } = await client.executeBatch({
|
|
553
561
|
* creates: [{
|
|
554
562
|
* payload: jsonToPayload({ entityType: "testType", entityId: "testId" }),
|
|
555
563
|
* contentType: "application/json",
|
|
@@ -565,7 +573,7 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
565
573
|
* ownershipChanges: [{ entityKey: keyToHandOver, newOwner }],
|
|
566
574
|
* })
|
|
567
575
|
*/
|
|
568
|
-
|
|
576
|
+
executeBatch: (data: ExecuteBatchParameters, txParams?: TxParams) => Promise<ExecuteBatchReturnType>;
|
|
569
577
|
/**
|
|
570
578
|
* The advanced path: build, send, ping and read mutation results as separate steps, each
|
|
571
579
|
* costing the minimum number of RPC calls. Use it when you are optimising your RPC budget;
|
|
@@ -584,16 +592,14 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
584
592
|
type WalletArkivClient<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined, rpcSchema extends RpcSchema | undefined = ArkivRpcSchema> = Prettify<Client<transport, chain, account, rpcSchema, WalletArkivActions<transport, chain, account>>>;
|
|
585
593
|
/**
|
|
586
594
|
* Creates a Wallet Client with a given [Transport](https://viem.sh/docs/clients/intro) configured
|
|
587
|
-
* for a [Chain](https://viem.sh/docs/
|
|
588
|
-
*
|
|
589
|
-
* - Docs: https://docs.arkiv.network/ts-sdk/clients/wallet
|
|
595
|
+
* for a [Chain](https://viem.sh/docs/chains/introduction) and an account.
|
|
590
596
|
*
|
|
591
597
|
* A Wallet Client signs and sends transactions, so it carries an `account` and exposes everything
|
|
592
598
|
* that mutates state — `createEntity`, `patchEntity`, `deleteEntity`, `extendEntity`,
|
|
593
|
-
* `changeOwnership` and `
|
|
599
|
+
* `changeOwnership` and `executeBatch` — on top of the read actions a Public Client has.
|
|
594
600
|
*
|
|
595
601
|
* @param parameters - Configuration object for the wallet client (chain, transport, account, etc.)
|
|
596
|
-
* @returns
|
|
602
|
+
* @returns An Arkiv Wallet Client. {@link WalletArkivClient}
|
|
597
603
|
*
|
|
598
604
|
* @example
|
|
599
605
|
* import { createWalletClient } from "@arkiv-network/sdk"
|
|
@@ -640,5 +646,5 @@ declare class InvalidContentTypeError extends Error {
|
|
|
640
646
|
*/
|
|
641
647
|
declare function chainFromName(name: string): Chain;
|
|
642
648
|
//#endregion
|
|
643
|
-
export { AddrValue, AnyArkivValue, type ArkivClient, ArkivRpcSchema, ArkivValue, AttributeInputs, AttributeSchema, Attributes, BoolValue, BuildMutationOptions, BuildMutationReturnType, Bytes32Value, BytesValue, ChangeOwnershipParameters, ChangeOwnershipReturnType, ConflictingMutationError, CreateEntityParameters, CreateEntityReturnType, CreationFlags, DECIMAL_SCALE, DECIMAL_UNIT, type DeadlineOptions, DecValue, DeleteEntityParameters, DeleteEntityReturnType, ENTITY_EVENTS_ABI, EmptyPatchError, EncodedExpiry, Entity, EntityCreatedEvent, EntityDeletedEvent, EntityEvent, EntityEventContext, EntityEventName, EntityFields, EntityMutationError, type EntityMutationOps, EntityPatchedEvent, ExpirationTime, Expiry, ExpiryContext, ExpiryExtendedEvent, ExtendEntityParameters, ExtendEntityReturnType, GetBlockTimingReturnType, GetMutationResultReturnType, I32Value, I32_MAX, I32_MIN, InvalidAttributeNameError, InvalidContentTypeError, InvalidCreationFlagsError, InvalidExpiryError, InvalidSaltError, InvalidValueError, KeyValue, Lifetime, MAX_ATTRIBUTES, MAX_EXPIRES_AT, MAX_NAME_BYTES, MAX_PAYLOAD_BYTES, MAX_SALT, MAX_STRING_BYTES, MimeType, MissingValueError,
|
|
649
|
+
export { AddrValue, AnyArkivValue, type ArkivClient, ArkivRpcSchema, ArkivValue, AttributeInputs, AttributeSchema, Attributes, BoolValue, BuildMutationOptions, BuildMutationReturnType, Bytes32Value, BytesValue, ChangeOwnershipParameters, ChangeOwnershipReturnType, ConflictingMutationError, CreateEntityParameters, CreateEntityReturnType, CreationFlags, DECIMAL_SCALE, DECIMAL_UNIT, type DeadlineOptions, DecValue, DeleteEntityParameters, DeleteEntityReturnType, ENTITY_EVENTS_ABI, EmptyPatchError, EncodedExpiry, Entity, EntityCreatedEvent, EntityDeletedEvent, EntityEvent, EntityEventContext, EntityEventName, EntityFields, EntityMutationError, type EntityMutationOps, EntityPatchedEvent, ExecuteBatchParameters, ExecuteBatchReturnType, ExpirationTime, Expiry, ExpiryContext, ExpiryExtendedEvent, ExtendEntityParameters, ExtendEntityReturnType, GetBlockTimingReturnType, GetMutationResultReturnType, I32Value, I32_MAX, I32_MIN, InvalidAttributeNameError, InvalidContentTypeError, InvalidCreationFlagsError, InvalidExpiryError, InvalidSaltError, InvalidValueError, KeyValue, Lifetime, MAX_ATTRIBUTES, MAX_EXPIRES_AT, MAX_NAME_BYTES, MAX_PAYLOAD_BYTES, MAX_SALT, MAX_STRING_BYTES, MimeType, MissingValueError, type MutationEvents, MutationResult, NO_SALT, NoEntityFoundError, NoMoreResultsError, NoRandomSourceError, Operation, OperationType, OwnershipTransferredEvent, PatchEntityParameters, PatchEntityReturnType, PingTransactionReturnType, PredictEntityKeysParameters, PredictEntityKeysReturnType, PredictedEntityKey, type PublicAdvancedActions, type PublicArkivActions, type PublicArkivClient, QueryOptions, QueryReturnType, ResolvedCreationFlags, ResolvedExpiry, RpcAttribute, RpcAttributeSchemaEntry, RpcCreationFlags, RpcEntity, RpcQueryOptions, RpcSelect, SaltInput, SendMutationOptions, SendMutationReturnType, StrValue, TooManyAttributesError, TxParams, TypeTag, U256Value, U256_MAX, U64Value, U64_MAX, UnknownAttributeTypeError, UntypedValueError, UserTypeTag, ValueInput, type WalletAdvancedActions, type WalletArkivActions, type WalletArkivClient, WatchEntityEventsParameters, addr, bool, buildEntityOperations, buildMutation, bytes32, chainFromName, collectMutationEvents, createPublicClient, createWalletClient, dec, decFromUnits, decUnits, decodeCreationFlags, decodeMutationResult, encodeCreationFlags, getMutationResult, i32, isArkivValue, isValidAttributeName, jsonToPayload, key, mutationNeedsBlockNumber, pingTransaction, predictEntityKey, randomSalt, resolveExpiry, sendMutation, str, stringToPayload, toBlocks, toValue, u256, u64, validateAttributeName };
|
|
644
650
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/clients/decorators/arkivAdvanced.ts","../src/clients/decorators/arkivPublic.ts","../src/clients/createPublicClient.ts","../src/clients/decorators/arkivWallet.ts","../src/clients/createWalletClient.ts","../src/errors.ts","../src/utils/chains.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;KA0BY,qBAAA;EAAA;;;;;;;;;;AA0DZ;;EAUU,eAAA,EAAA,CAAA,MAAA,EAvDkB,IAuDlB,EAAA,GAvD2B,OAuD3B,CAvDmC,yBAuDnC,CAAA;EACI;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/clients/decorators/arkivAdvanced.ts","../src/clients/decorators/arkivPublic.ts","../src/clients/createPublicClient.ts","../src/clients/decorators/arkivWallet.ts","../src/clients/createWalletClient.ts","../src/errors.ts","../src/utils/chains.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;KA0BY,qBAAA;EAAA;;;;;;;;;;AA0DZ;;EAUU,eAAA,EAAA,CAAA,MAAA,EAvDkB,IAuDlB,EAAA,GAvD2B,OAuD3B,CAvDmC,yBAuDnC,CAAA;EACI;;;;;;;;;;;ACzEd;;EACgC,iBAAA,EAAA,CAAA,MAAA,ED+BF,IC/BE,EAAA,GD+BO,OC/BP,CD+Be,2BC/Bf,CAAA;EAChB;;;;;;;;EAEZ,oBAAA,EAAA,CAAA,OAAA,EDsC8B,kBCtC9B,EAAA,GDsCqD,cCtCrD;CA4Ce;;;;;;;;;;;;;;;;;;AA0IO,KD5Hd,qBAAA,GAAwB,qBC4HV,GAAA;EAAY;;;;;;;;EA0C/B,aAAA,EAAA,CAAA,IAAA,ED5JG,iBC4JH,EAAA,OAAA,CAAA,ED3JO,oBC2JP,EAAA,GD1JA,OC0JA,CD1JQ,uBC0JR,CAAA;EAsByB;;;;;;;;ACjQhC;;;;;;;EAI4C,YAAA,EAAA,CAAA,IAAA,EF+FlC,iBE/FkC,EAAA,OAAA,CAAA,EFgG9B,mBEhG8B,EAAA,GFiGrC,OEjGqC,CFiG7B,sBEjG6B,CAAA;CAEnC;;;KDCG,qCACQ,YAAY,yBAChB,oBAAoB,mCAClB,sBAAsB,uBACpC,KACF,cAAc,WAAW,OAAO;;ADDlC;;;;;;;;;;AA0DA;;;;;;;;;;;;;;AC9DA;;;;;;EAGwC,SAAA,EAAA,CAAA,GAAA,EA6CrB,GA7CqB,EAAA,GA6Cb,OA7Ca,CA6CL,UA7CK,CAAA;EAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqPgB,MA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a5B,cKGC,eAAA,SAAwB,KAAA,CLHJ;EAaL,SAAA,SAAA,EAAA,MAAA;EAAiB,WAAA,CAAA,SAAA,EAAA,MAAA;;AAef,cKZjB,uBAAA,SAAgC,KAAA,CLYf;EAAiB,WAAA,CAAA,WAAA,EAAA,MAAA;;;;;;;;;;iBM1C/B,aAAA,gBAA6B"}
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { t as chains_exports } from "./chains-
|
|
2
|
-
import { a as OperationType, i as MAX_EXPIRES_AT, n as resolveExpiry, o as ARKIV_ADDRESS, r as toBlocks, s as BLOCK_TIME } from "./expiry-
|
|
3
|
-
import { a as buildMutation, c as mutationNeedsBlockNumber, i as getMutationResult, l as sendArkivTransaction, n as pingTransaction, o as buildEntityOperations, r as decodeMutationResult, s as collectMutationEvents, t as sendMutation, u as ENTITY_NONCE_ABI } from "./advanced-
|
|
4
|
-
import { A as DECIMAL_UNIT, C as str, E as u64, F as TooManyAttributesError, I as UnknownAttributeTypeError, L as UntypedValueError, M as InvalidAttributeNameError, N as InvalidValueError, O as isArkivValue, P as MissingValueError, S as key, T as u256, _ as bytes32, a as MAX_NAME_BYTES, b as decUnits, d as I32_MIN, f as MAX_STRING_BYTES, g as bool, h as addr, j as ConflictingMutationError, k as DECIMAL_SCALE, m as U64_MAX, n as MAX_PAYLOAD_BYTES, o as isValidAttributeName, p as U256_MAX, s as validateAttributeName, t as MAX_ATTRIBUTES, u as I32_MAX, v as dec, w as toValue, x as i32, y as decFromUnits } from "./attributes-
|
|
5
|
-
import { a as
|
|
6
|
-
import { i as NoRandomSourceError, n as InvalidExpiryError, r as InvalidSaltError, t as InvalidCreationFlagsError } from "./errors-
|
|
7
|
-
import { n as encodeCreationFlags, t as decodeCreationFlags } from "./flags-
|
|
1
|
+
import { t as chains_exports } from "./chains-Du8tql7I.js";
|
|
2
|
+
import { a as OperationType, i as MAX_EXPIRES_AT, n as resolveExpiry, o as ARKIV_ADDRESS, r as toBlocks, s as BLOCK_TIME } from "./expiry-CZErShX6.js";
|
|
3
|
+
import { a as buildMutation, c as mutationNeedsBlockNumber, i as getMutationResult, l as sendArkivTransaction, n as pingTransaction, o as buildEntityOperations, r as decodeMutationResult, s as collectMutationEvents, t as sendMutation, u as ENTITY_NONCE_ABI } from "./advanced-FZy7WoYR.js";
|
|
4
|
+
import { A as DECIMAL_UNIT, C as str, E as u64, F as TooManyAttributesError, I as UnknownAttributeTypeError, L as UntypedValueError, M as InvalidAttributeNameError, N as InvalidValueError, O as isArkivValue, P as MissingValueError, S as key, T as u256, _ as bytes32, a as MAX_NAME_BYTES, b as decUnits, d as I32_MIN, f as MAX_STRING_BYTES, g as bool, h as addr, j as ConflictingMutationError, k as DECIMAL_SCALE, m as U64_MAX, n as MAX_PAYLOAD_BYTES, o as isValidAttributeName, p as U256_MAX, s as validateAttributeName, t as MAX_ATTRIBUTES, u as I32_MAX, v as dec, w as toValue, x as i32, y as decFromUnits } from "./attributes-BJGuhsqp.js";
|
|
5
|
+
import { a as resolveSalt, i as randomSalt, n as NO_SALT, o as ENTITY_EVENTS_ABI, r as predictEntityKey, t as MAX_SALT } from "./key-XQkpw2xh.js";
|
|
6
|
+
import { i as NoRandomSourceError, n as InvalidExpiryError, r as InvalidSaltError, t as InvalidCreationFlagsError } from "./errors-CwPJ16bn.js";
|
|
7
|
+
import { n as encodeCreationFlags, t as decodeCreationFlags } from "./flags-Cr76ldwF.js";
|
|
8
8
|
import { a as NoEntityFoundError, i as InvalidContentTypeError, n as EmptyPatchError, o as NoMoreResultsError, r as EntityMutationError, t as getLogger } from "./logger-CVpvU8ik.js";
|
|
9
9
|
import "./attr-GcQKatub.js";
|
|
10
10
|
import { t as Entity } from "./entity-BYQR1uoe.js";
|
|
11
|
-
import { a as eq, r as toRpcSelect, t as SelectQueryBuilder, v as runQuery } from "./queryBuilder-
|
|
11
|
+
import { a as eq, r as toRpcSelect, t as SelectQueryBuilder, v as runQuery } from "./queryBuilder-BwauPaGO.js";
|
|
12
12
|
import "./entity-CD_qFF2M.js";
|
|
13
13
|
import "./types-Bu_ZwMbZ.js";
|
|
14
|
-
import { n as stringToPayload, r as ExpirationTime, t as jsonToPayload } from "./payload-
|
|
14
|
+
import { n as stringToPayload, r as ExpirationTime, t as jsonToPayload } from "./payload-DaPzUvEh.js";
|
|
15
15
|
import { createClient, decodeEventLog, publicActions, walletActions } from "viem";
|
|
16
16
|
import { getChainId, readContract } from "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(
|
|
146
|
+
return salts.map(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 = getLogger("actions:wallet:execute-batch");
|
|
435
|
+
async function executeBatch(client, data, txParams) {
|
|
436
|
+
const { receipt, createdEntityKeys } = await 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 = 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 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 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 = getLogger("actions:wallet:mutate-entities");
|
|
451
|
-
async function mutateEntities(client, data, txParams) {
|
|
452
|
-
const { receipt, createdEntityKeys } = await 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 = 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"
|
|
@@ -540,5 +538,5 @@ function chainFromName(name) {
|
|
|
540
538
|
}
|
|
541
539
|
|
|
542
540
|
//#endregion
|
|
543
|
-
export { ConflictingMutationError, DECIMAL_SCALE, DECIMAL_UNIT, ENTITY_EVENTS_ABI, EmptyPatchError, Entity, EntityMutationError, ExpirationTime, I32_MAX, I32_MIN, InvalidAttributeNameError, InvalidContentTypeError, InvalidCreationFlagsError, InvalidExpiryError, InvalidSaltError, InvalidValueError, MAX_ATTRIBUTES, MAX_EXPIRES_AT, MAX_NAME_BYTES, MAX_PAYLOAD_BYTES, MAX_SALT, MAX_STRING_BYTES, MissingValueError, NoEntityFoundError, NoMoreResultsError, NoRandomSourceError, OperationType, TooManyAttributesError, U256_MAX, U64_MAX, UnknownAttributeTypeError, UntypedValueError, addr, bool, buildEntityOperations, buildMutation, bytes32, chainFromName, collectMutationEvents, createPublicClient, createWalletClient, dec, decFromUnits, decUnits, decodeCreationFlags, decodeMutationResult, encodeCreationFlags, getMutationResult, i32, isArkivValue, isValidAttributeName, jsonToPayload, key, mutationNeedsBlockNumber, pingTransaction, predictEntityKey, randomSalt, resolveExpiry, sendMutation, str, stringToPayload, toBlocks, toValue, u256, u64, validateAttributeName };
|
|
541
|
+
export { ConflictingMutationError, DECIMAL_SCALE, DECIMAL_UNIT, ENTITY_EVENTS_ABI, EmptyPatchError, Entity, EntityMutationError, ExpirationTime, I32_MAX, I32_MIN, InvalidAttributeNameError, InvalidContentTypeError, InvalidCreationFlagsError, InvalidExpiryError, InvalidSaltError, InvalidValueError, MAX_ATTRIBUTES, MAX_EXPIRES_AT, MAX_NAME_BYTES, MAX_PAYLOAD_BYTES, MAX_SALT, MAX_STRING_BYTES, MissingValueError, NO_SALT, NoEntityFoundError, NoMoreResultsError, NoRandomSourceError, OperationType, TooManyAttributesError, U256_MAX, U64_MAX, UnknownAttributeTypeError, UntypedValueError, addr, bool, buildEntityOperations, buildMutation, bytes32, chainFromName, collectMutationEvents, createPublicClient, createWalletClient, dec, decFromUnits, decUnits, decodeCreationFlags, decodeMutationResult, encodeCreationFlags, getMutationResult, i32, isArkivValue, isValidAttributeName, jsonToPayload, key, mutationNeedsBlockNumber, pingTransaction, predictEntityKey, randomSalt, resolveExpiry, sendMutation, str, stringToPayload, toBlocks, toValue, u256, u64, validateAttributeName };
|
|
544
542
|
//# sourceMappingURL=index.js.map
|