Skip to content

Commit c9a0c23

Browse files
committed
[dashboard] add solana policies to vault access token (#8239)
<!-- start pr-codex --> ## 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}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## 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. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 43b0680 commit c9a0c23

File tree

1 file changed

+138
-0
lines changed
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/lib

1 file changed

+138
-0
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/lib/vault.client.ts

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,98 @@ export async function createWalletAccessToken(props: {
560560
],
561561
type: "eoa:create",
562562
},
563+
{
564+
metadataPatterns: [
565+
{
566+
key: "projectId",
567+
rule: {
568+
pattern: props.project.id,
569+
},
570+
},
571+
{
572+
key: "teamId",
573+
rule: {
574+
pattern: props.project.teamId,
575+
},
576+
},
577+
{
578+
key: "type",
579+
rule: {
580+
pattern: "server-wallet",
581+
},
582+
},
583+
],
584+
type: "solana:read",
585+
},
586+
{
587+
requiredMetadataPatterns: [
588+
{
589+
key: "projectId",
590+
rule: {
591+
pattern: props.project.id,
592+
},
593+
},
594+
{
595+
key: "teamId",
596+
rule: {
597+
pattern: props.project.teamId,
598+
},
599+
},
600+
{
601+
key: "type",
602+
rule: {
603+
pattern: "server-wallet",
604+
},
605+
},
606+
],
607+
type: "solana:create",
608+
},
609+
{
610+
metadataPatterns: [
611+
{
612+
key: "projectId",
613+
rule: {
614+
pattern: props.project.id,
615+
},
616+
},
617+
{
618+
key: "teamId",
619+
rule: {
620+
pattern: props.project.teamId,
621+
},
622+
},
623+
{
624+
key: "type",
625+
rule: {
626+
pattern: "server-wallet",
627+
},
628+
},
629+
],
630+
type: "solana:signTransaction",
631+
},
632+
{
633+
metadataPatterns: [
634+
{
635+
key: "projectId",
636+
rule: {
637+
pattern: props.project.id,
638+
},
639+
},
640+
{
641+
key: "teamId",
642+
rule: {
643+
pattern: props.project.teamId,
644+
},
645+
},
646+
{
647+
key: "type",
648+
rule: {
649+
pattern: "server-wallet",
650+
},
651+
},
652+
],
653+
type: "solana:signMessage",
654+
},
563655
],
564656
},
565657
},
@@ -633,6 +725,52 @@ async function createManagementAccessToken(props: {
633725
],
634726
type: "eoa:create",
635727
},
728+
{
729+
metadataPatterns: [
730+
{
731+
key: "projectId",
732+
rule: {
733+
pattern: props.project.id,
734+
},
735+
},
736+
{
737+
key: "teamId",
738+
rule: {
739+
pattern: props.project.teamId,
740+
},
741+
},
742+
{
743+
key: "type",
744+
rule: {
745+
pattern: "server-wallet",
746+
},
747+
},
748+
],
749+
type: "solana:read",
750+
},
751+
{
752+
requiredMetadataPatterns: [
753+
{
754+
key: "projectId",
755+
rule: {
756+
pattern: props.project.id,
757+
},
758+
},
759+
{
760+
key: "teamId",
761+
rule: {
762+
pattern: props.project.teamId,
763+
},
764+
},
765+
{
766+
key: "type",
767+
rule: {
768+
pattern: "server-wallet",
769+
},
770+
},
771+
],
772+
type: "solana:create",
773+
},
636774
{
637775
metadataPatterns: [
638776
{

0 commit comments

Comments
 (0)