Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
63074d1
Support for Versioned transactions
GregFitzhugh Apr 22, 2025
ce4bfb2
database values change/migration necessary
GregFitzhugh Apr 22, 2025
ceb2d44
Update .env.example for local testing
Akonobi1 Apr 22, 2025
38e9669
troubshoot versioned txs
GregFitzhugh Apr 23, 2025
c2c53da
Merge branch 'dev' of https://github.com/Akonobi1/kinetic into dev
GregFitzhugh Apr 23, 2025
12eca55
more edits for versioned transaction
GregFitzhugh Apr 24, 2025
7a8b76a
fix for versioned txs not being deserialized
GregFitzhugh Apr 25, 2025
9471b61
Edits to enable versioned transactions
GregFitzhugh Jun 4, 2025
0cd6fdb
versioned tx implementation
GregFitzhugh Jun 6, 2025
f9bf68c
named image
GregFitzhugh Jun 6, 2025
3e13d1f
complete versioned edit
GregFitzhugh Jul 1, 2025
1ecd48b
grappling with signature verification
GregFitzhugh Jul 1, 2025
881781f
edit versioned parse and sign tx file
GregFitzhugh Jul 2, 2025
3a32833
extent of versioned work to be saved for reference
GregFitzhugh Jul 3, 2025
29b9718
for reference
GregFitzhugh Jul 3, 2025
1bec1c7
removed secrets
GregFitzhugh Jul 15, 2025
74db7a1
restore default docker compose file
GregFitzhugh Jul 15, 2025
7145b96
Update .gitignore
Akonobi1 Jul 25, 2025
272df12
Update parse-and-sign-versioned-token-transfer.ts
mocolicious Aug 1, 2025
815985c
Update api-transaction.service.ts
mocolicious Aug 1, 2025
549cb16
Update api-kinetic.service.ts
mocolicious Aug 1, 2025
4bb88c2
Update api-kinetic.service.ts
mocolicious Aug 1, 2025
e231717
Update .env.example
mocolicious Aug 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
28 changes: 14 additions & 14 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ AUTH_PASSWORD_ENABLED=true
# The role is optional and can be one of: Admin and User (default).
# The email is optional and can be used to link an account to external providers.
# The avatarUrl is optional and can be used to provision an avatar for the user
AUTH_USERS="alice|Kinetic@alice1|Admin|alice@email.com|http://avatars.dicebear.com/api/open-peeps/aliceal.svg,bob||User|bob@gmail.com"
AUTH_USERS="admin|kinetic|Admin|admin@example.com|http://avatars.example.com/admin.svg,bob||User|user@example.com"
# Provision more apps by providing the mnemonic, secret key or byte array of the fee payer, name and optionally a logo URL.
APP_1_FEE_PAYER_SECRET=UvfuF3FPqLyvS8xGjSu4AUfdsY5QvLdnin8SKBLAi3UqgbmEWCDshPY3UcxvBgRAqHLzh5Ni1eypLVZArsis6FF
APP_1_NAME="App 1"
APP_1_FEE_PAYER_SECRET=3HicmKK88kuwRcvwfiVWMbzTY9mnzmmGuNN4V9Dwn5gCpFYDPCWfR8WmHPAZP4S3DSTPQvNGB4SXdoheCrj49dgW
APP_1_NAME="KInnected"
#APP_1_LOGO_URL=""
# Enabling the webhooks will enable the event and verify webhooks in debug mode.
#APP_1_ENABLE_WEBHOOKS=true
# Cache configurations, all TTL values are in seconds
#CACHE_SOLANA_GET_LATEST_BLOCKHASH_TTL=5
#CACHE_SOLANA_GET_TOKEN_ACCOUNTS_TTL=60
#COOKIE_DOMAINS="localhost,local.kinetic.host,pages.dev"
#COOKIE_NAME="__session"
COOKIE_DOMAINS="local.kinetic.host,pages.dev"
COOKIE_NAME="__session"
# If you want to configure CORS, define a comma-separated list of urls here.
# If you don't provide any domains, CORS will be bypassed (default).
#CORS_ORIGINS=http://localhost:4200
Expand Down Expand Up @@ -51,38 +51,38 @@ DATABASE_URL="postgresql://prisma:prisma@localhost:5432/prisma?schema=kinetic"
#GOOGLE_CLIENT_SECRET=x
#GOOGLE_ENABLED=false
# Secret used to sign JWT tokens (required)
JWT_SECRET="KineticJwtSecret!"
JWT_SECRET="KineticSecret!"
# Configure the host where the API listens on.
# Use 127.0.0.1 if you only want to allow connections from localhost.
# Use 0.0.0.0 (default) when deploying to e.g. Heroku, Render or run in a Docker container.
HOST=127.0.0.1
HOST=0.0.0.0
# Configure the port where the API listens on. 3000 is the default.
#PORT=3000
PORT=3000
# Configure the logger https://ogma.jaymcdoniel.dev/
#LOG_COLOR=true
#LOG_JSON=false
# ALL = 0, SILLY = 0, FINE = 1, VERBOSE = 1, DEBUG = 2, INFO = 3, LOG = 3, WARN = 4, ERROR = 5, FATAL = 6, OFF = 7
LOG_LEVEL=ALL
LOG_LEVEL=2
# Queue settings
QUEUE_CLOSE_ACCOUNT_CONCURRENCY=1
QUEUE_CLOSE_ACCOUNT_START=false
# Redis configuration
REDIS_URL=redis://localhost:6379
# SolanaLocal
SOLANA_LOCAL_ENABLED=true
#SOLANA_LOCAL_ENABLED=true
#SOLANA_LOCAL_MINT_KIN=*MoGaMuJnB3k8zXjBYBnHxHG47vWcW3nyb7bFYvdVzek,5,Kin
SOLANA_LOCAL_MINT_KIN_AIRDROP_SECRET=UvfuF3FPqLyvS8xGjSu4AUfdsY5QvLdnin8SKBLAi3UqgbmEWCDshPY3UcxvBgRAqHLzh5Ni1eypLVZArsis6FF
#SOLANA_LOCAL_MINT_KIN_AIRDROP_SECRET=UvfuF3FPqLyvS8xGjSu4AUfdsY5QvLdnin8SKBLAi3UqgbmEWCDshPY3UcxvBgRAqHLzh5Ni1eypLVZArsis6FF
#SOLANA_LOCAL_RPC_ENDPOINT=http://localhost:8899
# SolanaDevnet
#SOLANA_DEVNET_ENABLED=true
#SOLANA_DEVNET_RPC_ENDPOINT=devnet
#SOLANA_DEVNET_MINT_KIN=*KinDesK3dYWo3R2wDk6Ucaf31tvQCCSYyL8Fuqp33GX,5,Kin
#SOLANA_DEVNET_MINT_KIN_AIRDROP_AMOUNT=1000
#SOLANA_DEVNET_MINT_KIN_AIRDROP_MAX=50000
SOLANA_DEVNET_MINT_KIN_AIRDROP_SECRET=UvfuF3FPqLyvS8xGjSu4AUfdsY5QvLdnin8SKBLAi3UqgbmEWCDshPY3UcxvBgRAqHLzh5Ni1eypLVZArsis6FF
#SOLANA_DEVNET_MINT_KIN_AIRDROP_SECRET=UvfuF3FPqLyvS8xGjSu4AUfdsY5QvLdnin8SKBLAi3UqgbmEWCDshPY3UcxvBgRAqHLzh5Ni1eypLVZArsis6FF
# SolanaMainnet
#SOLANA_MAINNET_RPC_ENDPOINT=mainnet
SOLANA_MAINNET_ENABLED=false
SOLANA_MAINNET_RPC_ENDPOINT=mainnet
SOLANA_MAINNET_ENABLED=true
# The URL of the Web UI, used to redirect to the Web UI after login.
# In a typical deployment, this is the same as the API_URL with the '/api' suffix removed (the default).
# This means you will probably only need to set this if you are running a local development setup.
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/dist
/tmp
/out-tsc
/volumes

