feat: Allow to enable Vrf in testing environments #222

This commit is contained in:
ppe
2022-09-18 23:46:40 +02:00
committed by just_ppe
parent 3c944560b3
commit dfff75118e
5 changed files with 86 additions and 8 deletions

View File

@@ -209,7 +209,7 @@ export class HandlerBasedContract<State> implements Contract<State> {
if (!this.signer) {
throw new Error("Wallet not connected. Use 'connect' method first.");
}
const { arweave, interactionsLoader } = this.warp;
const { arweave, interactionsLoader, environment } = this.warp;
const effectiveTags = options?.tags || [];
const effectiveTransfer = options?.transfer || emptyTransfer;
@@ -228,7 +228,7 @@ export class HandlerBasedContract<State> implements Contract<State> {
throw new Error('Ar Transfers are not allowed for bundled interactions');
}
if (effectiveVrf && !bundleInteraction) {
if (effectiveVrf && !bundleInteraction && environment === 'mainnet') {
throw new Error('Vrf generation is only available for bundle interaction');
}
@@ -245,7 +245,7 @@ export class HandlerBasedContract<State> implements Contract<State> {
effectiveTransfer,
effectiveStrict,
false,
false,
effectiveVrf && environment !== 'mainnet',
effectiveReward
);
const response = await arweave.transactions.post(interactionTx);