Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .nx/version-plans/version-plan-1765435311894.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
ability-sdk: minor
---

This package now exports a new solana object which contains to helper functions used when writing Solana Abilities and/or Policies: deserializeTransaction and verifyBlockhashForCluster
5 changes: 5 additions & 0 deletions .nx/version-plans/version-plan-1765435492696.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
ability-sol-transaction-signer: minor
---

Add support for Solana Contract Whitelist Policy
4 changes: 3 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@
"policy-send-counter",
"ability-aerodrome-swap",
"ability-hyperliquid",
"e2e-test-utils"
"e2e-test-utils",
"policy-sol-contract-whitelist",
"ability-sol-transaction-signer"
],
"projectsRelationship": "independent",
"releaseTagPattern": "vincent/{projectName}/{version}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"dependencies": {
"@lit-protocol/vincent-ability-sdk": "workspace:*",
"@lit-protocol/vincent-wrapped-keys": "workspace:*",
"@lit-protocol/vincent-policy-sol-contract-whitelist": "workspace:*",
"@solana/web3.js": "^1.98.4",
"ethers": "^5.8.0",
"tslib": "2.8.1",
Expand Down
10 changes: 8 additions & 2 deletions packages/apps/ability-sol-transaction-signer/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"clean": {},
"action:build": {
"executor": "nx:run-commands",
"dependsOn": ["ability-sdk:build"],
"dependsOn": ["ability-sdk:build", "policy-sol-contract-whitelist:build"],
"options": {
"commands": ["pnpm node ./esbuild.config.js"],
"cwd": "packages/apps/ability-sol-transaction-signer",
Expand Down Expand Up @@ -52,7 +52,13 @@
},
"test-e2e": {
"executor": "@nx/jest:jest",
"dependsOn": ["app-sdk:build", "wrapped-keys:build", "e2e-test-utils:build", "action:deploy"],
"dependsOn": [
"app-sdk:build",
"wrapped-keys:build",
"policy-sol-contract-whitelist:action:deploy",
"e2e-test-utils:build",
"action:deploy"
],
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "packages/apps/ability-sol-transaction-signer/jest.config.js"
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"ipfsCid": "QmNh2nqvJ8mLrqurUGpHHawKYaqBTCuA4ToZ1ZrgTob5Mi"
"ipfsCid": "QmbHC6QB51TWivu6fSGvxtCgrvGWYeNBGL1t4FVZug3zcp"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { z } from 'zod';

export const abilityParamsSchema = z.object({
rpcUrl: z.string().describe('The RPC URL for the Solana cluster').optional(),
rpcUrl: z
.string()
.describe(
'The RPC URL to use for the Solana cluster the transaction is intended for (used to verify blockhash). Only available for precheck, execute will use the Lit provided RPC URL.',
)
.optional()
.nullable(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added .nullable due to a quirk of the Ability to Policy param mapping where even if the Policy schema defines a param as optional, it's actually always required if the Ability want to map a param to it

cluster: z
.enum(['devnet', 'testnet', 'mainnet-beta'])
.describe('The Solana cluster the transaction is intended for (used to verify blockhash)'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {
createVincentAbility,
createVincentAbilityPolicy,
supportedPoliciesForAbility,
} from '@lit-protocol/vincent-ability-sdk';
import { clusterApiUrl, Transaction } from '@solana/web3.js';
import { api } from '@lit-protocol/vincent-wrapped-keys';
import { bundledVincentPolicy } from '@lit-protocol/vincent-policy-sol-contract-whitelist';

const getSolanaKeyPairFromWrappedKey = api.litActionHelpers.getSolanaKeyPairFromWrappedKey;

Expand All @@ -25,12 +27,22 @@ declare const Lit: {
};
};

const ProgramWhitelistPolicy = createVincentAbilityPolicy({
abilityParamsSchema,
bundledVincentPolicy,
abilityParameterMappings: {
rpcUrl: 'rpcUrl',
cluster: 'cluster',
serializedTransaction: 'serializedTransaction',
},
});

export const vincentAbility = createVincentAbility({
packageName: '@lit-protocol/vincent-ability-sol-transaction-signer' as const,
abilityDescription:
'Sign a Solana transaction using a Vincent Agent Wallet with encrypted private key.' as const,
abilityParamsSchema,
supportedPolicies: supportedPoliciesForAbility([]),
supportedPolicies: supportedPoliciesForAbility([ProgramWhitelistPolicy]),

precheckFailSchema,

Expand Down
Loading