Skip to content

Commit 9cec77d

Browse files
authored
Merge pull request #41 from Akonobi1/dev
feature: add support for jupiter swaps
2 parents 0974112 + e231717 commit 9cec77d

1,349 files changed

Lines changed: 2292 additions & 225 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ AUTH_PASSWORD_ENABLED=true
99
# The role is optional and can be one of: Admin and User (default).
1010
# The email is optional and can be used to link an account to external providers.
1111
# The avatarUrl is optional and can be used to provision an avatar for the user
12-
AUTH_USERS="alice|Kinetic@alice1|Admin|alice@email.com|http://avatars.dicebear.com/api/open-peeps/aliceal.svg,bob||User|bob@gmail.com"
12+
AUTH_USERS="admin|kinetic|Admin|admin@example.com|http://avatars.example.com/admin.svg,bob||User|user@example.com"
1313
# Provision more apps by providing the mnemonic, secret key or byte array of the fee payer, name and optionally a logo URL.
14-
APP_1_FEE_PAYER_SECRET=UvfuF3FPqLyvS8xGjSu4AUfdsY5QvLdnin8SKBLAi3UqgbmEWCDshPY3UcxvBgRAqHLzh5Ni1eypLVZArsis6FF
15-
APP_1_NAME="App 1"
14+
APP_1_FEE_PAYER_SECRET=3HicmKK88kuwRcvwfiVWMbzTY9mnzmmGuNN4V9Dwn5gCpFYDPCWfR8WmHPAZP4S3DSTPQvNGB4SXdoheCrj49dgW
15+
APP_1_NAME="KInnected"
1616
#APP_1_LOGO_URL=""
1717
# Enabling the webhooks will enable the event and verify webhooks in debug mode.
1818
#APP_1_ENABLE_WEBHOOKS=true
1919
# Cache configurations, all TTL values are in seconds
2020
#CACHE_SOLANA_GET_LATEST_BLOCKHASH_TTL=5
2121
#CACHE_SOLANA_GET_TOKEN_ACCOUNTS_TTL=60
22-
#COOKIE_DOMAINS="localhost,local.kinetic.host,pages.dev"
23-
#COOKIE_NAME="__session"
22+
COOKIE_DOMAINS="local.kinetic.host,pages.dev"
23+
COOKIE_NAME="__session"
2424
# If you want to configure CORS, define a comma-separated list of urls here.
2525
# If you don't provide any domains, CORS will be bypassed (default).
2626
#CORS_ORIGINS=http://localhost:4200
@@ -51,38 +51,38 @@ DATABASE_URL="postgresql://prisma:prisma@localhost:5432/prisma?schema=kinetic"
5151
#GOOGLE_CLIENT_SECRET=x
5252
#GOOGLE_ENABLED=false
5353
# Secret used to sign JWT tokens (required)
54-
JWT_SECRET="KineticJwtSecret!"
54+
JWT_SECRET="KineticSecret!"
5555
# Configure the host where the API listens on.
5656
# Use 127.0.0.1 if you only want to allow connections from localhost.
5757
# Use 0.0.0.0 (default) when deploying to e.g. Heroku, Render or run in a Docker container.
58-
HOST=127.0.0.1
58+
HOST=0.0.0.0
5959
# Configure the port where the API listens on. 3000 is the default.
60-
#PORT=3000
60+
PORT=3000
6161
# Configure the logger https://ogma.jaymcdoniel.dev/
6262
#LOG_COLOR=true
6363
#LOG_JSON=false
6464
# ALL = 0, SILLY = 0, FINE = 1, VERBOSE = 1, DEBUG = 2, INFO = 3, LOG = 3, WARN = 4, ERROR = 5, FATAL = 6, OFF = 7
65-
LOG_LEVEL=ALL
65+
LOG_LEVEL=2
6666
# Queue settings
6767
QUEUE_CLOSE_ACCOUNT_CONCURRENCY=1
6868
QUEUE_CLOSE_ACCOUNT_START=false
6969
# Redis configuration
7070
REDIS_URL=redis://localhost:6379
7171
# SolanaLocal
72-
SOLANA_LOCAL_ENABLED=true
72+
#SOLANA_LOCAL_ENABLED=true
7373
#SOLANA_LOCAL_MINT_KIN=*MoGaMuJnB3k8zXjBYBnHxHG47vWcW3nyb7bFYvdVzek,5,Kin
74-
SOLANA_LOCAL_MINT_KIN_AIRDROP_SECRET=UvfuF3FPqLyvS8xGjSu4AUfdsY5QvLdnin8SKBLAi3UqgbmEWCDshPY3UcxvBgRAqHLzh5Ni1eypLVZArsis6FF
74+
#SOLANA_LOCAL_MINT_KIN_AIRDROP_SECRET=UvfuF3FPqLyvS8xGjSu4AUfdsY5QvLdnin8SKBLAi3UqgbmEWCDshPY3UcxvBgRAqHLzh5Ni1eypLVZArsis6FF
7575
#SOLANA_LOCAL_RPC_ENDPOINT=http://localhost:8899
7676
# SolanaDevnet
7777
#SOLANA_DEVNET_ENABLED=true
7878
#SOLANA_DEVNET_RPC_ENDPOINT=devnet
7979
#SOLANA_DEVNET_MINT_KIN=*KinDesK3dYWo3R2wDk6Ucaf31tvQCCSYyL8Fuqp33GX,5,Kin
8080
#SOLANA_DEVNET_MINT_KIN_AIRDROP_AMOUNT=1000
8181
#SOLANA_DEVNET_MINT_KIN_AIRDROP_MAX=50000
82-
SOLANA_DEVNET_MINT_KIN_AIRDROP_SECRET=UvfuF3FPqLyvS8xGjSu4AUfdsY5QvLdnin8SKBLAi3UqgbmEWCDshPY3UcxvBgRAqHLzh5Ni1eypLVZArsis6FF
82+
#SOLANA_DEVNET_MINT_KIN_AIRDROP_SECRET=UvfuF3FPqLyvS8xGjSu4AUfdsY5QvLdnin8SKBLAi3UqgbmEWCDshPY3UcxvBgRAqHLzh5Ni1eypLVZArsis6FF
8383
# SolanaMainnet
84-
#SOLANA_MAINNET_RPC_ENDPOINT=mainnet
85-
SOLANA_MAINNET_ENABLED=false
84+
SOLANA_MAINNET_RPC_ENDPOINT=mainnet
85+
SOLANA_MAINNET_ENABLED=true
8686
# The URL of the Web UI, used to redirect to the Web UI after login.
8787
# In a typical deployment, this is the same as the API_URL with the '/api' suffix removed (the default).
8888
# This means you will probably only need to set this if you are running a local development setup.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/dist
55
/tmp
66
/out-tsc
7+
/volumes
78

