-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tx submission error handling across the app (PUT errors were not …
…reported correctly) (#30)
- Loading branch information
Showing
22 changed files
with
504 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
flame build shy opera chef educate crane high acquire season negative syrup senior lecture false float dwarf quit fancy couple lizard grief buffalo bundle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
addr_test1qp7thfxtpw5yj2jmej823cgnh5937cv38e7a32k3ece8aerv6hy3dvev273nppcz3qu8dwk92p5atmkyzm9p8lvmv5rqnc06ms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { When } from '@cucumber/cucumber'; | ||
import { ScenarioWorld } from '../world.js'; | ||
import { | ||
Contract, | ||
datetoTimeout, | ||
} from "@marlowe.io/language-core-v1"; | ||
import { Bech32 } from '../../cardano.js'; | ||
|
||
|
||
const mkDoubleDeposit = (address1: Bech32, address2: Bech32): Contract => { | ||
const twentyMinutesInMilliseconds = 20 * 60 * 1000; | ||
const inTwentyMinutes = datetoTimeout(new Date(Date.now() + twentyMinutesInMilliseconds)); | ||
return { | ||
timeout: inTwentyMinutes, | ||
timeout_continuation: "close", | ||
when: [ | ||
{ case: { | ||
party: {address: address1.toString()}, | ||
deposits: 1000000n, | ||
of_token: { currency_symbol: "", token_name: "" }, | ||
into_account: {address: address1.toString()} | ||
}, | ||
then: "close", | ||
}, | ||
{ case: { | ||
party: {address: address2.toString()}, | ||
deposits: 2000000n, | ||
of_token: { currency_symbol: "", token_name: "" }, | ||
into_account: {address: address2.toString()} | ||
}, | ||
then: "close", | ||
}, | ||
] | ||
}; | ||
} | ||
|
||
When( | ||
/^I generate "DoubleDeposit" contract with "([^"]*)" as a first depositor and "([^"]*)" as a second depositor and call it "([^"]*)"$/, | ||
async function(this: ScenarioWorld, first: string, second: string, contractNickname: string) { | ||
const firstAddress = await this.getWalletAddress(first); | ||
const secondAddress = await this.getWalletAddress(second); | ||
const contract = mkDoubleDeposit(firstAddress, secondAddress); | ||
this.setContractInfo(contractNickname, { contract: contract, contractId: undefined }); | ||
} | ||
); | ||
|
59 changes: 59 additions & 0 deletions
59
e2e/src/step-definitions/contracts/doubleDepositAndNotify.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { When } from '@cucumber/cucumber'; | ||
import { ScenarioWorld } from '../world.js'; | ||
import { | ||
Contract, | ||
datetoTimeout, | ||
} from "@marlowe.io/language-core-v1"; | ||
import { Bech32 } from '../../cardano.js'; | ||
|
||
|
||
const mkDoubleDepositAndNotify = (address1: Bech32, address2: Bech32): Contract => { | ||
const twentyMinutesInMilliseconds = 20 * 60 * 1000; | ||
const inTwentyMinutes = datetoTimeout(new Date(Date.now() + twentyMinutesInMilliseconds)); | ||
const notifyContinuation:Contract = { | ||
timeout: inTwentyMinutes, | ||
timeout_continuation: "close", | ||
"when": [ | ||
{ | ||
"then": "close", | ||
"case": { | ||
"notify_if": true | ||
} | ||
} | ||
], | ||
}; | ||
|
||
return { | ||
timeout: inTwentyMinutes, | ||
timeout_continuation: "close", | ||
when: [ | ||
{ case: { | ||
party: {address: address1.toString()}, | ||
deposits: 1000000n, | ||
of_token: { currency_symbol: "", token_name: "" }, | ||
into_account: {address: address1.toString()} | ||
}, | ||
then: notifyContinuation, | ||
}, | ||
{ case: { | ||
party: {address: address2.toString()}, | ||
deposits: 2000000n, | ||
of_token: { currency_symbol: "", token_name: "" }, | ||
into_account: {address: address2.toString()} | ||
}, | ||
then: notifyContinuation, | ||
}, | ||
] | ||
}; | ||
} | ||
|
||
When( | ||
/^I generate "DoubleDepositAndNotify" contract with "([^"]*)" as a first depositor and "([^"]*)" as a second depositor and call it "([^"]*)"$/, | ||
async function(this: ScenarioWorld, first: string, second: string, contractNickname: string) { | ||
const firstAddress = await this.getWalletAddress(first); | ||
const secondAddress = await this.getWalletAddress(second); | ||
const contract = mkDoubleDepositAndNotify(firstAddress, secondAddress); | ||
this.setContractInfo(contractNickname, { contract: contract, contractId: undefined }); | ||
} | ||
); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Page } from "playwright"; | ||
|
||
export const grabPopup = async function (page: Page, triggerPopup: () => Promise<void>): Promise<Page> { | ||
const popupPromise:Promise<Page> = new Promise(resolve => page.context().once('page', resolve)); | ||
await triggerPopup(); | ||
return await popupPromise; | ||
} |
Oops, something went wrong.