#🚀・dev-support

1 messages · Page 10 of 1

topaz seal
#

have you seen the code examples in the API documentation page?

quiet horizon
topaz seal
steep robin
#

Hey hey! Where can I read more about the RWA module exactly? Can't find on the repo or in the docs

quiet horizon
topaz seal
quiet horizon
#

well, when i placed a short order the quantity was pretty arbitrary. 6.464000000000000000

#

but the margin was the same as the usdt deposit amount

#

soooo

topaz seal
quiet horizon
#

not rly sure

quiet horizon
hard fog
#

hi @topaz seal , I can't run MsgInstantPerpetualMarketLaunch in git@github.com:InjectiveLabs/sdk-go.git, so I don't know the response, but my question is after calling MsgInstantPerpetualMarketLaunch method, will we get the market ID for the new pair and we can use this id in create limit order, right?
the second question is I see quote and base token is a symbol, why not address?

#

thank you

reef fiber
#

if I require api access to data from say October 2023, do I need a entire archival node, or can I run something like a full node that dates back longer than the standard full node?

topaz seal
# hard fog hi <@831364009877569538> , I can't run MsgInstantPerpetualMarketLaunch in git@gi...

You don't receive a response to the message, what you receive is the response for the TX broadcast, since you don't send a message, you send a TX with the message in it.
If the TX is succesfully processed in a block, you will find an event in that TX with the market creation results. That event includes de market id for the new market.

There is an example on how to use this message in the Go SDK, both in the API documentation page and in the Go SDK repo, in the examples folder

topaz seal
topaz seal
velvet hollow
#

I have deployed new smart contract on injective network and need to index all events from the contract.
What's the best solution? Please give me example code.

steep robin
dusky bramble
modest gate
#

Where can i find the message to burn cw20 tokens

topaz seal
polar basin
#

Hello, looking for dev on injective! Website, token etc.

topaz seal
fleet depot
#

Hello

stone locust
#

for all new builders of inj discoverinj made a A useful tool that will help non coders to connect with smart contracts on Injective with ease and a slick UI!

slender barn
#

