Squash merge develop into master

This commit is contained in:
Prad Nukala
2024-09-14 14:27:45 -04:00
parent a929e61d01
commit 05bda3d1b2
227 changed files with 56902 additions and 10178 deletions
-69
View File
@@ -1,69 +0,0 @@
package coins
// Coin represents a cryptocurrency
type Coin interface {
// FormatAddress formats a public key into an address
FormatAddress(pubKey []byte) (string, error)
// GetIndex returns the coin type index
GetIndex() int64
// GetPath returns the coin component path
GetPath() uint32
// GetSymbol returns the coin symbol
GetSymbol() string
// GetMethod returns the coin DID method
GetMethod() string
// GetName returns the coin name
GetName() string
}
// DefaultCoins is a list of default coins used in the vault
var DefaultCoins = []Coin{
CoinBTC,
CoinETH,
CoinSNR,
}
var (
// Bitcoin mainnet
CoinBTC = &coin{
Name: "Bitcoin",
Index: 0,
Path: 0x80000000,
Symbol: "BTC",
Hrp: "bc",
Method: "btcr",
}
// Ethereum
CoinETH = &coin{
Name: "Ethereum",
Index: 60,
Path: 0x8000003c,
Symbol: "ETH",
Method: "ethr",
}
// Sonr
CoinSNR = &coin{
Name: "Sonr",
Index: 703,
Path: 0x800002bf,
Symbol: "SNR",
Hrp: "idx",
Method: "sonr",
}
)
// CoinBTCType is the coin type for BTC
const CoinBTCType = int64(0)
// CoinETHType is the coin type for ETH
const CoinETHType = int64(60)
// CoinSNRType is the coin type for SNR
const CoinSNRType = int64(703)
-54
View File
@@ -1,54 +0,0 @@
package coins
import (
"fmt"
"github.com/cosmos/cosmos-sdk/types/bech32"
)
type coin struct {
Name string `json:"name"`
Symbol string `json:"symbol"`
Hrp string `json:"hrp"`
Method string `json:"method"`
Index int64 `json:"index"`
Path uint32 `json:"path"`
}
// FormatAddress formats the address based on the coin
func (c *coin) FormatAddress(pubKey []byte) (string, error) {
if c.Hrp != "" {
return bech32.ConvertAndEncode(c.Hrp, pubKey)
}
return "", fmt.Errorf("unsupported coin")
}
// GetIndex returns the coin index
func (c *coin) GetIndex() int64 {
return c.Index
}
// GetName returns the coin name
func (c *coin) GetName() string {
return c.Name
}
// GetSymbol returns the coin symbol
func (c *coin) GetSymbol() string {
return c.Symbol
}
// GetHrp returns the coin hrp
func (c *coin) GetHrp() string {
return c.Hrp
}
// GetPath returns the coin path
func (c *coin) GetPath() uint32 {
return c.Path
}
// GetMethod returns the DID method for the coin
func (c *coin) GetMethod() string {
return c.Method
}
-6
View File
@@ -1,6 +0,0 @@
package did
// Format is the formatter to use for DIDs
var Format = formatter{}
type formatter struct{}
-1
View File
@@ -1 +0,0 @@
package did
-9
View File
@@ -1,9 +0,0 @@
package did
// VerificationMethod is an object that represents a verification method.
type VerificationMethod struct {
PublicKeyJwk map[string]interface{} `json:"publicKeyJwk"`
ID string `json:"id"`
Type string `json:"type"`
Controller string `json:"controller"`
}