Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: gas free #2224

Merged
merged 20 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion _raw/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"gasLimitNotEnough": "Gas limit is less than 21000. Transaction can't be submitted",
"gasLimitLessThanExpect": "Gas limit is low. There is 1% chance that the transaction may fail.",
"gasLimitLessThanGasUsed": "Gas limit is too low. There is 95% chance that the transaction may fail.",
"nativeTokenNotEngouthForGas": "You do not have enough gas in your wallet",
"nativeTokenNotEngouthForGas": "Gas balance is not enough for transaction",
"nonceLowerThanExpect": "Nonce is too low, the minimum should be {{0}}",
"canOnlyUseImportedAddress": "You can only use imported addresses to sign",
"multiSigChainNotMatch": "Multi-signature addresses are not on this chain and cannot initiate transactions",
Expand Down Expand Up @@ -307,6 +307,12 @@
"keystoneConnected": "Keystone is connected",
"ledgerConnected": "Ledger is connected",
"signAndSubmitButton": "Sign and Create",
"gasless": {
"unavailable": "Gas balance is not enough for this transaction",
"notEnough": "Gas balance is not enough",
"GetFreeGasToSign": "Get Free Gas to sign",
"rabbyPayGas": "Rabby'll pay for the gas needed – just sign on"
},
"walletConnect": {
"connectedButCantSign": "Connected but unable to sign.",
"switchToCorrectAddress": "Please switch to the correct address in mobile wallet",
Expand Down
1 change: 1 addition & 0 deletions changeLogs/09269.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Supported Free Gas - sign transactions smoothly with Rabby Wallet, even if your gas is not enough
2 changes: 2 additions & 0 deletions changeLogs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import version09259 from './09259.md';
import version09264 from './09264.md';
import version09266 from './09266.md';
import version09268 from './09268.md';
import version09269 from './09269.md';

const version = process.env.release || '0';
const versionMap = {
Expand Down Expand Up @@ -154,6 +155,7 @@ const versionMap = {
'0.92.64': version09264,
'0.92.66': version09266,
'0.92.68': version09268,
'0.92.69': version09269,
};
export const getUpdateContent = () => {
return versionMap[version];
Expand Down
1 change: 1 addition & 0 deletions changeLogs/zh_CN/09269.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- 支持免费 Gas - 即使你的 Gas 不足,也可以使用 Rabby 流畅的签名交易
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
"@rabby-wallet/eth-walletconnect-keyring": "2.1.3",
"@rabby-wallet/eth-watch-keyring": "1.0.0",
"@rabby-wallet/gnosis-sdk": "1.3.6",
"@rabby-wallet/rabby-api": "0.7.14-beta.2",
"@rabby-wallet/page-provider": "0.3.4",
"@rabby-wallet/rabby-api": "0.7.13",
"@rabby-wallet/rabby-security-engine": "1.1.20",
"@rabby-wallet/rabby-swap": "0.0.36",
"@rabby-wallet/widgets": "1.0.9",
Expand Down
4 changes: 4 additions & 0 deletions src/background/controller/provider/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ interface ApprovalRes extends Tx {
pushType?: TxPushType;
lowGasDeadline?: number;
reqId?: string;
isGasLess?: boolean;
}

interface Web3WalletPermission {
Expand Down Expand Up @@ -359,6 +360,7 @@ class ProviderController extends BaseController {
const pushType = approvalRes.pushType || 'default';
const lowGasDeadline = approvalRes.lowGasDeadline;
const preReqId = approvalRes.reqId;
const isGasLess = approvalRes.isGasLess || false;

let signedTransactionSuccess = false;
delete txParams.isSend;
Expand All @@ -377,6 +379,7 @@ class ProviderController extends BaseController {
delete approvalRes.lowGasDeadline;
delete approvalRes.reqId;
delete txParams.isCoboSafe;
delete approvalRes.isGasLess;

let is1559 = is1559Tx(approvalRes);
if (
Expand Down Expand Up @@ -689,6 +692,7 @@ class ProviderController extends BaseController {
low_gas_deadline: lowGasDeadline,
req_id: preReqId || '',
origin,
is_gasless: isGasLess,
});
hash = res.req.tx_id || undefined;
reqId = res.req.id || undefined;
Expand Down
2 changes: 2 additions & 0 deletions src/constant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,7 @@ export const SAFE_GAS_LIMIT_RATIO = {
export const GAS_TOP_UP_ADDRESS = '0x7559e1bbe06e94aeed8000d5671ed424397d25b5';
export const GAS_TOP_UP_PAY_ADDRESS =
'0x1f1f2bf8942861e6194fda1c0a9f13921c0cf117';
export const FREE_GAS_ADDRESS = '0x76dd65529dc6c073c1e0af2a5ecc78434bdbf7d9';

export const GAS_TOP_UP_SUPPORT_TOKENS: Record<string, string[]> = {
arb: [
Expand Down Expand Up @@ -1211,6 +1212,7 @@ export const EXTERNAL_RESOURCE_DOMAIN_BLACK_LIST = ['5degrees.io'];
export const ALIAS_ADDRESS = {
[GAS_TOP_UP_ADDRESS]: 'Gas Top Up',
[GAS_TOP_UP_PAY_ADDRESS]: 'Gas Top Up',
[FREE_GAS_ADDRESS]: 'Free Gas',
};

// non-opstack L2 chains
Expand Down
17 changes: 17 additions & 0 deletions src/ui/assets/sign/tx/bg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions src/ui/assets/sign/tx/gas-cc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/ui/assets/sign/tx/link.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions src/ui/assets/sign/tx/rabby.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/ui/views/AddressManagement/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ const AddressManagement = () => {
{enableSwitch
? t('page.manageAddress.current-address')
: t('page.manageAddress.address-management')}
<div className="absolute top-24 right-[42px]">
<div className="absolute top-24 right-[36px]">
<RcIconAddAddress
viewBox="0 0 20 20"
className={clsx(
Expand Down Expand Up @@ -586,11 +586,11 @@ const AddressManagement = () => {
onChange={(e) => setSearchKeyword(e.target.value)}
/>
<div
className="flex items-center cursor-pointer"
className="flex items-center cursor-pointer "
onClick={gotoManageAddress}
>
<span>{t('page.manageAddress.manage-address')}</span>
<RcIconRight />
<RcIconRight className="relative top-1" />
</div>
</div>
{noAnyAccount ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface Props {
tooltipContent?: React.ReactNode;
children?: React.ReactNode;
chain?: Chain;
gasLess?: boolean;
}

export const ActionsContainer: React.FC<Pick<Props, 'onCancel'>> = ({
Expand Down
Loading
Loading