Skip to content

Commit

Permalink
v1.15.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mytonwalletorg committed Aug 4, 2023
1 parent ba76bd5 commit bfea14c
Show file tree
Hide file tree
Showing 20 changed files with 340 additions and 95 deletions.
185 changes: 185 additions & 0 deletions .github/workflows/electron-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
name: Electron release

on:
workflow_dispatch:
push:
branches: master

env:
APP_NAME: MyTonWallet

jobs:
release:
runs-on: macOS-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Cache node modules
id: npm-cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-
- name: Install dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci

- name: Import MacOS Signing Certificate
env:
APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
run: |
KEY_CHAIN=build.keychain
CERTIFICATE_P12=certificate.p12
echo "$APPLE_CERTIFICATE_BASE64" | base64 --decode > $CERTIFICATE_P12
security create-keychain -p actions $KEY_CHAIN
security default-keychain -s $KEY_CHAIN
security unlock-keychain -p actions $KEY_CHAIN
security import $CERTIFICATE_P12 -k $KEY_CHAIN -P $APPLE_CERTIFICATE_PASSWORD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k actions $KEY_CHAIN
security find-identity -v -p codesigning $KEY_CHAIN
- name: Build and release
env:
TONHTTPAPI_MAINNET_URL: ${{ vars.TONHTTPAPI_MAINNET_URL }}
TONAPIIO_MAINNET_URL: ${{ vars.TONAPIIO_MAINNET_URL }}
TONHTTPAPI_TESTNET_URL: ${{ vars.TONHTTPAPI_TESTNET_URL }}
TONAPIIO_TESTNET_URL: ${{ vars.TONAPIIO_TESTNET_URL }}
PROXY_HOSTS: ${{ vars.PROXY_HOSTS }}
STAKING_POOLS: ${{ vars.STAKING_POOLS }}
ELECTRON_TONHTTPAPI_MAINNET_API_KEY: ${{ secrets.ELECTRON_TONHTTPAPI_MAINNET_API_KEY }}

APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}

PUBLISH_REPO: ${{ vars.PUBLISH_REPO }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
if [ -z "$PUBLISH_REPO" ]; then
npm run electron:staging
else
npm run deploy:electron
fi
- uses: actions/upload-artifact@v3
with:
name: ${{ env.APP_NAME }}-x64.dmg
path: dist-electron/${{ env.APP_NAME }}-x64.dmg

- uses: actions/upload-artifact@v3
with:
name: ${{ env.APP_NAME }}-arm64.dmg
path: dist-electron/${{ env.APP_NAME }}-arm64.dmg

- uses: actions/upload-artifact@v3
with:
name: ${{ env.APP_NAME }}-x86_64.AppImage
path: dist-electron/${{ env.APP_NAME }}-x86_64.AppImage

- uses: actions/upload-artifact@v3
with:
name: ${{ env.APP_NAME }}-x64.exe
path: dist-electron/${{ env.APP_NAME }}-x64.exe

windowsSigning:
needs: release
runs-on: windows-latest
if: vars.PUBLISH_REPO != ''
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
PUBLISH_REPO: ${{ vars.PUBLISH_REPO }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Certificate
shell: bash
run: echo "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12

- name: Set environment variables
id: variables
shell: bash
run: |
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
echo "FILE_NAME=${{ env.APP_NAME }}-x64.exe" >> "$GITHUB_ENV"
echo "SM_HOST=${{ secrets.SM_HOST }}" >> "$GITHUB_ENV"
echo "SM_API_KEY=${{ secrets.SM_API_KEY }}" >> "$GITHUB_ENV"
echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV"
echo "SM_CLIENT_CERT_PASSWORD=${{ secrets.SM_CLIENT_CERT_PASSWORD }}" >> "$GITHUB_ENV"
echo "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $GITHUB_PATH
echo "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools" >> $GITHUB_PATH
echo "C:\Program Files\DigiCert\DigiCert One Signing Manager Tools" >> $GITHUB_PATH
- name: Setup SSM KSP
env:
SM_API_KEY: ${{ secrets.SM_API_KEY }}
shell: cmd
run: |
curl.exe -X GET https://one.digicert.com/signingmanager/api-ui/v1/releases/smtools-windows-x64.msi/download -H "x-api-key:%SM_API_KEY%" -o smtools.msi
msiexec /i smtools.msi /quiet /qn
smksp_registrar.exe list
smctl.exe keypair ls
C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user
smksp_cert_sync.exe
- name: Download Windows package
id: download-artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.FILE_NAME }}

- name: Signing package
env:
KEYPAIR_ALIAS: ${{ secrets.KEYPAIR_ALIAS }}
FILE_PATH: ${{ steps.download-artifact.outputs.download-path }}
shell: cmd
run: smctl.exe sign --keypair-alias=%KEYPAIR_ALIAS% --input "%FILE_PATH%\%FILE_NAME%"

