fix: trying to fix arlocal issues with loading wasm binaries..
This commit is contained in:
@@ -121,8 +121,6 @@ describe('Testing the Go WASM Profit Sharing Token', () => {
|
||||
it('should properly deploy contract', async () => {
|
||||
const contractTx = await arweave.transactions.get(contractTxId);
|
||||
|
||||
console.log(contractTx.id);
|
||||
|
||||
expect(contractTx).not.toBeNull();
|
||||
expect(getTag(contractTx, SmartWeaveTags.CONTRACT_TYPE)).toEqual('wasm');
|
||||
expect(getTag(contractTx, SmartWeaveTags.WASM_LANG)).toEqual('go');
|
||||
|
||||
@@ -90,10 +90,21 @@ export class ArweaveWrapper {
|
||||
|
||||
async txData(id: string): Promise<Buffer> {
|
||||
// https://github.com/textury/arlocal/issues/83
|
||||
const txData = (await this.arweave.transactions.getData(id, {
|
||||
decode: true
|
||||
})) as Uint8Array;
|
||||
return isomorphicBuffer.from(txData);
|
||||
try {
|
||||
const txData = (await this.arweave.transactions.getData(id, {
|
||||
decode: true
|
||||
})) as Uint8Array;
|
||||
return isomorphicBuffer.from(txData);
|
||||
} catch (e) {
|
||||
const response = await fetch(`${this.baseUrl}/${id}`);
|
||||
if (!response.ok) {
|
||||
this.logger.error(e);
|
||||
this.logger.error(response.statusText);
|
||||
throw new Error('Unable to load tx data');
|
||||
}
|
||||
const buffer = await response.arrayBuffer();
|
||||
return isomorphicBuffer.from(buffer);
|
||||
}
|
||||
|
||||
// note: this is using arweave.net cache -
|
||||
// not very safe and clever, but fast...
|
||||
|
||||
Reference in New Issue
Block a user