Beispiel #1
0
    def transferClick(self):
        try:
            c = NemConnect(self.host.get(), int(self.port.get()))

            privkey = self.privKeyEntry.get()
            multisig = self.multisigPubKeyEntry.get(
            ) if self.multisigEnabled.get() else None
            recipient = self.transferRecipient.get()
            amount = int(self.transferAmount.get())
            message = self.transferMessage.get("1.0", END)
            mosaics = map(
                lambda x:
                (x['t'].get() + '.' + x['m'].get(), int(x['q'].get())),
                self.attachments)

            if len(self.attachments) > 0:
                amount *= 1000000

            a = Account(privkey)
            ok, j = c.prepareTransfer(a.getHexPublicKey(), multisig, recipient,
                                      amount, message, mosaics)
            self.commonHandle(c, a, ok, j)

        except Exception as e:
            self.report(str(e), traceback.format_exc())
Beispiel #2
0
    def mosaicClick(self):
        c = NemConnect(self.host.get(), int(self.port.get()))

        privkey = self.privKeyEntry.get()
        fqn = self.create_namespaceNameEntry.get(
        ) + '.' + self.create_mosaicNameEntry.get()
        desc = self.mosaicDescText.get("1.0", END)
        defaultProps = {
            'divisibility': int(self.m_d.get()),
            'initialSupply': int(self.m_is.get()),
            'supplyMutable': True if self.m_ms.get() else False,
            'transferable': True if self.m_t.get() else False
        }
        multisig = self.multisigPubKeyEntry.get() if self.multisigEnabled.get(
        ) else None

        if self.m_hasLevy.get():
            defaultProps['levy'] = {
                "type":
                int(self.m_levy_type.get()),
                "recipient":
                self.m_levy_recipient.get(),
                "mosaicFqn":
                self.m_levy_namespace.get() + '.' + self.m_levy_mosaic.get(),
                "fee":
                int(self.m_levy_fee.get())
            }
        try:
            a = Account(privkey)
            ok, j = c.prepareMosaicCreation(a.getHexPublicKey(), multisig, fqn,
                                            desc, defaultProps)
            self.commonHandle(c, a, ok, j)

        except Exception as e:
            self.report(str(e), traceback.format_exc())
Beispiel #3
0
    def mosaicClick(self):
        c = NemConnect(self.host.get(), int(self.port.get()))

        privkey = self.privKeyEntry.get()
        fqn = self.create_namespaceNameEntry.get(
        ) + '.' + self.create_mosaicNameEntry.get()
        desc = self.mosaicDescText.get("1.0", END)
        defaultProps = {
            'divisibility': int(self.m_d.get()),
            'initialSupply': int(self.m_is.get()),
            'supplyMutable': True if self.m_ms.get() else False,
            'transferable': True if self.m_t.get() else False
        }
        multisig = self.multisigPubKeyEntry.get() if self.multisigEnabled.get(
        ) else None

        if self.m_hasLevy.get():
            defaultProps['levy'] = {
                "type":
                int(self.m_levy_type.get()),
                "recipient":
                self.m_levy_recipient.get(),
                "mosaicFqn":
                self.m_levy_namespace.get() + '.' + self.m_levy_mosaic.get(),
                "fee":
                int(self.m_levy_fee.get())
            }
        try:
            a = Account(privkey)
            ok, j = c.prepareMosaicCreation(a.getHexPublicKey(), multisig, fqn,
                                            desc, defaultProps)
            self.commonHandle(c, a, ok, j)

        except Exception as e:
            self.report(str(e), traceback.format_exc())
Beispiel #4
0
    def namespaceClick(self):
        c = NemConnect(self.host.get(), int(self.port.get()))

        privkey = self.privKeyEntry.get()
        fqn = self.namespaceNameEntry.get()
        multisig = self.multisigPubKeyEntry.get() if self.multisigEnabled.get() else None
        try:
            a = Account(privkey)
            ok, j = c.prepareProvisionNamespace(a.getHexPublicKey(), multisig, fqn)
            self.commonHandle(c, a, ok, j)

        except Exception as e:
            self.report(str(e), traceback.format_exc())
