feat: returning original txid from 'bundleInteraction'

This commit is contained in:
ppedziwiatr
2022-01-28 15:00:36 +01:00
parent 6aa1a6a6de
commit 5bbced086b
2 changed files with 7 additions and 4 deletions

View File

@@ -240,7 +240,10 @@ export class HandlerBasedContract<State> implements Contract<State> {
throw new Error(`Unable to bundle interaction: ${JSON.stringify(error)}`); throw new Error(`Unable to bundle interaction: ${JSON.stringify(error)}`);
}); });
return response; return {
bundlrResponse: response,
originalTxId: interactionTx.id
};
} }
private async createInteraction<Input>( private async createInteraction<Input>(

View File

@@ -30,7 +30,7 @@ async function main() {
const smartweave = SmartWeaveNodeFactory.memCachedBased(arweave) const smartweave = SmartWeaveNodeFactory.memCachedBased(arweave)
.setInteractionsLoader( .setInteractionsLoader(
new RedstoneGatewayInteractionsLoader('http://localhost:5666', { notCorrupted: true }) new RedstoneGatewayInteractionsLoader('https://gateway.redstone.finance', { notCorrupted: true })
) )
.setDefinitionLoader( .setDefinitionLoader(
new RedstoneGatewayContractDefinitionLoader('https://gateway.redstone.finance', arweave, new MemCache()) new RedstoneGatewayContractDefinitionLoader('https://gateway.redstone.finance', arweave, new MemCache())
@@ -42,7 +42,7 @@ async function main() {
const token = smartweave const token = smartweave
.contract("OrO8n453N6bx921wtsEs-0OCImBLCItNU5oSbFKlFuU") .contract("OrO8n453N6bx921wtsEs-0OCImBLCItNU5oSbFKlFuU")
.setEvaluationOptions({ .setEvaluationOptions({
sequencerAddress: "http://localhost:5666/" sequencerAddress: "https://gateway.redstone.finance/"
}) })
// connecting wallet to a contract. It is required before performing any "writeInteraction" // connecting wallet to a contract. It is required before performing any "writeInteraction"
// calling "writeInteraction" without connecting to a wallet first will cause a runtime error. // calling "writeInteraction" without connecting to a wallet first will cause a runtime error.
@@ -60,7 +60,7 @@ async function main() {
}, },
}); });
logger.info("Result from the sequencer", result.id); logger.info("Result from the sequencer", result);
// the new transaction is instantly available - ie. during the state read operation // the new transaction is instantly available - ie. during the state read operation
const result2 = await token.readState(); const result2 = await token.readState();