-
{title}
+
{displayTitle}
-
+
+ {renderPayload(payload)}
+
-
+
{inputType === "confirmation" && (
)}
+ {inputType === "selection" && (
+
+ )}
diff --git a/packages/features/tsup.config.ts b/packages/features/tsup.config.ts
index 76688060..92b3fb56 100644
--- a/packages/features/tsup.config.ts
+++ b/packages/features/tsup.config.ts
@@ -1,4 +1,4 @@
-import { baseTsupConfig } from "@palladxyz/common"
+import { baseTsupConfig } from "@palladco/common"
import { polyfillNode } from "esbuild-plugin-polyfill-node"
import svgr from "esbuild-plugin-svgr"
import { defineConfig } from "tsup"
diff --git a/packages/key-management/package.json b/packages/key-management/package.json
index 7f26c57d..8d6daca5 100644
--- a/packages/key-management/package.json
+++ b/packages/key-management/package.json
@@ -1,5 +1,5 @@
{
- "name": "@palladxyz/key-management",
+ "name": "@palladco/key-management",
"description": "An agnostic key management package for Pallad",
"version": "0.0.1",
"type": "module",
@@ -21,17 +21,15 @@
"dependencies": {
"@noble/ciphers": "0.5.3",
"@noble/hashes": "1.4.0",
- "@noble/secp256k1": "2.1.0",
- "@palladxyz/mina-core": "workspace:*",
- "@palladxyz/pallad-core": "workspace:*",
+ "@palladco/mina-core": "workspace:*",
+ "@palladco/pallad-core": "workspace:*",
"@scure/base": "1.1.7",
"@scure/bip32": "1.4.0",
"@scure/bip39": "1.3.0",
- "buffer": "6.0.3",
"mina-signer": "3.0.7",
"ts-custom-error": "3.3.1"
},
"devDependencies": {
- "@palladxyz/common": "workspace:*"
+ "@palladco/common": "workspace:*"
}
}
diff --git a/packages/key-management/src/chains/Mina/credentialDerivation.ts b/packages/key-management/src/chains/Mina/credentialDerivation.ts
index b46d249b..fbac6ba2 100644
--- a/packages/key-management/src/chains/Mina/credentialDerivation.ts
+++ b/packages/key-management/src/chains/Mina/credentialDerivation.ts
@@ -1,4 +1,4 @@
-import type { Mina } from "@palladxyz/mina-core"
+import type { Mina } from "@palladco/mina-core"
import Client from "mina-signer"
import type {
diff --git a/packages/key-management/src/chains/Mina/guards.ts b/packages/key-management/src/chains/Mina/guards.ts
index baafa76b..929c1d58 100644
--- a/packages/key-management/src/chains/Mina/guards.ts
+++ b/packages/key-management/src/chains/Mina/guards.ts
@@ -1,5 +1,5 @@
import { TransactionBodySchema } from "@mina-js/utils"
-import type { Mina } from "@palladxyz/mina-core"
+import type { Mina } from "@palladco/mina-core"
export function isConstructedTransaction(payload: any) {
const transaction = TransactionBodySchema.parse(payload)
diff --git a/packages/key-management/src/chains/Mina/keyDerivationUtils.ts b/packages/key-management/src/chains/Mina/keyDerivationUtils.ts
index 8325595a..169d8843 100644
--- a/packages/key-management/src/chains/Mina/keyDerivationUtils.ts
+++ b/packages/key-management/src/chains/Mina/keyDerivationUtils.ts
@@ -1,4 +1,4 @@
-import { Network } from "@palladxyz/pallad-core"
+import { Network } from "@palladco/pallad-core"
import type { MinaDerivationArgs } from "./types"
diff --git a/packages/key-management/src/chains/Mina/signingOperations.ts b/packages/key-management/src/chains/Mina/signingOperations.ts
index 0e04f468..a362fd28 100644
--- a/packages/key-management/src/chains/Mina/signingOperations.ts
+++ b/packages/key-management/src/chains/Mina/signingOperations.ts
@@ -33,6 +33,7 @@ export function MinaSigningOperations
(
throw new Error("Invalid transaction payload")
}
+ case "mina_signFieldsWithPassphrase":
case "mina_signFields": {
if (util.isFields(payload)) {
return minaClient.signFields(payload.fields, privateKey)
diff --git a/packages/key-management/src/chains/Mina/types.ts b/packages/key-management/src/chains/Mina/types.ts
index 6d5cd67a..3d4e42cf 100644
--- a/packages/key-management/src/chains/Mina/types.ts
+++ b/packages/key-management/src/chains/Mina/types.ts
@@ -1,5 +1,5 @@
-import type { Mina } from "@palladxyz/mina-core"
-import { Network } from "@palladxyz/pallad-core"
+import type { Mina } from "@palladco/mina-core"
+import { Network } from "@palladco/pallad-core"
import type {
Nullifier,
diff --git a/packages/key-management/src/chains/README.md b/packages/key-management/src/chains/README.md
index 910dda55..c2d92ce0 100644
--- a/packages/key-management/src/chains/README.md
+++ b/packages/key-management/src/chains/README.md
@@ -1,6 +1,6 @@
-# `@palladxyz/key-management` Package - `chains` Subfolder Documentation
+# `@palladco/key-management` Package - `chains` Subfolder Documentation
-The `chains` subfolder of the `@palladxyz/key-management` package contains TypeScript modules that provide functionality related to key management, including credential derivation, key derivation, and signing operations specific to the Mina protocol. Each chain's folder follows a specific strucutre, below is an overview of each file for this strucutre within the `mina` subfolder as an example:
+The `chains` subfolder of the `@palladco/key-management` package contains TypeScript modules that provide functionality related to key management, including credential derivation, key derivation, and signing operations specific to the Mina protocol. Each chain's folder follows a specific strucutre, below is an overview of each file for this strucutre within the `mina` subfolder as an example:
## `credentialDerivation.ts`
diff --git a/packages/key-management/src/types.ts b/packages/key-management/src/types.ts
index dc34d7cd..c3a04733 100644
--- a/packages/key-management/src/types.ts
+++ b/packages/key-management/src/types.ts
@@ -1,5 +1,5 @@
-import type { Mina } from "@palladxyz/mina-core"
-import { Network } from "@palladxyz/pallad-core"
+import type { Mina } from "@palladco/mina-core"
+import { Network } from "@palladco/pallad-core"
import {
deriveMinaCredentials,
diff --git a/packages/key-management/test/mina/in-memory-key-agent.test.ts b/packages/key-management/test/mina/in-memory-key-agent.test.ts
index 3c36bf30..daef60b0 100644
--- a/packages/key-management/test/mina/in-memory-key-agent.test.ts
+++ b/packages/key-management/test/mina/in-memory-key-agent.test.ts
@@ -1,6 +1,6 @@
-import { mnemonic } from "@palladxyz/common"
-import type { Mina } from "@palladxyz/mina-core"
-import { Network } from "@palladxyz/pallad-core"
+import { mnemonic } from "@palladco/common"
+import type { Mina } from "@palladco/mina-core"
+import { Network } from "@palladco/pallad-core"
import * as bip32 from "@scure/bip32"
import Client from "mina-signer"
diff --git a/packages/key-management/test/mina/key-agent-base-zkapp-command.test.ts b/packages/key-management/test/mina/key-agent-base-zkapp-command.test.ts
index 02343890..f4bd7e7f 100644
--- a/packages/key-management/test/mina/key-agent-base-zkapp-command.test.ts
+++ b/packages/key-management/test/mina/key-agent-base-zkapp-command.test.ts
@@ -1,7 +1,7 @@
import { beforeEach, describe, expect, it } from "bun:test"
-import { mnemonic } from "@palladxyz/common"
-import type { Mina } from "@palladxyz/mina-core"
-import { Network } from "@palladxyz/pallad-core"
+import { mnemonic } from "@palladco/common"
+import type { Mina } from "@palladco/mina-core"
+import { Network } from "@palladco/pallad-core"
import Client from "mina-signer"
import { utf8ToBytes } from "@noble/hashes/utils"
diff --git a/packages/key-management/test/mina/key-agent-base.test.ts b/packages/key-management/test/mina/key-agent-base.test.ts
index c1a955f4..d042a81f 100644
--- a/packages/key-management/test/mina/key-agent-base.test.ts
+++ b/packages/key-management/test/mina/key-agent-base.test.ts
@@ -1,7 +1,7 @@
import { beforeEach, describe, expect, it } from "bun:test"
-import { mnemonic } from "@palladxyz/common"
-import type { Mina } from "@palladxyz/mina-core"
-import { Network } from "@palladxyz/pallad-core"
+import { mnemonic } from "@palladco/common"
+import type { Mina } from "@palladco/mina-core"
+import { Network } from "@palladco/pallad-core"
import * as bip32 from "@scure/bip32"
import Client from "mina-signer"
diff --git a/packages/key-management/test/util/guards.test.ts b/packages/key-management/test/util/guards.test.ts
index ac37dd66..e11bc8db 100644
--- a/packages/key-management/test/util/guards.test.ts
+++ b/packages/key-management/test/util/guards.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from "bun:test"
-import type { Mina } from "@palladxyz/mina-core"
+import type { Mina } from "@palladco/mina-core"
import {
isConstructedTransaction,
diff --git a/packages/key-management/tsconfig.json b/packages/key-management/tsconfig.json
index f4e2e06e..ffab31d1 100644
--- a/packages/key-management/tsconfig.json
+++ b/packages/key-management/tsconfig.json
@@ -1,3 +1,3 @@
{
- "extends": "@palladxyz/common/tsconfig.json"
+ "extends": "@palladco/common/tsconfig.json"
}
diff --git a/packages/key-management/tsup.config.ts b/packages/key-management/tsup.config.ts
index 8449a56d..3325517c 100644
--- a/packages/key-management/tsup.config.ts
+++ b/packages/key-management/tsup.config.ts
@@ -1,4 +1,4 @@
-import { baseTsupConfig } from "@palladxyz/common"
+import { baseTsupConfig } from "@palladco/common"
import { defineConfig } from "tsup"
import packageJson from "./package.json"
diff --git a/packages/mina-core/README.md b/packages/mina-core/README.md
index 9e45f402..08d7471a 100644
--- a/packages/mina-core/README.md
+++ b/packages/mina-core/README.md
@@ -1,13 +1,13 @@
-# @palladxyz/mina-core
+# @palladco/mina-core
-@palladxyz/mina-core is a TypeScript package designed for helping other libraries to interact with Mina. It provides interfaces & types for many the main data strcutures of Mina that are relevant for wallets and applications. This includes providers that retrieve account information, process transaction history, submit transactions, and fetch health checks.
+@palladco/mina-core is a TypeScript package designed for helping other libraries to interact with Mina. It provides interfaces & types for many the main data strcutures of Mina that are relevant for wallets and applications. This includes providers that retrieve account information, process transaction history, submit transactions, and fetch health checks.
## Installation
Install the package via npm:
```bash
-npm install @palladxyz/mina-core
+npm install @palladco/mina-core
```
## Usage
@@ -17,7 +17,7 @@ npm install @palladxyz/mina-core
The `AccountInfoProvider` interface is used to fetch account information based on a public key.
```ts
-import { AccountInfoProvider } from "@palladxyz/mina-core";
+import { AccountInfoProvider } from "@palladco/mina-core";
async function getAccountInfo(provider: AccountInfoProvider) {
const accountInfo = await provider.getAccountInfo({ publicKey: "..." });
@@ -29,7 +29,7 @@ async function getAccountInfo(provider: AccountInfoProvider) {
The `ChainHistoryProvider` interface provides methods to fetch transactions either by addresses or by hashes.
```ts
-import { ChainHistoryProvider } from "@palladxyz/mina-core";
+import { ChainHistoryProvider } from "@palladco/mina-core";
async function getTransactionsByAddresses(provider: ChainHistoryProvider) {
const transactions = await provider.transactionsByAddresses({
@@ -47,7 +47,7 @@ async function getTransactionsByHashes(provider: ChainHistoryProvider) {
The `TxSubmitProvider` interface allows you to submit signed transactions to the network.
```ts
-import { TxSubmitProvider } from "@palladxyz/mina-core";
+import { TxSubmitProvider } from "@palladco/mina-core";
async function submitTx(provider: TxSubmitProvider) {
const signedTx = // Prepare your signed transaction here
@@ -60,7 +60,7 @@ async function submitTx(provider: TxSubmitProvider) {
All provider types extend the base Provider interface, which provides a health check method to verify if the provider is operational.
```ts
-import { Provider } from "@palladxyz/mina-core";
+import { Provider } from "@palladco/mina-core";
async function checkHealth(provider: Provider) {
const healthCheckResponse = await provider.healthCheck();
diff --git a/packages/mina-core/package.json b/packages/mina-core/package.json
index 7920b221..4271ec77 100644
--- a/packages/mina-core/package.json
+++ b/packages/mina-core/package.json
@@ -1,5 +1,5 @@
{
- "name": "@palladxyz/mina-core",
+ "name": "@palladco/mina-core",
"version": "0.0.1",
"type": "module",
"description": "Core Mina Package SDK for Pallad",
@@ -17,13 +17,9 @@
"cleanup": "bunx --bun rimraf node_modules dist .turbo"
},
"dependencies": {
- "@palladxyz/util": "workspace:*",
- "bs58check": "4.0.0",
- "buffer": "6.0.3",
- "mina-signer": "3.0.7"
+ "@palladco/util": "workspace:*"
},
"devDependencies": {
- "@palladxyz/common": "workspace:*",
- "@types/secp256k1": "4.0.6"
+ "@palladco/common": "workspace:*"
}
}
diff --git a/packages/mina-core/src/Mina/Block.ts b/packages/mina-core/src/Mina/Block.ts
index fba12961..323467ac 100644
--- a/packages/mina-core/src/Mina/Block.ts
+++ b/packages/mina-core/src/Mina/Block.ts
@@ -1,4 +1,4 @@
-import type { OpaqueNumber } from "@palladxyz/util"
+import type { OpaqueNumber } from "@palladco/util"
/**
* The block number.
diff --git a/packages/mina-core/src/Mina/Transaction.ts b/packages/mina-core/src/Mina/Transaction.ts
index f32e5f88..e646a50a 100644
--- a/packages/mina-core/src/Mina/Transaction.ts
+++ b/packages/mina-core/src/Mina/Transaction.ts
@@ -1,4 +1,4 @@
-import { InvalidStringError, type OpaqueString } from "@palladxyz/util"
+import { InvalidStringError, type OpaqueString } from "@palladco/util"
import type { BorrowedTypes } from ".."
diff --git a/packages/mina-core/src/Providers/chain-history-provider/types.ts b/packages/mina-core/src/Providers/chain-history-provider/types.ts
index c48a2cb4..b3865816 100644
--- a/packages/mina-core/src/Providers/chain-history-provider/types.ts
+++ b/packages/mina-core/src/Providers/chain-history-provider/types.ts
@@ -1,4 +1,4 @@
-import type { Range } from "@palladxyz/util"
+import type { Range } from "@palladco/util"
import type { Mina, Provider } from "../.."
diff --git a/packages/mina-core/tsconfig.json b/packages/mina-core/tsconfig.json
index f4e2e06e..ffab31d1 100644
--- a/packages/mina-core/tsconfig.json
+++ b/packages/mina-core/tsconfig.json
@@ -1,3 +1,3 @@
{
- "extends": "@palladxyz/common/tsconfig.json"
+ "extends": "@palladco/common/tsconfig.json"
}
diff --git a/packages/mina-core/tsup.config.ts b/packages/mina-core/tsup.config.ts
index 8449a56d..3325517c 100644
--- a/packages/mina-core/tsup.config.ts
+++ b/packages/mina-core/tsup.config.ts
@@ -1,4 +1,4 @@
-import { baseTsupConfig } from "@palladxyz/common"
+import { baseTsupConfig } from "@palladco/common"
import { defineConfig } from "tsup"
import packageJson from "./package.json"
diff --git a/packages/offchain-data/README.md b/packages/offchain-data/README.md
index af2c116a..ad431d20 100644
--- a/packages/offchain-data/README.md
+++ b/packages/offchain-data/README.md
@@ -1,3 +1,3 @@
-# @palladxyz/offchain-data
+# @palladco/offchain-data
Package for fetching off-chain data like fiat prices.
diff --git a/packages/offchain-data/package.json b/packages/offchain-data/package.json
index 40970057..5b081f1e 100644
--- a/packages/offchain-data/package.json
+++ b/packages/offchain-data/package.json
@@ -1,5 +1,5 @@
{
- "name": "@palladxyz/offchain-data",
+ "name": "@palladco/offchain-data",
"description": "Off-chain data fetching services.",
"type": "module",
"version": "1.0.0",
@@ -21,6 +21,6 @@
"swr": "2.2.5"
},
"devDependencies": {
- "@palladxyz/common": "workspace:*"
+ "@palladco/common": "workspace:*"
}
}
diff --git a/packages/offchain-data/tsconfig.json b/packages/offchain-data/tsconfig.json
index f4e2e06e..ffab31d1 100644
--- a/packages/offchain-data/tsconfig.json
+++ b/packages/offchain-data/tsconfig.json
@@ -1,3 +1,3 @@
{
- "extends": "@palladxyz/common/tsconfig.json"
+ "extends": "@palladco/common/tsconfig.json"
}
diff --git a/packages/offchain-data/tsup.config.ts b/packages/offchain-data/tsup.config.ts
index 8449a56d..3325517c 100644
--- a/packages/offchain-data/tsup.config.ts
+++ b/packages/offchain-data/tsup.config.ts
@@ -1,4 +1,4 @@
-import { baseTsupConfig } from "@palladxyz/common"
+import { baseTsupConfig } from "@palladco/common"
import { defineConfig } from "tsup"
import packageJson from "./package.json"
diff --git a/packages/pallad-core/README.md b/packages/pallad-core/README.md
index 09d88d82..82cd6bcd 100644
--- a/packages/pallad-core/README.md
+++ b/packages/pallad-core/README.md
@@ -1,13 +1,13 @@
-# @palladxyz/mina-core
+# @palladco/mina-core
-@palladxyz/mina-core is a TypeScript package designed for interacting with the Mina Protocol. It provides interfaces for retrieving account information, processing transaction history, submitting transactions, and provider health checks. The package also includes the core types that represent the main data structures of the Mina Protocol.
+@palladco/mina-core is a TypeScript package designed for interacting with the Mina Protocol. It provides interfaces for retrieving account information, processing transaction history, submitting transactions, and provider health checks. The package also includes the core types that represent the main data structures of the Mina Protocol.
## Installation
Install the package via npm:
```bash
-npm install @palladxyz/mina-core
+npm install @palladco/mina-core
```
## Usage
@@ -17,7 +17,7 @@ npm install @palladxyz/mina-core
The `AccountInfoProvider` interface is used to fetch account information based on a public key.
```ts
-import { AccountInfoProvider } from "@palladxyz/mina-core";
+import { AccountInfoProvider } from "@palladco/mina-core";
async function getAccountInfo(provider: AccountInfoProvider) {
const accountInfo = await provider.getAccountInfo({ publicKey: "..." });
@@ -29,7 +29,7 @@ async function getAccountInfo(provider: AccountInfoProvider) {
The `ChainHistoryProvider` interface provides methods to fetch transactions either by addresses or by hashes.
```ts
-import { ChainHistoryProvider } from "@palladxyz/mina-core";
+import { ChainHistoryProvider } from "@palladco/mina-core";
async function getTransactionsByAddresses(provider: ChainHistoryProvider) {
const transactions = await provider.transactionsByAddresses({
@@ -47,7 +47,7 @@ async function getTransactionsByHashes(provider: ChainHistoryProvider) {
The `TxSubmitProvider` interface allows you to submit signed transactions to the network.
```ts
-import { TxSubmitProvider } from "@palladxyz/mina-core";
+import { TxSubmitProvider } from "@palladco/mina-core";
async function submitTx(provider: TxSubmitProvider) {
const signedTx = // Prepare your signed transaction here
@@ -60,7 +60,7 @@ async function submitTx(provider: TxSubmitProvider) {
All provider types extend the base Provider interface, which provides a health check method to verify if the provider is operational.
```ts
-import { Provider } from "@palladxyz/mina-core";
+import { Provider } from "@palladco/mina-core";
async function checkHealth(provider: Provider) {
const healthCheckResponse = await provider.healthCheck();
diff --git a/packages/pallad-core/package.json b/packages/pallad-core/package.json
index 7a8bfc4b..35007f82 100644
--- a/packages/pallad-core/package.json
+++ b/packages/pallad-core/package.json
@@ -1,5 +1,5 @@
{
- "name": "@palladxyz/pallad-core",
+ "name": "@palladco/pallad-core",
"version": "0.0.1",
"type": "module",
"description": "Core Pallad Package",
@@ -18,17 +18,11 @@
"cleanup": "bunx --bun rimraf node_modules dist .turbo"
},
"dependencies": {
- "@palladxyz/mina-core": "workspace:*",
- "@palladxyz/util": "workspace:*",
- "bs58check": "4.0.0",
- "buffer": "6.0.3",
- "mina-signer": "3.0.7",
- "viem": "2.18.4",
- "vite-plugin-top-level-await": "1.4.2",
- "vite-plugin-wasm": "3.3.0"
+ "@palladco/mina-core": "workspace:*",
+ "@palladco/util": "workspace:*",
+ "viem": "2.18.4"
},
"devDependencies": {
- "@palladxyz/common": "workspace:*",
- "@types/secp256k1": "4.0.6"
+ "@palladco/common": "workspace:*"
}
}
diff --git a/packages/pallad-core/src/Mina/Providers/account-info-provider/types.ts b/packages/pallad-core/src/Mina/Providers/account-info-provider/types.ts
index d8471c6a..e130a22a 100644
--- a/packages/pallad-core/src/Mina/Providers/account-info-provider/types.ts
+++ b/packages/pallad-core/src/Mina/Providers/account-info-provider/types.ts
@@ -1,4 +1,4 @@
-import type { Mina } from "@palladxyz/mina-core"
+import type { Mina } from "@palladco/mina-core"
import type { Provider } from "../.."
diff --git a/packages/pallad-core/src/Mina/Providers/chain-history-provider/types.ts b/packages/pallad-core/src/Mina/Providers/chain-history-provider/types.ts
index 01691b13..b14532d5 100644
--- a/packages/pallad-core/src/Mina/Providers/chain-history-provider/types.ts
+++ b/packages/pallad-core/src/Mina/Providers/chain-history-provider/types.ts
@@ -1,5 +1,5 @@
-import type { Mina } from "@palladxyz/mina-core"
-import type { Range } from "@palladxyz/util"
+import type { Mina } from "@palladco/mina-core"
+import type { Range } from "@palladco/util"
import type { Provider } from "../.."
diff --git a/packages/pallad-core/src/Mina/Providers/tx-submit-provider/types.ts b/packages/pallad-core/src/Mina/Providers/tx-submit-provider/types.ts
index dee20380..c049ef92 100644
--- a/packages/pallad-core/src/Mina/Providers/tx-submit-provider/types.ts
+++ b/packages/pallad-core/src/Mina/Providers/tx-submit-provider/types.ts
@@ -1,4 +1,4 @@
-import type { BorrowedTypes, Mina } from "@palladxyz/mina-core"
+import type { BorrowedTypes, Mina } from "@palladco/mina-core"
import type { Provider } from "../provider"
diff --git a/packages/pallad-core/src/Mina/Providers/unified-mina-provider.ts b/packages/pallad-core/src/Mina/Providers/unified-mina-provider.ts
index 6a02c6a2..2f3f8a2d 100644
--- a/packages/pallad-core/src/Mina/Providers/unified-mina-provider.ts
+++ b/packages/pallad-core/src/Mina/Providers/unified-mina-provider.ts
@@ -1,4 +1,4 @@
-import type { Mina } from "@palladxyz/mina-core"
+import type { Mina } from "@palladco/mina-core"
import type { AccountInfo, AccountInfoArgs } from "./account-info-provider"
import type {
diff --git a/packages/pallad-core/src/Pallad/providers/account-info-provider/types.ts b/packages/pallad-core/src/Pallad/providers/account-info-provider/types.ts
index df725e52..4ef41fec 100644
--- a/packages/pallad-core/src/Pallad/providers/account-info-provider/types.ts
+++ b/packages/pallad-core/src/Pallad/providers/account-info-provider/types.ts
@@ -1,4 +1,4 @@
-import type { Mina } from "@palladxyz/mina-core"
+import type { Mina } from "@palladco/mina-core"
import type { Address, Chain } from "viem"
import type { Provider } from "../"
diff --git a/packages/pallad-core/src/Pallad/providers/tx-submit-provider/types.ts b/packages/pallad-core/src/Pallad/providers/tx-submit-provider/types.ts
index cb9fea6e..9d177463 100644
--- a/packages/pallad-core/src/Pallad/providers/tx-submit-provider/types.ts
+++ b/packages/pallad-core/src/Pallad/providers/tx-submit-provider/types.ts
@@ -1,4 +1,4 @@
-import type { BorrowedTypes, Mina } from "@palladxyz/mina-core"
+import type { BorrowedTypes, Mina } from "@palladco/mina-core"
import type { Provider } from "../provider"
diff --git a/packages/pallad-core/src/Pallad/providers/types.ts b/packages/pallad-core/src/Pallad/providers/types.ts
index 188dcc4e..011df823 100644
--- a/packages/pallad-core/src/Pallad/providers/types.ts
+++ b/packages/pallad-core/src/Pallad/providers/types.ts
@@ -1,4 +1,4 @@
-import type { Mina } from "@palladxyz/mina-core"
+import type { Mina } from "@palladco/mina-core"
import type { Address, GetTransactionReturnType, Hash } from "viem"
export type TransactionHash = Mina.TxId[] | Hash[]
diff --git a/packages/pallad-core/tsconfig.json b/packages/pallad-core/tsconfig.json
index f4e2e06e..ffab31d1 100644
--- a/packages/pallad-core/tsconfig.json
+++ b/packages/pallad-core/tsconfig.json
@@ -1,3 +1,3 @@
{
- "extends": "@palladxyz/common/tsconfig.json"
+ "extends": "@palladco/common/tsconfig.json"
}
diff --git a/packages/pallad-core/tsup.config.ts b/packages/pallad-core/tsup.config.ts
index 8449a56d..3325517c 100644
--- a/packages/pallad-core/tsup.config.ts
+++ b/packages/pallad-core/tsup.config.ts
@@ -1,4 +1,4 @@
-import { baseTsupConfig } from "@palladxyz/common"
+import { baseTsupConfig } from "@palladco/common"
import { defineConfig } from "tsup"
import packageJson from "./package.json"
diff --git a/packages/providers/README.md b/packages/providers/README.md
index 1af83fcc..c44946ff 100644
--- a/packages/providers/README.md
+++ b/packages/providers/README.md
@@ -1,4 +1,4 @@
-# @palladxyz/providers
+# @palladco/providers
This TypeScript library creates Providers that can read and write (mutate) data to Mina via a set of API providers such as Minascan.
@@ -6,7 +6,7 @@ A Provider is an abstraction that encapsulates the functionality for interacting
## Implementation Detail
-While these providers can be used individually, they are more functional in nature than the founding `@palladxyz/mina-graphql` providers, removing the object oriented design in many of them (full set to be determined). Each provider is scoped to specifically either read, write, or listen; not focusing on specifically storing data themselves they are an abstraction for an application. In Pallad's case, the `vault` requires this abstraction as it stores the arguments for each provider.
+While these providers can be used individually, they are more functional in nature than the founding `@palladco/mina-graphql` providers, removing the object oriented design in many of them (full set to be determined). Each provider is scoped to specifically either read, write, or listen; not focusing on specifically storing data themselves they are an abstraction for an application. In Pallad's case, the `vault` requires this abstraction as it stores the arguments for each provider.
### Provider Sources
diff --git a/packages/providers/package.json b/packages/providers/package.json
index 8dde595b..3b687fa0 100644
--- a/packages/providers/package.json
+++ b/packages/providers/package.json
@@ -1,5 +1,5 @@
{
- "name": "@palladxyz/providers",
+ "name": "@palladco/providers",
"version": "0.0.1",
"description": "Proivder Package SDK for Pallad.",
"type": "module",
@@ -19,26 +19,19 @@
},
"dependencies": {
"@noble/hashes": "1.4.0",
- "@palladxyz/key-management": "workspace:*",
- "@palladxyz/mina-core": "workspace:*",
- "@palladxyz/pallad-core": "workspace:*",
- "@palladxyz/util": "workspace:*",
- "bs58check": "4.0.0",
- "buffer": "6.0.3",
- "events": "3.3.0",
+ "@palladco/key-management": "workspace:*",
+ "@palladco/mina-core": "workspace:*",
+ "@palladco/pallad-core": "workspace:*",
+ "@palladco/util": "workspace:*",
"graphql": "16.9.0",
"graphql-request": "7.1.0",
"json-bigint": "1.0.0",
"mina-signer": "3.0.7",
- "subscriptions-transport-ws": "0.11.0",
- "viem": "2.18.4",
- "ws": "8.18.0"
+ "subscriptions-transport-ws": "0.11.0"
},
"devDependencies": {
- "@palladxyz/common": "workspace:*",
- "@types/events": "3.0.3",
+ "@palladco/common": "workspace:*",
"@types/json-bigint": "1.0.4",
- "esbuild-plugin-polyfill-node": "0.3.0",
- "msw": "2.3.4"
+ "esbuild-plugin-polyfill-node": "0.3.0"
}
}
diff --git a/packages/providers/src/blockberry-provider/chain-history/chain-history-provider.ts b/packages/providers/src/blockberry-provider/chain-history/chain-history-provider.ts
index 7a6b5de4..6cee8004 100644
--- a/packages/providers/src/blockberry-provider/chain-history/chain-history-provider.ts
+++ b/packages/providers/src/blockberry-provider/chain-history/chain-history-provider.ts
@@ -1,9 +1,9 @@
-import type { Mina } from "@palladxyz/mina-core"
+import type { Mina } from "@palladco/mina-core"
import type {
ChainHistoryProvider,
TransactionsByAddressesArgs,
Tx,
-} from "@palladxyz/pallad-core"
+} from "@palladco/pallad-core"
//import { healthCheck } from "../utils/health-check-utils";
diff --git a/packages/providers/src/mina-node/account-info/account-info-provider.ts b/packages/providers/src/mina-node/account-info/account-info-provider.ts
index 719096b1..4318503c 100644
--- a/packages/providers/src/mina-node/account-info/account-info-provider.ts
+++ b/packages/providers/src/mina-node/account-info/account-info-provider.ts
@@ -2,7 +2,7 @@ import type {
AccountInfo,
AccountInfoArgs,
AccountInfoProvider,
-} from "@palladxyz/pallad-core"
+} from "@palladco/pallad-core"
import { createGraphQLRequest } from "../utils/fetch-utils"
import { healthCheck } from "../utils/health-check-utils"
diff --git a/packages/providers/src/mina-node/account-info/queries.ts b/packages/providers/src/mina-node/account-info/queries.ts
index e533c374..347f9867 100644
--- a/packages/providers/src/mina-node/account-info/queries.ts
+++ b/packages/providers/src/mina-node/account-info/queries.ts
@@ -17,7 +17,7 @@ export const getAccountBalance = `
}
}
`
-import type { TokenIdMap } from "@palladxyz/mina-core"
+import type { TokenIdMap } from "@palladco/mina-core"
export function getTokenAccountInfoQuery(tokenIds: TokenIdMap): string {
// Start with the base part of the query
diff --git a/packages/providers/src/mina-node/block-listener/BlockListenerProvider.ts b/packages/providers/src/mina-node/block-listener/BlockListenerProvider.ts
index 21409358..160bb4b9 100644
--- a/packages/providers/src/mina-node/block-listener/BlockListenerProvider.ts
+++ b/packages/providers/src/mina-node/block-listener/BlockListenerProvider.ts
@@ -1,4 +1,4 @@
-import type { AccountInfo, AccountInfoArgs } from "@palladxyz/mina-core"
+import type { AccountInfo, AccountInfoArgs } from "@palladco/mina-core"
import type { ExecutionResult } from "graphql"
import { GraphQLClient, gql } from "graphql-request"
import { SubscriptionClient } from "subscriptions-transport-ws"
diff --git a/packages/providers/src/mina-node/chain-history/chain-history-provider.ts b/packages/providers/src/mina-node/chain-history/chain-history-provider.ts
index 222a16b0..f0e03a8a 100644
--- a/packages/providers/src/mina-node/chain-history/chain-history-provider.ts
+++ b/packages/providers/src/mina-node/chain-history/chain-history-provider.ts
@@ -3,7 +3,7 @@ import type {
TransactionsByAddressesArgs,
TransactionsByHashesArgs,
Tx,
-} from "@palladxyz/pallad-core"
+} from "@palladco/pallad-core"
import { createGraphQLRequest } from "../utils/fetch-utils"
import {
diff --git a/packages/providers/src/mina-node/node-status/node-status-provider.ts b/packages/providers/src/mina-node/node-status/node-status-provider.ts
index f6756643..9d364c83 100644
--- a/packages/providers/src/mina-node/node-status/node-status-provider.ts
+++ b/packages/providers/src/mina-node/node-status/node-status-provider.ts
@@ -1,4 +1,4 @@
-import type { NodeStatus, NodeStatusProvider } from "@palladxyz/pallad-core"
+import type { NodeStatus, NodeStatusProvider } from "@palladco/pallad-core"
import { createGraphQLRequest } from "../utils/fetch-utils"
import { healthCheck } from "../utils/health-check-utils"
diff --git a/packages/providers/src/mina-node/types.ts b/packages/providers/src/mina-node/types.ts
index 10aaee8a..1a80d91f 100644
--- a/packages/providers/src/mina-node/types.ts
+++ b/packages/providers/src/mina-node/types.ts
@@ -8,7 +8,7 @@ import type {
TransactionsByIdsArgs,
TxStatus,
TxStatusArgs,
-} from "@palladxyz/mina-core"
+} from "@palladco/mina-core"
/**
* An interface that abstracts over Mina node queries.
*/
diff --git a/packages/providers/src/unified-providers/account-info-provider.ts b/packages/providers/src/unified-providers/account-info-provider.ts
index c3247843..47620fad 100644
--- a/packages/providers/src/unified-providers/account-info-provider.ts
+++ b/packages/providers/src/unified-providers/account-info-provider.ts
@@ -3,7 +3,7 @@ import type {
AccountInfoArgs,
AccountInfoProvider,
HealthCheckResponse,
-} from "@palladxyz/pallad-core"
+} from "@palladco/pallad-core"
import { createAccountInfoProvider as mn } from "../mina-node"
import type { ProviderConfig } from "./types"
diff --git a/packages/providers/src/unified-providers/chain-history-provider.ts b/packages/providers/src/unified-providers/chain-history-provider.ts
index 961759cc..193675d3 100644
--- a/packages/providers/src/unified-providers/chain-history-provider.ts
+++ b/packages/providers/src/unified-providers/chain-history-provider.ts
@@ -4,7 +4,7 @@ import type {
TransactionsByAddressesArgs,
TransactionsByHashesArgs,
Tx,
-} from "@palladxyz/pallad-core"
+} from "@palladco/pallad-core"
import { createChainHistoryProvider as ms } from "../blockberry-provider"
import { createChainHistoryProvider as zs } from "../zeko-scan"
diff --git a/packages/providers/src/unified-providers/node-status-provider.ts b/packages/providers/src/unified-providers/node-status-provider.ts
index 1e2f9ba8..9adac7a7 100644
--- a/packages/providers/src/unified-providers/node-status-provider.ts
+++ b/packages/providers/src/unified-providers/node-status-provider.ts
@@ -2,7 +2,7 @@ import type {
HealthCheckResponse,
NodeStatus,
NodeStatusProvider,
-} from "@palladxyz/pallad-core"
+} from "@palladco/pallad-core"
import { createNodeStatusProvider as mn } from "../mina-node"
import type { ProviderConfig } from "./types"
diff --git a/packages/providers/src/unified-providers/unified-provider.ts b/packages/providers/src/unified-providers/unified-provider.ts
index 771e7a3c..25fa9db9 100644
--- a/packages/providers/src/unified-providers/unified-provider.ts
+++ b/packages/providers/src/unified-providers/unified-provider.ts
@@ -5,7 +5,7 @@ import type {
TransactionsByAddressesArgs,
Tx,
UnifiedChainProviderType,
-} from "@palladxyz/pallad-core"
+} from "@palladco/pallad-core"
import { createAccountInfoProvider } from "./account-info-provider"
import { createChainHistoryProvider } from "./chain-history-provider"
diff --git a/packages/providers/src/zeko-scan/chain-history/chain-history-provider.ts b/packages/providers/src/zeko-scan/chain-history/chain-history-provider.ts
index 514ddd9a..9ded1260 100644
--- a/packages/providers/src/zeko-scan/chain-history/chain-history-provider.ts
+++ b/packages/providers/src/zeko-scan/chain-history/chain-history-provider.ts
@@ -1,9 +1,9 @@
-import type { Mina } from "@palladxyz/mina-core"
+import type { Mina } from "@palladco/mina-core"
import type {
ChainHistoryProvider,
TransactionsByAddressesArgs,
Tx,
-} from "@palladxyz/pallad-core"
+} from "@palladco/pallad-core"
const convertToTransactionBody = (
data: any[],
diff --git a/packages/providers/test/blockberry/chain-history-provider.test.ts b/packages/providers/test/blockberry/chain-history-provider.test.ts
index 9658f90e..ace79a5b 100644
--- a/packages/providers/test/blockberry/chain-history-provider.test.ts
+++ b/packages/providers/test/blockberry/chain-history-provider.test.ts
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it } from "bun:test"
-import type { Mina } from "@palladxyz/mina-core"
+import type { Mina } from "@palladco/mina-core"
import { Blockberry } from "../../src"
diff --git a/packages/providers/test/mina-node/l1-mina-node/individual-providers/account-info-provider.test.ts b/packages/providers/test/mina-node/l1-mina-node/individual-providers/account-info-provider.test.ts
index 0df31a0e..576c1289 100644
--- a/packages/providers/test/mina-node/l1-mina-node/individual-providers/account-info-provider.test.ts
+++ b/packages/providers/test/mina-node/l1-mina-node/individual-providers/account-info-provider.test.ts
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it } from "bun:test"
-import type { TokenIdMap } from "@palladxyz/mina-core"
+import type { TokenIdMap } from "@palladco/mina-core"
import { MinaNode } from "../../../../src"
diff --git a/packages/providers/test/mina-node/l1-mina-node/individual-providers/chain-history-provider.test.ts b/packages/providers/test/mina-node/l1-mina-node/individual-providers/chain-history-provider.test.ts
index 73ee1667..0867a6ca 100644
--- a/packages/providers/test/mina-node/l1-mina-node/individual-providers/chain-history-provider.test.ts
+++ b/packages/providers/test/mina-node/l1-mina-node/individual-providers/chain-history-provider.test.ts
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it } from "bun:test"
-import type { Mina } from "@palladxyz/mina-core"
+import type { Mina } from "@palladco/mina-core"
import { MinaNode } from "../../../../src"
const nodeUrl =
diff --git a/packages/providers/test/mina-node/l1-mina-node/individual-providers/submit-tx-provider.test.ts b/packages/providers/test/mina-node/l1-mina-node/individual-providers/submit-tx-provider.test.ts
index c6e6080b..3cde1675 100644
--- a/packages/providers/test/mina-node/l1-mina-node/individual-providers/submit-tx-provider.test.ts
+++ b/packages/providers/test/mina-node/l1-mina-node/individual-providers/submit-tx-provider.test.ts
@@ -6,9 +6,9 @@ import {
type FromBip39MnemonicWordsProps,
InMemoryKeyAgent,
type MinaSpecificArgs,
-} from "@palladxyz/key-management"
-import { Mina, type TokenIdMap } from "@palladxyz/mina-core"
-import { Network } from "@palladxyz/pallad-core"
+} from "@palladco/key-management"
+import { Mina, type TokenIdMap } from "@palladco/mina-core"
+import { Network } from "@palladco/pallad-core"
import type {
Payment,
SignedLegacy,
diff --git a/packages/providers/test/mina-node/zeko-sequencer/individual-providers/account-info-provider.test.ts b/packages/providers/test/mina-node/zeko-sequencer/individual-providers/account-info-provider.test.ts
index 50cc6afc..c867ce46 100644
--- a/packages/providers/test/mina-node/zeko-sequencer/individual-providers/account-info-provider.test.ts
+++ b/packages/providers/test/mina-node/zeko-sequencer/individual-providers/account-info-provider.test.ts
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it } from "bun:test"
-import type { TokenIdMap } from "@palladxyz/mina-core"
+import type { TokenIdMap } from "@palladco/mina-core"
import { MinaNode } from "../../../../src"
const nodeUrl = process.env.NODE_URL || "https://devnet.zeko.io/graphql"
diff --git a/packages/providers/test/mina-node/zeko-sequencer/individual-providers/submit-tx-provider.test.ts b/packages/providers/test/mina-node/zeko-sequencer/individual-providers/submit-tx-provider.test.ts
index 75d32ff3..b37a2258 100644
--- a/packages/providers/test/mina-node/zeko-sequencer/individual-providers/submit-tx-provider.test.ts
+++ b/packages/providers/test/mina-node/zeko-sequencer/individual-providers/submit-tx-provider.test.ts
@@ -6,9 +6,9 @@ import {
type GroupedCredentials,
InMemoryKeyAgent,
type MinaSpecificArgs,
-} from "@palladxyz/key-management"
-import { type AccountInfo, Mina, type TokenIdMap } from "@palladxyz/mina-core"
-import { Network } from "@palladxyz/pallad-core"
+} from "@palladco/key-management"
+import { type AccountInfo, Mina, type TokenIdMap } from "@palladco/mina-core"
+import { Network } from "@palladco/pallad-core"
import type {
Payment,
SignedLegacy,
diff --git a/packages/providers/test/mina-node/zeko-sequencer/individual-providers/util.ts b/packages/providers/test/mina-node/zeko-sequencer/individual-providers/util.ts
index c7c1f2e6..9aac9106 100644
--- a/packages/providers/test/mina-node/zeko-sequencer/individual-providers/util.ts
+++ b/packages/providers/test/mina-node/zeko-sequencer/individual-providers/util.ts
@@ -1,4 +1,4 @@
-import { Mina } from "@palladxyz/mina-core"
+import { Mina } from "@palladco/mina-core"
import Client from "mina-signer"
import type {
Payment,
diff --git a/packages/providers/test/unified-providers/individual-providers/account-info-provider.test.ts b/packages/providers/test/unified-providers/individual-providers/account-info-provider.test.ts
index 369dc544..5266fd8b 100644
--- a/packages/providers/test/unified-providers/individual-providers/account-info-provider.test.ts
+++ b/packages/providers/test/unified-providers/individual-providers/account-info-provider.test.ts
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it } from "bun:test"
-import type { TokenIdMap } from "@palladxyz/mina-core"
+import type { TokenIdMap } from "@palladco/mina-core"
import { type ProviderConfig, createAccountInfoProvider } from "../../../src"
diff --git a/packages/providers/test/unified-providers/individual-providers/chain-history-provider.test.ts b/packages/providers/test/unified-providers/individual-providers/chain-history-provider.test.ts
index dc7c0da9..fc59ab80 100644
--- a/packages/providers/test/unified-providers/individual-providers/chain-history-provider.test.ts
+++ b/packages/providers/test/unified-providers/individual-providers/chain-history-provider.test.ts
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it } from "bun:test"
-import type { Mina } from "@palladxyz/mina-core"
+import type { Mina } from "@palladco/mina-core"
import { type ProviderConfig, createChainHistoryProvider } from "../../../src"
diff --git a/packages/providers/test/unified-providers/unified-provider.test.ts b/packages/providers/test/unified-providers/unified-provider.test.ts
index e4f0cd65..a63f85fb 100644
--- a/packages/providers/test/unified-providers/unified-provider.test.ts
+++ b/packages/providers/test/unified-providers/unified-provider.test.ts
@@ -1,6 +1,6 @@
import { beforeEach, describe, expect, it } from "bun:test"
-import type { TokenIdMap } from "@palladxyz/mina-core"
-import type { Tx } from "@palladxyz/pallad-core"
+import type { TokenIdMap } from "@palladco/mina-core"
+import type { Tx } from "@palladco/pallad-core"
import { type ProviderConfig, createChainProvider } from "../../src"
diff --git a/packages/providers/test/zeko-scan/chain-history-provider.test.ts b/packages/providers/test/zeko-scan/chain-history-provider.test.ts
index 6128936f..2f0181d7 100644
--- a/packages/providers/test/zeko-scan/chain-history-provider.test.ts
+++ b/packages/providers/test/zeko-scan/chain-history-provider.test.ts
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it } from "bun:test"
-import type { Mina } from "@palladxyz/mina-core"
+import type { Mina } from "@palladco/mina-core"
import { ZekoScan } from "../../src"
diff --git a/packages/providers/tsconfig.json b/packages/providers/tsconfig.json
index f4e2e06e..ffab31d1 100644
--- a/packages/providers/tsconfig.json
+++ b/packages/providers/tsconfig.json
@@ -1,3 +1,3 @@
{
- "extends": "@palladxyz/common/tsconfig.json"
+ "extends": "@palladco/common/tsconfig.json"
}
diff --git a/packages/providers/tsup.config.ts b/packages/providers/tsup.config.ts
index 3d31da11..0673190e 100644
--- a/packages/providers/tsup.config.ts
+++ b/packages/providers/tsup.config.ts
@@ -1,4 +1,4 @@
-import { baseTsupConfig } from "@palladxyz/common"
+import { baseTsupConfig } from "@palladco/common"
import { polyfillNode } from "esbuild-plugin-polyfill-node"
import { defineConfig } from "tsup"
diff --git a/packages/util/README.md b/packages/util/README.md
index d3381be1..f54b84ff 100644
--- a/packages/util/README.md
+++ b/packages/util/README.md
@@ -1,3 +1,3 @@
-# @palladxyz/util
+# @palladco/util
This TypeScript library provides util functions for other Pallad SDK packages.
diff --git a/packages/util/package.json b/packages/util/package.json
index 9647b9a0..f88dfd3d 100644
--- a/packages/util/package.json
+++ b/packages/util/package.json
@@ -1,5 +1,5 @@
{
- "name": "@palladxyz/util",
+ "name": "@palladco/util",
"version": "0.0.1",
"type": "module",
"description": "Util Package SDK for Pallad",
@@ -18,13 +18,9 @@
"cleanup": "bunx --bun rimraf node_modules dist .turbo"
},
"dependencies": {
- "bs58check": "4.0.0",
- "buffer": "6.0.3",
- "mina-signer": "3.0.7",
"ts-custom-error": "3.3.1"
},
"devDependencies": {
- "@palladxyz/common": "workspace:*",
- "@types/secp256k1": "4.0.6"
+ "@palladco/common": "workspace:*"
}
}
diff --git a/packages/util/tsconfig.json b/packages/util/tsconfig.json
index f4e2e06e..ffab31d1 100644
--- a/packages/util/tsconfig.json
+++ b/packages/util/tsconfig.json
@@ -1,3 +1,3 @@
{
- "extends": "@palladxyz/common/tsconfig.json"
+ "extends": "@palladco/common/tsconfig.json"
}
diff --git a/packages/util/tsup.config.ts b/packages/util/tsup.config.ts
index 8449a56d..3325517c 100644
--- a/packages/util/tsup.config.ts
+++ b/packages/util/tsup.config.ts
@@ -1,4 +1,4 @@
-import { baseTsupConfig } from "@palladxyz/common"
+import { baseTsupConfig } from "@palladco/common"
import { defineConfig } from "tsup"
import packageJson from "./package.json"
diff --git a/packages/vault/README.md b/packages/vault/README.md
index 87da0c59..1e8c014f 100644
--- a/packages/vault/README.md
+++ b/packages/vault/README.md
@@ -1,12 +1,12 @@
-# @palladxyz/vault
+# @palladco/vault
## Introduction
-The `@palladxyz/vault` package offers a robust solution for managing key agents, credentials, and accounts within the wallet.
+The `@palladco/vault` package offers a robust solution for managing key agents, credentials, and accounts within the wallet.
## `useVault`: Central Interface for Wallet Management
-The `useVault` hook is the core interface of the `@palladxyz/vault` package, encapsulating the functionalities of account, credential, and key agent management in an integrated manner. It utilizes `zustand` for state management and `immer` for immutable state updates.
+The `useVault` hook is the core interface of the `@palladco/vault` package, encapsulating the functionalities of account, credential, and key agent management in an integrated manner. It utilizes `zustand` for state management and `immer` for immutable state updates.
## Features
@@ -17,8 +17,8 @@ The `useVault` hook is the core interface of the `@palladxyz/vault` package, enc
## Example Usage
```ts
-import { useVault } from '@palladxyz/vault';
-import { Network } from '@palladxyz/key-management';
+import { useVault } from '@palladco/vault';
+import { Network } from '@palladco/key-management';
// Example usage within a component or function
const MyComponent = () => {
diff --git a/packages/vault/package.json b/packages/vault/package.json
index 01904957..5adf50d3 100644
--- a/packages/vault/package.json
+++ b/packages/vault/package.json
@@ -1,5 +1,5 @@
{
- "name": "@palladxyz/vault",
+ "name": "@palladco/vault",
"version": "0.0.1",
"type": "module",
"description": "A Vault for the Mina Wallet Package for Pallad",
@@ -18,29 +18,22 @@
"cleanup": "bunx --bun rimraf node_modules dist .turbo"
},
"dependencies": {
- "@mina-js/klesia-sdk": "https://pkg.pr.new/palladians/mina-js/@mina-js/klesia-sdk@a51d3b4",
+ "@mina-js/klesia-sdk": "https://pkg.pr.new/palladians/mina-js/@mina-js/klesia-sdk@261950d",
"@noble/hashes": "1.4.0",
- "@palladxyz/key-management": "workspace:*",
- "@palladxyz/mina-core": "workspace:*",
- "@palladxyz/pallad-core": "workspace:*",
- "@palladxyz/providers": "workspace:*",
- "@palladxyz/util": "workspace:*",
+ "@palladco/key-management": "workspace:*",
+ "@palladco/mina-core": "workspace:*",
+ "@palladco/pallad-core": "workspace:*",
+ "@palladco/providers": "workspace:*",
+ "@palladco/util": "workspace:*",
"@plasmohq/storage": "1.11.0",
- "bs58check": "4.0.0",
- "buffer": "6.0.3",
"dayjs": "1.11.12",
"immer": "10.1.1",
- "rambda": "9.2.1",
- "redux-logger": "3.0.6",
"superjson": "2.2.1",
"unique-names-generator": "4.7.1",
"zustand": "4.5.4"
},
"devDependencies": {
- "@palladxyz/common": "workspace:*",
- "@types/secp256k1": "4.0.6",
- "mina-signer": "3.0.7",
- "msw": "2.3.4",
+ "@palladco/common": "workspace:*",
"vite": "5.3.5"
}
}
diff --git a/packages/vault/src/account/accountState.ts b/packages/vault/src/account/accountState.ts
index e2c55920..685ea003 100644
--- a/packages/vault/src/account/accountState.ts
+++ b/packages/vault/src/account/accountState.ts
@@ -1,5 +1,5 @@
-import type { ChainAddress } from "@palladxyz/key-management"
-import type { AccountInfo, Tx } from "@palladxyz/pallad-core"
+import type { ChainAddress } from "@palladco/key-management"
+import type { AccountInfo, Tx } from "@palladco/pallad-core"
export type SingleAccountState = {
accountInfo: Record
diff --git a/packages/vault/src/credentials/credentialsState.ts b/packages/vault/src/credentials/credentialsState.ts
index 922cba78..367baae8 100644
--- a/packages/vault/src/credentials/credentialsState.ts
+++ b/packages/vault/src/credentials/credentialsState.ts
@@ -1,8 +1,4 @@
-/**
- * @file Represents the state definitions related to credentials specific to keyAgents & accounts.
- */
-
-import type { GroupedCredentials } from "@palladxyz/key-management"
+import type { GroupedCredentials } from "@palladco/key-management"
import type { KeyAgentName } from "../keyAgent"
import type { SearchQuery } from "../utils/utils"
@@ -10,30 +6,18 @@ import type { SearchQuery } from "../utils/utils"
export type CredentialName = string
export type StoredCredential = GroupedCredentials | undefined
-/**
- * Type representing the basic state of a credential.
- * @typedef {Object} SingleCredentialState
- */
export type SingleCredentialState = {
credentialName: CredentialName
keyAgentName: KeyAgentName
credential: StoredCredential
}
-/**
- * Constant representing the initial credential state
- * @typedef {Object}
- */
export const initialCredentialState: SingleCredentialState = {
credentialName: "",
keyAgentName: "",
credential: undefined,
}
-/**
- * Type representing the store's state and actions combined.
- * @typedef {Object} CredentialsState
- */
export type CredentialStore = {
credentials: Record
ensureCredential: (
diff --git a/packages/vault/src/keyAgent/README.md b/packages/vault/src/keyAgent/README.md
index a64e396d..183a7b40 100644
--- a/packages/vault/src/keyAgent/README.md
+++ b/packages/vault/src/keyAgent/README.md
@@ -1,6 +1,6 @@
# Key Agent Store
-This TypeScript module provides a state management store for cryptographic key agents using Zustand, Immer, and the `@palladxyz/key-management` package. It is the key agent store for Pallad and it offers a robust set of functionalities to manage key agents securely in memory.
+This TypeScript module provides a state management store for cryptographic key agents using Zustand, Immer, and the `@palladco/key-management` package. It is the key agent store for Pallad and it offers a robust set of functionalities to manage key agents securely in memory.
## Key Files
- `key-agent-store.ts`: Contains the core logic for the Zustand store slice managing the state of key agents.
@@ -35,4 +35,4 @@ useStore.getState().initialiseKeyAgent("myKeyAgent", KeyAgents.InMemory, {
mnemonicWords,
getPassphrase: async () => "yourSecurePassphrase"
});
-```
\ No newline at end of file
+```
diff --git a/packages/vault/src/keyAgent/keyAgentState.ts b/packages/vault/src/keyAgent/keyAgentState.ts
index 19a06062..bdaa50be 100644
--- a/packages/vault/src/keyAgent/keyAgentState.ts
+++ b/packages/vault/src/keyAgent/keyAgentState.ts
@@ -12,7 +12,7 @@ import type {
GroupedCredentials,
InMemoryKeyAgent,
SerializableInMemoryKeyAgentData,
-} from "@palladxyz/key-management"
+} from "@palladco/key-management"
export type KeyAgentName = string
export enum KeyAgents {
diff --git a/packages/vault/src/keyAgent/keyAgentStore.ts b/packages/vault/src/keyAgent/keyAgentStore.ts
index cf9f9020..04e17f3f 100644
--- a/packages/vault/src/keyAgent/keyAgentStore.ts
+++ b/packages/vault/src/keyAgent/keyAgentStore.ts
@@ -1,7 +1,7 @@
import {
type FromBip39MnemonicWordsProps,
InMemoryKeyAgent,
-} from "@palladxyz/key-management"
+} from "@palladco/key-management"
import { produce } from "immer"
import type { StateCreator } from "zustand"
diff --git a/packages/vault/src/lib/utils.ts b/packages/vault/src/lib/utils.ts
index 8d56f53d..9c0ac276 100644
--- a/packages/vault/src/lib/utils.ts
+++ b/packages/vault/src/lib/utils.ts
@@ -1,4 +1,4 @@
-import type { CredentialName } from "@palladxyz/vault"
+import type { CredentialName } from "@palladco/vault"
import {
type Config,
adjectives,
diff --git a/packages/vault/src/network-info/default.ts b/packages/vault/src/network-info/default.ts
index aa22698a..162b72d5 100644
--- a/packages/vault/src/network-info/default.ts
+++ b/packages/vault/src/network-info/default.ts
@@ -1,4 +1,4 @@
-import type { ProviderConfig } from "@palladxyz/providers"
+import type { ProviderConfig } from "@palladco/providers"
import type { NetworkId } from "./network-info-state"
diff --git a/packages/vault/src/network-info/network-info-state.ts b/packages/vault/src/network-info/network-info-state.ts
index 46ae8293..ab698d79 100644
--- a/packages/vault/src/network-info/network-info-state.ts
+++ b/packages/vault/src/network-info/network-info-state.ts
@@ -3,7 +3,7 @@
* @typedef {Object} NetworkInfoStore
*/
-import type { ProviderConfig } from "@palladxyz/providers"
+import type { ProviderConfig } from "@palladco/providers"
export type NetworkId = string
diff --git a/packages/vault/src/objects/default.ts b/packages/vault/src/objects/default.ts
deleted file mode 100644
index b1ae1737..00000000
--- a/packages/vault/src/objects/default.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-export const EXAMPLE_CREDENTIAL_NAME = "Example Pallad Credential"
-export const EXAMPLE_CREDENTIAL = {
- "@context": ["https://www.w3.org/2018/credentials/v1"],
- id: "http://example.edu/credentials/3732",
- type: ["VerifiableCredential", "UniversityDegreeCredential"],
- issuer: "University of Example",
- issuanceDate: "2010-01-01T00:00:00Z",
- credentialSubject: {
- id: "did:mina:B62qjsV6WQwTeEWrNrRRBP6VaaLvQhwWTnFi4WP4LQjGvpfZEumXzxb",
- degree: {
- type: "BachelorDegree",
- name: "Bachelor of Science and Arts",
- },
- },
- proof: {
- type: "Kimchi",
- created: "2023-09-19T12:40:16Z",
- proof: {
- publicInput: ["0"],
- publicOutput: ["1"],
- maxProofsVerified: 0,
- proof: "KChzdGF0ZW1...SkpKSkp",
- },
- },
-}
-
-export const DEFAULT_OBJECTS = {
- [EXAMPLE_CREDENTIAL_NAME]: {
- objectName: EXAMPLE_CREDENTIAL_NAME,
- object: EXAMPLE_CREDENTIAL,
- },
-}
diff --git a/packages/vault/src/objects/index.ts b/packages/vault/src/objects/index.ts
index 977ec058..d1208f8c 100644
--- a/packages/vault/src/objects/index.ts
+++ b/packages/vault/src/objects/index.ts
@@ -1,3 +1,2 @@
-export * from "./default"
export * from "./objectsState"
export * from "./objectsStore"
diff --git a/packages/vault/src/objects/objectsState.ts b/packages/vault/src/objects/objectsState.ts
index e07bd906..fde7943f 100644
--- a/packages/vault/src/objects/objectsState.ts
+++ b/packages/vault/src/objects/objectsState.ts
@@ -1,31 +1,24 @@
-/**
- * @file Represents the state definitions related to objects (for example issued credentials).
- */
import type { Json } from "@mina-js/utils"
import type { SearchQuery } from "../utils/utils"
-export type ObjectName = string
+export type CredentialId = string
export type StoredObject = undefined | object
-/**
- * Constant representing the initial object state
- * @typedef {Object}
- */
export const initialObjectState: Json = {
- objectName: "",
- object: {},
+ credentialId: "",
+ credential: {},
}
-export type ObjectsStore = Record
-/**
- * Type representing the store's state and actions combined.
- * @typedef {Object} ObjectStore
- */
+export type ObjectsStore = Record
+
export type ObjectStore = {
objects: ObjectsStore
- ensureObject: (objectName: ObjectName) => void
- setObject: (objectState: Json) => void
- getObject: (objectName: ObjectName) => Json | typeof initialObjectState
- removeObject: (name: ObjectName) => void
- searchObjects(query: SearchQuery, props?: string[]): StoredObject[]
+ ensureObject: (credentialId: CredentialId) => void
+ setObject: (props: { credentialId: CredentialId; credential: Json }) => void
+ getObject: (credentialId: CredentialId) => Json | typeof initialObjectState
+ removeObject: (credentialId: CredentialId) => void
+ searchObjects(props: {
+ query: SearchQuery
+ props: string[] | undefined
+ }): StoredObject[]
clearObjects: () => void
}
diff --git a/packages/vault/src/objects/objectsStore.ts b/packages/vault/src/objects/objectsStore.ts
index e155d289..12c9cdfa 100644
--- a/packages/vault/src/objects/objectsStore.ts
+++ b/packages/vault/src/objects/objectsStore.ts
@@ -2,56 +2,52 @@ import { produce } from "immer"
import { type StateCreator, create } from "zustand"
import { matchesQuery } from "../utils/utils"
-import { DEFAULT_OBJECTS } from "./default"
import { type ObjectStore, initialObjectState } from "./objectsState"
export const objectSlice: StateCreator = (set, get) => ({
- objects: DEFAULT_OBJECTS,
- ensureObject: (objectName) => {
+ objects: {},
+ ensureObject: (credentialId) => {
set(
produce((draft) => {
- draft.objects[objectName] = draft.objects[objectName] || {
+ draft.objects[credentialId] = draft.objects[credentialId] || {
...(initialObjectState as object),
- objectName,
+ credentialId,
}
}),
)
},
- setObject: (objectState: any) => {
- const { objectName } = objectState
+ setObject: ({ credentialId, credential }) => {
set((current) =>
produce(current, (draft: any) => {
- draft.objects[objectName] = {
- ...draft.objects[objectName],
- ...objectState,
+ draft.objects[credentialId] = {
+ ...draft.objects[credentialId],
+ ...(credential as object),
}
}),
)
},
- getObject: (objectName) => {
+ getObject: (credentialId) => {
const { objects } = get()
- return objects[objectName] || initialObjectState
+ return objects[credentialId] || initialObjectState
},
- removeObject: (objectName) => {
+ removeObject: (credentialId) => {
set(
produce((draft) => {
- delete draft.objects[objectName]
+ delete draft.objects[credentialId]
}),
)
},
- searchObjects: (query, props) => {
- // TODO: improve
+ searchObjects: ({ query, props }) => {
const { objects } = get()
const objectsStatesArray = Object.values(objects)
- const objectsArray = objectsStatesArray.map((obj: any) => obj?.object)
- const filteredObjects = objectsArray.filter((object) => {
+ const filteredObjects = objectsStatesArray.filter((object) => {
if (!object) {
return false
}
return matchesQuery(object, query)
})
if (props?.length) {
- const arrayOfArrays = filteredObjects.map((objects) => {
+ const arrayOfArrays = filteredObjects.map((objects: any) => {
return props
.filter((prop) => objects && prop in objects)
.map((prop) => (objects as unknown as Record)[prop])
@@ -63,7 +59,7 @@ export const objectSlice: StateCreator = (set, get) => ({
clearObjects: () => {
set(
produce((draft) => {
- draft.objects = DEFAULT_OBJECTS
+ draft.objects = {}
}),
)
},
diff --git a/packages/vault/src/vault/utils/get-wallet-account-info.ts b/packages/vault/src/vault/utils/get-wallet-account-info.ts
index d767edf9..684c8fc7 100644
--- a/packages/vault/src/vault/utils/get-wallet-account-info.ts
+++ b/packages/vault/src/vault/utils/get-wallet-account-info.ts
@@ -1,5 +1,5 @@
-import type { GroupedCredentials } from "@palladxyz/key-management"
-import type { Network } from "@palladxyz/pallad-core"
+import type { GroupedCredentials } from "@palladco/key-management"
+import type { Network } from "@palladco/pallad-core"
import type { SingleCredentialState } from "../../credentials"
import { NetworkError, WalletError } from "../../lib/Errors"
diff --git a/packages/vault/src/vault/utils/get-wallet-transactions.ts b/packages/vault/src/vault/utils/get-wallet-transactions.ts
index 6b2c737c..de25fc9f 100644
--- a/packages/vault/src/vault/utils/get-wallet-transactions.ts
+++ b/packages/vault/src/vault/utils/get-wallet-transactions.ts
@@ -1,4 +1,4 @@
-import type { GroupedCredentials } from "@palladxyz/key-management"
+import type { GroupedCredentials } from "@palladco/key-management"
import { AddressError, NetworkError, WalletError } from "../../lib/Errors"
diff --git a/packages/vault/src/vault/utils/restore-wallet.ts b/packages/vault/src/vault/utils/restore-wallet.ts
index adbf0f9a..0b973a90 100644
--- a/packages/vault/src/vault/utils/restore-wallet.ts
+++ b/packages/vault/src/vault/utils/restore-wallet.ts
@@ -1,8 +1,8 @@
import type {
ChainDerivationArgs,
FromBip39MnemonicWordsProps,
-} from "@palladxyz/key-management"
-import { createChainProvider } from "@palladxyz/providers"
+} from "@palladco/key-management"
+import { createChainProvider } from "@palladco/providers"
import type { CredentialName, SingleCredentialState } from "../../credentials"
import type { KeyAgentName, KeyAgents } from "../../keyAgent"
diff --git a/packages/vault/src/vault/utils/sign.ts b/packages/vault/src/vault/utils/sign.ts
index 18614f30..87d92437 100644
--- a/packages/vault/src/vault/utils/sign.ts
+++ b/packages/vault/src/vault/utils/sign.ts
@@ -4,7 +4,7 @@ import type {
GetPassphrase,
GroupedCredentials,
InMemoryKeyAgent,
-} from "@palladxyz/key-management"
+} from "@palladco/key-management"
import { WalletError } from "../../lib/Errors"
diff --git a/packages/vault/src/vault/utils/sync-account-info.ts b/packages/vault/src/vault/utils/sync-account-info.ts
index ce566353..6a5c358c 100644
--- a/packages/vault/src/vault/utils/sync-account-info.ts
+++ b/packages/vault/src/vault/utils/sync-account-info.ts
@@ -1,4 +1,4 @@
-import { type ProviderConfig, createChainProvider } from "@palladxyz/providers"
+import { type ProviderConfig, createChainProvider } from "@palladco/providers"
export async function syncAccountHelper(
get: any,
diff --git a/packages/vault/src/vault/utils/sync-transactions.ts b/packages/vault/src/vault/utils/sync-transactions.ts
index bb83d040..b36ebdee 100644
--- a/packages/vault/src/vault/utils/sync-transactions.ts
+++ b/packages/vault/src/vault/utils/sync-transactions.ts
@@ -1,5 +1,5 @@
-import type { Tx } from "@palladxyz/pallad-core"
-import { type ProviderConfig, createChainProvider } from "@palladxyz/providers"
+import type { Tx } from "@palladco/pallad-core"
+import { type ProviderConfig, createChainProvider } from "@palladco/providers"
export async function syncTransactionHelper(
get: any,
diff --git a/packages/vault/src/vault/utils/sync-wallet.ts b/packages/vault/src/vault/utils/sync-wallet.ts
index 2e2cf83f..ce279d6d 100644
--- a/packages/vault/src/vault/utils/sync-wallet.ts
+++ b/packages/vault/src/vault/utils/sync-wallet.ts
@@ -1,5 +1,5 @@
-import { createChainProvider } from "@palladxyz/providers"
-import type { ProviderConfig } from "@palladxyz/providers"
+import { createChainProvider } from "@palladco/providers"
+import type { ProviderConfig } from "@palladco/providers"
import { AddressError } from "../../lib/Errors"
diff --git a/packages/vault/src/vault/vaultState.ts b/packages/vault/src/vault/vaultState.ts
index fb9c4fb6..8002dbe0 100644
--- a/packages/vault/src/vault/vaultState.ts
+++ b/packages/vault/src/vault/vaultState.ts
@@ -4,15 +4,15 @@ import type {
ChainOperationArgs,
ChainSignablePayload,
FromBip39MnemonicWordsProps,
-} from "@palladxyz/key-management"
-import type { GetPassphrase } from "@palladxyz/key-management"
+} from "@palladco/key-management"
+import type { GetPassphrase } from "@palladco/key-management"
import type {
AccountInfo,
Network,
SubmitTxArgs,
Tx,
-} from "@palladxyz/pallad-core"
-import type { ProviderConfig } from "@palladxyz/providers"
+} from "@palladco/pallad-core"
+import type { ProviderConfig } from "@palladco/providers"
import type { TransactionBody } from "@mina-js/utils"
import type {
diff --git a/packages/vault/src/vault/vaultStore.ts b/packages/vault/src/vault/vaultStore.ts
index b244de2a..b37a1a06 100644
--- a/packages/vault/src/vault/vaultStore.ts
+++ b/packages/vault/src/vault/vaultStore.ts
@@ -1,5 +1,5 @@
-import { generateMnemonicWords } from "@palladxyz/key-management"
-import { Network } from "@palladxyz/pallad-core"
+import { generateMnemonicWords } from "@palladco/key-management"
+import { Network } from "@palladco/pallad-core"
import { produce } from "immer"
import { create } from "zustand"
import { createJSONStorage, persist } from "zustand/middleware"
diff --git a/packages/vault/test/account/accountStore.test.ts b/packages/vault/test/account/accountStore.test.ts
index ba373509..cbba9b43 100644
--- a/packages/vault/test/account/accountStore.test.ts
+++ b/packages/vault/test/account/accountStore.test.ts
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it } from "bun:test"
-import { type AccountInfo, Mina } from "@palladxyz/mina-core"
+import { type AccountInfo, Mina } from "@palladco/mina-core"
import { act, renderHook } from "@testing-library/react"
import { initialSingleAccountState } from "../../src"
diff --git a/packages/vault/test/credentials/credentialsStore.test.ts b/packages/vault/test/credentials/credentialsStore.test.ts
index f52b5068..74edbdba 100644
--- a/packages/vault/test/credentials/credentialsStore.test.ts
+++ b/packages/vault/test/credentials/credentialsStore.test.ts
@@ -1,6 +1,6 @@
import { beforeEach, describe, expect, it } from "bun:test"
-import type { GroupedCredentials } from "@palladxyz/key-management"
-import { Network } from "@palladxyz/pallad-core"
+import type { GroupedCredentials } from "@palladco/key-management"
+import { Network } from "@palladco/pallad-core"
import { act, renderHook } from "@testing-library/react"
import {
diff --git a/packages/vault/test/keyAgent/keyAgentStore.test.ts b/packages/vault/test/keyAgent/keyAgentStore.test.ts
index 63aea268..8b4350d0 100644
--- a/packages/vault/test/keyAgent/keyAgentStore.test.ts
+++ b/packages/vault/test/keyAgent/keyAgentStore.test.ts
@@ -1,15 +1,15 @@
import { afterEach, beforeEach, describe, expect, it } from "bun:test"
import { utf8ToBytes } from "@noble/hashes/utils"
-import { mnemonic } from "@palladxyz/common"
+import { mnemonic } from "@palladco/common"
import {
type ChainOperationArgs,
type FromBip39MnemonicWordsProps,
type GroupedCredentials,
type MinaDerivationArgs,
generateMnemonicWords,
-} from "@palladxyz/key-management"
-import type { Mina } from "@palladxyz/mina-core"
-import { Network } from "@palladxyz/pallad-core"
+} from "@palladco/key-management"
+import type { Mina } from "@palladco/mina-core"
+import { Network } from "@palladco/pallad-core"
import { act, renderHook } from "@testing-library/react"
import { KeyAgents } from "../../src"
diff --git a/packages/vault/test/objects/objectsStore.test.ts b/packages/vault/test/objects/objectsStore.test.ts
deleted file mode 100644
index 3972cc41..00000000
--- a/packages/vault/test/objects/objectsStore.test.ts
+++ /dev/null
@@ -1,115 +0,0 @@
-import { beforeEach, describe, expect, it } from "bun:test"
-import type { GroupedCredentials } from "@palladxyz/key-management"
-import { Network } from "@palladxyz/pallad-core"
-import { act, renderHook } from "@testing-library/react"
-
-import type { Json } from "@mina-js/utils"
-import {
- DEFAULT_OBJECTS,
- type ObjectName,
- type StoredObject,
- useVault,
-} from "../../src"
-
-describe("ObjectStore", () => {
- let object: GroupedCredentials
- let objectName: ObjectName
- let objectState: Json
- let objectStateTwo: Json
- let objectTwo: object
-
- beforeEach(() => {
- object = {
- "@context": ["https://w3id.org/wallet/v1"],
- id: "did:mina:B62qjsV6WQwTeEWrNrRRBP6VaaLvQhwWTnFi4WP4LQjGvpfZEumXzxb",
- type: "MinaAddress",
- controller:
- "did:mina:B62qjsV6WQwTeEWrNrRRBP6VaaLvQhwWTnFi4WP4LQjGvpfZEumXzxb",
- name: "Mina Account",
- description: "My Mina account.",
- chain: Network.Mina,
- accountIndex: 0,
- addressIndex: 0,
- address: "B62qjsV6WQwTeEWrNrRRBP6VaaLvQhwWTnFi4WP4LQjGvpfZEumXzxb",
- encryptedPrivateKeyBytes: new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7]),
- }
- objectTwo = {
- "@context": ["https://www.w3.org/2018/credentials/v1"],
- id: "http://example.edu/credentials/3732",
- type: ["VerifiableCredential", "UniversityDegreeCredential"],
- issuer: "University of Example",
- issuanceDate: "2010-01-01T00:00:00Z",
- credentialSubject: {
- id: "did:mina:B62qjsV6WQwTeEWrNrRRBP6VaaLvQhwWTnFi4WP4LQjGvpfZEumXzxb",
- degree: {
- type: "BachelorDegree",
- name: "Bachelor of Science and Arts",
- },
- },
- proof: {
- type: "Kimchi",
- created: "2023-09-19T12:40:16Z",
- proof: {
- publicInput: ["0"],
- publicOutput: ["1"],
- maxProofsVerified: 0,
- proof: "KChzdGF0ZW1...SkpKSkp",
- },
- },
- }
-
- objectName = "credentialName"
- objectState = {
- objectName: objectName,
- object: object as StoredObject,
- }
-
- objectStateTwo = {
- objectName: "green crocodile credential",
- object: objectTwo as StoredObject,
- }
- const { result } = renderHook(() => useVault())
- act(() => result.current.clearObjects())
- })
-
- it("should create an objects store", () => {
- const { result } = renderHook(() => useVault())
- expect(result.current.objects).toEqual(DEFAULT_OBJECTS)
- })
-
- it("should add one object and remove one from store", () => {
- let storedObject
- const { result } = renderHook(() => useVault())
- act(() => {
- result.current.setObject(objectState)
- storedObject = result.current.getObject(objectName)
- })
- expect(storedObject?.object).toEqual(object)
- act(() => {
- result.current.removeObject(objectName)
- storedObject = result.current.getObject(objectName)
- })
- // check that object is removed
- expect(storedObject.object).toEqual({})
- })
- it("should add two objects and search for Mina addresses and return them as an array not as a credential object", () => {
- let storedObjects: StoredObject[] | undefined
- // search for first credential
- const searchQuery = {
- type: "MinaAddress",
- chain: Network.Mina,
- }
- // return props
- const props = ["address"]
- const { result } = renderHook(() => useVault())
- act(() => {
- // add first credential
- result.current.setObject(objectState)
- // add second credential
- result.current.setObject(objectStateTwo)
- storedObjects = result.current.searchObjects(searchQuery, props)
- })
- expect(storedObjects).toBeDefined()
- expect(storedObjects?.length).toEqual(1)
- })
-})
diff --git a/packages/vault/test/wallet/walletFlow.test.ts b/packages/vault/test/wallet/walletFlow.test.ts
index 08556692..f53229e2 100644
--- a/packages/vault/test/wallet/walletFlow.test.ts
+++ b/packages/vault/test/wallet/walletFlow.test.ts
@@ -1,17 +1,16 @@
import { beforeEach, describe, expect, it } from "bun:test"
import { utf8ToBytes } from "@noble/hashes/utils"
-import { mnemonic } from "@palladxyz/common"
+import { mnemonic } from "@palladco/common"
import type {
ChainDerivationArgs,
FromBip39MnemonicWordsProps,
-} from "@palladxyz/key-management"
-import { Network } from "@palladxyz/pallad-core"
+} from "@palladco/key-management"
+import { Network } from "@palladco/pallad-core"
import { act, renderHook } from "@testing-library/react"
import { type CredentialName, KeyAgents } from "../../src"
import { useVault } from "../../src"
import { DEFAULT_NETWORK } from "../../src/network-info/default"
-import { EXAMPLE_CREDENTIAL } from "../../src/objects/default"
const PREGENERATED_MNEMONIC = mnemonic
@@ -96,15 +95,15 @@ describe.skip("WalletTest", () => {
expect(accountInfo).toBeDefined()
act(() => {
result.current.setObject({
- objectName: "example credential",
- object: EXAMPLE_CREDENTIAL,
+ credentialId: "0",
+ credential: { test: true },
})
})
- const allObjects = result.current.searchObjects(
- { issuer: "University of Example" },
- [],
- )
+ const allObjects = result.current.searchObjects({
+ query: { issuer: "University of Example" },
+ props: [],
+ })
expect(allObjects.length).toEqual(2)
// get keyAgentName
const currentKeyAgentName = result.current.keyAgentName
diff --git a/packages/vault/tsconfig.json b/packages/vault/tsconfig.json
index 83805819..e0cdff40 100644
--- a/packages/vault/tsconfig.json
+++ b/packages/vault/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "@palladxyz/common/tsconfig.json",
+ "extends": "@palladco/common/tsconfig.json",
"compilerOptions": {
"target": "esnext",
"module": "esnext",
diff --git a/packages/vault/tsup.config.ts b/packages/vault/tsup.config.ts
index 639c8868..6a7ed6fa 100644
--- a/packages/vault/tsup.config.ts
+++ b/packages/vault/tsup.config.ts
@@ -1,4 +1,4 @@
-import { baseTsupConfig } from "@palladxyz/common"
+import { baseTsupConfig } from "@palladco/common"
import { defineConfig } from "tsup"
import packageJson from "./package.json"
diff --git a/packages/web-provider/README.md b/packages/web-provider/README.md
index 6ae83cf2..d4763389 100644
--- a/packages/web-provider/README.md
+++ b/packages/web-provider/README.md
@@ -1,4 +1,4 @@
-# @palladxyz/web-extension
+# @palladco/web-extension
🚧 This package is a WIP & implementation of RFC-0008/-0009 🚧
@@ -8,7 +8,7 @@ This is a typescript package that allows applications to interact with the walle
## Implementation & Testing
-For implementation of this package, you should investigate the `apps/extension` folder. In there you can view the background script, the injected script, and the content script together allow Pallad to interact with applications. See the e2e tests for a good test suite of this provider's implementation.
+For implementation of this package, you should investigate the `apps/extension` folder. In there you can view the background script, the injected script, and the content script together allow Pallad to interact with applications. See the e2e tests for a good test suite of this provider's implementation.
## Current Design
diff --git a/packages/web-provider/package.json b/packages/web-provider/package.json
index 0cd9d7e6..435de646 100644
--- a/packages/web-provider/package.json
+++ b/packages/web-provider/package.json
@@ -1,5 +1,5 @@
{
- "name": "@palladxyz/web-provider",
+ "name": "@palladco/web-provider",
"version": "0.0.1",
"type": "module",
"description": "A web-provider for Mina wallets",
@@ -17,27 +17,21 @@
"cleanup": "bunx --bun rimraf node_modules dist .turbo"
},
"dependencies": {
- "@mina-js/klesia-sdk": "https://pkg.pr.new/palladians/mina-js/@mina-js/klesia-sdk@a51d3b4",
- "@mina-js/providers": "https://pkg.pr.new/palladians/mina-js/@mina-js/providers@a51d3b4",
+ "@mina-js/klesia-sdk": "https://pkg.pr.new/palladians/mina-js/@mina-js/klesia-sdk@261950d",
+ "@mina-js/providers": "https://pkg.pr.new/palladians/mina-js/@mina-js/providers@3",
"@noble/hashes": "1.4.0",
- "@palladxyz/key-management": "workspace:*",
- "@palladxyz/mina-core": "workspace:*",
- "@palladxyz/providers": "workspace:*",
- "@palladxyz/vault": "workspace:*",
+ "@palladco/key-management": "workspace:*",
+ "@palladco/mina-core": "workspace:*",
+ "@palladco/providers": "workspace:*",
+ "@palladco/vault": "workspace:*",
"dayjs": "1.11.12",
- "eventemitter3": "5.0.1",
"mina-signer": "3.0.7",
"mitt": "3.0.1",
- "superjson": "2.2.1",
"ts-pattern": "5.5.0",
- "webext-bridge": "6.0.1",
- "webextension-polyfill": "0.12.0",
"zod": "3.23.8"
},
"devDependencies": {
- "@palladxyz/common": "workspace:*",
- "@types/chrome": "0.0.269",
- "@types/webextension-polyfill": "0.10.7",
- "type-fest": "4.23.0"
+ "@palladco/common": "workspace:*",
+ "@types/chrome": "0.0.269"
}
}
diff --git a/packages/web-provider/src/mina-network/index.ts b/packages/web-provider/src/mina-network/index.ts
index 1ec944f0..e21c529b 100644
--- a/packages/web-provider/src/mina-network/index.ts
+++ b/packages/web-provider/src/mina-network/index.ts
@@ -1,2 +1,3 @@
export * from "./mina-provider"
+export * from "./utils"
export * as Validation from "./validation"
diff --git a/packages/web-provider/src/mina-network/mina-provider.ts b/packages/web-provider/src/mina-network/mina-provider.ts
index 9a72729d..e52ac182 100644
--- a/packages/web-provider/src/mina-network/mina-provider.ts
+++ b/packages/web-provider/src/mina-network/mina-provider.ts
@@ -12,14 +12,14 @@ import { utf8ToBytes } from "@noble/hashes/utils"
import type {
ChainOperationArgs,
ChainSignablePayload,
-} from "@palladxyz/key-management"
-import type { SearchQuery } from "@palladxyz/vault"
+} from "@palladco/key-management"
+import type { SearchQuery, StoredObject } from "@palladco/vault"
import mitt from "mitt"
import { P, match } from "ts-pattern"
import { showUserPrompt } from "../utils/prompts"
import { createVaultService } from "../vault-service"
import type { ConnectOps } from "../web-provider-types"
-import { serializeField, serializeGroup } from "./utils"
+import { createCredentialHash, serializeField, serializeGroup } from "./utils"
export function getMinaChainId(chains: string[]) {
return Number(chains[0]?.split(":")[1])
@@ -43,7 +43,7 @@ export const createMinaProvider = async (): Promise<
const _emitter = mitt()
const _vault = createVaultService()
const unlockWallet = async () => {
- const passphrase = await showUserPrompt({
+ const { value: passphrase } = await showUserPrompt({
inputType: "password",
metadata: {
title: "Unlock your wallet",
@@ -51,6 +51,7 @@ export const createMinaProvider = async (): Promise<
rejectButtonLabel: "Cancel",
},
})
+
if (passphrase === null) throw createProviderRpcError(4100, "Unauthorized")
await _vault.unlockWallet(passphrase)
}
@@ -105,7 +106,7 @@ export const createMinaProvider = async (): Promise<
utf8ToBytes(passphrase),
)) as T
} catch (error) {
- throw createProviderRpcError(4100, "Unauthorized")
+ throw createProviderRpcError(4100, "Unauthorized: signPayload")
}
}
return {
@@ -117,14 +118,14 @@ export const createMinaProvider = async (): Promise<
const { context } = typedArgs
const { origin } = context as Record
if (!origin) {
- throw createProviderRpcError(4100, "Unauthorized")
+ throw createProviderRpcError(4100, "Unauthorized: origin")
}
if (await _vault.isBlocked({ origin })) {
- throw createProviderRpcError(4100, "Unauthorized")
+ throw createProviderRpcError(4100, "Unauthorized: isBlocked")
}
const initialized = await verifyInitialized()
if (!initialized) {
- throw createProviderRpcError(4100, "Unauthorized")
+ throw createProviderRpcError(4100, "Unauthorized: initialized")
}
const locked = await _vault.isLocked()
const enabled = await _vault.getEnabled({ origin })
@@ -152,7 +153,7 @@ export const createMinaProvider = async (): Promise<
if (!networkIds.includes(networkId)) {
throw createProviderRpcError(4100, "Unauthorized.")
}
- const userConfirmed = await showUserPrompt({
+ const { value: userConfirmed } = await showUserPrompt({
inputType: "confirmation",
metadata: {
title: "Switch to different chain.",
@@ -166,7 +167,7 @@ export const createMinaProvider = async (): Promise<
return networkId
})
.with({ method: "mina_requestNetwork" }, async () => {
- const userConfirmed = await showUserPrompt({
+ const { value: userConfirmed } = await showUserPrompt({
inputType: "confirmation",
metadata: {
title: "Request to current Mina network information.",
@@ -181,7 +182,7 @@ export const createMinaProvider = async (): Promise<
.with(
{ method: P.union("mina_sign", "mina_signTransaction") },
async (signatureRequest) => {
- const passphrase = await showUserPrompt({
+ const { value: passphrase } = await showUserPrompt({
inputType: "password",
metadata: {
title: "Signature request",
@@ -227,7 +228,7 @@ export const createMinaProvider = async (): Promise<
.with(
{ method: P.union("mina_createNullifier", "mina_signFields") },
async (signatureRequest) => {
- const passphrase = await showUserPrompt({
+ const { value: passphrase } = await showUserPrompt({
inputType: "password",
metadata: {
title: "Signature request",
@@ -261,11 +262,11 @@ export const createMinaProvider = async (): Promise<
return item
},
)
- const seriliasedResponse = {
+ const serializedResponse = {
...signedResponse,
data: serializedResponseData,
}
- return seriliasedResponse
+ return serializedResponse
})
.with({ method: "mina_createNullifier" }, async ({ params }) => {
const [message] = params
@@ -297,13 +298,58 @@ export const createMinaProvider = async (): Promise<
.exhaustive()
},
)
+ .with(
+ { method: "mina_signFieldsWithPassphrase" },
+ async ({ params }) => {
+ const [fieldsAndPassphrase] = params
+ if (
+ !fieldsAndPassphrase ||
+ !fieldsAndPassphrase.fields ||
+ !fieldsAndPassphrase.fields.length ||
+ !fieldsAndPassphrase.passphrase
+ ) {
+ throw createProviderRpcError(
+ 4100,
+ `Unauthorized. fieldsAndPassphrase: ${JSON.stringify(fieldsAndPassphrase)}`,
+ )
+ }
+ const { fields, passphrase } = fieldsAndPassphrase
+
+ const operationArgs: ChainOperationArgs = {
+ operation: args.method,
+ network: "Mina",
+ }
+
+ const signedResponse = await signPayload({
+ signable: {
+ fields: fields.map((item: any) => BigInt(item)),
+ },
+ operationArgs,
+ passphrase,
+ })
+
+ const serializedResponseData = signedResponse.data.map((item) => {
+ if (typeof item === "bigint") {
+ return String(item)
+ }
+ return item
+ })
+
+ const seriliasedResponse = {
+ ...signedResponse,
+ data: serializedResponseData,
+ }
+
+ return seriliasedResponse
+ },
+ )
.with({ method: "mina_getState" }, async ({ params }) => {
const [query, props] = params
const credentials = await _vault.getState(
query as SearchQuery,
props as string[],
)
- const confirmation = await showUserPrompt({
+ const { value: confirmation } = await showUserPrompt({
inputType: "confirmation",
metadata: {
title: "Credential read request",
@@ -316,25 +362,200 @@ export const createMinaProvider = async (): Promise<
return credentials
})
.with({ method: "mina_setState" }, async ({ params }) => {
- const payload = params?.[0]
- if (!payload) throw createProviderRpcError(4000, "Invalid Request")
- const confirmation = await showUserPrompt({
+ const [credential] = params
+ if (!credential) throw createProviderRpcError(4000, "Invalid Request")
+ const { value: confirmation } = await showUserPrompt({
inputType: "confirmation",
metadata: {
title: "Credential write request",
- payload: JSON.stringify(payload),
+ payload: JSON.stringify(credential),
},
})
if (!confirmation) {
throw createProviderRpcError(4001, "User Rejected Request")
}
- await _vault.setState(payload)
+ const { id } = credential as { id: string }
+ await _vault.setState({ credentialId: id, credential })
return { success: true }
})
+ .with({ method: "mina_storePrivateCredential" }, async ({ params }) => {
+ const [credential] = params
+ if (!credential) throw createProviderRpcError(4000, "Invalid Request")
+
+ const stringifiedCredential = JSON.stringify(credential)
+
+ let credentialToStore
+
+ try {
+ const credentialWitnessType = credential.witness.type
+ if (credentialWitnessType === "unsigned") {
+ const { value: userConfirmed } = await showUserPrompt({
+ inputType: "confirmation",
+ metadata: {
+ title: "Store Private Credential",
+ payload: stringifiedCredential,
+ },
+ })
+
+ if (!userConfirmed) {
+ throw createProviderRpcError(4001, "User Rejected Request")
+ }
+
+ credentialToStore = stringifiedCredential
+ } else {
+ // prompt user to approve incoming credential and validate if approved
+ const { value: userConfirmed, result } =
+ await showUserPrompt({
+ inputType: "confirmation",
+ contract: "validate-credential",
+ metadata: {
+ title: "Store Private Credential",
+ payload: stringifiedCredential,
+ },
+ })
+
+ if (!userConfirmed) {
+ throw createProviderRpcError(4001, "User Rejected Request")
+ }
+
+ if (result?.error) {
+ throw createProviderRpcError(
+ 4100,
+ `Credential validation failed: ${JSON.stringify(result.error)}`,
+ )
+ }
+
+ if (!result?.result) {
+ throw createProviderRpcError(4100, "Missing validation result")
+ }
+
+ credentialToStore = result.result
+ }
+
+ // Generate hash of the new credential
+ const newCredentialHash = createCredentialHash(credential)
+
+ // Get existing credentials and check for duplicates
+ const existingCredentials = await _vault.getPrivateCredential()
+ const isDuplicate = existingCredentials.some((existing) => {
+ const existingHash = createCredentialHash(existing)
+ return existingHash === newCredentialHash
+ })
+
+ if (isDuplicate) {
+ throw createProviderRpcError(4100, "Credential already stored")
+ }
+
+ try {
+ const parsedResult = JSON.parse(credentialToStore)
+ await _vault.storePrivateCredential(parsedResult)
+ return { success: parsedResult }
+ } catch (error: any) {
+ throw createProviderRpcError(
+ 4100,
+ `Failed to store private credential: ${error}`,
+ )
+ }
+ } catch (error: any) {
+ throw createProviderRpcError(
+ 4100,
+ error.message || "Failed to validate credential",
+ )
+ }
+ })
+ .with({ method: "mina_requestPresentation" }, async ({ params }) => {
+ try {
+ const [request] = params
+ if (!request) throw createProviderRpcError(4000, "Invalid Request")
+
+ const { presentationRequest, zkAppAccount } = request
+
+ const verifierIdentity =
+ presentationRequest.type === "zk-app" ? zkAppAccount : origin
+
+ // Ask for approval to proceed with the presentation request
+ const { value: userConfirmed } = await showUserPrompt({
+ inputType: "confirmation",
+ metadata: {
+ title: "Presentation request",
+ payload: JSON.stringify({
+ origin,
+ presentationRequest,
+ verifierIdentity: verifierIdentity,
+ }),
+ },
+ })
+
+ if (!userConfirmed) {
+ throw createProviderRpcError(4001, "User Rejected Request")
+ }
+
+ // Get stored credentials that could be used for the presentation
+ const storedCredentials: StoredObject[] =
+ await _vault.getPrivateCredential()
+
+ // Show credential selection prompt
+ const { value: selectedCredentials } = await showUserPrompt(
+ {
+ inputType: "selection",
+ metadata: {
+ title: "Select credentials for presentation",
+ payload: JSON.stringify({
+ presentationRequest,
+ storedCredentials,
+ }),
+ submitButtonLabel: "Continue",
+ rejectButtonLabel: "Cancel",
+ },
+ },
+ )
+
+ if (!selectedCredentials) {
+ throw createProviderRpcError(
+ 4001,
+ "User Rejected Credential Selection",
+ )
+ }
+
+ const { value: passphrase, result } = await showUserPrompt({
+ inputType: "password",
+ contract: "presentation",
+ metadata: {
+ title: "Create presentation",
+ payload: JSON.stringify({
+ verifierIdentity,
+ presentationRequest,
+ selectedCredentials: JSON.parse(selectedCredentials),
+ }),
+ },
+ })
+
+ if (passphrase === null)
+ throw createProviderRpcError(4100, "Unauthorized.")
+
+ if (result?.error) {
+ throw createProviderRpcError(
+ 4100,
+ `Presentation creation failed: ${JSON.stringify(result.error)}`,
+ )
+ }
+
+ if (!result?.result) {
+ throw createProviderRpcError(4100, "Missing presentation result")
+ }
+
+ return result.result
+ } catch (error: any) {
+ throw createProviderRpcError(
+ 4100,
+ error.message || "Failed to create presentation",
+ )
+ }
+ })
.with({ method: "mina_sendTransaction" }, async ({ params }) => {
const [payload] = params
if (!payload) throw createProviderRpcError(4000, "Invalid Request")
- const passphrase = await showUserPrompt({
+ const { value: passphrase } = await showUserPrompt({
inputType: "password",
metadata: {
title: "Send transaction request",
diff --git a/packages/web-provider/src/mina-network/utils.ts b/packages/web-provider/src/mina-network/utils.ts
index 28c725b6..1417ba9f 100644
--- a/packages/web-provider/src/mina-network/utils.ts
+++ b/packages/web-provider/src/mina-network/utils.ts
@@ -1,5 +1,7 @@
-import type { MinaSignablePayload } from "@palladxyz/key-management"
-import type { BorrowedTypes } from "@palladxyz/mina-core"
+import { sha256 } from "@noble/hashes/sha256"
+import { utf8ToBytes } from "@noble/hashes/utils"
+import type { MinaSignablePayload } from "@palladco/key-management"
+import type { BorrowedTypes } from "@palladco/mina-core"
export const serializeField = (field: BorrowedTypes.Field) => {
if (typeof field === "bigint" || typeof field === "number") {
@@ -46,3 +48,15 @@ export const serializeTransaction = (transaction: MinaSignablePayload) => {
const clonedTransaction = JSON.parse(JSON.stringify(transaction))
return serializeObject(clonedTransaction)
}
+
+export const createCredentialHash = (credential: any): string => {
+ // exclude metadata from hash
+ const { metadata: _, ...credentialWithoutMetadata } = credential
+
+ const stableString = JSON.stringify(credentialWithoutMetadata)
+ const bytes = utf8ToBytes(stableString)
+ const hash = sha256(bytes)
+ return Array.from(hash)
+ .map((b) => b.toString(16).padStart(2, "0"))
+ .join("")
+}
diff --git a/packages/web-provider/src/utils/prompts.ts b/packages/web-provider/src/utils/prompts.ts
index 107f30ea..0e23458a 100644
--- a/packages/web-provider/src/utils/prompts.ts
+++ b/packages/web-provider/src/utils/prompts.ts
@@ -1,4 +1,4 @@
-type InputType = "text" | "password" | "confirmation"
+type InputType = "text" | "password" | "confirmation" | "selection"
type Metadata = {
title: string
submitButtonLabel?: string
@@ -6,16 +6,29 @@ type Metadata = {
payload?: string
}
+type ContractResult = {
+ type?: string
+ result?: string
+ error?: any
+}
+
+type PromptResult = {
+ value: T
+ result?: ContractResult
+}
+
export const showUserPrompt = async ({
inputType,
metadata,
+ contract,
emitConnected = false,
}: {
inputType: InputType
metadata: Metadata
+ contract?: string
emitConnected?: boolean
-}): Promise => {
- return new Promise((resolve, reject) => {
+}): Promise> => {
+ return new Promise>((resolve, reject) => {
chrome.windows
.create({
url: "prompt.html",
@@ -32,11 +45,20 @@ export const showUserPrompt = async ({
return reject(new Error("4001 - User Rejected Request"))
}
if (inputType === "confirmation") {
- if (response.userConfirmed) return resolve(true as any)
+ if (response.userConfirmed) {
+ return resolve({
+ value: true as T,
+ result: response.result,
+ })
+ }
return reject(new Error("4001 - User Rejected Request"))
}
- if (response.userInput.length > 0)
- return resolve(response.userInput)
+ if (response.userInput.length > 0) {
+ return resolve({
+ value: response.userInput,
+ result: response.result,
+ })
+ }
return reject(new Error("4100 - Unauthorized"))
}
return reject(new Error("Wrong window context"))
@@ -53,6 +75,7 @@ export const showUserPrompt = async ({
rejectButtonLabel: metadata.rejectButtonLabel,
payload: metadata.payload ?? "{}",
inputType,
+ contract,
emitConnected,
},
})
diff --git a/packages/web-provider/src/vault-service/types.ts b/packages/web-provider/src/vault-service/types.ts
index e7c45d24..1482d579 100644
--- a/packages/web-provider/src/vault-service/types.ts
+++ b/packages/web-provider/src/vault-service/types.ts
@@ -2,11 +2,11 @@ import type {
ChainOperationArgs,
ChainSignablePayload,
GetPassphrase,
-} from "@palladxyz/key-management"
+} from "@palladco/key-management"
import type { Json, Sendable } from "@mina-js/utils"
-import type { ProviderConfig } from "@palladxyz/providers"
-import type { SearchQuery, StoredObject } from "@palladxyz/vault"
+import type { ProviderConfig } from "@palladco/providers"
+import type { SearchQuery, StoredObject } from "@palladco/vault"
export interface IVaultService {
getAccounts(): Promise
@@ -18,7 +18,9 @@ export interface IVaultService {
getBalance(): Promise
getNetworkId(): Promise
getNetworkIds(): Promise
- setState(state: Json): Promise
+ setState(props: { credentialId: string; credential: Json }): Promise
+ storePrivateCredential(state: Json): Promise
+ getPrivateCredential(query?: SearchQuery): Promise
getEnabled({ origin }: { origin: string }): Promise
setEnabled({ origin }: { origin: string }): Promise
switchNetwork(
diff --git a/packages/web-provider/src/vault-service/vault-service.ts b/packages/web-provider/src/vault-service/vault-service.ts
index 13ea006c..d717ea6c 100644
--- a/packages/web-provider/src/vault-service/vault-service.ts
+++ b/packages/web-provider/src/vault-service/vault-service.ts
@@ -1,9 +1,9 @@
import { createClient } from "@mina-js/klesia-sdk"
-import type { ChainOperationArgs } from "@palladxyz/key-management"
-import type { ProviderConfig } from "@palladxyz/providers"
-import { securePersistence, sessionPersistence } from "@palladxyz/vault"
-import { usePendingTransactionStore } from "@palladxyz/vault"
-import { useVault } from "@palladxyz/vault"
+import type { ChainOperationArgs } from "@palladco/key-management"
+import type { ProviderConfig } from "@palladco/providers"
+import { securePersistence, sessionPersistence } from "@palladco/vault"
+import { usePendingTransactionStore } from "@palladco/vault"
+import { useVault } from "@palladco/vault"
import dayjs from "dayjs"
import Client from "mina-signer"
@@ -95,15 +95,38 @@ export const createVaultService = (): IVaultService => {
getState: async (params, props?) => {
await rehydrate()
const store = useVault.getState()
- if (props === undefined) {
- return store.searchObjects(params)
- }
- return store.searchObjects(params, props)
+ return store.searchObjects({ query: params, props })
+ },
+ setState: async ({ credentialId, credential }) => {
+ await rehydrate()
+ const store = useVault.getState()
+ store.setObject({ credentialId, credential })
+ },
+ storePrivateCredential: async (credential) => {
+ await rehydrate()
+ const store = useVault.getState()
+ return store.setObject({
+ credentialId: crypto.randomUUID(),
+ credential: {
+ ...(credential as object),
+ type: "private-credential",
+ },
+ })
},
- setState: async (state) => {
+ getPrivateCredential: async () => {
await rehydrate()
const store = useVault.getState()
- store.setObject(state)
+ const credentials = await store.searchObjects({
+ query: { type: "private-credential" },
+ props: [],
+ })
+
+ // Remove the type field from each credential in the results
+ return credentials.map((credential) => {
+ if (!credential) return credential
+ const { type, ...credentialWithoutType } = credential as any
+ return credentialWithoutType
+ })
},
getEnabled: async ({ origin }) => {
const { permissions } = await chrome.storage.local.get({
diff --git a/packages/web-provider/tsconfig.json b/packages/web-provider/tsconfig.json
index 7d1358d6..6fc060ac 100644
--- a/packages/web-provider/tsconfig.json
+++ b/packages/web-provider/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "@palladxyz/common/tsconfig.json",
+ "extends": "@palladco/common/tsconfig.json",
"compilerOptions": {
"types": ["@types/chrome"]
}
diff --git a/packages/web-provider/tsup.config.ts b/packages/web-provider/tsup.config.ts
index 8449a56d..3325517c 100644
--- a/packages/web-provider/tsup.config.ts
+++ b/packages/web-provider/tsup.config.ts
@@ -1,4 +1,4 @@
-import { baseTsupConfig } from "@palladxyz/common"
+import { baseTsupConfig } from "@palladco/common"
import { defineConfig } from "tsup"
import packageJson from "./package.json"