-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WASM, Kotlin]: Fixed methods and properties in enums (#2919)
- Loading branch information
1 parent
7e81d2f
commit 3d2c86d
Showing
17 changed files
with
383 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,71 +52,11 @@ | |
"@jridgewell/resolve-uri" "3.1.0" | ||
"@jridgewell/sourcemap-codec" "1.4.14" | ||
|
||
"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": | ||
version "1.1.2" | ||
resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" | ||
integrity sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ== | ||
|
||
"@protobufjs/base64@^1.1.2": | ||
version "1.1.2" | ||
resolved "https://registry.yarnpkg.com/@protobufjs/base64/-/base64-1.1.2.tgz#4c85730e59b9a1f1f349047dbf24296034bb2735" | ||
integrity sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg== | ||
|
||
"@protobufjs/codegen@^2.0.4": | ||
version "2.0.4" | ||
resolved "https://registry.yarnpkg.com/@protobufjs/codegen/-/codegen-2.0.4.tgz#7ef37f0d010fb028ad1ad59722e506d9262815cb" | ||
integrity sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg== | ||
|
||
"@protobufjs/eventemitter@^1.1.0": | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz#355cbc98bafad5978f9ed095f397621f1d066b70" | ||
integrity sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q== | ||
|
||
"@protobufjs/fetch@^1.1.0": | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/@protobufjs/fetch/-/fetch-1.1.0.tgz#ba99fb598614af65700c1619ff06d454b0d84c45" | ||
integrity sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ== | ||
dependencies: | ||
"@protobufjs/aspromise" "^1.1.1" | ||
"@protobufjs/inquire" "^1.1.0" | ||
|
||
"@protobufjs/float@^1.0.2": | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/@protobufjs/float/-/float-1.0.2.tgz#5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1" | ||
integrity sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ== | ||
|
||
"@protobufjs/inquire@^1.1.0": | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/@protobufjs/inquire/-/inquire-1.1.0.tgz#ff200e3e7cf2429e2dcafc1140828e8cc638f089" | ||
integrity sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q== | ||
|
||
"@protobufjs/path@^1.1.2": | ||
version "1.1.2" | ||
resolved "https://registry.yarnpkg.com/@protobufjs/path/-/path-1.1.2.tgz#6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d" | ||
integrity sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA== | ||
|
||
"@protobufjs/pool@^1.1.0": | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/@protobufjs/pool/-/pool-1.1.0.tgz#09fd15f2d6d3abfa9b65bc366506d6ad7846ff54" | ||
integrity sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw== | ||
|
||
"@protobufjs/utf8@^1.1.0": | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" | ||
integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw== | ||
|
||
"@socket.io/component-emitter@~3.1.0": | ||
version "3.1.0" | ||
resolved "https://registry.yarnpkg.com/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz#96116f2a912e0c02817345b3c10751069920d553" | ||
integrity sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg== | ||
|
||
"@trustwallet/[email protected]": | ||
version "3.1.10" | ||
resolved "https://registry.yarnpkg.com/@trustwallet/wallet-core/-/wallet-core-3.1.10.tgz#3af4d0021a91f61faea7d3401d4e04197a843a9b" | ||
integrity sha512-4/Du55HQLcNrJsBXWqUlk+5G7TCan1CfaOhRTxfXad1txWMtTj75kkYnbfST5Oi2DaKbuH86FF+yYroSdgoEiw== | ||
dependencies: | ||
protobufjs ">=6.11.3" | ||
|
||
"@types/cookie@^0.4.1": | ||
version "0.4.1" | ||
resolved "https://registry.yarnpkg.com/@types/cookie/-/cookie-0.4.1.tgz#bfd02c1f2224567676c1545199f87c3a861d878d" | ||
|
@@ -160,7 +100,7 @@ | |
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" | ||
integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== | ||
|
||
"@types/node@*", "@types/node@>=10.0.0", "@types/node@>=13.7.0": | ||
"@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== | ||
|
@@ -658,14 +598,6 @@ dom-serialize@^2.2.1: | |
extend "^3.0.0" | ||
void-elements "^2.0.0" | ||
|
||
[email protected]: | ||
version "0.5.8-rc.4" | ||
resolved "https://registry.yarnpkg.com/dukat/-/dukat-0.5.8-rc.4.tgz#90384dcb50b14c26f0e99dae92b2dea44f5fce21" | ||
integrity sha512-ZnMt6DGBjlVgK2uQamXfd7uP/AxH7RqI0BL9GLrrJb2gKdDxvJChWy+M9AQEaL+7/6TmxzJxFOsRiInY9oGWTA== | ||
dependencies: | ||
google-protobuf "3.12.2" | ||
typescript "3.9.5" | ||
|
||
[email protected]: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" | ||
|
@@ -930,11 +862,6 @@ glob@^7.1.3, glob@^7.1.7: | |
once "^1.3.0" | ||
path-is-absolute "^1.0.0" | ||
|
||
[email protected]: | ||
version "3.12.2" | ||
resolved "https://registry.yarnpkg.com/google-protobuf/-/google-protobuf-3.12.2.tgz#50ce9f9b6281235724eb243d6a83e969a2176e53" | ||
integrity sha512-4CZhpuRr1d6HjlyrxoXoocoGFnRYgKULgMtikMddA9ztRyYR59Aondv2FioyxWVamRo0rF2XpYawkTCBEQOSkA== | ||
|
||
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" | ||
|
@@ -1231,11 +1158,6 @@ log4js@^6.4.1: | |
rfdc "^1.3.0" | ||
streamroller "^3.1.3" | ||
|
||
long@^5.0.0: | ||
version "5.2.1" | ||
resolved "https://registry.yarnpkg.com/long/-/long-5.2.1.tgz#e27595d0083d103d2fa2c20c7699f8e0c92b897f" | ||
integrity sha512-GKSNGeNAtw8IryjjkhZxuKB3JzlcLTwjtiQCHKvqQet81I93kXslhDQruGI/QsddO83mcDToBVy7GqGS/zYf/A== | ||
|
||
[email protected]: | ||
version "0.3.0" | ||
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" | ||
|
@@ -1463,24 +1385,6 @@ pkg-dir@^4.2.0: | |
dependencies: | ||
find-up "^4.0.0" | ||
|
||
protobufjs@>=6.11.3: | ||
version "7.2.0" | ||
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.2.0.tgz#ca6b1ceb9a9efe21186ba96178089ec563011a5e" | ||
integrity sha512-hYCqTDuII4iJ4stZqiuGCSU8xxWl5JeXYpwARGtn/tWcKCAro6h3WQz+xpsNbXW0UYqpmTQFEyFWO0G0Kjt64g== | ||
dependencies: | ||
"@protobufjs/aspromise" "^1.1.2" | ||
"@protobufjs/base64" "^1.1.2" | ||
"@protobufjs/codegen" "^2.0.4" | ||
"@protobufjs/eventemitter" "^1.1.0" | ||
"@protobufjs/fetch" "^1.1.0" | ||
"@protobufjs/float" "^1.0.2" | ||
"@protobufjs/inquire" "^1.1.0" | ||
"@protobufjs/path" "^1.1.2" | ||
"@protobufjs/pool" "^1.1.0" | ||
"@protobufjs/utf8" "^1.1.0" | ||
"@types/node" ">=13.7.0" | ||
long "^5.0.0" | ||
|
||
punycode@^2.1.0: | ||
version "2.3.0" | ||
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" | ||
|
@@ -1807,11 +1711,6 @@ type-is@~1.6.18: | |
media-typer "0.3.0" | ||
mime-types "~2.1.24" | ||
|
||
[email protected]: | ||
version "3.9.5" | ||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.5.tgz#586f0dba300cde8be52dd1ac4f7e1009c1b13f36" | ||
integrity sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ== | ||
|
||
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" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// 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. | ||
|
||
#include <TrustWalletCore/TWBitcoinSigHashType.h> | ||
|
||
#include <emscripten/bind.h> | ||
|
||
using namespace emscripten; | ||
|
||
#include "BitcoinSigHashTypeExt.h" | ||
|
||
namespace TW::Wasm { | ||
|
||
auto BitcoinSigHashTypeExt::isSingle(TWBitcoinSigHashType type) { | ||
return TWBitcoinSigHashTypeIsSingle(type); | ||
} | ||
auto BitcoinSigHashTypeExt::isNone(TWBitcoinSigHashType type) { | ||
return TWBitcoinSigHashTypeIsNone(type); | ||
} | ||
|
||
EMSCRIPTEN_BINDINGS(Wasm_BitcoinSigHashTypeExt) { | ||
class_<BitcoinSigHashTypeExt>("BitcoinSigHashTypeExt") | ||
.class_function("isSingle", &BitcoinSigHashTypeExt::isSingle) | ||
.class_function("isNone", &BitcoinSigHashTypeExt::isNone); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// 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 <TrustWalletCore/TWBitcoinSigHashType.h> | ||
|
||
#include <emscripten/bind.h> | ||
|
||
using namespace emscripten; | ||
|
||
namespace TW::Wasm { | ||
|
||
class BitcoinSigHashTypeExt { | ||
public: | ||
static auto isSingle(TWBitcoinSigHashType type); | ||
static auto isNone(TWBitcoinSigHashType type); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// 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. | ||
|
||
#include <TrustWalletCore/TWCoinType.h> | ||
#include "WasmString.h" | ||
|
||
#include "generated/PrivateKey.h" | ||
#include "generated/PublicKey.h" | ||
|
||
#include <emscripten/bind.h> | ||
|
||
using namespace emscripten; | ||
|
||
#include "CoinTypeExt.h" | ||
|
||
namespace TW::Wasm { | ||
|
||
auto CoinTypeExt::blockchain(TWCoinType coin) { | ||
return TWCoinTypeBlockchain(coin); | ||
} | ||
auto CoinTypeExt::purpose(TWCoinType coin) { | ||
return TWCoinTypePurpose(coin); | ||
} | ||
auto CoinTypeExt::curve(TWCoinType coin) { | ||
return TWCoinTypeCurve(coin); | ||
} | ||
auto CoinTypeExt::xpubVersion(TWCoinType coin) { | ||
return TWCoinTypeXpubVersion(coin); | ||
} | ||
auto CoinTypeExt::xprvVersion(TWCoinType coin) { | ||
return TWCoinTypeXprvVersion(coin); | ||
} | ||
auto CoinTypeExt::hrp(TWCoinType coin) { | ||
return TWCoinTypeHRP(coin); | ||
} | ||
auto CoinTypeExt::p2pkhPrefix(TWCoinType coin) { | ||
return TWCoinTypeP2pkhPrefix(coin); | ||
} | ||
auto CoinTypeExt::p2shPrefix(TWCoinType coin) { | ||
return TWCoinTypeP2shPrefix(coin); | ||
} | ||
auto CoinTypeExt::staticPrefix(TWCoinType coin) { | ||
return TWCoinTypeStaticPrefix(coin); | ||
} | ||
auto CoinTypeExt::chainId(TWCoinType coin) { | ||
return TWStringToStd(TWCoinTypeChainId(coin)); | ||
} | ||
auto CoinTypeExt::slip44Id(TWCoinType coin) { | ||
return TWCoinTypeSlip44Id(coin); | ||
} | ||
auto CoinTypeExt::ss58Prefix(TWCoinType coin) { | ||
return TWCoinTypeSS58Prefix(coin); | ||
} | ||
auto CoinTypeExt::publicKeyType(TWCoinType coin) { | ||
return TWCoinTypePublicKeyType(coin); | ||
} | ||
auto CoinTypeExt::validate(TWCoinType coin, const std::string& address) { | ||
return TWCoinTypeValidate(coin, &address); | ||
} | ||
auto CoinTypeExt::derivationPath(TWCoinType coin) { | ||
return TWStringToStd(TWCoinTypeDerivationPath(coin)); | ||
} | ||
auto CoinTypeExt::derivationPathWithDerivation(TWCoinType coin, TWDerivation derivation) { | ||
return TWStringToStd(TWCoinTypeDerivationPathWithDerivation(coin, derivation)); | ||
} | ||
auto CoinTypeExt::deriveAddress(TWCoinType coin, WasmPrivateKey* privateKey) { | ||
return TWStringToStd(TWCoinTypeDeriveAddress(coin, privateKey->instance)); | ||
} | ||
auto CoinTypeExt::deriveAddressFromPublicKey(TWCoinType coin, WasmPublicKey* publicKey) { | ||
return TWStringToStd(TWCoinTypeDeriveAddressFromPublicKey(coin, publicKey->instance)); | ||
} | ||
|
||
EMSCRIPTEN_BINDINGS(Wasm_CoinTypeExt) { | ||
class_<CoinTypeExt>("CoinTypeExt") | ||
.class_function("blockchain", &CoinTypeExt::blockchain) | ||
.class_function("purpose", &CoinTypeExt::purpose) | ||
.class_function("curve", &CoinTypeExt::curve) | ||
.class_function("xpubVersion", &CoinTypeExt::xpubVersion) | ||
.class_function("xprvVersion", &CoinTypeExt::xprvVersion) | ||
.class_function("hrp", &CoinTypeExt::hrp) | ||
.class_function("p2pkhPrefix", &CoinTypeExt::p2pkhPrefix) | ||
.class_function("p2shPrefix", &CoinTypeExt::p2shPrefix) | ||
.class_function("staticPrefix", &CoinTypeExt::staticPrefix) | ||
.class_function("chainId", &CoinTypeExt::chainId) | ||
.class_function("slip44Id", &CoinTypeExt::slip44Id) | ||
.class_function("ss58Prefix", &CoinTypeExt::ss58Prefix) | ||
.class_function("publicKeyType", &CoinTypeExt::publicKeyType) | ||
.class_function("validate", &CoinTypeExt::validate) | ||
.class_function("derivationPath", &CoinTypeExt::derivationPath) | ||
.class_function("derivationPathWithDerivation", &CoinTypeExt::derivationPathWithDerivation) | ||
.class_function("deriveAddress", &CoinTypeExt::deriveAddress, allow_raw_pointers()) | ||
.class_function("deriveAddressFromPublicKey", &CoinTypeExt::deriveAddressFromPublicKey, allow_raw_pointers()); | ||
}; | ||
} |
Oops, something went wrong.