- uses: actions/upload-artifact@v3
with:
name: ${{ env.FILE_NAME }}
path: ${{ env.FILE_NAME }}

- name: Get latest release ID
id: release-id
shell: bash
run: |
RELEASE_ID=$(curl -s -H "Authorization: Bearer $GH_TOKEN" "https://api.github.com/repos/$PUBLISH_REPO/releases?per_page=1" | jq -r '.[0].id')
echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT
- name: Delete existing asset
env:
RELEASE_ID: ${{ steps.release-id.outputs.release_id }}
shell: bash
run: |
PUBLISH_FILE_NAME=${FILE_NAME// /-} # Consistency with electron-builder
ASSET_ID=$(curl -s -H "Authorization: Bearer $GH_TOKEN" "https://api.github.com/repos/$PUBLISH_REPO/releases/$RELEASE_ID/assets" | jq -r --arg PUBLISH_FILE_NAME "$PUBLISH_FILE_NAME" '.[] | select(.name == $PUBLISH_FILE_NAME) | .id')
curl -X DELETE -H "Authorization: Bearer $GH_TOKEN" "https://api.github.com/repos/$PUBLISH_REPO/releases/assets/$ASSET_ID"
- name: Push new asset
env:
FILE_PATH: ${{ steps.download-artifact.outputs.download-path }}
RELEASE_ID: ${{ steps.release-id.outputs.release_id }}
shell: bash
run: |
PUBLISH_FILE_NAME=${FILE_NAME// /-} # Consistency with electron-builder
curl -X POST -H "Authorization: Bearer $GH_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary "@$FILE_PATH\\$FILE_NAME" \
"https://uploads.github.com/repos/$PUBLISH_REPO/releases/$RELEASE_ID/assets?name=$PUBLISH_FILE_NAME"
- name: Publish release
env:
RELEASE_ID: ${{ steps.release-id.outputs.release_id }}
shell: bash
run: |
curl -X PATCH -H "Authorization: Bearer $GH_TOKEN" "https://api.github.com/repos/$PUBLISH_REPO/releases/$RELEASE_ID" -d '{"draft": false}'
5 changes: 2 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mytonwallet",
"version": "1.15.0",
"version": "1.15.1",
"description": "The most feature-rich web wallet and browser extension for TON – with support of multi-accounts, tokens (jettons), NFT, TON DNS, TON Sites, TON Proxy, and TON Magic.",
"main": "index.js",
"scripts": {
Expand All @@ -15,7 +15,7 @@
"build:extension:production": "npm i && cross-env ENV_EXTENSION=1 webpack && bash ./deploy/copy_to_dist.sh && rm -f MyTonWallet.zip && zip -r -X MyTonWallet.zip dist/*",
"build:extension:dev:firefox": "cross-env IS_FIREFOX_EXTENSION=1 npm run build:extension:dev",
"build:extension:production:firefox": "npm i && cross-env IS_FIREFOX_EXTENSION=1 ENV_EXTENSION=1 webpack && bash ./deploy/copy_to_dist.sh && rm -f MyTonWallet-firefox.zip && cd dist && rm -f reference.json && zip -r -X ../MyTonWallet-firefox.zip ./*",
"deploy:electron": "source .env && npm run electron:production -- -p always && git checkout . && git clean -df",
"deploy:electron": "npm run electron:production -- -p always",
"start:extension:dev:arch": "npm run build:extension:dev && google-chrome-stable --load-extension=\"`pwd`/dist\"",
"start:extension:dev:mac": "npm run build:extension:dev && open -a \"Google Chrome\" --load-extension=\"`pwd`/dist\"",
"build:icons": "fantasticon",
Expand All @@ -26,7 +26,7 @@
"test:record": "playwright codegen localhost:1235",
"electron:webpack": "cross-env APP_ENV=$ENV webpack --config ./webpack-electron.config.ts",
"electron:build": "IS_ELECTRON=true npm run build:$ENV && electron-builder install-app-deps && electron-rebuild && ENV=$ENV npm run electron:webpack",
"electron:staging": "ENV=staging CSC_IDENTITY_AUTO_DISCOVERY=false npm run electron:package --",
"electron:staging": "ENV=staging npm run electron:package -- -p never",
"electron:production": "ENV=production npm run electron:package --",
"electron:package": "npm run electron:build && npx rimraf dist-electron && electron-builder build --win --mac --linux --config src/electron/config.yml",
"prepare": "husky install",
Expand Down Expand Up @@ -71,7 +71,6 @@
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.0",
"@babel/register": "^7.21.0",
"@electron/rebuild": "^3.2.10",
"@peculiar/webcrypto": "^1.3.2",
"@playwright/test": "^1.31.2",
"@statoscope/cli": "^5.26.2",
Expand Down
3 changes: 2 additions & 1 deletion src/api/blockchains/ton/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export async function resolveAddress(network: ApiNetwork, address: string) {

try {
if (dns.isVipDnsDomain(domain)) {
const base = dns.removeZone(domain);
const base = dns.removeVipZone(domain)!;

return (await new DnsCollection(tonweb.provider, {
address: VIP_DNS_COLLECTION,
}).resolve(base, 'wallet'))?.toString(true, true, true);
Expand Down
13 changes: 7 additions & 6 deletions src/api/blockchains/ton/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import TonWeb from 'tonweb';
import type {
ApiBaseToken, ApiNetwork, ApiToken, ApiTokenSimple,
} from '../../types';
import type { ApiTransactionExtra, JettonMetadata } from './types';
import type { AnyPayload, ApiTransactionExtra, JettonMetadata } from './types';

import { parseAccountId } from '../../../util/account';
import { logDebugError } from '../../../util/logs';
Expand Down Expand Up @@ -92,7 +92,7 @@ export function parseTokenTransaction(
}

const {
operation, jettonAmount, address, forwardComment,
operation, jettonAmount, address, comment, encryptedComment,
} = parsedData;
const isIncoming = operation === 'InternalTransfer';

Expand All @@ -102,7 +102,8 @@ export function parseTokenTransaction(
fromAddress: isIncoming ? (address ?? tx.fromAddress) : walletAddress,
toAddress: isIncoming ? walletAddress : address!,
amount: isIncoming ? jettonAmount.toString() : `-${jettonAmount}`,
comment: forwardComment,
comment,
encryptedComment,
isIncoming,
};
}
Expand All @@ -113,7 +114,7 @@ export async function buildTokenTransfer(
fromAddress: string,
toAddress: string,
amount: string,
comment?: string,
payload?: AnyPayload,
) {
const minterAddress = resolveTokenBySlug(slug).minterAddress!;
const tokenWalletAddress = await resolveTokenWalletAddress(network, fromAddress, minterAddress);
Expand All @@ -124,11 +125,11 @@ export async function buildTokenTransfer(

const tokenWallet = getTokenWallet(network, tokenWalletAddress);

const payload = buildTokenTransferBody({
payload = buildTokenTransferBody({
tokenAmount: amount,
toAddress,
forwardAmount: TOKEN_TRANSFER_TON_FORWARD_AMOUNT.toString(),
forwardPayload: comment,
forwardPayload: payload,
responseAddress: fromAddress,
});

Expand Down
13 changes: 2 additions & 11 deletions src/api/blockchains/ton/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ApiTransactionDraftError, ApiTransactionError } from '../../types';
import type {
ApiNetwork, ApiSignedTransfer, ApiTransaction, ApiTxIdBySlug,
} from '../../types';
import type { ApiTransactionExtra, TonTransferParams } from './types';
import type { AnyPayload, ApiTransactionExtra, TonTransferParams } from './types';

import { TON_TOKEN_SLUG } from '../../../config';
import { parseAccountId } from '../../../util/account';
Expand Down Expand Up @@ -141,11 +141,6 @@ export async function checkTransactionDraft(
}
}
} else {
if (data && typeof data !== 'string') {
result.error = ApiTransactionDraftError.Unexpected;
return result;
}

const address = await fetchStoredAddress(accountId);
const tokenAmount: string = amount;
let tokenWallet: JettonWalletType;
Expand Down Expand Up @@ -183,7 +178,7 @@ export async function submitTransfer(
tokenSlug: string,
toAddress: string,
amount: string,
data?: string | Uint8Array | Cell,
data?: AnyPayload,
stateInit?: Cell,
shouldEncrypt?: boolean,
): Promise<SubmitTransferResult> {
Expand All @@ -207,10 +202,6 @@ export async function submitTransfer(
}

if (tokenSlug !== TON_TOKEN_SLUG) {
if (data && typeof data !== 'string') {
throw new Error('Unknown error');
}

({
amount,
toAddress: resolvedAddress,
Expand Down
6 changes: 4 additions & 2 deletions src/api/blockchains/ton/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export declare class MyTonWeb extends TonWeb {
dns: Dns;
}

export type AnyPayload = string | Uint8Array | Cell;

export interface ApiTransactionExtra extends ApiTransaction {
extraData?: { body?: any };
}
Expand All @@ -27,13 +29,13 @@ export interface TokenTransferBodyParams {
toAddress: string;
responseAddress: string;
forwardAmount: string;
forwardPayload?: Cell | string;
forwardPayload?: AnyPayload;
}

export interface TonTransferParams {
toAddress: string;
amount: string;
payload?: string | Uint8Array | Cell;
payload?: AnyPayload;
stateInit?: Cell;
}

Expand Down
Loading

0 comments on commit bfea14c

Please sign in to comment.