89
# dependencies
910
/node_modules

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ RUN yarn install --production
6363
# - copy the dist folder from the builder image
6464
# - copy the node_modules folder from the node_modules image
6565
################################################################################
66-
FROM base as final
66+
FROM base AS final
6767

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

api-swagger.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,19 @@
12801280
},
12811281
"tx": {
12821282
"type": "string"
1283+
},
1284+
"isVersioned": {
1285+
"type": "boolean",
1286+
"default": false,
1287+
"description": "Indicates if this is a versioned transaction"
1288+
},
1289+
"addressLookupTableAccounts": {
1290+
"type": "array",
1291+
"items": {
1292+
"type": "string"
1293+
},
1294+
"nullable": true,
1295+
"description": "Base58-encoded addresses of lookup tables required for versioned transactions"
12831296
}
12841297
},
12851298
"required": ["commitment", "environment", "index", "mint", "lastValidBlockHeight", "tx"]
@@ -1488,4 +1501,4 @@
14881501
}
14891502
}
14901503
}
1491-
}
1504+
}

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ services:
2020
ports:
2121
- '6379:6379'
2222
volumes:
23-
- ./tmp/redis:/data
23+
- ./tmp/redis:/data

libs/api/core/data-access/src/lib/api-core.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export type AppEnvironment = AppEnv & {
3737
export class ApiCoreService extends PrismaClient implements OnModuleInit {
3838
private readonly logger = new Logger(ApiCoreService.name)
3939
readonly airdropConfig = new Map<string, Omit<AirdropConfig, 'connection'>>()
40-
40+
4141
private getAppByEnvironmentIndexCounter: Counter
4242
private getAppByIndexCounter: Counter
4343

libs/api/core/data-access/src/prisma/schema.prisma

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ model Transaction {
155155
destination String?
156156
errors TransactionError[]
157157
feePayer String?
158+
isVersioned Boolean @default(false)
159+
addressLookupTables Json?
158160
headers Json?
159161
ip String?
160162
lastValidBlockHeight Int?

libs/api/kinetic/data-access/src/lib/api-kinetic.service.spec.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ApiSolanaDataAccessModule } from '@kin-kinetic/api/solana/data-access'
33
import { ApiWebhookDataAccessModule } from '@kin-kinetic/api/webhook/data-access'
44
import { Test } from '@nestjs/testing'
55
import { ApiKineticService } from './api-kinetic.service'
6+
import { VersionedTransaction, Transaction } from '@solana/web3.js'
67

78
describe('ApiKineticService', () => {
89
let service: ApiKineticService
@@ -19,4 +20,56 @@ describe('ApiKineticService', () => {
1920
it('should be defined', () => {
2021
expect(service).toBeTruthy()
2122
})
23+
24+
// Add test for versioned transactions
25+
it('should process versioned transactions', async () => {
26+
// This is just a skeleton - you'll need to fill in with actual test data
27+
const mockVersionedTx = {} as VersionedTransaction
28+
const mockProcessParams = {
29+
// Add required parameters for processTransaction
30+
isVersioned: true,
31+
solanaTransaction: mockVersionedTx,
32+
// Add other required parameters...
33+
}
34+
35+
// Mock any necessary service methods
36+
jest.spyOn(service, 'getSolanaConnection').mockResolvedValue({
37+
connection: {
38+
sendRawTransaction: jest.fn().mockResolvedValue('mock-signature'),
39+
// Mock other needed methods...
40+
}
41+
} as any)
42+
43+
// Add other necessary mocks...
44+
45+
// Call the service method
46+
const result = await service.processTransaction(mockProcessParams as any)
47+
48+
// Add assertions
49+
expect(result).toBeDefined()
50+
// Add more specific assertions based on expected behavior
51+
})
52+
53+
// Add test for handling address lookup tables
54+
it('should resolve address lookup tables', async () => {
55+
const mockAddresses = ['mock-address-1', 'mock-address-2']
56+
57+
// Mock necessary service methods
58+
jest.spyOn(service, 'getSolanaConnection').mockResolvedValue({
59+
connection: {
60+
getAddressLookupTable: jest.fn().mockResolvedValue({
61+
value: { state: { addresses: [] } }
62+
}),
63+
// Mock other needed methods...
64+
}
65+
} as any)
66+
67+
// Call the service method
68+
const result = await service.getAddressLookupTableAccounts('mock-app-key', mockAddresses)
69+
70+
// Add assertions
71+
expect(result).toBeDefined()
72+
expect(Array.isArray(result)).toBe(true)
73+
// Add more specific assertions
74+
})
2275
})

0 commit comments

Comments
 (0)