# dependencies
/node_modules
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ RUN yarn install --production
# - copy the dist folder from the builder image
# - copy the node_modules folder from the node_modules image
################################################################################
FROM base as final
FROM base AS final

#RUN apk --no-cache add krb5-libs

Expand Down
15 changes: 14 additions & 1 deletion api-swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,19 @@
},
"tx": {
"type": "string"
},
"isVersioned": {
"type": "boolean",
"default": false,
"description": "Indicates if this is a versioned transaction"
},
"addressLookupTableAccounts": {
"type": "array",
"items": {
"type": "string"
},
"nullable": true,
"description": "Base58-encoded addresses of lookup tables required for versioned transactions"
}
},
"required": ["commitment", "environment", "index", "mint", "lastValidBlockHeight", "tx"]
Expand Down Expand Up @@ -1488,4 +1501,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ services:
ports:
- '6379:6379'
volumes:
- ./tmp/redis:/data
- ./tmp/redis:/data
2 changes: 1 addition & 1 deletion libs/api/core/data-access/src/lib/api-core.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export type AppEnvironment = AppEnv & {
export class ApiCoreService extends PrismaClient implements OnModuleInit {
private readonly logger = new Logger(ApiCoreService.name)
readonly airdropConfig = new Map<string, Omit<AirdropConfig, 'connection'>>()

private getAppByEnvironmentIndexCounter: Counter
private getAppByIndexCounter: Counter

Expand Down
2 changes: 2 additions & 0 deletions libs/api/core/data-access/src/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ model Transaction {
destination String?
errors TransactionError[]
feePayer String?
isVersioned Boolean @default(false)
addressLookupTables Json?
headers Json?
ip String?
lastValidBlockHeight Int?
Expand Down
53 changes: 53 additions & 0 deletions libs/api/kinetic/data-access/src/lib/api-kinetic.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ApiSolanaDataAccessModule } from '@kin-kinetic/api/solana/data-access'
import { ApiWebhookDataAccessModule } from '@kin-kinetic/api/webhook/data-access'
import { Test } from '@nestjs/testing'
import { ApiKineticService } from './api-kinetic.service'
import { VersionedTransaction, Transaction } from '@solana/web3.js'

describe('ApiKineticService', () => {
let service: ApiKineticService
Expand All @@ -19,4 +20,56 @@ describe('ApiKineticService', () => {
it('should be defined', () => {
expect(service).toBeTruthy()
})

// Add test for versioned transactions
it('should process versioned transactions', async () => {
// This is just a skeleton - you'll need to fill in with actual test data
const mockVersionedTx = {} as VersionedTransaction
const mockProcessParams = {
// Add required parameters for processTransaction
isVersioned: true,
solanaTransaction: mockVersionedTx,
// Add other required parameters...
}

// Mock any necessary service methods
jest.spyOn(service, 'getSolanaConnection').mockResolvedValue({
connection: {
sendRawTransaction: jest.fn().mockResolvedValue('mock-signature'),
// Mock other needed methods...
}
} as any)

// Add other necessary mocks...

// Call the service method
const result = await service.processTransaction(mockProcessParams as any)

// Add assertions
expect(result).toBeDefined()
// Add more specific assertions based on expected behavior
})

// Add test for handling address lookup tables
it('should resolve address lookup tables', async () => {
const mockAddresses = ['mock-address-1', 'mock-address-2']

// Mock necessary service methods
jest.spyOn(service, 'getSolanaConnection').mockResolvedValue({
connection: {
getAddressLookupTable: jest.fn().mockResolvedValue({
value: { state: { addresses: [] } }
}),
// Mock other needed methods...
}
} as any)

// Call the service method
const result = await service.getAddressLookupTableAccounts('mock-app-key', mockAddresses)

// Add assertions
expect(result).toBeDefined()
expect(Array.isArray(result)).toBe(true)
// Add more specific assertions
})
})
Loading
Loading