Skip to content
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
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ android {
applicationId "io.metamask"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionName "7.61.99"
versionName "7.61.0"
versionCode 3092
testBuildType System.getProperty('testBuildType', 'debug')
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,16 @@ const PredictBalance: React.FC<PredictBalanceProps> = ({ onLayout }) => {
</Box>
<Skeleton width={48} height={48} style={tw.style('rounded-full')} />
</Box>
<Box flexDirection={BoxFlexDirection.Row} twClassName="gap-2">
<Box flexDirection={BoxFlexDirection.Row} twClassName="gap-3">
<Skeleton
width="50%"
height={40}
style={tw.style('rounded-full flex-1')}
style={tw.style('rounded-xl flex-1')}
/>
<Skeleton
width="50%"
height={40}
style={tw.style('rounded-full flex-1')}
style={tw.style('rounded-xl flex-1')}
/>
</Box>
</Box>
Expand Down Expand Up @@ -145,11 +145,11 @@ const PredictBalance: React.FC<PredictBalanceProps> = ({ onLayout }) => {
alignItems={BoxAlignItems.Center}
>
<Box>
<Text style={tw.style('text-heading-md font-bold')}>
<Text style={tw.style('text-body-md font-bold')}>
{formatPrice(balance, { maximumDecimals: 2 })}
</Text>
<Text
style={tw.style('color-alternative')}
style={tw.style('color-alternative text-body-sm')}
color={TextColor.Alternative}
>
{strings('predict.available_balance')}
Expand All @@ -162,6 +162,7 @@ const PredictBalance: React.FC<PredictBalanceProps> = ({ onLayout }) => {
<Badge
variant={BadgeVariant.Network}
imageSource={images.POL}
style={tw.style('border-background-muted')}
name="Polygon"
/>
}
Expand All @@ -173,7 +174,7 @@ const PredictBalance: React.FC<PredictBalanceProps> = ({ onLayout }) => {
/>
</BadgeWrapper>
</Box>
<Box flexDirection={BoxFlexDirection.Row} twClassName="gap-2">
<Box flexDirection={BoxFlexDirection.Row} twClassName="gap-3">
<Button
variant={
hasBalance ? ButtonVariants.Secondary : ButtonVariants.Primary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ const PredictPositionsHeader = forwardRef<
<Box
flexDirection={BoxFlexDirection.Row}
alignItems={BoxAlignItems.Center}
twClassName="flex-row items-center"
twClassName="flex-row items-center gap-1"
>
{isBalanceLoading ? (
<Skeleton
Expand Down
8 changes: 8 additions & 0 deletions app/components/UI/Predict/constants/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export const PREDICT_ERROR_CODES = {
ACTIVITY_NOT_AVAILABLE: 'PREDICT_ACTIVITY_NOT_AVAILABLE',
DEPOSIT_FAILED: 'PREDICT_DEPOSIT_FAILED',
WITHDRAW_FAILED: 'PREDICT_WITHDRAW_FAILED',
BUY_ORDER_NOT_FULLY_FILLED: 'PREDICT_BUY_ORDER_NOT_FULLY_FILLED',
SELL_ORDER_NOT_FULLY_FILLED: 'PREDICT_SELL_ORDER_NOT_FULLY_FILLED',
} as const;

export const getPredictErrorMessages = () =>
Expand Down Expand Up @@ -59,4 +61,10 @@ export const getPredictErrorMessages = () =>
[PREDICT_ERROR_CODES.ORDER_NOT_FULLY_FILLED]: strings(
'predict.error_messages.order_not_fully_filled',
),
[PREDICT_ERROR_CODES.BUY_ORDER_NOT_FULLY_FILLED]: strings(
'predict.error_messages.buy_order_not_fully_filled',
),
[PREDICT_ERROR_CODES.SELL_ORDER_NOT_FULLY_FILLED]: strings(
'predict.error_messages.sell_order_not_fully_filled',
),
}) as const;
4 changes: 4 additions & 0 deletions app/components/UI/Predict/controllers/PredictController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,10 @@ export class PredictController extends BaseController<
});
geoBlockResponse.isEligible = !isLocallyGeoblocked;
}
if (process.env.MM_PREDICT_SKIP_GEOBLOCK === 'true') {
geoBlockResponse.isEligible = true;
geoBlockResponse.country = 'N/A';
}
this.update((state) => {
state.eligibility[providerId] = {
eligible: geoBlockResponse.isEligible,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
Recurrence,
Side,
} from '../../types';
import { PREDICT_ERROR_CODES } from '../../constants/errors';
import { OrderPreview, PlaceOrderParams } from '../types';
import { PolymarketProvider } from './PolymarketProvider';
import {
Expand Down Expand Up @@ -1102,6 +1103,54 @@ describe('PolymarketProvider', () => {
expect(result.error).toBe('Maker address not found');
});

it('returns BUY_ORDER_NOT_FULLY_FILLED error when buy order cannot be fully filled', async () => {
// Arrange
const { provider, mockSigner } = setupPlaceOrderTest();
mockSubmitClobOrder.mockResolvedValue({
success: false,
response: undefined,
error: `order couldn't be fully filled`,
});
const preview = createMockOrderPreview({ side: Side.BUY });
const orderParams = {
signer: mockSigner,
providerId: 'polymarket',
preview,
};

// Act
const result = await provider.placeOrder(orderParams);

// Assert
expect(result.success).toBe(false);
expect(result.error).toBe(PREDICT_ERROR_CODES.BUY_ORDER_NOT_FULLY_FILLED);
});

it('returns SELL_ORDER_NOT_FULLY_FILLED error when sell order cannot be fully filled', async () => {
// Arrange
const { provider, mockSigner } = setupPlaceOrderTest();
mockSubmitClobOrder.mockResolvedValue({
success: false,
response: undefined,
error: `order couldn't be fully filled`,
});
const preview = createMockOrderPreview({ side: Side.SELL });
const orderParams = {
signer: mockSigner,
providerId: 'polymarket',
preview,
};

// Act
const result = await provider.placeOrder(orderParams);

// Assert
expect(result.success).toBe(false);
expect(result.error).toBe(
PREDICT_ERROR_CODES.SELL_ORDER_NOT_FULLY_FILLED,
);
});

it('fetches account state when not cached during placeOrder', async () => {
const { provider, mockSigner } = setupPlaceOrderTest();
const preview = createMockOrderPreview({ side: Side.BUY });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,11 @@ export class PolymarketProvider implements PredictProvider {
outcomeTokenId,
});
if (error.includes(`order couldn't be fully filled`)) {
throw new Error(PREDICT_ERROR_CODES.ORDER_NOT_FULLY_FILLED);
throw new Error(
side === Side.BUY
? PREDICT_ERROR_CODES.BUY_ORDER_NOT_FULLY_FILLED
: PREDICT_ERROR_CODES.SELL_ORDER_NOT_FULLY_FILLED,
);
}
if (
error.includes(`not available in your region`) ||
Expand Down
4 changes: 2 additions & 2 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3577,13 +3577,13 @@ app:
PROJECT_LOCATION_IOS: ios
- opts:
is_expand: false
VERSION_NAME: 7.61.99
VERSION_NAME: 7.61.0
- opts:
is_expand: false
VERSION_NUMBER: 3092
- opts:
is_expand: false
FLASK_VERSION_NAME: 7.61.99
FLASK_VERSION_NAME: 7.61.0
- opts:
is_expand: false
FLASK_VERSION_NUMBER: 3092
Expand Down
12 changes: 6 additions & 6 deletions ios/MetaMask.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@
"${inherited}",
);
LLVM_LTO = YES;
MARKETING_VERSION = 7.61.99;
MARKETING_VERSION = 7.61.0;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -1385,7 +1385,7 @@
"${inherited}",
);
LLVM_LTO = YES;
MARKETING_VERSION = 7.61.99;
MARKETING_VERSION = 7.61.0;
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -1454,7 +1454,7 @@
"\"$(SRCROOT)/MetaMask/System/Library/Frameworks\"",
);
LLVM_LTO = YES;
MARKETING_VERSION = 7.61.99;
MARKETING_VERSION = 7.61.0;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -1518,7 +1518,7 @@
"\"$(SRCROOT)/MetaMask/System/Library/Frameworks\"",
);
LLVM_LTO = YES;
MARKETING_VERSION = 7.61.99;
MARKETING_VERSION = 7.61.0;
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -1684,7 +1684,7 @@
"\"$(SRCROOT)/MetaMask/System/Library/Frameworks\"",
);
LLVM_LTO = YES;
MARKETING_VERSION = 7.61.99;
MARKETING_VERSION = 7.61.0;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
"$(inherited)",
Expand Down Expand Up @@ -1751,7 +1751,7 @@
"\"$(SRCROOT)/MetaMask/System/Library/Frameworks\"",
);
LLVM_LTO = YES;
MARKETING_VERSION = 7.61.99;
MARKETING_VERSION = 7.61.0;
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = (
"$(inherited)",
Expand Down
4 changes: 3 additions & 1 deletion locales/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1991,7 +1991,9 @@
"preview_no_order_match_sell": "There isn't enough demand at market price to cash out right now.",
"claim_failed": "Failed to claim",
"unknown_error": "An unknown error occurred",
"order_not_fully_filled": "Failed to fill your order"
"order_not_fully_filled": "Failed to fill your order",
"buy_order_not_fully_filled": "Not enough shares available at market price to place your order right now.",
"sell_order_not_fully_filled": "There isn't enough demand at market price to cash out right now."
}
},
"receive": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "metamask",
"version": "7.61.99",
"version": "7.61.0",
"private": true,
"scripts": {
"install:foundryup": "yarn mm-foundryup",
Expand Down
Loading