SDK V2 Errors

Hello,

Light Shadow Box team met some errors while implementing SDK v2

Problem 1: Send native token. The sending can be initiated while message is empty, but if the message is filled, then it said: can’t init transfer

130076139_710880966229065_1306599946058696548_n

Problem 2: Send privacy token. The API from SDK returned forEach of undefined even though we implemented every info needed in the document

129465963_1264320147275262_4069141916057742037_n

Problem 3: getTxHistoryByPublicKey only returned send history, there is no receive history

@andrey @Peter @Ducky

2 Likes

Hi, we are in the process of completing the SDK-v2.
You can use branch develop by cmd
yarn add https://github.com/incognitochain/sdk-v2#develop. to fix your problem 1 & 2.
getTxHistoryByPublicKey only saves local tx (send tx) so we will support a method to get receive history next time.

2 Likes

Thanks
We got this error after importing and requesting to your server

image

** Updated:

We still got errors from server side even with these fullnode APIs:

@binh @phathoang @andrey

1 Like

Hi, please configs your project by this link
https://github.com/incognitochain/sdk-v2/blob/develop/sample/test-node.js or re-check function incognito.setConfig({…})

configs: { //mainnet
chainURL: ‘https://lb-fullnode.incognito.org/fullnode’,
apiURL: ‘https://api-service.incognito.org’,
mainnet: true,
wasmPath: path-to-file/privacy.wasm,
},
configs: { //testnet
chainURL: 'https://testnet.incognito.org/fullnode,
apiURL: ‘https://staging-api-service.incognito.org’,
mainnet: false,
wasmPath: path-to-file/privacy.wasm,
},

1 Like

@taind can you post your code ?
here example call to fullnode with respone ok.

var axios = require('axios');
var data = '{\n    "jsonrpc": "1.0",\n    "method": "getblockchaininfo",\n    "params": [],\n    "id": 1\n    }';

var config = {
  method: 'post',
  url: 'https://community-fullnode.incognito.org/',
  headers: { 
    'Content-Type': 'text/plain', 
    'Cookie': '__cfduid=da6fc1cc5f6ce18165d11c93424d5af0c1605371330'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
1 Like

@binh @phathoang
We got the server works, thanks.

However, when it comes to send privacy token, we got some issues
ErrorCode is not defined

130942390_215196386740996_2001443359523788367_n

Here is our code:

131117290_828972924608186_7748601273956284207_n

130112619_750639132211626_1989326980588244896_n (1)

Also, when sending token, do we need to request accessToken? We got this while calculating the fee.

Please help us on this :smiley:

1 Like

Please check your code by following this config below and make sure you are using branch #develop to have the newest code.

1 Like

We tried these configurations

1. Same configurations you gave us

131388293_513714709531821_8166821979883010863_n

Outcome:

  • Cannot request to server, error occurs
  • Cannot do any further functionality
    131565675_2853171954962866_1178288465904193709_n

2. Our configurations

131275899_812762789574816_4295199843095120566_n (1)

Outcome:

  • Successfully send & receive in-network
  • Cannot send & receive outnetwork
    130744025_2822178774693511_321712160692372857_n

Please have a look @binh @phathoang

1 Like

You can install chrome extension CORS https://chrome.google.com/webstore/detail/allow-cors-access-control/lhobafahddgcelffkeicbaginigeejlf to resolve this problem on develop mode and follow configs at file https://github.com/incognitochain/incognito-extention-wallet/blob/main/src/services/server.ts

We tried exactly your config above, and still got this error with Shield & Unshield,
I dont think it’s related to the server config @phathoang

131511037_1322271108131447_4838402519449370854_n

We will support Shield and Unshield next time. SDK is still developing

Do you have the estimated timeline?
Also does the request trade & staking feature completed in SDK v2?
@phathoang

1 Like

We encountered this error while sending in-network, any thoughts ? @binh @phathoang

133081393_817837355456687_4217945941561497656_n

Yah maybe

Can you share your code? (Config env, your token id, v…v) or follow topic https://github.com/incognitochain/sdk-v2/blob/develop/sample/test-node.js

Native fee or privacy fee must be string. You can use typescript to check it easier

@phathoang

  • Send in-network worked before, until last-week
  • When we switched to use the master branch, it works, but if we used the develop branch, it got errors.

Our configs and code:

133751550_742872353291685_4704914967691324337_n

133830052_4139579286071689_1375279117591943535_n

Also,

@andrey @binh @phathoang,
Can you guys do a weekly update on the SDK development, as builder i want to know:

  1. What changes on the SDK function, and does it affect on our implementation, do we need to change anything to keep the function works. (take our send in-network as example, i believe it’s due to some coreteam changes on the SDK)
  2. What’s new features on SDK => this will take us ahead on what’s new, better for our planning.
2 Likes

for develop branch it work for test-net.

  1. Current to sdk we have still update for a improve in chain. this we will release in this week.
  2. for new features ok SDK, current we dont have plain to bring news feature for sdk, all almost want to make sdk stable first.
1 Like

So you mean SDK is not ready to send privacy token? We used the develop branch to make sending privacy token works.

When can the master branch could send privacy token, please give me the estimated timeline. We’re pushing our updates on the store.