Skip to content

Commit 45c0839

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/subwallet-dev' into webapp-dev
# Conflicts: # packages/extension-base/src/services/chain-service/index.ts # packages/webapp/package.json
2 parents 3b979fb + e8b40e3 commit 45c0839

File tree

74 files changed

+1036
-485
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1036
-485
lines changed

.123trigger

+3-1
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,6 @@
131131
1.1.61
132132
1.1.62
133133
1.1.63
134-
1.1.64
134+
1.1.64
135+
1.1.65
136+
1.1.66

CHANGELOG.md

+29
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
# CHANGELOG
22

3+
## 1.1.66
4+
Build date: May 21, 2024.
5+
6+
Features & Update:
7+
- Update chain-list (#3055)
8+
- Support SQD token on Arbitrum
9+
- Support for Common LP Drops and Common Staking Drops
10+
- Update price-id for AUDD
11+
- Update new chain-list interface (#3085)
12+
- Support GRC-20 token (#2852, #3067)
13+
14+
Bugs fixed:
15+
- Handle the case of not resetting the wallet to the default state when click Erase all (#3035)
16+
17+
## 1.1.65
18+
Build date: May 17, 2024.
19+
20+
Features & Update:
21+
- Update chain-list (#3040)
22+
- Update chainBalanceSlug and explorer for some chains
23+
- Add support for Hyperbridge (Nexus)
24+
- Add support for CESS testnet
25+
- Add support for Pendulum, Amplitude assets
26+
- Add support for BOB and tokens on BOB
27+
28+
Bugs fixed:
29+
- Fixed bug Unable to back screen in case open General settings to Marketing campaign (#3062)
30+
- Fixed bug when transferring PSP22 token (#3041)
31+
332
## 1.1.64
433
Build date: May 11, 2024.
534

CONTRIBUTORS

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
2511 AnhMTV Release version 1.1.64
1+
2522 AnhMTV Release version 1.1.66
22
2352 Nam Phạm [Issue 2754] fix: fix eslint
3-
2027 S2kael [Issue-3020] Update chain-list stable version
4-
813 lw-cdm
3+
2036 S2kael [Issue-3055] Update stable version for chain-list
4+
815 lw-cdm Fix eslint issues
55
465 Jaco 0.42.5 (#969)
6-
403 nguyentiendung [Issue-3011] Update UI code for change symbol
6+
416 nguyentiendung [Issue-2914] Update yarn.lock
77
185 quangdo
8-
129 bluezdot [Issue-3020] Update ED for mythos
8+
148 bluezdot [Issue-3055] Update chainlist
99
106 dominhquang [Issue-2649] Add send crash log feature
1010
104 khainh predefine metadata for Polkadot & Kusama chains
11+
102 Automation Bot [CI Skip] Auto increase webapp build number
1112
101 lw-cdm
12-
99 Automation Bot [CI Skip] Auto increase webapp build number
1313
83 Hieu Dao Update README.md
1414
82 Thibaut Sardan Add account filtering feature (#832)
1515
81 leewong Swap - Change idle time to 300s
16-
73 Thiendekaco [Issue 2859] [fix] Extension - deploy smart contract when use ledger
16+
75 Thiendekaco [Issue 3062] [fix] Extension - Unable to back screen in case open General settings to Marketing campaign
1717
63 Roman fix ui issues
1818
53 Dominhquangdev update Bridge code
1919
48 bluedot [Issue-2771] Update multichain asset logo for ASTR

package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"url": "https://github.com/Koniverse/Subwallet-V2.git"
1111
},
1212
"sideEffects": false,
13-
"version": "1.1.64",
13+
"version": "1.1.66",
1414
"workspaces": [
1515
"packages/*"
1616
],
@@ -79,21 +79,21 @@
7979
"sinon-chrome": "^3.0.1"
8080
},
8181
"resolutions": {
82-
"@subwallet/react-ui": "5.1.2-b77",
8382
"@ethereumjs/common": "^4.1.0",
8483
"@google/model-viewer": "3.1.1",
8584
"@ledgerhq/hw-app-eth": "6.33.4",
8685
"@mangata-finance/type-definitions": "2.1.2",
87-
"@polkadot/api": "^10.12.4",
88-
"@polkadot/api-base": "^10.11.2",
89-
"@polkadot/api-contract": "^10.12.4",
86+
"@polkadot/api": "^11.0.3",
87+
"@polkadot/api-base": "^11.0.3",
88+
"@polkadot/api-contract": "^11.0.3",
9089
"@polkadot/networks": "^12.6.2",
91-
"@polkadot/types": "^10.12.4",
92-
"@polkadot/types-codec": "10.10.1",
90+
"@polkadot/types": "^11.0.3",
91+
"@polkadot/types-codec": "^11.0.3",
9392
"@polkadot/util": "^12.6.2",
9493
"@polkadot/util-crypto": "^12.6.2",
95-
"@subwallet/chain-list": "0.2.60",
94+
"@subwallet/chain-list": "0.2.62",
9695
"@subwallet/keyring": "^0.1.5",
96+
"@subwallet/react-ui": "5.1.2-b77",
9797
"@subwallet/ui-keyring": "^0.1.5",
9898
"babel-core": "^7.0.0-bridge.0",
9999
"babel-jest": "^29.3.1",

packages/extension-base/package.json

+18-16
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"./detectPackage.cjs"
1818
],
1919
"type": "module",
20-
"version": "1.1.64-0",
20+
"version": "1.1.66-0",
2121
"main": "index.js",
2222
"dependencies": {
2323
"@acala-network/api": "^5.0.2",
@@ -29,32 +29,33 @@
2929
"@ethereumjs/tx": "^5.1.0",
3030
"@ethersproject/abi": "^5.7.0",
3131
"@galacticcouncil/sdk": "^2.1.0",
32+
"@gear-js/api": "^0.37.2",
3233
"@json-rpc-tools/utils": "^1.7.6",
3334
"@metamask/safe-event-emitter": "^2.0.0",
3435
"@metaverse-network-sdk/type-definitions": "^0.0.1-13",
3536
"@oak-foundation/types": "^0.0.23",
36-
"@polkadot/api": "^10.12.4",
37+
"@polkadot/api": "^11.0.3",
3738
"@polkadot/api-base": "^10.11.2",
38-
"@polkadot/api-contract": "^10.12.4",
39-
"@polkadot/api-derive": "^10.12.4",
40-
"@polkadot/apps-config": "^0.135.1",
39+
"@polkadot/api-contract": "^11.0.3",
40+
"@polkadot/api-derive": "^11.0.3",
41+
"@polkadot/apps-config": "^0.137.1",
4142
"@polkadot/hw-ledger": "^12.6.2",
4243
"@polkadot/networks": "^12.6.2",
43-
"@polkadot/phishing": "^0.22.4",
44-
"@polkadot/rpc-provider": "^10.12.4",
45-
"@polkadot/types": "^10.12.4",
46-
"@polkadot/types-augment": "^10.12.4",
47-
"@polkadot/ui-settings": "^3.6.5",
44+
"@polkadot/phishing": "^0.22.7",
45+
"@polkadot/rpc-provider": "^11.0.3",
46+
"@polkadot/types": "^11.0.3",
47+
"@polkadot/types-augment": "^11.0.3",
48+
"@polkadot/ui-settings": "^3.6.6",
4849
"@polkadot/util": "^12.6.2",
4950
"@polkadot/util-crypto": "^12.6.2",
5051
"@reduxjs/toolkit": "^1.9.1",
5152
"@sora-substrate/type-definitions": "^1.17.7",
5253
"@substrate/connect": "^0.8.9",
53-
"@subwallet/chain-list": "0.2.60",
54-
"@subwallet/extension-base": "^1.1.64-0",
55-
"@subwallet/extension-chains": "^1.1.64-0",
56-
"@subwallet/extension-dapp": "^1.1.64-0",
57-
"@subwallet/extension-inject": "^1.1.64-0",
54+
"@subwallet/chain-list": "0.2.62",
55+
"@subwallet/extension-base": "^1.1.66-0",
56+
"@subwallet/extension-chains": "^1.1.66-0",
57+
"@subwallet/extension-dapp": "^1.1.66-0",
58+
"@subwallet/extension-inject": "^1.1.66-0",
5859
"@subwallet/keyring": "^0.1.5",
5960
"@subwallet/ui-keyring": "^0.1.5",
6061
"@walletconnect/sign-client": "^2.8.4",
@@ -82,6 +83,7 @@
8283
"moment": "^2.29.4",
8384
"protobufjs": "^7.2.4",
8485
"rxjs": "^7.8.1",
86+
"sails-js": "^0.1.3",
8587
"uuid": "^9.0.0",
8688
"web3": "^1.10.0",
8789
"web3-core": "^1.10.0",
@@ -92,7 +94,7 @@
9294
"web3-utils": "^1.10.0"
9395
},
9496
"devDependencies": {
95-
"@subwallet/extension-mocks": "^1.1.64-0",
97+
"@subwallet/extension-mocks": "^1.1.66-0",
9698
"@types/uuid": "^9.0.1"
9799
}
98100
}

packages/extension-base/src/koni/api/dotsama/transfer.ts

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
// Copyright 2019-2022 @subwallet/extension-base
22
// SPDX-License-Identifier: Apache-2.0
33

4+
import { GearApi } from '@gear-js/api';
45
import { _ChainAsset, _ChainInfo } from '@subwallet/chain-list/types';
56
import { SupportTransferResponse } from '@subwallet/extension-base/background/KoniTypes';
67
import { getPSP22ContractPromise } from '@subwallet/extension-base/koni/api/tokens/wasm';
78
import { getWasmContractGasLimit } from '@subwallet/extension-base/koni/api/tokens/wasm/utils';
89
import { _BALANCE_TOKEN_GROUP, _MANTA_ZK_CHAIN_GROUP, _TRANSFER_CHAIN_GROUP, _TRANSFER_NOT_SUPPORTED_CHAINS, _ZK_ASSET_PREFIX } from '@subwallet/extension-base/services/chain-service/constants';
910
import { _SubstrateApi } from '@subwallet/extension-base/services/chain-service/types';
10-
import { _getContractAddressOfToken, _getTokenOnChainAssetId, _getTokenOnChainInfo, _isChainEvmCompatible, _isNativeToken, _isTokenWasmSmartContract } from '@subwallet/extension-base/services/chain-service/utils';
11+
import { _getContractAddressOfToken, _getTokenOnChainAssetId, _getTokenOnChainInfo, _isChainEvmCompatible, _isNativeToken, _isTokenGearSmartContract, _isTokenWasmSmartContract } from '@subwallet/extension-base/services/chain-service/utils';
12+
import { getGRC20ContractPromise } from '@subwallet/extension-base/utils';
1113

1214
import { SubmittableExtrinsic } from '@polkadot/api/promise/types';
1315
import { AccountInfoWithProviders, AccountInfoWithRefCount } from '@polkadot/types/interfaces';
14-
import { BN } from '@polkadot/util';
16+
import { BN, u8aToHex } from '@polkadot/util';
17+
import { decodeAddress } from '@polkadot/util-crypto';
1518

1619
function isRefCount (accountInfo: AccountInfoWithProviders | AccountInfoWithRefCount): accountInfo is AccountInfoWithRefCount {
1720
return !!(accountInfo as AccountInfoWithRefCount).refcount;
@@ -142,6 +145,12 @@ interface CreateTransferExtrinsicProps {
142145
export const createTransferExtrinsic = async ({ from, networkKey, substrateApi, to, tokenInfo, transferAll, value }: CreateTransferExtrinsicProps): Promise<[SubmittableExtrinsic | null, string]> => {
143146
const api = substrateApi.api;
144147

148+
const isDisableTransfer = tokenInfo.metadata?.isDisableTransfer as boolean;
149+
150+
if (isDisableTransfer) {
151+
return [null, value];
152+
}
153+
145154
// @ts-ignore
146155
let transfer: SubmittableExtrinsic<'promise'> | null = null;
147156
const isTxCurrenciesSupported = !!api && !!api.tx && !!api.tx.currencies;
@@ -159,6 +168,15 @@ export const createTransferExtrinsic = async ({ from, networkKey, substrateApi,
159168
// @ts-ignore
160169
transfer = contractPromise.tx['psp22::transfer']({ gasLimit }, to, value, {});
161170
transferAmount = value;
171+
} else if (_isTokenGearSmartContract(tokenInfo) && (api instanceof GearApi)) {
172+
const contractPromise = getGRC20ContractPromise(api, _getContractAddressOfToken(tokenInfo));
173+
const transaction = await contractPromise
174+
.transfer(u8aToHex(decodeAddress(to)), BigInt(value)) // Create transfer transaction
175+
.withAccount(from) // Set sender account
176+
.calculateGas(); // Add account arg to extrinsic
177+
178+
transfer = transaction.tx;
179+
transferAmount = value;
162180
} else if (_TRANSFER_CHAIN_GROUP.acala.includes(networkKey)) {
163181
if (!_isNativeToken(tokenInfo)) {
164182
if (isTxCurrenciesSupported) {

packages/extension-base/src/koni/api/staking/bonding/relayChain.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ export async function getRelayValidatorsInfo (chain: string, substrateApi: _Subs
754754
const bnTotalEraStake = new BN(_totalEraStake.toString());
755755
const eraStakers = _eraStakers as any[];
756756

757-
const rawMinBond = _minBond.toHuman() as string;
757+
const rawMinBond = _minBond.toHuman();
758758
const minBond = rawMinBond.replaceAll(',', '');
759759

760760
const totalStakeMap: Record<string, BN> = {};
@@ -916,6 +916,7 @@ export async function getRelayBondingExtrinsic (substrateApi: _SubstrateApi, amo
916916
if (paramsCount === 2) {
917917
bondTx = chainApi.api.tx.staking.bond(binaryAmount, bondDest);
918918
} else {
919+
// @ts-ignore
919920
bondTx = chainApi.api.tx.staking.bond(address, binaryAmount, bondDest);
920921
}
921922

@@ -928,6 +929,7 @@ export async function getRelayBondingExtrinsic (substrateApi: _SubstrateApi, amo
928929
if (paramsCount === 2) {
929930
bondTx = chainApi.api.tx.staking.bond(binaryAmount, bondDest);
930931
} else {
932+
// @ts-ignore
931933
bondTx = chainApi.api.tx.staking.bond(nominatorMetadata.address, binaryAmount, bondDest);
932934
}
933935

@@ -950,6 +952,7 @@ export async function getRelayBondingExtrinsic (substrateApi: _SubstrateApi, amo
950952
return nominateTx;
951953
}
952954

955+
// @ts-ignore
953956
return chainApi.api.tx.utility.batchAll([bondTx, nominateTx]);
954957
}
955958

@@ -978,6 +981,7 @@ export async function getRelayWithdrawalExtrinsic (substrateApi: _SubstrateApi,
978981

979982
return chainApi.api.tx.staking.withdrawUnbonded(slashingSpanCount);
980983
} else {
984+
// @ts-ignore
981985
return chainApi.api.tx.staking.withdrawUnbonded();
982986
}
983987
}
@@ -1026,6 +1030,7 @@ export async function getPoolingWithdrawalExtrinsic (substrateApi: _SubstrateApi
10261030

10271031
return chainApi.api.tx.nominationPools.withdrawUnbonded({ Id: nominatorMetadata.address }, slashingSpanCount);
10281032
} else {
1033+
// @ts-ignore
10291034
return chainApi.api.tx.nominationPools.withdrawUnbonded({ Id: nominatorMetadata.address });
10301035
}
10311036
}

packages/extension-base/src/koni/api/tokens/wasm/utils.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,16 @@ export async function getWasmContractGasLimit (
4444
// @ts-ignore
4545
const { gasLimit, storageDepositLimit, value } = options;
4646

47-
// @ts-ignore
4847
const { gasRequired } = await api.call.contractsApi.call(
4948
callerAddress,
5049
contract.address,
50+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
5151
value ?? new BN(0),
52+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
5253
gasLimit ?? null,
54+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
5355
storageDepositLimit ?? null,
56+
// @ts-ignore
5457
abiMessage?.value?.toU8a(args)
5558
);
5659

packages/extension-base/src/koni/background/handlers/State.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { _AssetRef, _AssetType, _ChainAsset, _ChainInfo, _MultiChainAsset } from
55
import { EvmProviderError } from '@subwallet/extension-base/background/errors/EvmProviderError';
66
import { withErrorLog } from '@subwallet/extension-base/background/handlers/helpers';
77
import { isSubscriptionRunning, unsubscribe } from '@subwallet/extension-base/background/handlers/subscriptions';
8-
import { AccountRefMap, AddTokenRequestExternal, AmountData, APIItemState, ApiMap, AuthRequestV2, BasicTxErrorType, ChainStakingMetadata, ChainType, ConfirmationsQueue, CrowdloanItem, CrowdloanJson, CurrentAccountInfo, EvmProviderErrorType, EvmSendTransactionParams, EvmSendTransactionRequest, EvmSignatureRequest, ExternalRequestPromise, ExternalRequestPromiseStatus, ExtrinsicType, MantaAuthorizationContext, MantaPayConfig, MantaPaySyncState, NftCollection, NftItem, NftJson, NominatorMetadata, RequestAccountExportPrivateKey, RequestCheckPublicAndSecretKey, RequestConfirmationComplete, RequestCrowdloanContributions, RequestSettingsType, ResponseAccountExportPrivateKey, ResponseCheckPublicAndSecretKey, ServiceInfo, SingleModeJson, StakingItem, StakingJson, StakingRewardItem, StakingRewardJson, StakingType, UiSettings } from '@subwallet/extension-base/background/KoniTypes';
8+
import { AccountRefMap, AddTokenRequestExternal, AmountData, APIItemState, ApiMap, AuthRequestV2, BasicTxErrorType, ChainStakingMetadata, ChainType, ConfirmationsQueue, CrowdloanItem, CrowdloanJson, CurrencyType, CurrentAccountInfo, EvmProviderErrorType, EvmSendTransactionParams, EvmSendTransactionRequest, EvmSignatureRequest, ExternalRequestPromise, ExternalRequestPromiseStatus, ExtrinsicType, MantaAuthorizationContext, MantaPayConfig, MantaPaySyncState, NftCollection, NftItem, NftJson, NominatorMetadata, RequestAccountExportPrivateKey, RequestCheckPublicAndSecretKey, RequestConfirmationComplete, RequestCrowdloanContributions, RequestSettingsType, ResponseAccountExportPrivateKey, ResponseCheckPublicAndSecretKey, ServiceInfo, SingleModeJson, StakingItem, StakingJson, StakingRewardItem, StakingRewardJson, StakingType, UiSettings } from '@subwallet/extension-base/background/KoniTypes';
99
import { AccountJson, RequestAuthorizeTab, RequestRpcSend, RequestRpcSubscribe, RequestRpcUnsubscribe, RequestSign, ResponseRpcListProviders, ResponseSigning } from '@subwallet/extension-base/background/types';
1010
import { ALL_ACCOUNT_KEY, ALL_GENESIS_HASH, MANTA_PAY_BALANCE_INTERVAL } from '@subwallet/extension-base/constants';
1111
import { BalanceService } from '@subwallet/extension-base/services/balance-service';
@@ -87,6 +87,8 @@ const generateDefaultCrowdloanMap = (): Record<string, CrowdloanItem> => {
8787
return crowdloanMap;
8888
};
8989

90+
const DEFAULT_CURRENCY: CurrencyType = 'USD';
91+
9092
export default class KoniState {
9193
private injectedProviders = new Map<chrome.runtime.Port, ProviderInterface>();
9294
private readonly providers: Providers;
@@ -1874,6 +1876,7 @@ export default class KoniState {
18741876

18751877
if (resetAll) {
18761878
this.settingService.resetWallet();
1879+
await this.priceService.setPriceCurrency(DEFAULT_CURRENCY);
18771880
}
18781881

18791882
this.chainService.resetWallet(resetAll);

packages/extension-base/src/packageInfo.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
// Do not edit, auto-generated by @polkadot/dev
55

6-
export const packageInfo = { name: '@subwallet/extension-base', path: 'auto', type: 'auto', version: '1.1.64-0' };
6+
export const packageInfo = { name: '@subwallet/extension-base', path: 'auto', type: 'auto', version: '1.1.66-0' };

packages/extension-base/src/services/balance-service/helpers/subscribe/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export function subscribeBalance (addresses: string[], chains: string[], tokens:
100100
const [useAddresses, notSupportAddresses] = filterAddress(addresses, chainInfo);
101101

102102
if (notSupportAddresses.length) {
103-
const tokens = filterAssetsByChainAndType(chainAssetMap, chainSlug, [_AssetType.NATIVE, _AssetType.ERC20, _AssetType.PSP22, _AssetType.LOCAL]);
103+
const tokens = filterAssetsByChainAndType(chainAssetMap, chainSlug, [_AssetType.NATIVE, _AssetType.ERC20, _AssetType.PSP22, _AssetType.LOCAL, _AssetType.GRC20]);
104104

105105
const now = new Date().getTime();
106106

0 commit comments

Comments
 (0)