Skip to content

Commit

Permalink
SORA parachain bridge (#1231)
Browse files Browse the repository at this point in the history
* add sora parachain for network selection

* prepare connector for refactoring

* refactoring SubNetworksConnector

* wip outgoing reducer

* fix network fee

* parachain tx tracking

* refactoring connector

* add sora parachain icon example

* add scrollbar to networks list

* sora parachain history restoration

* small fixes

* sonar refactoring

* update short names

* improve sub bridge history restoration

* restore refunded transactions

* improve history restoration parachain part

* [fix] clean history only for selected network

* revert env.json

* refactoring history restoration

* update wallet 1.26.3

* up version

* set detectEthereumProvider arg mustBeMetaMask to true

* review update
  • Loading branch information
Nikita-Polyakov authored and Sociopacific committed Dec 1, 2023
1 parent e60ddc7 commit 7cd7058
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/store/bridge/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ const getters = defineGetters<BridgeState>()({
const { state, rootState } = bridgeGetterContext(args);
const { networkSelected } = rootState.web3;

return !!networkSelected && !!state.historyLoading[networkSelected];
return !!(networkSelected && state.historyLoading[networkSelected]);
},
});

Expand Down
2 changes: 1 addition & 1 deletion src/utils/bridge/common/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class BridgeReducer<Transaction extends IBridgeTransaction> implements IB
try {
await Promise.race([
this.checkTransactionBlockId(id),
new Promise((resolve, reject) => setTimeout(reject, BLOCK_PRODUCE_TIME * 6)), // 30s
delay(BLOCK_PRODUCE_TIME * 6, false), // 36s
]);
} catch (error) {
console.info(`[${this.constructor.name}]: Implement "blockId" restoration by "txId"`);
Expand Down
12 changes: 10 additions & 2 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,16 @@ export const getWalletAddress = (): string => {
return storage.get('address');
};

export async function delay(ms = 50): Promise<void> {
await new Promise((resolve) => setTimeout(resolve, ms));
export async function delay(ms = 50, success = true): Promise<void> {
return await new Promise((resolve, reject) => setTimeout(success ? resolve : reject, ms));
}

export async function conditionalAwait(func: AsyncFnWithoutArgs, wait: boolean): Promise<void> {
if (wait) {
await func();
} else {
func();
}
}

export async function conditionalAwait(func: AsyncFnWithoutArgs, wait: boolean): Promise<void> {
Expand Down

0 comments on commit 7cd7058

Please sign in to comment.