diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index db9d1056626..1724b9a1b7e 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -3,5 +3,5 @@
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
-* @milerius @satoshiotomakan @lamafab
-kotlin/ @MaximPestryakov
+* @milerius @satoshiotomakan @ar-g
+kotlin/ @ar-g @JaimeToca @rkokhatskyi
diff --git a/.github/workflows/android-ci.yml b/.github/workflows/android-ci.yml
index a575fe792ea..b8d6bb34c8a 100644
--- a/.github/workflows/android-ci.yml
+++ b/.github/workflows/android-ci.yml
@@ -12,7 +12,7 @@ concurrency:
jobs:
build:
- runs-on: [ self-hosted, macOS, ARM64, wallet-core ]
+ runs-on: macos-latest-large
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
@@ -29,6 +29,15 @@ jobs:
- name: Install system dependencies
run: |
tools/install-sys-dependencies-mac
+
+ - name: Cache Rust
+ uses: Swatinem/rust-cache@v2
+ with:
+ workspaces: |
+ rust
+
+ - name: Install Rust dependencies
+ run: |
tools/install-rust-dependencies
- name: Install Android Dependencies
@@ -39,7 +48,7 @@ jobs:
uses: actions/cache@v3
with:
path: build/local
- key: ${{ runner.os }}-internal-${{ hashFiles('tools/install-dependencies') }}
+ key: ${{ runner.os }}-${{ runner.arch }}-internal-${{ hashFiles('tools/install-dependencies') }}
- name: Install internal dependencies
run: tools/install-dependencies
@@ -51,8 +60,21 @@ jobs:
- name: Build Kotlin doc
run: tools/kotlin-doc
- - name: Run test
- run: tools/android-test
+ - name: Build tests
+ run: |
+ pushd android
+ ./gradlew assembleAndroidTest
+ popd
+
+ - name: Run tests
+ uses: reactivecircus/android-emulator-runner@v2
+ with:
+ api-level: 30
+ target: google_apis
+ arch: x86
+ ndk: 23.1.7779620
+ cmake: 3.18.1
+ script: cd android; ./gradlew connectedAndroidTest
- name: Build sample app
run: tools/samples-build android
diff --git a/.github/workflows/codegen-v2.yml b/.github/workflows/codegen-v2.yml
index 108b8e42448..50446778240 100644
--- a/.github/workflows/codegen-v2.yml
+++ b/.github/workflows/codegen-v2.yml
@@ -3,22 +3,45 @@ name: Codegen-v2 Tests
on:
push:
branches: [ dev, master ]
- paths:
- - 'codegen-v2/**'
pull_request:
branches: [ dev, master ]
- paths:
- - 'codegen-v2/**'
+
+env:
+ SCCACHE_GHA_ENABLED: "true"
+ RUSTC_WRAPPER: "sccache"
jobs:
test:
runs-on: ubuntu-latest
+ if: github.event.pull_request.draft == false
steps:
- - uses: actions/checkout@v2
- - uses: actions-rs/toolchain@v1
- with:
- toolchain: stable
- - uses: actions-rs/cargo@v1
- with:
- command: test
- args: --manifest-path codegen-v2/Cargo.toml
+ - uses: actions/checkout@v3
+ - name: Install system dependencies
+ run: |
+ tools/install-sys-dependencies-linux
+
+ - name: Run sccache-cache
+ uses: mozilla-actions/sccache-action@v0.0.3
+
+ - name: Install Rust dependencies
+ run: |
+ tools/install-rust-dependencies
+
+ - name: Run codegen-v2 tests
+ run: |
+ cargo test --all
+ working-directory: codegen-v2
+
+ # Generate files for a blockchain.
+ # Please note the blockchain should not be implemented in Rust at the moment of running this step,
+ # otherwise consider either generating files for another blockchain or removing this step at all.
+ - name: Test codegen-v2 new-blockchain-rust
+ run: |
+ cargo run -- new-blockchain-rust iotex
+ working-directory: codegen-v2
+
+ # Check if `new-blockchain-rust` command has generated files that do not break project compilation.
+ - name: Check Rust compiles
+ run: |
+ cargo check --tests
+ working-directory: rust
diff --git a/.github/workflows/ios-ci.yml b/.github/workflows/ios-ci.yml
index 7dcc89a194b..649b15e84a2 100644
--- a/.github/workflows/ios-ci.yml
+++ b/.github/workflows/ios-ci.yml
@@ -12,24 +12,37 @@ concurrency:
jobs:
build:
- runs-on: [ self-hosted, macOS, ARM64, wallet-core ]
+ runs-on: macos-latest-xlarge
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
+
- name: Install system dependencies
run: |
tools/install-sys-dependencies-mac
+
+ - name: Cache Rust
+ uses: Swatinem/rust-cache@v2
+ with:
+ workspaces: |
+ rust
+
+ - name: Install Rust dependencies
+ run: |
tools/install-rust-dependencies
+
- name: Cache internal dependencies
id: internal_cache
uses: actions/cache@v3
with:
path: build/local
key: ${{ runner.os }}-internal-${{ hashFiles('tools/install-dependencies') }}
+
- name: Install internal dependencies
run: |
tools/install-dependencies
if: steps.internal_cache.outputs.cache-hit != 'true'
+
- name: Run codegen tests
run: tools/codegen-test
@@ -37,6 +50,7 @@ jobs:
run: |
tools/generate-files ios
tools/ios-test
+
- name: Build sample app
run: |
tools/samples-build ios
diff --git a/.github/workflows/kotlin-ci.yml b/.github/workflows/kotlin-ci.yml
index 0a517a03ae8..1198c20ae3c 100644
--- a/.github/workflows/kotlin-ci.yml
+++ b/.github/workflows/kotlin-ci.yml
@@ -12,7 +12,7 @@ concurrency:
jobs:
build:
- runs-on: [ self-hosted, macOS, ARM64, wallet-core ]
+ runs-on: macos-latest-xlarge
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
@@ -23,6 +23,9 @@ jobs:
java-version: '17'
distribution: 'temurin'
+ - name: Setup Android SDK
+ uses: android-actions/setup-android@v3
+
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
@@ -31,6 +34,15 @@ jobs:
- name: Install system dependencies
run: |
tools/install-sys-dependencies-mac
+
+ - name: Cache Rust
+ uses: Swatinem/rust-cache@v2
+ with:
+ workspaces: |
+ rust
+
+ - name: Install Rust dependencies
+ run: |
tools/install-rust-dependencies
- name: Install emsdk
diff --git a/.github/workflows/kotlin-sample-ci.yml b/.github/workflows/kotlin-sample-ci.yml
index 4c42e44dcd5..f96b2a4b280 100644
--- a/.github/workflows/kotlin-sample-ci.yml
+++ b/.github/workflows/kotlin-sample-ci.yml
@@ -12,7 +12,7 @@ concurrency:
jobs:
build:
- runs-on: [ self-hosted, macOS, ARM64, wallet-core ]
+ runs-on: macos-latest-xlarge
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
@@ -23,6 +23,9 @@ jobs:
java-version: '17'
distribution: 'temurin'
+ - name: Setup Android SDK
+ uses: android-actions/setup-android@v3
+
- name: Install Kotlin Dependencies
run: tools/install-kotlin-dependencies
diff --git a/.github/workflows/linux-ci-rust.yml b/.github/workflows/linux-ci-rust.yml
index 9a27424cea2..36d3e57931a 100644
--- a/.github/workflows/linux-ci-rust.yml
+++ b/.github/workflows/linux-ci-rust.yml
@@ -15,7 +15,8 @@ concurrency:
cancel-in-progress: true
jobs:
- build:
+ # Check formatting, clippy warnings, run tests and check code coverage.
+ build-and-test:
permissions:
contents: read
checks: write
@@ -40,9 +41,6 @@ jobs:
run: |
tools/install-rust-dependencies dev
- - name: Install emsdk
- run: tools/install-wasm-dependencies
-
- name: Check code formatting
run: |
cargo fmt --check
@@ -55,22 +53,109 @@ jobs:
- name: Run tests
run: |
- cargo llvm-cov nextest --profile ci --no-fail-fast --lcov --output-path coverage.info
- working-directory: rust
+ tools/rust-coverage
+
+ - name: Gather and check Rust code coverage
+ run: |
+ tools/check-coverage rust/coverage.stats rust/coverage.info
+
+ # Run Rust tests in WASM.
+ test-wasm:
+ runs-on: ubuntu-latest
+ if: github.event.pull_request.draft == false
+ steps:
+ - uses: actions/checkout@v3
+ - name: Install system dependencies
+ run: |
+ tools/install-sys-dependencies-linux
+
+ - name: Run sccache-cache
+ uses: mozilla-actions/sccache-action@v0.0.3
+
+ - name: Cache Rust
+ uses: Swatinem/rust-cache@v2
+ with:
+ workspaces: |
+ rust
+
+ - name: Install Rust dependencies
+ run: |
+ tools/install-rust-dependencies
+
+ - name: Install emsdk
+ run: tools/install-wasm-dependencies
- name: Run tests in WASM
run: tools/rust-test wasm
- - name: Rust Test Report
- uses: dorny/test-reporter@v1
- if: success() || failure()
- continue-on-error: true
+ check-binary-sizes:
+ permissions:
+ contents: read
+ pull-requests: write
+ runs-on: macos-latest-xlarge
+ if: github.event.pull_request.draft == false
+ steps:
+ - uses: actions/checkout@v3
+ - name: Install system dependencies
+ run: |
+ tools/install-sys-dependencies-mac
+
+ - name: Run sccache-cache
+ uses: mozilla-actions/sccache-action@v0.0.3
+
+ - name: Cache Rust
+ uses: Swatinem/rust-cache@v2
with:
- name: Rust Tests
- path: |
- rust/target/nextest/ci/junit.xml
- reporter: java-junit
+ workspaces: |
+ rust
- - name: Gather and check Rust code coverage
+ - name: Install Rust dependencies
+ run: tools/install-rust-dependencies
+
+ - name: Install emsdk
+ run: tools/install-wasm-dependencies
+
+ - name: Compile release binaries
run: |
- tools/check-coverage rust/coverage.stats rust/coverage.info
+ mkdir -p build/local/lib
+ source emsdk/emsdk_env.sh
+ tools/rust-bindgen
+
+ - name: Generate release report
+ run: |
+ ./tools/release-size measure-rust > release-report.json
+
+ - name: Upload release report
+ uses: actions/upload-artifact@v4
+ with:
+ name: release_report
+ path: release-report.json
+
+ # Download previous release report, compare the release binary sizes, and post/update a comment at the Pull Request.
+ - name: Download previous release report
+ if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false
+ uses: dawidd6/action-download-artifact@v6
+ with:
+ commit: ${{github.event.pull_request.base.sha}}
+ path: previous
+ if_no_artifact_found: warn
+ # Same artifact name as at the "Upload release report" step.
+ name: release_report
+ # Ignore status or conclusion in the search.
+ workflow_conclusion: ""
+
+ - name: Craft Comment Body
+ if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false
+ run: |
+ # Please note `previous/release-report.json` may not exist if the previous report was not found.
+ ./tools/release-size compare --before previous/release-report.json --current release-report.json > report-diff.md
+
+ - name: Create or Update Comment
+ if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false
+ uses: edumserrano/find-create-or-update-comment@v2
+ with:
+ issue-number: ${{ github.event.pull_request.number }}
+ body-includes: "Binary size comparison"
+ comment-author: 'github-actions[bot]'
+ edit-mode: replace
+ body-path: 'report-diff.md'
diff --git a/.github/workflows/linux-ci-sonarcloud.yml b/.github/workflows/linux-ci-sonarcloud.yml
index d8154a0c9b4..775486d741a 100644
--- a/.github/workflows/linux-ci-sonarcloud.yml
+++ b/.github/workflows/linux-ci-sonarcloud.yml
@@ -16,16 +16,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
+
+ - name: Set up JDK 17
+ uses: actions/setup-java@v3
+ with:
+ java-version: '17'
+ distribution: 'temurin'
+
- name: Install system dependencies
run: |
tools/install-sys-dependencies-linux
tools/install-rust-dependencies
+
- name: Cache internal dependencies
id: internal_cache
uses: actions/cache@v3
with:
path: build/local
key: ${{ runner.os }}-internal-${{ hashFiles('tools/install-dependencies') }}
+
- name: Install internal dependencies
run: |
tools/install-dependencies
@@ -33,12 +42,14 @@ jobs:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
if: steps.internal_cache.outputs.cache-hit != 'true'
+
- name: Code generation
run: |
tools/generate-files native
env:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
+
- name: CMake (coverage/clang-tidy/clang-asan)
run: |
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Debug -DTW_CODE_COVERAGE=ON -DTW_ENABLE_CLANG_TIDY=ON -DTW_CLANG_ASAN=ON -GNinja
@@ -46,6 +57,7 @@ jobs:
env:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
+
- name: SonarCloud Scan
run: |
./tools/sonarcloud-analysis
diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml
index 8eb3d94358e..653fbf0c135 100644
--- a/.github/workflows/linux-ci.yml
+++ b/.github/workflows/linux-ci.yml
@@ -18,14 +18,14 @@ jobs:
- uses: actions/checkout@v3
- name: Install system dependencies
run: |
- tools/install-sys-dependencies-linux
+ tools/install-sys-dependencies-linux ci
tools/install-rust-dependencies
- name: Cache internal dependencies
id: internal_cache
uses: actions/cache@v3
with:
path: build/local
- key: ${{ runner.os }}-internal-${{ hashFiles('tools/install-dependencies') }}
+ key: ${{ runner.os }}-internal-${{ hashFiles('tools/install-sys-dependencies-linux') }}-${{ hashFiles('tools/install-dependencies') }}
- name: Install internal dependencies
run: |
tools/install-dependencies
diff --git a/.github/workflows/linux-sampleapp-ci.yml b/.github/workflows/linux-sampleapp-ci.yml
index ec1b8ec665d..da1aa11656b 100644
--- a/.github/workflows/linux-sampleapp-ci.yml
+++ b/.github/workflows/linux-sampleapp-ci.yml
@@ -18,14 +18,14 @@ jobs:
- uses: actions/checkout@v3
- name: Install system dependencies
run: |
- tools/install-sys-dependencies-linux
+ tools/install-sys-dependencies-linux ci
tools/install-rust-dependencies
- name: Cache internal dependencies
id: internal_cache
uses: actions/cache@v3
with:
path: build/local
- key: ${{ runner.os }}-internal-${{ hashFiles('tools/install-dependencies') }}
+ key: ${{ runner.os }}-internal-${{ hashFiles('tools/install-sys-dependencies-linux') }}-${{ hashFiles('tools/install-dependencies') }}
- name: Install internal dependencies
run: |
tools/install-dependencies
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5cba2961f0a..6fec5513326 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,8 +1,6 @@
-# Copyright © 2017-2022 Trust Wallet.
+# SPDX-License-Identifier: Apache-2.0
#
-# This file is part of Trust. The full Trust copyright notice, including
-# terms governing use, modification, and redistribution, is contained in the
-# file LICENSE at the root of the source code distribution tree.
+# Copyright © 2017 Trust Wallet.
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
diff --git a/Dockerfile b/Dockerfile
index 7db09d1bd5b..082d5fd1969 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -38,6 +38,7 @@ ENV CXX=/usr/bin/clang++-14
RUN wget "https://sh.rustup.rs" -O rustup.sh \
&& sh rustup.sh -y
ENV PATH="/root/.cargo/bin:${PATH}"
+RUN rustup default nightly-2024-06-13
RUN cargo install --force cbindgen \
&& rustup target add wasm32-unknown-emscripten
diff --git a/LICENSE b/LICENSE
index 261eeb9e9f8..591e7191a60 100644
--- a/LICENSE
+++ b/LICENSE
@@ -175,18 +175,7 @@
END OF TERMS AND CONDITIONS
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
+ Copyright 2017 Trust Wallet
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/Package.swift b/Package.swift
index 90ec9e38022..38e74510f2f 100644
--- a/Package.swift
+++ b/Package.swift
@@ -12,13 +12,13 @@ let package = Package(
targets: [
.binaryTarget(
name: "WalletCore",
- url: "https://github.com/trustwallet/wallet-core/releases/download/3.2.1/WalletCore.xcframework.zip",
- checksum: "b7f9fe6b5aa1fd216d43f676400c9db6999c6494e0120db73b2afb49dcc1f013"
+ url: "https://github.com/trustwallet/wallet-core/releases/download/4.0.33/WalletCore.xcframework.zip",
+ checksum: "2fb8b833047b9697bba6ade66a9bdeede622b2fe0fb7a9b90cb9edb4651ec866"
),
.binaryTarget(
name: "SwiftProtobuf",
- url: "https://github.com/trustwallet/wallet-core/releases/download/3.2.1/SwiftProtobuf.xcframework.zip",
- checksum: "12bbc92dc2225c661e301cc2826e034fcb69b2a144f8c4ff2e51ce6ccf122124"
+ url: "https://github.com/trustwallet/wallet-core/releases/download/4.0.33/SwiftProtobuf.xcframework.zip",
+ checksum: "05557735dd607c5a369dc378eb3f299504b880614ef13f136a028ecd320b0e4d"
)
]
)
diff --git a/README.md b/README.md
index 3452964595f..7456046acbd 100644
--- a/README.md
+++ b/README.md
@@ -6,12 +6,13 @@ It is a core part of the popular [Trust Wallet](https://trustwallet.com), and so
Most of the code is C++ with a set of strict C interfaces, and idiomatic interfaces for supported languages:
Swift for iOS and Java (Kotlin) for Android.
-![iOS CI](https://github.com/trustwallet/wallet-core/workflows/iOS%20CI/badge.svg)
-![Android CI](https://github.com/trustwallet/wallet-core/workflows/Android%20CI/badge.svg)
-![Linux CI](https://github.com/trustwallet/wallet-core/workflows/Linux%20CI/badge.svg)
-![Wasm CI](https://github.com/trustwallet/wallet-core/workflows/Wasm%20CI/badge.svg)
-![Kotlin CI](https://github.com/trustwallet/wallet-core/workflows/Kotlin%20CI/badge.svg)
-![Docker CI](https://github.com/trustwallet/wallet-core/workflows/Docker%20CI/badge.svg)
+[![iOS CI](https://github.com/trustwallet/wallet-core/actions/workflows/ios-ci.yml/badge.svg)](https://github.com/trustwallet/wallet-core/actions/workflows/ios-ci.yml)
+[![Android CI](https://github.com/trustwallet/wallet-core/actions/workflows/android-ci.yml/badge.svg)](https://github.com/trustwallet/wallet-core/actions/workflows/android-ci.yml)
+[![Linux CI](https://github.com/trustwallet/wallet-core/actions/workflows/linux-ci.yml/badge.svg)](https://github.com/trustwallet/wallet-core/actions/workflows/linux-ci.yml)
+[![Rust CI](https://github.com/trustwallet/wallet-core/actions/workflows/linux-ci-rust.yml/badge.svg)](https://github.com/trustwallet/wallet-core/actions/workflows/linux-ci-rust.yml)
+[![Wasm CI](https://github.com/trustwallet/wallet-core/actions/workflows/wasm-ci.yml/badge.svg)](https://github.com/trustwallet/wallet-core/actions/workflows/wasm-ci.yml)
+[![Kotlin CI](https://github.com/trustwallet/wallet-core/actions/workflows/kotlin-ci.yml/badge.svg)](https://github.com/trustwallet/wallet-core/actions/workflows/kotlin-ci.yml)
+[![Docker CI](https://github.com/trustwallet/wallet-core/actions/workflows/docker.yml/badge.svg)](https://github.com/trustwallet/wallet-core/actions/workflows/docker.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=TrustWallet_wallet-core&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=TrustWallet_wallet-core)
[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/trustwallet/wallet-core)
@@ -24,6 +25,10 @@ Swift for iOS and Java (Kotlin) for Android.
For comprehensive documentation, see [developer.trustwallet.com](https://developer.trustwallet.com/wallet-core).
+# Audit Reports
+
+Security Audit reports can be found in the [audit](audit) directory.
+
# Supported Blockchains
Wallet Core supports more than **130** blockchains: Bitcoin, Ethereum, BNB, Cosmos, Solana, and most major blockchain platforms.
@@ -97,16 +102,16 @@ Please check out the [Kotlin Multiplatform sample](https://github.com/trustwalle
Projects using Trust Wallet Core. Add yours too!
-[](https://trustwallet.com)
+[](https://trustwallet.com)
[Coinpaprika](https://coinpaprika.com/)
| [crypto.com](https://crypto.com)
-| [Alice](https://www.alicedapp.com/)
| [Frontier](https://frontier.xyz/)
| [Tokenary](https://tokenary.io/)
| [MemesWallet](https://planetmemes.com/)
| [xPortal](https://xportal.com/)
| [Slingshot](https://slingshot.finance/)
+| [ECOIN Wallet](https://play.google.com/store/apps/details?id=org.ecoinwallet&pcampaignid=web_share)
# Community
@@ -118,7 +123,8 @@ There are a few community-maintained projects that extend Wallet Core to some ad
# Contributing
-The best way to submit feedback and report bugs is to [open a GitHub issue](https://github.com/trustwallet/wallet-core/issues/new).
+The best way to submit feedback and report bugs related to WalletCore is to [open a GitHub issue](https://github.com/trustwallet/wallet-core/issues/new).
+If the bug is not related to WalletCore but to the TrustWallet app, please [create a Customer Support ticket](https://support.trustwallet.com/en/support/tickets/new).
If you want to contribute code please see [Contributing](https://developer.trustwallet.com/wallet-core/contributing).
If you want to add support for a new blockchain also see [Adding Support for a New Blockchain](https://developer.trustwallet.com/wallet-core/newblockchain), make sure you have read the [requirements](https://developer.trustwallet.com/wallet-core/newblockchain#requirements) section.
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/CoinAddressDerivationTests.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/CoinAddressDerivationTests.kt
index eb93523e4eb..9064a873e7c 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/CoinAddressDerivationTests.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/CoinAddressDerivationTests.kt
@@ -42,10 +42,14 @@ class CoinAddressDerivationTests {
CALLISTO -> assertEquals("0x3E6FFC80745E6669135a76F4A7ce6BCF02436e04", address)
DASH -> assertEquals("XqHiz8EXYbTAtBEYs4pWTHh7ipEDQcNQeT", address)
DIGIBYTE -> assertEquals("dgb1qtjgmerfqwdffyf8ghcrkgy52cghsqptynmyswu", address)
+
ETHEREUM, SMARTCHAIN, POLYGON, OPTIMISM, ZKSYNC, ARBITRUM, ARBITRUMNOVA, ECOCHAIN, AVALANCHECCHAIN, XDAI,
FANTOM, CELO, CRONOSCHAIN, SMARTBITCOINCASH, KUCOINCOMMUNITYCHAIN, BOBA, METIS,
- AURORA, EVMOS, MOONRIVER, MOONBEAM, KAVAEVM, KLAYTN, METER, OKXCHAIN, POLYGONZKEVM, SCROLL,
- CONFLUXESPACE, ACALAEVM, OPBNB, NEON, BASE, LINEA, GREENFIELD, MANTLE, ZENEON -> assertEquals("0x8f348F300873Fd5DA36950B2aC75a26584584feE", address)
+ AURORA, EVMOS, MOONRIVER, MOONBEAM, KAVAEVM, KAIA, METER, OKXCHAIN, POLYGONZKEVM, SCROLL,
+ CONFLUXESPACE, ACALAEVM, OPBNB, NEON, BASE, LINEA, GREENFIELD, MANTLE, ZENEON, MANTAPACIFIC,
+ ZETAEVM, MERLIN, LIGHTLINK, BLAST, BOUNCEBIT, ZKLINKNOVA,
+ -> assertEquals("0x8f348F300873Fd5DA36950B2aC75a26584584feE", address)
+
RONIN -> assertEquals("ronin:8f348F300873Fd5DA36950B2aC75a26584584feE", address)
ETHEREUMCLASSIC -> assertEquals("0x078bA3228F3E6C08bEEac9A005de0b7e7089aD1c", address)
GOCHAIN -> assertEquals("0x5940ce4A14210d4Ccd0ac206CE92F21828016aC2", address)
@@ -57,7 +61,7 @@ class CoinAddressDerivationTests {
XRP -> assertEquals("rPwE3gChNKtZ1mhH3Ko8YFGqKmGRWLWXV3", address)
TEZOS -> assertEquals("tz1acnY9VbMagps26Kj3RfoGRWD9nYG5qaRX", address)
THUNDERCORE -> assertEquals("0x4b92b3ED6d8b24575Bf5ce4C6a86ED261DA0C8d7", address)
- TOMOCHAIN -> assertEquals("0xC74b6D8897cBa9A4b659d43fEF73C9cA852cE424", address)
+ VICTION -> assertEquals("0xC74b6D8897cBa9A4b659d43fEF73C9cA852cE424", address)
TRON -> assertEquals("TQ5NMqJjhpQGK7YJbESKtNCo86PJ89ujio", address)
VECHAIN -> assertEquals("0x1a553275dF34195eAf23942CB7328AcF9d48c160", address)
WANCHAIN -> assertEquals("0xD5ca90b928279FE5D06144136a25DeD90127aC15", address)
@@ -118,8 +122,8 @@ class CoinAddressDerivationTests {
NATIVEEVMOS -> assertEquals("evmos13u6g7vqgw074mgmf2ze2cadzvkz9snlwstd20d", address)
NERVOS -> assertEquals("ckb1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqdtyq04tvp02wectaumxn0664yw2jd53lqk4mxg3", address)
EVERSCALE -> assertEquals("0:0c39661089f86ec5926ea7d4ee4223d634ba4ed6dcc2e80c7b6a8e6d59f79b04", address)
- TON -> assertEquals("EQDgEMqToTacHic7SnvnPFmvceG5auFkCcAw0mSCvzvKUfk9", address)
- APTOS -> assertEquals("0x07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30", address)
+ TON -> assertEquals("UQDgEMqToTacHic7SnvnPFmvceG5auFkCcAw0mSCvzvKUaT4", address)
+ APTOS -> assertEquals("0x7968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30", address)
NEBL -> assertEquals("NgDVaXAwNgBwb88xLiFKomfBmPkEh9F2d7", address)
SUI -> assertEquals("0xada112cfb90b44ba889cc5d39ac2bf46281e4a91f7919c693bcd9b8323e81ed2", address)
HEDERA -> assertEquals("0.0.302a300506032b657003210049eba62f64d0d941045595d9433e65d84ecc46bcdb1421de55e05fcf2d8357d5", address)
@@ -146,5 +150,9 @@ class CoinAddressDerivationTests {
NOBLE -> assertEquals("noble142j9u5eaduzd7faumygud6ruhdwme98qc8l3wa", address)
ROOTSTOCK -> assertEquals("0xA2D7065F94F838a3aB9C04D67B312056846424Df", address)
SEI -> assertEquals("sei142j9u5eaduzd7faumygud6ruhdwme98qagm0sj", address)
+ INTERNETCOMPUTER -> assertEquals("6f8e568160a3c8362789848dc0fa52891964473c045cc25208a305fb35b7c4ab", address)
+ TIA -> assertEquals("celestia142j9u5eaduzd7faumygud6ruhdwme98qpwmfv7", address)
+ NATIVEZETACHAIN -> assertEquals("zeta13u6g7vqgw074mgmf2ze2cadzvkz9snlwywj304", address)
+ DYDX -> assertEquals("dydx142j9u5eaduzd7faumygud6ruhdwme98qeayaky", address)
}
}
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/TestCoinType.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/TestCoinType.kt
index 5b92dd34849..d565a1a08be 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/TestCoinType.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/TestCoinType.kt
@@ -32,7 +32,7 @@ class TestCoinType {
assertEquals(CoinType.POANETWORK.value(), 178)
assertEquals(CoinType.VECHAIN.value(), 818)
assertEquals(CoinType.ICON.value(), 74)
- assertEquals(CoinType.TOMOCHAIN.value(), 889)
+ assertEquals(CoinType.VICTION.value(), 889)
assertEquals(CoinType.TEZOS.value(), 1729)
assertEquals(CoinType.QTUM.value(), 2301)
assertEquals(CoinType.NEBULAS.value(), 2718)
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/acala/TestAcalaAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/acala/TestAcalaAddress.kt
index b94158bace6..5e50f515ab4 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/acala/TestAcalaAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/acala/TestAcalaAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.acala
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/acala/TestAcalaSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/acala/TestAcalaSigner.kt
index a066009144d..ad99985b4ec 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/acala/TestAcalaSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/acala/TestAcalaSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.acala
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/acalaevm/TestAcalaEVMAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/acalaevm/TestAcalaEVMAddress.kt
index 81274311cdd..6845bea3e89 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/acalaevm/TestAcalaEVMAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/acalaevm/TestAcalaEVMAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.acalaevm
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/agoric/TestAgoricAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/agoric/TestAgoricAddress.kt
index 9cabca65f15..1164db16e14 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/agoric/TestAgoricAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/agoric/TestAgoricAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.agoric
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/agoric/TestAgoricSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/agoric/TestAgoricSigner.kt
index 7567a61f21f..ecdf4372f3a 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/agoric/TestAgoricSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/agoric/TestAgoricSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.agoric
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/aptos/TestAptosAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/aptos/TestAptosAddress.kt
index 180617ff5b1..c8bed69c5d8 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/aptos/TestAptosAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/aptos/TestAptosAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.aptos
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/aptos/TestAptosSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/aptos/TestAptosSigner.kt
index f16a3be8300..e536821658b 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/aptos/TestAptosSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/aptos/TestAptosSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.aptos
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bandchain/TestBandChainAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bandchain/TestBandChainAddress.kt
index d988eed5bb1..ec361735357 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bandchain/TestBandChainAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bandchain/TestBandChainAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2020 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.bandchain
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bandchain/TestBandChainSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bandchain/TestBandChainSigner.kt
index 662773bba9c..001e9d90631 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bandchain/TestBandChainSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bandchain/TestBandChainSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2020 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.bandchain
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/binance/TestBinanceWalletConnectSigning.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/binance/TestBinanceWalletConnectSigning.kt
new file mode 100644
index 00000000000..a66c2dc9776
--- /dev/null
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/binance/TestBinanceWalletConnectSigning.kt
@@ -0,0 +1,46 @@
+package com.trustwallet.core.app.blockchains.binance
+
+import com.google.protobuf.ByteString
+import com.trustwallet.core.app.utils.toHexBytes
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import wallet.core.jni.proto.Binance.SigningOutput
+import wallet.core.jni.proto.WalletConnect
+import wallet.core.jni.*
+import wallet.core.jni.CoinType.BINANCE
+import wallet.core.java.AnySigner
+import wallet.core.jni.proto.Common
+
+class TestBinanceWalletConnectSigning {
+ init {
+ System.loadLibrary("TrustWalletCore")
+ }
+
+ @Test
+ fun testSignBinanceTransactionFromWalletConnectRequest() {
+ // Step 1: Parse a signing request received through WalletConnect.
+
+ val parsingInput = WalletConnect.ParseRequestInput.newBuilder().apply {
+ method = WalletConnect.Method.CosmosSignAmino
+ payload = "{\"signerAddress\":\"bnb1grpf0955h0ykzq3ar5nmum7y6gdfl6lxfn46h2\",\"signDoc\":{\"account_number\":\"19\",\"chain_id\":\"chain-bnb\",\"memo\":\"\",\"data\":null,\"msgs\":[{\"inputs\":[{\"address\":\"bnb1grpf0955h0ykzq3ar5nmum7y6gdfl6lxfn46h2\",\"coins\":[{\"amount\":1001000000,\"denom\":\"BNB\"}]}],\"outputs\":[{\"address\":\"bnb13zeh6hs97d5eu2s5qerguhv8ewwue6u4ywa6yf\",\"coins\":[{\"amount\":1001000000,\"denom\":\"BNB\"}]}]}],\"sequence\":\"23\",\"source\":\"1\"}}"
+ }.build()
+
+ val parsingOutputBytes = WalletConnectRequest.parse(BINANCE, parsingInput.toByteArray())
+ val parsingOutput = WalletConnect.ParseRequestOutput.parseFrom(parsingOutputBytes)
+
+ assertEquals(parsingOutput.error, Common.SigningError.OK)
+
+ // Step 2: Set missing fields.
+
+ val signingInput = parsingOutput.binance.toBuilder().apply {
+ privateKey = ByteString.copyFrom("95949f757db1f57ca94a5dff23314accbe7abee89597bf6a3c7382c84d7eb832".toHexBytes())
+ }.build()
+
+ // Step 3: Sign the transaction.
+
+ val output = AnySigner.sign(signingInput, BINANCE, SigningOutput.parser())
+
+ assertEquals(output.error, Common.SigningError.OK)
+ assertEquals(output.signatureJson, "{\"pub_key\":{\"type\":\"tendermint/PubKeySecp256k1\",\"value\":\"Amo1kgCI2Yw4iMpoxT38k/RWRgJgbLuH8P5e5TPbOOUC\"},\"signature\":\"PCTHhMa7+Z1U/6uxU+3LbTxKd0k231xypdMolyVvjgYvMg+0dTMC+wqW8IxHWXTSDt/Ronu+7ac1h/WN3JWJdQ==\"}")
+ }
+}
\ No newline at end of file
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bitcoin/TestBitcoinFee.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bitcoin/TestBitcoinFee.kt
deleted file mode 100644
index 15d4ee2d593..00000000000
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bitcoin/TestBitcoinFee.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.trustwallet.core.app.blockchains.bitcoin
-
-import com.trustwallet.core.app.utils.Numeric
-import com.trustwallet.core.app.utils.toHexBytes
-import org.junit.Assert.assertEquals
-import org.junit.Test
-import wallet.core.jni.BitcoinFee
-
-class TestBitcoinFee {
-
- init {
- System.loadLibrary("TrustWalletCore")
- }
-
- @Test
- fun P2pkhCalculateFee() {
- val satVb = "10"
- val tx = Numeric.hexStringToByteArray("02000000017be4e642bb278018ab12277de9427773ad1c5f5b1d164a157e0d99aa48dc1c1e000000006a473044022078eda020d4b86fcb3af78ef919912e6d79b81164dbbb0b0b96da6ac58a2de4b102201a5fd8d48734d5a02371c4b5ee551a69dca3842edbf577d863cf8ae9fdbbd4590121036666dd712e05a487916384bfcd5973eb53e8038eccbbf97f7eed775b87389536ffffffff01c0aff629010000001976a9145eaaa4f458f9158f86afcba08dd7448d27045e3d88ac00000000")
- var fee = BitcoinFee.calculateFee(tx, satVb).toLong()
-
- assertEquals(fee, 191 * satVb.toLong())
- }
-
- @Test
- fun P2wpkhCalculateFee() {
- val satVb = "12"
- val tx = Numeric.hexStringToByteArray("020000000111b9f62923af73e297abb69f749e7a1aa2735fbdfd32ac5f6aa89e5c96841c18000000006b483045022100df9ed0b662b759e68b89a42e7144cddf787782a7129d4df05642dd825930e6e6022051a08f577f11cc7390684bbad2951a6374072253ffcf2468d14035ed0d8cd6490121028d7dce6d72fb8f7af9566616c6436349c67ad379f2404dd66fe7085fe0fba28fffffffff01c0aff629010000001600140d0e1cec6c2babe8badde5e9b3dea667da90036d00000000")
- var fee = BitcoinFee.calculateFee(tx, satVb).toLong()
-
- assertEquals(fee, 189 * satVb.toLong())
- }
-
- @Test
- // Metadata can be observed live on:
- // https://www.blockchain.com/explorer/transactions/btc/797d17d47ae66e598341f9dfdea020b04d4017dcf9cc33f0e51f7a6082171fb1
- //
- // Fee/VB 19.608 sat/vByte
- // Size 235 Bytes
- // Weight 610
- fun Brc20TransferCommitCalculateFee() {
- val satVb = "19"
- val tx = Numeric.hexStringToByteArray("02000000000101089098890d2653567b9e8df2d1fbe5c3c8bf1910ca7184e301db0ad3b495c88e0100000000ffffffff02581b000000000000225120e8b706a97732e705e22ae7710703e7f589ed13c636324461afa443016134cc051040000000000000160014e311b8d6ddff856ce8e9a4e03bc6d4fe5050a83d02483045022100a44aa28446a9a886b378a4a65e32ad9a3108870bd725dc6105160bed4f317097022069e9de36422e4ce2e42b39884aa5f626f8f94194d1013007d5a1ea9220a06dce0121030f209b6ada5edb42c77fd2bc64ad650ae38314c8f451f3e36d80bc8e26f132cb00000000")
- var fee = BitcoinFee.calculateFee(tx, satVb).toLong()
-
- assertEquals(fee, 153 * satVb.toLong()) // 153 = ceil(610/4)
- }
-}
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bitcoin/TestBitcoinPsbt.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bitcoin/TestBitcoinPsbt.kt
new file mode 100644
index 00000000000..884120800ca
--- /dev/null
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bitcoin/TestBitcoinPsbt.kt
@@ -0,0 +1,108 @@
+package com.trustwallet.core.app.blockchains.bitcoin
+
+import com.google.protobuf.ByteString
+import com.trustwallet.core.app.utils.Numeric
+import com.trustwallet.core.app.utils.toHex
+import com.trustwallet.core.app.utils.toHexBytes
+import com.trustwallet.core.app.utils.toHexBytesInByteString
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import wallet.core.java.AnySigner
+import wallet.core.jni.BitcoinScript
+import wallet.core.jni.BitcoinSigHashType
+import wallet.core.jni.CoinType
+import wallet.core.jni.CoinType.BITCOIN
+import wallet.core.jni.Hash
+import wallet.core.jni.PrivateKey
+import wallet.core.jni.PublicKey
+import wallet.core.jni.PublicKeyType
+import wallet.core.jni.proto.Bitcoin
+import wallet.core.jni.proto.BitcoinV2
+import wallet.core.jni.proto.Common.SigningError
+
+class TestBitcoinPsbt {
+
+ init {
+ System.loadLibrary("TrustWalletCore")
+ }
+
+ @Test
+ fun testSignThorSwap() {
+ // Successfully broadcasted tx: https://mempool.space/tx/634a416e82ac710166725f6a4090ac7b5db69687e86b2d2e38dcb3d91c956c32
+
+ val privateKey = "f00ffbe44c5c2838c13d2778854ac66b75e04eb6054f0241989e223223ad5e55".toHexBytesInByteString()
+ val psbt = "70736274ff0100bc0200000001147010db5fbcf619067c1090fec65c131443fbc80fb4aaeebe940e44206098c60000000000ffffffff0360ea000000000000160014f22a703617035ef7f490743d50f26ae08c30d0a70000000000000000426a403d3a474149412e41544f4d3a636f736d6f7331737377797a666d743675396a373437773537753438746778646575393573757a666c6d7175753a303a743a35303e12000000000000160014b139199ec796f36fc42e637f42da8e3e6720aa9d000000000001011f6603010000000000160014b139199ec796f36fc42e637f42da8e3e6720aa9d00000000".toHexBytesInByteString()
+
+ val input = BitcoinV2.SigningInput.newBuilder()
+ .setPsbt(BitcoinV2.Psbt.newBuilder().setPsbt(psbt))
+ .addPrivateKeys(privateKey)
+ .build()
+
+ val legacyInput = Bitcoin.SigningInput.newBuilder()
+ .setSigningV2(input)
+ .build()
+
+ val legacyOutput = AnySigner.sign(legacyInput, BITCOIN, Bitcoin.SigningOutput.parser())
+ val output = legacyOutput.signingResultV2
+
+ assertEquals(output.error, SigningError.OK)
+ assertEquals(
+ output.psbt.psbt.toByteArray().toHex(),
+ "0x70736274ff0100bc0200000001147010db5fbcf619067c1090fec65c131443fbc80fb4aaeebe940e44206098c60000000000ffffffff0360ea000000000000160014f22a703617035ef7f490743d50f26ae08c30d0a70000000000000000426a403d3a474149412e41544f4d3a636f736d6f7331737377797a666d743675396a373437773537753438746778646575393573757a666c6d7175753a303a743a35303e12000000000000160014b139199ec796f36fc42e637f42da8e3e6720aa9d000000000001011f6603010000000000160014b139199ec796f36fc42e637f42da8e3e6720aa9d01086c02483045022100b1229a008f20691639767bf925d6b8956ea957ccc633ad6b5de3618733a55e6b02205774d3320489b8a57a6f8de07f561de3e660ff8e587f6ac5422c49020cd4dc9101210306d8c664ea8fd2683eebea1d3114d90e0a5429e5783ba49b80ddabce04ff28f300000000"
+ )
+ assertEquals(
+ output.encoded.toByteArray().toHex(),
+ "0x02000000000101147010db5fbcf619067c1090fec65c131443fbc80fb4aaeebe940e44206098c60000000000ffffffff0360ea000000000000160014f22a703617035ef7f490743d50f26ae08c30d0a70000000000000000426a403d3a474149412e41544f4d3a636f736d6f7331737377797a666d743675396a373437773537753438746778646575393573757a666c6d7175753a303a743a35303e12000000000000160014b139199ec796f36fc42e637f42da8e3e6720aa9d02483045022100b1229a008f20691639767bf925d6b8956ea957ccc633ad6b5de3618733a55e6b02205774d3320489b8a57a6f8de07f561de3e660ff8e587f6ac5422c49020cd4dc9101210306d8c664ea8fd2683eebea1d3114d90e0a5429e5783ba49b80ddabce04ff28f300000000"
+ )
+ assertEquals(
+ output.txid.toByteArray().toHex(),
+ "0x634a416e82ac710166725f6a4090ac7b5db69687e86b2d2e38dcb3d91c956c32"
+ )
+ }
+
+ @Test
+ fun testPlanThorSwap() {
+ // Successfully broadcasted tx: https://mempool.space/tx/634a416e82ac710166725f6a4090ac7b5db69687e86b2d2e38dcb3d91c956c32
+
+ val privateKey = PrivateKey("f00ffbe44c5c2838c13d2778854ac66b75e04eb6054f0241989e223223ad5e55".toHexBytes())
+ val publicKey = privateKey.getPublicKeySecp256k1(true)
+ val psbt = "70736274ff0100bc0200000001147010db5fbcf619067c1090fec65c131443fbc80fb4aaeebe940e44206098c60000000000ffffffff0360ea000000000000160014f22a703617035ef7f490743d50f26ae08c30d0a70000000000000000426a403d3a474149412e41544f4d3a636f736d6f7331737377797a666d743675396a373437773537753438746778646575393573757a666c6d7175753a303a743a35303e12000000000000160014b139199ec796f36fc42e637f42da8e3e6720aa9d000000000001011f6603010000000000160014b139199ec796f36fc42e637f42da8e3e6720aa9d00000000".toHexBytesInByteString()
+
+ val input = BitcoinV2.SigningInput.newBuilder()
+ .setPsbt(BitcoinV2.Psbt.newBuilder().setPsbt(psbt))
+ .addPublicKeys(ByteString.copyFrom(publicKey.data()))
+ .build()
+
+ val legacyInput = Bitcoin.SigningInput.newBuilder()
+ .setSigningV2(input)
+ .build()
+
+ val legacyPlan = AnySigner.plan(legacyInput, BITCOIN, Bitcoin.TransactionPlan.parser())
+ val plan = legacyPlan.planningResultV2
+
+ assertEquals(plan.error, SigningError.OK)
+
+ assertEquals(plan.getInputs(0).receiverAddress, "bc1qkyu3n8k8jmekl3pwvdl59k5w8enjp25akz2r3z")
+ assertEquals(plan.getInputs(0).value, 66_406)
+
+ // Vault transfer
+ assertEquals(plan.getOutputs(0).toAddress, "bc1q7g48qdshqd000aysws74pun2uzxrp598gcfum0")
+ assertEquals(plan.getOutputs(0).value, 60_000)
+
+ // OP_RETURN
+ assertEquals(
+ plan.getOutputs(1).customScriptPubkey.toByteArray().toHex(),
+ "0x6a403d3a474149412e41544f4d3a636f736d6f7331737377797a666d743675396a373437773537753438746778646575393573757a666c6d7175753a303a743a3530"
+ )
+ assertEquals(plan.getOutputs(1).value, 0)
+
+ // Change output
+ assertEquals(plan.getOutputs(2).toAddress, "bc1qkyu3n8k8jmekl3pwvdl59k5w8enjp25akz2r3z")
+ assertEquals(plan.getOutputs(2).value, 4_670)
+
+ assertEquals(plan.feeEstimate, 1736)
+ // Please note that `change` in PSBT planning is always 0.
+ // That's because we aren't able to determine which output is an actual change from PSBT.
+ assertEquals(plan.change, 0)
+ }
+}
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bitcoin/TestBitcoinSigning.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bitcoin/TestBitcoinSigning.kt
index 0aa1ddac322..abd187f8150 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bitcoin/TestBitcoinSigning.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bitcoin/TestBitcoinSigning.kt
@@ -16,6 +16,7 @@ import wallet.core.jni.PublicKey
import wallet.core.jni.PublicKeyType
import wallet.core.jni.proto.Bitcoin
import wallet.core.jni.proto.Bitcoin.SigningOutput
+import wallet.core.jni.proto.BitcoinV2
import wallet.core.jni.proto.Common.SigningError
class TestBitcoinSigning {
@@ -160,842 +161,202 @@ class TestBitcoinSigning {
Numeric.toHexString(encoded.toByteArray()));
}
- @Test
- fun testSignBrc20Transfer() {
- // Successfully broadcasted: https://www.blockchain.com/explorer/transactions/btc/3e3576eb02667fac284a5ecfcb25768969680cc4c597784602d0a33ba7c654b7
- val privateKeyData = (Numeric.hexStringToByteArray("e253373989199da27c48680e3a3fc0f648d50f9a727ef17a7fe6a4dc3b159129"))
- val fullAmount = 26400
- val minerFee = 3000
- val brcInscribeAmount = 7000
- val dustSatoshis = 546
- val forFeeAmount = fullAmount - brcInscribeAmount - minerFee
- val txIdInscription = Numeric.hexStringToByteArray("7046dc2689a27e143ea2ad1039710885147e9485ab6453fa7e87464aa7dd3eca").reversedArray()
- val txIDForFees = Numeric.hexStringToByteArray("797d17d47ae66e598341f9dfdea020b04d4017dcf9cc33f0e51f7a6082171fb1").reversedArray()
-
- val privateKey = PrivateKey(privateKeyData)
- val publicKey = privateKey.getPublicKeySecp256k1(true)
- val pubKeyHash = Hash.ripemd(Hash.sha256(publicKey.data()))
- val bobPubkey = PublicKey(Numeric.hexStringToByteArray("02f453bb46e7afc8796a9629e89e07b5cb0867e9ca340b571e7bcc63fc20c43f2e"), PublicKeyType.SECP256K1)
- val bobPubkeyHash = Hash.ripemd(Hash.sha256(bobPubkey.data()))
-
- val p2wpkh = BitcoinScript.buildPayToWitnessPubkeyHash(pubKeyHash)
- val outputP2wpkh = BitcoinScript.buildPayToWitnessPubkeyHash(bobPubkeyHash)
-
- val input = Bitcoin.SigningInput.newBuilder()
- .setIsItBrcOperation(true)
- .addPrivateKey(ByteString.copyFrom(privateKeyData))
-
- val unspentOutputPoint0 = Bitcoin.OutPoint.newBuilder()
- .setHash(ByteString.copyFrom(txIdInscription))
- .setIndex(0)
- .build()
- val utxo0 = Bitcoin.UnspentTransaction.newBuilder()
- .setScript(ByteString.copyFrom(p2wpkh.data()))
- .setAmount(dustSatoshis.toLong())
- .setVariant(Bitcoin.TransactionVariant.P2WPKH)
- .setOutPoint(unspentOutputPoint0)
- .build()
-
- val unspentOutputPoint1 = Bitcoin.OutPoint.newBuilder()
- .setHash(ByteString.copyFrom(txIDForFees))
- .setIndex(1)
- .build()
- val utxo1 = Bitcoin.UnspentTransaction.newBuilder()
- .setScript(ByteString.copyFrom(p2wpkh.data()))
- .setAmount(forFeeAmount.toLong())
- .setVariant(Bitcoin.TransactionVariant.P2WPKH)
- .setOutPoint(unspentOutputPoint1)
- .build()
-
- input.addUtxo(utxo0)
- input.addUtxo(utxo1)
-
- val utxoPlan0 = Bitcoin.UnspentTransaction.newBuilder()
- .setScript(ByteString.copyFrom(outputP2wpkh.data()))
- .setAmount(dustSatoshis.toLong())
- .setVariant(Bitcoin.TransactionVariant.P2WPKH)
- .build()
- val utxoPlan1 = Bitcoin.UnspentTransaction.newBuilder()
- .setScript(ByteString.copyFrom(p2wpkh.data()))
- .setAmount((forFeeAmount - minerFee).toLong())
- .setVariant(Bitcoin.TransactionVariant.P2WPKH)
- .build()
-
- val plan = Bitcoin.TransactionPlan.newBuilder()
- .addUtxos(utxoPlan0)
- .addUtxos(utxoPlan1)
- .build()
- input.plan = plan
-
- val output = AnySigner.sign(input.build(), BITCOIN, SigningOutput.parser())
-
- assertEquals(output.error, SigningError.OK)
- assertEquals(output.transactionId, "3e3576eb02667fac284a5ecfcb25768969680cc4c597784602d0a33ba7c654b7")
- assertEquals(Numeric.toHexString(output.encoded.toByteArray()), "0x02000000000102ca3edda74a46877efa5364ab85947e148508713910ada23e147ea28926dc46700000000000ffffffffb11f1782607a1fe5f033ccf9dc17404db020a0dedff94183596ee67ad4177d790100000000ffffffff022202000000000000160014e891850afc55b64aa8247b2076f8894ebdf889015834000000000000160014e311b8d6ddff856ce8e9a4e03bc6d4fe5050a83d024830450221008798393eb0b7390217591a8c33abe18dd2f7ea7009766e0d833edeaec63f2ec302200cf876ff52e68dbaf108a3f6da250713a9b04949a8f1dcd1fb867b24052236950121030f209b6ada5edb42c77fd2bc64ad650ae38314c8f451f3e36d80bc8e26f132cb0248304502210096bbb9d1f0596d69875646689e46f29485e8ceccacde9d0025db87fd96d3066902206d6de2dd69d965d28df3441b94c76e812384ab9297e69afe3480ee4031e1b2060121030f209b6ada5edb42c77fd2bc64ad650ae38314c8f451f3e36d80bc8e26f132cb00000000")
-
- val signedTransaction = output.transaction
- assert(signedTransaction.isInitialized)
- }
-
@Test
fun testSignBrc20Commit() {
// Successfully broadcasted: https://www.blockchain.com/explorer/transactions/btc/797d17d47ae66e598341f9dfdea020b04d4017dcf9cc33f0e51f7a6082171fb1
val privateKeyData = (Numeric.hexStringToByteArray("e253373989199da27c48680e3a3fc0f648d50f9a727ef17a7fe6a4dc3b159129"))
- val fullAmount = 26400
- val minerFee = 3000
- val brcInscribeAmount = 7000
- val forFeeAmount = fullAmount - brcInscribeAmount - minerFee
- val txId = Numeric.hexStringToByteArray("089098890d2653567b9e8df2d1fbe5c3c8bf1910ca7184e301db0ad3b495c88e")
- val brc20Ticker = "oadf"
- val brc20Amount = "20"
+ val dustSatoshis = 546.toLong()
+ val txId = Numeric.hexStringToByteArray("8ec895b4d30adb01e38471ca1019bfc8c3e5fbd1f28d9e7b5653260d89989008").reversedArray()
val privateKey = PrivateKey(privateKeyData)
- val publicKey = privateKey.getPublicKeySecp256k1(true)
- val pubKeyHash = Hash.ripemd(Hash.sha256(publicKey.data()))
-
- val p2wpkh = BitcoinScript.buildPayToWitnessPubkeyHash(pubKeyHash)
- val outputInscribe = BitcoinScript.buildBRC20InscribeTransfer(brc20Ticker, brc20Amount, publicKey.data())
- val outputInscribeProto = Bitcoin.TransactionOutput.parseFrom(outputInscribe)
-
- val input = Bitcoin.SigningInput.newBuilder()
- .setIsItBrcOperation(true)
- .addPrivateKey(ByteString.copyFrom(privateKeyData))
-
- val unspentOutputPoint = Bitcoin.OutPoint.newBuilder()
- .setHash(ByteString.copyFrom(txId))
- .setIndex(1)
- .build()
-
- val utxo0 = Bitcoin.UnspentTransaction.newBuilder()
- .setScript(ByteString.copyFrom(p2wpkh.data()))
- .setAmount(fullAmount.toLong())
- .setVariant(Bitcoin.TransactionVariant.P2WPKH)
- .setOutPoint(unspentOutputPoint)
- .build()
- input.addUtxo(utxo0)
-
- val utxoPlan0 = Bitcoin.UnspentTransaction.newBuilder()
- .setScript(outputInscribeProto.script)
- .setAmount(brcInscribeAmount.toLong())
- .setVariant(Bitcoin.TransactionVariant.BRC20TRANSFER)
- .build()
- val utxoPlan1 = Bitcoin.UnspentTransaction.newBuilder()
- .setScript(ByteString.copyFrom(p2wpkh.data()))
- .setAmount(forFeeAmount.toLong())
- .setVariant(Bitcoin.TransactionVariant.P2WPKH)
- .build()
-
- val plan = Bitcoin.TransactionPlan.newBuilder()
- .addUtxos(utxoPlan0)
- .addUtxos(utxoPlan1)
- .build()
- input.plan = plan
-
- val output = AnySigner.sign(input.build(), BITCOIN, SigningOutput.parser())
+ val publicKey = ByteString.copyFrom(privateKey.getPublicKeySecp256k1(true).data())
+
+ val utxo0 = BitcoinV2.Input.newBuilder()
+ .setOutPoint(BitcoinV2.OutPoint.newBuilder().apply {
+ hash = ByteString.copyFrom(txId)
+ vout = 1
+ })
+ .setValue(26_400)
+ .setSighashType(BitcoinSigHashType.ALL.value())
+ .setScriptBuilder(BitcoinV2.Input.InputBuilder.newBuilder().apply {
+ p2Wpkh = BitcoinV2.PublicKeyOrHash.newBuilder().setPubkey(publicKey).build()
+ })
+
+ val out0 = BitcoinV2.Output.newBuilder()
+ .setValue(7_000)
+ .setBuilder(BitcoinV2.Output.OutputBuilder.newBuilder().apply {
+ brc20Inscribe = BitcoinV2.Output.OutputBrc20Inscription.newBuilder().apply {
+ inscribeTo = publicKey
+ ticker = "oadf"
+ transferAmount = "20"
+ }.build()
+ })
+
+ val changeOutput = BitcoinV2.Output.newBuilder()
+ .setValue(16_400)
+ .setBuilder(BitcoinV2.Output.OutputBuilder.newBuilder().apply {
+ p2Wpkh = BitcoinV2.PublicKeyOrHash.newBuilder().setPubkey(publicKey).build()
+ })
+
+ val builder = BitcoinV2.TransactionBuilder.newBuilder()
+ .setVersion(BitcoinV2.TransactionVersion.V2)
+ .addInputs(utxo0)
+ .addOutputs(out0)
+ .addOutputs(changeOutput)
+ .setInputSelector(BitcoinV2.InputSelector.UseAll)
+ .setFixedDustThreshold(dustSatoshis)
+ val signingInput = BitcoinV2.SigningInput.newBuilder()
+ .setBuilder(builder)
+ .addPrivateKeys(ByteString.copyFrom(privateKeyData))
+ .setChainInfo(BitcoinV2.ChainInfo.newBuilder().apply {
+ p2PkhPrefix = 0
+ p2ShPrefix = 5
+ })
+ .setDangerousUseFixedSchnorrRng(true)
+ .build()
+
+ val legacySigningInput = Bitcoin.SigningInput.newBuilder().apply {
+ signingV2 = signingInput
+ }
+
+ val output = AnySigner.sign(legacySigningInput.build(), BITCOIN, SigningOutput.parser())
assertEquals(output.error, SigningError.OK)
- assertEquals(output.transactionId, "797d17d47ae66e598341f9dfdea020b04d4017dcf9cc33f0e51f7a6082171fb1")
- assertEquals(Numeric.toHexString(output.encoded.toByteArray()), "0x02000000000101089098890d2653567b9e8df2d1fbe5c3c8bf1910ca7184e301db0ad3b495c88e0100000000ffffffff02581b000000000000225120e8b706a97732e705e22ae7710703e7f589ed13c636324461afa443016134cc051040000000000000160014e311b8d6ddff856ce8e9a4e03bc6d4fe5050a83d02483045022100a44aa28446a9a886b378a4a65e32ad9a3108870bd725dc6105160bed4f317097022069e9de36422e4ce2e42b39884aa5f626f8f94194d1013007d5a1ea9220a06dce0121030f209b6ada5edb42c77fd2bc64ad650ae38314c8f451f3e36d80bc8e26f132cb00000000")
-
- val signedTransaction = output.transaction
- assert(signedTransaction.isInitialized)
+ assertEquals(output.signingResultV2.error, SigningError.OK)
+ assertEquals(Numeric.toHexString(output.signingResultV2.encoded.toByteArray()), "0x02000000000101089098890d2653567b9e8df2d1fbe5c3c8bf1910ca7184e301db0ad3b495c88e0100000000ffffffff02581b000000000000225120e8b706a97732e705e22ae7710703e7f589ed13c636324461afa443016134cc051040000000000000160014e311b8d6ddff856ce8e9a4e03bc6d4fe5050a83d02483045022100a44aa28446a9a886b378a4a65e32ad9a3108870bd725dc6105160bed4f317097022069e9de36422e4ce2e42b39884aa5f626f8f94194d1013007d5a1ea9220a06dce0121030f209b6ada5edb42c77fd2bc64ad650ae38314c8f451f3e36d80bc8e26f132cb00000000")
+ assertEquals(Numeric.toHexString(output.signingResultV2.txid.toByteArray()), "0x797d17d47ae66e598341f9dfdea020b04d4017dcf9cc33f0e51f7a6082171fb1")
}
@Test
fun testSignBrc20Reveal() {
// Successfully broadcasted: https://www.blockchain.com/explorer/transactions/btc/7046dc2689a27e143ea2ad1039710885147e9485ab6453fa7e87464aa7dd3eca
val privateKeyData = (Numeric.hexStringToByteArray("e253373989199da27c48680e3a3fc0f648d50f9a727ef17a7fe6a4dc3b159129"))
- val brcInscribeAmount = 7000
- val dustSatoshis = 546
- val txId = Numeric.hexStringToByteArray("b11f1782607a1fe5f033ccf9dc17404db020a0dedff94183596ee67ad4177d79")
- val brc20Ticker = "oadf"
- val brc20Amount = "20"
-
- val privateKey = PrivateKey(privateKeyData)
- val publicKey = privateKey.getPublicKeySecp256k1(true)
- val pubKeyHash = Hash.ripemd(Hash.sha256(publicKey.data()))
- val p2wpkh = BitcoinScript.buildPayToWitnessPubkeyHash(pubKeyHash)
- val outputInscribe = BitcoinScript.buildBRC20InscribeTransfer(brc20Ticker, brc20Amount, publicKey.data())
- val outputInscribeProto = Bitcoin.TransactionOutput.parseFrom(outputInscribe)
-
- val input = Bitcoin.SigningInput.newBuilder()
- .setIsItBrcOperation(true)
- .addPrivateKey(ByteString.copyFrom(privateKeyData))
-
- val unspentOutputPoint0 = Bitcoin.OutPoint.newBuilder()
- .setHash(ByteString.copyFrom(txId))
- .setIndex(0)
- .build()
- val utxo0 = Bitcoin.UnspentTransaction.newBuilder()
- .setScript(outputInscribeProto.script)
- .setAmount(brcInscribeAmount.toLong())
- .setVariant(Bitcoin.TransactionVariant.BRC20TRANSFER)
- .setSpendingScript(outputInscribeProto.spendingScript)
- .setOutPoint(unspentOutputPoint0)
- .build()
-
- input.addUtxo(utxo0)
-
- val utxoPlan0 = Bitcoin.UnspentTransaction.newBuilder()
- .setScript(ByteString.copyFrom(p2wpkh.data()))
- .setAmount(dustSatoshis.toLong())
- .setVariant(Bitcoin.TransactionVariant.P2WPKH)
- .build()
-
- val plan = Bitcoin.TransactionPlan.newBuilder()
- .addUtxos(utxoPlan0)
- .build()
- input.plan = plan
-
- val output = AnySigner.sign(input.build(), BITCOIN, SigningOutput.parser())
-
- assertEquals(output.error, SigningError.OK)
- assertEquals(output.transactionId, "7046dc2689a27e143ea2ad1039710885147e9485ab6453fa7e87464aa7dd3eca")
- val encodedHex = Numeric.toHexString(output.encoded.toByteArray())
- assert(encodedHex.startsWith("0x02000000000101b11f1782607a1fe5f033ccf9dc17404db020a0dedff94183596ee67ad4177d790000000000ffffffff012202000000000000160014e311b8d6ddff856ce8e9a4e03bc6d4fe5050a83d0340"))
- assert(encodedHex.endsWith("5b0063036f7264010118746578742f706c61696e3b636861727365743d7574662d3800377b2270223a226272632d3230222c226f70223a227472616e73666572222c227469636b223a226f616466222c22616d74223a223230227d6821c00f209b6ada5edb42c77fd2bc64ad650ae38314c8f451f3e36d80bc8e26f132cb00000000"))
-
- val signedTransaction = output.transaction
- assert(signedTransaction.isInitialized)
- }
-
- @Test
- fun testSignNftInscriptionCommit() {
- // Successfully broadcasted: https://www.blockchain.com/explorer/transactions/btc/f1e708e5c5847339e16accf8716c14b33717c14d6fe68f9db36627cecbde7117
-
- val privateKeyData = (Numeric.hexStringToByteArray("e253373989199da27c48680e3a3fc0f648d50f9a727ef17a7fe6a4dc3b159129"))
- val fullAmount = 32400
- val minerFee = 1300
- val inscribeAmount = fullAmount - minerFee;
- val txId = Numeric.hexStringToByteArray("992faa0d60f29d77cdae687c300d288a3b075b3c7e1e3b42ad537222c3909557")
- val payload = Numeric.hexStringToByteArray(nftInscriptionImageData)
+ val dustSatoshis = 546.toLong()
+ val txIdCommit = Numeric.hexStringToByteArray("797d17d47ae66e598341f9dfdea020b04d4017dcf9cc33f0e51f7a6082171fb1").reversedArray()
val privateKey = PrivateKey(privateKeyData)
- val publicKey = privateKey.getPublicKeySecp256k1(true)
- val pubKeyHash = Hash.ripemd(Hash.sha256(publicKey.data()))
-
- val p2wpkh = BitcoinScript.buildPayToWitnessPubkeyHash(pubKeyHash)
- val outputInscribe = BitcoinScript.buildOrdinalNftInscription("image/png", payload, publicKey.data())
- val outputInscribeProto = Bitcoin.TransactionOutput.parseFrom(outputInscribe)
-
- val input = Bitcoin.SigningInput.newBuilder()
- .setIsItBrcOperation(true)
- .addPrivateKey(ByteString.copyFrom(privateKeyData))
-
- val unspentOutputPoint = Bitcoin.OutPoint.newBuilder()
- .setHash(ByteString.copyFrom(txId))
- .setIndex(0)
- .build()
-
- val utxo = Bitcoin.UnspentTransaction.newBuilder()
- .setScript(ByteString.copyFrom(p2wpkh.data()))
- .setAmount(fullAmount.toLong())
- .setVariant(Bitcoin.TransactionVariant.P2WPKH)
- .setOutPoint(unspentOutputPoint)
- .build()
- input.addUtxo(utxo)
-
- val utxoPlan = Bitcoin.UnspentTransaction.newBuilder()
- .setScript(outputInscribeProto.script)
- .setAmount(inscribeAmount.toLong())
- .setVariant(Bitcoin.TransactionVariant.NFTINSCRIPTION)
- .build()
-
- val plan = Bitcoin.TransactionPlan.newBuilder()
- .addUtxos(utxoPlan)
- .build()
- input.plan = plan
-
- val output = AnySigner.sign(input.build(), BITCOIN, SigningOutput.parser())
+ val publicKey = ByteString.copyFrom(privateKey.getPublicKeySecp256k1(true).data())
+
+ val utxo0 = BitcoinV2.Input.newBuilder()
+ .setOutPoint(BitcoinV2.OutPoint.newBuilder().apply {
+ hash = ByteString.copyFrom(txIdCommit)
+ vout = 0
+ })
+ .setValue(7_000)
+ .setSighashType(BitcoinSigHashType.ALL.value())
+ .setScriptBuilder(BitcoinV2.Input.InputBuilder.newBuilder().apply {
+ brc20Inscribe = BitcoinV2.Input.InputBrc20Inscription.newBuilder().apply {
+ inscribeTo = publicKey
+ ticker = "oadf"
+ transferAmount = "20"
+ }.build()
+ })
+
+ val out0 = BitcoinV2.Output.newBuilder()
+ .setValue(dustSatoshis)
+ .setBuilder(BitcoinV2.Output.OutputBuilder.newBuilder().apply {
+ p2Wpkh = BitcoinV2.PublicKeyOrHash.newBuilder().setPubkey(publicKey).build()
+ })
+
+ val builder = BitcoinV2.TransactionBuilder.newBuilder()
+ .setVersion(BitcoinV2.TransactionVersion.V2)
+ .addInputs(utxo0)
+ .addOutputs(out0)
+ .setInputSelector(BitcoinV2.InputSelector.UseAll)
+ .setFixedDustThreshold(dustSatoshis)
+ val signingInput = BitcoinV2.SigningInput.newBuilder()
+ .setBuilder(builder)
+ .addPrivateKeys(ByteString.copyFrom(privateKeyData))
+ .setChainInfo(BitcoinV2.ChainInfo.newBuilder().apply {
+ p2PkhPrefix = 0
+ p2ShPrefix = 5
+ })
+ .setDangerousUseFixedSchnorrRng(true)
+ .build()
+
+ val legacySigningInput = Bitcoin.SigningInput.newBuilder().apply {
+ signingV2 = signingInput
+ }
+
+ val output = AnySigner.sign(legacySigningInput.build(), BITCOIN, SigningOutput.parser())
assertEquals(output.error, SigningError.OK)
- assertEquals(output.transactionId, "f1e708e5c5847339e16accf8716c14b33717c14d6fe68f9db36627cecbde7117")
- assertEquals(Numeric.toHexString(output.encoded.toByteArray()), "0x02000000000101992faa0d60f29d77cdae687c300d288a3b075b3c7e1e3b42ad537222c39095570000000000ffffffff017c790000000000002251202ac69a7e9dba801e9fcba826055917b84ca6fba4d51a29e47d478de603eedab602473044022054212984443ed4c66fc103d825bfd2da7baf2ab65d286e3c629b36b98cd7debd022050214cfe5d3b12a17aaaf1a196bfeb2f0ad15ffb320c4717eb7614162453e4fe0121030f209b6ada5edb42c77fd2bc64ad650ae38314c8f451f3e36d80bc8e26f132cb00000000")
-
- val signedTransaction = output.transaction
- assert(signedTransaction.isInitialized)
+ assertEquals(output.signingResultV2.error, SigningError.OK)
+ assertEquals(Numeric.toHexString(output.signingResultV2.encoded.toByteArray()), "0x02000000000101b11f1782607a1fe5f033ccf9dc17404db020a0dedff94183596ee67ad4177d790000000000ffffffff012202000000000000160014e311b8d6ddff856ce8e9a4e03bc6d4fe5050a83d03406a35548b8fa4620028e021a944c1d3dc6e947243a7bfc901bf63fefae0d2460efa149a6440cab51966aa4f09faef2d1e5efcba23ab4ca6e669da598022dbcfe35b0063036f7264010118746578742f706c61696e3b636861727365743d7574662d3800377b2270223a226272632d3230222c226f70223a227472616e73666572222c227469636b223a226f616466222c22616d74223a223230227d6821c00f209b6ada5edb42c77fd2bc64ad650ae38314c8f451f3e36d80bc8e26f132cb00000000")
+ assertEquals(Numeric.toHexString(output.signingResultV2.txid.toByteArray()), "0x7046dc2689a27e143ea2ad1039710885147e9485ab6453fa7e87464aa7dd3eca")
}
@Test
- fun testSignNftInscriptionReveal() {
- // Successfully broadcasted: https://www.blockchain.com/explorer/transactions/btc/173f8350b722243d44cc8db5584de76b432eb6d0888d9e66e662db51584f44ac
-
+ fun testSignBrc20Transfer() {
+ // Successfully broadcasted: https://www.blockchain.com/explorer/transactions/btc/3e3576eb02667fac284a5ecfcb25768969680cc4c597784602d0a33ba7c654b7
val privateKeyData = (Numeric.hexStringToByteArray("e253373989199da27c48680e3a3fc0f648d50f9a727ef17a7fe6a4dc3b159129"))
- val inscribeAmount = 31100
- val dustSatoshis = 546
- val txId = Numeric.hexStringToByteArray("1771decbce2766b39d8fe66f4dc11737b3146c71f8cc6ae1397384c5e508e7f1")
- val payload = Numeric.hexStringToByteArray(nftInscriptionImageData)
+ val dustSatoshis = 546.toLong()
+ val txIdInscription = Numeric.hexStringToByteArray("7046dc2689a27e143ea2ad1039710885147e9485ab6453fa7e87464aa7dd3eca").reversedArray()
+ val txIdForFees = Numeric.hexStringToByteArray("797d17d47ae66e598341f9dfdea020b04d4017dcf9cc33f0e51f7a6082171fb1").reversedArray()
val privateKey = PrivateKey(privateKeyData)
- val publicKey = privateKey.getPublicKeySecp256k1(true)
- val pubKeyHash = Hash.ripemd(Hash.sha256(publicKey.data()))
- val p2wpkh = BitcoinScript.buildPayToWitnessPubkeyHash(pubKeyHash)
- val outputInscribe = BitcoinScript.buildOrdinalNftInscription("image/png", payload, publicKey.data())
- val outputInscribeProto = Bitcoin.TransactionOutput.parseFrom(outputInscribe)
-
- val input = Bitcoin.SigningInput.newBuilder()
- .setIsItBrcOperation(true)
- .addPrivateKey(ByteString.copyFrom(privateKeyData))
-
- val unspentOutputPoint0 = Bitcoin.OutPoint.newBuilder()
- .setHash(ByteString.copyFrom(txId))
- .setIndex(0)
- .build()
-
- val utxo = Bitcoin.UnspentTransaction.newBuilder()
- .setScript(outputInscribeProto.script)
- .setAmount(inscribeAmount.toLong())
- .setVariant(Bitcoin.TransactionVariant.NFTINSCRIPTION)
- .setSpendingScript(outputInscribeProto.spendingScript)
- .setOutPoint(unspentOutputPoint0)
- .build()
-
- input.addUtxo(utxo)
-
- val utxoPlan = Bitcoin.UnspentTransaction.newBuilder()
- .setScript(ByteString.copyFrom(p2wpkh.data()))
- .setAmount(dustSatoshis.toLong())
- .setVariant(Bitcoin.TransactionVariant.P2WPKH)
- .build()
-
- val plan = Bitcoin.TransactionPlan.newBuilder()
- .addUtxos(utxoPlan)
- .build()
- input.plan = plan
-
- val output = AnySigner.sign(input.build(), BITCOIN, SigningOutput.parser())
+ val publicKey = ByteString.copyFrom(privateKey.getPublicKeySecp256k1(true).data())
+ val bobAddress = "bc1qazgc2zhu2kmy42py0vs8d7yff67l3zgpwfzlpk"
+
+ val utxo0 = BitcoinV2.Input.newBuilder()
+ .setOutPoint(BitcoinV2.OutPoint.newBuilder().apply {
+ hash = ByteString.copyFrom(txIdInscription)
+ vout = 0
+ })
+ .setValue(dustSatoshis)
+ .setSighashType(BitcoinSigHashType.ALL.value())
+ .setScriptBuilder(BitcoinV2.Input.InputBuilder.newBuilder().apply {
+ p2Wpkh = BitcoinV2.PublicKeyOrHash.newBuilder().setPubkey(publicKey).build()
+ })
+
+ val utxo1 = BitcoinV2.Input.newBuilder()
+ .setOutPoint(BitcoinV2.OutPoint.newBuilder().apply {
+ hash = ByteString.copyFrom(txIdForFees)
+ vout = 1
+ })
+ .setValue(16_400)
+ .setSighashType(BitcoinSigHashType.ALL.value())
+ .setScriptBuilder(BitcoinV2.Input.InputBuilder.newBuilder().apply {
+ p2Wpkh = BitcoinV2.PublicKeyOrHash.newBuilder().setPubkey(publicKey).build()
+ })
+
+ val out0 = BitcoinV2.Output.newBuilder()
+ .setValue(dustSatoshis)
+ .setToAddress(bobAddress)
+
+ val changeOutput = BitcoinV2.Output.newBuilder()
+ .setValue(13_400)
+ .setBuilder(BitcoinV2.Output.OutputBuilder.newBuilder().apply {
+ p2Wpkh = BitcoinV2.PublicKeyOrHash.newBuilder().setPubkey(publicKey).build()
+ })
+
+ val builder = BitcoinV2.TransactionBuilder.newBuilder()
+ .setVersion(BitcoinV2.TransactionVersion.V2)
+ .addInputs(utxo0)
+ .addInputs(utxo1)
+ .addOutputs(out0)
+ .addOutputs(changeOutput)
+ .setInputSelector(BitcoinV2.InputSelector.UseAll)
+ .setFixedDustThreshold(dustSatoshis)
+ val signingInput = BitcoinV2.SigningInput.newBuilder()
+ .setBuilder(builder)
+ .addPrivateKeys(ByteString.copyFrom(privateKeyData))
+ .setChainInfo(BitcoinV2.ChainInfo.newBuilder().apply {
+ p2PkhPrefix = 0
+ p2ShPrefix = 5
+ })
+ .setDangerousUseFixedSchnorrRng(true)
+ .build()
+
+ val legacySigningInput = Bitcoin.SigningInput.newBuilder().apply {
+ signingV2 = signingInput
+ }
+
+ val output = AnySigner.sign(legacySigningInput.build(), BITCOIN, SigningOutput.parser())
assertEquals(output.error, SigningError.OK)
- assertEquals(output.transactionId, "173f8350b722243d44cc8db5584de76b432eb6d0888d9e66e662db51584f44ac")
-
- val encodedHex = Numeric.toHexString(output.encoded.toByteArray())
- val expectedHex = nftInscriptionRawHex
-
- // Offset is the 0x prefix.
- val offset = 2;
- assertEquals(encodedHex.length, 15658 + offset)
- assertEquals(encodedHex.substring(0 + offset, 164 + offset), expectedHex.substring(0, 164))
- assertEquals(encodedHex.substring(292 + offset, 15658 + offset), expectedHex.substring(292, 15658))
-
- val signedTransaction = output.transaction
- assert(signedTransaction.isInitialized)
+ assertEquals(output.signingResultV2.error, SigningError.OK)
+ assertEquals(Numeric.toHexString(output.signingResultV2.encoded.toByteArray()), "0x02000000000102ca3edda74a46877efa5364ab85947e148508713910ada23e147ea28926dc46700000000000ffffffffb11f1782607a1fe5f033ccf9dc17404db020a0dedff94183596ee67ad4177d790100000000ffffffff022202000000000000160014e891850afc55b64aa8247b2076f8894ebdf889015834000000000000160014e311b8d6ddff856ce8e9a4e03bc6d4fe5050a83d024830450221008798393eb0b7390217591a8c33abe18dd2f7ea7009766e0d833edeaec63f2ec302200cf876ff52e68dbaf108a3f6da250713a9b04949a8f1dcd1fb867b24052236950121030f209b6ada5edb42c77fd2bc64ad650ae38314c8f451f3e36d80bc8e26f132cb0248304502210096bbb9d1f0596d69875646689e46f29485e8ceccacde9d0025db87fd96d3066902206d6de2dd69d965d28df3441b94c76e812384ab9297e69afe3480ee4031e1b2060121030f209b6ada5edb42c77fd2bc64ad650ae38314c8f451f3e36d80bc8e26f132cb00000000")
+ assertEquals(Numeric.toHexString(output.signingResultV2.txid.toByteArray()), "0x3e3576eb02667fac284a5ecfcb25768969680cc4c597784602d0a33ba7c654b7")
}
}
-
-const val nftInscriptionImageData =
-"89504e470d0a1a0a0000000d4948445200000360000002be0803000000f3" +
-"0f8d7d000000d8504c54450000003070bf3070af3173bd3078b73870b730" +
-"70b73575ba3075ba3075b53070ba3078bb3474bb3474b73074bb3074b733" +
-"76b93076b93373bc3373b93073b93376bc3275ba3075ba3572ba3272ba33" +
-"75bc3276b83474bb3274bb3274b83276bd3276bb3474bd3474bb3276b934" +
-"74bb3474b93274bb3274b93476bb3276bb3375ba3275ba3373bc3273ba32" +
-"77bc3375bc3375ba3373bc3374ba3174b93376bb3375bc3375bb3375b933" +
-"75bb3374bb3376bb3475bb3375bb3375ba3374bb3276bc3276ba3375bc32" +
-"75bc3375bb3275bb3374bc3374bb3375bb7edf10e10000004774524e5300" +
-"10101f20202030303030404040404050505050505f606060606f70707070" +
-"7f7f7f7f80808080808f8f909090909f9f9f9fa0a0afafafb0bfbfcfcfcf" +
-"cfcfdfdfdfdfefefefef6a89059600001c294944415478daeddd6b7bd3d6" +
-"ba2ee0d8350eb00c81ec5533cbac69d6da99383334dbe510904b66129383" +
-"feff3fda17506888751892255b52eefb634b1259d2a3f1ead5d0f0d61600" +
-"000000000000000000000000000000000000000000000000000000000000" +
-"000000000000000000000000000000000000000000000000000000000000" +
-"000000000000000000000000000000000000000000000000000000000000" +
-"000000000000000000000000000000000084eaef3c9b4e274f87f604546e" +
-"27ba8abf3a19db1b50a96114dfb01031a8d0cf57f18f0e7a760a54e4b778" +
-"c9c2ad1854a27f1c27586cdb3350c1edd7224eb667dfc0aa9e5fc569666e" +
-"c460b5f2f0df71063762b08afb8b389b3211ca978771aec82006a5fcf870" +
-"39cd8587ce5066f8ba8ac3cc0c6250d0cec738d8c53fed2f2820bb79a89d" +
-"08ab185fc545a91321b03a8ce21216ea44c8372c152f2fb1400d375fb722" +
-"b6630f427abcf6aee2d544220675c54bc420adb5318b2be25e0c6ec72b8a" +
-"2bb4186bdac3dfb5e1495cb5d903fb15bed48657711d4ec67d3b973b6eb8" +
-"574fbafe1ac6343cb8cba5e1248a6bb69031eeead8557bba648c3b3a74ed" +
-"1c9cc56b74f54e5b913b13aebde82a5ebf9399af8da0ebe17a7ab09170fd" +
-"1db2b1ee3dddbce57a3a79b77a5978383e5fb95c8c0e9eba29a33ba3d683" +
-"6793d94925e3d6f9686b6bf0a69ab12c3a98ec2819696baa86c39d67cfa6" +
-"b377671556846fbe3e385e7d10fbdb59f4ee60fa6c6767e899340d8dd2b3" +
-"835974d3c9d9592db759974fbefdc98a06b1a5b09d9dfdf041a2d94429c9" +
-"66ed44ebea4f1cde1c63aa1cc4b29fa1ed2923d9dce8b5b6787dbefbbaa9" +
-"a641ccbb2f3448eec2f1955587fbcbb748bbeb1ac4e203479a8de46b5d4f" +
-"b4e683c4bfbf7fbda6bf3f73ac59bfe16233d5e106ea446318eb77bc9eea" +
-"f0d7ac6d189cac27618f1c6ed66cbca99baf5b9bb1965bb185e3cd9a9dae" +
-"bb35bfd18819c258af876be82d0c4207d3fa231639e2acd5a431f15a4bc4" +
-"2e7cdd3a6bf57ec3f75eeb8e98b75ce8cc2d58f1787d89d8bcce80fde290" +
-"b34ef5bdf13f2f3d37a9cee762024617027679385a65ab06b5558a0246fb" +
-"03369facfe5ad6e88d802160950f5e3787b1530143c07e48d7eb51955b37" +
-"383c1730da2caa345d35ac22bf5d6dc6048c7606ecf27054d77a18db93ea" +
-"6ac5270e39ed0bd87c7f54ef660ec6c7972623721703f6e970773d4b398d" +
-"267301e34e05ecf470cddfdd359acc2f058c3b10b04faf27a3cd2c42b8bd" +
-"7b583e6502c65a9598ec7b393fdc54b66ea66c7a7c2a6034dddb2283d6e9" +
-"ebe978bb496be76eef4e0ee7a702467b03f6e9d3fcf8f574321edd6bee87" +
-"e88f46e3e9e1f1fcf4536ee9e875159a12b07fddbb77af7d1fa87fefde76" +
-"c6f4949f1c721a12b0f64e7a1030044cc0b8038ed2cfc51702062b9aa69f" +
-"8bd3d67ea86b0143c0ea93d14574c411300143c0040c5609d82b01831565" +
-"7cf7c31f020602b66490b174b6238e80d51730df5f848009187721601f04" +
-"0c56f43863259bb67ea68cef3cfbd31147c07c2604cc6782554ec63f050c" +
-"3404040c015ba72e764611b03604ec0f479ca604ec42c060551d9c183b11" +
-"3004ac3e9d7cc70d011330b8ad830bc40818cdd1c125ce8e040c01ab4f27" +
-"175345c0040c6e3bedde57fdbc17301a23ea5ec03af891e862c09e0818a8" +
-"a7040c1d81353af3059708d84602e6cb5558b30e3e95f5ed45344707e715" +
-"59391b011330ee84eebd3cd513309aa37bafff5ad8977604ec8380c18a76" +
-"3bb7c65917977aa4b51edfa580591691757bd8b9824ac070c7e2ae923b1f" +
-"b08bce05ccaa6dac5bf79e1a4d058c06b94b01b3e60d6bd7b9a9b11695a2" +
-"493af77247c60b382f1c6e1a14b076be9e68cd1b9aa4732fd877709511ba" +
-"19b05f5c31a0be5b967606ec4cc0d013d848c0ac18c0da75aeab9df160af" +
-"e770b36e19cf655f752d608e366bd7b5a97b0301a325016be5e4f3875e68" +
-"a649baf64ab3179a69cb09b9e8d8e7f1be258dba676965c0bc6f89a6408d" +
-"265e07a3513af6dcc8eb60344bc75e087b2b60344ac7de57f1b60acdd2b1" +
-"af41f7b60aad39237f71bd80fa6e5ada389dde17c8d22c1d9b4e1f7b5b85" +
-"46e9d63a82be1d8c86e9d674fa879d5ba998ee06ac8593f71e9b4c8f53b2" +
-"3ebbe6fad22cddfafa8789b9beb4a72dd0bec988befa81a6e95463db5444" +
-"9aa6538f66232bd3d330a75d9a2b652a224df3be4b177debfae2b6c50d25" +
-"7748971a6f5645a471ba3495e3b1995234cd6e87a672ec5a1591a6e9d2fc" +
-"d8899952b4e9bea56d53398e4ce4a071e2ee3c697e6f22078d73d69d87b3" +
-"9135a568d359d9b627cdd79e33d3386fbbf31d7cb1256fd019a8cd43df1f" +
-"4bf38c3bf3f0c873661a68b733a7a5c7603450771e841d593080e6e975a6" +
-"35f0be3bed1a3ae4ac2b4f8f4ebdcf4cbbcecb76cd7f883d06a381de76a4" +
-"4fffd063309a68da913efd63af5bd244e38ef4e927de06a36da5559b56b2" +
-"38f2188c26caead3b7693e7da44b4f235d77a3bd7dad4b4f239d76a28dd8" +
-"d3a5a799de76a23bf0d8a28834d3a4136dc489b9f434d36e27aefdef3511" +
-"69a64127da88a7e6d2d350d75d6870c79a883454d4818bff634d449aeaa8" +
-"03fd8189053968aa7107ba1c334d449a2a6b36625bdeb93cd544a4a9b226" +
-"41bcf211604519ab0644edef71f87a66362c63b2d4453b3a0453af33d35c" +
-"93d6f7b8233d0edad9e568c7c237b11e070d76ddf29bb0c7adbf42d06951" +
-"cb6fc2a6e671d064472d3f4123f33868b2dd763f46ca7a0a6645299ca177" +
-"fbfa40f79db57a3ae2cc6366da7b13d6fcd7a916195b3f7070d9bcac09f5" +
-"8d6fd43f760b468b6fc21adf879bb905a3e94e5b5c232edc82d1e69bb086" +
-"d7888f634fc168ba517bcfd299898834df756ba7f35d5b508ae6cb78272c" +
-"fed8e40dcf6a807a178c569ca74d9e8f98350ff1dc71a521321bf50d6e73" +
-"0c634d7ada206a679b63167b558536c85a37a0b96d8ecc014c85484b6ac4" +
-"c6be76993980cd1c555a5223367408cb1cc0f4106992710b87b0990a91d6" +
-"d488d7ad1bc2b207b0b1634a931c659eaec3b60d605e05a35932e72336f1" +
-"59d8fdcc0df6c596b4a9cdd1c0373f162ddb5eeeb8cc4761f1a2697d8edf" +
-"622d0ebad3e668da63a5ec0e871607cdf332fb9cfd6793b6b59f5d206a71" +
-"d0c0212cfb9cbd68522731bb836816074df4266ecb6d58f60d98018c461a" +
-"e59cb68de9d5ff1c1bc068a1a81d27eefd2b03185d1cc2e2bd56e4cb0046" +
-"3befc21a91b0dc7c19c068aac175dcf4d161e72a3680d1562ff3cedef8dd" +
-"667b893fe76ee0b9018cc6eae50e61f16293cfc37ecbddbcf8574791e69a" +
-"e49fc18b8d4da4ed1fe76f9d5988345a947f0e6faad5717f11b06ddb0e21" +
-"edee73c4717cb28932f179c086e970d0fe3ec7e73271edd3d5872143ab0e" +
-"07dd2812e378b6de41ecf955d0568d1c3e3a5124c6f1628defaf840d5f71" +
-"fc2f478fe69b849dcd6b6bd8f7f7023748079156f83df0848e0fd611b19d" +
-"45e0d65cba01a3157a27a109abbfd9713f0add16eb04d0b1dbb02f11dba9" +
-"b53afc77f086b801a33db6c3cfeb1afb89fdbdabf0cd78e3a8d11ee378f3" +
-"117bb228b00dffe93b68b4c87e91842d6a983cb51315d9024f98e972c22a" +
-"ef760c0bc54bbee87ac22a8d5891de867c713712164715dd8a15ea6dc817" +
-"77266195743b0ac74bbeb833095b3d62e3452c5fdc1593c2095bada158ac" +
-"75f8c55c7f9ef61a5d178f58e96ec7fde2f18a0f1d23da6c705efca42fb7" +
-"6a47d1d6a1f951742261c725cefbe2b762c57b1b9fe7cf7bc192bbd8ea28" +
-"1eb1e2bd8dcfd3a3b437e8c48d588932b1d01bcf257a1b6ebfe85099f8a6" +
-"4c0042bb1dc35999dfae3ca44326d775d589a56ebe74e7e9da2056aa8a8b" +
-"f7f296b2df59941abe2c904de706b1f3eaebc461b9d8ce75377027f6edfb" +
-"5886155787e74f1c0b3a697c5eae4eacb23a8c0fdd7dd159a59e8925d689" +
-"fde372d5e17d070175626e3ff179a9eaf0d2d26ca813f307b172cd8dcb7d" +
-"d5212296ffc2f35ea951f058ef903b5227febe4ab363e763a99b2f333770" +
-"2b96ff7511a5de4a89cfc58b3b16b179a941ac546fdec40ddc8ad5466f03" +
-"11ab8f07cbdc5dfb7547ccb443743bea8b97de06225657bcb40ea1744351" +
-"eb1036d6edd03a84fa2236132ff8a14edcd7db8016743bf43620d1fdf32a" +
-"6ebeec47a8eb56ccbc0dc8aa137f77f3057546ecbd275fd0bc3a517508b5" +
-"d589aa43088fd8b9ea106a54e8eb22ac67034507b1379e2cc3e69b1d9a1b" +
-"50db2066f882fa0631c317d4368819bea0be41ccf005b50d62862fa844e2" +
-"33b163c3175434889d9bba0135dab79e28ace94eecc4175542e5111b1f9f" +
-"7efaf4e9f850730300000000000000000000000000000000000000000000" +
-"000000000000000000000000000000000000000000000000000000000000" +
-"00000000000000000068bff16c49effbfffc9fe5ff698f41016fe3253f7d" +
-"ff9fd1f2ffb4c740c040c040c0046c15b3aa0ceedcae1b26ec8583b01f7d" +
-"b2f483e3b01f7cbef483ff2b608d1657e5d19ddb75bdebd2bb61f9bcbd08" +
-"fb9bcb7f7226600276778aab781a34f695dd7fbb35ec770113b0861a25ec" +
-"8628e407c7093ff82aa8a05ffab173f7600276a76ac49f4a55888135620d" +
-"15a28009585dfefbd992b5d488c3b23b30a1427cd2fa80f5968fc28e8075" +
-"22602b9f3d256bc471e20e0ca81167657b234d0ed860f94ffc216002965a" +
-"23f64a55884159a9a3421430016b6cc0126bc417e52ac4803d584b852860" +
-"02d6dc808dcbd488e3943d987bf7564b85286002d6dc8095aa11a3943db8" +
-"c8fb6b8b3a2a440113b0e6062c312c2fca5588b9bbf0f1f24f8c054cc03a" +
-"1db01235e23875174e8b5688010d150113b036072ca946bce895aa107393" +
-"b95c217ed8123001eb74c012e3f24bb90a316716484d15a2800958930356" +
-"b8461c67ecc3e9062a4401abd728d5ff4938030ed3ff79ff6e06ac708d78" +
-"9a11b0680315a2806dcaa068f17327039658233e2a5721660e4975558802" +
-"d6ad800dd734d2f587c3dc3f55c9d933890b9d2093cc80bd2854210e56fb" +
-"f8b5062cfcef0b5858c03e1fd21ffdb083fb3b93d9c9591cc7f3bf767fd6" +
-"3fcefdd5c3f403fbec60767276f56d83cfa2e860b2d3af3160bdb8508d78" +
-"9a19b0a84885384fd8530f6e7ffc77d3a70fd619b0efc7f9b3ab93e820ef" +
-"cf0b5860c01e67eca6fe24baba795a14dca7d3c0226c78e3cfdc9a24f16e" +
-"b25353c08ad588c39c5651af7c85387c363b4bfea557efc6c3b5042cf900" +
-"2c664f05acce80ed1c5fddbaeed611b0fe5e9473f2465f4fb383e89b8493" +
-"21baa5648df8aa5c85985123e654883b7b27d9bff8ddd3ba03d69fa41f80" +
-"abd952c2bfefe2840d5fdc3a0a0702961eb061b45cd8541fb0fede55c8b3" +
-"84689cf5a0372e35a2f58abc7a729ab781652ac47e5ebabe9eb5e33a0396" +
-"7b00a25b254491a33017b0d4803dbf8aeb0f5860bcbe9c66412763a192b1" +
-"408d38ccfd83bdc215e2f020f4c32f86b505ec79c036fc388a09581501eb" +
-"1f27eeac8a03b6b388eb52b68ff8aa5c8598ba87532bc4e1acc8c7d9ab27" +
-"603b1f8bff7901ab2060c38ff11a02f63c8e371ab00235e269ee1f8c8a55" +
-"88e143f75727c31a02167e006e8ca102b67ac0fa8b780d01fb2dde70c0c2" +
-"6bc4fc0a31a5c39f52210e3f16fe40cb65e2aa01eb17b9a95d6c0b587501" +
-"3b8ed710b0c2f95a541eb049e8b4c2e57f781db68b8f922bc4de79bc7ac2" +
-"560cd8b0607dfeb3805515b0ab780d012b9caf595479c0926ac4455085f8" +
-"e751d88e48ab10c72506e545afca800d0bdffffe2c6015052c5e43c08685" +
-"cfaf41f5010bad119737f6c528a8467c98da432c3184dd5e6760a5800d4b" +
-"f4971e09587b02b6287e76d510b0c01a719250e75d8724f328f529739921" +
-"ecd65254ab04ac4cbee28ba180b52560c5cfaf411d01eb85b503972bc4a4" +
-"ecfc115221fef9ed7f9519c27e1c245709585426dff1494fc05a12b01203" +
-"581d014bfc9d3fe55788e3a4c5812f422ac4ef53aa4665cef06945012bdb" +
-"c03d10b076042cf96f5ebe9eec6edffb6c7bb43b3d3ebdf57375042ca946" +
-"7c1152216e85d488e9156272043e7d9acf4f3f850e61e5039676037c7a38" +
-"feb2ff479337e7a9b76102d682801d25fdfed1d2839addefc779be554fc0" +
-"826ac4d3c4f3e6287f16484685786b08bb3c9eecdefbf67fb677d3ceef1f" +
-"c25f3e6089f5c3e5e1f6cd6d1f9fa73c4e17b016042c6162c4bf927fc5e8" +
-"cdf7dedbd1fc9b84b7fde7b784eeaca4d4f6022ac4901af1617640a2bf4f" +
-"eda56b4bcaf9fd43f84b072c7102c77c10b409e3adbff77142486f1d05b3" +
-"e9730336ff7665bd77afc28005e7ebf3dfdc3fbffd6d7515be0fff32bf46" +
-"7c995ce7f5726bc4495685f83da1cb23f7d7b1f5f7c4e3d15b3d60891dc4" +
-"5f93f6fc49e66342ef83ad1cb0cbfd7eeeaf2e13b0e54b7bf6f73dee3fa9" +
-"2d6083fc1a719152f8bccdab114fb32ac4bf3e464abcbe7cea9c1ab16cc0" +
-"923a1cff480ef971ea733c01ab2060fbfd805f5d2660cb7fb2d83a4b55ae" +
-"e8925b233e4c3bc7f26ac48456c28f091cc5e7a3ac4d4b1ac3fe583d608b" +
-"b0f1eb4bc24e32ae3e02b65ac0920e7e6d01fb636301cbad118fd2eabcbc" +
-"1a31a142bcb5ccc5ef39cbcb649768250336ce9d2272f380677c46015b29" +
-"60e783ad3506eccf8d052cb7465ca4b6c6a2ece754a7050be1840e4fe6e8" +
-"5a326051d8a14e8de32b01ab22609783ad7506ecfb5cedb5072ce997dd7c" +
-"dcf430fd2e649c35bee4578801aeb306c172011b66dd5685ec9e85805511" +
-"b0f1568d014bdac27f6e2a602fb377d7517a2730bb46ccaf10f31d656d5a" +
-"b9808d836629670d613f09d8ea017bbf5567c0121f562e0e1e6c24603935" +
-"e222e3e169668db87a859878bff462c580bd2f7007967c15792160ab07ec" +
-"51bd014b5d073075add1fa0296b4317f5fd41f668dede38c64565121263d" +
-"aa9eae18b045ce1cfd25efd38eb880950fd89f5bf506ec28e3d1f655c692" +
-"beb504ec65d605e628eb59712fe3141f075fb58a1dca57ab05ac97fdf03b" +
-"c124ede410b0f2017b5173c0f2a7929f640d66d5066c94f5b8699139bd2e" +
-"a3468c8a5588fd074f9f3d9bde7694b5bf4b052ce1684fb31da73ded13b0" +
-"f2017b5073c002df863a3978daaf3f60893562488598d4c888d22bc4b47b" +
-"9de1647612bec6d48a012bf5a267f25f11b0d201bbd8aa3b6093e0a3194d" +
-"8675072ca3463cca2ea87aa9cfa9422bc49d8382ebb7ad18b06905017b20" +
-"602b066c5e7bc00abd7b727bf1e6aa03965423be0aa91093b6e445810ab1" +
-"3f39297c76af18b0a30a02f648c0560cd887fa033628f4cafcadaf20a8fa" +
-"dbe5526bc48779cf07d36ac4a00af149998531560cd8db0a02f68b80ad18" +
-"b069fd01dbda2e94b08b719d014bad118ff25a6e6935624085d83f2e7576" +
-"0b98800505ace018f6c3f2e855072cb546ccab10536bc4fc0a7158725d7e" +
-"0113b0b0806d0dde944d58e55f407c9d5c23e656886935627e8558365f4d" +
-"08d813016b48c08e720aa571a141ec9ff505ec28b946ccad10d36ac4dc0a" +
-"b174be9a10304d8ea604ec7dee9d48a1883daa2d604935e234a4424cda96" +
-"5f022ac459bca18069d3b72d6059ef229f063c0c1abd09ce58545bc0926a" +
-"c445488598d42089f22bc4151ef7ae18b0490501f3a0799d01cb7a553270" +
-"16f1f6f8f8bcd010567dc0926ac407b390697bcbbbe4a2975b21a61488a7" +
-"afa7d3f14d93ca03b6bbfcdfffefb8a02d015b63c02e0afde6d409af83db" +
-"2b8d665dbdab0f58628d18522126d68851ce5e4a1cc0e6a37eb192bc54c0" +
-"06e1134f4b9c6702b662c07a71d6410d6c1d64d8de9dbe9e5fa63f0dab2d" +
-"604935e2554885985823e6558809ff2079f99bea0396f04123016b4cc092" +
-"8abef40be0a270c0be8d6687f3ccdbeb1a0216348568103af8a575b6532f" +
-"5329cb62d410b0f7a97b55c01a10b0b338fc02388e4b06eccb8748ec2ffe" +
-"525bc04262320fde27d91562caf7caae27609390495c02b6a98025dd260d" +
-"0b0c60455e3adc4fddb01a0296542306a6e065c05cca9c87d3e75b6b0bd8" +
-"60b5832260f506ec6d1c7c01fc2d5e31600927c9abfa027654b2420c1afc" +
-"9ee4fca90feb0b58d2ff59f4caecb15eb16736021612b0497068eec72b07" +
-"6c9c7676bd2fd26aa9ac469c17a89b333badef8377f86e0d017b19172e12" +
-"9f6f07de902f046cc580259e868b8422f1fe555ec0a271de07495d00f86d" +
-"75bde60235e2b8f4e0f72170640e18c3570f58efba60c2faffefaf2f8f0d" +
-"d8633d015b2d608947272161cf73a73b8de378b193fd4126691b7654a0d5" +
-"525d8d38283df88df346b03fc2db442b072cf9839ea4dd496f0d3fa65c43" +
-"9346eea980ad16b0b43791f77ef8473b51e07cc245e6287692364e8d736f" +
-"736aa811e7e507bf5ede8d6cf2d3fac419c1ab076c90b88d2987a2bf7795" +
-"5aa52454ea1743015b2d606973d916b3bf1681eaefec4501b39d1e7fffb9" +
-"d4a730bfa5fef4c3a4fb9c9bf7093b653acfd7252bc4dcc1ef43fe3f4fba" +
-"3cf43fc6b5046cebf7383462dfe295dc0839ca1b099f8f05ac68c07a1927" +
-"d2d5d9d959de0dffb780cd12b2f9e3e53be985dfcc8dd81b7e8f57a99b81" +
-"b7252bc4dcc16f9c5ff9250c10c38f714d01eb5da75e259fded88e0793e8" +
-"e68df4492fa0057323a6fdff8e2a28dcef5cc08a7d53726ac06ecf373f39" +
-"98ecfc7d6cfb3b9328732848de88ab683a9d1ebcbb2a7933302a5b21e60d" +
-"7ebd8003b494b09d455c57c09293f17d2746b3d96c169de53742522eb657" +
-"ef0ea6d3d9d7703e10b0a2011b5512b0e4f7a1cecea2283a39bbca1d0af2" +
-"9fed7e2cf15ce7ba64859853237e08cbe3cd857dfacfa29a5e57f9ea4da9" +
-"63372b7eb19d0a58d180ad38843d4a1cc0c29c0715aae56727bc2d320c85" +
-"5f7596a399727d880e9eedececec3c3b88aef2df28582960bdf35207602f" +
-"f0863ce85d0b01ab65087b94318015e876e7a7bcf8372d647eb20fe51b24" +
-"83a02314aa9280155d71282561bdeb3aae73773d60694da802011b5e97f9" +
-"d179a1945f146f73649d2fe3d2835fd2cddbf1a603b6b55dea10dcfe16b7" +
-"fc523d12b0c2012b595fdc08d86fa50ac441b142b5c4dc8eb7252bc4ccc0" +
-"27457370bde980954cd83f0a0f613d012b7c6bba7dbd62c0ca2ca97479bf" +
-"e0295ae2da392a5b21669d6983228f1397ae2ad77505ac5495f88fe29f63" +
-"2a60c5774ae86dd87f0e13035666c997cb27f90f9352cfb6d56bc471e9c1" +
-"2fa5bd1fd8c71b9fd516b0ad41d185f12fff51e273440256e2aab31b3486" +
-"cdfbd3c480bd2c9eaff3fb4bdbb05fc3b5f37de9426754309abda0b3fb70" +
-"abc68005ecc2bc6310f2391e0958895333a4be384c5a85efcbee1e15ad4e" +
-"e6497556dee951a2453c2e5921660c7e6913407a018d8e375bf506ac5099" +
-"78dc2f77a578256065aefdb9eb5e5ffeba951ab0adadf1bc4869f26bf236" +
-"4c2abf76a6c524604e5d547802c87e40be6a0ed8d6d6243062e74fca7695" +
-"2f7a0256aab8ca5e94f7eb98334d3fe907a10b8e5eeef7cb8da39725a69a" +
-"46a55b61e3e2d1ccd9fc2f9795ba03b635d83f5fe918e49e09ff190858c9" +
-"bb97f41d3bff6b11b269e6a8b21b90b193cc439b756c67fd12fb6e5cb242" +
-"4c1dfc06652f52b3af3f597bc002ca89f92467570ef62fd3a3a9c9b1427b" +
-"20f1d05cbeffbec6df34af6c1b4d3396418ce7fba3fc4d382e7ec92d1a93" +
-"71e9c16f9edb2e4adefcc36fc15c47c03eafe1355fe5187cfe05a7a5a2d9" +
-"4abd84d58e0785fef9fdf03fd6df3dbc1991cbd3c39b0bd4de0fd990edcf" +
-"8bfade8ad9e5e9ebc9a85f6a13e24fc79351e99db79bb45674d05dc420e9" +
-"27ef17dffccb1f4ee9a5edf9fb2df0ffcadad0ff4a5df13ab50f3ab97d14" +
-"3e1d1fee86076430fe7169e64faf3b99ae8de86f8fbe1cc2d1bd157ec7bd" +
-"d1d75f32de1ddd2b7e64faa36f9bd0caa3fa7df3b7fb9b3e92bb7f6d48a9" +
-"63f9d741dc5de54c00000000000000000000000000000000000000000000" +
-"000000000000000000000000000000000000000000000000000000000000" +
-"000000000000000000000000000000000000000000000000000000000000" +
-"00000000000000000000000000000000000000000000008066fbffddd184" +
-"8d4adc88950000000049454e44ae426082"
-
-const val nftInscriptionRawHex =
-"020000000001011771decbce2766b39d8fe66f4dc11737b3146c71f8cc6a" +
-"e1397384c5e508e7f10000000000ffffffff012202000000000000160014" +
-"e311b8d6ddff856ce8e9a4e03bc6d4fe5050a83d0340cc1e7b0b5fa18b28" +
-"dce702e4e8ed2e91069d682b8daa3a773774bfc7d0e6f737d403016a9016" +
-"b58a92592ad0b41682e6209167444eb56605532b28e9be922d3afdda1d00" +
-"63036f7264010109696d6167652f706e67004d080289504e470d0a1a0a00" +
-"00000d4948445200000360000002be0803000000f30f8d7d000000d8504c" +
-"54450000003070bf3070af3173bd3078b73870b73070b73575ba3075ba30" +
-"75b53070ba3078bb3474bb3474b73074bb3074b73376b93076b93373bc33" +
-"73b93073b93376bc3275ba3075ba3572ba3272ba3375bc3276b83474bb32" +
-"74bb3274b83276bd3276bb3474bd3474bb3276b93474bb3474b93274bb32" +
-"74b93476bb3276bb3375ba3275ba3373bc3273ba3277bc3375bc3375ba33" +
-"73bc3374ba3174b93376bb3375bc3375bb3375b93375bb3374bb3376bb34" +
-"75bb3375bb3375ba3374bb3276bc3276ba3375bc3275bc3375bb3275bb33" +
-"74bc3374bb3375bb7edf10e10000004774524e530010101f202020303030" +
-"30404040404050505050505f606060606f707070707f7f7f7f8080808080" +
-"8f8f909090909f9f9f9fa0a0afafafb0bfbfcfcfcfcfcfdfdfdfdfefefef" +
-"ef6a89059600001c294944415478daeddd6b7bd3d6ba2ee0d8350eb00c81" +
-"ec5533cbac69d6da99383334dbe510904b66129383feff3fda1750688875" +
-"1892255b52eefb634b1259d2a3f1ead5d0f0d61600000000000000000000" +
-"000000000000000000000000000000000000000000000000000000000000" +
-"000000000000000000000000000000000000000000000000000000000000" +
-"000000000000000000000000000000000000000000000000000000000000" +
-"004d08020000000000000084eaef3c9b4e274f87f604546e27ba8abf3a19" +
-"db1b50a96114dfb01031a8d0cf57f18f0e7a760a54e4b778c9c2ad1854a2" +
-"7f1c27586cdb3350c1edd7224eb667dfc0aa9e5fc569666ec460b5f2f0df" +
-"71063762b08afb8b389b3211ca978771aec82006a5fcf87039cd8587ce50" +
-"66f8ba8ac3cc0c6250d0cec738d8c53fed2f2820bb79a89d08ab185fc545" +
-"a91321b03a8ce21216ea44c8372c152f2fb1400d375fb722b6630f427abc" +
-"f6aee2d544220675c54bc420adb5318b2be25e0c6ec72b8a2bb4186bdac3" +
-"dfb5e1495cb5d903fb15bed48657711d4ec67d3b973b6eb8574fbafe1ac6" +
-"343cb8cba5e1248a6bb69031eeead8557bba648c3b3a74ed1c9cc56b74f5" +
-"4e5b913b13aebde82a5ebf9399af8da0ebe17a7ab09170fd1db2b1ee3ddd" +
-"bce57a3a79b77a5978383e5fb95c8c0e9eba29a33ba3d6836793d94925e3" +
-"d6f9686b6bf0a69ab12c3a98ec2819696baa86c39d67cfa6b37767155684" +
-"6fbe3e385e7d10fbdb59f4ee60fa6c6767e899340d8dd2b3835974d3c9d9" +
-"592db759974fbefdc98a06b1a5b09d9dfdf041a2d94429c966ed44ebea4f" +
-"1cde1c63aa1cc4b29fa1ed2923d9dce8b5b6787dbefbbaa9a641ccbb2f34" +
-"48eec2f1955587fbcbb748bbeb1ac4e203479a8de46b5d4fb4e683c4bfbf" +
-"7fbda6bf3f73ac59bfe16233d5e106ea446318eb77bc9eeaf0d7ac6d189c" +
-"ac27618f1c6ed66cbca99baf5b9b4d0802b1965bb185e3cd9a9daebb35bf" +
-"d18819c258af876be82d0c4207d3fa231639e2acd5a431f15a4bc42e7cdd" +
-"3a6bf57ec3f75eeb8e98b75ce8cc2d58f1787d89d8bcce80fde290b34ef5" +
-"bdf13f2f3d37a9cee762024617027679385a65ab06b5558a0246fb03369f" +
-"acfe5ad6e88d802160950f5e3787b1530143c07e48d7eb51955b37383c17" +
-"30da2caa345d35ac22bf5d6dc6048c7606ecf27054d77a18db93ea6ac527" +
-"0e39ed0bd87c7f54ef660ec6c7972623721703f6e970773d4b398d267301" +
-"e34e05ecf470cddfdd359acc2f058c3b10b04faf27a3cd2c42b8bd7b583e" +
-"6502c65a9598ec7b393fdc54b66ea66c7a7c2a6034dddb2283d6e9ebe978" +
-"bb496be76eef4e0ee7a702467b03f6e9d3fcf8f574321edd6bee87e88f46" +
-"e3e9e1f1fcf4536ee9e875159a12b07fddbb77af7d1fa87fefde76c6f494" +
-"9f1c721a12b0f64e7a1030044cc0b8038ed2cfc51702062b9aa69f8bd3d6" +
-"7ea86b0143c0ea93d14574c411300143c0040c5609d82b018315657cf7c3" +
-"1f020602b66490b174b6238e80d51730df5f848009187721601f040c56f4" +
-"3863259bb67ea68cef3cfbd31147c07c2604cc6782554ec63f050c340404" +
-"0c015ba72e764611b03604ec0f479ca604ec42c060551d9c183b113004ac" +
-"3e9d7cc70d011330b8ad830bc40818cdd1c125ce8e040c01ab4f27175345" +
-"c0040c6e3bedde57fdbc17301a23ea5ec03af891e862c09e0818a84d0802" +
-"a7040c1d81353af3059708d84602e6cb5558b30e3e95f5ed45344707e715" +
-"59391b011330ee84eebd3cd513309aa37bafff5ad8977604ec8380c18a76" +
-"3bb7c65917977aa4b51edfa580591691757bd8b9824ac070c7e2ae923b1f" +
-"b08bce05ccaa6dac5bf79e1a4d058c06b94b01b3e60d6bd7b9a9b11695a2" +
-"493af77247c60b382f1c6e1a14b076be9e68cd1b9aa4732fd877709511ba" +
-"19b05f5c31a0be5b967606ec4cc0d013d848c0ac18c0da75aeab9df160af" +
-"e770b36e19cf655f752d608e366bd7b5a97b0301a325016be5e4f3875e68" +
-"a649baf64ab3179a69cb09b9e8d8e7f1be258dba676965c0bc6f89a6408d" +
-"265e07a3513af6dcc8eb60344bc75e087b2b60344ac7de57f1b60acdd2b1" +
-"af41f7b60aad39237f71bd80fa6e5ada389dde17c8d22c1d9b4e1f7b5b85" +
-"46e9d63a82be1d8c86e9d674fa879d5ba998ee06ac8593f71e9b4c8f53b2" +
-"3ebbe6fad22cddfafa8789b9beb4a72dd0bec988befa81a6e95463db5444" +
-"9aa6538f66232bd3d330a75d9a2b652a224df3be4b177debfae2b6c50d25" +
-"7748971a6f5645a471ba3495e3b1995234cd6e87a672ec5a1591a6e9d2fc" +
-"d8899952b4e9bea56d53398e4ce4a071e2ee3c697e6f22078d73d69d87b3" +
-"9135a568d359d9b627cdd79e33d3386fbbf31d7cb1256fd019a8cd43df1f" +
-"4bf38c3bf3f0c873661a68b733a7a5c7603450771e841d593080e6e975a6" +
-"35f0be3bed1a3ae4ac2b4d08024f8f4ebdcf4cbbcecb76cd7f883d06a381" +
-"de76a44fffd063309a68da913efd63af5bd244e38ef4e927de06a36da555" +
-"9b56b238f2188c26caead3b7693e7da44b4f235d77a3bd7dad4b4f239d76" +
-"a28dd8d3a5a799de76a23bf0d8a28834d3a4136dc489b9f434d36e27aefd" +
-"ef351169a64127da88a7e6d2d350d75d6870c79a883454d4818bff634d44" +
-"9aeaa803fd8189053968aa7107ba1c334d449a2a6b36625bdeb93cd544a4" +
-"a9b22641bcf211604519ab0644edef71f87a66362c63b2d4453b3a0453af" +
-"33d35c93d6f7b8233d0edad9e568c7c237b11e070d76ddf29bb0c7adbf42" +
-"d06951cb6fc2a6e671d064472d3f4123f33868b2dd763f46ca7a0a664529" +
-"9ca177fbfa40f79db57a3ae2cc6366da7b13d6fcd7a916195b3f7070d9bc" +
-"ac09f58d6fd43f760b468b6fc21adf879bb905a3e94e5b5c232edc82d1e6" +
-"9bb086d7888f634fc168ba517bcfd299898834df756ba7f35d5b508ae6cb" +
-"78272cfed8e40dcf6a807a178c569ca74d9e8f98350ff1dc71a521321bf5" +
-"0d6e730c634d7ada206a679b63167b558536c85a37a0b96d8ecc014c8548" +
-"4b6ac4c6be76993980cd1c555a5223367408cb1cc0f4106992710b87b099" +
-"0a91d6d488d7ad1bc2b207b0b1634a931c659eaec3b60d605e05a35932e7" +
-"2336f159d8fdcc0df6c596b4a9cdd1c0373f162ddb5eeeb8cc4761f1a269" +
-"7d8edf622d0ebad3e668da63a5ec0e871607cdf332fb9c4d0802fd6793b6" +
-"b59f5d206a71d0c0212cfb9cbd68522731bb836816074df4266ecb6d58f6" +
-"0d98018c461ae59cb68de9d5ff1c1bc068a1a81d27eefd2b03185d1cc2e2" +
-"bd56e4cb00463befc21a91b0dc7c19c068aac175dcf4d161e72a3680d156" +
-"2ff3cedef8dd667b893fe76ee0b9018cc6eae50e61f16293cfc37ecbddbc" +
-"f8574791e69ae49fc18b8d4da4ed1fe76f9d5988345a947f0e6faad5717f" +
-"11b06ddb0e21edee73c4717cb28932f179c086e970d0fe3ec7e73271edd3" +
-"d5872143ab0e07dd2812e378b6de41ecf955d0568d1c3e3a5124c6f1628d" +
-"efaf840d5f71fc2f478fe69b849dcd6b6bd8f7f7023748079156f83df084" +
-"8e0fd611b19d45e0d65cba01a3157a27a109abbfd9713f0add16eb04d0b1" +
-"dbb02f11dba9b53afc77f086b801a33db6c3cfeb1afb89fdbdabf0cd78e3" +
-"a8d11ee378f3117bb228b00dffe93b68b4c87e91842d6a983cb51315d902" +
-"4f98e972c22aef760c0bc54bbee87ac22a8d5891de867c713712164715dd" +
-"8a15ea6dc81777266195743b0ac74bbeb833095b3d62e3452c5fdc1593c2" +
-"095bada158ac75f8c55c7f9ef61a5d178f58e96ec7fde2f18a0f1d23da6c" +
-"705efca42fb76a47d1d6a1f951742261c725cefbe2b762c57b1b9fe7cf7b" +
-"c192bbd8ea281eb1e2bd8dcfd3a3b437e8c48d588932b1d01bcf257a1b6e" +
-"bfe85099f8a64c0042bb1dc35999dfae3ca44326d775d589a56ebe74e7e9" +
-"da2056aa8a8b4d0802f7f296b2df59941abe2c904de706b1f3eaebc461b9" +
-"d8ce75377027f6edfb5886155787e74f1c0b3a697c5eae4eacb23a8c0fdd" +
-"7dd159a59e8925d689fde372d5e17d070175626e3ff179a9eaf0d2d26ca8" +
-"13f307b172cd8dcb7dd5212296ffc2f35ea951f058ef903b5227febe4ab3" +
-"63e763a99b2f3337702b96ff7511a5de4a89cfc58b3b16b179a941ac546f" +
-"dec40ddc8ad5466f0311ab8f07cbdc5dfb7547ccb443743bea8b97de0622" +
-"5657bcb40ea1744351eb1036d6edd03a84fa2236132ff8a14edcd7db8016" +
-"743bf43620d1fdf32a6ebeec47a8eb56ccbc0dc8aa137f77f3057546ecbd" +
-"275fd0bc3a517508b5d589aa43088fd8b9ea106a54e8eb22ac67034507b1" +
-"379e2cc3e69b1d9a1b50db2066f882fa0631c317d4368819bea0be41ccf0" +
-"05b50d62862fa844e233b163c3175434889d9bba0135dab79e28ace94eec" +
-"c4175542e5111b1f9f7efaf4e9f850730300000000000000000000000000" +
-"000000000000000000000000000000000000000000000000000000000000" +
-"00000000000000000000000000000000000068bff16c49effbfffc9fe5ff" +
-"698f41016fe3253f7dff9fd1f2ffb4c740c040c040c0046c15b3aa0ceedc" +
-"ae1b26ec8583b01f7db2f483e3b01f7cbef483ff2b608d1657e5d19ddb75" +
-"bdebd2bb61f9bcbd08fb9bcb7f7226600276778aab781a34f695dd7fbb35" +
-"ec770113b0861a25ec8628e407c7093ff82aa84d0802a05ffab173f76002" +
-"76a76ac49f4a55888135620d15a28009585dfefbd992b5d488c3b23b30a1" +
-"427cd2fa80f5968fc28e807522602b9f3d256bc471e20e0ca81167657b23" +
-"4d0ed860f94ffc216002965a23f64a55884159a9a3421430016b6cc0126b" +
-"c417e52ac4803d584b85286002d6dc808dcbd488e3943d987bf7564b8528" +
-"6002d6dc8095aa11a3943db8c8fb6b8b3a2a440113b0e6062c312c2fca55" +
-"88b9bbf0f1f24f8c054cc03a1db01235e23875174e8b5688010d150113b0" +
-"36072ca946bce895aa107393b95c217ed8123001eb74c012e3f24bb90a31" +
-"6716484d15a2800958930356b8461c67ecc3e9062a4401abd728d5ff4938" +
-"030ed3ff79ff6e06ac708d789a11b0680315a2806dcaa068f17327039658" +
-"233e2a5721660e4975558802d6ad800dd734d2f587c3dc3f55c9d933890b" +
-"9d2093cc80bd2854210e56fbf8b5062cfcef0b5858c03e1fd21ffdb083fb" +
-"3b93d9c9591cc7f3bf767fd63fcefdd5c3f403fbec60767276f56d83cfa2" +
-"e860b2d3af3160bdb8508d789a19b0a84885384fd8530f6e7ffc77d3a70f" +
-"d619b0efc7f9b3ab93e820efcf0b5860c01e67eca6fe24baba795a14dca7" +
-"d3c0226c78e3cfdc9a24f16eb25353c08ad588c39c5651af7c85387c363b" +
-"4bfea557efc6c3b5042cf9002c664f05acce80ed1c5fddbaeed611b0fe5e" +
-"9473f2465f4fb383e89b849321baa5648df8aa5c85985123e654883b7b27" +
-"d9bf4d0802f8ddd3ba03d69fa41f80abd952c2bfefe2840d5fdc3a0a0702" +
-"961eb061b45cd8541fb0fede55c8b384689cf5a0372e35a2f58abc7a729a" +
-"b781652ac47e5ebabe9eb5e33a03967b00a25b254491a33017b0d4803dbf" +
-"8aeb0f5860bcbe9c66412763a192b1408d38ccfd83bdc215e2f020f4c32f" +
-"86b505ec79c036fc388a09581501eb1f27eeac8a03b6b388eb52b68ff8aa" +
-"5c8598ba87532bc4e1acc8c7d9ab27603b1f8bff7901ab2060c38ff11a02" +
-"f63c8e371ab00235e269ee1f8c8a5588e143f75727c31a02167e006e8ca1" +
-"02b67ac0fa8b780d01fb2dde70c0c26bc4fc0a31a5c39f52210e3f16fe40" +
-"cb65e2aa01eb17b9a95d6c0b5875013b8ed710b0c2f95a541eb049e8b4c2" +
-"e57f781db68b8f922bc4de79bc7ac2560cd8b0607dfeb3805515b0ab780d" +
-"012b9caf595479c0926ac4455085f8e751d88e48ab10c72506e545afca80" +
-"0d0bdffffe2c6015052c5e43c08685cfaf41f5010bad119737f6c528a846" +
-"7c98da432c3184dd5e6760a5800d4bf4971e09587b02b6287e76d510b0c0" +
-"1a719250e75d8724f328f529739921ecd65254ab04ac4cbee28ba180b525" +
-"60c5cfaf411d01eb85b503972bc4a4ecfc115221fef9ed7f9519c27e1c24" +
-"5709585426dff1494fc05a12b01203581d014bfc9d3fe55788e3a4c5812f" +
-"422ac4ef53aa4665cef06945012bdbc03d10b076042cf96f5ebe9eec6edf" +
-"fb6c7bb43b3d3ebdf57375042ca9464d08027c1152216e85d488e9156272" +
-"043e7d9acf4f3f850e61e5039676037c7a38feb2ff479337e7a9b76102d6" +
-"82801d25fdfed1d2839addefc779be554fc0826ac4d3c4f3e6287f164846" +
-"85786b08bb3c9eecdefbf67fb677d3ceef1fc25f3e6089f5c3e5e1f6cd6d" +
-"1f9fa73c4e17b016042c6162c4bf927fc5e8cdf7dedbd1fc9b84b7fde7b7" +
-"84eeaca4d4f6022ac4901af1617640a2bf4feda56b4bcaf9fd43f84b072c" +
-"7102c77c10b409e3adbff77142486f1d05b3e9730336ff7665bd77afc280" +
-"05e7ebf3dfdc3fbffd6d7515be0fff32bf467c995ce7f5726bc4495685f8" +
-"3da1cb23f7d7b1f5f7c4e3d15b3d60891dc45f93f6fc49e66342ef83ad1c" +
-"b0cbfd7eeeaf2e13b0e54b7bf6f73dee3fa92d6083fc1a719152f8bccdab" +
-"114fb32ac4bf3e464abcbe7cea9c1ab16cc0923a1cff480ef971ea733c01" +
-"ab2060fbfd805f5d2660cb7fb2d83a4b55aee8925b233e4c3bc7f26ac484" +
-"56c28f091cc5e7a3ac4d4b1ac3fe583d608bb0f1eb4bc24e32ae3e02b65a" +
-"c0920e7e6d01fb636301cbad118fd2eabcbc1a31a142bcb5ccc5ef39cbcb" +
-"649768250336ce9d2272f380677c46015b2960e783ad3506eccf8d052cb7" +
-"465ca4b6c6a2ece754a7050be1840e4fe6e85a326051d8a14e8de32b01ab" +
-"22609783ad7506ecfb5cedb5072ce997dd7cdcf430fd2e649c35bee45788" +
-"01aeb306c172011b66dd5685ec9e85805511b0f1568d014bdac27f6e4d08" +
-"022a602fb377d7517a2730bb46ccaf10f31d656d5ab9808d836629670d61" +
-"3f09d8ea017bbf5567c0121f562e0e1e6c24603935e222e3e169668db87a" +
-"859878bff462c580bd2f7007967c15792160ab07ec51bd014b5d073075ad" +
-"d1fa0296b4317f5fd41f668dede38c64565121263daa9eae18b045ce1cfd" +
-"25efd38eb880950fd89f5bf506ec28e3d1f655c692beb504ec65d605e628" +
-"eb59712fe3141f075fb58a1dca57ab05ac97fdf03bc124ede410b0f2017b" +
-"5173c0f2a7929f640d66d5066c94f5b8699139bd2ea3468c8a5588fd074f" +
-"9f3d9bde7694b5bf4b052ce1684fb31da73ded13b0f2017b5073c002df86" +
-"3a3978daaf3f60893562488598d4c888d22bc4b47b9de1647612bec6d48a" +
-"012bf5a267f25f11b0d201bbd8aa3b6093e0a3194d8675072ca3463cca2e" +
-"a87aa9cfa9422bc49d8382ebb7ad18b06905017b20602b066c5e7bc00abd" +
-"7b727bf1e6aa03965423be0aa91093b6e445810ab13f39297c76af18b0a3" +
-"0a02f648c0560cd887fa033628f4cafcadaf20a8fadbe5526bc48779cf07" +
-"d36ac4a00af149998531560cd8db0a02f68b80ad18b069fd01dbda2e94b0" +
-"8b719d014bad118ff25a6e6935624085d83f2e75760b98800505ace018f6" +
-"c3f2e855072cb546ccab10536bc4fc0a7158725d7e0113b0b0806d0dde94" +
-"4d58e55f407c9d5c23e656886935627e8558365f4d08d813016b48c08e72" +
-"0aa571a141ec9ff505ec284d0802b946ccad10d36ac4dc0ab174be9a1030" +
-"4d8ea604ec7dee9d48a1883daa2d604935e234a4424cda965f022ac459bc" +
-"a18069d3b72d6059ef229f063c0c1abd09ce58545bc0926ac445488598d4" +
-"2089f22bc4151ef7ae18b0490501f3a0799d01cb7a55327016f1f6f8f8bc" +
-"d010567dc0926ac407b390697bcbbbe4a2975b21a61488a7afa7d3f14d93" +
-"ca03b6bbfcdfffefb8a02d015b63c02e0afde6d409af83db2b8d665dbdab" +
-"0f58628d18522126d68851ce5e4a1cc0e6a37eb192bc54c006e1134f4b9c" +
-"6702b662c07a71d6410d6c1d64d8de9dbe9e5fa63f0dab2d604935e25548" +
-"85985823e6558809ff2079f99bea0396f04123016b4cc0928abef40be0a2" +
-"70c0be8d6687f3ccdbeb1a0216348568103af8a575b6532f5329cb62d410" +
-"b0f7a97b55c01a10b0b338fc02388e4b06eccb8748ec2ffe525bc0426232" +
-"0fde27d91562caf7caae27609390495c02b6a98025dd260d0b0c60455e3a" +
-"dc4fddb01a0296542306a6e065c05cca9c87d3e75b6b0bd860b5832260f5" +
-"06ec6d1c7c01fc2d5e31600927c9abfa027654b2420c1afc9ee4fca90feb" +
-"0b58d2ff59f4caecb15eb16736021612b0497068eec72b076c9c7676bd2f" +
-"d26aa9ac469c17a89b333badef8377f86e0d017b19172e129f6f07de902f" +
-"046cc580259e868b8422f1fe555ec0a271de07495d00f86d75bde60235e2" +
-"b8f4e0f72170640e18c3570f58efba60c2faffefaf2f8f0d4d0802d8633d" +
-"015b2d608947272161cf73a73b8de378b193fd4126691b7654a0d5525d8d" +
-"38283df88df346b03fc2db442b072cf9839ea4dd496f0d3fa65c439346ee" +
-"a980ad16b0b43791f77ef8473b51e07cc245e6287692364e8d736f736aa8" +
-"11e7e507bf5ede8d6cf2d3fac419c1ab076c90b88d2987a2bf77955aa524" +
-"54ea1743015b2d606973d916b3bf1681eaefec4501b39d1e7fffb9d4a730" +
-"bfa5fef4c3a4fb9c9bf7093b653acfd7252bc4dcc1ef43fe3f4fba3cf43f" +
-"c6b5046cebf7383462dfe295dc0839ca1b099f8f05ac68c07a1927d2d5d9" +
-"d959de0dffb780cd12b2f9e3e53be985dfcc8dd81b7e8f57a99b81b7252b" +
-"c4dcc16f9c5ff9250c10c38f714d01eb5da75e259fded88e0793e8e68df4" +
-"492fa0057323a6fdff8e2a28dcef5cc08a7d53726ac06ecf373f3998ecfc" +
-"7d6cfb3b9328732848de88ab683a9d1ebcbb2a7933302a5b21e60d7ebd80" +
-"03b494b09d455c57c09293f17d2746b3d96c169de53742522eb657ef0ea6" +
-"d3d9d7703e10b0a2011b5512b0e4f7a1cecea2283a39bbca1d0af29fed7e" +
-"2cf15ce7ba64859853237e08cbe3cd857dfacfa29a5e57f9ea4da963372b" +
-"7eb19d0a58d180ad38843d4a1cc0c29c0715aae56727bc2d320c855f7596" +
-"a399727d880e9eedececec3c3b88aef2df28582960bdf35207602ff0863c" +
-"e85d0b01ab65087b94318015e876e7a7bcf8372d647eb20fe51b2483a023" +
-"14aa9280155d714d0802282561bdeb3aae73773d60694da802011b5e97f9" +
-"d179a1945f146f73649d2fe3d2835fd2cddbf1a603b6b55dea10dcfe16b7" +
-"fc523d12b0c2012b595fdc08d86fa50ac441b142b5c4dc8eb7252bc4ccc0" +
-"27457370bde980954cd83f0a0f613d012b7c6bba7dbd62c0ca2ca97479bf" +
-"e0295ae2da392a5b21669d6983228f1397ae2ad77505ac5495f88fe29f63" +
-"2a60c5774ae86dd87f0e13035666c997cb27f90f9352cfb6d56bc471e9c1" +
-"2fa5bd1fd8c71b9fd516b0ad41d185f12fff51e273440256e2aab31b3486" +
-"cdfbd3c480bd2c9eaff3fb4bdbb05fc3b5f37de9426754309abda0b3fb70" +
-"abc68005ecc2bc6310f2391e0958895333a4be384c5a85efcbee1e15ad4e" +
-"e6497556dee951a2453c2e5921660c7e6913407a018d8e375bf506ac5099" +
-"78dc2f77a578256065aefdb9eb5e5ffeba951ab0adadf1bc4869f26bf236" +
-"4c2abf76a6c524604e5d547802c87e40be6a0ed8d6d6243062e74fca7695" +
-"2f7a0256aab8ca5e94f7eb98334d3fe907a10b8e5eeef7cb8da39725a69a" +
-"46a55b61e3e2d1ccd9fc2f9795ba03b635d83f5fe918e49e09ff190858c9" +
-"bb97f41d3bff6b11b269e6a8b21b90b193cc439b756c67fd12fb6e5cb242" +
-"4c1dfc06652f52b3af3f597bc002ca89f92467570ef62fd3a3a9c9b1427b" +
-"20f1d05cbeffbec6df34af6c1b4d3396418ce7fba3fc4d382e7ec92d1a93" +
-"71e9c16f9edb2e4adefcc36fc15c47c03eafe1354d29015fe5187cfe05a7" +
-"a5a2d94abd84d58e0785fef9fdf03fd6df3dbc1991cbd3c39b0bd4de0fd9" +
-"90edcf8bfade8ad9e5e9ebc9a85f6a13e24fc79351e99db79bb45674d05d" +
-"c420e927ef17dffccb1f4ee9a5edf9fb2df0ffcadad0ff4a5df13ab50f3a" +
-"b97d143e1d1fee86076430fe7169e64faf3b99ae8de86f8fbe1cc2d1bd15" +
-"7ec7bdd1d75f32de1ddd2b7e64faa36f9bd0caa3fa7df3b7fb9b3e92bb7f" +
-"6d48a963f9d741dc5de54c00000000000000000000000000000000000000" +
-"000000000000000000000000000000000000000000000000000000000000" +
-"000000000000000000000000000000000000000000000000000000000000" +
-"00000000000000000000000000000000000000000000000000008066fbff" +
-"ddd1848d4adc88950000000049454e44ae4260826821c00f209b6ada5edb" +
-"42c77fd2bc64ad650ae38314c8f451f3e36d80bc8e26f132cb00000000"
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bitcoindiamond/TestBitcoinDiamondAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bitcoindiamond/TestBitcoinDiamondAddress.kt
index d8f768eeaec..497b2d6dedc 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bitcoindiamond/TestBitcoinDiamondAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bitcoindiamond/TestBitcoinDiamondAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.bitcoindiamond
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bitcoindiamond/TestBitcoinDiamondSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bitcoindiamond/TestBitcoinDiamondSigner.kt
index eea39e3a269..3bbbd9a77fd 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bitcoindiamond/TestBitcoinDiamondSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bitcoindiamond/TestBitcoinDiamondSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.bitcoindiamond
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bluzelle/TestBluzelleAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bluzelle/TestBluzelleAddress.kt
index 99baa611f71..d8eb3424893 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bluzelle/TestBluzelleAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bluzelle/TestBluzelleAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2021 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.bluzelle
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bluzelle/TestBluzelleSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bluzelle/TestBluzelleSigner.kt
index ba4d7e99238..bf40f0dcc67 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bluzelle/TestBluzelleSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/bluzelle/TestBluzelleSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2021 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.bluzelle
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cardano/TestCardanoAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cardano/TestCardanoAddress.kt
index 6ac0f1c4d63..a505e201176 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cardano/TestCardanoAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cardano/TestCardanoAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2020 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.cardano
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cardano/TestCardanoSigning.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cardano/TestCardanoSigning.kt
index 2e56bab0838..d9450e9881c 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cardano/TestCardanoSigning.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cardano/TestCardanoSigning.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.cardano
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/confluxespace/TestConfluxeSpaceAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/confluxespace/TestConfluxeSpaceAddress.kt
index 5186e4730ea..25d5ae1c81e 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/confluxespace/TestConfluxeSpaceAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/confluxespace/TestConfluxeSpaceAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.confluxespace
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cosmos/TestCosmosTransactions.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cosmos/TestCosmosTransactions.kt
index ed829d1ce76..4de24f9b60f 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cosmos/TestCosmosTransactions.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cosmos/TestCosmosTransactions.kt
@@ -67,7 +67,7 @@ class TestCosmosTransactions {
assertEquals(
output.serialized,
- "{\"mode\":\"BROADCAST_MODE_BLOCK\",\"tx_bytes\":\"CvgBCvUBCh4vY29zbW9zLmF1dGh6LnYxYmV0YTEuTXNnR3JhbnQS0gEKLWNvc21vczEzazBxMGw3bGcya3IzMmt2dDdseTIzNnBwbGR5OHY5ZHp3aDNnZBItY29zbW9zMWZzN2x1MjhoeDVtOWFrbTdycDBjMjQyMmNuOHIyZjdndXJ1amhmGnIKaAoqL2Nvc21vcy5zdGFraW5nLnYxYmV0YTEuU3Rha2VBdXRob3JpemF0aW9uEjoSNgo0Y29zbW9zdmFsb3BlcjFnanR2bHk5bGVsNnpza3Z3dHZsZzV2aHdwdTljOXdhdzdzeHp3eCABEgYI4LD6pgYSZwpQCkYKHy9jb3Ntb3MuY3J5cHRvLnNlY3AyNTZrMS5QdWJLZXkSIwohA/fcQw1hCVUx904t+kCXTiiziaLIY8lyssu1ENfzaN1KEgQKAggBGAUSEwoNCgV1YXRvbRIEMjQxOBCp8wUaQIFyfuijGKf87Hz61ZqxasfLI1PZnNge4RDq/tRyB/tZI6p80iGRqHecoV6+84EQkc9GTlNRQOSlApRCsivT9XI=\"}"
+ "{\"mode\":\"BROADCAST_MODE_BLOCK\",\"tx_bytes\":\"CvgBCvUBCh4vY29zbW9zLmF1dGh6LnYxYmV0YTEuTXNnR3JhbnQS0gEKLWNvc21vczEzazBxMGw3bGcya3IzMmt2dDdseTIzNnBwbGR5OHY5ZHp3aDNnZBItY29zbW9zMWZzN2x1MjhoeDVtOWFrbTdycDBjMjQyMmNuOHIyZjdndXJ1amhmGnIKaAoqL2Nvc21vcy5zdGFraW5nLnYxYmV0YTEuU3Rha2VBdXRob3JpemF0aW9uEjogARI2CjRjb3Ntb3N2YWxvcGVyMWdqdHZseTlsZWw2enNrdnd0dmxnNXZod3B1OWM5d2F3N3N4end4EgYI4LD6pgYSZwpQCkYKHy9jb3Ntb3MuY3J5cHRvLnNlY3AyNTZrMS5QdWJLZXkSIwohA/fcQw1hCVUx904t+kCXTiiziaLIY8lyssu1ENfzaN1KEgQKAggBGAUSEwoNCgV1YXRvbRIEMjQxOBCp8wUaQEAN1nIfDawlHnep2bNEm14w+g7tYybJJT3htcGVS6s9D7va3ed1OUEIk9LZoc3G//VenJ+KLw26SRVBaRukgVI=\"}"
)
assertEquals(output.errorMessage, "")
}
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cryptoorg/TestCryptoorgAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cryptoorg/TestCryptoorgAddress.kt
index 52e06a041d8..214c391624d 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cryptoorg/TestCryptoorgAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cryptoorg/TestCryptoorgAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2021 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.cryptoorg
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cryptoorg/TestCryptoorgSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cryptoorg/TestCryptoorgSigner.kt
index 25197f82a53..74090e73a29 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cryptoorg/TestCryptoorgSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/cryptoorg/TestCryptoorgSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2021 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.cryptoorg
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/dydx/TestDydxAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/dydx/TestDydxAddress.kt
new file mode 100644
index 00000000000..408f8fb4ae3
--- /dev/null
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/dydx/TestDydxAddress.kt
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+package com.trustwallet.core.app.blockchains.dydx
+
+import com.trustwallet.core.app.utils.toHexByteArray
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import wallet.core.jni.*
+
+class TestDydxAddress {
+
+ init {
+ System.loadLibrary("TrustWalletCore")
+ }
+
+ @Test
+ fun testAddress() {
+ val key = PrivateKey("a498a9ee41af9bab5ef2a8be63d5c970135c3c109e70efc8c56c534e6636b433".toHexByteArray())
+ val pubKey = key.getPublicKeySecp256k1(true)
+ val address = AnyAddress(pubKey, CoinType.DYDX)
+ val expected = AnyAddress("dydx1mry47pkga5tdswtluy0m8teslpalkdq0hc72uz", CoinType.DYDX)
+
+ assertEquals(address.description(), expected.description())
+ }
+}
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/ethereum/TestEthereumMessageSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/ethereum/TestEthereumMessageSigner.kt
index 6b86f698769..6245751d124 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/ethereum/TestEthereumMessageSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/ethereum/TestEthereumMessageSigner.kt
@@ -36,6 +36,17 @@ class TestEthereumMessageSigner {
assertTrue(EthereumMessageSigner.verifyMessage(publicKey, msg, signature))
}
+ @Test
+ fun testEthereumSignAndVerifyMessageLegacyHex() {
+ val data = Numeric.hexStringToByteArray("9066aa168c379a403becb235c15e7129c133c244e56a757ab07bc369288bcab0")
+ val privateKey = PrivateKey(data)
+ val publicKey = privateKey.getPublicKey(CoinType.ETHEREUM)
+ val msg = "0xc0a96273d5c3fbe4d4000491f08daef9c17f88df846c1d6f57eb5f33c1fbd035"
+ val signature = EthereumMessageSigner.signMessage(privateKey, msg)
+ assertEquals(signature, "b18a666ad08bf9bfcd39920b26b5a5d1486b67b45119810b3c7bda22e41e5c4c1bfbe0c932f6c14df4947a18ba310831a37b7307d724a3ac2a4935b99d7075141b");
+ assertTrue(EthereumMessageSigner.verifyMessage(publicKey, msg, signature))
+ }
+
@Test
fun testEthereumSignAndVerifyMessage712Legacy() {
val data = Numeric.hexStringToByteArray("03a9ca895dca1623c7dfd69693f7b4111f5d819d2e145536e0b03c136025a25d")
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/everscale/TestEverscaleAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/everscale/TestEverscaleAddress.kt
index b09cfaff057..5922fa9f191 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/everscale/TestEverscaleAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/everscale/TestEverscaleAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.everscale
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/everscale/TestEverscaleSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/everscale/TestEverscaleSigner.kt
index cb1d7266f92..a07ba7c46b4 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/everscale/TestEverscaleSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/everscale/TestEverscaleSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.everscale
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/fio/TestFIOAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/fio/TestFIOAddress.kt
index 6b6461e78d1..4a9bef5fedb 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/fio/TestFIOAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/fio/TestFIOAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2020 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.fio
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/fio/TestFIOSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/fio/TestFIOSigner.kt
index 7037706254b..6992aa0b9f8 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/fio/TestFIOSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/fio/TestFIOSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2020 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.fio
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/greenfield/TestGreenfieldSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/greenfield/TestGreenfieldSigner.kt
index 757bdaea895..cd7caf5e2ac 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/greenfield/TestGreenfieldSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/greenfield/TestGreenfieldSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.greenfield
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/hedera/TestHederaAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/hedera/TestHederaAddress.kt
index be92015f825..925c36c7851 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/hedera/TestHederaAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/hedera/TestHederaAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.hedera
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/hedera/TestHederaSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/hedera/TestHederaSigner.kt
index dec11a37bcb..c01f813e2d0 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/hedera/TestHederaSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/hedera/TestHederaSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.hedera
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/internetcomputer/TestInternetComputerAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/internetcomputer/TestInternetComputerAddress.kt
new file mode 100644
index 00000000000..2861aea3a4a
--- /dev/null
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/internetcomputer/TestInternetComputerAddress.kt
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+package com.trustwallet.core.app.blockchains.internetcomputer
+
+import com.trustwallet.core.app.utils.toHex
+import com.trustwallet.core.app.utils.toHexByteArray
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import wallet.core.jni.*
+
+class TestInternetComputerAddress {
+
+ init {
+ System.loadLibrary("TrustWalletCore")
+ }
+
+ @Test
+ fun testAddress() {
+ val key = PrivateKey("ee42eaada903e20ef6e5069f0428d552475c1ea7ed940842da6448f6ef9d48e7".toHexByteArray())
+ val pubkey = key.getPublicKeySecp256k1(false);
+ val address = AnyAddress(pubkey, CoinType.INTERNETCOMPUTER)
+ val expected = AnyAddress("2f25874478d06cf68b9833524a6390d0ba69c566b02f46626979a3d6a4153211", CoinType.INTERNETCOMPUTER)
+
+ assertEquals(pubkey.data().toHex(), "0x048542e6fb4b17d6dfcac3948fe412c00d626728815ee7cc70509603f1bc92128a6e7548f3432d6248bc49ff44a1e50f6389238468d17f7d7024de5be9b181dbc8")
+ assertEquals(address.description(), expected.description())
+ }
+}
\ No newline at end of file
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/internetcomputer/TestInternetComputerSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/internetcomputer/TestInternetComputerSigner.kt
new file mode 100644
index 00000000000..d3e97de972e
--- /dev/null
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/internetcomputer/TestInternetComputerSigner.kt
@@ -0,0 +1,79 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+package com.trustwallet.core.app.blockchains.internetcomputer
+
+import com.google.protobuf.ByteString
+import com.trustwallet.core.app.utils.Numeric
+import com.trustwallet.core.app.utils.toHex
+import com.trustwallet.core.app.utils.toHexByteArray
+import com.trustwallet.core.app.utils.toHexBytes
+import com.trustwallet.core.app.utils.toHexBytesInByteString
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import wallet.core.java.AnySigner
+import wallet.core.jni.*
+import wallet.core.jni.proto.InternetComputer
+import wallet.core.jni.proto.InternetComputer.SigningOutput
+
+class TestInternetComputerSigner {
+
+ init {
+ System.loadLibrary("TrustWalletCore")
+ }
+
+ @Test
+ fun InternetComputerTransactionSigning() {
+ val key = PrivateKey("227102911bb99ce7285a55f952800912b7d22ebeeeee59d77fc33a5d7c7080be".toHexByteArray())
+
+ val input = InternetComputer.SigningInput.newBuilder()
+ .setTransaction(InternetComputer.Transaction.newBuilder().apply {
+ transfer = InternetComputer.Transaction.Transfer.newBuilder().apply {
+ toAccountIdentifier = "943d12e762f43806782f524b8f90297298a6d79e4749b41b585ec427409c826a"
+ amount = 100000000
+ memo = 0
+ currentTimestampNanos = 1691709940000000000
+ }.build()
+ }.build())
+ .setPrivateKey(ByteString.copyFrom(key.data()))
+ val output = AnySigner.sign(input.build(), CoinType.INTERNETCOMPUTER, SigningOutput.parser())
+ assertEquals(output.signedTransaction.toByteArray().toHex(), "0x81826b5452414e53414354494f4e81a266757064617465a367636f6e74656e74a66c726571756573745f747970656463616c6c6e696e67726573735f6578706972791b177a297215cfe8006673656e646572581d971cd2ddeecd1cf1b28be914d7a5c43441f6296f1f9966a7c8aff68d026b63616e69737465725f69644a000000000000000201016b6d6574686f645f6e616d656773656e645f706263617267583b0a0012070a050880c2d72f2a220a20943d12e762f43806782f524b8f90297298a6d79e4749b41b585ec427409c826a3a0a088090caa5a3a78abd176d73656e6465725f7075626b65799858183018561830100607182a1886184818ce183d02010605182b188104000a0318420004183d18ab183a182118a81838184d184c187e1852188a187e18dc18d8184418ea18cd18c5189518ac188518b518bc181d188515186318bc18e618ab18d2184318d3187c184f18cd18f018de189b18b5181918dd18ef1889187218e71518c40418d4189718881843187218c611182e18cc18e6186b182118630218356a73656e6465725f736967984013186f18b9181c189818b318a8186518b2186118d418971618b1187d18eb185818e01826182f1873183b185018cb185d18ef18d81839186418b3183218da1824182f184e18a01880182718c0189018c918a018fd18c418d9189e189818b318ef1874183b185118e118a51864185918e718ed18c71889186c1822182318ca6a726561645f7374617465a367636f6e74656e74a46c726571756573745f747970656a726561645f73746174656e696e67726573735f6578706972791b177a297215cfe8006673656e646572581d971cd2ddeecd1cf1b28be914d7a5c43441f6296f1f9966a7c8aff68d0265706174687381824e726571756573745f7374617475735820e8fbc2d5b0bf837b3a369249143e50d4476faafb2dd620e4e982586a51ebcf1e6d73656e6465725f7075626b65799858183018561830100607182a1886184818ce183d02010605182b188104000a0318420004183d18ab183a182118a81838184d184c187e1852188a187e18dc18d8184418ea18cd18c5189518ac188518b518bc181d188515186318bc18e618ab18d2184318d3187c184f18cd18f018de189b18b5181918dd18ef1889187218e71518c40418d4189718881843187218c611182e18cc18e6186b182118630218356a73656e6465725f7369679840182d182718201888188618ce187f0c182a187a18d718e818df18fb18d318d41118a5186a184b18341842185318d718e618e8187a1828186c186a183618461418f3183318bd18a618a718bc18d918c818b7189d186e1865188418ff18fd18e418e9187f181b18d705184818b21872187818d6181c161833184318a2")
+ }
+
+ @Test
+ fun InternetComputerTransactionSigningWithInvalidToAccountIdentifier() {
+ val key = PrivateKey("227102911bb99ce7285a55f952800912b7d22ebeeeee59d77fc33a5d7c7080be".toHexByteArray())
+
+ val input = InternetComputer.SigningInput.newBuilder()
+ .setTransaction(InternetComputer.Transaction.newBuilder().apply {
+ transfer = InternetComputer.Transaction.Transfer.newBuilder().apply {
+ toAccountIdentifier = "643d12e762f43806782f524b8f90297298a6d79e4749b41b585ec427409c826b"
+ amount = 100000000
+ memo = 0
+ currentTimestampNanos = 1691709940000000000
+ }.build()
+ }.build())
+ .setPrivateKey(ByteString.copyFrom(key.data()))
+ val output = AnySigner.sign(input.build(), CoinType.INTERNETCOMPUTER, SigningOutput.parser())
+ assertEquals(output.error.number, 16)
+ }
+
+ @Test
+ fun InternetComputerTransactionSigningWithInvalidAmount() {
+ val key = PrivateKey("227102911bb99ce7285a55f952800912b7d22ebeeeee59d77fc33a5d7c7080be".toHexByteArray())
+
+ val input = InternetComputer.SigningInput.newBuilder()
+ .setTransaction(InternetComputer.Transaction.newBuilder().apply {
+ transfer = InternetComputer.Transaction.Transfer.newBuilder().apply {
+ toAccountIdentifier = "943d12e762f43806782f524b8f90297298a6d79e4749b41b585ec427409c826a"
+ amount = 0
+ memo = 0
+ currentTimestampNanos = 1691709940000000000
+ }.build()
+ }.build())
+ .setPrivateKey(ByteString.copyFrom(key.data()))
+ val output = AnySigner.sign(input.build(), CoinType.INTERNETCOMPUTER, SigningOutput.parser())
+ assertEquals(output.error.number, 23)
+ }
+}
\ No newline at end of file
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/juno/TestJunoAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/juno/TestJunoAddress.kt
index eb9edcfb89d..39c7022b743 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/juno/TestJunoAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/juno/TestJunoAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.juno
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/kcc/TestKuCoinCommunityChainAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/kcc/TestKuCoinCommunityChainAddress.kt
index 0d2fe4a7446..9a2ecfc3811 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/kcc/TestKuCoinCommunityChainAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/kcc/TestKuCoinCommunityChainAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2021 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.kcc
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/kusama/TestKusamaAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/kusama/TestKusamaAddress.kt
index 23f6b258315..39fc302d0ff 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/kusama/TestKusamaAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/kusama/TestKusamaAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2020 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.kusama
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/kusama/TestKusamaSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/kusama/TestKusamaSigner.kt
index 388a38bd150..7bec37b4f0e 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/kusama/TestKusamaSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/kusama/TestKusamaSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2020 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.polkadot
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/multiversx/TestMultiversXAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/multiversx/TestMultiversXAddress.kt
index 6cb38fef175..ab3b1ec2483 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/multiversx/TestMultiversXAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/multiversx/TestMultiversXAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2020 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.multiversx
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/multiversx/TestMultiversXSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/multiversx/TestMultiversXSigner.kt
index fc6bd12637f..811c8a6b76f 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/multiversx/TestMultiversXSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/multiversx/TestMultiversXSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2020 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.multiversx
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nativeinjective/TestNativeInjectiveAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nativeinjective/TestNativeInjectiveAddress.kt
index fc0a81474eb..8c70eaf1dfe 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nativeinjective/TestNativeInjectiveAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nativeinjective/TestNativeInjectiveAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.nativeinjective
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nativeinjective/TestNativeInjectiveSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nativeinjective/TestNativeInjectiveSigner.kt
index 8892bac9d7f..b1295e2d823 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nativeinjective/TestNativeInjectiveSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nativeinjective/TestNativeInjectiveSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.nativeinjective
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nativezetachain/TestNativeZetaChainAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nativezetachain/TestNativeZetaChainAddress.kt
new file mode 100644
index 00000000000..93a2fbd2a3a
--- /dev/null
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nativezetachain/TestNativeZetaChainAddress.kt
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+package com.trustwallet.core.app.blockchains.nativezetachain
+
+import com.trustwallet.core.app.utils.toHex
+import com.trustwallet.core.app.utils.toHexByteArray
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import wallet.core.jni.*
+
+class TestNativeZetaChainAddress {
+
+ init {
+ System.loadLibrary("TrustWalletCore")
+ }
+
+ @Test
+ fun testAddress() {
+ val key = PrivateKey("8d2a3bd62d300a148c89dc8635f87b7a24a951bd1c4e78675fe40e1a640d46ed".toHexByteArray())
+ val pubKey = key.getPublicKeySecp256k1(false)
+ val address = AnyAddress(pubKey, CoinType.NATIVEZETACHAIN)
+ val expected = AnyAddress("zeta14py36sx57ud82t9yrks9z6hdsrpn5x6kmxs0ne", CoinType.NATIVEZETACHAIN)
+
+ assertEquals(address.description(), expected.description())
+ }
+}
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nativezetachain/TestNativeZetaChainSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nativezetachain/TestNativeZetaChainSigner.kt
new file mode 100644
index 00000000000..2dd00e4f2f8
--- /dev/null
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nativezetachain/TestNativeZetaChainSigner.kt
@@ -0,0 +1,71 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+package com.trustwallet.core.app.blockchains.nativezetachain
+
+import com.google.protobuf.ByteString
+import com.trustwallet.core.app.utils.toHexByteArray
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import wallet.core.java.AnySigner
+import wallet.core.jni.AnyAddress
+import wallet.core.jni.CoinType
+import wallet.core.jni.PrivateKey
+import wallet.core.jni.proto.Cosmos
+
+class TestNativeZetaChainSigner {
+
+ init {
+ System.loadLibrary("TrustWalletCore")
+ }
+
+ @Test
+ fun NativeZetaChainTransactionSigning() {
+ val key = PrivateKey("8d2a3bd62d300a148c89dc8635f87b7a24a951bd1c4e78675fe40e1a640d46ed".toHexByteArray())
+ val publicKey = key.getPublicKeySecp256k1(false)
+ val from = AnyAddress(publicKey, CoinType.NATIVEZETACHAIN).description()
+
+ val transferAmount = Cosmos.Amount.newBuilder().apply {
+ // 0.3 ZETA
+ amount = "300000000000000000"
+ denom = "azeta"
+ }.build()
+
+ val message = Cosmos.Message.newBuilder().apply {
+ sendCoinsMessage = Cosmos.Message.Send.newBuilder().apply {
+ fromAddress = from
+ toAddress = "zeta1cscf4ldnkkz7f0wpveur6dpd0d6p2zxnsuu70y"
+ addAllAmounts(listOf(transferAmount))
+ }.build()
+ }.build()
+
+ val transferFee = Cosmos.Fee.newBuilder().apply {
+ gas = 200000
+ }.build()
+
+ val signingInput = Cosmos.SigningInput.newBuilder().apply {
+ signingMode = Cosmos.SigningMode.Protobuf
+ accountNumber = 2726346
+ chainId = "athens_7001-1"
+ sequence = 2
+ fee = transferFee
+ privateKey = ByteString.copyFrom(key.data())
+ txHasher = Cosmos.TxHasher.Keccak256
+ signerInfo = Cosmos.SignerInfo.newBuilder().apply {
+ // Zetachain requires a compressed public key to sign a transaction,
+ // however an uncompressed public key is used to generate address.
+ publicKeyType = Cosmos.SignerPublicKeyType.Secp256k1
+ jsonType = "ethermint/PubKeyEthSecp256k1"
+ protobufType = "/ethermint.crypto.v1.ethsecp256k1.PubKey"
+ }.build()
+ addAllMessages(listOf(message))
+ }.build()
+
+ val output = AnySigner.sign(signingInput, CoinType.NATIVEZETACHAIN, Cosmos.SigningOutput.parser())
+
+ // Successfully broadcasted (testnet):
+ // https://explorer.zetachain.com/cosmos/tx/A2FC8816657856ED274C4418C3CAEAEE645561275F6C63AB5F8B1DCFB37341A0
+ assertEquals(output.serialized, "{\"mode\":\"BROADCAST_MODE_BLOCK\",\"tx_bytes\":\"CpoBCpcBChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEncKK3pldGExNHB5MzZzeDU3dWQ4MnQ5eXJrczl6Nmhkc3JwbjV4NmtteHMwbmUSK3pldGExY3NjZjRsZG5ra3o3ZjB3cHZldXI2ZHBkMGQ2cDJ6eG5zdXU3MHkaGwoFYXpldGESEjMwMDAwMDAwMDAwMDAwMDAwMBJhClkKTwooL2V0aGVybWludC5jcnlwdG8udjEuZXRoc2VjcDI1NmsxLlB1YktleRIjCiECho5+FjRBfbKt/Z/jggW/oP6gGJin/TBWXRP3BWo3wGUSBAoCCAEYAhIEEMCaDBpAgGvqca0w2N9wnHnnxS9HiVud4aQ9lNCumzgNIW6wOR4kvPScacGS1G3kwCw7wyI2NJL8M1eVYjafFIt2FpKl3w==\"}")
+ }
+}
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/neo/TestsNEOAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/neo/TestsNEOAddress.kt
index dd1ef2e86dc..8eb3f6ac165 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/neo/TestsNEOAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/neo/TestsNEOAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2020 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.neo
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nervos/TestNervosAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nervos/TestNervosAddress.kt
index 64f1c492ada..f77ce3858cd 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nervos/TestNervosAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nervos/TestNervosAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.nervos
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nervos/TestNervosSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nervos/TestNervosSigner.kt
index 3d0a149e5ae..d556f883f17 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nervos/TestNervosSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/nervos/TestNervosSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2021 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.nervos
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/oasis/TestOasisAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/oasis/TestOasisAddress.kt
index 2cdc8dfcd4a..00b315bc40a 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/oasis/TestOasisAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/oasis/TestOasisAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2020 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.oasis
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/oasis/TestOasisSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/oasis/TestOasisSigner.kt
index f9962ebb13c..ef3ad829694 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/oasis/TestOasisSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/oasis/TestOasisSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2020 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.oasis
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/osmosis/TestOsmosisAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/osmosis/TestOsmosisAddress.kt
index 1d881bbdef1..88b33d1b9fd 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/osmosis/TestOsmosisAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/osmosis/TestOsmosisAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2021 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.osmosis
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/osmosis/TestOsmosisSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/osmosis/TestOsmosisSigner.kt
index e8498fb0ab6..679583594f7 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/osmosis/TestOsmosisSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/osmosis/TestOsmosisSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2021 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.osmosis
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/polkadot/TestPolkadotAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/polkadot/TestPolkadotAddress.kt
index 82477b4bbbe..7ab39ef55f5 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/polkadot/TestPolkadotAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/polkadot/TestPolkadotAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2020 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.Polkadot
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/polkadot/TestPolkadotSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/polkadot/TestPolkadotSigner.kt
index 9da312ca3ea..da571e5ca1a 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/polkadot/TestPolkadotSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/polkadot/TestPolkadotSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2020 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.polkadot
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/polygon/TestPolygonAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/polygon/TestPolygonAddress.kt
index f6b21b1780c..ab807796d5a 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/polygon/TestPolygonAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/polygon/TestPolygonAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2020 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.polygon
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/scroll/TestScrollAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/scroll/TestScrollAddress.kt
index da490466d1c..23d77ff4ccb 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/scroll/TestScrollAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/scroll/TestScrollAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.scroll
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/secret/TestSecretAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/secret/TestSecretAddress.kt
index 26d66ee5883..5315c57c9ad 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/secret/TestSecretAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/secret/TestSecretAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.secret
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/secret/TestSecretSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/secret/TestSecretSigner.kt
index d9286ccd4f2..3f1ef6330a0 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/secret/TestSecretSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/secret/TestSecretSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.secret
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/smartbitcoincash/TestSmartBitcoinCashAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/smartbitcoincash/TestSmartBitcoinCashAddress.kt
index 95acfd23453..64c33ba9c58 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/smartbitcoincash/TestSmartBitcoinCashAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/smartbitcoincash/TestSmartBitcoinCashAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2021 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.smartbitcoincash
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/smartchain/TestBinanceSmartChainAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/smartchain/TestBinanceSmartChainAddress.kt
index 142cbc0babe..a9a83132c36 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/smartchain/TestBinanceSmartChainAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/smartchain/TestBinanceSmartChainAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2020 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.binancesmartchain
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/solana/TestSolanaTransaction.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/solana/TestSolanaTransaction.kt
new file mode 100644
index 00000000000..c2f8a3d461c
--- /dev/null
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/solana/TestSolanaTransaction.kt
@@ -0,0 +1,84 @@
+package com.trustwallet.core.app.blockchains.solana
+
+import com.google.protobuf.ByteString
+import com.trustwallet.core.app.utils.toHex
+import com.trustwallet.core.app.utils.toHexByteArray
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import wallet.core.jni.Base58
+import wallet.core.java.AnySigner
+import wallet.core.jni.Base64
+import wallet.core.jni.CoinType
+import wallet.core.jni.CoinType.SOLANA
+import wallet.core.jni.SolanaTransaction
+import wallet.core.jni.DataVector
+import wallet.core.jni.TransactionDecoder
+import wallet.core.jni.proto.Common.SigningError
+import wallet.core.jni.proto.Solana
+import wallet.core.jni.proto.Solana.DecodingTransactionOutput
+import wallet.core.jni.proto.Solana.SigningInput
+import wallet.core.jni.proto.Solana.SigningOutput
+
+class TestSolanaTransaction {
+
+ init {
+ System.loadLibrary("TrustWalletCore")
+ }
+
+ @Test
+ fun testUpdateBlockhashAndSign() {
+ val encodedTx = "AnQTYwZpkm3fs4SdLxnV6gQj3hSLsyacpxDdLMALYWObm722f79IfYFTbZeFK9xHtMumiDOWAM2hHQP4r/GtbARpncaXgOVFv7OgbRLMbuCEJHO1qwcdCbtH72VzyzU8yw9sqqHIAaCUE8xaQTgT6Z5IyZfeyMe2QGJIfOjz65UPAgACBssq8Im1alV3N7wXGODL8jLPWwLhTuCqfGZ1Iz9fb5tXlMOJD6jUvASrKmdtLK/qXNyJns2Vqcvlk+nfJYdZaFpIWiT/tAcEYbttfxyLdYxrLckAKdVRtf1OrNgtZeMCII4SAn6SYaaidrX/AN3s/aVn/zrlEKW0cEUIatHVDKtXO0Qss5EhV/E6kz0BNCgtAytf/s0Botvxt3kGCN8ALqcG3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8Aqe6sdLXiXSDILEtzckCjkjchiSf6zVGpMYiAE5BE2IqHAQUEAgQDAQoMoA8AAAAAAAAG"
+ val newBlockhash = "CyPYVsYWrsJNfVpi8aazu7WsrswNFuDd385z6GNoBGUg"
+
+ val myPrivateKey = "7f0932159226ddec9e1a4b0b8fe7cdc135049f9e549a867d722aa720dd64f32e".toHexByteArray()
+ val feePayerPrivateKey = "4b9d6f57d28b06cbfa1d4cc710953e62d653caf853415c56ffd9d150acdeb7f7".toHexByteArray()
+
+ val privateKeys = DataVector()
+ privateKeys.add(myPrivateKey)
+ privateKeys.add(feePayerPrivateKey)
+
+ val outputData = SolanaTransaction.updateBlockhashAndSign(encodedTx, newBlockhash, privateKeys)
+ val output = SigningOutput.parseFrom(outputData)
+
+ assertEquals(output.error, SigningError.OK)
+ val expectedString = "Ajzc/Tke0CG8Cew5qFa6xZI/7Ya3DN0M8Ige6tKPsGzhg8Bw9DqL18KUrEZZ1F4YqZBo4Rv+FsDT8A7Nss7p4A6BNVZzzGprCJqYQeNg0EVIbmPc6mDitNniHXGeKgPZ6QZbM4FElw9O7IOFTpOBPvQFeqy0vZf/aayncL8EK/UEAgACBssq8Im1alV3N7wXGODL8jLPWwLhTuCqfGZ1Iz9fb5tXlMOJD6jUvASrKmdtLK/qXNyJns2Vqcvlk+nfJYdZaFpIWiT/tAcEYbttfxyLdYxrLckAKdVRtf1OrNgtZeMCII4SAn6SYaaidrX/AN3s/aVn/zrlEKW0cEUIatHVDKtXO0Qss5EhV/E6kz0BNCgtAytf/s0Botvxt3kGCN8ALqcG3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8AqbHiki6ThNH3auuyZPQpJntnN0mA//56nMpK/6HIuu8xAQUEAgQDAQoMoA8AAAAAAAAG"
+ assertEquals(output.encoded, expectedString)
+ }
+
+ @Test
+ fun testDecodeUpdateBlockhashAndSign() {
+ // https://explorer.solana.com/tx/3KbvREZUat76wgWMtnJfWbJL74Vzh4U2eabVJa3Z3bb2fPtW8AREP5pbmRwUrxZCESbTomWpL41PeKDcPGbojsej?cluster=devnet
+ val encodedTx = Base64.decode("AnQTYwZpkm3fs4SdLxnV6gQj3hSLsyacpxDdLMALYWObm722f79IfYFTbZeFK9xHtMumiDOWAM2hHQP4r/GtbARpncaXgOVFv7OgbRLMbuCEJHO1qwcdCbtH72VzyzU8yw9sqqHIAaCUE8xaQTgT6Z5IyZfeyMe2QGJIfOjz65UPAgACBssq8Im1alV3N7wXGODL8jLPWwLhTuCqfGZ1Iz9fb5tXlMOJD6jUvASrKmdtLK/qXNyJns2Vqcvlk+nfJYdZaFpIWiT/tAcEYbttfxyLdYxrLckAKdVRtf1OrNgtZeMCII4SAn6SYaaidrX/AN3s/aVn/zrlEKW0cEUIatHVDKtXO0Qss5EhV/E6kz0BNCgtAytf/s0Botvxt3kGCN8ALqcG3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8Aqe6sdLXiXSDILEtzckCjkjchiSf6zVGpMYiAE5BE2IqHAQUEAgQDAQoMoA8AAAAAAAAG")
+ val newBlockhash = "CyPYVsYWrsJNfVpi8aazu7WsrswNFuDd385z6GNoBGUg"
+
+ val senderPrivateKeyData = "7f0932159226ddec9e1a4b0b8fe7cdc135049f9e549a867d722aa720dd64f32e".toHexByteArray()
+ val feePayerPrivateKeyData = "4b9d6f57d28b06cbfa1d4cc710953e62d653caf853415c56ffd9d150acdeb7f7".toHexByteArray()
+
+ // Step 1: Decode the transaction.
+
+ val decodedData = TransactionDecoder.decode(SOLANA, encodedTx)
+ val decodedOutput = DecodingTransactionOutput.parseFrom(decodedData)
+
+ assertEquals(decodedOutput.error, SigningError.OK)
+ assert(decodedOutput.transaction.hasLegacy())
+
+ // Step 2: Update recent blockhash.
+
+ val rawTx = decodedOutput.transaction.toBuilder().apply {
+ legacy = decodedOutput.transaction.legacy.toBuilder().setRecentBlockhash(newBlockhash).build()
+ }.build()
+
+ // Step 3: Re-sign the updated transaction.
+
+ val signingInput = SigningInput.newBuilder().apply {
+ rawMessage = rawTx
+ privateKey = ByteString.copyFrom(senderPrivateKeyData)
+ feePayerPrivateKey = ByteString.copyFrom(feePayerPrivateKeyData)
+ txEncoding = Solana.Encoding.Base64
+ }.build()
+
+ val output = AnySigner.sign(signingInput, SOLANA, SigningOutput.parser())
+ val expectedString = "Ajzc/Tke0CG8Cew5qFa6xZI/7Ya3DN0M8Ige6tKPsGzhg8Bw9DqL18KUrEZZ1F4YqZBo4Rv+FsDT8A7Nss7p4A6BNVZzzGprCJqYQeNg0EVIbmPc6mDitNniHXGeKgPZ6QZbM4FElw9O7IOFTpOBPvQFeqy0vZf/aayncL8EK/UEAgACBssq8Im1alV3N7wXGODL8jLPWwLhTuCqfGZ1Iz9fb5tXlMOJD6jUvASrKmdtLK/qXNyJns2Vqcvlk+nfJYdZaFpIWiT/tAcEYbttfxyLdYxrLckAKdVRtf1OrNgtZeMCII4SAn6SYaaidrX/AN3s/aVn/zrlEKW0cEUIatHVDKtXO0Qss5EhV/E6kz0BNCgtAytf/s0Botvxt3kGCN8ALqcG3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8AqbHiki6ThNH3auuyZPQpJntnN0mA//56nMpK/6HIuu8xAQUEAgQDAQoMoA8AAAAAAAAG"
+ assertEquals(output.encoded, expectedString)
+ }
+}
\ No newline at end of file
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/solana/TestSolanaWalletConnectSigning.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/solana/TestSolanaWalletConnectSigning.kt
new file mode 100644
index 00000000000..51360e7b5af
--- /dev/null
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/solana/TestSolanaWalletConnectSigning.kt
@@ -0,0 +1,52 @@
+package com.trustwallet.core.app.blockchains.solana
+
+import com.google.protobuf.ByteString
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import wallet.core.java.AnySigner
+import wallet.core.jni.Base58
+import wallet.core.jni.CoinType.SOLANA
+import wallet.core.jni.WalletConnectRequest
+import wallet.core.jni.proto.Common.SigningError
+import wallet.core.jni.proto.Solana.Encoding
+import wallet.core.jni.proto.Solana.SigningOutput
+import wallet.core.jni.proto.WalletConnect
+
+class TestSolanaWalletConnectSigning {
+
+ init {
+ System.loadLibrary("TrustWalletCore")
+ }
+
+ @Test
+ fun testSignSolanaTransactionFromWalletConnectRequest() {
+ // Step 1: Parse a signing request received through WalletConnect.
+
+ val parsingInput = WalletConnect.ParseRequestInput.newBuilder().apply {
+ method = WalletConnect.Method.SolanaSignTransaction
+ payload = "{\"transaction\":\"AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDZsL1CMnFVcrMn7JtiOiN1U4hC7WovOVof2DX51xM0H/GizyJTHgrBanCf8bGbrFNTn0x3pCGq30hKbywSTr6AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAgIAAQwCAAAAKgAAAAAAAAA=\"}"
+ }.build()
+
+ val parsingOutputBytes = WalletConnectRequest.parse(SOLANA, parsingInput.toByteArray())
+ val parsingOutput = WalletConnect.ParseRequestOutput.parseFrom(parsingOutputBytes)
+
+ assertEquals(parsingOutput.error, SigningError.OK)
+
+ // Step 2: Set missing fields.
+
+ val signingInput = parsingOutput.solana.toBuilder().apply {
+ privateKey = ByteString.copyFrom(Base58.decodeNoCheck("A7psj2GW7ZMdY4E5hJq14KMeYg7HFjULSsWSrTXZLvYr"))
+ txEncoding = Encoding.Base64
+ }.build()
+
+ // Step 3: Sign the transaction.
+
+ val output = AnySigner.sign(signingInput, SOLANA, SigningOutput.parser())
+
+ assertEquals(output.error, SigningError.OK)
+ assertEquals(output.encoded, "AQPWaOi7dMdmQpXi8HyQQKwiqIftrg1igGQxGtZeT50ksn4wAnyH4DtDrkkuE0fqgx80LTp4LwNN9a440SrmoA8BAAEDZsL1CMnFVcrMn7JtiOiN1U4hC7WovOVof2DX51xM0H/GizyJTHgrBanCf8bGbrFNTn0x3pCGq30hKbywSTr6AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAgIAAQwCAAAAKgAAAAAAAAA=")
+
+ assertEquals(output.getSignatures(0).pubkey, "7v91N7iZ9mNicL8WfG6cgSCKyRXydQjLh6UYBWwm6y1Q")
+ assertEquals(output.getSignatures(0).signature, "5T6uZBHnHFd8uWErDBTFRVkbKuhbcm94K5MJ2beTYDruzqv4FjS7EMKvC94ZfxNAiWUXZ6bZxS3WXUbhJwYNPWn")
+ }
+}
\ No newline at end of file
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/stargaze/TestStargazeAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/stargaze/TestStargazeAddress.kt
index bc568dccae3..54577d7971d 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/stargaze/TestStargazeAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/stargaze/TestStargazeAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.stargaze
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/stargaze/TestStargazeSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/stargaze/TestStargazeSigner.kt
index 94a2fbfc7c2..63a7a166b60 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/stargaze/TestStargazeSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/stargaze/TestStargazeSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.stargaze
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/sui/TestSuiAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/sui/TestSuiAddress.kt
index b4ec636a5eb..503e6e8c8ad 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/sui/TestSuiAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/sui/TestSuiAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.sui
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/sui/TestSuiSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/sui/TestSuiSigner.kt
index 327e8a2b19b..84ab0914391 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/sui/TestSuiSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/sui/TestSuiSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.sui
@@ -24,7 +22,7 @@ class TestSuiSigner {
}
@Test
- fun SuiTransactionSigning() {
+ fun testSuiDirectSigning() {
// Successfully broadcasted https://explorer.sui.io/txblock/HkPo6rYPyDY53x1MBszvSZVZyixVN7CHvCJGX381czAh?network=devnet
val txBytes = """
AAACAAgQJwAAAAAAAAAgJZ/4B0q0Jcu0ifI24Y4I8D8aeFa998eih3vWT3OLUBUCAgABAQAAAQEDAAAAAAEBANV1rX8Y6UhGKlz2mPVk7zlKdSpx/sYkk6+KBVwBLA1QAQbywsjB2JZN8QGdZhbpcFcZvrq9kx2idVy5SM635olk7AIAAAAAAAAgYEVuxmf1zRBGdoDr+VDtMpIFF12s2Ua7I2ru1XyGF8/Vda1/GOlIRipc9pj1ZO85SnUqcf7GJJOvigVcASwNUAEAAAAAAAAA0AcAAAAAAAAA
@@ -39,4 +37,37 @@ class TestSuiSigner {
assertEquals(result.unsignedTx, txBytes);
assertEquals(result.signature, expectedSignature)
}
+
+ @Test
+ fun testSuiTransfer() {
+ // Successfully broadcasted: https://suiscan.xyz/mainnet/tx/D4Ay9TdBJjXkGmrZSstZakpEWskEQHaWURP6xWPRXbAm
+ val txBytes = """
+ AAAEAAjoAwAAAAAAAAAIUMMAAAAAAAAAIKcXWr3V7ZLr4605DbNmxqcGR4zfUXzebPmGMAZc2jd6ACBU6A1215DCd/WkTzzpL1PSb1iUiSvzld7mN1mIh2vmsgMCAAIBAAABAQABAQMAAAAAAQIAAQEDAAABAAEDAFToDXbXkMJ39aRPPOkvU9JvWJSJK/OV3uY3WYiHa+ayAWNgILOn3HsRw6pvQZsX+KnBLn95ox0b3S3mcLTt1jAFeHEaBQAAAAAgGGuNnxrqusosgjP3gQ3jBjnhapGNBlcU0yTaupXpa0BU6A1215DCd/WkTzzpL1PSb1iUiSvzld7mN1mIh2vmsu4CAAAAAAAAwMYtAAAAAAAA
+ """.trimIndent()
+ val key =
+ "7e6682f7bf479ef0f627823cffd4e1a940a7af33e5fb39d9e0f631d2ecc5daff".toHexBytesInByteString()
+
+ val paySui = Sui.PaySui.newBuilder()
+ .addInputCoins(Sui.ObjectRef.newBuilder().apply {
+ objectId = "0x636020b3a7dc7b11c3aa6f419b17f8a9c12e7f79a31d1bdd2de670b4edd63005"
+ version = 85619064
+ objectDigest = "2eKuWbZSVfpFVfg8FXY9wP6W5AFXnTchSoUdp7obyYZ5"
+ })
+ .addRecipients("0xa7175abdd5ed92ebe3ad390db366c6a706478cdf517cde6cf98630065cda377a")
+ .addRecipients("0x54e80d76d790c277f5a44f3ce92f53d26f5894892bf395dee6375988876be6b2")
+ .addAmounts(1000)
+ .addAmounts(50000)
+
+ val signingInput = Sui.SigningInput.newBuilder()
+ .setPaySui(paySui)
+ .setPrivateKey(key)
+ .setGasBudget(3000000)
+ .setReferenceGasPrice(750)
+ .build()
+
+ val result = AnySigner.sign(signingInput, CoinType.SUI, Sui.SigningOutput.parser())
+ val expectedSignature = "AEh44B7iGArEHF1wOLAQJMLNgGnaIwn3gKPC92vtDJqITDETAM5z9plaxio1xomt6/cZReQ5FZaQsMC6l7E0BwmF69FEH+T5VPvl3GB3vwCOEZpeJpKXxvcIPQAdKsh2/g=="
+ assertEquals(result.unsignedTx, txBytes);
+ assertEquals(result.signature, expectedSignature)
+ }
}
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/theopennetwork/TestTheOpenNetworkAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/theopennetwork/TestTheOpenNetworkAddress.kt
index d2f341dc62f..f37d4c7e4e9 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/theopennetwork/TestTheOpenNetworkAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/theopennetwork/TestTheOpenNetworkAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.theopennetwork
@@ -24,27 +22,58 @@ class TestTheOpenNetworkAddress {
val publicKey = privateKey.getPublicKeyEd25519()
val address = AnyAddress(publicKey, CoinType.TON)
assertEquals(publicKey.data().toHex(), "0xf42c77f931bea20ec5d0150731276bbb2e2860947661245b2319ef8133ee8d41")
- assertEquals(address.description(), "EQBm--PFwDv1yCeS-QTJ-L8oiUpqo9IT1BwgVptlSq3ts90Q")
+ assertEquals(address.description(), "UQBm--PFwDv1yCeS-QTJ-L8oiUpqo9IT1BwgVptlSq3ts4DV")
}
@Test
fun testAddressFromPublicKey() {
val publicKey = PublicKey("f42c77f931bea20ec5d0150731276bbb2e2860947661245b2319ef8133ee8d41".toHexByteArray(), PublicKeyType.ED25519)
val address = AnyAddress(publicKey, CoinType.TON)
- assertEquals(address.description(), "EQBm--PFwDv1yCeS-QTJ-L8oiUpqo9IT1BwgVptlSq3ts90Q")
+ assertEquals(address.description(), "UQBm--PFwDv1yCeS-QTJ-L8oiUpqo9IT1BwgVptlSq3ts4DV")
}
@Test
fun testAddressFromRawString() {
val addressString = "0:66fbe3c5c03bf5c82792f904c9f8bf28894a6aa3d213d41c20569b654aadedb3"
val address = AnyAddress(addressString, CoinType.TON)
- assertEquals(address.description(), "EQBm--PFwDv1yCeS-QTJ-L8oiUpqo9IT1BwgVptlSq3ts90Q")
+ assertEquals(address.description(), "UQBm--PFwDv1yCeS-QTJ-L8oiUpqo9IT1BwgVptlSq3ts4DV")
}
@Test
- fun testAddressFromUserFriendlyString() {
+ fun testAddressFromBounceableString() {
val addressString = "EQBm--PFwDv1yCeS-QTJ-L8oiUpqo9IT1BwgVptlSq3ts90Q"
val address = AnyAddress(addressString, CoinType.TON)
- assertEquals(address.description(), "EQBm--PFwDv1yCeS-QTJ-L8oiUpqo9IT1BwgVptlSq3ts90Q")
+ assertEquals(address.description(), "UQBm--PFwDv1yCeS-QTJ-L8oiUpqo9IT1BwgVptlSq3ts4DV")
+ }
+
+ @Test
+ fun testAddressFromUserFriendlyString() {
+ val addressString = "UQBm--PFwDv1yCeS-QTJ-L8oiUpqo9IT1BwgVptlSq3ts4DV"
+ val address = AnyAddress(addressString, CoinType.TON)
+ assertEquals(address.description(), "UQBm--PFwDv1yCeS-QTJ-L8oiUpqo9IT1BwgVptlSq3ts4DV")
+ }
+
+ @Test
+ fun testAddressToBounceable() {
+ val addressString = "UQBm--PFwDv1yCeS-QTJ-L8oiUpqo9IT1BwgVptlSq3ts4DV"
+ val bounceable = true
+ val testnet = false
+ val address = TONAddressConverter.toUserFriendly(addressString, bounceable, testnet)
+ assertEquals(address, "EQBm--PFwDv1yCeS-QTJ-L8oiUpqo9IT1BwgVptlSq3ts90Q")
+ }
+
+ @Test
+ fun testGenerateJettonAddress() {
+ val mainAddress = "UQBjKqthWBE6GEcqb_epTRFrQ1niS6Z1Z1MHMwR-mnAYRoYr"
+ val mainAddressBoc = TONAddressConverter.toBoc(mainAddress)
+ assertEquals(mainAddressBoc, "te6cckEBAQEAJAAAQ4AMZVVsKwInQwjlTf71KaItaGs8SXTOrOpg5mCP004DCNAptHQU")
+
+ // curl --location 'https://toncenter.com/api/v2/runGetMethod' --header 'Content-Type: application/json' --data \
+ // '{"address":"EQAvlWFDxGF2lXm67y4yzC17wYKD9A0guwPkMs1gOsM__NOT","method":"get_wallet_address","method":"get_wallet_address","stack":[["tvm.Slice","te6ccgICAAEAAQAAACQAAABDgAxlVWwrAidDCOVN/vUpoi1oazxJdM6s6mDmYI/TTgMI0A=="]]}'
+
+ // Parse the `get_wallet_address` RPC response.
+ val jettonAddressBocEncoded = "te6cckEBAQEAJAAAQ4AFvT5rqwxcbKfITqnkwL+go4Zi9bulRHAtLt4cjjFdK7B8L+Cq"
+ val jettonAddress = TONAddressConverter.fromBoc(jettonAddressBocEncoded)
+ assertEquals(jettonAddress, "UQAt6fNdWGLjZT5CdU8mBf0FHDMXrd0qI4FpdvDkcYrpXV5H")
}
}
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/theopennetwork/TestTheOpenNetworkMessageSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/theopennetwork/TestTheOpenNetworkMessageSigner.kt
new file mode 100644
index 00000000000..64c4627cb97
--- /dev/null
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/theopennetwork/TestTheOpenNetworkMessageSigner.kt
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+package com.trustwallet.core.app.blockchains.theopennetwork
+
+import com.trustwallet.core.app.utils.toHexByteArray
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import wallet.core.jni.PrivateKey
+import wallet.core.jni.TONMessageSigner
+import wallet.core.jni.TONWallet
+
+class TestTheOpenNetworkMessageSigner {
+ init {
+ System.loadLibrary("TrustWalletCore")
+ }
+
+ @Test
+ fun TheOpenNetworkMessageSignerSignMessage() {
+ // The private key has been derived by using [ton-mnemonic](https://www.npmjs.com/package/tonweb-mnemonic/v/0.0.2)
+ // from the following mnemonic:
+ // document shield addict crime broom point story depend suit satisfy test chicken valid tail speak fortune sound drill seek cube cheap body music recipe
+ val privateKey = PrivateKey("112d4e2e700a468f1eae699329202f1ee671d6b665caa2d92dea038cf3868c18".toHexByteArray())
+ val message = "Hello world"
+ val signature = TONMessageSigner.signMessage(privateKey, message)
+ // The following signature has been computed by calling `window.ton.send("ton_personalSign", { data: "Hello world" });`.
+ assertEquals(signature, "2490fbaa72aec0b77b19162bbbe0b0e3f7afd42cc9ef469f0494cd4a366a4bf76643300cd5991f66bce6006336742b8d1d435d541d244dcc013d428472e89504")
+ }
+}
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/theopennetwork/TestTheOpenNetworkSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/theopennetwork/TestTheOpenNetworkSigner.kt
index 887c3516493..59b3fcdd465 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/theopennetwork/TestTheOpenNetworkSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/theopennetwork/TestTheOpenNetworkSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.theopennetwork
@@ -27,24 +25,24 @@ class TestTheOpenNetworkSigner {
val privateKey = PrivateKey("c38f49de2fb13223a9e7d37d5d0ffbdd89a5eb7c8b0ee4d1c299f2cefe7dc4a0".toHexByteArray())
val transfer = TheOpenNetwork.Transfer.newBuilder()
- .setWalletVersion(TheOpenNetwork.WalletVersion.WALLET_V4_R2)
.setDest("EQBm--PFwDv1yCeS-QTJ-L8oiUpqo9IT1BwgVptlSq3ts90Q")
.setAmount(10)
- .setSequenceNumber(6)
.setMode(TheOpenNetwork.SendMode.PAY_FEES_SEPARATELY_VALUE or TheOpenNetwork.SendMode.IGNORE_ACTION_PHASE_ERRORS_VALUE)
- .setExpireAt(1671132440)
.setBounceable(true)
.build()
val input = TheOpenNetwork.SigningInput.newBuilder()
- .setTransfer(transfer)
.setPrivateKey(ByteString.copyFrom(privateKey.data()))
+ .addMessages(transfer)
+ .setSequenceNumber(6)
+ .setExpireAt(1671132440)
+ .setWalletVersion(TheOpenNetwork.WalletVersion.WALLET_V4_R2)
.build()
val output = AnySigner.sign(input, CoinType.TON, SigningOutput.parser())
// tx: https://tonscan.org/tx/3Z4tHpXNLyprecgu5aTQHWtY7dpHXEoo11MAX61Xyg0=
- val expectedString = "te6ccgICAAQAAQAAALAAAAFFiAGwt/q8k4SrjbFbQCjJZfQr64ExRxcUMsWqaQODqTUijgwAAQGcEUPkil2aZ4s8KKparSep/OKHMC8vuXafFbW2HGp/9AcTRv0J5T4dwyW1G0JpHw+g5Ov6QI3Xo0O9RFr3KidICimpoxdjm3UYAAAABgADAAIBYmIAM33x4uAd+uQTyXyCZPxflESlNVHpCeoOECtNsqVW9tmIUAAAAAAAAAAAAAAAAAEAAwAA"
+ val expectedString = "te6cckEBBAEArQABRYgBsLf6vJOEq42xW0AoyWX0K+uBMUcXFDLFqmkDg6k1Io4MAQGcEUPkil2aZ4s8KKparSep/OKHMC8vuXafFbW2HGp/9AcTRv0J5T4dwyW1G0JpHw+g5Ov6QI3Xo0O9RFr3KidICimpoxdjm3UYAAAABgADAgFiYgAzffHi4B365BPJfIJk/F+URKU1UekJ6g4QK02ypVb22YhQAAAAAAAAAAAAAAAAAQMAAA08Nzs="
assertEquals(output.encoded, expectedString)
}
@@ -53,33 +51,77 @@ class TestTheOpenNetworkSigner {
fun TheOpenNetworkJettonTransferSigning() {
val privateKey = PrivateKey("c054900a527538c1b4325688a421c0469b171c29f23a62da216e90b0df2412ee".toHexByteArray())
- val transferData = TheOpenNetwork.Transfer.newBuilder()
- .setWalletVersion(TheOpenNetwork.WalletVersion.WALLET_V4_R2)
- .setDest("EQBiaD8PO1NwfbxSkwbcNT9rXDjqhiIvXWymNO-edV0H5lja")
- .setAmount(100 * 1000 * 1000)
- .setSequenceNumber(1)
- .setMode(TheOpenNetwork.SendMode.PAY_FEES_SEPARATELY_VALUE or TheOpenNetwork.SendMode.IGNORE_ACTION_PHASE_ERRORS_VALUE)
- .setExpireAt(1787693046)
- .setComment("test comment")
- .setBounceable(true)
-
val jettonTransfer = TheOpenNetwork.JettonTransfer.newBuilder()
- .setTransfer(transferData)
.setJettonAmount(500 * 1000 * 1000)
.setToOwner("EQAFwMs5ha8OgZ9M4hQr80z9NkE7rGxUpE1hCFndiY6JnDx8")
.setResponseAddress("EQBaKIMq5Am2p_rfR1IFTwsNWHxBkOpLTmwUain5Fj4llTXk")
.setForwardAmount(1)
.build()
- val input = TheOpenNetwork.SigningInput.newBuilder()
+ val transfer = TheOpenNetwork.Transfer.newBuilder()
+ .setDest("EQBiaD8PO1NwfbxSkwbcNT9rXDjqhiIvXWymNO-edV0H5lja")
+ .setAmount(100 * 1000 * 1000)
+ .setMode(TheOpenNetwork.SendMode.PAY_FEES_SEPARATELY_VALUE or TheOpenNetwork.SendMode.IGNORE_ACTION_PHASE_ERRORS_VALUE)
+ .setComment("test comment")
+ .setBounceable(true)
.setJettonTransfer(jettonTransfer)
+
+ val input = TheOpenNetwork.SigningInput.newBuilder()
.setPrivateKey(ByteString.copyFrom(privateKey.data()))
+ .addMessages(transfer)
+ .setSequenceNumber(1)
+ .setExpireAt(1787693046)
+ .setWalletVersion(TheOpenNetwork.WalletVersion.WALLET_V4_R2)
.build()
val output = AnySigner.sign(input, CoinType.TON, SigningOutput.parser())
// tx: https://testnet.tonscan.org/tx/Er_oT5R3QK7D-qVPBKUGkJAOOq6ayVls-mgEphpI9Ck=
- val expectedString = "te6ccgICAAQAAQAAARgAAAFFiAC0UQZVyBNtT/W+jqQKnhYasPiDIdSWnNgo1FPyLHxLKgwAAQGcaIWVosi1XnveAmoG9y0/mPeNUqUu7GY76mdbRAaVeNeDOPDlh5M3BEb26kkc6XoYDekV60o2iOobN+TGS76jBSmpoxdqjgf2AAAAAQADAAIBaGIAMTQfh52puD7eKUmDbhqfta4cdUMRF662Uxp3zzqug/MgL68IAAAAAAAAAAAAAAAAAAEAAwDKD4p+pQAAAAAAAAAAQdzWUAgAC4GWcwteHQM+mcQoV+aZ+myCd1jYqUiawhCzuxMdEzkAFoogyrkCban+t9HUgVPCw1YfEGQ6ktObBRqKfkWPiWVCAgAAAAB0ZXN0IGNvbW1lbnQ="
+ val expectedString = "te6cckECBAEAARUAAUWIALRRBlXIE21P9b6OpAqeFhqw+IMh1Jac2CjUU/IsfEsqDAEBnGiFlaLItV573gJqBvctP5j3jVKlLuxmO+pnW0QGlXjXgzjw5YeTNwRG9upJHOl6GA3pFetKNojqGzfkxku+owUpqaMXao4H9gAAAAEAAwIBaGIAMTQfh52puD7eKUmDbhqfta4cdUMRF662Uxp3zzqug/MgL68IAAAAAAAAAAAAAAAAAAEDAMoPin6lAAAAAAAAAABB3NZQCAALgZZzC14dAz6ZxChX5pn6bIJ3WNipSJrCELO7Ex0TOQAWiiDKuQJtqf630dSBU8LDVh8QZDqS05sFGop+RY+JZUICAAAAAHRlc3QgY29tbWVudG/bd5c="
+
+ assertEquals(output.encoded, expectedString)
+ }
+
+ @Test
+ fun TheOpenNetworkTransferCustomPayload() {
+ val privateKey = PrivateKey("5525e673087587bc0efd7ab09920ef7d3c1bf6b854a661430244ca59ab19e9d1".toHexByteArray())
+
+ // Doge chatbot contract payload to be deployed.
+ // Docs: https://docs.ton.org/develop/dapps/ton-connect/transactions#smart-contract-deployment
+ val dogeChatbotStateInit = "te6cckEBBAEAUwACATQBAgEU/wD0pBP0vPLICwMAEAAAAZDrkbgQAGrTMAGCCGlJILmRMODQ0wMx+kAwi0ZG9nZYcCCAGMjLBVAEzxaARfoCE8tqEssfAc8WyXP7AO4ioYU="
+ // Doge chatbot's address after the contract is deployed.
+ val dogeChatbotDeployingAddress = "0:3042cd5480da232d5ac1d9cbe324e3c9eb58f167599f6b7c20c6e638aeed0335"
+
+ // The comment has nothing to do with Doge chatbot.
+ // It's just used to attach the following ASCII comment to the transaction:
+ // "This transaction deploys Doge Chatbot contract"
+ val commentPayload = "te6cckEBAQEANAAAZAAAAABUaGlzIHRyYW5zYWN0aW9uIGRlcGxveXMgRG9nZSBDaGF0Ym90IGNvbnRyYWN0v84vSg=="
+
+ val customPayload = TheOpenNetwork.CustomPayload.newBuilder()
+ .setStateInit(dogeChatbotStateInit)
+ .setPayload(commentPayload)
+ .build()
+
+ val transfer = TheOpenNetwork.Transfer.newBuilder()
+ .setDest(dogeChatbotDeployingAddress)
+ // 0.069 TON
+ .setAmount(69_000_000)
+ .setMode(TheOpenNetwork.SendMode.PAY_FEES_SEPARATELY_VALUE or TheOpenNetwork.SendMode.IGNORE_ACTION_PHASE_ERRORS_VALUE)
+ .setBounceable(false)
+ .setCustomPayload(customPayload)
+
+ val input = TheOpenNetwork.SigningInput.newBuilder()
+ .setPrivateKey(ByteString.copyFrom(privateKey.data()))
+ .addMessages(transfer)
+ .setSequenceNumber(4)
+ .setExpireAt(1721939714)
+ .setWalletVersion(TheOpenNetwork.WalletVersion.WALLET_V4_R2)
+ .build()
+
+ val output = AnySigner.sign(input, CoinType.TON, SigningOutput.parser())
+
+ // Successfully broadcasted: https://tonviewer.com/transaction/f4b7ed2247b1adf54f33dd2fd99216fbd61beefb281542d0b330ccea9b8d0338
+ val expectedString = "te6cckECCAEAATcAAUWIAfq4NsPLegfou/MPhtHE9YuzV3gnI/q6jm3MRJh2PtpaDAEBnPbyCSsWrOZpEjb7ZFxz5yYi+an6M6Lnq7rI7TFWdDS76LEtGBrVVrhMGziwxuy6LCVtsMBikI7RPVQ89FCIAAYpqaMXZqK3AgAAAAQAAwICaUIAGCFmqkBtEZatYOzl8ZJx5PWseLOsz7W+EGNzHFd2gZqgIObaAAAAAAAAAAAAAAAAAAPAAwQCATQFBgBkAAAAAFRoaXMgdHJhbnNhY3Rpb24gZGVwbG95cyBEb2dlIENoYXRib3QgY29udHJhY3QBFP8A9KQT9LzyyAsHABAAAAGQ65G4EABq0zABgghpSSC5kTDg0NMDMfpAMItGRvZ2WHAggBjIywVQBM8WgEX6AhPLahLLHwHPFslz+wAa2r/S"
assertEquals(output.encoded, expectedString)
}
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/theopennetwork/TestTheOpenNetworkWallet.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/theopennetwork/TestTheOpenNetworkWallet.kt
new file mode 100644
index 00000000000..9305072bb75
--- /dev/null
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/theopennetwork/TestTheOpenNetworkWallet.kt
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+package com.trustwallet.core.app.blockchains.theopennetwork
+
+import com.trustwallet.core.app.utils.toHexByteArray
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import wallet.core.jni.PublicKey
+import wallet.core.jni.PublicKeyType
+import wallet.core.jni.TONWallet
+
+class TestTheOpenNetworkWallet {
+ init {
+ System.loadLibrary("TrustWalletCore")
+ }
+
+ @Test
+ fun TheOpenNetworkWalletBuildV4R2StateInit() {
+ val publicKey = PublicKey("f229a9371fa7c2108b3d90ea22c9be705ff5d0cfeaee9cbb9366ff0171579357".toHexByteArray(), PublicKeyType.ED25519)
+ val baseWorkchain = 0
+ val defaultWalletId = 0x29a9a317
+ val stateInit = TONWallet.buildV4R2StateInit(publicKey, baseWorkchain, defaultWalletId)
+
+ val expected = "te6cckECFgEAAwQAAgE0AQIBFP8A9KQT9LzyyAsDAFEAAAAAKamjF/IpqTcfp8IQiz2Q6iLJvnBf9dDP6u6cu5Nm/wFxV5NXQAIBIAQFAgFIBgcE+PKDCNcYINMf0x/THwL4I7vyZO1E0NMf0x/T//QE0VFDuvKhUVG68qIF+QFUEGT5EPKj+AAkpMjLH1JAyx9SMMv/UhD0AMntVPgPAdMHIcAAn2xRkyDXSpbTB9QC+wDoMOAhwAHjACHAAuMAAcADkTDjDQOkyMsfEssfy/8ICQoLAubQAdDTAyFxsJJfBOAi10nBIJJfBOAC0x8hghBwbHVnvSKCEGRzdHK9sJJfBeAD+kAwIPpEAcjKB8v/ydDtRNCBAUDXIfQEMFyBAQj0Cm+hMbOSXwfgBdM/yCWCEHBsdWe6kjgw4w0DghBkc3RyupJfBuMNDA0CASAODwBu0gf6ANTUIvkABcjKBxXL/8nQd3SAGMjLBcsCIs8WUAX6AhTLaxLMzMlz+wDIQBSBAQj0UfKnAgBwgQEI1xj6ANM/yFQgR4EBCPRR8qeCEG5vdGVwdIAYyMsFywJQBs8WUAT6AhTLahLLH8s/yXP7AAIAbIEBCNcY+gDTPzBSJIEBCPRZ8qeCEGRzdHJwdIAYyMsFywJQBc8WUAP6AhPLassfEss/yXP7AAAK9ADJ7VQAeAH6APQEMPgnbyIwUAqhIb7y4FCCEHBsdWeDHrFwgBhQBMsFJs8WWPoCGfQAy2kXyx9SYMs/IMmAQPsABgCKUASBAQj0WTDtRNCBAUDXIMgBzxb0AMntVAFysI4jghBkc3Rygx6xcIAYUAXLBVADzxYj+gITy2rLH8s/yYBA+wCSXwPiAgEgEBEAWb0kK29qJoQICga5D6AhhHDUCAhHpJN9KZEM5pA+n/mDeBKAG3gQFImHFZ8xhAIBWBITABG4yX7UTQ1wsfgAPbKd+1E0IEBQNch9AQwAsjKB8v/ydABgQEI9ApvoTGACASAUFQAZrc52omhAIGuQ64X/wAAZrx32omhAEGuQ64WPwEXtMkg="
+ assertEquals(stateInit, expected)
+ }
+}
\ No newline at end of file
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/thetafuel/TestThetaFuelAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/thetafuel/TestThetaFuelAddress.kt
index 876fdefebb4..17e60b89aeb 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/thetafuel/TestThetaFuelAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/thetafuel/TestThetaFuelAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.thetafuel
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/thorchain/TestTHORChainAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/thorchain/TestTHORChainAddress.kt
index 8a1c5768d90..0974995d3f1 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/thorchain/TestTHORChainAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/thorchain/TestTHORChainAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2021 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.thorchain
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/thorchain/TestTHORChainSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/thorchain/TestTHORChainSigner.kt
index c12ad29b2f1..fde6325529f 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/thorchain/TestTHORChainSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/thorchain/TestTHORChainSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2021 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.thorchain
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/zen/TestZenAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/zen/TestZenAddress.kt
index bd7fcdfed69..8398b636928 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/zen/TestZenAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/zen/TestZenAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.zen
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/zen/TestZenSigner.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/zen/TestZenSigner.kt
index 0b42106409a..36682ac0293 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/zen/TestZenSigner.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/zen/TestZenSigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.zen
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestAnyAddress.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestAnyAddress.kt
index 64b3bb82987..ae4b47b4bd0 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestAnyAddress.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestAnyAddress.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.utils
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestAsnParser.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestAsnParser.kt
index ecdf9db3d9c..7c896d7860c 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestAsnParser.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestAsnParser.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.utils
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestCryptoBox.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestCryptoBox.kt
new file mode 100644
index 00000000000..4b5bc226ce9
--- /dev/null
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestCryptoBox.kt
@@ -0,0 +1,47 @@
+package com.trustwallet.core.app.utils
+
+import com.trustwallet.core.app.utils.toHexBytes
+import com.trustwallet.core.app.utils.toHex
+import org.junit.Assert.*
+import org.junit.Test
+import wallet.core.jni.*
+
+class TestCryptoBox {
+ init {
+ System.loadLibrary("TrustWalletCore")
+ }
+
+ @Test
+ fun testEncryptDecryptEasy() {
+ val mySecret = CryptoBoxSecretKey()
+ val myPubkey = mySecret.publicKey
+
+ val otherSecret = CryptoBoxSecretKey()
+ val otherPubkey = otherSecret.publicKey
+
+ val message = "Well done is better than well said. -Benjamin Franklin"
+ val encrypted = CryptoBox.encryptEasy(mySecret, otherPubkey, message.toByteArray())
+
+ // Step 2. Make sure the Box can be decrypted by the other side.
+ val decrypted = CryptoBox.decryptEasy(otherSecret, myPubkey, encrypted)
+ assertEquals(decrypted.toString(Charsets.UTF_8), message)
+ }
+
+ @Test
+ fun testSecretKeyFromToBytes() {
+ val secretBytesHex = "0xdd87000d4805d6fbd89ae1352f5e4445648b79d5e901c92aebcb610e9be468e4"
+ val secretBytes = secretBytesHex.toHexByteArray()
+ assert(CryptoBoxSecretKey.isValid(secretBytes))
+ val secret = CryptoBoxSecretKey(secretBytes)
+ assertEquals(secret.data().toHex(), secretBytesHex)
+ }
+
+ @Test
+ fun testPublicKeyFromToBytes() {
+ val publicBytesHex = "0xafccabc5b28a8a1fd1cd880516f9c854ae2498d0d1b978b53a59f38e4ae55747"
+ val publicBytes = publicBytesHex.toHexByteArray()
+ assert(CryptoBoxPublicKey.isValid(publicBytes))
+ val pubkey = CryptoBoxPublicKey(publicBytes)
+ assertEquals(pubkey.data().toHex(), publicBytesHex)
+ }
+}
\ No newline at end of file
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestHDWallet.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestHDWallet.kt
index 22af2bfc37f..e3ec6f29b12 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestHDWallet.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestHDWallet.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2022 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.utils
diff --git a/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestLiquidStaking.kt b/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestLiquidStaking.kt
index a4bcbf35957..44701d5f2b1 100644
--- a/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestLiquidStaking.kt
+++ b/android/app/src/androidTest/java/com/trustwallet/core/app/utils/TestLiquidStaking.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.utils
@@ -31,7 +29,7 @@ class TestLiquidStaking {
stake = LiquidStaking.Stake.newBuilder().apply {
amount = "1000000000000000000"
asset = LiquidStaking.Asset.newBuilder().apply {
- stakingToken = LiquidStaking.Coin.MATIC
+ stakingToken = LiquidStaking.Coin.POL
}.build()
}.build()
}
diff --git a/audit/2023-09-15_TrustWallet_SecureCodeReviewReport_Public_v2.00.pdf b/audit/2023-09-15_TrustWallet_SecureCodeReviewReport_Public_v2.00.pdf
new file mode 100644
index 00000000000..d0efac0de8d
Binary files /dev/null and b/audit/2023-09-15_TrustWallet_SecureCodeReviewReport_Public_v2.00.pdf differ
diff --git a/cmake/Protobuf.cmake b/cmake/Protobuf.cmake
index 131bd7678b8..8e0a93251d2 100644
--- a/cmake/Protobuf.cmake
+++ b/cmake/Protobuf.cmake
@@ -1,8 +1,6 @@
-# Copyright © 2017-2022 Trust Wallet.
+# SPDX-License-Identifier: Apache-2.0
#
-# This file is part of Trust. The full Trust copyright notice, including
-# terms governing use, modification, and redistribution, is contained in the
-# file LICENSE at the root of the source code distribution tree.
+# Copyright © 2017 Trust Wallet.
set(protobuf_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../build/local/src/protobuf/protobuf-3.19.2)
set(protobuf_source_dir ${CMAKE_CURRENT_LIST_DIR}/../build/local/src/protobuf/protobuf-3.19.2)
diff --git a/codegen-v2/Cargo.lock b/codegen-v2/Cargo.lock
index 32a0596b5ae..6ed11b1c48a 100644
--- a/codegen-v2/Cargo.lock
+++ b/codegen-v2/Cargo.lock
@@ -3,10 +3,13 @@
version = 3
[[package]]
-name = "autocfg"
-version = "1.1.0"
+name = "aho-corasick"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
+dependencies = [
+ "memchr",
+]
[[package]]
name = "block-buffer"
@@ -27,18 +30,31 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
name = "codegen-v2"
version = "0.1.0"
dependencies = [
+ "aho-corasick",
+ "convert_case",
"handlebars",
"heck",
+ "pathdiff",
"serde",
"serde_json",
"serde_yaml",
+ "toml_edit",
+]
+
+[[package]]
+name = "convert_case"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca"
+dependencies = [
+ "unicode-segmentation",
]
[[package]]
name = "cpufeatures"
-version = "0.2.7"
+version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58"
+checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504"
dependencies = [
"libc",
]
@@ -55,14 +71,20 @@ dependencies = [
[[package]]
name = "digest"
-version = "0.10.6"
+version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f"
+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
"block-buffer",
"crypto-common",
]
+[[package]]
+name = "equivalent"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
+
[[package]]
name = "generic-array"
version = "0.14.7"
@@ -75,9 +97,9 @@ dependencies = [
[[package]]
name = "handlebars"
-version = "4.3.6"
+version = "4.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "035ef95d03713f2c347a72547b7cd38cbc9af7cd51e6099fb62d586d4a6dee3a"
+checksum = "faa67bab9ff362228eb3d00bd024a4965d8231bbb7921167f0cfa66c6626b225"
dependencies = [
"log",
"pest",
@@ -89,9 +111,9 @@ dependencies = [
[[package]]
name = "hashbrown"
-version = "0.12.3"
+version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
+checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
[[package]]
name = "heck"
@@ -101,56 +123,66 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "indexmap"
-version = "1.9.3"
+version = "2.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
+checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4"
dependencies = [
- "autocfg",
+ "equivalent",
"hashbrown",
]
[[package]]
name = "itoa"
-version = "1.0.6"
+version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
+checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
[[package]]
name = "libc"
-version = "0.2.142"
+version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317"
+checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "log"
-version = "0.4.17"
+version = "0.4.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
-dependencies = [
- "cfg-if",
-]
+checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
+
+[[package]]
+name = "memchr"
+version = "2.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
[[package]]
name = "once_cell"
-version = "1.17.1"
+version = "1.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
+
+[[package]]
+name = "pathdiff"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
+checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
[[package]]
name = "pest"
-version = "2.5.7"
+version = "2.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b1403e8401ad5dedea73c626b99758535b342502f8d1e361f4a2dd952749122"
+checksum = "56f8023d0fb78c8e03784ea1c7f3fa36e68a723138990b8d5a47d916b651e7a8"
dependencies = [
+ "memchr",
"thiserror",
"ucd-trie",
]
[[package]]
name = "pest_derive"
-version = "2.5.7"
+version = "2.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be99c4c1d2fc2769b1d00239431d711d08f6efedcecb8b6e30707160aee99c15"
+checksum = "b0d24f72393fd16ab6ac5738bc33cdb6a9aa73f8b902e8fe29cf4e67d7dd1026"
dependencies = [
"pest",
"pest_generator",
@@ -158,9 +190,9 @@ dependencies = [
[[package]]
name = "pest_generator"
-version = "2.5.7"
+version = "2.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e56094789873daa36164de2e822b3888c6ae4b4f9da555a1103587658c805b1e"
+checksum = "fdc17e2a6c7d0a492f0158d7a4bd66cc17280308bbaff78d5bef566dca35ab80"
dependencies = [
"pest",
"pest_meta",
@@ -171,9 +203,9 @@ dependencies = [
[[package]]
name = "pest_meta"
-version = "2.5.7"
+version = "2.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6733073c7cff3d8459fda0e42f13a047870242aed8b509fe98000928975f359e"
+checksum = "934cd7631c050f4674352a6e835d5f6711ffbfb9345c2fc0107155ac495ae293"
dependencies = [
"once_cell",
"pest",
@@ -182,42 +214,42 @@ dependencies = [
[[package]]
name = "proc-macro2"
-version = "1.0.56"
+version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435"
+checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
-version = "1.0.26"
+version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"
+checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [
"proc-macro2",
]
[[package]]
name = "ryu"
-version = "1.0.13"
+version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
+checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1"
[[package]]
name = "serde"
-version = "1.0.160"
+version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c"
+checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.160"
+version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df"
+checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
dependencies = [
"proc-macro2",
"quote",
@@ -226,9 +258,9 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "1.0.95"
+version = "1.0.114"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d721eca97ac802aa7777b701877c8004d950fc142651367300d21c1cc0194744"
+checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0"
dependencies = [
"itoa",
"ryu",
@@ -237,9 +269,9 @@ dependencies = [
[[package]]
name = "serde_yaml"
-version = "0.9.21"
+version = "0.9.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9d684e3ec7de3bf5466b32bd75303ac16f0736426e5a4e0d6e489559ce1249c"
+checksum = "8fd075d994154d4a774f95b51fb96bdc2832b0ea48425c92546073816cda1f2f"
dependencies = [
"indexmap",
"itoa",
@@ -250,9 +282,9 @@ dependencies = [
[[package]]
name = "sha2"
-version = "0.10.6"
+version = "0.10.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"
+checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
dependencies = [
"cfg-if",
"cpufeatures",
@@ -261,9 +293,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.14"
+version = "2.0.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fcf316d5356ed6847742d036f8a39c3b8435cac10bd528a4bd461928a6ab34d5"
+checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07"
dependencies = [
"proc-macro2",
"quote",
@@ -272,50 +304,82 @@ dependencies = [
[[package]]
name = "thiserror"
-version = "1.0.40"
+version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"
+checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.40"
+version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
+checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
+[[package]]
+name = "toml_datetime"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
+
+[[package]]
+name = "toml_edit"
+version = "0.21.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1"
+dependencies = [
+ "indexmap",
+ "toml_datetime",
+ "winnow",
+]
+
[[package]]
name = "typenum"
-version = "1.16.0"
+version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
+checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
[[package]]
name = "ucd-trie"
-version = "0.1.5"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"
+checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"
[[package]]
name = "unicode-ident"
-version = "1.0.8"
+version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
+checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
+
+[[package]]
+name = "unicode-segmentation"
+version = "1.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202"
[[package]]
name = "unsafe-libyaml"
-version = "0.2.8"
+version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1865806a559042e51ab5414598446a5871b561d21b6764f2eabb0dd481d880a6"
+checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b"
[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
+
+[[package]]
+name = "winnow"
+version = "0.5.40"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"
+dependencies = [
+ "memchr",
+]
diff --git a/codegen-v2/Cargo.toml b/codegen-v2/Cargo.toml
index a8906c0ae94..43c2afea1c6 100644
--- a/codegen-v2/Cargo.toml
+++ b/codegen-v2/Cargo.toml
@@ -3,8 +3,6 @@ name = "codegen-v2"
version = "0.1.0"
edition = "2021"
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
-
[lib]
name = "libparser"
path = "src/lib.rs"
@@ -14,8 +12,12 @@ name = "parser"
path = "src/main.rs"
[dependencies]
-serde = { version = "1.0.159", features = ["derive"] }
-serde_json = "1.0.95"
+aho-corasick = "1.1.2"
+convert_case = "0.6.0"
+pathdiff = "0.2.1"
+serde = { version = "1.0", features = ["derive"] }
+serde_json = "1.0"
serde_yaml = "0.9.21"
+toml_edit = "0.21.0"
handlebars = "4.3.6"
heck = "0.4.1"
diff --git a/codegen-v2/README.md b/codegen-v2/README.md
index 11490caee31..33e018ac407 100644
--- a/codegen-v2/README.md
+++ b/codegen-v2/README.md
@@ -2,7 +2,7 @@
This is a _work-in-progress_ parser meant to deprecate the existing Ruby parser
in `codegen/`. As of now, we only support Swift binding generation. This project
-will progess over multiple stages (PRs).
+will progress over multiple stages (PRs).
## Execution
diff --git a/codegen-v2/manifest/TWCoinType.yaml b/codegen-v2/manifest/TWCoinType.yaml
index 872c3050766..af01f64569b 100644
--- a/codegen-v2/manifest/TWCoinType.yaml
+++ b/codegen-v2/manifest/TWCoinType.yaml
@@ -192,7 +192,7 @@ enums:
value: 10001284
- name: kavaEvm
value: 10002222
- - name: klaytn
+ - name: kaia
value: 10008217
- name: meter
value: 18000
diff --git a/codegen-v2/manifest/TWEthereumChainID.yaml b/codegen-v2/manifest/TWEthereumChainID.yaml
index ec004a4bdf1..a8c93f297cc 100644
--- a/codegen-v2/manifest/TWEthereumChainID.yaml
+++ b/codegen-v2/manifest/TWEthereumChainID.yaml
@@ -63,7 +63,7 @@ enums:
value: 2222
- name: iotexevm
value: 4689
- - name: klaytn
+ - name: kaia
value: 8217
- name: avalanchec
value: 43114
diff --git a/codegen-v2/src/codegen/cpp/blockchain_dispatcher_generator.rs b/codegen-v2/src/codegen/cpp/blockchain_dispatcher_generator.rs
new file mode 100644
index 00000000000..0871d545995
--- /dev/null
+++ b/codegen-v2/src/codegen/cpp/blockchain_dispatcher_generator.rs
@@ -0,0 +1,75 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::cpp::cpp_source_directory;
+use crate::registry::CoinItem;
+use crate::utils::FileContent;
+use crate::Result;
+use std::path::PathBuf;
+
+const COIN_INCLUDES_END: &str = "end_of_coin_includes_marker_do_not_modify";
+const COIN_DISPATCHER_DECLARATIONS_END: &str =
+ "end_of_coin_dipatcher_declarations_marker_do_not_modify";
+const COIN_DISPATCHER_SWITCH_END: &str = "end_of_coin_dipatcher_switch_marker_do_not_modify";
+
+fn dispatcher_coin_cpp_path() -> PathBuf {
+ cpp_source_directory().join("Coin.cpp")
+}
+
+/// Represents `Coin.cpp`.
+pub struct BlockchainDispatcherGenerator;
+
+impl BlockchainDispatcherGenerator {
+ pub fn generate_new_blockchain_type_dispatching(coin: &CoinItem) -> Result<()> {
+ let dispatcher_path = dispatcher_coin_cpp_path();
+ println!("[EDIT] {dispatcher_path:?}");
+ let mut file_content = FileContent::read(dispatcher_path)?;
+
+ Self::generate_include_of_blockchain_entry(coin, &mut file_content)?;
+ Self::generate_blockchain_entry_constant(coin, &mut file_content)?;
+ Self::generate_blockchain_dispatcher_case(coin, &mut file_content)?;
+
+ file_content.write()
+ }
+
+ fn generate_include_of_blockchain_entry(
+ coin: &CoinItem,
+ file_content: &mut FileContent,
+ ) -> Result<()> {
+ let blockchain_type = coin.blockchain_type();
+
+ let mut line_marker = file_content.rfind_line(|line| line.contains(COIN_INCLUDES_END))?;
+ line_marker.push_line_before(format!(r#"#include "{blockchain_type}/Entry.h""#));
+
+ Ok(())
+ }
+
+ fn generate_blockchain_entry_constant(
+ coin: &CoinItem,
+ file_content: &mut FileContent,
+ ) -> Result<()> {
+ let blockchain_type = coin.blockchain_type();
+
+ let mut entries_region =
+ file_content.rfind_line(|line| line.contains(COIN_DISPATCHER_DECLARATIONS_END))?;
+ entries_region.push_line_before(format!("{blockchain_type}::Entry {blockchain_type}DP;"));
+
+ Ok(())
+ }
+
+ fn generate_blockchain_dispatcher_case(
+ coin: &CoinItem,
+ file_content: &mut FileContent,
+ ) -> Result<()> {
+ let blockchain_type = coin.blockchain_type();
+
+ let mut entries_region =
+ file_content.rfind_line(|line| line.contains(COIN_DISPATCHER_SWITCH_END))?;
+ entries_region.push_line_before(format!(
+ " case TWBlockchain{blockchain_type}: entry = &{blockchain_type}DP; break;"
+ ));
+
+ Ok(())
+ }
+}
diff --git a/codegen-v2/src/codegen/cpp/entry_generator.rs b/codegen-v2/src/codegen/cpp/entry_generator.rs
new file mode 100644
index 00000000000..639ee6c0488
--- /dev/null
+++ b/codegen-v2/src/codegen/cpp/entry_generator.rs
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::cpp::cpp_source_directory;
+use crate::codegen::template_generator::TemplateGenerator;
+use crate::registry::CoinItem;
+use crate::Result;
+use std::fs;
+use std::path::PathBuf;
+
+const ENTRY_HEADER_TEMPLATE: &str = include_str!("templates/Entry.h");
+
+pub fn coin_source_directory(coin: &CoinItem) -> PathBuf {
+ cpp_source_directory().join(coin.blockchain_type())
+}
+
+pub struct EntryGenerator;
+
+impl EntryGenerator {
+ pub fn generate(coin: &CoinItem) -> Result {
+ let blockchain_dir = coin_source_directory(coin);
+ let entry_header_path = blockchain_dir.join("Entry.h");
+
+ if blockchain_dir.exists() {
+ println!("[SKIP] Entry file already exists: {blockchain_dir:?}");
+ return Ok(blockchain_dir);
+ }
+
+ fs::create_dir_all(&blockchain_dir)?;
+
+ println!("[ADD] {entry_header_path:?}");
+ TemplateGenerator::new(ENTRY_HEADER_TEMPLATE)
+ .write_to(entry_header_path.clone())
+ .with_default_patterns(coin)
+ .write()?;
+
+ Ok(entry_header_path)
+ }
+}
diff --git a/codegen-v2/src/codegen/cpp/mod.rs b/codegen-v2/src/codegen/cpp/mod.rs
new file mode 100644
index 00000000000..1ef7188d86f
--- /dev/null
+++ b/codegen-v2/src/codegen/cpp/mod.rs
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::registry::CoinItem;
+use std::env;
+use std::path::PathBuf;
+
+pub mod blockchain_dispatcher_generator;
+pub mod entry_generator;
+pub mod new_blockchain;
+pub mod new_cosmos_chain;
+pub mod new_evmchain;
+pub mod tw_any_address_tests_generator;
+pub mod tw_any_signer_tests_generator;
+pub mod tw_blockchain;
+pub mod tw_coin_address_derivation_tests_generator;
+pub mod tw_coin_type_generator;
+pub mod tw_coin_type_tests_generator;
+
+pub fn cpp_source_directory() -> PathBuf {
+ PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
+ .join("..")
+ .join("src")
+}
+
+pub fn cpp_include_directory() -> PathBuf {
+ PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
+ .join("..")
+ .join("include")
+ .join("TrustWalletCore")
+}
+
+pub fn integration_tests_directory() -> PathBuf {
+ PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
+ .join("..")
+ .join("tests")
+}
+
+pub fn coin_integration_tests_directory(coin: &CoinItem) -> PathBuf {
+ integration_tests_directory()
+ .join("chains")
+ .join(coin.coin_type())
+}
+
+pub fn cosmos_coin_integration_tests_directory(coin: &CoinItem) -> PathBuf {
+ integration_tests_directory()
+ .join("chains")
+ .join("Cosmos")
+ .join(coin.coin_type())
+}
diff --git a/codegen-v2/src/codegen/cpp/new_blockchain.rs b/codegen-v2/src/codegen/cpp/new_blockchain.rs
new file mode 100644
index 00000000000..df7c94c62bd
--- /dev/null
+++ b/codegen-v2/src/codegen/cpp/new_blockchain.rs
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::cpp::blockchain_dispatcher_generator::BlockchainDispatcherGenerator;
+use crate::codegen::cpp::entry_generator::EntryGenerator;
+use crate::codegen::cpp::tw_any_address_tests_generator::TWAnyAddressTestsGenerator;
+use crate::codegen::cpp::tw_any_signer_tests_generator::TWAnySignerTestsGenerator;
+use crate::codegen::cpp::tw_blockchain::TWBlockchainGenerator;
+use crate::codegen::cpp::tw_coin_address_derivation_tests_generator::CoinAddressDerivationTestsGenerator;
+use crate::codegen::cpp::tw_coin_type_generator::TWCoinTypeGenerator;
+use crate::codegen::cpp::tw_coin_type_tests_generator::TWCoinTypeTestsGenerator;
+use crate::registry::CoinItem;
+use crate::Result;
+
+pub fn new_blockchain(coin: &CoinItem) -> Result<()> {
+ // Generate C++ files.
+ EntryGenerator::generate(coin)?;
+
+ // Add the new coin type to the `TWCoinType` enum.
+ TWCoinTypeGenerator::generate_coin_type_variant(coin)?;
+ // Add the new blockchain type to the `TWBlockchain` enum.
+ TWBlockchainGenerator::generate_blockchain_type_variant(coin)?;
+ // Add the blockchain entry to the dispatcher `Coin.cpp`.
+ BlockchainDispatcherGenerator::generate_new_blockchain_type_dispatching(coin)?;
+
+ // Add integration tests.
+ TWCoinTypeTestsGenerator::generate(coin)?;
+ TWAnyAddressTestsGenerator::generate(coin)?;
+ TWAnySignerTestsGenerator::generate(coin)?;
+ CoinAddressDerivationTestsGenerator::generate_new_coin_type_case(coin)?;
+
+ Ok(())
+}
diff --git a/codegen-v2/src/codegen/cpp/new_cosmos_chain.rs b/codegen-v2/src/codegen/cpp/new_cosmos_chain.rs
new file mode 100644
index 00000000000..08c4406f994
--- /dev/null
+++ b/codegen-v2/src/codegen/cpp/new_cosmos_chain.rs
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::cpp::tw_coin_address_derivation_tests_generator::CoinAddressDerivationTestsGenerator;
+use crate::codegen::cpp::tw_coin_type_generator::TWCoinTypeGenerator;
+use crate::codegen::cpp::tw_coin_type_tests_generator::TWCoinTypeTestsGenerator;
+use crate::registry::CoinItem;
+use crate::Result;
+
+pub fn new_cosmos_chain(coin: &CoinItem) -> Result<()> {
+ // Add the new coin type to the `TWCoinType` enum.
+ TWCoinTypeGenerator::generate_coin_type_variant(coin)?;
+
+ // Add integration tests.
+ TWCoinTypeTestsGenerator::generate(coin)?;
+ CoinAddressDerivationTestsGenerator::generate_new_coin_type_case(coin)?;
+
+ Ok(())
+}
diff --git a/codegen-v2/src/codegen/cpp/new_evmchain.rs b/codegen-v2/src/codegen/cpp/new_evmchain.rs
new file mode 100644
index 00000000000..2368c797ab3
--- /dev/null
+++ b/codegen-v2/src/codegen/cpp/new_evmchain.rs
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::cpp::tw_coin_address_derivation_tests_generator::CoinAddressDerivationTestsGenerator;
+use crate::codegen::cpp::tw_coin_type_generator::TWCoinTypeGenerator;
+use crate::codegen::cpp::tw_coin_type_tests_generator::TWCoinTypeTestsGenerator;
+use crate::registry::CoinItem;
+use crate::Result;
+
+pub fn new_evmchain(coin: &CoinItem) -> Result<()> {
+ // Add the new coin type to the `TWCoinType` enum.
+ TWCoinTypeGenerator::generate_coin_type_variant(coin)?;
+
+ // Add integration tests.
+ TWCoinTypeTestsGenerator::generate(coin)?;
+ CoinAddressDerivationTestsGenerator::generate_new_evm_coin_type_case(coin)?;
+
+ Ok(())
+}
diff --git a/codegen-v2/src/codegen/cpp/templates/Entry.h b/codegen-v2/src/codegen/cpp/templates/Entry.h
new file mode 100644
index 00000000000..2c2520f9ccb
--- /dev/null
+++ b/codegen-v2/src/codegen/cpp/templates/Entry.h
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+#pragma once
+
+#include "rust/RustCoinEntry.h"
+
+namespace TW::{BLOCKCHAIN} {
+
+/// Entry point for {BLOCKCHAIN} coin.
+/// Note: do not put the implementation here (no matter how simple), to avoid having coin-specific includes in this file
+class Entry : public Rust::RustCoinEntry {
+};
+
+} // namespace TW::{BLOCKCHAIN}
+
diff --git a/codegen-v2/src/codegen/cpp/templates/TWAnyAddressTests.cpp b/codegen-v2/src/codegen/cpp/templates/TWAnyAddressTests.cpp
new file mode 100644
index 00000000000..139234a20e4
--- /dev/null
+++ b/codegen-v2/src/codegen/cpp/templates/TWAnyAddressTests.cpp
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+#include
+#include "HexCoding.h"
+
+#include "TestUtilities.h"
+#include
+
+using namespace TW;
+
+// TODO: Finalize tests
+
+TEST(TW{COIN_TYPE}, Address) {
+ // TODO: Finalize test implementation
+
+ auto string = STRING("__ADD_VALID_ADDRESS_HERE__");
+ auto addr = WRAP(TWAnyAddress, TWAnyAddressCreateWithString(string.get(), TWCoinType{COIN_TYPE}));
+ auto string2 = WRAPS(TWAnyAddressDescription(addr.get()));
+ EXPECT_TRUE(TWStringEqual(string.get(), string2.get()));
+ auto keyHash = WRAPD(TWAnyAddressData(addr.get()));
+ assertHexEqual(keyHash, "__CORRESPONDING_ADDRESS_DATA__");
+}
diff --git a/codegen-v2/src/codegen/cpp/templates/TWAnySignerTests.cpp b/codegen-v2/src/codegen/cpp/templates/TWAnySignerTests.cpp
new file mode 100644
index 00000000000..ce5b56f0467
--- /dev/null
+++ b/codegen-v2/src/codegen/cpp/templates/TWAnySignerTests.cpp
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+#include
+#include "HexCoding.h"
+
+#include "TestUtilities.h"
+#include
+
+using namespace TW;
+
+// TODO: Finalize tests
+
+TEST(TWAnySigner{COIN_TYPE}, Sign) {
+ // TODO: Finalize test implementation
+}
diff --git a/codegen-v2/src/codegen/cpp/templates/TWCoinTypeTests.cpp b/codegen-v2/src/codegen/cpp/templates/TWCoinTypeTests.cpp
new file mode 100644
index 00000000000..8e917150dd4
--- /dev/null
+++ b/codegen-v2/src/codegen/cpp/templates/TWCoinTypeTests.cpp
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+#include "TestUtilities.h"
+#include
+#include
+
+TEST(TW{COIN_TYPE}CoinType, TWCoinType) {
+ const auto coin = TWCoinType{COIN_TYPE};
+ const auto symbol = WRAPS(TWCoinTypeConfigurationGetSymbol(coin));
+ const auto id = WRAPS(TWCoinTypeConfigurationGetID(coin));
+ const auto name = WRAPS(TWCoinTypeConfigurationGetName(coin));
+ const auto txId = WRAPS(TWStringCreateWithUTF8Bytes("{EXPLORER_SAMPLE_TX}"));
+ const auto txUrl = WRAPS(TWCoinTypeConfigurationGetTransactionURL(coin, txId.get()));
+ const auto accId = WRAPS(TWStringCreateWithUTF8Bytes("{EXPLORER_SAMPLE_ACCOUNT}"));
+ const auto accUrl = WRAPS(TWCoinTypeConfigurationGetAccountURL(coin, accId.get()));
+
+ assertStringsEqual(id, "{COIN_ID}");
+ assertStringsEqual(name, "{COIN_NAME}");
+ assertStringsEqual(symbol, "{SYMBOL}");
+ ASSERT_EQ(TWCoinTypeConfigurationGetDecimals(coin), {DECIMALS});
+ ASSERT_EQ(TWCoinTypeBlockchain(coin), TWBlockchain{BLOCKCHAIN});
+ ASSERT_EQ(TWCoinTypeP2pkhPrefix(coin), {P2PKH_PREFIX});
+ ASSERT_EQ(TWCoinTypeP2shPrefix(coin), {P2SH_PREFIX});
+ ASSERT_EQ(TWCoinTypeStaticPrefix(coin), {STATIC_PREFIX});
+ assertStringsEqual(txUrl, "{EXPLORER_URL}{EXPLORER_TX_PATH}{EXPLORER_SAMPLE_TX}");
+ assertStringsEqual(accUrl, "{EXPLORER_URL}{EXPLORER_ACCOUNT_PATH}{EXPLORER_SAMPLE_ACCOUNT}");
+}
diff --git a/codegen-v2/src/codegen/cpp/tw_any_address_tests_generator.rs b/codegen-v2/src/codegen/cpp/tw_any_address_tests_generator.rs
new file mode 100644
index 00000000000..599ea265235
--- /dev/null
+++ b/codegen-v2/src/codegen/cpp/tw_any_address_tests_generator.rs
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::cpp::coin_integration_tests_directory;
+use crate::codegen::template_generator::TemplateGenerator;
+use crate::registry::CoinItem;
+use crate::Result;
+use std::fs;
+use std::path::PathBuf;
+
+const TW_ANY_ADDRESS_TESTS_TEMPLATE: &str = include_str!("templates/TWAnyAddressTests.cpp");
+
+pub fn tw_any_address_tests_path(coin: &CoinItem) -> PathBuf {
+ coin_integration_tests_directory(coin).join("TWAnyAddressTests.cpp")
+}
+
+pub struct TWAnyAddressTestsGenerator;
+
+impl TWAnyAddressTestsGenerator {
+ pub fn generate(coin: &CoinItem) -> Result<()> {
+ let coin_tests_dir = coin_integration_tests_directory(coin);
+ let tw_any_address_tests_path = coin_tests_dir.join("TWAnyAddressTests.cpp");
+
+ fs::create_dir_all(coin_tests_dir)?;
+ if tw_any_address_tests_path.exists() {
+ println!("[SKIP] {tw_any_address_tests_path:?} already exists");
+ return Ok(());
+ }
+
+ println!("[ADD] {tw_any_address_tests_path:?}");
+ TemplateGenerator::new(TW_ANY_ADDRESS_TESTS_TEMPLATE)
+ .write_to(tw_any_address_tests_path)
+ .with_default_patterns(coin)
+ .write()?;
+
+ Ok(())
+ }
+}
diff --git a/codegen-v2/src/codegen/cpp/tw_any_signer_tests_generator.rs b/codegen-v2/src/codegen/cpp/tw_any_signer_tests_generator.rs
new file mode 100644
index 00000000000..9ea4337616a
--- /dev/null
+++ b/codegen-v2/src/codegen/cpp/tw_any_signer_tests_generator.rs
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::cpp::coin_integration_tests_directory;
+use crate::codegen::template_generator::TemplateGenerator;
+use crate::registry::CoinItem;
+use crate::Result;
+use std::fs;
+use std::path::PathBuf;
+
+const TW_ANY_SIGNER_TESTS_TEMPLATE: &str = include_str!("templates/TWAnySignerTests.cpp");
+
+pub fn tw_any_signer_tests_path(coin: &CoinItem) -> PathBuf {
+ coin_integration_tests_directory(coin).join("TWAnySignerTests.cpp")
+}
+
+pub struct TWAnySignerTestsGenerator;
+
+impl TWAnySignerTestsGenerator {
+ pub fn generate(coin: &CoinItem) -> Result<()> {
+ let coin_tests_dir = coin_integration_tests_directory(coin);
+ let tw_any_signer_tests_path = coin_tests_dir.join("TWAnySignerTests.cpp");
+
+ fs::create_dir_all(coin_tests_dir)?;
+ if tw_any_signer_tests_path.exists() {
+ println!("[SKIP] {tw_any_signer_tests_path:?} already exists");
+ return Ok(());
+ }
+
+ println!("[ADD] {tw_any_signer_tests_path:?}");
+ TemplateGenerator::new(TW_ANY_SIGNER_TESTS_TEMPLATE)
+ .write_to(tw_any_signer_tests_path)
+ .with_default_patterns(coin)
+ .write()?;
+
+ Ok(())
+ }
+}
diff --git a/codegen-v2/src/codegen/cpp/tw_blockchain.rs b/codegen-v2/src/codegen/cpp/tw_blockchain.rs
new file mode 100644
index 00000000000..a76a73ab055
--- /dev/null
+++ b/codegen-v2/src/codegen/cpp/tw_blockchain.rs
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::cpp::cpp_include_directory;
+use crate::registry::CoinItem;
+use crate::utils::FileContent;
+use crate::Result;
+use std::path::PathBuf;
+
+/// An offset because of removed blockchain enum types.
+const BLOCKCHAIN_TYPE_OFFSET: usize = 2;
+
+pub fn tw_blockchain_path() -> PathBuf {
+ cpp_include_directory().join("TWBlockchain.h")
+}
+
+/// Represents `TWBlockchain.h`.
+pub struct TWBlockchainGenerator;
+
+impl TWBlockchainGenerator {
+ pub fn generate_blockchain_type_variant(coin: &CoinItem) -> Result<()> {
+ let coin_type = coin.blockchain_type();
+ let tw_blockchain_type_path = tw_blockchain_path();
+
+ println!("[EDIT] {tw_blockchain_type_path:?}");
+ let mut tw_blockchain_type_rs = FileContent::read(tw_blockchain_type_path)?;
+
+ {
+ let mut enum_region =
+ tw_blockchain_type_rs.find_region_with_prefix(" TWBlockchain")?;
+ // Add an offset because of removed blockchain enum types.
+ let new_blockchain_id = enum_region.count_lines() + BLOCKCHAIN_TYPE_OFFSET;
+ enum_region.push_line(format!(
+ " TWBlockchain{coin_type} = {new_blockchain_id},"
+ ));
+ }
+
+ tw_blockchain_type_rs.write()
+ }
+}
diff --git a/codegen-v2/src/codegen/cpp/tw_coin_address_derivation_tests_generator.rs b/codegen-v2/src/codegen/cpp/tw_coin_address_derivation_tests_generator.rs
new file mode 100644
index 00000000000..91321dffb05
--- /dev/null
+++ b/codegen-v2/src/codegen/cpp/tw_coin_address_derivation_tests_generator.rs
@@ -0,0 +1,65 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::cpp::integration_tests_directory;
+use crate::registry::CoinItem;
+use crate::utils::FileContent;
+use crate::Result;
+use std::path::PathBuf;
+
+const COIN_ADDRESS_DERIVATION_TESTS_END: &str =
+ "end_of_coin_address_derivation_tests_marker_do_not_modify";
+const EVM_ADDRESS_DERIVATION_TESTS_END: &str =
+ "end_of_evm_address_derivation_tests_marker_do_not_modify";
+
+pub fn coin_address_derivation_tests_path() -> PathBuf {
+ integration_tests_directory()
+ .join("common")
+ .join("CoinAddressDerivationTests.cpp")
+}
+
+/// Represents `CoinAddressDerivationTests.cpp`.
+pub struct CoinAddressDerivationTestsGenerator;
+
+impl CoinAddressDerivationTestsGenerator {
+ pub fn generate_new_coin_type_case(coin: &CoinItem) -> Result<()> {
+ let coin_type = coin.coin_type();
+ let test_path = coin_address_derivation_tests_path();
+ println!("[EDIT] {test_path:?}");
+
+ let mut coin_address_derivation_test_rs = FileContent::read(test_path)?;
+
+ {
+ let mut switch_case_region = coin_address_derivation_test_rs
+ .rfind_line(|line| line.contains(COIN_ADDRESS_DERIVATION_TESTS_END))?;
+
+ #[rustfmt::skip]
+ let test_case = format!(
+r#" case TWCoinType{coin_type}:
+ EXPECT_EQ(address, "__TODO__");
+ break;"#
+);
+
+ switch_case_region.push_paragraph_before(test_case);
+ }
+
+ coin_address_derivation_test_rs.write()
+ }
+
+ pub fn generate_new_evm_coin_type_case(coin: &CoinItem) -> Result<()> {
+ let coin_type = coin.coin_type();
+ let test_path = coin_address_derivation_tests_path();
+ println!("[EDIT] {test_path:?}");
+
+ let mut evm_address_derivation_test_rs = FileContent::read(test_path)?;
+
+ {
+ let mut switch_case_region = evm_address_derivation_test_rs
+ .rfind_line(|line| line.contains(EVM_ADDRESS_DERIVATION_TESTS_END))?;
+ switch_case_region.push_line_before(format!(" case TWCoinType{coin_type}:"));
+ }
+
+ evm_address_derivation_test_rs.write()
+ }
+}
diff --git a/codegen-v2/src/codegen/cpp/tw_coin_type_generator.rs b/codegen-v2/src/codegen/cpp/tw_coin_type_generator.rs
new file mode 100644
index 00000000000..0271838af03
--- /dev/null
+++ b/codegen-v2/src/codegen/cpp/tw_coin_type_generator.rs
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::cpp::cpp_include_directory;
+use crate::registry::CoinItem;
+use crate::utils::FileContent;
+use crate::Result;
+use std::path::PathBuf;
+
+const TW_COIN_TYPE_END: &str = "end_of_tw_coin_type_marker_do_not_modify";
+
+pub fn tw_coin_type_path() -> PathBuf {
+ cpp_include_directory().join("TWCoinType.h")
+}
+
+/// Represents `TWCoinType.h`.
+pub struct TWCoinTypeGenerator;
+
+impl TWCoinTypeGenerator {
+ pub fn generate_coin_type_variant(coin: &CoinItem) -> Result<()> {
+ let coin_type = coin.coin_type();
+ let coin_id_number = coin.coin_id_number;
+ let tw_coin_type_file_path = tw_coin_type_path();
+
+ println!("[EDIT] {tw_coin_type_file_path:?}");
+ let mut tw_coin_type_rs = FileContent::read(tw_coin_type_file_path)?;
+
+ {
+ let mut enum_region =
+ tw_coin_type_rs.rfind_line(|line| line.contains(TW_COIN_TYPE_END))?;
+ enum_region.push_line_before(format!(" TWCoinType{coin_type} = {coin_id_number},"));
+ }
+
+ tw_coin_type_rs.write()
+ }
+}
diff --git a/codegen-v2/src/codegen/cpp/tw_coin_type_tests_generator.rs b/codegen-v2/src/codegen/cpp/tw_coin_type_tests_generator.rs
new file mode 100644
index 00000000000..a3f9f50c5da
--- /dev/null
+++ b/codegen-v2/src/codegen/cpp/tw_coin_type_tests_generator.rs
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::cpp::{
+ coin_integration_tests_directory, cosmos_coin_integration_tests_directory,
+};
+use crate::codegen::template_generator::TemplateGenerator;
+use crate::registry::CoinItem;
+use crate::Result;
+use std::fs;
+use std::path::PathBuf;
+
+const TW_COIN_TYPE_TESTS_TEMPLATE: &str = include_str!("templates/TWCoinTypeTests.cpp");
+
+pub fn tw_coin_type_tests_path(coin: &CoinItem) -> PathBuf {
+ coin_integration_tests_directory(coin).join("TWCoinTypeTests.cpp")
+}
+
+pub struct TWCoinTypeTestsGenerator;
+
+impl TWCoinTypeTestsGenerator {
+ pub fn generate(coin: &CoinItem) -> Result<()> {
+ let coin_tests_dir = coin_integration_tests_directory(coin);
+ Self::generate_at(coin, coin_tests_dir)
+ }
+
+ pub fn generate_cosmos(coin: &CoinItem) -> Result<()> {
+ let cosmos_coin_tests_dir = cosmos_coin_integration_tests_directory(coin);
+ Self::generate_at(coin, cosmos_coin_tests_dir)
+ }
+
+ fn generate_at(coin: &CoinItem, coin_tests_dir: PathBuf) -> Result<()> {
+ let tw_coin_type_tests_path = coin_tests_dir.join("TWCoinTypeTests.cpp");
+
+ fs::create_dir(coin_tests_dir)?;
+ if tw_coin_type_tests_path.exists() {
+ println!("[SKIP] {tw_coin_type_tests_path:?} already exists");
+ return Ok(());
+ }
+
+ println!("[ADD] {tw_coin_type_tests_path:?}");
+ TemplateGenerator::new(TW_COIN_TYPE_TESTS_TEMPLATE)
+ .write_to(tw_coin_type_tests_path)
+ .with_default_patterns(coin)
+ .write()?;
+
+ Ok(())
+ }
+}
diff --git a/codegen-v2/src/codegen/mod.rs b/codegen-v2/src/codegen/mod.rs
index 52487305973..1d8522e6b9f 100644
--- a/codegen-v2/src/codegen/mod.rs
+++ b/codegen-v2/src/codegen/mod.rs
@@ -1,7 +1,9 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
+pub mod cpp;
+pub mod proto;
+pub mod rust;
pub mod swift;
+pub mod template_generator;
diff --git a/codegen-v2/src/codegen/proto/mod.rs b/codegen-v2/src/codegen/proto/mod.rs
new file mode 100644
index 00000000000..47d3e1a2dd5
--- /dev/null
+++ b/codegen-v2/src/codegen/proto/mod.rs
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use std::env;
+use std::path::PathBuf;
+
+pub mod new_blockchain;
+pub mod proto_generator;
+
+pub fn proto_source_directory() -> PathBuf {
+ PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
+ .join("..")
+ .join("src")
+ .join("proto")
+}
diff --git a/codegen-v2/src/codegen/proto/new_blockchain.rs b/codegen-v2/src/codegen/proto/new_blockchain.rs
new file mode 100644
index 00000000000..9e5f51a5387
--- /dev/null
+++ b/codegen-v2/src/codegen/proto/new_blockchain.rs
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::proto::proto_generator::ProtoGenerator;
+use crate::registry::CoinItem;
+use crate::Result;
+
+pub fn new_blockchain(coin: &CoinItem) -> Result<()> {
+ ProtoGenerator::generate(coin)
+}
diff --git a/codegen-v2/src/codegen/proto/proto_generator.rs b/codegen-v2/src/codegen/proto/proto_generator.rs
new file mode 100644
index 00000000000..f2cdfd94a86
--- /dev/null
+++ b/codegen-v2/src/codegen/proto/proto_generator.rs
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::proto::proto_source_directory;
+use crate::codegen::template_generator::TemplateGenerator;
+use crate::registry::CoinItem;
+use crate::Result;
+use std::path::PathBuf;
+
+const PROTO_TEMPLATE: &str = include_str!("templates/Blockchain.proto");
+
+pub fn blockchain_proto_path(coin: &CoinItem) -> PathBuf {
+ let blockchain_type = coin.blockchain_type();
+ proto_source_directory().join(format!("{blockchain_type}.proto"))
+}
+
+pub struct ProtoGenerator;
+
+impl ProtoGenerator {
+ pub fn generate(coin: &CoinItem) -> Result<()> {
+ let proto_path = blockchain_proto_path(coin);
+
+ if proto_path.exists() {
+ println!("[SKIP] Protobuf interface already exists: {proto_path:?}");
+ return Ok(());
+ }
+
+ println!("[ADD] {proto_path:?}");
+ TemplateGenerator::new(PROTO_TEMPLATE)
+ .write_to(proto_path)
+ .with_default_patterns(coin)
+ .write()?;
+
+ Ok(())
+ }
+}
diff --git a/codegen-v2/src/codegen/proto/templates/Blockchain.proto b/codegen-v2/src/codegen/proto/templates/Blockchain.proto
new file mode 100644
index 00000000000..9c4c6e34478
--- /dev/null
+++ b/codegen-v2/src/codegen/proto/templates/Blockchain.proto
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+syntax = "proto3";
+
+package TW.{BLOCKCHAIN}.Proto;
+option java_package = "wallet.core.jni.proto";
+
+import "Common.proto";
+
+// TODO: typical balance transfer, add more fields needed to sign
+message TransferMessage {
+ int64 amount = 1;
+ int64 fee = 2;
+ string to = 3;
+}
+
+// TODO: Input data necessary to create a signed transaction.
+message SigningInput {
+ bytes private_key = 1;
+
+ oneof message_oneof {
+ TransferMessage transfer = 2;
+ }
+}
+
+// Transaction signing output.
+message SigningOutput {
+ // Signed and encoded transaction bytes.
+ bytes encoded = 1;
+
+ // A possible error, `OK` if none.
+ Common.Proto.SigningError error = 2;
+
+ string error_message = 3;
+}
diff --git a/codegen-v2/src/codegen/rust/blockchain_dispatcher_generator.rs b/codegen-v2/src/codegen/rust/blockchain_dispatcher_generator.rs
new file mode 100644
index 00000000000..92f98bac940
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/blockchain_dispatcher_generator.rs
@@ -0,0 +1,79 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::rust::coin_registry_directory;
+use crate::registry::CoinItem;
+use crate::utils::FileContent;
+use crate::Result;
+use std::path::PathBuf;
+
+const BLOCKCHAIN_ENTRIES_START: &str = "start_of_blockchain_entries";
+const BLOCKCHAIN_ENTRIES_END: &str = "end_of_blockchain_entries";
+const BLOCKCHAIN_DISPATCHER_START: &str = "start_of_blockchain_dispatcher";
+const BLOCKCHAIN_DISPATCHER_END: &str = "end_of_blockchain_dispatcher";
+
+pub fn dispatcher_path() -> PathBuf {
+ coin_registry_directory().join("src").join("dispatcher.rs")
+}
+
+pub struct BlockchainDispatcherGenerator;
+
+impl BlockchainDispatcherGenerator {
+ pub fn generate_new_blockchain_type_dispatching(coin: &CoinItem) -> Result<()> {
+ let dispatcher_rs_path = dispatcher_path();
+ println!("[EDIT] {dispatcher_rs_path:?}");
+ let mut dispatcher_rs = FileContent::read(dispatcher_rs_path)?;
+
+ Self::generate_use_of_blockchain_entry(coin, &mut dispatcher_rs)?;
+ Self::generate_blockchain_entry_constant(coin, &mut dispatcher_rs)?;
+ Self::generate_blockchain_dispatch(coin, &mut dispatcher_rs)?;
+
+ dispatcher_rs.write()
+ }
+
+ fn generate_use_of_blockchain_entry(
+ coin: &CoinItem,
+ file_content: &mut FileContent,
+ ) -> Result<()> {
+ let import_pattern = "use ";
+ let blockchain_entry = coin.blockchain_entry();
+ let tw_crate_name = coin.id.to_tw_crate_name();
+
+ let mut last_entry = file_content.rfind_line(|line| line.contains(import_pattern))?;
+ last_entry.push_line_after(format!("use {tw_crate_name}::entry::{blockchain_entry};"));
+
+ Ok(())
+ }
+
+ fn generate_blockchain_entry_constant(
+ coin: &CoinItem,
+ file_content: &mut FileContent,
+ ) -> Result<()> {
+ let blockchain_entry = coin.blockchain_entry();
+ let blockchain_entry_const = coin.blockchain_entry_upper_snake();
+
+ let mut entries_region = file_content
+ .find_region_with_comments(BLOCKCHAIN_ENTRIES_START, BLOCKCHAIN_ENTRIES_END)?;
+ entries_region.push_line(format!(
+ "const {blockchain_entry_const}: {blockchain_entry} = {blockchain_entry};"
+ ));
+ entries_region.sort();
+
+ Ok(())
+ }
+
+ fn generate_blockchain_dispatch(coin: &CoinItem, file_content: &mut FileContent) -> Result<()> {
+ let blockchain_type = coin.blockchain_type();
+ let blockchain_entry_const = coin.blockchain_entry_upper_snake();
+
+ let mut dispatcher_region = file_content
+ .find_region_with_comments(BLOCKCHAIN_DISPATCHER_START, BLOCKCHAIN_DISPATCHER_END)?;
+ dispatcher_region.push_line(format!(
+ " BlockchainType::{blockchain_type} => Ok(&{blockchain_entry_const}),"
+ ));
+ dispatcher_region.sort();
+
+ Ok(())
+ }
+}
diff --git a/codegen-v2/src/codegen/rust/blockchain_type_generator.rs b/codegen-v2/src/codegen/rust/blockchain_type_generator.rs
new file mode 100644
index 00000000000..4895bf8a923
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/blockchain_type_generator.rs
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::rust::coin_registry_directory;
+use crate::registry::CoinItem;
+use crate::utils::FileContent;
+use crate::Result;
+use std::path::PathBuf;
+
+const BLOCKCHAIN_TYPE_START: &str = "start_of_blockchain_type";
+const BLOCKCHAIN_TYPE_END: &str = "end_of_blockchain_type";
+
+pub fn blockchain_type_path() -> PathBuf {
+ coin_registry_directory()
+ .join("src")
+ .join("blockchain_type.rs")
+}
+
+/// Represents `BlockchainType` enum generator.
+pub struct BlockchainTypeGenerator;
+
+impl BlockchainTypeGenerator {
+ pub fn add_new_blockchain_type(coin: &CoinItem) -> Result<()> {
+ let blockchain_type_rs_path = blockchain_type_path();
+ let blockchain_type = coin.blockchain_type();
+
+ println!("[EDIT] {blockchain_type_rs_path:?}");
+ let mut blockchain_type_rs = FileContent::read(blockchain_type_rs_path)?;
+
+ {
+ let mut enum_region = blockchain_type_rs
+ .find_region_with_comments(BLOCKCHAIN_TYPE_START, BLOCKCHAIN_TYPE_END)?;
+ enum_region.push_line(format!(" {blockchain_type},"));
+ enum_region.sort();
+ }
+
+ blockchain_type_rs.write()
+ }
+}
diff --git a/codegen-v2/src/codegen/rust/coin_address_derivation_test_generator.rs b/codegen-v2/src/codegen/rust/coin_address_derivation_test_generator.rs
new file mode 100644
index 00000000000..4d339cb05ad
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/coin_address_derivation_test_generator.rs
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::rust::tw_tests_directory;
+use crate::registry::CoinItem;
+use crate::utils::FileContent;
+use crate::Result;
+use std::path::PathBuf;
+
+const COIN_ADDRESS_DERIVATION_TEST_END: &str =
+ "end_of_coin_address_derivation_tests_marker_do_not_modify";
+const EVM_ADDRESS_DERIVATION_TEST_END: &str =
+ "end_of_evm_address_derivation_tests_marker_do_not_modify";
+
+pub fn coin_address_derivation_test_path() -> PathBuf {
+ tw_tests_directory()
+ .join("tests")
+ .join("coin_address_derivation_test.rs")
+}
+
+pub struct CoinAddressDerivationTestGenerator;
+
+impl CoinAddressDerivationTestGenerator {
+ pub fn generate_new_coin_type_case(coin: &CoinItem) -> Result<()> {
+ let test_path = coin_address_derivation_test_path();
+ let coin_type = coin.coin_type();
+
+ println!("[EDIT] {test_path:?}");
+ let mut coin_address_derivation_test_rs = FileContent::read(test_path)?;
+
+ {
+ let mut end_of_test = coin_address_derivation_test_rs
+ .rfind_line(|line| line.contains(COIN_ADDRESS_DERIVATION_TEST_END))?;
+ end_of_test.push_line_before(format!(" CoinType::{coin_type} => todo!(),"));
+ }
+
+ coin_address_derivation_test_rs.write()
+ }
+
+ pub fn generate_new_evm_coin_type_case(coin: &CoinItem) -> Result<()> {
+ let test_path = coin_address_derivation_test_path();
+ let coin_type = coin.coin_type();
+
+ println!("[EDIT] {test_path:?}");
+ let mut coin_address_derivation_test_rs = FileContent::read(test_path)?;
+
+ {
+ let mut end_of_test = coin_address_derivation_test_rs
+ .rfind_line(|line| line.contains(EVM_ADDRESS_DERIVATION_TEST_END))?;
+ end_of_test.push_line_before(format!(" | CoinType::{coin_type}"));
+ }
+
+ coin_address_derivation_test_rs.write()
+ }
+}
diff --git a/codegen-v2/src/codegen/rust/coin_crate.rs b/codegen-v2/src/codegen/rust/coin_crate.rs
new file mode 100644
index 00000000000..0e1b133f171
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/coin_crate.rs
@@ -0,0 +1,95 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::rust::chains_directory;
+use crate::codegen::template_generator::TemplateGenerator;
+use crate::coin_id::CoinId;
+use crate::registry::CoinItem;
+use crate::Result;
+use std::fs;
+use std::path::PathBuf;
+
+const BLOCKCHAIN_ADDRESS_TEMPLATE: &str = include_str!("templates/blockchain_crate/address.rs");
+const BLOCKCHAIN_COMPILER_TEMPLATE: &str = include_str!("templates/blockchain_crate/compiler.rs");
+const BLOCKCHAIN_ENTRY_TEMPLATE: &str = include_str!("templates/blockchain_crate/entry.rs");
+const BLOCKCHAIN_MANIFEST_TEMPLATE: &str = include_str!("templates/blockchain_crate/Cargo.toml");
+const BLOCKCHAIN_LIB_TEMPLATE: &str = include_str!("templates/blockchain_crate/lib.rs");
+const BLOCKCHAIN_SIGNER_TEMPLATE: &str = include_str!("templates/blockchain_crate/signer.rs");
+
+pub fn coin_source_directory(id: &CoinId) -> PathBuf {
+ chains_directory().join(id.to_tw_crate_name())
+}
+
+pub struct CoinCrate {
+ coin: CoinItem,
+}
+
+impl CoinCrate {
+ pub fn new(coin: CoinItem) -> CoinCrate {
+ CoinCrate { coin }
+ }
+
+ /// Creates a Cargo crate with `entry.rs` file.
+ /// Returns the path to the create crate.
+ pub fn create(self) -> Result {
+ let blockchain_path = coin_source_directory(&self.coin.id);
+ let blockchain_toml_path = blockchain_path.join("Cargo.toml");
+
+ let blockchain_src_path = blockchain_path.join("src");
+ let blockchain_lib_rs_path = blockchain_src_path.join("lib.rs");
+ let blockchain_entry_path = blockchain_src_path.join("entry.rs");
+ let blockchain_compiler_path = blockchain_src_path.join("compiler.rs");
+ let blockchain_address_rs_path = blockchain_src_path.join("address.rs");
+ let blockchain_signer_rs_path = blockchain_src_path.join("signer.rs");
+
+ if blockchain_path.exists() {
+ let tw_crate_name = self.coin.id.to_tw_crate_name();
+ println!(
+ "[SKIP] '{tw_crate_name}' blockchain crate already exists: {blockchain_path:?}"
+ );
+ return Ok(blockchain_path);
+ }
+
+ fs::create_dir_all(&blockchain_path)?;
+ fs::create_dir_all(&blockchain_src_path)?;
+
+ println!("[ADD] {blockchain_toml_path:?}");
+ TemplateGenerator::new(BLOCKCHAIN_MANIFEST_TEMPLATE)
+ .write_to(blockchain_toml_path)
+ .with_default_patterns(&self.coin)
+ .write()?;
+
+ println!("[ADD] {blockchain_lib_rs_path:?}");
+ TemplateGenerator::new(BLOCKCHAIN_LIB_TEMPLATE)
+ .write_to(blockchain_lib_rs_path)
+ .with_default_patterns(&self.coin)
+ .write()?;
+
+ println!("[ADD] {blockchain_entry_path:?}");
+ TemplateGenerator::new(BLOCKCHAIN_ENTRY_TEMPLATE)
+ .write_to(blockchain_entry_path)
+ .with_default_patterns(&self.coin)
+ .write()?;
+
+ println!("[ADD] {blockchain_compiler_path:?}");
+ TemplateGenerator::new(BLOCKCHAIN_COMPILER_TEMPLATE)
+ .write_to(blockchain_compiler_path)
+ .with_default_patterns(&self.coin)
+ .write()?;
+
+ println!("[ADD] {blockchain_address_rs_path:?}");
+ TemplateGenerator::new(BLOCKCHAIN_ADDRESS_TEMPLATE)
+ .write_to(blockchain_address_rs_path)
+ .with_default_patterns(&self.coin)
+ .write()?;
+
+ println!("[ADD] {blockchain_signer_rs_path:?}");
+ TemplateGenerator::new(BLOCKCHAIN_SIGNER_TEMPLATE)
+ .write_to(blockchain_signer_rs_path)
+ .with_default_patterns(&self.coin)
+ .write()?;
+
+ Ok(blockchain_path)
+ }
+}
diff --git a/codegen-v2/src/codegen/rust/coin_integration_tests.rs b/codegen-v2/src/codegen/rust/coin_integration_tests.rs
new file mode 100644
index 00000000000..067462aacfc
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/coin_integration_tests.rs
@@ -0,0 +1,150 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::rust::tw_tests_directory;
+use crate::codegen::template_generator::TemplateGenerator;
+use crate::coin_id::CoinId;
+use crate::registry::CoinItem;
+use crate::utils::FileContent;
+use crate::Result;
+use std::fs;
+use std::path::PathBuf;
+
+const ADDRESS_TESTS_TEMPLATE: &str = include_str!("templates/integration_tests/address_tests.rs");
+const COSMOS_ADDRESS_TESTS_TEMPLATE: &str =
+ include_str!("templates/integration_tests/cosmos_address_tests.rs");
+const COMPILE_TESTS_TEMPLATE: &str = include_str!("templates/integration_tests/compile_tests.rs");
+const MOD_TESTS_TEMPLATE: &str = include_str!("templates/integration_tests/mod.rs");
+const MOD_ADDRESS_TESTS_TEMPLATE: &str = include_str!("templates/integration_tests/mod_address.rs");
+const SIGN_TESTS_TEMPLATE: &str = include_str!("templates/integration_tests/sign_tests.rs");
+
+pub fn chains_integration_tests_directory() -> PathBuf {
+ tw_tests_directory().join("tests").join("chains")
+}
+
+pub fn coin_integration_tests_directory(id: &CoinId) -> PathBuf {
+ chains_integration_tests_directory().join(id.as_str())
+}
+
+pub fn coin_address_derivation_test_path() -> PathBuf {
+ tw_tests_directory()
+ .join("tests")
+ .join("coin_address_derivation_test.rs")
+}
+
+pub struct CoinIntegrationTests {
+ coin: CoinItem,
+}
+
+impl CoinIntegrationTests {
+ pub fn new(coin: CoinItem) -> CoinIntegrationTests {
+ CoinIntegrationTests { coin }
+ }
+
+ pub fn create(self) -> Result {
+ let blockchain_tests_path = self.coin_tests_directory();
+ if blockchain_tests_path.exists() {
+ println!("[SKIP] integration tests already exists: {blockchain_tests_path:?}");
+ return Ok(blockchain_tests_path);
+ }
+
+ fs::create_dir_all(&blockchain_tests_path)?;
+
+ self.list_blockchain_in_chains_mod()?;
+ self.create_address_tests(ADDRESS_TESTS_TEMPLATE)?;
+ self.create_compile_tests()?;
+ self.create_sign_tests()?;
+ self.create_chain_tests_mod_rs(MOD_TESTS_TEMPLATE)?;
+
+ Ok(blockchain_tests_path)
+ }
+
+ /// For a Cosmos chain, it's enough to create address tests only, but with additional Bech32 prefix tests.
+ pub fn create_cosmos(self) -> Result {
+ let blockchain_tests_path = self.coin_tests_directory();
+ if blockchain_tests_path.exists() {
+ println!("[SKIP] integration tests already exists: {blockchain_tests_path:?}");
+ return Ok(blockchain_tests_path);
+ }
+
+ fs::create_dir_all(&blockchain_tests_path)?;
+
+ self.list_blockchain_in_chains_mod()?;
+ self.create_address_tests(COSMOS_ADDRESS_TESTS_TEMPLATE)?;
+ // `mod.rs` should contain `{COIN_TYPE}_address` module only.
+ self.create_chain_tests_mod_rs(MOD_ADDRESS_TESTS_TEMPLATE)?;
+
+ Ok(blockchain_tests_path)
+ }
+
+ fn coin_tests_directory(&self) -> PathBuf {
+ coin_integration_tests_directory(&self.coin.id)
+ }
+
+ fn create_address_tests(&self, template: &'static str) -> Result<()> {
+ let coin_id = self.coin.id.as_str();
+ let address_tests_path = self
+ .coin_tests_directory()
+ .join(format!("{coin_id}_address.rs"));
+
+ println!("[ADD] {address_tests_path:?}");
+ TemplateGenerator::new(template)
+ .write_to(address_tests_path)
+ .with_default_patterns(&self.coin)
+ .write()
+ }
+
+ fn create_compile_tests(&self) -> Result<()> {
+ let coin_id = self.coin.id.as_str();
+ let compile_tests_path = self
+ .coin_tests_directory()
+ .join(format!("{coin_id}_compile.rs"));
+
+ println!("[ADD] {compile_tests_path:?}");
+ TemplateGenerator::new(COMPILE_TESTS_TEMPLATE)
+ .write_to(compile_tests_path)
+ .with_default_patterns(&self.coin)
+ .write()
+ }
+
+ fn create_sign_tests(&self) -> Result<()> {
+ let coin_id = self.coin.id.as_str();
+ let sign_tests_path = self
+ .coin_tests_directory()
+ .join(format!("{coin_id}_sign.rs"));
+
+ println!("[ADD] {sign_tests_path:?}");
+ TemplateGenerator::new(SIGN_TESTS_TEMPLATE)
+ .write_to(sign_tests_path)
+ .with_default_patterns(&self.coin)
+ .write()
+ }
+
+ fn create_chain_tests_mod_rs(&self, template: &'static str) -> Result<()> {
+ let blockchain_tests_mod_path = self.coin_tests_directory().join("mod.rs");
+
+ println!("[ADD] {blockchain_tests_mod_path:?}");
+ TemplateGenerator::new(template)
+ .write_to(blockchain_tests_mod_path)
+ .with_default_patterns(&self.coin)
+ .write()
+ }
+
+ fn list_blockchain_in_chains_mod(&self) -> Result<()> {
+ let chains_mod_path = chains_integration_tests_directory().join("mod.rs");
+ let chain_id = self.coin.id.as_str();
+
+ println!("[EDIT] {chains_mod_path:?}");
+ let mut chains_mod_rs = FileContent::read(chains_mod_path)?;
+
+ {
+ let mod_pattern = "mod ";
+ let mut mod_region = chains_mod_rs.find_region_with_prefix(mod_pattern)?;
+ mod_region.push_line(format!("mod {chain_id};"));
+ mod_region.sort();
+ }
+
+ chains_mod_rs.write()
+ }
+}
diff --git a/codegen-v2/src/codegen/rust/coin_registry_manifest_generator.rs b/codegen-v2/src/codegen/rust/coin_registry_manifest_generator.rs
new file mode 100644
index 00000000000..2a63e90e336
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/coin_registry_manifest_generator.rs
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::rust::coin_registry_directory;
+use crate::codegen::rust::toml_editor::Dependencies;
+use crate::registry::CoinItem;
+use crate::Result;
+use std::path::Path;
+
+pub struct CoinRegistryManifestGenerator;
+
+impl CoinRegistryManifestGenerator {
+ pub fn add_dependency(coin: &CoinItem, path_to_new_blockchain_crate: &Path) -> Result<()> {
+ let path_to_cargo_manifest = coin_registry_directory().join("Cargo.toml");
+ println!("[EDIT] {path_to_cargo_manifest:?}");
+ Dependencies::new(path_to_cargo_manifest)
+ .insert_dependency(&coin.id.to_tw_crate_name(), path_to_new_blockchain_crate)
+ }
+}
diff --git a/codegen-v2/src/codegen/rust/mod.rs b/codegen-v2/src/codegen/rust/mod.rs
new file mode 100644
index 00000000000..a9de11f38fa
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/mod.rs
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use std::env;
+use std::path::PathBuf;
+
+pub mod blockchain_dispatcher_generator;
+pub mod blockchain_type_generator;
+pub mod coin_address_derivation_test_generator;
+pub mod coin_crate;
+pub mod coin_integration_tests;
+pub mod coin_registry_manifest_generator;
+pub mod new_blockchain;
+pub mod new_cosmos_chain;
+pub mod new_evmchain;
+pub mod toml_editor;
+
+pub fn rust_source_directory() -> PathBuf {
+ PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
+ .join("..")
+ .join("rust")
+}
+
+pub fn chains_directory() -> PathBuf {
+ rust_source_directory().join("chains")
+}
+
+pub fn tw_tests_directory() -> PathBuf {
+ rust_source_directory().join("tw_tests")
+}
+
+pub fn workspace_toml_path() -> PathBuf {
+ rust_source_directory().join("Cargo.toml")
+}
+
+pub fn coin_registry_directory() -> PathBuf {
+ rust_source_directory().join("tw_coin_registry")
+}
diff --git a/codegen-v2/src/codegen/rust/new_blockchain.rs b/codegen-v2/src/codegen/rust/new_blockchain.rs
new file mode 100644
index 00000000000..ca27f77b08e
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/new_blockchain.rs
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::rust::blockchain_dispatcher_generator::BlockchainDispatcherGenerator;
+use crate::codegen::rust::blockchain_type_generator::BlockchainTypeGenerator;
+use crate::codegen::rust::coin_address_derivation_test_generator::CoinAddressDerivationTestGenerator;
+use crate::codegen::rust::coin_crate::CoinCrate;
+use crate::codegen::rust::coin_integration_tests::CoinIntegrationTests;
+use crate::codegen::rust::coin_registry_manifest_generator::CoinRegistryManifestGenerator;
+use crate::codegen::rust::toml_editor::Workspace;
+use crate::codegen::rust::workspace_toml_path;
+use crate::registry::CoinItem;
+use crate::Result;
+
+pub fn new_blockchain(coin: &CoinItem) -> Result<()> {
+ // Create blockchain's crate.
+ let blockchain_crate_path = CoinCrate::new(coin.clone()).create()?;
+
+ // Insert the created crate to the workspace.
+ Workspace::new(workspace_toml_path()).insert_crate(&blockchain_crate_path)?;
+
+ // Create integration tests.
+ CoinIntegrationTests::new(coin.clone()).create()?;
+ CoinAddressDerivationTestGenerator::generate_new_coin_type_case(coin)?;
+
+ // Add the new blockchain to the `tw_coin_registry`.
+ BlockchainTypeGenerator::add_new_blockchain_type(coin)?;
+ CoinRegistryManifestGenerator::add_dependency(coin, &blockchain_crate_path)?;
+ BlockchainDispatcherGenerator::generate_new_blockchain_type_dispatching(coin)?;
+
+ Ok(())
+}
diff --git a/codegen-v2/src/codegen/rust/new_cosmos_chain.rs b/codegen-v2/src/codegen/rust/new_cosmos_chain.rs
new file mode 100644
index 00000000000..96151ff6446
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/new_cosmos_chain.rs
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::rust::coin_address_derivation_test_generator::CoinAddressDerivationTestGenerator;
+use crate::codegen::rust::coin_integration_tests::CoinIntegrationTests;
+use crate::registry::CoinItem;
+use crate::Result;
+
+pub fn new_cosmos_chain(coin: &CoinItem) -> Result<()> {
+ // Create integration tests.
+ CoinIntegrationTests::new(coin.clone()).create_cosmos()?;
+ CoinAddressDerivationTestGenerator::generate_new_coin_type_case(coin)?;
+
+ Ok(())
+}
diff --git a/codegen-v2/src/codegen/rust/new_evmchain.rs b/codegen-v2/src/codegen/rust/new_evmchain.rs
new file mode 100644
index 00000000000..f754fa5ba1b
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/new_evmchain.rs
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::codegen::rust::coin_address_derivation_test_generator::CoinAddressDerivationTestGenerator;
+use crate::registry::CoinItem;
+use crate::Result;
+
+pub fn new_evmchain(coin: &CoinItem) -> Result<()> {
+ // Modify integration tests.
+ CoinAddressDerivationTestGenerator::generate_new_evm_coin_type_case(coin)
+}
diff --git a/codegen-v2/src/codegen/rust/templates/blockchain_crate/Cargo.toml b/codegen-v2/src/codegen/rust/templates/blockchain_crate/Cargo.toml
new file mode 100644
index 00000000000..9d5a7a7d04a
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/templates/blockchain_crate/Cargo.toml
@@ -0,0 +1,10 @@
+[package]
+name = "{TW_CRATE_NAME}"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+tw_coin_entry = { path = "../../tw_coin_entry" }
+tw_keypair = { path = "../../tw_keypair" }
+tw_memory = { path = "../../tw_memory" }
+tw_proto = { path = "../../tw_proto" }
diff --git a/codegen-v2/src/codegen/rust/templates/blockchain_crate/address.rs b/codegen-v2/src/codegen/rust/templates/blockchain_crate/address.rs
new file mode 100644
index 00000000000..3ec4f8516b5
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/templates/blockchain_crate/address.rs
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use std::fmt;
+use std::str::FromStr;
+use tw_coin_entry::coin_entry::CoinAddress;
+use tw_coin_entry::error::prelude::*;
+use tw_memory::Data;
+
+pub struct {BLOCKCHAIN}Address {
+ // TODO add necessary fields.
+}
+
+impl CoinAddress for {BLOCKCHAIN}Address {
+ #[inline]
+ fn data(&self) -> Data {
+ todo!()
+ }
+}
+
+impl FromStr for {BLOCKCHAIN}Address {
+ type Err = AddressError;
+
+ fn from_str(_s: &str) -> Result {
+ todo!()
+ }
+}
+
+impl fmt::Display for {BLOCKCHAIN}Address {
+ fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ todo!()
+ }
+}
diff --git a/codegen-v2/src/codegen/rust/templates/blockchain_crate/compiler.rs b/codegen-v2/src/codegen/rust/templates/blockchain_crate/compiler.rs
new file mode 100644
index 00000000000..63d51f1df50
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/templates/blockchain_crate/compiler.rs
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use tw_coin_entry::coin_context::CoinContext;
+use tw_coin_entry::coin_entry::{PublicKeyBytes, SignatureBytes};
+use tw_coin_entry::error::prelude::*;
+use tw_coin_entry::signing_output_error;
+use tw_proto::{BLOCKCHAIN}::Proto;
+use tw_proto::TxCompiler::Proto as CompilerProto;
+
+pub struct {BLOCKCHAIN}Compiler;
+
+impl {BLOCKCHAIN}Compiler {
+ #[inline]
+ pub fn preimage_hashes(
+ coin: &dyn CoinContext,
+ input: Proto::SigningInput<'_>,
+ ) -> CompilerProto::PreSigningOutput<'static> {
+ Self::preimage_hashes_impl(coin, input)
+ .unwrap_or_else(|e| signing_output_error!(CompilerProto::PreSigningOutput, e))
+ }
+
+ fn preimage_hashes_impl(
+ _coin: &dyn CoinContext,
+ _input: Proto::SigningInput<'_>,
+ ) -> SigningResult> {
+ todo!()
+ }
+
+ #[inline]
+ pub fn compile(
+ coin: &dyn CoinContext,
+ input: Proto::SigningInput<'_>,
+ signatures: Vec,
+ public_keys: Vec,
+ ) -> Proto::SigningOutput<'static> {
+ Self::compile_impl(coin, input, signatures, public_keys)
+ .unwrap_or_else(|e| signing_output_error!(Proto::SigningOutput, e))
+ }
+
+ fn compile_impl(
+ _coin: &dyn CoinContext,
+ _input: Proto::SigningInput<'_>,
+ _signatures: Vec,
+ _public_keys: Vec,
+ ) -> SigningResult> {
+ todo!()
+ }
+}
diff --git a/codegen-v2/src/codegen/rust/templates/blockchain_crate/entry.rs b/codegen-v2/src/codegen/rust/templates/blockchain_crate/entry.rs
new file mode 100644
index 00000000000..9b1194bbb68
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/templates/blockchain_crate/entry.rs
@@ -0,0 +1,95 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::address::{BLOCKCHAIN}Address;
+use crate::compiler::{BLOCKCHAIN}Compiler;
+use crate::signer::{BLOCKCHAIN}Signer;
+use std::str::FromStr;
+use tw_coin_entry::coin_context::CoinContext;
+use tw_coin_entry::coin_entry::{CoinEntry, PublicKeyBytes, SignatureBytes};
+use tw_coin_entry::derivation::Derivation;
+use tw_coin_entry::error::prelude::*;
+use tw_coin_entry::modules::json_signer::NoJsonSigner;
+use tw_coin_entry::modules::message_signer::NoMessageSigner;
+use tw_coin_entry::modules::plan_builder::NoPlanBuilder;
+use tw_coin_entry::modules::transaction_decoder::NoTransactionDecoder;
+use tw_coin_entry::modules::transaction_util::NoTransactionUtil;
+use tw_coin_entry::modules::wallet_connector::NoWalletConnector;
+use tw_coin_entry::prefix::NoPrefix;
+use tw_keypair::tw::PublicKey;
+use tw_proto::{BLOCKCHAIN}::Proto;
+use tw_proto::TxCompiler::Proto as CompilerProto;
+
+pub struct {BLOCKCHAIN}Entry;
+
+impl CoinEntry for {BLOCKCHAIN}Entry {
+ type AddressPrefix = NoPrefix;
+ type Address = {BLOCKCHAIN}Address;
+ type SigningInput<'a> = Proto::SigningInput<'a>;
+ type SigningOutput = Proto::SigningOutput<'static>;
+ type PreSigningOutput = CompilerProto::PreSigningOutput<'static>;
+
+ // Optional modules:
+ type JsonSigner = NoJsonSigner;
+ type PlanBuilder = NoPlanBuilder;
+ type MessageSigner = NoMessageSigner;
+ type WalletConnector = NoWalletConnector;
+ type TransactionDecoder = NoTransactionDecoder;
+ type TransactionUtil = NoTransactionUtil;
+
+ #[inline]
+ fn parse_address(
+ &self,
+ _coin: &dyn CoinContext,
+ _address: &str,
+ _prefix: Option,
+ ) -> AddressResult {
+ todo!()
+ }
+
+ #[inline]
+ fn parse_address_unchecked(
+ &self,
+ _coin: &dyn CoinContext,
+ address: &str,
+ ) -> AddressResult {
+ {BLOCKCHAIN}Address::from_str(address)
+ }
+
+ #[inline]
+ fn derive_address(
+ &self,
+ _coin: &dyn CoinContext,
+ _public_key: PublicKey,
+ _derivation: Derivation,
+ _prefix: Option,
+ ) -> AddressResult {
+ todo!()
+ }
+
+ #[inline]
+ fn sign(&self, coin: &dyn CoinContext, input: Self::SigningInput<'_>) -> Self::SigningOutput {
+ {BLOCKCHAIN}Signer::sign(coin, input)
+ }
+
+ #[inline]
+ fn preimage_hashes(
+ &self,
+ coin: &dyn CoinContext,
+ input: Self::SigningInput<'_>,
+ ) -> Self::PreSigningOutput {
+ {BLOCKCHAIN}Compiler::preimage_hashes(coin, input)
+ }
+
+ #[inline]
+ fn compile(
+ &self,
+ coin: &dyn CoinContext,
+ input: Self::SigningInput<'_>,
+ signatures: Vec,
+ public_keys: Vec,
+ ) -> Self::SigningOutput {
+ {BLOCKCHAIN}Compiler::compile(coin, input, signatures, public_keys)
+ }
+}
diff --git a/codegen-v2/src/codegen/rust/templates/blockchain_crate/lib.rs b/codegen-v2/src/codegen/rust/templates/blockchain_crate/lib.rs
new file mode 100644
index 00000000000..c41edeb4471
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/templates/blockchain_crate/lib.rs
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+pub mod address;
+pub mod compiler;
+pub mod entry;
+pub mod signer;
diff --git a/codegen-v2/src/codegen/rust/templates/blockchain_crate/signer.rs b/codegen-v2/src/codegen/rust/templates/blockchain_crate/signer.rs
new file mode 100644
index 00000000000..3a64018e599
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/templates/blockchain_crate/signer.rs
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use tw_coin_entry::coin_context::CoinContext;
+use tw_coin_entry::error::prelude::*;
+use tw_coin_entry::signing_output_error;
+use tw_proto::{BLOCKCHAIN}::Proto;
+
+pub struct {BLOCKCHAIN}Signer;
+
+impl {BLOCKCHAIN}Signer {
+ pub fn sign(
+ coin: &dyn CoinContext,
+ input: Proto::SigningInput<'_>,
+ ) -> Proto::SigningOutput<'static> {
+ Self::sign_impl(coin, input)
+ .unwrap_or_else(|e| signing_output_error!(Proto::SigningOutput, e))
+ }
+
+ fn sign_impl(
+ _coin: &dyn CoinContext,
+ _input: Proto::SigningInput<'_>,
+ ) -> SigningResult> {
+ todo!()
+ }
+}
diff --git a/codegen-v2/src/codegen/rust/templates/integration_tests/address_tests.rs b/codegen-v2/src/codegen/rust/templates/integration_tests/address_tests.rs
new file mode 100644
index 00000000000..1d417a77ed4
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/templates/integration_tests/address_tests.rs
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use tw_any_coin::test_utils::address_utils::{
+ test_address_derive, test_address_get_data, test_address_invalid, test_address_normalization,
+ test_address_valid,
+};
+use tw_coin_registry::coin_type::CoinType;
+
+#[test]
+fn test_{COIN_ID}_address_derive() {
+ test_address_derive(CoinType::{COIN_TYPE}, "PRIVATE_KEY", "EXPECTED ADDRESS");
+}
+
+#[test]
+fn test_{COIN_ID}_address_normalization() {
+ test_address_normalization(CoinType::{COIN_TYPE}, "DENORMALIZED", "EXPECTED");
+}
+
+#[test]
+fn test_{COIN_ID}_address_is_valid() {
+ test_address_valid(CoinType::{COIN_TYPE}, "VALID ADDRESS");
+}
+
+#[test]
+fn test_{COIN_ID}_address_invalid() {
+ test_address_invalid(CoinType::{COIN_TYPE}, "INVALID ADDRESS");
+}
+
+#[test]
+fn test_{COIN_ID}_address_get_data() {
+ test_address_get_data(CoinType::{COIN_TYPE}, "ADDRESS", "HEX(DATA)");
+}
diff --git a/codegen-v2/src/codegen/rust/templates/integration_tests/compile_tests.rs b/codegen-v2/src/codegen/rust/templates/integration_tests/compile_tests.rs
new file mode 100644
index 00000000000..fad7f69330a
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/templates/integration_tests/compile_tests.rs
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+#[test]
+fn test_{COIN_ID}_compile() {
+ todo!()
+}
diff --git a/codegen-v2/src/codegen/rust/templates/integration_tests/cosmos_address_tests.rs b/codegen-v2/src/codegen/rust/templates/integration_tests/cosmos_address_tests.rs
new file mode 100644
index 00000000000..6bf6079ac9d
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/templates/integration_tests/cosmos_address_tests.rs
@@ -0,0 +1,69 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use tw_any_coin::test_utils::address_utils::{
+ test_address_bech32_is_valid, test_address_create_bech32_with_public_key,
+ test_address_get_data, test_address_invalid, test_address_normalization, test_address_valid,
+ AddressBech32IsValid, AddressCreateBech32WithPublicKey,
+};
+use tw_coin_registry::coin_type::CoinType;
+use tw_keypair::tw::PublicKeyType;
+
+#[test]
+fn test_{COIN_ID}_address_normalization() {
+ test_address_normalization(CoinType::{COIN_TYPE}, "DENORMALIZED", "EXPECTED");
+}
+
+#[test]
+fn test_{COIN_ID}_address_is_valid() {
+ test_address_valid(CoinType::{COIN_TYPE}, "VALID {COIN_TYPE} ADDRESS");
+}
+
+#[test]
+fn test_{COIN_ID}_address_invalid() {
+ test_address_invalid(CoinType::{COIN_TYPE}, "INVALID ADDRESS");
+ // Cosmos has a different `hrp`.
+ test_address_invalid(CoinType::Cosmos, "VALID {COIN_TYPE} ADDRESS");
+}
+
+#[test]
+fn test_{COIN_ID}_address_get_data() {
+ test_address_get_data(CoinType::{COIN_TYPE}, "ADDRESS", "HEX(DATA)");
+}
+
+#[test]
+fn test_{COIN_ID}_is_valid_bech32() {
+ // {COIN_TYPE} address must be valid if its Base32 prefix passed.
+ test_address_bech32_is_valid(AddressBech32IsValid {
+ coin: CoinType::{COIN_TYPE},
+ address: "{COIN_TYPE} ADDRESS",
+ hrp: "{HRP}",
+ });
+ // {COIN_TYPE} address must be valid for the standard Cosmos hub if its Base32 prefix passed.
+ test_address_bech32_is_valid(AddressBech32IsValid {
+ coin: CoinType::Cosmos,
+ address: "{COIN_TYPE} ADDRESS",
+ hrp: "{HRP}",
+ });
+ // Cosmos address must be valid with "cosmos" hrp.
+ test_address_bech32_is_valid(AddressBech32IsValid {
+ coin: CoinType::{COIN_TYPE},
+ address: "cosmos1hsk6jryyqjfhp5dhc55tc9jtckygx0eph6dd02",
+ hrp: "cosmos",
+ });
+}
+
+#[test]
+fn test_any_address_create_bech32_with_public_key() {
+ test_address_create_bech32_with_public_key(AddressCreateBech32WithPublicKey {
+ // TODO consider using `CoinType::{COIN_TYPE}` if the chain's `addressHasher` is different from Cosmos's.
+ coin: CoinType::Cosmos,
+ private_key: "PRIVATE_KEY",
+ // TODO consider using another `PublicKeyType` if the chain's `publicKeyType` is different from Cosmos's.
+ public_key_type: PublicKeyType::Secp256k1,
+ hrp: "{HRP}",
+ expected: "{COIN_TYPE} ADDRESS",
+ });
+}
+
diff --git a/codegen-v2/src/codegen/rust/templates/integration_tests/mod.rs b/codegen-v2/src/codegen/rust/templates/integration_tests/mod.rs
new file mode 100644
index 00000000000..15dccad969f
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/templates/integration_tests/mod.rs
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+mod {COIN_ID}_address;
+mod {COIN_ID}_compile;
+mod {COIN_ID}_sign;
diff --git a/codegen-v2/src/codegen/rust/templates/integration_tests/mod_address.rs b/codegen-v2/src/codegen/rust/templates/integration_tests/mod_address.rs
new file mode 100644
index 00000000000..6f501e180bc
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/templates/integration_tests/mod_address.rs
@@ -0,0 +1,5 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+mod {COIN_ID}_address;
diff --git a/codegen-v2/src/codegen/rust/templates/integration_tests/sign_tests.rs b/codegen-v2/src/codegen/rust/templates/integration_tests/sign_tests.rs
new file mode 100644
index 00000000000..38f01a4e0e1
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/templates/integration_tests/sign_tests.rs
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+#[test]
+fn test_{COIN_ID}_sign() {
+ todo!()
+}
diff --git a/codegen-v2/src/codegen/rust/toml_editor.rs b/codegen-v2/src/codegen/rust/toml_editor.rs
new file mode 100644
index 00000000000..0811182365d
--- /dev/null
+++ b/codegen-v2/src/codegen/rust/toml_editor.rs
@@ -0,0 +1,110 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::{Error, Result};
+use std::fs;
+use std::path::{Path, PathBuf};
+use std::str::FromStr;
+use toml_edit::{Document, InlineTable, Item, Value};
+
+const NEW_LINE_TAB_DECORATOR: &str = "\n ";
+const NO_DECORATOR: &str = "";
+
+pub struct Workspace {
+ path_to_toml: PathBuf,
+}
+
+impl Workspace {
+ pub fn new(path_to_toml: PathBuf) -> Workspace {
+ Workspace { path_to_toml }
+ }
+
+ pub fn insert_crate(self, path_to_crate: &Path) -> Result<()> {
+ let manifest = fs::read_to_string(&self.path_to_toml)?;
+ let mut manifest = Document::from_str(&manifest)?;
+
+ let members = manifest["workspace"]["members"]
+ .as_array_mut()
+ .ok_or(Error::TomlFormat(
+ "Invalid 'workspace' TOML format".to_string(),
+ ))?;
+
+ // Try to get a path to the crate relative to the `Cargo.toml`.
+ let relative_path_to_crate = relative_path_to_crate(&self.path_to_toml, path_to_crate)?;
+
+ // Push the new member, sort and save the manifest.
+
+ let relative_path_to_crate_decorated =
+ Value::from(relative_path_to_crate).decorated(NEW_LINE_TAB_DECORATOR, NO_DECORATOR);
+
+ members.push_formatted(relative_path_to_crate_decorated);
+ members.sort_by(|x, y| x.as_str().cmp(&y.as_str()));
+
+ fs::write(self.path_to_toml, manifest.to_string())?;
+ Ok(())
+ }
+}
+
+pub struct Dependencies {
+ path_to_toml: PathBuf,
+}
+
+impl Dependencies {
+ pub fn new(path_to_toml: PathBuf) -> Dependencies {
+ Dependencies { path_to_toml }
+ }
+
+ pub fn insert_dependency(self, dep_name: &str, path_to_dep_crate: &Path) -> Result<()> {
+ let manifest = fs::read_to_string(&self.path_to_toml)?;
+ let mut manifest = Document::from_str(&manifest)?;
+
+ let dependencies = manifest["dependencies"]
+ .as_table_like_mut()
+ .ok_or(Error::TomlFormat("Invalid 'Cargo.toml' format".to_string()))?;
+
+ // Try to get a path to the crate relative to the `Cargo.toml`.
+ let relative_path_to_crate = relative_path_to_crate(&self.path_to_toml, path_to_dep_crate)?;
+
+ // Create the new dependency member (aka a TOML inline table with `path` key-value).
+ let mut new_member = InlineTable::new();
+ new_member.insert("path", relative_path_to_crate.into());
+
+ // Push the new member, sort and save the manifest.
+ dependencies.insert(dep_name, Item::Value(Value::InlineTable(new_member)));
+ dependencies.sort_values();
+
+ fs::write(self.path_to_toml, manifest.to_string())?;
+
+ Ok(())
+ }
+}
+
+/// Returns a path to the dependency accordingly to the Cargo manifest file.
+/// The result string can be put to `Cargo.toml` as:
+/// ```toml
+/// tw_foo = { path = "" }
+/// ```
+fn relative_path_to_crate(
+ path_to_cargo_manifest: &Path,
+ path_to_dependency: &Path,
+) -> Result {
+ let absolute_path_to_crate_directory = path_to_cargo_manifest
+ .parent()
+ .ok_or_else(|| Error::io_error_other("Cannot get a parent directory".to_string()))?
+ .canonicalize()?;
+ let absolute_path_to_dependency = path_to_dependency.canonicalize()?;
+
+ let relative_path_to_dependency = pathdiff::diff_paths(
+ absolute_path_to_dependency,
+ absolute_path_to_crate_directory,
+ )
+ .ok_or_else(|| {
+ Error::io_error_other("Cannot get a relative path to the dependency".to_string())
+ })?
+ .to_str()
+ .ok_or_else(|| Error::io_error_other("Invalid path to the crate".to_string()))?
+ .to_string();
+
+ Ok(relative_path_to_dependency)
+}
diff --git a/codegen-v2/src/codegen/swift/functions.rs b/codegen-v2/src/codegen/swift/functions.rs
index 08573893865..1f7e4aa8d39 100644
--- a/codegen-v2/src/codegen/swift/functions.rs
+++ b/codegen-v2/src/codegen/swift/functions.rs
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
use super::*;
use crate::manifest::{FunctionInfo, TypeVariant};
diff --git a/codegen-v2/src/codegen/swift/inits.rs b/codegen-v2/src/codegen/swift/inits.rs
index 07de55e037d..a1f140c326e 100644
--- a/codegen-v2/src/codegen/swift/inits.rs
+++ b/codegen-v2/src/codegen/swift/inits.rs
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
use super::*;
use crate::manifest::InitInfo;
diff --git a/codegen-v2/src/codegen/swift/mod.rs b/codegen-v2/src/codegen/swift/mod.rs
index bb19c2d7478..4bc70e7e416 100644
--- a/codegen-v2/src/codegen/swift/mod.rs
+++ b/codegen-v2/src/codegen/swift/mod.rs
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
use self::functions::process_methods;
use self::inits::process_inits;
diff --git a/codegen-v2/src/codegen/swift/properties.rs b/codegen-v2/src/codegen/swift/properties.rs
index 0f19db983ba..61d73e7171f 100644
--- a/codegen-v2/src/codegen/swift/properties.rs
+++ b/codegen-v2/src/codegen/swift/properties.rs
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
use super::*;
use crate::manifest::PropertyInfo;
diff --git a/codegen-v2/src/codegen/swift/render.rs b/codegen-v2/src/codegen/swift/render.rs
index b7f68716b72..465a7277682 100644
--- a/codegen-v2/src/codegen/swift/render.rs
+++ b/codegen-v2/src/codegen/swift/render.rs
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
use super::{inits::process_deinits, *};
diff --git a/codegen-v2/src/codegen/swift/templates/WalletCore.h b/codegen-v2/src/codegen/swift/templates/WalletCore.h
index 98e432e9066..76f61b9fa74 100644
--- a/codegen-v2/src/codegen/swift/templates/WalletCore.h
+++ b/codegen-v2/src/codegen/swift/templates/WalletCore.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#import
diff --git a/codegen-v2/src/codegen/swift/templates/enum.hbs b/codegen-v2/src/codegen/swift/templates/enum.hbs
index e9fd0b59cf7..5363fb776b4 100644
--- a/codegen-v2/src/codegen/swift/templates/enum.hbs
+++ b/codegen-v2/src/codegen/swift/templates/enum.hbs
@@ -1,8 +1,6 @@
-// Copyright © 2017-{{current_year}} Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.
//
diff --git a/codegen-v2/src/codegen/swift/templates/extension.hbs b/codegen-v2/src/codegen/swift/templates/extension.hbs
index de51b918f76..ddae1f95ba6 100644
--- a/codegen-v2/src/codegen/swift/templates/extension.hbs
+++ b/codegen-v2/src/codegen/swift/templates/extension.hbs
@@ -1,8 +1,6 @@
-// Copyright © 2017-{{current_year}} Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.
//
diff --git a/codegen-v2/src/codegen/swift/templates/proto.hbs b/codegen-v2/src/codegen/swift/templates/proto.hbs
index aad05bf9191..23e1c541698 100644
--- a/codegen-v2/src/codegen/swift/templates/proto.hbs
+++ b/codegen-v2/src/codegen/swift/templates/proto.hbs
@@ -1,8 +1,6 @@
-// Copyright © 2017-{{current_year}} Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.
//
diff --git a/codegen-v2/src/codegen/swift/templates/struct.hbs b/codegen-v2/src/codegen/swift/templates/struct.hbs
index 6d7f9bb63ce..eccc0499fd7 100644
--- a/codegen-v2/src/codegen/swift/templates/struct.hbs
+++ b/codegen-v2/src/codegen/swift/templates/struct.hbs
@@ -1,8 +1,6 @@
-// Copyright © 2017-{{current_year}} Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.
//
diff --git a/codegen-v2/src/codegen/template_generator.rs b/codegen-v2/src/codegen/template_generator.rs
new file mode 100644
index 00000000000..7b725ba74e7
--- /dev/null
+++ b/codegen-v2/src/codegen/template_generator.rs
@@ -0,0 +1,80 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::registry::CoinItem;
+use crate::{current_year, Error, Result};
+use std::fs;
+use std::path::PathBuf;
+
+const PATTERNS_CAPACITY: usize = 20;
+
+pub struct TemplateGenerator {
+ template_content: &'static str,
+ write_to: Option,
+ to_replace: Vec,
+ replace_with: Vec,
+}
+
+impl TemplateGenerator {
+ pub fn new(template_content: &'static str) -> TemplateGenerator {
+ TemplateGenerator {
+ template_content,
+ write_to: None,
+ to_replace: Vec::with_capacity(PATTERNS_CAPACITY),
+ replace_with: Vec::with_capacity(PATTERNS_CAPACITY),
+ }
+ }
+
+ pub fn write_to(mut self, write_to: PathBuf) -> TemplateGenerator {
+ self.write_to = Some(write_to);
+ self
+ }
+
+ /// Use default patterns.
+ pub fn with_default_patterns(self, coin: &CoinItem) -> TemplateGenerator {
+ self.add_pattern("{YEAR}", current_year())
+ .add_pattern("{BLOCKCHAIN}", coin.blockchain_type())
+ .add_pattern("{TW_CRATE_NAME}", coin.id.to_tw_crate_name())
+ .add_pattern("{COIN_ID}", coin.id.as_str())
+ .add_pattern("{COIN_TYPE}", coin.coin_type())
+ .add_pattern("{COIN_NAME}", if coin.display_name.len() > 0 { &coin.display_name } else { &coin.name })
+ .add_pattern("{SYMBOL}", &coin.symbol)
+ .add_pattern("{DECIMALS}", coin.decimals)
+ .add_pattern("{P2PKH_PREFIX}", coin.p2pkh_prefix)
+ .add_pattern("{P2SH_PREFIX}", coin.p2sh_prefix)
+ .add_pattern("{HRP}", coin.hrp.as_str())
+ .add_pattern("{STATIC_PREFIX}", coin.static_prefix)
+ .add_pattern("{EXPLORER_URL}", &coin.explorer.url)
+ .add_pattern("{EXPLORER_TX_PATH}", &coin.explorer.tx_path)
+ .add_pattern("{EXPLORER_ACCOUNT_PATH}", &coin.explorer.account_path)
+ .add_pattern("{EXPLORER_SAMPLE_TX}", &coin.explorer.sample_tx)
+ .add_pattern("{EXPLORER_SAMPLE_ACCOUNT}", &coin.explorer.sample_account)
+ }
+
+ pub fn add_pattern(
+ mut self,
+ to_replace: K,
+ replace_with: V,
+ ) -> TemplateGenerator {
+ self.to_replace.push(to_replace.to_string());
+ self.replace_with.push(replace_with.to_string());
+ self
+ }
+
+ pub fn write(self) -> Result<()> {
+ let write_to_path = self.write_to.ok_or_else(|| {
+ Error::io_error_other("Incorrect use of 'TemplateGenerator'".to_string())
+ })?;
+ let file_to_write = fs::File::create(write_to_path)?;
+
+ aho_corasick::AhoCorasick::new(self.to_replace)
+ .map_err(|e| Error::io_error_other(format!("Invalid patterns: {e}")))?
+ .try_stream_replace_all(
+ self.template_content.as_bytes(),
+ file_to_write,
+ &self.replace_with,
+ )
+ .map_err(Error::from)
+ }
+}
diff --git a/codegen-v2/src/coin_id.rs b/codegen-v2/src/coin_id.rs
new file mode 100644
index 00000000000..87a6b9e13c4
--- /dev/null
+++ b/codegen-v2/src/coin_id.rs
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::{Error, Result};
+use serde::de::Error as SerdeError;
+use serde::{Deserialize, Deserializer};
+
+#[derive(Clone, Eq, PartialEq)]
+pub struct CoinId(String);
+
+impl CoinId {
+ /// Returns `Ok` if only the given `id` is a valid Rust identifier.
+ pub fn new(id: String) -> Result {
+ let first_letter = id
+ .chars()
+ .next()
+ .ok_or(Error::RegistryError("Invalid 'id'".to_string()))?;
+ let valid_chars = id.chars().all(|ch| ch.is_ascii_alphanumeric() || ch == '_');
+
+ if first_letter.is_numeric() || !valid_chars {
+ return Err(Error::RegistryError("Invalid 'id'".to_string()));
+ }
+ Ok(CoinId(id))
+ }
+
+ pub fn to_tw_crate_name(&self) -> String {
+ format!("tw_{}", self.0)
+ }
+
+ pub fn as_str(&self) -> &str {
+ &self.0
+ }
+}
+
+impl<'de> Deserialize<'de> for CoinId {
+ fn deserialize(deserializer: D) -> std::result::Result
+ where
+ D: Deserializer<'de>,
+ {
+ let id = String::deserialize(deserializer)?;
+ CoinId::new(id).map_err(|e| SerdeError::custom(format!("{e:?}")))
+ }
+}
diff --git a/codegen-v2/src/lib.rs b/codegen-v2/src/lib.rs
index ca6556bb44d..3e2c2e2e59d 100644
--- a/codegen-v2/src/lib.rs
+++ b/codegen-v2/src/lib.rs
@@ -1,20 +1,23 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#[macro_use]
extern crate serde;
use handlebars::{RenderError, TemplateError};
use serde_yaml::Error as YamlError;
+use std::io;
use std::io::Error as IoError;
+use toml_edit::TomlError;
pub mod codegen;
+pub mod coin_id;
pub mod manifest;
+pub mod registry;
#[cfg(test)]
mod tests;
+pub mod utils;
pub type Result = std::result::Result;
@@ -25,9 +28,17 @@ pub enum Error {
RenderError(RenderError),
TemplateError(TemplateError),
BadFormat(String),
+ RegistryError(String),
+ TomlFormat(String),
InvalidCommand,
}
+impl Error {
+ pub fn io_error_other(err: String) -> Error {
+ Error::IoError(IoError::new(io::ErrorKind::Other, err))
+ }
+}
+
impl From for Error {
fn from(err: IoError) -> Self {
Error::IoError(err)
@@ -52,6 +63,12 @@ impl From for Error {
}
}
+impl From for Error {
+ fn from(err: TomlError) -> Self {
+ Error::TomlFormat(err.to_string())
+ }
+}
+
fn current_year() -> u64 {
use std::time::{SystemTime, UNIX_EPOCH};
diff --git a/codegen-v2/src/main.rs b/codegen-v2/src/main.rs
index 1be255b2f20..53fd140cc65 100644
--- a/codegen-v2/src/main.rs
+++ b/codegen-v2/src/main.rs
@@ -1,11 +1,12 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
use libparser::codegen::swift::RenderIntput;
+use libparser::codegen::{cpp, proto, rust};
+use libparser::coin_id::CoinId;
use libparser::manifest::parse_dir;
+use libparser::registry::read_coin_from_registry;
use libparser::{Error, Result};
use std::fs::read_to_string;
@@ -17,11 +18,66 @@ fn main() -> Result<()> {
}
match args[1].as_str() {
+ "new-blockchain-rust" => new_blockchain_rust(&args[2..]),
+ "new-blockchain" => new_blockchain(&args[2..]),
+ "new-evmchain" => new_evmchain(&args[2..]),
+ "new-cosmos-chain" => new_cosmos_chain(&args[2..]),
"swift" => generate_swift_bindings(),
_ => Err(Error::InvalidCommand),
}
}
+fn new_blockchain_rust(args: &[String]) -> Result<()> {
+ let coin_str = args.iter().next().ok_or_else(|| Error::InvalidCommand)?;
+ let coin_id = CoinId::new(coin_str.clone())?;
+ let coin_item = read_coin_from_registry(&coin_id)?;
+
+ println!("New Rust blockchain template for coin '{coin_str}' requested");
+ rust::new_blockchain::new_blockchain(&coin_item)?;
+
+ Ok(())
+}
+
+fn new_blockchain(args: &[String]) -> Result<()> {
+ let coin_str = args.iter().next().ok_or_else(|| Error::InvalidCommand)?;
+ let coin_id = CoinId::new(coin_str.clone())?;
+ let coin_item = read_coin_from_registry(&coin_id)?;
+
+ println!("New '{coin_str}' blockchain template requested");
+
+ proto::new_blockchain::new_blockchain(&coin_item)?;
+ rust::new_blockchain::new_blockchain(&coin_item)?;
+ cpp::new_blockchain::new_blockchain(&coin_item)?;
+
+ Ok(())
+}
+
+fn new_evmchain(args: &[String]) -> Result<()> {
+ let coin_str = args.iter().next().ok_or_else(|| Error::InvalidCommand)?;
+ let coin_id = CoinId::new(coin_str.clone())?;
+ let coin_item = read_coin_from_registry(&coin_id)?;
+
+ println!("New '{coin_str}' EVM chain template requested");
+
+ rust::new_evmchain::new_evmchain(&coin_item)?;
+ cpp::new_evmchain::new_evmchain(&coin_item)?;
+
+ Ok(())
+}
+
+fn new_cosmos_chain(args: &[String]) -> Result<()> {
+ let coin_str = args.iter().next().ok_or_else(|| Error::InvalidCommand)?;
+ let coin_id = CoinId::new(coin_str.clone())?;
+ let coin_item = read_coin_from_registry(&coin_id)?;
+
+ println!("New '{coin_str}' Cosmos chain template requested");
+
+ rust::new_cosmos_chain::new_cosmos_chain(&coin_item)?;
+ cpp::new_cosmos_chain::new_cosmos_chain(&coin_item)?;
+
+ Ok(())
+}
+
fn generate_swift_bindings() -> Result<()> {
// NOTE: The paths will be configurable, eventually.
const OUT_DIR: &str = "bindings/";
diff --git a/codegen-v2/src/manifest.rs b/codegen-v2/src/manifest.rs
index 91ef48f1392..f70c24b2e5a 100644
--- a/codegen-v2/src/manifest.rs
+++ b/codegen-v2/src/manifest.rs
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
use super::Result;
use std::fs;
diff --git a/codegen-v2/src/registry.rs b/codegen-v2/src/registry.rs
new file mode 100644
index 00000000000..c83ef174dd0
--- /dev/null
+++ b/codegen-v2/src/registry.rs
@@ -0,0 +1,92 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::coin_id::CoinId;
+use crate::{Error, Result};
+use convert_case::{Case, Casing};
+use std::path::PathBuf;
+use std::{env, fs};
+
+pub fn registry_json_path() -> PathBuf {
+ PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
+ .join("..")
+ .join("registry.json")
+}
+
+#[derive(Clone, Deserialize)]
+pub struct CoinExplorer {
+ pub url: String,
+ #[serde(rename = "txPath")]
+ pub tx_path: String,
+ #[serde(rename = "accountPath")]
+ pub account_path: String,
+ #[serde(rename = "sampleTx")]
+ #[serde(default)]
+ pub sample_tx: String,
+ #[serde(rename = "sampleAccount")]
+ #[serde(default)]
+ pub sample_account: String,
+}
+
+#[derive(Clone, Deserialize)]
+pub struct CoinItem {
+ pub id: CoinId,
+ pub name: String,
+ #[serde(rename = "displayName")]
+ #[serde(default)]
+ pub display_name: String,
+ #[serde(rename = "coinId")]
+ pub coin_id_number: u32,
+ pub symbol: String,
+ pub decimals: u8,
+ pub blockchain: String,
+ #[serde(rename = "p2pkhPrefix")]
+ #[serde(default)]
+ pub p2pkh_prefix: u8,
+ #[serde(rename = "p2shPrefix")]
+ #[serde(default)]
+ pub p2sh_prefix: u8,
+ #[serde(rename = "staticPrefix")]
+ #[serde(default)]
+ pub static_prefix: u8,
+ #[serde(default)]
+ pub hrp: String,
+ pub explorer: CoinExplorer,
+}
+
+impl CoinItem {
+ /// Transforms a coin name to a Rust name.
+ /// https://github.com/trustwallet/wallet-core/blob/3769f31b7d0c75126b2f426bb065364429aaa379/codegen/lib/coin_skeleton_gen.rb#L15-L22
+ pub fn coin_type(&self) -> String {
+ self.name.replace([' ', '.', '-'], "")
+ }
+
+ /// Returns the blockchain type in `UpperCamel` case.
+ pub fn blockchain_type(&self) -> String {
+ self.blockchain.to_case(Case::UpperCamel)
+ }
+
+ /// Returns the blockchain type in `UPPER_SNAKE` case.
+ pub fn blockchain_entry_upper_snake(&self) -> String {
+ self.blockchain.to_case(Case::UpperSnake)
+ }
+
+ /// Returns a Rust blockchain entry of the blockchain.
+ pub fn blockchain_entry(&self) -> String {
+ format!("{}Entry", self.blockchain_type())
+ }
+}
+
+pub fn read_coin_from_registry(coin: &CoinId) -> Result {
+ let registry_path = registry_json_path();
+
+ let registry_bytes = fs::read(registry_path)?;
+ let coins: Vec =
+ serde_json::from_slice(®istry_bytes).map_err(|e| Error::RegistryError(e.to_string()))?;
+
+ coins
+ .into_iter()
+ .find(|item| item.id == *coin)
+ .ok_or(Error::InvalidCommand)
+}
diff --git a/codegen-v2/src/tests/mod.rs b/codegen-v2/src/tests/mod.rs
index 266d3913191..6a889017da4 100644
--- a/codegen-v2/src/tests/mod.rs
+++ b/codegen-v2/src/tests/mod.rs
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
use crate::codegen::swift::{render_to_strings, RenderIntput};
use crate::manifest::parse_str;
diff --git a/codegen-v2/src/tests/samples/class.output.swift b/codegen-v2/src/tests/samples/class.output.swift
index 0b5b7fbb3a1..ed7c0b000ac 100644
--- a/codegen-v2/src/tests/samples/class.output.swift
+++ b/codegen-v2/src/tests/samples/class.output.swift
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.
//
diff --git a/codegen-v2/src/tests/samples/enum.output.swift b/codegen-v2/src/tests/samples/enum.output.swift
index ebc0cd0b491..0e5b8346d6f 100644
--- a/codegen-v2/src/tests/samples/enum.output.swift
+++ b/codegen-v2/src/tests/samples/enum.output.swift
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.
//
diff --git a/codegen-v2/src/tests/samples/enum_extension.output.swift b/codegen-v2/src/tests/samples/enum_extension.output.swift
index afdd1d794cc..706368ee760 100644
--- a/codegen-v2/src/tests/samples/enum_extension.output.swift
+++ b/codegen-v2/src/tests/samples/enum_extension.output.swift
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.
//
diff --git a/codegen-v2/src/tests/samples/enum_private.output.swift b/codegen-v2/src/tests/samples/enum_private.output.swift
index b1f199054fe..b2cb22aea3a 100644
--- a/codegen-v2/src/tests/samples/enum_private.output.swift
+++ b/codegen-v2/src/tests/samples/enum_private.output.swift
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.
//
diff --git a/codegen-v2/src/tests/samples/non-associated.output.swift b/codegen-v2/src/tests/samples/non-associated.output.swift
index d4e8ee82477..478b8b1d6b5 100644
--- a/codegen-v2/src/tests/samples/non-associated.output.swift
+++ b/codegen-v2/src/tests/samples/non-associated.output.swift
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.
//
diff --git a/codegen-v2/src/tests/samples/optional.output.swift b/codegen-v2/src/tests/samples/optional.output.swift
index e2cef180240..a33b4afea58 100644
--- a/codegen-v2/src/tests/samples/optional.output.swift
+++ b/codegen-v2/src/tests/samples/optional.output.swift
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.
//
diff --git a/codegen-v2/src/tests/samples/private_class.output.swift b/codegen-v2/src/tests/samples/private_class.output.swift
index 0ce8618172f..2362367af00 100644
--- a/codegen-v2/src/tests/samples/private_class.output.swift
+++ b/codegen-v2/src/tests/samples/private_class.output.swift
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.
//
diff --git a/codegen-v2/src/tests/samples/struct.output.swift b/codegen-v2/src/tests/samples/struct.output.swift
index 927ffd1eac1..34f310c1eb8 100644
--- a/codegen-v2/src/tests/samples/struct.output.swift
+++ b/codegen-v2/src/tests/samples/struct.output.swift
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.
//
diff --git a/codegen-v2/src/utils.rs b/codegen-v2/src/utils.rs
new file mode 100644
index 00000000000..a61222fc3fd
--- /dev/null
+++ b/codegen-v2/src/utils.rs
@@ -0,0 +1,157 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::{Error, Result};
+use std::fs;
+use std::path::{Path, PathBuf};
+
+pub fn read_lines>(path: P) -> Result> {
+ let lines = fs::read_to_string(path)?
+ .split('\n')
+ .map(|line| line.to_string())
+ .collect();
+ Ok(lines)
+}
+
+pub fn write_lines>(path: P, lines: Vec) -> Result<()> {
+ let content = lines.join("\n");
+ fs::write(path, content).map_err(Error::from)
+}
+
+pub struct FileContent {
+ path: PathBuf,
+ lines: Vec,
+}
+
+impl FileContent {
+ pub fn read(path: PathBuf) -> Result {
+ read_lines(&path).map(|lines| FileContent { path, lines })
+ }
+
+ pub fn find_region_with_prefix(&mut self, prefix: &str) -> Result> {
+ // Find the first line that starts with the `prefix`.
+ let region_starts_at = self
+ .lines
+ .iter()
+ .position(|line| line.starts_with(prefix))
+ .ok_or_else(|| Error::io_error_other(format!("Cannot find the `{prefix}` region")))?;
+
+ // Find the last line that starts with the `prefix`.
+ let region_ends_at = self
+ .lines
+ .iter()
+ .rposition(|line| line.starts_with(prefix))
+ .ok_or_else(|| Error::io_error_other(format!("Cannot find the `{prefix}` region")))?;
+
+ Ok(FileRegion {
+ lines: &mut self.lines,
+ region_starts_at,
+ region_ends_at,
+ })
+ }
+
+ pub fn find_region_with_comments(
+ &mut self,
+ start_comment: &str,
+ end_comment: &str,
+ ) -> Result> {
+ // Find the position of the `start_comment`.
+ let start_comment_at = self
+ .lines
+ .iter()
+ .position(|line| line.contains(start_comment))
+ .ok_or_else(|| {
+ Error::io_error_other(format!("Cannot find the `{start_comment}` line"))
+ })?;
+ let end_comment_at = self
+ .lines
+ .iter()
+ .skip(start_comment_at)
+ .position(|line| line.contains(end_comment))
+ .ok_or_else(|| {
+ Error::io_error_other(format!("Cannot find the `{end_comment}` line"))
+ })?
+ + start_comment_at;
+
+ let region_starts_at = start_comment_at + 1;
+ let region_ends_at = end_comment_at - 1;
+
+ if region_starts_at > region_ends_at {
+ return Err(Error::io_error_other(format!(
+ "There must be the content between {start_comment} and {end_comment}"
+ )));
+ }
+
+ Ok(FileRegion {
+ lines: &mut self.lines,
+ region_starts_at,
+ region_ends_at,
+ })
+ }
+
+ pub fn rfind_line(&mut self, f: F) -> Result>
+ where
+ F: Fn(&str) -> bool,
+ {
+ let line_idx = self.lines.iter().rposition(|line| f(line)).ok_or_else(|| {
+ Error::io_error_other(format!(
+ "{:?} file does not contain a required pattern",
+ self.path
+ ))
+ })?;
+ Ok(LinePointer {
+ lines: &mut self.lines,
+ line_idx,
+ })
+ }
+
+ pub fn write(self) -> Result<()> {
+ write_lines(self.path, self.lines)
+ }
+}
+
+pub struct FileRegion<'a> {
+ lines: &'a mut Vec,
+ region_starts_at: usize,
+ region_ends_at: usize,
+}
+
+impl<'a> FileRegion<'a> {
+ pub fn push_line(&mut self, line: String) {
+ self.lines.insert(self.region_ends_at + 1, line);
+ self.region_ends_at += 1;
+ }
+
+ pub fn sort(&mut self) {
+ self.lines[self.region_starts_at..=self.region_ends_at].sort()
+ }
+
+ pub fn count_lines(&self) -> usize {
+ self.region_ends_at - self.region_starts_at
+ }
+}
+
+pub struct LinePointer<'a> {
+ lines: &'a mut Vec,
+ line_idx: usize,
+}
+
+impl<'a> LinePointer<'a> {
+ /// Please note that the line pointer will be shifted to the same line on which it pointed before.
+ pub fn push_line_before(&mut self, line: String) {
+ self.lines.insert(self.line_idx, line);
+ self.line_idx += 1;
+ }
+
+ pub fn push_paragraph_before(&mut self, paragraph: String) {
+ for line in paragraph.split("\n") {
+ self.push_line_before(line.to_string());
+ }
+ }
+
+ /// Please note that the line pointer will not be shifted to the pushed element.
+ pub fn push_line_after(&mut self, line: String) {
+ self.lines.insert(self.line_idx + 1, line);
+ }
+}
diff --git a/codegen/bin/newcoin b/codegen/bin/newcoin
index aeeec609d73..ee14b241f7a 100755
--- a/codegen/bin/newcoin
+++ b/codegen/bin/newcoin
@@ -18,4 +18,4 @@ end
coin_id = command_line_args[0]
-generate_skeleton(coin_id, "")
+generate_skeleton(coin_id, "full")
diff --git a/codegen/bin/newcoin-mobile-tests b/codegen/bin/newcoin-mobile-tests
new file mode 100755
index 00000000000..d6ea29a84c9
--- /dev/null
+++ b/codegen/bin/newcoin-mobile-tests
@@ -0,0 +1,22 @@
+#!/usr/bin/env ruby
+
+# Sript for creating new skeleton files for new coin mobile tests. See also `newcoin` or `newevmchain`.
+# It is considered to be used by codegen-v2 tool until Swift and Android tests generating supported.
+# 1. Add relevant entry to registry.json (in order to minimize merge conflict, don't add at the very end)
+# 2. Invoke this script with the id of the coin, e.g.: codegen/bin/newcoin-mobile-tests ethereum
+
+require 'fileutils'
+
+CurrentDir = File.dirname(__FILE__)
+$LOAD_PATH.unshift(File.join(CurrentDir, '..', 'lib'))
+require 'coin_skeleton_gen'
+
+command_line_args = ARGV
+if command_line_args.length < 1
+ puts "Usage: newcoin-mobile-tests "
+ return
+end
+
+coin_id = command_line_args[0]
+
+generate_skeleton(coin_id, "mobile-tests")
diff --git a/codegen/lib/coin_skeleton_gen.rb b/codegen/lib/coin_skeleton_gen.rb
index 29335e4fdb0..b0bcbe85e80 100755
--- a/codegen/lib/coin_skeleton_gen.rb
+++ b/codegen/lib/coin_skeleton_gen.rb
@@ -90,6 +90,37 @@ def self.insert_target_line(target_file, target_line, original_line)
return true
end
+def generate_blockchain_files(coin)
+ name = format_name(coin)
+
+ generate_file("newcoin/Address.h.erb", "src/#{name}", "Address.h", coin)
+ generate_file("newcoin/Address.cpp.erb", "src/#{name}", "Address.cpp", coin)
+ generate_file("newcoin/Entry.h.erb", "src/#{name}", "Entry.h", coin)
+ generate_file("newcoin/Entry.cpp.erb", "src/#{name}", "Entry.cpp", coin)
+ generate_file("newcoin/Proto.erb", "src/proto", "#{name}.proto", coin)
+ generate_file("newcoin/Signer.h.erb", "src/#{name}", "Signer.h", coin)
+ generate_file("newcoin/Signer.cpp.erb", "src/#{name}", "Signer.cpp", coin)
+
+ generate_file("newcoin/AddressTests.cpp.erb", "tests/chains/#{name}", "AddressTests.cpp", coin)
+ generate_file("newcoin/SignerTests.cpp.erb", "tests/chains/#{name}", "SignerTests.cpp", coin)
+ generate_file("newcoin/TransactionCompilerTests.cpp.erb", "tests/chains/#{name}", "TransactionCompilerTests.cpp", coin)
+ generate_file("newcoin/TWAddressTests.cpp.erb", "tests/chains/#{name}", "TWAnyAddressTests.cpp", coin)
+ generate_file("newcoin/TWSignerTests.cpp.erb", "tests/chains/#{name}", "TWAnySignerTests.cpp", coin)
+end
+
+def generate_mobile_tests(coin)
+ name = format_name(coin)
+
+ generate_file("newcoin/AddressTests.kt.erb", "android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/#{format_name_lowercase(coin)}", "Test#{name}Address.kt", coin)
+ generate_file("newcoin/SignerTests.kt.erb", "android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/#{format_name_lowercase(coin)}", "Test#{name}Signer.kt", coin)
+ generate_file("newcoin/Tests.swift.erb", "swift/Tests/Blockchains", "#{name}Tests.swift", coin)
+end
+
+def generate_coin_type_tests(coin)
+ coin_test_gen = CoinTestGen.new()
+ coin_test_gen.generate_coin_test_file(coin, 'TWCoinTypeTests.cpp.erb', true)
+end
+
def generate_skeleton(coin_id, mode)
puts "New coin template for coin '#{coin_id}' #{mode} requested"
@@ -103,8 +134,6 @@ def generate_skeleton(coin_id, mode)
@coins = coins
- coin_test_gen = CoinTestGen.new()
-
# Find coin in list of coins, by Id
coinSelect = coins.select {|c| c['id'] == coin_id}
if coinSelect.length() == 0
@@ -112,32 +141,19 @@ def generate_skeleton(coin_id, mode)
return
end
coin = coinSelect.first
- name = format_name(coin)
-
- insert_coin_type(coin, mode)
- if (mode != "evm")
+ if (mode == "full")
+ insert_coin_type(coin, mode)
insert_coin_entry(coin)
-
- generate_file("newcoin/Address.h.erb", "src/#{name}", "Address.h", coin)
- generate_file("newcoin/Address.cpp.erb", "src/#{name}", "Address.cpp", coin)
- generate_file("newcoin/Entry.h.erb", "src/#{name}", "Entry.h", coin)
- generate_file("newcoin/Entry.cpp.erb", "src/#{name}", "Entry.cpp", coin)
- generate_file("newcoin/Proto.erb", "src/proto", "#{name}.proto", coin)
- generate_file("newcoin/Signer.h.erb", "src/#{name}", "Signer.h", coin)
- generate_file("newcoin/Signer.cpp.erb", "src/#{name}", "Signer.cpp", coin)
-
- generate_file("newcoin/AddressTests.cpp.erb", "tests/chains/#{name}", "AddressTests.cpp", coin)
- generate_file("newcoin/SignerTests.cpp.erb", "tests/chains/#{name}", "SignerTests.cpp", coin)
- generate_file("newcoin/TransactionCompilerTests.cpp.erb", "tests/chains/#{name}", "TransactionCompilerTests.cpp", coin)
- generate_file("newcoin/TWAddressTests.cpp.erb", "tests/chains/#{name}", "TWAnyAddressTests.cpp", coin)
- generate_file("newcoin/TWSignerTests.cpp.erb", "tests/chains/#{name}", "TWAnySignerTests.cpp", coin)
- generate_file("newcoin/AddressTests.kt.erb", "android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/#{format_name_lowercase(coin)}", "Test#{name}Address.kt", coin)
- generate_file("newcoin/SignerTests.kt.erb", "android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/#{format_name_lowercase(coin)}", "Test#{name}Signer.kt", coin)
- generate_file("newcoin/Tests.swift.erb", "swift/Tests/Blockchains", "#{name}Tests.swift", coin)
+ generate_blockchain_files(coin)
+ generate_mobile_tests(coin)
+ generate_coin_type_tests(coin)
+ elsif (mode == "evm")
+ insert_coin_type(coin, mode)
+ generate_coin_type_tests(coin)
+ elsif (mode == "mobile-tests")
+ generate_mobile_tests(coin)
end
- coin_test_gen.generate_coin_test_file(coin, 'TWCoinTypeTests.cpp.erb', true)
-
puts "please tools/generate-files to generate Swift/Java/Protobuf files"
end
diff --git a/codegen/lib/templates/CoinInfoData.cpp.erb b/codegen/lib/templates/CoinInfoData.cpp.erb
index 4803af6dff6..d2bbb5d6b71 100644
--- a/codegen/lib/templates/CoinInfoData.cpp.erb
+++ b/codegen/lib/templates/CoinInfoData.cpp.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.
//
diff --git a/codegen/lib/templates/TWCoinTypeTests.cpp.erb b/codegen/lib/templates/TWCoinTypeTests.cpp.erb
index 3784f589eb4..bb8cbdadb79 100644
--- a/codegen/lib/templates/TWCoinTypeTests.cpp.erb
+++ b/codegen/lib/templates/TWCoinTypeTests.cpp.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here MAY BE LOST.
// Generated one-time (codegen/bin/cointests)
diff --git a/codegen/lib/templates/TWDerivation.h.erb b/codegen/lib/templates/TWDerivation.h.erb
index 30ba65483da..e2c9a53a494 100644
--- a/codegen/lib/templates/TWDerivation.h.erb
+++ b/codegen/lib/templates/TWDerivation.h.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE from \registry.json, changes made here WILL BE LOST.
//
@@ -20,14 +18,12 @@ enum TWDerivation {
TWDerivationCustom = 1, // custom, for any coin
<% enum_count += 1 -%>
<% coins.each do |coin| -%>
-<% if coin['derivation'].count > 1 -%>
<% coin['derivation'].each_with_index do |deriv, index| -%>
<% if index > 0 or !deriv['name'].nil? -%>
<%= derivation_enum_name(deriv, coin) %> = <% enum_count += 1 -%><%= enum_count %>,
<% end -%>
<% end -%>
<% end -%>
-<% end -%>
};
TW_EXTERN_C_END
diff --git a/codegen/lib/templates/TWEthereumChainID.h.erb b/codegen/lib/templates/TWEthereumChainID.h.erb
index 7d3657b7a8c..3e6385e1b77 100644
--- a/codegen/lib/templates/TWEthereumChainID.h.erb
+++ b/codegen/lib/templates/TWEthereumChainID.h.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE from \registry.json, changes made here WILL BE LOST.
//
diff --git a/codegen/lib/templates/copyright_header.erb b/codegen/lib/templates/copyright_header.erb
index e8de6a21997..39239c27440 100644
--- a/codegen/lib/templates/copyright_header.erb
+++ b/codegen/lib/templates/copyright_header.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.
//
diff --git a/codegen/lib/templates/hrp.cpp.erb b/codegen/lib/templates/hrp.cpp.erb
index ecca3779ced..c3705bd5a9f 100644
--- a/codegen/lib/templates/hrp.cpp.erb
+++ b/codegen/lib/templates/hrp.cpp.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE from \registry.json, changes made here WILL BE LOST.
//
diff --git a/codegen/lib/templates/hrp.h.erb b/codegen/lib/templates/hrp.h.erb
index a346bf8333c..4691fbafc5b 100644
--- a/codegen/lib/templates/hrp.h.erb
+++ b/codegen/lib/templates/hrp.h.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE from \registry.json, changes made here WILL BE LOST.
//
diff --git a/codegen/lib/templates/java/header.erb b/codegen/lib/templates/java/header.erb
index 13ea5d56c17..3c5da1f81ed 100644
--- a/codegen/lib/templates/java/header.erb
+++ b/codegen/lib/templates/java/header.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here WILL BE LOST.
//
diff --git a/codegen/lib/templates/newcoin/Address.cpp.erb b/codegen/lib/templates/newcoin/Address.cpp.erb
index 88de42de169..ea1c354db0e 100644
--- a/codegen/lib/templates/newcoin/Address.cpp.erb
+++ b/codegen/lib/templates/newcoin/Address.cpp.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#include "Address.h"
diff --git a/codegen/lib/templates/newcoin/Address.h.erb b/codegen/lib/templates/newcoin/Address.h.erb
index 302a491a0aa..7fe392b92df 100644
--- a/codegen/lib/templates/newcoin/Address.h.erb
+++ b/codegen/lib/templates/newcoin/Address.h.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/codegen/lib/templates/newcoin/AddressTests.cpp.erb b/codegen/lib/templates/newcoin/AddressTests.cpp.erb
index 4c20321c6fd..27c4c09ab89 100644
--- a/codegen/lib/templates/newcoin/AddressTests.cpp.erb
+++ b/codegen/lib/templates/newcoin/AddressTests.cpp.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#include "HexCoding.h"
#include "<%= format_name(coin) %>/Address.h"
diff --git a/codegen/lib/templates/newcoin/AddressTests.kt.erb b/codegen/lib/templates/newcoin/AddressTests.kt.erb
index 4185afbb9dd..20bbd774cc9 100644
--- a/codegen/lib/templates/newcoin/AddressTests.kt.erb
+++ b/codegen/lib/templates/newcoin/AddressTests.kt.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.<%= format_name_lowercase(coin) %>
diff --git a/codegen/lib/templates/newcoin/Entry.cpp.erb b/codegen/lib/templates/newcoin/Entry.cpp.erb
index 5e4c4aaf25d..793f5bf8f3f 100644
--- a/codegen/lib/templates/newcoin/Entry.cpp.erb
+++ b/codegen/lib/templates/newcoin/Entry.cpp.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#include "Entry.h"
diff --git a/codegen/lib/templates/newcoin/Entry.h.erb b/codegen/lib/templates/newcoin/Entry.h.erb
index 29ba0783596..32b48e0e42c 100644
--- a/codegen/lib/templates/newcoin/Entry.h.erb
+++ b/codegen/lib/templates/newcoin/Entry.h.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/codegen/lib/templates/newcoin/Proto.erb b/codegen/lib/templates/newcoin/Proto.erb
index 9609e2d2089..bbd242d66be 100644
--- a/codegen/lib/templates/newcoin/Proto.erb
+++ b/codegen/lib/templates/newcoin/Proto.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
syntax = "proto3";
diff --git a/codegen/lib/templates/newcoin/Signer.cpp.erb b/codegen/lib/templates/newcoin/Signer.cpp.erb
index fd81ac314e5..aeedceda863 100644
--- a/codegen/lib/templates/newcoin/Signer.cpp.erb
+++ b/codegen/lib/templates/newcoin/Signer.cpp.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#include "Signer.h"
#include "Address.h"
diff --git a/codegen/lib/templates/newcoin/Signer.h.erb b/codegen/lib/templates/newcoin/Signer.h.erb
index 7d660796723..f77982f3ac3 100644
--- a/codegen/lib/templates/newcoin/Signer.h.erb
+++ b/codegen/lib/templates/newcoin/Signer.h.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/codegen/lib/templates/newcoin/SignerTests.cpp.erb b/codegen/lib/templates/newcoin/SignerTests.cpp.erb
index 26150a8face..d88ad46994f 100644
--- a/codegen/lib/templates/newcoin/SignerTests.cpp.erb
+++ b/codegen/lib/templates/newcoin/SignerTests.cpp.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#include "<%= format_name(coin) %>/Signer.h"
#include "<%= format_name(coin) %>/Address.h"
diff --git a/codegen/lib/templates/newcoin/SignerTests.kt.erb b/codegen/lib/templates/newcoin/SignerTests.kt.erb
index 5bf1f4ed8bb..4add9add89f 100644
--- a/codegen/lib/templates/newcoin/SignerTests.kt.erb
+++ b/codegen/lib/templates/newcoin/SignerTests.kt.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core.app.blockchains.<%= format_name_lowercase(coin) %>
diff --git a/codegen/lib/templates/newcoin/TWAddressTests.cpp.erb b/codegen/lib/templates/newcoin/TWAddressTests.cpp.erb
index 9ad574fec94..91a0cbf0729 100644
--- a/codegen/lib/templates/newcoin/TWAddressTests.cpp.erb
+++ b/codegen/lib/templates/newcoin/TWAddressTests.cpp.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#include
#include "HexCoding.h"
diff --git a/codegen/lib/templates/newcoin/TWSignerTests.cpp.erb b/codegen/lib/templates/newcoin/TWSignerTests.cpp.erb
index 456b6f08b8d..8e8193db07c 100644
--- a/codegen/lib/templates/newcoin/TWSignerTests.cpp.erb
+++ b/codegen/lib/templates/newcoin/TWSignerTests.cpp.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#include
#include "HexCoding.h"
diff --git a/codegen/lib/templates/newcoin/Tests.swift.erb b/codegen/lib/templates/newcoin/Tests.swift.erb
index 28c2ef8339e..e28d0ec1bc2 100644
--- a/codegen/lib/templates/newcoin/Tests.swift.erb
+++ b/codegen/lib/templates/newcoin/Tests.swift.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
import WalletCore
import XCTest
diff --git a/codegen/lib/templates/newcoin/TransactionCompilerTests.cpp.erb b/codegen/lib/templates/newcoin/TransactionCompilerTests.cpp.erb
index 8150081c49e..c996dd2c6ab 100644
--- a/codegen/lib/templates/newcoin/TransactionCompilerTests.cpp.erb
+++ b/codegen/lib/templates/newcoin/TransactionCompilerTests.cpp.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#include "<%= format_name(coin) %>/Signer.h"
#include "<%= format_name(coin) %>/Address.h"
diff --git a/codegen/lib/templates/swift/TrustWalletCore.h.erb b/codegen/lib/templates/swift/TrustWalletCore.h.erb
index f1246a2a970..5e2ac88537a 100644
--- a/codegen/lib/templates/swift/TrustWalletCore.h.erb
+++ b/codegen/lib/templates/swift/TrustWalletCore.h.erb
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#import
diff --git a/docs/registry-fields.md b/docs/registry-fields.md
index e1c7098e332..ff6b0e539e6 100644
--- a/docs/registry-fields.md
+++ b/docs/registry-fields.md
@@ -189,7 +189,7 @@ Link to the default implementation of the node or RPC gateway that can be used b
Optional URL to an available public RPC service.
**`info/documentation`**
-Main porject documentation site/subsite.
+Main project documentation site/subsite.
**`deprecated`**
If set to `true`, the project is considered deprecated: its info is kept here, but it will not be supported.
diff --git a/docs/registry.md b/docs/registry.md
index d1a15c32038..7606e14a45b 100644
--- a/docs/registry.md
+++ b/docs/registry.md
@@ -31,11 +31,13 @@ This list is generated from [./registry.json](../registry.json)
| 148 | Stellar | XLM | | |
| 156 | Bitcoin Gold | BTG | | |
| 165 | Nano | XNO | | |
+| 169 | Manta Pacific | ETH | | |
| 175 | Ravencoin | RVN | | |
| 178 | POA Network | POA | | |
| 194 | EOS | EOS | | |
| 195 | Tron | TRX | | |
| 204 | OpBNB | BNB | | |
+| 223 | Internet Computer | ICP | | |
| 235 | FIO | FIO | | |
| 242 | Nimiq | NIM | | |
| 283 | Algorand | ALGO | | |
@@ -70,10 +72,10 @@ This list is generated from [./registry.json](../registry.json)
| 818 | VeChain | VET | | |
| 820 | Callisto | CLO | | |
| 888 | NEO | NEO | | |
-| 889 | TomoChain | TOMO | | |
+| 889 | Viction | VIC | | |
| 899 | eCash | XEC | | |
| 931 | THORChain | RUNE | | |
-| 966 | Polygon | MATIC | | |
+| 966 | Polygon | POL | | |
| 996 | OKX Chain | OKT | | |
| 999 | Bitcoin Diamond | BCD | | |
| 1001 | ThunderCore | TT | | |
@@ -82,11 +84,14 @@ This list is generated from [./registry.json](../registry.json)
| 1030 | Conflux eSpace | CFX | | |
| 1729 | Tezos | XTZ | | |
| 1815 | Cardano | ADA | | |
+| 1890 | Lightlink Phoenix | ETH | | |
| 2301 | Qtum | QTUM | | |
| 2718 | Nebulas | NAS | | |
| 3030 | Hedera | HBAR | | |
+| 4200 | Merlin | BTC | | |
| 5000 | Mantle | MNT | | |
| 5600 | BNB Greenfield | BNB | | |
+| 6001 | BounceBit | BB | | |
| 6060 | GoChain | GO | | |
| 7332 | Zen EON | ZEN | | |
| 8453 | Base | ETH | | |
@@ -96,13 +101,15 @@ This list is generated from [./registry.json](../registry.json)
| 19167 | Flux | FLUX | | |
| 52752 | Celo | CELO | | |
| 59144 | Linea | ETH | | |
+| 81457 | Blast | ETH | | |
| 105105 | Stratis | STRAX | | |
-| 534353 | Scroll | ETH | | |
+| 534352 | Scroll | ETH | | |
+| 810180 | zkLink Nova Mainnet | ETH | | |
| 5718350 | Wanchain | WAN | | |
| 5741564 | Waves | WAVES | | |
| 10000025 | Cronos Chain | CRO | | |
| 10000060 | Native Injective | INJ | | |
-| 10000070 | Optimism Ethereum | ETH | | |
+| 10000070 | OP Mainnet | ETH | | |
| 10000100 | Gnosis Chain | xDAI | | |
| 10000118 | Osmosis | OSMO | | |
| 10000145 | Smart Bitcoin Cash | BCH | | |
@@ -121,8 +128,9 @@ This list is generated from [./registry.json](../registry.json)
| 10002020 | Ronin | RON | | |
| 10002222 | KavaEvm | KAVA | | |
| 10004689 | IoTeX EVM | IOTX | | |
+| 10007000 | NativeZetaChain | ZETA | | |
| 10007700 | NativeCanto | CANTO | | |
-| 10008217 | Klaytn | KLAY | | |
+| 10008217 | Kaia | KLAY | | |
| 10009000 | Avalanche C-Chain | AVAX | | |
| 10009001 | Evmos | EVMOS | | |
| 10042170 | Arbitrum Nova | ETH | | |
@@ -138,7 +146,10 @@ This list is generated from [./registry.json](../registry.json)
| 19000118 | Sei | SEI | | |
| 20000118 | Stargaze | STARS | | |
| 20000714 | BNB Smart Chain | BNB | | |
+| 20007000 | Zeta EVM | ZETA | | |
| 20009001 | Native Evmos | EVMOS | | |
+| 21000118 | Celestia | TIA | | |
+| 22000118 | dYdX | DYDX | | |
| 30000118 | Juno | JUNO | | |
| 30000714 | TBNB | BNB | | |
| 40000118 | Stride | STRD | | |
diff --git a/include/TrustWalletCore/TWAES.h b/include/TrustWalletCore/TWAES.h
index 383804cedb1..e4a30c656d1 100644
--- a/include/TrustWalletCore/TWAES.h
+++ b/include/TrustWalletCore/TWAES.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWAESPaddingMode.h b/include/TrustWalletCore/TWAESPaddingMode.h
index b9e7c707950..da271a5b989 100644
--- a/include/TrustWalletCore/TWAESPaddingMode.h
+++ b/include/TrustWalletCore/TWAESPaddingMode.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWAccount.h b/include/TrustWalletCore/TWAccount.h
index adb6f8a97e3..a5cc0fc0e2f 100644
--- a/include/TrustWalletCore/TWAccount.h
+++ b/include/TrustWalletCore/TWAccount.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWAnyAddress.h b/include/TrustWalletCore/TWAnyAddress.h
index ce501489c22..49b604aa9fc 100644
--- a/include/TrustWalletCore/TWAnyAddress.h
+++ b/include/TrustWalletCore/TWAnyAddress.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
@@ -10,6 +8,7 @@
#include "TWCoinType.h"
#include "TWData.h"
#include "TWFilecoinAddressType.h"
+#include "TWFiroAddressType.h"
#include "TWString.h"
TW_EXTERN_C_BEGIN
@@ -124,6 +123,14 @@ struct TWAnyAddress* _Nonnull TWAnyAddressCreateSS58WithPublicKey(struct TWPubli
TW_EXPORT_STATIC_METHOD
struct TWAnyAddress* _Nonnull TWAnyAddressCreateWithPublicKeyFilecoinAddressType(struct TWPublicKey* _Nonnull publicKey, enum TWFilecoinAddressType filecoinAddressType);
+/// Creates a Firo address from a public key and a given address type.
+///
+/// \param publicKey derivates the address from the public key.
+/// \param firoAddressType Firo address type.
+/// \return TWAnyAddress pointer or nullptr if public key is invalid.
+TW_EXPORT_STATIC_METHOD
+struct TWAnyAddress* _Nonnull TWAnyAddressCreateWithPublicKeyFiroAddressType(struct TWPublicKey* _Nonnull publicKey, enum TWFiroAddressType firoAddressType);
+
/// Deletes an address.
///
/// \param address address to delete.
diff --git a/include/TrustWalletCore/TWAnySigner.h b/include/TrustWalletCore/TWAnySigner.h
index 25cebe5c1a0..a50f1246618 100644
--- a/include/TrustWalletCore/TWAnySigner.h
+++ b/include/TrustWalletCore/TWAnySigner.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
#include "TWBase.h"
diff --git a/include/TrustWalletCore/TWAsnParser.h b/include/TrustWalletCore/TWAsnParser.h
index 67d0c6588cd..b008a0578d8 100644
--- a/include/TrustWalletCore/TWAsnParser.h
+++ b/include/TrustWalletCore/TWAsnParser.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWBarz.h b/include/TrustWalletCore/TWBarz.h
index 3bc08ed31b4..1454e219b5d 100644
--- a/include/TrustWalletCore/TWBarz.h
+++ b/include/TrustWalletCore/TWBarz.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
#include "TWBase.h"
@@ -41,4 +39,20 @@ TWData *_Nonnull TWBarzGetInitCode(TWString* _Nonnull factory, struct TWPublicKe
/// \return Bytes of the formatted signature
TW_EXPORT_STATIC_METHOD
TWData *_Nonnull TWBarzGetFormattedSignature(TWData* _Nonnull signature, TWData* _Nonnull challenge, TWData* _Nonnull authenticatorData, TWString* _Nonnull clientDataJSON);
+
+/// Returns the final hash to be signed by Barz for signing messages & typed data
+///
+/// \param msgHash Original msgHash
+/// \param barzAddress The address of Barz wallet signing the message
+/// \param chainId The chainId of the network the verification will happen
+/// \return The final hash to be signed
+TW_EXPORT_STATIC_METHOD
+TWData *_Nonnull TWBarzGetPrefixedMsgHash(TWData* _Nonnull msgHash, TWString* _Nonnull barzAddress, uint32_t chainId);
+
+/// Returns the encoded diamondCut function call for Barz contract upgrades
+///
+/// \param input The serialized data of DiamondCutInput
+/// \return The encoded bytes of diamondCut function call
+TW_EXPORT_STATIC_METHOD
+TWData *_Nonnull TWBarzGetDiamondCutCode(TWData *_Nonnull input);
TW_EXTERN_C_END
diff --git a/include/TrustWalletCore/TWBase.h b/include/TrustWalletCore/TWBase.h
index f0486654eb7..1e334d18679 100644
--- a/include/TrustWalletCore/TWBase.h
+++ b/include/TrustWalletCore/TWBase.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#if !defined(TW_EXTERN_C_BEGIN)
#if defined(__cplusplus)
diff --git a/include/TrustWalletCore/TWBase32.h b/include/TrustWalletCore/TWBase32.h
index 153d348f3a3..a8f09039ec8 100644
--- a/include/TrustWalletCore/TWBase32.h
+++ b/include/TrustWalletCore/TWBase32.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWBase58.h b/include/TrustWalletCore/TWBase58.h
index 87a3cbe70fd..c59ddd2a2a0 100644
--- a/include/TrustWalletCore/TWBase58.h
+++ b/include/TrustWalletCore/TWBase58.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWBase64.h b/include/TrustWalletCore/TWBase64.h
index 7ca0c37492f..5b3cff51a73 100644
--- a/include/TrustWalletCore/TWBase64.h
+++ b/include/TrustWalletCore/TWBase64.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWBitcoinAddress.h b/include/TrustWalletCore/TWBitcoinAddress.h
index 1ef667bf6a4..5fd4d2172a0 100644
--- a/include/TrustWalletCore/TWBitcoinAddress.h
+++ b/include/TrustWalletCore/TWBitcoinAddress.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWBitcoinFee.h b/include/TrustWalletCore/TWBitcoinFee.h
deleted file mode 100644
index 33dc9c6c5ea..00000000000
--- a/include/TrustWalletCore/TWBitcoinFee.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright © 2017-2023 Trust Wallet.
-//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
-
-#pragma once
-
-#include "TWData.h"
-#include "TWString.h"
-
-TW_EXTERN_C_BEGIN
-
-TW_EXPORT_CLASS
-struct TWBitcoinFee;
-
-/// Calculates the fee of any Bitcoin transaction.
-///
-/// \param data: the signed transaction in its final form.
-/// \param satVb: the satoshis per vbyte amount. The passed on string is interpreted as a unit64_t.
-/// \returns the fee denominated in satoshis or nullptr if the transaction failed to be decoded.
-TW_EXPORT_STATIC_METHOD
-TWString* _Nullable TWBitcoinFeeCalculateFee(TWData* _Nonnull data, TWString* _Nonnull satVb);
-
-TW_EXTERN_C_END
diff --git a/include/TrustWalletCore/TWBitcoinMessageSigner.h b/include/TrustWalletCore/TWBitcoinMessageSigner.h
index 6b09918f3a6..4090ff4850f 100644
--- a/include/TrustWalletCore/TWBitcoinMessageSigner.h
+++ b/include/TrustWalletCore/TWBitcoinMessageSigner.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWBitcoinScript.h b/include/TrustWalletCore/TWBitcoinScript.h
index 94ed5ce020b..b49e65ae1f8 100644
--- a/include/TrustWalletCore/TWBitcoinScript.h
+++ b/include/TrustWalletCore/TWBitcoinScript.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
@@ -193,26 +191,6 @@ struct TWBitcoinScript* _Nonnull TWBitcoinScriptBuildPayToWitnessPubkeyHash(TWDa
TW_EXPORT_STATIC_METHOD
struct TWBitcoinScript* _Nonnull TWBitcoinScriptBuildPayToWitnessScriptHash(TWData* _Nonnull scriptHash);
-/// Builds the Ordinals inscripton for BRC20 transfer.
-///
-/// \param ticker ticker of the brc20
-/// \param amount uint64 transfer amount
-/// \param pubkey Non-null pointer to a pubkey
-/// \note Must be deleted with \TWBitcoinScriptDelete
-/// \return A pointer to the built script
-TW_EXPORT_STATIC_METHOD
-TWData* _Nonnull TWBitcoinScriptBuildBRC20InscribeTransfer(TWString* _Nonnull ticker, TWString* _Nonnull amount, TWData* _Nonnull pubkey);
-
-/// Builds the Ordinals inscripton for NFT construction.
-///
-/// \param mimeType the MIME type of the payload
-/// \param payload the payload to inscribe
-/// \param pubkey Non-null pointer to a pubkey
-/// \note Must be deleted with \TWBitcoinScriptDelete
-/// \return A pointer to the built script
-TW_EXPORT_STATIC_METHOD
-TWData* _Nonnull TWBitcoinScriptBuildOrdinalNftInscription(TWString* _Nonnull mimeType, TWData* _Nonnull payload, TWData* _Nonnull pubkey);
-
/// Builds a appropriate lock script for the given address..
///
/// \param address Non-null pointer to an address
diff --git a/include/TrustWalletCore/TWBitcoinSigHashType.h b/include/TrustWalletCore/TWBitcoinSigHashType.h
index c71bde2d480..4d7e9c49a38 100644
--- a/include/TrustWalletCore/TWBitcoinSigHashType.h
+++ b/include/TrustWalletCore/TWBitcoinSigHashType.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWBlockchain.h b/include/TrustWalletCore/TWBlockchain.h
index d715176ed7b..faf4c575c1b 100644
--- a/include/TrustWalletCore/TWBlockchain.h
+++ b/include/TrustWalletCore/TWBlockchain.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
@@ -64,6 +62,9 @@ enum TWBlockchain {
TWBlockchainTheOpenNetwork = 49,
TWBlockchainSui = 50,
TWBlockchainGreenfield = 51,
+ TWBlockchainInternetComputer = 52,
+ TWBlockchainNativeEvmos = 53, // Cosmos
+ TWBlockchainNativeInjective = 54, // Cosmos
};
TW_EXTERN_C_END
diff --git a/include/TrustWalletCore/TWCardano.h b/include/TrustWalletCore/TWCardano.h
index 0892d616183..17bd9ebb61f 100644
--- a/include/TrustWalletCore/TWCardano.h
+++ b/include/TrustWalletCore/TWCardano.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWCoinType.h b/include/TrustWalletCore/TWCoinType.h
index ad78ddfa90d..388bd270334 100644
--- a/include/TrustWalletCore/TWCoinType.h
+++ b/include/TrustWalletCore/TWCoinType.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
@@ -72,7 +70,7 @@ enum TWCoinType {
TWCoinTypeTheta = 500,
TWCoinTypeThunderCore = 1001,
TWCoinTypeNEO = 888,
- TWCoinTypeTomoChain = 889,
+ TWCoinTypeViction = 889,
TWCoinTypeTron = 195,
TWCoinTypeVeChain = 818,
TWCoinTypeViacoin = 14,
@@ -127,7 +125,7 @@ enum TWCoinType {
TWCoinTypeMoonriver = 10001285,
TWCoinTypeMoonbeam = 10001284,
TWCoinTypeKavaEvm = 10002222,
- TWCoinTypeKlaytn = 10008217,
+ TWCoinTypeKaia = 10008217,
TWCoinTypeMeter = 18000,
TWCoinTypeOKXChain = 996,
TWCoinTypeStratis = 105105,
@@ -162,7 +160,7 @@ enum TWCoinType {
TWCoinTypePersistence = 16000118,
TWCoinTypeAkash = 17000118,
TWCoinTypeNoble = 18000118,
- TWCoinTypeScroll = 534353,
+ TWCoinTypeScroll = 534352,
TWCoinTypeRootstock = 137,
TWCoinTypeThetaFuel = 361,
TWCoinTypeConfluxeSpace = 1030,
@@ -177,6 +175,18 @@ enum TWCoinType {
TWCoinTypeGreenfield = 5600,
TWCoinTypeMantle = 5000,
TWCoinTypeZenEON = 7332,
+ TWCoinTypeInternetComputer = 223,
+ TWCoinTypeTia = 21000118,
+ TWCoinTypeMantaPacific = 169,
+ TWCoinTypeNativeZetaChain = 10007000,
+ TWCoinTypeZetaEVM = 20007000,
+ TWCoinTypeDydx = 22000118,
+ TWCoinTypeMerlin = 4200,
+ TWCoinTypeLightlink = 1890,
+ TWCoinTypeBlast = 81457,
+ TWCoinTypeBounceBit = 6001,
+ TWCoinTypeZkLinkNova = 810180,
+ // end_of_tw_coin_type_marker_do_not_modify
};
/// Returns the blockchain for a coin type.
diff --git a/include/TrustWalletCore/TWCoinTypeConfiguration.h b/include/TrustWalletCore/TWCoinTypeConfiguration.h
index c83db7753e0..ca71f4dc56e 100644
--- a/include/TrustWalletCore/TWCoinTypeConfiguration.h
+++ b/include/TrustWalletCore/TWCoinTypeConfiguration.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWCryptoBox.h b/include/TrustWalletCore/TWCryptoBox.h
new file mode 100644
index 00000000000..abd27ca8191
--- /dev/null
+++ b/include/TrustWalletCore/TWCryptoBox.h
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+#pragma once
+
+#include "TWBase.h"
+#include "TWCryptoBoxPublicKey.h"
+#include "TWCryptoBoxSecretKey.h"
+#include "TWData.h"
+#include "TWString.h"
+
+TW_EXTERN_C_BEGIN
+
+/// `crypto_box` encryption algorithms.
+TW_EXPORT_STRUCT
+struct TWCryptoBox;
+
+/// Encrypts message using `my_secret` and `other_pubkey`.
+/// The output will have a randomly generated nonce prepended to it.
+/// The output will be Overhead + 24 bytes longer than the original.
+///
+/// \param mySecret *non-null* pointer to my secret key.
+/// \param otherPubkey *non-null* pointer to other's public key.
+/// \param message *non-null* pointer to the message to be encrypted.
+/// \return *nullable* pointer to the encrypted message with randomly generated nonce prepended to it.
+TW_EXPORT_STATIC_METHOD
+TWData* _Nonnull TWCryptoBoxEncryptEasy(struct TWCryptoBoxSecretKey* _Nonnull mySecret, struct TWCryptoBoxPublicKey* _Nonnull otherPubkey, TWData* _Nonnull message);
+
+/// Decrypts box produced by `TWCryptoBoxEncryptEasy`.
+/// We assume a 24-byte nonce is prepended to the encrypted text in box.
+///
+/// \param mySecret *non-null* pointer to my secret key.
+/// \param otherPubkey *non-null* pointer to other's public key.
+/// \param encrypted *non-null* pointer to the encrypted message with nonce prepended to it.
+/// \return *nullable* pointer to the decrypted message.
+TW_EXPORT_STATIC_METHOD
+TWData* _Nullable TWCryptoBoxDecryptEasy(struct TWCryptoBoxSecretKey* _Nonnull mySecret, struct TWCryptoBoxPublicKey* _Nonnull otherPubkey, TWData* _Nonnull encrypted);
+
+TW_EXTERN_C_END
diff --git a/include/TrustWalletCore/TWCryptoBoxPublicKey.h b/include/TrustWalletCore/TWCryptoBoxPublicKey.h
new file mode 100644
index 00000000000..e46ea72feae
--- /dev/null
+++ b/include/TrustWalletCore/TWCryptoBoxPublicKey.h
@@ -0,0 +1,45 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+#pragma once
+
+#include "TWBase.h"
+#include "TWData.h"
+#include "TWString.h"
+
+TW_EXTERN_C_BEGIN
+
+/// Public key used in `crypto_box` cryptography.
+TW_EXPORT_CLASS
+struct TWCryptoBoxPublicKey;
+
+/// Determines if the given public key is valid or not.
+///
+/// \param data *non-null* byte array.
+/// \return true if the public key is valid, false otherwise.
+TW_EXPORT_STATIC_METHOD
+bool TWCryptoBoxPublicKeyIsValid(TWData* _Nonnull data);
+
+/// Create a `crypto_box` public key with the given block of data.
+///
+/// \param data *non-null* byte array. Expected to have 32 bytes.
+/// \note Should be deleted with \tw_crypto_box_public_key_delete.
+/// \return Nullable pointer to Public Key.
+TW_EXPORT_STATIC_METHOD
+struct TWCryptoBoxPublicKey* _Nullable TWCryptoBoxPublicKeyCreateWithData(TWData* _Nonnull data);
+
+/// Delete the given public key.
+///
+/// \param publicKey *non-null* pointer to public key.
+TW_EXPORT_METHOD
+void TWCryptoBoxPublicKeyDelete(struct TWCryptoBoxPublicKey* _Nonnull publicKey);
+
+/// Returns the raw data of the given public-key.
+///
+/// \param publicKey *non-null* pointer to a public key.
+/// \return C-compatible result with a C-compatible byte array.
+TW_EXPORT_PROPERTY
+TWData* _Nonnull TWCryptoBoxPublicKeyData(struct TWCryptoBoxPublicKey* _Nonnull publicKey);
+
+TW_EXTERN_C_END
diff --git a/include/TrustWalletCore/TWCryptoBoxSecretKey.h b/include/TrustWalletCore/TWCryptoBoxSecretKey.h
new file mode 100644
index 00000000000..f93ad92eb56
--- /dev/null
+++ b/include/TrustWalletCore/TWCryptoBoxSecretKey.h
@@ -0,0 +1,60 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+#pragma once
+
+#include "TWBase.h"
+#include "TWCryptoBoxPublicKey.h"
+#include "TWData.h"
+#include "TWString.h"
+
+TW_EXTERN_C_BEGIN
+
+/// Secret key used in `crypto_box` cryptography.
+TW_EXPORT_CLASS
+struct TWCryptoBoxSecretKey;
+
+/// Determines if the given secret key is valid or not.
+///
+/// \param data *non-null* byte array.
+/// \return true if the secret key is valid, false otherwise.
+TW_EXPORT_STATIC_METHOD
+bool TWCryptoBoxSecretKeyIsValid(TWData* _Nonnull data);
+
+/// Create a random secret key.
+///
+/// \note Should be deleted with \tw_crypto_box_secret_key_delete.
+/// \return *non-null* pointer to Secret Key.
+TW_EXPORT_STATIC_METHOD
+struct TWCryptoBoxSecretKey* _Nonnull TWCryptoBoxSecretKeyCreate();
+
+/// Create a `crypto_box` secret key with the given block of data.
+///
+/// \param data *non-null* byte array. Expected to have 32 bytes.
+/// \note Should be deleted with \tw_crypto_box_secret_key_delete.
+/// \return Nullable pointer to Secret Key.
+TW_EXPORT_STATIC_METHOD
+struct TWCryptoBoxSecretKey* _Nullable TWCryptoBoxSecretKeyCreateWithData(TWData* _Nonnull data);
+
+/// Delete the given secret `key`.
+///
+/// \param key *non-null* pointer to secret key.
+TW_EXPORT_METHOD
+void TWCryptoBoxSecretKeyDelete(struct TWCryptoBoxSecretKey* _Nonnull key);
+
+/// Returns the public key associated with the given `key`.
+///
+/// \param key *non-null* pointer to the private key.
+/// \return *non-null* pointer to the corresponding public key.
+TW_EXPORT_METHOD
+struct TWCryptoBoxPublicKey* _Nonnull TWCryptoBoxSecretKeyGetPublicKey(struct TWCryptoBoxSecretKey* _Nonnull key);
+
+/// Returns the raw data of the given secret-key.
+///
+/// \param secretKey *non-null* pointer to a secret key.
+/// \return C-compatible result with a C-compatible byte array.
+TW_EXPORT_PROPERTY
+TWData* _Nonnull TWCryptoBoxSecretKeyData(struct TWCryptoBoxSecretKey* _Nonnull secretKey);
+
+TW_EXTERN_C_END
diff --git a/include/TrustWalletCore/TWCurve.h b/include/TrustWalletCore/TWCurve.h
index f04256c62c2..3b7f2b003bd 100644
--- a/include/TrustWalletCore/TWCurve.h
+++ b/include/TrustWalletCore/TWCurve.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWData.h b/include/TrustWalletCore/TWData.h
index 8c498d81cc4..77dc7c625b6 100644
--- a/include/TrustWalletCore/TWData.h
+++ b/include/TrustWalletCore/TWData.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWDataVector.h b/include/TrustWalletCore/TWDataVector.h
index 3f950635aea..fbfae776ad2 100644
--- a/include/TrustWalletCore/TWDataVector.h
+++ b/include/TrustWalletCore/TWDataVector.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWDerivationPath.h b/include/TrustWalletCore/TWDerivationPath.h
index 0d116870e93..ccec3051138 100644
--- a/include/TrustWalletCore/TWDerivationPath.h
+++ b/include/TrustWalletCore/TWDerivationPath.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWDerivationPathIndex.h b/include/TrustWalletCore/TWDerivationPathIndex.h
index fe7d93ae2c0..a015f37b5f5 100644
--- a/include/TrustWalletCore/TWDerivationPathIndex.h
+++ b/include/TrustWalletCore/TWDerivationPathIndex.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWEthereum.h b/include/TrustWalletCore/TWEthereum.h
index 20007e4aaff..9ff49f208b2 100644
--- a/include/TrustWalletCore/TWEthereum.h
+++ b/include/TrustWalletCore/TWEthereum.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWEthereumAbi.h b/include/TrustWalletCore/TWEthereumAbi.h
index 33b976dc61a..f2d23a4dec5 100644
--- a/include/TrustWalletCore/TWEthereumAbi.h
+++ b/include/TrustWalletCore/TWEthereumAbi.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWEthereumAbiFunction.h b/include/TrustWalletCore/TWEthereumAbiFunction.h
index d07199a2844..cb5fbb9407c 100644
--- a/include/TrustWalletCore/TWEthereumAbiFunction.h
+++ b/include/TrustWalletCore/TWEthereumAbiFunction.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWEthereumAbiValue.h b/include/TrustWalletCore/TWEthereumAbiValue.h
index 0af2f1e22ad..fcbe14de839 100644
--- a/include/TrustWalletCore/TWEthereumAbiValue.h
+++ b/include/TrustWalletCore/TWEthereumAbiValue.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWEthereumMessageSigner.h b/include/TrustWalletCore/TWEthereumMessageSigner.h
index cf21d8a8ddd..6d73c338f6c 100644
--- a/include/TrustWalletCore/TWEthereumMessageSigner.h
+++ b/include/TrustWalletCore/TWEthereumMessageSigner.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWEthereumRlp.h b/include/TrustWalletCore/TWEthereumRlp.h
index 1644c86e1e2..361ac305cbc 100644
--- a/include/TrustWalletCore/TWEthereumRlp.h
+++ b/include/TrustWalletCore/TWEthereumRlp.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWFIOAccount.h b/include/TrustWalletCore/TWFIOAccount.h
index a8abca53615..e11a65c4b3d 100644
--- a/include/TrustWalletCore/TWFIOAccount.h
+++ b/include/TrustWalletCore/TWFIOAccount.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWFilecoinAddressConverter.h b/include/TrustWalletCore/TWFilecoinAddressConverter.h
index aa5e37b8000..b6c3689984c 100644
--- a/include/TrustWalletCore/TWFilecoinAddressConverter.h
+++ b/include/TrustWalletCore/TWFilecoinAddressConverter.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWFilecoinAddressType.h b/include/TrustWalletCore/TWFilecoinAddressType.h
index 98f82450d3d..5bab60774c5 100644
--- a/include/TrustWalletCore/TWFilecoinAddressType.h
+++ b/include/TrustWalletCore/TWFilecoinAddressType.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWFiroAddressType.h b/include/TrustWalletCore/TWFiroAddressType.h
new file mode 100644
index 00000000000..55fa3a84259
--- /dev/null
+++ b/include/TrustWalletCore/TWFiroAddressType.h
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+#pragma once
+
+#include "TWBase.h"
+
+TW_EXTERN_C_BEGIN
+
+/// Firo address type.
+TW_EXPORT_ENUM(uint32_t)
+enum TWFiroAddressType {
+ TWFiroAddressTypeDefault = 0, // default
+ TWFiroAddressTypeExchange = 1,
+};
+
+TW_EXTERN_C_END
diff --git a/include/TrustWalletCore/TWGroestlcoinAddress.h b/include/TrustWalletCore/TWGroestlcoinAddress.h
index e6512db8c0b..52114afd736 100644
--- a/include/TrustWalletCore/TWGroestlcoinAddress.h
+++ b/include/TrustWalletCore/TWGroestlcoinAddress.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWHDVersion.h b/include/TrustWalletCore/TWHDVersion.h
index 6e726bef840..ceb7733e676 100644
--- a/include/TrustWalletCore/TWHDVersion.h
+++ b/include/TrustWalletCore/TWHDVersion.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWHDWallet.h b/include/TrustWalletCore/TWHDWallet.h
index e48e9bd7050..9e902a55587 100644
--- a/include/TrustWalletCore/TWHDWallet.h
+++ b/include/TrustWalletCore/TWHDWallet.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWHash.h b/include/TrustWalletCore/TWHash.h
index f8f4a9743e2..06024bb4e4f 100644
--- a/include/TrustWalletCore/TWHash.h
+++ b/include/TrustWalletCore/TWHash.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWLiquidStaking.h b/include/TrustWalletCore/TWLiquidStaking.h
index 4829ef3b594..a50f3e2709b 100644
--- a/include/TrustWalletCore/TWLiquidStaking.h
+++ b/include/TrustWalletCore/TWLiquidStaking.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
#include "TWBase.h"
diff --git a/include/TrustWalletCore/TWMnemonic.h b/include/TrustWalletCore/TWMnemonic.h
index 6baa9b1113c..2cfba1dba70 100644
--- a/include/TrustWalletCore/TWMnemonic.h
+++ b/include/TrustWalletCore/TWMnemonic.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWNEARAccount.h b/include/TrustWalletCore/TWNEARAccount.h
index 8daa5365cf9..cd8fbb4b97a 100644
--- a/include/TrustWalletCore/TWNEARAccount.h
+++ b/include/TrustWalletCore/TWNEARAccount.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWNervosAddress.h b/include/TrustWalletCore/TWNervosAddress.h
index eedceb86f08..0254c2bf5cf 100644
--- a/include/TrustWalletCore/TWNervosAddress.h
+++ b/include/TrustWalletCore/TWNervosAddress.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWPBKDF2.h b/include/TrustWalletCore/TWPBKDF2.h
index b7070849dbf..86c6cca6801 100644
--- a/include/TrustWalletCore/TWPBKDF2.h
+++ b/include/TrustWalletCore/TWPBKDF2.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWPrivateKey.h b/include/TrustWalletCore/TWPrivateKey.h
index 2e32b19f532..5fdfc61bcde 100644
--- a/include/TrustWalletCore/TWPrivateKey.h
+++ b/include/TrustWalletCore/TWPrivateKey.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWPrivateKeyType.h b/include/TrustWalletCore/TWPrivateKeyType.h
index a51aebae791..ee9255e0893 100644
--- a/include/TrustWalletCore/TWPrivateKeyType.h
+++ b/include/TrustWalletCore/TWPrivateKeyType.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWPublicKey.h b/include/TrustWalletCore/TWPublicKey.h
index 326f694d073..7187ac564af 100644
--- a/include/TrustWalletCore/TWPublicKey.h
+++ b/include/TrustWalletCore/TWPublicKey.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWPublicKeyType.h b/include/TrustWalletCore/TWPublicKeyType.h
index 894292ad5f4..f175fc8c471 100644
--- a/include/TrustWalletCore/TWPublicKeyType.h
+++ b/include/TrustWalletCore/TWPublicKeyType.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWPurpose.h b/include/TrustWalletCore/TWPurpose.h
index 142ed4f10c9..8cfa9cd91ae 100644
--- a/include/TrustWalletCore/TWPurpose.h
+++ b/include/TrustWalletCore/TWPurpose.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWRippleXAddress.h b/include/TrustWalletCore/TWRippleXAddress.h
index ff412711003..3c9256d2613 100644
--- a/include/TrustWalletCore/TWRippleXAddress.h
+++ b/include/TrustWalletCore/TWRippleXAddress.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWSS58AddressType.h b/include/TrustWalletCore/TWSS58AddressType.h
index 846c9d8c60f..9f9010c670e 100644
--- a/include/TrustWalletCore/TWSS58AddressType.h
+++ b/include/TrustWalletCore/TWSS58AddressType.h
@@ -1,9 +1,7 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWSegwitAddress.h b/include/TrustWalletCore/TWSegwitAddress.h
index 29c81571132..452b4bc2ed0 100644
--- a/include/TrustWalletCore/TWSegwitAddress.h
+++ b/include/TrustWalletCore/TWSegwitAddress.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWSolanaAddress.h b/include/TrustWalletCore/TWSolanaAddress.h
index 9e9c4ede571..3a21460e759 100644
--- a/include/TrustWalletCore/TWSolanaAddress.h
+++ b/include/TrustWalletCore/TWSolanaAddress.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
@@ -37,6 +35,14 @@ void TWSolanaAddressDelete(struct TWSolanaAddress* _Nonnull address);
TW_EXPORT_METHOD
TWString* _Nullable TWSolanaAddressDefaultTokenAddress(struct TWSolanaAddress* _Nonnull address, TWString* _Nonnull tokenMintAddress);
+/// Derive token 2022 address for token
+///
+/// \param address Non-null pointer to a Solana Address
+/// \param tokenMintAddress Non-null pointer to a token mint address as a string
+/// \return Null pointer if the token 2022 address for a token is not found, valid pointer otherwise
+TW_EXPORT_METHOD
+TWString* _Nullable TWSolanaAddressToken2022Address(struct TWSolanaAddress* _Nonnull address, TWString* _Nonnull tokenMintAddress);
+
/// Returns the address string representation.
///
/// \param address Non-null pointer to a Solana Address
diff --git a/include/TrustWalletCore/TWSolanaTransaction.h b/include/TrustWalletCore/TWSolanaTransaction.h
new file mode 100644
index 00000000000..681313ff248
--- /dev/null
+++ b/include/TrustWalletCore/TWSolanaTransaction.h
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+#pragma once
+
+#include "TWBase.h"
+#include "TWData.h"
+#include "TWDataVector.h"
+#include "TWString.h"
+
+TW_EXTERN_C_BEGIN
+
+TW_EXPORT_STRUCT
+struct TWSolanaTransaction;
+
+/// Decode Solana transaction, update the recent blockhash and re-sign the transaction.
+///
+/// # Warning
+///
+/// This is a temporary solution. It will be removed when `Solana.proto` supports
+/// direct transaction signing.
+///
+/// \param encodedTx base64 encoded Solana transaction.
+/// \param recentBlockhash base58 encoded recent blockhash.
+/// \param privateKeys list of private keys that should be used to re-sign the transaction.
+/// \return serialized `Solana::Proto::SigningOutput`.
+TW_EXPORT_STATIC_METHOD
+TWData *_Nonnull TWSolanaTransactionUpdateBlockhashAndSign(TWString *_Nonnull encodedTx,
+ TWString *_Nonnull recentBlockhash,
+ const struct TWDataVector *_Nonnull privateKeys);
+
+TW_EXTERN_C_END
diff --git a/include/TrustWalletCore/TWStarkExMessageSigner.h b/include/TrustWalletCore/TWStarkExMessageSigner.h
index 63e0d2eb7cc..d5299f4f026 100644
--- a/include/TrustWalletCore/TWStarkExMessageSigner.h
+++ b/include/TrustWalletCore/TWStarkExMessageSigner.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWStarkWare.h b/include/TrustWalletCore/TWStarkWare.h
index 1f767ea6d71..1ff02199f71 100644
--- a/include/TrustWalletCore/TWStarkWare.h
+++ b/include/TrustWalletCore/TWStarkWare.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWStellarMemoType.h b/include/TrustWalletCore/TWStellarMemoType.h
index 812edbf4fda..8f6b66eec8f 100644
--- a/include/TrustWalletCore/TWStellarMemoType.h
+++ b/include/TrustWalletCore/TWStellarMemoType.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWStellarPassphrase.h b/include/TrustWalletCore/TWStellarPassphrase.h
index d56187244eb..307afb84865 100644
--- a/include/TrustWalletCore/TWStellarPassphrase.h
+++ b/include/TrustWalletCore/TWStellarPassphrase.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWStellarVersionByte.h b/include/TrustWalletCore/TWStellarVersionByte.h
index f2df0f65215..94f125ab94c 100644
--- a/include/TrustWalletCore/TWStellarVersionByte.h
+++ b/include/TrustWalletCore/TWStellarVersionByte.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWStoredKey.h b/include/TrustWalletCore/TWStoredKey.h
index 01efa96e691..58a07e521c0 100644
--- a/include/TrustWalletCore/TWStoredKey.h
+++ b/include/TrustWalletCore/TWStoredKey.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
@@ -297,6 +295,16 @@ TWData* _Nullable TWStoredKeyExportJSON(struct TWStoredKey* _Nonnull key);
TW_EXPORT_METHOD
bool TWStoredKeyFixAddresses(struct TWStoredKey* _Nonnull key, TWData* _Nonnull password);
+/// Re-derives address for the account(s) associated with the given coin.
+/// This method can be used if address format has been changed.
+/// In case of multiple accounts, all of them will be updated.
+///
+/// \param key Non-null pointer to a stored key
+/// \param coin Account(s) coin type to be updated
+/// \return `false` if there are no accounts associated with the given coin, true otherwise
+TW_EXPORT_METHOD
+bool TWStoredKeyUpdateAddress(struct TWStoredKey* _Nonnull key, enum TWCoinType coin);
+
/// Retrieve stored key encoding parameters, as JSON string.
///
/// \param key Non-null pointer to a stored key
diff --git a/include/TrustWalletCore/TWStoredKeyEncryption.h b/include/TrustWalletCore/TWStoredKeyEncryption.h
index 856b407157b..ccb0d7cfcac 100644
--- a/include/TrustWalletCore/TWStoredKeyEncryption.h
+++ b/include/TrustWalletCore/TWStoredKeyEncryption.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWStoredKeyEncryptionLevel.h b/include/TrustWalletCore/TWStoredKeyEncryptionLevel.h
index 071df20c97f..6a7ceb7bcbc 100644
--- a/include/TrustWalletCore/TWStoredKeyEncryptionLevel.h
+++ b/include/TrustWalletCore/TWStoredKeyEncryptionLevel.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWString.h b/include/TrustWalletCore/TWString.h
index 336b88922f4..9cfc8e77bfc 100644
--- a/include/TrustWalletCore/TWString.h
+++ b/include/TrustWalletCore/TWString.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWTHORChainSwap.h b/include/TrustWalletCore/TWTHORChainSwap.h
index bcd35a0911e..11844425bbe 100644
--- a/include/TrustWalletCore/TWTHORChainSwap.h
+++ b/include/TrustWalletCore/TWTHORChainSwap.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
#include "TWBase.h"
diff --git a/include/TrustWalletCore/TWTONAddressConverter.h b/include/TrustWalletCore/TWTONAddressConverter.h
new file mode 100644
index 00000000000..39bb4dfed7e
--- /dev/null
+++ b/include/TrustWalletCore/TWTONAddressConverter.h
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+#pragma once
+
+#include "TWBase.h"
+#include "TWString.h"
+
+TW_EXTERN_C_BEGIN
+
+/// TON address operations.
+TW_EXPORT_CLASS
+struct TWTONAddressConverter;
+
+/// Converts a TON user address into a Bag of Cells (BoC) with a single root Cell.
+/// The function is mostly used to request a Jetton user address via `get_wallet_address` RPC.
+/// https://docs.ton.org/develop/dapps/asset-processing/jettons#retrieving-jetton-wallet-addresses-for-a-given-user
+///
+/// \param address Address to be converted into a Bag Of Cells (BoC).
+/// \return Pointer to a base64 encoded Bag Of Cells (BoC). Null if invalid address provided.
+TW_EXPORT_STATIC_METHOD
+TWString *_Nullable TWTONAddressConverterToBoc(TWString *_Nonnull address);
+
+/// Parses a TON address from a Bag of Cells (BoC) with a single root Cell.
+/// The function is mostly used to parse a Jetton user address received on `get_wallet_address` RPC.
+/// https://docs.ton.org/develop/dapps/asset-processing/jettons#retrieving-jetton-wallet-addresses-for-a-given-user
+///
+/// \param boc Base64 encoded Bag Of Cells (BoC).
+/// \return Pointer to a Jetton address.
+TW_EXPORT_STATIC_METHOD
+TWString *_Nullable TWTONAddressConverterFromBoc(TWString *_Nonnull boc);
+
+/// Converts any TON address format to user friendly with the given parameters.
+///
+/// \param address raw or user-friendly address to be converted.
+/// \param bounceable whether the result address should be bounceable.
+/// \param testnet whether the result address should be testnet.
+/// \return user-friendly address str.
+TW_EXPORT_STATIC_METHOD
+TWString *_Nullable TWTONAddressConverterToUserFriendly(TWString *_Nonnull address, bool bounceable, bool testnet);
+
+TW_EXTERN_C_END
diff --git a/include/TrustWalletCore/TWTONMessageSigner.h b/include/TrustWalletCore/TWTONMessageSigner.h
new file mode 100644
index 00000000000..c9c73876ee3
--- /dev/null
+++ b/include/TrustWalletCore/TWTONMessageSigner.h
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+#pragma once
+
+#include "TWBase.h"
+#include "TWPrivateKey.h"
+#include "TWString.h"
+
+TW_EXTERN_C_BEGIN
+
+/// TON message signing.
+TW_EXPORT_CLASS
+struct TWTONMessageSigner;
+
+/// Signs an arbitrary message to prove ownership of an address for off-chain services.
+/// https://github.com/ton-foundation/specs/blob/main/specs/wtf-0002.md
+///
+/// \param privateKey: the private key used for signing
+/// \param message: A custom message which is input to the signing.
+/// \returns the signature, Hex-encoded. On invalid input null is returned. Returned object needs to be deleted after use.
+TW_EXPORT_STATIC_METHOD
+TWString *_Nullable TWTONMessageSignerSignMessage(struct TWPrivateKey *_Nonnull privateKey, TWString* _Nonnull message);
+
+TW_EXTERN_C_END
diff --git a/include/TrustWalletCore/TWTONWallet.h b/include/TrustWalletCore/TWTONWallet.h
new file mode 100644
index 00000000000..098702faa6a
--- /dev/null
+++ b/include/TrustWalletCore/TWTONWallet.h
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+#pragma once
+
+#include "TWBase.h"
+#include "TWPublicKey.h"
+#include "TWString.h"
+
+TW_EXTERN_C_BEGIN
+
+/// TON wallet operations.
+TW_EXPORT_CLASS
+struct TWTONWallet;
+
+/// Constructs a TON Wallet V4R2 stateInit encoded as BoC (BagOfCells) for the given `public_key`.
+///
+/// \param publicKey wallet's public key.
+/// \param workchain TON workchain to which the wallet belongs. Usually, base chain is used (0).
+/// \param walletId wallet's ID allows to create multiple wallets for the same private key.
+/// \return Pointer to a base64 encoded Bag Of Cells (BoC) StateInit. Null if invalid public key provided.
+TW_EXPORT_STATIC_METHOD
+TWString *_Nullable TWTONWalletBuildV4R2StateInit(struct TWPublicKey *_Nonnull publicKey, int32_t workchain, int32_t walletId);
+
+TW_EXTERN_C_END
diff --git a/include/TrustWalletCore/TWTezosMessageSigner.h b/include/TrustWalletCore/TWTezosMessageSigner.h
index bcb99bf8a85..be1f586f448 100644
--- a/include/TrustWalletCore/TWTezosMessageSigner.h
+++ b/include/TrustWalletCore/TWTezosMessageSigner.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWTransactionCompiler.h b/include/TrustWalletCore/TWTransactionCompiler.h
index 5ec06883c40..67dfc4f0124 100644
--- a/include/TrustWalletCore/TWTransactionCompiler.h
+++ b/include/TrustWalletCore/TWTransactionCompiler.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
@@ -18,23 +16,6 @@ TW_EXTERN_C_BEGIN
TW_EXPORT_STRUCT
struct TWTransactionCompiler;
-/// Builds a coin-specific SigningInput (proto object) from a simple transaction.
-///
-/// \deprecated `TWTransactionCompilerBuildInput` will be removed soon.
-/// \param coin coin type.
-/// \param from sender of the transaction.
-/// \param to receiver of the transaction.
-/// \param amount transaction amount in string
-/// \param asset optional asset name, like "BNB"
-/// \param memo optional memo
-/// \param chainId optional chainId to override default
-/// \return serialized data of the SigningInput proto object.
-TW_EXPORT_STATIC_METHOD
-TWData* _Nonnull TWTransactionCompilerBuildInput(enum TWCoinType coinType, TWString* _Nonnull from,
- TWString* _Nonnull to, TWString* _Nonnull amount,
- TWString* _Nonnull asset, TWString* _Nonnull memo,
- TWString* _Nonnull chainId);
-
/// Obtains pre-signing hashes of a transaction.
///
/// We provide a default `PreSigningOutput` in TransactionCompiler.proto.
diff --git a/include/TrustWalletCore/TWTransactionDecoder.h b/include/TrustWalletCore/TWTransactionDecoder.h
new file mode 100644
index 00000000000..2d1a22cffe4
--- /dev/null
+++ b/include/TrustWalletCore/TWTransactionDecoder.h
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+#pragma once
+
+#include "TWBase.h"
+#include "TWCoinType.h"
+#include "TWData.h"
+#include "TWString.h"
+
+TW_EXTERN_C_BEGIN
+
+TW_EXPORT_STRUCT
+struct TWTransactionDecoder;
+
+/// Decodes a transaction from a binary representation.
+///
+/// \param coin coin type.
+/// \param encodedTx encoded transaction data.
+/// \return serialized protobuf message specific for the given coin.
+TW_EXPORT_STATIC_METHOD
+TWData *_Nonnull TWTransactionDecoderDecode(enum TWCoinType coinType, TWData *_Nonnull encodedTx);
+
+TW_EXTERN_C_END
diff --git a/include/TrustWalletCore/TWTransactionUtil.h b/include/TrustWalletCore/TWTransactionUtil.h
new file mode 100644
index 00000000000..55b2a811428
--- /dev/null
+++ b/include/TrustWalletCore/TWTransactionUtil.h
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+#pragma once
+
+#include "TWBase.h"
+#include "TWCoinType.h"
+#include "TWData.h"
+
+TW_EXTERN_C_BEGIN
+
+TW_EXPORT_STRUCT
+struct TWTransactionUtil;
+
+/// Calculate the TX hash of a transaction.
+///
+/// \param coin coin type.
+/// \param encodedTx encoded transaction data.
+/// \return The TX hash of a transaction, If the input is invalid or the chain is unsupported, null is returned.
+TW_EXPORT_STATIC_METHOD
+TWString* _Nullable TWTransactionUtilCalcTxHash(enum TWCoinType coinType, TWString* _Nonnull encodedTx);
+
+TW_EXTERN_C_END
diff --git a/include/TrustWalletCore/TWTronMessageSigner.h b/include/TrustWalletCore/TWTronMessageSigner.h
index 56f326d49a4..d20baba14c1 100644
--- a/include/TrustWalletCore/TWTronMessageSigner.h
+++ b/include/TrustWalletCore/TWTronMessageSigner.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/include/TrustWalletCore/TWWalletConnectRequest.h b/include/TrustWalletCore/TWWalletConnectRequest.h
new file mode 100644
index 00000000000..41ba895457c
--- /dev/null
+++ b/include/TrustWalletCore/TWWalletConnectRequest.h
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+#pragma once
+
+#include "TWBase.h"
+#include "TWCoinType.h"
+#include "TWData.h"
+
+TW_EXTERN_C_BEGIN
+
+/// Represents a WalletConnect signing request.
+TW_EXPORT_CLASS
+struct TWWalletConnectRequest;
+
+/// Parses the WalletConnect signing request as a `SigningInput`.
+///
+/// \param coin The given coin type to plan the transaction for.
+/// \param input The serialized data of a `WalletConnect::Proto::ParseRequestInput` proto object.
+/// \return The serialized data of `WalletConnect::Proto::ParseRequestOutput` proto object.
+TW_EXPORT_STATIC_METHOD
+TWData* _Nonnull TWWalletConnectRequestParse(enum TWCoinType coin, TWData* _Nonnull input);
+
+TW_EXTERN_C_END
diff --git a/include/TrustWalletCore/TWWebAuthn.h b/include/TrustWalletCore/TWWebAuthn.h
index 4d988daaecf..c3f24b27a2b 100644
--- a/include/TrustWalletCore/TWWebAuthn.h
+++ b/include/TrustWalletCore/TWWebAuthn.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
#include "TWBase.h"
diff --git a/jni/android/AnySigner.c b/jni/android/AnySigner.c
index d9ac054adc4..fd1704562f5 100644
--- a/jni/android/AnySigner.c
+++ b/jni/android/AnySigner.c
@@ -1,8 +1,6 @@
-// Copyright © 2017-2020 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#include
#include
diff --git a/jni/android/AnySigner.h b/jni/android/AnySigner.h
index b51323a6554..566d446a7ee 100644
--- a/jni/android/AnySigner.h
+++ b/jni/android/AnySigner.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2020 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#ifndef JNI_TW_ANYSIGNER_H
#define JNI_TW_ANYSIGNER_H
diff --git a/jni/cpp/Random.cpp b/jni/cpp/Random.cpp
index 8e583ae5a92..216c61d46cc 100644
--- a/jni/cpp/Random.cpp
+++ b/jni/cpp/Random.cpp
@@ -1,12 +1,11 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#include
#include
#include
+#include
static JavaVM* cachedJVM;
@@ -27,31 +26,42 @@ uint32_t random32() {
}
void random_buffer(uint8_t *buf, size_t len) {
- JNIEnv *env;
-
+ if (cachedJVM)
+ {
+ JNIEnv *env;
+
#if defined(__ANDROID__) || defined(ANDROID)
cachedJVM->AttachCurrentThread(&env, nullptr);
#else
cachedJVM->AttachCurrentThread((void **) &env, nullptr);
#endif
- // SecureRandom random = new SecureRandom();
- jclass secureRandomClass = env->FindClass("java/security/SecureRandom");
- jmethodID constructor = env->GetMethodID(secureRandomClass, "", "()V");
- jobject random = env->NewObject(secureRandomClass, constructor);
+ // SecureRandom random = new SecureRandom();
+ jclass secureRandomClass = env->FindClass("java/security/SecureRandom");
+ jmethodID constructor = env->GetMethodID(secureRandomClass, "", "()V");
+ jobject random = env->NewObject(secureRandomClass, constructor);
- //byte array[] = new byte[len];
- jbyteArray array = env->NewByteArray(static_cast(len));
+ //byte array[] = new byte[len];
+ jbyteArray array = env->NewByteArray(static_cast(len));
- //random.nextBytes(bytes);
- jmethodID nextBytes = env->GetMethodID(secureRandomClass, "nextBytes", "([B)V");
- env->CallVoidMethod(random, nextBytes, array);
+ //random.nextBytes(bytes);
+ jmethodID nextBytes = env->GetMethodID(secureRandomClass, "nextBytes", "([B)V");
+ env->CallVoidMethod(random, nextBytes, array);
- jbyte* bytes = env->GetByteArrayElements(array, nullptr);
- memcpy(buf, bytes, len);
- env->ReleaseByteArrayElements(array, bytes, JNI_ABORT);
+ jbyte* bytes = env->GetByteArrayElements(array, nullptr);
+ memcpy(buf, bytes, len);
+ env->ReleaseByteArrayElements(array, bytes, JNI_ABORT);
- env->DeleteLocalRef(array);
- env->DeleteLocalRef(random);
- env->DeleteLocalRef(secureRandomClass);
+ env->DeleteLocalRef(array);
+ env->DeleteLocalRef(random);
+ env->DeleteLocalRef(secureRandomClass);
+ }
+ else
+ {
+ std::ifstream randomData("/dev/urandom", std::ios::in | std::ios::binary);
+ if (randomData.is_open()) {
+ randomData.read(reinterpret_cast(buf), len);
+ randomData.close();
+ }
+ }
}
diff --git a/jni/cpp/TWJNI.h b/jni/cpp/TWJNI.h
index 4fc8d55d71f..86fc962ca29 100644
--- a/jni/cpp/TWJNI.h
+++ b/jni/cpp/TWJNI.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/jni/cpp/TWJNIData.cpp b/jni/cpp/TWJNIData.cpp
index 47e294f64b0..942505f593f 100644
--- a/jni/cpp/TWJNIData.cpp
+++ b/jni/cpp/TWJNIData.cpp
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#include
#include
diff --git a/jni/cpp/TWJNIData.h b/jni/cpp/TWJNIData.h
index 39d3ca47aa9..9d1c6730368 100644
--- a/jni/cpp/TWJNIData.h
+++ b/jni/cpp/TWJNIData.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/jni/cpp/TWJNIString.cpp b/jni/cpp/TWJNIString.cpp
index 95b017fac2e..996eb0c747c 100644
--- a/jni/cpp/TWJNIString.cpp
+++ b/jni/cpp/TWJNIString.cpp
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#include
#include
diff --git a/jni/cpp/TWJNIString.h b/jni/cpp/TWJNIString.h
index e6452df0134..1691fe47abb 100644
--- a/jni/cpp/TWJNIString.h
+++ b/jni/cpp/TWJNIString.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#pragma once
diff --git a/jni/java/wallet/core/java/AnySigner.java b/jni/java/wallet/core/java/AnySigner.java
index 49c7770d3d1..21caaa185d4 100644
--- a/jni/java/wallet/core/java/AnySigner.java
+++ b/jni/java/wallet/core/java/AnySigner.java
@@ -1,8 +1,6 @@
-// Copyright © 2017-2020 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package wallet.core.java;
diff --git a/jni/kotlin/AnySigner.c b/jni/kotlin/AnySigner.c
index 57c215eb34c..83211fb3512 100644
--- a/jni/kotlin/AnySigner.c
+++ b/jni/kotlin/AnySigner.c
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#include
#include
diff --git a/jni/kotlin/AnySigner.h b/jni/kotlin/AnySigner.h
index 05742d57122..eac2bd9340b 100644
--- a/jni/kotlin/AnySigner.h
+++ b/jni/kotlin/AnySigner.h
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
#ifndef JNI_TW_ANYSIGNER_H
#define JNI_TW_ANYSIGNER_H
diff --git a/kotlin/build-logic/build.gradle.kts b/kotlin/build-logic/build.gradle.kts
index 83e8afc4707..1f41e03775b 100644
--- a/kotlin/build-logic/build.gradle.kts
+++ b/kotlin/build-logic/build.gradle.kts
@@ -6,6 +6,10 @@ plugins {
}
allprojects {
+ tasks.withType {
+ sourceCompatibility = "17"
+ targetCompatibility = "17"
+ }
tasks.withType {
compilerOptions {
allWarningsAsErrors.set(true)
diff --git a/kotlin/kotlin-js-store/yarn.lock b/kotlin/kotlin-js-store/yarn.lock
index f2fd767d23d..0995b488885 100644
--- a/kotlin/kotlin-js-store/yarn.lock
+++ b/kotlin/kotlin-js-store/yarn.lock
@@ -2,6 +2,28 @@
# yarn lockfile v1
+"@babel/code-frame@^7.10.4":
+ version "7.23.5"
+ resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.23.5.tgz#9009b69a8c602293476ad598ff53e4562e15c244"
+ integrity sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==
+ dependencies:
+ "@babel/highlight" "^7.23.4"
+ chalk "^2.4.2"
+
+"@babel/helper-validator-identifier@^7.22.20":
+ version "7.22.20"
+ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0"
+ integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==
+
+"@babel/highlight@^7.23.4":
+ version "7.23.4"
+ resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.23.4.tgz#edaadf4d8232e1a961432db785091207ead0621b"
+ integrity sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==
+ dependencies:
+ "@babel/helper-validator-identifier" "^7.22.20"
+ chalk "^2.4.2"
+ js-tokens "^4.0.0"
+
"@colors/colors@1.5.0":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9"
@@ -13,44 +35,86 @@
integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==
"@jridgewell/gen-mapping@^0.3.0":
- version "0.3.2"
- resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz#c1aedc61e853f2bb9f5dfe6d4442d3b565b253b9"
- integrity sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==
+ version "0.3.3"
+ resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098"
+ integrity sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==
dependencies:
"@jridgewell/set-array" "^1.0.1"
"@jridgewell/sourcemap-codec" "^1.4.10"
"@jridgewell/trace-mapping" "^0.3.9"
-"@jridgewell/resolve-uri@3.1.0":
- version "3.1.0"
- resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78"
- integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==
+"@jridgewell/resolve-uri@^3.1.0":
+ version "3.1.1"
+ resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721"
+ integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==
"@jridgewell/set-array@^1.0.1":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72"
integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==
-"@jridgewell/source-map@^0.3.2":
- version "0.3.2"
- resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.2.tgz#f45351aaed4527a298512ec72f81040c998580fb"
- integrity sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==
+"@jridgewell/source-map@^0.3.3":
+ version "0.3.5"
+ resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.5.tgz#a3bb4d5c6825aab0d281268f47f6ad5853431e91"
+ integrity sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==
dependencies:
"@jridgewell/gen-mapping" "^0.3.0"
"@jridgewell/trace-mapping" "^0.3.9"
-"@jridgewell/sourcemap-codec@1.4.14", "@jridgewell/sourcemap-codec@^1.4.10":
- version "1.4.14"
- resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24"
- integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==
-
-"@jridgewell/trace-mapping@^0.3.14", "@jridgewell/trace-mapping@^0.3.9":
- version "0.3.17"
- resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz#793041277af9073b0951a7fe0f0d8c4c98c36985"
- integrity sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==
+"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14":
+ version "1.4.15"
+ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32"
+ integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==
+
+"@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9":
+ version "0.3.20"
+ resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz#72e45707cf240fa6b081d0366f8265b0cd10197f"
+ integrity sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==
+ dependencies:
+ "@jridgewell/resolve-uri" "^3.1.0"
+ "@jridgewell/sourcemap-codec" "^1.4.14"
+
+"@rollup/plugin-commonjs@^21.0.1":
+ version "21.1.0"
+ resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-21.1.0.tgz#45576d7b47609af2db87f55a6d4b46e44fc3a553"
+ integrity sha512-6ZtHx3VHIp2ReNNDxHjuUml6ur+WcQ28N1yHgCQwsbNkQg2suhxGMDQGJOn/KuDxKtd1xuZP5xSTwBA4GQ8hbA==
+ dependencies:
+ "@rollup/pluginutils" "^3.1.0"
+ commondir "^1.0.1"
+ estree-walker "^2.0.1"
+ glob "^7.1.6"
+ is-reference "^1.2.1"
+ magic-string "^0.25.7"
+ resolve "^1.17.0"
+
+"@rollup/plugin-node-resolve@^13.1.3":
+ version "13.3.0"
+ resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.3.0.tgz#da1c5c5ce8316cef96a2f823d111c1e4e498801c"
+ integrity sha512-Lus8rbUo1eEcnS4yTFKLZrVumLPY+YayBdWXgFSHYhTT2iJbMhoaaBL3xl5NCdeRytErGr8tZ0L71BMRmnlwSw==
+ dependencies:
+ "@rollup/pluginutils" "^3.1.0"
+ "@types/resolve" "1.17.1"
+ deepmerge "^4.2.2"
+ is-builtin-module "^3.1.0"
+ is-module "^1.0.0"
+ resolve "^1.19.0"
+
+"@rollup/plugin-typescript@^8.3.0":
+ version "8.5.0"
+ resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-8.5.0.tgz#7ea11599a15b0a30fa7ea69ce3b791d41b862515"
+ integrity sha512-wMv1/scv0m/rXx21wD2IsBbJFba8wGF3ErJIr6IKRfRj49S85Lszbxb4DCo8iILpluTjk2GAAu9CoZt4G3ppgQ==
+ dependencies:
+ "@rollup/pluginutils" "^3.1.0"
+ resolve "^1.17.0"
+
+"@rollup/pluginutils@^3.0.9", "@rollup/pluginutils@^3.1.0":
+ version "3.1.0"
+ resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b"
+ integrity sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==
dependencies:
- "@jridgewell/resolve-uri" "3.1.0"
- "@jridgewell/sourcemap-codec" "1.4.14"
+ "@types/estree" "0.0.39"
+ estree-walker "^1.0.1"
+ picomatch "^2.2.2"
"@socket.io/component-emitter@~3.1.0":
version "3.1.0"
@@ -63,172 +127,186 @@
integrity sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==
"@types/cors@^2.8.12":
- version "2.8.13"
- resolved "https://registry.yarnpkg.com/@types/cors/-/cors-2.8.13.tgz#b8ade22ba455a1b8cb3b5d3f35910fd204f84f94"
- integrity sha512-RG8AStHlUiV5ysZQKq97copd2UmVYw3/pRMLefISZ3S1hK104Cwm7iLQ3fTKx+lsUH2CE8FlLaYeEA2LSeqYUA==
+ version "2.8.17"
+ resolved "https://registry.yarnpkg.com/@types/cors/-/cors-2.8.17.tgz#5d718a5e494a8166f569d986794e49c48b216b2b"
+ integrity sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==
dependencies:
"@types/node" "*"
"@types/eslint-scope@^3.7.3":
- version "3.7.4"
- resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.4.tgz#37fc1223f0786c39627068a12e94d6e6fc61de16"
- integrity sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==
+ version "3.7.7"
+ resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.7.tgz#3108bd5f18b0cdb277c867b3dd449c9ed7079ac5"
+ integrity sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==
dependencies:
"@types/eslint" "*"
"@types/estree" "*"
"@types/eslint@*":
- version "8.4.10"
- resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.4.10.tgz#19731b9685c19ed1552da7052b6f668ed7eb64bb"
- integrity sha512-Sl/HOqN8NKPmhWo2VBEPm0nvHnu2LL3v9vKo8MEq0EtbJ4eVzGPl41VNPvn5E1i5poMk4/XD8UriLHpJvEP/Nw==
+ version "8.44.9"
+ resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.44.9.tgz#5799663009645637bd1c45b2e1a7c8f4caf89534"
+ integrity sha512-6yBxcvwnnYoYT1Uk2d+jvIfsuP4mb2EdIxFnrPABj5a/838qe5bGkNLFOiipX4ULQ7XVQvTxOh7jO+BTAiqsEw==
dependencies:
"@types/estree" "*"
"@types/json-schema" "*"
-"@types/estree@*":
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.0.tgz#5fb2e536c1ae9bf35366eed879e827fa59ca41c2"
- integrity sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==
+"@types/estree@*", "@types/estree@^1.0.0":
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4"
+ integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==
-"@types/estree@^0.0.51":
- version "0.0.51"
- resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.51.tgz#cfd70924a25a3fd32b218e5e420e6897e1ac4f40"
- integrity sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==
+"@types/estree@0.0.39":
+ version "0.0.39"
+ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
+ integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==
"@types/json-schema@*", "@types/json-schema@^7.0.8":
- version "7.0.11"
- resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3"
- integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==
+ version "7.0.15"
+ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
+ integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==
"@types/node@*", "@types/node@>=10.0.0":
- version "18.11.18"
- resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.18.tgz#8dfb97f0da23c2293e554c5a50d61ef134d7697f"
- integrity sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==
+ version "20.10.4"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-20.10.4.tgz#b246fd84d55d5b1b71bf51f964bd514409347198"
+ integrity sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==
+ dependencies:
+ undici-types "~5.26.4"
+
+"@types/node@^12.12.14":
+ version "12.20.55"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240"
+ integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==
+
+"@types/resolve@1.17.1":
+ version "1.17.1"
+ resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.17.1.tgz#3afd6ad8967c77e4376c598a82ddd58f46ec45d6"
+ integrity sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==
+ dependencies:
+ "@types/node" "*"
"@ungap/promise-all-settled@1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44"
integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==
-"@webassemblyjs/ast@1.11.1":
- version "1.11.1"
- resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.1.tgz#2bfd767eae1a6996f432ff7e8d7fc75679c0b6a7"
- integrity sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==
+"@webassemblyjs/ast@1.11.6", "@webassemblyjs/ast@^1.11.5":
+ version "1.11.6"
+ resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.6.tgz#db046555d3c413f8966ca50a95176a0e2c642e24"
+ integrity sha512-IN1xI7PwOvLPgjcf180gC1bqn3q/QaOCwYUahIOhbYUu8KA/3tw2RT/T0Gidi1l7Hhj5D/INhJxiICObqpMu4Q==
dependencies:
- "@webassemblyjs/helper-numbers" "1.11.1"
- "@webassemblyjs/helper-wasm-bytecode" "1.11.1"
+ "@webassemblyjs/helper-numbers" "1.11.6"
+ "@webassemblyjs/helper-wasm-bytecode" "1.11.6"
-"@webassemblyjs/floating-point-hex-parser@1.11.1":
- version "1.11.1"
- resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz#f6c61a705f0fd7a6aecaa4e8198f23d9dc179e4f"
- integrity sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==
+"@webassemblyjs/floating-point-hex-parser@1.11.6":
+ version "1.11.6"
+ resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.6.tgz#dacbcb95aff135c8260f77fa3b4c5fea600a6431"
+ integrity sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw==
-"@webassemblyjs/helper-api-error@1.11.1":
- version "1.11.1"
- resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz#1a63192d8788e5c012800ba6a7a46c705288fd16"
- integrity sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==
+"@webassemblyjs/helper-api-error@1.11.6":
+ version "1.11.6"
+ resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.6.tgz#6132f68c4acd59dcd141c44b18cbebbd9f2fa768"
+ integrity sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q==
-"@webassemblyjs/helper-buffer@1.11.1":
- version "1.11.1"
- resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz#832a900eb444884cde9a7cad467f81500f5e5ab5"
- integrity sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==
+"@webassemblyjs/helper-buffer@1.11.6":
+ version "1.11.6"
+ resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.6.tgz#b66d73c43e296fd5e88006f18524feb0f2c7c093"
+ integrity sha512-z3nFzdcp1mb8nEOFFk8DrYLpHvhKC3grJD2ardfKOzmbmJvEf/tPIqCY+sNcwZIY8ZD7IkB2l7/pqhUhqm7hLA==
-"@webassemblyjs/helper-numbers@1.11.1":
- version "1.11.1"
- resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz#64d81da219fbbba1e3bd1bfc74f6e8c4e10a62ae"
- integrity sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==
+"@webassemblyjs/helper-numbers@1.11.6":
+ version "1.11.6"
+ resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.6.tgz#cbce5e7e0c1bd32cf4905ae444ef64cea919f1b5"
+ integrity sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g==
dependencies:
- "@webassemblyjs/floating-point-hex-parser" "1.11.1"
- "@webassemblyjs/helper-api-error" "1.11.1"
+ "@webassemblyjs/floating-point-hex-parser" "1.11.6"
+ "@webassemblyjs/helper-api-error" "1.11.6"
"@xtuc/long" "4.2.2"
-"@webassemblyjs/helper-wasm-bytecode@1.11.1":
- version "1.11.1"
- resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz#f328241e41e7b199d0b20c18e88429c4433295e1"
- integrity sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==
+"@webassemblyjs/helper-wasm-bytecode@1.11.6":
+ version "1.11.6"
+ resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.6.tgz#bb2ebdb3b83aa26d9baad4c46d4315283acd51e9"
+ integrity sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA==
-"@webassemblyjs/helper-wasm-section@1.11.1":
- version "1.11.1"
- resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz#21ee065a7b635f319e738f0dd73bfbda281c097a"
- integrity sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==
+"@webassemblyjs/helper-wasm-section@1.11.6":
+ version "1.11.6"
+ resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.6.tgz#ff97f3863c55ee7f580fd5c41a381e9def4aa577"
+ integrity sha512-LPpZbSOwTpEC2cgn4hTydySy1Ke+XEu+ETXuoyvuyezHO3Kjdu90KK95Sh9xTbmjrCsUwvWwCOQQNta37VrS9g==
dependencies:
- "@webassemblyjs/ast" "1.11.1"
- "@webassemblyjs/helper-buffer" "1.11.1"
- "@webassemblyjs/helper-wasm-bytecode" "1.11.1"
- "@webassemblyjs/wasm-gen" "1.11.1"
+ "@webassemblyjs/ast" "1.11.6"
+ "@webassemblyjs/helper-buffer" "1.11.6"
+ "@webassemblyjs/helper-wasm-bytecode" "1.11.6"
+ "@webassemblyjs/wasm-gen" "1.11.6"
-"@webassemblyjs/ieee754@1.11.1":
- version "1.11.1"
- resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz#963929e9bbd05709e7e12243a099180812992614"
- integrity sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==
+"@webassemblyjs/ieee754@1.11.6":
+ version "1.11.6"
+ resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.11.6.tgz#bb665c91d0b14fffceb0e38298c329af043c6e3a"
+ integrity sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg==
dependencies:
"@xtuc/ieee754" "^1.2.0"
-"@webassemblyjs/leb128@1.11.1":
- version "1.11.1"
- resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.11.1.tgz#ce814b45574e93d76bae1fb2644ab9cdd9527aa5"
- integrity sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==
+"@webassemblyjs/leb128@1.11.6":
+ version "1.11.6"
+ resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.11.6.tgz#70e60e5e82f9ac81118bc25381a0b283893240d7"
+ integrity sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ==
dependencies:
"@xtuc/long" "4.2.2"
-"@webassemblyjs/utf8@1.11.1":
- version "1.11.1"
- resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.11.1.tgz#d1f8b764369e7c6e6bae350e854dec9a59f0a3ff"
- integrity sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==
-
-"@webassemblyjs/wasm-edit@1.11.1":
- version "1.11.1"
- resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz#ad206ebf4bf95a058ce9880a8c092c5dec8193d6"
- integrity sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==
- dependencies:
- "@webassemblyjs/ast" "1.11.1"
- "@webassemblyjs/helper-buffer" "1.11.1"
- "@webassemblyjs/helper-wasm-bytecode" "1.11.1"
- "@webassemblyjs/helper-wasm-section" "1.11.1"
- "@webassemblyjs/wasm-gen" "1.11.1"
- "@webassemblyjs/wasm-opt" "1.11.1"
- "@webassemblyjs/wasm-parser" "1.11.1"
- "@webassemblyjs/wast-printer" "1.11.1"
-
-"@webassemblyjs/wasm-gen@1.11.1":
- version "1.11.1"
- resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz#86c5ea304849759b7d88c47a32f4f039ae3c8f76"
- integrity sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==
- dependencies:
- "@webassemblyjs/ast" "1.11.1"
- "@webassemblyjs/helper-wasm-bytecode" "1.11.1"
- "@webassemblyjs/ieee754" "1.11.1"
- "@webassemblyjs/leb128" "1.11.1"
- "@webassemblyjs/utf8" "1.11.1"
-
-"@webassemblyjs/wasm-opt@1.11.1":
- version "1.11.1"
- resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz#657b4c2202f4cf3b345f8a4c6461c8c2418985f2"
- integrity sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==
- dependencies:
- "@webassemblyjs/ast" "1.11.1"
- "@webassemblyjs/helper-buffer" "1.11.1"
- "@webassemblyjs/wasm-gen" "1.11.1"
- "@webassemblyjs/wasm-parser" "1.11.1"
-
-"@webassemblyjs/wasm-parser@1.11.1":
- version "1.11.1"
- resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz#86ca734534f417e9bd3c67c7a1c75d8be41fb199"
- integrity sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==
- dependencies:
- "@webassemblyjs/ast" "1.11.1"
- "@webassemblyjs/helper-api-error" "1.11.1"
- "@webassemblyjs/helper-wasm-bytecode" "1.11.1"
- "@webassemblyjs/ieee754" "1.11.1"
- "@webassemblyjs/leb128" "1.11.1"
- "@webassemblyjs/utf8" "1.11.1"
-
-"@webassemblyjs/wast-printer@1.11.1":
- version "1.11.1"
- resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz#d0c73beda8eec5426f10ae8ef55cee5e7084c2f0"
- integrity sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==
- dependencies:
- "@webassemblyjs/ast" "1.11.1"
+"@webassemblyjs/utf8@1.11.6":
+ version "1.11.6"
+ resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.11.6.tgz#90f8bc34c561595fe156603be7253cdbcd0fab5a"
+ integrity sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA==
+
+"@webassemblyjs/wasm-edit@^1.11.5":
+ version "1.11.6"
+ resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.6.tgz#c72fa8220524c9b416249f3d94c2958dfe70ceab"
+ integrity sha512-Ybn2I6fnfIGuCR+Faaz7YcvtBKxvoLV3Lebn1tM4o/IAJzmi9AWYIPWpyBfU8cC+JxAO57bk4+zdsTjJR+VTOw==
+ dependencies:
+ "@webassemblyjs/ast" "1.11.6"
+ "@webassemblyjs/helper-buffer" "1.11.6"
+ "@webassemblyjs/helper-wasm-bytecode" "1.11.6"
+ "@webassemblyjs/helper-wasm-section" "1.11.6"
+ "@webassemblyjs/wasm-gen" "1.11.6"
+ "@webassemblyjs/wasm-opt" "1.11.6"
+ "@webassemblyjs/wasm-parser" "1.11.6"
+ "@webassemblyjs/wast-printer" "1.11.6"
+
+"@webassemblyjs/wasm-gen@1.11.6":
+ version "1.11.6"
+ resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.6.tgz#fb5283e0e8b4551cc4e9c3c0d7184a65faf7c268"
+ integrity sha512-3XOqkZP/y6B4F0PBAXvI1/bky7GryoogUtfwExeP/v7Nzwo1QLcq5oQmpKlftZLbT+ERUOAZVQjuNVak6UXjPA==
+ dependencies:
+ "@webassemblyjs/ast" "1.11.6"
+ "@webassemblyjs/helper-wasm-bytecode" "1.11.6"
+ "@webassemblyjs/ieee754" "1.11.6"
+ "@webassemblyjs/leb128" "1.11.6"
+ "@webassemblyjs/utf8" "1.11.6"
+
+"@webassemblyjs/wasm-opt@1.11.6":
+ version "1.11.6"
+ resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.6.tgz#d9a22d651248422ca498b09aa3232a81041487c2"
+ integrity sha512-cOrKuLRE7PCe6AsOVl7WasYf3wbSo4CeOk6PkrjS7g57MFfVUF9u6ysQBBODX0LdgSvQqRiGz3CXvIDKcPNy4g==
+ dependencies:
+ "@webassemblyjs/ast" "1.11.6"
+ "@webassemblyjs/helper-buffer" "1.11.6"
+ "@webassemblyjs/wasm-gen" "1.11.6"
+ "@webassemblyjs/wasm-parser" "1.11.6"
+
+"@webassemblyjs/wasm-parser@1.11.6", "@webassemblyjs/wasm-parser@^1.11.5":
+ version "1.11.6"
+ resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.6.tgz#bb85378c527df824004812bbdb784eea539174a1"
+ integrity sha512-6ZwPeGzMJM3Dqp3hCsLgESxBGtT/OeCvCZ4TA1JUPYgmhAx38tTPR9JaKy0S5H3evQpO/h2uWs2j6Yc/fjkpTQ==
+ dependencies:
+ "@webassemblyjs/ast" "1.11.6"
+ "@webassemblyjs/helper-api-error" "1.11.6"
+ "@webassemblyjs/helper-wasm-bytecode" "1.11.6"
+ "@webassemblyjs/ieee754" "1.11.6"
+ "@webassemblyjs/leb128" "1.11.6"
+ "@webassemblyjs/utf8" "1.11.6"
+
+"@webassemblyjs/wast-printer@1.11.6":
+ version "1.11.6"
+ resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.11.6.tgz#a7bf8dd7e362aeb1668ff43f35cb849f188eff20"
+ integrity sha512-JM7AhRcE+yW2GWYaKeHL5vt4xqee5N2WcezptmgyhNS+ScggqcT1OtXykhAb13Sn5Yas0j2uv9tHgrjwvzAP4A==
+ dependencies:
+ "@webassemblyjs/ast" "1.11.6"
"@xtuc/long" "4.2.2"
"@webpack-cli/configtest@^1.2.0":
@@ -271,15 +349,15 @@ accepts@~1.3.4:
mime-types "~2.1.34"
negotiator "0.6.3"
-acorn-import-assertions@^1.7.6:
- version "1.8.0"
- resolved "https://registry.yarnpkg.com/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz#ba2b5939ce62c238db6d93d81c9b111b29b855e9"
- integrity sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==
+acorn-import-assertions@^1.9.0:
+ version "1.9.0"
+ resolved "https://registry.yarnpkg.com/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz#507276249d684797c84e0734ef84860334cfb1ac"
+ integrity sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA==
-acorn@^8.5.0, acorn@^8.7.1:
- version "8.8.2"
- resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a"
- integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==
+acorn@^8.7.1, acorn@^8.8.2:
+ version "8.11.2"
+ resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.2.tgz#ca0d78b51895be5390a5903c5b3bdcdaf78ae40b"
+ integrity sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==
ajv-keywords@^3.5.2:
version "3.5.2"
@@ -306,6 +384,13 @@ ansi-regex@^5.0.1:
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
+ansi-styles@^3.2.1:
+ version "3.2.1"
+ resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
+ integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==
+ dependencies:
+ color-convert "^1.9.0"
+
ansi-styles@^4.0.0, ansi-styles@^4.1.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
@@ -326,6 +411,11 @@ argparse@^2.0.1:
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
+atob@^2.1.2:
+ version "2.1.2"
+ resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
+ integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==
+
balanced-match@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
@@ -342,12 +432,12 @@ binary-extensions@^2.0.0:
integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==
body-parser@^1.19.0:
- version "1.20.1"
- resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.1.tgz#b1812a8912c195cd371a3ee5e66faa2338a5c668"
- integrity sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==
+ version "1.20.2"
+ resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.2.tgz#6feb0e21c4724d06de7ff38da36dad4f57a747fd"
+ integrity sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==
dependencies:
bytes "3.1.2"
- content-type "~1.0.4"
+ content-type "~1.0.5"
debug "2.6.9"
depd "2.0.0"
destroy "1.2.0"
@@ -355,7 +445,7 @@ body-parser@^1.19.0:
iconv-lite "0.4.24"
on-finished "2.4.1"
qs "6.11.0"
- raw-body "2.5.1"
+ raw-body "2.5.2"
type-is "~1.6.18"
unpipe "1.0.0"
@@ -387,42 +477,57 @@ browser-stdout@1.3.1:
integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==
browserslist@^4.14.5:
- version "4.21.5"
- resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.5.tgz#75c5dae60063ee641f977e00edd3cfb2fb7af6a7"
- integrity sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==
+ version "4.22.2"
+ resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.22.2.tgz#704c4943072bd81ea18997f3bd2180e89c77874b"
+ integrity sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==
dependencies:
- caniuse-lite "^1.0.30001449"
- electron-to-chromium "^1.4.284"
- node-releases "^2.0.8"
- update-browserslist-db "^1.0.10"
+ caniuse-lite "^1.0.30001565"
+ electron-to-chromium "^1.4.601"
+ node-releases "^2.0.14"
+ update-browserslist-db "^1.0.13"
buffer-from@^1.0.0:
version "1.1.2"
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5"
integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==
+builtin-modules@^3.3.0:
+ version "3.3.0"
+ resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6"
+ integrity sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==
+
bytes@3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5"
integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==
call-bind@^1.0.0:
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c"
- integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.5.tgz#6fa2b7845ce0ea49bf4d8b9ef64727a2c2e2e513"
+ integrity sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==
dependencies:
- function-bind "^1.1.1"
- get-intrinsic "^1.0.2"
+ function-bind "^1.1.2"
+ get-intrinsic "^1.2.1"
+ set-function-length "^1.1.1"
camelcase@^6.0.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a"
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==
-caniuse-lite@^1.0.30001449:
- version "1.0.30001449"
- resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001449.tgz#a8d11f6a814c75c9ce9d851dc53eb1d1dfbcd657"
- integrity sha512-CPB+UL9XMT/Av+pJxCKGhdx+yg1hzplvFJQlJ2n68PyQGMz9L/E2zCyLdOL8uasbouTUgnPl+y0tccI/se+BEw==
+caniuse-lite@^1.0.30001565:
+ version "1.0.30001570"
+ resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001570.tgz#b4e5c1fa786f733ab78fc70f592df6b3f23244ca"
+ integrity sha512-+3e0ASu4sw1SWaoCtvPeyXp+5PsjigkSt8OXZbF9StH5pQWbxEjLAZE3n8Aup5udop1uRiKA7a4utUk/uoSpUw==
+
+chalk@^2.4.2:
+ version "2.4.2"
+ resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
+ integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
+ dependencies:
+ ansi-styles "^3.2.1"
+ escape-string-regexp "^1.0.5"
+ supports-color "^5.3.0"
chalk@^4.1.0:
version "4.1.2"
@@ -470,6 +575,13 @@ clone-deep@^4.0.1:
kind-of "^6.0.2"
shallow-clone "^3.0.0"
+color-convert@^1.9.0:
+ version "1.9.3"
+ resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
+ integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==
+ dependencies:
+ color-name "1.1.3"
+
color-convert@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
@@ -477,15 +589,20 @@ color-convert@^2.0.1:
dependencies:
color-name "~1.1.4"
+color-name@1.1.3:
+ version "1.1.3"
+ resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
+ integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==
+
color-name@~1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
colorette@^2.0.14:
- version "2.0.19"
- resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.19.tgz#cdf044f47ad41a0f4b56b3a0d5b4e6e1a2d5a798"
- integrity sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==
+ version "2.0.20"
+ resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a"
+ integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==
commander@^2.20.0:
version "2.20.3"
@@ -497,6 +614,11 @@ commander@^7.0.0:
resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7"
integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==
+commondir@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b"
+ integrity sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==
+
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
@@ -512,7 +634,7 @@ connect@^3.7.0:
parseurl "~1.3.3"
utils-merge "1.0.1"
-content-type@~1.0.4:
+content-type@~1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918"
integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==
@@ -568,6 +690,25 @@ decamelize@^4.0.0:
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837"
integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==
+decode-uri-component@^0.2.0:
+ version "0.2.2"
+ resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9"
+ integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==
+
+deepmerge@^4.2.2:
+ version "4.3.1"
+ resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a"
+ integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==
+
+define-data-property@^1.1.1:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.1.tgz#c35f7cd0ab09883480d12ac5cb213715587800b3"
+ integrity sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==
+ dependencies:
+ get-intrinsic "^1.2.1"
+ gopd "^1.0.1"
+ has-property-descriptors "^1.0.0"
+
depd@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df"
@@ -603,10 +744,10 @@ ee-first@1.1.1:
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==
-electron-to-chromium@^1.4.284:
- version "1.4.284"
- resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz#61046d1e4cab3a25238f6bf7413795270f125592"
- integrity sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA==
+electron-to-chromium@^1.4.601:
+ version "1.4.612"
+ resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.612.tgz#350c6fd4201d677307519b931949fa64dae6a5cc"
+ integrity sha512-dM8BMtXtlH237ecSMnYdYuCkib2QHq0kpWfUnavjdYsyr/6OsAwg5ZGUfnQ9KD1Ga4QgB2sqXlB2NT8zy2GnVg==
emoji-regex@^8.0.0:
version "8.0.0"
@@ -618,15 +759,15 @@ encodeurl@~1.0.2:
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==
-engine.io-parser@~5.0.3:
- version "5.0.6"
- resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-5.0.6.tgz#7811244af173e157295dec9b2718dfe42a64ef45"
- integrity sha512-tjuoZDMAdEhVnSFleYPCtdL2GXwVTGtNjoeJd9IhIG3C1xs9uwxqRNEu5WpnDZCaozwVlK/nuQhpodhXSIMaxw==
+engine.io-parser@~5.2.1:
+ version "5.2.1"
+ resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-5.2.1.tgz#9f213c77512ff1a6cc0c7a86108a7ffceb16fcfb"
+ integrity sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ==
-engine.io@~6.2.1:
- version "6.2.1"
- resolved "https://registry.yarnpkg.com/engine.io/-/engine.io-6.2.1.tgz#e3f7826ebc4140db9bbaa9021ad6b1efb175878f"
- integrity sha512-ECceEFcAaNRybd3lsGQKas3ZlMVjN3cyWwMP25D2i0zWfyiytVbTpRPa34qrr+FHddtpBVOmq4H/DCv1O0lZRA==
+engine.io@~6.5.2:
+ version "6.5.4"
+ resolved "https://registry.yarnpkg.com/engine.io/-/engine.io-6.5.4.tgz#6822debf324e781add2254e912f8568508850cdc"
+ integrity sha512-KdVSDKhVKyOi+r5uEabrDLZw2qXStVvCsEB/LN3mw4WFi6Gx50jTyuxYVCwAAC0U46FdnzP/ScKRBTXb/NiEOg==
dependencies:
"@types/cookie" "^0.4.1"
"@types/cors" "^2.8.12"
@@ -636,13 +777,13 @@ engine.io@~6.2.1:
cookie "~0.4.1"
cors "~2.8.5"
debug "~4.3.1"
- engine.io-parser "~5.0.3"
- ws "~8.2.3"
+ engine.io-parser "~5.2.1"
+ ws "~8.11.0"
-enhanced-resolve@^5.10.0:
- version "5.12.0"
- resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz#300e1c90228f5b570c4d35babf263f6da7155634"
- integrity sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==
+enhanced-resolve@^5.15.0:
+ version "5.15.0"
+ resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz#1af946c7d93603eb88e9896cee4904dc012e9c35"
+ integrity sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==
dependencies:
graceful-fs "^4.2.4"
tapable "^2.2.0"
@@ -653,14 +794,14 @@ ent@~2.2.0:
integrity sha512-GHrMyVZQWvTIdDtpiEXdHZnFQKzeO09apj8Cbl4pKWy4i0Oprcq17usfDt5aO63swf0JOeMWjWQE/LzgSRuWpA==
envinfo@^7.7.3:
- version "7.8.1"
- resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.8.1.tgz#06377e3e5f4d379fea7ac592d5ad8927e0c4d475"
- integrity sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==
+ version "7.11.0"
+ resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.11.0.tgz#c3793f44284a55ff8c82faf1ffd91bc6478ea01f"
+ integrity sha512-G9/6xF1FPbIw0TtalAMaVPpiq2aDEuKLXM314jPVAO9r2fo2a4BLqMNkmRS7O/xPPZ+COAhGIz3ETvHEV3eUcg==
-es-module-lexer@^0.9.0:
- version "0.9.3"
- resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-0.9.3.tgz#6f13db00cc38417137daf74366f535c8eb438f19"
- integrity sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==
+es-module-lexer@^1.2.1:
+ version "1.4.1"
+ resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.4.1.tgz#41ea21b43908fe6a287ffcbe4300f790555331f5"
+ integrity sha512-cXLGjP0c4T3flZJKQSuziYoq7MlT+rnvfZjfp7h+I7K9BNX54kP9nyWvdbwjQ4u1iWbOL4u96fgeZLToQlZC7w==
escalade@^3.1.1:
version "3.1.1"
@@ -677,6 +818,11 @@ escape-string-regexp@4.0.0:
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
+escape-string-regexp@^1.0.5:
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
+ integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==
+
eslint-scope@5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
@@ -702,6 +848,16 @@ estraverse@^5.2.0:
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123"
integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==
+estree-walker@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700"
+ integrity sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==
+
+estree-walker@^2.0.1:
+ version "2.0.2"
+ resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac"
+ integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==
+
eventemitter3@^4.0.0:
version "4.0.7"
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f"
@@ -774,16 +930,16 @@ flat@^5.0.2:
integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==
flatted@^3.2.7:
- version "3.2.7"
- resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787"
- integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==
+ version "3.2.9"
+ resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf"
+ integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==
follow-redirects@^1.0.0:
- version "1.15.2"
- resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
- integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==
+ version "1.15.3"
+ resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.3.tgz#fe2f3ef2690afce7e82ed0b44db08165b207123a"
+ integrity sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==
-format-util@1.0.5:
+format-util@1.0.5, format-util@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/format-util/-/format-util-1.0.5.tgz#1ffb450c8a03e7bccffe40643180918cc297d271"
integrity sha512-varLbTj0e0yVyRpqQhuWV+8hlePAgaoFRhNFj50BNjEIrw1/DphHSObtqwskVCPWNgzwPoQrZAbfa/SBiicNeg==
@@ -803,28 +959,29 @@ fs.realpath@^1.0.0:
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
fsevents@~2.3.2:
- version "2.3.2"
- resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
- integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
+ version "2.3.3"
+ resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6"
+ integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==
-function-bind@^1.1.1:
- version "1.1.1"
- resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
- integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==
+function-bind@^1.1.2:
+ version "1.1.2"
+ resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c"
+ integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==
get-caller-file@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
-get-intrinsic@^1.0.2:
- version "1.2.0"
- resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.0.tgz#7ad1dc0535f3a2904bba075772763e5051f6d05f"
- integrity sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==
+get-intrinsic@^1.0.2, get-intrinsic@^1.1.3, get-intrinsic@^1.2.1, get-intrinsic@^1.2.2:
+ version "1.2.2"
+ resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.2.tgz#281b7622971123e1ef4b3c90fd7539306da93f3b"
+ integrity sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==
dependencies:
- function-bind "^1.1.1"
- has "^1.0.3"
+ function-bind "^1.1.2"
+ has-proto "^1.0.1"
has-symbols "^1.0.3"
+ hasown "^2.0.0"
glob-parent@~5.1.2:
version "5.1.2"
@@ -850,7 +1007,7 @@ glob@7.2.0:
once "^1.3.0"
path-is-absolute "^1.0.0"
-glob@^7.1.3, glob@^7.1.7:
+glob@^7.1.3, glob@^7.1.6, glob@^7.1.7:
version "7.2.3"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b"
integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==
@@ -862,27 +1019,51 @@ glob@^7.1.3, glob@^7.1.7:
once "^1.3.0"
path-is-absolute "^1.0.0"
+gopd@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c"
+ integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==
+ dependencies:
+ get-intrinsic "^1.1.3"
+
graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.9:
- version "4.2.10"
- resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c"
- integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==
+ version "4.2.11"
+ resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
+ integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==
+
+has-flag@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
+ integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==
has-flag@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
+has-property-descriptors@^1.0.0:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz#52ba30b6c5ec87fd89fa574bc1c39125c6f65340"
+ integrity sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==
+ dependencies:
+ get-intrinsic "^1.2.2"
+
+has-proto@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.1.tgz#1885c1305538958aff469fef37937c22795408e0"
+ integrity sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==
+
has-symbols@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8"
integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==
-has@^1.0.3:
- version "1.0.3"
- resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796"
- integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==
+hasown@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.0.tgz#f4c513d454a57b7c7e1650778de226b11700546c"
+ integrity sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==
dependencies:
- function-bind "^1.1.1"
+ function-bind "^1.1.2"
he@1.2.0:
version "1.2.0"
@@ -956,12 +1137,24 @@ is-binary-path@~2.1.0:
dependencies:
binary-extensions "^2.0.0"
-is-core-module@^2.9.0:
- version "2.11.0"
- resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144"
- integrity sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==
+is-builtin-module@^3.1.0:
+ version "3.2.1"
+ resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-3.2.1.tgz#f03271717d8654cfcaf07ab0463faa3571581169"
+ integrity sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==
dependencies:
- has "^1.0.3"
+ builtin-modules "^3.3.0"
+
+is-core-module@^2.13.0:
+ version "2.13.1"
+ resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384"
+ integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==
+ dependencies:
+ hasown "^2.0.0"
+
+is-docker@^2.0.0:
+ version "2.2.1"
+ resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa"
+ integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==
is-extglob@^2.1.1:
version "2.1.1"
@@ -980,6 +1173,11 @@ is-glob@^4.0.1, is-glob@~4.0.1:
dependencies:
is-extglob "^2.1.1"
+is-module@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591"
+ integrity sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==
+
is-number@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b"
@@ -997,11 +1195,25 @@ is-plain-object@^2.0.4:
dependencies:
isobject "^3.0.1"
+is-reference@^1.2.1:
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.2.1.tgz#8b2dac0b371f4bc994fdeaba9eb542d03002d0b7"
+ integrity sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==
+ dependencies:
+ "@types/estree" "*"
+
is-unicode-supported@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7"
integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==
+is-wsl@^2.2.0:
+ version "2.2.0"
+ resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271"
+ integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==
+ dependencies:
+ is-docker "^2.0.0"
+
isbinaryfile@^4.0.8:
version "4.0.10"
resolved "https://registry.yarnpkg.com/isbinaryfile/-/isbinaryfile-4.0.10.tgz#0c5b5e30c2557a2f06febd37b7322946aaee42b3"
@@ -1017,6 +1229,15 @@ isobject@^3.0.1:
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==
+jest-worker@^26.2.1:
+ version "26.6.2"
+ resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed"
+ integrity sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==
+ dependencies:
+ "@types/node" "*"
+ merge-stream "^2.0.0"
+ supports-color "^7.0.0"
+
jest-worker@^27.4.5:
version "27.5.1"
resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0"
@@ -1026,6 +1247,11 @@ jest-worker@^27.4.5:
merge-stream "^2.0.0"
supports-color "^8.0.0"
+js-tokens@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
+ integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
+
js-yaml@4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
@@ -1148,15 +1374,22 @@ log-symbols@4.1.0:
is-unicode-supported "^0.1.0"
log4js@^6.4.1:
- version "6.7.1"
- resolved "https://registry.yarnpkg.com/log4js/-/log4js-6.7.1.tgz#06e12b1ac915dd1067146ffad8215f666f7d2c51"
- integrity sha512-lzbd0Eq1HRdWM2abSD7mk6YIVY0AogGJzb/z+lqzRk+8+XJP+M6L1MS5FUSc3jjGru4dbKjEMJmqlsoYYpuivQ==
+ version "6.9.1"
+ resolved "https://registry.yarnpkg.com/log4js/-/log4js-6.9.1.tgz#aba5a3ff4e7872ae34f8b4c533706753709e38b6"
+ integrity sha512-1somDdy9sChrr9/f4UlzhdaGfDR2c/SaD2a4T7qEkG4jTS57/B3qmnjLYePwQ8cqWnUHZI0iAKxMBpCZICiZ2g==
dependencies:
date-format "^4.0.14"
debug "^4.3.4"
flatted "^3.2.7"
rfdc "^1.3.0"
- streamroller "^3.1.3"
+ streamroller "^3.1.5"
+
+magic-string@^0.25.7:
+ version "0.25.9"
+ resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.9.tgz#de7f9faf91ef8a1c91d02c2e5314c8277dbcdd1c"
+ integrity sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==
+ dependencies:
+ sourcemap-codec "^1.4.8"
media-typer@0.3.0:
version "0.3.0"
@@ -1200,9 +1433,9 @@ minimatch@^3.0.4, minimatch@^3.1.1:
brace-expansion "^1.1.7"
minimist@^1.2.3, minimist@^1.2.6:
- version "1.2.7"
- resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18"
- integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==
+ version "1.2.8"
+ resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
+ integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
mkdirp@^0.5.5:
version "0.5.6"
@@ -1269,10 +1502,10 @@ neo-async@^2.6.2:
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f"
integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==
-node-releases@^2.0.8:
- version "2.0.9"
- resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.9.tgz#fe66405285382b0c4ac6bcfbfbe7e8a510650b4d"
- integrity sha512-2xfmOrRkGogbTK9R6Leda0DGiXeY3p2NJpy4+gNCffdUvV6mdEJnaDEic1i3Ec2djAo8jWYoJMR5PB0MSMpxUA==
+node-releases@^2.0.14:
+ version "2.0.14"
+ resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b"
+ integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==
normalize-path@^3.0.0, normalize-path@~3.0.0:
version "3.0.0"
@@ -1285,9 +1518,9 @@ object-assign@^4:
integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==
object-inspect@^1.9.0:
- version "1.12.3"
- resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.3.tgz#ba62dffd67ee256c8c086dfae69e016cd1f198b9"
- integrity sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==
+ version "1.13.1"
+ resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2"
+ integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==
on-finished@2.4.1:
version "2.4.1"
@@ -1373,7 +1606,7 @@ picocolors@^1.0.0:
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c"
integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==
-picomatch@^2.0.4, picomatch@^2.2.1:
+picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2:
version "2.3.1"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
@@ -1386,9 +1619,9 @@ pkg-dir@^4.2.0:
find-up "^4.0.0"
punycode@^2.1.0:
- version "2.3.0"
- resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f"
- integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==
+ version "2.3.1"
+ resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5"
+ integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==
qjobs@^1.2.0:
version "1.2.0"
@@ -1414,10 +1647,10 @@ range-parser@^1.2.1:
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031"
integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==
-raw-body@2.5.1:
- version "2.5.1"
- resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.1.tgz#fe1b1628b181b700215e5fd42389f98b71392857"
- integrity sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==
+raw-body@2.5.2:
+ version "2.5.2"
+ resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz#99febd83b90e08975087e8f1f9419a149366b68a"
+ integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==
dependencies:
bytes "3.1.2"
http-errors "2.0.0"
@@ -1460,12 +1693,12 @@ resolve-from@^5.0.0:
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69"
integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==
-resolve@^1.9.0:
- version "1.22.1"
- resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177"
- integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==
+resolve@^1.17.0, resolve@^1.19.0, resolve@^1.9.0:
+ version "1.22.8"
+ resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d"
+ integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==
dependencies:
- is-core-module "^2.9.0"
+ is-core-module "^2.13.0"
path-parse "^1.0.7"
supports-preserve-symlinks-flag "^1.0.0"
@@ -1481,6 +1714,31 @@ rimraf@^3.0.0, rimraf@^3.0.2:
dependencies:
glob "^7.1.3"
+rollup-plugin-sourcemaps@^0.6.3:
+ version "0.6.3"
+ resolved "https://registry.yarnpkg.com/rollup-plugin-sourcemaps/-/rollup-plugin-sourcemaps-0.6.3.tgz#bf93913ffe056e414419607f1d02780d7ece84ed"
+ integrity sha512-paFu+nT1xvuO1tPFYXGe+XnQvg4Hjqv/eIhG8i5EspfYYPBKL57X7iVbfv55aNVASg3dzWvES9dmWsL2KhfByw==
+ dependencies:
+ "@rollup/pluginutils" "^3.0.9"
+ source-map-resolve "^0.6.0"
+
+rollup-plugin-terser@^7.0.2:
+ version "7.0.2"
+ resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz#e8fbba4869981b2dc35ae7e8a502d5c6c04d324d"
+ integrity sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==
+ dependencies:
+ "@babel/code-frame" "^7.10.4"
+ jest-worker "^26.2.1"
+ serialize-javascript "^4.0.0"
+ terser "^5.0.0"
+
+rollup@^2.68.0:
+ version "2.79.1"
+ resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.79.1.tgz#bedee8faef7c9f93a2647ac0108748f497f081c7"
+ integrity sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==
+ optionalDependencies:
+ fsevents "~2.3.2"
+
safe-buffer@^5.1.0:
version "5.2.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
@@ -1491,10 +1749,10 @@ safe-buffer@^5.1.0:
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
-schema-utils@^3.1.0, schema-utils@^3.1.1:
- version "3.1.1"
- resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.1.1.tgz#bc74c4b6b6995c1d88f76a8b77bea7219e0c8281"
- integrity sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==
+schema-utils@^3.1.1, schema-utils@^3.2.0:
+ version "3.3.0"
+ resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.3.0.tgz#f50a88877c3c01652a15b622ae9e9795df7a60fe"
+ integrity sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==
dependencies:
"@types/json-schema" "^7.0.8"
ajv "^6.12.5"
@@ -1507,13 +1765,30 @@ serialize-javascript@6.0.0:
dependencies:
randombytes "^2.1.0"
-serialize-javascript@^6.0.0:
+serialize-javascript@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-4.0.0.tgz#b525e1238489a5ecfc42afacc3fe99e666f4b1aa"
+ integrity sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==
+ dependencies:
+ randombytes "^2.1.0"
+
+serialize-javascript@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.1.tgz#b206efb27c3da0b0ab6b52f48d170b7996458e5c"
integrity sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w==
dependencies:
randombytes "^2.1.0"
+set-function-length@^1.1.1:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.1.1.tgz#4bc39fafb0307224a33e106a7d35ca1218d659ed"
+ integrity sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==
+ dependencies:
+ define-data-property "^1.1.1"
+ get-intrinsic "^1.2.1"
+ gopd "^1.0.1"
+ has-property-descriptors "^1.0.0"
+
setprototypeof@1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424"
@@ -1547,30 +1822,33 @@ side-channel@^1.0.4:
get-intrinsic "^1.0.2"
object-inspect "^1.9.0"
-socket.io-adapter@~2.4.0:
- version "2.4.0"
- resolved "https://registry.yarnpkg.com/socket.io-adapter/-/socket.io-adapter-2.4.0.tgz#b50a4a9ecdd00c34d4c8c808224daa1a786152a6"
- integrity sha512-W4N+o69rkMEGVuk2D/cvca3uYsvGlMwsySWV447y99gUPghxq42BxqLNMndb+a1mm/5/7NeXVQS7RLa2XyXvYg==
+socket.io-adapter@~2.5.2:
+ version "2.5.2"
+ resolved "https://registry.yarnpkg.com/socket.io-adapter/-/socket.io-adapter-2.5.2.tgz#5de9477c9182fdc171cd8c8364b9a8894ec75d12"
+ integrity sha512-87C3LO/NOMc+eMcpcxUBebGjkpMDkNBS9tf7KJqcDsmL936EChtVva71Dw2q4tQcuVC+hAUy4an2NO/sYXmwRA==
+ dependencies:
+ ws "~8.11.0"
-socket.io-parser@~4.2.1:
- version "4.2.2"
- resolved "https://registry.yarnpkg.com/socket.io-parser/-/socket.io-parser-4.2.2.tgz#1dd384019e25b7a3d374877f492ab34f2ad0d206"
- integrity sha512-DJtziuKypFkMMHCm2uIshOYC7QaylbtzQwiMYDuCKy3OPkjLzu4B2vAhTlqipRHHzrI0NJeBAizTK7X+6m1jVw==
+socket.io-parser@~4.2.4:
+ version "4.2.4"
+ resolved "https://registry.yarnpkg.com/socket.io-parser/-/socket.io-parser-4.2.4.tgz#c806966cf7270601e47469ddeec30fbdfda44c83"
+ integrity sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==
dependencies:
"@socket.io/component-emitter" "~3.1.0"
debug "~4.3.1"
socket.io@^4.4.1:
- version "4.5.4"
- resolved "https://registry.yarnpkg.com/socket.io/-/socket.io-4.5.4.tgz#a4513f06e87451c17013b8d13fdfaf8da5a86a90"
- integrity sha512-m3GC94iK9MfIEeIBfbhJs5BqFibMtkRk8ZpKwG2QwxV0m/eEhPIV4ara6XCF1LWNAus7z58RodiZlAH71U3EhQ==
+ version "4.7.2"
+ resolved "https://registry.yarnpkg.com/socket.io/-/socket.io-4.7.2.tgz#22557d76c3f3ca48f82e73d68b7add36a22df002"
+ integrity sha512-bvKVS29/I5fl2FGLNHuXlQaUH/BlzX1IN6S+NKLNZpBsPZIDH+90eQmCs2Railn4YUiww4SzUedJ6+uzwFnKLw==
dependencies:
accepts "~1.3.4"
base64id "~2.0.0"
+ cors "~2.8.5"
debug "~4.3.2"
- engine.io "~6.2.1"
- socket.io-adapter "~2.4.0"
- socket.io-parser "~4.2.1"
+ engine.io "~6.5.2"
+ socket.io-adapter "~2.5.2"
+ socket.io-parser "~4.2.4"
source-map-js@^1.0.2:
version "1.0.2"
@@ -1586,6 +1864,14 @@ source-map-loader@4.0.0:
iconv-lite "^0.6.3"
source-map-js "^1.0.2"
+source-map-resolve@^0.6.0:
+ version "0.6.0"
+ resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.6.0.tgz#3d9df87e236b53f16d01e58150fc7711138e5ed2"
+ integrity sha512-KXBr9d/fO/bWo97NXsPIAW1bFSBOuCnjbNTBMO7N59hsv5i9yzRDfcYwwt0l04+VqnKC+EwzvJZIP/qkuMgR/w==
+ dependencies:
+ atob "^2.1.2"
+ decode-uri-component "^0.2.0"
+
source-map-support@~0.5.20:
version "0.5.21"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f"
@@ -1599,6 +1885,11 @@ source-map@^0.6.0, source-map@^0.6.1:
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
+sourcemap-codec@^1.4.8:
+ version "1.4.8"
+ resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4"
+ integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==
+
statuses@2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63"
@@ -1609,10 +1900,10 @@ statuses@~1.5.0:
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==
-streamroller@^3.1.3:
- version "3.1.4"
- resolved "https://registry.yarnpkg.com/streamroller/-/streamroller-3.1.4.tgz#844a18e795d39c1089a8216e66a1cf1151271df0"
- integrity sha512-Ha1Ccw2/N5C/IF8Do6zgNe8F3jQo8MPBnMBGvX0QjNv/I97BcNRzK6/mzOpZHHK7DjMLTI3c7Xw7Y1KvdChkvw==
+streamroller@^3.1.5:
+ version "3.1.5"
+ resolved "https://registry.yarnpkg.com/streamroller/-/streamroller-3.1.5.tgz#1263182329a45def1ffaef58d31b15d13d2ee7ff"
+ integrity sha512-KFxaM7XT+irxvdqSP1LGLgNWbYN7ay5owZ3r/8t77p+EtSUAfUgtl7be3xtqtOmGUl9K9YPO2ca8133RlTjvKw==
dependencies:
date-format "^4.0.14"
debug "^4.3.4"
@@ -1646,7 +1937,14 @@ supports-color@8.1.1, supports-color@^8.0.0:
dependencies:
has-flag "^4.0.0"
-supports-color@^7.1.0:
+supports-color@^5.3.0:
+ version "5.5.0"
+ resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
+ integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==
+ dependencies:
+ has-flag "^3.0.0"
+
+supports-color@^7.0.0, supports-color@^7.1.0:
version "7.2.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da"
integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==
@@ -1663,24 +1961,24 @@ tapable@^2.1.1, tapable@^2.2.0:
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0"
integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==
-terser-webpack-plugin@^5.1.3:
- version "5.3.6"
- resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.6.tgz#5590aec31aa3c6f771ce1b1acca60639eab3195c"
- integrity sha512-kfLFk+PoLUQIbLmB1+PZDMRSZS99Mp+/MHqDNmMA6tOItzRt+Npe3E+fsMs5mfcM0wCtrrdU387UnV+vnSffXQ==
+terser-webpack-plugin@^5.3.7:
+ version "5.3.9"
+ resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.9.tgz#832536999c51b46d468067f9e37662a3b96adfe1"
+ integrity sha512-ZuXsqE07EcggTWQjXUj+Aot/OMcD0bMKGgF63f7UxYcu5/AJF53aIpK1YoP5xR9l6s/Hy2b+t1AM0bLNPRuhwA==
dependencies:
- "@jridgewell/trace-mapping" "^0.3.14"
+ "@jridgewell/trace-mapping" "^0.3.17"
jest-worker "^27.4.5"
schema-utils "^3.1.1"
- serialize-javascript "^6.0.0"
- terser "^5.14.1"
+ serialize-javascript "^6.0.1"
+ terser "^5.16.8"
-terser@^5.14.1:
- version "5.16.2"
- resolved "https://registry.yarnpkg.com/terser/-/terser-5.16.2.tgz#8f495819439e8b5c150e7530fc434a6e70ea18b2"
- integrity sha512-JKuM+KvvWVqT7muHVyrwv7FVRPnmHDwF6XwoIxdbF5Witi0vu99RYpxDexpJndXt3jbZZmmWr2/mQa6HvSNdSg==
+terser@^5.0.0, terser@^5.16.8:
+ version "5.26.0"
+ resolved "https://registry.yarnpkg.com/terser/-/terser-5.26.0.tgz#ee9f05d929f4189a9c28a0feb889d96d50126fe1"
+ integrity sha512-dytTGoE2oHgbNV9nTzgBEPaqAWvcJNl66VZ0BkJqlvp71IjO8CxdBx/ykCNb47cLnCmCvRZ6ZR0tLkqvZCdVBQ==
dependencies:
- "@jridgewell/source-map" "^0.3.2"
- acorn "^8.5.0"
+ "@jridgewell/source-map" "^0.3.3"
+ acorn "^8.8.2"
commander "^2.20.0"
source-map-support "~0.5.20"
@@ -1703,6 +2001,11 @@ toidentifier@1.0.1:
resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35"
integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==
+tslib@^2.3.1:
+ version "2.6.2"
+ resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
+ integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==
+
type-is@~1.6.18:
version "1.6.18"
resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131"
@@ -1711,10 +2014,25 @@ type-is@~1.6.18:
media-typer "0.3.0"
mime-types "~2.1.24"
+typescript@4.7.4:
+ version "4.7.4"
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235"
+ integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==
+
+typescript@^3.7.2:
+ version "3.9.10"
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.10.tgz#70f3910ac7a51ed6bef79da7800690b19bf778b8"
+ integrity sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==
+
ua-parser-js@^0.7.30:
- version "0.7.33"
- resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.33.tgz#1d04acb4ccef9293df6f70f2c3d22f3030d8b532"
- integrity sha512-s8ax/CeZdK9R/56Sui0WM6y9OFREJarMRHqLB2EwkovemBxNQ+Bqu8GAsUnVcXKgphb++ghr/B2BZx4mahujPw==
+ version "0.7.37"
+ resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.37.tgz#e464e66dac2d33a7a1251d7d7a99d6157ec27832"
+ integrity sha512-xV8kqRKM+jhMvcHWUKthV9fNebIzrNy//2O9ZwWcfiBFR5f25XVZPLlEajk/sf3Ra15V92isyQqnIEXRDaZWEA==
+
+undici-types@~5.26.4:
+ version "5.26.5"
+ resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
+ integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==
universalify@^0.1.0:
version "0.1.2"
@@ -1726,10 +2044,10 @@ unpipe@1.0.0, unpipe@~1.0.0:
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==
-update-browserslist-db@^1.0.10:
- version "1.0.10"
- resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz#0f54b876545726f17d00cd9a2561e6dade943ff3"
- integrity sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==
+update-browserslist-db@^1.0.13:
+ version "1.0.13"
+ resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz#3c5e4f5c083661bd38ef64b6328c26ed6c8248c4"
+ integrity sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==
dependencies:
escalade "^3.1.1"
picocolors "^1.0.0"
@@ -1790,11 +2108,12 @@ webpack-merge@^4.1.5:
lodash "^4.17.15"
webpack-merge@^5.7.3:
- version "5.8.0"
- resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-5.8.0.tgz#2b39dbf22af87776ad744c390223731d30a68f61"
- integrity sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q==
+ version "5.10.0"
+ resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-5.10.0.tgz#a3ad5d773241e9c682803abf628d4cd62b8a4177"
+ integrity sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==
dependencies:
clone-deep "^4.0.1"
+ flat "^5.0.2"
wildcard "^2.0.0"
webpack-sources@^3.2.3:
@@ -1802,22 +2121,22 @@ webpack-sources@^3.2.3:
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde"
integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==
-webpack@5.74.0:
- version "5.74.0"
- resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.74.0.tgz#02a5dac19a17e0bb47093f2be67c695102a55980"
- integrity sha512-A2InDwnhhGN4LYctJj6M1JEaGL7Luj6LOmyBHjcI8529cm5p6VXiTIW2sn6ffvEAKmveLzvu4jrihwXtPojlAA==
+webpack@5.89.0:
+ version "5.89.0"
+ resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.89.0.tgz#56b8bf9a34356e93a6625770006490bf3a7f32dc"
+ integrity sha512-qyfIC10pOr70V+jkmud8tMfajraGCZMBWJtrmuBymQKCrLTRejBI8STDp1MCyZu/QTdZSeacCQYpYNQVOzX5kw==
dependencies:
"@types/eslint-scope" "^3.7.3"
- "@types/estree" "^0.0.51"
- "@webassemblyjs/ast" "1.11.1"
- "@webassemblyjs/wasm-edit" "1.11.1"
- "@webassemblyjs/wasm-parser" "1.11.1"
+ "@types/estree" "^1.0.0"
+ "@webassemblyjs/ast" "^1.11.5"
+ "@webassemblyjs/wasm-edit" "^1.11.5"
+ "@webassemblyjs/wasm-parser" "^1.11.5"
acorn "^8.7.1"
- acorn-import-assertions "^1.7.6"
+ acorn-import-assertions "^1.9.0"
browserslist "^4.14.5"
chrome-trace-event "^1.0.2"
- enhanced-resolve "^5.10.0"
- es-module-lexer "^0.9.0"
+ enhanced-resolve "^5.15.0"
+ es-module-lexer "^1.2.1"
eslint-scope "5.1.1"
events "^3.2.0"
glob-to-regexp "^0.4.1"
@@ -1826,9 +2145,9 @@ webpack@5.74.0:
loader-runner "^4.2.0"
mime-types "^2.1.27"
neo-async "^2.6.2"
- schema-utils "^3.1.0"
+ schema-utils "^3.2.0"
tapable "^2.1.1"
- terser-webpack-plugin "^5.1.3"
+ terser-webpack-plugin "^5.3.7"
watchpack "^2.4.0"
webpack-sources "^3.2.3"
@@ -1847,9 +2166,9 @@ which@^2.0.1:
isexe "^2.0.0"
wildcard@^2.0.0:
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec"
- integrity sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.1.tgz#5ab10d02487198954836b6349f74fff961e10f67"
+ integrity sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==
workerpool@6.2.1:
version "6.2.1"
@@ -1870,10 +2189,10 @@ wrappy@1:
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==
-ws@~8.2.3:
- version "8.2.3"
- resolved "https://registry.yarnpkg.com/ws/-/ws-8.2.3.tgz#63a56456db1b04367d0b721a0b80cae6d8becbba"
- integrity sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==
+ws@~8.11.0:
+ version "8.11.0"
+ resolved "https://registry.yarnpkg.com/ws/-/ws-8.11.0.tgz#6a0d36b8edfd9f96d8b25683db2f8d7de6e8e143"
+ integrity sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==
y18n@^5.0.5:
version "5.0.8"
diff --git a/kotlin/wallet-core-kotlin/build.gradle.kts b/kotlin/wallet-core-kotlin/build.gradle.kts
index 3bea97954ca..63d879ca7c3 100644
--- a/kotlin/wallet-core-kotlin/build.gradle.kts
+++ b/kotlin/wallet-core-kotlin/build.gradle.kts
@@ -80,6 +80,10 @@ kotlin {
getByName("jsMain") {
kotlin.srcDir(projectDir.resolve("src/jsMain/generated"))
+
+ dependencies {
+ implementation(npm(name = "webpack", version = "5.89.0"))
+ }
}
}
diff --git a/kotlin/wallet-core-kotlin/src/commonAndroidJvmMain/kotlin/com/trustwallet/core/AnySigner.kt b/kotlin/wallet-core-kotlin/src/commonAndroidJvmMain/kotlin/com/trustwallet/core/AnySigner.kt
index 374d66218b9..e6b348433c4 100644
--- a/kotlin/wallet-core-kotlin/src/commonAndroidJvmMain/kotlin/com/trustwallet/core/AnySigner.kt
+++ b/kotlin/wallet-core-kotlin/src/commonAndroidJvmMain/kotlin/com/trustwallet/core/AnySigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core
diff --git a/kotlin/wallet-core-kotlin/src/commonMain/kotlin/com/trustwallet/core/AnySigner.kt b/kotlin/wallet-core-kotlin/src/commonMain/kotlin/com/trustwallet/core/AnySigner.kt
index 85e195c229e..576aa1d32cb 100644
--- a/kotlin/wallet-core-kotlin/src/commonMain/kotlin/com/trustwallet/core/AnySigner.kt
+++ b/kotlin/wallet-core-kotlin/src/commonMain/kotlin/com/trustwallet/core/AnySigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core
diff --git a/kotlin/wallet-core-kotlin/src/commonTest/kotlin/com/trustwallet/core/test/CoinAddressDerivationTests.kt b/kotlin/wallet-core-kotlin/src/commonTest/kotlin/com/trustwallet/core/test/CoinAddressDerivationTests.kt
index dac9e182bf3..c3d3dbf0527 100644
--- a/kotlin/wallet-core-kotlin/src/commonTest/kotlin/com/trustwallet/core/test/CoinAddressDerivationTests.kt
+++ b/kotlin/wallet-core-kotlin/src/commonTest/kotlin/com/trustwallet/core/test/CoinAddressDerivationTests.kt
@@ -38,8 +38,9 @@ class CoinAddressDerivationTests {
Ethereum, SmartChain, Polygon, Optimism, Zksync, Arbitrum, ArbitrumNova, ECOChain, AvalancheCChain, XDai,
Fantom, Celo, CronosChain, SmartBitcoinCash, KuCoinCommunityChain, Boba, Metis,
- Aurora, Evmos, Moonriver, Moonbeam, KavaEvm, Klaytn, Meter, OKXChain, PolygonzkEVM, Scroll,
- ConfluxeSpace, AcalaEVM, OpBNB, Neon, Base, Linea, Greenfield, Mantle, ZenEON,
+ Aurora, Evmos, Moonriver, Moonbeam, KavaEvm, Kaia, Meter, OKXChain, PolygonzkEVM, Scroll,
+ ConfluxeSpace, AcalaEVM, OpBNB, Neon, Base, Linea, Greenfield, Mantle, ZenEON, MantaPacific,
+ ZetaEVM, Merlin, Lightlink, Blast, BounceBit, ZkLinkNova,
-> "0x8f348F300873Fd5DA36950B2aC75a26584584feE"
Ronin -> "ronin:8f348F300873Fd5DA36950B2aC75a26584584feE"
@@ -53,7 +54,7 @@ class CoinAddressDerivationTests {
XRP -> "rPwE3gChNKtZ1mhH3Ko8YFGqKmGRWLWXV3"
Tezos -> "tz1acnY9VbMagps26Kj3RfoGRWD9nYG5qaRX"
ThunderCore -> "0x4b92b3ED6d8b24575Bf5ce4C6a86ED261DA0C8d7"
- TomoChain -> "0xC74b6D8897cBa9A4b659d43fEF73C9cA852cE424"
+ Viction -> "0xC74b6D8897cBa9A4b659d43fEF73C9cA852cE424"
Tron -> "TQ5NMqJjhpQGK7YJbESKtNCo86PJ89ujio"
VeChain -> "0x1a553275dF34195eAf23942CB7328AcF9d48c160"
Wanchain -> "0xD5ca90b928279FE5D06144136a25DeD90127aC15"
@@ -114,8 +115,8 @@ class CoinAddressDerivationTests {
NativeEvmos -> "evmos13u6g7vqgw074mgmf2ze2cadzvkz9snlwstd20d"
Nervos -> "ckb1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqdtyq04tvp02wectaumxn0664yw2jd53lqk4mxg3"
Everscale -> "0:0c39661089f86ec5926ea7d4ee4223d634ba4ed6dcc2e80c7b6a8e6d59f79b04"
- TON -> "EQDgEMqToTacHic7SnvnPFmvceG5auFkCcAw0mSCvzvKUfk9"
- Aptos -> "0x07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30"
+ TON -> "UQDgEMqToTacHic7SnvnPFmvceG5auFkCcAw0mSCvzvKUaT4"
+ Aptos -> "0x7968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30"
Nebl -> "NgDVaXAwNgBwb88xLiFKomfBmPkEh9F2d7"
Sui -> "0xada112cfb90b44ba889cc5d39ac2bf46281e4a91f7919c693bcd9b8323e81ed2"
Hedera -> "0.0.302a300506032b657003210049eba62f64d0d941045595d9433e65d84ecc46bcdb1421de55e05fcf2d8357d5"
@@ -142,5 +143,9 @@ class CoinAddressDerivationTests {
Noble -> "noble142j9u5eaduzd7faumygud6ruhdwme98qc8l3wa"
Rootstock -> "0xA2D7065F94F838a3aB9C04D67B312056846424Df"
Sei -> "sei142j9u5eaduzd7faumygud6ruhdwme98qagm0sj"
+ InternetComputer -> "6f8e568160a3c8362789848dc0fa52891964473c045cc25208a305fb35b7c4ab"
+ Tia -> "celestia142j9u5eaduzd7faumygud6ruhdwme98qpwmfv7"
+ NativeZetaChain -> "zeta13u6g7vqgw074mgmf2ze2cadzvkz9snlwywj304"
+ Dydx -> "dydx142j9u5eaduzd7faumygud6ruhdwme98qeayaky"
}
}
diff --git a/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/AnySigner.kt b/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/AnySigner.kt
index fd1cb8ed651..6de0b110bea 100644
--- a/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/AnySigner.kt
+++ b/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/AnySigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core
diff --git a/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/ByteArrayExt.kt b/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/ByteArrayExt.kt
index 8498cb26061..ec5923272a1 100644
--- a/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/ByteArrayExt.kt
+++ b/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/ByteArrayExt.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core
diff --git a/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/StringExt.kt b/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/StringExt.kt
index 19f224a22b7..2eb7fdd311e 100644
--- a/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/StringExt.kt
+++ b/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/StringExt.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core
diff --git a/kotlin/wallet-core-kotlin/src/jsMain/kotlin/WalletCore.kt b/kotlin/wallet-core-kotlin/src/jsMain/kotlin/WalletCore.kt
index ba7c30845c5..a454889ea72 100644
--- a/kotlin/wallet-core-kotlin/src/jsMain/kotlin/WalletCore.kt
+++ b/kotlin/wallet-core-kotlin/src/jsMain/kotlin/WalletCore.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
import com.trustwallet.core.*
import kotlin.js.Promise
diff --git a/kotlin/wallet-core-kotlin/src/jsMain/kotlin/com/trustwallet/core/AnySigner.kt b/kotlin/wallet-core-kotlin/src/jsMain/kotlin/com/trustwallet/core/AnySigner.kt
index b9e28700f97..d62bf4f81c3 100644
--- a/kotlin/wallet-core-kotlin/src/jsMain/kotlin/com/trustwallet/core/AnySigner.kt
+++ b/kotlin/wallet-core-kotlin/src/jsMain/kotlin/com/trustwallet/core/AnySigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core
diff --git a/kotlin/wallet-core-kotlin/src/jsMain/kotlin/com/trustwallet/core/ByteArray.kt b/kotlin/wallet-core-kotlin/src/jsMain/kotlin/com/trustwallet/core/ByteArray.kt
index 615d8c38db9..9163d5bdca2 100644
--- a/kotlin/wallet-core-kotlin/src/jsMain/kotlin/com/trustwallet/core/ByteArray.kt
+++ b/kotlin/wallet-core-kotlin/src/jsMain/kotlin/com/trustwallet/core/ByteArray.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core
diff --git a/kotlin/wallet-core-kotlin/src/jsMain/kotlin/com/trustwallet/core/JsAnySigner.kt b/kotlin/wallet-core-kotlin/src/jsMain/kotlin/com/trustwallet/core/JsAnySigner.kt
index f387eccbe7d..75be5fbd8d7 100644
--- a/kotlin/wallet-core-kotlin/src/jsMain/kotlin/com/trustwallet/core/JsAnySigner.kt
+++ b/kotlin/wallet-core-kotlin/src/jsMain/kotlin/com/trustwallet/core/JsAnySigner.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
package com.trustwallet.core
diff --git a/kotlin/wallet-core-kotlin/src/jsMain/kotlin/com/trustwallet/core/JsWalletCore.kt b/kotlin/wallet-core-kotlin/src/jsMain/kotlin/com/trustwallet/core/JsWalletCore.kt
index f2d75c7c361..0865e64e531 100644
--- a/kotlin/wallet-core-kotlin/src/jsMain/kotlin/com/trustwallet/core/JsWalletCore.kt
+++ b/kotlin/wallet-core-kotlin/src/jsMain/kotlin/com/trustwallet/core/JsWalletCore.kt
@@ -1,8 +1,6 @@
-// Copyright © 2017-2023 Trust Wallet.
+// SPDX-License-Identifier: Apache-2.0
//
-// This file is part of Trust. The full Trust copyright notice, including
-// terms governing use, modification, and redistribution, is contained in the
-// file LICENSE at the root of the source code distribution tree.
+// Copyright © 2017 Trust Wallet.
@file:Suppress("PropertyName")
diff --git a/protobuf-plugin/CMakeLists.txt b/protobuf-plugin/CMakeLists.txt
index 57b7ac59d83..237789be7be 100644
--- a/protobuf-plugin/CMakeLists.txt
+++ b/protobuf-plugin/CMakeLists.txt
@@ -1,33 +1,26 @@
-# Copyright © 2017-2022 Trust Wallet.
+# SPDX-License-Identifier: Apache-2.0
#
-# This file is part of Trust. The full Trust copyright notice, including
-# terms governing use, modification, and redistribution, is contained in the
-# file LICENSE at the root of the source code distribution tree.
+# Copyright © 2017 Trust Wallet.
-cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(TrustWalletCoreProtobufPlugin)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14" CACHE STRING "Minimum OS X deployment version" FORCE)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
-if ("$ENV{PREFIX}" STREQUAL "")
+if("$ENV{PREFIX}" STREQUAL "")
set(PREFIX "${CMAKE_SOURCE_DIR}/../build/local")
else()
set(PREFIX "$ENV{PREFIX}")
endif()
-include_directories(${PREFIX}/include)
-link_directories(${PREFIX}/lib)
+find_package(Protobuf CONFIG REQUIRED PATH ${PREFIX}/lib/pkgconfig)
-find_package(Protobuf REQUIRED PATH ${PREFIX}/lib/pkgconfig)
-include_directories(${Protobuf_INCLUDE_DIRS})
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
+add_executable(protoc-gen-c-typedef c_typedef.cc)
+target_link_libraries(protoc-gen-c-typedef protobuf::libprotobuf protobuf::libprotoc)
-add_executable(protoc-gen-c-typedef c_typedef.cc ${PROTO_SRCS} ${PROTO_HDRS})
-target_link_libraries(protoc-gen-c-typedef protobuf -lprotoc -pthread)
-
-add_executable(protoc-gen-swift-typealias swift_typealias.cc ${PROTO_SRCS} ${PROTO_HDRS})
-target_link_libraries(protoc-gen-swift-typealias protobuf -lprotoc -pthread)
+add_executable(protoc-gen-swift-typealias swift_typealias.cc)
+target_link_libraries(protoc-gen-swift-typealias protobuf::libprotobuf protobuf::libprotoc)
install(TARGETS protoc-gen-c-typedef protoc-gen-swift-typealias DESTINATION bin)
diff --git a/protobuf-plugin/c_typedef.cc b/protobuf-plugin/c_typedef.cc
index 9cd48a5e798..1352898cb73 100644
--- a/protobuf-plugin/c_typedef.cc
+++ b/protobuf-plugin/c_typedef.cc
@@ -14,16 +14,14 @@ class Generator : public compiler::CodeGenerator {
return "TW" + proto_file.substr(0, index) + "Proto.h";
}
- bool Generate(const FileDescriptor* file, const std::string& parameter, compiler::GeneratorContext* generator_context, string* error) const {
+ bool Generate(const FileDescriptor* file, const std::string& parameter, compiler::GeneratorContext* generator_context, std::string* error) const {
std::unique_ptr output(generator_context->Open(GetOutputFilename(file->name())));
io::Printer printer(output.get(), '$');
printer.Print(
- "// Copyright © 2017-2020 Trust Wallet.\n"
+ "// SPDX-License-Identifier: Apache-2.0\n"
"//\n"
- "// This file is part of Trust. The full Trust copyright notice, including\n"
- "// terms governing use, modification, and redistribution, is contained in the\n"
- "// file LICENSE at the root of the source code distribution tree.\n"
+ "// Copyright © 2017 Trust Wallet.\n"
"//\n"
"// This is a GENERATED FILE, changes made here WILL BE LOST.\n"
"\n"
diff --git a/protobuf-plugin/swift_typealias.cc b/protobuf-plugin/swift_typealias.cc
index 57a169dea03..3d0983c2ca3 100644
--- a/protobuf-plugin/swift_typealias.cc
+++ b/protobuf-plugin/swift_typealias.cc
@@ -16,16 +16,14 @@ class Generator : public compiler::CodeGenerator {
return proto_file.substr(0, index) + "+Proto.swift";
}
- bool Generate(const FileDescriptor* file, const std::string& parameter, compiler::GeneratorContext* generator_context, string* error) const {
+ bool Generate(const FileDescriptor* file, const std::string& parameter, compiler::GeneratorContext* generator_context, std::string* error) const {
std::unique_ptr output(generator_context->Open(GetOutputFilename(file->name())));
io::Printer printer(output.get(), '$');
printer.Print(
- "// Copyright © 2017-2020 Trust Wallet.\n"
+ "// SPDX-License-Identifier: Apache-2.0\n"
"//\n"
- "// This file is part of Trust. The full Trust copyright notice, including\n"
- "// terms governing use, modification, and redistribution, is contained in the\n"
- "// file LICENSE at the root of the source code distribution tree.\n"
+ "// Copyright © 2017 Trust Wallet.\n"
"\n"
);
diff --git a/registry.json b/registry.json
index 8fad28fe10c..1bb8123783a 100644
--- a/registry.json
+++ b/registry.json
@@ -34,9 +34,9 @@
"publicKeyHasher": "sha256ripemd",
"base58Hasher": "sha256d",
"explorer": {
- "url": "https://blockchair.com",
- "txPath": "/bitcoin/transaction/",
- "accountPath": "/bitcoin/address/",
+ "url": "https://mempool.space",
+ "txPath": "/tx/",
+ "accountPath": "/address/",
"sampleTx": "0607f62530b68cfcc91c57a1702841dd399a899d0eecda8e31ecca3f52f01df2",
"sampleAccount": "17A16QmavnUfCW11DAApiJxp7ARnxN5pGX"
},
@@ -1166,6 +1166,36 @@
"documentation": "https://docs.sei.io/"
}
},
+ {
+ "id": "tia",
+ "name": "Tia",
+ "displayName": "Celestia",
+ "coinId": 21000118,
+ "symbol": "TIA",
+ "decimals": 6,
+ "blockchain": "Cosmos",
+ "chainId": "celestia",
+ "derivation": [
+ {
+ "path": "m/44'/118'/0'/0/0"
+ }
+ ],
+ "curve": "secp256k1",
+ "publicKeyType": "secp256k1",
+ "hrp": "celestia",
+ "addressHasher": "sha256ripemd",
+ "explorer": {
+ "url": "https://www.mintscan.io/celestia",
+ "txPath": "/txs/",
+ "accountPath": "/account/",
+ "sampleTx": "FF370C65D8D67B8236F9D3A8D2B1256337C60C1965092CADD1FA970288FCE99B",
+ "sampleAccount": "celestia1tt4tv4jrs4twdtzwywxd8u65duxgk8y73wvfu2"
+ },
+ "info": {
+ "url": "https://celestia.org/",
+ "documentation": "https://docs.celestia.org/"
+ }
+ },
{
"id": "coreum",
"name": "Coreum",
@@ -1468,7 +1498,7 @@
"url": "https://blockchair.com/stellar",
"txPath": "/transaction/",
"accountPath": "/account/",
- "sampleTx": "d9aeabfa9d24df8c5755125f8af243b74cd3ff878656cfa72c566a8824bf6e84",
+ "sampleTx": "8a7ff7261e8b3f31af7f6ed257c2e9fe7c47afcd9b1ce1be1bfc1bc5f6a3ad9e",
"sampleAccount": "GCILJZQ3CKBKBUJWW4TAM6Q37LJA5MQX6GMSFSQN75BPLWIZ33OPRG52"
},
"info": {
@@ -1529,9 +1559,9 @@
"publicKeyType": "ed25519Blake2b",
"url": "https://nano.org",
"explorer": {
- "url": "https://nanocrawler.cc",
- "txPath": "/explorer/block/",
- "accountPath": "/explorer/account/",
+ "url": "https://www.nanolooker.com",
+ "txPath": "/block/",
+ "accountPath": "/account/",
"sampleTx": "C264DB7BF40738F0CEFF19B606746CB925B713E4B8699A055699E0DC8ABBC70F",
"sampleAccount": "nano_1wpj616kwhe1y38y1mspd8aub8i334cwybqco511iyuxm55zx8d67ptf1tsf"
},
@@ -1563,7 +1593,7 @@
"publicKeyHasher": "sha256ripemd",
"base58Hasher": "sha256d",
"explorer": {
- "url": "https://ravencoin.network",
+ "url": "https://blockbook.ravencoin.org",
"txPath": "/tx/",
"accountPath": "/address/"
},
@@ -1750,9 +1780,9 @@
"curve": "ed25519",
"publicKeyType": "ed25519",
"explorer": {
- "url": "https://algoexplorer.io",
- "txPath": "/tx/",
- "accountPath": "/address/",
+ "url": "https://app.dappflow.org/explorer",
+ "txPath": "/transaction/",
+ "accountPath": "/account/",
"sampleTx": "CR7POXFTYDLC7TV3IXHA7AZKWABUJC52BACLHJQNXAKZJGRPQY3A",
"sampleAccount": "J4AEINCSSLDA7LNBNWM4ZXFCTLTOZT5LG3F5BLMFPJYGFWVCMU37EZI2AM"
},
@@ -1763,7 +1793,6 @@
"documentation": "https://developer.algorand.org/docs/algod-rest-paths"
}
},
-
{
"id": "iotex",
"name": "IoTeX",
@@ -2005,9 +2034,9 @@
"curve": "ed25519",
"publicKeyType": "ed25519",
"explorer": {
- "url": "https://explorer.near.org",
- "txPath": "/transactions/",
- "accountPath": "/accounts/",
+ "url": "https://nearblocks.io",
+ "txPath": "/txns/",
+ "accountPath": "/address/",
"sampleTx": "FPQAMaVnvFHNwNBJWnTttXfdJhp5FvMGGDJEesB8gvbL",
"sampleAccount": "test-trust.vlad.near"
},
@@ -2268,11 +2297,11 @@
"hrp": "band",
"addressHasher": "sha256ripemd",
"explorer": {
- "url": "https://scan-wenchang-testnet2.bandchain.org/",
+ "url": "https://www.mintscan.io/band",
"txPath": "/tx/",
"accountPath": "/account/",
- "sampleTx": "473264551D3063A9EC64EC251C61BE92DDDFCF6CC46D026D1E574D83D5447173",
- "sampleAccount": "band12nmsm9khdsv0tywge43q3zwj8kkj3hvup9rltp"
+ "sampleTx": "74AF38C2183B06EB6274DA4AAC0D2334E6E283643D436852F5E088AEA2CD0B17",
+ "sampleAccount": "band16gpgu994g2gdrzvwp9047le3pcq9wz6mcgtd4w"
},
"info": {
"url": "https://bandprotocol.com/",
@@ -2411,6 +2440,7 @@
],
"curve": "secp256k1",
"publicKeyType": "secp256k1",
+ "addressHasher": "sha256ripemd",
"hrp": "bnb",
"chainId": "Binance-Chain-Tigris",
"explorer": {
@@ -2443,6 +2473,7 @@
],
"curve": "secp256k1",
"publicKeyType": "secp256k1",
+ "addressHasher": "sha256ripemd",
"hrp": "tbnb",
"explorer": {
"url": "https://testnet-explorer.binance.org",
@@ -2544,10 +2575,10 @@
}
},
{
- "id": "tomochain",
- "name": "TomoChain",
+ "id": "viction",
+ "name": "Viction",
"coinId": 889,
- "symbol": "TOMO",
+ "symbol": "VIC",
"decimals": 18,
"blockchain": "Ethereum",
"derivation": [
@@ -2560,15 +2591,15 @@
"chainId": "88",
"addressHasher": "keccak256",
"explorer": {
- "url": "https://tomoscan.io",
+ "url": "https://www.vicscan.xyz",
"txPath": "/tx/",
"accountPath": "/address/",
"sampleTx": "0x35a8d3ab06c94d5b7d27221b7c9a24ba3f1710dd0fcfd75c5d59b3a885fd709b",
"sampleAccount": "0x86cCbD9bfb371c355202086882bC644A7D0b024B"
},
"info": {
- "url": "https://tomochain.com",
- "source": "https://github.com/tomochain/tomochain",
+ "url": "https://www.viction.xyz/",
+ "source": "https://github.com/BuildOnViction/tomochain",
"rpc": "https://rpc.tomochain.com",
"documentation": "https://eth.wiki/json-rpc/API"
}
@@ -2682,7 +2713,7 @@
"url": "https://oasisscan.com",
"txPath": "/transactions/",
"accountPath": "/accounts/detail/",
- "sampleTx": "0b9bd4983f1c88a1c71bf33562b6ba02b3064e01697d15a0de4bfe1922ec74b8",
+ "sampleTx": "73dc977fdd8596d4a57e6feb891b21f5da3652d26815dc94f15f7420c298e29e",
"sampleAccount": "oasis1qrx376dmwuckmruzn9vq64n49clw72lywctvxdf4"
},
"info": {
@@ -3077,7 +3108,7 @@
"id": "polygon",
"name": "Polygon",
"coinId": 966,
- "symbol": "MATIC",
+ "symbol": "POL",
"decimals": 18,
"blockchain": "Ethereum",
"derivation": [
@@ -3098,9 +3129,9 @@
},
"info": {
"url": "https://polygon.technology",
- "source": "https://github.com/maticnetwork/contracts",
+ "source": "https://github.com/maticnetwork",
"rpc": "https://polygon-rpc.com",
- "documentation": "https://eth.wiki/json-rpc/API"
+ "documentation": "https://docs.polygon.technology"
}
},
{
@@ -3148,6 +3179,7 @@
"curve": "secp256k1",
"publicKeyType": "secp256k1",
"hrp": "thor",
+ "addressHasher": "sha256ripemd",
"chainId": "thorchain-mainnet-v1",
"explorer": {
"url": "https://viewblock.io/thorchain",
@@ -3166,7 +3198,7 @@
{
"id": "optimism",
"name": "Optimism",
- "displayName": "Optimism Ethereum",
+ "displayName": "OP Mainnet",
"coinId": 10000070,
"slip44": 60,
"symbol": "ETH",
@@ -3259,7 +3291,7 @@
"id": "scroll",
"name": "Scroll",
"displayName": "Scroll",
- "coinId": 534353,
+ "coinId": 534352,
"slip44": 60,
"symbol": "ETH",
"decimals": 18,
@@ -3271,19 +3303,19 @@
],
"curve": "secp256k1",
"publicKeyType": "secp256k1Extended",
- "chainId": "534353",
+ "chainId": "534352",
"addressHasher": "keccak256",
"explorer": {
- "url": "https://blockscout.scroll.io",
+ "url": "https://scrollscan.com",
"txPath": "/tx/",
"accountPath": "/address/",
- "sampleTx": "0xee9196d6840c8d31626324d91c886d20e65711c2026c559133fb23741d3b2f9d",
- "sampleAccount": "0xFE993660cd35d68D94b6Eba29F4D928d979cd65B"
+ "sampleTx": "0xa2062a4530b194a438bb9f9e87cdce59f70775a52e8336892364445847c43ca2",
+ "sampleAccount": "0xf9062b8a30e0d7722960e305049fa50b86ba6253"
},
"info": {
"url": "https://scroll.io",
"source": "https://github.com/scroll-tech",
- "rpc": "https://alpha-rpc.scroll.io/l2",
+ "rpc": "https://rpc.scroll.io",
"documentation": "https://guide.scroll.io"
}
},
@@ -3944,7 +3976,7 @@
"coinId": 20009001,
"symbol": "EVMOS",
"decimals": 18,
- "blockchain": "Cosmos",
+ "blockchain": "NativeEvmos",
"chainId": "evmos_9001-2",
"derivation": [
{
@@ -4025,8 +4057,8 @@
}
},
{
- "id": "klaytn",
- "name": "Klaytn",
+ "id": "kaia",
+ "name": "Kaia",
"coinId": 10008217,
"symbol": "KLAY",
"decimals": 18,
@@ -4040,16 +4072,16 @@
"publicKeyType": "secp256k1Extended",
"chainId": "8217",
"explorer": {
- "url": "https://scope.klaytn.com",
+ "url": "https://kaiascan.io",
"txPath": "/tx/",
"accountPath": "/account/",
"sampleTx": "0x93ea92687845fe7bb6cacd69c76a16a2a3c2bbb85a8a93ff0e032d0098d583d7",
"sampleAccount": "0x2ad9656bf5b82caf10847b431012e28e301e83ba"
},
"info": {
- "url": "https://klaytn.foundation",
- "rpc": "https://public-node-api.klaytnapi.com/v1/cypress",
- "documentation": "https://docs.klaytn.foundation"
+ "url": "https://kaia.io",
+ "rpc": "https://public-en.node.kaia.io",
+ "documentation": "https://docs.kaia.io"
}
},
{
@@ -4098,7 +4130,7 @@
"publicKeyType": "secp256k1Extended",
"addressHasher": "keccak256",
"explorer": {
- "url": "https://www.oklink.com/en/okc",
+ "url": "https://www.oklink.com/oktc",
"txPath": "/tx/",
"accountPath": "/address/",
"sampleTx": "0x46C3A947E8248570FBD28E4FE456CC8F80DFD90716533878FB67857B95FA3D37",
@@ -4148,7 +4180,7 @@
"coinId": 5600,
"symbol": "BNB",
"decimals": 18,
- "chainId": "9000",
+ "chainId": "1017",
"blockchain": "Greenfield",
"derivation": [
{
@@ -4211,6 +4243,7 @@
"blockchain": "Bitcoin",
"derivation": [
{
+ "name": "segwit",
"path": "m/44'/105105'/0'/0/0",
"xpub": "xpub",
"xprv": "xprv"
@@ -4329,6 +4362,38 @@
"documentation": "https://docs.agoric.com"
}
},
+ {
+ "id": "dydx",
+ "name": "Dydx",
+ "displayName": "dYdX",
+ "coinId": 22000118,
+ "symbol": "DYDX",
+ "decimals": 18,
+ "blockchain": "Cosmos",
+ "derivation": [
+ {
+ "path": "m/44'/118'/0'/0/0"
+ }
+ ],
+ "curve": "secp256k1",
+ "publicKeyType": "secp256k1",
+ "hrp": "dydx",
+ "chainId": "dydx-mainnet-1",
+ "addressHasher": "sha256ripemd",
+ "explorer": {
+ "url": "https://www.mintscan.io/dydx",
+ "txPath": "/tx/",
+ "accountPath": "/address/",
+ "sampleTx": "F236222E4F7C92FA84711FD6451ED22DD56CBDFA319BFDAFB99A21E4E9B9EC2F",
+ "sampleAccount": "dydx1adl7usw7z2dnysyn7wvrghu0u0q6gr7jqs4gtt"
+ },
+ "info": {
+ "url": "https://dydx.exchange",
+ "source": "https://github.com/dydxprotocol",
+ "rpc": "https://dydx-dao-api.polkachu.com",
+ "documentation": "https://docs.dydx.exchange"
+ }
+ },
{
"id": "nativeinjective",
"name": "NativeInjective",
@@ -4336,7 +4401,7 @@
"coinId": 10000060,
"symbol": "INJ",
"decimals": 18,
- "blockchain": "Cosmos",
+ "blockchain": "NativeInjective",
"derivation": [
{
"path": "m/44'/60'/0'/0/0"
@@ -4389,13 +4454,71 @@
"documentation": "https://docs.canto.io/"
}
},
+ {
+ "id": "zetachain",
+ "name": "NativeZetaChain",
+ "displayName": "NativeZetaChain",
+ "coinId": 10007000,
+ "symbol": "ZETA",
+ "decimals": 18,
+ "blockchain": "Cosmos",
+ "chainId": "zetachain_7000-1",
+ "derivation": [
+ {
+ "path": "m/44'/60'/0'/0/0"
+ }
+ ],
+ "curve": "secp256k1",
+ "publicKeyType": "secp256k1Extended",
+ "hrp": "zeta",
+ "addressHasher": "keccak256",
+ "explorer": {
+ "url": "https://explorer.zetachain.com",
+ "txPath": "/cosmos/tx/",
+ "accountPath": "/address/",
+ "sampleTx": "2DBB071DDD47985F4470A21E5943CE95D371AE4BDE2267E201D3553FB2BDCFDE",
+ "sampleAccount": "zeta14py36sx57ud82t9yrks9z6hdsrpn5x6kmxs0ne"
+ },
+ "info": {
+ "url": "https://www.zetachain.com/",
+ "documentation": "https://www.zetachain.com/docs/"
+ }
+ },
+ {
+ "id": "zetaevm",
+ "name": "Zeta EVM",
+ "coinId": 20007000,
+ "symbol": "ZETA",
+ "decimals": 18,
+ "blockchain": "Ethereum",
+ "derivation": [
+ {
+ "path": "m/44'/60'/0'/0/0"
+ }
+ ],
+ "curve": "secp256k1",
+ "publicKeyType": "secp256k1Extended",
+ "chainId": "7000",
+ "addressHasher": "keccak256",
+ "explorer": {
+ "url": "https://explorer.zetachain.com",
+ "txPath": "/evm/tx/",
+ "accountPath": "/address/",
+ "sampleTx": "0x04cb1201857de29af97b755e51c888454fb96c1f3bb3c1329bb94d5353d5c19e",
+ "sampleAccount": "0x85539A58F9c88DdDccBaBBfc660968323Fd1e167"
+ },
+ "info": {
+ "url": "https://www.zetachain.com/",
+ "documentation": "https://www.zetachain.com/docs/"
+ }
+ },
{
"id": "ton",
"name": "TON",
"coinId": 607,
"symbol": "TON",
"decimals": 9,
- "blockchain": "The Open Network",
+ "blockchain": "TheOpenNetwork",
"derivation": [
{
"path": "m/44'/607'/0'"
@@ -4404,9 +4527,9 @@
"curve": "ed25519",
"publicKeyType": "ed25519",
"explorer": {
- "url": "https://tonscan.org",
- "txPath": "/tx/",
- "accountPath": "/address/",
+ "url": "https://tonviewer.com",
+ "txPath": "/transaction/",
+ "accountPath": "/",
"sampleTx": "fJXfn0EVhV09HFuEgUHu4Cchb24nUQtIMwSzmzk2tLs=",
"sampleAccount": "EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N"
},
@@ -4446,5 +4569,217 @@
"rpc": "https://neon-proxy-mainnet.solana.p2p.org/",
"documentation": "https://docs.neonfoundation.io/docs/quick_start"
}
+ },
+ {
+ "id": "internet_computer",
+ "name": "Internet Computer",
+ "coinId": 223,
+ "symbol": "ICP",
+ "decimals": 8,
+ "blockchain": "InternetComputer",
+ "derivation": [
+ {
+ "path": "m/44'/223'/0'/0/0",
+ "xpub": "xpub",
+ "xpriv": "xpriv"
+ }
+ ],
+ "curve": "secp256k1",
+ "publicKeyType": "secp256k1Extended",
+ "explorer": {
+ "url": "https://dashboard.internetcomputer.org",
+ "txPath": "/transaction/",
+ "accountPath": "/account/",
+ "sampleTx": "9e32c54975adf84a1d98f19df41bbc34a752a899c32cc9c0000200b2c4308f85",
+ "sampleAccount": "529ea51c22e8d66e8302eabd9297b100fdb369109822248bb86939a671fbc55b"
+ },
+ "info": {
+ "url": "https://internetcomputer.org",
+ "source": "https://github.com/dfinity/ic",
+ "rpc": "",
+ "documentation": "https://internetcomputer.org/docs"
+ }
+ },
+ {
+ "id": "manta",
+ "name": "Manta Pacific",
+ "coinId": 169,
+ "symbol": "ETH",
+ "decimals": 18,
+ "blockchain": "Ethereum",
+ "derivation": [
+ {
+ "path": "m/44'/60'/0'/0/0"
+ }
+ ],
+ "curve": "secp256k1",
+ "publicKeyType": "secp256k1Extended",
+ "chainId": "169",
+ "addressHasher": "keccak256",
+ "explorer": {
+ "url": "https://pacific-explorer.manta.network",
+ "txPath": "/tx/",
+ "accountPath": "/address/",
+ "sampleTx": "0x2bbd5d85b0ed05d1416e30ce1197a6f0c27d10ce02593a2719e2baf486d2e8c2",
+ "sampleAccount": "0xF122a1aC569a36a5Cf6d0F828A22254c8A9afF84"
+ },
+ "info": {
+ "url": "https://pacific.manta.network",
+ "source": "https://github.com/manta-network",
+ "rpc": "https://pacific-rpc.manta.network/http",
+ "documentation": "https://docs.manta.network/docs/Introduction"
+ }
+ },
+ {
+ "id": "merlin",
+ "name": "Merlin",
+ "coinId": 4200,
+ "symbol": "BTC",
+ "decimals": 18,
+ "blockchain": "Ethereum",
+ "derivation": [
+ {
+ "path": "m/44'/60'/0'/0/0"
+ }
+ ],
+ "curve": "secp256k1",
+ "publicKeyType": "secp256k1Extended",
+ "chainId": "4200",
+ "addressHasher": "keccak256",
+ "explorer": {
+ "url": "https://scan.merlinchain.io",
+ "txPath": "/tx/",
+ "accountPath": "/address/",
+ "sampleTx": "0xca6f2891959b669237738dd0bc2c1051d966778c9de90b94165032ce58364212",
+ "sampleAccount": "0xf7e017b3f61bD3410A3b03D7DAD7699FD6780584"
+ },
+ "info": {
+ "url": "https://merlinchain.io",
+ "source": "https://merlinchain.io",
+ "rpc": "https://rpc.merlinchain.io",
+ "documentation": "https://docs.merlinchain.io/merlin-docs"
+ }
+ },
+ {
+ "id": "lightlink",
+ "name": "Lightlink",
+ "displayName": "Lightlink Phoenix",
+ "coinId": 1890,
+ "symbol": "ETH",
+ "decimals": 18,
+ "blockchain": "Ethereum",
+ "derivation": [
+ {
+ "path": "m/44'/60'/0'/0/0"
+ }
+ ],
+ "curve": "secp256k1",
+ "publicKeyType": "secp256k1Extended",
+ "chainId": "1890",
+ "addressHasher": "keccak256",
+ "explorer": {
+ "url": "https://phoenix.lightlink.io",
+ "txPath": "/tx/",
+ "accountPath": "/address/",
+ "sampleTx": "0xc65f82445aefc883fd4ffe09149c8ce48f61b670c0734528a49d4a8bd8309bb0",
+ "sampleAccount": "0x4566ED6c7a7fFc90E2C7cfF7eB9156262afD2fDe"
+ },
+ "info": {
+ "url": "https://lightlink.io",
+ "source": "https://github.com/lightlink-network",
+ "rpc": "https://endpoints.omniatech.io/v1/lightlink/phoenix/public",
+ "documentation": "https://docs.lightlink.io/lightlink-protocol"
+ }
+ },
+ {
+ "id": "blast",
+ "name": "Blast",
+ "coinId": 81457,
+ "symbol": "ETH",
+ "decimals": 18,
+ "blockchain": "Ethereum",
+ "derivation": [
+ {
+ "path": "m/44'/60'/0'/0/0"
+ }
+ ],
+ "curve": "secp256k1",
+ "publicKeyType": "secp256k1Extended",
+ "chainId": "81457",
+ "addressHasher": "keccak256",
+ "explorer": {
+ "url": "https://blastscan.io",
+ "txPath": "/tx/",
+ "accountPath": "/address/",
+ "sampleTx": "0x511fc00e8329343b9e953bf1f75e9b0a7b3cc2eb3a8f049d5be41adf4fbd6cac",
+ "sampleAccount": "0x0d11f2f0ff55c4fcfc3ff86bdc8e78ffa7df99fd"
+ },
+ "info": {
+ "url": "https://blast.io",
+ "source": "https://github.com/blast-io",
+ "rpc": "https://rpc.blast.io",
+ "documentation": "https://docs.blast.io"
+ }
+ },
+ {
+ "id": "bouncebit",
+ "name": "BounceBit",
+ "coinId": 6001,
+ "symbol": "BB",
+ "decimals": 18,
+ "blockchain": "Ethereum",
+ "derivation": [
+ {
+ "path": "m/44'/60'/0'/0/0"
+ }
+ ],
+ "curve": "secp256k1",
+ "publicKeyType": "secp256k1Extended",
+ "chainId": "6001",
+ "addressHasher": "keccak256",
+ "explorer": {
+ "url": "https://bbscan.io",
+ "txPath": "/tx/",
+ "accountPath": "/address/",
+ "sampleTx": "0x52558f4143d058d942e3b73414090266ae3ffce1fe8c25fe86896e2c8e5ef932",
+ "sampleAccount": "0xf4aa7349a9ccca4609943955b5ddc7bd9278c223"
+ },
+ "info": {
+ "url": "https://bouncebit.io",
+ "source": "https://github.com/BounceBit-Labs",
+ "rpc": "https://fullnode-mainnet.bouncebitapi.com",
+ "documentation": "https://docs.bouncebit.io"
+ }
+ },
+ {
+ "id": "zklinknova",
+ "name": "ZkLinkNova",
+ "displayName": "zkLink Nova Mainnet",
+ "coinId": 810180,
+ "symbol": "ETH",
+ "decimals": 18,
+ "blockchain": "Ethereum",
+ "derivation": [
+ {
+ "path": "m/44'/60'/0'/0/0"
+ }
+ ],
+ "curve": "secp256k1",
+ "publicKeyType": "secp256k1Extended",
+ "chainId": "810180",
+ "addressHasher": "keccak256",
+ "explorer": {
+ "url": "https://explorer.zklink.io",
+ "txPath": "/tx/",
+ "accountPath": "/address/",
+ "sampleTx": "0xeb5eb8710369c89115a83f3e744c15c9d388030cfce2fd3a653dbd18f2947400",
+ "sampleAccount": "0xF95115BaD9a4585B3C5e2bfB50579f17163A45aA"
+ },
+ "info": {
+ "url": "https://zklink.io",
+ "source": "https://github.com/zkLinkProtocol",
+ "rpc": "https://rpc.zklink.io",
+ "documentation": "https://docs.zklink.io"
+ }
}
]
diff --git a/rust/.config/nextest.toml b/rust/.config/nextest.toml
deleted file mode 100644
index 76fd74b5d7f..00000000000
--- a/rust/.config/nextest.toml
+++ /dev/null
@@ -1,2 +0,0 @@
-[profile.ci.junit]
-path = "junit.xml"
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
index 7ae598db1fd..108bb84e1e0 100644
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -2,6 +2,16 @@
# It is not intended for manual editing.
version = 3
+[[package]]
+name = "aead"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0"
+dependencies = [
+ "crypto-common",
+ "generic-array",
+]
+
[[package]]
name = "aho-corasick"
version = "0.7.20"
@@ -22,9 +32,15 @@ dependencies = [
[[package]]
name = "anyhow"
-version = "1.0.69"
+version = "1.0.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800"
+checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
+
+[[package]]
+name = "arbitrary"
+version = "0.4.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "db55d72333851e17d572bec876e390cd3b11eb1ef53ae821dd9f3b653d2b4569"
[[package]]
name = "arbitrary"
@@ -136,9 +152,9 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
[[package]]
name = "bcs"
-version = "0.1.4"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b06b4c1f053002b70e7084ac944c77d58d5d92b2110dbc5e852735e00ad3ccc"
+checksum = "85b6598a2f5d564fb7855dc6b06fd1c38cff5a72bd8b863a4d021938497b440a"
dependencies = [
"serde",
"thiserror",
@@ -162,6 +178,15 @@ dependencies = [
"serde",
]
+[[package]]
+name = "bincode"
+version = "1.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
+dependencies = [
+ "serde",
+]
+
[[package]]
name = "bitcoin"
version = "0.30.1"
@@ -196,11 +221,26 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+[[package]]
+name = "bitreader"
+version = "0.3.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bdd859c9d97f7c468252795b35aeccc412bdbb1e90ee6969c4fa6328272eaeff"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "bitstream-io"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3dcde5f311c85b8ca30c2e4198d4326bc342c76541590106f5fa4a50946ea499"
+
[[package]]
name = "bitvec"
-version = "1.0.1"
+version = "0.20.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
+checksum = "7774144344a4faa177370406a7ff5f1da24303817368584c6206c8303eb07848"
dependencies = [
"funty",
"radium",
@@ -221,13 +261,11 @@ dependencies = [
[[package]]
name = "blake2"
-version = "0.9.2"
+version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0a4e37d16930f5459780f5621038b6382b9bb37c19016f39fb6b5808d831f174"
+checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe"
dependencies = [
- "crypto-mac",
- "digest 0.9.0",
- "opaque-debug",
+ "digest 0.10.6",
]
[[package]]
@@ -254,6 +292,30 @@ dependencies = [
"generic-array",
]
+[[package]]
+name = "borsh"
+version = "1.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f58b559fd6448c6e2fd0adb5720cd98a2506594cafa4737ff98c396f3e82f667"
+dependencies = [
+ "borsh-derive",
+ "cfg_aliases",
+]
+
+[[package]]
+name = "borsh-derive"
+version = "1.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7aadb5b6ccbd078890f6d7003694e33816e6b784358f18e15e7e6d9f065a57cd"
+dependencies = [
+ "once_cell",
+ "proc-macro-crate 3.1.0",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.37",
+ "syn_derive",
+]
+
[[package]]
name = "bs58"
version = "0.4.0"
@@ -296,6 +358,50 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+[[package]]
+name = "cfg_aliases"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
+
+[[package]]
+name = "ciborium"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "effd91f6c78e5a4ace8a5d3c0b6bfaec9e2baaef55f3efc00e45fb2e477ee926"
+dependencies = [
+ "ciborium-io",
+ "ciborium-ll",
+ "serde",
+]
+
+[[package]]
+name = "ciborium-io"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cdf919175532b369853f5d5e20b26b43112613fd6fe7aee757e35f7a44642656"
+
+[[package]]
+name = "ciborium-ll"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "defaa24ecc093c77630e6c15e17c51f5e187bf35ee514f4e2d67baaa96dae22b"
+dependencies = [
+ "ciborium-io",
+ "half",
+]
+
+[[package]]
+name = "cipher"
+version = "0.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
+dependencies = [
+ "crypto-common",
+ "inout",
+ "zeroize",
+]
+
[[package]]
name = "clap"
version = "2.34.0"
@@ -319,13 +425,28 @@ checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913"
[[package]]
name = "cpufeatures"
-version = "0.2.5"
+version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320"
+checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504"
dependencies = [
"libc",
]
+[[package]]
+name = "crc"
+version = "3.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636"
+dependencies = [
+ "crc-catalog",
+]
+
+[[package]]
+name = "crc-catalog"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
+
[[package]]
name = "crunchy"
version = "0.2.2"
@@ -339,7 +460,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c2538c4e68e52548bacb3e83ac549f903d44f011ac9d5abb5e132e67d0808f7"
dependencies = [
"generic-array",
- "rand_core 0.6.4",
+ "rand_core",
"subtle",
"zeroize",
]
@@ -351,37 +472,71 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
"generic-array",
+ "rand_core",
"typenum",
]
[[package]]
-name = "crypto-mac"
-version = "0.8.0"
+name = "crypto_box"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "16182b4f39a82ec8a6851155cc4c0cda3065bb1db33651726a29e1951de0f009"
+dependencies = [
+ "aead",
+ "crypto_secretbox",
+ "curve25519-dalek",
+ "salsa20",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
+name = "crypto_secretbox"
+version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab"
+checksum = "b9d6cf87adf719ddf43a805e92c6870a531aedda35ff640442cbaf8674e141e1"
dependencies = [
+ "aead",
+ "cipher",
"generic-array",
+ "poly1305",
+ "salsa20",
"subtle",
+ "zeroize",
]
[[package]]
name = "curve25519-dalek"
-version = "3.2.0"
+version = "4.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61"
+checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be"
dependencies = [
- "byteorder",
- "digest 0.9.0",
- "rand_core 0.5.1",
+ "cfg-if",
+ "cpufeatures",
+ "curve25519-dalek-derive",
+ "digest 0.10.6",
+ "fiat-crypto",
+ "rustc_version",
"subtle",
"zeroize",
]
+[[package]]
+name = "curve25519-dalek-derive"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.37",
+]
+
[[package]]
name = "data-encoding"
-version = "2.3.3"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb"
+checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "der"
@@ -393,6 +548,12 @@ dependencies = [
"zeroize",
]
+[[package]]
+name = "derivation-path"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6e5c37193a1db1d8ed868c03ec7b152175f26160a5b740e5e484143877e0adf0"
+
[[package]]
name = "derivative"
version = "2.2.0"
@@ -469,7 +630,7 @@ dependencies = [
"group",
"hkdf",
"pkcs8",
- "rand_core 0.6.4",
+ "rand_core",
"sec1",
"subtle",
"zeroize",
@@ -494,23 +655,35 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1"
+[[package]]
+name = "ethnum"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c8ff382b2fa527fb7fb06eeebfc5bbb3f17e3cc6b9d70b006c41daa8824adac"
+
[[package]]
name = "ff"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449"
dependencies = [
- "rand_core 0.6.4",
+ "rand_core",
"subtle",
]
+[[package]]
+name = "fiat-crypto"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1676f435fc1dadde4d03e43f5d62b259e1ce5f40bd4ffb21db2b42ebe59c1382"
+
[[package]]
name = "fixed-hash"
-version = "0.8.0"
+version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534"
+checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c"
dependencies = [
- "arbitrary",
+ "arbitrary 0.4.7",
"byteorder",
"rand",
"rustc-hex",
@@ -519,32 +692,21 @@ dependencies = [
[[package]]
name = "funty"
-version = "2.0.0"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
+checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7"
[[package]]
name = "generic-array"
-version = "0.14.6"
+version = "0.14.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9"
+checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
dependencies = [
"typenum",
"version_check",
"zeroize",
]
-[[package]]
-name = "getrandom"
-version = "0.1.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
-dependencies = [
- "cfg-if",
- "libc",
- "wasi 0.9.0+wasi-snapshot-preview1",
-]
-
[[package]]
name = "getrandom"
version = "0.2.9"
@@ -554,7 +716,7 @@ dependencies = [
"cfg-if",
"js-sys",
"libc",
- "wasi 0.11.0+wasi-snapshot-preview1",
+ "wasi",
"wasm-bindgen",
]
@@ -574,16 +736,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63"
dependencies = [
"ff",
- "rand_core 0.6.4",
+ "rand_core",
"subtle",
]
+[[package]]
+name = "half"
+version = "1.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
+
[[package]]
name = "hashbrown"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
+[[package]]
+name = "heck"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
+
[[package]]
name = "hermit-abi"
version = "0.1.19"
@@ -634,13 +808,22 @@ dependencies = [
[[package]]
name = "impl-codec"
-version = "0.6.0"
+version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f"
+checksum = "161ebdfec3c8e3b52bf61c4f3550a1eea4f9579d10dc1b936f3171ebdcd6c443"
dependencies = [
"parity-scale-codec",
]
+[[package]]
+name = "impl-serde"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c"
+dependencies = [
+ "serde",
+]
+
[[package]]
name = "impl-trait-for-tuples"
version = "0.2.2"
@@ -662,6 +845,15 @@ dependencies = [
"hashbrown",
]
+[[package]]
+name = "inout"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5"
+dependencies = [
+ "generic-array",
+]
+
[[package]]
name = "itertools"
version = "0.10.5"
@@ -696,7 +888,7 @@ dependencies = [
"ecdsa",
"elliptic-curve",
"once_cell",
- "sha2 0.10.6",
+ "sha2",
"signature",
]
@@ -717,9 +909,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
-version = "0.2.141"
+version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5"
+checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "log"
@@ -745,16 +937,20 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "move-core-types"
version = "0.0.4"
-source = "git+https://github.com/move-language/move?rev=f7137eabc2046f76fdad3ded2c51e03a3b1fbd01#f7137eabc2046f76fdad3ded2c51e03a3b1fbd01"
+source = "git+https://github.com/move-language/move?rev=ea70797099baea64f05194a918cebd69ed02b285#ea70797099baea64f05194a918cebd69ed02b285"
dependencies = [
"anyhow",
"bcs",
+ "ethnum",
"hex",
+ "num",
"once_cell",
+ "primitive-types",
"rand",
"ref-cast",
"serde",
"serde_bytes",
+ "uint",
]
[[package]]
@@ -767,47 +963,91 @@ dependencies = [
"minimal-lexical",
]
+[[package]]
+name = "num"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af"
+dependencies = [
+ "num-bigint",
+ "num-complex",
+ "num-integer",
+ "num-iter",
+ "num-rational",
+ "num-traits",
+]
+
[[package]]
name = "num-bigint"
-version = "0.4.3"
+version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f"
+checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"
dependencies = [
- "autocfg",
"num-integer",
"num-traits",
]
+[[package]]
+name = "num-complex"
+version = "0.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214"
+dependencies = [
+ "num-traits",
+]
+
[[package]]
name = "num-integer"
-version = "0.1.45"
+version = "0.1.46"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
+dependencies = [
+ "num-traits",
+]
+
+[[package]]
+name = "num-iter"
+version = "0.1.43"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252"
+dependencies = [
+ "autocfg",
+ "num-integer",
+ "num-traits",
+]
+
+[[package]]
+name = "num-rational"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
+checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
dependencies = [
"autocfg",
+ "num-bigint",
+ "num-integer",
"num-traits",
]
[[package]]
name = "num-traits"
-version = "0.2.15"
+version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
+checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
]
[[package]]
name = "once_cell"
-version = "1.17.0"
+version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
+checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "opaque-debug"
-version = "0.3.0"
+version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
+checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
[[package]]
name = "p256"
@@ -818,14 +1058,14 @@ dependencies = [
"ecdsa",
"elliptic-curve",
"primeorder",
- "sha2 0.10.6",
+ "sha2",
]
[[package]]
name = "parity-scale-codec"
-version = "3.5.0"
+version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ddb756ca205bd108aee3c62c6d3c994e1df84a59b9d6d4a5ea42ee1fd5a9a28"
+checksum = "373b1a4c1338d9cd3d1fa53b3a11bdab5ab6bd80a20f7f7becd76953ae2be909"
dependencies = [
"arrayvec",
"bitvec",
@@ -837,11 +1077,11 @@ dependencies = [
[[package]]
name = "parity-scale-codec-derive"
-version = "3.1.4"
+version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b"
+checksum = "1557010476e0595c9b568d16dcfb81b93cdeb157612726f5170d31aa707bed27"
dependencies = [
- "proc-macro-crate",
+ "proc-macro-crate 1.3.1",
"proc-macro2",
"quote",
"syn 1.0.107",
@@ -875,6 +1115,17 @@ dependencies = [
"spki",
]
+[[package]]
+name = "poly1305"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf"
+dependencies = [
+ "cpufeatures",
+ "opaque-debug",
+ "universal-hash",
+]
+
[[package]]
name = "ppv-lite86"
version = "0.2.17"
@@ -892,12 +1143,13 @@ dependencies = [
[[package]]
name = "primitive-types"
-version = "0.12.1"
+version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66"
+checksum = "05e4722c697a58a99d5d06a08c30821d7c082a4632198de1eaa5a6c22ef42373"
dependencies = [
"fixed-hash",
"impl-codec",
+ "impl-serde",
"uint",
]
@@ -908,14 +1160,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919"
dependencies = [
"once_cell",
- "toml_edit",
+ "toml_edit 0.19.11",
+]
+
+[[package]]
+name = "proc-macro-crate"
+version = "3.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284"
+dependencies = [
+ "toml_edit 0.21.1",
+]
+
+[[package]]
+name = "proc-macro-error"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
+dependencies = [
+ "proc-macro-error-attr",
+ "proc-macro2",
+ "quote",
+ "version_check",
+]
+
+[[package]]
+name = "proc-macro-error-attr"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "version_check",
]
[[package]]
name = "proc-macro2"
-version = "1.0.56"
+version = "1.0.67"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435"
+checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328"
dependencies = [
"unicode-ident",
]
@@ -937,18 +1221,18 @@ dependencies = [
[[package]]
name = "quote"
-version = "1.0.26"
+version = "1.0.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"
+checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
dependencies = [
"proc-macro2",
]
[[package]]
name = "radium"
-version = "0.7.0"
+version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
+checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb"
[[package]]
name = "rand"
@@ -958,7 +1242,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
"rand_chacha",
- "rand_core 0.6.4",
+ "rand_core",
]
[[package]]
@@ -968,16 +1252,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
- "rand_core 0.6.4",
-]
-
-[[package]]
-name = "rand_core"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
-dependencies = [
- "getrandom 0.1.16",
+ "rand_core",
]
[[package]]
@@ -986,7 +1261,7 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
- "getrandom 0.2.9",
+ "getrandom",
]
[[package]]
@@ -1036,21 +1311,6 @@ dependencies = [
"subtle",
]
-[[package]]
-name = "ring"
-version = "0.16.20"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc"
-dependencies = [
- "cc",
- "libc",
- "once_cell",
- "spin",
- "untrusted",
- "web-sys",
- "winapi",
-]
-
[[package]]
name = "ripemd"
version = "0.1.3"
@@ -1085,12 +1345,27 @@ dependencies = [
"semver",
]
+[[package]]
+name = "rustversion"
+version = "1.0.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
+
[[package]]
name = "ryu"
version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
+[[package]]
+name = "salsa20"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213"
+dependencies = [
+ "cipher",
+]
+
[[package]]
name = "sec1"
version = "0.7.1"
@@ -1133,38 +1408,38 @@ checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
[[package]]
name = "serde"
-version = "1.0.164"
+version = "1.0.189"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d"
+checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_bytes"
-version = "0.11.9"
+version = "0.11.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "416bda436f9aab92e02c8e10d49a15ddd339cea90b6e340fe51ed97abb548294"
+checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff"
dependencies = [
"serde",
]
[[package]]
name = "serde_derive"
-version = "1.0.164"
+version = "1.0.189"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68"
+checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.15",
+ "syn 2.0.37",
]
[[package]]
name = "serde_json"
-version = "1.0.96"
+version = "1.0.108"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1"
+checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
dependencies = [
"itoa",
"ryu",
@@ -1172,27 +1447,25 @@ dependencies = [
]
[[package]]
-name = "sha1"
-version = "0.10.5"
+name = "serde_repr"
+version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3"
+checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145"
dependencies = [
- "cfg-if",
- "cpufeatures",
- "digest 0.10.6",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.37",
]
[[package]]
-name = "sha2"
-version = "0.9.9"
+name = "sha1"
+version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800"
+checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3"
dependencies = [
- "block-buffer 0.9.0",
"cfg-if",
"cpufeatures",
- "digest 0.9.0",
- "opaque-debug",
+ "digest 0.10.6",
]
[[package]]
@@ -1223,15 +1496,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500"
dependencies = [
"digest 0.10.6",
- "rand_core 0.6.4",
+ "rand_core",
]
-[[package]]
-name = "spin"
-version = "0.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
-
[[package]]
name = "spki"
version = "0.7.1"
@@ -1255,7 +1522,7 @@ dependencies = [
"num-integer",
"num-traits",
"rfc6979",
- "sha2 0.10.6",
+ "sha2",
"starknet-crypto-codegen",
"starknet-curve",
"starknet-ff",
@@ -1270,7 +1537,7 @@ checksum = "e6dc88f1f470d9de1001ffbb90d2344c9dd1a615f5467daf0574e2975dfd9ebd"
dependencies = [
"starknet-curve",
"starknet-ff",
- "syn 2.0.15",
+ "syn 2.0.37",
]
[[package]]
@@ -1291,7 +1558,7 @@ dependencies = [
"ark-ff",
"bigdecimal",
"crypto-bigint",
- "getrandom 0.2.9",
+ "getrandom",
"hex",
"serde",
]
@@ -1308,6 +1575,25 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
+[[package]]
+name = "strum"
+version = "0.25.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125"
+
+[[package]]
+name = "strum_macros"
+version = "0.25.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0"
+dependencies = [
+ "heck",
+ "proc-macro2",
+ "quote",
+ "rustversion",
+ "syn 2.0.37",
+]
+
[[package]]
name = "subtle"
version = "2.4.1"
@@ -1327,9 +1613,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.15"
+version = "2.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822"
+checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8"
dependencies = [
"proc-macro2",
"quote",
@@ -1337,15 +1623,15 @@ dependencies = [
]
[[package]]
-name = "synstructure"
-version = "0.12.6"
+name = "syn_derive"
+version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
+checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b"
dependencies = [
+ "proc-macro-error",
"proc-macro2",
"quote",
- "syn 1.0.107",
- "unicode-xid",
+ "syn 2.0.37",
]
[[package]]
@@ -1394,9 +1680,9 @@ dependencies = [
[[package]]
name = "toml_datetime"
-version = "0.6.3"
+version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b"
+checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
[[package]]
name = "toml_edit"
@@ -1406,24 +1692,94 @@ checksum = "266f016b7f039eec8a1a80dfe6156b633d208b9fccca5e4db1d6775b0c4e34a7"
dependencies = [
"indexmap",
"toml_datetime",
- "winnow",
+ "winnow 0.4.7",
+]
+
+[[package]]
+name = "toml_edit"
+version = "0.21.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1"
+dependencies = [
+ "indexmap",
+ "toml_datetime",
+ "winnow 0.5.40",
]
[[package]]
name = "tw_any_coin"
version = "0.1.0"
dependencies = [
- "tw_any_coin",
"tw_coin_entry",
"tw_coin_registry",
"tw_encoding",
+ "tw_hash",
"tw_keypair",
"tw_memory",
"tw_misc",
+ "tw_proto",
+]
+
+[[package]]
+name = "tw_aptos"
+version = "0.1.0"
+dependencies = [
+ "move-core-types",
+ "serde",
+ "serde_bytes",
+ "serde_json",
+ "tw_coin_entry",
+ "tw_encoding",
+ "tw_hash",
+ "tw_keypair",
+ "tw_memory",
"tw_number",
"tw_proto",
]
+[[package]]
+name = "tw_base58_address"
+version = "0.1.0"
+dependencies = [
+ "serde",
+ "tw_coin_entry",
+ "tw_encoding",
+ "tw_hash",
+]
+
+[[package]]
+name = "tw_bech32_address"
+version = "0.1.0"
+dependencies = [
+ "serde",
+ "tw_coin_entry",
+ "tw_encoding",
+ "tw_hash",
+ "tw_keypair",
+ "tw_memory",
+]
+
+[[package]]
+name = "tw_binance"
+version = "0.1.0"
+dependencies = [
+ "quick-protobuf",
+ "serde",
+ "serde_json",
+ "serde_repr",
+ "strum_macros",
+ "tw_bech32_address",
+ "tw_coin_entry",
+ "tw_cosmos_sdk",
+ "tw_encoding",
+ "tw_evm",
+ "tw_hash",
+ "tw_keypair",
+ "tw_memory",
+ "tw_misc",
+ "tw_proto",
+]
+
[[package]]
name = "tw_bitcoin"
version = "0.1.0"
@@ -1432,21 +1788,27 @@ dependencies = [
"secp256k1",
"serde",
"serde_json",
+ "tw_base58_address",
+ "tw_bech32_address",
"tw_coin_entry",
"tw_encoding",
+ "tw_hash",
"tw_keypair",
"tw_memory",
"tw_misc",
"tw_proto",
"tw_utxo",
- "wallet-core-rs",
]
[[package]]
name = "tw_coin_entry"
version = "0.1.0"
dependencies = [
+ "derivation-path",
+ "serde",
"serde_json",
+ "tw_encoding",
+ "tw_hash",
"tw_keypair",
"tw_memory",
"tw_misc",
@@ -1458,27 +1820,78 @@ dependencies = [
name = "tw_coin_registry"
version = "0.1.0"
dependencies = [
+ "itertools",
"lazy_static",
"serde",
"serde_json",
+ "strum",
+ "strum_macros",
+ "tw_aptos",
+ "tw_binance",
"tw_bitcoin",
"tw_coin_entry",
+ "tw_cosmos",
"tw_ethereum",
"tw_evm",
+ "tw_greenfield",
+ "tw_hash",
+ "tw_internet_computer",
"tw_keypair",
"tw_memory",
"tw_misc",
+ "tw_native_evmos",
+ "tw_native_injective",
"tw_ronin",
+ "tw_solana",
+ "tw_sui",
+ "tw_thorchain",
+ "tw_ton",
+ "tw_utxo",
+]
+
+[[package]]
+name = "tw_cosmos"
+version = "0.1.0"
+dependencies = [
+ "tw_coin_entry",
+ "tw_cosmos_sdk",
+ "tw_keypair",
+ "tw_proto",
+]
+
+[[package]]
+name = "tw_cosmos_sdk"
+version = "0.1.0"
+dependencies = [
+ "pb-rs",
+ "quick-protobuf",
+ "serde",
+ "serde_json",
+ "tw_bech32_address",
+ "tw_coin_entry",
+ "tw_cosmos_sdk",
+ "tw_encoding",
+ "tw_hash",
+ "tw_keypair",
+ "tw_memory",
+ "tw_misc",
+ "tw_number",
+ "tw_proto",
]
[[package]]
name = "tw_encoding"
version = "0.1.0"
dependencies = [
- "arbitrary",
+ "arbitrary 1.3.0",
+ "bcs",
+ "bech32",
"bs58",
+ "ciborium",
"data-encoding",
"hex",
+ "serde",
+ "serde_bytes",
"tw_memory",
]
@@ -1513,11 +1926,29 @@ dependencies = [
"tw_proto",
]
+[[package]]
+name = "tw_greenfield"
+version = "0.1.0"
+dependencies = [
+ "serde",
+ "serde_json",
+ "tw_coin_entry",
+ "tw_cosmos_sdk",
+ "tw_encoding",
+ "tw_evm",
+ "tw_hash",
+ "tw_keypair",
+ "tw_memory",
+ "tw_misc",
+ "tw_number",
+ "tw_proto",
+]
+
[[package]]
name = "tw_hash"
version = "0.1.0"
dependencies = [
- "arbitrary",
+ "arbitrary 1.3.0",
"blake-hash",
"blake2b-ref",
"digest 0.10.6",
@@ -1527,35 +1958,55 @@ dependencies = [
"serde",
"serde_json",
"sha1",
- "sha2 0.10.6",
+ "sha2",
"sha3",
"tw_encoding",
"tw_memory",
"zeroize",
]
+[[package]]
+name = "tw_internet_computer"
+version = "0.1.0"
+dependencies = [
+ "pb-rs",
+ "quick-protobuf",
+ "serde",
+ "tw_coin_entry",
+ "tw_encoding",
+ "tw_hash",
+ "tw_keypair",
+ "tw_memory",
+ "tw_proto",
+]
+
[[package]]
name = "tw_keypair"
version = "0.1.0"
dependencies = [
- "arbitrary",
+ "arbitrary 1.3.0",
+ "bitcoin",
"blake2",
+ "crypto_box",
"curve25519-dalek",
"der",
- "digest 0.9.0",
+ "digest 0.10.6",
"ecdsa",
"k256",
"lazy_static",
"p256",
+ "pkcs8",
+ "rand_core",
"rfc6979",
- "ring",
+ "secp256k1",
"serde",
"serde_json",
- "sha2 0.9.9",
+ "sha2",
"starknet-crypto",
"starknet-ff",
"tw_encoding",
"tw_hash",
+ "tw_keypair",
"tw_memory",
"tw_misc",
"zeroize",
@@ -1569,24 +2020,40 @@ version = "0.1.0"
name = "tw_misc"
version = "0.1.0"
dependencies = [
+ "serde",
+ "serde_json",
"zeroize",
]
[[package]]
-name = "tw_move_parser"
+name = "tw_native_evmos"
version = "0.1.0"
dependencies = [
- "bcs",
- "hex",
- "move-core-types",
+ "tw_coin_entry",
+ "tw_cosmos_sdk",
+ "tw_hash",
+ "tw_keypair",
+ "tw_memory",
+ "tw_proto",
+]
+
+[[package]]
+name = "tw_native_injective"
+version = "0.1.0"
+dependencies = [
+ "tw_coin_entry",
+ "tw_cosmos_sdk",
+ "tw_hash",
+ "tw_keypair",
"tw_memory",
+ "tw_proto",
]
[[package]]
name = "tw_number"
version = "0.1.0"
dependencies = [
- "arbitrary",
+ "arbitrary 1.3.0",
"lazy_static",
"primitive-types",
"serde",
@@ -1599,11 +2066,9 @@ dependencies = [
name = "tw_proto"
version = "0.1.0"
dependencies = [
- "arbitrary",
+ "arbitrary 1.3.0",
"pb-rs",
"quick-protobuf",
- "tw_encoding",
- "tw_memory",
]
[[package]]
@@ -1619,16 +2084,127 @@ dependencies = [
"tw_proto",
]
+[[package]]
+name = "tw_solana"
+version = "0.1.0"
+dependencies = [
+ "bincode",
+ "borsh",
+ "lazy_static",
+ "serde",
+ "serde_json",
+ "tw_coin_entry",
+ "tw_encoding",
+ "tw_hash",
+ "tw_keypair",
+ "tw_memory",
+ "tw_proto",
+]
+
+[[package]]
+name = "tw_sui"
+version = "0.1.0"
+dependencies = [
+ "indexmap",
+ "move-core-types",
+ "serde",
+ "serde_repr",
+ "tw_coin_entry",
+ "tw_encoding",
+ "tw_hash",
+ "tw_keypair",
+ "tw_memory",
+ "tw_proto",
+]
+
+[[package]]
+name = "tw_tests"
+version = "0.1.0"
+dependencies = [
+ "serde",
+ "serde_json",
+ "tw_any_coin",
+ "tw_coin_entry",
+ "tw_coin_registry",
+ "tw_cosmos_sdk",
+ "tw_encoding",
+ "tw_hash",
+ "tw_keypair",
+ "tw_memory",
+ "tw_misc",
+ "tw_number",
+ "tw_proto",
+ "tw_solana",
+ "tw_ton",
+ "tw_ton_sdk",
+ "tw_utxo",
+ "wallet-core-rs",
+]
+
+[[package]]
+name = "tw_thorchain"
+version = "0.1.0"
+dependencies = [
+ "tw_coin_entry",
+ "tw_cosmos_sdk",
+ "tw_keypair",
+ "tw_memory",
+ "tw_proto",
+]
+
+[[package]]
+name = "tw_ton"
+version = "0.1.0"
+dependencies = [
+ "lazy_static",
+ "tw_coin_entry",
+ "tw_encoding",
+ "tw_hash",
+ "tw_keypair",
+ "tw_memory",
+ "tw_misc",
+ "tw_number",
+ "tw_proto",
+ "tw_ton_sdk",
+]
+
+[[package]]
+name = "tw_ton_sdk"
+version = "0.1.0"
+dependencies = [
+ "bitreader",
+ "bitstream-io",
+ "crc",
+ "lazy_static",
+ "num-bigint",
+ "serde",
+ "serde_json",
+ "tw_coin_entry",
+ "tw_encoding",
+ "tw_hash",
+ "tw_keypair",
+ "tw_memory",
+ "tw_number",
+]
+
[[package]]
name = "tw_utxo"
version = "0.1.0"
dependencies = [
+ "bech32",
"bitcoin",
+ "byteorder",
+ "itertools",
"secp256k1",
+ "strum_macros",
+ "tw_base58_address",
+ "tw_bech32_address",
"tw_coin_entry",
"tw_encoding",
+ "tw_hash",
"tw_keypair",
"tw_memory",
+ "tw_misc",
"tw_proto",
]
@@ -1644,7 +2220,7 @@ version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52"
dependencies = [
- "arbitrary",
+ "arbitrary 1.3.0",
"byteorder",
"crunchy",
"hex",
@@ -1664,16 +2240,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
[[package]]
-name = "unicode-xid"
-version = "0.2.4"
+name = "universal-hash"
+version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
+checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea"
+dependencies = [
+ "crypto-common",
+ "subtle",
+]
[[package]]
-name = "untrusted"
-version = "0.7.1"
+name = "uuid"
+version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
+checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a"
+dependencies = [
+ "getrandom",
+]
[[package]]
name = "vec_map"
@@ -1691,10 +2274,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
name = "wallet-core-rs"
version = "0.1.0"
dependencies = [
- "serde_json",
+ "bitreader",
"tw_any_coin",
"tw_bitcoin",
- "tw_coin_entry",
"tw_coin_registry",
"tw_encoding",
"tw_ethereum",
@@ -1702,16 +2284,21 @@ dependencies = [
"tw_keypair",
"tw_memory",
"tw_misc",
- "tw_move_parser",
"tw_number",
"tw_proto",
+ "tw_solana",
+ "tw_ton",
+ "uuid",
]
[[package]]
-name = "wasi"
-version = "0.9.0+wasi-snapshot-preview1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
+name = "wallet_core_bin"
+version = "0.1.0"
+dependencies = [
+ "serde",
+ "serde_json",
+ "tw_coin_registry",
+]
[[package]]
name = "wasi"
@@ -1773,16 +2360,6 @@ version = "0.2.84"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d"
-[[package]]
-name = "web-sys"
-version = "0.3.61"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97"
-dependencies = [
- "js-sys",
- "wasm-bindgen",
-]
-
[[package]]
name = "winapi"
version = "0.3.9"
@@ -1824,31 +2401,36 @@ dependencies = [
]
[[package]]
-name = "wyz"
-version = "0.5.1"
+name = "winnow"
+version = "0.5.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed"
+checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"
dependencies = [
- "tap",
+ "memchr",
]
+[[package]]
+name = "wyz"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214"
+
[[package]]
name = "zeroize"
-version = "1.6.0"
+version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9"
+checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"
dependencies = [
"zeroize_derive",
]
[[package]]
name = "zeroize_derive"
-version = "1.3.3"
+version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c"
+checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69"
dependencies = [
"proc-macro2",
"quote",
- "syn 1.0.107",
- "synstructure",
+ "syn 2.0.37",
]
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index b8fdf347fca..ca41fb6099d 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -1,24 +1,45 @@
[workspace]
members = [
+ "chains/tw_aptos",
+ "chains/tw_binance",
+ "chains/tw_bitcoin",
+ "chains/tw_cosmos",
+ "chains/tw_ethereum",
+ "chains/tw_greenfield",
+ "chains/tw_internet_computer",
+ "chains/tw_native_evmos",
+ "chains/tw_native_injective",
+ "chains/tw_ronin",
+ "chains/tw_solana",
+ "chains/tw_sui",
+ "chains/tw_thorchain",
+ "chains/tw_ton",
+ "frameworks/tw_ton_sdk",
+ "frameworks/tw_utxo",
"tw_any_coin",
- "tw_bitcoin",
+ "tw_base58_address",
+ "tw_bech32_address",
"tw_coin_entry",
"tw_coin_registry",
+ "tw_cosmos_sdk",
"tw_encoding",
- "tw_ethereum",
"tw_evm",
"tw_hash",
"tw_keypair",
"tw_memory",
"tw_misc",
- "tw_move_parser",
"tw_number",
"tw_proto",
- "tw_ronin",
- "tw_utxo",
+ "tw_tests",
+ "wallet_core_bin",
"wallet_core_rs",
]
+[profile.release]
+strip = true
+codegen-units = 1
+panic = "abort"
+
[profile.wasm-test]
inherits = "release"
# Fixes an incredibly slow compilation of `curve25519-dalek` package.
diff --git a/rust/chains/tw_aptos/Cargo.toml b/rust/chains/tw_aptos/Cargo.toml
new file mode 100644
index 00000000000..d78b0e3c644
--- /dev/null
+++ b/rust/chains/tw_aptos/Cargo.toml
@@ -0,0 +1,22 @@
+[package]
+name = "tw_aptos"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+serde_json = "1.0"
+tw_coin_entry = { path = "../../tw_coin_entry" }
+tw_encoding = { path = "../../tw_encoding" }
+tw_keypair = { path = "../../tw_keypair" }
+tw_proto = { path = "../../tw_proto" }
+tw_number = { path = "../../tw_number" }
+tw_hash = { path = "../../tw_hash" }
+tw_memory = { path = "../../tw_memory" }
+move-core-types = { git = "https://github.com/move-language/move", rev = "ea70797099baea64f05194a918cebd69ed02b285", features = ["address32"] }
+serde = { version = "1.0", features = ["derive"] }
+serde_bytes = "0.11.12"
+
+[dev-dependencies]
+tw_coin_entry = { path = "../../tw_coin_entry", features = ["test-utils"] }
+tw_encoding = { path = "../../tw_encoding" }
+tw_number = { path = "../../tw_number", features = ["helpers"] }
diff --git a/rust/chains/tw_aptos/fuzz/.gitignore b/rust/chains/tw_aptos/fuzz/.gitignore
new file mode 100644
index 00000000000..5c404b9583f
--- /dev/null
+++ b/rust/chains/tw_aptos/fuzz/.gitignore
@@ -0,0 +1,5 @@
+target
+corpus
+artifacts
+coverage
+Cargo.lock
diff --git a/rust/chains/tw_aptos/fuzz/Cargo.toml b/rust/chains/tw_aptos/fuzz/Cargo.toml
new file mode 100644
index 00000000000..721a84b3ab9
--- /dev/null
+++ b/rust/chains/tw_aptos/fuzz/Cargo.toml
@@ -0,0 +1,28 @@
+[package]
+name = "tw_aptos-fuzz"
+version = "0.0.0"
+publish = false
+edition = "2021"
+
+[package.metadata]
+cargo-fuzz = true
+
+[dependencies]
+libfuzzer-sys = "0.4"
+tw_proto = { path = "../../tw_proto", features = ["fuzz"] }
+
+[dependencies.tw_aptos]
+path = ".."
+
+# Prevent this from interfering with workspaces
+[workspace]
+members = ["."]
+
+[profile.release]
+debug = 1
+
+[[bin]]
+name = "sign"
+path = "fuzz_targets/sign.rs"
+test = false
+doc = false
diff --git a/rust/chains/tw_aptos/fuzz/fuzz_targets/sign.rs b/rust/chains/tw_aptos/fuzz/fuzz_targets/sign.rs
new file mode 100644
index 00000000000..5d55e467d14
--- /dev/null
+++ b/rust/chains/tw_aptos/fuzz/fuzz_targets/sign.rs
@@ -0,0 +1,9 @@
+#![no_main]
+
+use libfuzzer_sys::fuzz_target;
+use tw_aptos::signer::Signer;
+use tw_proto::Aptos::Proto;
+
+fuzz_target!(|input: Proto::SigningInput<'_>| {
+ let _ = Signer::sign_proto(input);
+});
diff --git a/rust/chains/tw_aptos/src/address.rs b/rust/chains/tw_aptos/src/address.rs
new file mode 100644
index 00000000000..3915750c625
--- /dev/null
+++ b/rust/chains/tw_aptos/src/address.rs
@@ -0,0 +1,122 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use move_core_types::account_address::{AccountAddress, AccountAddressParseError};
+use std::fmt::{Display, Formatter};
+use std::str::FromStr;
+use tw_coin_entry::coin_entry::CoinAddress;
+use tw_coin_entry::error::prelude::*;
+use tw_hash::sha3::sha3_256;
+use tw_keypair::ed25519;
+use tw_memory::Data;
+
+#[repr(u8)]
+pub enum Scheme {
+ Ed25519 = 0,
+}
+
+#[derive(Clone)]
+pub struct Address {
+ addr: AccountAddress,
+}
+
+impl Address {
+ pub const LENGTH: usize = AccountAddress::LENGTH;
+
+ /// Initializes an address with a `ed25519` public key.
+ pub fn with_ed25519_pubkey(
+ pubkey: &ed25519::sha512::PublicKey,
+ ) -> Result {
+ let mut to_hash = pubkey.as_slice().to_vec();
+ to_hash.push(Scheme::Ed25519 as u8);
+ let hashed = sha3_256(to_hash.as_slice());
+ let addr = AccountAddress::from_bytes(hashed).map_err(from_account_error)?;
+ Ok(Address { addr })
+ }
+
+ pub fn inner(&self) -> AccountAddress {
+ self.addr
+ }
+}
+
+impl Display for Address {
+ fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+ write!(f, "{}", self.addr.to_hex_literal())
+ }
+}
+
+impl CoinAddress for Address {
+ #[inline]
+ fn data(&self) -> Data {
+ self.addr.to_vec()
+ }
+}
+
+#[inline]
+pub fn from_account_error(_err: AccountAddressParseError) -> AddressError {
+ AddressError::InvalidInput
+}
+
+impl FromStr for Address {
+ type Err = AddressError;
+
+ // https://github.com/aptos-labs/aptos-core/blob/261019cbdafe1c514c60c2b74357ea2c77d25e67/types/src/account_address.rs#L44
+ fn from_str(s: &str) -> Result {
+ const NUM_CHARS: usize = AccountAddress::LENGTH * 2;
+ let mut has_0x = false;
+ let mut working = s.trim();
+
+ // Checks if it has a 0x at the beginning, which is okay
+ if working.starts_with("0x") {
+ has_0x = true;
+ working = &working[2..];
+ }
+
+ if working.len() > NUM_CHARS || (!has_0x && working.len() < NUM_CHARS) {
+ return Err(AddressError::InvalidInput);
+ }
+
+ if !working.chars().all(|c| char::is_ascii_hexdigit(&c)) {
+ return Err(AddressError::InvalidInput);
+ }
+
+ let addr = if has_0x {
+ AccountAddress::from_hex_literal(s.trim())
+ } else {
+ AccountAddress::from_str(s.trim())
+ }
+ .map_err(from_account_error)?;
+
+ Ok(Address { addr })
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use tw_keypair::ed25519::sha512::PrivateKey;
+
+ #[test]
+ fn test_from_public_key() {
+ let private = PrivateKey::try_from(
+ "afeefca74d9a325cf1d6b6911d61a65c32afa8e02bd5e78e2e4ac2910bab45f5",
+ )
+ .unwrap();
+ let public = private.public();
+ let addr = Address::with_ed25519_pubkey(&public);
+ assert_eq!(
+ addr.as_ref().unwrap().to_string(),
+ "0x9006fa46f038224e8004bdda97f2e7a60c2c3d135bce7cb15541e5c0aae907a4"
+ );
+ assert_eq!(addr.unwrap().data().len(), Address::LENGTH);
+ }
+
+ #[test]
+ fn test_from_account_error() {
+ assert_eq!(
+ from_account_error(AccountAddressParseError {}),
+ AddressError::InvalidInput
+ );
+ }
+}
diff --git a/rust/chains/tw_aptos/src/aptos_move_packages.rs b/rust/chains/tw_aptos/src/aptos_move_packages.rs
new file mode 100644
index 00000000000..e90e6bf2a4b
--- /dev/null
+++ b/rust/chains/tw_aptos/src/aptos_move_packages.rs
@@ -0,0 +1,207 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::transaction_payload::{EntryFunction, TransactionPayload};
+use move_core_types::account_address::AccountAddress;
+use move_core_types::ident_str;
+use move_core_types::language_storage::{ModuleId, TypeTag};
+use serde_json::json;
+use tw_coin_entry::error::prelude::*;
+use tw_encoding::bcs;
+
+pub fn aptos_account_transfer(
+ to: AccountAddress,
+ amount: u64,
+) -> SigningResult {
+ Ok(TransactionPayload::EntryFunction(EntryFunction::new(
+ ModuleId::new(
+ AccountAddress::new([
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1,
+ ]),
+ ident_str!("aptos_account").to_owned(),
+ ),
+ ident_str!("transfer").to_owned(),
+ vec![],
+ vec![bcs::encode(&to)?, bcs::encode(&amount)?],
+ json!([to.to_hex_literal(), amount.to_string()]),
+ )))
+}
+
+pub fn aptos_account_create_account(auth_key: AccountAddress) -> SigningResult {
+ Ok(TransactionPayload::EntryFunction(EntryFunction::new(
+ ModuleId::new(
+ AccountAddress::new([
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1,
+ ]),
+ ident_str!("aptos_account").to_owned(),
+ ),
+ ident_str!("create_account").to_owned(),
+ vec![],
+ vec![bcs::encode(&auth_key)?],
+ json!([auth_key.to_hex_literal()]),
+ )))
+}
+
+pub fn coin_transfer(
+ coin_type: TypeTag,
+ to: AccountAddress,
+ amount: u64,
+) -> SigningResult {
+ Ok(TransactionPayload::EntryFunction(EntryFunction::new(
+ ModuleId::new(
+ AccountAddress::new([
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1,
+ ]),
+ ident_str!("coin").to_owned(),
+ ),
+ ident_str!("transfer").to_owned(),
+ vec![coin_type],
+ vec![bcs::encode(&to)?, bcs::encode(&amount)?],
+ json!([to.to_hex_literal(), amount.to_string()]),
+ )))
+}
+
+pub fn aptos_account_transfer_coins(
+ coin_type: TypeTag,
+ to: AccountAddress,
+ amount: u64,
+) -> SigningResult {
+ Ok(TransactionPayload::EntryFunction(EntryFunction::new(
+ ModuleId::new(
+ AccountAddress::new([
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1,
+ ]),
+ ident_str!("aptos_account").to_owned(),
+ ),
+ ident_str!("transfer_coins").to_owned(),
+ vec![coin_type],
+ vec![bcs::encode(&to)?, bcs::encode(&amount)?],
+ json!([to.to_hex_literal(), amount.to_string()]),
+ )))
+}
+
+pub fn token_transfers_offer_script(
+ receiver: AccountAddress,
+ creator: AccountAddress,
+ collection: Vec,
+ name: Vec,
+ property_version: u64,
+ amount: u64,
+) -> SigningResult {
+ Ok(TransactionPayload::EntryFunction(EntryFunction::new(
+ ModuleId::new(
+ AccountAddress::new([
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 3,
+ ]),
+ ident_str!("token_transfers").to_owned(),
+ ),
+ ident_str!("offer_script").to_owned(),
+ vec![],
+ vec![
+ bcs::encode(&receiver)?,
+ bcs::encode(&creator)?,
+ bcs::encode(&collection)?,
+ bcs::encode(&name)?,
+ bcs::encode(&property_version)?,
+ bcs::encode(&amount)?,
+ ],
+ json!([
+ receiver.to_hex_literal(),
+ creator.to_hex_literal(),
+ String::from_utf8_lossy(&collection),
+ String::from_utf8_lossy(&name),
+ property_version.to_string(),
+ amount.to_string()
+ ]),
+ )))
+}
+
+pub fn token_transfers_cancel_offer_script(
+ receiver: AccountAddress,
+ creator: AccountAddress,
+ collection: Vec,
+ name: Vec,
+ property_version: u64,
+) -> SigningResult {
+ Ok(TransactionPayload::EntryFunction(EntryFunction::new(
+ ModuleId::new(
+ AccountAddress::new([
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 3,
+ ]),
+ ident_str!("token_transfers").to_owned(),
+ ),
+ ident_str!("cancel_offer_script").to_owned(),
+ vec![],
+ vec![
+ bcs::encode(&receiver)?,
+ bcs::encode(&creator)?,
+ bcs::encode(&collection)?,
+ bcs::encode(&name)?,
+ bcs::encode(&property_version)?,
+ ],
+ json!([
+ receiver.to_hex_literal(),
+ creator.to_hex_literal(),
+ String::from_utf8_lossy(&collection),
+ String::from_utf8_lossy(&name),
+ property_version.to_string()
+ ]),
+ )))
+}
+
+pub fn token_transfers_claim_script(
+ sender: AccountAddress,
+ creator: AccountAddress,
+ collection: Vec,
+ name: Vec,
+ property_version: u64,
+) -> SigningResult {
+ Ok(TransactionPayload::EntryFunction(EntryFunction::new(
+ ModuleId::new(
+ AccountAddress::new([
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 3,
+ ]),
+ ident_str!("token_transfers").to_owned(),
+ ),
+ ident_str!("claim_script").to_owned(),
+ vec![],
+ vec![
+ bcs::encode(&sender)?,
+ bcs::encode(&creator)?,
+ bcs::encode(&collection)?,
+ bcs::encode(&name)?,
+ bcs::encode(&property_version)?,
+ ],
+ json!([
+ sender.to_hex_literal(),
+ creator.to_hex_literal(),
+ String::from_utf8_lossy(&collection),
+ String::from_utf8_lossy(&name),
+ property_version.to_string()
+ ]),
+ )))
+}
+
+pub fn managed_coin_register(coin_type: TypeTag) -> TransactionPayload {
+ TransactionPayload::EntryFunction(EntryFunction::new(
+ ModuleId::new(
+ AccountAddress::new([
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1,
+ ]),
+ ident_str!("managed_coin").to_owned(),
+ ),
+ ident_str!("register").to_owned(),
+ vec![coin_type],
+ vec![],
+ json!([]),
+ ))
+}
diff --git a/rust/chains/tw_aptos/src/compiler.rs b/rust/chains/tw_aptos/src/compiler.rs
new file mode 100644
index 00000000000..53b9df11bd4
--- /dev/null
+++ b/rust/chains/tw_aptos/src/compiler.rs
@@ -0,0 +1,76 @@
+use crate::address::Address;
+use crate::transaction_builder;
+use std::str::FromStr;
+use tw_coin_entry::coin_entry::{PublicKeyBytes, SignatureBytes};
+use tw_coin_entry::error::prelude::*;
+use tw_coin_entry::signing_output_error;
+use tw_proto::Aptos::Proto;
+use tw_proto::TxCompiler::Proto as CompilerProto;
+
+pub struct Compiler;
+
+impl Compiler {
+ #[inline]
+ pub fn preimage_hashes(
+ input: Proto::SigningInput<'_>,
+ ) -> CompilerProto::PreSigningOutput<'static> {
+ Self::preimage_hashes_impl(input)
+ .unwrap_or_else(|e| signing_output_error!(CompilerProto::PreSigningOutput, e))
+ }
+
+ fn preimage_hashes_impl(
+ input: Proto::SigningInput<'_>,
+ ) -> SigningResult> {
+ let builder = transaction_builder::TransactionFactory::new_from_protobuf(input.clone())?;
+ let sender = Address::from_str(&input.sender)
+ .into_tw()
+ .context("Invalid sender address")?;
+ let signed_tx = builder
+ .sender(sender.inner())
+ .sequence_number(input.sequence_number as u64)
+ .build()?
+ .pre_image()?;
+ Ok(CompilerProto::PreSigningOutput {
+ data: signed_tx.into(),
+ ..CompilerProto::PreSigningOutput::default()
+ })
+ }
+
+ #[inline]
+ pub fn compile(
+ input: Proto::SigningInput<'_>,
+ signatures: Vec,
+ public_keys: Vec,
+ ) -> Proto::SigningOutput<'static> {
+ Self::compile_impl(input, signatures, public_keys)
+ .unwrap_or_else(|e| signing_output_error!(Proto::SigningOutput, e))
+ }
+
+ fn compile_impl(
+ input: Proto::SigningInput<'_>,
+ signatures: Vec,
+ public_keys: Vec,
+ ) -> SigningResult> {
+ let builder = transaction_builder::TransactionFactory::new_from_protobuf(input.clone())?;
+ let sender = Address::from_str(&input.sender)?;
+ let signature = signatures
+ .first()
+ .or_tw_err(SigningErrorType::Error_signatures_count)?;
+ let public_key = public_keys
+ .first()
+ .or_tw_err(SigningErrorType::Error_signatures_count)?;
+
+ let signed_tx = builder
+ .sender(sender.inner())
+ .sequence_number(input.sequence_number as u64)
+ .build()?
+ .compile(signature.to_vec(), public_key.to_vec())?;
+ Ok(Proto::SigningOutput {
+ raw_txn: signed_tx.raw_txn_bytes().clone().into(),
+ encoded: signed_tx.encoded().clone().into(),
+ authenticator: Some((*signed_tx.authenticator()).clone().into()),
+ json: signed_tx.to_json().to_string().into(),
+ ..Proto::SigningOutput::default()
+ })
+ }
+}
diff --git a/rust/chains/tw_aptos/src/constants.rs b/rust/chains/tw_aptos/src/constants.rs
new file mode 100644
index 00000000000..714c1a2f782
--- /dev/null
+++ b/rust/chains/tw_aptos/src/constants.rs
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+pub const GAS_UNIT_PRICE: u64 = 100;
+pub const MAX_GAS_AMOUNT: u64 = 100_000_000;
+pub const APTOS_SALT: &[u8] = b"APTOS::RawTransaction";
diff --git a/rust/chains/tw_aptos/src/entry.rs b/rust/chains/tw_aptos/src/entry.rs
new file mode 100644
index 00000000000..f9a46c55049
--- /dev/null
+++ b/rust/chains/tw_aptos/src/entry.rs
@@ -0,0 +1,112 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::address::Address;
+use crate::compiler::Compiler;
+use crate::modules::transaction_util::AptosTransactionUtil;
+use crate::signer::Signer;
+use std::str::FromStr;
+use tw_coin_entry::coin_context::CoinContext;
+use tw_coin_entry::coin_entry::{CoinEntry, PublicKeyBytes, SignatureBytes};
+use tw_coin_entry::derivation::Derivation;
+use tw_coin_entry::error::prelude::*;
+use tw_coin_entry::modules::json_signer::NoJsonSigner;
+use tw_coin_entry::modules::message_signer::NoMessageSigner;
+use tw_coin_entry::modules::plan_builder::NoPlanBuilder;
+use tw_coin_entry::modules::transaction_decoder::NoTransactionDecoder;
+use tw_coin_entry::modules::wallet_connector::NoWalletConnector;
+use tw_coin_entry::prefix::NoPrefix;
+use tw_keypair::tw::PublicKey;
+use tw_proto::Aptos::Proto;
+use tw_proto::TxCompiler::Proto as CompilerProto;
+
+pub struct AptosEntry;
+
+impl CoinEntry for AptosEntry {
+ type AddressPrefix = NoPrefix;
+ type Address = Address;
+ type SigningInput<'a> = Proto::SigningInput<'a>;
+ type SigningOutput = Proto::SigningOutput<'static>;
+ type PreSigningOutput = CompilerProto::PreSigningOutput<'static>;
+
+ // Optional modules:
+ type JsonSigner = NoJsonSigner;
+ type PlanBuilder = NoPlanBuilder;
+ type MessageSigner = NoMessageSigner;
+ type WalletConnector = NoWalletConnector;
+ type TransactionDecoder = NoTransactionDecoder;
+ type TransactionUtil = AptosTransactionUtil;
+
+ #[inline]
+ fn parse_address(
+ &self,
+ _coin: &dyn CoinContext,
+ address: &str,
+ _prefix: Option,
+ ) -> AddressResult {
+ Address::from_str(address)
+ }
+
+ #[inline]
+ fn parse_address_unchecked(
+ &self,
+ _coin: &dyn CoinContext,
+ address: &str,
+ ) -> AddressResult {
+ Address::from_str(address)
+ }
+
+ fn derive_address(
+ &self,
+ _coin: &dyn CoinContext,
+ public_key: PublicKey,
+ _derivation: Derivation,
+ _prefix: Option,
+ ) -> AddressResult {
+ let public_key = public_key
+ .to_ed25519()
+ .ok_or(AddressError::PublicKeyTypeMismatch)?;
+ Address::with_ed25519_pubkey(public_key)
+ }
+
+ #[inline]
+ fn sign(&self, _coin: &dyn CoinContext, input: Self::SigningInput<'_>) -> Self::SigningOutput {
+ Signer::sign_proto(input)
+ }
+
+ #[inline]
+ fn preimage_hashes(
+ &self,
+ _coin: &dyn CoinContext,
+ input: Self::SigningInput<'_>,
+ ) -> Self::PreSigningOutput {
+ Compiler::preimage_hashes(input)
+ }
+
+ #[inline]
+ fn compile(
+ &self,
+ _coin: &dyn CoinContext,
+ input: Self::SigningInput<'_>,
+ signatures: Vec,
+ public_keys: Vec,
+ ) -> Self::SigningOutput {
+ Compiler::compile(input, signatures, public_keys)
+ }
+
+ #[inline]
+ fn json_signer(&self) -> Option {
+ None
+ }
+
+ #[inline]
+ fn message_signer(&self) -> Option {
+ None
+ }
+
+ #[inline]
+ fn transaction_util(&self) -> Option {
+ Some(AptosTransactionUtil)
+ }
+}
diff --git a/rust/chains/tw_aptos/src/lib.rs b/rust/chains/tw_aptos/src/lib.rs
new file mode 100644
index 00000000000..5388e03f4e7
--- /dev/null
+++ b/rust/chains/tw_aptos/src/lib.rs
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+pub mod address;
+pub mod aptos_move_packages;
+pub mod constants;
+pub mod entry;
+mod serde_helper;
+
+pub mod nft;
+
+pub mod compiler;
+pub mod liquid_staking;
+pub mod modules;
+pub mod signer;
+pub mod transaction;
+pub mod transaction_builder;
+pub mod transaction_payload;
diff --git a/rust/chains/tw_aptos/src/liquid_staking.rs b/rust/chains/tw_aptos/src/liquid_staking.rs
new file mode 100644
index 00000000000..2ce311e4350
--- /dev/null
+++ b/rust/chains/tw_aptos/src/liquid_staking.rs
@@ -0,0 +1,158 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::address::from_account_error;
+use crate::transaction_payload::{EntryFunction, TransactionPayload};
+use move_core_types::{account_address::AccountAddress, ident_str, language_storage::ModuleId};
+use serde_json::json;
+use std::str::FromStr;
+use tw_coin_entry::error::prelude::*;
+use tw_encoding::bcs;
+use tw_proto::{
+ Aptos::Proto::mod_LiquidStaking::OneOfliquid_stake_transaction_payload,
+ Aptos::Proto::{LiquidStaking, TortugaClaim, TortugaStake, TortugaUnstake},
+};
+
+pub fn tortuga_stake(
+ smart_contract_address: AccountAddress,
+ amount: u64,
+) -> SigningResult {
+ Ok(TransactionPayload::EntryFunction(EntryFunction::new(
+ ModuleId::new(
+ smart_contract_address,
+ ident_str!("stake_router").to_owned(),
+ ),
+ ident_str!("stake").to_owned(),
+ vec![],
+ vec![bcs::encode(&amount)?],
+ json!([amount.to_string()]),
+ )))
+}
+
+pub fn tortuga_unstake(
+ smart_contract_address: AccountAddress,
+ amount: u64,
+) -> SigningResult {
+ Ok(TransactionPayload::EntryFunction(EntryFunction::new(
+ ModuleId::new(
+ smart_contract_address,
+ ident_str!("stake_router").to_owned(),
+ ),
+ ident_str!("unstake").to_owned(),
+ vec![],
+ vec![bcs::encode(&amount)?],
+ json!([amount.to_string()]),
+ )))
+}
+
+pub fn tortuga_claim(
+ smart_contract_address: AccountAddress,
+ idx: u64,
+) -> SigningResult {
+ Ok(TransactionPayload::EntryFunction(EntryFunction::new(
+ ModuleId::new(
+ smart_contract_address,
+ ident_str!("stake_router").to_owned(),
+ ),
+ ident_str!("claim").to_owned(),
+ vec![],
+ vec![bcs::encode(&idx)?],
+ json!([idx.to_string()]),
+ )))
+}
+
+pub struct Stake {
+ pub amount: u64,
+ pub smart_contract_address: AccountAddress,
+}
+
+pub struct Unstake {
+ pub amount: u64,
+ pub smart_contract_address: AccountAddress,
+}
+
+pub struct Claim {
+ pub idx: u64,
+ pub smart_contract_address: AccountAddress,
+}
+
+pub enum LiquidStakingOperation {
+ Stake(Stake),
+ Unstake(Unstake),
+ Claim(Claim),
+}
+
+impl TryFrom> for LiquidStakingOperation {
+ type Error = SigningError;
+
+ fn try_from(value: LiquidStaking) -> SigningResult {
+ match value.liquid_stake_transaction_payload {
+ OneOfliquid_stake_transaction_payload::stake(stake_msg) => {
+ let smart_contract_address =
+ AccountAddress::from_str(&value.smart_contract_address)
+ .map_err(from_account_error)
+ .into_tw()
+ .context("Invalid Smart Contract address")?;
+ Ok(LiquidStakingOperation::Stake(Stake {
+ amount: stake_msg.amount,
+ smart_contract_address,
+ }))
+ },
+ OneOfliquid_stake_transaction_payload::unstake(unstake_msg) => {
+ let smart_contract_address =
+ AccountAddress::from_str(&value.smart_contract_address)
+ .map_err(from_account_error)
+ .into_tw()
+ .context("Invalid Smart Contract address")?;
+ Ok(LiquidStakingOperation::Unstake(Unstake {
+ amount: unstake_msg.amount,
+ smart_contract_address,
+ }))
+ },
+ OneOfliquid_stake_transaction_payload::claim(claim) => {
+ let smart_contract_address =
+ AccountAddress::from_str(&value.smart_contract_address)
+ .map_err(from_account_error)
+ .into_tw()
+ .context("Invalid Smart Contract address")?;
+ Ok(LiquidStakingOperation::Claim(Claim {
+ idx: claim.idx,
+ smart_contract_address,
+ }))
+ },
+ OneOfliquid_stake_transaction_payload::None => {
+ SigningError::err(SigningErrorType::Error_invalid_params)
+ },
+ }
+ }
+}
+
+impl From for LiquidStaking<'_> {
+ fn from(value: LiquidStakingOperation) -> Self {
+ match value {
+ LiquidStakingOperation::Stake(stake) => LiquidStaking {
+ smart_contract_address: stake.smart_contract_address.to_hex_literal().into(),
+ liquid_stake_transaction_payload: OneOfliquid_stake_transaction_payload::stake(
+ TortugaStake {
+ amount: stake.amount,
+ },
+ ),
+ },
+ LiquidStakingOperation::Unstake(unstake) => LiquidStaking {
+ smart_contract_address: unstake.smart_contract_address.to_hex_literal().into(),
+ liquid_stake_transaction_payload: OneOfliquid_stake_transaction_payload::unstake(
+ TortugaUnstake {
+ amount: unstake.amount,
+ },
+ ),
+ },
+ LiquidStakingOperation::Claim(claim) => LiquidStaking {
+ smart_contract_address: claim.smart_contract_address.to_hex_literal().into(),
+ liquid_stake_transaction_payload: OneOfliquid_stake_transaction_payload::claim(
+ TortugaClaim { idx: claim.idx },
+ ),
+ },
+ }
+ }
+}
diff --git a/rust/chains/tw_aptos/src/modules/mod.rs b/rust/chains/tw_aptos/src/modules/mod.rs
new file mode 100644
index 00000000000..c083bb0102e
--- /dev/null
+++ b/rust/chains/tw_aptos/src/modules/mod.rs
@@ -0,0 +1,5 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+pub mod transaction_util;
diff --git a/rust/chains/tw_aptos/src/modules/transaction_util.rs b/rust/chains/tw_aptos/src/modules/transaction_util.rs
new file mode 100644
index 00000000000..6b7034477f8
--- /dev/null
+++ b/rust/chains/tw_aptos/src/modules/transaction_util.rs
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use tw_coin_entry::coin_context::CoinContext;
+use tw_coin_entry::error::prelude::*;
+use tw_coin_entry::modules::transaction_util::TransactionUtil;
+use tw_encoding::hex;
+use tw_hash::sha3::sha3_256;
+
+pub struct AptosTransactionUtil;
+
+impl TransactionUtil for AptosTransactionUtil {
+ fn calc_tx_hash(&self, coin: &dyn CoinContext, encoded_tx: &str) -> SigningResult {
+ Self::calc_tx_hash_impl(coin, encoded_tx)
+ }
+}
+
+impl AptosTransactionUtil {
+ fn calc_tx_hash_impl(_coin: &dyn CoinContext, encoded_tx: &str) -> SigningResult {
+ let txn_bytes = hex::decode(encoded_tx).map_err(|_| SigningErrorType::Error_input_parse)?;
+
+ // See: https://github.com/aptos-labs/aptos-ts-sdk/blob/f54cac824a41e41dea09c7a6916858a8604dc901/src/api/transaction.ts#L118
+ let prefix = sha3_256("APTOS::Transaction".as_bytes());
+
+ let mut hash_message = Vec::new();
+ hash_message.extend_from_slice(&prefix);
+ // 0 is the index of the enum `Transaction`, see: https://github.com/aptos-labs/aptos-core/blob/6a130c1cca274a5cfdb4a65b441cd5fe61b6c15b/types/src/transaction/mod.rs#L1939
+ hash_message.push(0);
+ hash_message.extend_from_slice(&txn_bytes);
+
+ let tx_hash = sha3_256(&hash_message);
+ Ok(hex::encode(tx_hash, true))
+ }
+}
diff --git a/rust/chains/tw_aptos/src/nft.rs b/rust/chains/tw_aptos/src/nft.rs
new file mode 100644
index 00000000000..172308b4ee2
--- /dev/null
+++ b/rust/chains/tw_aptos/src/nft.rs
@@ -0,0 +1,176 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::address::from_account_error;
+use move_core_types::account_address::AccountAddress;
+use std::str::FromStr;
+use tw_coin_entry::error::prelude::*;
+use tw_proto::Aptos::Proto::mod_NftMessage::OneOfnft_transaction_payload;
+use tw_proto::Aptos::Proto::{CancelOfferNftMessage, ClaimNftMessage, NftMessage, OfferNftMessage};
+
+pub struct Offer {
+ pub receiver: AccountAddress,
+ pub creator: AccountAddress,
+ pub collection: Vec,
+ pub name: Vec,
+ pub property_version: u64,
+ pub amount: u64,
+}
+
+pub struct Claim {
+ pub sender: AccountAddress,
+ pub creator: AccountAddress,
+ pub collection: Vec,
+ pub name: Vec,
+ pub property_version: u64,
+}
+
+pub enum NftOperation {
+ Claim(Claim),
+ Offer(Offer),
+ Cancel(Offer),
+}
+
+impl TryFrom> for NftOperation {
+ type Error = SigningError;
+
+ fn try_from(value: NftMessage) -> SigningResult {
+ match value.nft_transaction_payload {
+ OneOfnft_transaction_payload::offer_nft(msg) => {
+ Ok(NftOperation::Offer(Offer::try_from(msg)?))
+ },
+ OneOfnft_transaction_payload::cancel_offer_nft(msg) => {
+ Ok(NftOperation::Cancel(Offer::try_from(msg)?))
+ },
+ OneOfnft_transaction_payload::claim_nft(msg) => {
+ Ok(NftOperation::Claim(Claim::try_from(msg)?))
+ },
+ OneOfnft_transaction_payload::None => {
+ SigningError::err(SigningErrorType::Error_invalid_params)
+ .context("No transaction payload provided")
+ },
+ }
+ }
+}
+
+impl From for NftMessage<'_> {
+ fn from(value: NftOperation) -> Self {
+ match value {
+ NftOperation::Claim(claim) => NftMessage {
+ nft_transaction_payload: OneOfnft_transaction_payload::claim_nft(claim.into()),
+ },
+ NftOperation::Offer(offer) => NftMessage {
+ nft_transaction_payload: OneOfnft_transaction_payload::offer_nft(offer.into()),
+ },
+ NftOperation::Cancel(cancel) => NftMessage {
+ nft_transaction_payload: OneOfnft_transaction_payload::cancel_offer_nft(
+ cancel.into(),
+ ),
+ },
+ }
+ }
+}
+
+impl TryFrom> for Offer {
+ type Error = SigningError;
+
+ fn try_from(value: OfferNftMessage) -> SigningResult {
+ Ok(Offer {
+ receiver: AccountAddress::from_str(&value.receiver).map_err(from_account_error)?,
+ creator: AccountAddress::from_str(&value.creator).map_err(from_account_error)?,
+ collection: value.collectionName.as_bytes().to_vec(),
+ name: value.name.as_bytes().to_vec(),
+ property_version: value.property_version,
+ amount: value.amount,
+ })
+ }
+}
+
+impl From for OfferNftMessage<'_> {
+ fn from(value: Offer) -> Self {
+ OfferNftMessage {
+ receiver: value.receiver.to_hex_literal().into(),
+ creator: value.creator.to_hex_literal().into(),
+ collectionName: String::from_utf8_lossy(value.collection.as_slice())
+ .to_string()
+ .into(),
+ name: String::from_utf8_lossy(&value.name).to_string().into(),
+ property_version: value.property_version,
+ amount: value.amount,
+ }
+ }
+}
+
+impl TryFrom> for Offer {
+ type Error = SigningError;
+
+ fn try_from(value: CancelOfferNftMessage) -> SigningResult {
+ Ok(Offer {
+ receiver: AccountAddress::from_str(&value.receiver)
+ .map_err(from_account_error)
+ .into_tw()
+ .context("Invalid receiver address")?,
+ creator: AccountAddress::from_str(&value.creator)
+ .map_err(from_account_error)
+ .into_tw()
+ .context("Invalid creator address")?,
+ collection: value.collectionName.as_bytes().to_vec(),
+ name: value.name.as_bytes().to_vec(),
+ property_version: value.property_version,
+ amount: 0,
+ })
+ }
+}
+
+impl From for CancelOfferNftMessage<'_> {
+ fn from(value: Offer) -> Self {
+ CancelOfferNftMessage {
+ receiver: value.receiver.to_hex_literal().into(),
+ creator: value.creator.to_hex_literal().into(),
+ collectionName: String::from_utf8_lossy(value.collection.as_slice())
+ .to_string()
+ .into(),
+ name: String::from_utf8_lossy(value.name.as_slice())
+ .to_string()
+ .into(),
+ property_version: value.property_version,
+ }
+ }
+}
+
+impl TryFrom> for Claim {
+ type Error = SigningError;
+
+ fn try_from(value: ClaimNftMessage) -> SigningResult {
+ Ok(Claim {
+ sender: AccountAddress::from_str(&value.sender)
+ .map_err(from_account_error)
+ .into_tw()
+ .context("Invalid sender address")?,
+ creator: AccountAddress::from_str(&value.creator)
+ .map_err(from_account_error)
+ .into_tw()
+ .context("Invalid creator address")?,
+ collection: value.collectionName.as_bytes().to_vec(),
+ name: value.name.as_bytes().to_vec(),
+ property_version: value.property_version,
+ })
+ }
+}
+
+impl From for ClaimNftMessage<'_> {
+ fn from(value: Claim) -> Self {
+ ClaimNftMessage {
+ sender: value.sender.to_hex_literal().into(),
+ creator: value.creator.to_hex_literal().into(),
+ collectionName: String::from_utf8_lossy(value.collection.as_slice())
+ .to_string()
+ .into(),
+ name: String::from_utf8_lossy(value.name.as_slice())
+ .to_string()
+ .into(),
+ property_version: value.property_version,
+ }
+ }
+}
diff --git a/rust/chains/tw_aptos/src/serde_helper/mod.rs b/rust/chains/tw_aptos/src/serde_helper/mod.rs
new file mode 100644
index 00000000000..876f018225e
--- /dev/null
+++ b/rust/chains/tw_aptos/src/serde_helper/mod.rs
@@ -0,0 +1,5 @@
+// Copyright © Aptos Foundation
+// Parts of the project are originally copyright © Meta Platforms, Inc.
+// SPDX-License-Identifier: Apache-2.0
+
+pub mod vec_bytes;
diff --git a/rust/chains/tw_aptos/src/serde_helper/vec_bytes.rs b/rust/chains/tw_aptos/src/serde_helper/vec_bytes.rs
new file mode 100644
index 00000000000..f57311d19dd
--- /dev/null
+++ b/rust/chains/tw_aptos/src/serde_helper/vec_bytes.rs
@@ -0,0 +1,30 @@
+// Copyright © Aptos Foundation
+// Parts of the project are originally copyright © Meta Platforms, Inc.
+// SPDX-License-Identifier: Apache-2.0
+
+use serde::{
+ de::Deserializer,
+ ser::{SerializeSeq, Serializer},
+ Deserialize,
+};
+
+pub fn serialize(data: &[Vec], serializer: S) -> Result
+where
+ S: Serializer,
+{
+ let mut seq = serializer.serialize_seq(Some(data.len()))?;
+ for e in data {
+ seq.serialize_element(serde_bytes::Bytes::new(e.as_slice()))?;
+ }
+ seq.end()
+}
+
+pub fn deserialize<'de, D>(deserializer: D) -> Result>, D::Error>
+where
+ D: Deserializer<'de>,
+{
+ Ok(>::deserialize(deserializer)?
+ .into_iter()
+ .map(serde_bytes::ByteBuf::into_vec)
+ .collect())
+}
diff --git a/rust/chains/tw_aptos/src/signer.rs b/rust/chains/tw_aptos/src/signer.rs
new file mode 100644
index 00000000000..8937e821081
--- /dev/null
+++ b/rust/chains/tw_aptos/src/signer.rs
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::address::Address;
+use crate::transaction_builder;
+use std::str::FromStr;
+use tw_coin_entry::error::prelude::*;
+use tw_coin_entry::signing_output_error;
+use tw_keypair::ed25519;
+use tw_proto::Aptos::Proto;
+
+pub struct Signer;
+
+impl Signer {
+ #[inline]
+ pub fn sign_proto(input: Proto::SigningInput<'_>) -> Proto::SigningOutput<'static> {
+ Self::sign_proto_impl(input)
+ .unwrap_or_else(|e| signing_output_error!(Proto::SigningOutput, e))
+ }
+
+ fn sign_proto_impl(
+ input: Proto::SigningInput<'_>,
+ ) -> SigningResult> {
+ let key_pair = ed25519::sha512::KeyPair::try_from(input.private_key.as_ref())?;
+ let builder = transaction_builder::TransactionFactory::new_from_protobuf(input.clone())?;
+ let sender = Address::from_str(&input.sender)
+ .into_tw()
+ .context("Invalid sender address")?;
+ let signed_tx = builder
+ .sender(sender.inner())
+ .sequence_number(input.sequence_number as u64)
+ .build()?
+ .sign(key_pair)?;
+ Ok(Proto::SigningOutput {
+ raw_txn: signed_tx.raw_txn_bytes().clone().into(),
+ encoded: signed_tx.encoded().clone().into(),
+ authenticator: Some((*signed_tx.authenticator()).clone().into()),
+ json: signed_tx.to_json().to_string().into(),
+ ..Proto::SigningOutput::default()
+ })
+ }
+}
diff --git a/rust/chains/tw_aptos/src/transaction.rs b/rust/chains/tw_aptos/src/transaction.rs
new file mode 100644
index 00000000000..f4ca4a2c151
--- /dev/null
+++ b/rust/chains/tw_aptos/src/transaction.rs
@@ -0,0 +1,221 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::constants::APTOS_SALT;
+use crate::transaction_payload::TransactionPayload;
+use move_core_types::account_address::AccountAddress;
+use serde::Serialize;
+use serde_json::{json, Value};
+use std::borrow::Cow;
+use tw_coin_entry::error::prelude::*;
+use tw_encoding::hex::encode;
+use tw_encoding::{bcs, EncodingResult};
+use tw_keypair::ed25519::sha512::KeyPair;
+use tw_keypair::traits::{KeyPairTrait, SigningKeyTrait};
+use tw_memory::Data;
+use tw_proto::Aptos::Proto;
+
+#[derive(Clone, Serialize)]
+pub enum TransactionAuthenticator {
+ /// Single Ed25519 signature
+ Ed25519 {
+ public_key: Vec,
+ signature: Vec,
+ },
+}
+
+impl From for Proto::TransactionAuthenticator<'_> {
+ fn from(from: TransactionAuthenticator) -> Self {
+ Proto::TransactionAuthenticator {
+ signature: Cow::from(from.get_signature()),
+ public_key: Cow::from(from.get_public_key()),
+ }
+ }
+}
+
+impl TransactionAuthenticator {
+ pub fn get_signature(&self) -> Vec {
+ match self {
+ TransactionAuthenticator::Ed25519 {
+ public_key: _public_key,
+ signature,
+ } => signature.clone(),
+ }
+ }
+
+ pub fn get_public_key(&self) -> Vec {
+ match self {
+ TransactionAuthenticator::Ed25519 {
+ public_key,
+ signature: _signature,
+ } => public_key.clone(),
+ }
+ }
+
+ pub fn to_json(&self) -> Value {
+ match self {
+ TransactionAuthenticator::Ed25519 {
+ public_key,
+ signature,
+ } => {
+ json!({"public_key": encode(public_key, true),
+ "signature": encode(signature, true),
+ "type": "ed25519_signature"})
+ },
+ }
+ }
+}
+
+/// RawTransaction is the portion of a transaction that a client signs.
+#[derive(Clone, Serialize)]
+pub struct RawTransaction {
+ /// Sender's address.
+ sender: AccountAddress,
+
+ /// Sequence number of this transaction. This must match the sequence number
+ /// stored in the sender's account at the time the transaction executes.
+ sequence_number: u64,
+
+ /// The transaction payload, e.g., a script to execute.
+ payload: TransactionPayload,
+
+ /// Maximal total gas to spend for this transaction.
+ max_gas_amount: u64,
+
+ /// Price to be paid per gas unit.
+ gas_unit_price: u64,
+
+ /// Expiration timestamp for this transaction, represented
+ /// as seconds from the Unix Epoch. If the current blockchain timestamp
+ /// is greater than or equal to this time, then the transaction has
+ /// expired and will be discarded. This can be set to a large value far
+ /// in the future to indicate that a transaction does not expire.
+ expiration_timestamp_secs: u64,
+
+ /// Chain ID of the Aptos network this transaction is intended for.
+ chain_id: u8,
+}
+
+impl RawTransaction {
+ /// Create a new `RawTransaction` with a payload.
+ ///
+ /// It can be either to publish a module, to execute a script, or to issue a writeset
+ /// transaction.
+ pub fn new(
+ sender: AccountAddress,
+ sequence_number: u64,
+ payload: TransactionPayload,
+ max_gas_amount: u64,
+ gas_unit_price: u64,
+ expiration_timestamp_secs: u64,
+ chain_id: u8,
+ ) -> Self {
+ RawTransaction {
+ sender,
+ sequence_number,
+ payload,
+ max_gas_amount,
+ gas_unit_price,
+ expiration_timestamp_secs,
+ chain_id,
+ }
+ }
+
+ /// Create a new `RawTransaction` with an entry function
+ fn serialize(&self) -> EncodingResult {
+ bcs::encode(&self)
+ }
+
+ fn msg_to_sign(&self) -> SigningResult {
+ let serialized = self
+ .serialize()
+ .into_tw()
+ .context("Error serializing RawTransaction")?;
+ let mut preimage = tw_hash::sha3::sha3_256(APTOS_SALT);
+ preimage.extend_from_slice(serialized.as_slice());
+ Ok(preimage)
+ }
+
+ pub fn pre_image(&self) -> SigningResult> {
+ self.msg_to_sign()
+ }
+
+ pub fn compile(
+ &self,
+ signature: Vec,
+ public_key: Vec,
+ ) -> SigningResult {
+ let serialized = self.serialize()?;
+ let auth = TransactionAuthenticator::Ed25519 {
+ public_key,
+ signature,
+ };
+ let mut encoded = serialized.clone();
+ encoded.extend_from_slice(bcs::encode(&auth)?.as_slice());
+ Ok(SignedTransaction {
+ raw_txn: self.clone(),
+ authenticator: auth,
+ raw_txn_bytes: serialized.to_vec(),
+ encoded,
+ })
+ }
+
+ pub fn sign(self, key_pair: KeyPair) -> SigningResult {
+ let to_sign = self.pre_image()?;
+ let signature = key_pair.private().sign(to_sign)?.to_bytes().into_vec();
+ let pubkey = key_pair.public().as_slice().to_vec();
+ self.compile(signature, pubkey)
+ }
+
+ pub fn to_json(&self) -> Value {
+ json!({
+ "expiration_timestamp_secs": self.expiration_timestamp_secs.to_string(),
+ "gas_unit_price": self.gas_unit_price.to_string(),
+ "max_gas_amount": self.max_gas_amount.to_string(),
+ "payload": self.payload.to_json(),
+ "sender": self.sender.to_hex_literal(),
+ "sequence_number": self.sequence_number.to_string()
+ })
+ }
+}
+
+/// A transaction that has been signed.
+///
+/// A `SignedTransaction` is a single transaction that can be atomically executed. Clients submit
+/// these to validator nodes, and the validator and executor submits these to the VM.
+///
+#[derive(Clone, Serialize)]
+pub struct SignedTransaction {
+ /// The raw transaction
+ raw_txn: RawTransaction,
+
+ /// Public key and signature to authenticate
+ authenticator: TransactionAuthenticator,
+
+ #[serde(skip_serializing)]
+ /// Raw txs bytes
+ raw_txn_bytes: Vec,
+
+ #[serde(skip_serializing)]
+ /// Encoded bytes to be broadcast
+ encoded: Vec,
+}
+
+impl SignedTransaction {
+ pub fn authenticator(&self) -> &TransactionAuthenticator {
+ &self.authenticator
+ }
+ pub fn raw_txn_bytes(&self) -> &Vec {
+ &self.raw_txn_bytes
+ }
+ pub fn encoded(&self) -> &Vec {
+ &self.encoded
+ }
+
+ pub fn to_json(&self) -> Value {
+ let mut json_value = self.raw_txn.to_json();
+ json_value["signature"] = self.authenticator.to_json();
+ json_value
+ }
+}
diff --git a/rust/chains/tw_aptos/src/transaction_builder.rs b/rust/chains/tw_aptos/src/transaction_builder.rs
new file mode 100644
index 00000000000..deae84c8008
--- /dev/null
+++ b/rust/chains/tw_aptos/src/transaction_builder.rs
@@ -0,0 +1,278 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::address::from_account_error;
+use crate::aptos_move_packages::{
+ aptos_account_create_account, aptos_account_transfer, aptos_account_transfer_coins,
+ coin_transfer, managed_coin_register, token_transfers_cancel_offer_script,
+ token_transfers_claim_script, token_transfers_offer_script,
+};
+use crate::constants::{GAS_UNIT_PRICE, MAX_GAS_AMOUNT};
+use crate::liquid_staking::{
+ tortuga_claim, tortuga_stake, tortuga_unstake, LiquidStakingOperation,
+};
+use crate::nft::NftOperation;
+use crate::transaction::RawTransaction;
+use crate::transaction_payload::{
+ convert_proto_struct_tag_to_type_tag, EntryFunction, TransactionPayload,
+};
+use move_core_types::account_address::AccountAddress;
+use move_core_types::language_storage::TypeTag;
+use serde_json::Value;
+use std::str::FromStr;
+use tw_coin_entry::error::prelude::*;
+use tw_proto::Aptos::Proto::mod_SigningInput::OneOftransaction_payload;
+use tw_proto::Aptos::Proto::SigningInput;
+
+pub struct TransactionBuilder {
+ sender: Option,
+ sequence_number: Option,
+ payload: TransactionPayload,
+ max_gas_amount: u64,
+ gas_unit_price: u64,
+ expiration_timestamp_secs: u64,
+ chain_id: u8,
+}
+
+impl TransactionBuilder {
+ pub fn sender(mut self, sender: AccountAddress) -> Self {
+ self.sender = Some(sender);
+ self
+ }
+
+ pub fn sequence_number(mut self, sequence_number: u64) -> Self {
+ self.sequence_number = Some(sequence_number);
+ self
+ }
+
+ pub fn build(self) -> SigningResult {
+ let sender = self
+ .sender
+ .or_tw_err(SigningErrorType::Error_invalid_params)
+ .context("Invalid sender address")?;
+ let sequence_number = self
+ .sequence_number
+ .or_tw_err(SigningErrorType::Error_invalid_params)
+ .context("Invalid sequence number")?;
+ Ok(RawTransaction::new(
+ sender,
+ sequence_number,
+ self.payload,
+ self.max_gas_amount,
+ self.gas_unit_price,
+ self.expiration_timestamp_secs,
+ self.chain_id,
+ ))
+ }
+}
+
+#[derive(Clone, Debug)]
+pub struct TransactionFactory {
+ max_gas_amount: u64,
+ gas_unit_price: u64,
+ transaction_expiration_time: u64,
+ chain_id: u8,
+}
+
+impl TransactionFactory {
+ pub fn new(chain_id: u8) -> Self {
+ Self {
+ max_gas_amount: MAX_GAS_AMOUNT,
+ gas_unit_price: GAS_UNIT_PRICE,
+ transaction_expiration_time: 30,
+ chain_id,
+ }
+ }
+
+ pub fn new_from_protobuf(input: SigningInput) -> SigningResult {
+ let factory = TransactionFactory::new(input.chain_id as u8)
+ .with_gas_unit_price(input.gas_unit_price)
+ .with_max_gas_amount(input.max_gas_amount)
+ .with_transaction_expiration_time(input.expiration_timestamp_secs);
+ match input.transaction_payload {
+ OneOftransaction_payload::transfer(transfer) => factory
+ .implicitly_create_user_account_and_transfer(
+ AccountAddress::from_str(&transfer.to)
+ .map_err(from_account_error)
+ .into_tw()
+ .context("Invalid destination address")?,
+ transfer.amount,
+ ),
+ OneOftransaction_payload::token_transfer(token_transfer) => {
+ let func = token_transfer
+ .function
+ .or_tw_err(SigningErrorType::Error_invalid_params)
+ .context("'TokenTransferMessage::function' is not set")?;
+ factory.coins_transfer(
+ AccountAddress::from_str(&token_transfer.to)
+ .map_err(from_account_error)
+ .into_tw()
+ .context("Invalid destination address")?,
+ token_transfer.amount,
+ convert_proto_struct_tag_to_type_tag(func)?,
+ )
+ },
+ OneOftransaction_payload::create_account(create_account) => {
+ let address = AccountAddress::from_str(&create_account.auth_key)
+ .map_err(from_account_error)
+ .into_tw()
+ .context("Invalid 'auth_key' address")?;
+ factory.create_user_account(address)
+ },
+ OneOftransaction_payload::nft_message(nft_message) => {
+ factory.nft_ops(NftOperation::try_from(nft_message)?)
+ },
+ OneOftransaction_payload::register_token(register_token) => {
+ let function = register_token
+ .function
+ .or_tw_err(SigningErrorType::Error_invalid_params)
+ .context("'ManagedTokensRegisterMessage::function' is not set")?;
+ Ok(factory.register_token(convert_proto_struct_tag_to_type_tag(function)?))
+ },
+ OneOftransaction_payload::liquid_staking_message(msg) => {
+ factory.liquid_staking_ops(LiquidStakingOperation::try_from(msg)?)
+ },
+ OneOftransaction_payload::token_transfer_coins(token_transfer_coins) => {
+ let func = token_transfer_coins
+ .function
+ .or_tw_err(SigningErrorType::Error_invalid_params)
+ .context("'TokenTransferCoinsMessage::function' is not set")?;
+ factory.implicitly_create_user_and_coins_transfer(
+ AccountAddress::from_str(&token_transfer_coins.to)
+ .map_err(from_account_error)
+ .into_tw()
+ .context("Invalid destination address")?,
+ token_transfer_coins.amount,
+ convert_proto_struct_tag_to_type_tag(func)?,
+ )
+ },
+ OneOftransaction_payload::None => {
+ let is_blind_sign = !input.any_encoded.is_empty();
+ let v = serde_json::from_str::(&input.any_encoded)
+ .into_tw()
+ .context("Error decoding 'SigningInput::any_encoded' as JSON")?;
+ if is_blind_sign {
+ let entry_function = EntryFunction::try_from(v)?;
+ Ok(factory.payload(TransactionPayload::EntryFunction(entry_function)))
+ } else {
+ SigningError::err(SigningErrorType::Error_input_parse)
+ }
+ },
+ }
+ }
+
+ pub fn with_max_gas_amount(mut self, max_gas_amount: u64) -> Self {
+ self.max_gas_amount = max_gas_amount;
+ self
+ }
+
+ pub fn with_gas_unit_price(mut self, gas_unit_price: u64) -> Self {
+ self.gas_unit_price = gas_unit_price;
+ self
+ }
+
+ pub fn with_transaction_expiration_time(mut self, transaction_expiration_time: u64) -> Self {
+ self.transaction_expiration_time = transaction_expiration_time;
+ self
+ }
+
+ pub fn payload(&self, payload: TransactionPayload) -> TransactionBuilder {
+ self.transaction_builder(payload)
+ }
+
+ pub fn create_user_account(&self, to: AccountAddress) -> SigningResult {
+ Ok(self.payload(aptos_account_create_account(to)?))
+ }
+
+ pub fn register_token(&self, coin_type: TypeTag) -> TransactionBuilder {
+ self.payload(managed_coin_register(coin_type))
+ }
+
+ pub fn nft_ops(&self, operation: NftOperation) -> SigningResult {
+ match operation {
+ NftOperation::Claim(claim) => Ok(self.payload(token_transfers_claim_script(
+ claim.sender,
+ claim.creator,
+ claim.collection,
+ claim.name,
+ claim.property_version,
+ )?)),
+ NftOperation::Cancel(offer) => Ok(self.payload(token_transfers_cancel_offer_script(
+ offer.receiver,
+ offer.creator,
+ offer.collection,
+ offer.name,
+ offer.property_version,
+ )?)),
+ NftOperation::Offer(offer) => Ok(self.payload(token_transfers_offer_script(
+ offer.receiver,
+ offer.creator,
+ offer.collection,
+ offer.name,
+ offer.property_version,
+ offer.amount,
+ )?)),
+ }
+ }
+
+ pub fn liquid_staking_ops(
+ &self,
+ operation: LiquidStakingOperation,
+ ) -> SigningResult {
+ match operation {
+ LiquidStakingOperation::Stake(stake) => {
+ Ok(self.payload(tortuga_stake(stake.smart_contract_address, stake.amount)?))
+ },
+ LiquidStakingOperation::Unstake(unstake) => Ok(self.payload(tortuga_unstake(
+ unstake.smart_contract_address,
+ unstake.amount,
+ )?)),
+ LiquidStakingOperation::Claim(claim) => {
+ Ok(self.payload(tortuga_claim(claim.smart_contract_address, claim.idx)?))
+ },
+ }
+ }
+
+ pub fn implicitly_create_user_account_and_transfer(
+ &self,
+ to: AccountAddress,
+ amount: u64,
+ ) -> SigningResult {
+ Ok(self.payload(aptos_account_transfer(to, amount)?))
+ }
+
+ pub fn coins_transfer(
+ &self,
+ to: AccountAddress,
+ amount: u64,
+ coin_type: TypeTag,
+ ) -> SigningResult {
+ Ok(self.payload(coin_transfer(coin_type, to, amount)?))
+ }
+
+ pub fn implicitly_create_user_and_coins_transfer(
+ &self,
+ to: AccountAddress,
+ amount: u64,
+ coin_type: TypeTag,
+ ) -> SigningResult {
+ Ok(self.payload(aptos_account_transfer_coins(coin_type, to, amount)?))
+ }
+
+ fn transaction_builder(&self, payload: TransactionPayload) -> TransactionBuilder {
+ TransactionBuilder {
+ sender: None,
+ sequence_number: None,
+ payload,
+ max_gas_amount: self.max_gas_amount,
+ gas_unit_price: self.gas_unit_price,
+ expiration_timestamp_secs: self.expiration_timestamp(),
+ chain_id: self.chain_id,
+ }
+ }
+
+ fn expiration_timestamp(&self) -> u64 {
+ self.transaction_expiration_time
+ }
+}
diff --git a/rust/chains/tw_aptos/src/transaction_payload.rs b/rust/chains/tw_aptos/src/transaction_payload.rs
new file mode 100644
index 00000000000..aa1c74d02da
--- /dev/null
+++ b/rust/chains/tw_aptos/src/transaction_payload.rs
@@ -0,0 +1,267 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::serde_helper::vec_bytes;
+use move_core_types::identifier::Identifier;
+use move_core_types::language_storage::{ModuleId, StructTag, TypeTag};
+use move_core_types::parser::parse_transaction_argument;
+use move_core_types::transaction_argument::TransactionArgument;
+use serde::{Deserialize, Serialize};
+use serde_json::{json, Value};
+use std::default::Default;
+use std::str::FromStr;
+use tw_coin_entry::error::prelude::*;
+use tw_encoding::{bcs, EncodingError, EncodingResult};
+use tw_memory::Data;
+use tw_proto::Aptos;
+
+pub type EntryFunctionResult = Result;
+
+#[derive(Debug)]
+pub enum EntryFunctionError {
+ MissingFunctionName,
+ InvalidFunctionName,
+ MissingArguments,
+ InvalidArguments,
+ EncodingError,
+ MissingTypeArguments,
+ InvalidTypeArguments,
+}
+
+impl From for EntryFunctionError {
+ fn from(_error: EncodingError) -> Self {
+ EntryFunctionError::EncodingError
+ }
+}
+
+impl From for SigningError {
+ fn from(e: EntryFunctionError) -> Self {
+ SigningError::new(SigningErrorType::Error_invalid_params)
+ .context(format!("Error decoding EntryFunction: {e:?}"))
+ }
+}
+
+#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
+pub struct EntryFunction {
+ module: ModuleId,
+ function: Identifier,
+ ty_args: Vec,
+ #[serde(with = "vec_bytes")]
+ args: Vec>,
+ #[serde(skip_serializing)]
+ json_args: Value,
+}
+
+impl TryFrom for EntryFunction {
+ type Error = EntryFunctionError;
+
+ fn try_from(value: Value) -> EntryFunctionResult {
+ let function_str = value["function"]
+ .as_str()
+ .ok_or(EntryFunctionError::MissingFunctionName)?;
+ let tag = StructTag::from_str(function_str)
+ .map_err(|_| EntryFunctionError::InvalidFunctionName)?;
+
+ let args = value["arguments"]
+ .as_array()
+ .ok_or(EntryFunctionError::MissingArguments)?
+ .iter()
+ .map(|element| {
+ let arg_str = element.to_string();
+ let arg = parse_transaction_argument(
+ arg_str.trim_start_matches('"').trim_end_matches('"'),
+ )
+ .map_err(|_| EntryFunctionError::InvalidArguments)?;
+ serialize_argument(&arg).map_err(EntryFunctionError::from)
+ })
+ .collect::>>()?;
+
+ let ty_args = value["type_arguments"]
+ .as_array()
+ .ok_or(EntryFunctionError::MissingTypeArguments)?
+ .iter()
+ .map(|element| {
+ let ty_arg_str = element
+ .as_str()
+ .ok_or(EntryFunctionError::InvalidTypeArguments)?;
+ TypeTag::from_str(ty_arg_str).map_err(|_| EntryFunctionError::InvalidTypeArguments)
+ })
+ .collect::>>()?;
+
+ Ok(EntryFunction {
+ module: tag.module_id(),
+ function: tag.name,
+ ty_args,
+ args,
+ json_args: value["arguments"].clone(),
+ })
+ }
+}
+
+fn serialize_argument(arg: &TransactionArgument) -> EncodingResult {
+ match arg {
+ TransactionArgument::U8(v) => bcs::encode(v),
+ TransactionArgument::U16(v) => bcs::encode(v),
+ TransactionArgument::U32(v) => bcs::encode(v),
+ TransactionArgument::U64(v) => bcs::encode(v),
+ TransactionArgument::U128(v) => bcs::encode(v),
+ TransactionArgument::U256(v) => bcs::encode(v),
+ TransactionArgument::U8Vector(v) => bcs::encode(v),
+ TransactionArgument::Bool(v) => bcs::encode(v),
+ TransactionArgument::Address(v) => {
+ let serialized_v = bcs::encode(v)?;
+ bcs::encode(&serialized_v)
+ },
+ }
+}
+
+pub fn convert_proto_struct_tag_to_type_tag(
+ struct_tag: Aptos::Proto::StructTag,
+) -> SigningResult {
+ TypeTag::from_str(&format!(
+ "{}::{}::{}",
+ struct_tag.account_address, struct_tag.module, struct_tag.name
+ ))
+ .tw_err(|_| SigningErrorType::Error_invalid_params)
+}
+
+pub fn convert_type_tag_to_struct_tag(type_tag: TypeTag) -> Aptos::Proto::StructTag<'static> {
+ if let TypeTag::Struct(st) = type_tag {
+ Aptos::Proto::StructTag {
+ account_address: st.address.to_hex_literal().into(),
+ module: st.module.to_string().into(),
+ name: st.name.to_string().into(),
+ }
+ } else {
+ Aptos::Proto::StructTag::default()
+ }
+}
+
+impl EntryFunction {
+ fn to_json(&self) -> Value {
+ // Create a JSON array from the `ty_args` field by filtering and mapping
+ // the items that match `TypeTag::Struct` to their string representation.
+ let type_arguments: Value = self
+ .ty_args
+ .iter()
+ .map(|item| Some(json!(item.to_string())))
+ .collect();
+
+ // Construct the final JSON value
+ json!({
+ "type": "entry_function_payload",
+ "function": format!("{}::{}", self.module.short_str_lossless(), self.function.clone().into_string()),
+ "arguments": self.json_args,
+ "type_arguments": type_arguments
+ })
+ }
+}
+
+#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
+pub enum TransactionPayload {
+ Script,
+ ModuleBundle,
+ /// A transaction that executes an existing entry function published on-chain.
+ EntryFunction(EntryFunction),
+}
+
+impl TransactionPayload {
+ pub fn to_json(&self) -> Value {
+ match self {
+ TransactionPayload::Script => Value::default(),
+ TransactionPayload::ModuleBundle => Value::default(),
+ TransactionPayload::EntryFunction(entry) => entry.to_json(),
+ }
+ }
+}
+
+impl EntryFunction {
+ pub fn new(
+ module: ModuleId,
+ function: Identifier,
+ ty_args: Vec,
+ args: Vec>,
+ json_args: Value,
+ ) -> Self {
+ EntryFunction {
+ module,
+ function,
+ ty_args,
+ args,
+ json_args,
+ }
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::address::Address;
+ use move_core_types::account_address::AccountAddress;
+ use move_core_types::identifier::Identifier;
+ use move_core_types::language_storage::{ModuleId, TypeTag};
+ use serde_json::{json, Value};
+ use std::str::FromStr;
+ use tw_encoding::hex;
+
+ #[test]
+ fn test_payload_from_json() {
+ let payload_value: Value = json!({
+ "arguments": ["0xc95db29a67a848940829b3df6119b5e67b788ff0248676e4484c7c6f29c0f5e6"],
+ "function": "0xc23c3b70956ce8d88fb18ad9ed3b463fe873cb045db3f6d2e2fb15b9aab71d50::IFO::release",
+ "type": "entry_function_payload",
+ "type_arguments": [
+ "0x48e0e3958d42b8d452c9199d4a221d0d1b15d14655787453dbe77208ced90517::coins::BUSD",
+ "0x48e0e3958d42b8d452c9199d4a221d0d1b15d14655787453dbe77208ced90517::coins::DAI",
+ "0x9936836587ca33240d3d3f91844651b16cb07802faf5e34514ed6f78580deb0a::uints::U1"
+ ]
+ });
+
+ let v = EntryFunction::try_from(payload_value.clone()).unwrap();
+ assert_eq!(payload_value, v.to_json());
+ }
+
+ #[test]
+ fn test_payload_from_json_with_arg_non_str() {
+ let payload_value: Value = json!({
+ "type":"entry_function_payload",
+ "function":"0xd11107bdf0d6d7040c6c0bfbdecb6545191fdf13e8d8d259952f53e1713f61b5::ditto_staking::stake_aptos",
+ "type_arguments":[],
+ "arguments": [1000000]
+ });
+
+ let v = EntryFunction::try_from(payload_value.clone()).unwrap();
+ assert_eq!(payload_value, v.to_json());
+ }
+
+ #[test]
+ fn test_basic_payload() {
+ let addr =
+ Address::from_str("0xeeff357ea5c1a4e7bc11b2b17ff2dc2dcca69750bfef1e1ebcaccf8c8018175b")
+ .unwrap()
+ .inner();
+ let amount: i64 = 1000;
+ let args = vec![bcs::encode(&addr).unwrap(), bcs::encode(&amount).unwrap()];
+ let module = ModuleId::new(AccountAddress::ONE, Identifier::from_str("coin").unwrap());
+ let function = Identifier::from_str("transfer").unwrap();
+ let type_tag = vec![TypeTag::from_str("0x1::aptos_coin::AptosCoin").unwrap()];
+ let entry = EntryFunction::new(
+ module,
+ function,
+ type_tag,
+ args,
+ json!([addr.to_hex_literal(), amount.to_string()]),
+ );
+ let tp = TransactionPayload::EntryFunction(entry);
+ let serialized = bcs::encode(&tp).unwrap();
+ assert_eq!(hex::encode(serialized, false), "02000000000000000000000000000000000000000000000000000000000000000104636f696e087472616e73666572010700000000000000000000000000000000000000000000000000000000000000010a6170746f735f636f696e094170746f73436f696e000220eeff357ea5c1a4e7bc11b2b17ff2dc2dcca69750bfef1e1ebcaccf8c8018175b08e803000000000000");
+ let payload_value: Value = json!({
+ "function": "0x1::coin::transfer",
+ "type": "entry_function_payload",
+ "arguments": ["0xeeff357ea5c1a4e7bc11b2b17ff2dc2dcca69750bfef1e1ebcaccf8c8018175b", "1000"],
+ "type_arguments": ["0x1::aptos_coin::AptosCoin"]
+ });
+ assert_eq!(tp.to_json(), payload_value);
+ }
+}
diff --git a/rust/chains/tw_aptos/tests/signer.rs b/rust/chains/tw_aptos/tests/signer.rs
new file mode 100644
index 00000000000..e69c6894839
--- /dev/null
+++ b/rust/chains/tw_aptos/tests/signer.rs
@@ -0,0 +1,871 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use move_core_types::account_address::AccountAddress;
+use move_core_types::language_storage::TypeTag;
+use std::str::FromStr;
+use tw_aptos::liquid_staking;
+use tw_aptos::liquid_staking::{LiquidStakingOperation, Stake, Unstake};
+use tw_aptos::nft::{Claim, NftOperation, Offer};
+use tw_aptos::signer::Signer;
+use tw_aptos::transaction_payload::convert_type_tag_to_struct_tag;
+use tw_coin_entry::error::prelude::*;
+use tw_encoding::hex;
+use tw_proto::Aptos::Proto;
+use tw_proto::Aptos::Proto::{SigningInput, SigningOutput};
+
+pub struct AccountCreation {
+ to: String,
+}
+
+pub struct Transfer {
+ to: String,
+ amount: u64,
+}
+
+pub struct TokenTransfer {
+ transfer: Transfer,
+ tag: TypeTag,
+}
+
+pub struct RegisterToken {
+ coin_type: TypeTag,
+}
+
+pub enum OpsDetails {
+ RegisterToken(RegisterToken),
+ LiquidStakingOps(LiquidStakingOperation),
+ AccountCreation(AccountCreation),
+ Transfer(Transfer),
+ TokenTransfer(TokenTransfer),
+ ImplicitTokenTransfer(TokenTransfer),
+ NftOps(NftOperation),
+}
+
+fn setup_proto_transaction<'a>(
+ sender: &'a str,
+ keypair_str: &'a str,
+ transaction_type: &'a str,
+ sequence_number: i64,
+ chain_id: u32,
+ max_gas_amount: u64,
+ timestamp: u64,
+ gas_unit_price: u64,
+ any_encoded: &'a str,
+ ops_details: Option,
+) -> SigningInput<'a> {
+ let private = hex::decode(keypair_str).unwrap();
+
+ let payload: Proto::mod_SigningInput::OneOftransaction_payload = match transaction_type {
+ "transfer" => {
+ if let OpsDetails::Transfer(transfer) = ops_details.unwrap() {
+ Proto::mod_SigningInput::OneOftransaction_payload::transfer(
+ Proto::TransferMessage {
+ to: transfer.to.into(),
+ amount: transfer.amount,
+ },
+ )
+ } else {
+ panic!("Unsupported arguments")
+ }
+ },
+ "create_account" => {
+ if let OpsDetails::AccountCreation(account) = ops_details.unwrap() {
+ Proto::mod_SigningInput::OneOftransaction_payload::create_account(
+ Proto::CreateAccountMessage {
+ auth_key: account.to.into(),
+ },
+ )
+ } else {
+ panic!("Unsupported arguments")
+ }
+ },
+ "coin_transfer" => {
+ if let OpsDetails::TokenTransfer(token_transfer) = ops_details.unwrap() {
+ Proto::mod_SigningInput::OneOftransaction_payload::token_transfer(
+ Proto::TokenTransferMessage {
+ to: token_transfer.transfer.to.into(),
+ amount: token_transfer.transfer.amount,
+ function: Some(convert_type_tag_to_struct_tag(token_transfer.tag)),
+ },
+ )
+ } else {
+ panic!("Unsupported arguments")
+ }
+ },
+ "implicit_coin_transfer" => {
+ if let OpsDetails::ImplicitTokenTransfer(token_transfer) = ops_details.unwrap() {
+ Proto::mod_SigningInput::OneOftransaction_payload::token_transfer_coins(
+ Proto::TokenTransferCoinsMessage {
+ to: token_transfer.transfer.to.into(),
+ amount: token_transfer.transfer.amount,
+ function: Some(convert_type_tag_to_struct_tag(token_transfer.tag)),
+ },
+ )
+ } else {
+ panic!("Unsupported arguments")
+ }
+ },
+ "nft_ops" => {
+ if let OpsDetails::NftOps(nft) = ops_details.unwrap() {
+ Proto::mod_SigningInput::OneOftransaction_payload::nft_message(nft.into())
+ } else {
+ panic!("Unsupported arguments")
+ }
+ },
+ "register_token" => {
+ if let OpsDetails::RegisterToken(register_token) = ops_details.unwrap() {
+ Proto::mod_SigningInput::OneOftransaction_payload::register_token(
+ Proto::ManagedTokensRegisterMessage {
+ function: Some(convert_type_tag_to_struct_tag(register_token.coin_type)),
+ },
+ )
+ } else {
+ panic!("Unsupported arguments")
+ }
+ },
+ "liquid_staking_ops" => {
+ if let OpsDetails::LiquidStakingOps(liquid_staking_ops) = ops_details.unwrap() {
+ Proto::mod_SigningInput::OneOftransaction_payload::liquid_staking_message(
+ liquid_staking_ops.into(),
+ )
+ } else {
+ panic!("Unsupported arguments")
+ }
+ },
+ "blind_sign_json" => Proto::mod_SigningInput::OneOftransaction_payload::None,
+ _ => Proto::mod_SigningInput::OneOftransaction_payload::None,
+ };
+
+ let input = SigningInput {
+ chain_id,
+ sender: sender.into(),
+ sequence_number,
+ max_gas_amount,
+ gas_unit_price,
+ expiration_timestamp_secs: timestamp,
+ private_key: private.into(),
+ any_encoded: any_encoded.into(),
+ transaction_payload: payload,
+ };
+
+ input
+}
+
+fn test_tx_result(
+ output: SigningOutput,
+ expected_raw_txn_bytes_str: &str,
+ expected_signature_str: &str,
+ expected_encoded_txn_str: &str,
+ json_literal: &str,
+) {
+ assert_eq!(output.error, SigningErrorType::OK);
+ assert!(output.error_message.is_empty());
+
+ assert_eq!(
+ hex::encode(output.raw_txn.to_vec(), false),
+ expected_raw_txn_bytes_str
+ );
+ assert_eq!(
+ hex::encode(output.authenticator.unwrap().signature.to_vec(), false),
+ expected_signature_str
+ );
+ assert_eq!(
+ hex::encode(output.encoded.to_vec(), false),
+ expected_encoded_txn_str
+ );
+
+ let json_value_expected: serde_json::Value = serde_json::from_str(json_literal).unwrap();
+ let json_value: serde_json::Value = serde_json::from_str(output.json.as_ref()).unwrap();
+ assert_eq!(json_value, json_value_expected);
+}
+
+// Successfully broadcasted https://explorer.aptoslabs.com/txn/0xb4d62afd3862116e060dd6ad9848ccb50c2bc177799819f1d29c059ae2042467?network=devnet
+#[test]
+fn test_aptos_sign_transaction_transfer() {
+ let input = setup_proto_transaction(
+ "0x07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30",
+ "5d996aa76b3212142792d9130796cd2e11e3c445a93118c08414df4f66bc60ec",
+ "transfer",
+ 99,
+ 33,
+ 3296766,
+ 3664390082,
+ 100,
+ "",
+ Some(OpsDetails::Transfer(Transfer {
+ to: "0x07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30".to_string(),
+ amount: 1000,
+ })),
+ );
+ let output = Signer::sign_proto(input);
+ test_tx_result(output,
+ "07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f3063000000000000000200000000000000000000000000000000000000000000000000000000000000010d6170746f735f6163636f756e74087472616e7366657200022007968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f3008e803000000000000fe4d3200000000006400000000000000c2276ada0000000021",
+ "5707246db31e2335edc4316a7a656a11691d1d1647f6e864d1ab12f43428aaaf806cf02120d0b608cdd89c5c904af7b137432aacdd60cc53f9fad7bd33578e01",
+ "07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f3063000000000000000200000000000000000000000000000000000000000000000000000000000000010d6170746f735f6163636f756e74087472616e7366657200022007968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f3008e803000000000000fe4d3200000000006400000000000000c2276ada00000000210020ea526ba1710343d953461ff68641f1b7df5f23b9042ffa2d2a798d3adb3f3d6c405707246db31e2335edc4316a7a656a11691d1d1647f6e864d1ab12f43428aaaf806cf02120d0b608cdd89c5c904af7b137432aacdd60cc53f9fad7bd33578e01",
+ r#"{
+ "expiration_timestamp_secs": "3664390082",
+ "gas_unit_price": "100",
+ "max_gas_amount": "3296766",
+ "payload": {
+ "arguments": ["0x7968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30","1000"],
+ "function": "0x1::aptos_account::transfer",
+ "type": "entry_function_payload",
+ "type_arguments": []
+ },
+ "sender": "0x7968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30",
+ "sequence_number": "99",
+ "signature": {
+ "public_key": "0xea526ba1710343d953461ff68641f1b7df5f23b9042ffa2d2a798d3adb3f3d6c",
+ "signature": "0x5707246db31e2335edc4316a7a656a11691d1d1647f6e864d1ab12f43428aaaf806cf02120d0b608cdd89c5c904af7b137432aacdd60cc53f9fad7bd33578e01",
+ "type": "ed25519_signature"
+ }
+ }"#);
+}
+
+// Successfully broadcasted: https://explorer.aptoslabs.com/txn/0x477141736de6b0936a6c3734e4d6fd018c7d21f1f28f99028ef0bc6881168602?network=Devnet
+#[test]
+fn test_aptos_sign_create_account() {
+ let input = setup_proto_transaction(
+ "0x07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30", // Sender's address
+ "5d996aa76b3212142792d9130796cd2e11e3c445a93118c08414df4f66bc60ec", // Keypair
+ "create_account",
+ 0, // Sequence number
+ 33,
+ 3296766,
+ 3664390082,
+ 100,
+ "",
+ Some(OpsDetails::AccountCreation(AccountCreation {
+ to: "0x3aa1672641a4e17b3d913b4c0301e805755a80b12756fc729c5878f12344d30e".to_string(),
+ })),
+ );
+ let output = Signer::sign_proto(input);
+ test_tx_result(output,
+ "07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f3000000000000000000200000000000000000000000000000000000000000000000000000000000000010d6170746f735f6163636f756e740e6372656174655f6163636f756e740001203aa1672641a4e17b3d913b4c0301e805755a80b12756fc729c5878f12344d30efe4d3200000000006400000000000000c2276ada0000000021", // Expected raw transaction bytes
+ "fcba3dfbec76721454ef414955f09f159660a13886b4edd8c579e3c779c29073afe7b25efa3fef9b21c2efb1cf16b4247fc0e5c8f63fdcd1c8d87f5d59f44501", // Expected signature
+ "07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f3000000000000000000200000000000000000000000000000000000000000000000000000000000000010d6170746f735f6163636f756e740e6372656174655f6163636f756e740001203aa1672641a4e17b3d913b4c0301e805755a80b12756fc729c5878f12344d30efe4d3200000000006400000000000000c2276ada00000000210020ea526ba1710343d953461ff68641f1b7df5f23b9042ffa2d2a798d3adb3f3d6c40fcba3dfbec76721454ef414955f09f159660a13886b4edd8c579e3c779c29073afe7b25efa3fef9b21c2efb1cf16b4247fc0e5c8f63fdcd1c8d87f5d59f44501", // Expected encoded transaction
+ r#"{
+ "expiration_timestamp_secs": "3664390082",
+ "gas_unit_price": "100",
+ "max_gas_amount": "3296766",
+ "payload": {
+ "arguments": ["0x3aa1672641a4e17b3d913b4c0301e805755a80b12756fc729c5878f12344d30e"],
+ "function": "0x1::aptos_account::create_account",
+ "type": "entry_function_payload",
+ "type_arguments": []
+ },
+ "sender": "0x7968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30",
+ "sequence_number": "0",
+ "signature": {
+ "public_key": "0xea526ba1710343d953461ff68641f1b7df5f23b9042ffa2d2a798d3adb3f3d6c",
+ "signature": "0xfcba3dfbec76721454ef414955f09f159660a13886b4edd8c579e3c779c29073afe7b25efa3fef9b21c2efb1cf16b4247fc0e5c8f63fdcd1c8d87f5d59f44501",
+ "type": "ed25519_signature"
+ }
+ }"#);
+}
+
+// Successfully broadcasted https://explorer.aptoslabs.com/txn/0xb5b383a5c7f99b2edb3bed9533f8169a89051b149d65876a82f4c0b9bf78a15b?network=Devnet
+#[test]
+fn test_aptos_sign_coin_transfer() {
+ let input = setup_proto_transaction(
+ "0x07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30", // Sender's address
+ "5d996aa76b3212142792d9130796cd2e11e3c445a93118c08414df4f66bc60ec", // Keypair
+ "coin_transfer",
+ 24, // Sequence number
+ 32,
+ 3296766,
+ 3664390082,
+ 100,
+ "",
+ Some(OpsDetails::TokenTransfer(TokenTransfer {
+ transfer: Transfer {
+ to: "0x07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30"
+ .to_string(),
+ amount: 100000,
+ },
+ tag: TypeTag::from_str(
+ "0x43417434fd869edee76cca2a4d2301e528a1551b1d719b75c350c3c97d15b8b9::coins::BTC",
+ )
+ .unwrap(),
+ })),
+ );
+ let output = Signer::sign_proto(input);
+ test_tx_result(output,
+ "07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30180000000000000002000000000000000000000000000000000000000000000000000000000000000104636f696e087472616e73666572010743417434fd869edee76cca2a4d2301e528a1551b1d719b75c350c3c97d15b8b905636f696e730342544300022007968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f3008a086010000000000fe4d3200000000006400000000000000c2276ada0000000020", // Expected raw transaction bytes
+ "7643ec8aae6198bd13ca6ea2962265859cba5a228e7d181131f6c022700dd02a7a04dc0345ad99a0289e5ab80b130b3864e6404079980bc226f1a13aee7d280a", // Expected signature
+ "07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30180000000000000002000000000000000000000000000000000000000000000000000000000000000104636f696e087472616e73666572010743417434fd869edee76cca2a4d2301e528a1551b1d719b75c350c3c97d15b8b905636f696e730342544300022007968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f3008a086010000000000fe4d3200000000006400000000000000c2276ada00000000200020ea526ba1710343d953461ff68641f1b7df5f23b9042ffa2d2a798d3adb3f3d6c407643ec8aae6198bd13ca6ea2962265859cba5a228e7d181131f6c022700dd02a7a04dc0345ad99a0289e5ab80b130b3864e6404079980bc226f1a13aee7d280a", // Expected encoded transaction
+ r#"{
+ "expiration_timestamp_secs": "3664390082",
+ "gas_unit_price": "100",
+ "max_gas_amount": "3296766",
+ "payload": {
+ "arguments": ["0x7968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30","100000"],
+ "function": "0x1::coin::transfer",
+ "type": "entry_function_payload",
+ "type_arguments": ["0x43417434fd869edee76cca2a4d2301e528a1551b1d719b75c350c3c97d15b8b9::coins::BTC"]
+ },
+ "sender": "0x7968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30",
+ "sequence_number": "24",
+ "signature": {
+ "public_key": "0xea526ba1710343d953461ff68641f1b7df5f23b9042ffa2d2a798d3adb3f3d6c",
+ "signature": "0x7643ec8aae6198bd13ca6ea2962265859cba5a228e7d181131f6c022700dd02a7a04dc0345ad99a0289e5ab80b130b3864e6404079980bc226f1a13aee7d280a",
+ "type": "ed25519_signature"
+ }
+ }"#);
+}
+
+// Successfully broadcasted https://explorer.aptoslabs.com/txn/0x197d40ea12e2bfc65a0a913b9f4ca3b0b0208fe0c1514d3d55cef3d5bcf25211?network=mainnet
+#[test]
+fn test_implicit_aptos_sign_coin_transfer() {
+ let input = setup_proto_transaction("0x1869b853768f0ba935d67f837a66b172dd39a60ca2315f8d4e0e669bbd35cf25", // Sender's address
+ "e7f56c77189e03699a75d8ec5c090e41f3d9d4783bc49c33df8a93d915e10de8", // Keypair
+ "implicit_coin_transfer",
+ 2, // Sequence number
+ 1,
+ 2000,
+ 3664390082,
+ 100,
+ "",
+ Some(OpsDetails::ImplicitTokenTransfer(TokenTransfer { transfer: Transfer { to: "0xb7c7d12080209e9dc14498c80200706e760363fb31782247e82cf57d1d6e5d6c".to_string(), amount: 10000 }, tag: TypeTag::from_str("0xe9c192ff55cffab3963c695cff6dbf9dad6aff2bb5ac19a6415cad26a81860d9::mee_coin::MeeCoin").unwrap() })),
+ );
+ let output = Signer::sign_proto(input);
+ test_tx_result(output,
+ "1869b853768f0ba935d67f837a66b172dd39a60ca2315f8d4e0e669bbd35cf2502000000000000000200000000000000000000000000000000000000000000000000000000000000010d6170746f735f6163636f756e740e7472616e736665725f636f696e730107e9c192ff55cffab3963c695cff6dbf9dad6aff2bb5ac19a6415cad26a81860d9086d65655f636f696e074d6565436f696e000220b7c7d12080209e9dc14498c80200706e760363fb31782247e82cf57d1d6e5d6c081027000000000000d0070000000000006400000000000000c2276ada0000000001", // Expected raw transaction bytes
+ "30ebd7e95cb464677f411868e2cbfcb22bc01cc63cded36c459dff45e6d2f1354ae4e090e7dfbb509851c0368b343e0e5ecaf6b08e7c1b94c186530b0f7dee0d", // Expected signature
+ "1869b853768f0ba935d67f837a66b172dd39a60ca2315f8d4e0e669bbd35cf2502000000000000000200000000000000000000000000000000000000000000000000000000000000010d6170746f735f6163636f756e740e7472616e736665725f636f696e730107e9c192ff55cffab3963c695cff6dbf9dad6aff2bb5ac19a6415cad26a81860d9086d65655f636f696e074d6565436f696e000220b7c7d12080209e9dc14498c80200706e760363fb31782247e82cf57d1d6e5d6c081027000000000000d0070000000000006400000000000000c2276ada0000000001002062e7a6a486553b56a53e89dfae3f780693e537e5b0a7ed33290780e581ca83694030ebd7e95cb464677f411868e2cbfcb22bc01cc63cded36c459dff45e6d2f1354ae4e090e7dfbb509851c0368b343e0e5ecaf6b08e7c1b94c186530b0f7dee0d", // Expected encoded transaction
+ r#"{
+ "expiration_timestamp_secs": "3664390082",
+ "gas_unit_price": "100",
+ "max_gas_amount": "2000",
+ "payload": {
+ "arguments": ["0xb7c7d12080209e9dc14498c80200706e760363fb31782247e82cf57d1d6e5d6c","10000"],
+ "function": "0x1::aptos_account::transfer_coins",
+ "type": "entry_function_payload",
+ "type_arguments": ["0xe9c192ff55cffab3963c695cff6dbf9dad6aff2bb5ac19a6415cad26a81860d9::mee_coin::MeeCoin"]
+ },
+ "sender": "0x1869b853768f0ba935d67f837a66b172dd39a60ca2315f8d4e0e669bbd35cf25",
+ "sequence_number": "2",
+ "signature": {
+ "public_key": "0x62e7a6a486553b56a53e89dfae3f780693e537e5b0a7ed33290780e581ca8369",
+ "signature": "0x30ebd7e95cb464677f411868e2cbfcb22bc01cc63cded36c459dff45e6d2f1354ae4e090e7dfbb509851c0368b343e0e5ecaf6b08e7c1b94c186530b0f7dee0d",
+ "type": "ed25519_signature"
+ }
+ }"#);
+}
+
+// Successfully broadcasted https://explorer.aptoslabs.com/txn/0x514e473618bd3cb89a2b110b7c473db9a2e10532f98eb42d02d86fb31c00525d?network=testnet
+#[test]
+fn test_aptos_nft_offer() {
+ let input = setup_proto_transaction(
+ "0x783135e8b00430253a22ba041d860c373d7a1501ccf7ac2d1ad37a8ed2775aee", // Sender's address
+ "7bebb6d543d17f6fe4e685cfab239fa37896edd594ff859f1df32f244fb707e2", // Keypair
+ "nft_ops",
+ 1, // Sequence number
+ 2,
+ 3296766,
+ 3664390082,
+ 100,
+ "",
+ Some(OpsDetails::NftOps(NftOperation::Offer(Offer {
+ receiver: AccountAddress::from_str(
+ "0x07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30",
+ )
+ .unwrap(),
+ creator: AccountAddress::from_str(
+ "0x9125e4054d884fdc7296b66e12c0d63a7baa0d88c77e8e784987c0a967c670ac",
+ )
+ .unwrap(),
+ collection: "Topaz Troopers".as_bytes().to_vec(),
+ name: "Topaz Trooper #20068".as_bytes().to_vec(),
+ property_version: 0,
+ amount: 1,
+ }))),
+ );
+ let output = Signer::sign_proto(input);
+ test_tx_result(output,
+ "783135e8b00430253a22ba041d860c373d7a1501ccf7ac2d1ad37a8ed2775aee01000000000000000200000000000000000000000000000000000000000000000000000000000000030f746f6b656e5f7472616e73666572730c6f666665725f73637269707400062007968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30209125e4054d884fdc7296b66e12c0d63a7baa0d88c77e8e784987c0a967c670ac0f0e546f70617a2054726f6f706572731514546f70617a2054726f6f70657220233230303638080000000000000000080100000000000000fe4d3200000000006400000000000000c2276ada0000000002", // Expected raw transaction bytes
+ "af5c7357a83c69e3f425beb23eaf232f8bb36dea3b7cad4a7ab8d735cee999c8ec5285005adf69dc85a6c34b042dd0308fe92b76dad5d6ac88c7b9259902c10f", // Expected signature
+ "783135e8b00430253a22ba041d860c373d7a1501ccf7ac2d1ad37a8ed2775aee01000000000000000200000000000000000000000000000000000000000000000000000000000000030f746f6b656e5f7472616e73666572730c6f666665725f73637269707400062007968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30209125e4054d884fdc7296b66e12c0d63a7baa0d88c77e8e784987c0a967c670ac0f0e546f70617a2054726f6f706572731514546f70617a2054726f6f70657220233230303638080000000000000000080100000000000000fe4d3200000000006400000000000000c2276ada00000000020020d1d99b67e37b483161a0fa369c46f34a3be4863c20e20fc7cdc669c0826a411340af5c7357a83c69e3f425beb23eaf232f8bb36dea3b7cad4a7ab8d735cee999c8ec5285005adf69dc85a6c34b042dd0308fe92b76dad5d6ac88c7b9259902c10f", // Expected encoded transaction
+ r#"{
+ "expiration_timestamp_secs": "3664390082",
+ "gas_unit_price": "100",
+ "max_gas_amount": "3296766",
+ "payload": {
+ "arguments": [
+ "0x7968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30",
+ "0x9125e4054d884fdc7296b66e12c0d63a7baa0d88c77e8e784987c0a967c670ac",
+ "Topaz Troopers", "Topaz Trooper #20068", "0", "1"],
+ "function": "0x3::token_transfers::offer_script",
+ "type": "entry_function_payload",
+ "type_arguments": []
+ },
+ "sender": "0x783135e8b00430253a22ba041d860c373d7a1501ccf7ac2d1ad37a8ed2775aee",
+ "sequence_number": "1",
+ "signature": {
+ "public_key": "0xd1d99b67e37b483161a0fa369c46f34a3be4863c20e20fc7cdc669c0826a4113",
+ "signature": "0xaf5c7357a83c69e3f425beb23eaf232f8bb36dea3b7cad4a7ab8d735cee999c8ec5285005adf69dc85a6c34b042dd0308fe92b76dad5d6ac88c7b9259902c10f",
+ "type": "ed25519_signature"
+ }
+ }"#);
+}
+
+// Successfully broadcasted https://explorer.aptoslabs.com/txn/0x0b8c64e6847c368e4c6bd2cce0e9eab378971b0ef2e3bc40cbd292910a80201d?network=testnet
+#[test]
+fn test_aptos_cancel_nft_offer() {
+ let input = setup_proto_transaction(
+ "0x7968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30", // Sender's address
+ "5d996aa76b3212142792d9130796cd2e11e3c445a93118c08414df4f66bc60ec", // Keypair
+ "nft_ops",
+ 21, // Sequence number
+ 2,
+ 3296766,
+ 3664390082,
+ 100,
+ "",
+ Some(OpsDetails::NftOps(NftOperation::Cancel(Offer {
+ receiver: AccountAddress::from_str(
+ "0x783135e8b00430253a22ba041d860c373d7a1501ccf7ac2d1ad37a8ed2775aee",
+ )
+ .unwrap(),
+ creator: AccountAddress::from_str(
+ "0x9125e4054d884fdc7296b66e12c0d63a7baa0d88c77e8e784987c0a967c670ac",
+ )
+ .unwrap(),
+ collection: "Topaz Troopers".as_bytes().to_vec(),
+ name: "Topaz Trooper #20068".as_bytes().to_vec(),
+ property_version: 0,
+ amount: 0,
+ }))),
+ );
+ let output = Signer::sign_proto(input);
+ test_tx_result(output,
+ "07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f3015000000000000000200000000000000000000000000000000000000000000000000000000000000030f746f6b656e5f7472616e73666572731363616e63656c5f6f666665725f736372697074000520783135e8b00430253a22ba041d860c373d7a1501ccf7ac2d1ad37a8ed2775aee209125e4054d884fdc7296b66e12c0d63a7baa0d88c77e8e784987c0a967c670ac0f0e546f70617a2054726f6f706572731514546f70617a2054726f6f70657220233230303638080000000000000000fe4d3200000000006400000000000000c2276ada0000000002", // Expected raw transaction bytes
+ "826722d374e276f618123e77da3ac024c89a3f97db9e09e19aa8ed06c3cdfc57d4a21c7890137f9a7c0447cc303447ba10ca5b1908e889071e0a68f48c0f260a", // Expected signature
+ "07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f3015000000000000000200000000000000000000000000000000000000000000000000000000000000030f746f6b656e5f7472616e73666572731363616e63656c5f6f666665725f736372697074000520783135e8b00430253a22ba041d860c373d7a1501ccf7ac2d1ad37a8ed2775aee209125e4054d884fdc7296b66e12c0d63a7baa0d88c77e8e784987c0a967c670ac0f0e546f70617a2054726f6f706572731514546f70617a2054726f6f70657220233230303638080000000000000000fe4d3200000000006400000000000000c2276ada00000000020020ea526ba1710343d953461ff68641f1b7df5f23b9042ffa2d2a798d3adb3f3d6c40826722d374e276f618123e77da3ac024c89a3f97db9e09e19aa8ed06c3cdfc57d4a21c7890137f9a7c0447cc303447ba10ca5b1908e889071e0a68f48c0f260a", // Expected encoded transaction
+ r#"{
+ "expiration_timestamp_secs": "3664390082",
+ "gas_unit_price": "100",
+ "max_gas_amount": "3296766",
+ "payload": {
+ "arguments": [
+ "0x783135e8b00430253a22ba041d860c373d7a1501ccf7ac2d1ad37a8ed2775aee",
+ "0x9125e4054d884fdc7296b66e12c0d63a7baa0d88c77e8e784987c0a967c670ac",
+ "Topaz Troopers", "Topaz Trooper #20068", "0"],
+ "function": "0x3::token_transfers::cancel_offer_script",
+ "type": "entry_function_payload",
+ "type_arguments": []
+ },
+ "sender": "0x7968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30",
+ "sequence_number": "21",
+ "signature": {
+ "public_key": "0xea526ba1710343d953461ff68641f1b7df5f23b9042ffa2d2a798d3adb3f3d6c",
+ "signature": "0x826722d374e276f618123e77da3ac024c89a3f97db9e09e19aa8ed06c3cdfc57d4a21c7890137f9a7c0447cc303447ba10ca5b1908e889071e0a68f48c0f260a",
+ "type": "ed25519_signature"
+ }
+ }"#);
+}
+
+// Successfully broadcasted: https://explorer.aptoslabs.com/txn/0x60b51e15140ec0b7650334e948fb447ce3cb13ae63492260461ebfa9d02e85c4?network=testnet
+#[test]
+fn test_aptos_nft_claim() {
+ let input = setup_proto_transaction(
+ "0x7968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30", // Sender's address
+ "5d996aa76b3212142792d9130796cd2e11e3c445a93118c08414df4f66bc60ec", // Keypair
+ "nft_ops",
+ 19, // Sequence number
+ 2,
+ 3296766,
+ 3664390082,
+ 100,
+ "",
+ Some(OpsDetails::NftOps(NftOperation::Claim(Claim {
+ sender: AccountAddress::from_str(
+ "0x783135e8b00430253a22ba041d860c373d7a1501ccf7ac2d1ad37a8ed2775aee",
+ )
+ .unwrap(),
+ creator: AccountAddress::from_str(
+ "0x9125e4054d884fdc7296b66e12c0d63a7baa0d88c77e8e784987c0a967c670ac",
+ )
+ .unwrap(),
+ collection: "Topaz Troopers".as_bytes().to_vec(),
+ name: "Topaz Trooper #20068".as_bytes().to_vec(),
+ property_version: 0,
+ }))),
+ );
+ let output = Signer::sign_proto(input);
+ test_tx_result(output,
+ "07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f3013000000000000000200000000000000000000000000000000000000000000000000000000000000030f746f6b656e5f7472616e73666572730c636c61696d5f736372697074000520783135e8b00430253a22ba041d860c373d7a1501ccf7ac2d1ad37a8ed2775aee209125e4054d884fdc7296b66e12c0d63a7baa0d88c77e8e784987c0a967c670ac0f0e546f70617a2054726f6f706572731514546f70617a2054726f6f70657220233230303638080000000000000000fe4d3200000000006400000000000000c2276ada0000000002", // Expected raw transaction bytes
+ "ede1ffb5f8f663741c2ca9597af44af81c98f7a910261bb4125f758fd0c0ebbf5bacb34f1196ad45153177729eb6d478676b364ab747da17602713f65ca2dd0a", // Expected signature
+ "07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f3013000000000000000200000000000000000000000000000000000000000000000000000000000000030f746f6b656e5f7472616e73666572730c636c61696d5f736372697074000520783135e8b00430253a22ba041d860c373d7a1501ccf7ac2d1ad37a8ed2775aee209125e4054d884fdc7296b66e12c0d63a7baa0d88c77e8e784987c0a967c670ac0f0e546f70617a2054726f6f706572731514546f70617a2054726f6f70657220233230303638080000000000000000fe4d3200000000006400000000000000c2276ada00000000020020ea526ba1710343d953461ff68641f1b7df5f23b9042ffa2d2a798d3adb3f3d6c40ede1ffb5f8f663741c2ca9597af44af81c98f7a910261bb4125f758fd0c0ebbf5bacb34f1196ad45153177729eb6d478676b364ab747da17602713f65ca2dd0a", // Expected encoded transaction
+ r#"{
+ "expiration_timestamp_secs": "3664390082",
+ "gas_unit_price": "100",
+ "max_gas_amount": "3296766",
+ "payload": {
+ "arguments": [
+ "0x783135e8b00430253a22ba041d860c373d7a1501ccf7ac2d1ad37a8ed2775aee",
+ "0x9125e4054d884fdc7296b66e12c0d63a7baa0d88c77e8e784987c0a967c670ac",
+ "Topaz Troopers", "Topaz Trooper #20068", "0"],
+ "function": "0x3::token_transfers::claim_script",
+ "type": "entry_function_payload",
+ "type_arguments": []
+ },
+ "sender": "0x7968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30",
+ "sequence_number": "19",
+ "signature": {
+ "public_key": "0xea526ba1710343d953461ff68641f1b7df5f23b9042ffa2d2a798d3adb3f3d6c",
+ "signature": "0xede1ffb5f8f663741c2ca9597af44af81c98f7a910261bb4125f758fd0c0ebbf5bacb34f1196ad45153177729eb6d478676b364ab747da17602713f65ca2dd0a",
+ "type": "ed25519_signature"
+ }
+ }"#);
+}
+
+// Successfully broadcasted https://explorer.aptoslabs.com/txn/0xe591252daed785641bfbbcf72a5d17864568cf32e04c0cc9129f3a13834d0e8e?network=testnet
+#[test]
+fn test_aptos_register_token() {
+ let input = setup_proto_transaction("0x07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30", // Sender's address
+ "5d996aa76b3212142792d9130796cd2e11e3c445a93118c08414df4f66bc60ec", // Keypair
+ "register_token",
+ 23, // Sequence number
+ 2,
+ 2000000,
+ 3664390082,
+ 100,
+ "",
+ Some(OpsDetails::RegisterToken(RegisterToken { coin_type: TypeTag::from_str("0xe4497a32bf4a9fd5601b27661aa0b933a923191bf403bd08669ab2468d43b379::move_coin::MoveCoin").unwrap() })),
+ );
+ let output = Signer::sign_proto(input);
+ test_tx_result(output,
+ "07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f3017000000000000000200000000000000000000000000000000000000000000000000000000000000010c6d616e616765645f636f696e0872656769737465720107e4497a32bf4a9fd5601b27661aa0b933a923191bf403bd08669ab2468d43b379096d6f76655f636f696e084d6f7665436f696e000080841e00000000006400000000000000c2276ada0000000002", // Expected raw transaction bytes
+ "e230b49f552fb85356dbec9df13f0dc56228eb7a9c29a8af3a99f4ae95b86c72bdcaa4ff1e9beb0bd81c298b967b9d97449856ec8bc672a08e2efef345c37100", // Expected signature
+ "07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f3017000000000000000200000000000000000000000000000000000000000000000000000000000000010c6d616e616765645f636f696e0872656769737465720107e4497a32bf4a9fd5601b27661aa0b933a923191bf403bd08669ab2468d43b379096d6f76655f636f696e084d6f7665436f696e000080841e00000000006400000000000000c2276ada00000000020020ea526ba1710343d953461ff68641f1b7df5f23b9042ffa2d2a798d3adb3f3d6c40e230b49f552fb85356dbec9df13f0dc56228eb7a9c29a8af3a99f4ae95b86c72bdcaa4ff1e9beb0bd81c298b967b9d97449856ec8bc672a08e2efef345c37100", // Expected encoded transaction
+ r#"{
+ "expiration_timestamp_secs": "3664390082",
+ "gas_unit_price": "100",
+ "max_gas_amount": "2000000",
+ "payload": {
+ "arguments": [],
+ "function": "0x1::managed_coin::register",
+ "type": "entry_function_payload",
+ "type_arguments": ["0xe4497a32bf4a9fd5601b27661aa0b933a923191bf403bd08669ab2468d43b379::move_coin::MoveCoin"]
+ },
+ "sender": "0x7968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30",
+ "sequence_number": "23",
+ "signature": {
+ "public_key": "0xea526ba1710343d953461ff68641f1b7df5f23b9042ffa2d2a798d3adb3f3d6c",
+ "signature": "0xe230b49f552fb85356dbec9df13f0dc56228eb7a9c29a8af3a99f4ae95b86c72bdcaa4ff1e9beb0bd81c298b967b9d97449856ec8bc672a08e2efef345c37100",
+ "type": "ed25519_signature"
+ }
+ }"#);
+}
+
+// Successfully broadcasted: https://explorer.aptoslabs.com/txn/0x25dca849cb4ebacbff223139f7ad5d24c37c225d9506b8b12a925de70429e685/userTxnOverview?network=mainnet
+#[test]
+fn test_aptos_tortuga_stake() {
+ let input = setup_proto_transaction(
+ "0xf3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc", // Sender's address
+ "786fc7ceca43b4c1da018fea5d96f35dfdf5605f220b1205ff29c5c6d9eccf05", // Keypair
+ "liquid_staking_ops",
+ 19, // Sequence number
+ 1,
+ 5554,
+ 1670240203,
+ 100,
+ "",
+ Some(OpsDetails::LiquidStakingOps(LiquidStakingOperation::Stake(
+ Stake {
+ amount: 100000000,
+ smart_contract_address: AccountAddress::from_str(
+ "0x8f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f",
+ )
+ .unwrap(),
+ },
+ ))),
+ );
+ let output = Signer::sign_proto(input);
+ test_tx_result(output,
+ "f3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc1300000000000000028f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f0c7374616b655f726f75746572057374616b6500010800e1f50500000000b2150000000000006400000000000000cbd78d630000000001", // Expected raw transaction bytes
+ "22d3166c3003f9c24a35fd39c71eb27e0d2bb82541be610822165c9283f56fefe5a9d46421b9caf174995bd8f83141e60ea8cff521ecf4741fe19e6ae9a5680d", // Expected signature
+ "f3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc1300000000000000028f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f0c7374616b655f726f75746572057374616b6500010800e1f50500000000b2150000000000006400000000000000cbd78d630000000001002089e0211d7e19c7d3a8e2030fe16c936a690ca9b95569098c5d2bf1031ff44bc44022d3166c3003f9c24a35fd39c71eb27e0d2bb82541be610822165c9283f56fefe5a9d46421b9caf174995bd8f83141e60ea8cff521ecf4741fe19e6ae9a5680d", // Expected encoded transaction
+ r#"{
+ "sender": "0xf3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc",
+ "sequence_number": "19",
+ "max_gas_amount": "5554",
+ "gas_unit_price": "100",
+ "expiration_timestamp_secs": "1670240203",
+ "payload": {
+ "function": "0x8f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f::stake_router::stake",
+ "type_arguments": [],
+ "arguments": [
+ "100000000"
+ ],
+ "type": "entry_function_payload"
+ },
+ "signature": {
+ "public_key": "0x89e0211d7e19c7d3a8e2030fe16c936a690ca9b95569098c5d2bf1031ff44bc4",
+ "signature": "0x22d3166c3003f9c24a35fd39c71eb27e0d2bb82541be610822165c9283f56fefe5a9d46421b9caf174995bd8f83141e60ea8cff521ecf4741fe19e6ae9a5680d",
+ "type": "ed25519_signature"
+ }
+ }"#);
+}
+
+// Successfully broadcasted: https://explorer.aptoslabs.com/txn/0x92edb4f756fe86118e34a0e64746c70260ee02c2ae2cf402b3e39f6a282ce968?network=mainnet
+#[test]
+fn test_aptos_tortuga_unstake() {
+ let input = setup_proto_transaction(
+ "0xf3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc", // Sender's address
+ "786fc7ceca43b4c1da018fea5d96f35dfdf5605f220b1205ff29c5c6d9eccf05", // Keypair
+ "liquid_staking_ops",
+ 20, // Sequence number
+ 1,
+ 2371,
+ 1670304949,
+ 120,
+ "",
+ Some(OpsDetails::LiquidStakingOps(
+ LiquidStakingOperation::Unstake(Unstake {
+ amount: 99178100,
+ smart_contract_address: AccountAddress::from_str(
+ "0x8f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f",
+ )
+ .unwrap(),
+ }),
+ )),
+ );
+ let output = Signer::sign_proto(input);
+ test_tx_result(output,
+ "f3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc1400000000000000028f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f0c7374616b655f726f7574657207756e7374616b650001087456e9050000000043090000000000007800000000000000b5d48e630000000001", // Expected raw transaction bytes
+ "6994b917432ad70ae84d2ce1484e6aece589a68aad1b7c6e38c9697f2a012a083a3a755c5e010fd3d0f149a75dd8d257acbd09f10800e890074e5ad384314d0c", // Expected signature
+ "f3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc1400000000000000028f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f0c7374616b655f726f7574657207756e7374616b650001087456e9050000000043090000000000007800000000000000b5d48e630000000001002089e0211d7e19c7d3a8e2030fe16c936a690ca9b95569098c5d2bf1031ff44bc4406994b917432ad70ae84d2ce1484e6aece589a68aad1b7c6e38c9697f2a012a083a3a755c5e010fd3d0f149a75dd8d257acbd09f10800e890074e5ad384314d0c", // Expected encoded transaction
+ r#"{
+ "sender": "0xf3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc",
+ "sequence_number": "20",
+ "max_gas_amount": "2371",
+ "gas_unit_price": "120",
+ "expiration_timestamp_secs": "1670304949",
+ "payload": {
+ "function": "0x8f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f::stake_router::unstake",
+ "type_arguments": [],
+ "arguments": [
+ "99178100"
+ ],
+ "type": "entry_function_payload"
+ },
+ "signature": {
+ "public_key": "0x89e0211d7e19c7d3a8e2030fe16c936a690ca9b95569098c5d2bf1031ff44bc4",
+ "signature": "0x6994b917432ad70ae84d2ce1484e6aece589a68aad1b7c6e38c9697f2a012a083a3a755c5e010fd3d0f149a75dd8d257acbd09f10800e890074e5ad384314d0c",
+ "type": "ed25519_signature"
+ }
+ }"#);
+}
+
+// // Successfully broadcasted: https://explorer.aptoslabs.com/txn/0x9fc874de7a7d3e813d9a1658d896023de270a0096a5e258c196005656ace7d54?network=mainnet
+#[test]
+fn test_aptos_tortuga_claim() {
+ let input = setup_proto_transaction(
+ "0xf3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc", // Sender's address
+ "786fc7ceca43b4c1da018fea5d96f35dfdf5605f220b1205ff29c5c6d9eccf05", // Keypair
+ "liquid_staking_ops",
+ 28, // Sequence number
+ 1,
+ 10,
+ 1682066783,
+ 148,
+ "",
+ Some(OpsDetails::LiquidStakingOps(LiquidStakingOperation::Claim(
+ liquid_staking::Claim {
+ idx: 0,
+ smart_contract_address: AccountAddress::from_str(
+ "0x8f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f",
+ )
+ .unwrap(),
+ },
+ ))),
+ );
+ let output = Signer::sign_proto(input);
+ test_tx_result(output,
+ "f3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc1c00000000000000028f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f0c7374616b655f726f7574657205636c61696d00010800000000000000000a0000000000000094000000000000005f4d42640000000001", // Expected raw transaction bytes
+ "c936584f89777e1fe2d5dd75cd8d9c514efc445810ba22f462b6fe7229c6ec7fc1c8b25d3e233eafaa8306433b3220235e563498ba647be38cac87ff618e3d03", // Expected signature
+ "f3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc1c00000000000000028f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f0c7374616b655f726f7574657205636c61696d00010800000000000000000a0000000000000094000000000000005f4d42640000000001002089e0211d7e19c7d3a8e2030fe16c936a690ca9b95569098c5d2bf1031ff44bc440c936584f89777e1fe2d5dd75cd8d9c514efc445810ba22f462b6fe7229c6ec7fc1c8b25d3e233eafaa8306433b3220235e563498ba647be38cac87ff618e3d03", // Expected encoded transaction
+ r#"{
+ "sender": "0xf3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc",
+ "sequence_number": "28",
+ "max_gas_amount": "10",
+ "gas_unit_price": "148",
+ "expiration_timestamp_secs": "1682066783",
+ "payload": {
+ "function": "0x8f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f::stake_router::claim",
+ "type_arguments": [],
+ "arguments": [
+ "0"
+ ],
+ "type": "entry_function_payload"
+ },
+ "signature": {
+ "public_key": "0x89e0211d7e19c7d3a8e2030fe16c936a690ca9b95569098c5d2bf1031ff44bc4",
+ "signature": "0xc936584f89777e1fe2d5dd75cd8d9c514efc445810ba22f462b6fe7229c6ec7fc1c8b25d3e233eafaa8306433b3220235e563498ba647be38cac87ff618e3d03",
+ "type": "ed25519_signature"
+ }
+ }"#);
+}
+
+// Successfully broadcasted: https://explorer.aptoslabs.com/txn/0x7efd69e7f9462774b932ce500ab51c0d0dcc004cf272e09f8ffd5804c2a84e33?network=mainnet
+#[test]
+fn test_aptos_blind_sign() {
+ let input = setup_proto_transaction(
+ "0x07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30", // Sender's address
+ "5d996aa76b3212142792d9130796cd2e11e3c445a93118c08414df4f66bc60ec", // Keypair
+ "blind_sign_json",
+ 42, // Sequence number
+ 1,
+ 100011,
+ 3664390082,
+ 100,
+ r#"{
+ "function": "0x16fe2df00ea7dde4a63409201f7f4e536bde7bb7335526a35d05111e68aa322c::AnimeSwapPoolV1::swap_exact_coins_for_coins_3_pair_entry",
+ "type_arguments": [
+ "0x1::aptos_coin::AptosCoin",
+ "0x881ac202b1f1e6ad4efcff7a1d0579411533f2502417a19211cfc49751ddb5f4::coin::MOJO",
+ "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDT",
+ "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC"
+ ],
+ "arguments": [
+ "1000000",
+ "49329"
+ ],
+ "type": "entry_function_payload"
+ }"#,
+ None,
+ );
+ let output = Signer::sign_proto(input);
+ test_tx_result(output,
+ "07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f302a000000000000000216fe2df00ea7dde4a63409201f7f4e536bde7bb7335526a35d05111e68aa322c0f416e696d6553776170506f6f6c563127737761705f65786163745f636f696e735f666f725f636f696e735f335f706169725f656e747279040700000000000000000000000000000000000000000000000000000000000000010a6170746f735f636f696e094170746f73436f696e0007881ac202b1f1e6ad4efcff7a1d0579411533f2502417a19211cfc49751ddb5f404636f696e044d4f4a4f0007f22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa05617373657404555344540007f22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa056173736574045553444300020840420f000000000008b1c0000000000000ab860100000000006400000000000000c2276ada0000000001", // Expected raw transaction bytes
+ "42cd67406e85afd1e948e7ad7f5f484fb4c60d82b267c6b6b28a92301e228b983206d2b87cd5487cf9acfb0effbd183ab90123570eb2e047cb152d337152210b", // Expected signature
+ "07968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f302a000000000000000216fe2df00ea7dde4a63409201f7f4e536bde7bb7335526a35d05111e68aa322c0f416e696d6553776170506f6f6c563127737761705f65786163745f636f696e735f666f725f636f696e735f335f706169725f656e747279040700000000000000000000000000000000000000000000000000000000000000010a6170746f735f636f696e094170746f73436f696e0007881ac202b1f1e6ad4efcff7a1d0579411533f2502417a19211cfc49751ddb5f404636f696e044d4f4a4f0007f22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa05617373657404555344540007f22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa056173736574045553444300020840420f000000000008b1c0000000000000ab860100000000006400000000000000c2276ada00000000010020ea526ba1710343d953461ff68641f1b7df5f23b9042ffa2d2a798d3adb3f3d6c4042cd67406e85afd1e948e7ad7f5f484fb4c60d82b267c6b6b28a92301e228b983206d2b87cd5487cf9acfb0effbd183ab90123570eb2e047cb152d337152210b", // Expected encoded transaction
+ r#"{
+ "expiration_timestamp_secs": "3664390082",
+ "gas_unit_price": "100",
+ "max_gas_amount": "100011",
+ "payload": {
+ "function": "0x16fe2df00ea7dde4a63409201f7f4e536bde7bb7335526a35d05111e68aa322c::AnimeSwapPoolV1::swap_exact_coins_for_coins_3_pair_entry",
+ "type_arguments": [
+ "0x1::aptos_coin::AptosCoin",
+ "0x881ac202b1f1e6ad4efcff7a1d0579411533f2502417a19211cfc49751ddb5f4::coin::MOJO",
+ "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDT",
+ "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC"
+ ],
+ "arguments": [
+ "1000000",
+ "49329"
+ ],
+ "type": "entry_function_payload"
+ },
+ "sender": "0x7968dab936c1bad187c60ce4082f307d030d780e91e694ae03aef16aba73f30",
+ "sequence_number": "42",
+ "signature": {
+ "public_key": "0xea526ba1710343d953461ff68641f1b7df5f23b9042ffa2d2a798d3adb3f3d6c",
+ "signature": "0x42cd67406e85afd1e948e7ad7f5f484fb4c60d82b267c6b6b28a92301e228b983206d2b87cd5487cf9acfb0effbd183ab90123570eb2e047cb152d337152210b",
+ "type": "ed25519_signature"
+ }
+ }"#);
+}
+
+// Successfully broadcasted: https://explorer.aptoslabs.com/txn/0x25dca849cb4ebacbff223139f7ad5d24c37c225d9506b8b12a925de70429e685/payload
+#[test]
+fn test_aptos_blind_sign_staking() {
+ let input = setup_proto_transaction(
+ "0xf3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc", // Sender's address
+ "5d996aa76b3212142792d9130796cd2e11e3c445a93118c08414df4f66bc60ec", // Keypair
+ "blind_sign_json",
+ 43, // Sequence number
+ 1,
+ 100011,
+ 3664390082,
+ 100,
+ r#"{
+ "function": "0x8f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f::stake_router::stake",
+ "type_arguments": [],
+ "arguments": [
+ "100000000"
+ ],
+ "type": "entry_function_payload"
+ }"#,
+ None,
+ );
+ let output = Signer::sign_proto(input);
+ test_tx_result(output,
+ "f3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc2b00000000000000028f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f0c7374616b655f726f75746572057374616b6500010800e1f50500000000ab860100000000006400000000000000c2276ada0000000001", // Expected raw transaction bytes
+ "a41b7440a50f36e8491319508734acb55488abc6d88fbc9cb2b37ba23210f01f5d08c856cb7abf18c414cf9302ee144450bd99495a7e21e61f624764db91eb0b", // Expected signature
+ "f3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc2b00000000000000028f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f0c7374616b655f726f75746572057374616b6500010800e1f50500000000ab860100000000006400000000000000c2276ada00000000010020ea526ba1710343d953461ff68641f1b7df5f23b9042ffa2d2a798d3adb3f3d6c40a41b7440a50f36e8491319508734acb55488abc6d88fbc9cb2b37ba23210f01f5d08c856cb7abf18c414cf9302ee144450bd99495a7e21e61f624764db91eb0b", // Expected encoded transaction
+ r#"{
+ "expiration_timestamp_secs": "3664390082",
+ "gas_unit_price": "100",
+ "max_gas_amount": "100011",
+ "payload": {
+ "function": "0x8f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f::stake_router::stake",
+ "type_arguments": [],
+ "arguments": [
+ "100000000"
+ ],
+ "type": "entry_function_payload"
+ },
+ "sender": "0xf3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc",
+ "sequence_number": "43",
+ "signature": {
+ "public_key": "0xea526ba1710343d953461ff68641f1b7df5f23b9042ffa2d2a798d3adb3f3d6c",
+ "signature": "0xa41b7440a50f36e8491319508734acb55488abc6d88fbc9cb2b37ba23210f01f5d08c856cb7abf18c414cf9302ee144450bd99495a7e21e61f624764db91eb0b",
+ "type": "ed25519_signature"
+ }
+ }"#);
+}
+
+// Successfully broadcasted: https://explorer.aptoslabs.com/txn/0x92edb4f756fe86118e34a0e64746c70260ee02c2ae2cf402b3e39f6a282ce968/payload
+#[test]
+fn test_aptos_blind_sign_unstaking() {
+ let input = setup_proto_transaction(
+ "0xf3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc", // Sender's address
+ "5d996aa76b3212142792d9130796cd2e11e3c445a93118c08414df4f66bc60ec", // Keypair
+ "blind_sign_json",
+ 44, // Sequence number
+ 1,
+ 100011,
+ 3664390082,
+ 100,
+ r#"{
+ "function": "0x8f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f::stake_router::unstake",
+ "type_arguments": [],
+ "arguments": [
+ "99178100"
+ ],
+ "type": "entry_function_payload"
+ }"#,
+ None,
+ );
+ let output = Signer::sign_proto(input);
+ test_tx_result(output,
+ "f3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc2c00000000000000028f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f0c7374616b655f726f7574657207756e7374616b650001087456e90500000000ab860100000000006400000000000000c2276ada0000000001", // Expected raw transaction bytes
+ "a58ad5e3331beb8c0212a18a1f932207cb664b78f5aad3cb1fe7435e0e0e053247ce49b38fd67b064bed34ed643eb6a03165d77c681d7d73ac3161ab984a960a", // Expected signature
+ "f3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc2c00000000000000028f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f0c7374616b655f726f7574657207756e7374616b650001087456e90500000000ab860100000000006400000000000000c2276ada00000000010020ea526ba1710343d953461ff68641f1b7df5f23b9042ffa2d2a798d3adb3f3d6c40a58ad5e3331beb8c0212a18a1f932207cb664b78f5aad3cb1fe7435e0e0e053247ce49b38fd67b064bed34ed643eb6a03165d77c681d7d73ac3161ab984a960a", // Expected encoded transaction
+ r#"{
+ "expiration_timestamp_secs": "3664390082",
+ "gas_unit_price": "100",
+ "max_gas_amount": "100011",
+ "payload": {
+ "function": "0x8f396e4246b2ba87b51c0739ef5ea4f26515a98375308c31ac2ec1e42142a57f::stake_router::unstake",
+ "type_arguments": [],
+ "arguments": [
+ "99178100"
+ ],
+ "type": "entry_function_payload"
+ },
+ "sender": "0xf3d7f364dd7705824a5ebda9c7aab6cb3fc7bb5b58718249f12defec240b36cc",
+ "sequence_number": "44",
+ "signature": {
+ "public_key": "0xea526ba1710343d953461ff68641f1b7df5f23b9042ffa2d2a798d3adb3f3d6c",
+ "signature": "0xa58ad5e3331beb8c0212a18a1f932207cb664b78f5aad3cb1fe7435e0e0e053247ce49b38fd67b064bed34ed643eb6a03165d77c681d7d73ac3161ab984a960a",
+ "type": "ed25519_signature"
+ }
+ }"#);
+}
diff --git a/rust/chains/tw_binance/Cargo.toml b/rust/chains/tw_binance/Cargo.toml
new file mode 100644
index 00000000000..e5c9a10aa2c
--- /dev/null
+++ b/rust/chains/tw_binance/Cargo.toml
@@ -0,0 +1,21 @@
+[package]
+name = "tw_binance"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+quick-protobuf = "0.8.1"
+serde = { version = "1.0", features = ["derive"] }
+serde_json = "1.0"
+serde_repr = "0.1"
+strum_macros = "0.25"
+tw_bech32_address = { path = "../../tw_bech32_address" }
+tw_coin_entry = { path = "../../tw_coin_entry" }
+tw_cosmos_sdk = { path = "../../tw_cosmos_sdk" }
+tw_encoding = { path = "../../tw_encoding" }
+tw_evm = { path = "../../tw_evm" }
+tw_hash = { path = "../../tw_hash" }
+tw_keypair = { path = "../../tw_keypair" }
+tw_memory = { path = "../../tw_memory" }
+tw_misc = { path = "../../tw_misc", features = ["serde"] }
+tw_proto = { path = "../../tw_proto" }
diff --git a/rust/chains/tw_binance/fuzz/.gitignore b/rust/chains/tw_binance/fuzz/.gitignore
new file mode 100644
index 00000000000..5c404b9583f
--- /dev/null
+++ b/rust/chains/tw_binance/fuzz/.gitignore
@@ -0,0 +1,5 @@
+target
+corpus
+artifacts
+coverage
+Cargo.lock
diff --git a/rust/chains/tw_binance/fuzz/Cargo.toml b/rust/chains/tw_binance/fuzz/Cargo.toml
new file mode 100644
index 00000000000..179f9d77239
--- /dev/null
+++ b/rust/chains/tw_binance/fuzz/Cargo.toml
@@ -0,0 +1,30 @@
+[package]
+name = "tw_binance-fuzz"
+version = "0.0.0"
+publish = false
+edition = "2021"
+
+[package.metadata]
+cargo-fuzz = true
+
+[dependencies]
+libfuzzer-sys = "0.4"
+tw_any_coin = { path = "../../../tw_any_coin", features = ["test-utils"] }
+tw_coin_registry = { path = "../../../tw_coin_registry" }
+tw_proto = { path = "../../../tw_proto", features = ["fuzz"] }
+
+[dependencies.tw_binance]
+path = ".."
+
+# Prevent this from interfering with workspaces
+[workspace]
+members = ["."]
+
+[profile.release]
+debug = 1
+
+[[bin]]
+name = "sign"
+path = "fuzz_targets/sign.rs"
+test = false
+doc = false
diff --git a/rust/chains/tw_binance/fuzz/fuzz_targets/sign.rs b/rust/chains/tw_binance/fuzz/fuzz_targets/sign.rs
new file mode 100644
index 00000000000..482fd1f5844
--- /dev/null
+++ b/rust/chains/tw_binance/fuzz/fuzz_targets/sign.rs
@@ -0,0 +1,11 @@
+#![no_main]
+
+use libfuzzer_sys::fuzz_target;
+use tw_any_coin::test_utils::sign_utils::AnySignerHelper;
+use tw_coin_registry::coin_type::CoinType;
+use tw_proto::Binance::Proto;
+
+fuzz_target!(|input: Proto::SigningInput<'_>| {
+ let mut signer = AnySignerHelper::::default();
+ let _ = signer.sign(CoinType::Binance, input);
+});
diff --git a/rust/chains/tw_binance/src/address.rs b/rust/chains/tw_binance/src/address.rs
new file mode 100644
index 00000000000..45b00e26bb4
--- /dev/null
+++ b/rust/chains/tw_binance/src/address.rs
@@ -0,0 +1,92 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use serde::{Deserialize, Serialize};
+use std::fmt;
+use std::str::FromStr;
+use tw_bech32_address::bech32_prefix::Bech32Prefix;
+use tw_bech32_address::Bech32Address;
+use tw_coin_entry::coin_context::CoinContext;
+use tw_coin_entry::coin_entry::CoinAddress;
+use tw_coin_entry::error::prelude::*;
+use tw_cosmos_sdk::address::CosmosAddress;
+use tw_keypair::tw::PublicKey;
+use tw_memory::Data;
+
+/// The list of known BNB hrps.
+const BNB_KNOWN_HRPS: [&str; 2] = [
+ BinanceAddress::VALIDATOR_HRP, // BNB Validator HRP.
+ "bca",
+];
+
+#[derive(Deserialize, PartialEq, Serialize)]
+pub struct BinanceAddress(Bech32Address);
+
+impl CoinAddress for BinanceAddress {
+ #[inline]
+ fn data(&self) -> Data {
+ self.0.data()
+ }
+}
+
+impl CosmosAddress for BinanceAddress {}
+
+impl BinanceAddress {
+ pub const VALIDATOR_HRP: &'static str = "bva";
+
+ pub fn new_validator_addr(key_hash: Data) -> AddressResult {
+ Bech32Address::new(Self::VALIDATOR_HRP.to_string(), key_hash).map(BinanceAddress)
+ }
+
+ /// Creates a Binance address with the only `prefix`
+ pub fn from_str_with_coin_and_prefix(
+ coin: &dyn CoinContext,
+ address_str: String,
+ prefix: Option,
+ ) -> AddressResult
+ where
+ Self: Sized,
+ {
+ let possible_hrps = match prefix {
+ Some(Bech32Prefix { hrp }) => vec![hrp],
+ None => {
+ let coin_hrp = coin.hrp().ok_or(AddressError::InvalidHrp)?;
+ let other_hrps = BNB_KNOWN_HRPS
+ .iter()
+ .map(|another_hrp| another_hrp.to_string());
+ std::iter::once(coin_hrp).chain(other_hrps).collect()
+ },
+ };
+ Bech32Address::from_str_checked(possible_hrps, address_str).map(BinanceAddress)
+ }
+
+ pub fn with_public_key_coin_context(
+ coin: &dyn CoinContext,
+ public_key: &PublicKey,
+ prefix: Option,
+ ) -> AddressResult {
+ Bech32Address::with_public_key_coin_context(coin, public_key, prefix).map(BinanceAddress)
+ }
+
+ pub fn from_key_hash_with_coin(
+ coin: &dyn CoinContext,
+ key_hash: Data,
+ ) -> AddressResult {
+ Bech32Address::from_key_hash_with_coin(coin, key_hash).map(BinanceAddress)
+ }
+}
+
+impl FromStr for BinanceAddress {
+ type Err = AddressError;
+
+ fn from_str(s: &str) -> Result {
+ Bech32Address::from_str(s).map(BinanceAddress)
+ }
+}
+
+impl fmt::Display for BinanceAddress {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ fmt::Display::fmt(&self.0, f)
+ }
+}
diff --git a/rust/chains/tw_binance/src/amino.rs b/rust/chains/tw_binance/src/amino.rs
new file mode 100644
index 00000000000..6bcc017dd48
--- /dev/null
+++ b/rust/chains/tw_binance/src/amino.rs
@@ -0,0 +1,125 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use quick_protobuf::MessageWrite;
+use tw_encoding::{EncodingError, EncodingResult};
+use tw_memory::Data;
+use tw_proto::serialize;
+
+pub struct AminoEncoder {
+ /// The Amino content starts with a prefix.
+ content: Data,
+}
+
+impl AminoEncoder {
+ pub fn new(prefix: &[u8]) -> AminoEncoder {
+ AminoEncoder {
+ content: prefix.to_vec(),
+ }
+ }
+
+ pub fn extend_content(mut self, content: &[u8]) -> AminoEncoder {
+ self.content.extend_from_slice(content);
+ self
+ }
+
+ pub fn extend_with_msg(mut self, msg: &M) -> EncodingResult {
+ let msg_data = serialize(msg).map_err(|_| EncodingError::Internal)?;
+ self.content.extend_from_slice(&msg_data);
+ Ok(self)
+ }
+
+ pub fn encode(self) -> Data {
+ self.content
+ }
+
+ pub fn encode_size_prefixed(self) -> EncodingResult {
+ const CONTENT_SIZE_CAPACITY: usize = 10;
+
+ let content_len = self.content.len();
+ let capacity = content_len + CONTENT_SIZE_CAPACITY;
+
+ let mut buffer = Vec::with_capacity(capacity);
+
+ Self::write_varint(&mut buffer, content_len as u64)?;
+ buffer.extend_from_slice(&self.content);
+
+ Ok(buffer)
+ }
+
+ /// This method takes `&mut Data` instead of `&mut [u8]` because the given `buffer` can be extended (become longer).
+ fn write_varint(buffer: &mut Data, num: u64) -> EncodingResult<()> {
+ let mut writer = quick_protobuf::Writer::new(buffer);
+ writer
+ .write_varint(num)
+ .map_err(|_| EncodingError::Internal)
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use tw_encoding::hex::DecodeHex;
+
+ struct TestInput {
+ prefix: &'static str,
+ content: &'static str,
+ content_size_prefixed: bool,
+ expected: &'static str,
+ }
+
+ fn amino_encode_impl(input: TestInput) {
+ let prefix = input.prefix.decode_hex().unwrap();
+ let content = input.content.decode_hex().unwrap();
+
+ let encoder = AminoEncoder::new(&prefix).extend_content(&content);
+
+ let actual = if input.content_size_prefixed {
+ encoder
+ .encode_size_prefixed()
+ .expect("Error on Amino encoding with content size prefix")
+ } else {
+ encoder.encode()
+ };
+
+ let expected = input.expected.decode_hex().unwrap();
+ assert_eq!(actual, expected);
+ }
+
+ #[test]
+ fn test_amino_encode() {
+ let content_size_prefixed = false;
+
+ amino_encode_impl(TestInput {
+ prefix: "0b0c0d0e",
+ content: "0102030405060708",
+ content_size_prefixed,
+ expected: "0b0c0d0e0102030405060708",
+ });
+ amino_encode_impl(TestInput {
+ prefix: "0b0c0d0e",
+ content: "01020304050607080102030405060708010203040506070801020304050607080102030405060708",
+ content_size_prefixed,
+ expected: "0b0c0d0e01020304050607080102030405060708010203040506070801020304050607080102030405060708",
+ });
+ }
+
+ #[test]
+ fn test_amino_encode_with_content_size_prefix() {
+ let content_size_prefixed = true;
+
+ amino_encode_impl(TestInput {
+ prefix: "0b0c0d0e",
+ content: "0102030405060708",
+ content_size_prefixed,
+ expected: "0c0b0c0d0e0102030405060708",
+ });
+ amino_encode_impl(TestInput {
+ prefix: "0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e",
+ content: "0102030405060708",
+ content_size_prefixed,
+ expected: "dc020b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0b0c0d0e0f101112131415161718191a1b1c1d1e0102030405060708",
+ });
+ }
+}
diff --git a/rust/chains/tw_binance/src/compiler.rs b/rust/chains/tw_binance/src/compiler.rs
new file mode 100644
index 00000000000..400c37e36ec
--- /dev/null
+++ b/rust/chains/tw_binance/src/compiler.rs
@@ -0,0 +1,101 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::context::BinanceContext;
+use crate::modules::preimager::{JsonPreimager, JsonTxPreimage};
+use crate::modules::serializer::BinanceAminoSerializer;
+use crate::modules::tx_builder::TxBuilder;
+use crate::signature::BinanceSignature;
+use crate::transaction::SignerInfo;
+use tw_coin_entry::coin_context::CoinContext;
+use tw_coin_entry::coin_entry::{PublicKeyBytes, SignatureBytes};
+use tw_coin_entry::common::compile_input::SingleSignaturePubkey;
+use tw_coin_entry::error::prelude::*;
+use tw_coin_entry::signing_output_error;
+use tw_cosmos_sdk::modules::serializer::json_serializer::JsonSerializer;
+use tw_cosmos_sdk::public_key::secp256k1::Secp256PublicKey;
+use tw_cosmos_sdk::public_key::CosmosPublicKey;
+use tw_misc::traits::ToBytesVec;
+use tw_proto::Binance::Proto;
+use tw_proto::TxCompiler::Proto as CompilerProto;
+
+pub struct BinanceCompiler;
+
+impl BinanceCompiler {
+ #[inline]
+ pub fn preimage_hashes(
+ coin: &dyn CoinContext,
+ input: Proto::SigningInput<'_>,
+ ) -> CompilerProto::PreSigningOutput<'static> {
+ Self::preimage_hashes_impl(coin, input)
+ .unwrap_or_else(|e| signing_output_error!(CompilerProto::PreSigningOutput, e))
+ }
+
+ fn preimage_hashes_impl(
+ coin: &dyn CoinContext,
+ input: Proto::SigningInput<'_>,
+ ) -> SigningResult> {
+ let unsigned_tx = TxBuilder::unsigned_tx_from_proto(coin, &input)?;
+ let JsonTxPreimage {
+ tx_hash,
+ encoded_tx,
+ } = JsonPreimager::preimage_hash(&unsigned_tx)?;
+
+ Ok(CompilerProto::PreSigningOutput {
+ data_hash: tx_hash.to_vec().into(),
+ data: encoded_tx.as_bytes().to_vec().into(),
+ ..CompilerProto::PreSigningOutput::default()
+ })
+ }
+
+ #[inline]
+ pub fn compile(
+ coin: &dyn CoinContext,
+ input: Proto::SigningInput<'_>,
+ signatures: Vec,
+ public_keys: Vec,
+ ) -> Proto::SigningOutput<'static> {
+ Self::compile_impl(coin, input, signatures, public_keys)
+ .unwrap_or_else(|e| signing_output_error!(Proto::SigningOutput, e))
+ }
+
+ fn compile_impl(
+ coin: &dyn CoinContext,
+ input: Proto::SigningInput<'_>,
+ signatures: Vec,
+ public_keys: Vec,
+ ) -> SigningResult> {
+ let SingleSignaturePubkey {
+ signature,
+ public_key,
+ } = SingleSignaturePubkey::from_sign_pubkey_list(signatures, public_keys)?;
+ let signature = BinanceSignature::try_from(signature.as_slice())?;
+ let public_key_params = None;
+ let public_key =
+ Secp256PublicKey::from_bytes(coin, public_key.as_slice(), public_key_params)?;
+
+ let signature_bytes = signature.to_vec();
+ let signature_json = JsonSerializer::::serialize_signature(
+ &public_key,
+ signature_bytes.clone(),
+ );
+
+ let unsigned_tx = TxBuilder::unsigned_tx_from_proto(coin, &input)?;
+ let signed_tx = unsigned_tx.into_signed(SignerInfo {
+ public_key,
+ signature,
+ });
+
+ let encoded_tx = BinanceAminoSerializer::serialize_signed_tx(&signed_tx)?;
+
+ let signature_json =
+ serde_json::to_string(&signature_json).tw_err(|_| SigningErrorType::Error_internal)?;
+ Ok(Proto::SigningOutput {
+ encoded: encoded_tx.into(),
+ signature: signature_bytes.into(),
+ signature_json: signature_json.into(),
+ ..Proto::SigningOutput::default()
+ })
+ }
+}
diff --git a/rust/chains/tw_binance/src/context.rs b/rust/chains/tw_binance/src/context.rs
new file mode 100644
index 00000000000..58952365b63
--- /dev/null
+++ b/rust/chains/tw_binance/src/context.rs
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::address::BinanceAddress;
+use tw_cosmos_sdk::context::CosmosContext;
+use tw_cosmos_sdk::private_key::secp256k1::Secp256PrivateKey;
+use tw_cosmos_sdk::public_key::secp256k1::Secp256PublicKey;
+use tw_cosmos_sdk::signature::secp256k1::Secp256k1Signature;
+use tw_hash::hasher::Hasher;
+
+pub struct BinanceContext;
+
+impl CosmosContext for BinanceContext {
+ type Address = BinanceAddress;
+ type PrivateKey = Secp256PrivateKey;
+ type PublicKey = Secp256PublicKey;
+ type Signature = Secp256k1Signature;
+
+ /// Binance Beacon chain uses `sha256` hash.
+ fn default_tx_hasher() -> Hasher {
+ Hasher::Sha256
+ }
+}
diff --git a/rust/chains/tw_binance/src/entry.rs b/rust/chains/tw_binance/src/entry.rs
new file mode 100644
index 00000000000..55930473d53
--- /dev/null
+++ b/rust/chains/tw_binance/src/entry.rs
@@ -0,0 +1,100 @@
+// SPDX-License-Identifier: Apache-2.0
+//
+// Copyright © 2017 Trust Wallet.
+
+use crate::address::BinanceAddress;
+use crate::compiler::BinanceCompiler;
+use crate::modules::wallet_connect::connector::BinanceWalletConnector;
+use crate::signer::BinanceSigner;
+use std::str::FromStr;
+use tw_bech32_address::bech32_prefix::Bech32Prefix;
+use tw_coin_entry::coin_context::CoinContext;
+use tw_coin_entry::coin_entry::{CoinEntry, PublicKeyBytes, SignatureBytes};
+use tw_coin_entry::derivation::Derivation;
+use tw_coin_entry::error::prelude::*;
+use tw_coin_entry::modules::json_signer::NoJsonSigner;
+use tw_coin_entry::modules::message_signer::NoMessageSigner;
+use tw_coin_entry::modules::plan_builder::NoPlanBuilder;
+use tw_coin_entry::modules::transaction_decoder::NoTransactionDecoder;
+use tw_coin_entry::modules::transaction_util::NoTransactionUtil;
+use tw_keypair::tw::PublicKey;
+use tw_proto::Binance::Proto;
+use tw_proto::TxCompiler::Proto as CompilerProto;
+
+pub struct BinanceEntry;
+
+impl CoinEntry for BinanceEntry {
+ type AddressPrefix = Bech32Prefix;
+ type Address = BinanceAddress;
+ type SigningInput<'a> = Proto::SigningInput<'a>;
+ type SigningOutput = Proto::SigningOutput<'static>;
+ type PreSigningOutput = CompilerProto::PreSigningOutput<'static>;
+
+ // Optional modules:
+ type JsonSigner = NoJsonSigner;
+ type PlanBuilder = NoPlanBuilder;
+ type MessageSigner = NoMessageSigner;
+ type WalletConnector = BinanceWalletConnector;
+ type TransactionDecoder = NoTransactionDecoder;
+ type TransactionUtil = NoTransactionUtil;
+
+ #[inline]
+ fn parse_address(
+ &self,
+ coin: &dyn CoinContext,
+ address: &str,
+ prefix: Option