-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #181 from ElrondNetwork/account-on-network
Breaking change: unifying provider interfaces, preparing network providers for extraction - step 2
- Loading branch information
Showing
11 changed files
with
79 additions
and
75 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
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,30 @@ | ||
import { IAccountBalance, IAddress, INonce } from "./interface"; | ||
import { AccountBalance, Address, Nonce } from "./primitives"; | ||
|
||
/** | ||
* A plain view of an account, as queried from the Network. | ||
*/ | ||
export class AccountOnNetwork { | ||
address: IAddress = new Address(""); | ||
nonce: INonce = new Nonce(0); | ||
balance: IAccountBalance = new AccountBalance(""); | ||
code: string = ""; | ||
userName: string = ""; | ||
|
||
constructor(init?: Partial<AccountOnNetwork>) { | ||
Object.assign(this, init); | ||
} | ||
|
||
static fromHttpResponse(payload: any): AccountOnNetwork { | ||
let result = new AccountOnNetwork(); | ||
|
||
result.address = new Address(payload["address"] || 0); | ||
result.nonce = new Nonce(payload["nonce"] || 0); | ||
result.balance = new AccountBalance(payload["balance"] || "0"); | ||
result.code = payload["code"] || ""; | ||
result.userName = payload["username"] || ""; | ||
|
||
return result; | ||
} | ||
} | ||
|
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
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
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
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