Skip to content
2 changes: 1 addition & 1 deletion wallets/aria-extension/src/constant.ts

Large diffs are not rendered by default.

435 changes: 427 additions & 8 deletions wallets/aria-extension/src/extension/client.ts

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions wallets/aria-extension/src/extension/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export * from './chain-wallet';
export * from './client';
export * from './main-wallet';
export * from './registry';
export * from './types';
export * from './utils';
288 changes: 288 additions & 0 deletions wallets/aria-extension/src/extension/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,145 @@ import {
import { DirectSignResponse, OfflineSigner } from '@cosmjs/proto-signing';
import { BroadcastMode, DirectSignDoc, SignOptions } from '@cosmos-kit/core';

// ============================================================================
// Phase 3C - Power Features Types
// ============================================================================

export interface SettledResponse<T> {
status: 'fulfilled' | 'rejected';
value?: T;
reason?: string;
}

export interface AriaKey {
name: string;
algo: string;
pubKey: Uint8Array;
address: Uint8Array;
bech32Address: string;
isNanoLedger: boolean;
isSmartContract?: boolean;
}

export interface ChainInfoWithoutEndpoints {
chainId: string;
chainName: string;
bech32Prefix: string;
bip44: { coinType: number };
currencies: Array<{
coinDenom: string;
coinMinimalDenom: string;
coinDecimals: number;
}>;
}

export interface ConnectedApp {
origin: string;
connectedAt: number;
chainIds: string[];
}

// ============================================================================
// Phase 4A - Secret Network (Enigma) Types
// ============================================================================

export interface SecretUtils {
getPubkey: () => Promise<Uint8Array>;
decrypt: (ciphertext: Uint8Array, nonce: Uint8Array) => Promise<Uint8Array>;
encrypt: (contractCodeHash: string, msg: object) => Promise<Uint8Array>;
getTxEncryptionKey: (nonce: Uint8Array) => Promise<Uint8Array>;
}

// ============================================================================
// Phase 4B - EVM/Ethereum Types
// ============================================================================

export type EthSignType = 'message' | 'transaction' | 'eip-712';

// ============================================================================
// Phase 4C - Advanced Signing Types
// ============================================================================

export interface DirectAuxSignResponse {
signed: {
bodyBytes: Uint8Array;
publicKey: {
typeUrl: string;
value: Uint8Array;
};
chainId: string;
accountNumber: bigint;
sequence: bigint;
};
signature: StdSignature;
}

export interface EIP712Doc {
types: Record<string, Array<{ name: string; type: string }>>;
primaryType: string;
domain: Record<string, unknown>;
message: Record<string, unknown>;
}

export interface ICNSAdr36Signatures {
chainId: string;
addressChainIds: string[];
signatures: {
[chainId: string]: {
address: string;
signature: StdSignature;
};
};
}

// ============================================================================
// Phase 4D - Multi-Chain Types (Bitcoin, Starknet)
// ============================================================================

export interface BitcoinKey {
name: string;
pubKey: Uint8Array;
address: string;
paymentType: 'native-segwit' | 'taproot';
isNanoLedger: boolean;
}

export interface SignPsbtOptions {
autoFinalized?: boolean;
toSignInputs?: Array<{
index: number;
address?: string;
publicKey?: string;
sighashTypes?: number[];
disableTweakSigner?: boolean;
useTweakedSigner?: boolean;
}>;
}

export interface StarknetKey {
name: string;
pubKey: Uint8Array;
address: string;
isNanoLedger: boolean;
}

// ============================================================================
// Phase 4E - SVM/Solana Types
// ============================================================================

export interface SolanaKey {
name: string;
pubKey: Uint8Array;
address: string;
isNanoLedger: boolean;
}

// ============================================================================
// Phase 4F - Ledger Types
// ============================================================================

export type LedgerTransportType = 'WebUSB' | 'WebHID';

export interface Aria {
// Account Methods
getKey(chainId: string): Promise<{
Expand Down Expand Up @@ -51,10 +190,159 @@ export interface Aria {

// Token Support
suggestCW20Token?(chainId: string, contractAddress: string): Promise<void>;
suggestToken?(
chainId: string,
contractAddress: string,
viewingKey?: string
): Promise<void>;

// Chain Management
addChain?(chainInfo: unknown): Promise<void>;

// Event Listeners
on?(type: string, listener: EventListenerOrEventListenerObject): void;
off?(type: string, listener: EventListenerOrEventListenerObject): void;

// Signature Verification
verifyArbitrary?(
chainId: string,
signer: string,
data: string | Uint8Array,
signature: StdSignature
): Promise<boolean>;

// Connectivity
ping?(): Promise<void>;

// Optional Methods (if used)
enable?(chainIds: string | string[]): Promise<void>;
disable?(chainIds?: string | string[]): Promise<void>;
disconnect?(): Promise<void>;

// ============================================================================
// Phase 3C - Power Features
// ============================================================================

getKeysSettled?(chainIds: string[]): Promise<SettledResponse<AriaKey>[]>;
getChainInfosWithoutEndpoints?(): Promise<ChainInfoWithoutEndpoints[]>;
getChainInfoWithoutEndpoints?(chainId: string): Promise<ChainInfoWithoutEndpoints>;
getConnectedApps?(): Promise<ConnectedApp[]>;
disconnectApp?(origin: string): Promise<void>;

// ============================================================================
// Phase 4A - Secret Network (Enigma) Support
// ============================================================================

getEnigmaPubKey?(chainId: string): Promise<Uint8Array>;
getEnigmaTxEncryptionKey?(chainId: string, nonce: Uint8Array): Promise<Uint8Array>;
enigmaEncrypt?(
chainId: string,
contractCodeHash: string,
msg: object
): Promise<Uint8Array>;
enigmaDecrypt?(
chainId: string,
ciphertext: Uint8Array,
nonce: Uint8Array
): Promise<Uint8Array>;
getSecret20ViewingKey?(chainId: string, contractAddress: string): Promise<string>;
getEnigmaUtils?(chainId: string): SecretUtils;

// ============================================================================
// Phase 4B - EVM/Ethereum Support
// ============================================================================

signEthereum?(
chainId: string,
signer: string,
data: string | Uint8Array,
type: EthSignType
): Promise<Uint8Array>;
sendEthereumTx?(chainId: string, tx: Uint8Array): Promise<string>;
suggestERC20?(chainId: string, contractAddress: string): Promise<void>;

// ============================================================================
// Phase 4C - Advanced Signing
// ============================================================================

signDirectAux?(
chainId: string,
signer: string,
signDoc: DirectSignDoc
): Promise<DirectAuxSignResponse>;
experimentalSignEIP712CosmosTx_v0?(
chainId: string,
signer: string,
eip712: EIP712Doc,
signDoc: StdSignDoc,
signOptions?: SignOptions
): Promise<AminoSignResponse>;
signICNSAdr36?(
chainId: string,
contractAddress: string,
owner: string,
username: string,
addressChainIds: string[]
): Promise<ICNSAdr36Signatures>;

// ============================================================================
// Phase 4D - Multi-Chain (Bitcoin, Starknet)
// ============================================================================

// Starknet
getStarknetKey?(chainId: string): Promise<StarknetKey>;
signStarknetTx?(
chainId: string,
signer: string,
transactions: unknown[]
): Promise<unknown>;

// Bitcoin
getBitcoinKey?(chainId: string): Promise<BitcoinKey>;
getBitcoinKeysSettled?(chainIds: string[]): Promise<SettledResponse<BitcoinKey>[]>;
signPsbt?(
chainId: string,
psbtHex: string,
options?: SignPsbtOptions
): Promise<string>;
signPsbts?(
chainId: string,
psbtsHexes: string[],
options?: SignPsbtOptions
): Promise<string[]>;

// ============================================================================
// Phase 4E - SVM/Solana Support
// ============================================================================

getSolanaKey?(chainId: string): Promise<SolanaKey>;
signSolanaTransaction?(
chainId: string,
transaction: Uint8Array
): Promise<Uint8Array>;
signSolanaMessage?(
chainId: string,
message: Uint8Array
): Promise<Uint8Array>;
sendSolanaTransaction?(
chainId: string,
transaction: Uint8Array
): Promise<string>;

// ============================================================================
// Phase 4F - Ledger Hardware Wallet Support
// ============================================================================

initLedger?(transport?: LedgerTransportType): Promise<void>;
getLedgerAddress?(
path: string,
bech32Prefix: string
): Promise<{ address: string; publicKey: string }>;
signWithLedger?(
signDoc: StdSignDoc,
accountIndex?: number
): Promise<Uint8Array>;
isLedgerConnected?(): boolean;
}

declare global {
Expand Down
19 changes: 19 additions & 0 deletions wallets/aria-extension/tsconfig.standalone.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "ES2021",
"lib": ["ES2021", "DOM"],
"declaration": true,
"strict": false,
"noImplicitAny": false,
"strictNullChecks": false,
"moduleResolution": "node",
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"baseUrl": ".",
"rootDir": "src"
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}
21 changes: 7 additions & 14 deletions wallets/aria-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,10 @@
"name": "@cosmos-kit/aria-mobile",
"version": "1.3.0",
"description": "cosmos-kit wallet connector",
"author": "Constructive <[email protected]>",
"author": "[email protected]",
"contributors": [
{
"name": "Jun Liu"
},
{
"name": "Dan Lynch"
},
{
"name": "Noah Saso"
},
{
"name": "Eliot Baker"
},
{
"name": "Delivan Jeonghyeok Yoo"
"name": "David Blackstone"
}
],
"homepage": "https://github.com/hyperweb-io/cosmos-kit#readme",
Expand Down Expand Up @@ -71,8 +59,13 @@
]
},
"dependencies": {
"@cosmos-kit/aria-extension": "^2.20.0",
"@cosmos-kit/core": "^2.18.0",
"@cosmos-kit/walletconnect": "^2.15.0"
},
"peerDependencies": {
"@cosmjs/amino": ">=0.32.3",
"@cosmjs/proto-signing": ">=0.32.3"
},
"gitHead": "39fe5288455524191eb70ca82de6f2d7e6b3549a"
}
Loading