@arkiv-network/sdk 0.8.0-dev.1 → 0.8.0-dev.2
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/attr/index.cjs +1 -1
- package/dist/attr/index.d.cts +1 -1
- package/dist/attr/index.d.ts +1 -1
- package/dist/attr/index.js +1 -1
- package/dist/{attr-BvxHN99W.cjs → attr-BXTkpnoc.cjs} +13 -3
- package/dist/{attr-BDZ-APg5.js → attr-tmyREHtw.js} +14 -4
- package/dist/attr-tmyREHtw.js.map +1 -0
- 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/{changeOwnership-DwgtdSFc.d.ts → changeOwnership-B0ar96ub.d.ts} +47 -34
- package/dist/changeOwnership-B0ar96ub.d.ts.map +1 -0
- package/dist/{changeOwnership-B7bEgla4.d.cts → changeOwnership-BofkLnXJ.d.cts} +47 -34
- package/dist/changeOwnership-BofkLnXJ.d.cts.map +1 -0
- package/dist/entity/index.cjs +5 -4
- package/dist/entity/index.d.cts +2 -2
- package/dist/entity/index.d.ts +2 -2
- package/dist/entity/index.js +5 -5
- package/dist/{entity-CFhbAv0R.js → entity-CniBgBSd.js} +17 -5
- package/dist/entity-CniBgBSd.js.map +1 -0
- package/dist/{entity-wfBnZd91.cjs → entity-DJ0Gml9c.cjs} +23 -5
- package/dist/{errors-DGB8AgT2.js → errors-D2E1GRjw.js} +2 -2
- package/dist/errors-D2E1GRjw.js.map +1 -0
- package/dist/{errors-D-eJkGVc.cjs → errors-DhV00966.cjs} +1 -1
- package/dist/expiry-BxOlvVWC.d.ts.map +1 -1
- package/dist/{expiry-BUYIXTGb.cjs → expiry-CG9GhVXv.cjs} +1 -1
- package/dist/{expiry-DGRzrSan.js → expiry-Cgdb_dbq.js} +2 -2
- package/dist/expiry-Cgdb_dbq.js.map +1 -0
- package/dist/expiry-DRV29F1r.d.cts.map +1 -1
- package/dist/{flags-Ct8k0gpB.cjs → flags-DCD26uhe.cjs} +1 -1
- package/dist/{flags-ZtlvOIIk.js → flags-DUT2gHEU.js} +2 -2
- package/dist/{flags-ZtlvOIIk.js.map → flags-DUT2gHEU.js.map} +1 -1
- package/dist/{index-D0CmtiWT.d.cts → index-BGp2plHs.d.cts} +15 -5
- package/dist/index-BGp2plHs.d.cts.map +1 -0
- package/dist/{index-VCqgn29D.d.ts → index-BKB875Um.d.ts} +4 -4
- package/dist/{index-VCqgn29D.d.ts.map → index-BKB875Um.d.ts.map} +1 -1
- package/dist/{index-DVYFaXNV.d.ts → index-CIcHPx2j.d.cts} +13 -6
- package/dist/index-CIcHPx2j.d.cts.map +1 -0
- package/dist/{index-D8LZt-3J.d.cts → index-Cd2aaWme.d.ts} +13 -6
- package/dist/index-Cd2aaWme.d.ts.map +1 -0
- package/dist/{index-ClgIuxJ8.d.ts → index-ezMZ2-JH.d.ts} +15 -5
- package/dist/index-ezMZ2-JH.d.ts.map +1 -0
- package/dist/{index-Cgw1u5aY.d.cts → index-rINthNuU.d.cts} +4 -4
- package/dist/{index-Cgw1u5aY.d.cts.map → index-rINthNuU.d.cts.map} +1 -1
- package/dist/index.cjs +41 -42
- package/dist/index.d.cts +56 -50
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +56 -50
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -43
- package/dist/index.js.map +1 -1
- package/dist/{payload-Dgx3PQeK.d.ts → payload-CGvVPZQX.d.ts} +60 -1
- package/dist/payload-CGvVPZQX.d.ts.map +1 -0
- package/dist/{payload-CIxSn_DW.js → payload-DE7wMztL.js} +28 -3
- package/dist/payload-DE7wMztL.js.map +1 -0
- package/dist/{payload-P0nWyjLg.d.cts → payload-Dfu30njp.d.cts} +60 -1
- package/dist/payload-Dfu30njp.d.cts.map +1 -0
- package/dist/{payload-Bnw1hrvb.cjs → payload-DqFweqiO.cjs} +27 -2
- package/dist/query/index.cjs +4 -4
- package/dist/query/index.d.cts +3 -3
- package/dist/query/index.d.ts +3 -3
- package/dist/query/index.js +4 -4
- package/dist/{queryBuilder-CbLL4pG5.js → queryBuilder-wvA8sn--.js} +14 -11
- package/dist/queryBuilder-wvA8sn--.js.map +1 -0
- package/dist/{queryBuilder-BXDvX1K_.cjs → queryBuilder-zHGhDmaG.cjs} +13 -10
- package/dist/{selection-BvK6yX0g.d.cts → selection-Bv8_o-7i.d.cts} +16 -8
- package/dist/selection-Bv8_o-7i.d.cts.map +1 -0
- package/dist/{selection-fpmI3ADQ.d.ts → selection-ox7zdtVm.d.ts} +16 -8
- package/dist/selection-ox7zdtVm.d.ts.map +1 -0
- package/dist/types/index.d.cts +5 -5
- package/dist/types/index.d.ts +5 -5
- 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/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/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/attr-BDZ-APg5.js.map +0 -1
- package/dist/chains-BJrZs6sG.js.map +0 -1
- package/dist/changeOwnership-B7bEgla4.d.cts.map +0 -1
- package/dist/changeOwnership-DwgtdSFc.d.ts.map +0 -1
- package/dist/entity-CFhbAv0R.js.map +0 -1
- package/dist/errors-DGB8AgT2.js.map +0 -1
- package/dist/expiry-DGRzrSan.js.map +0 -1
- package/dist/index-ClgIuxJ8.d.ts.map +0 -1
- package/dist/index-D0CmtiWT.d.cts.map +0 -1
- package/dist/index-D8LZt-3J.d.cts.map +0 -1
- package/dist/index-DVYFaXNV.d.ts.map +0 -1
- package/dist/payload-CIxSn_DW.js.map +0 -1
- package/dist/payload-Dgx3PQeK.d.ts.map +0 -1
- package/dist/payload-P0nWyjLg.d.cts.map +0 -1
- package/dist/queryBuilder-CbLL4pG5.js.map +0 -1
- package/dist/selection-BvK6yX0g.d.cts.map +0 -1
- package/dist/selection-fpmI3ADQ.d.ts.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { A as i32, B as Bytes32Value, C as ValueInput, D as dec, E as bytes32, F as u64, G as StrValue, H as DecValue, I as AddrValue, J as U64Value, K as TypeTag, L as AnyArkivValue, M as str, N as toValue, O as decFromUnits, P as u256, R as ArkivValue, S as U64_MAX, T as bool, U as I32Value, V as BytesValue, W as KeyValue, X as isArkivValue, Y as UserTypeTag, _ 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, q as U256Value, 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, z as BoolValue } from "./index-
|
|
2
|
-
import { a as
|
|
1
|
+
import { A as i32, B as Bytes32Value, C as ValueInput, D as dec, E as bytes32, F as u64, G as StrValue, H as DecValue, I as AddrValue, J as U64Value, K as TypeTag, L as AnyArkivValue, M as str, N as toValue, O as decFromUnits, P as u256, R as ArkivValue, S as U64_MAX, T as bool, U as I32Value, V as BytesValue, W as KeyValue, X as isArkivValue, Y as UserTypeTag, _ 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, q as U256Value, 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, z as BoolValue } from "./index-CIcHPx2j.cjs";
|
|
2
|
+
import { a as SaltInput, c as ENTITY_EVENTS_ABI, d as InvalidExpiryError, f as InvalidSaltError, i as NO_SALT, l as EntityEventName, n as OperationType, o as predictEntityKey, p as NoRandomSourceError, r as MAX_SALT, s as randomSalt, t as MAX_EXPIRES_AT, u as InvalidCreationFlagsError } from "./index-BGp2plHs.cjs";
|
|
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-DRV29F1r.cjs";
|
|
4
4
|
import { i as encodeCreationFlags, n as ResolvedCreationFlags, r as decodeCreationFlags, t as CreationFlags } from "./flags-0Vl5rrHq.cjs";
|
|
5
|
-
import { A as EntityFields, F as RpcCreationFlags, I as RpcEntity, L as RpcQueryOptions, M as ArkivRpcSchema, N as RpcAttribute, P as RpcAttributeSchemaEntry, R as RpcSelect, d as Expression, i as SelectArg, j as ArkivClient, k as Entity, n as FullEntity, r as ProjectedEntity, t as EntitySelection } from "./selection-
|
|
6
|
-
import { t as SelectQueryBuilder } from "./index-
|
|
7
|
-
import { C as
|
|
8
|
-
import { i as ExpirationTime, n as stringToPayload, r as DeadlineOptions, t as jsonToPayload } from "./payload-
|
|
5
|
+
import { A as EntityFields, F as RpcCreationFlags, I as RpcEntity, L as RpcQueryOptions, M as ArkivRpcSchema, N as RpcAttribute, P as RpcAttributeSchemaEntry, R as RpcSelect, d as Expression, i as SelectArg, j as ArkivClient, k as Entity, n as FullEntity, r as ProjectedEntity, t as EntitySelection } from "./selection-Bv8_o-7i.cjs";
|
|
6
|
+
import { t as SelectQueryBuilder } from "./index-rINthNuU.cjs";
|
|
7
|
+
import { C as QueryOptions, D as PredictedEntityKey, E as PredictEntityKeysReturnType, O as GetBlockTimingReturnType, S as OwnershipTransferredEvent, T as PredictEntityKeysParameters, _ as EntityDeletedEvent, a as ExecuteBatchParameters, b as EntityPatchedEvent, c as PatchEntityReturnType, d as DeleteEntityParameters, f as DeleteEntityReturnType, g as EntityCreatedEvent, h as WatchEntityEventsParameters, i as MimeType, l as ExtendEntityParameters, m as CreateEntityReturnType, n as ChangeOwnershipReturnType, o as ExecuteBatchReturnType, p as CreateEntityParameters, r as TxParams, s as PatchEntityParameters, t as ChangeOwnershipParameters, u as ExtendEntityReturnType, v as EntityEvent, w as QueryReturnType, x as ExpiryExtendedEvent, y as EntityEventContext } from "./changeOwnership-BofkLnXJ.cjs";
|
|
8
|
+
import { i as ExpirationTime, n as stringToPayload, r as DeadlineOptions, t as jsonToPayload } from "./payload-Dfu30njp.cjs";
|
|
9
9
|
import { Account, Address, Chain, Client, Hex, ParseAccount, Prettify, PublicActions, PublicClientConfig, RpcSchema, Transport, WalletActions, WalletClientConfig } from "viem";
|
|
10
10
|
|
|
11
11
|
//#region src/clients/decorators/arkivPublic.d.ts
|
|
@@ -13,11 +13,15 @@ type PublicArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
13
13
|
/**
|
|
14
14
|
* Returns the entity with the given key.
|
|
15
15
|
*
|
|
16
|
-
* -
|
|
16
|
+
* - JSON-RPC Methods: `arkiv_query`
|
|
17
17
|
*
|
|
18
18
|
* @param key - The entity key (hex string)
|
|
19
19
|
* @returns The entity with the given key, with every field populated. {@link FullEntity}
|
|
20
20
|
*
|
|
21
|
+
* @throws {InvalidValueError} If the key is not 32 bytes.
|
|
22
|
+
* @throws {NoEntityFoundError} If no live entity has that key — it never existed, or it was
|
|
23
|
+
* deleted or has expired.
|
|
24
|
+
*
|
|
21
25
|
* @example
|
|
22
26
|
* import { createPublicClient } from "@arkiv-network/sdk"
|
|
23
27
|
* import { cheesecake } from "@arkiv-network/sdk/chains"
|
|
@@ -43,7 +47,7 @@ type PublicArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
43
47
|
* read entities. You declare up front which parts of an entity you want returned, so results
|
|
44
48
|
* always contain exactly the data you asked for.
|
|
45
49
|
*
|
|
46
|
-
* -
|
|
50
|
+
* - JSON-RPC Methods: `arkiv_query`
|
|
47
51
|
*
|
|
48
52
|
* @param selection - What to include in the results. Omit it (or pass `"*"`) to select everything,
|
|
49
53
|
* or pass an object to select specific parts (at least one field is required). Every part is
|
|
@@ -103,7 +107,7 @@ type PublicArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
103
107
|
/**
|
|
104
108
|
* Runs one query and returns one page, with no builder in between.
|
|
105
109
|
*
|
|
106
|
-
* Use {@link select} for anything typed — this returns full {@link Entity} objects whatever the
|
|
110
|
+
* Use {@link PublicArkivActions.select} for anything typed — this returns full {@link Entity} objects whatever the
|
|
107
111
|
* selection, and takes a raw string as an escape hatch for a query built elsewhere. A raw string
|
|
108
112
|
* goes to the node exactly as written, with none of the name, type or operator checks the
|
|
109
113
|
* expression combinators apply.
|
|
@@ -194,7 +198,7 @@ type PublicArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
194
198
|
* import { key } from "@arkiv-network/sdk/attr"
|
|
195
199
|
*
|
|
196
200
|
* const [parent, child] = await client.predictEntityKeys({ owner: account.address, count: 2 })
|
|
197
|
-
* await wallet.
|
|
201
|
+
* await wallet.executeBatch({
|
|
198
202
|
* creates: [
|
|
199
203
|
* { payload, contentType, expires, salt: parent.salt },
|
|
200
204
|
* {
|
|
@@ -207,7 +211,7 @@ type PublicArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
207
211
|
* ],
|
|
208
212
|
* })
|
|
209
213
|
*/
|
|
210
|
-
predictEntityKeys: <const TCount extends number = number, const TSalts extends readonly
|
|
214
|
+
predictEntityKeys: <const TCount extends number = number, const TSalts extends readonly SaltInput[] | undefined = undefined>(parameters: PredictEntityKeysParameters<TCount, TSalts>) => Promise<PredictEntityKeysReturnType<TCount, TSalts>>;
|
|
211
215
|
/**
|
|
212
216
|
* Returns the current block timing.
|
|
213
217
|
* @returns The current block timing. {@link GetBlockTimingReturnType}
|
|
@@ -228,11 +232,7 @@ type PublicArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
228
232
|
* // blockDuration: 2, // in seconds
|
|
229
233
|
* // }
|
|
230
234
|
*/
|
|
231
|
-
getBlockTiming: () => Promise<
|
|
232
|
-
currentBlock: bigint;
|
|
233
|
-
currentBlockTime: number;
|
|
234
|
-
blockDuration: number;
|
|
235
|
-
}>;
|
|
235
|
+
getBlockTiming: () => Promise<GetBlockTimingReturnType>;
|
|
236
236
|
/**
|
|
237
237
|
* Watches entity events, calling the handlers you pass as they arrive.
|
|
238
238
|
*
|
|
@@ -265,14 +265,14 @@ type PublicArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
265
265
|
//#region src/clients/createPublicClient.d.ts
|
|
266
266
|
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>>>;
|
|
267
267
|
/**
|
|
268
|
-
* Creates a Public Client with a given [Transport](https://viem.sh/docs/clients/intro) configured for a [Chain](https://viem.sh/docs/
|
|
269
|
-
*
|
|
270
|
-
* - Docs: https://docs.arkiv.network/ts-sdk/clients/public
|
|
268
|
+
* Creates a Public Client with a given [Transport](https://viem.sh/docs/clients/intro) configured for a [Chain](https://viem.sh/docs/chains/introduction).
|
|
271
269
|
*
|
|
272
|
-
* A Public Client is an interface to "public" [Ethereum JSON-RPC API](https://ethereum.org/en/developers/docs/apis/json-rpc/)
|
|
270
|
+
* A Public Client is an interface to the "public" [Ethereum JSON-RPC API](https://ethereum.org/en/developers/docs/apis/json-rpc/)
|
|
271
|
+
* and the Arkiv JSON-RPC API — retrieving block numbers and transactions, reading from
|
|
272
|
+
* contracts, and querying entities — through {@link PublicArkivActions}.
|
|
273
273
|
*
|
|
274
274
|
* @param parameters - Configuration object for the public client (chain, transport, etc.)
|
|
275
|
-
* @returns
|
|
275
|
+
* @returns An Arkiv Public Client. {@link PublicArkivClient}
|
|
276
276
|
*
|
|
277
277
|
* @example
|
|
278
278
|
* import { createPublicClient } from "@arkiv-network/sdk"
|
|
@@ -291,12 +291,12 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
291
291
|
/**
|
|
292
292
|
* Creates a new entity.
|
|
293
293
|
*
|
|
294
|
-
* -
|
|
295
|
-
* - JSON-RPC Methods: [`eth_sendRawTransaction`](https://docs.arkiv.network/dev/json-rpc-api/#mutateEntities)
|
|
294
|
+
* - JSON-RPC Methods: `eth_sendRawTransaction`
|
|
296
295
|
*
|
|
297
296
|
* @param data - The entity creation parameters
|
|
298
297
|
* @param txParams - Optional transaction parameters
|
|
299
|
-
* @returns The
|
|
298
|
+
* @returns The new entity's key, the transaction hash, and the block it is expected to
|
|
299
|
+
* expire at. {@link CreateEntityReturnType}
|
|
300
300
|
*
|
|
301
301
|
* @throws {InvalidExpiryError} If the expiry exceeds a protocol bound or would leave the
|
|
302
302
|
* entity dead on arrival.
|
|
@@ -308,8 +308,10 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
308
308
|
* import { i32 } from "@arkiv-network/sdk/attr"
|
|
309
309
|
* import { cheesecake } from "@arkiv-network/sdk/chains"
|
|
310
310
|
* import { http } from "viem"
|
|
311
|
+
* import { privateKeyToAccount } from "viem/accounts"
|
|
311
312
|
*
|
|
312
313
|
* const client = createWalletClient({
|
|
314
|
+
* account: privateKeyToAccount("0x..."),
|
|
313
315
|
* chain: cheesecake,
|
|
314
316
|
* transport: http(),
|
|
315
317
|
* })
|
|
@@ -325,12 +327,11 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
325
327
|
* Applies a patch to the entity with the given key: sets some fields, unsets others, and leaves
|
|
326
328
|
* everything it does not name alone.
|
|
327
329
|
*
|
|
328
|
-
* -
|
|
329
|
-
* - JSON-RPC Methods: [`eth_sendRawTransaction`](https://docs.arkiv.network/dev/json-rpc-api/#mutateEntities)
|
|
330
|
+
* - JSON-RPC Methods: `eth_sendRawTransaction`
|
|
330
331
|
*
|
|
331
332
|
* @param data - The entity key and the mutations to apply
|
|
332
333
|
* @param txParams - Optional transaction parameters
|
|
333
|
-
* @returns The entity key and the transaction hash
|
|
334
|
+
* @returns The patched entity's key and the transaction hash. {@link PatchEntityReturnType}
|
|
334
335
|
*
|
|
335
336
|
* @throws {EmptyPatchError} If the patch has nothing to apply.
|
|
336
337
|
* @throws {ConflictingMutationError} If a name appears in both `set` and `unset`.
|
|
@@ -342,8 +343,10 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
342
343
|
* import { i32 } from "@arkiv-network/sdk/attr"
|
|
343
344
|
* import { cheesecake } from "@arkiv-network/sdk/chains"
|
|
344
345
|
* import { http } from "viem"
|
|
346
|
+
* import { privateKeyToAccount } from "viem/accounts"
|
|
345
347
|
*
|
|
346
348
|
* const client = createWalletClient({
|
|
349
|
+
* account: privateKeyToAccount("0x..."),
|
|
347
350
|
* chain: cheesecake,
|
|
348
351
|
* transport: http(),
|
|
349
352
|
* })
|
|
@@ -359,19 +362,20 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
359
362
|
/**
|
|
360
363
|
* Deletes the entity with the given key.
|
|
361
364
|
*
|
|
362
|
-
* -
|
|
363
|
-
* - JSON-RPC Methods: [`eth_sendRawTransaction`](https://docs.arkiv.network/dev/json-rpc-api/#mutateEntities)
|
|
365
|
+
* - JSON-RPC Methods: `eth_sendRawTransaction`
|
|
364
366
|
*
|
|
365
367
|
* @param data - The entity deletion parameters
|
|
366
368
|
* @param txParams - Optional transaction parameters
|
|
367
|
-
* @returns The deleted entity
|
|
369
|
+
* @returns The deleted entity's key and the transaction hash. {@link DeleteEntityReturnType}
|
|
368
370
|
*
|
|
369
371
|
* @example
|
|
370
372
|
* import { createWalletClient } from "@arkiv-network/sdk"
|
|
371
373
|
* import { cheesecake } from "@arkiv-network/sdk/chains"
|
|
372
374
|
* import { http } from "viem"
|
|
375
|
+
* import { privateKeyToAccount } from "viem/accounts"
|
|
373
376
|
*
|
|
374
377
|
* const client = createWalletClient({
|
|
378
|
+
* account: privateKeyToAccount("0x..."),
|
|
375
379
|
* chain: cheesecake,
|
|
376
380
|
* transport: http(),
|
|
377
381
|
* })
|
|
@@ -386,12 +390,12 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
386
390
|
* than adding to what the entity has left, and `atBlock` / `atDate` pin an absolute deadline.
|
|
387
391
|
* The engine rejects an extension that would not move the expiry later.
|
|
388
392
|
*
|
|
389
|
-
* -
|
|
390
|
-
* - JSON-RPC Methods: [`eth_sendRawTransaction`](https://docs.arkiv.network/dev/json-rpc-api/#mutateEntities)
|
|
393
|
+
* - JSON-RPC Methods: `eth_sendRawTransaction`
|
|
391
394
|
*
|
|
392
395
|
* @param data - The entity key and its new lifetime
|
|
393
396
|
* @param txParams - Optional transaction parameters
|
|
394
|
-
* @returns The entity key, transaction hash, and the block it is now expected to expire
|
|
397
|
+
* @returns The entity's key, the transaction hash, and the block it is now expected to expire
|
|
398
|
+
* at. {@link ExtendEntityReturnType}
|
|
395
399
|
*
|
|
396
400
|
* @throws {InvalidExpiryError} If the expiry is malformed, exceeds a protocol bound, or would
|
|
397
401
|
* leave the entity dead on arrival.
|
|
@@ -400,8 +404,10 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
400
404
|
* import { createWalletClient, ExpirationTime } from "@arkiv-network/sdk"
|
|
401
405
|
* import { cheesecake } from "@arkiv-network/sdk/chains"
|
|
402
406
|
* import { http } from "viem"
|
|
407
|
+
* import { privateKeyToAccount } from "viem/accounts"
|
|
403
408
|
*
|
|
404
409
|
* const client = createWalletClient({
|
|
410
|
+
* account: privateKeyToAccount("0x..."),
|
|
405
411
|
* chain: cheesecake,
|
|
406
412
|
* transport: http(),
|
|
407
413
|
* })
|
|
@@ -412,28 +418,28 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
412
418
|
*/
|
|
413
419
|
extendEntity: (data: ExtendEntityParameters, txParams?: TxParams) => Promise<ExtendEntityReturnType>;
|
|
414
420
|
/**
|
|
415
|
-
*
|
|
421
|
+
* Hands the entity with the given key to a new owner.
|
|
416
422
|
*
|
|
417
|
-
* -
|
|
418
|
-
* - JSON-RPC Methods: [`eth_sendRawTransaction`](https://docs.arkiv.network/dev/json-rpc-api/#mutateEntities)
|
|
423
|
+
* - JSON-RPC Methods: `eth_sendRawTransaction`
|
|
419
424
|
*
|
|
420
425
|
* @param data - The ownership change parameters
|
|
421
426
|
* @param txParams - Optional transaction parameters
|
|
422
|
-
* @returns The entity
|
|
427
|
+
* @returns The entity's key and the transaction hash. {@link ChangeOwnershipReturnType}
|
|
423
428
|
*/
|
|
424
429
|
changeOwnership: (data: ChangeOwnershipParameters, txParams?: TxParams) => Promise<ChangeOwnershipReturnType>;
|
|
425
430
|
/**
|
|
426
|
-
*
|
|
431
|
+
* Applies a batch of entity operations — creates, patches, deletes, extensions and ownership
|
|
432
|
+
* transfers — in one transaction.
|
|
427
433
|
*
|
|
428
|
-
* -
|
|
429
|
-
* - JSON-RPC Methods: [`eth_sendRawTransaction`](https://docs.arkiv.network/dev/json-rpc-api/#mutateEntities)
|
|
434
|
+
* - JSON-RPC Methods: `eth_sendRawTransaction`
|
|
430
435
|
*
|
|
431
436
|
* Every operation lands in one transaction, so the whole batch applies or none of it does.
|
|
432
437
|
* At least one operation is required.
|
|
433
438
|
*
|
|
434
|
-
* @param data - The
|
|
439
|
+
* @param data - The batch parameters (creates, patches, deletes, extensions, ownershipChanges)
|
|
435
440
|
* @param txParams - Optional transaction parameters
|
|
436
|
-
* @returns The
|
|
441
|
+
* @returns The transaction hash, plus the keys touched by each kind of operation.
|
|
442
|
+
* {@link ExecuteBatchReturnType}
|
|
437
443
|
*
|
|
438
444
|
* @throws {InvalidExpiryError} If an expiry exceeds a protocol bound or would leave the entity
|
|
439
445
|
* dead on arrival.
|
|
@@ -443,12 +449,14 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
443
449
|
* import { createWalletClient, ExpirationTime, jsonToPayload } from "@arkiv-network/sdk"
|
|
444
450
|
* import { cheesecake } from "@arkiv-network/sdk/chains"
|
|
445
451
|
* import { http } from "viem"
|
|
452
|
+
* import { privateKeyToAccount } from "viem/accounts"
|
|
446
453
|
*
|
|
447
454
|
* const client = createWalletClient({
|
|
455
|
+
* account: privateKeyToAccount("0x..."),
|
|
448
456
|
* chain: cheesecake,
|
|
449
457
|
* transport: http(),
|
|
450
458
|
* })
|
|
451
|
-
* const { txHash, createdEntities } = await client.
|
|
459
|
+
* const { txHash, createdEntities } = await client.executeBatch({
|
|
452
460
|
* creates: [{
|
|
453
461
|
* payload: jsonToPayload({ entityType: "testType", entityId: "testId" }),
|
|
454
462
|
* contentType: "application/json",
|
|
@@ -464,23 +472,21 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
|
|
|
464
472
|
* ownershipChanges: [{ entityKey: keyToHandOver, newOwner }],
|
|
465
473
|
* })
|
|
466
474
|
*/
|
|
467
|
-
|
|
475
|
+
executeBatch: (data: ExecuteBatchParameters, txParams?: TxParams) => Promise<ExecuteBatchReturnType>;
|
|
468
476
|
};
|
|
469
477
|
//#endregion
|
|
470
478
|
//#region src/clients/createWalletClient.d.ts
|
|
471
479
|
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>>>;
|
|
472
480
|
/**
|
|
473
481
|
* Creates a Wallet Client with a given [Transport](https://viem.sh/docs/clients/intro) configured
|
|
474
|
-
* for a [Chain](https://viem.sh/docs/
|
|
475
|
-
*
|
|
476
|
-
* - Docs: https://docs.arkiv.network/ts-sdk/clients/wallet
|
|
482
|
+
* for a [Chain](https://viem.sh/docs/chains/introduction) and an account.
|
|
477
483
|
*
|
|
478
484
|
* A Wallet Client signs and sends transactions, so it carries an `account` and exposes everything
|
|
479
485
|
* that mutates state — `createEntity`, `patchEntity`, `deleteEntity`, `extendEntity`,
|
|
480
|
-
* `changeOwnership` and `
|
|
486
|
+
* `changeOwnership` and `executeBatch` — on top of the read actions a Public Client has.
|
|
481
487
|
*
|
|
482
488
|
* @param parameters - Configuration object for the wallet client (chain, transport, account, etc.)
|
|
483
|
-
* @returns
|
|
489
|
+
* @returns An Arkiv Wallet Client. {@link WalletArkivClient}
|
|
484
490
|
*
|
|
485
491
|
* @example
|
|
486
492
|
* import { createWalletClient } from "@arkiv-network/sdk"
|
|
@@ -527,5 +533,5 @@ declare class InvalidContentTypeError extends Error {
|
|
|
527
533
|
*/
|
|
528
534
|
declare function chainFromName(name: string): Chain;
|
|
529
535
|
//#endregion
|
|
530
|
-
export { AddrValue, AnyArkivValue, type ArkivClient, ArkivRpcSchema, ArkivValue, AttributeInputs, AttributeSchema, Attributes, BoolValue, 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, EntityPatchedEvent, ExpirationTime, Expiry, ExpiryContext, ExpiryExtendedEvent, ExtendEntityParameters, ExtendEntityReturnType, GetBlockTimingReturnType, 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,
|
|
536
|
+
export { AddrValue, AnyArkivValue, type ArkivClient, ArkivRpcSchema, ArkivValue, AttributeInputs, AttributeSchema, Attributes, BoolValue, 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, EntityPatchedEvent, ExecuteBatchParameters, ExecuteBatchReturnType, ExpirationTime, Expiry, ExpiryContext, ExpiryExtendedEvent, ExtendEntityParameters, ExtendEntityReturnType, GetBlockTimingReturnType, 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, NO_SALT, NoEntityFoundError, NoMoreResultsError, NoRandomSourceError, OperationType, OwnershipTransferredEvent, PatchEntityParameters, PatchEntityReturnType, PredictEntityKeysParameters, PredictEntityKeysReturnType, PredictedEntityKey, type PublicArkivActions, type PublicArkivClient, QueryOptions, QueryReturnType, ResolvedCreationFlags, ResolvedExpiry, RpcAttribute, RpcAttributeSchemaEntry, RpcCreationFlags, RpcEntity, RpcQueryOptions, RpcSelect, SaltInput, StrValue, TooManyAttributesError, TxParams, TypeTag, U256Value, U256_MAX, U64Value, U64_MAX, UnknownAttributeTypeError, UntypedValueError, UserTypeTag, ValueInput, type WalletArkivActions, type WalletArkivClient, WatchEntityEventsParameters, addr, bool, bytes32, chainFromName, createPublicClient, createWalletClient, dec, decFromUnits, decUnits, decodeCreationFlags, encodeCreationFlags, i32, isArkivValue, isValidAttributeName, jsonToPayload, key, predictEntityKey, randomSalt, resolveExpiry, str, stringToPayload, toBlocks, toValue, u256, u64, validateAttributeName };
|
|
531
537
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../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":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../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":";;;;;;;;;;;KAqBY,qCACQ,YAAY,yBAChB,oBAAoB,mCAClB,sBAAsB,uBACpC,KACF,cAAc,WAAW,OAAO;EALtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0L0B,SAAA,EAAA,CAAA,GAAA,EA1InB,GA0ImB,EAAA,GA1IX,OA0IW,CA1IH,UA0IG,CAAA;EAuCJ;;;;;;;;;;;;;;;ACvOlC;;;;;;;;;;;;;;;;;;EA6BgB,MAAA,EAAA;IACI;IACJ,CAAA,SAAA,CAAA,EAAA,GAAA,CAAA,ED4DO,kBC5DP,CD4D0B,UC5D1B,CAAA;IACW;;;;;;;;;;;;;;;;;;;ICjBf,CAAA,gBFgGS,eEhGS,CAAA,CAAA,SAAA,EFgGmB,CEhGnB,CAAA,EFgGuB,kBEhGvB,CFgG0C,eEhG1C,CFgG0D,CEhG1D,CAAA,CAAA;IACV;;;;IAEF,CAAA,SAAA,EFkGF,SElGE,CAAA,EFkGU,kBElGV,CFkG6B,UElG7B,CAAA;EAAsB,CAAA;EAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6NP,KAAA,EAAA,CAAA,KAAA,EF1FQ,UE0FR,GAAA,MAAA,EAAA,YAAA,CAAA,EF1F4C,YE0F5C,EAAA,GF1F6D,OE0F7D,CF1FqE,eE0FrE,CAAA;EAAO;;;;ACjPhB;;;;;;;;;;;;EAMoC,cAAA,EAAA,GAAA,GHmKZ,OGnKY,CAAA,MAAA,CAAA;EAA8B;;;;;;;AA0BlE;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