Skip to content

Commit

Permalink
Merge pull request #52 from ainize-team/fix/woojae/depositAddress
Browse files Browse the repository at this point in the history
fix: depositAddress
  • Loading branch information
akastercomcom authored Sep 20, 2023
2 parents 9a9d34e + 007ee79 commit 8b31a44
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ainize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export default class Ainize {
}

async logout() {
await this.handler.disconnect();
this.ain.removeDefaultAccount();
await this.handler.disconnect();
console.log('logout success!');
}

Expand Down
4 changes: 2 additions & 2 deletions src/controllers/modelController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default class ModelController {
this.isLoggedIn();
const userAddress = this.ain.getAddress();
const balancePath = Path.app(modelName).balanceOfUser(userAddress);
return await this.ain.getValue(balancePath);
return await this.ain.getValue(balancePath) | 0;
}

async getCreditHistory(modelName: string) {
Expand Down Expand Up @@ -111,7 +111,7 @@ export default class ModelController {
}

private async getDepositAddress(appName: string) {
return (await this.ain.getValue(Path.app(appName).billingConfig())).defaultAddress;
return (await this.ain.getValue(Path.app(appName).billingConfig())).depositAddress;
}

private isLoggedIn() {
Expand Down
6 changes: 4 additions & 2 deletions src/handlers/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ export default class Handler {
}

private async disconnectedCb() {
console.log('disconnected. reconnecting...');
await this.connect();
if(!AinModule.getInstance().isDefaultAccountExist()) {
console.log('disconnected. reconnecting...');
await this.connect();
}
}

async subscribe(requester:string, recordId:string, appName: string, resolve: any) {
Expand Down

0 comments on commit 8b31a44

Please sign in to comment.