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

fix: amount to receive #196

Merged
merged 50 commits into from
Jun 11, 2024
Merged
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
28e1ee2
fix: fixing erronous amount to receive displayed due to double subtra…
wainola May 13, 2024
3780105
fix: wrong amount displayed if user changes original value
wainola May 14, 2024
4484a38
chore: removing log
wainola May 14, 2024
3f7a9f8
chore: small refactor of some functions to avoid some race conditions
wainola May 22, 2024
ea04338
chore: small fixes
wainola May 22, 2024
cb9a62a
chore: removing log
wainola May 23, 2024
48e4084
Merge branch 'fix/amount-to-receive' of github.com:sygmaprotocol/sygm…
saadahmsiddiqui May 23, 2024
2e2eb99
chore: remove unused check
wainola May 23, 2024
df51abc
chore: pr review
wainola May 23, 2024
81cfc75
chore: fixing build
wainola May 23, 2024
5f70270
chore: pr review suggestions and small changes
wainola May 24, 2024
9c40d46
chore: fixing build
wainola May 24, 2024
1df0279
chore: adding new variable to display amount to receive
wainola May 27, 2024
5437f6d
Merge branch 'main' into fix/amount-to-receive
Lykhoyda May 28, 2024
ae58317
Merge branch 'main' into fix/amount-to-receive
Lykhoyda May 28, 2024
95e05cf
chore: changing variable state for substrate transaction build
wainola May 28, 2024
fbba63e
wip: debounce + flag
wainola May 29, 2024
40abc39
Merge branch 'fix/amount-to-receive' of github.com:sygmaprotocol/sygm…
saadahmsiddiqui May 29, 2024
0e4b661
added debounce input
saadahmsiddiqui May 29, 2024
0dc8e64
increase debounce time
saadahmsiddiqui May 29, 2024
b10473e
added fix for changing network selection
saadahmsiddiqui May 29, 2024
b1c2c65
fix: custom debounce
wainola May 30, 2024
e71b775
fix: remove dependency, fixing linting and build issues
wainola May 30, 2024
7275014
chore: fix tests
wainola May 30, 2024
3e84792
chore: update deps
wainola Jun 3, 2024
d041495
chore: remove commented code
wainola Jun 3, 2024
2aa84c3
chore: avoid re-asignement
wainola Jun 3, 2024
805c8d2
chore: restoring re-asignement
wainola Jun 3, 2024
c009d9b
chore: removing re-asignemt of resource amount
wainola Jun 3, 2024
0176aa8
reset stuff on build or estimation errors
saadahmsiddiqui Jun 3, 2024
355f6fd
chore: solving conflicts
wainola Jun 4, 2024
98cd816
chore: fixing lint
wainola Jun 4, 2024
b317ab0
chore: fixing tests
wainola Jun 4, 2024
fc726d8
chore: fixing tests
wainola Jun 4, 2024
08f3ae4
Merge branch 'main' into fix/amount-to-receive
Lykhoyda Jun 5, 2024
3423849
chore: addressing comments
wainola Jun 7, 2024
82bf8f3
chore: remove unused method
wainola Jun 7, 2024
8a1d687
chore: using constant in test
wainola Jun 7, 2024
588d171
Merge branch 'main' of github.com:sygmaprotocol/sygma-widget into fix…
saadahmsiddiqui Jun 7, 2024
8cad80c
Update packages/widget/src/components/resource-amount-selector/resour…
wainola Jun 7, 2024
f3f6cc6
Update packages/widget/src/controllers/transfers/fungible-token-trans…
wainola Jun 7, 2024
53ed022
Update packages/widget/src/controllers/transfers/fungible-token-trans…
wainola Jun 7, 2024
2c12d8b
Update packages/widget/src/controllers/transfers/evm/execute.ts
wainola Jun 7, 2024
35259b0
Update packages/widget/src/utils/gas.ts
wainola Jun 7, 2024
88a0922
chore: addressing comments
wainola Jun 7, 2024
81febd9
chore: generic arg for debounce
wainola Jun 7, 2024
22af7b1
chore: addressing comments
wainola Jun 7, 2024
3b160fa
chore: small change on request update call
wainola Jun 7, 2024
48cd4fd
Update packages/widget/src/controllers/transfers/evm/build.ts
wainola Jun 9, 2024
d1fd4b7
chore: fixing lint issues
wainola Jun 9, 2024
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
Prev Previous commit
Next Next commit
chore: restoring re-asignement
wainola committed Jun 3, 2024
commit 805c8d2303dd70c78371db71aeac8f6f42db0910
12 changes: 7 additions & 5 deletions packages/widget/src/controllers/transfers/evm/build.ts
Original file line number Diff line number Diff line change
@@ -27,7 +27,8 @@ export async function buildEvmFungibleTransactions({
providerChainId,
env,
pendingEvmApprovalTransactions,
pendingTransferTransaction
pendingTransferTransaction,
fee
}: {
address: string;
chainId: number;
@@ -40,6 +41,7 @@ export async function buildEvmFungibleTransactions({
pendingEvmApprovalTransactions: UnsignedTransaction[];
pendingTransferTransaction: UnsignedTransaction;
sourceNetwork: Domain | null;
fee: EvmFee;
}): Promise<{
pendingEvmApprovalTransactions: UnsignedTransaction[];
pendingTransferTransaction: UnsignedTransaction;
@@ -91,21 +93,21 @@ export async function buildEvmFungibleTransactions({
resourceId,
resourceAmount.toString()
);
const transferFee = await evmTransfer.getFee(transfer);
fee = await evmTransfer.getFee(transfer);

pendingEvmApprovalTransactions = await evmTransfer.buildApprovals(
transfer,
transferFee
fee
);

pendingTransferTransaction = await evmTransfer.buildTransferTransaction(
transfer,
transferFee
fee
);
return {
pendingEvmApprovalTransactions,
pendingTransferTransaction,
fee: transferFee,
fee,
resourceAmount
};
}
Original file line number Diff line number Diff line change
@@ -563,7 +563,8 @@ export class FungibleTokenTransferController implements ReactiveController {
this.pendingEvmApprovalTransactions,
pendingTransferTransaction: this
.pendingTransferTransaction as UnsignedTransaction,
sourceNetwork: this.sourceNetwork!
sourceNetwork: this.sourceNetwork!,
fee: this.fee as EvmFee
});

this.fee = evmTransferArtifacts.fee;
@@ -614,7 +615,8 @@ export class FungibleTokenTransferController implements ReactiveController {
resourceId: this.selectedResource!.resourceId,
resourceAmount: this.resourceAmount,
pendingTransferTransaction: this
.pendingTransferTransaction as SubstrateTransaction
.pendingTransferTransaction as SubstrateTransaction,
fee: this.fee as SubstrateFee
});

this.fee = fee;
12 changes: 7 additions & 5 deletions packages/widget/src/controllers/transfers/substrate/build.ts
Original file line number Diff line number Diff line change
@@ -13,7 +13,8 @@ export async function buildSubstrateFungibleTransactions({
destinationAddress,
resourceId,
resourceAmount,
pendingTransferTransaction
pendingTransferTransaction,
fee
}: {
address: string;
substrateProvider: ApiPromise;
@@ -23,6 +24,7 @@ export async function buildSubstrateFungibleTransactions({
resourceId: string;
resourceAmount: BigNumber;
pendingTransferTransaction: SubstrateTransaction;
fee: SubstrateFee;
}): Promise<{
pendingTransferTransaction: SubstrateTransaction;
resourceAmount: BigNumber;
@@ -39,20 +41,20 @@ export async function buildSubstrateFungibleTransactions({
String(resourceAmount)
);

const transferFee = await substrateTransfer.getFee(transfer);
fee = await substrateTransfer.getFee(transfer);

if (resourceAmount.toString() === transfer.details.amount.toString()) {
resourceAmount = resourceAmount.sub(transferFee.fee.toString());
resourceAmount = resourceAmount.sub(fee.fee.toString());
}

pendingTransferTransaction = substrateTransfer.buildTransferTransaction(
transfer,
transferFee
fee
);

return {
pendingTransferTransaction,
resourceAmount,
fee: transferFee
fee
};
}