From c9a0c23c6c3ec47c17a6c1bf65482398f4a0fec0 Mon Sep 17 00:00:00 2001 From: d4mr <16459486+d4mr@users.noreply.github.com> Date: Tue, 14 Oct 2025 18:06:44 +0000 Subject: [PATCH] [dashboard] add solana policies to vault access token (#8239) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## PR-Codex overview This PR focuses on adding new metadata patterns and required metadata patterns for various transaction types related to `solana`, enhancing the functionality of the `vault.client.ts` file. ### Detailed summary - Added new `metadataPatterns` for `solana:read`, `solana:create`, `solana:signTransaction`, and `solana:signMessage` types. - Included `requiredMetadataPatterns` for `solana:create` type. - Each pattern includes `projectId`, `teamId`, and a fixed `type` of `"server-wallet"`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` ## Summary by CodeRabbit * **New Features** * Added Solana-specific permissions to access tokens. * Wallet tokens now support solana:read, solana:create, solana:signTransaction, and solana:signMessage. * Management tokens now support solana:read and solana:create. * Permissions can be scoped via metadata (team, project, server-wallet) for finer control. * No changes to existing flows or error handling; new scopes are available during token creation. --- .../transactions/lib/vault.client.ts | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/lib/vault.client.ts b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/lib/vault.client.ts index 14e89a3ec36..449d9a6e886 100644 --- a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/lib/vault.client.ts +++ b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/lib/vault.client.ts @@ -560,6 +560,98 @@ export async function createWalletAccessToken(props: { ], type: "eoa:create", }, + { + metadataPatterns: [ + { + key: "projectId", + rule: { + pattern: props.project.id, + }, + }, + { + key: "teamId", + rule: { + pattern: props.project.teamId, + }, + }, + { + key: "type", + rule: { + pattern: "server-wallet", + }, + }, + ], + type: "solana:read", + }, + { + requiredMetadataPatterns: [ + { + key: "projectId", + rule: { + pattern: props.project.id, + }, + }, + { + key: "teamId", + rule: { + pattern: props.project.teamId, + }, + }, + { + key: "type", + rule: { + pattern: "server-wallet", + }, + }, + ], + type: "solana:create", + }, + { + metadataPatterns: [ + { + key: "projectId", + rule: { + pattern: props.project.id, + }, + }, + { + key: "teamId", + rule: { + pattern: props.project.teamId, + }, + }, + { + key: "type", + rule: { + pattern: "server-wallet", + }, + }, + ], + type: "solana:signTransaction", + }, + { + metadataPatterns: [ + { + key: "projectId", + rule: { + pattern: props.project.id, + }, + }, + { + key: "teamId", + rule: { + pattern: props.project.teamId, + }, + }, + { + key: "type", + rule: { + pattern: "server-wallet", + }, + }, + ], + type: "solana:signMessage", + }, ], }, }, @@ -633,6 +725,52 @@ async function createManagementAccessToken(props: { ], type: "eoa:create", }, + { + metadataPatterns: [ + { + key: "projectId", + rule: { + pattern: props.project.id, + }, + }, + { + key: "teamId", + rule: { + pattern: props.project.teamId, + }, + }, + { + key: "type", + rule: { + pattern: "server-wallet", + }, + }, + ], + type: "solana:read", + }, + { + requiredMetadataPatterns: [ + { + key: "projectId", + rule: { + pattern: props.project.id, + }, + }, + { + key: "teamId", + rule: { + pattern: props.project.teamId, + }, + }, + { + key: "type", + rule: { + pattern: "server-wallet", + }, + }, + ], + type: "solana:create", + }, { metadataPatterns: [ {