Skip to content
This repository was archived by the owner on Jun 19, 2021. It is now read-only.

Commit c88d1cc

Browse files
committed
1 parent f6fa183 commit c88d1cc

File tree

8 files changed

+381
-908
lines changed

8 files changed

+381
-908
lines changed

package-lock.json

Lines changed: 341 additions & 876 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@oclif/errors": "^1.2.2",
1111
"@oclif/plugin-help": "^2.1.4",
1212
"@oclif/plugin-plugins": "^1.7.3",
13-
"byteballcore": "git+https://github.com/byteball/byteballcore.git",
13+
"ocore": "github:byteball/ocore",
1414
"strict-event-emitter-types": "^2.0.0",
1515
"tslib": "^1.9.3"
1616
},
@@ -33,7 +33,7 @@
3333
"babel-jest": "^23.6.0",
3434
"conventional-github-releaser": "^3.1.2",
3535
"globby": "^8.0.1",
36-
"headless-byteball": "git+https://github.com/byteball/headless-byteball.git",
36+
"headless-obyte": "github:byteball/headless-obyte",
3737
"husky": "^1.3.1",
3838
"jest": "^23.6.0",
3939
"jest-silent-reporter": "^0.1.1",
@@ -67,13 +67,19 @@
6767
"/oclif.manifest.json"
6868
],
6969
"homepage": "https://github.com/DrSensor/bot-byte",
70-
"keywords": ["oclif"],
70+
"keywords": [
71+
"oclif"
72+
],
7173
"license": "MIT",
7274
"lint-staged": {
7375
"linters": {
74-
"*.ts": ["tslint --fix -c tslint.json -p tsconfig.json"]
76+
"*.ts": [
77+
"tslint --fix -c tslint.json -p tsconfig.json"
78+
]
7579
},
76-
"ignore": ["examples/**"]
80+
"ignore": [
81+
"examples/**"
82+
]
7783
},
7884
"standard-version": {
7985
"scripts": {
@@ -89,7 +95,9 @@
8995
"oclif": {
9096
"commands": "./dist/commands",
9197
"bin": "botbyte",
92-
"plugins": ["@oclif/plugin-help"]
98+
"plugins": [
99+
"@oclif/plugin-help"
100+
]
93101
},
94102
"repository": "DrSensor/bot-byte",
95103
"scripts": {

rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const configure = ({input, output, watch, ...others}) => ({
4747
}, output),
4848
watch: {clearScreen: false},
4949
// 👇 I wonder if I can convert it as a plugin like rollup-plugin-auto-external 🤔
50-
external: id => /byteballcore/.test(id) || /bitcore/.test(id) || /@oclif/.test(id),
50+
external: id => /ocore/.test(id) || /bitcore/.test(id) || /@oclif/.test(id),
5151
plugins: [
5252
dev && run({ bin: pkg.bin[pkg.name] }),
5353
json(),

src/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {getAppDataDir, getAppRootDir} from 'byteballcore/desktop_app'
21
import {EventEmitter} from 'events'
2+
import {getAppDataDir, getAppRootDir} from 'ocore/desktop_app'
33
import {dirname} from 'path'
44
import Typed from 'strict-event-emitter-types'
55

@@ -42,7 +42,7 @@ export class Bot extends (EventEmitter as new() => EventType<IBot>) {
4242
// db: LazyImport<any> // TODO: use it if there is side-effect
4343
}
4444

45-
private readonly db = require('byteballcore/db')
45+
private readonly db = require('ocore/db')
4646

4747
constructor(option?: Partial<IOption>) {
4848
super()
@@ -175,16 +175,16 @@ export class Bot extends (EventEmitter as new() => EventType<IBot>) {
175175
private async init() {
176176
/// use of `await import` is for module thaat immediately run a service 😓
177177
this.core = {
178-
wallet: await import('headless-byteball') as Wallet,
179-
device: await import('byteballcore/device') as Device,
180-
composer: await import('byteballcore/composer'),
181-
network: await import('byteballcore/network')
178+
wallet: await import('headless-obyte') as Wallet,
179+
device: await import('ocore/device') as Device,
180+
composer: await import('ocore/composer'),
181+
network: await import('ocore/network')
182182
}
183-
const eventBus = require('byteballcore/event_bus')
183+
const eventBus = require('ocore/event_bus')
184184
return new Promise<EventEmitter>(async resolve => {
185185
eventBus.once('headless_wallet_ready', () => {
186186
this.core!.wallet.setupChatEventHandlers()
187-
this.core!.wallet.readFirstAddress(address => {
187+
this.core!.wallet.readSingleAddress(address => {
188188
this.address = address
189189
this.emit('ready', this.core!.device)
190190
resolve(eventBus)

src/options/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ let _options: Partial<IOption>
1111

1212
export function getOption() {
1313
const {constants, conf, ...others} = _options
14-
Object.assign(constants, require('byteballcore/constants'))
15-
Object.assign(conf, require('byteballcore/conf'))
14+
Object.assign(constants, require('ocore/constants'))
15+
Object.assign(conf, require('ocore/conf'))
1616
return {...others, conf, constants}
1717
}
1818

1919
/**
2020
* This function do all necessary thing for merging the option
21-
* It make it possible to set `byteballcore/constants` and `bytballcore/conf` programatically
21+
* It make it possible to set `ocore/constants` and `bytballcore/conf` programatically
2222
*/
2323
export function setOption(option: Partial<IOption> = {}) {
2424
if (!option.constants) option.constants = {}
@@ -75,11 +75,11 @@ export function setOption(option: Partial<IOption> = {}) {
7575
//#endregion
7676

7777
// don't place this 👇 on top because it immediately print something upon require() 😓
78-
Object.assign(require('byteballcore/constants'), option.constants)
78+
Object.assign(require('ocore/constants'), option.constants)
7979

80-
/// can't merge it maybe because of https://github.com/byteball/byteballcore/blame/cd764e9bd1edd00e93ee46c2e2ec029c6a52210b/conf.js#L73-L103
81-
/// or https://github.com/byteball/byteballcore/blame/cd764e9bd1edd00e93ee46c2e2ec029c6a52210b/conf.js#L3
82-
// Object.assign(require('byteballcore/conf'), option.conf) //👈🤔 TODO: need workaround
80+
/// can't merge it maybe because of https://github.com/byteball/ocore/blame/cd764e9bd1edd00e93ee46c2e2ec029c6a52210b/conf.js#L73-L103
81+
/// or https://github.com/byteball/ocore/blame/cd764e9bd1edd00e93ee46c2e2ec029c6a52210b/conf.js#L3
82+
// Object.assign(require('ocore/conf'), option.conf) //👈🤔 TODO: need workaround
8383

8484
}
8585

src/options/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export enum LIVENET {
4848

4949
// #region Database config
5050
/**
51-
* @see https://github.com/byteball/byteballcore/blob/master/conf.js#L105-L116
51+
* @see https://github.com/byteball/ocore/blob/master/conf.js#L105-L116
5252
*/
5353
interface IDatabase {
5454
max_connections?: number
@@ -75,7 +75,7 @@ interface IConfWallet {
7575
}
7676

7777
/**
78-
* @see https://github.com/byteball/byteballcore/blob/master/conf.js
78+
* @see https://github.com/byteball/ocore/blob/master/conf.js
7979
*/
8080
export interface IConf extends IConfWallet {
8181
port: number | null
@@ -98,7 +98,7 @@ export interface IConf extends IConfWallet {
9898
}
9999

100100
/**
101-
* @see https://github.com/byteball/byteballcore/blob/master/constants.js
101+
* @see https://github.com/byteball/ocore/blob/master/constants.js
102102
*/
103103
export interface IConstants {
104104
version: TESTNET.version | string

src/shim-readline.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import conf from 'byteballcore/conf'
1+
import conf from 'ocore/conf'
22
import {ReadLineOptions} from 'readline'
33

44
import {bot, Question} from './event-handler'

src/shim.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ interface Wallet {
2222
readSingleAddress(cb: (address: string) => void)
2323
readFirstAddress(cb: (address: string) => void)
2424
}
25-
declare module 'headless-byteball' {
25+
declare module 'headless-obyte' {
2626
export default Wallet
2727
}
2828

@@ -32,25 +32,25 @@ interface Device {
3232
subject: 'text', // TODO: get full subject type
3333
body: string,
3434
callbacks?: () => void,
35-
conn?: any // TODO: need to create dts of https://github.com/byteball/byteballcore/blob/master/db.js
35+
conn?: any // TODO: need to create dts of https://github.com/byteball/ocore/blob/master/db.js
3636
)
3737
}
38-
declare module 'byteballcore/device' {
38+
declare module 'ocore/device' {
3939
export default Device
4040
}
4141

42-
declare module 'byteballcore/desktop_app' {
42+
declare module 'ocore/desktop_app' {
4343
export const getAppDataDir: () => string
4444
export const getAppRootDir: () => string
4545
}
4646

47-
declare module 'byteballcore/event_bus' {
47+
declare module 'ocore/event_bus' {
4848
import {EventEmitter} from 'events'
4949
const event: EventEmitter
5050
export default event
5151
}
5252

53-
declare module 'byteballcore/*' {
53+
declare module 'ocore/*' {
5454
const _: PlainObject<any>
5555
export default _
5656
}

0 commit comments

Comments
 (0)