Skip to content

Commit

Permalink
add window.mbjs.callbackUrl back to execute to all wallets (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenmarcus authored Jan 8, 2024
1 parent 889d9ac commit 774ffae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/sdk/src/execute/execute.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @jest-environment jsdom
*/

/* eslint-disable @typescript-eslint/no-explicit-any */
import { execute } from './execute';
import { MAX_GAS, ONE_YOCTO } from '../constants';
Expand Down
13 changes: 10 additions & 3 deletions packages/sdk/src/execute/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@ export const execute = async (

let callbackFinal = callbackUrl;

const shouldGetFromMbjs = callbackUrl?.length < 1 || callbackUrl === undefined &&
window?.['mbjs']?.callbackUrl && window?.['mbjs']?.callbackUrl.length > 0;

if (wallet?.id == 'mintbase-wallet') {
if (callbackUrl?.length < 1 || callbackUrl === undefined) {
let mbjsCallbackUrl = '';

if (
window?.['mbjs']?.keys?.callbackUrl &&
window?.['mbjs']?.keys?.callbackUrl.length > 0
window?.['mbjs']?.callbackUrl &&
window?.['mbjs']?.callbackUrl.length > 0
) {
mbjsCallbackUrl = window?.['mbjs']?.keys?.callbackUrl;
mbjsCallbackUrl = window?.['mbjs']?.callbackUrl;
}

const globalCBUrl =
Expand All @@ -42,6 +45,10 @@ export const execute = async (
}
}

if (shouldGetFromMbjs) {
callbackFinal = window?.['mbjs']?.callbackUrl;
}

const outcomes = await genericBatchExecute(
flattenArgs(calls),
wallet,
Expand Down

0 comments on commit 774ffae

Please sign in to comment.