Skip to content

Commit

Permalink
Merge branch 'delivan/keplr-274' into delivan/keplr-309
Browse files Browse the repository at this point in the history
  • Loading branch information
delivan committed May 24, 2024
2 parents 40b8d10 + 3217c05 commit edb6dee
Show file tree
Hide file tree
Showing 67 changed files with 800 additions and 365 deletions.
48 changes: 24 additions & 24 deletions apps/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@keplr-wallet/extension",
"version": "0.12.94",
"version": "0.12.96-rc.0",
"author": "chainapsis",
"license": "Apache-2.0",
"private": true,
Expand All @@ -26,29 +26,29 @@
"@ethersproject/transactions": "^5.7.0",
"@floating-ui/react": "^0.23.0",
"@floating-ui/react-dom": "^1.3.0",
"@keplr-wallet/analytics": "0.12.94",
"@keplr-wallet/background": "0.12.94",
"@keplr-wallet/chain-validator": "0.12.94",
"@keplr-wallet/common": "0.12.94",
"@keplr-wallet/cosmos": "0.12.94",
"@keplr-wallet/crypto": "0.12.94",
"@keplr-wallet/hooks": "0.12.94",
"@keplr-wallet/hooks-internal": "0.12.94",
"@keplr-wallet/ledger-cosmos": "0.12.94",
"@keplr-wallet/popup": "0.12.94",
"@keplr-wallet/proto-types": "0.12.94",
"@keplr-wallet/provider": "0.12.94",
"@keplr-wallet/router": "0.12.94",
"@keplr-wallet/router-extension": "0.12.94",
"@keplr-wallet/simple-fetch": "0.12.94",
"@keplr-wallet/stores": "0.12.94",
"@keplr-wallet/stores-core": "0.12.94",
"@keplr-wallet/stores-etc": "0.12.94",
"@keplr-wallet/stores-eth": "0.12.94",
"@keplr-wallet/stores-ibc": "0.12.94",
"@keplr-wallet/stores-internal": "0.12.94",
"@keplr-wallet/types": "0.12.94",
"@keplr-wallet/unit": "0.12.94",
"@keplr-wallet/analytics": "0.12.96-rc.0",
"@keplr-wallet/background": "0.12.96-rc.0",
"@keplr-wallet/chain-validator": "0.12.96-rc.0",
"@keplr-wallet/common": "0.12.96-rc.0",
"@keplr-wallet/cosmos": "0.12.96-rc.0",
"@keplr-wallet/crypto": "0.12.96-rc.0",
"@keplr-wallet/hooks": "0.12.96-rc.0",
"@keplr-wallet/hooks-internal": "0.12.96-rc.0",
"@keplr-wallet/ledger-cosmos": "0.12.96-rc.0",
"@keplr-wallet/popup": "0.12.96-rc.0",
"@keplr-wallet/proto-types": "0.12.96-rc.0",
"@keplr-wallet/provider": "0.12.96-rc.0",
"@keplr-wallet/router": "0.12.96-rc.0",
"@keplr-wallet/router-extension": "0.12.96-rc.0",
"@keplr-wallet/simple-fetch": "0.12.96-rc.0",
"@keplr-wallet/stores": "0.12.96-rc.0",
"@keplr-wallet/stores-core": "0.12.96-rc.0",
"@keplr-wallet/stores-etc": "0.12.96-rc.0",
"@keplr-wallet/stores-eth": "0.12.96-rc.0",
"@keplr-wallet/stores-ibc": "0.12.96-rc.0",
"@keplr-wallet/stores-internal": "0.12.96-rc.0",
"@keplr-wallet/types": "0.12.96-rc.0",
"@keplr-wallet/unit": "0.12.96-rc.0",
"@keystonehq/animated-qr": "^0.8.6",
"@keystonehq/keystone-sdk": "^0.2.3",
"@ledgerhq/devices": "^6.20.0",
Expand Down
2 changes: 2 additions & 0 deletions apps/extension/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,11 @@ const RoutesAfterReady: FunctionComponent = observer(() => {
chainStore.isInitializing,
chainStore.chainInfos,
isURLUnlockPage,
tokenFactoryRegistrar.isInitialized,
ibcCurrencyRegistrar.isInitialized,
lsmCurrencyRegistrar.isInitialized,
priceStore.isInitialized,
price24HChangesStore.isInitialized,
uiConfigStore.isInitialized,
uiConfigStore.isDeveloper,
gravityBridgeCurrencyRegistrar.isInitialized,
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/manifest.v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"name": "Keplr",
"description": "Keplr is a browser extension wallet for the Inter blockchain ecosystem.",
"version": "0.12.94",
"version": "0.12.96",
"icons": {
"16": "assets/icon-16.png",
"48": "assets/icon-48.png",
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/manifest.v3.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"name": "Keplr",
"description": "Keplr is a browser extension wallet for the Inter blockchain ecosystem.",
"version": "0.12.94",
"version": "0.12.96",
"icons": {
"16": "assets/icon-16.png",
"48": "assets/icon-48.png",
Expand Down
6 changes: 4 additions & 2 deletions apps/extension/src/pages/main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ import { DepositModal } from "./components/deposit-modal";
import { MainHeaderLayout } from "./layouts/header";
import { amountToAmbiguousAverage } from "../../utils";
import { InExtensionMessageRequester } from "@keplr-wallet/router-extension";
import { LogAnalyticsEventMsg } from "@keplr-wallet/background";
import {
ChainInfoWithCoreTypes,
LogAnalyticsEventMsg,
} from "@keplr-wallet/background";
import { BACKGROUND_PORT } from "@keplr-wallet/router";
import { useBuy } from "../../hooks/use-buy";
import { ChainInfoWithCoreTypes } from "@keplr-wallet/types";

export interface ViewToken {
token: CoinPretty;
Expand Down
3 changes: 2 additions & 1 deletion apps/extension/src/stores/chain/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import {
runInAction,
} from "mobx";

import { ChainInfo, ChainInfoWithCoreTypes } from "@keplr-wallet/types";
import { ChainInfo } from "@keplr-wallet/types";
import {
ChainStore as BaseChainStore,
IChainInfoImpl,
} from "@keplr-wallet/stores";
import { KeyRingStore } from "@keplr-wallet/stores-core";

import {
ChainInfoWithCoreTypes,
ClearAllChainEndpointsMsg,
ClearAllSuggestedChainInfosMsg,
ClearChainEndpointsMsg,
Expand Down
12 changes: 6 additions & 6 deletions apps/hooks-internal/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@keplr-wallet/hooks-internal",
"version": "0.12.94",
"version": "0.12.96-rc.0",
"main": "build/index.js",
"author": "chainapsis",
"license": "Apache-2.0",
Expand All @@ -14,11 +14,11 @@
"lint-fix": "eslint --fix \"src/**/*\" && prettier --write \"src/**/*\""
},
"dependencies": {
"@keplr-wallet/hooks": "0.12.94",
"@keplr-wallet/stores": "0.12.94",
"@keplr-wallet/stores-internal": "0.12.94",
"@keplr-wallet/types": "0.12.94",
"@keplr-wallet/unit": "0.12.94"
"@keplr-wallet/hooks": "0.12.96-rc.0",
"@keplr-wallet/stores": "0.12.96-rc.0",
"@keplr-wallet/stores-internal": "0.12.96-rc.0",
"@keplr-wallet/types": "0.12.96-rc.0",
"@keplr-wallet/unit": "0.12.96-rc.0"
},
"peerDependencies": {
"mobx": "^6",
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@keplr-wallet/mobile",
"version": "0.12.94",
"version": "0.12.96-rc.0",
"private": true,
"installConfig": {
"hoistingLimits": "workspaces"
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/src/screen/sign/message-registry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {UndelegateMessage} from './undelegate';
import {RedelegateMessage} from './redelegate';
import {VoteMessage} from './renders/vote';
import {ExecuteContractMessage} from './renders/execute-contract';
import {TransferMessage} from './transfer.tsx';

export class MessageRenderRegistry implements IMessageRenderRegistry {
protected renderers: IMessageRenderer[] = [];
Expand Down Expand Up @@ -71,6 +72,7 @@ export class MessageRenderRegistry implements IMessageRenderRegistry {
export const defaultRegistry = new MessageRenderRegistry();
defaultRegistry.register(ClaimRewardsMessage);
defaultRegistry.register(SendMessage);
defaultRegistry.register(TransferMessage);
defaultRegistry.register(DelegateMessage);
defaultRegistry.register(UndelegateMessage);
defaultRegistry.register(RedelegateMessage);
Expand Down
3 changes: 3 additions & 0 deletions apps/mobile/src/screen/sign/renders/wasm-message-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ export const WasmMessageView: FunctionComponent<{
<Button
size="extra-small"
color="secondary"
containerStyle={{
backgroundColor: style.get('color-gray-400').color,
}}
text={
isOpen
? intl.formatMessage({
Expand Down
148 changes: 148 additions & 0 deletions apps/mobile/src/screen/sign/transfer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
import {IMessageRenderer} from './types.ts';
import {MsgTransfer} from '@keplr-wallet/proto-types/ibc/applications/transfer/v1/tx';
import * as ExpoImage from 'expo-image';
import {FormattedMessage, useIntl} from 'react-intl';
import React, {FunctionComponent, useState} from 'react';
import {observer} from 'mobx-react-lite';
import {useStore} from '../../stores';
import {Coin, CoinPretty} from '@keplr-wallet/unit';
import {Bech32Address} from '@keplr-wallet/cosmos';
import {StyleSheet, Text} from 'react-native';
import {useStyle} from '../../styles';
import {XAxis} from '../../components/axis';
import {Button} from '../../components/button';
import {Box} from '../../components/box';
import {Gutter} from '../../components/gutter';

export const TransferMessage: IMessageRenderer = {
process(chainId: string, msg) {
const d = (() => {
if ('type' in msg && msg.type === 'cosmos-sdk/MsgTransfer') {
return {
token: msg.value.token,
receiver: msg.value.receiver,
channelId: msg.value.source_channel,
ibcMemo: msg.value.memo,
};
}

if (
'unpacked' in msg &&
msg.typeUrl === '/ibc.applications.transfer.v1.MsgTransfer'
) {
return {
token: (msg.unpacked as MsgTransfer).token,
receiver: (msg.unpacked as MsgTransfer).receiver,
channelId: (msg.unpacked as MsgTransfer).sourceChannel,
ibcMemo: (msg.unpacked as MsgTransfer).memo,
};
}
})();

if (d) {
return {
icon: (
<ExpoImage.Image
style={{width: 48, height: 48}}
source={require('../../public/assets/img/sign/sign-ibc-transfer.png')}
/>
),
title: (
<FormattedMessage id="page.sign.components.messages.transfer.title" />
),
content: (
<TransferMessagePretty
chainId={chainId}
amount={d.token}
receiver={d.receiver}
channelId={d.channelId}
ibcMemo={d.ibcMemo}
/>
),
};
}
},
};

const TransferMessagePretty: FunctionComponent<{
chainId: string;
amount: Coin;
receiver: string;
channelId: string;
ibcMemo?: string;
}> = observer(({chainId, amount, receiver, channelId, ibcMemo}) => {
const {chainStore} = useStore();

const intl = useIntl();
const style = useStyle();

const [isOpen, setIsOpen] = useState(false);

const currency = chainStore.getChain(chainId).forceFindCurrency(amount.denom);
const coinPretty = new CoinPretty(currency, amount.amount);

return (
<React.Fragment>
<Text style={style.flatten(['body3', 'color-text-middle'])}>
<FormattedMessage
id="page.sign.components.messages.transfer.paragraph"
values={{
coin: coinPretty.trim(true).toString(),
address: Bech32Address.shortenAddress(receiver, 20),
channelId,
b: (...chunks: any) => (
<Text style={{fontWeight: 'bold'}}>{chunks}</Text>
),
}}
/>
</Text>

{ibcMemo ? (
<Box>
<Gutter size={6} />

{isOpen ? (
<React.Fragment>
<Text
style={StyleSheet.flatten([
style.flatten(['body3', 'color-text-middle']),
{width: 240, margin: 0, marginBottom: 8},
])}>
{isOpen
? (() => {
try {
return JSON.stringify(JSON.parse(ibcMemo), null, 2);
} catch {
return ibcMemo;
}
})()
: ''}
</Text>
</React.Fragment>
) : null}
<XAxis>
<Button
size="extra-small"
color="secondary"
containerStyle={{
backgroundColor: style.get('color-gray-400').color,
}}
text={
isOpen
? intl.formatMessage({
id: 'page.sign.components.messages.wasm-message-view.close-button',
})
: intl.formatMessage({
id: 'page.sign.components.messages.wasm-message-view.details-button',
})
}
onPress={() => {
setIsOpen(!isOpen);
}}
/>
</XAxis>
</Box>
) : null}
</React.Fragment>
);
});
14 changes: 7 additions & 7 deletions apps/stores-internal/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@keplr-wallet/stores-internal",
"version": "0.12.94",
"version": "0.12.96-rc.0",
"main": "build/index.js",
"author": "chainapsis",
"license": "Apache-2.0",
Expand All @@ -14,12 +14,12 @@
"lint-fix": "eslint --fix \"src/**/*\" && prettier --write \"src/**/*\""
},
"dependencies": {
"@keplr-wallet/common": "0.12.94",
"@keplr-wallet/cosmos": "0.12.94",
"@keplr-wallet/simple-fetch": "0.12.94",
"@keplr-wallet/stores": "0.12.94",
"@keplr-wallet/types": "0.12.94",
"@keplr-wallet/unit": "0.12.94",
"@keplr-wallet/common": "0.12.96-rc.0",
"@keplr-wallet/cosmos": "0.12.96-rc.0",
"@keplr-wallet/simple-fetch": "0.12.96-rc.0",
"@keplr-wallet/stores": "0.12.96-rc.0",
"@keplr-wallet/types": "0.12.96-rc.0",
"@keplr-wallet/unit": "0.12.96-rc.0",
"joi": "^17.5.0",
"utility-types": "^3.10.0"
},
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.12.94",
"version": "0.12.96-rc.0",
"useWorkspaces": true,
"npmClient": "yarn",
"command": {
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@keplr-wallet/analytics",
"version": "0.12.94",
"version": "0.12.96-rc.0",
"main": "build/index.js",
"author": "chainapsis",
"license": "Apache-2.0",
Expand Down
Loading

0 comments on commit edb6dee

Please sign in to comment.