@arkiv-network/sdk 0.6.8 → 0.7.0
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 +52 -16
- package/dist/chains/index.d.cts +25 -25
- package/dist/consts-AUoL-v42.cjs +18 -0
- package/dist/consts-BV4PR-de.js +7 -0
- package/dist/consts-BV4PR-de.js.map +1 -0
- package/dist/{query-CO6f35AE.d.cts → entity-B6g_EPm1.d.cts} +78 -31
- package/dist/entity-B6g_EPm1.d.cts.map +1 -0
- package/dist/{query-BhdmAzYg.d.ts → entity-qoLMAuuk.d.ts} +78 -31
- package/dist/entity-qoLMAuuk.d.ts.map +1 -0
- package/dist/index-DdspxNAA.d.ts +481 -0
- package/dist/index-DdspxNAA.d.ts.map +1 -0
- package/dist/index-Ds9dwqb5.d.cts +481 -0
- package/dist/index-Ds9dwqb5.d.cts.map +1 -0
- package/dist/index.cjs +63 -28
- package/dist/index.d.cts +90 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +91 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +58 -21
- package/dist/index.js.map +1 -1
- package/dist/{payload-Da9gJMG5.d.ts → payload-B2kFJyah.d.ts} +1 -1
- package/dist/{payload-Da9gJMG5.d.ts.map → payload-B2kFJyah.d.ts.map} +1 -1
- package/dist/payload-Claf2jUO.js +13 -0
- package/dist/payload-Claf2jUO.js.map +1 -0
- package/dist/{payload-vwU3Rc6P.cjs → payload-DpA5PA-w.cjs} +0 -17
- package/dist/query/index.cjs +10 -28
- package/dist/query/index.d.cts +3 -3
- package/dist/query/index.d.ts +3 -3
- package/dist/query/index.js +7 -28
- package/dist/query/index.js.map +1 -1
- package/dist/{queryBuilder-DonAg1aq.js → queryBuilder-D2uwP9jI.js} +209 -89
- package/dist/queryBuilder-D2uwP9jI.js.map +1 -0
- package/dist/{queryBuilder-DM-YO1Y7.cjs → queryBuilder-UW2MCaX4.cjs} +237 -87
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/index.cjs +4 -10
- package/dist/utils/index.d.cts +0 -1
- package/dist/utils/index.d.cts.map +1 -1
- package/dist/utils/index.d.ts +1 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -3
- package/dist/utils/index.js.map +1 -1
- package/package.json +11 -15
- package/src/actions/public/buildQuery.ts +4 -0
- package/src/actions/public/query.ts +10 -0
- package/src/actions/wallet/createEntity.ts +12 -2
- package/src/actions/wallet/extendEntity.ts +6 -1
- package/src/actions/wallet/updateEntity.ts +12 -2
- package/src/clients/createPublicClient.test.ts +2 -0
- package/src/clients/decorators/arkivPublic.ts +67 -2
- package/src/clients/decorators/arkivWallet.ts +18 -0
- package/src/errors.ts +18 -0
- package/src/index.ts +0 -3
- package/src/query/engine.ts +22 -13
- package/src/query/index.ts +1 -0
- package/src/query/predicate.test.ts +43 -0
- package/src/query/predicate.ts +14 -10
- package/src/query/queryBuilder.test.ts +22 -0
- package/src/query/queryBuilder.ts +221 -106
- package/src/query/queryResult.ts +13 -7
- package/src/query/selectQueryBuilder.test.ts +210 -0
- package/src/query/selection.test.ts +120 -0
- package/src/query/selection.ts +116 -0
- package/src/types/attributes.ts +12 -0
- package/src/utils/arkivTransactions.test.ts +62 -0
- package/src/utils/arkivTransactions.ts +36 -27
- package/src/utils/index.ts +0 -1
- package/src/utils/validation.test.ts +60 -0
- package/src/utils/validation.ts +32 -0
- package/dist/accounts/index.cjs +0 -9
- package/dist/accounts/index.d.cts +0 -1
- package/dist/accounts/index.d.ts +0 -1
- package/dist/accounts/index.js +0 -1
- package/dist/payload-DKBYYjeA.js +0 -18
- package/dist/payload-DKBYYjeA.js.map +0 -1
- package/dist/query-BhdmAzYg.d.ts.map +0 -1
- package/dist/query-CO6f35AE.d.cts.map +0 -1
- package/dist/queryBuilder-BvoQXa_u.d.ts +0 -328
- package/dist/queryBuilder-BvoQXa_u.d.ts.map +0 -1
- package/dist/queryBuilder-DonAg1aq.js.map +0 -1
- package/dist/queryBuilder-zTsKXctT.d.cts +0 -328
- package/dist/queryBuilder-zTsKXctT.d.cts.map +0 -1
- package/src/accounts/index.ts +0 -1
package/README.md
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
# arkivjs
|
|
2
2
|
|
|
3
3
|
A TypeScript client library for Arkiv's blockchains interactions.
|
|
4
|
-
The Arkiv SDK
|
|
4
|
+
The Arkiv SDK builds strongly on the [Viem](https://github.com/wevm/viem) library - it extends Viem's clients with Arkiv's chain-specific features.
|
|
5
|
+
|
|
6
|
+
[`viem`](https://viem.sh) is a **peer dependency**: install it alongside the SDK.
|
|
5
7
|
|
|
6
8
|
## Installation
|
|
7
9
|
|
|
8
10
|
```bash
|
|
9
|
-
npm install @arkiv-network/sdk
|
|
11
|
+
npm install @arkiv-network/sdk viem
|
|
10
12
|
# or
|
|
11
|
-
pnpm install @arkiv-network/sdk
|
|
13
|
+
pnpm install @arkiv-network/sdk viem
|
|
12
14
|
# or
|
|
13
|
-
bun add @arkiv-network/sdk
|
|
15
|
+
bun add @arkiv-network/sdk viem
|
|
14
16
|
# or
|
|
15
|
-
yarn add @arkiv-network/sdk
|
|
17
|
+
yarn add @arkiv-network/sdk viem
|
|
16
18
|
```
|
|
17
19
|
|
|
18
20
|
## Usage
|
|
@@ -76,14 +78,15 @@ Modify the `"main"` entry to `"read_example.ts"` and set `"type"` to `"module"`
|
|
|
76
78
|
}
|
|
77
79
|
```
|
|
78
80
|
|
|
79
|
-
Install `@arkiv-network/sdk` using your preferred package manager:
|
|
81
|
+
Install `@arkiv-network/sdk` along with its `viem` peer dependency using your preferred package manager:
|
|
80
82
|
```bash
|
|
81
|
-
npm install @arkiv-network/sdk
|
|
83
|
+
npm install @arkiv-network/sdk viem
|
|
82
84
|
```
|
|
83
85
|
This command will update your `package.json` with a section like:
|
|
84
86
|
```json
|
|
85
87
|
"dependencies": {
|
|
86
|
-
"@arkiv-network/sdk": "^0.6.0"
|
|
88
|
+
"@arkiv-network/sdk": "^0.6.0",
|
|
89
|
+
"viem": "^2.38.2"
|
|
87
90
|
}
|
|
88
91
|
```
|
|
89
92
|
It will also create a `node_modules` directory with all dependencies installed.
|
|
@@ -93,9 +96,10 @@ It will also create a `node_modules` directory with all dependencies installed.
|
|
|
93
96
|
You can now use Arkiv's public client to query data. Paste the following in `read_example.ts`:
|
|
94
97
|
|
|
95
98
|
```typescript
|
|
96
|
-
import { createPublicClient
|
|
99
|
+
import { createPublicClient } from "@arkiv-network/sdk"
|
|
97
100
|
import { braga } from "@arkiv-network/sdk/chains"
|
|
98
101
|
import { eq } from "@arkiv-network/sdk/query"
|
|
102
|
+
import { http } from "viem"
|
|
99
103
|
|
|
100
104
|
const publicClient = createPublicClient({
|
|
101
105
|
chain: braga, // "braga" is Arkiv's testnet
|
|
@@ -110,13 +114,11 @@ console.log('Chain ID:', chainId);
|
|
|
110
114
|
const entity = await publicClient.getEntity('0xcadb830a3414251d65e5c92cd28ecb648d9e73d85f2203eff631839d5421f9d7');
|
|
111
115
|
console.log('Entity:', entity);
|
|
112
116
|
|
|
113
|
-
// Build and execute a query using
|
|
114
|
-
const
|
|
115
|
-
|
|
117
|
+
// Build and execute a query using select()
|
|
118
|
+
const result = await publicClient
|
|
119
|
+
.select({ owner: true, attributes: true, payload: true })
|
|
116
120
|
.where(eq('category', 'documentation'))
|
|
117
121
|
.ownedBy('0x6186B0DbA9652262942d5A465d49686eb560834C')
|
|
118
|
-
.withAttributes(true)
|
|
119
|
-
.withPayload(true)
|
|
120
122
|
.limit(10)
|
|
121
123
|
.fetch();
|
|
122
124
|
|
|
@@ -129,6 +131,39 @@ if (result.hasNextPage()) {
|
|
|
129
131
|
}
|
|
130
132
|
```
|
|
131
133
|
|
|
134
|
+
#### Selecting fields with `select()`
|
|
135
|
+
|
|
136
|
+
Pass nothing (or `"*"`) to fetch everything, or pass an object to fetch only specific fields:
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
// All fields
|
|
140
|
+
await publicClient.select().where(eq("category", "docs")).fetch();
|
|
141
|
+
|
|
142
|
+
// Only the fields you need
|
|
143
|
+
await publicClient.select({ key: true, owner: true, payload: true }).where(eq("category", "docs")).fetch();
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Select only what you need.** Every selected field is fetched over the network, so requesting
|
|
147
|
+
data you won't use makes queries slower. Narrowing the selection keeps responses small and fast.
|
|
148
|
+
|
|
149
|
+
The result type is inferred from your selection: reading a field you didn't select is a compile error. The `toText()` / `toJson()` payload
|
|
150
|
+
helpers are available only when you select `payload`.
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
const [entity] = (await publicClient.select({ owner: true, payload: true }).fetch()).entities;
|
|
154
|
+
entity.owner; // ✅ Hex
|
|
155
|
+
entity.toJson(); // ✅ payload was selected
|
|
156
|
+
entity.creator; // ❌ compile error — not selected
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
> **Footgun:** pass the selection inline. A selection stored in a variable widens its `true` values
|
|
160
|
+
> to `boolean`, so the result type can't be narrowed (you get `{}` and a compile error on every
|
|
161
|
+
> field). If you need to reuse one, annotate it `as const`:
|
|
162
|
+
> ```typescript
|
|
163
|
+
> const fields = { owner: true, payload: true } as const;
|
|
164
|
+
> await publicClient.select(fields).where(eq("category", "docs")).fetch();
|
|
165
|
+
> ```
|
|
166
|
+
|
|
132
167
|
### Running the Example
|
|
133
168
|
|
|
134
169
|
You have several options to run your TypeScript sample:
|
|
@@ -170,10 +205,11 @@ Now let's add storage (write) functionality.
|
|
|
170
205
|
Create a file named `write_example.ts` with the following content:
|
|
171
206
|
|
|
172
207
|
```typescript
|
|
173
|
-
import { createPublicClient, createWalletClient
|
|
174
|
-
import { privateKeyToAccount } from "@arkiv-network/sdk/accounts"
|
|
208
|
+
import { createPublicClient, createWalletClient } from "@arkiv-network/sdk"
|
|
175
209
|
import { braga } from "@arkiv-network/sdk/chains"
|
|
176
210
|
import { ExpirationTime, jsonToPayload } from "@arkiv-network/sdk/utils"
|
|
211
|
+
import { http } from "viem"
|
|
212
|
+
import { privateKeyToAccount } from "viem/accounts"
|
|
177
213
|
|
|
178
214
|
// Create a public client
|
|
179
215
|
const publicClient = createPublicClient({
|
package/dist/chains/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as viem0 from "viem";
|
|
2
2
|
|
|
3
3
|
//#region src/chains/braga.d.ts
|
|
4
4
|
declare const braga: {
|
|
@@ -11,13 +11,13 @@ declare const braga: {
|
|
|
11
11
|
};
|
|
12
12
|
blockTime?: number | undefined | undefined;
|
|
13
13
|
contracts?: {
|
|
14
|
-
[x: string]:
|
|
15
|
-
[sourceId: number]:
|
|
14
|
+
[x: string]: viem0.ChainContract | {
|
|
15
|
+
[sourceId: number]: viem0.ChainContract | undefined;
|
|
16
16
|
} | undefined;
|
|
17
|
-
ensRegistry?:
|
|
18
|
-
ensUniversalResolver?:
|
|
19
|
-
multicall3?:
|
|
20
|
-
erc6492Verifier?:
|
|
17
|
+
ensRegistry?: viem0.ChainContract | undefined;
|
|
18
|
+
ensUniversalResolver?: viem0.ChainContract | undefined;
|
|
19
|
+
multicall3?: viem0.ChainContract | undefined;
|
|
20
|
+
erc6492Verifier?: viem0.ChainContract | undefined;
|
|
21
21
|
} | undefined;
|
|
22
22
|
ensTlds?: readonly string[] | undefined;
|
|
23
23
|
id: 60138453102;
|
|
@@ -37,9 +37,9 @@ declare const braga: {
|
|
|
37
37
|
sourceId?: number | undefined | undefined;
|
|
38
38
|
testnet: true;
|
|
39
39
|
custom?: Record<string, unknown> | undefined;
|
|
40
|
-
fees?:
|
|
40
|
+
fees?: viem0.ChainFees<undefined> | undefined;
|
|
41
41
|
formatters?: undefined;
|
|
42
|
-
serializers?:
|
|
42
|
+
serializers?: viem0.ChainSerializers<undefined, viem0.TransactionSerializable> | undefined;
|
|
43
43
|
readonly network: "braga";
|
|
44
44
|
};
|
|
45
45
|
//#endregion
|
|
@@ -57,13 +57,13 @@ declare const kaolin: {
|
|
|
57
57
|
};
|
|
58
58
|
blockTime?: number | undefined | undefined;
|
|
59
59
|
contracts?: {
|
|
60
|
-
[x: string]:
|
|
61
|
-
[sourceId: number]:
|
|
60
|
+
[x: string]: viem0.ChainContract | {
|
|
61
|
+
[sourceId: number]: viem0.ChainContract | undefined;
|
|
62
62
|
} | undefined;
|
|
63
|
-
ensRegistry?:
|
|
64
|
-
ensUniversalResolver?:
|
|
65
|
-
multicall3?:
|
|
66
|
-
erc6492Verifier?:
|
|
63
|
+
ensRegistry?: viem0.ChainContract | undefined;
|
|
64
|
+
ensUniversalResolver?: viem0.ChainContract | undefined;
|
|
65
|
+
multicall3?: viem0.ChainContract | undefined;
|
|
66
|
+
erc6492Verifier?: viem0.ChainContract | undefined;
|
|
67
67
|
} | undefined;
|
|
68
68
|
ensTlds?: readonly string[] | undefined;
|
|
69
69
|
id: 60138453025;
|
|
@@ -83,9 +83,9 @@ declare const kaolin: {
|
|
|
83
83
|
sourceId?: number | undefined | undefined;
|
|
84
84
|
testnet: true;
|
|
85
85
|
custom?: Record<string, unknown> | undefined;
|
|
86
|
-
fees?:
|
|
86
|
+
fees?: viem0.ChainFees<undefined> | undefined;
|
|
87
87
|
formatters?: undefined;
|
|
88
|
-
serializers?:
|
|
88
|
+
serializers?: viem0.ChainSerializers<undefined, viem0.TransactionSerializable> | undefined;
|
|
89
89
|
readonly network: "kaolin";
|
|
90
90
|
};
|
|
91
91
|
//#endregion
|
|
@@ -105,13 +105,13 @@ declare const localhost: {
|
|
|
105
105
|
} | undefined | undefined;
|
|
106
106
|
blockTime?: number | undefined | undefined;
|
|
107
107
|
contracts?: {
|
|
108
|
-
[x: string]:
|
|
109
|
-
[sourceId: number]:
|
|
108
|
+
[x: string]: viem0.ChainContract | {
|
|
109
|
+
[sourceId: number]: viem0.ChainContract | undefined;
|
|
110
110
|
} | undefined;
|
|
111
|
-
ensRegistry?:
|
|
112
|
-
ensUniversalResolver?:
|
|
113
|
-
multicall3?:
|
|
114
|
-
erc6492Verifier?:
|
|
111
|
+
ensRegistry?: viem0.ChainContract | undefined;
|
|
112
|
+
ensUniversalResolver?: viem0.ChainContract | undefined;
|
|
113
|
+
multicall3?: viem0.ChainContract | undefined;
|
|
114
|
+
erc6492Verifier?: viem0.ChainContract | undefined;
|
|
115
115
|
} | undefined;
|
|
116
116
|
ensTlds?: readonly string[] | undefined;
|
|
117
117
|
id: 1337;
|
|
@@ -130,9 +130,9 @@ declare const localhost: {
|
|
|
130
130
|
sourceId?: number | undefined | undefined;
|
|
131
131
|
testnet?: boolean | undefined | undefined;
|
|
132
132
|
custom?: Record<string, unknown> | undefined;
|
|
133
|
-
fees?:
|
|
133
|
+
fees?: viem0.ChainFees<undefined> | undefined;
|
|
134
134
|
formatters?: undefined;
|
|
135
|
-
serializers?:
|
|
135
|
+
serializers?: viem0.ChainSerializers<undefined, viem0.TransactionSerializable> | undefined;
|
|
136
136
|
};
|
|
137
137
|
//#endregion
|
|
138
138
|
export { braga, kaolin, localhost };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/consts.ts
|
|
3
|
+
const ARKIV_ADDRESS = "0x00000000000000000000000000000061726b6976";
|
|
4
|
+
const BLOCK_TIME = 2;
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
Object.defineProperty(exports, 'ARKIV_ADDRESS', {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return ARKIV_ADDRESS;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, 'BLOCK_TIME', {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return BLOCK_TIME;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts-BV4PR-de.js","names":[],"sources":["../src/consts.ts"],"sourcesContent":["export const ARKIV_ADDRESS = \"0x00000000000000000000000000000061726b6976\" as `0x${string}`\nexport const BLOCK_TIME = 2 // 2 seconds\n"],"mappings":";AAAA,MAAa,gBAAgB;AAC7B,MAAa,aAAa"}
|
|
@@ -81,6 +81,40 @@ type GetBlockTimingReturnType = {
|
|
|
81
81
|
blockDuration: number;
|
|
82
82
|
};
|
|
83
83
|
//#endregion
|
|
84
|
+
//#region src/actions/public/query.d.ts
|
|
85
|
+
type QueryOptionsIncludeData = {
|
|
86
|
+
attributes?: boolean;
|
|
87
|
+
payload?: boolean;
|
|
88
|
+
metadata?: boolean;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* @deprecated Server-side ordering is not supported by the network. Sort the fetched
|
|
92
|
+
* entities in JavaScript instead (e.g. `entities.sort(...)`). This type will be removed
|
|
93
|
+
* in a future release.
|
|
94
|
+
*/
|
|
95
|
+
type QueryOptionsOrderBy = {
|
|
96
|
+
name: string;
|
|
97
|
+
type: "string" | "numeric";
|
|
98
|
+
desc: "asc" | "desc";
|
|
99
|
+
};
|
|
100
|
+
type QueryOptions = {
|
|
101
|
+
includeData?: QueryOptionsIncludeData;
|
|
102
|
+
atBlock?: bigint;
|
|
103
|
+
/**
|
|
104
|
+
* @deprecated Server-side ordering is not supported by the network, so this option has no
|
|
105
|
+
* effect on the returned order. Sort the fetched entities in JavaScript instead
|
|
106
|
+
* (e.g. `entities.sort(...)`). This option will be removed in a future release.
|
|
107
|
+
*/
|
|
108
|
+
orderBy?: QueryOptionsOrderBy[];
|
|
109
|
+
resultsPerPage?: number | undefined;
|
|
110
|
+
cursor?: string | undefined;
|
|
111
|
+
};
|
|
112
|
+
type QueryReturnType = {
|
|
113
|
+
entities: Entity[];
|
|
114
|
+
cursor: string | undefined;
|
|
115
|
+
blockNumber: bigint | undefined;
|
|
116
|
+
};
|
|
117
|
+
//#endregion
|
|
84
118
|
//#region src/actions/wallet/changeOwnership.d.ts
|
|
85
119
|
/**
|
|
86
120
|
* Parameters for the deleteEntity function.
|
|
@@ -104,14 +138,24 @@ type ChangeOwnershipReturnType = {
|
|
|
104
138
|
/**
|
|
105
139
|
* Parameters for the createEntity function.
|
|
106
140
|
* - payload: The payload of the entity.
|
|
107
|
-
* - attributes: The attributes of the entity.
|
|
141
|
+
* - attributes: The attributes of the entity. Attribute values may be strings
|
|
142
|
+
* or numbers, but numeric values **must be integers**. To store a non-integer,
|
|
143
|
+
* scale it to an integer (e.g. `1.5` -> `1500`) to preserve numeric ordering,
|
|
144
|
+
* or pass it as a string (e.g. `"1.5"`). A non-integer numeric value throws an
|
|
145
|
+
* {@link InvalidAttributeError}.
|
|
108
146
|
* - contentType: The content type of the entity.
|
|
109
|
-
* - expiresIn:
|
|
147
|
+
* - expiresIn: How long until the entity expires, in seconds. Because Arkiv
|
|
148
|
+
* measures expiration in blocks (1 block = 2 seconds), this **must be a
|
|
149
|
+
* positive integer and a multiple of the block time (2 seconds)**
|
|
150
|
+
* Invalid values throw an {@link InvalidExpirationError}.
|
|
110
151
|
*/
|
|
111
152
|
type CreateEntityParameters = {
|
|
112
153
|
payload: Uint8Array;
|
|
154
|
+
/** Entity attributes. Numeric values must be integers (scale non-integers, e.g. `1.5` -> `1500`, or use a string). Throws {@link InvalidAttributeError} otherwise. */
|
|
113
155
|
attributes: Attribute[];
|
|
114
156
|
contentType: MimeType | string;
|
|
157
|
+
/** Seconds until expiry. Must be a positive integer and a multiple of the 2s block time.
|
|
158
|
+
* Throws {@link InvalidExpirationError} otherwise. */
|
|
115
159
|
expiresIn: number;
|
|
116
160
|
};
|
|
117
161
|
/**
|
|
@@ -146,10 +190,15 @@ type DeleteEntityReturnType = {
|
|
|
146
190
|
/**
|
|
147
191
|
* Parameters for the extendEntity function.
|
|
148
192
|
* - entityKey: The key of the entity to extend.
|
|
149
|
-
* - expiresIn:
|
|
193
|
+
* - expiresIn: How long to extend the entity by, in seconds. Because Arkiv
|
|
194
|
+
* measures expiration in blocks (1 block = 2 seconds), this **must be a
|
|
195
|
+
* positive integer and a multiple of the block time (2 seconds)**.
|
|
196
|
+
* Invalid values throw an {@link InvalidExpirationError}.
|
|
150
197
|
*/
|
|
151
198
|
type ExtendEntityParameters = {
|
|
152
199
|
entityKey: Hex;
|
|
200
|
+
/** Seconds to extend by. Must be a positive integer and a multiple of the 2s block time.
|
|
201
|
+
* Throws {@link InvalidExpirationError} otherwise. */
|
|
153
202
|
expiresIn: number;
|
|
154
203
|
};
|
|
155
204
|
/**
|
|
@@ -167,15 +216,25 @@ type ExtendEntityReturnType = {
|
|
|
167
216
|
* Parameters for the updateEntity function.
|
|
168
217
|
* - entityKey: The key of the entity to update.
|
|
169
218
|
* - payload: The payload of the entity.
|
|
170
|
-
* - attributes: The attributes of the entity.
|
|
219
|
+
* - attributes: The attributes of the entity. Attribute values may be strings
|
|
220
|
+
* or numbers, but numeric values **must be integers**. To store a non-integer,
|
|
221
|
+
* scale it to an integer (e.g. `1.5` -> `1500`) to preserve numeric ordering,
|
|
222
|
+
* or pass it as a string (e.g. `"1.5"`). A non-integer numeric value throws an
|
|
223
|
+
* {@link InvalidAttributeError}.
|
|
171
224
|
* - contentType: The content type of the entity.
|
|
172
|
-
* - expiresIn:
|
|
225
|
+
* - expiresIn: How long until the entity expires, in seconds. Because Arkiv
|
|
226
|
+
* measures expiration in blocks (1 block = 2 seconds), this **must be a
|
|
227
|
+
* positive integer and a multiple of the block time (2 seconds)**.
|
|
228
|
+
* Invalid values throw an {@link InvalidExpirationError}.
|
|
173
229
|
*/
|
|
174
230
|
type UpdateEntityParameters = {
|
|
175
231
|
entityKey: Hex;
|
|
176
232
|
payload: Uint8Array;
|
|
233
|
+
/** Entity attributes. Numeric values must be integers (scale non-integers, e.g. `1.5` -> `1500`, or use a string). Throws {@link InvalidAttributeError} otherwise. */
|
|
177
234
|
attributes: Attribute[];
|
|
178
235
|
contentType: MimeType | string;
|
|
236
|
+
/** Seconds until expiry. Must be a positive integer and a multiple of the 2s block time.
|
|
237
|
+
* Throws {@link InvalidExpirationError} otherwise. */
|
|
179
238
|
expiresIn: number;
|
|
180
239
|
};
|
|
181
240
|
/**
|
|
@@ -222,8 +281,20 @@ type MutateEntitiesReturnType = {
|
|
|
222
281
|
};
|
|
223
282
|
//#endregion
|
|
224
283
|
//#region src/types/attributes.d.ts
|
|
284
|
+
/**
|
|
285
|
+
* An entity attribute (key/value pair).
|
|
286
|
+
*
|
|
287
|
+
* Arkiv supports both string and number values. Numeric values **must be
|
|
288
|
+
* integers** — passing a non-integer number (e.g. `1.5`) throws an
|
|
289
|
+
* {@link InvalidAttributeError} at mutation time. To store a non-integer value:
|
|
290
|
+
* - Scale it to an integer (e.g. `1.5` -> `1500`, dividing by the same factor on
|
|
291
|
+
* read) to keep numeric ordering and range queries working.
|
|
292
|
+
* - Or pass it as a string (e.g. `"1.5"`), which sorts lexicographically and so
|
|
293
|
+
* does not support numeric comparisons.
|
|
294
|
+
*/
|
|
225
295
|
type Attribute = {
|
|
226
296
|
key: string;
|
|
297
|
+
/** Attribute value. A `number` must be an integer (scale non-integers, e.g. `1.5` -> `1500`, or use a string). Throws {@link InvalidAttributeError} otherwise. */
|
|
227
298
|
value: string | number;
|
|
228
299
|
};
|
|
229
300
|
//#endregion
|
|
@@ -307,29 +378,5 @@ declare class Entity {
|
|
|
307
378
|
toJson(): any;
|
|
308
379
|
}
|
|
309
380
|
//#endregion
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
attributes?: boolean;
|
|
313
|
-
payload?: boolean;
|
|
314
|
-
metadata?: boolean;
|
|
315
|
-
};
|
|
316
|
-
type QueryOptionsOrderBy = {
|
|
317
|
-
name: string;
|
|
318
|
-
type: "string" | "numeric";
|
|
319
|
-
desc: "asc" | "desc";
|
|
320
|
-
};
|
|
321
|
-
type QueryOptions = {
|
|
322
|
-
includeData?: QueryOptionsIncludeData;
|
|
323
|
-
atBlock?: bigint;
|
|
324
|
-
orderBy?: QueryOptionsOrderBy[];
|
|
325
|
-
resultsPerPage?: number | undefined;
|
|
326
|
-
cursor?: string | undefined;
|
|
327
|
-
};
|
|
328
|
-
type QueryReturnType = {
|
|
329
|
-
entities: Entity[];
|
|
330
|
-
cursor: string | undefined;
|
|
331
|
-
blockNumber: bigint | undefined;
|
|
332
|
-
};
|
|
333
|
-
//#endregion
|
|
334
|
-
export { RpcIncludeData as A, CreateEntityReturnType as C, ArkivClient as D, GetBlockTimingReturnType as E, RpcQueryOptions as M, MimeType as N, ArkivRpcSchema as O, CreateEntityParameters as S, ChangeOwnershipReturnType as T, UpdateEntityReturnType as _, Entity as a, DeleteEntityParameters as b, OnEntityDeletedEvent as c, OnEntityOwnerChangedEvent as d, OnEntityUpdatedEvent as f, UpdateEntityParameters as g, MutateEntitiesReturnType as h, QueryReturnType as i, RpcOrderByAttribute as j, RpcEntity as k, OnEntityExpiredEvent as l, MutateEntitiesParameters as m, QueryOptionsIncludeData as n, TxParams as o, Attribute as p, QueryOptionsOrderBy as r, OnEntityCreatedEvent as s, QueryOptions as t, OnEntityExpiresInExtendedEvent as u, ExtendEntityParameters as v, ChangeOwnershipParameters as w, DeleteEntityReturnType as x, ExtendEntityReturnType as y };
|
|
335
|
-
//# sourceMappingURL=query-CO6f35AE.d.cts.map
|
|
381
|
+
export { RpcIncludeData as A, QueryOptionsIncludeData as C, ArkivClient as D, GetBlockTimingReturnType as E, RpcQueryOptions as M, MimeType as N, ArkivRpcSchema as O, QueryOptions as S, QueryReturnType as T, DeleteEntityReturnType as _, OnEntityExpiredEvent as a, ChangeOwnershipParameters as b, OnEntityUpdatedEvent as c, MutateEntitiesReturnType as d, UpdateEntityParameters as f, DeleteEntityParameters as g, ExtendEntityReturnType as h, OnEntityDeletedEvent as i, RpcOrderByAttribute as j, RpcEntity as k, Attribute as l, ExtendEntityParameters as m, TxParams as n, OnEntityExpiresInExtendedEvent as o, UpdateEntityReturnType as p, OnEntityCreatedEvent as r, OnEntityOwnerChangedEvent as s, Entity as t, MutateEntitiesParameters as u, CreateEntityParameters as v, QueryOptionsOrderBy as w, ChangeOwnershipReturnType as x, CreateEntityReturnType as y };
|
|
382
|
+
//# sourceMappingURL=entity-B6g_EPm1.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-B6g_EPm1.d.cts","names":[],"sources":["../src/types/mimeTypes.ts","../src/types/rpcSchema.ts","../src/clients/baseClient.ts","../src/actions/public/getBlockTiming.ts","../src/actions/public/query.ts","../src/actions/wallet/changeOwnership.ts","../src/actions/wallet/createEntity.ts","../src/actions/wallet/deleteEntity.ts","../src/actions/wallet/extendEntity.ts","../src/actions/wallet/updateEntity.ts","../src/actions/wallet/mutateEntities.ts","../src/types/attributes.ts","../src/types/events.ts","../src/types/txParams.ts","../src/types/entity.ts"],"sourcesContent":[],"mappings":";;;KAAY,QAAA;;;KCGA,SAAA;EDHA,GAAA,ECIL,GDJK;eCKG;;aAEF;EAJD,cAAS,EAKH,GALG;EACd,mBAAA,EAKgB,GALhB;EACQ,uBAAA,EAKY,GALZ;EAEF,2BAAA,EAIkB,GAJlB;EACK,KAAA,EAIT,GAJS;EACK,OAAA,EAIZ,GAJY;EACI,gBAAA,CAAA,EAAA,CAAA;IACI,GAAA,EAAA,MAAA;IACtB,KAAA,EAAA,MAAA;EACE,CAAA,CAAA;EAEkC,iBAAA,CAAA,EAAA,CAAA;IAAG,GAAA,EAAA,MAAA;IAGpC,KAAA,EAHiC,GAGjC;EAMA,CAAA,CAAA;CACA;AACI,KARJ,mBAAA,GAQI;EACJ,IAAA,EAAA,MAAA;EACO,IAAA,EAAA,QAAA,GAAA,SAAA;EAAG,IAAA,EAAA,OAAA;AAItB,CAAA;AAcY,KAtBA,eAAA,GAsBc;EAGsB,OAAA,CAAA,EAxBpC,GAwBoC;EAEpC,WAAA,CAAA,EAzBI,cAyBJ;EACO,OAAA,CAAA,EAzBP,mBAyBO,EAAA;EAAG,cAAA,CAAA,EAxBH,GAwBG;;;KApBV,cAAA;EC7BA,GAAA,CAAA,EAAA,OAAA;EACQ,UAAA,CAAA,EAAA,OAAA;EAAY,OAAA,CAAA,EAAA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,MAAA,GAAA,SAAA;EACQ,cAAA,EAAA,MAAA,GAAA,SAAA;EAEF,mBAAA,EAAA,MAAA,GAAA,SAAA;EACK,uBAAA,EAAA,MAAA,GAAA,SAAA;EACK,2BAAA,EAAA,MAAA,GAAA,SAAA;EACI,OAAA,EaIhB,UbJgB,GAAA,SAAA;EACI,UAAA,EaIjB,SbJiB,EAAA;EACtB,WAAA,CAAA,GAAA,EaMA,GbNA,EAAA,WAAA,EaOQ,QbPR,GAAA,SAAA,EAAA,KAAA,EaQE,GbRF,GAAA,SAAA,EAAA,OAAA,EaSI,GbTJ,GAAA,SAAA,EAAA,cAAA,EAAA,MAAA,GAAA,SAAA,EAAA,cAAA,EAAA,MAAA,GAAA,SAAA,EAAA,mBAAA,EAAA,MAAA,GAAA,SAAA,EAAA,uBAAA,EAAA,MAAA,GAAA,SAAA,EAAA,2BAAA,EAAA,MAAA,GAAA,SAAA,EAAA,OAAA,EaeI,UbfJ,GAAA,SAAA,EAAA,UAAA,EagBO,SbhBP,EAAA;EACE;;;AAKX;AAMA;;EAEgB,MAAA,CAAA,CAAA,EAAA,MAAA;EACJ;;;AAKZ;AAcA;;EAKY,MAAA,CAAA,CAAA,EAAA,GAAA"}
|
|
@@ -81,6 +81,40 @@ type GetBlockTimingReturnType = {
|
|
|
81
81
|
blockDuration: number;
|
|
82
82
|
};
|
|
83
83
|
//#endregion
|
|
84
|
+
//#region src/actions/public/query.d.ts
|
|
85
|
+
type QueryOptionsIncludeData = {
|
|
86
|
+
attributes?: boolean;
|
|
87
|
+
payload?: boolean;
|
|
88
|
+
metadata?: boolean;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* @deprecated Server-side ordering is not supported by the network. Sort the fetched
|
|
92
|
+
* entities in JavaScript instead (e.g. `entities.sort(...)`). This type will be removed
|
|
93
|
+
* in a future release.
|
|
94
|
+
*/
|
|
95
|
+
type QueryOptionsOrderBy = {
|
|
96
|
+
name: string;
|
|
97
|
+
type: "string" | "numeric";
|
|
98
|
+
desc: "asc" | "desc";
|
|
99
|
+
};
|
|
100
|
+
type QueryOptions = {
|
|
101
|
+
includeData?: QueryOptionsIncludeData;
|
|
102
|
+
atBlock?: bigint;
|
|
103
|
+
/**
|
|
104
|
+
* @deprecated Server-side ordering is not supported by the network, so this option has no
|
|
105
|
+
* effect on the returned order. Sort the fetched entities in JavaScript instead
|
|
106
|
+
* (e.g. `entities.sort(...)`). This option will be removed in a future release.
|
|
107
|
+
*/
|
|
108
|
+
orderBy?: QueryOptionsOrderBy[];
|
|
109
|
+
resultsPerPage?: number | undefined;
|
|
110
|
+
cursor?: string | undefined;
|
|
111
|
+
};
|
|
112
|
+
type QueryReturnType = {
|
|
113
|
+
entities: Entity[];
|
|
114
|
+
cursor: string | undefined;
|
|
115
|
+
blockNumber: bigint | undefined;
|
|
116
|
+
};
|
|
117
|
+
//#endregion
|
|
84
118
|
//#region src/actions/wallet/changeOwnership.d.ts
|
|
85
119
|
/**
|
|
86
120
|
* Parameters for the deleteEntity function.
|
|
@@ -104,14 +138,24 @@ type ChangeOwnershipReturnType = {
|
|
|
104
138
|
/**
|
|
105
139
|
* Parameters for the createEntity function.
|
|
106
140
|
* - payload: The payload of the entity.
|
|
107
|
-
* - attributes: The attributes of the entity.
|
|
141
|
+
* - attributes: The attributes of the entity. Attribute values may be strings
|
|
142
|
+
* or numbers, but numeric values **must be integers**. To store a non-integer,
|
|
143
|
+
* scale it to an integer (e.g. `1.5` -> `1500`) to preserve numeric ordering,
|
|
144
|
+
* or pass it as a string (e.g. `"1.5"`). A non-integer numeric value throws an
|
|
145
|
+
* {@link InvalidAttributeError}.
|
|
108
146
|
* - contentType: The content type of the entity.
|
|
109
|
-
* - expiresIn:
|
|
147
|
+
* - expiresIn: How long until the entity expires, in seconds. Because Arkiv
|
|
148
|
+
* measures expiration in blocks (1 block = 2 seconds), this **must be a
|
|
149
|
+
* positive integer and a multiple of the block time (2 seconds)**
|
|
150
|
+
* Invalid values throw an {@link InvalidExpirationError}.
|
|
110
151
|
*/
|
|
111
152
|
type CreateEntityParameters = {
|
|
112
153
|
payload: Uint8Array;
|
|
154
|
+
/** Entity attributes. Numeric values must be integers (scale non-integers, e.g. `1.5` -> `1500`, or use a string). Throws {@link InvalidAttributeError} otherwise. */
|
|
113
155
|
attributes: Attribute[];
|
|
114
156
|
contentType: MimeType | string;
|
|
157
|
+
/** Seconds until expiry. Must be a positive integer and a multiple of the 2s block time.
|
|
158
|
+
* Throws {@link InvalidExpirationError} otherwise. */
|
|
115
159
|
expiresIn: number;
|
|
116
160
|
};
|
|
117
161
|
/**
|
|
@@ -146,10 +190,15 @@ type DeleteEntityReturnType = {
|
|
|
146
190
|
/**
|
|
147
191
|
* Parameters for the extendEntity function.
|
|
148
192
|
* - entityKey: The key of the entity to extend.
|
|
149
|
-
* - expiresIn:
|
|
193
|
+
* - expiresIn: How long to extend the entity by, in seconds. Because Arkiv
|
|
194
|
+
* measures expiration in blocks (1 block = 2 seconds), this **must be a
|
|
195
|
+
* positive integer and a multiple of the block time (2 seconds)**.
|
|
196
|
+
* Invalid values throw an {@link InvalidExpirationError}.
|
|
150
197
|
*/
|
|
151
198
|
type ExtendEntityParameters = {
|
|
152
199
|
entityKey: Hex;
|
|
200
|
+
/** Seconds to extend by. Must be a positive integer and a multiple of the 2s block time.
|
|
201
|
+
* Throws {@link InvalidExpirationError} otherwise. */
|
|
153
202
|
expiresIn: number;
|
|
154
203
|
};
|
|
155
204
|
/**
|
|
@@ -167,15 +216,25 @@ type ExtendEntityReturnType = {
|
|
|
167
216
|
* Parameters for the updateEntity function.
|
|
168
217
|
* - entityKey: The key of the entity to update.
|
|
169
218
|
* - payload: The payload of the entity.
|
|
170
|
-
* - attributes: The attributes of the entity.
|
|
219
|
+
* - attributes: The attributes of the entity. Attribute values may be strings
|
|
220
|
+
* or numbers, but numeric values **must be integers**. To store a non-integer,
|
|
221
|
+
* scale it to an integer (e.g. `1.5` -> `1500`) to preserve numeric ordering,
|
|
222
|
+
* or pass it as a string (e.g. `"1.5"`). A non-integer numeric value throws an
|
|
223
|
+
* {@link InvalidAttributeError}.
|
|
171
224
|
* - contentType: The content type of the entity.
|
|
172
|
-
* - expiresIn:
|
|
225
|
+
* - expiresIn: How long until the entity expires, in seconds. Because Arkiv
|
|
226
|
+
* measures expiration in blocks (1 block = 2 seconds), this **must be a
|
|
227
|
+
* positive integer and a multiple of the block time (2 seconds)**.
|
|
228
|
+
* Invalid values throw an {@link InvalidExpirationError}.
|
|
173
229
|
*/
|
|
174
230
|
type UpdateEntityParameters = {
|
|
175
231
|
entityKey: Hex;
|
|
176
232
|
payload: Uint8Array;
|
|
233
|
+
/** Entity attributes. Numeric values must be integers (scale non-integers, e.g. `1.5` -> `1500`, or use a string). Throws {@link InvalidAttributeError} otherwise. */
|
|
177
234
|
attributes: Attribute[];
|
|
178
235
|
contentType: MimeType | string;
|
|
236
|
+
/** Seconds until expiry. Must be a positive integer and a multiple of the 2s block time.
|
|
237
|
+
* Throws {@link InvalidExpirationError} otherwise. */
|
|
179
238
|
expiresIn: number;
|
|
180
239
|
};
|
|
181
240
|
/**
|
|
@@ -222,8 +281,20 @@ type MutateEntitiesReturnType = {
|
|
|
222
281
|
};
|
|
223
282
|
//#endregion
|
|
224
283
|
//#region src/types/attributes.d.ts
|
|
284
|
+
/**
|
|
285
|
+
* An entity attribute (key/value pair).
|
|
286
|
+
*
|
|
287
|
+
* Arkiv supports both string and number values. Numeric values **must be
|
|
288
|
+
* integers** — passing a non-integer number (e.g. `1.5`) throws an
|
|
289
|
+
* {@link InvalidAttributeError} at mutation time. To store a non-integer value:
|
|
290
|
+
* - Scale it to an integer (e.g. `1.5` -> `1500`, dividing by the same factor on
|
|
291
|
+
* read) to keep numeric ordering and range queries working.
|
|
292
|
+
* - Or pass it as a string (e.g. `"1.5"`), which sorts lexicographically and so
|
|
293
|
+
* does not support numeric comparisons.
|
|
294
|
+
*/
|
|
225
295
|
type Attribute = {
|
|
226
296
|
key: string;
|
|
297
|
+
/** Attribute value. A `number` must be an integer (scale non-integers, e.g. `1.5` -> `1500`, or use a string). Throws {@link InvalidAttributeError} otherwise. */
|
|
227
298
|
value: string | number;
|
|
228
299
|
};
|
|
229
300
|
//#endregion
|
|
@@ -307,29 +378,5 @@ declare class Entity {
|
|
|
307
378
|
toJson(): any;
|
|
308
379
|
}
|
|
309
380
|
//#endregion
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
attributes?: boolean;
|
|
313
|
-
payload?: boolean;
|
|
314
|
-
metadata?: boolean;
|
|
315
|
-
};
|
|
316
|
-
type QueryOptionsOrderBy = {
|
|
317
|
-
name: string;
|
|
318
|
-
type: "string" | "numeric";
|
|
319
|
-
desc: "asc" | "desc";
|
|
320
|
-
};
|
|
321
|
-
type QueryOptions = {
|
|
322
|
-
includeData?: QueryOptionsIncludeData;
|
|
323
|
-
atBlock?: bigint;
|
|
324
|
-
orderBy?: QueryOptionsOrderBy[];
|
|
325
|
-
resultsPerPage?: number | undefined;
|
|
326
|
-
cursor?: string | undefined;
|
|
327
|
-
};
|
|
328
|
-
type QueryReturnType = {
|
|
329
|
-
entities: Entity[];
|
|
330
|
-
cursor: string | undefined;
|
|
331
|
-
blockNumber: bigint | undefined;
|
|
332
|
-
};
|
|
333
|
-
//#endregion
|
|
334
|
-
export { RpcIncludeData as A, CreateEntityReturnType as C, ArkivClient as D, GetBlockTimingReturnType as E, RpcQueryOptions as M, MimeType as N, ArkivRpcSchema as O, CreateEntityParameters as S, ChangeOwnershipReturnType as T, UpdateEntityReturnType as _, Entity as a, DeleteEntityParameters as b, OnEntityDeletedEvent as c, OnEntityOwnerChangedEvent as d, OnEntityUpdatedEvent as f, UpdateEntityParameters as g, MutateEntitiesReturnType as h, QueryReturnType as i, RpcOrderByAttribute as j, RpcEntity as k, OnEntityExpiredEvent as l, MutateEntitiesParameters as m, QueryOptionsIncludeData as n, TxParams as o, Attribute as p, QueryOptionsOrderBy as r, OnEntityCreatedEvent as s, QueryOptions as t, OnEntityExpiresInExtendedEvent as u, ExtendEntityParameters as v, ChangeOwnershipParameters as w, DeleteEntityReturnType as x, ExtendEntityReturnType as y };
|
|
335
|
-
//# sourceMappingURL=query-BhdmAzYg.d.ts.map
|
|
381
|
+
export { RpcIncludeData as A, QueryOptionsIncludeData as C, ArkivClient as D, GetBlockTimingReturnType as E, RpcQueryOptions as M, MimeType as N, ArkivRpcSchema as O, QueryOptions as S, QueryReturnType as T, DeleteEntityReturnType as _, OnEntityExpiredEvent as a, ChangeOwnershipParameters as b, OnEntityUpdatedEvent as c, MutateEntitiesReturnType as d, UpdateEntityParameters as f, DeleteEntityParameters as g, ExtendEntityReturnType as h, OnEntityDeletedEvent as i, RpcOrderByAttribute as j, RpcEntity as k, Attribute as l, ExtendEntityParameters as m, TxParams as n, OnEntityExpiresInExtendedEvent as o, UpdateEntityReturnType as p, OnEntityCreatedEvent as r, OnEntityOwnerChangedEvent as s, Entity as t, MutateEntitiesParameters as u, CreateEntityParameters as v, QueryOptionsOrderBy as w, ChangeOwnershipReturnType as x, CreateEntityReturnType as y };
|
|
382
|
+
//# sourceMappingURL=entity-qoLMAuuk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-qoLMAuuk.d.ts","names":[],"sources":["../src/types/mimeTypes.ts","../src/types/rpcSchema.ts","../src/clients/baseClient.ts","../src/actions/public/getBlockTiming.ts","../src/actions/public/query.ts","../src/actions/wallet/changeOwnership.ts","../src/actions/wallet/createEntity.ts","../src/actions/wallet/deleteEntity.ts","../src/actions/wallet/extendEntity.ts","../src/actions/wallet/updateEntity.ts","../src/actions/wallet/mutateEntities.ts","../src/types/attributes.ts","../src/types/events.ts","../src/types/txParams.ts","../src/types/entity.ts"],"sourcesContent":[],"mappings":";;;KAAY,QAAA;;;KCGA,SAAA;EDHA,GAAA,ECIL,GDJK;eCKG;;aAEF;EAJD,cAAS,EAKH,GALG;EACd,mBAAA,EAKgB,GALhB;EACQ,uBAAA,EAKY,GALZ;EAEF,2BAAA,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