when I ping the wallet I want to read, I have the following pagination information:
{
"paging": {
"total": 10462,
"from": 1,
"to": 100
},

velvet hollow
#

Is there any example of NFT contract on injective chain?
cc: @soft dome @topaz seal

rotund panther
#

Is there any dev here?

topaz seal
topaz seal
rotund panther
#

Basically I'm trying to connect Injective chain through python and facing some ENS issues how to directly connect to injective??

topaz seal
topaz seal
rotund panther
#

No where can I get that basically my goal is to get number of tokens of particular project address is holding through python

topaz seal
rotund panther
#

Can you share API doc pls?

topaz seal
rotund panther
#

What api provideo should I use

#

there is noting I could find related to that?

topaz seal
rotund panther
#

I'm looking to run this code but facing error with injective provider url
"from web3 import Web3, HTTPProvider

Replace with your Injective node provider URL

injective_provider_url = ""

Injective address to check balance

injective_address = ""

def check_injective_balance(address):
"""Fetches and prints the balance of an Injective Chain address.

Args:
address: The Injective Chain address (starting with "inj").
"""
try:
# Connect to the Injective node
web3 = Web3(HTTPProvider(injective_provider_url))

# Fetch the balance
balance = web3.eth.getBalance(address)

# Print the balance
print(f"Balance of {address}: {balance}")

except Exception as e:
print(f"Error fetching balance: {e}")

if name == "main":
check_injective_balance(injective_address)
"

rotund panther
topaz seal
slender barn
slender barn
fast ocean
hazy sand
topaz seal
quick shard
frosty kiln
frosty kiln
fast ocean
#

Hello, after i set up node following by this guide Injective Exchange Service Setup Guidehttps://injective.notion.site/Injective-Exchange-Service-Setup-Guide-7e59980634d54991862300670583d46a, what kind of data i will be able to get from this node? Will i be able to to fetch all transactions for specified addresses?

#

@frosty kiln

fast ocean
#

I’m looking for a ws connection to my runned node. I want to subscribe for new transactions for specified addresses and get data from them. Also, I must have an opportunity to call getters functions on contracts and send transactions to contracts through my node. Is this possible?

empty kettle
#

I have question about wasmd.
Which version of wasmd is used in injective chain?
Where can I query this info?

topaz seal
fast ocean
modest gate
topaz seal
limpid remnant
#

I get this error,when sending transaction from a new wallet, pubKey does not match signer address inj12zd4wvdln9ksnq3czu6kn0fj3zu4ar2lh4aymv with signer index: 0: invalid pubkey

#

@topaz seal

kind flare
limpid remnant
#

I have read all the docs

#

I could debug it myself...if I know the repo the error message is from

#

I found where the error message is coming from but, the transaction only go when sequence number is greater than 0

limpid remnant
#

I have found the solution...thanks

light parrot
#

hi sorry for stupid question, trying to send an rpc request using cw-injective for QueryAllContractStateRequest (types/cosmwasm/wasm/v1) anyone knows how to do this? looks like it should be something simple but i cant find any docs.

i see WasmQuerier.all_contract_state exists, but not sure how to create one

velvet hollow
#

Hello, hope you are doing well.
How to import NFT in Keplr wallet? Who knows?

#

It seems like it's possible to import cw20 token, but impossible to import NFT contract. Can you please help me guys?

velvet hollow
#

This should be scam. @viscid hound

buoyant jewel
velvet hollow
velvet hollow
topaz seal
#

Be careful with the links you received in DMs @velvet hollow

velvet hollow
shy ivy
#

I just wanna make LP token Locker on INJ, How can I do this?
Any online doc here?

topaz seal
vast bluff
topaz seal
vast bluff
topaz seal
tranquil rivet
#

Our Validator Slashboard now tracks more slashing events than before!
We’ve added tracking of 👾 **missing_valset_confirm **and 🎃 **missing_batch_confirm **events on INJ Injective network.

https://x.com/kjnodes/status/1798272764287324198

🚀 Our Validator Slashboard now tracks more slashing events than before!

Alongside ⚠️missing_signature and 🛑double_sign, we’ve added tracking of 👾missing_valset_confirm and 🎃missing_batch_confirm events on @injective.

These additions cover almost half of the slashed value!

topaz seal
#

@worthy crown @mortal kelp @lime ruin this user is sending spam. We should block him

teal sapphire
#

hello, TEAM!
im an independent blockchain & frontend developer and am currently looking for a developer position on an ongoing project.
is there any chance i can work with you?

lime ruin
polar basin
#

INJ Testnet is working? Cant send the tx

lime ruin
# polar basin INJ Testnet is working? Cant send the tx

Make sure to always provide more details about what exactly you're trying such as what message you're trying to execute, what SDK you're using and the node endpoint which you're connecting to also any errors if you're getting any so that your question gets answered faster.

#

I just did a testnet transaction and it works fine btw.

hard fog
#

hi @topaz seal , we want to build a new perpeptual exchange using INJ, and I have a few questions:

  • we want to create new pair (like BTC/USDT), is this possible? If possible, could we use customized token or should be the token in the specified list that INJ support?
  • could we create the pair that already existed on INJ (like BTC/USDT on helix), is one pair will has one marketID?
  • can we use shared order on INJ (like we created new own BTC/USDT pair, and can get and match order from Helix BTC/USDT)?
  • What is the strategy for liquidate and funding fee? Did INJ use oracle for liquidate? Could you send me some documents for this, thank you
hazy sand
topaz seal
# hard fog hi <@831364009877569538> , we want to build a new perpeptual exchange using INJ,...

Hello
| + we want to create new pair (like BTC/USDT), is this possible? If possible, could we use customized token or should be the token in the specified list that INJ support?
You can launch new markets through governance, or usin the instant market launch (only available for spot markets)

| + could we create the pair that already existed on INJ (like BTC/USDT on helix), is one pair will has one marketID?
Only if the market details are different. It would not make sense to have more than one instance of the exact same market

| + can we use shared order on INJ (like we created new own BTC/USDT pair, and can get and match order from Helix BTC/USDT)?
Each market has its own order book. Order matching happens in the context of the order book.

| + What is the strategy for liquidate and funding fee? Did INJ use oracle for liquidate? Could you send me some documents for this, thank you
Please check the docs, that is all explained there

topaz seal
tardy spindle
#

Has some C++ documentation for work with transactions? or C++ usseles for that

topaz seal
#

We have only implemented SDKs for Python, Go and TS. You can use C++, you just need to implement the requests using gRPC yourself

candid maple
#

I thought Injective Protocol was built using Substrate SDK?

topaz seal
candid maple
tardy spindle
#

what do u reccomend learn after C++ for crypto? Solidity or just learn Js/Python?

topaz seal
polar basin
#

I have a question about tokenstation. a launch market option is like creating a liquidity for trading? is this option for this?

woeful moon
#

can anyone help me with pagination on the python api lol

#

I swear it isnt behaving properly

#

do I need to transform the nextKey before using it in the next request?

topaz seal
woeful moon
#

sure thing

topaz seal
woeful moon
# topaz seal what is the issue? Could you provide an example script to reproduce the problem ...
next_key = ""
while next_key is not None:
    pagination_option = PaginationOption(key=next_key, limit=100, count_total=True)
    response = await self.client.fetch_denom_owners(
        denom=address, pagination=pagination_option
    )

    if response and "denomOwners" in response:
        all_balances.extend(response["denomOwners"])
        print(f"extended all balances {len(response['denomOwners'])}")
    else:
        print("No balances found for the provided denom.")
        break

    next_key = response["pagination"].get("nextKey")

    if not next_key:
        next_key = None
print(len(all_balances))```
`self.network = Network.mainnet()`
`self.client = AsyncClient(self.network)`
the first query returns 100 balances and a pagination object like 
{'nextKey': 'FBx6l7swhudRAKHTFfrh1u49Ched', 'total': '946'}
but when I use the key for the next iteration, its returns nothing 
{'pagination': {'nextKey': '', 'total': '0'}, 'denomOwners': []}
so I only end up with the first 100
#

let me know if you need any more info

#

this has been my experience with every api call that uses pagination. same for fetch_smart_contract_state

#

it seems to skip data

topaz seal
woeful moon
topaz seal
#

No, you are not. It is related to some pagination keys not supporting to be decoded from bytes to string. We need to fix the pagination definition in the Python SDK

pearl hound
topaz seal
hazy sand
topaz seal
hazy sand
heady steeple
#

@woeful moon

woeful moon
#

hi

topaz seal
woeful moon
true herald
#

Hi community how are you doing?

#

Hi @topaz seal I need some assistance to develop with nextjs about injective network for now.

#

I created a new token using https://www.tokenstation.app/launch. And I have to get detail infos about the token. so, I already got the token name, description, icon, token price, total supply, etc. But I didn't get some info such as launch date and market state yet.
please let me know how to get the launch date or mint date of the token.

Token Station

Launch a Token on Injective

true herald
#

And another question:

I am going to sell the token i created. Users connect own wallet and can buy the token. At this time, user will pay me the token price. For this, should I develop the smart contract? or Injective network can provide modules for these transactions?

topaz seal
topaz seal
true herald
true herald
#

for this, I dont think I have to develop the smart contract. Injective network will provide the api like this, i guess.

#

how about you?

#

if so, please let me know in more detail about this api.

sonic tide
#

hello. i am a passionate blockchain engineer and now looking for an opportunity to work with you.

true herald
#

so, can you help me for now?

topaz seal
topaz seal
true herald
true herald
polar basin
#

Hello, I'm working on my token and I managed to connect it to my website so that everything displays nicely.

I have a question about implementing transactions for custom token. Should I use a launch market on tokenstation or is there any docs where is it written down somehow how to do that?

topaz seal
woeful moon
#

Im struggling to launch a permissionless spot market on token station. not sure what params to use

woeful moon
#

what resolution does min_price_tick_size need to be in? 18 for INJ as quote?

topaz seal
#

min_price_tick_size for spot markets should depend on both base and quote assets decimals. For perpetual markets only the quote asset decimals has impact

woeful moon
woeful moon
#

The mod that was helping me made FIO on testnet. He set price tick size to 0.00001 but the tx has
min_price_tick_size: 10000000.000000000000000000

woeful moon
#

And FIO has 6 decimals where INJ as 18. So it's 18-6 =12 ? Then the above value makes sense

#

What if both are 18

topaz seal
#

For spot markets you just need to make the calculation (for the value to send in the market creation message) of min_price_tick_size * (10^(quote_token_decimals - base_token_decimals))

gray trout
#

Hi, I'm trying to send a transaction on Inj but get the error invalid Bech32 prefix; expected inj, got injpub

#
  let privateKey = PrivateKey.fromHex("0x...")
  let message = MsgExecuteContractCompat.fromJSON({
    contractAddress,
    sender: privateKey.toBech32(),
    funds: [
      {
        amount,
        denom: 'inj',
      },
    ],
    msg: {...},
  })

  return new MsgBroadcasterWithPk({
    privateKey,
    network: Network.Mainnet,
  }).simulate({ msgs: message })
#

This is the code I'm using.

tough pawn
tough pawn
gray trout
#

But I thought anyone could deploy a contract on chain?

toxic forge
#

Can anyone explain to me what the uri_hash should be set to for tokenfactory denoms?

#

I can't find any explanation in any docs on any network 😄

toxic forge
#

Or more in general, do you guys have any examples of creating denoms and setting metadata from the cosmwasm side?

toxic forge
#

At this point I'm looking for the protobuf definitions of the tokenfactory msg types

#

because I can find no such code example of creating new denoms on the contract side. Everything is typescript client so far

#

Anyone happen to know where I can find the SetDenomMetadata protobuf def?

sturdy river
#

Hm

woeful moon
#

Getting this error with any tx I try execute on the exchange module on the testnet. Same error message. Can't create spot orders or create new spot markets.

toxic forge
#

You have to enable the extension to run in a private window, though

woeful moon
toxic forge
#

ah

woeful moon
#

Like my phone

#

And using different wallets

#

So weird

toxic forge
#

what wallet are you using?

woeful moon
#

Keplr

toxic forge
#

hmm yea not sure....

#

I've gotten similar in other contexts

#

But it's intermittant and I also have no idea where it's originating from

woeful moon
#

I don't even own the pub key that's in the error msg

toxic forge
#

All apologies, but to be honest, all I've been doing all day is searching through docs to figure out how injective's implementation differs from the supposed standard tokenfactory spec. I'm sorry for not seeing this minuscule link in a section of the docs I wouldn't have thought to look in, since in my mind, protobuf definitions aren't client specific.

What would be truly useful is an example of creating new denoms, specifically on injective, from the CW side, since it seems like injective, along with a whole host of other cosmos blockchains, decided to do their own thing and use non-standard Message namespaces etc., so at this point, my eyeballs are spinning in my head from trying to keep everything straight.

Thanks for the link though

topaz seal
woeful moon
topaz seal
woeful moon
#

does this not contradict
min_price_tick_size * (10^(quote_token_decimals - base_token_decimals))

#

if base decimals 6 and quote 18

topaz seal
woeful moon
topaz seal
woeful moon
woeful moon
#

so I made a fresh wallet, got some funds from faucet and was able to make a spot market once, now getting
pubKey does not match signer address inj18q7dkdajtydljze4tgemgplupxuaxks6q4ctrr with signer index: 0: invalid pubkey
again

topaz seal
woeful moon
topaz seal
#

You are working in a new web tool. Are you sure you are using Injective TS SDK?

woeful moon
#

yes

#

I actually managed to get one MsgInstantSpotMarketLaunch tx through on a fresh wallet. Now when I try again it fails

topaz seal
#

In that case now please check you are pointing to the correct network (mainnet, testnet or the one you are trying to work with), and that the account you are trying to use exists on chain and has INJ deposited (enough to pay for the TX fees)

woeful moon
#

it actually worked twice

#

is there a limit on spot market launches you can do from an IP address or wallet

topaz seal
#

no, no limit on market launches per IP. There are limits in the public nodes for request, yes, but not limits on how many market launches you can perform

woeful moon
#

very strange

#

dosnt matter what device or browser I use

#

pubKey does not match signer address inj18q7dkdajtydljze4tgemgplupxuaxks6q4ctrr with signer index: 0: invalid pubkey
I have no connecton to that pub key

#

I got Lahn the community manager to send me some testnet INJ yesterday, not sure if that has anything to do with it. I cant imagine it does

#

iv been sending it between wallets because the faucet has 6 hr timelimit

#

maybe a keplr bug

topaz seal
#

You mentioned you are creating a new web tool. Can you provide a TS script that could be used to reproduce the error? Without the code is difficult to validate you are doing everything correctly

woeful moon
#

but it has already worked

#

i get the exact same error trying to trade on testnet helix

#

ahhhh ok I found the issue

#

is proposer in the MsgInstantSpotMarketLaunch msg the wallet that is sending the tx?

topaz seal
woeful moon
#

those docs mention nothing of proposer

topaz seal
#

They don't mention that field because MsgInstantSpotMarketLaunch does not have a proposer field

woeful moon
#
            proposer: "",
            market: {
                sender: injectiveAddress,
                ticker: `${props.token.metadata.symbol}/INJ`,
                baseDenom: props.token.token,
                quoteDenom: 'inj',
                minPriceTickSize: minPriceTick.toString(),
                minQuantityTickSize: minQuantityTick.toString()
            }
        });```
topaz seal
woeful moon
#

import {MsgInstantSpotMarketLaunch} from "@injectivelabs/sdk-ts";

#

it works if I set it to sender address

topaz seal
#

You must be seeing some SDK internal MsgInstantSpotMarketLaunch class, but not the real proto message

woeful moon
#

still bizzare that I cannot trade on testnet helix

#

I tried installing leap wallet, same thing

topaz seal
# gray trout bumping this

Check the sender in your script. It is supposed to be a public injective address, no t a private key transformed to bech32 representation

toxic forge
#

However, the example code only creates two DenomUnit entries with the denom field being equal to the full denom factory/{addr}/u*{subdenom}

#

I'm pretty sure that if I change to code to configure the DenomUnits the same way that it works for Osmosis (as shown in the cw-token-issuer contract), it'll work. About to try

#

Yep, that worked. Instead of what is shown in the example, this works instead:

  denom_units: vec![
      DenomUnit {
          denom: full_denom.clone(), // factory/...
          exponent: 0,
          aliases: vec![],
      },
      DenomUnit {
          denom: symbol.clone(),
          exponent: decimals,
          aliases: vec![],
      },
  ]
gray trout
topaz seal
topaz seal
#

A private key is just a key in the end. It has an hexadecimal representation that can be turned into a "inj..." format without problems. But representing it as "inj...." does not turn it into a public key.
Again, consider that address already compromissed and do not use it

gray trout
#

While converting inj1rn3g429a2fdtmkftc9c7tgspa00drz7mw96cd6 to an eth address with getEthereumAddress() returns a 20 byte address.

#

Am I missing something?

topaz seal
#

You can test that yourself. Please check the 'toPublicKey` method to get the public key. Compare the result with your private key, and if the result is the same, then you were right

gray trout
topaz seal
gray trout
#

But that's besides the point I think.

#

Can you see the reason for the transaction failing?

topaz seal
gray trout
#

The address for the sender that is.

topaz seal
#

Did that work? Did the error message change?

gray trout
#

No, it was the same.

topaz seal
#

Are you saying that even when hardcoding an address that starts with "inj" instead of "injpub", the TX failed saying the address starts with "injpub"?

gray trout
#

Correct, this is what my code looks like.

topaz seal
#

If that is the case, then you are doing something really wrong in the code, I can't imagine any other reason

gray trout
#
  let privateKey = PrivateKey.fromHex("0x...")
  let message = MsgExecuteContractCompat.fromJSON({
    contractAddress,
    sender: "inj1rn3g429a2fdtmkftc9c7tgspa00drz7mw96cd6",
    funds: [
      {
        amount,
        denom: 'inj',
      },
    ],
    msg: {...},
  })

  return new MsgBroadcasterWithPk({
    privateKey,
    network: Network.Mainnet,
  }).simulate({ msgs: message })
gray trout
topaz seal
gray trout
#

Where the only the msgs field is mandatory.

topaz seal
gray trout
topaz seal
#

Ok, I see now what you mean. I did not realize first you were using the broadcaster. What happens if you run the simulation as in the example in the link I provided?

gray trout
topaz seal
gray trout
#

But ChainGrpcAuthApi.fetchAccount() accepts an inj address, not a public key.

topaz seal
#

privateKey.toPublicKey() returns the public key
publicKey.toBetch32() returns the inj address for that public key

gray trout
#

Ah see that's the issue.

#

For me:

#

privateKey.toBetch32() returns inj1rn3g429a2fdtmkftc9c7tgspa00drz7mw96cd6

#

privateKey.toPublicKey().toBech32() returns injpub1qgfax8n854sguf6tcsdu6ctpa57hm4tz3u9mt303w5kkn360rm7y2ds87uw

#

And that's the source of the original error message, invalid Bech32 prefix; expected inj, got injpub

gray trout
# topaz seal `privateKey.toPublicKey()` returns the public key `publicKey.toBetch32()` return...

Can you please confirm this too runs as expected on your end?

import { getNetworkEndpoints, Network } from '@injectivelabs/networks'
import { ChainGrpcAuthApi, PrivateKey } from '@injectivelabs/sdk-ts'

async function main() {
  const endpoints = getNetworkEndpoints(Network.Mainnet)
  const privateKey = PrivateKey.fromHex("0x...")
  const publicKey = privateKey.toPublicKey()

  const chainGrpcAuthApi = new ChainGrpcAuthApi(endpoints.grpc)

  // works
  const accountDetails1 = await chainGrpcAuthApi.fetchAccount(
    privateKey.toBech32()
  )
  console.dir(accountDetails1)

  // throws `invalid Bech32 prefix; expected inj, got injpub`
  const accountDetails2 = await chainGrpcAuthApi.fetchAccount(
    publicKey.toBech32()
  )
  console.dir(accountDetails2)
}

main()
gray trout
topaz seal
gray trout
edgy cipher
#

Hey guys, is there an old snapshot for injective before january 2024? or is there any way to start an injective node from scratch?

shut crow
#

For building on Injective, which of the sdk is recommended & Ideal: Rust or TypeScript?

hexed sage
#

gm

gray trout
topaz seal
topaz seal
gray trout
#

Or should I directly raise a PR?

topaz seal
gray trout
gray trout
topaz seal
gray trout
#

If you run the snippet, you'll see it throws an error.

#

Does it not throw for you?

topaz seal
gray trout
topaz seal
#

I have already tagged Bojan, he is the team TS expert. It is evident that I can't get the message accross. Let's wait for him to reply. If you want I would suggest you to create a new thread in #1189372652561895475, with all the evidence you have already provided in several different messages here. That will make it easier for him to review the problem

gray trout
kind flare
#

That's what bech32 means. The publicKey can either be in hex or base64 representation.

#

There is no error on the code.

hollow blaze
#

As a developer with a team of analysts, we specialize in addressing challenges related to cryptocurrency. Our team is dedicated to providing swift and effective solutions to any issues you may encounter.

Should you require guidance or problem resolution, please feel free to reach out to us via direct message. Thank you.

rotund panther
#

any python SDK expert here?

#

or admin need some info asap

#

Can we send one bridged ERC20 token from one injective account to another injective accout through injective chain on Python SDK??

gray trout
# kind flare `publicKey.toBech32()` converts the publicKey to `bech32` representation => `inj...

But it does not, that's what I have been trying to tell you.

  const privateKey = PrivateKey.fromHex("0x...");
  console.log(`privateKey.toBech32() = ${privateKey.toBech32()}`);
  console.log(`privateKey.toPublicKey().toBech32() = ${privateKey.toPublicKey().toBech32()}`);

output:

privateKey.toBech32() = inj1rn3g429a2fdtmkftc9c7tgspa00drz7mw96cd6
privateKey.toPublicKey().toBech32() = injpub1qgfax8n854sguf6tcsdu6ctpa57hm4tz3u9mt303w5kkn360rm7y2ds87uw
#

Does this execute differently for you?
If so, please let me know and I'll double check my env.

kind flare
#

Let me check the code

#

good catch, let me republish with a fix

gray trout
#

But I'm a bit disappointing in the team for the reluctance to accept that something might be wrong in the sdk.

#

I understand it's usually user-error and sdk bugs are rare but when someone is debugging sdk code then I think you should listen a bit more carefully.

kind flare
#

But I'm a bit disappointing in the team for the reluctance to accept that something might be wrong in the sdk.

Chill dude, we have probably 50+ requests a day people saying something is wrong with our SDK. We would need to hire 2-3 people to pay attention to these requests that in 99% of the time end up being a false alarm.

rotund panther
#

any python SDK expert here?
or admin need some info asap
Can we send one bridged ERC20 token from one injective account to another injective accout through injective chain on Python SDK??
@kind flare

kind flare
#

or admin need some info asap

There is no need for these kind of messages, we'll reply when it's possible.

kind flare
kind flare
# gray trout Thank you!

Use this version, it should work fine now.

fix: pubKey conversion to bec32 (bangjelkoski)
@injectivelabs/sdk-ts: 1.14.13-beta.1
@injectivelabs/wallet-ts: 1.14.13-beta.1
rotund panther
rotund panther
gray trout
kind flare
gray trout
#

Might be worth adding a separate test for this to ensure it doesn't regress again.

#

Something like this in the spec
https://github.com/InjectiveLabs/injective-ts/blob/2b1fc34956239979d80f0683f740b9ae45c7f527/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.spec.ts#L8C

  test('simulates a transaction', async () => {
    const privateKey = PrivateKey.fromHex(
      process.env.TEST_PRIVATE_KEY as string,
    )

    const network = Network.Devnet
    const injectiveAddress = privateKey.toBech32()

    const message = MsgSend.fromJSON({
      srcInjectiveAddress: injectiveAddress,
      dstInjectiveAddress: injectiveAddress,
      amount: {
        amount: '1',
        denom: 'inj',
      },
    })

    const response = await new MsgBroadcasterWithPk({
      network,
      privateKey,
    }).simulate({ msgs: message })

    expect(response.result).toBeDefined()
  }, 60000)
GitHub

Collection of TypeScript packages that consume and interact with the Injective Chain - InjectiveLabs/injective-ts

honest geyser
#

Hey @topaz seal thanks for guiding me.

I have thuis code to prompt user to sign a message in wallet:

async function handleTxWithKeplr(
receiverAddress,
senderAddress,
tokenToTransact,
mesg,
chainId,
restEndpoint
) {
console.log("Handling transaction with Keplr wallet...");
try {
console.log("Receiver Address:", receiverAddress);
console.log("Sender Address:", senderAddress);
console.log("Token to Transact:", tokenToTransact);
console.log("Message:", mesg);
const getKeplr = async () => {
await window.keplr.enable(chainId);
const offlineSigner = window.keplr.getOfflineSigner(chainId);
const accounts = await offlineSigner.getAccounts();
const key = await window.keplr.getKey(chainId);
return { offlineSigner, accounts, key };
};

const broadcastTx = async (txRaw) => {
  const txRestClient = new TxRestClient(restEndpoint);
  const txHash = await txRestClient.broadcastTx(txRaw);
  if (!txHash) {
    throw new Error("Transaction failed to be broadcasted");
  }
  return txHash;
};
#

const handleTransactionKeplrwithINJ = async () => {
const { offlineSigner, accounts, key } = await getKeplr();
const userAddress = accounts[0].address;

  if (!key.pubKey) {
    throw new Error("Public key not found for the connected account.");
  }

  const chainRestAuthApi = new ChainRestAuthApi(restEndpoint);
  const accountDetailsResponse = await chainRestAuthApi.fetchAccount(
    userAddress
  );
  const baseAccount = BaseAccount.fromRestApi(accountDetailsResponse);
  const accountDetails = baseAccount.toAccountDetails();

  const chainRestTendermintApi = new ChainRestTendermintApi(restEndpoint);
  const latestBlock = await chainRestTendermintApi.fetchLatestBlock();
  const latestHeight = latestBlock.header.height;
  const timeoutHeight = new BigNumberInBase(latestHeight).plus(
    DEFAULT_BLOCK_TIMEOUT_HEIGHT
  );

  const amountToSend = {
    amount: new BigNumberInBase(0.01).toWei().toFixed(),
    denom: "inj",
  };
  const msg = mesg;

  const pubKey = Buffer.from(key.pubKey).toString("base64");
  const { txRaw, signDoc } = createTransaction({
    pubKey,
    chainId,
    fee: DEFAULT_STD_FEE,
    message: [msg],
    sequence: accountDetails.sequence,
    timeoutHeight: timeoutHeight.toNumber(),
    accountNumber: accountDetails.accountNumber,
  });

  const directSignResponse = await offlineSigner.signDirect(
    userAddress,
    signDoc
  );
  const signedTxRaw =
    getTxRawFromTxRawOrDirectSignResponse(directSignResponse);
  const txHash = await broadcastTx(signedTxRaw);
  console.log(`Transaction Hash: ${txHash}`);
  return true; // Indicating success
}; // Call the transaction handling function for Keplr
await handleTransactionKeplrwithINJ();

} catch (error) {
console.error("Error handling transaction with Keplr:", error);
throw error;
}
}

#

@topaz seal I just need one help, how can we add memo in this so that it will automatically filled in user tx memo to be signed

#

in short along with msg, i wanna pass memo string too, so user if sign tx, memo also gets written on chain'

kind flare
#

createTransaction accepts memo

honest geyser
# kind flare `createTransaction` accepts `memo`

like we ned to add simply this line in tx raw?

const pubKey = Buffer.from(key.pubKey).toString("base64"); const { txRaw, signDoc } = createTransaction({ pubKey, chainId, fee: DEFAULT_STD_FEE, memo: "I am first memo bro", message: [msg], sequence: accountDetails.sequence, timeoutHeight: timeoutHeight.toNumber(), accountNumber: accountDetails.accountNumber, });

memo: "I am first memo bro",

#

lemme try, if it works, i am very very tyhankfull for this guidence

#

Thanks Bojan and Abel, for help

honest geyser
topaz seal
honest geyser
topaz seal
honest geyser
topaz seal
honest geyser
honest geyser
# topaz seal I am not sure how else to explain this but just mentioning that blocks can have ...

Thisisanexampleofalongstringoftextwithnointervalsorbreaksfulfillingtherequirementofbeingtwohundredcharacterslongitcontinueswithoutanyspacesmakingitdifficulttoreadbutmeetingthespecifiedcriteriaforlengthandformat123456789012345678901234567890
this is longest memo i was able to pass, its 230 characters long,. longer memo is signed by user wallet, but not dded in block and become failed tx.

so longest memo we can add is 230 chars, no matter how much fee we will to pay!

#

now not so good databse! hahahha, but still usable for small data storages

honest geyser
#

@topaz seal if we need to get out a tx info from chain, but we wanna filter, like from this sender to this receiver in this time range.

then what are options:
fetch all tx in time range then locally apply filter?
Or on chain we have ability tio filter tx?

cuase if we need to fetch all tx for an address then filter tx with other address, we might have to fetch 3k+ tx, how will we do that?

#

PS: its not a q on how to fetch tx or see in data received etc, i wanna know if filters exist in way that we can apply before fetching tx

topaz seal
honest geyser
topaz seal
rotund panther
#

I have one question can we send token from one wallet to another through python I mean using peggy I think we can only send inj in python sdk msgsnd @kind flare

#

I have read the doc but it is letting me only to send INJ tokens, whenever I try other token with peggy details it gives keyerror

topaz seal
#

Also, when creating the MsgSend using the composer, the parameter "denom" is the token symbol, not the token denom on chain

misty sparrow
#

Hey guys - does anyone have a list or reference to the contract addresses and their code for Helix and Mito?

gray trout
#

Hi, is it possible to execute two messages (for example two transfers) in the same transaction without writing a contract?

#

The idea is to have them be atomic, either both succeed or both fail.

topaz seal
jagged dagger
#

hey folks

#

Just wondering, is there any way to get token price ?

#

using @injectivelabs/sdk-ts package, but couldnt find any solution for that

topaz seal
# jagged dagger hey folks

If there is a market in Injective for the pair you want the price for, then you can just get the best bid/ask price from the orderbook, or the last traded price.
If not should get the price from an Oracle

jagged dagger
#

hm, can I get with Mito somehow ?

topaz seal
#

Not sure if Mito contracts have any public function to return the price. You should ask in the Mito Discord server

jagged dagger
#

hm , and for using Oracle, I checked the docs, there is a way to get all markets etc. , but I am trying to get for factory/inj1etz0laas6h7vemg3qtd67jpr6lh8v7xz7gfzqw/hdro, it's undefined, so can't get price

topaz seal
#

When using the oracle price endpoint from the Indexer, you need to specify the Oracle symbol for the token (it depends on the Oracle being queried). That symbol is, in general, different from the token denom in Injective chain

jagged dagger
jagged dagger
#

I took it from the injective explorer website

topaz seal
#

Let me check with the team. I have the feeling that the endpoint was not implemented with the idea of making it public. So initially I don't think we will add support for it in any of the SDKs. But I will confirm once I have more details

jagged dagger
#

ok, so the question still remains for me
with oracle I cant get price for this address
factory/inj1etz0laas6h7vemg3qtd67jpr6lh8v7xz7gfzqw/hdro

#

confused

#

also, from official endpoints couldn't find any endpoint to get price

topaz seal
#

Well, you should be able to use any Oracle that lists already that token. You will have to do your own research here.

topaz seal
jagged dagger
#

no

#

couldnt find

topaz seal
little ocean
#

I want to be able to get the price of a cw20 token on-chain. I came up with the attached code, but not sure if it’s the right way? Anyone please?

topaz seal
#

Why would you asume that the Band oracle has the CW20 token you are insterested in listed?

#

also in general Band oracle does not use token's denom as their symbol/name

little ocean
#

Honestly this is my first time dealing with such. I'm just looking for a solution where I can get the price of a cw20 token.

topaz seal
#

If you want to take the price from an oracle, then make sure you query with the correct token symbol. If you want to take the price from an Injective market, make sure the pair you are interested in does have a market in Injective, and then use the mid price endpoint to get the price from a node

little ocean
#

I know this might be too much to ask, but any docs or code sample I can look. I came up with the above code sample by poking around injective-cosmwasm sdk.

#

Please

paper lance
#

✋ maybe this is something that is answered many times but i am developing on latests macos M2 Pro. After cosmwasm/rust-optimizer:0.12.12 i deployed my wasm contract to testnet sucessfully but when checking the contract i get an error:

Error: error unmarshalling result: illegal base64 data at input byte 4```
all tests check out and i cant find any issues in my code using IntelliJ IDEA
#

Personally i think it has something to do with ARM64, should i optimise using cosmwasm/rust-optimizer-arm64:0.12.12 ?

#

hmm tried to verify another contract created by somebody else and ik get the same error:
injectived query tx 1E9104DB742E87A8C6B77072E04616446850CA0EFC8214ADFF22BC3B77FB14B2 --node=https://k8s.testnet.tm.injective.network:443

#

Looks to me like a bug, anyways im going to try to execute my contract

paper lance
#

my contract works perfectly but i cant explain the Error: error unmarshalling result: illegal base64 data at input byte 4 i get in my docker container:

-v=<directory_to_which_you_cloned_cw-template>/artifacts:/var/artifacts \
--entrypoint=sh public.ecr.aws/l9h3g6c6/injective-core:staging \
-c "tail -F anything"```
pastel pond
#

I couldn't find any tutorial for cw721. I think need to develop.

frosty kiln
#

@paper lance try compiling with this script

#!/bin/bash
ARCH=""

if [[ $(arch) = "arm64" ]]; then
  ARCH=-arm64
fi

for contract_dir in contracts/*; do
  docker run --rm -v "$(pwd)":/code -v "$HOME/.cargo/git":/usr/local/cargo/git \
    --mount type=volume,source="$(basename "$(pwd)")_cache",target=/target \
    --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
    cosmwasm/workspace-optimizer${ARCH}:0.15.0 "$contract_dir"
done
frosty kiln
pastel pond
#

Can you provide me an example of init msg please?

#

INIT='{"name":"InjectiveTestCoin","symbol":"ITC"}'
yes 12345678 | injectived tx wasm instantiate 9924 $INIT --label="Injective Test" --from=$(echo inj1kjuckfjkrv2f5fqvmd79ln8kn7chuqrqd8x8v4) --chain-id="injective-888" --yes --gas-prices=160000000inj --gas=20000000 --no-admin --node=https://testnet.sentry.tm.injective.network:443

#

Like these. or is it written true

paper lance
#

tried it with 0.15.0 compiler and rustc 1.79.0 (129f3b996 2024-06-10) but command still gives error:
injectived query tx 61E07C7CB7BE5CC6C2DDE71D1743B7B70DFB596839E6ED9F036B961EC6D33B13 --node=https://k8s.testnet.tm.injective.network:443
Contracts works flowless when sending commands to them tho so no block problem.

#

Also i use this to execute the injectived command:

-v=<directory_to_which_you_cloned_cw-template>/artifacts:/var/artifacts \
--entrypoint=sh public.ecr.aws/l9h3g6c6/injective-core:staging \
-c "tail -F anything" ```
maybe that version is too old?
pastel pond
# frosty kiln how do you compile the contract? seems to be related to newer Rust versions: htt...

It passed test but when ım compiled with RUSTFLAGS='-C link-arg=-s' cargo wasm cp ../../target/wasm32-unknown-unknown/release/cw721_base.wasm . ls -l cw721_base.wasm sha256sum cw721_base.wasm with these commands it gave hundred errors. There is no error with this code: docker run --rm -v "$(pwd)":/code \ --mount type=volume,source="$(basename "$(pwd)")_cache",target=/target \ --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ cosmwasm/optimizer:0.16.0 and here is the same issue: https://testnet.explorer.injective.network/transaction/497CB160E913C785C02F1B7710809D92BB686A271BEAF2B7E1675DEAE4CE4443/

paper lance
paper lance
#

where can i find docs on CW404?

novel siren
#

@frosty kiln The address on Keplr has changed even though I am still using the same access keys.

topaz seal
icy briar
#

Sorry for interrupt you. I wanna work in your team as a web full stack and blockchain developer.

lime ruin
paper lance
#

GM, hope you all are well. I have a question. i am making an contract but i get an execution error on testnet:

failed to execute message; message index: 0: Error parsing into type simple_token_agreement::msg::ExecuteMsg: Invalid type: execute wasm contract failed

i think i have upgraded my dependencies a little to high:

[dependencies]
cosmwasm-std = "2.0.4"
cosmwasm-storage = "1.5.2"
cw-storage-plus = "2.0.0"
cw2 = "2.0.0"
schemars = "0.8.21"
serde = { version = "1.0.203", default-features = false, features = ["derive"] }
thiserror = { version = "1.0.61" }
log = "0.4.21"

Also using cosmwasm/rust-optimizer-arm64:0.15.0

All my tests are green so i know code is how it should be.

paper lance
#

cosmwasm-std = "2.0.4" supported already?

paper lance
#

Nvm it works now 🔥 not sure what i changed but i think it has to do with serde snake_case not being used in executeMsg

paper lance
#

allright tracked down where the ExecuteMsg: Invalid type exception comes from:
if you declase id: u64, but in your json you send a "1" instead of 1 you get that error.

paper lance
#

Looks like i need some integration tests 😅

delicate flicker
#

I am a lead web3 frontend and blockchain engineer, i am looking for an opportunity to work with you.

true herald
#

I have one thing to need your help.
"Injective smart contract should be depolyed on Ubuntu. not windows."
this is right?

paper lance
#

@winged maple I am currently developing a contract that includes a roadmap with numerous features. Since implementing all these features at once is impractical, should I divide the project into smaller, separate contracts, or should I create a single contract and release new versions as I add more features?

pastel pond
#

Is it possible to mint NFT using the cw721-base contract or should I write a new contract myself?

#

Is there a tutorial for this?

woeful moon
#

my code for calculating the current market buy / sell price for a spot market is getting slightly different results from helix UI. this is what im doing:

  1. query all spot orders
  2. for a given base token amount, iterate through the orders and calculate the average price based on order quantity and price. for a market buy price this involves searching through the sell orders only until the quantity is satisfied.
  3. the price for each order is adjusted to add the taker fee rate

am I missing anything ?

woeful moon
#

I think its actually working ok

reef fiber
#

does anyone know why there are multiple markets with the same pair?
in /injective/exchange/v1beta1/spot/full_markets,
WMATIC/USDT appears twice, although seemingly with some differences in the details. The prices reported by both are different too.

frosty kiln
pastel pond
topaz seal
keen cloud
#

hi guys, having some issues deploying a node
followed the documentation, although I am using a custom folder, but shouldn't be the issue
getting
panic: validator set is empty after InitGenesis, please ensure at least one validator is initialized with a delegation greater than or equal to the DefaultPowerReduction ({824663675520})

and then exit

Any clues on what might be happening?

I am running:
injectived init "Node1" --chain-id ${NETWORK} --home=${APP_HOME} --default-denom=${DENOM}
wget https://github.com/InjectiveLabs/mainnet-config/blob/master/10001/app.toml -P ${APP_HOME}/config
wget https://github.com/InjectiveLabs/mainnet-config/blob/master/10001/genesis.json -P ${APP_HOME}/config

  exec injectived \
    --home=${APP_HOME} \
    start \
    --moniker=${MONIKER} \
    --rpc.laddr=tcp://0.0.0.0:26657 \
    --p2p.seeds="38c18461209694e1f667ff2c8636ba827cc01c86@176.9.143.252:11751,4f9025feca44211eddc26cd983372114947b2e85@176.9.140.49:11751,c98bb1b889ddb58b46e4ad3726c1382d37cd5609@65.109.51.80:11751,23d0eea9bb42316ff5ea2f8b4cd8475ef3f35209@65.109.36.70:11751,f9ae40fb4a37b63bea573cc0509b4a63baa1a37a@15.235.114.80:11751,7f3473ddab10322b63789acb4ac58647929111ba@15.235.13.116:11751,ade4d8bc8cbe014af6ebdf3cb7b1e9ad36f412c0@seeds.polkachu.com:14356,ebc272824924ea1a27ea3183dd0b9ba713494f83@injective-mainnet-seed.autostake.com:26726,1846e76e14913124a07e231586d487a0636c0296@tenderseed.ccvalidators.com:26007"
vale magnet
#

Hi devs. I'm trying to figure out the best way to derive injective addresses from stars addresses. I previously have used the python Bech32 library for stars => osmo addresses, but that is giving me incorrect results compared to the control group of addresses when i go from stars=>inj. Any help or pointing me in the right direction would be appreciated.

topaz seal
#

Maybe in the Discord server of chain that actually uses Solidity to code their contracts. That would be a good starting point.

topaz seal
#

@mortal kelp @lime ruin sorry for the interruption. Seems like we are having spammers again in this channel. Could you please ban them?

mortal kelp
#

Sure

valid zealot
#

GMGM

This is Baby from PancakSwap. The top 3 largest DEX in DeFi.

We are keen to connect with Injective team to explore collaboration possibilities (farming $INJ on BNB chain) and invite the Injective onboard PancakeSwap to tap into our world-class $2B liquidity and > 150k DAU.

Let us know your thoughts. 😉

valid zealot
#

thanks for pointing that out

valid zealot
hazy sand
#

I'm currently investigating how trading fees work on Helix and saw that market has maker and taker fees. For instance, INJ/USDT has -0.01% maker and 0.1% taker fees, but on Helix itself 0.2% fee is shown. How could it work even though 0.01% + 0.1% is 0.11% but not 0.2%

topaz seal
#

@lime ruin we have spammers again in the channel. Could you please ban them?

willow cedar
#

i’m currently trying to create a etf-like index token on injective using cosmwasm. I tried to get eth/usd price feed using pyth but i guess i need to update it every block with fee and it’ll be costy maybe at future. Does anyone know any idea to get price feed of a pair on cosmwasm ?

raven sandal
#

was the peggo v1.12.2 docker image at aws ecr removed? it still has v1.12.0 but running the release notes test command I get:
l9h3g6c6/peggo:v1.12.2 not found: manifest unknown: Requested image not found.

gusty orbit
#

Has anyone else had the problem with adding CA to Base denom, it saying already registered if you check but your token not showing up in this list even after 30 minutes ?

#

It's saying contract already setup, is this just a case of token factory not updating?

calm helm
#

Hey @topaz seal

I'm encountering an error while trying to create a binary options market using the Injective SDK. The error message I'm getting is:

TypeError: message.toBinary is not a function
at /Users/dennis/betting/node_modules/@injectivelabs/sdk-ts/src/core/modules/tx/utils/tx.ts:63:22
at Array.map (<anonymous>)
at createBody (/Users/dennis/betting/node_modules/@injectivelabs/sdk-ts/src/core/modules/tx/utils/tx.ts:61:30)
at createTransactionWithSigners (/Users/dennis/betting/node_modules/@injectivelabs/sdk-ts/src/core/modules/tx/tx.ts:61:26)
at createTransaction (/Users/dennis/betting/node_modules/@injectivelabs/sdk-ts/src/core/modules/tx/tx.ts:136:38)
at /Users/dennis/betting/createMarket.ts:93:49
at Generator.next (<anonymous>)
at fulfilled (/Users/dennis/betting/createMarket.ts:5:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5)

This is the relevant code snippet:

`// Message instantiation
const msg = MsgInstantBinaryOptionsMarketLaunch.fromJSON(msgParams);
console.log("Market message created:", msg);

.
.
.
try {
const msgProto = msg.toProto(); // Error occurs here
console.log("Message proto created:", msgProto);

const { signBytes, txRaw } = createTransaction({
  message: [msgProto] as unknown as Msgs[],
  fee,
  pubKey: publicKey,
  sequence: parseInt(baseAccount.sequence, 10),
  accountNumber: parseInt(baseAccount.account_number, 10),
  chainId: chainId,
});`
calm helm
#

it seems like MsgInstantBinaryOptionsMarketLaunch

does not have toBinary serialization support

indigo furnace
#

someone manage getting wallet-ts running with next.js? I get this problem when instantiating WalletStrategy:

TypeError: externals_1.BN is not a constructor

#

And if it is not an absolute must - I dont wanna switch to vite 😎 . Otherwise I need to do a complete frontend refactoring

willow notch
# calm helm Hey <@831364009877569538> I'm encountering an error while trying to create a b...

Which version are you using?

we have toBinary() added for the message
https://github.com/InjectiveLabs/injective-ts/blob/dfcb81a8c4968423372c018e843364827062dbbc/packages/sdk-ts/src/core/modules/exchange/msgs/MsgInstantBinaryOptionsMarketLaunch.ts#L138-L142

try using these version:

@injectivelabs/exceptions: 1.14.14-beta.0
@injectivelabs/networks: 1.14.14-beta.0
@injectivelabs/test-utils: 1.14.14-beta.0
@injectivelabs/ts-types: 1.14.14-beta.0
@injectivelabs/utils: 1.14.14-beta.0
@injectivelabs/sdk-ts: 1.14.14-beta.1
@injectivelabs/wallet-ts: 1.14.14-beta.2
GitHub

Collection of TypeScript packages that consume and interact with the Injective Chain - InjectiveLabs/injective-ts

rotund panther
#

Hello I need to get peggy token holder info in explorer it shows very limited info is there any api that can get me that info please @topaz seal @brave quail

grizzled nebula
misty maple
misty maple
#

😅

misty maple
topaz seal
#

I am sorry you have to go around like that. But let's be honest: it is a question about the process to start receiving trading incentives. What does that have to do with developers at all?

misty maple
topaz seal
lime ruin
#

Hmm, thought the question might better fit here since Maitre was using Python SDK for it, mb if it's not the right place though.

misty maple
#

No problem, mistake can happens !

#

Thank you

topaz seal
#

@misty maple yes, that is the screep you need to run. Make sure you run it in your own environment, since you need to put there your private key

misty maple
#

Thankyou 😉

#

This is a scam ? I think

#

(After i delete my chat from here)

lime ruin
lime ruin
# misty maple

ANYONE who sends you DMs is very likely a scammer, please block them.

misty maple
#

Thats what I thought yeah

#

Thx, we can sup my chat here if its not appropriate in this channel now, have a great day

topaz seal
#

We can leave it here now, just for future reference

woeful moon
#

pagination on the fetchBinaryOptionsMarkets typescript might be broken. it returns next: [] when querying all demolished markets on testnet. I cant figure out how to get next page

#

there is 17052 total

woeful moon
#

also, could anyone explain how the "Frontrunner" oracle type works ?. edit - ok from breif research Frontrunner is a third party oracle

woeful moon
#

can change between mainnet and testnet top right

woeful moon
#

gm, found this is in the docs The market may be optionally configured with a market admin which has the ability to trigger settlement, change the market status as well as modify the expiration and settlement timestamp of the given market

How do I exercise my ability as the market admin to change attributes and reach settlement? I cannot find any such messages in the docs

topaz seal
woeful moon
#

ok. im talking about binary option markets, which is a type of derivative market I guess. Is there a way for a binary option market admin to trigger settlement on testnet ?

topaz seal
woeful moon
#

did you have a chance to look if pagination on fetchBinaryOptionsMarkets in the TS API needs fixing ?

woeful moon
# topaz seal <@228167691825840129>

it returns next: [] when querying all demolished markets on testnet. I cant figure out how to get next page. there is 17052 total let me know if you need code snipit

woeful moon
#

is chainGrpcGovApi.fetchProposalVotes supposed to work ? returns no votes for all proposals

#

is this the best place to report bugs?

light wave
#

Hi guys. I am using this exmaple: https://docs.ts.injective.network/transactions/transactions-cosmos and trying to store code on chain but My transaction fails. https://testnet.explorer.injective.network/transaction/41903B838B037A55E4179F777FEA1C79260DC7B024F814C550E785F3EBC33BE9/
I changed the MsgSend.fromJSON to MsgStoreCode.fromJSON
I built my contract by using this example https://docs.injective.network/develop/guides/injective-101/your-first-contract#building-the-contract

This example illustrates the structure of a basic smart contract. The counter website allows you to interact with an instance of the smart contract on the Injective testnet. If you have prior CosmWasm smart contract experience, feel free to skip this section.

willow notch
# woeful moon did you have a chance to look if pagination on fetchBinaryOptionsMarkets in the ...

There are 2 different sources fetching binaryOptionsMarket, the one on TS supports fetching it from the indexer where the pagination options param looks like this:

fetchBinaryOptionsMarkets({
  marketStatus?: string,
  quoteDenom?: string,
  {
    key?: string
    offset?: number
    skip?: number
    limit?: number
    reverse?: boolean
    countTotal?: boolean
    endTime?: number
    startTime?: number
    fromNumber?: number
    toNumber?: number
  }
})
woeful moon
willow notch
#

try passing this:

fetchBinaryOptionsMarkets({
  marketStatus?: string,
  quoteDenom?: string,
  {
    limit: 20
  }
})
woeful moon
willow notch
woeful moon
#

But I noticed the votes are not loading on the hub either

willow notch
#

votes are removed once the proposal passes voting period

woeful moon
#

ok makes sense.
still stuck on this binary option markets pagination

willow notch
#

which env are you testing against?

#

i will take a deeper look

woeful moon
#

i am trying both mainnet and testnet

willow notch
#

from the sceenshot its testnet?

lavish estuary
woeful moon
#

tesnet not responding

lavish estuary
#

First trial was after it was passed as well.

willow notch
lavish estuary
willow notch
woeful moon
topaz seal
#

The best place to report bugs is always the SDKs repositories in GitHub

#

Comments here are always welcomed, since they help us know there is a new bug to investigate. But the details should be in the GitHub issue report (it is difficult to find details here as the chat progresses)

lavish estuary
# lavish estuary I did actually, but I'm not with my laptop rn but in the next hr.

Hey 👋 @willow notch,

I was able to get through this part and started fetching 100 values at a time. I later found out that the issue was caused by pagination. I handled it, and it started fetching data 100 by 100. However, during the fourth call, I received this error:

2024/07/08 15:48:26 Raw response body: {"code":3,"message":"illegal base64 data at input byte 22","details":[]}
2024/07/08 15:48:26 Fetched 0 votes, nextKey:
Spreadsheet saved as votes.xlsx

The number of voters is expected to be more than 300.

misty maple
#

Hi guys !
How can I fund my injective testnet wallet ?

topaz seal
#

!faucets

wild frigateBOT
woeful moon
#

getting some funny behavior when querying old block heights on
https://sentry.lcd.injective.network/cosmos/gov/v1/proposals/412/votes
im using block 76860000 in the headers 'x-cosmos-block-height': 76860000
for some reason the first few requests result in an error
failed to load state at height 76860000; version mismatch on immutable IAVL tree; version does not exist. Version has either been pruned, or is for a future block height (latest height: 77226477): invalid request
but then I just try a few more times and then it works?
but then it makes it hard to get all pages because half of the requests fail.

woeful moon
#

I was able to get a full list by implementing retry logic but sometimes a request would fail 10+ times before resolving

woeful moon
light wave
# willow notch transaction not found :/

hmm weird I can see the transaction. Could you check the transaction again?
error log is "failed to execute message; message index: 0: Error calling the VM: Error during static Wasm validation: Wasm bytecode could not be deserialized. Deserialization error: "magic header not detected: bad magic number (at offset 0x0)": create wasm contract failed" btw

hazy sand
#

Hey guys, how can I fetch contract state? Not from exposed queries.

topaz seal
hexed dock
#

Is there a problem on the API right now ?

light wave
#

does MsgBroadCaster in injective/sdk-ts has transaction simulate method? I know that it has simulateTx boolean which simulates before broadcasting transaction but I only want to use simulate function. And I don't want to use MsgBroadcasterWithPK

light wave
pearl yarrow
#

hello, fams

#

im an AI dev, is there any chance to work with you?

wide bridge
#

Hello team, I have a question about this error "Orderbook liquidity cannot satisfy current worst price". It occurs when I send a CreateDerivativeMarketOrder message to Injective testnet (Injective-888) via an execute function of my CW contract.
I use mark price (let mark_price = querier.query_derivative_market(&market_id)?.market.unwrap().mark_price;) to fill the price field of OrderInfo in DerivativeOrder.
Where did that error come from? If it's not because I coded wrongly, maybe it's because there is no trading liquidity on the injective testnet for that perpetual market? Additionally, the market I tested is INJ-USDT PERP.
Thank you so much for clarifying my question. ❤️

topaz seal
wide bridge
#

I have tried using from mark price, mid price, tob,... to the manually entered price, but both get the above error.

#

Could you explain to me about this error? What is "worst price"? Thank you very much

topaz seal
#

Worst price is the price you configure in the OrderInfo. It is the worst price you accept the exchange to use to find a match counterparty order

wide bridge
#

@topaz seal So could you teach me how to properly pass the price field in OrderInfo to ensure my orders are matched?

topaz seal
#

Just put the worst price you are willing to pay/receive (depending the order direction)

wide bridge
#

I have tried doing that, I have tried pass many values around 10% above and below of the mark price but they all get the same error.

topaz seal
#

Take the best bid/best ask price (depending the order direction) and add/subtract (depending on the order direction) 30%

#

But the worst prices should be configured by you. I am not sure what would be a good price for you

#

Is kind of asking me were should you invest your money: I can't answer that for you

wide bridge
topaz seal
#

I am not seeing a live INJ/USDT PERP market in testnet

#

At least not in the Helixapp in testnet

wide bridge
#

I use injective deamon to get info about this market

#

This is my command: injectived q exchange derivative-market 0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6 --chain-id injective-888 --node $INJ_TESTNET_RPC

#

0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6 is the market id of INJ/USDT PERP

topaz seal
#

Ignore my previous comment: I see the status for the market is "Active"

hazy sand
#

Hey @topaz seal !
I fetched all markets of Injective with all orders to represent Helix swaps. However, Helix has quite a bit markets and pairs, but there are a lot more orders and markets. Does Helix has a list of active markets to swap on?

topaz seal
light wave
lime ruin
#

Gm, if you're unable to access the #🚀・dev-support and other developer related channels then please connect your GitHub to your Discord account and take the Developer role from the available linked roles.

How do I connect my GitHub to Discord?

  1. Go to Discord settings → Connections tab.
  2. Click the View more icon ( > ) and select GitHub.
  3. Review the connection and allow to successfully connect your GitHub to your Discord.

How do I get the Developer role from the linked roles?
If you've done the previous and connected your GitHub then:

  1. Click on the server name on top left to open the server drop down menu.
  2. Click on Linked roles and select Developer.
  3. Then follow the procedure it prompt you to do and you'll get the role in just few clicks.
  4. Alternatively, you can also get it by clicking the Developer tag beside my name.
    Click here for a more detailed guide.
woeful moon
#

I have a question about Binary option markets and oracle providers.
I see that it is mandatory to have an oracle when creating a BOM (binary optons market)
what if you simply want to create a market where the admin decides the settlement price and an oracle is not needed ?
Alternatively, is there a placeholder oracle we can use? Or is the correct / only approach to build an oracle that can post price updates for the market to reach settlement ?

woeful moon
topaz seal
#

The exchange module will always need a prive not coming from the binary option market itself to calculate the settlement related actions. And since it is a price not coming from the market itself, it is then required an oracle to provide it. That is the only option

wide bridge
#

Injective team, I see the Injective-888 testnet is down, are you doing chain halt to upgrade the chain? Thanks for answering

woeful moon
#

is there any way to find the closest block height to a given timestamp, apart from querying individual blocks to check their timestamp

hazy sand
#

Hey guys! What do "limit_cumulative_quantity" and "limit_cumulative_notional" mean in "query_spot_market_orderbook" in InjectiveQuerier package? I'm trying to represent swap contract logic and I'm stuck on estimating buy execution. I don't understand how to filter all orders in the same way swap contract does because I rewrote all logic and mathematics and my average price is too high.

topaz seal
misty maple
#

@topaz seal
I have a question about hummingbot connector that you have built,
We would like to use RockX node to connect and when we choose custom_network on hummingbot LCI client, it's asking for :

Enter the network lcd_endpoint
Enter the network tm_websocket_endpoint
Enter the network grpc_endpoint
Enter the network grpc_exchange_endpoint
Enter the network grpc_explorer_endpoint
Enter the network chain_stream_endpoint
Enter the network chain_id
Enter the network environment name

RockX is only giving us API key, Rest API, and GRPC Api, is it enough to complete those questions ? Here is some documentation about custom_network connection ?
Thank you !

topaz seal
#

hello @misty maple. I don't know RockX at all, but from what you mention, they are providing an API wrapping the Injective nodes they might be running. But the connector I created is designed to be used directly with an Injective node. If you want to use RockX thorugh their API, you will need a connector designed for that.
One other alternative (I am not sure if it is possible) would be to ask RockX to provide access to the node they are running for you (supossing they run a separate node for each user requesting an API key, which I doubt)

#

I have added some details about the custom network connection in the Injective connector documentation in Hummingbot docs page. You can find more details about each of the endpoints required in the Injective nodes documentation

misty maple
misty maple
topaz seal
#

I don't see the custom details in the docs, may be the page was modified. In any case the parameters are not difficult to understand. You can ask questions here if you have doubts

wide bridge
#

I have a question, does the Injective core team plan to develop a native lending module (like umee chain) to support lending/CDP projects in the future? Thank you team for sharing

light wave
#

Hello I have a question about eth based wallet signing it is metioned that on injectifve you can process signing transaction using ethereum wallet. And the process says that 'packing the transaction into a native cosmos transactoin' does it mean user must have two wallets? like you need metamask and keplr at the same time or just the metamask

topaz seal
misty maple
topaz seal
#

They are all for different types of requests
One is for the node gRPC messages, one for the Indexer gRPC messages, one for the chain stream in the node, one for REST queries to the node, etc

lusty night
#

Hey is there any working faucet? Trying to get some native tokens on testnet for testing. Or would appreciate it if someone could send some inj1cjv6vz3jhltgysalnfvc4p07kw0nx98mh6gsd2 🙏

sharp cradle
#

I tried requesting to your address too

So you should get some soon

lusty night
lyric falcon
#

I created a token on tokenstation.app. How can I transfer it to another IBC chain, such as Terra?

#

or Osmosis

tough karma
#

Hey all,

I am struggling with something very simple and hopefuly you'll be able to assist here:
Creating a simple Injective transaction from 1 account to another.
I use the injective ts-sdk to the transaction. My signer is a remote signer that I execute the request to via API.
The signature response I get is:
r: hex string
s: hex string
v: number (0 or 1)

In addition, I am getting the compressed public key from the same API in hex format. If I try to derive the address from this pubkey I am getting exactly the same one as my INJ wallet.

The problem is when I submit the transaction to the network I get:
pubKey does not match signer address <my_address> with signer index: 0: invalid pubkey

When buidling the tx I set the pubkey in base64.
The attached signature is Buffer from r & s values.

The documentation is not very helpful and I basically did the same as the PrivateKey.sign method of the sdk

tough karma
tough karma
bitter hinge
hexed dock
#

Is there a problem checking the orderbook throught the API ? I often get the error “list index out of range”

#

But sometimes, without changing the code, I get the datas I need

topaz seal
#

There is no reported issue that I am aware @hexed dock . If you are using a private node you should check if it is syncing correctly. If you are using the public servers, they are usually under heavy load and you could easily experience connectivity issues

lyric falcon
hexed dock
#

Thanks @topaz seal

bitter hinge
topaz seal
# tough karma Anyone?

I don't think I understood your scenario clearly. But I do know that TS SDK documentation includes working examples on how to transfer tokens from one account to the other

bitter hinge
#

I also recommend to set the same private key on the remote signer and use the same key in the injetive-ts sdk. Next, sign identical data and check signature

tough karma
astral kiln
#

I can't access the grpc node using the ts SDK since today's upgrade. Calling ChainGrpcBankApi.fetchBalance returns GrpcUnaryRequestException error. This happens with my own node and with any public nodes as well.

topaz seal
astral kiln
#

@injectivelabs/sdk-ts@1.14.13

topaz seal
astral kiln
unreal crown
#

Hello, is there an issue with ledger signing on frontends? not able to sign on coinhall and dojoswap. Also is it possible to readd the InjectiveStargate client to the injective-ts package

feral wyvern
#

Hello, Frontend from Neptune Finance. Since the chain upgrade, our app has been throwing this error as a response from the broadcaster on every transaction attempt on production and on local dev env:

The request has failed. The server has closed the connection without sending any headers.

Access to fetch has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

POST 502 (Bad Gateway)

woeful moon
#

also getting 502

#

using next tag

lavish pond
#

@woeful moon
using rest api endpoint inplace of grpc web will fix this issue

severe patio
#

@lavish pond @feral wyvern grpc-web should be fixed now, lmk if you have same issues ^

#

Just tested, works

woeful moon
#

Looking good now

feral wyvern
#

Can confirm, it is working well now

hexed dock
#

Is it possible to use the API with a Ledger ? Cause we don't have private key with a ledger

topaz seal
honest geyser
#

is it possible? i seen through the docs, not found this thing

#

found balance fetchs, etc, but not the way to fetch tx with two input addresses

#

i need to fetch tx involving both and reterive their memos from chain.

I am using this to map from a single address, but not from one sender all senders to that address.
I want to specify second address too.

topaz seal
honest geyser
#

I need for explorer type of dapp

topaz seal
lime mountain
honest geyser
#

Right

daring apex
#

Hi, is there anywhere I can go to, to learn how to query smart contracts, in particular a contract's tx history?

bitter hinge
woeful moon
#

is it possible to use the python sdk to create market orders for permisionless markets ? I get a key error
market = self.spot_markets[market_id]
KeyError: '0xc6b6d6627aeed8b9c29810163bed47d25c695d51a2aa8599fc5e39b2d88ef934'

woeful moon
#

I manually added the market
now when I try simulate a market buy

            market_id=market_id,
            sender=self.address.to_acc_bech32(),
            subaccount_id=self.acc_id,
            fee_recipient=self.fee_recipient,
            price=Decimal(0.000000402),
            quantity=Decimal(10000),
            order_type="BUY",
        )```
`details = "math/big: cannot unmarshal "402000000000.000025037199766" into a *big.Int: tx parse error `
for some reason there is a decimal left over, even though `402000000000` is correct
chrome grove
#

Namely if its possible to derive the open interest in USDT terms from the cumulativeFunding and cumulativePrice values?

Or some other way to derive the open interest values?

woeful moon
#

I am unable to create spot orders for permissionless helix markets in the latest python SDK

#

even after adding the spot market to composer.spot_markets, it still does not construct the msg properly

woeful moon
#

managed to get it working. but need to construct the message myself. the composer gets the decimals wrong

topaz seal
topaz seal
clever kayak
#

Hey question to devs here 😄
testnet.sentry.lcd.injective.network/cosmos/tx/v1beta1/txs?events=transfer.recipient%3D%27inj1v2xyk5ekyy0534cuf0djfrfagj8xzdt5d0n5p3%27&pagination.reverse=true&order_by=2
I'm trying to get this info about specified address trx from testnet, in last week it have been working, today it show "query cannot be empty" error. Can someone tell me what I screwed up here?

clever kayak
# topaz seal You can find the list of endpoints in the swagger page https://testnet.lcd.injec...

Thanks for info, i have been checking that. But in last week such request have been working correctly, right now It's not visible in swagger. I have been testing similar request on other networks as well and they are working fine. I'm mostly looking for info have it been disabled purposefully or is it some kind of issue. If it have been disabled then I need to find some new source of info.

sly vortex
#

Hi everybody - Thanks @lime ruin !

#

I'm keen to speak to somebody who cares about testing and finding bugs in the core Injective codebase. I'm not interested in bug bounties.

topaz seal
#

All devs are interested in bugs being found and fixed

sly vortex
#

I work for a startup which has a way in which we can simulate distributed systems, and stress them to the point of failure, with 100% reproduction. We're finding that Ethereum, Ava Labs, Mysten etc are finding this very useful for their engineers

#

Worth discussing Injective?

topaz seal
sly vortex
#

Fill in the form?

topaz seal
#

yes, correct

sly vortex
noble epoch
#

Hello,
I am from Andromeda team and I need injective team's help for cosmwasm smart contract building

lime ruin
noble epoch
#

So here I can not use InjectiveQueryWrapper as CustomQuery of DepsMut.

#

How to solve this problem...

#

I would appreciate your help.

topaz seal
#

@frosty kiln

noble epoch
#

Hello @frosty kiln
Can you help me for the problem I raised?

rancid thicket
#

hi would like to check is there API or script to check the exact on-chain timestamp of a validator/delegator earning staking rewards?
i checked on mintscan explorer and also Injective official API docs, only can query accrued rewards

woeful moon
#

Does anyone know how to get the lp denom address for a mito vault ?

topaz seal
#

You might find an answer for your question if you post it in the Mito Discord Server

topaz seal
#

You should not expect the command to succeed if you point to incorrect endpoints. Please check Injective docs page to get the list of correct endpoints

#

I assume you mean you got that endpoint from a doc example script. Please check the official endpoints doc page and addapt the example script accordingly (example scripts are supposed to be taken as examples, not as code that should be executed after just copying/pasting)

zealous stream
#

Hi guys, I am trying to use MetaMask to Sign EIP712TypedData with using injective-sdk-ts. MsgSend was fine but MsgStoreCode doesn't work. I used getEIP712TypedData. Which Stops the whole React app.
So Alternatively I used getEIP712TypedDataV2 and it worked fine but when I sign the data on MetaMask.
MetaMask emits the error "please verify account number (740687) and chain-id (injective-888):UnAuthorized". Can Somebody could help me with this problem? (I used injective-sdk-ts doc's transaction/ethereum example)

half furnace
#

Hello, I'm using StartGate client to connect to Injective (latest version 0.32.4) and receiving a lot of "Bad status on response 403" errors durinng connection. Sometime it's necessary to try it 10x times to be able to connect properly. Is this know issue?

I'm using cosmos.directory RPC as same as official RPC but with the same results

willow notch
woeful moon
#

Is there mito dev overlap here ? My vault is not updating orders on price change

willow notch
# willow notch Hey <@1247000934895194183> can you share the payload you're sending? we're want ...

@zealous stream wrote a script to test, managed to upload the contract via the sdk-ts function. To help you better i need more context

<script lang="ts" setup>
import {
  PrivateKey,
  MsgStoreCode,
  MsgBroadcasterWithPk
} from '@injectivelabs/sdk-ts'
import { Network } from '@injectivelabs/networks'

const privateKeyHash = 'yourPrivateKeyGoesHere'
const privateKey = PrivateKey.fromHex(privateKeyHash)
const injectiveAddress = privateKey.toBech32()

async function handleFileUpload(event: InputEvent) {
  const target = event.target as HTMLInputElement

  if (!target.files) {
    return
  }

  const buffer = await target.files[0].arrayBuffer()
  const bytes = new Uint8Array(buffer)

  const msgStore = MsgStoreCode.fromJSON({
    wasmBytes: bytes,
    sender: injectiveAddress
  })

  const txHash = await new MsgBroadcasterWithPk({
    privateKey: privateKeyHash,
    network: Network.Devnet
  }).broadcast({
    msgs: msgStore,
    gas: {
      gas: 100000000000000
    }
  })
  console.log(`Transaction hash: ${txHash}`)
}
</script>

<template>
  <div>
    <input type="file" @change="handleFileUpload" />
  </div>
</template>

zealous stream
west shuttle
#

hi all! I'm building a trading bot to trade on helix but I get a lot of 503 errors on my grpc requests as well as in the chain-stream channel. Is there any way to whitelist my IP address or know how long I'm banned for? I'm using the official endpoints

#
2024-08-22 14:17:07,855 - 15 - hummingbot.connector.exchange.injective_v2.data_sources.injective_grantee_data_source.InjectiveGranteeDataSource - WARNING - Error while listening to chain stream (<AioRpcError of RPC that terminated with:
    status = StatusCode.UNAVAILABLE
    details = "Received http2 header with status: 503"
    debug_error_string = "UNKNOWN:Error received from peer  {created_time:"2024-08-22T14:17:07.78746198+00:00", grpc_status:14, grpc_message:"Received http2 header with status: 503"}"
>)
topaz seal
willow notch
zealous stream
zinc geode
#

i am doing some IBC transactions via a smart contract and they seem to be stuck in the relayer.

is there a way i can figure out why they are stuck?

on the mintscan realyers page it shows 4 pending transactions on the injective side

#

they have been stuck for about 40 minutes

zinc geode
#

txs are still stuck, it's been 3 hours

#

this is the one from about 3 hours ago 2B1CFB43D8AC6836F30A56EEB306C33C882C28481CEE79D61B584DE0CD3351DB this is a msg that should trigger an ibc transaction that replies with a random number from secret network.

#

it's worked earlier today, it took about 9.5 minutes then i upped the gas fee and it went through in 90 seconds, then i tried some more times and it has been 3 hours

zinc geode
#

is it possible to do a multi-message tx on the command line? i know how to create multiple execute messages on a FE and put them in one tx, but on cli i am not sure how to do it on a command line. i tried just putting the messages in a json array and that did not work

topaz seal
misty maple
#

Hi ! What is the command to get the differents endpoint of a local node ?

#

Like that

topaz seal
old swan
#

Hi Injective team, can I request transactions with certain event with: tm.injective.network/tx_search?query=&prove=&page=&per_page=&order_by=_

#

I want to get transactions that send token to my address in certain height.

#

Thanks.

little mesa
#

Where to report for IBC relayer?!

zealous stream
#

Has Anyone used cw-injective/atomic-order-example? I am trying to execute the contract on testnet but somehow getting that my funds are insufficient.
I am sending 21USDT as fund. 0.000000000020449 as price and 10000000000000000 as quantity. I have queried the order book using indexer and checked out on the helixapp(testnet) for the worst price.
My wallet Address is inj16j4rzjtsmp8vkk5074lrrctx574xtxwkekf55r
Grpc Message:

failed to execute message; message index: 0: dispatch: submessages: reply: dispatch: submessages: spendable balance 558742peggy0x87aB3B4C8661e07D6372361211B96ed4Dc36B1B5 is smaller than 558743peggy0x87aB3B4C8661e07D6372361211B96ed4Dc36B1B5: insufficient funds [!injective!labs/cosmos-sdk@v0.50.9-inj-2/x/bank/keeper/send.go:275] With gas wanted: '50000000' and gas used: '499731'
tardy spindle
#

devs. i have a question. I want to start in Smart Contract programming

#

What i need to do?

devout wharf
lavish estuary
topaz seal
#

@lime ruin @mortal kelp could you help us banning this spammer?

lime ruin
#

sure

topaz seal
#

Wow, that was fast. Much appreciated!

buoyant jewel
#

Happy devs day guys
You guys are the powerhouse of Injective
Love you all

buoyant jewel
devout wharf
#

programming day lol

#

when pi day?

buoyant jewel
lime ruin
#

Btw did you manage to do it already?

devout wharf
#

@lime ruin you can check on my discord how many holders i have

lime ruin
#

Getting all the holders for that token.

devout wharf
lime ruin
#

Oh

#

Querying the contract?

devout wharf
#

i can all the CW20 tokens holders

devout wharf
devout wharf
lime ruin
#

well sounds a lot

devout wharf
devout wharf
#

i dont know what to do

lime ruin
#

lol

buoyant jewel
buoyant jewel
devout wharf
#

for knight role?

devout wharf
lime ruin
#

Yeah it's cool.

devout wharf
lime ruin
#

Found it at someone's profile I think

devout wharf
#

why grade C?

lime ruin
#

Haven't been really active for like a year lol

devout wharf
lime ruin
#

the hackathon ones?

devout wharf
devout wharf
lime ruin
#

else would just continue all day

devout wharf
lime ruin
#

true

devout wharf
lime ruin
#

you were there back then?

devout wharf
#

Did stupid things, so use back up discord

lime ruin
#

oh

#

so came back with new account?

#

lol

#

yeah i expected that

devout wharf
lime ruin
#

have you tried cursor

#

editor

devout wharf
lime ruin
#

yeah that one

devout wharf
#

not yet is that nice

#

Some of my friends say its help a lot

lime ruin
#

well for auto complete does feels to help

#

i just don't like it messing with the keybinds

devout wharf
#

that help me with cleaning the code

lime ruin
#

formatting?

#

or

devout wharf
lime ruin
#

well cursor is basically

lavish estuary
#

Good day fam

lime ruin
#

vs code

#

with ai integrated

#

good day trynax

lavish estuary
#

Anyone here that's quite familiar with Injective go-sdk?

devout wharf
lavish estuary
lime ruin
lime ruin
#

i can't imagine asking a question on stack overflow

#

without being asked to fix the question a million times

devout wharf
lavish estuary
lavish estuary
lime ruin
#
export const chainGrpcWasmApi = new ChainGrpcWasmApi(ENDPOINTS.grpc);

(async () => {
  const response = await chainGrpcWasmApi.fetchSmartContractState({
    contractAddress: "inj1c6lxety9hqn9q4khwqvjcfa24c2qeqvvfsg4fm", // The address of the contract
  });
  console.log(response);
})();

Is this wrong way to fetch the state, or are you also supposed to query something.

devout wharf
lime ruin
#

oh, i used to use python mostly

#

but then switched to js

#

as i started learning frontend

devout wharf
#

what give? the log?

lime ruin
#

just gives an error

#
TypeError [ERR_INVALID_ARG_TYPE]: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received an instance of Object
#

maybe just passed it wrong arguments

devout wharf
#

contract_history = await client.fetch_all_contracts_state(address=address, pagination=pagination) this was my python code

#

fetchSmartContractState

#

is there no other function/class

lime ruin
#

ah got it

#

(async () => {
  const response = await chainGrpcWasmApi.fetchSmartContractState(
    "inj1c6lxety9hqn9q4khwqvjcfa24c2qeqvvfsg4fm"
  );
  console.log(response);
})();
#

this is how you're supposed to do it

#

it requires the first argument as the contract address

lime ruin
#

wrapping it in the object makes it think that the object is the contract address

lime ruin
#

apparently query is also required

#

ugh

devout wharf
#

all the data and stuff always for backend

#

thats what people told me

lime ruin
#

uh like setup a backend and fetch data there then setup an api and use that api to request data for frontend?

lime ruin
#

Frontend → Sends request to backend → Backend will do the work for you → Returns the data to frontend?

#

well maybe yeah that's probably more efficient but

#

just putting it in frontend feels easier

#

lol

devout wharf
#

true true

lime ruin
#

i mean you'll still need to request from the frontend

devout wharf
#

i didnt know about pagination

lime ruin
#

oh yeah, it doesn't returns all the data at once

devout wharf
devout wharf
#

so i thought wtf

#

why my wallet not inside

lime ruin
#

considering you wanna to something which you can't do on frontend

devout wharf
lime ruin
#

else just put the stuff on frontend

#

all at one place

devout wharf
#

its also not safe

lime ruin
#

oh, for authentication keys?

#

or

devout wharf
#

i wanna also say walletadresses but u need to request it ofc

lime ruin
#

you need to query all_accounts for the holders right?

devout wharf
#

show me lahn

#

how much

lime ruin
#

lemme try

#

the query also needs to be converted to base64 it seems

devout wharf
#

balanceinj.....

lime ruin
#

skull

devout wharf
#

i dont understand why balanceinj...

#

it give me mindfuck

lime ruin
#

balanceinj?

devout wharf
#

and more ...balanceinj1c6lxety9hqn9q4khwqvjcfa24c2qeqvvfsg4fm you get that

#

from base 64

lime ruin
#

  data: Uint8Array(464) [
    123,  34,  97,  99,  99, 111, 117, 110, 116, 115,  34,  58,
     91,  34, 105, 110, 106,  49,  48,  54,  57, 106, 117, 119,
    110,  50,  48, 106,  97, 107,  51, 110,  97, 116,  48, 101,
    115,  54, 121, 122, 117, 102, 114, 121,  99,  50, 103, 119,
    101,  56, 109, 116, 109, 118, 116, 119,  34,  44,  34, 105,
    110, 106,  49,  48,  99, 103, 113,  48, 113, 102,  57, 110,
     52,  56, 120,  56, 122, 117, 102, 114, 104, 101,  48, 117,
     99,  97, 115, 104, 120,  54, 107,  55, 102, 108, 102, 113,
    103,  97, 112,  97,
    ... 364 more items
  ]
}
#

it gave me this

#

the hell

devout wharf
#

wtf

lime ruin
#

well this was without converting to base64

lime ruin
#

and it doesn't works when you convert it to base64

devout wharf
#

its uint8array

#

wtf why

lime ruin
#

ah not that

#

this is what docs say

#

that you gotta convert the query to base64

#

you didn't do that?

devout wharf
#

ohw i see

devout wharf
devout wharf
#

why get count?

lime ruin
#

wdym

#

not getting count

#
import { ChainGrpcWasmApi } from "@injectivelabs/sdk-ts";
import { Network, getNetworkEndpoints } from "@injectivelabs/networks";

export const NETWORK = Network.MainnetSentry;
export const ENDPOINTS = getNetworkEndpoints(NETWORK);

export const chainGrpcWasmApi = new ChainGrpcWasmApi(ENDPOINTS.grpc);

(async () => {
  const response = await chainGrpcWasmApi.fetchSmartContractState(
    "inj1c6lxety9hqn9q4khwqvjcfa24c2qeqvvfsg4fm",
    { all_accounts: {} }
  );
  //   console.log(new TextDecoder().decode(response));
  console.log(response);
})();
#

code rn

devout wharf
devout wharf
lime ruin
#

yea

#

and trying to decode it gives error

devout wharf
lime ruin
#

nah

devout wharf
#

show code

devout wharf
#

with decoder

devout wharf
#

ohw lol

#

i see

#

new TextDecoder().decoder.decode(response)?

#

you want convert uint8array to string i guess

lime ruin
#
node:internal/encoding:449
        return decodeUTF8(input, this[kIgnoreBOM], this[kFatal]);
               ^

TypeError: The "list" argument must be an instance of SharedArrayBuffer, ArrayBuffer or ArrayBufferView.
    at TextDecoder.decode (node:internal/encoding:449:16)
    at file:///d:/kurisu/test.js:14:42
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_INVALID_ARG_TYPE'
}
devout wharf
lime ruin
#

just that unit8array

devout wharf
devout wharf
#

lol

lime ruin
#

Ggs

devout wharf
#

GG

lime ruin
#
import { ChainGrpcWasmApi, fromBase64, toBase64 } from "@injectivelabs/sdk-ts";
import { Network, getNetworkEndpoints } from "@injectivelabs/networks";

export const NETWORK = Network.MainnetSentry;
export const ENDPOINTS = getNetworkEndpoints(NETWORK);

export const chainGrpcWasmApi = new ChainGrpcWasmApi(ENDPOINTS.grpc);

(async () => {
  const response = await chainGrpcWasmApi.fetchSmartContractState(
    "inj1c6lxety9hqn9q4khwqvjcfa24c2qeqvvfsg4fm",
    toBase64({ all_accounts: {} })
  );
  console.log(fromBase64(response.data));
})();
#

works

#

this

devout wharf
#

ohw really

lime ruin
#

you gotta decode from base64

#

not unit8array

devout wharf
#

but that doesnt make sense

lime ruin
#

it just gives 10 addresses though

devout wharf
lime ruin
devout wharf
lime ruin
devout wharf
#

wtf

devout wharf
#

max 100

#

console.log(new TextDecoder('utf-8').decode(response)); <-- works this also?

lime ruin
devout wharf
#

just curious

devout wharf
#

you know what its quite funny

#

it is in order HAHAHAHA

devout wharf
#

i thought so we can decode but to where lol

#

but @lime ruin i wanna all the wallet holder

lime ruin
#

hmm so now if you want rest of the addresses

#

do you need to do another

devout wharf
#

can u remove this?

lime ruin
#

request?

#

done

devout wharf
#

idk if people wanna share all his inj adresses

lime ruin
#

so need 2 requsts ig

devout wharf
lime ruin
#

how did you get it?

#

the next addresses

devout wharf
#

idk has there a parameter for pagination and limit?

lime ruin
#

well yeah

devout wharf
#

lets gooooooo

lime ruin
#

erm

devout wharf
#

can u set to 100 limit?

#

does that work?

lime ruin
#

yes

devout wharf
#

so u have now 100 adresses?

lime ruin
#
{ all_accounts: { limit: 100 } }
lime ruin
devout wharf
#

well u need to extract the last nextkey

#

but how does the data looks now if before utf-8

#

by python you get this

lime ruin
#

not sure if there's a pagination

devout wharf
#

so he can search furhter with the nextkey

lime ruin
#

i mean

#

the parameter

lime ruin
#

hmm wait

devout wharf
#

send documentation

lime ruin
#

what does your query look like?

devout wharf
#

import asyncio

from pyinjective.async_client import AsyncClient
from pyinjective.client.model.pagination import PaginationOption
from pyinjective.core.network import Network

async def main() -> None:

network = Network.mainnet()
client = AsyncClient(network)
address = "wallet"
limit = 2
pagination = PaginationOption(limit=limit)
contract_history = await client.fetch_all_contracts_state(address=address, pagination=pagination)
print(contract_history)

if name == "main":
asyncio.get_event_loop().run_until_complete(main())

lime ruin
#

i mean the query which you're querying to the contract

devout wharf
#

what u mean

#

async def main() -> None:

network = Network.mainnet()
client = AsyncClient(network)
address = "inj1c6lxety9hqn9q4khwqvjcfa24c2qeqvvfsg4fm"
limit = 1000
pagination = PaginationOption(limit=limit)


contract_history = await client.fetch_all_contracts_state(address=address, pagination=pagination)
A = contract_history
print(contract_history)


while contract_history['pagination']['nextKey']:
    pagination = PaginationOption(limit=limit, encoded_page_key=contract_history['pagination']['nextKey'])
    contract_history = await client.fetch_all_contracts_state(address=address, pagination=pagination)
    A['models'] += contract_history['models']
    A['pagination'] = contract_history['pagination']

    print(f"Fetched {len(contract_history['models'])} models, total now: {len(A['models'])}")
lime ruin
#

ah

lime ruin
#

i see

devout wharf
lime ruin
devout wharf
#

i am just happy that injective makes my life easier

devout wharf
lime ruin
#

yo

devout wharf
devout wharf
lime ruin
#

hmm there's also this