Skip to content

Commit 94cf97c

Browse files
committed
chore(sdk-core): sui pass gas limit param in prebuild
Ticket: BG-63034
1 parent ee3841d commit 94cf97c

3 files changed

Lines changed: 28 additions & 0 deletions

File tree

modules/bitgo/test/v2/unit/wallet.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,6 +1300,22 @@ describe('V2 Wallet:', function () {
13001300

13011301
response.isDone().should.be.true();
13021302
});
1303+
1304+
it('should pass gas limit parameter through when building transaction for sui', async function () {
1305+
const params = { gasLimit: 100 };
1306+
const path = `/api/v2/${wallet.coin()}/wallet/${wallet.id()}/tx/build`;
1307+
const response = nock(bgUrl)
1308+
.post(path, _.matches(params)) // use _.matches to do a partial match on request body object instead of strict matching
1309+
.reply(200);
1310+
try {
1311+
await wallet.prebuildTransaction(params);
1312+
} catch (e) {
1313+
// the prebuildTransaction method will probably throw an exception for not having all of the correct nocks
1314+
// we only care about /tx/build and whether reservation is an allowed parameter
1315+
}
1316+
1317+
response.isDone().should.be.true();
1318+
});
13031319
});
13041320

13051321
describe('Maximum Spendable', function maximumSpendable() {

modules/sdk-core/src/bitgo/utils/mpcUtils.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,16 @@ export abstract class MpcUtils {
161161
}
162162
}
163163

164+
if (params.feeOptions !== undefined) {
165+
return {
166+
...baseIntent,
167+
memo: params.memo?.value,
168+
token: params.tokenName,
169+
enableTokens: params.enableTokens,
170+
feeOptions: params.feeOptions,
171+
};
172+
}
173+
164174
return {
165175
...baseIntent,
166176
memo: params.memo?.value,

modules/sdk-core/src/bitgo/wallet/wallet.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2554,6 +2554,8 @@ export class Wallet implements IWallet {
25542554
maxPriorityFeePerGas: Number(params.eip1559?.maxPriorityFeePerGas),
25552555
gasLimit: params.gasLimit,
25562556
};
2557+
} else if (params.gasLimit !== undefined) {
2558+
feeOptions = { gasLimit: params.gasLimit };
25572559
} else {
25582560
feeOptions = undefined;
25592561
}

0 commit comments

Comments
 (0)