Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sora parachain xcm fee, Update rococo event #1120

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/consts/sub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ export const SUB_NETWORKS: Partial<Record<SubNetwork, NetworkData>> = {
export const SUB_TRANSFER_FEES: SubNetworksFees = {
[SubNetwork.Rococo]: {
ROC: {
[BridgeTxDirection.Outgoing]: '10188285',
[BridgeTxDirection.Incoming]: '4000000000',
[BridgeTxDirection.Outgoing]: '10124190',
[BridgeTxDirection.Incoming]: '0',
},
},
};
16 changes: 6 additions & 10 deletions src/utils/bridge/sub/classes/reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class SubBridgeReducer extends BridgeReducer<SubHistory> {
await new Promise<void>((resolve) => {
subscription = adapter.apiRx.query.system.blockHash(blockHeight).subscribe((hash) => {
if (!hash.isEmpty) {
blockId = hash.toString();
txId = blockId = hash.toString();
resolve();
}
});
Expand Down Expand Up @@ -502,7 +502,6 @@ export class SubBridgeOutgoingReducer extends SubBridgeReducer {

let subscription!: Subscription;
let blockNumber!: number;
let extrinsicIndex!: number;
let amount!: string;

try {
Expand All @@ -513,20 +512,17 @@ export class SubBridgeOutgoingReducer extends SubBridgeReducer {
const blockNumberObservable = this.subNetworkAdapter.apiRx.query.system.number();

subscription = combineLatest([eventsObservable, blockNumberObservable]).subscribe(([events, blockNum]) => {
const umpExecutedUpwardEvent = events.find((e) =>
this.subNetworkAdapter.api.events.ump.ExecutedUpward.is(e.event)
const messageQueueProcessedEvent = events.find((e) =>
this.subNetworkAdapter.api.events.messageQueue.Processed.is(e.event)
);

if (!umpExecutedUpwardEvent) return;
if (!messageQueueProcessedEvent) return;

const [hash, status] = umpExecutedUpwardEvent.event.data;
const [hash] = messageQueueProcessedEvent.event.data;

if (hash.toString() !== messageHash) return;

blockNumber = blockNum.toNumber();
extrinsicIndex = umpExecutedUpwardEvent.phase.asApplyExtrinsic.toNumber();

if (!status.isComplete) throw new Error(`[${this.constructor.name}]: Transaction is incomplete`);

// Native token for network
const balancesDepositEvent = events.find(
Expand All @@ -547,7 +543,7 @@ export class SubBridgeOutgoingReducer extends SubBridgeReducer {
subscription.unsubscribe();

// run blocking process promise
await this.getHashesByBlockNumber(this.subNetworkAdapter, blockNumber, extrinsicIndex)
await this.getHashesByBlockNumber(this.subNetworkAdapter, blockNumber)
.then(({ blockHeight, blockId, txId }) =>
this.updateTransactionParams(id, {
externalBlockHeight: blockHeight, // parachain block number
Expand Down