-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
2,923 additions
and
6,482 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"printWidth": 120, | ||
"trailingComma": "all", | ||
"singleQuote": true | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import IAsset from "./src/interfaces/iasset"; | ||
import IBlockchain from "./src/interfaces/iblockchain"; | ||
import IConnector from "./src/interfaces/iconnector"; | ||
import IEnv from "./src/interfaces/ienv"; | ||
|
||
export class Lunar { | ||
static version: string; | ||
static Blockchains: IBlockchain[]; | ||
static Wallets: string[]; | ||
static listBlockchain(isTestnet: boolean | undefined): IBlockchain[]; | ||
static findBlockchain(chainId: number): IBlockchain; | ||
|
||
env: IEnv; | ||
isConnected: boolean; | ||
address: string; | ||
blockchain: IBlockchain; | ||
|
||
on(event: string, callback: Function): void; | ||
findConnector({ walletType }: { walletType: string }): IConnector|undefined; | ||
connect({ wallet, blockchain }: { wallet?: string, blockchain?: IBlockchain }): Promise<boolean>; | ||
switchBlockchain({ blockchain }: { blockchain: IBlockchain }): Promise<boolean>; | ||
disconnect(): Promise<boolean>; | ||
getAsset({ contract }: { contract?: string }): Promise<IAsset | undefined>; | ||
getBalance({ contract, address }: { contract?: string, address?: string }): Promise<string>; | ||
getAllowance({ contract, owner, spender }: { contract: string, owner: string, spender: string }): Promise<string>; | ||
getData({ contract, func, params, data }: { contract: string, data?: string, func?: string, params?: string[], state?: string }): Promise<string>; | ||
send({ to, amount, data }: { to: string, amount: number, data:string }): Promise<string>; | ||
interfaceOf({ contract, abi }: { contract: string, abi: any }): Promise<any>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"transform": { | ||
"^.+\\.(t|j)sx?$": "ts-jest" | ||
}, | ||
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", | ||
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"] | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { Blockchains, Blockchain } from "../constants/blockchains"; | ||
import Wallets from "../constants/wallets"; | ||
import IAsset from "../interfaces/iasset"; | ||
|
||
class Connector { | ||
_isConnected: boolean = false; | ||
_address: string = '0x'; | ||
_blockchain: Blockchain = Blockchains.BOLT; | ||
_type: string = Wallets.TideWallet; | ||
_assets: string[] = []; | ||
|
||
constructor() {} | ||
get isConnected() { | ||
return this._isConnected; | ||
} | ||
get blockchain() { | ||
return this._blockchain; | ||
} | ||
get address() { | ||
return this._address; | ||
} | ||
get type() { | ||
return this._type; | ||
} | ||
get chainId() { | ||
return this._blockchain.chainId; | ||
} | ||
|
||
async init() {} | ||
on(event:Event, callback:Function) {} | ||
async connect({ blockchain }: { blockchain?: Blockchain } = {}): Promise<boolean> { | ||
return true; | ||
} | ||
async switchBlockchain({ blockchain }: { blockchain: Blockchain }): Promise<boolean> { | ||
return true; | ||
} | ||
async disconnect(): Promise<boolean> { | ||
return true; | ||
} | ||
async send({ to, amount, data }: { to: string, amount: number, data:string }): Promise<string> { | ||
return "0x"; | ||
} | ||
async getAsset({ contract }: { contract?: string }): Promise<IAsset> { | ||
return { name: '', symbol: '', decimals: 18, totalSupply: '0' }; | ||
} | ||
async getAllowance({ contract, owner, spender }: { contract: string, owner: string, spender: string }): Promise<string> { | ||
return '0'; | ||
} | ||
async getContractBalance({ contract, address, state }: { contract: string, address: string, state?: string }): Promise<string> { | ||
return "0x"; | ||
} | ||
async getBalance({ contract, address, state }: { contract?: string, address?: string, state?: string } = {}): Promise<string> { | ||
return "0x"; | ||
} | ||
async getData({ contract, data, func, params, state }: { contract: string, data?: string, func?: string, params?: string[], state?: string }): Promise<string> { | ||
return "0x"; | ||
} | ||
async interfaceOf({ contract, abi }: { contract: string, abi: any }): Promise<any> { | ||
return; | ||
} | ||
} | ||
|
||
export default Connector; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Wallets from '../constants/wallets.js'; | ||
import SmartContract from '../libs/smartcontract.js'; | ||
import Metamask from './metamask.js' | ||
|
||
declare let ethereum: any; | ||
|
||
class ImToken extends Metamask { | ||
_type = Wallets.imToken; | ||
} | ||
|
||
export default ImToken; |
Oops, something went wrong.