Skip to content

Commit

Permalink
Release/v1.8.0 (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shramp authored Oct 16, 2023
1 parent 560ea0a commit 225b7c9
Show file tree
Hide file tree
Showing 52 changed files with 728 additions and 163 deletions.
163 changes: 81 additions & 82 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Build Desktop Wallet

on:
push:
branches: [ main, develop ]
tags: [ 'v*' ]
branches: [main, develop]
tags: ['v*']
pull_request:

env:
Expand All @@ -17,7 +17,7 @@ jobs:
contents: write
env:
# Pin full service binary version
FULL_SERVICE_VERSION: "v2.7.0"
FULL_SERVICE_VERSION: 'v2.8.0'
# Apple codesigning certs
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
Expand Down Expand Up @@ -61,82 +61,81 @@ jobs:
network: testnet

steps:
- uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 0

- uses: FranzDiebold/github-env-vars-action@v1.2.1

- name: Export version tag
run: |
echo "VERSION=$(git describe --dirty=+ --always --tags)" >> $GITHUB_ENV
- name: Configure node
uses: actions/setup-node@v3
with:
node-version: 16

- name: Setup python@3.10 for self-hosted runners
# required due to issue with node-gyp@0.7 and python@3.11
# see: https://stackoverflow.com/questions/74715990/node-gyp-err-invalid-mode-ru-while-trying-to-load-binding-gyp
if: ${{ matrix.os == 'mac' }}
run: |
brew install python@3.10
python3.10 -m venv .venv
echo "$(pwd)/.venv/bin" >> $GITHUB_PATH
- name: Configure node module caching
uses: actions/cache@v3
with:
key: desktop-wallet-${{ matrix.os }}-${{ github.run_id }}
restore-keys: desktop-wallet-${{ matrix.os }}
lookup-only: ${{ matrix.network == 'testnet' }}
path: |
./node_modules
- name: Install node dependencies
uses: borales/actions-yarn@v4
with:
cmd: install

- name: Fetch and link full-service binaries for packaging
run: |
./get-full-service.sh -o ${{ matrix.os }} -a ${{ matrix.arch }} -n ${{ matrix.network }} -v ${{ env.FULL_SERVICE_VERSION }}
cp -r ./full-service-bin/${{ matrix.network }}/* ./full-service-bin/
ls ./full-service-bin/
- name: Patch testnet build names and disable autoupdate
if: ${{ matrix.network == 'testnet' }}
run: |
sed -i.bkp -e's/MobileCoin Wallet/MobileCoin Wallet TestNet/g' package.json
sed -i.bkp -e's/mobilecoin-wallet/mobilecoin-wallet-testnet/g' package.json
sed -i.bkp -e's/MobileCoin Wallet/MobileCoin Wallet TestNet/g' app/package.json
sed -i.bkp -e's/mobilecoin-wallet/mobilecoin-wallet-testnet/g' app/package.json
sed -i.bkp -e's/new AppUpdater();//g' app/main.dev.ts
yarn postinstall
- name: Build and package app
uses: borales/actions-yarn@v4
with:
cmd: package-${{ matrix.os }}

- name: Upload package artifacts
uses: actions/upload-artifact@v3
with:
name: mobilecoin-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.network }}
path: |
release/MobileCoin Wallet*
release/mobilecoin-wallet*
release/latest-*.yml
- name: Create prerelease for tagged versions
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
draft: true
prerelease: true
files: |
release/MobileCoin Wallet*
release/mobilecoin-wallet*
- uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 0

- uses: FranzDiebold/github-env-vars-action@v1.2.1

- name: Export version tag
run: |
echo "VERSION=$(git describe --dirty=+ --always --tags)" >> $GITHUB_ENV
- name: Configure node
uses: actions/setup-node@v3
with:
node-version: 16

- name: Setup python@3.10 for self-hosted runners
# required due to issue with node-gyp@0.7 and python@3.11
# see: https://stackoverflow.com/questions/74715990/node-gyp-err-invalid-mode-ru-while-trying-to-load-binding-gyp
if: ${{ matrix.os == 'mac' }}
run: |
brew install python@3.10
python3.10 -m venv .venv
echo "$(pwd)/.venv/bin" >> $GITHUB_PATH
- name: Configure node module caching
uses: actions/cache@v3
with:
key: desktop-wallet-${{ matrix.os }}-${{ github.run_id }}
restore-keys: desktop-wallet-${{ matrix.os }}
lookup-only: ${{ matrix.network == 'testnet' }}
path: |
./node_modules
- name: Install node dependencies
uses: borales/actions-yarn@v4
with:
cmd: install

- name: Fetch and link full-service binaries for packaging
run: |
./get-full-service.sh -o ${{ matrix.os }} -a ${{ matrix.arch }} -n ${{ matrix.network }} -v ${{ env.FULL_SERVICE_VERSION }}
cp -r ./full-service-bin/${{ matrix.network }}/* ./full-service-bin/
ls ./full-service-bin/
- name: Patch testnet build names and disable autoupdate
if: ${{ matrix.network == 'testnet' }}
run: |
sed -i.bkp -e's/MobileCoin Wallet/MobileCoin Wallet TestNet/g' package.json
sed -i.bkp -e's/mobilecoin-wallet/mobilecoin-wallet-testnet/g' package.json
sed -i.bkp -e's/MobileCoin Wallet/MobileCoin Wallet TestNet/g' app/package.json
sed -i.bkp -e's/mobilecoin-wallet/mobilecoin-wallet-testnet/g' app/package.json
sed -i.bkp -e's/new AppUpdater();//g' app/main.dev.ts
yarn postinstall
- name: Build and package app
uses: borales/actions-yarn@v4
with:
cmd: package-${{ matrix.os }}

- name: Upload package artifacts
uses: actions/upload-artifact@v3
with:
name: mobilecoin-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.network }}
path: |
release/MobileCoin Wallet*
release/mobilecoin-wallet*
release/latest-*.yml
- name: Create prerelease for tagged versions
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
draft: true
prerelease: true
files: |
release/MobileCoin Wallet*
release/mobilecoin-wallet*
8 changes: 7 additions & 1 deletion app/components/AccountCard/AccountCard.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { Accounts } from '../../types/Account';

export interface AccountCardProps {
account: { accountId: string; b58Code: string; name?: string; balance: string };
account: {
accountId: string;
b58Code: string;
name?: string;
balance: string;
fogEnabled?: boolean;
};
accounts?: Accounts;
isGift?: boolean;
onClickCode?: (code: string, text: string) => void;
Expand Down
1 change: 1 addition & 0 deletions app/components/AccountCard/AccountCard.view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ const AccountCard: FC<AccountCardProps> = ({
data-testid="account-card-long-code"
codeClass={classes.code}
code={b58Code}
isLong={account.fogEnabled}
/>
</Box>
</Tooltip>
Expand Down
1 change: 1 addition & 0 deletions app/components/LongCode/LongCode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export interface LongCodeProps {
code: string;
codeClass?: string;
isTruncated?: boolean;
isLong?: boolean;
}
6 changes: 4 additions & 2 deletions app/components/LongCode/LongCode.view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const useStyles = makeStyles((theme: Theme) => ({
},
}));

const LongCode: FC<LongCodeProps> = ({ code, codeClass, isTruncated }: LongCodeProps) => {
const LongCode: FC<LongCodeProps> = ({ code, codeClass, isTruncated, isLong }: LongCodeProps) => {
const classes = useStyles();

// Remove the center of the code and replace with * *
Expand All @@ -50,11 +50,13 @@ const LongCode: FC<LongCodeProps> = ({ code, codeClass, isTruncated }: LongCodeP
let nextCodeLine: JSX.Element[] = [];
const codeLines: JSX.Element[][] = [];

const lineLength = isLong ? 18 : 11;

colorCode.forEach((char, i) => {
nextCodeLine.push(char);
if (i === displayedCode.length - 1) {
codeLines.push(nextCodeLine);
} else if (nextCodeLine.length === 11) {
} else if (nextCodeLine.length === lineLength) {
codeLines.push(nextCodeLine);
nextCodeLine = [];
}
Expand Down
78 changes: 78 additions & 0 deletions app/fullService/api/buildAndSubmitTransaction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import type { StringHex, StringB58, StringUInt64 } from '../../types/SpecialStrings';
import type { AddressAndAmount } from '../../types/TransactionAmount';
import type { OutputTxo, TxProposal } from '../../types/TxProposal';
import axiosFullService, { AxiosFullServiceResponse } from '../axiosFullService';

const BUILD_AND_SUBMIT_TRANSACTION_METHOD = 'build_and_submit_transaction';
// this value comes from the mobilecoin lib. Ideally it would be exposed by full-service but in
// the interest of getting things done fast, we're just hard-coding it here for now

export type BuildAndSubmitTransactionParams = {
addressesAndAmounts: AddressAndAmount[];
accountId: StringHex;
feeValue?: StringUInt64;
feeTokenId?: StringUInt64;
inputTxoIds?: StringHex[];
maxSpendableValue?: StringUInt64;
tombstoneBlock?: StringUInt64;
blockVersion?: StringUInt64;
};

export type BuildAndSubmitTransactionResult = {
feeConfirmation: bigint;
totalValueConfirmation: bigint;
txProposal: TxProposal;
txProposalReceiverB58Code: StringB58;
};

type BuildAndSubmitTransactionProposalResponse = {
txProposal: TxProposal;
};

const buildAndSubmitTransaction = async ({
addressesAndAmounts,
accountId,
feeValue,
feeTokenId,
inputTxoIds,
maxSpendableValue,
tombstoneBlock,
blockVersion,
}: BuildAndSubmitTransactionParams): Promise<BuildAndSubmitTransactionResult> => {
const { result, error }: AxiosFullServiceResponse<BuildAndSubmitTransactionProposalResponse> =
await axiosFullService(BUILD_AND_SUBMIT_TRANSACTION_METHOD, {
accountId,
addressesAndAmounts,
blockVersion,
feeTokenId,
feeValue,
inputTxoIds,
maxSpendableValue,
tombstoneBlock,
});

if (error) {
throw new Error(error);
} else if (!result) {
throw new Error('Failure to retrieve data.');
}

const { txProposal } = result;
// FIX-ME: assumes only 1 recipient
const txProposalReceiverB58Code = txProposal.payloadTxos[0].recipientPublicAddressB58;

// TODO fix type, right now it just matches what the component is expecting
const totalValueConfirmation = txProposal.payloadTxos
.map((txo: OutputTxo) => BigInt(txo.amount.value))
.reduce((acc: bigint, cur: bigint) => acc + cur, BigInt(0));

const feeConfirmation = BigInt(txProposal.feeAmount.value);
return {
feeConfirmation,
totalValueConfirmation,
txProposal,
txProposalReceiverB58Code,
};
};

export default buildAndSubmitTransaction;
8 changes: 7 additions & 1 deletion app/fullService/api/createAccount.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import type { Account, AccountV2 } from '../../types/Account.d';
import { FogInfo } from '../../utils/fogConstants';
import axiosFullService, { AxiosFullServiceResponse } from '../axiosFullService';
import getAccount from './getAccount';

const CREATE_ACCOUNT_METHOD = 'create_account';

type CreateAccountParams = {
name: string | null;
fogInfo?: FogInfo;
};

type CreateAccountResult = {
Expand All @@ -16,10 +18,14 @@ type CreateAccountResultV2 = {
account: AccountV2;
};

const createAccount = async ({ name }: CreateAccountParams): Promise<CreateAccountResult> => {
const createAccount = async ({
name,
fogInfo,
}: CreateAccountParams): Promise<CreateAccountResult> => {
const { result, error }: AxiosFullServiceResponse<CreateAccountResultV2> = await axiosFullService(
CREATE_ACCOUNT_METHOD,
{
fog_info: fogInfo ? { ...fogInfo } : undefined,
name,
}
);
Expand Down
2 changes: 2 additions & 0 deletions app/fullService/api/getAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export function convertAccountV2(account: AccountV2): Account {
accountHeight: account.nextBlockIndex,
accountId: account.id,
firstBlockIndex: account.firstBlockIndex,
fogEnabled: account.fogEnabled,
mainAddress: account.mainAddress,
managedByHardwareWallet: account.managedByHardwareWallet,
name: account.name,
nextSubaddressIndex: account.nextSubaddressIndex,
recoveryMode: account.recoveryMode,
Expand Down
1 change: 1 addition & 0 deletions app/fullService/api/getNetworkStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function convertNetworkStatusFromV2(networkStatus: NetworkStatusV2): GetNetworkS
blockVersion: networkStatus.blockVersion,
fees: networkStatus.fees,
localBlockHeight: networkStatus.localBlockHeight,
network: networkStatus.networkInfo.chainId,
networkBlockHeight: networkStatus.networkBlockHeight,
},
};
Expand Down
4 changes: 4 additions & 0 deletions app/fullService/api/importAccount.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Account, AccountV2 } from '../../types/Account.d';
import { FogInfo } from '../../utils/fogConstants';
import axiosFullService, { AxiosFullServiceResponse } from '../axiosFullService';
import getAccount from './getAccount';

Expand All @@ -9,6 +10,7 @@ type ImportAccountParams = {
key_derivation_version: string;
firstBlockIndex?: string;
name: string | null;
fogInfo?: FogInfo;
};

type ImportAccountResult = {
Expand All @@ -24,11 +26,13 @@ const importAccount = async ({
key_derivation_version,
firstBlockIndex,
name,
fogInfo,
}: ImportAccountParams): Promise<ImportAccountResult> => {
const { result, error }: AxiosFullServiceResponse<ImportAccountResultV2> = await axiosFullService(
IMPORT_ACCOUNT_METHOD,
{
firstBlockIndex,
fogInfo,
key_derivation_version,
mnemonic,
name,
Expand Down
Loading

0 comments on commit 225b7c9

Please sign in to comment.