From dd94ee246f98e7db1775293bc20ff7d537a0e008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=E1=BB=AFu=20H=C3=A0?= Date: Thu, 12 Jan 2023 18:34:52 +0700 Subject: [PATCH] init commit --- .vscode/settings.json | 3 +++ pkg/currency/currency.go | 15 +++++++++++++++ pkg/network/evm.go | 8 ++++++++ pkg/network/network.go | 4 ++++ pkg/network/tron.go | 8 ++++++++ pkg/wallet/key.go | 9 +++++++++ pkg/wallet/wallet.go | 36 ++++++++++++++++++++++++++++++++++++ 7 files changed, 83 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 pkg/currency/currency.go create mode 100644 pkg/network/evm.go create mode 100644 pkg/network/network.go create mode 100644 pkg/network/tron.go create mode 100644 pkg/wallet/key.go create mode 100644 pkg/wallet/wallet.go diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..1f2b05c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "nuxt.isNuxtApp": false +} \ No newline at end of file diff --git a/pkg/currency/currency.go b/pkg/currency/currency.go new file mode 100644 index 0000000..30bf6bf --- /dev/null +++ b/pkg/currency/currency.go @@ -0,0 +1,15 @@ +package currency + +type CurrencyOptions struct { + ContractAddress string + Decimal int +} + +type Currency struct { + Symbol string + Options CurrencyOptions +} + +func NewCurrency(symbol string, options CurrencyOptions) *Currency { + return &Currency{} +} diff --git a/pkg/network/evm.go b/pkg/network/evm.go new file mode 100644 index 0000000..518e415 --- /dev/null +++ b/pkg/network/evm.go @@ -0,0 +1,8 @@ +package network + +type EVM struct { +} + +func NewEVM() Network { + return &EVM{} +} diff --git a/pkg/network/network.go b/pkg/network/network.go new file mode 100644 index 0000000..cea7fa8 --- /dev/null +++ b/pkg/network/network.go @@ -0,0 +1,4 @@ +package network + +type Network interface { +} diff --git a/pkg/network/tron.go b/pkg/network/tron.go new file mode 100644 index 0000000..df106ca --- /dev/null +++ b/pkg/network/tron.go @@ -0,0 +1,8 @@ +package network + +type TRON struct { +} + +func NewTRON() Network { + return &TRON{} +} diff --git a/pkg/wallet/key.go b/pkg/wallet/key.go new file mode 100644 index 0000000..7c71287 --- /dev/null +++ b/pkg/wallet/key.go @@ -0,0 +1,9 @@ +package wallet + +type Key struct { + Opt *Options +} + +func NewKey(opts ...Option) *Key { + +} diff --git a/pkg/wallet/wallet.go b/pkg/wallet/wallet.go new file mode 100644 index 0000000..d9abee2 --- /dev/null +++ b/pkg/wallet/wallet.go @@ -0,0 +1,36 @@ +package wallet + +type Option func(o *Options) + +type Options struct { + Mnemonic string + Index uint32 +} + +type Wallet struct { + Options Options +} + +func AddressIndex(i uint32) Option { + return func(o *Options) { + o.Index = i + } +} + +func Mnemonic(mnemonic string) Option { + return func(o *Options) { + o.Mnemonic = mnemonic + } +} + +func NewWallet(opts ...Option) *Wallet { + opt := Options{} + + for _, o := range opts { + o(&opt) + } + + return &Wallet{ + Options: opt, + } +}