Skip to content

Commit 9977191

Browse files
feat(stable-account): Add TWDerivationSmartChainStableAccount derivation type (#4585)
1 parent 5e6a7ed commit 9977191

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

codegen/bin/coins

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ def self.camel_case(id)
2626
id[0].upcase + id[1..].downcase
2727
end
2828

29+
def self.upper_camel_case(id)
30+
id.split('_').map { |w| w.capitalize }.join
31+
end
32+
2933
def self.coin_img(coin)
3034
"<img src=\"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/#{coin}/info/logo.png\" width=\"32\" />"
3135
end

codegen/lib/derivation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def derivation_name(deriv)
1414
# Returns a string of `<Coin><Derivation>` if derivation's name is specified, otherwise returns `Default`.
1515
def derivation_enum_name_no_prefix(deriv, coin)
1616
return "Default" if deriv['name'].nil?
17-
format_name(coin['name']) + camel_case(deriv['name'])
17+
format_name(coin['name']) + upper_camel_case(deriv['name'])
1818
end
1919

2020
# Returns a string of `TWDerivation<Coin><Derivation>` if derivation's name is specified, otherwise returns `TWDerivationDefault`.

include/TrustWalletCore/TWDerivation.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ enum TWDerivation {
2727
TWDerivationBitcoinTaproot = 8,
2828
TWDerivationPactusMainnet = 9,
2929
TWDerivationPactusTestnet = 10,
30+
TWDerivationSmartChainStableAccount = 11,
3031
// end_of_derivation_enum - USED TO GENERATE CODE
3132
};
3233

registry.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3090,6 +3090,11 @@
30903090
"derivation": [
30913091
{
30923092
"path": "m/44'/60'/0'/0/0"
3093+
},
3094+
{
3095+
"name": "stable_account",
3096+
"path": "m/44'/60'/9172'/3604/9999",
3097+
"description": "TrustWallet's specific derivation path for Stable Account wallets"
30933098
}
30943099
],
30953100
"curve": "secp256k1",

rust/tw_coin_registry/src/tw_derivation.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub enum TWDerivation {
2020
BitcoinTaproot = 8,
2121
PactusMainnet = 9,
2222
PactusTestnet = 10,
23+
SmartChainStableAccount = 11,
2324
// end_of_derivation_enum - USED TO GENERATE CODE
2425
#[default]
2526
Default = 0,
@@ -36,6 +37,7 @@ impl From<TWDerivation> for Derivation {
3637
TWDerivation::BitcoinTaproot => Derivation::Taproot,
3738
TWDerivation::PactusMainnet => Derivation::Default,
3839
TWDerivation::PactusTestnet => Derivation::Testnet,
40+
TWDerivation::SmartChainStableAccount => Derivation::Default,
3941
}
4042
}
4143
}

0 commit comments

Comments
 (0)