Beispiel #5
0
    def mosaicSupplyClick(self):
        c = NemConnect(self.host.get(), int(self.port.get()))

        privkey = self.privKeyEntry.get()
        fqn = self.mosaicSupply_namespace.get() + '.' + self.mosaicSupply_mosaic.get()
        supplyDelta = int(self.ms_supplyChange.get())
        supplyMode = self.ms_mode.get()

        multisig = self.multisigPubKeyEntry.get() if self.multisigEnabled.get() else None
        try:
            a = Account(privkey)
            ok, j = c.prepareMosaicSupply(a.getHexPublicKey(), multisig, fqn, supplyMode, supplyDelta)
            self.commonHandle(c, a, ok, j)
        except Exception as e:
            self.report(str(e), traceback.format_exc())
Beispiel #6
0
    def namespaceClick(self):
        c = NemConnect(self.host.get(), int(self.port.get()))

        privkey = self.privKeyEntry.get()
        fqn = self.namespaceNameEntry.get()
        multisig = self.multisigPubKeyEntry.get() if self.multisigEnabled.get(
        ) else None
        try:
            a = Account(privkey)
            ok, j = c.prepareProvisionNamespace(a.getHexPublicKey(), multisig,
                                                fqn)
            self.commonHandle(c, a, ok, j)

        except Exception as e:
            self.report(str(e), traceback.format_exc())
Beispiel #7
0
    def mosaicSupplyClick(self):
        c = NemConnect(self.host.get(), int(self.port.get()))

        privkey = self.privKeyEntry.get()
        fqn = self.mosaicSupply_namespace.get(
        ) + '.' + self.mosaicSupply_mosaic.get()
        supplyDelta = int(self.ms_supplyChange.get())
        supplyMode = self.ms_mode.get()

        multisig = self.multisigPubKeyEntry.get() if self.multisigEnabled.get(
        ) else None
        try:
            a = Account(privkey)
            ok, j = c.prepareMosaicSupply(a.getHexPublicKey(), multisig, fqn,
                                          supplyMode, supplyDelta)
            self.commonHandle(c, a, ok, j)
        except Exception as e:
            self.report(str(e), traceback.format_exc())
Beispiel #8
0
    def transferClick(self):
        try:
            c = NemConnect(self.host.get(), int(self.port.get()))

            privkey = self.privKeyEntry.get()
            multisig = self.multisigPubKeyEntry.get() if self.multisigEnabled.get() else None
            recipient = self.transferRecipient.get()
            amount = int(self.transferAmount.get())
            message = self.transferMessage.get("1.0", END)
            mosaics = map(lambda x: (x['t'].get() + '.' + x['m'].get(), int(x['q'].get())), self.attachments)

            if len(self.attachments) > 0:
                amount *= 1000000

            a = Account(privkey)
            ok, j = c.prepareTransfer(a.getHexPublicKey(), multisig, recipient, amount, message, mosaics)
            self.commonHandle(c, a, ok, j)

        except Exception as e:
            self.report(str(e), traceback.format_exc())
Beispiel #9
0

def signAndAnnounceTransaction(connector, jsonData):
    print " [+] TRYING TO SIGN PREPARED DATA"
    data = unhexlify(jsonData['data'])
    sig = a.sign(data)

    ok, j = connector.transferAnnounce(jsonData['data'], hexlify(sig))
    if ok:
        print " [+] ANNOUNCED"
    else:
        print " [!] announce failed"
    prettyPrint(j)


c = NemConnect('127.0.0.1', 7890)

if args.sub == 'info':
    j = c.nodeInfo()
    print " [+] NODE INFO:"
    prettyPrint(j)
    sys.exit(0)

elif args.sub == 'harvest':
    msg = "UNLOCK" if args.unlock else "LOCK"
    privkey = args.unlock or args.lock
    a = Account(privkey)
    print " [+] TRYING TO %s USING ACCOUNT" % msg
    print "private: %s" % a.getHexPrivateKey()
    print " public: %s" % a.getHexPublicKey()
    if args.unlock:
def prettyPrint(j):
	print json.dumps(j, indent=2)

