-
Notifications
You must be signed in to change notification settings - Fork 310
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 #310 from MysteriumNetwork/feature/MYST-586-endpoi…
…nt-with-identity-registration-status Feature/myst 586 endpoint with identity registration status
- Loading branch information
Showing
28 changed files
with
1,859 additions
and
47 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
...net/account/UTC--2018-07-25T13-08-10.138246914Z--a754f0d31411d88e46aed455fa79b9fced122497
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 @@ | ||
{"address":"a754f0d31411d88e46aed455fa79b9fced122497","crypto":{"cipher":"aes-128-ctr","ciphertext":"56c3a9b187b9acfe64d9d9ab2f0236f990f533f99ddb05cc0d5be9340f7fb755","cipherparams":{"iv":"fa76b9c835859593db14cd4820078b88"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"3dfdd74c4e7eb4d6ef3b449b836438f3082a34bd0c6dc82a85bde4f30421e1b9"},"mac":"97c1323a22cddb1dac9652a1b3b6b07706193a12cf056256dee963647686cde7"},"id":"965998e2-2a62-4aae-9b0d-b3a723b8d521","version":3} |
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,93 @@ | ||
/* | ||
* Copyright (C) 2017 The "MysteriumNetwork/node" Authors. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"flag" | ||
"fmt" | ||
"github.com/MysteriumNetwork/payments/cli/helpers" | ||
mysttoken "github.com/MysteriumNetwork/payments/mysttoken/generated" | ||
promises "github.com/MysteriumNetwork/payments/promises/generated" | ||
"github.com/ethereum/go-ethereum/core/types" | ||
"github.com/ethereum/go-ethereum/ethclient" | ||
"math/big" | ||
"os" | ||
"time" | ||
) | ||
|
||
func main() { | ||
|
||
keyStoreDir := flag.String("keystore.directory", "", "Directory of keystore") | ||
etherAddress := flag.String("ether.address", "", "Account inside keystore to use for deployment") | ||
etherPassphrase := flag.String("ether.passphrase", "", "Passphrase for account unlocking") | ||
ethRPC := flag.String("geth.url", "", "RPC url of ethereum client") | ||
|
||
flag.Parse() | ||
|
||
ks := helpers.GetKeystore(*keyStoreDir) | ||
|
||
acc, err := helpers.GetUnlockedAcc(*etherAddress, *etherPassphrase, ks) | ||
checkError("Unlock acc", err) | ||
|
||
transactor := helpers.CreateNewKeystoreTransactor(ks, acc) | ||
|
||
client, synced, err := helpers.LookupBackend(*ethRPC) | ||
checkError("Backend lookup", err) | ||
<-synced | ||
|
||
mystTokenAddress, tx, _, err := mysttoken.DeployMystToken(transactor, client) | ||
checkError("Deploy token", err) | ||
checkTxStatus(client, tx) | ||
fmt.Println("Token: ", mystTokenAddress.String()) | ||
|
||
transactor.Nonce = big.NewInt(int64(tx.Nonce() + 1)) | ||
paymentsAddress, tx, _, err := promises.DeployIdentityPromises(transactor, client, mystTokenAddress, big.NewInt(100)) | ||
checkError("Deploy payments", err) | ||
checkTxStatus(client, tx) | ||
|
||
fmt.Println("Payments: ", paymentsAddress.String()) | ||
} | ||
|
||
func checkError(context string, err error) { | ||
if err != nil { | ||
fmt.Println("Error at:", context, "value:", err.Error()) | ||
os.Exit(1) | ||
} | ||
} | ||
|
||
func checkTxStatus(client *ethclient.Client, tx *types.Transaction) { | ||
|
||
//wait for transaction to be mined at most 10 seconds | ||
for i := 0; i < 10; i++ { | ||
_, pending, err := client.TransactionByHash(context.Background(), tx.Hash()) | ||
checkError("Get tx by hash", err) | ||
if pending { | ||
time.Sleep(1 * time.Second) | ||
} else { | ||
break | ||
} | ||
} | ||
|
||
receipt, err := client.TransactionReceipt(context.Background(), tx.Hash()) | ||
checkError("Fetch tx receipt", err) | ||
if receipt.Status != 1 { | ||
fmt.Println("Receipt status expected to be 1") | ||
os.Exit(1) | ||
} | ||
} |
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
Oops, something went wrong.