@subwallet/extension-base 1.0.6-2 → 1.0.7-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/background/KoniTypes.d.ts +11 -5
- package/cjs/constants/index.js +1 -1
- package/cjs/koni/api/staking/bonding/amplitude.js +83 -0
- package/cjs/koni/api/staking/bonding/astar.js +104 -1
- package/cjs/koni/api/staking/bonding/index.js +35 -0
- package/cjs/koni/api/staking/bonding/paraChain.js +97 -0
- package/cjs/koni/api/staking/bonding/relayChain.js +191 -12
- package/cjs/koni/api/staking/index.js +11 -11
- package/cjs/koni/api/staking/paraChain.js +200 -130
- package/cjs/koni/api/staking/relayChain.js +66 -68
- package/cjs/koni/api/staking/subsquidStaking.js +6 -11
- package/cjs/koni/background/cron.js +0 -25
- package/cjs/koni/background/handlers/State.js +18 -19
- package/cjs/koni/background/handlers/Tabs.js +68 -19
- package/cjs/koni/background/subscription.js +57 -12
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/utils.js +6 -1
- package/cjs/services/migration-service/index.js +2 -2
- package/cjs/services/request-service/handler/EvmRequestHandler.js +23 -0
- package/cjs/services/request-service/index.js +5 -0
- package/cjs/services/storage-service/DatabaseService.js +7 -3
- package/cjs/services/storage-service/db-stores/ChainStakingMetadata.js +5 -0
- package/cjs/services/storage-service/db-stores/NominatorMetadata.js +4 -4
- package/cjs/services/transaction-service/index.js +6 -1
- package/constants/index.d.ts +1 -1
- package/constants/index.js +1 -1
- package/koni/api/staking/bonding/amplitude.d.ts +4 -0
- package/koni/api/staking/bonding/amplitude.js +81 -0
- package/koni/api/staking/bonding/astar.d.ts +4 -0
- package/koni/api/staking/bonding/astar.js +102 -1
- package/koni/api/staking/bonding/index.d.ts +1 -0
- package/koni/api/staking/bonding/index.js +38 -4
- package/koni/api/staking/bonding/paraChain.d.ts +4 -0
- package/koni/api/staking/bonding/paraChain.js +95 -0
- package/koni/api/staking/bonding/relayChain.d.ts +5 -0
- package/koni/api/staking/bonding/relayChain.js +185 -10
- package/koni/api/staking/index.d.ts +4 -4
- package/koni/api/staking/index.js +11 -11
- package/koni/api/staking/paraChain.d.ts +5 -5
- package/koni/api/staking/paraChain.js +201 -131
- package/koni/api/staking/relayChain.d.ts +4 -4
- package/koni/api/staking/relayChain.js +66 -67
- package/koni/api/staking/subsquidStaking.d.ts +1 -1
- package/koni/api/staking/subsquidStaking.js +6 -11
- package/koni/background/cron.js +1 -26
- package/koni/background/handlers/State.d.ts +2 -2
- package/koni/background/handlers/State.js +18 -19
- package/koni/background/handlers/Tabs.js +68 -19
- package/koni/background/subscription.d.ts +2 -1
- package/koni/background/subscription.js +58 -13
- package/package.json +6 -6
- package/packageInfo.js +1 -1
- package/services/chain-service/types.d.ts +3 -0
- package/services/chain-service/utils.js +6 -1
- package/services/migration-service/index.js +2 -2
- package/services/request-service/handler/EvmRequestHandler.d.ts +1 -0
- package/services/request-service/handler/EvmRequestHandler.js +21 -0
- package/services/request-service/index.d.ts +1 -0
- package/services/request-service/index.js +3 -0
- package/services/storage-service/DatabaseService.d.ts +2 -2
- package/services/storage-service/DatabaseService.js +7 -3
- package/services/storage-service/db-stores/ChainStakingMetadata.d.ts +1 -0
- package/services/storage-service/db-stores/ChainStakingMetadata.js +3 -0
- package/services/storage-service/db-stores/NominatorMetadata.d.ts +2 -2
- package/services/storage-service/db-stores/NominatorMetadata.js +4 -4
- package/services/transaction-service/index.js +6 -1
|
@@ -38,7 +38,7 @@ export default class DatabaseService {
|
|
|
38
38
|
getPooledStakings(addresses: string[], chainHashes?: string[]): Promise<StakingItem[]>;
|
|
39
39
|
subscribeStaking(addresses: string[], chainList?: string[], callback?: (stakingItems: StakingItem[]) => void): Subscription;
|
|
40
40
|
subscribeChainStakingMetadata(chains: string[], callback: (data: ChainStakingMetadata[]) => void): void;
|
|
41
|
-
subscribeNominatorMetadata(callback: (data: NominatorMetadata[]) => void):
|
|
41
|
+
subscribeNominatorMetadata(addresses: string[], callback: (data: NominatorMetadata[]) => void): Subscription;
|
|
42
42
|
getHistories(query?: HistoryQuery): Promise<import("@subwallet/extension-base/services/storage-service/databases").ITransactionHistoryItem[]>;
|
|
43
43
|
upsertHistory(histories: TransactionHistoryItem[]): Promise<unknown>;
|
|
44
44
|
updateHistoryByExtrinsicHash(extrinsicHash: string, updateData: Partial<TransactionHistoryItem>): Promise<unknown>;
|
|
@@ -58,7 +58,7 @@ export default class DatabaseService {
|
|
|
58
58
|
updateAssetStore(item: _ChainAsset): Promise<unknown>;
|
|
59
59
|
getAllAssetStore(): Promise<_ChainAsset[]>;
|
|
60
60
|
removeFromAssetStore(items: string[]): Promise<number>;
|
|
61
|
-
updateChainStakingMetadata(item: ChainStakingMetadata): Promise<unknown>;
|
|
61
|
+
updateChainStakingMetadata(item: ChainStakingMetadata, changes?: Record<string, unknown>): Promise<unknown>;
|
|
62
62
|
getChainStakingMetadata(): Promise<ChainStakingMetadata[]>;
|
|
63
63
|
getStakingMetadataByChain(chain: string, type?: StakingType): Promise<ChainStakingMetadata | undefined>;
|
|
64
64
|
updateNominatorMetadata(item: NominatorMetadata): Promise<unknown>;
|
|
@@ -99,8 +99,8 @@ export default class DatabaseService {
|
|
|
99
99
|
next: data => callback && callback(data)
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
|
-
subscribeNominatorMetadata(callback) {
|
|
103
|
-
this.stores.nominatorMetadata.
|
|
102
|
+
subscribeNominatorMetadata(addresses, callback) {
|
|
103
|
+
return this.stores.nominatorMetadata.subscribeByAddresses(addresses).subscribe({
|
|
104
104
|
next: data => callback && callback(data)
|
|
105
105
|
});
|
|
106
106
|
}
|
|
@@ -191,7 +191,11 @@ export default class DatabaseService {
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
// Staking
|
|
194
|
-
async updateChainStakingMetadata(item) {
|
|
194
|
+
async updateChainStakingMetadata(item, changes) {
|
|
195
|
+
const existingRecord = await this.stores.chainStakingMetadata.getByChainAndType(item.chain, item.type);
|
|
196
|
+
if (existingRecord && changes) {
|
|
197
|
+
return this.stores.chainStakingMetadata.updateByChainAndType(item.chain, item.type, changes);
|
|
198
|
+
}
|
|
195
199
|
return this.stores.chainStakingMetadata.upsert(item);
|
|
196
200
|
}
|
|
197
201
|
async getChainStakingMetadata() {
|
|
@@ -6,4 +6,5 @@ export default class ChainStakingMetadataStore extends BaseStoreWithChain<ChainS
|
|
|
6
6
|
getByChains(chains: string[]): Promise<ChainStakingMetadata[]>;
|
|
7
7
|
getByChainAndType(chain: string, type?: StakingType): import("dexie").PromiseExtended<ChainStakingMetadata | undefined>;
|
|
8
8
|
removeByChains(chains: string[]): Promise<number>;
|
|
9
|
+
updateByChainAndType(chain: string, type: StakingType | undefined, changes: Record<string, unknown>): import("dexie").PromiseExtended<number>;
|
|
9
10
|
}
|
|
@@ -26,4 +26,7 @@ export default class ChainStakingMetadataStore extends BaseStoreWithChain {
|
|
|
26
26
|
async removeByChains(chains) {
|
|
27
27
|
return this.table.where('chain').anyOfIgnoreCase(chains).delete();
|
|
28
28
|
}
|
|
29
|
+
updateByChainAndType(chain, type = StakingType.NOMINATED, changes) {
|
|
30
|
+
return this.table.update([chain, type], changes);
|
|
31
|
+
}
|
|
29
32
|
}
|
|
@@ -2,8 +2,8 @@ import { NominatorMetadata } from '@subwallet/extension-base/background/KoniType
|
|
|
2
2
|
import BaseStoreWithAddressAndChain from '@subwallet/extension-base/services/storage-service/db-stores/BaseStoreWithAddressAndChain';
|
|
3
3
|
export default class NominatorMetadataStore extends BaseStoreWithAddressAndChain<NominatorMetadata> {
|
|
4
4
|
getAll(): Promise<NominatorMetadata[]>;
|
|
5
|
-
|
|
5
|
+
subscribeByAddresses(addresses: string[]): import("dexie").Observable<NominatorMetadata[]>;
|
|
6
6
|
subscribeAll(): import("dexie").Observable<NominatorMetadata[]>;
|
|
7
|
-
getByAddress(
|
|
7
|
+
getByAddress(addresses: string[]): import("dexie").PromiseExtended<NominatorMetadata[]>;
|
|
8
8
|
removeByAddress(address: string): Promise<number>;
|
|
9
9
|
}
|
|
@@ -7,14 +7,14 @@ export default class NominatorMetadataStore extends BaseStoreWithAddressAndChain
|
|
|
7
7
|
async getAll() {
|
|
8
8
|
return this.table.toArray();
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
return liveQuery(() => this.getByAddress(
|
|
10
|
+
subscribeByAddresses(addresses) {
|
|
11
|
+
return liveQuery(() => this.getByAddress(addresses));
|
|
12
12
|
}
|
|
13
13
|
subscribeAll() {
|
|
14
14
|
return liveQuery(() => this.getAll());
|
|
15
15
|
}
|
|
16
|
-
getByAddress(
|
|
17
|
-
return this.table.where('address').anyOfIgnoreCase(
|
|
16
|
+
getByAddress(addresses) {
|
|
17
|
+
return this.table.where('address').anyOfIgnoreCase(addresses).toArray();
|
|
18
18
|
}
|
|
19
19
|
async removeByAddress(address) {
|
|
20
20
|
return this.table.where('address').anyOfIgnoreCase(address).delete();
|
|
@@ -631,7 +631,12 @@ export default class TransactionService {
|
|
|
631
631
|
if (!payload.parseData) {
|
|
632
632
|
const isToContract = await isContractAddress(payload.to || '', evmApi);
|
|
633
633
|
payload.isToContract = isToContract;
|
|
634
|
-
|
|
634
|
+
try {
|
|
635
|
+
payload.parseData = isToContract ? payload.data ? (await parseContractInput(payload.data || '', payload.to || '', chainInfo)).result : '' : payload.data || '';
|
|
636
|
+
} catch (e) {
|
|
637
|
+
console.warn('Unable to parse contract input data');
|
|
638
|
+
payload.parseData = payload.data;
|
|
639
|
+
}
|
|
635
640
|
}
|
|
636
641
|
if ('data' in payload && payload.data === undefined) {
|
|
637
642
|
delete payload.data;
|