Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing vars and controllers added #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
BLOCK_ENGINE_URL=block-engine.mainnet.frankfurt.jito.wtf
AUTH_KEYPAIR_PATH=/Path/to/keypair.json
ACCOUNTS_OF_INTEREST=5XLqnSjJBAm1XjAcR76QCn8eB1phEQ3py2VAE2f8pdCQ,Y2akr3bXHRsqyP1QJtbm9G9N88ZV4t1KfaFeDzKRTfr
PROGRAMS_OF_INTEREST=675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8
BUNDLE_TRANSACTION_LIMIT=5
RPC_URL=https://frankfurt.mainnet.rpc.jito.wtf/?access-token=${ACCESS_TOKEN}
# Set this to not have to use the authentication mechanism
NO_AUTH=true
# Geyser envs
GEYSER_URL=https://geyser.url
GEYSER_ACCESS_TOKEN=your_access_token
24 changes: 18 additions & 6 deletions src/examples/geyser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,27 @@ import {PublicKey} from '@solana/web3.js';
import {geyserClient} from '../../sdk';

const main = async () => {
const geyserUrl = process.env.GEYSER_URL || '';
const geyserAccessToken = process.env.GEYSER_ACCESS_TOKEN || '';
const geyserUrl = process.env.GEYSER_URL || null;
const geyserAccessToken = process.env.GEYSER_ACCESS_TOKEN || null;
console.log(`GEYSER_URL: ${geyserUrl}`);

const _accounts = (process.env.ACCOUNTS_OF_INTEREST || '').split(',');
console.log(`ACCOUNTS_OF_INTEREST: ${_accounts}`);
const accounts = _accounts.map(a => new PublicKey(a));
const _accounts = (process.env.ACCOUNTS_OF_INTEREST || '')
.split(',')
.filter(a => a !== '');
const _programs = (process.env.PROGRAMS_OF_INTEREST || '')
.split(',')
.filter(p => p !== '');

if (
!geyserUrl ||
!geyserAccessToken ||
!_accounts.length ||
!_programs.length
) {
throw new Error('missing required environment variables');
}

const _programs = (process.env.PROGRAMS_OF_INTEREST || '').split(',');
const accounts = _accounts.map(a => new PublicKey(a));
console.log(`PROGRAMS_OF_INTEREST: ${_programs}`);
const programs = _programs.map(p => new PublicKey(p));

Expand Down
11 changes: 8 additions & 3 deletions src/examples/simple_bundle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ import {searcherClient} from '../../sdk/block-engine/searcher';
import {onBundleResult, sendBundles} from './utils';

const main = async () => {
const blockEngineUrl = process.env.BLOCK_ENGINE_URL || '';
const blockEngineUrl = process.env.BLOCK_ENGINE_URL || null;
console.log('BLOCK_ENGINE_URL:', blockEngineUrl);

const authKeypairPath = process.env.AUTH_KEYPAIR_PATH || '';
const authKeypairPath = process.env.AUTH_KEYPAIR_PATH || null;
console.log('AUTH_KEYPAIR_PATH:', authKeypairPath);

if (!blockEngineUrl || !authKeypairPath) {
throw new Error('missing required environment variables');
}

const decodedKey = new Uint8Array(
JSON.parse(Fs.readFileSync(authKeypairPath).toString()) as number[]
);
Expand Down Expand Up @@ -41,5 +46,5 @@ main()
console.log('Sending bundle');
})
.catch(e => {
throw e;
console.error(`error: ${e}`);
});