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

feat(core): Transfer Domain feature branch (WIP) #4007

Merged
merged 23 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
23161bc
feat(core): allow evm conversion
Jul 24, 2023
c5a20c5
update value and text based on domain
Jul 26, 2023
ef80e77
feature(ui-ux): evm support for address book (#4008)
fullstackninja864 Aug 3, 2023
608fd3c
fix(ui-ux): fixed domain switch toggle (#4012)
fullstackninja864 Aug 3, 2023
e3aaa50
Merge branch 'feature/evm' into pierregee/evm-convert-screen
Aug 12, 2023
6a5b88f
feat(core): support transfer domain in convert screen (#4014)
Aug 14, 2023
5647087
fix(ui-ux): translations for convert screen (#4028)
chloezxyy Aug 29, 2023
d1daa41
fix conflict
Aug 30, 2023
fb4907f
fix conflict
Aug 30, 2023
a2f8f46
chore(ops): bump packages to display changi (#4030)
Aug 30, 2023
3eb745b
feat(ui-ux): add svg icons for sui and xchf tokens (#4031)
lykalabrada Aug 30, 2023
7062bfc
fix(ui-ux): updated walletkit package to filter out burn token pool p…
chloezxyy Sep 6, 2023
fb8a96d
chore(ops): bump walletkit (#4036)
Sep 26, 2023
e187749
Merge 'main' branch changes
lykalabrada Sep 26, 2023
a150b13
fix(ui-ux): svg border for evm tokens (#4029)
chloezxyy Sep 27, 2023
31cd4ab
feature(ui-ux): enable transfer domain (#4032)
chloezxyy Oct 3, 2023
fd79b4d
fix(ui-ux): fix selection of whitelisted address that redirects to ed…
lykalabrada Oct 4, 2023
e13ad96
chore(ui-ux): resolved ui bug for address book screen (#4041)
fullstackninja864 Oct 4, 2023
c63796e
fix(ui-ux): copy evm address when evm domain is toggled on (#4043)
lykalabrada Oct 6, 2023
4a87561
feat(core): add evmtx signer on convert (#4038)
lykalabrada Oct 9, 2023
38989db
feature(ui-ux): address book ui for transfer domain (#4042)
chloezxyy Oct 9, 2023
fe27038
fix(ui-ux): fix send nonce and vm address (#4045)
lykalabrada Oct 9, 2023
ac34ba6
Merge branch 'feature/evm' into pierregee/evm-convert-screen
Oct 9, 2023
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
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ module.exports = function (api) {
},
],
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-transform-private-methods",
"@babel/plugin-transform-class-properties",
"@babel/plugin-transform-private-property-in-object",
"react-native-reanimated/plugin",
];

Expand Down
16 changes: 11 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,22 @@ services:
ports:
- "19553:80"
- "19552:8080"
- "19551:8082"
# - "19551:8082"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"

defi-blockchain:
image: defi/defichain:master-91a01aea0
image: defi/defichain:HEAD-420563c450
ports:
- "19554:19554"
- "19551:19551"
command: >
defid
-printtoconsole
-rpcallowip=0.0.0.0/0
-rpcbind=0.0.0.0
-ethrpcbind=0.0.0.0
-rpcallowcors=http://localhost:8081
-rpcuser=playground
-rpcpassword=playground
-rpcworkqueue=512
Expand Down Expand Up @@ -55,10 +60,11 @@ services:
-grandcentralheight=16
-grandcentralepilogueheight=17
-nextnetworkupgradeheight=18
-changiintermediateheight=19
environment:
- RUST_LOG=debug

defi-playground:
image: ghcr.io/birthdayresearch/playground-api:3.34.0
image: ghcr.io/birthdayresearch/playground-api:4.0.0-rc.1.2
depends_on:
- defi-blockchain
ports:
Expand All @@ -71,7 +77,7 @@ services:
- "traefik.http.routers.playground.entrypoints=web"

defi-whale:
image: ghcr.io/birthdayresearch/whale-api:3.34.0
image: ghcr.io/birthdayresearch/whale-api:4.0.0-rc.1.2
depends_on:
- defi-blockchain
ports:
Expand Down
51 changes: 29 additions & 22 deletions mobile-app/app/api/transaction/dfi_converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import {
CTransactionSegWit,
TransactionSegWit,
} from "@defichain/jellyfish-transaction";

export type ConversionMode = "utxosToAccount" | "accountToUtxos";
import { ConvertDirection } from "@screens/enum";

export async function dfiConversionSigner(
account: WhaleWalletAccount,
amount: BigNumber,
mode: ConversionMode
mode: ConvertDirection,
): Promise<CTransactionSegWit> {
const script = await account.getScript();
const builder = account.withTransactionBuilder();
Expand All @@ -32,7 +31,7 @@ export async function dfiConversionSigner(
},
],
},
script
script,
);
} else {
signed = await builder.account.accountToUtxos(
Expand All @@ -46,55 +45,63 @@ export async function dfiConversionSigner(
],
mintingOutputsStart: 2, // 0: DfTx, 1: change, 2: minted utxos (mandated by jellyfish-tx)
},
script
script,
);
}
return new CTransactionSegWit(signed);
}

export function dfiConversionCrafter(
amount: BigNumber,
mode: ConversionMode,
convertDirection: ConvertDirection,
onBroadcast: () => any,
onConfirmation: () => void,
submitButtonLabel?: string
submitButtonLabel?: string,
): DfTxSigner {
if (
![
ConvertDirection.accountToUtxos,
ConvertDirection.utxosToAccount,
].includes(convertDirection)
) {
throw new Error("Unexpected DFI conversion");
}

const [symbolA, symbolB] =
mode === "utxosToAccount"
? ["UTXO", translate("screens/OceanInterface", "tokens")]
: [translate("screens/OceanInterface", "tokens"), "UTXO"];
convertDirection === ConvertDirection.utxosToAccount
? ["UTXO", translate("screens/OceanInterface", "DFI")]
: [translate("screens/OceanInterface", "DFI"), "UTXO"];
return {
sign: async (account: WhaleWalletAccount) =>
await dfiConversionSigner(account, amount, mode),
await dfiConversionSigner(account, amount, convertDirection),
title: translate(
"screens/ConvertConfirmScreen",
"Convert {{amount}} DFI to {{target}}",
"Convert {{amount}} {{symbolA}} to {{symbolB}} tokens",
{
amount: amount.toFixed(8),
target:
mode === "utxosToAccount"
? translate("screens/ConvertScreen", "tokens")
: "UTXO",
}
symbolA,
symbolB,
},
),
drawerMessages: {
preparing: translate("screens/OceanInterface", "Preparing to convert…"),
waiting: translate(
"screens/OceanInterface",
"Converting {{amount}} DFI {{symbolA}} to {{symbolB}}",
"Converting {{amount}} {{symbolA}} to {{symbolB}} tokens",
{
symbolA: symbolA,
symbolB: symbolB,
amount: amount.toFixed(8),
}
},
),
complete: translate(
"screens/OceanInterface",
"{{amount}} DFI converted to {{symbolB}}",
"{{amount}} {{symbolA}} converted to {{symbolB}} tokens",
{
symbolB: symbolB,
symbolA,
symbolB,
amount: amount.toFixed(8),
}
},
),
},
onBroadcast,
Expand Down
Loading