Skip to content

Commit

Permalink
Merge pull request #27 from jmrossy/aaronmgdr/no-66-default
Browse files Browse the repository at this point in the history
Do not automatically create cip66 transactions ever
  • Loading branch information
jmrossy authored Aug 13, 2024
2 parents 8e531ee + d0f471d commit 3580f10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/lib/CeloWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ export default class CeloWallet extends Wallet {
// sets feedata for the transaction.
//
async populateFees(tx: CeloTransactionRequest) {
const isCel2 = await this.isCel2();
const noFeeCurrency = !tx.feeCurrency;
const useCIP66ForEasyFeeTransactions = isCel2 && !noFeeCurrency;
const useCIP66ForEasyFeeTransactions = false // cip66 is not yet implemented in nodes
// CIP 66 transactions are denominated in CELO not the fee token
const feesAreInCELO = noFeeCurrency || useCIP66ForEasyFeeTransactions;

Expand Down Expand Up @@ -175,12 +174,13 @@ export default class CeloWallet extends Wallet {
}

/**
* For cip 66 transactions (the prefered way to pay for gas with fee tokens on Cel2) it is necessary
* to provide the absolute limit one is willing to pay denominated in the token.
* @remarks For cip 66 transactions it is necessary to provide the absolute limit one is willing to pay denominated in the token.
* In contrast with earlier tx types for fee currencies (celo legacy, cip42, cip 64).
*
* Calulating Estimation requires the gas, maxfeePerGas and the conversion rate from CELO to feeToken
* https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip-0066.md
*
* @dev cip66 has yet to be implemented on celo nodes. Dont add maxFeeInFeeCurrency to your transaction. use cip64
*/
async estimateMaxFeeInFeeToken({
gasLimit,
Expand Down
4 changes: 2 additions & 2 deletions tests/CeloWallet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("CeloWallet", () => {
});
});
describe("when feeCurrency on cel2", () => {
test("populates maxFeePerGas and maxPriorityFeePerGas and maxFeeInFeeCurrency", async () => {
test("populates maxFeePerGas and maxPriorityFeePerGas (not maxFeeInFeeCurrency)", async () => {
const wallet = getSigner();

jest.spyOn(wallet, "isCel2").mockImplementation(async () => true);
Expand All @@ -36,7 +36,7 @@ describe("CeloWallet", () => {
expect(typeof filled.maxFeePerGas).toEqual("bigint");
expect(typeof filled.maxPriorityFeePerGas).toEqual("bigint");

expect(typeof filled.maxFeeInFeeCurrency).toEqual("bigint");
expect(filled.maxFeeInFeeCurrency).toBeUndefined();
expect(filled.feeCurrency).toEqual(USDC_ADAPTER_ALFAJORES_ADDRESS);
});
});
Expand Down

0 comments on commit 3580f10

Please sign in to comment.