Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Thunnini committed Apr 5, 2024
2 parents 0b1fd77 + e5f7890 commit 9f1ca3f
Show file tree
Hide file tree
Showing 93 changed files with 6,895 additions and 584 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
KEPLR_EXT_GOOGLE_API_KEY_FOR_MEASUREMENT: ${{ secrets.KEPLR_EXT_GOOGLE_API_KEY_FOR_MEASUREMENT }}
KEPLR_EXT_TOKEN_FACTORY_BASE_URL: ${{ secrets.KEPLR_EXT_TOKEN_FACTORY_BASE_URL }}
KEPLR_EXT_TOKEN_FACTORY_URI: ${{ secrets.KEPLR_EXT_TOKEN_FACTORY_URI }}
KEPLR_EXT_TX_HISTORY_BASE_URL: ${{ secrets.KEPLR_EXT_TX_HISTORY_BASE_URL }}
KEPLR_EXT_CONFIG_SERVER: ${{ secrets.KEPLR_EXT_CONFIG_SERVER }}
WC_PROJECT_ID: ${{ secrets.WC_PROJECT_ID }}
- run: sudo apt-get install gh
- run: npx zx ./scripts/publish.mjs
Expand All @@ -68,7 +70,7 @@ jobs:
- run: cp ./build/firefox-archive.tar.gz ../firefox-archive.tar.gz
- run: mkdir temp && tar xvzf firefox-archive.tar.gz -C temp
working-directory: ..
- run: docker build -f ./docker/Dockerfile -t builder --build-arg KEPLR_EXT_ETHEREUM_ENDPOINT=$KEPLR_EXT_ETHEREUM_ENDPOINT --build-arg KEPLR_EXT_ANALYTICS_API_AUTH_TOKEN=$KEPLR_EXT_ANALYTICS_API_AUTH_TOKEN --build-arg KEPLR_EXT_ANALYTICS_API_URL=$KEPLR_EXT_ANALYTICS_API_URL --build-arg KEPLR_EXT_COINGECKO_ENDPOINT=$KEPLR_EXT_COINGECKO_ENDPOINT --build-arg KEPLR_EXT_COINGECKO_GETPRICE=$KEPLR_EXT_COINGECKO_GETPRICE --build-arg KEPLR_EXT_TRANSAK_API_KEY=$KEPLR_EXT_TRANSAK_API_KEY --build-arg KEPLR_EXT_MOONPAY_API_KEY=$KEPLR_EXT_MOONPAY_API_KEY --build-arg KEPLR_EXT_KADO_API_KEY=$KEPLR_EXT_KADO_API_KEY --build-arg KEPLR_EXT_CHAIN_REGISTRY_URL=$KEPLR_EXT_CHAIN_REGISTRY_URL --build-arg KEPLR_EXT_GOOGLE_MEASUREMENT_ID=$KEPLR_EXT_GOOGLE_MEASUREMENT_ID --build-arg KEPLR_EXT_GOOGLE_API_KEY_FOR_MEASUREMENT=$KEPLR_EXT_GOOGLE_API_KEY_FOR_MEASUREMENT --build-arg WC_PROJECT_ID=$WC_PROJECT_ID --build-arg KEPLR_EXT_TOKEN_FACTORY_BASE_URL=$KEPLR_EXT_TOKEN_FACTORY_BASE_URL --build-arg KEPLR_EXT_TOKEN_FACTORY_URI=$KEPLR_EXT_TOKEN_FACTORY_URI .
- run: docker build -f ./docker/Dockerfile -t builder --build-arg KEPLR_EXT_ETHEREUM_ENDPOINT=$KEPLR_EXT_ETHEREUM_ENDPOINT --build-arg KEPLR_EXT_ANALYTICS_API_AUTH_TOKEN=$KEPLR_EXT_ANALYTICS_API_AUTH_TOKEN --build-arg KEPLR_EXT_ANALYTICS_API_URL=$KEPLR_EXT_ANALYTICS_API_URL --build-arg KEPLR_EXT_COINGECKO_ENDPOINT=$KEPLR_EXT_COINGECKO_ENDPOINT --build-arg KEPLR_EXT_COINGECKO_GETPRICE=$KEPLR_EXT_COINGECKO_GETPRICE --build-arg KEPLR_EXT_TRANSAK_API_KEY=$KEPLR_EXT_TRANSAK_API_KEY --build-arg KEPLR_EXT_MOONPAY_API_KEY=$KEPLR_EXT_MOONPAY_API_KEY --build-arg KEPLR_EXT_KADO_API_KEY=$KEPLR_EXT_KADO_API_KEY --build-arg KEPLR_EXT_CHAIN_REGISTRY_URL=$KEPLR_EXT_CHAIN_REGISTRY_URL --build-arg KEPLR_EXT_GOOGLE_MEASUREMENT_ID=$KEPLR_EXT_GOOGLE_MEASUREMENT_ID --build-arg KEPLR_EXT_GOOGLE_API_KEY_FOR_MEASUREMENT=$KEPLR_EXT_GOOGLE_API_KEY_FOR_MEASUREMENT --build-arg WC_PROJECT_ID=$WC_PROJECT_ID --build-arg KEPLR_EXT_TOKEN_FACTORY_BASE_URL=$KEPLR_EXT_TOKEN_FACTORY_BASE_URL --build-arg KEPLR_EXT_TOKEN_FACTORY_URI=$KEPLR_EXT_TOKEN_FACTORY_URI --build-arg KEPLR_EXT_TX_HISTORY_BASE_URL=$KEPLR_EXT_TX_HISTORY_BASE_URL --build-arg KEPLR_EXT_CONFIG_SERVER=$KEPLR_EXT_CONFIG_SERVER .
working-directory: ../temp
env:
KEPLR_EXT_ETHEREUM_ENDPOINT: ${{ secrets.KEPLR_EXT_ETHEREUM_ENDPOINT }}
Expand All @@ -84,6 +86,8 @@ jobs:
KEPLR_EXT_GOOGLE_API_KEY_FOR_MEASUREMENT: ${{ secrets.KEPLR_EXT_GOOGLE_API_KEY_FOR_MEASUREMENT }}
KEPLR_EXT_TOKEN_FACTORY_BASE_URL: ${{ secrets.KEPLR_EXT_TOKEN_FACTORY_BASE_URL }}
KEPLR_EXT_TOKEN_FACTORY_URI: ${{ secrets.KEPLR_EXT_TOKEN_FACTORY_URI }}
KEPLR_EXT_TX_HISTORY_BASE_URL: ${{ secrets.KEPLR_EXT_TX_HISTORY_BASE_URL }}
KEPLR_EXT_CONFIG_SERVER: ${{ secrets.KEPLR_EXT_CONFIG_SERVER }}
WC_PROJECT_ID: ${{ secrets.WC_PROJECT_ID }}
- run: docker run -v $(pwd):/data builder
working-directory: ../temp
Expand Down
4 changes: 4 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ ARG KEPLR_EXT_GOOGLE_MEASUREMENT_ID
ARG KEPLR_EXT_GOOGLE_API_KEY_FOR_MEASUREMENT
ARG KEPLR_EXT_TOKEN_FACTORY_BASE_URL
ARG KEPLR_EXT_TOKEN_FACTORY_URI
ARG KEPLR_EXT_TX_HISTORY_BASE_URL
ARG KEPLR_EXT_CONFIG_SERVER
ARG WC_PROJECT_ID

