@arkiv-network/sdk 0.8.0-dev.2 → 0.8.0-dev.4
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 +6 -6
- package/dist/chains/index.cjs +3 -3
- package/dist/chains/index.d.cts +21 -21
- package/dist/chains/index.d.cts.map +1 -1
- package/dist/chains/index.d.ts +21 -21
- package/dist/chains/index.d.ts.map +1 -1
- package/dist/chains/index.js +2 -2
- package/dist/{chains-Du8tql7I.js → chains-DmrgfF3p.js} +25 -25
- package/dist/chains-DmrgfF3p.js.map +1 -0
- package/dist/{chains-BfNQliHU.cjs → chains-Etgm64UM.cjs} +27 -27
- package/dist/index-BGp2plHs.d.cts.map +1 -1
- package/dist/index-Cd2aaWme.d.ts.map +1 -1
- package/dist/{index-BKB875Um.d.ts → index-CmEefH8_.d.ts} +3 -3
- package/dist/{index-BKB875Um.d.ts.map → index-CmEefH8_.d.ts.map} +1 -1
- package/dist/{index-rINthNuU.d.cts → index-DsM7EXu6.d.cts} +3 -3
- package/dist/{index-rINthNuU.d.cts.map → index-DsM7EXu6.d.cts.map} +1 -1
- package/dist/index-ezMZ2-JH.d.ts.map +1 -1
- package/dist/index.cjs +26 -16
- package/dist/index.d.cts +31 -29
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +31 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -16
- package/dist/index.js.map +1 -1
- package/dist/query/index.cjs +1 -1
- package/dist/query/index.d.cts +1 -1
- package/dist/query/index.d.ts +1 -1
- package/dist/query/index.js +1 -1
- package/dist/{queryBuilder-zHGhDmaG.cjs → queryBuilder-BmRTaoJ8.cjs} +5 -3
- package/dist/{queryBuilder-wvA8sn--.js → queryBuilder-MubNEvA4.js} +6 -4
- package/dist/queryBuilder-MubNEvA4.js.map +1 -0
- package/dist/selection-Bv8_o-7i.d.cts.map +1 -1
- package/dist/selection-ox7zdtVm.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/actions/public/watchEntityEvents.ts +2 -2
- package/src/actions/wallet/createEntity.ts +1 -0
- package/src/actions/wallet/extendEntity.ts +1 -0
- package/src/chains/index.ts +1 -1
- package/src/chains/tiramisu.ts +22 -0
- package/src/clients/createPublicClient.ts +2 -2
- package/src/clients/createWalletClient.ts +2 -2
- package/src/clients/decorators/arkivPublic.ts +14 -14
- package/src/clients/decorators/arkivWallet.ts +10 -10
- package/src/errors.ts +7 -2
- package/src/query/queryBuilder.ts +2 -2
- package/src/utils/arkivTransactions.ts +8 -3
- package/src/utils/chains.test.ts +14 -14
- package/dist/chains-Du8tql7I.js.map +0 -1
- package/dist/queryBuilder-wvA8sn--.js.map +0 -1
- package/src/chains/cheesecake.ts +0 -22
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as chains_exports } from "./chains-
|
|
1
|
+
import { t as chains_exports } from "./chains-DmrgfF3p.js";
|
|
2
2
|
import { A as DECIMAL_UNIT, C as str, E as u64, F as TooManyAttributesError, I as UnknownAttributeTypeError, L as UntypedValueError, M as InvalidAttributeNameError, N as InvalidValueError, O as isArkivValue, P as MissingValueError, S as key, T as u256, _ as bytes32, a as MAX_NAME_BYTES, b as decUnits, d as I32_MIN, f as MAX_STRING_BYTES, g as bool, h as addr, i as encodeMutations, j as ConflictingMutationError, k as DECIMAL_SCALE, m as U64_MAX, n as MAX_PAYLOAD_BYTES, o as isValidAttributeName, p as U256_MAX, r as encodeAttributes, s as validateAttributeName, t as MAX_ATTRIBUTES, u as I32_MAX, v as dec, w as toValue, x as i32, y as decFromUnits } from "./attr-tmyREHtw.js";
|
|
3
|
-
import { C as EntityMutationError, D as getLogger, E as NoMoreResultsError, S as EmptyPatchError, T as NoEntityFoundError, a as eq, r as toRpcSelect, t as SelectQueryBuilder, v as runQuery, w as InvalidContentTypeError } from "./queryBuilder-
|
|
3
|
+
import { C as EntityMutationError, D as getLogger, E as NoMoreResultsError, S as EmptyPatchError, T as NoEntityFoundError, a as eq, r as toRpcSelect, t as SelectQueryBuilder, v as runQuery, w as InvalidContentTypeError } from "./queryBuilder-MubNEvA4.js";
|
|
4
4
|
import { i as NoRandomSourceError, n as InvalidExpiryError, r as InvalidSaltError, t as InvalidCreationFlagsError } from "./errors-D2E1GRjw.js";
|
|
5
5
|
import { n as encodeCreationFlags, t as decodeCreationFlags } from "./flags-DUT2gHEU.js";
|
|
6
6
|
import { t as Entity } from "./entity-BIp_df9u.js";
|
|
@@ -274,10 +274,10 @@ const DEFAULT_POLLING_INTERVAL = BLOCK_TIME * 1e3 / 2;
|
|
|
274
274
|
*
|
|
275
275
|
* @example
|
|
276
276
|
* import { createPublicClient } from "@arkiv-network/sdk"
|
|
277
|
-
* import {
|
|
277
|
+
* import { tiramisu } from "@arkiv-network/sdk/chains"
|
|
278
278
|
* import { http } from "viem"
|
|
279
279
|
*
|
|
280
|
-
* const client = createPublicClient({ chain:
|
|
280
|
+
* const client = createPublicClient({ chain: tiramisu, transport: http() })
|
|
281
281
|
*
|
|
282
282
|
* const unwatch = client.watchEntityEvents({
|
|
283
283
|
* onEntityCreated: ({ entityKey, owner, expiresAt }) =>
|
|
@@ -431,11 +431,11 @@ function publicArkivActions(client) {
|
|
|
431
431
|
*
|
|
432
432
|
* @example
|
|
433
433
|
* import { createPublicClient } from "@arkiv-network/sdk"
|
|
434
|
-
* import {
|
|
434
|
+
* import { tiramisu } from "@arkiv-network/sdk/chains"
|
|
435
435
|
* import { http } from "viem"
|
|
436
436
|
*
|
|
437
437
|
* const client = createPublicClient({
|
|
438
|
-
* chain:
|
|
438
|
+
* chain: tiramisu,
|
|
439
439
|
* transport: http(),
|
|
440
440
|
* })
|
|
441
441
|
*/
|
|
@@ -599,8 +599,9 @@ async function sendArkivTransaction(client, ops, txParams) {
|
|
|
599
599
|
];
|
|
600
600
|
if (operations.length === 0) throw new Error("No operations to perform");
|
|
601
601
|
logger$6("Sending execute with %d operations %o", operations.length, operations);
|
|
602
|
+
let txHash;
|
|
602
603
|
try {
|
|
603
|
-
|
|
604
|
+
txHash = await walletClient.writeContract({
|
|
604
605
|
address: ARKIV_ADDRESS,
|
|
605
606
|
abi: EXECUTE_ABI$1,
|
|
606
607
|
functionName: "execute",
|
|
@@ -624,9 +625,12 @@ async function sendArkivTransaction(client, ops, txParams) {
|
|
|
624
625
|
} catch (err) {
|
|
625
626
|
const error = err;
|
|
626
627
|
const reason = describeEntityRevert(err) ?? error.shortMessage ?? error.cause?.details ?? "No reason provided by backend.";
|
|
627
|
-
throw new EntityMutationError(`Transaction ${receipt.transactionHash} reverted. Reason: ${reason}
|
|
628
|
+
throw new EntityMutationError(`Transaction ${receipt.transactionHash} reverted. Reason: ${reason}`, {
|
|
629
|
+
cause: err,
|
|
630
|
+
txHash: receipt.transactionHash
|
|
631
|
+
});
|
|
628
632
|
}
|
|
629
|
-
throw new EntityMutationError(`Transaction ${receipt.transactionHash} reverted. No reason provided by backend
|
|
633
|
+
throw new EntityMutationError(`Transaction ${receipt.transactionHash} reverted. No reason provided by backend.`, { txHash: receipt.transactionHash });
|
|
630
634
|
}
|
|
631
635
|
return {
|
|
632
636
|
receipt,
|
|
@@ -637,7 +641,10 @@ async function sendArkivTransaction(client, ops, txParams) {
|
|
|
637
641
|
};
|
|
638
642
|
} catch (error) {
|
|
639
643
|
const described = error instanceof EntityMutationError ? void 0 : describeEntityRevert(error);
|
|
640
|
-
if (described !== void 0) throw new EntityMutationError(`Transaction failed: ${described}`, {
|
|
644
|
+
if (described !== void 0) throw new EntityMutationError(`Transaction failed: ${described}`, {
|
|
645
|
+
cause: error,
|
|
646
|
+
txHash
|
|
647
|
+
});
|
|
641
648
|
let message = "Transaction failed";
|
|
642
649
|
if (error instanceof TransactionExecutionError) message += `: ${error.details}`;
|
|
643
650
|
else if (error instanceof ContractFunctionExecutionError) {
|
|
@@ -646,7 +653,10 @@ async function sendArkivTransaction(client, ops, txParams) {
|
|
|
646
653
|
else message += ": Execution error without revert data";
|
|
647
654
|
} else if (error instanceof EntityMutationError) throw error;
|
|
648
655
|
else if (error instanceof Error) message += `: ${error.message}`;
|
|
649
|
-
throw new EntityMutationError(message, {
|
|
656
|
+
throw new EntityMutationError(message, {
|
|
657
|
+
cause: error,
|
|
658
|
+
txHash
|
|
659
|
+
});
|
|
650
660
|
}
|
|
651
661
|
}
|
|
652
662
|
/**
|
|
@@ -687,7 +697,7 @@ function decodeEntityLog(log) {
|
|
|
687
697
|
}
|
|
688
698
|
function assertCount(receipt, what, got, want) {
|
|
689
699
|
if (got === want) return;
|
|
690
|
-
throw new EntityMutationError(`Transaction ${receipt.transactionHash} succeeded — do not retry it — but emitted ${got} ${what} event(s) for ${want} ${what} operation(s). The batch was applied; the SDK cannot say which entity each operation produced, so read them back to find them
|
|
700
|
+
throw new EntityMutationError(`Transaction ${receipt.transactionHash} succeeded — do not retry it — but emitted ${got} ${what} event(s) for ${want} ${what} operation(s). The batch was applied; the SDK cannot say which entity each operation produced, so read them back to find them.`, { txHash: receipt.transactionHash });
|
|
691
701
|
}
|
|
692
702
|
|
|
693
703
|
//#endregion
|
|
@@ -712,7 +722,7 @@ async function createEntity(client, data, txParams) {
|
|
|
712
722
|
logger$4("Receipt from createEntity %o", receipt);
|
|
713
723
|
const [entityKey] = createdEntityKeys;
|
|
714
724
|
const [expiresAt] = createdExpiries;
|
|
715
|
-
if (entityKey === void 0 || expiresAt === void 0) throw new EntityMutationError(`Transaction ${receipt.transactionHash} succeeded, but the receipt did not carry the expected entity key or expiry
|
|
725
|
+
if (entityKey === void 0 || expiresAt === void 0) throw new EntityMutationError(`Transaction ${receipt.transactionHash} succeeded, but the receipt did not carry the expected entity key or expiry.`, { txHash: receipt.transactionHash });
|
|
716
726
|
return {
|
|
717
727
|
txHash: receipt.transactionHash,
|
|
718
728
|
entityKey,
|
|
@@ -757,7 +767,7 @@ async function extendEntity(client, data, txParams) {
|
|
|
757
767
|
const { receipt, extendedExpiries } = await sendArkivTransaction(client, { extensions: [data] }, txParams);
|
|
758
768
|
logger$1("Receipt from extendEntity %o", receipt);
|
|
759
769
|
const [expiresAt] = extendedExpiries;
|
|
760
|
-
if (expiresAt === void 0) throw new EntityMutationError(`Transaction ${receipt.transactionHash} succeeded, but the receipt did not carry the expected entity expiry
|
|
770
|
+
if (expiresAt === void 0) throw new EntityMutationError(`Transaction ${receipt.transactionHash} succeeded, but the receipt did not carry the expected entity expiry.`, { txHash: receipt.transactionHash });
|
|
761
771
|
return {
|
|
762
772
|
txHash: receipt.transactionHash,
|
|
763
773
|
entityKey: data.entityKey,
|
|
@@ -806,12 +816,12 @@ function walletArkivActions(client) {
|
|
|
806
816
|
*
|
|
807
817
|
* @example
|
|
808
818
|
* import { createWalletClient } from "@arkiv-network/sdk"
|
|
809
|
-
* import {
|
|
819
|
+
* import { tiramisu } from "@arkiv-network/sdk/chains"
|
|
810
820
|
* import { http } from "viem"
|
|
811
821
|
* import { privateKeyToAccount } from "viem/accounts"
|
|
812
822
|
*
|
|
813
823
|
* const client = createWalletClient({
|
|
814
|
-
* chain:
|
|
824
|
+
* chain: tiramisu,
|
|
815
825
|
* transport: http(),
|
|
816
826
|
* account: privateKeyToAccount("0x..."),
|
|
817
827
|
* })
|