Skip to content

Commit

Permalink
fix: issue when using testnet05 it wouldn't use the right error message
Browse files Browse the repository at this point in the history
  • Loading branch information
alber70g committed Dec 3, 2024
1 parent 9719083 commit 7ed927f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
1 change: 1 addition & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ <h1>Kadena Coin Transfer</h1>
<a href="transfer-create.html"><button id="submit-button" class="ui primary button">Transfer</button></a>
<a href="ledger.html"><button id="transfer-button" class="ui primary button">Ledger Tools</button></a>
<button id="xchain-button" onclick="redirectToNewFinisher()" class="ui primary button">Finish Cross Chain Transfer</button>
<a href="xchain.html"><button id="xchain-button" class="ui primary button">Finish Cross Chain Transfer (Old)</button></a>
</div>
<div style="margin-top:10px;">
<a href="https://balance.chainweb.com"><button class="ui primary button">Check Account Balance</button></a>
Expand Down
3 changes: 1 addition & 2 deletions docs/xchain.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ <h1>Finish Cross Chain Transfer</h1>
type="text"
id="gas-payer"
placeholder="kadena-xchain-gas"
value="kadena-xchain-gas"
value="kadena-xchain-gass"
/>
<!-- <button id="verify-gas-payer" class="ui primary button">Verify</button> -->
</div>

<div class="field">
Expand Down
25 changes: 17 additions & 8 deletions docs/xchain.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ async function listen() {
document.getElementById('status-message').textContent =
'TRANSFER FAILED with error';
document.getElementById('status-error').textContent = JSON.stringify(
res.result.error.message,
res.result.error.message || res.result.error.errorMsg,
);
window.localStorage.removeItem('xchain-request-key');
}
Expand All @@ -440,10 +440,12 @@ async function finishXChain() {
makeRawRequestInit(signedTransaction),
).then(r => r.json());
if (
testLocal.result.status === 'failure' &&
testLocal.result.error.message.includes('pact completed')
(testLocal.result.status === 'failure' &&
testLocal.result.error.message?.includes('pact completed')) ||
(testLocal.result.status === 'failure' &&
testLocal.result.error.errorMsg?.includes('pact completed'))
) {
setError(testLocal.result.error.message);
setError(testLocal.result.error.message || testLocal.result.error.errorMsg);
return;
}

Expand Down Expand Up @@ -502,10 +504,14 @@ async function finishXChain() {
makeRawRequestInit(JSON.stringify(c.cmds[0])),
).then(r => r.json());
if (
testLocal.result.status === 'failure' &&
testLocal.result.error.message.includes('pact completed')
(testLocal.result.status === 'failure' &&
testLocal.result.error.message?.includes('pact completed')) ||
(testLocal.result.status === 'failure' &&
testLocal.result.error.errorMsg?.includes('pact completed'))
) {
setError(testLocal.result.error.message);
setError(
testLocal.result.error?.message || testLocal.result.error?.errorMsg,
);
return;
}
} catch (e) {
Expand Down Expand Up @@ -699,8 +705,11 @@ function isAccountEligibleForGasPayment() {
if (State.gasPayerAccountDetails.result.status === 'failure') {
// an error occurrred
if (
State.gasPayerAccountDetails.result.error.message.includes(
State.gasPayerAccountDetails.result.error.message?.includes(
'row not found',
) ||
State.gasPayerAccountDetails.result.error.errorMsg?.includes(
'No value found in table',
)
) {
setError(
Expand Down

0 comments on commit 7ed927f

Please sign in to comment.