ENV KEPLR_EXT_ETHEREUM_ENDPOINT $KEPLR_EXT_ETHEREUM_ENDPOINT
Expand All @@ -34,6 +36,8 @@ ENV KEPLR_EXT_GOOGLE_MEASUREMENT_ID $KEPLR_EXT_GOOGLE_MEASUREMENT_ID
ENV KEPLR_EXT_GOOGLE_API_KEY_FOR_MEASUREMENT $KEPLR_EXT_GOOGLE_API_KEY_FOR_MEASUREMENT
ENV KEPLR_EXT_TOKEN_FACTORY_BASE_URL $KEPLR_EXT_TOKEN_FACTORY_BASE_URL
ENV KEPLR_EXT_TOKEN_FACTORY_URI $KEPLR_EXT_TOKEN_FACTORY_URI
ENV KEPLR_EXT_TX_HISTORY_BASE_URL $KEPLR_EXT_TX_HISTORY_BASE_URL
ENV KEPLR_EXT_CONFIG_SERVER $KEPLR_EXT_CONFIG_SERVER
ENV WC_PROJECT_ID $WC_PROJECT_ID

RUN yarn install --immutable
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.76",
"version": "0.12.77-rc.1",
"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.76",
"version": "0.12.77-rc.1",
"main": "build/index.js",
"author": "chainapsis",
"license": "Apache-2.0",
Expand Down
24 changes: 12 additions & 12 deletions packages/background/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@keplr-wallet/background",
"version": "0.12.76",
"version": "0.12.77-rc.1",
"main": "build/index.js",
"author": "chainapsis",
"license": "Apache-2.0",
Expand Down Expand Up @@ -29,17 +29,17 @@
"@ethersproject/hash": "^5.7.0",
"@ethersproject/transactions": "^5.7.0",
"@ethersproject/wallet": "^5.7.0",
"@keplr-wallet/chain-validator": "0.12.76",
"@keplr-wallet/common": "0.12.76",
"@keplr-wallet/cosmos": "0.12.76",
"@keplr-wallet/crypto": "0.12.76",
"@keplr-wallet/ledger-cosmos": "0.12.76",
"@keplr-wallet/popup": "0.12.76",
"@keplr-wallet/proto-types": "0.12.76",
"@keplr-wallet/router": "0.12.76",
"@keplr-wallet/simple-fetch": "0.12.76",
"@keplr-wallet/types": "0.12.76",
"@keplr-wallet/unit": "0.12.76",
"@keplr-wallet/chain-validator": "0.12.77-rc.1",
"@keplr-wallet/common": "0.12.77-rc.1",
"@keplr-wallet/cosmos": "0.12.77-rc.1",
"@keplr-wallet/crypto": "0.12.77-rc.1",
"@keplr-wallet/ledger-cosmos": "0.12.77-rc.1",
"@keplr-wallet/popup": "0.12.77-rc.1",
"@keplr-wallet/proto-types": "0.12.77-rc.1",
"@keplr-wallet/router": "0.12.77-rc.1",
"@keplr-wallet/simple-fetch": "0.12.77-rc.1",
"@keplr-wallet/types": "0.12.77-rc.1",
"@keplr-wallet/unit": "0.12.77-rc.1",
"@ledgerhq/hw-app-eth": "^6.29.3",
"@ledgerhq/hw-transport": "^6.20.0",
"@ledgerhq/hw-transport-webhid": "^6.20.0",
Expand Down
6 changes: 6 additions & 0 deletions packages/background/src/chains-update/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ export class ChainsUpdateService {
console.log(e);
});
});

