-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In outcome parsers, handle both TransactionOnNetwork and TransactionO…
…utcome.
- Loading branch information
1 parent
52f0efb
commit 475b8a4
Showing
9 changed files
with
281 additions
and
78 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
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
File renamed without changes.
23 changes: 20 additions & 3 deletions
23
src/transactionsOutcomeParsers/delegationTransactionsOutcomeParser.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
40 changes: 40 additions & 0 deletions
40
src/transactionsOutcomeParsers/smartContractTransactionsOutcomeParser.dev.net.spec.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,40 @@ | ||
import { assert } from "chai"; | ||
import { TransactionsConverter } from "../converters/transactionsConverter"; | ||
import { createDevnetProvider } from "../testutils/networkProviders"; | ||
import { SmartContractTransactionsOutcomeParser } from "./smartContractTransactionsOutcomeParser"; | ||
|
||
describe("test smart contract transactions outcome parser on devnet", () => { | ||
const networkProvider = createDevnetProvider(); | ||
const parser = new SmartContractTransactionsOutcomeParser(); | ||
const transactionsConverter = new TransactionsConverter(); | ||
|
||
it("should parse outcome of deploy transactions (1)", async () => { | ||
const transactionHash = "5d2ff2af8eb3fe7f2acb7e29c0436854b4c6c44de02878b6afff582888024a55"; | ||
const transactionOnNetwork = await networkProvider.getTransaction(transactionHash); | ||
const transactionOutcome = transactionsConverter.transactionOnNetworkToOutcome(transactionOnNetwork); | ||
const parsedGivenTransactionOnNetwork = parser.parseDeploy({ transactionOnNetwork }); | ||
const parsedGivenTransactionOutcome = parser.parseDeploy({ transactionOutcome }); | ||
|
||
assert.deepEqual(parsedGivenTransactionOnNetwork, parsedGivenTransactionOutcome); | ||
assert.equal(parsedGivenTransactionOnNetwork.returnCode, "ok"); | ||
assert.deepEqual(parsedGivenTransactionOnNetwork.contracts, [ | ||
{ | ||
address: "erd1qqqqqqqqqqqqqpgqpayq2es08gq8798xhnpr0kzgn7495qt5q6uqd7lpwf", | ||
ownerAddress: "erd1tn62hjp72rznp8vq0lplva5csav6rccpqqdungpxtqz0g2hcq6uq9k4cc6", | ||
codeHash: Buffer.from("c876625ec34a04445cfd99067777ebe488afdbc6899cd958f4c1d36107ca02d9", "hex"), | ||
}, | ||
]); | ||
}); | ||
|
||
it("should parse outcome of deploy transactions (2)", async () => { | ||
const transactionHash = "76683e926dad142fc9651afca208487f2a80d327fc87e5c876eec9d028196352"; | ||
const transactionOnNetwork = await networkProvider.getTransaction(transactionHash); | ||
const transactionOutcome = transactionsConverter.transactionOnNetworkToOutcome(transactionOnNetwork); | ||
const parsedGivenTransactionOnNetwork = parser.parseDeploy({ transactionOnNetwork }); | ||
const parsedGivenTransactionOutcome = parser.parseDeploy({ transactionOutcome }); | ||
|
||
assert.deepEqual(parsedGivenTransactionOnNetwork, parsedGivenTransactionOutcome); | ||
assert.equal(parsedGivenTransactionOnNetwork.returnCode, "execution failed"); | ||
assert.lengthOf(parsedGivenTransactionOnNetwork.contracts, 0); | ||
}); | ||
}); |
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
Oops, something went wrong.