Closed grctest closed 10 months ago
Attempting to change the instance code to the following in line with bitsharesjs-ws readme example:
return Apis.instance(
node,
true,
10000,
{ enableCrypto: false, enableOrders: true },
(error) => console.log(error),
).init_promise.then(async (res) => {
console.log("connected to:", res[0].network);
const tr = new TXBuilder();
tr.add_type_operation(opType, opContents);
try {
await tr.update_head_block();
} catch (error) {
console.error(error);
return;
}
try {
await tr.set_required_fees();
} catch (error) {
console.error(error);
return;
}
try {
tr.set_expire_seconds(7200);
} catch (error) {
console.error(error);
return;
}
try {
tr.add_signer("inject_wif");
} catch (error) {
console.error(error);
return;
}
try {
tr.finalize();
} catch (error) {
console.error(error);
return;
}
let encryptedPayload;
try {
encryptedPayload = await tr.encrypt();
} catch (error) {
console.error(error);
return;
}
return encryptedPayload;
}).catch((error) => {
console.log(error);
});
This ensures the instance connection, however I'm still getting the error:
connected to:
{
"core_asset": "BTS",
"address_prefix": "BTS",
"chain_id": "4018d7844c78f6a6c41c6a552b898022310fc5dec06da467ee7905a8dad512c8"
}
TypeError: Cannot read properties of undefined (reading 'exec')
at TransactionBuilder2.update_head_block (TransactionBuilder.js:318:48)
at generate.js?t=1686013632315:49:16
at async fetchData (Create.jsx:114:19)
Disabling the optional update_head_block, set_required_fees and set_expire_seconds results in the following error:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'exec')
at TransactionBuilder.js:158:40
at new Promise (<anonymous>)
at TransactionBuilder2.finalize (TransactionBuilder.js:133:12)
at generate.js?t=1686013922531:79:10
at async fetchData (Create.jsx:114:19)
The deeplink does generate, but it's incomplete:
{"type":"api","id":"774e9d2c-1993-4f47-93cf-b49923082723","payload":{"method":"injectedCall","params":["signAndBroadcast","{\"ref_block_num\":0,\"ref_block_prefix\":0,\"expiration\":\"1970-01-01T00:00:00\",\"operations\":[[57,{\"fee\":{\"amount\":\"0\",\"asset_id\":\"1.3.0\"},\"account\":\"1.2.555\",\"target_type\":\"1\",\"amount\":{\"amount\":\"100000\",\"asset_id\":\"1.3.0\"},\"extensions\":[]}]],\"extensions\":[],\"signatures\":[]}",null],"appName":"creating_ticket","chain":"BTS","browser":"airdrop_tool","origin":"localhost"}}
I wrapped the function in a promise and downgraded the library from the develop branch to using the ^6.0.0 main release.
Perhaps there's something in the develop branch causing this issue?
I can't easily spot what's causing this in the develop branch? Perhaps using the 6.0.0-rc1 bitsharesjs-ws dependency instead of ^6.0.0 ? I'm using 6.0.0 not 6.0.0-rc1 to create the API instance, so perhaps they're not recognizing each other?
Or perhaps this is an environmental issue caused by building the develop bitsharesjs locally? Hmm
I'm suddenly getting the following error and I'm struggling to debug it, anyone run into this before?
Triggering from: https://github.com/BTS-CM/airdrop_tool/blob/develop/src/pages/Create.jsx#LL101C29-L101C30
Fails here: https://github.com/BTS-CM/airdrop_tool/blob/develop/src/lib/generate.js#L53
example generate deeplink inputs:
Works here: https://github.com/BTS-CM/airdrop_tool/blob/main/src/pages/Create.jsx#L131 (Main branch)
Also works here: https://github.com/BTS-CM/beet-deeplinks/blob/main/examples/BTS/057_ticket_create.js
Would appreciate any help on this, once this error is resolved I'll be translating the locale strings and creating a new release with new features and additional locales. I wasn't expecting this to stop working..