feature/1110 abstract connected wallet operations (#1166)

- **refactor: refactor DID module types and move to controller package**
- **refactor: move controller creation and resolution logic to keeper**
- **refactor: update imports to reflect controller package move**
- **refactor: update protobuf definitions for DID module**
- **docs: update proto README to reflect changes**
- **refactor: move hway to gateway, update node modules, and refactor
pkl generation**
- **build: update pkl-gen task to use new pkl file paths**
- **refactor: refactor DWN WASM build and deployment process**
- **refactor: refactor DID controller implementation to use
account-based storage**
- **refactor: move DID controller interface to base file and update
implementation**
- **chore: migrate to google protobuf**
- **feat: Add v0.52.0 Interfaces for Acc Abstraction**
- **refactor: replace public_key with public_key_hex in Assertion
message**
- **refactor: remove unused PubKey, JSONWebKey, and RawKey message types
and related code**
This commit is contained in:
Prad Nukala
2024-11-18 19:04:10 -05:00
committed by GitHub
parent 01cb37e82e
commit bf94277b0f
190 changed files with 9345 additions and 14038 deletions
-65
View File
@@ -1,65 +0,0 @@
@go.Package { name = "github.com/onsonr/sonr/internal/dwn/gen" }
module dwngen
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
typealias JSON = String
class JsonField extends go.Field {
structTags {
["json"] = "%{name},omitempty"
}
}
class Config {
@JsonField
ipfsGatewayUrl: String
@JsonField
motrKeyshare: String
@JsonField
motrAddress: String
@JsonField
sonrApiUrl: String
@JsonField
sonrRpcUrl: String
@JsonField
sonrChainId: String
@JsonField
vaultSchema: Schema
}
class Schema {
version: Int
@JsonField
account: String
@JsonField
asset: String
@JsonField
chain: String
@JsonField
credential: String
@JsonField
jwk: String
@JsonField
grant: String
@JsonField
keyshare: String
@JsonField
profile: String
}
-274
View File
@@ -1,274 +0,0 @@
@go.Package { name = "github.com/onsonr/sonr/internal/orm" }
module orm
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
typealias Base58 = String
typealias Base64 = String
typealias Bech32 = String
typealias Keccak = String
typealias ChainCode = UInt
typealias Scope = String
typealias Hex = String
class PrimaryKey extends go.Field {
structTags {
["json"] = "%{name},omitempty"
["query"] = "%{name}"
}
}
class JsonField extends go.Field {
structTags {
["json"] = "%{name},omitempty"
}
}
// Enums
typealias AssetType = "native"|"wrapped"|"staking"|"pool"|"ibc"|"cw20"
typealias DIDMethod = "ipfs"|"sonr"|"bitcoin"|"ethereum"|"ibc"|"webauthn"|"dwn"|"service"
typealias KeyAlgorithm = "es256"|"es384"|"es512"|"eddsa"|"es256k"|"ecdsa"
typealias KeyCurve = "p256"|"p384"|"p521"|"x25519"|"x448"|"ed25519"|"ed448"|"secp256k1"|"bls12381"|"keccak256"
typealias KeyEncoding = "raw"|"hex"|"multibase"
typealias KeyRole = "authentication"|"assertion"|"delegation"|"invocation"
typealias KeyType = "octet"|"elliptic"|"rsa"|"symmetric"|"hmac"|"mpc"|"zk"|"webauthn"|"bip32"
typealias KeyShareRole = "user"|"validator"
typealias PermissionGrant = "none"|"read"|"write"|"verify"|"broadcast"|"admin"
typealias PermissionScope = "profile"|"metadata"|"permissions"|"wallets"|"transactions"|"user"|"validator"
class Account {
@PrimaryKey
id: String
@JsonField
name: String
@JsonField
address: Bech32|Keccak|String
@JsonField
publicKey: Base58
@JsonField
chainCode: ChainCode
@JsonField
index: Int
@JsonField
controller: Bech32
@JsonField
createdAt: String?
}
class Asset {
@PrimaryKey
id: String
@JsonField
name: String
@JsonField
symbol: String
@JsonField
decimals: Int
@JsonField
chainCode: ChainCode
@JsonField
createdAt: String?
}
class Chain {
@PrimaryKey
id: String
@JsonField
name: String
@JsonField
networkId: String
@JsonField
chainCode: ChainCode
@JsonField
createdAt: String?
}
class Credential {
@PrimaryKey
id: String
@JsonField
subject: String
@JsonField
controller: Bech32
@JsonField
attestationType: String
@JsonField
origin: String
@JsonField
label: String?
@JsonField
deviceId: String?
@JsonField
credentialId: Base64
@JsonField
publicKey: Base64
@JsonField
transport: List<String>
@JsonField
signCount: UInt
@JsonField
userPresent: Boolean
@JsonField
userVerified: Boolean
@JsonField
backupEligible: Boolean
@JsonField
backupState: Boolean
@JsonField
cloneWarning: Boolean
@JsonField
createdAt: String?
@JsonField
updatedAt: String?
}
class DID {
@PrimaryKey
id: String
role: KeyRole
algorithm: KeyAlgorithm
encoding: KeyEncoding
curve: KeyCurve
key_type: KeyType
raw: Base64
jwk: JWK
}
class JWK {
@JsonField
kty: String
@JsonField
crv: String
@JsonField
x: String
@JsonField
y: String
@JsonField
n: String
@JsonField
e: String
}
class Grant {
@PrimaryKey
id: UInt
@JsonField
subject: String
@JsonField
controller: Bech32
@JsonField
origin: String
@JsonField
token: String
@JsonField
scopes: List<String>
@JsonField
createdAt: String?
@JsonField
updatedAt: String?
}
class Keyshare {
@PrimaryKey
id: String
@JsonField
data: Base64
@JsonField
role: Int
@JsonField
createdAt: String?
@JsonField
lastRefreshed: String?
}
class Profile {
@PrimaryKey
id: String
@JsonField
subject: String
@JsonField
controller: Bech32
@JsonField
originUri: String?
@JsonField
publicMetadata: String?
@JsonField
privateMetadata: String?
@JsonField
createdAt: String?
@JsonField
updatedAt: String?
}
db_name: String = "vault"
db_version: Int = 1
View File
-174
View File
@@ -1,174 +0,0 @@
@go.Package { name = "github.com/onsonr/sonr/internal/orm/transactions" }
module transactions
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
/// Common Cosmos SDK types
typealias Coin = Dynamic
typealias AccAddress = String
typealias ValAddress = String
typealias Timestamp = String
/// Base class for all messages
abstract class Msg {
/// The type URL for the message
typeUrl: String
}
/// Base class for all proposals
class Proposal {
/// The title of the proposal
title: String
/// The description of the proposal
description: String
}
/// Gov module messages
class MsgGovSubmitProposal extends Msg {
typeUrl = "/cosmos.gov.v1beta1.MsgSubmitProposal"
content: Proposal
initialDeposit: List<Coin>
proposer: AccAddress
}
class MsgGovVote extends Msg {
typeUrl = "/cosmos.gov.v1beta1.MsgVote"
proposalId: Int
voter: AccAddress
option: Int
}
class MsgGovDeposit extends Msg {
typeUrl = "/cosmos.gov.v1beta1.MsgDeposit"
proposalId: Int
depositor: AccAddress
amount: List<Coin>
}
/// Group module messages
class MsgGroupCreateGroup extends Msg {
typeUrl = "/cosmos.group.v1.MsgCreateGroup"
admin: AccAddress
members: List<Dynamic>
metadata: String
}
class MsgGroupSubmitProposal extends Msg {
typeUrl = "/cosmos.group.v1.MsgSubmitProposal"
groupPolicyAddress: AccAddress
proposers: List<AccAddress>
metadata: String
messages: List<Dynamic>
exec: Int
}
class MsgGroupVote extends Msg {
typeUrl = "/cosmos.group.v1.MsgVote"
proposalId: Int
voter: AccAddress
option: Int
metadata: String
exec: Int
}
/// Staking module messages
class MsgStakingCreateValidator extends Msg {
typeUrl = "/cosmos.staking.v1beta1.MsgCreateValidator"
description: Dynamic
commission: Dynamic
minSelfDelegation: String
delegatorAddress: AccAddress
validatorAddress: ValAddress
pubkey: Dynamic
value: Coin
}
class MsgStakingDelegate extends Msg {
typeUrl = "/cosmos.staking.v1beta1.MsgDelegate"
delegatorAddress: AccAddress
validatorAddress: ValAddress
amount: Coin
}
class MsgStakingUndelegate extends Msg {
typeUrl = "/cosmos.staking.v1beta1.MsgUndelegate"
delegatorAddress: AccAddress
validatorAddress: ValAddress
amount: Coin
}
class MsgStakingBeginRedelegate extends Msg {
typeUrl = "/cosmos.staking.v1beta1.MsgBeginRedelegate"
delegatorAddress: AccAddress
validatorSrcAddress: ValAddress
validatorDstAddress: ValAddress
amount: Coin
}
class MsgDidUpdateParams extends Msg {
typeUrl = "/sonr.did.v1.MsgUpdateParams"
authority: AccAddress
params: Dynamic
token: Dynamic
}
class MsgDidAllocateVault extends Msg {
typeUrl = "/sonr.did.v1.MsgAllocateVault"
authority: AccAddress
subject: String
token: Dynamic
}
class MsgDidProveWitness extends Msg {
typeUrl = "/sonr.did.v1.MsgProveWitness"
authority: AccAddress
property: String
witness: Listing<Int>
token: Dynamic
}
class MsgDidSyncVault extends Msg {
typeUrl = "/sonr.did.v1.MsgSyncVault"
controller: AccAddress
token: Dynamic
}
class MsgDidRegisterController extends Msg {
typeUrl = "/sonr.did.v1.MsgRegisterController"
authority: AccAddress
cid: String
origin: String
authentication: List<Dynamic>
token: Dynamic
}
class MsgDidAuthorize extends Msg {
typeUrl = "/sonr.did.v1.MsgAuthorize"
authority: AccAddress
controller: AccAddress
address: AccAddress
origin: String
token: Dynamic
}
class MsgDidRegisterService extends Msg {
typeUrl = "/sonr.did.v1.MsgRegisterService"
controller: AccAddress
originUri: String
scopes: Dynamic
description: String
serviceEndpoints: Map<String, String>
metadata: Dynamic
token: Dynamic
}
/// Represents a transaction body
class TxBody {
messages: List<Msg>
memo: String?
timeoutHeight: Int?
extensionOptions: List<Dynamic>?
nonCriticalExtensionOptions: List<Dynamic>?
}