Giter Site home page Giter Site logo

nem2-sdk-go's People

Contributors

carlocayos avatar mickeyscorsese avatar ruslanbik4 avatar slackve avatar wondertan avatar xgreenx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nem2-sdk-go's Issues

Mosaic creation broken after the last update

Creating mosaic now returns an error

Hash: 366E0ABBF745B4BE36ADAA04487A519B5D9584BF677ADBC16F9AF7754426F91B
Error code: Failure_Mosaic_Invalid_Name
Deadline: 2018-11-29 14:13:38.615

Multiple address listening is not working

This is first account's transaction statuses handling:

subscribeTransaction, err := ws.Subscribe.ConfirmedAdded(account.Address.Address)
if err != nil {
    return nil, err
}
// Below goes code which handles channels and it works.

This part of code goes after with different account, thus different address:

subscribeTransaction, err := b.ws.Subscribe.ConfirmedAdded(acc.Address.Address)
if err != nil {
   errCh <-err
   return
}
// This part handles channel and it is not working
for {
    select {
    case status := <-statusSub.Ch: // Returns nothing
        if status.Hash.String() == signedTx.Hash.String() {
	    errCh <-errors.New(status.Status)
	    break
	}
}

I checked through debugger function buildType() and it is not called, while other WS client not from sdk receives message about confirmed transaction

It is not possible to subscribe to one topic with many addresses

sub1, _ := b.ws.Subscribe.Status("VBRPREMRDLANIF2WT2WRFXNLC5GDFGZYBVFSSAGK")
sub2, _ := b.ws.Subscribe.Status("VDYWAEJF7ZNGEOPAVGMSX6KDAX6PHVRENJVKX2OM")

Sub2 overrides sub1 programmatically, while websocket channel is still sending messages to sdk, which can't handle them

I'm getting an 'undefined: sdk.LoadTestnetConfig' error.

Hello Sir,

I'm currently testing the 'Get AccountInfo for an account' sample code and I'm getting this error.

Sample code:

`package main

import (
"fmt"

"github.com/proximax-storage/nem2-sdk-go/sdk"
"golang.org/x/net/context"

)

const (
// Catapult-api-rest server.
baseUrl = "http://localhost:3000"

// Types of network.
// MainNet:   104
// TestNet:   152
// Mijin:     96
// MijinTest: 144
networkType = sdk.MijinTest

// A valid private key.
publicKeyOne = "E17324EAF403B5FD747055ED3ED97CFD1000AF176FB9294C9424A2814D765A76"

)

// Simple Account API request
func main() {

addressOne, _ := sdk.NewAddressFromPublicKey(publicKeyOne, networkType)

conf, err := sdk.LoadTestnetConfig(baseUrl)
if err != nil {
	panic(err)
}

// Use the default http client
client := sdk.NewClient(nil, conf)

// Get AccountInfo for an account.
// Param address - A Address struct.
accountInfo, resp, err := client.Account.GetAccountInfo(context.Background(), addressOne)
if err != nil {
	fmt.Printf("Account.GetAccountInfo returned error: %s", err)
	return
}
fmt.Printf("Response Status Code == %d\n", resp.StatusCode)
fmt.Printf(accountInfo.String())

}
`
Here's the screenshot: https://imgur.com/z8SuYKN

Thanks alot.

ws sdk not work it's flood response old block

selection_029
selection_028

package main

import (
	"context"
	"fmt"

	"github.com/proximax-storage/nem2-sdk-go/sdk"
)

const (
	baseUrl     = "http://xxxxxx:3000"
	networkType = sdk.MijinTest
	privateKey  = "xxx"
)

// WebSockets make possible receiving notifications when a transaction or event occurs in the blockchain.
// The notification is received in real time without having to poll the API waiting for a reply.
// Simple Blockchain API request
func main() {

	// timeout in milliseconds
	// 60000 ms = 60 seconds
	// 0 = without timeout
	ws, err := sdk.NewConnectWs(baseUrl, 60000)
	conf, err := sdk.NewConfig(baseUrl, networkType)
	if err != nil {
		panic(err)
	}
	// Use the default http client
	client := sdk.NewClient(nil, conf)

	fmt.Println("websocket negotiated uid:", ws.Uid)
	d, _ := ws.Subscribe.Block()

	for {
		data := <-d.Ch
		fmt.Printf("Block received with height: %v \n", data.Height)

		getBlockTransactions, resp, err := client.Blockchain.GetBlockTransactions(context.Background(), data.Height)

		if err != nil {
			fmt.Printf("Blockchain.GetBlockTransactions returned error: %s", err)
			return
		}
		fmt.Printf("Response Status Code == %d\n", resp.StatusCode)
		fmt.Printf("%s\n\n", getBlockTransactions)
	}
}

Websocket client shouldn't manipulate URL by default

In wsConnect(), changeURLPort() is called by default, which forces the port to 3000. It should follow the port set in the BaseURL or have an option to not call it at all.

Also there is no way to change from ws:// to wss://

not receiving websocket block status updates

issue with websocket code not receiving block status updates

`package main

import (
"fmt"
"github.com/proximax-storage/nem2-sdk-go/sdk"
)

const (
baseUrl = "http://bctestnet1.xpxsirius.io:3000"
)

func main() {

// timeout in milliseconds
// 5000 ms = 5 seconds
ws, err := sdk.NewConnectWs(baseUrl, 5000)
if err != nil {
	panic(err)
}

fmt.Println("websocket negotiated uid:", ws.Uid)
d, _ := ws.Subscribe.Block()

for {
	data := <-d.Ch
	fmt.Printf("Block received with height: %v \n", data.Height)
}

}
`

@slackve

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.