this.chainsService.addChainRemovedHandler((chainInfo) => {
this.updateChainInfo(chainInfo.chainId).catch((e) => {
console.log(e);
});
});
}

protected startUpdateLoop() {
Expand Down
10 changes: 4 additions & 6 deletions packages/background/src/chains/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,7 @@ export class ChainsService {
this.suggestedChainInfos = [];

for (const chainInfo of prev) {
const updated = this.mergeChainInfosWithDynamics([chainInfo])[0];
for (const handler of this.onChainRemovedHandlers) {
handler(updated);
}
this.onChainRemoved(chainInfo);
}
}

Expand Down Expand Up @@ -881,6 +878,9 @@ export class ChainsService {
onChainRemoved(chainInfo: ChainInfo): void {
const chainIdentifier = ChainIdHelper.parse(chainInfo.chainId).identifier;

// 이 이후로 updated 정보를 다 지워버리기 때문에 먼저 chain info를 얻어놔야한다.
const updated = this.mergeChainInfosWithDynamics([chainInfo])[0];

{
const newChainInfos = this.updatedChainInfos.slice();
newChainInfos.filter(
Expand Down Expand Up @@ -917,8 +917,6 @@ export class ChainsService {
this.endpoints = newEndpoints;
}

const updated = this.mergeChainInfosWithDynamics([chainInfo])[0];

for (const handler of this.onChainRemovedHandlers) {
handler(updated);
}
Expand Down
8 changes: 4 additions & 4 deletions packages/chain-validator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@keplr-wallet/chain-validator",
"version": "0.12.76",
"version": "0.12.77-rc.1",
"main": "build/index.js",
"author": "chainapsis",
"license": "Apache-2.0",
Expand All @@ -16,9 +16,9 @@
"lint-fix": "eslint --fix \"src/**/*\" && prettier --write \"src/**/*\""
},
"dependencies": {
"@keplr-wallet/cosmos": "0.12.76",
"@keplr-wallet/simple-fetch": "0.12.76",
"@keplr-wallet/types": "0.12.76",
"@keplr-wallet/cosmos": "0.12.77-rc.1",
"@keplr-wallet/simple-fetch": "0.12.77-rc.1",
"@keplr-wallet/types": "0.12.77-rc.1",
"joi": "^17.5.0",
"utility-types": "^3.10.0"
}
Expand Down
6 changes: 3 additions & 3 deletions packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@keplr-wallet/common",
"version": "0.12.76",
"version": "0.12.77-rc.1",
"main": "build/index.js",
"author": "chainapsis",
"license": "Apache-2.0",
Expand All @@ -16,8 +16,8 @@
"lint-fix": "eslint --fix \"src/**/*\" && prettier --write \"src/**/*\""
},
"dependencies": {
"@keplr-wallet/crypto": "0.12.76",
"@keplr-wallet/types": "0.12.76",
"@keplr-wallet/crypto": "0.12.77-rc.1",
"@keplr-wallet/types": "0.12.77-rc.1",
"buffer": "^6.0.3",
"delay": "^4.4.0",
"mobx": "^6.1.7"
Expand Down
32 changes: 32 additions & 0 deletions packages/common/src/coin/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
export function isValidCoinStr(str: string): boolean {
const split = str.split(/^([0-9]+)(\s)*([a-zA-Z][a-zA-Z0-9/-]*)$/);

if (split.length === 5) {
if (
split[1].length > 0 &&
split[3].length > 0 &&
!Number.isNaN(parseInt(split[1]))
) {
return true;
}
}

return false;
}

export function parseCoinStr(str: string): {
denom: string;
amount: string;
} {
const split = str.split(/^([0-9]+)(\s)*([a-zA-Z][a-zA-Z0-9/-]*)$/);

if (split.length === 5) {
const denom = split[3];
return {
denom,
amount: split[1],
};
}

throw new Error(`Invalid coin string: ${str}`);
}
1 change: 1 addition & 0 deletions packages/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export * from "./icns";
export * from "./retry";
export * from "./sleep";
export * from "./mnemonic";
export * from "./coin";
4 changes: 2 additions & 2 deletions packages/cosmjs-test/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cosmjs-test",
"version": "0.12.76",
"version": "0.12.77-rc.1",
"author": "chainapsis",
"license": "Apache-2.0",
"private": true,
Expand All @@ -12,7 +12,7 @@
},
"devDependencies": {
"@cosmjs/stargate": "^0.29.3",
"@keplr-wallet/provider-mock": "0.12.76",
"@keplr-wallet/provider-mock": "0.12.77-rc.1",
"secretjs": "^1.6.0"
}
}
14 changes: 7 additions & 7 deletions packages/cosmos/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@keplr-wallet/cosmos",
"version": "0.12.76",
"version": "0.12.77-rc.1",
"main": "build/index.js",
"author": "chainapsis",
"license": "Apache-2.0",
Expand All @@ -17,12 +17,12 @@
},
"dependencies": {
"@ethersproject/address": "^5.6.0",
"@keplr-wallet/common": "0.12.76",
"@keplr-wallet/crypto": "0.12.76",
"@keplr-wallet/proto-types": "0.12.76",
"@keplr-wallet/simple-fetch": "0.12.76",
"@keplr-wallet/types": "0.12.76",
"@keplr-wallet/unit": "0.12.76",
"@keplr-wallet/common": "0.12.77-rc.1",
"@keplr-wallet/crypto": "0.12.77-rc.1",
"@keplr-wallet/proto-types": "0.12.77-rc.1",
"@keplr-wallet/simple-fetch": "0.12.77-rc.1",
"@keplr-wallet/types": "0.12.77-rc.1",
"@keplr-wallet/unit": "0.12.77-rc.1",
"bech32": "^1.1.4",
"buffer": "^6.0.3",
"long": "^4.0.0",
Expand Down
16 changes: 10 additions & 6 deletions packages/cosmos/src/bech32/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,21 @@ export class Bech32Address {
return prefix + "1" + former + "..." + latter;
}

static fromBech32(bech32Address: string, prefix?: string): Bech32Address {
const decoded = bech32.decode(bech32Address);
static fromBech32(
bech32Address: string,
prefix?: string,
limit?: number
): Bech32Address {
const decoded = bech32.decode(bech32Address, limit);
if (prefix && decoded.prefix !== prefix) {
throw new Error("Unmatched prefix");
}

return new Bech32Address(new Uint8Array(fromWords(decoded.words)));
}

static validate(bech32Address: string, prefix?: string) {
const { prefix: decodedPrefix } = bech32.decode(bech32Address);
static validate(bech32Address: string, prefix?: string, limit?: number) {
const { prefix: decodedPrefix } = bech32.decode(bech32Address, limit);
if (prefix && prefix !== decodedPrefix) {
throw new Error(
`Unexpected prefix (expected: ${prefix}, actual: ${decodedPrefix})`
Expand Down Expand Up @@ -75,9 +79,9 @@ export class Bech32Address {

constructor(public readonly address: Uint8Array) {}

toBech32(prefix: string): string {
toBech32(prefix: string, limit?: number): string {
const words = bech32.toWords(this.address);
return bech32.encode(prefix, words);
return bech32.encode(prefix, words, limit);
}

toHex(mixedCaseChecksum: boolean = true): string {
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@keplr-wallet/crypto",
"version": "0.12.76",
"version": "0.12.77-rc.1",
"main": "build/index.js",
"author": "chainapsis",
"license": "Apache-2.0",
Expand Down
44 changes: 22 additions & 22 deletions packages/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@keplr-wallet/extension",
"version": "0.12.76",
"version": "0.12.77-rc.1",
"author": "chainapsis",
"license": "Apache-2.0",
"private": true,
Expand All @@ -26,27 +26,27 @@
"@ethersproject/transactions": "^5.7.0",
"@floating-ui/react": "^0.23.0",
"@floating-ui/react-dom": "^1.3.0",
"@keplr-wallet/analytics": "0.12.76",
"@keplr-wallet/background": "0.12.76",
"@keplr-wallet/chain-validator": "0.12.76",
"@keplr-wallet/common": "0.12.76",
"@keplr-wallet/cosmos": "0.12.76",
"@keplr-wallet/crypto": "0.12.76",
"@keplr-wallet/hooks": "0.12.76",
"@keplr-wallet/ledger-cosmos": "0.12.76",
"@keplr-wallet/popup": "0.12.76",
"@keplr-wallet/proto-types": "0.12.76",
"@keplr-wallet/provider": "0.12.76",
"@keplr-wallet/router": "0.12.76",
"@keplr-wallet/router-extension": "0.12.76",
"@keplr-wallet/simple-fetch": "0.12.76",
"@keplr-wallet/stores": "0.12.76",
"@keplr-wallet/stores-core": "0.12.76",
"@keplr-wallet/stores-etc": "0.12.76",
"@keplr-wallet/stores-eth": "0.12.76",
"@keplr-wallet/stores-ibc": "0.12.76",
"@keplr-wallet/types": "0.12.76",
"@keplr-wallet/unit": "0.12.76",
"@keplr-wallet/analytics": "0.12.77-rc.1",
"@keplr-wallet/background": "0.12.77-rc.1",
"@keplr-wallet/chain-validator": "0.12.77-rc.1",
"@keplr-wallet/common": "0.12.77-rc.1",
"@keplr-wallet/cosmos": "0.12.77-rc.1",
"@keplr-wallet/crypto": "0.12.77-rc.1",
"@keplr-wallet/hooks": "0.12.77-rc.1",
"@keplr-wallet/ledger-cosmos": "0.12.77-rc.1",
"@keplr-wallet/popup": "0.12.77-rc.1",
"@keplr-wallet/proto-types": "0.12.77-rc.1",
"@keplr-wallet/provider": "0.12.77-rc.1",
"@keplr-wallet/router": "0.12.77-rc.1",
"@keplr-wallet/router-extension": "0.12.77-rc.1",
"@keplr-wallet/simple-fetch": "0.12.77-rc.1",
"@keplr-wallet/stores": "0.12.77-rc.1",
"@keplr-wallet/stores-core": "0.12.77-rc.1",
"@keplr-wallet/stores-etc": "0.12.77-rc.1",
"@keplr-wallet/stores-eth": "0.12.77-rc.1",
"@keplr-wallet/stores-ibc": "0.12.77-rc.1",
"@keplr-wallet/types": "0.12.77-rc.1",
"@keplr-wallet/unit": "0.12.77-rc.1",
"@keystonehq/animated-qr": "^0.8.6",
"@keystonehq/keystone-sdk": "^0.2.3",
"@ledgerhq/devices": "^6.20.0",
Expand Down
Loading

0 comments on commit 9f1ca3f

Please sign in to comment.