@arkiv-network/sdk 0.0.25
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 +67 -0
- package/dist/_cjs/accounts/index.d.ts +2 -0
- package/dist/_cjs/accounts/index.d.ts.map +1 -0
- package/dist/_cjs/accounts/index.js +18 -0
- package/dist/_cjs/accounts/index.js.map +1 -0
- package/dist/_cjs/actions/public/buildQuery.d.ts +4 -0
- package/dist/_cjs/actions/public/buildQuery.d.ts.map +1 -0
- package/dist/_cjs/actions/public/buildQuery.js +8 -0
- package/dist/_cjs/actions/public/buildQuery.js.map +1 -0
- package/dist/_cjs/actions/public/getBlockTiming.d.ts +12 -0
- package/dist/_cjs/actions/public/getBlockTiming.d.ts.map +1 -0
- package/dist/_cjs/actions/public/getBlockTiming.js +16 -0
- package/dist/_cjs/actions/public/getBlockTiming.js.map +1 -0
- package/dist/_cjs/actions/public/getEntity.d.ts +4 -0
- package/dist/_cjs/actions/public/getEntity.d.ts.map +1 -0
- package/dist/_cjs/actions/public/getEntity.js +13 -0
- package/dist/_cjs/actions/public/getEntity.js.map +1 -0
- package/dist/_cjs/actions/public/query.d.ts +3 -0
- package/dist/_cjs/actions/public/query.d.ts.map +1 -0
- package/dist/_cjs/actions/public/query.js +13 -0
- package/dist/_cjs/actions/public/query.js.map +1 -0
- package/dist/_cjs/actions/public/subscribeEntityEvents.d.ts +96 -0
- package/dist/_cjs/actions/public/subscribeEntityEvents.d.ts.map +1 -0
- package/dist/_cjs/actions/public/subscribeEntityEvents.js +79 -0
- package/dist/_cjs/actions/public/subscribeEntityEvents.js.map +1 -0
- package/dist/_cjs/actions/wallet/createEntity.d.ts +25 -0
- package/dist/_cjs/actions/wallet/createEntity.d.ts.map +1 -0
- package/dist/_cjs/actions/wallet/createEntity.js +15 -0
- package/dist/_cjs/actions/wallet/createEntity.js.map +1 -0
- package/dist/_cjs/actions/wallet/deleteEntity.d.ts +21 -0
- package/dist/_cjs/actions/wallet/deleteEntity.d.ts.map +1 -0
- package/dist/_cjs/actions/wallet/deleteEntity.js +15 -0
- package/dist/_cjs/actions/wallet/deleteEntity.js.map +1 -0
- package/dist/_cjs/actions/wallet/extendEntity.d.ts +23 -0
- package/dist/_cjs/actions/wallet/extendEntity.d.ts.map +1 -0
- package/dist/_cjs/actions/wallet/extendEntity.js +15 -0
- package/dist/_cjs/actions/wallet/extendEntity.js.map +1 -0
- package/dist/_cjs/actions/wallet/mutateEntities.d.ts +37 -0
- package/dist/_cjs/actions/wallet/mutateEntities.d.ts.map +1 -0
- package/dist/_cjs/actions/wallet/mutateEntities.js +56 -0
- package/dist/_cjs/actions/wallet/mutateEntities.js.map +1 -0
- package/dist/_cjs/actions/wallet/updateEntity.d.ts +27 -0
- package/dist/_cjs/actions/wallet/updateEntity.d.ts.map +1 -0
- package/dist/_cjs/actions/wallet/updateEntity.js +15 -0
- package/dist/_cjs/actions/wallet/updateEntity.js.map +1 -0
- package/dist/_cjs/chains/index.d.ts +4 -0
- package/dist/_cjs/chains/index.d.ts.map +1 -0
- package/dist/_cjs/chains/index.js +10 -0
- package/dist/_cjs/chains/index.js.map +1 -0
- package/dist/_cjs/chains/kaolin.d.ts +42 -0
- package/dist/_cjs/chains/kaolin.d.ts.map +1 -0
- package/dist/_cjs/chains/kaolin.js +29 -0
- package/dist/_cjs/chains/kaolin.js.map +1 -0
- package/dist/_cjs/chains/localhost.d.ts +45 -0
- package/dist/_cjs/chains/localhost.d.ts.map +1 -0
- package/dist/_cjs/chains/localhost.js +17 -0
- package/dist/_cjs/chains/localhost.js.map +1 -0
- package/dist/_cjs/chains/marketplace.d.ts +42 -0
- package/dist/_cjs/chains/marketplace.d.ts.map +1 -0
- package/dist/_cjs/chains/marketplace.js +29 -0
- package/dist/_cjs/chains/marketplace.js.map +1 -0
- package/dist/_cjs/clients/baseClient.d.ts +4 -0
- package/dist/_cjs/clients/baseClient.d.ts.map +1 -0
- package/dist/_cjs/clients/baseClient.js +3 -0
- package/dist/_cjs/clients/baseClient.js.map +1 -0
- package/dist/_cjs/clients/createPublicClient.d.ts +25 -0
- package/dist/_cjs/clients/createPublicClient.d.ts.map +1 -0
- package/dist/_cjs/clients/createPublicClient.js +34 -0
- package/dist/_cjs/clients/createPublicClient.js.map +1 -0
- package/dist/_cjs/clients/createWalletClient.d.ts +25 -0
- package/dist/_cjs/clients/createWalletClient.d.ts.map +1 -0
- package/dist/_cjs/clients/createWalletClient.js +39 -0
- package/dist/_cjs/clients/createWalletClient.js.map +1 -0
- package/dist/_cjs/clients/decorators/arkivPublic.d.ts +100 -0
- package/dist/_cjs/clients/decorators/arkivPublic.d.ts.map +1 -0
- package/dist/_cjs/clients/decorators/arkivPublic.js +25 -0
- package/dist/_cjs/clients/decorators/arkivPublic.js.map +1 -0
- package/dist/_cjs/clients/decorators/arkivWallet.d.ts +167 -0
- package/dist/_cjs/clients/decorators/arkivWallet.d.ts.map +1 -0
- package/dist/_cjs/clients/decorators/arkivWallet.js +18 -0
- package/dist/_cjs/clients/decorators/arkivWallet.js.map +1 -0
- package/dist/_cjs/consts.d.ts +3 -0
- package/dist/_cjs/consts.d.ts.map +1 -0
- package/dist/_cjs/consts.js +6 -0
- package/dist/_cjs/consts.js.map +1 -0
- package/dist/_cjs/index.d.ts +11 -0
- package/dist/_cjs/index.d.ts.map +1 -0
- package/dist/_cjs/index.js +16 -0
- package/dist/_cjs/index.js.map +1 -0
- package/dist/_cjs/query/engine.d.ts +16 -0
- package/dist/_cjs/query/engine.d.ts.map +1 -0
- package/dist/_cjs/query/engine.js +64 -0
- package/dist/_cjs/query/engine.js.map +1 -0
- package/dist/_cjs/query/errors.d.ts +10 -0
- package/dist/_cjs/query/errors.d.ts.map +1 -0
- package/dist/_cjs/query/errors.js +22 -0
- package/dist/_cjs/query/errors.js.map +1 -0
- package/dist/_cjs/query/index.d.ts +5 -0
- package/dist/_cjs/query/index.d.ts.map +1 -0
- package/dist/_cjs/query/index.js +21 -0
- package/dist/_cjs/query/index.js.map +1 -0
- package/dist/_cjs/query/predicate.d.ts +111 -0
- package/dist/_cjs/query/predicate.d.ts.map +1 -0
- package/dist/_cjs/query/predicate.js +130 -0
- package/dist/_cjs/query/predicate.js.map +1 -0
- package/dist/_cjs/query/queryBuilder.d.ts +110 -0
- package/dist/_cjs/query/queryBuilder.d.ts.map +1 -0
- package/dist/_cjs/query/queryBuilder.js +162 -0
- package/dist/_cjs/query/queryBuilder.js.map +1 -0
- package/dist/_cjs/query/queryResult.d.ts +12 -0
- package/dist/_cjs/query/queryResult.d.ts.map +1 -0
- package/dist/_cjs/query/queryResult.js +40 -0
- package/dist/_cjs/query/queryResult.js.map +1 -0
- package/dist/_cjs/types/annotation.d.ts +5 -0
- package/dist/_cjs/types/annotation.d.ts.map +1 -0
- package/dist/_cjs/types/annotation.js +3 -0
- package/dist/_cjs/types/annotation.js.map +1 -0
- package/dist/_cjs/types/entity.d.ts +13 -0
- package/dist/_cjs/types/entity.d.ts.map +1 -0
- package/dist/_cjs/types/entity.js +32 -0
- package/dist/_cjs/types/entity.js.map +1 -0
- package/dist/_cjs/types/events.d.ts +30 -0
- package/dist/_cjs/types/events.d.ts.map +1 -0
- package/dist/_cjs/types/events.js +3 -0
- package/dist/_cjs/types/events.js.map +1 -0
- package/dist/_cjs/types/index.d.ts +4 -0
- package/dist/_cjs/types/index.d.ts.map +1 -0
- package/dist/_cjs/types/index.js +3 -0
- package/dist/_cjs/types/index.js.map +1 -0
- package/dist/_cjs/types/rpcSchema.d.ts +43 -0
- package/dist/_cjs/types/rpcSchema.d.ts.map +1 -0
- package/dist/_cjs/types/rpcSchema.js +3 -0
- package/dist/_cjs/types/rpcSchema.js.map +1 -0
- package/dist/_cjs/types/txParams.d.ts +14 -0
- package/dist/_cjs/types/txParams.d.ts.map +1 -0
- package/dist/_cjs/types/txParams.js +3 -0
- package/dist/_cjs/types/txParams.js.map +1 -0
- package/dist/_cjs/utils/arkivTransactions.d.ts +15 -0
- package/dist/_cjs/utils/arkivTransactions.d.ts.map +1 -0
- package/dist/_cjs/utils/arkivTransactions.js +67 -0
- package/dist/_cjs/utils/arkivTransactions.js.map +1 -0
- package/dist/_cjs/utils/entities.d.ts +5 -0
- package/dist/_cjs/utils/entities.d.ts.map +1 -0
- package/dist/_cjs/utils/entities.js +22 -0
- package/dist/_cjs/utils/entities.js.map +1 -0
- package/dist/_cjs/utils/expirationTime.d.ts +12 -0
- package/dist/_cjs/utils/expirationTime.d.ts.map +1 -0
- package/dist/_cjs/utils/expirationTime.js +16 -0
- package/dist/_cjs/utils/expirationTime.js.map +1 -0
- package/dist/_cjs/utils/index.d.ts +4 -0
- package/dist/_cjs/utils/index.d.ts.map +1 -0
- package/dist/_cjs/utils/index.js +20 -0
- package/dist/_cjs/utils/index.js.map +1 -0
- package/dist/_cjs/utils/payload.d.ts +3 -0
- package/dist/_cjs/utils/payload.d.ts.map +1 -0
- package/dist/_cjs/utils/payload.js +12 -0
- package/dist/_cjs/utils/payload.js.map +1 -0
- package/dist/_esm/accounts/index.d.ts +2 -0
- package/dist/_esm/accounts/index.d.ts.map +1 -0
- package/dist/_esm/accounts/index.js +2 -0
- package/dist/_esm/accounts/index.js.map +1 -0
- package/dist/_esm/actions/public/buildQuery.d.ts +4 -0
- package/dist/_esm/actions/public/buildQuery.d.ts.map +1 -0
- package/dist/_esm/actions/public/buildQuery.js +5 -0
- package/dist/_esm/actions/public/buildQuery.js.map +1 -0
- package/dist/_esm/actions/public/getBlockTiming.d.ts +12 -0
- package/dist/_esm/actions/public/getBlockTiming.d.ts.map +1 -0
- package/dist/_esm/actions/public/getBlockTiming.js +13 -0
- package/dist/_esm/actions/public/getBlockTiming.js.map +1 -0
- package/dist/_esm/actions/public/getEntity.d.ts +4 -0
- package/dist/_esm/actions/public/getEntity.d.ts.map +1 -0
- package/dist/_esm/actions/public/getEntity.js +10 -0
- package/dist/_esm/actions/public/getEntity.js.map +1 -0
- package/dist/_esm/actions/public/query.d.ts +3 -0
- package/dist/_esm/actions/public/query.d.ts.map +1 -0
- package/dist/_esm/actions/public/query.js +10 -0
- package/dist/_esm/actions/public/query.js.map +1 -0
- package/dist/_esm/actions/public/subscribeEntityEvents.d.ts +96 -0
- package/dist/_esm/actions/public/subscribeEntityEvents.d.ts.map +1 -0
- package/dist/_esm/actions/public/subscribeEntityEvents.js +75 -0
- package/dist/_esm/actions/public/subscribeEntityEvents.js.map +1 -0
- package/dist/_esm/actions/wallet/createEntity.d.ts +25 -0
- package/dist/_esm/actions/wallet/createEntity.d.ts.map +1 -0
- package/dist/_esm/actions/wallet/createEntity.js +12 -0
- package/dist/_esm/actions/wallet/createEntity.js.map +1 -0
- package/dist/_esm/actions/wallet/deleteEntity.d.ts +21 -0
- package/dist/_esm/actions/wallet/deleteEntity.d.ts.map +1 -0
- package/dist/_esm/actions/wallet/deleteEntity.js +12 -0
- package/dist/_esm/actions/wallet/deleteEntity.js.map +1 -0
- package/dist/_esm/actions/wallet/extendEntity.d.ts +23 -0
- package/dist/_esm/actions/wallet/extendEntity.d.ts.map +1 -0
- package/dist/_esm/actions/wallet/extendEntity.js +12 -0
- package/dist/_esm/actions/wallet/extendEntity.js.map +1 -0
- package/dist/_esm/actions/wallet/mutateEntities.d.ts +37 -0
- package/dist/_esm/actions/wallet/mutateEntities.d.ts.map +1 -0
- package/dist/_esm/actions/wallet/mutateEntities.js +53 -0
- package/dist/_esm/actions/wallet/mutateEntities.js.map +1 -0
- package/dist/_esm/actions/wallet/updateEntity.d.ts +27 -0
- package/dist/_esm/actions/wallet/updateEntity.d.ts.map +1 -0
- package/dist/_esm/actions/wallet/updateEntity.js +12 -0
- package/dist/_esm/actions/wallet/updateEntity.js.map +1 -0
- package/dist/_esm/chains/index.d.ts +4 -0
- package/dist/_esm/chains/index.d.ts.map +1 -0
- package/dist/_esm/chains/index.js +4 -0
- package/dist/_esm/chains/index.js.map +1 -0
- package/dist/_esm/chains/kaolin.d.ts +42 -0
- package/dist/_esm/chains/kaolin.d.ts.map +1 -0
- package/dist/_esm/chains/kaolin.js +26 -0
- package/dist/_esm/chains/kaolin.js.map +1 -0
- package/dist/_esm/chains/localhost.d.ts +45 -0
- package/dist/_esm/chains/localhost.d.ts.map +1 -0
- package/dist/_esm/chains/localhost.js +14 -0
- package/dist/_esm/chains/localhost.js.map +1 -0
- package/dist/_esm/chains/marketplace.d.ts +42 -0
- package/dist/_esm/chains/marketplace.d.ts.map +1 -0
- package/dist/_esm/chains/marketplace.js +26 -0
- package/dist/_esm/chains/marketplace.js.map +1 -0
- package/dist/_esm/clients/baseClient.d.ts +4 -0
- package/dist/_esm/clients/baseClient.d.ts.map +1 -0
- package/dist/_esm/clients/baseClient.js +2 -0
- package/dist/_esm/clients/baseClient.js.map +1 -0
- package/dist/_esm/clients/createPublicClient.d.ts +25 -0
- package/dist/_esm/clients/createPublicClient.d.ts.map +1 -0
- package/dist/_esm/clients/createPublicClient.js +31 -0
- package/dist/_esm/clients/createPublicClient.js.map +1 -0
- package/dist/_esm/clients/createWalletClient.d.ts +25 -0
- package/dist/_esm/clients/createWalletClient.d.ts.map +1 -0
- package/dist/_esm/clients/createWalletClient.js +36 -0
- package/dist/_esm/clients/createWalletClient.js.map +1 -0
- package/dist/_esm/clients/decorators/arkivPublic.d.ts +100 -0
- package/dist/_esm/clients/decorators/arkivPublic.d.ts.map +1 -0
- package/dist/_esm/clients/decorators/arkivPublic.js +22 -0
- package/dist/_esm/clients/decorators/arkivPublic.js.map +1 -0
- package/dist/_esm/clients/decorators/arkivWallet.d.ts +167 -0
- package/dist/_esm/clients/decorators/arkivWallet.d.ts.map +1 -0
- package/dist/_esm/clients/decorators/arkivWallet.js +15 -0
- package/dist/_esm/clients/decorators/arkivWallet.js.map +1 -0
- package/dist/_esm/consts.d.ts +3 -0
- package/dist/_esm/consts.d.ts.map +1 -0
- package/dist/_esm/consts.js +3 -0
- package/dist/_esm/consts.js.map +1 -0
- package/dist/_esm/index.d.ts +11 -0
- package/dist/_esm/index.d.ts.map +1 -0
- package/dist/_esm/index.js +6 -0
- package/dist/_esm/index.js.map +1 -0
- package/dist/_esm/query/engine.d.ts +16 -0
- package/dist/_esm/query/engine.d.ts.map +1 -0
- package/dist/_esm/query/engine.js +61 -0
- package/dist/_esm/query/engine.js.map +1 -0
- package/dist/_esm/query/errors.d.ts +10 -0
- package/dist/_esm/query/errors.d.ts.map +1 -0
- package/dist/_esm/query/errors.js +16 -0
- package/dist/_esm/query/errors.js.map +1 -0
- package/dist/_esm/query/index.d.ts +5 -0
- package/dist/_esm/query/index.d.ts.map +1 -0
- package/dist/_esm/query/index.js +5 -0
- package/dist/_esm/query/index.js.map +1 -0
- package/dist/_esm/query/predicate.d.ts +111 -0
- package/dist/_esm/query/predicate.d.ts.map +1 -0
- package/dist/_esm/query/predicate.js +119 -0
- package/dist/_esm/query/predicate.js.map +1 -0
- package/dist/_esm/query/queryBuilder.d.ts +110 -0
- package/dist/_esm/query/queryBuilder.d.ts.map +1 -0
- package/dist/_esm/query/queryBuilder.js +158 -0
- package/dist/_esm/query/queryBuilder.js.map +1 -0
- package/dist/_esm/query/queryResult.d.ts +12 -0
- package/dist/_esm/query/queryResult.d.ts.map +1 -0
- package/dist/_esm/query/queryResult.js +36 -0
- package/dist/_esm/query/queryResult.js.map +1 -0
- package/dist/_esm/types/annotation.d.ts +5 -0
- package/dist/_esm/types/annotation.d.ts.map +1 -0
- package/dist/_esm/types/annotation.js +2 -0
- package/dist/_esm/types/annotation.js.map +1 -0
- package/dist/_esm/types/entity.d.ts +13 -0
- package/dist/_esm/types/entity.d.ts.map +1 -0
- package/dist/_esm/types/entity.js +28 -0
- package/dist/_esm/types/entity.js.map +1 -0
- package/dist/_esm/types/events.d.ts +30 -0
- package/dist/_esm/types/events.d.ts.map +1 -0
- package/dist/_esm/types/events.js +2 -0
- package/dist/_esm/types/events.js.map +1 -0
- package/dist/_esm/types/index.d.ts +4 -0
- package/dist/_esm/types/index.d.ts.map +1 -0
- package/dist/_esm/types/index.js +2 -0
- package/dist/_esm/types/index.js.map +1 -0
- package/dist/_esm/types/rpcSchema.d.ts +43 -0
- package/dist/_esm/types/rpcSchema.d.ts.map +1 -0
- package/dist/_esm/types/rpcSchema.js +2 -0
- package/dist/_esm/types/rpcSchema.js.map +1 -0
- package/dist/_esm/types/txParams.d.ts +14 -0
- package/dist/_esm/types/txParams.d.ts.map +1 -0
- package/dist/_esm/types/txParams.js +2 -0
- package/dist/_esm/types/txParams.js.map +1 -0
- package/dist/_esm/utils/arkivTransactions.d.ts +15 -0
- package/dist/_esm/utils/arkivTransactions.d.ts.map +1 -0
- package/dist/_esm/utils/arkivTransactions.js +63 -0
- package/dist/_esm/utils/arkivTransactions.js.map +1 -0
- package/dist/_esm/utils/entities.d.ts +5 -0
- package/dist/_esm/utils/entities.d.ts.map +1 -0
- package/dist/_esm/utils/entities.js +19 -0
- package/dist/_esm/utils/entities.js.map +1 -0
- package/dist/_esm/utils/expirationTime.d.ts +12 -0
- package/dist/_esm/utils/expirationTime.d.ts.map +1 -0
- package/dist/_esm/utils/expirationTime.js +13 -0
- package/dist/_esm/utils/expirationTime.js.map +1 -0
- package/dist/_esm/utils/index.d.ts +4 -0
- package/dist/_esm/utils/index.d.ts.map +1 -0
- package/dist/_esm/utils/index.js +4 -0
- package/dist/_esm/utils/index.js.map +1 -0
- package/dist/_esm/utils/payload.d.ts +3 -0
- package/dist/_esm/utils/payload.d.ts.map +1 -0
- package/dist/_esm/utils/payload.js +8 -0
- package/dist/_esm/utils/payload.js.map +1 -0
- package/dist/_types/accounts/index.d.ts +2 -0
- package/dist/_types/accounts/index.d.ts.map +1 -0
- package/dist/_types/actions/public/buildQuery.d.ts +4 -0
- package/dist/_types/actions/public/buildQuery.d.ts.map +1 -0
- package/dist/_types/actions/public/getBlockTiming.d.ts +12 -0
- package/dist/_types/actions/public/getBlockTiming.d.ts.map +1 -0
- package/dist/_types/actions/public/getEntity.d.ts +4 -0
- package/dist/_types/actions/public/getEntity.d.ts.map +1 -0
- package/dist/_types/actions/public/query.d.ts +3 -0
- package/dist/_types/actions/public/query.d.ts.map +1 -0
- package/dist/_types/actions/public/subscribeEntityEvents.d.ts +96 -0
- package/dist/_types/actions/public/subscribeEntityEvents.d.ts.map +1 -0
- package/dist/_types/actions/wallet/createEntity.d.ts +25 -0
- package/dist/_types/actions/wallet/createEntity.d.ts.map +1 -0
- package/dist/_types/actions/wallet/deleteEntity.d.ts +21 -0
- package/dist/_types/actions/wallet/deleteEntity.d.ts.map +1 -0
- package/dist/_types/actions/wallet/extendEntity.d.ts +23 -0
- package/dist/_types/actions/wallet/extendEntity.d.ts.map +1 -0
- package/dist/_types/actions/wallet/mutateEntities.d.ts +37 -0
- package/dist/_types/actions/wallet/mutateEntities.d.ts.map +1 -0
- package/dist/_types/actions/wallet/updateEntity.d.ts +27 -0
- package/dist/_types/actions/wallet/updateEntity.d.ts.map +1 -0
- package/dist/_types/chains/index.d.ts +4 -0
- package/dist/_types/chains/index.d.ts.map +1 -0
- package/dist/_types/chains/kaolin.d.ts +42 -0
- package/dist/_types/chains/kaolin.d.ts.map +1 -0
- package/dist/_types/chains/localhost.d.ts +45 -0
- package/dist/_types/chains/localhost.d.ts.map +1 -0
- package/dist/_types/chains/marketplace.d.ts +42 -0
- package/dist/_types/chains/marketplace.d.ts.map +1 -0
- package/dist/_types/clients/baseClient.d.ts +4 -0
- package/dist/_types/clients/baseClient.d.ts.map +1 -0
- package/dist/_types/clients/createPublicClient.d.ts +25 -0
- package/dist/_types/clients/createPublicClient.d.ts.map +1 -0
- package/dist/_types/clients/createWalletClient.d.ts +25 -0
- package/dist/_types/clients/createWalletClient.d.ts.map +1 -0
- package/dist/_types/clients/decorators/arkivPublic.d.ts +100 -0
- package/dist/_types/clients/decorators/arkivPublic.d.ts.map +1 -0
- package/dist/_types/clients/decorators/arkivWallet.d.ts +167 -0
- package/dist/_types/clients/decorators/arkivWallet.d.ts.map +1 -0
- package/dist/_types/consts.d.ts +3 -0
- package/dist/_types/consts.d.ts.map +1 -0
- package/dist/_types/index.d.ts +11 -0
- package/dist/_types/index.d.ts.map +1 -0
- package/dist/_types/query/engine.d.ts +16 -0
- package/dist/_types/query/engine.d.ts.map +1 -0
- package/dist/_types/query/errors.d.ts +10 -0
- package/dist/_types/query/errors.d.ts.map +1 -0
- package/dist/_types/query/index.d.ts +5 -0
- package/dist/_types/query/index.d.ts.map +1 -0
- package/dist/_types/query/predicate.d.ts +111 -0
- package/dist/_types/query/predicate.d.ts.map +1 -0
- package/dist/_types/query/queryBuilder.d.ts +110 -0
- package/dist/_types/query/queryBuilder.d.ts.map +1 -0
- package/dist/_types/query/queryResult.d.ts +12 -0
- package/dist/_types/query/queryResult.d.ts.map +1 -0
- package/dist/_types/types/annotation.d.ts +5 -0
- package/dist/_types/types/annotation.d.ts.map +1 -0
- package/dist/_types/types/entity.d.ts +13 -0
- package/dist/_types/types/entity.d.ts.map +1 -0
- package/dist/_types/types/events.d.ts +30 -0
- package/dist/_types/types/events.d.ts.map +1 -0
- package/dist/_types/types/index.d.ts +4 -0
- package/dist/_types/types/index.d.ts.map +1 -0
- package/dist/_types/types/rpcSchema.d.ts +43 -0
- package/dist/_types/types/rpcSchema.d.ts.map +1 -0
- package/dist/_types/types/txParams.d.ts +14 -0
- package/dist/_types/types/txParams.d.ts.map +1 -0
- package/dist/_types/utils/arkivTransactions.d.ts +15 -0
- package/dist/_types/utils/arkivTransactions.d.ts.map +1 -0
- package/dist/_types/utils/entities.d.ts +5 -0
- package/dist/_types/utils/entities.d.ts.map +1 -0
- package/dist/_types/utils/expirationTime.d.ts +12 -0
- package/dist/_types/utils/expirationTime.d.ts.map +1 -0
- package/dist/_types/utils/index.d.ts +4 -0
- package/dist/_types/utils/index.d.ts.map +1 -0
- package/dist/_types/utils/payload.d.ts +3 -0
- package/dist/_types/utils/payload.d.ts.map +1 -0
- package/package.json +115 -0
- package/src/accounts/index.ts +1 -0
- package/src/actions/public/buildQuery.ts +6 -0
- package/src/actions/public/getBlockTiming.ts +20 -0
- package/src/actions/public/getEntity.ts +13 -0
- package/src/actions/public/query.ts +15 -0
- package/src/actions/public/subscribeEntityEvents.ts +105 -0
- package/src/actions/wallet/createEntity.ts +43 -0
- package/src/actions/wallet/deleteEntity.ts +39 -0
- package/src/actions/wallet/extendEntity.ts +41 -0
- package/src/actions/wallet/mutateEntities.ts +100 -0
- package/src/actions/wallet/updateEntity.ts +45 -0
- package/src/chains/index.ts +3 -0
- package/src/chains/kaolin.ts +26 -0
- package/src/chains/localhost.ts +14 -0
- package/src/chains/marketplace.ts +26 -0
- package/src/clients/baseClient.ts +9 -0
- package/src/clients/createPublicClient.ts +65 -0
- package/src/clients/createWalletClient.ts +70 -0
- package/src/clients/decorators/arkivPublic.ts +167 -0
- package/src/clients/decorators/arkivWallet.ts +232 -0
- package/src/consts.ts +2 -0
- package/src/index.ts +21 -0
- package/src/query/engine.ts +86 -0
- package/src/query/errors.ts +17 -0
- package/src/query/index.ts +4 -0
- package/src/query/predicate.ts +140 -0
- package/src/query/queryBuilder.ts +174 -0
- package/src/query/queryResult.ts +46 -0
- package/src/types/annotation.ts +4 -0
- package/src/types/entity.ts +38 -0
- package/src/types/events.ts +34 -0
- package/src/types/index.ts +3 -0
- package/src/types/rpcSchema.ts +35 -0
- package/src/types/txParams.ts +15 -0
- package/src/utils/arkivTransactions.ts +91 -0
- package/src/utils/entities.ts +22 -0
- package/src/utils/expirationTime.ts +13 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/payload.ts +9 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import type { Account, Chain, Client, Hex, PublicActions, Transport } from "viem"
|
|
2
|
+
import { getBlockTiming } from "../../actions/public/getBlockTiming"
|
|
3
|
+
import { getEntity } from "../../actions/public/getEntity"
|
|
4
|
+
import { query } from "../../actions/public/query"
|
|
5
|
+
import { subscribeEntityEvents } from "../../actions/public/subscribeEntityEvents"
|
|
6
|
+
import { QueryBuilder } from "../../query/queryBuilder"
|
|
7
|
+
import type { Entity } from "../../types/entity"
|
|
8
|
+
import type {
|
|
9
|
+
OnEntityCreatedEvent,
|
|
10
|
+
OnEntityDeletedEvent,
|
|
11
|
+
OnEntityExpiredEvent,
|
|
12
|
+
OnEntityExpiresInExtendedEvent,
|
|
13
|
+
OnEntityUpdatedEvent,
|
|
14
|
+
} from "../../types/events"
|
|
15
|
+
|
|
16
|
+
export type PublicArkivActions<
|
|
17
|
+
transport extends Transport = Transport,
|
|
18
|
+
chain extends Chain | undefined = Chain | undefined,
|
|
19
|
+
account extends Account | undefined = Account | undefined,
|
|
20
|
+
> = Pick<
|
|
21
|
+
PublicActions<transport, chain, account>,
|
|
22
|
+
| "getBalance"
|
|
23
|
+
| "getBlock"
|
|
24
|
+
| "getBlockNumber"
|
|
25
|
+
| "getChainId"
|
|
26
|
+
| "getLogs"
|
|
27
|
+
| "getTransaction"
|
|
28
|
+
| "getTransactionCount"
|
|
29
|
+
| "getTransactionReceipt"
|
|
30
|
+
| "waitForTransactionReceipt"
|
|
31
|
+
| "watchEvent"
|
|
32
|
+
> & {
|
|
33
|
+
/**
|
|
34
|
+
* Returns the entity with the given key.
|
|
35
|
+
*
|
|
36
|
+
* - Docs: https://docs.golemdb.io/ts-sdk/actions/public/getEntity
|
|
37
|
+
* - JSON-RPC Methods: [`golembase_getStorageValue`](https://docs.golemdb.io/dev/json-rpc-api/#golembase_getstoragevalue)
|
|
38
|
+
* - JSON-RPC Methods: [`golembase_getEntityMetaData`](https://docs.golemdb.io/dev/json-rpc-api/#golembase_getEntityMetaData)
|
|
39
|
+
*
|
|
40
|
+
* @param args - {entityKey}
|
|
41
|
+
* @returns The entity with the given key. {@link Entity}
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* import { createPublicClient, http } from 'arkiv'
|
|
45
|
+
* import { kaolin } from 'arkiv/chains'
|
|
46
|
+
*
|
|
47
|
+
* const client = createPublicClient({
|
|
48
|
+
* chain: kaolin,
|
|
49
|
+
* transport: http(),
|
|
50
|
+
* })
|
|
51
|
+
* const entity = await client.getEntity("0x123")
|
|
52
|
+
* // {
|
|
53
|
+
* // key: "0x123",
|
|
54
|
+
* // value: "0x123",
|
|
55
|
+
* // }
|
|
56
|
+
*/
|
|
57
|
+
getEntity: (key: Hex) => Promise<Entity>
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Returns a QueryBuilder instance for building and executing queries.
|
|
61
|
+
* The QueryBuilder object follows the Builder pattern, allowing you to chain methods to build a query and then execute it.
|
|
62
|
+
*
|
|
63
|
+
* - Docs: https://docs.golemdb.io/ts-sdk/actions/public/query
|
|
64
|
+
*
|
|
65
|
+
* @returns A QueryBuilder instance for building and executing queries. {@link QueryBuilder}
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* import { createPublicClient, http } from 'arkiv'
|
|
69
|
+
* import { kaolin } from 'arkiv/chains'
|
|
70
|
+
*
|
|
71
|
+
* const client = createPublicClient({
|
|
72
|
+
* chain: kaolin,
|
|
73
|
+
* transport: http(),
|
|
74
|
+
* })
|
|
75
|
+
* const query = client.buildQuery()
|
|
76
|
+
* const entities = await query.where("key", "=", "value").ownedBy("0x123").fetch()
|
|
77
|
+
*
|
|
78
|
+
*/
|
|
79
|
+
buildQuery: () => QueryBuilder
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Returns a QueryResult instance for fetching the results of a raw query.
|
|
83
|
+
* @returns A QueryResult instance for fetching the results of a raw query. {@link QueryResult}
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* import { createPublicClient, http } from 'arkiv'
|
|
87
|
+
* import { kaolin } from 'arkiv/chains'
|
|
88
|
+
*
|
|
89
|
+
* const client = createPublicClient({
|
|
90
|
+
* chain: kaolin,
|
|
91
|
+
* transport: http(),
|
|
92
|
+
* })
|
|
93
|
+
* const queryResult = client.query('key = value && $owner = 0x123')
|
|
94
|
+
*
|
|
95
|
+
*/
|
|
96
|
+
query: (query: string) => Promise<Entity[]>
|
|
97
|
+
|
|
98
|
+
getBlockTiming: () => Promise<{
|
|
99
|
+
currentBlock: bigint
|
|
100
|
+
currentBlockTime: number
|
|
101
|
+
blockDuration: number
|
|
102
|
+
}>
|
|
103
|
+
|
|
104
|
+
subscribeEntityEvents: (
|
|
105
|
+
{
|
|
106
|
+
onError,
|
|
107
|
+
onEntityCreated,
|
|
108
|
+
onEntityUpdated,
|
|
109
|
+
onEntityDeleted,
|
|
110
|
+
onEntityExpiresInExtended,
|
|
111
|
+
}: {
|
|
112
|
+
onError?: (error: Error) => void
|
|
113
|
+
onEntityCreated?: (event: OnEntityCreatedEvent) => void
|
|
114
|
+
onEntityUpdated?: (event: OnEntityUpdatedEvent) => void
|
|
115
|
+
onEntityDeleted?: (event: OnEntityDeletedEvent) => void
|
|
116
|
+
onEntityExpired?: (event: OnEntityExpiredEvent) => void
|
|
117
|
+
onEntityExpiresInExtended?: (event: OnEntityExpiresInExtendedEvent) => void
|
|
118
|
+
},
|
|
119
|
+
pollingInterval?: number,
|
|
120
|
+
fromBlock?: bigint,
|
|
121
|
+
) => Promise<() => void>
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function publicArkivActions<
|
|
125
|
+
transport extends Transport = Transport,
|
|
126
|
+
chain extends Chain | undefined = Chain | undefined,
|
|
127
|
+
account extends Account | undefined = Account | undefined,
|
|
128
|
+
>(client: Client<transport, chain, account>) {
|
|
129
|
+
return {
|
|
130
|
+
getEntity: (key: Hex) => getEntity(client, key),
|
|
131
|
+
query: (rawQuery: string) => query(client, rawQuery),
|
|
132
|
+
buildQuery: () => new QueryBuilder(client),
|
|
133
|
+
getBlockTiming: () => getBlockTiming(client),
|
|
134
|
+
subscribeEntityEvents: (
|
|
135
|
+
{
|
|
136
|
+
onError,
|
|
137
|
+
onEntityCreated,
|
|
138
|
+
onEntityUpdated,
|
|
139
|
+
onEntityDeleted,
|
|
140
|
+
onEntityExpired,
|
|
141
|
+
onEntityExpiresInExtended,
|
|
142
|
+
}: {
|
|
143
|
+
onError?: (error: Error) => void
|
|
144
|
+
onEntityCreated?: (event: OnEntityCreatedEvent) => void
|
|
145
|
+
onEntityUpdated?: (event: OnEntityUpdatedEvent) => void
|
|
146
|
+
onEntityDeleted?: (event: OnEntityDeletedEvent) => void
|
|
147
|
+
onEntityExpired?: (event: OnEntityExpiredEvent) => void
|
|
148
|
+
onEntityExpiresInExtended?: (event: OnEntityExpiresInExtendedEvent) => void
|
|
149
|
+
},
|
|
150
|
+
pollingInterval?: number,
|
|
151
|
+
fromBlock?: bigint,
|
|
152
|
+
) =>
|
|
153
|
+
subscribeEntityEvents(
|
|
154
|
+
client,
|
|
155
|
+
{
|
|
156
|
+
onError,
|
|
157
|
+
onEntityCreated,
|
|
158
|
+
onEntityUpdated,
|
|
159
|
+
onEntityDeleted,
|
|
160
|
+
onEntityExpired,
|
|
161
|
+
onEntityExpiresInExtended,
|
|
162
|
+
},
|
|
163
|
+
pollingInterval,
|
|
164
|
+
fromBlock,
|
|
165
|
+
),
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import type { Account, Chain, Client, Transport, WalletActions } from "viem"
|
|
2
|
+
import {
|
|
3
|
+
type CreateEntityParameters,
|
|
4
|
+
type CreateEntityReturnType,
|
|
5
|
+
createEntity,
|
|
6
|
+
} from "../../actions/wallet/createEntity"
|
|
7
|
+
import type {
|
|
8
|
+
DeleteEntityParameters,
|
|
9
|
+
DeleteEntityReturnType,
|
|
10
|
+
} from "../../actions/wallet/deleteEntity"
|
|
11
|
+
import { deleteEntity } from "../../actions/wallet/deleteEntity"
|
|
12
|
+
import type {
|
|
13
|
+
ExtendEntityParameters,
|
|
14
|
+
ExtendEntityReturnType,
|
|
15
|
+
} from "../../actions/wallet/extendEntity"
|
|
16
|
+
import { extendEntity } from "../../actions/wallet/extendEntity"
|
|
17
|
+
import type {
|
|
18
|
+
MutateEntitiesParameters,
|
|
19
|
+
MutateEntitiesReturnType,
|
|
20
|
+
} from "../../actions/wallet/mutateEntities"
|
|
21
|
+
import { mutateEntities } from "../../actions/wallet/mutateEntities"
|
|
22
|
+
import type {
|
|
23
|
+
UpdateEntityParameters,
|
|
24
|
+
UpdateEntityReturnType,
|
|
25
|
+
} from "../../actions/wallet/updateEntity"
|
|
26
|
+
import { updateEntity } from "../../actions/wallet/updateEntity"
|
|
27
|
+
|
|
28
|
+
import type { Entity, TxParams } from "../../types"
|
|
29
|
+
import type { PublicArkivActions } from "./arkivPublic"
|
|
30
|
+
|
|
31
|
+
export type WalletArkivActions<
|
|
32
|
+
transport extends Transport = Transport,
|
|
33
|
+
chain extends Chain | undefined = Chain | undefined,
|
|
34
|
+
account extends Account | undefined = Account | undefined,
|
|
35
|
+
> = PublicArkivActions<transport, chain, account> &
|
|
36
|
+
Pick<
|
|
37
|
+
WalletActions<chain, account>,
|
|
38
|
+
| "sendTransaction"
|
|
39
|
+
| "sendTransactionSync"
|
|
40
|
+
| "sendRawTransaction"
|
|
41
|
+
| "sendRawTransactionSync"
|
|
42
|
+
| "signMessage"
|
|
43
|
+
| "signTransaction"
|
|
44
|
+
> & {
|
|
45
|
+
/**
|
|
46
|
+
* Returns the entity with the given key.
|
|
47
|
+
*
|
|
48
|
+
* - Docs: https://docs.golemdb.io/ts-sdk/actions/public/getEntity
|
|
49
|
+
* - JSON-RPC Methods: [`golembase_getStorageValue`](https://docs.golemdb.io/dev/json-rpc-api/#golembase_getstoragevalue)
|
|
50
|
+
* - JSON-RPC Methods: [`golembase_getEntityMetaData`](https://docs.golemdb.io/dev/json-rpc-api/#golembase_getEntityMetaData)
|
|
51
|
+
*
|
|
52
|
+
* @param args - {entityKey}
|
|
53
|
+
* @returns The entity with the given key. {@link Entity}
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* import { createPublicClient, http } from 'arkiv'
|
|
57
|
+
* import { kaolin } from 'arkiv/chains'
|
|
58
|
+
*
|
|
59
|
+
* const client = createPublicClient({
|
|
60
|
+
* chain: kaolin,
|
|
61
|
+
* transport: http(),
|
|
62
|
+
* })
|
|
63
|
+
* const { entityKey, txHash } = await client.createEntity({
|
|
64
|
+
* payload: toBytes(JSON.stringify({ entity: { entityType: "testType", entityId: "testId" } })),
|
|
65
|
+
* annotations: [{ key: "testKey", value: "testValue" }],
|
|
66
|
+
* expiresIn: 1000,
|
|
67
|
+
* })
|
|
68
|
+
* console.log("entityKey", entityKey)
|
|
69
|
+
* console.log("txHash", txHash)
|
|
70
|
+
* // {
|
|
71
|
+
* // entityKey: "0x123",
|
|
72
|
+
* // txHash: "0x123",
|
|
73
|
+
* // }
|
|
74
|
+
*/
|
|
75
|
+
createEntity: (
|
|
76
|
+
data: CreateEntityParameters,
|
|
77
|
+
txParams?: TxParams,
|
|
78
|
+
) => Promise<CreateEntityReturnType>
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Updates the entity with the given key.
|
|
82
|
+
*
|
|
83
|
+
* - Docs: https://docs.golemdb.io/ts-sdk/actions/wallet/updateEntity
|
|
84
|
+
* - JSON-RPC Methods: [`golembase_updateEntity`](https://docs.golemdb.io/dev/json-rpc-api/#golembase_updateEntity)
|
|
85
|
+
*
|
|
86
|
+
* @param args - {entityKey, data}
|
|
87
|
+
* @returns The entity with the given key. {@link Entity}
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* import { createWalletClient, http } from 'arkiv'
|
|
91
|
+
* import { kaolin } from 'arkiv/chains'
|
|
92
|
+
*
|
|
93
|
+
* const client = createWalletClient({
|
|
94
|
+
* chain: kaolin,
|
|
95
|
+
* transport: http(),
|
|
96
|
+
* })
|
|
97
|
+
*/
|
|
98
|
+
updateEntity: (
|
|
99
|
+
data: UpdateEntityParameters,
|
|
100
|
+
txParams?: TxParams,
|
|
101
|
+
) => Promise<UpdateEntityReturnType>
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Deletes the entity with the given key.
|
|
105
|
+
*
|
|
106
|
+
* - Docs: https://docs.golemdb.io/ts-sdk/actions/wallet/deleteEntity
|
|
107
|
+
* - JSON-RPC Methods: [`golembase_deleteEntity`](https://docs.golemdb.io/dev/json-rpc-api/#golembase_deleteEntity)
|
|
108
|
+
*
|
|
109
|
+
* @param args - {entityKey}
|
|
110
|
+
* @returns The entity with the given key. {@link Entity}
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* import { createWalletClient, http } from 'arkiv'
|
|
114
|
+
* import { kaolin } from 'arkiv/chains'
|
|
115
|
+
*
|
|
116
|
+
* const client = createWalletClient({
|
|
117
|
+
* chain: kaolin,
|
|
118
|
+
* transport: http(),
|
|
119
|
+
* })
|
|
120
|
+
* const { entityKey, txHash } = await client.deleteEntity({ entityKey: "0x123" })
|
|
121
|
+
* console.log("entityKey", entityKey)
|
|
122
|
+
* console.log("txHash", txHash)
|
|
123
|
+
* // {
|
|
124
|
+
* // entityKey: "0x123",
|
|
125
|
+
* // txHash: "0x123",
|
|
126
|
+
* // }
|
|
127
|
+
*/
|
|
128
|
+
deleteEntity: (
|
|
129
|
+
data: DeleteEntityParameters,
|
|
130
|
+
txParams?: TxParams,
|
|
131
|
+
) => Promise<DeleteEntityReturnType>
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Extends the entity with the given key.
|
|
135
|
+
*
|
|
136
|
+
* - Docs: https://docs.golemdb.io/ts-sdk/actions/wallet/extendEntity
|
|
137
|
+
* - JSON-RPC Methods: [`golembase_extendEntity`](https://docs.golemdb.io/dev/json-rpc-api/#golembase_extendEntity)
|
|
138
|
+
*
|
|
139
|
+
* @param args - {entityKey, data}
|
|
140
|
+
* @returns The entity with the given key. {@link Entity}
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* import { createWalletClient, http } from 'arkiv'
|
|
144
|
+
* import { kaolin } from 'arkiv/chains'
|
|
145
|
+
*
|
|
146
|
+
* const client = createWalletClient({
|
|
147
|
+
* chain: kaolin,
|
|
148
|
+
* transport: http(),
|
|
149
|
+
* })
|
|
150
|
+
* const { entityKey, txHash } = await client.extendEntity("0x123", {
|
|
151
|
+
* expiresIn: 1000,
|
|
152
|
+
* })
|
|
153
|
+
* console.log("entityKey", entityKey)
|
|
154
|
+
* console.log("txHash", txHash)
|
|
155
|
+
* // {
|
|
156
|
+
* // entityKey: "0x123",
|
|
157
|
+
* // txHash: "0x123",
|
|
158
|
+
* // }
|
|
159
|
+
*/
|
|
160
|
+
extendEntity: (
|
|
161
|
+
data: ExtendEntityParameters,
|
|
162
|
+
txParams?: TxParams,
|
|
163
|
+
) => Promise<ExtendEntityReturnType>
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Mutates the entities with the given keys.
|
|
167
|
+
*
|
|
168
|
+
* - Docs: https://docs.golemdb.io/ts-sdk/actions/wallet/mutateEntities
|
|
169
|
+
* - JSON-RPC Methods: [`golembase_mutateEntities`](https://docs.golemdb.io/dev/json-rpc-api/#golembase_mutateEntities)
|
|
170
|
+
*
|
|
171
|
+
* @param args - {data}
|
|
172
|
+
* @returns The entity with the given key. {@link Entity}
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* import { createWalletClient, http } from 'arkiv'
|
|
176
|
+
* import { kaolin } from 'arkiv/chains'
|
|
177
|
+
*
|
|
178
|
+
* const client = createWalletClient({
|
|
179
|
+
* chain: kaolin,
|
|
180
|
+
* transport: http(),
|
|
181
|
+
* })
|
|
182
|
+
* const { entityKey, txHash } = await client.mutateEntities({
|
|
183
|
+
* creates: [{
|
|
184
|
+
* payload: toBytes(JSON.stringify({ entity: { entityType: "testType", entityId: "testId" } })),
|
|
185
|
+
* annotations: [{ key: "testKey", value: "testValue" }],
|
|
186
|
+
* expiresIn: 1000,
|
|
187
|
+
* }],
|
|
188
|
+
* updates: [{
|
|
189
|
+
* entityKey: "0x123",
|
|
190
|
+
* payload: toBytes(JSON.stringify({ entity: { entityType: "testType", entityId: "testId" } })),
|
|
191
|
+
* annotations: [{ key: "testKey", value: "testValue" }],
|
|
192
|
+
* expiresIn: 1000,
|
|
193
|
+
* }],
|
|
194
|
+
* deletes: [{
|
|
195
|
+
* entityKey: "0x321",
|
|
196
|
+
* }],
|
|
197
|
+
* extensions: [{
|
|
198
|
+
* entityKey: "0x1234",
|
|
199
|
+
* expiresIn: 1000,
|
|
200
|
+
* }],
|
|
201
|
+
* })
|
|
202
|
+
* console.log("entityKey", entityKey)
|
|
203
|
+
* console.log("txHash", txHash)
|
|
204
|
+
* // {
|
|
205
|
+
* // entityKey: "0x123",
|
|
206
|
+
* // txHash: "0x123",
|
|
207
|
+
* // }
|
|
208
|
+
*/
|
|
209
|
+
mutateEntities: (
|
|
210
|
+
data: MutateEntitiesParameters,
|
|
211
|
+
txParams?: TxParams,
|
|
212
|
+
) => Promise<MutateEntitiesReturnType>
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export function walletArkivActions<
|
|
216
|
+
transport extends Transport = Transport,
|
|
217
|
+
chain extends Chain | undefined = Chain | undefined,
|
|
218
|
+
account extends Account | undefined = Account | undefined,
|
|
219
|
+
>(client: Client<transport, chain, account>) {
|
|
220
|
+
return {
|
|
221
|
+
createEntity: (data: CreateEntityParameters, txParams?: TxParams) =>
|
|
222
|
+
createEntity(client, data, txParams),
|
|
223
|
+
updateEntity: (data: UpdateEntityParameters, txParams?: TxParams) =>
|
|
224
|
+
updateEntity(client, data, txParams),
|
|
225
|
+
deleteEntity: (data: DeleteEntityParameters, txParams?: TxParams) =>
|
|
226
|
+
deleteEntity(client, data, txParams),
|
|
227
|
+
extendEntity: (data: ExtendEntityParameters, txParams?: TxParams) =>
|
|
228
|
+
extendEntity(client, data, txParams),
|
|
229
|
+
mutateEntities: (data: MutateEntitiesParameters, txParams?: TxParams) =>
|
|
230
|
+
mutateEntities(client, data, txParams),
|
|
231
|
+
}
|
|
232
|
+
}
|
package/src/consts.ts
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Export all public APIs
|
|
2
|
+
|
|
3
|
+
export type {
|
|
4
|
+
Account,
|
|
5
|
+
Address,
|
|
6
|
+
Chain,
|
|
7
|
+
Hex,
|
|
8
|
+
PublicClientConfig,
|
|
9
|
+
RpcSchema,
|
|
10
|
+
Transport,
|
|
11
|
+
} from "viem"
|
|
12
|
+
// Re-export commonly used viem types for convenience
|
|
13
|
+
export { http, toBytes, toHex, toRlp, webSocket } from "viem"
|
|
14
|
+
export type { ArkivClient } from "./clients/baseClient"
|
|
15
|
+
export type { PublicArkivClient } from "./clients/createPublicClient"
|
|
16
|
+
export { createPublicClient } from "./clients/createPublicClient"
|
|
17
|
+
export type { WalletArkivClient } from "./clients/createWalletClient"
|
|
18
|
+
export { createWalletClient } from "./clients/createWalletClient"
|
|
19
|
+
export type { Annotation } from "./types/annotation"
|
|
20
|
+
export type { Entity } from "./types/entity"
|
|
21
|
+
export type { ArkivRpcSchema } from "./types/rpcSchema"
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { Hex } from "viem"
|
|
2
|
+
import type { ArkivClient } from "../clients/baseClient"
|
|
3
|
+
import type { Predicate } from "./predicate"
|
|
4
|
+
|
|
5
|
+
function processPredicates(predicates: Predicate[]): string {
|
|
6
|
+
const processValue = (value: string | number) => {
|
|
7
|
+
if (typeof value === "string") {
|
|
8
|
+
return `"${value}"`
|
|
9
|
+
}
|
|
10
|
+
return value
|
|
11
|
+
}
|
|
12
|
+
return predicates
|
|
13
|
+
.map((predicate) => {
|
|
14
|
+
switch (predicate.type) {
|
|
15
|
+
case "eq":
|
|
16
|
+
return `${predicate.key} = ${processValue(predicate.value)}`
|
|
17
|
+
case "neq":
|
|
18
|
+
return `${predicate.key} != ${processValue(predicate.value)}`
|
|
19
|
+
case "gt":
|
|
20
|
+
return `${predicate.key} > ${processValue(predicate.value)}`
|
|
21
|
+
case "gte":
|
|
22
|
+
return `${predicate.key} >= ${processValue(predicate.value)}`
|
|
23
|
+
case "lt":
|
|
24
|
+
return `${predicate.key} < ${processValue(predicate.value)}`
|
|
25
|
+
case "lte":
|
|
26
|
+
return `${predicate.key} <= ${processValue(predicate.value)}`
|
|
27
|
+
case "not":
|
|
28
|
+
return `!${predicate.key}`
|
|
29
|
+
case "or":
|
|
30
|
+
return `(${predicate.predicates.map((predicate) => processPredicates([predicate])).join(" || ")})`
|
|
31
|
+
case "and":
|
|
32
|
+
return `(${predicate.predicates.map((predicate) => processPredicates([predicate])).join(" && ")})`
|
|
33
|
+
default:
|
|
34
|
+
return ""
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
.join(" && ")
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export async function processQuery(
|
|
41
|
+
client: ArkivClient,
|
|
42
|
+
queryParams: {
|
|
43
|
+
predicates: Predicate[]
|
|
44
|
+
limit: number | undefined
|
|
45
|
+
offset: number | undefined
|
|
46
|
+
ownedBy: Hex | undefined
|
|
47
|
+
validBeforeBlock?: number | undefined
|
|
48
|
+
withAnnotations?: boolean | undefined
|
|
49
|
+
withMetadata?: boolean | undefined
|
|
50
|
+
},
|
|
51
|
+
) {
|
|
52
|
+
const { predicates, limit, offset, ownedBy, validBeforeBlock, withAnnotations, withMetadata } =
|
|
53
|
+
queryParams
|
|
54
|
+
|
|
55
|
+
console.debug(
|
|
56
|
+
`Processing query with params: predicates: ${predicates}, limit: ${limit}, offset: ${offset}, ownedBy: ${ownedBy}, validBeforeBlock: ${validBeforeBlock}, withAnnotations: ${withAnnotations}, withMetadata: ${withMetadata}`,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
let query = processPredicates(predicates)
|
|
60
|
+
if (ownedBy) {
|
|
61
|
+
query += ` && $owner=${ownedBy}`
|
|
62
|
+
}
|
|
63
|
+
if (limit) {
|
|
64
|
+
query += ` limit=${limit}`
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (offset) {
|
|
68
|
+
query += ` offset=${offset}`
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// remove leading and trailing spaces and leading &&
|
|
72
|
+
query = query.trim()
|
|
73
|
+
if (query.startsWith("&& ")) {
|
|
74
|
+
query = query.slice(3)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
console.debug(`Built query to send: ${query}`)
|
|
78
|
+
|
|
79
|
+
const result = await client.request({
|
|
80
|
+
method: "golembase_queryEntities",
|
|
81
|
+
params: [query],
|
|
82
|
+
})
|
|
83
|
+
console.debug("Raw result from query: ", result)
|
|
84
|
+
|
|
85
|
+
return result
|
|
86
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export class NoMoreResultsError extends Error {
|
|
2
|
+
constructor() {
|
|
3
|
+
super("No more results")
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export class NoOffsetOrLimitError extends Error {
|
|
8
|
+
constructor() {
|
|
9
|
+
super("Offset and limit must be defined to fetch next or previous")
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class OffsetCannotBeLessThanZeroError extends Error {
|
|
14
|
+
constructor() {
|
|
15
|
+
super("Offset cannot be less than 0")
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
export type PredicateType = "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "not"
|
|
2
|
+
export type PredicateContainerType = "or" | "and"
|
|
3
|
+
|
|
4
|
+
export type Predicate =
|
|
5
|
+
| {
|
|
6
|
+
type: PredicateType
|
|
7
|
+
key: string
|
|
8
|
+
value: string | number
|
|
9
|
+
}
|
|
10
|
+
| {
|
|
11
|
+
type: PredicateContainerType
|
|
12
|
+
predicates: Predicate[]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Creates an OR predicate
|
|
17
|
+
* @param predicates - The predicates to combine
|
|
18
|
+
* @returns The OR predicate
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* const predicates = [eq("name", "John"), eq("age", 30)]
|
|
22
|
+
* const result = or(predicates)
|
|
23
|
+
* // result = { type: "or", predicates: [eq("name", "John"), eq("age", 30)] }
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
export function or(predicates: Predicate[]): Predicate {
|
|
27
|
+
return { type: "or", predicates }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Creates an AND predicate
|
|
32
|
+
* @param predicates - The predicates to combine
|
|
33
|
+
* @returns The AND predicate
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* const predicates = [eq("name", "John"), eq("age", 30)]
|
|
37
|
+
* const result = and(predicates)
|
|
38
|
+
* // result = { type: "and", predicates: [eq("name", "John"), eq("age", 30)] }
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
export function and(predicates: Predicate[]): Predicate {
|
|
42
|
+
return { type: "and", predicates }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Creates an equality predicate
|
|
47
|
+
* @param key - The key to compare
|
|
48
|
+
* @param value - The value to compare
|
|
49
|
+
* @returns The equality predicate
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* const predicate = eq("name", "John")
|
|
53
|
+
* // result = { type: "eq", key: "name", value: "John" }
|
|
54
|
+
*/
|
|
55
|
+
export function eq(key: string, value: string | number): Predicate {
|
|
56
|
+
return { type: "eq", key, value }
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Creates a not equal predicate
|
|
61
|
+
* @param key - The key to compare
|
|
62
|
+
* @param value - The value to compare
|
|
63
|
+
* @returns The not equal predicate
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* const predicate = neq("name", "John")
|
|
67
|
+
* // result = { type: "neq", key: "name", value: "John" }
|
|
68
|
+
*/
|
|
69
|
+
export function neq(key: string, value: string | number): Predicate {
|
|
70
|
+
return { type: "neq", key, value }
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Creates a greater than predicate
|
|
75
|
+
* @param key - The key to compare
|
|
76
|
+
* @param value - The value to compare
|
|
77
|
+
* @returns The greater than predicate
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* const predicate = gt("name", "John")
|
|
81
|
+
* // result = { type: "gt", key: "name", value: "John" }
|
|
82
|
+
*/
|
|
83
|
+
export function gt(key: string, value: string | number): Predicate {
|
|
84
|
+
return { type: "gt", key, value }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Creates a greater than or equal predicate
|
|
89
|
+
* @param key - The key to compare
|
|
90
|
+
* @param value - The value to compare
|
|
91
|
+
* @returns The greater than or equal predicate
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* const predicate = gte("name", "John")
|
|
95
|
+
* // result = { type: "gte", key: "name", value: "John" }
|
|
96
|
+
*/
|
|
97
|
+
export function gte(key: string, value: string | number): Predicate {
|
|
98
|
+
return { type: "gte", key, value }
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Creates a less than predicate
|
|
103
|
+
* @param key - The key to compare
|
|
104
|
+
* @param value - The value to compare
|
|
105
|
+
* @returns The less than predicate
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* const predicate = lt("name", "John")
|
|
109
|
+
* // result = { type: "lt", key: "name", value: "John" }
|
|
110
|
+
*/
|
|
111
|
+
export function lt(key: string, value: string | number): Predicate {
|
|
112
|
+
return { type: "lt", key, value }
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Creates a less than or equal predicate
|
|
117
|
+
* @param key - The key to compare
|
|
118
|
+
* @param value - The value to compare
|
|
119
|
+
* @returns The less than or equal predicate
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* const predicate = lte("name", "John")
|
|
123
|
+
* // result = { type: "lte", key: "name", value: "John" }
|
|
124
|
+
*/
|
|
125
|
+
export function lte(key: string, value: string | number): Predicate {
|
|
126
|
+
return { type: "lte", key, value }
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Creates a not predicate
|
|
131
|
+
* @param key - The key to compare
|
|
132
|
+
* @returns The not predicate
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* const predicate = not("name")
|
|
136
|
+
* // result = { type: "not", key: "name", value: "" }
|
|
137
|
+
*/
|
|
138
|
+
export function not(key: string): Predicate {
|
|
139
|
+
return { type: "not", key, value: "" }
|
|
140
|
+
}
|