def signAndAnnounceTransaction(connector, jsonData):
	print " [+] TRYING TO SIGN PREPARED DATA"
	data = unhexlify(jsonData['data'])
	sig = a.sign(data)

	ok, j = connector.transferAnnounce(jsonData['data'], hexlify(sig))
	if ok:
		print " [+] ANNOUNCED"
	else:
		print " [!] announce failed"
	prettyPrint(j)

c = NemConnect('62.75.171.41', 7890)

if args.sub == 'info':
	j = c.nodeInfo()
	print " [+] NODE INFO:"
	prettyPrint(j)
	sys.exit(0)

elif  args.sub == 'harvest':
	msg = "UNLOCK" if args.unlock else "LOCK"
	privkey = args.unlock or args.lock
	a = Account(privkey)
	print " [+] TRYING TO %s USING ACCOUNT" % msg
	print "private: %s" % a.getHexPrivateKey()
	print " public: %s" % a.getHexPublicKey()
	if args.unlock:
Beispiel #11
0
sendParser = sub.add_parser('send', help="send nem")
sendParser.add_argument("key", metavar='PRIVKEY', action=PrivateKeyAction, help="sender's private key")
sendParser.add_argument("to", metavar='ADDRESS', help="recipient's address (i.e. TDGIMREMR5NSRFUOMPI5OOHLDATCABNPC5ID2SVA)")
sendParser.add_argument("amount", metavar="AMOUNT", type=int, help="amount in microNEMs")
#sendParser.add_argument("fee", metavar="FEE", type=int, help="fee in microNEMs")

#harvestingParser = sub.add_parser('harvest', help="remote harvesting")

args = parser.parse_args()
print args

def prettyPrint(j):
	print json.dumps(j, indent=2)

c = NemConnect('127.0.0.1', 7890)

if args.sub == 'info':
	j = c.nodeInfo()
	print " [+] NODE INFO:"
	prettyPrint(j)

elif  args.sub == 'harvest':
	msg = "UNLOCK" if args.unlock else "LOCK"
	privkey = args.unlock or args.lock
	a = Account(privkey)
	print " [+] TRYING TO %s USING ACCOUNT" % msg
	print "private: %s" % a.getHexPrivateKey()
	print " public: %s" % a.getHexPublicKey()
	if args.unlock:
		ok,j = c.accountUnlock(privkey)

def signAndAnnounceTransaction(connector, jsonData):
    print " [+] TRYING TO SIGN PREPARED DATA"
    data = unhexlify(jsonData['data'])
    sig = a.sign(data)

    ok, j = connector.transferAnnounce(jsonData['data'], hexlify(sig))
    if ok:
        print " [+] ANNOUNCED"
    else:
        print " [!] announce failed"
    prettyPrint(j)


c = NemConnect('62.75.171.41', 7890)

if args.sub == 'info':
    j = c.nodeInfo()
    print " [+] NODE INFO:"
    prettyPrint(j)
    sys.exit(0)

elif args.sub == 'harvest':
    msg = "UNLOCK" if args.unlock else "LOCK"
    privkey = args.unlock or args.lock
    a = Account(privkey)
    print " [+] TRYING TO %s USING ACCOUNT" % msg
    print "private: %s" % a.getHexPrivateKey()
    print " public: %s" % a.getHexPublicKey()
    if args.unlock:
Beispiel #13
0

def signAndAnnounceTransaction(connector, jsonData):
    print " [+] TRYING TO SIGN PREPARED DATA"
    data = unhexlify(jsonData['data'])
    sig = a.sign(data)

    ok, j = connector.transferAnnounce(jsonData['data'], hexlify(sig))
    if ok:
        print " [+] ANNOUNCED"
    else:
        print " [!] announce failed"
    prettyPrint(j)


c = NemConnect('127.0.0.1', 7890)

if args.sub == 'info':
    j = c.nodeInfo()
    print " [+] NODE INFO:"
    prettyPrint(j)
    sys.exit(0)

elif args.sub == 'harvest':
    msg = "UNLOCK" if args.unlock else "LOCK"
    privkey = args.unlock or args.lock
    a = Account(privkey)
    print " [+] TRYING TO %s USING ACCOUNT" % msg
    print "private: %s" % a.getHexPrivateKey()
    print " public: %s" % a.getHexPublicKey()
    if args.unlock: