Skip to content

Commit 55fb6d9

Browse files
committed
swift maker config to not send transactions, only simulate
1 parent 7003e32 commit 55fb6d9

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

src/experimental-bots/entrypoint.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -390,13 +390,18 @@ const runBot = async () => {
390390
});
391391
await userMap.subscribe();
392392

393-
const swiftMaker = new SwiftMaker(driftClient, userMap, {
394-
rpcEndpoint: endpoint,
395-
commit: '',
396-
driftEnv: config.global.driftEnv!,
397-
driftPid: driftPublicKey.toBase58(),
398-
walletAuthority: wallet.publicKey.toBase58(),
399-
});
393+
const swiftMaker = new SwiftMaker(
394+
driftClient,
395+
userMap,
396+
{
397+
rpcEndpoint: endpoint,
398+
commit: '',
399+
driftEnv: config.global.driftEnv!,
400+
driftPid: driftPublicKey.toBase58(),
401+
walletAuthority: wallet.publicKey.toBase58(),
402+
},
403+
config.global.testLiveness
404+
);
400405
bots.push(swiftMaker);
401406
}
402407

src/experimental-bots/swift/makerExample.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ export class SwiftMaker {
2424
constructor(
2525
private driftClient: DriftClient,
2626
private userMap: UserMap,
27-
runtimeSpec: RuntimeSpec
27+
runtimeSpec: RuntimeSpec,
28+
private dryRun?: boolean
2829
) {
2930
if (runtimeSpec.driftEnv != 'devnet') {
3031
throw new Error('SwiftMaker only works on devnet');
@@ -187,8 +188,13 @@ export class SwiftMaker {
187188
);
188189
if (resp.value.err) {
189190
console.log(resp.value.logs);
191+
return;
190192
}
191193

194+
if (this.dryRun) {
195+
console.log('Dry run, not sending transaction');
196+
return;
197+
}
192198
this.driftClient.txSender
193199
.sendVersionedTransaction(tx)
194200
.then((response) => {

0 commit comments

Comments
 (0)