@arkiv-network/sdk 0.7.0 → 0.8.0-dev.1
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/README.md +29 -16
- package/dist/attr/index.cjs +34 -0
- package/dist/attr/index.d.cts +2 -0
- package/dist/attr/index.d.ts +2 -0
- package/dist/attr/index.js +3 -0
- package/dist/attr-BDZ-APg5.js +809 -0
- package/dist/attr-BDZ-APg5.js.map +1 -0
- package/dist/attr-BvxHN99W.cjs +1029 -0
- package/dist/chains/index.cjs +2 -3
- package/dist/chains/index.d.cts +39 -77
- package/dist/chains/index.d.cts.map +1 -1
- package/dist/chains/index.d.ts +22 -60
- package/dist/chains/index.d.ts.map +1 -1
- package/dist/chains/index.js +2 -2
- package/dist/chains-BJrZs6sG.js +57 -0
- package/dist/chains-BJrZs6sG.js.map +1 -0
- package/dist/chains-BYRTTipa.cjs +73 -0
- package/dist/changeOwnership-B7bEgla4.d.cts +509 -0
- package/dist/changeOwnership-B7bEgla4.d.cts.map +1 -0
- package/dist/changeOwnership-DwgtdSFc.d.ts +509 -0
- package/dist/changeOwnership-DwgtdSFc.d.ts.map +1 -0
- package/dist/entity/index.cjs +19 -0
- package/dist/entity/index.d.cts +4 -0
- package/dist/entity/index.d.ts +4 -0
- package/dist/entity/index.js +6 -0
- package/dist/entity-B0t6sN7F.cjs +71 -0
- package/dist/entity-BIp_df9u.js +67 -0
- package/dist/entity-BIp_df9u.js.map +1 -0
- package/dist/entity-CFhbAv0R.js +70 -0
- package/dist/entity-CFhbAv0R.js.map +1 -0
- package/dist/entity-wfBnZd91.cjs +98 -0
- package/dist/errors-D-eJkGVc.cjs +56 -0
- package/dist/errors-DGB8AgT2.js +33 -0
- package/dist/errors-DGB8AgT2.js.map +1 -0
- package/dist/expiry-BUYIXTGb.cjs +135 -0
- package/dist/expiry-BxOlvVWC.d.ts +79 -0
- package/dist/expiry-BxOlvVWC.d.ts.map +1 -0
- package/dist/expiry-DGRzrSan.js +95 -0
- package/dist/expiry-DGRzrSan.js.map +1 -0
- package/dist/expiry-DRV29F1r.d.cts +79 -0
- package/dist/expiry-DRV29F1r.d.cts.map +1 -0
- package/dist/flags-0Vl5rrHq.d.cts +41 -0
- package/dist/flags-0Vl5rrHq.d.cts.map +1 -0
- package/dist/flags-Ct8k0gpB.cjs +43 -0
- package/dist/flags-ZtlvOIIk.js +33 -0
- package/dist/flags-ZtlvOIIk.js.map +1 -0
- package/dist/flags-wmcMoAnN.d.ts +41 -0
- package/dist/flags-wmcMoAnN.d.ts.map +1 -0
- package/dist/index-Cgw1u5aY.d.cts +278 -0
- package/dist/index-Cgw1u5aY.d.cts.map +1 -0
- package/dist/index-ClgIuxJ8.d.ts +159 -0
- package/dist/index-ClgIuxJ8.d.ts.map +1 -0
- package/dist/index-D0CmtiWT.d.cts +159 -0
- package/dist/index-D0CmtiWT.d.cts.map +1 -0
- package/dist/index-D8LZt-3J.d.cts +417 -0
- package/dist/index-D8LZt-3J.d.cts.map +1 -0
- package/dist/index-DVYFaXNV.d.ts +417 -0
- package/dist/index-DVYFaXNV.d.ts.map +1 -0
- package/dist/index-VCqgn29D.d.ts +278 -0
- package/dist/index-VCqgn29D.d.ts.map +1 -0
- package/dist/index.cjs +675 -357
- package/dist/index.d.cts +251 -203
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +251 -203
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +626 -355
- package/dist/index.js.map +1 -1
- package/dist/payload-Bnw1hrvb.cjs +83 -0
- package/dist/payload-CIxSn_DW.js +67 -0
- package/dist/payload-CIxSn_DW.js.map +1 -0
- package/dist/payload-Dgx3PQeK.d.ts +94 -0
- package/dist/payload-Dgx3PQeK.d.ts.map +1 -0
- package/dist/payload-P0nWyjLg.d.cts +94 -0
- package/dist/payload-P0nWyjLg.d.cts.map +1 -0
- package/dist/query/index.cjs +24 -149
- package/dist/query/index.d.cts +5 -3
- package/dist/query/index.d.ts +5 -3
- package/dist/query/index.js +6 -137
- package/dist/queryBuilder-BXDvX1K_.cjs +1123 -0
- package/dist/queryBuilder-CbLL4pG5.js +963 -0
- package/dist/queryBuilder-CbLL4pG5.js.map +1 -0
- package/dist/selection-BvK6yX0g.d.cts +433 -0
- package/dist/selection-BvK6yX0g.d.cts.map +1 -0
- package/dist/selection-fpmI3ADQ.d.ts +433 -0
- package/dist/selection-fpmI3ADQ.d.ts.map +1 -0
- package/dist/types/index.cjs +4 -1
- package/dist/types/index.d.cts +7 -2
- package/dist/types/index.d.ts +7 -2
- package/dist/types/index.js +4 -1
- package/dist/utils/index.cjs +4 -17
- package/dist/utils/index.d.cts +3 -17
- package/dist/utils/index.d.ts +3 -17
- package/dist/utils/index.js +4 -18
- package/package.json +26 -5
- package/src/actions/public/getEntity.ts +27 -43
- package/src/actions/public/getEntityNonce.ts +30 -0
- package/src/actions/public/predictEntityKeys.test.ts +143 -0
- package/src/actions/public/predictEntityKeys.ts +138 -0
- package/src/actions/public/query.ts +33 -69
- package/src/actions/public/watchEntityEvents.test.ts +414 -0
- package/src/actions/public/watchEntityEvents.ts +225 -0
- package/src/actions/wallet/changeOwnership.ts +8 -8
- package/src/actions/wallet/createEntity.ts +104 -26
- package/src/actions/wallet/deleteEntity.ts +2 -3
- package/src/actions/wallet/extendEntity.ts +39 -16
- package/src/actions/wallet/mutateEntities.test.ts +76 -0
- package/src/actions/wallet/mutateEntities.ts +29 -74
- package/src/actions/wallet/patchEntity.ts +90 -0
- package/src/attr/attributes.test.ts +120 -0
- package/src/attr/attributes.ts +190 -0
- package/src/attr/codec.test.ts +162 -0
- package/src/attr/codec.ts +220 -0
- package/src/attr/decimal.ts +86 -0
- package/src/attr/errors.ts +145 -0
- package/src/attr/index.ts +50 -0
- package/src/attr/names.ts +106 -0
- package/src/attr/types.ts +150 -0
- package/src/attr/values.test.ts +271 -0
- package/src/attr/values.ts +502 -0
- package/src/chains/cheesecake.ts +22 -0
- package/src/chains/index.ts +1 -2
- package/src/clients/createPublicClient.test.ts +3 -5
- package/src/clients/createPublicClient.ts +5 -4
- package/src/clients/createWalletClient.test.ts +2 -2
- package/src/clients/createWalletClient.ts +13 -7
- package/src/clients/decorators/arkivPublic.ts +160 -139
- package/src/clients/decorators/arkivWallet.ts +91 -95
- package/src/consts.ts +2 -1
- package/src/entity/create.test.ts +184 -0
- package/src/entity/errors.ts +38 -0
- package/src/entity/events.ts +16 -0
- package/src/entity/expiry.test.ts +195 -0
- package/src/entity/expiry.ts +181 -0
- package/src/entity/flags.ts +65 -0
- package/src/entity/index.ts +14 -0
- package/src/entity/key.ts +68 -0
- package/src/entity/operations.ts +134 -0
- package/src/entity/params.ts +15 -0
- package/src/errors.ts +33 -28
- package/src/index.ts +6 -0
- package/src/query/engine.ts +59 -134
- package/src/query/errors.ts +151 -0
- package/src/query/expression.test.ts +286 -0
- package/src/query/expression.ts +493 -0
- package/src/query/index.ts +40 -4
- package/src/query/injection.test.ts +151 -0
- package/src/query/queryBuilder.test.ts +322 -637
- package/src/query/queryBuilder.ts +126 -359
- package/src/query/queryResult.ts +54 -51
- package/src/query/selection.test.ts +48 -98
- package/src/query/selection.ts +77 -65
- package/src/types/entity.test.ts +44 -155
- package/src/types/entity.ts +62 -44
- package/src/types/events.ts +64 -23
- package/src/types/index.ts +20 -16
- package/src/types/rpcSchema.ts +70 -33
- package/src/utils/arkivTransactions.test.ts +681 -38
- package/src/utils/arkivTransactions.ts +249 -104
- package/src/utils/chains.test.ts +21 -24
- package/src/utils/compression.ts +1 -1
- package/src/utils/entities.test.ts +62 -0
- package/src/utils/entities.ts +111 -29
- package/src/utils/expirationTime.ts +114 -10
- package/src/utils/logger.ts +2 -2
- package/src/utils/payload.ts +4 -2
- package/src/utils/revert.test.ts +99 -0
- package/src/utils/revert.ts +145 -0
- package/dist/chains-BifaY04V.cjs +0 -108
- package/dist/chains-CrtkVbBh.js +0 -86
- package/dist/chains-CrtkVbBh.js.map +0 -1
- package/dist/consts-AUoL-v42.cjs +0 -18
- package/dist/consts-BV4PR-de.js +0 -7
- package/dist/consts-BV4PR-de.js.map +0 -1
- package/dist/entity-B6g_EPm1.d.cts +0 -382
- package/dist/entity-B6g_EPm1.d.cts.map +0 -1
- package/dist/entity-qoLMAuuk.d.ts +0 -382
- package/dist/entity-qoLMAuuk.d.ts.map +0 -1
- package/dist/index-DdspxNAA.d.ts +0 -481
- package/dist/index-DdspxNAA.d.ts.map +0 -1
- package/dist/index-Ds9dwqb5.d.cts +0 -481
- package/dist/index-Ds9dwqb5.d.cts.map +0 -1
- package/dist/payload-B2kFJyah.d.ts +0 -6
- package/dist/payload-B2kFJyah.d.ts.map +0 -1
- package/dist/payload-CJN8fTvX.d.cts +0 -6
- package/dist/payload-CJN8fTvX.d.cts.map +0 -1
- package/dist/payload-Claf2jUO.js +0 -13
- package/dist/payload-Claf2jUO.js.map +0 -1
- package/dist/payload-DpA5PA-w.cjs +0 -23
- package/dist/query/index.js.map +0 -1
- package/dist/queryBuilder-D2uwP9jI.js +0 -704
- package/dist/queryBuilder-D2uwP9jI.js.map +0 -1
- package/dist/queryBuilder-UW2MCaX4.cjs +0 -792
- package/dist/utils/index.d.cts.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js.map +0 -1
- package/src/actions/public/buildQuery.ts +0 -10
- package/src/actions/public/subscribeEntityEvents.ts +0 -119
- package/src/actions/wallet/updateEntity.ts +0 -60
- package/src/chains/braga.ts +0 -26
- package/src/chains/kaolin.ts +0 -29
- package/src/query/engine.test.ts +0 -526
- package/src/query/predicate.test.ts +0 -461
- package/src/query/predicate.ts +0 -144
- package/src/query/queryResult.test.ts +0 -270
- package/src/query/selectQueryBuilder.test.ts +0 -210
- package/src/types/attributes.ts +0 -16
- package/src/utils/validation.test.ts +0 -60
- package/src/utils/validation.ts +0 -32
- /package/dist/{types-H-TSmRpm.js → types-Bx1EKe0v.js} +0 -0
- /package/dist/{types-o3zWarRp.cjs → types-CKPddlfS.cjs} +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { Address, Hex } from "viem";
|
|
2
|
+
|
|
3
|
+
//#region src/entity/errors.d.ts
|
|
4
|
+
/** An expiry could not be expressed, or would be rejected by the engine. */
|
|
5
|
+
declare class InvalidExpiryError extends Error {
|
|
6
|
+
constructor(reason: string);
|
|
7
|
+
}
|
|
8
|
+
/** A `creationFlags` byte could not be built or read. */
|
|
9
|
+
declare class InvalidCreationFlagsError extends Error {
|
|
10
|
+
constructor(reason: string);
|
|
11
|
+
}
|
|
12
|
+
/** A key salt was outside the `uint128` the wire carries. */
|
|
13
|
+
declare class InvalidSaltError extends Error {
|
|
14
|
+
constructor(salt: bigint);
|
|
15
|
+
}
|
|
16
|
+
/** No cryptographic randomness was available to generate a salt. */
|
|
17
|
+
declare class NoRandomSourceError extends Error {
|
|
18
|
+
constructor();
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/entity/events.d.ts
|
|
22
|
+
/**
|
|
23
|
+
* The events the engine emits: one per applied operation, in application order, so an off-chain
|
|
24
|
+
* replica can replay a transaction operation by operation.
|
|
25
|
+
*/
|
|
26
|
+
declare const ENTITY_EVENTS_ABI: readonly [{
|
|
27
|
+
readonly name: "EntityCreated";
|
|
28
|
+
readonly type: "event";
|
|
29
|
+
readonly inputs: readonly [{
|
|
30
|
+
readonly type: "bytes32";
|
|
31
|
+
readonly name: "entityKey";
|
|
32
|
+
readonly indexed: true;
|
|
33
|
+
}, {
|
|
34
|
+
readonly type: "address";
|
|
35
|
+
readonly name: "owner";
|
|
36
|
+
readonly indexed: true;
|
|
37
|
+
}, {
|
|
38
|
+
readonly type: "uint64";
|
|
39
|
+
readonly name: "expiresAt";
|
|
40
|
+
}, {
|
|
41
|
+
readonly type: "uint8";
|
|
42
|
+
readonly name: "creationFlags";
|
|
43
|
+
}];
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "EntityPatched";
|
|
46
|
+
readonly type: "event";
|
|
47
|
+
readonly inputs: readonly [{
|
|
48
|
+
readonly type: "bytes32";
|
|
49
|
+
readonly name: "entityKey";
|
|
50
|
+
readonly indexed: true;
|
|
51
|
+
}, {
|
|
52
|
+
readonly type: "address";
|
|
53
|
+
readonly name: "owner";
|
|
54
|
+
readonly indexed: true;
|
|
55
|
+
}];
|
|
56
|
+
}, {
|
|
57
|
+
readonly name: "ExpiryExtended";
|
|
58
|
+
readonly type: "event";
|
|
59
|
+
readonly inputs: readonly [{
|
|
60
|
+
readonly type: "bytes32";
|
|
61
|
+
readonly name: "entityKey";
|
|
62
|
+
readonly indexed: true;
|
|
63
|
+
}, {
|
|
64
|
+
readonly type: "address";
|
|
65
|
+
readonly name: "owner";
|
|
66
|
+
readonly indexed: true;
|
|
67
|
+
}, {
|
|
68
|
+
readonly type: "uint64";
|
|
69
|
+
readonly name: "expiresAt";
|
|
70
|
+
}];
|
|
71
|
+
}, {
|
|
72
|
+
readonly name: "OwnershipTransferred";
|
|
73
|
+
readonly type: "event";
|
|
74
|
+
readonly inputs: readonly [{
|
|
75
|
+
readonly type: "bytes32";
|
|
76
|
+
readonly name: "entityKey";
|
|
77
|
+
readonly indexed: true;
|
|
78
|
+
}, {
|
|
79
|
+
readonly type: "address";
|
|
80
|
+
readonly name: "previousOwner";
|
|
81
|
+
readonly indexed: true;
|
|
82
|
+
}, {
|
|
83
|
+
readonly type: "address";
|
|
84
|
+
readonly name: "newOwner";
|
|
85
|
+
readonly indexed: true;
|
|
86
|
+
}];
|
|
87
|
+
}, {
|
|
88
|
+
readonly name: "EntityDeleted";
|
|
89
|
+
readonly type: "event";
|
|
90
|
+
readonly inputs: readonly [{
|
|
91
|
+
readonly type: "bytes32";
|
|
92
|
+
readonly name: "entityKey";
|
|
93
|
+
readonly indexed: true;
|
|
94
|
+
}, {
|
|
95
|
+
readonly type: "address";
|
|
96
|
+
readonly name: "owner";
|
|
97
|
+
readonly indexed: true;
|
|
98
|
+
}];
|
|
99
|
+
}];
|
|
100
|
+
/** The name of each event in {@link ENTITY_EVENTS_ABI}. */
|
|
101
|
+
type EntityEventName = (typeof ENTITY_EVENTS_ABI)[number]["name"];
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/entity/key.d.ts
|
|
104
|
+
/** The widest salt the `uint128` wire field carries. */
|
|
105
|
+
declare const MAX_SALT: bigint;
|
|
106
|
+
/**
|
|
107
|
+
* A cryptographically random 128-bit salt — what {@link CreateEntityParameters.salt} defaults to.
|
|
108
|
+
*
|
|
109
|
+
* The salt exists for unpredictability, not uniqueness: the per-owner nonce already guarantees
|
|
110
|
+
* distinct keys. Random bits mean only the creator can predict the key of an entity they are about
|
|
111
|
+
* to create, so nobody else can reference or squat it in advance.
|
|
112
|
+
*
|
|
113
|
+
* @throws {NoRandomSourceError} If the runtime has no `crypto.getRandomValues`.
|
|
114
|
+
*/
|
|
115
|
+
declare function randomSalt(): bigint;
|
|
116
|
+
/**
|
|
117
|
+
* The key an entity will be created with, derived exactly as the engine derives it:
|
|
118
|
+
* `keccak256(domain ++ owner ++ nonce ++ salt)`.
|
|
119
|
+
*
|
|
120
|
+
* Deriving it client-side is what lets a batch compose: predict the key of a create, then have a
|
|
121
|
+
* later operation in the same transaction reference it, or store it as a `key` attribute on a
|
|
122
|
+
* sibling entity.
|
|
123
|
+
*/
|
|
124
|
+
declare function predictEntityKey({
|
|
125
|
+
owner,
|
|
126
|
+
nonce,
|
|
127
|
+
salt,
|
|
128
|
+
chainId
|
|
129
|
+
}: {
|
|
130
|
+
/** The account creating the entity. */
|
|
131
|
+
owner: Address;
|
|
132
|
+
/**
|
|
133
|
+
* The owner's entity-nonce at creation time. Each create in a batch consumes one, so the *n*th
|
|
134
|
+
* create in a batch uses `nonce + n`.
|
|
135
|
+
*/
|
|
136
|
+
nonce: bigint;
|
|
137
|
+
/** The salt the create will carry. */
|
|
138
|
+
salt: bigint;
|
|
139
|
+
/** The chain the entity is being created on — half of the derivation domain. */
|
|
140
|
+
chainId: number;
|
|
141
|
+
}): Hex;
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/entity/params.d.ts
|
|
144
|
+
/**
|
|
145
|
+
* Max uint64 value
|
|
146
|
+
*/
|
|
147
|
+
declare const MAX_EXPIRES_AT: bigint;
|
|
148
|
+
/** The operation tags of the `execute` ABI's tagged union. */
|
|
149
|
+
declare const OperationType: {
|
|
150
|
+
readonly Create: 1;
|
|
151
|
+
readonly Patch: 2;
|
|
152
|
+
readonly ExtendExpiry: 3;
|
|
153
|
+
readonly TransferOwnership: 4;
|
|
154
|
+
readonly Delete: 5;
|
|
155
|
+
};
|
|
156
|
+
type OperationType = (typeof OperationType)[keyof typeof OperationType];
|
|
157
|
+
//#endregion
|
|
158
|
+
export { randomSalt as a, InvalidCreationFlagsError as c, NoRandomSourceError as d, predictEntityKey as i, InvalidExpiryError as l, OperationType as n, ENTITY_EVENTS_ABI as o, MAX_SALT as r, EntityEventName as s, MAX_EXPIRES_AT as t, InvalidSaltError as u };
|
|
159
|
+
//# sourceMappingURL=index-ClgIuxJ8.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-ClgIuxJ8.d.ts","names":[],"sources":["../src/entity/errors.ts","../src/entity/events.ts","../src/entity/key.ts","../src/entity/params.ts"],"sourcesContent":[],"mappings":";;;;cACa,kBAAA,SAA2B,KAAA;;AAAxC;AAQA;AAQa,cARA,yBAAA,SAAkC,KAAA,CAQJ;EAW9B,WAAA,CAAA,MAAA,EAAA,MAAoB;;;cAXpB,gBAAA,SAAyB,KAAA;ECXzB,WAAA,CAAA,IAAA,EAAA,MAMX;AAGF;;cDaa,mBAAA,SAA4B,KAAA;;AEvBzC;;;;;;AFJA;AAQa,cCHA,iBDG0B,EAAA,SAAa,CAAA;EAQvC,SAAA,IAAA,EAAA,eAAyB;EAWzB,SAAA,IAAA,EAAA,OAAoB;;;;ICtBpB,SAAA,OAMX,EAAA,IAAA;EAGU,CAAA,EAAA;;;;ECVC,CAAA,EAAA;IAWG,SAAU,IAAA,EAAA,QAAA;IA2BV,SAAA,IAAA,EAAgB,WAAA;EAC9B,CAAA,EAAA;IACA,SAAA,IAAA,EAAA,OAAA;IACA,SAAA,IAAA,EAAA,eAAA;EACA,CAAA,CAAA;CAGO,EAAA;EAUL,SAAA,IAAA,EAAA,eAAA;EAAG,SAAA,IAAA,EAAA,OAAA;;;;ICzDM,SAAA,OAA+B,EAAA,IAAA;EAG/B,CAAA,EAAA;IAQD,SAAA,IAAa,EAAA,SAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KFCxB,eAAA,WAA0B;;;;cCVzB;AFJb;AAQA;AAQA;AAWA;;;;ACtBA;AASA;iBCCgB,UAAA,CAAA;AAXhB;AAWA;AA2BA;;;;;;AAiBI,iBAjBY,gBAAA,CAiBZ;EAAA,KAAA;EAAA,KAAA;EAAA,IAAA;EAAA;CAAA,EAAA;EAAG;SAVE;;;AC/CT;AAGA;EAQY,KAAA,EAAA,MAAA;;;;;ID8CR;;;;;;AF3DS,cGEA,cHFmB,EAAQ,MAAK;AAQ7C;AAQa,cGXA,aHWyB,EAAA;EAWzB,SAAA,MAAA,EAAA,CAAA;;;;ECtBA,SAAA,MAAA,EAAA,CAAA;AASb,CAAA;KEDY,aAAA,WAAwB,4BAA4B"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { Address, Hex } from "viem";
|
|
2
|
+
|
|
3
|
+
//#region src/entity/errors.d.ts
|
|
4
|
+
/** An expiry could not be expressed, or would be rejected by the engine. */
|
|
5
|
+
declare class InvalidExpiryError extends Error {
|
|
6
|
+
constructor(reason: string);
|
|
7
|
+
}
|
|
8
|
+
/** A `creationFlags` byte could not be built or read. */
|
|
9
|
+
declare class InvalidCreationFlagsError extends Error {
|
|
10
|
+
constructor(reason: string);
|
|
11
|
+
}
|
|
12
|
+
/** A key salt was outside the `uint128` the wire carries. */
|
|
13
|
+
declare class InvalidSaltError extends Error {
|
|
14
|
+
constructor(salt: bigint);
|
|
15
|
+
}
|
|
16
|
+
/** No cryptographic randomness was available to generate a salt. */
|
|
17
|
+
declare class NoRandomSourceError extends Error {
|
|
18
|
+
constructor();
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/entity/events.d.ts
|
|
22
|
+
/**
|
|
23
|
+
* The events the engine emits: one per applied operation, in application order, so an off-chain
|
|
24
|
+
* replica can replay a transaction operation by operation.
|
|
25
|
+
*/
|
|
26
|
+
declare const ENTITY_EVENTS_ABI: readonly [{
|
|
27
|
+
readonly name: "EntityCreated";
|
|
28
|
+
readonly type: "event";
|
|
29
|
+
readonly inputs: readonly [{
|
|
30
|
+
readonly type: "bytes32";
|
|
31
|
+
readonly name: "entityKey";
|
|
32
|
+
readonly indexed: true;
|
|
33
|
+
}, {
|
|
34
|
+
readonly type: "address";
|
|
35
|
+
readonly name: "owner";
|
|
36
|
+
readonly indexed: true;
|
|
37
|
+
}, {
|
|
38
|
+
readonly type: "uint64";
|
|
39
|
+
readonly name: "expiresAt";
|
|
40
|
+
}, {
|
|
41
|
+
readonly type: "uint8";
|
|
42
|
+
readonly name: "creationFlags";
|
|
43
|
+
}];
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "EntityPatched";
|
|
46
|
+
readonly type: "event";
|
|
47
|
+
readonly inputs: readonly [{
|
|
48
|
+
readonly type: "bytes32";
|
|
49
|
+
readonly name: "entityKey";
|
|
50
|
+
readonly indexed: true;
|
|
51
|
+
}, {
|
|
52
|
+
readonly type: "address";
|
|
53
|
+
readonly name: "owner";
|
|
54
|
+
readonly indexed: true;
|
|
55
|
+
}];
|
|
56
|
+
}, {
|
|
57
|
+
readonly name: "ExpiryExtended";
|
|
58
|
+
readonly type: "event";
|
|
59
|
+
readonly inputs: readonly [{
|
|
60
|
+
readonly type: "bytes32";
|
|
61
|
+
readonly name: "entityKey";
|
|
62
|
+
readonly indexed: true;
|
|
63
|
+
}, {
|
|
64
|
+
readonly type: "address";
|
|
65
|
+
readonly name: "owner";
|
|
66
|
+
readonly indexed: true;
|
|
67
|
+
}, {
|
|
68
|
+
readonly type: "uint64";
|
|
69
|
+
readonly name: "expiresAt";
|
|
70
|
+
}];
|
|
71
|
+
}, {
|
|
72
|
+
readonly name: "OwnershipTransferred";
|
|
73
|
+
readonly type: "event";
|
|
74
|
+
readonly inputs: readonly [{
|
|
75
|
+
readonly type: "bytes32";
|
|
76
|
+
readonly name: "entityKey";
|
|
77
|
+
readonly indexed: true;
|
|
78
|
+
}, {
|
|
79
|
+
readonly type: "address";
|
|
80
|
+
readonly name: "previousOwner";
|
|
81
|
+
readonly indexed: true;
|
|
82
|
+
}, {
|
|
83
|
+
readonly type: "address";
|
|
84
|
+
readonly name: "newOwner";
|
|
85
|
+
readonly indexed: true;
|
|
86
|
+
}];
|
|
87
|
+
}, {
|
|
88
|
+
readonly name: "EntityDeleted";
|
|
89
|
+
readonly type: "event";
|
|
90
|
+
readonly inputs: readonly [{
|
|
91
|
+
readonly type: "bytes32";
|
|
92
|
+
readonly name: "entityKey";
|
|
93
|
+
readonly indexed: true;
|
|
94
|
+
}, {
|
|
95
|
+
readonly type: "address";
|
|
96
|
+
readonly name: "owner";
|
|
97
|
+
readonly indexed: true;
|
|
98
|
+
}];
|
|
99
|
+
}];
|
|
100
|
+
/** The name of each event in {@link ENTITY_EVENTS_ABI}. */
|
|
101
|
+
type EntityEventName = (typeof ENTITY_EVENTS_ABI)[number]["name"];
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/entity/key.d.ts
|
|
104
|
+
/** The widest salt the `uint128` wire field carries. */
|
|
105
|
+
declare const MAX_SALT: bigint;
|
|
106
|
+
/**
|
|
107
|
+
* A cryptographically random 128-bit salt — what {@link CreateEntityParameters.salt} defaults to.
|
|
108
|
+
*
|
|
109
|
+
* The salt exists for unpredictability, not uniqueness: the per-owner nonce already guarantees
|
|
110
|
+
* distinct keys. Random bits mean only the creator can predict the key of an entity they are about
|
|
111
|
+
* to create, so nobody else can reference or squat it in advance.
|
|
112
|
+
*
|
|
113
|
+
* @throws {NoRandomSourceError} If the runtime has no `crypto.getRandomValues`.
|
|
114
|
+
*/
|
|
115
|
+
declare function randomSalt(): bigint;
|
|
116
|
+
/**
|
|
117
|
+
* The key an entity will be created with, derived exactly as the engine derives it:
|
|
118
|
+
* `keccak256(domain ++ owner ++ nonce ++ salt)`.
|
|
119
|
+
*
|
|
120
|
+
* Deriving it client-side is what lets a batch compose: predict the key of a create, then have a
|
|
121
|
+
* later operation in the same transaction reference it, or store it as a `key` attribute on a
|
|
122
|
+
* sibling entity.
|
|
123
|
+
*/
|
|
124
|
+
declare function predictEntityKey({
|
|
125
|
+
owner,
|
|
126
|
+
nonce,
|
|
127
|
+
salt,
|
|
128
|
+
chainId
|
|
129
|
+
}: {
|
|
130
|
+
/** The account creating the entity. */
|
|
131
|
+
owner: Address;
|
|
132
|
+
/**
|
|
133
|
+
* The owner's entity-nonce at creation time. Each create in a batch consumes one, so the *n*th
|
|
134
|
+
* create in a batch uses `nonce + n`.
|
|
135
|
+
*/
|
|
136
|
+
nonce: bigint;
|
|
137
|
+
/** The salt the create will carry. */
|
|
138
|
+
salt: bigint;
|
|
139
|
+
/** The chain the entity is being created on — half of the derivation domain. */
|
|
140
|
+
chainId: number;
|
|
141
|
+
}): Hex;
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/entity/params.d.ts
|
|
144
|
+
/**
|
|
145
|
+
* Max uint64 value
|
|
146
|
+
*/
|
|
147
|
+
declare const MAX_EXPIRES_AT: bigint;
|
|
148
|
+
/** The operation tags of the `execute` ABI's tagged union. */
|
|
149
|
+
declare const OperationType: {
|
|
150
|
+
readonly Create: 1;
|
|
151
|
+
readonly Patch: 2;
|
|
152
|
+
readonly ExtendExpiry: 3;
|
|
153
|
+
readonly TransferOwnership: 4;
|
|
154
|
+
readonly Delete: 5;
|
|
155
|
+
};
|
|
156
|
+
type OperationType = (typeof OperationType)[keyof typeof OperationType];
|
|
157
|
+
//#endregion
|
|
158
|
+
export { randomSalt as a, InvalidCreationFlagsError as c, NoRandomSourceError as d, predictEntityKey as i, InvalidExpiryError as l, OperationType as n, ENTITY_EVENTS_ABI as o, MAX_SALT as r, EntityEventName as s, MAX_EXPIRES_AT as t, InvalidSaltError as u };
|
|
159
|
+
//# sourceMappingURL=index-D0CmtiWT.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-D0CmtiWT.d.cts","names":[],"sources":["../src/entity/errors.ts","../src/entity/events.ts","../src/entity/key.ts","../src/entity/params.ts"],"sourcesContent":[],"mappings":";;;;cACa,kBAAA,SAA2B,KAAA;;AAAxC;AAQA;AAQa,cARA,yBAAA,SAAkC,KAAA,CAQJ;EAW9B,WAAA,CAAA,MAAA,EAAA,MAAoB;;;cAXpB,gBAAA,SAAyB,KAAA;ECXzB,WAAA,CAAA,IAAA,EAAA,MAMX;AAGF;;cDaa,mBAAA,SAA4B,KAAA;;AEvBzC;;;;;;AFJA;AAQa,cCHA,iBDG0B,EAAA,SAAQ,CAAA;EAQlC,SAAA,IAAA,EAAA,eAAiB;EAWjB,SAAA,IAAA,EAAA,OAAoB;;;;ICtBpB,SAAA,OAMX,EAAA,IAAA;EAGU,CAAA,EAAA;;;;ECVC,CAAA,EAAA;IAWG,SAAU,IAAA,EAAA,QAAA;IA2BV,SAAA,IAAA,EAAgB,WAAA;EAC9B,CAAA,EAAA;IACA,SAAA,IAAA,EAAA,OAAA;IACA,SAAA,IAAA,EAAA,eAAA;EACA,CAAA,CAAA;CAGO,EAAA;EAUL,SAAA,IAAA,EAAA,eAAA;EAAG,SAAA,IAAA,EAAA,OAAA;;;;ICzDM,SAAA,OAA+B,EAAA,IAAA;EAG/B,CAAA,EAAA;IAQD,SAAA,IAAa,EAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KFCb,eAAA,WAA0B;;;;cCVzB;AFJb;AAQA;AAQA;AAWA;;;;ACtBA;AASA;iBCCgB,UAAA,CAAA;AAXhB;AAWA;AA2BA;;;;;;AAiBI,iBAjBY,gBAAA,CAiBZ;EAAA,KAAA;EAAA,KAAA;EAAA,IAAA;EAAA;CAAA,EAAA;EAAG;SAVE;;;AC/CT;AAGA;EAQY,KAAA,EAAA,MAAA;;;;;ID8CR;;;;;;AF3DS,cGEA,cHFmB,EAAA,MAAQ;AAQxC;AAQa,cGXA,aHWiB,EAAQ;EAWzB,SAAA,MAAA,EAAA,CAAA;;;;ECtBA,SAAA,MAAA,EAAA,CAAA;AASb,CAAA;KEDY,aAAA,WAAwB,4BAA4B"}
|