Giter Site home page Giter Site logo

cosmjs-types's People

Contributors

boz avatar egasimus avatar pyramation avatar webmaster128 avatar willclarktech avatar zetazzz avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

cosmjs-types's Issues

GrantFee /cosmos.feegrant.v1beta1.MsgGrantAllowance is not executing

I want to use the grant fee with cosmjs but I get errors

example 1

const grantFeeMsg = {
        typeUrl: '/cosmos.feegrant.v1beta1.MsgGrantAllowance',
        value: {
            granter: accountMain.address,
            /** grantee is the address of the user being granted an allowance of another user's funds. */
            grantee:  accountGrantee.address,
            /** allowance can be any of basic and filtered fee allowance. */
            allowance: BasicAllowance.encode(BasicAllowance.fromPartial({
                spendLimit: [{ denom: 'uatom', amount: '1000' }],
                expiration: Timestamp.fromPartial({
                    seconds: defaultExpiry.unix(),
                    nanos: 0
                })
            })).finish()
            // BasicAllowance.encode()
        }

    }
    const resultExecGrant = await clientMainGrant.signAndBroadcast(accountMain.address, [grantFeeMsg], 'auto');
    console.log(resultExecGrant);

Error: Query failed with (18): unable to resolve type URL : tx parse error: invalid request

example 2

const grantFeeMsg = {
        typeUrl: '/cosmos.feegrant.v1beta1.MsgGrantAllowance',
        value: {
            granter: accountMain.address,
            /** grantee is the address of the user being granted an allowance of another user's funds. */
            grantee:  accountGrantee.address,
            /** allowance can be any of basic and filtered fee allowance. */
        }

    }
    const resultExecGrant = await clientMainGrant.signAndBroadcast(accountMain.address, [grantFeeMsg], 'auto');
    console.log(resultExecGrant);
Error: Query failed with (18): recovered: runtime error: invalid memory address or nil pointer dereference
stack:
goroutine 1716454895 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x65
github.com/cosmos/cosmos-sdk/baseapp.newDefaultRecoveryMiddleware.func1({0x19c2380, 0x3237380})
        github.com/cosmos/[email protected]/baseapp/recovery.go:71 +0x27
github.com/cosmos/cosmos-sdk/baseapp.newRecoveryMiddleware.func1({0x19c2380?, 0x3237380?})
        github.com/cosmos/[email protected]/baseapp/recovery.go:39 +0x30
github.com/cosmos/cosmos-sdk/baseapp.processRecovery({0x19c2380, 0x3237380}, 0xc09b9b6240?)
        github.com/cosmos/[email protected]/baseapp/recovery.go:28 +0x37
github.com/cosmos/cosmos-sdk/baseapp.processRecovery({0x19c2380, 0x3237380}, 0x252a8c0?)
        github.com/cosmos/[email protected]/baseapp/recovery.go:33 +0x5e
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx.func1()
        github.com/cosmos/[email protected]/baseapp/baseapp.go:608 +0xfd
panic({0x19c2380, 0x3237380})
        runtime/panic.go:838 +0x207
github.com/cosmos/cosmos-sdk/codec/types.(*Any).GetCachedValue(...)
        github.com/cosmos/[email protected]/codec/types/any.go:113
github.com/cosmos/cosmos-sdk/x/feegrant.MsgGrantAllowance.GetFeeAllowanceI({{0xc0e008d4d0, 0x2d}, {0xc0e008d530, 0x2d}, 0x0})
        github.com/cosmos/[email protected]/x/feegrant/msgs.go:85 +0x31
github.com/cosmos/cosmos-sdk/x/feegrant.MsgGrantAllowance.ValidateBasic({{0xc0e008d4d0, 0x2d}, {0xc0e008d530, 0x2d}, 0x0})
        github.com/cosmos/[email protected]/x/feegrant/msgs.go:51 +0x85
github.com/cosmos/cosmos-sdk/baseapp.validateBasicTxMsgs({0xc0ef275290?, 0x1, 0xf0?})
        github.com/cosmos/[email protected]/baseapp/baseapp.go:527 +0x7a
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx(0xc0013b7040, 0x2, {0xc0c00f1860, 0xe8, 0xf0})
        github.com/cosmos/[email protected]/baseapp/baseapp.go:641 +0x417
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).Simulate(0x414307?, {0xc0c00f1860?, 0x1a74040?, 0x1?})
        github.com/cosmos/[email protected]/baseapp/test_helpers.go:23 +0x2c
github.com/cosmos/cosmos-sdk/x/auth/tx.txServer.Simulate({{{0x0, 0x0, 0x0}, {0x2531e40, 0xc0049c2b80}, {0xc001398cd0, 0xb}, {0x2522288, 0xc0012ceaf0}, {0x252c218, ...}, ...}, ...}, ...)
        github.com/cosmos/[email protected]/x/auth/tx/service.go:119 +0x129
github.com/cosmos/cosmos-sdk/types/tx._Service_Simulate_Handler({0x1b068c0?, 0xc00343d040}, {0x251e3e8, 0xc06fb75cb0}, 0xc17a0501e0, 0x0)
        github.com/cosmos/[email protected]/types/tx/service.pb.go:910 +0x170
github.com/cosmos/cosmos-sdk/baseapp.(*GRPCQueryRouter).RegisterService.func1({{0x251e378, 0xc000052060}, {0x252a8c0, 0xc09b8e70c0}, {{0xb, 0x0}, {0xc13ff58460, 0xb}, 0xbe8ab6, {0xea52c4a, ...}, ...}, ...}, ...)
        github.com/cosmos/[email protected]/baseapp/grpcrouter.go:85 +0x22d
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).handleQueryGRPC(0xc0013b7040, 0xc00898bef0, {{0xc08ab22780, 0xeb, 0x1e0}, {0xc0e008c660, 0x23}, 0xbe8ab6, 0x0})
        github.com/cosmos/[email protected]/baseapp/abci.go:577 +0x1cf
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).Query(0xc0013b7040, {{0xc08ab22780, 0xeb, 0x1e0}, {0xc0e008c660, 0x23}, 0xbe8ab6, 0x0})
        github.com/cosmos/[email protected]/baseapp/abci.go:421 +0x6fd
github.com/tendermint/tendermint/abci/client.(*localClient).QuerySync(0xc001260600, {{0xc08ab22780, 0xeb, 0x1e0}, {0xc0e008c660, 0x23}, 0x0, 0x0})
        github.com/tendermint/[email protected]/abci/client/local_client.go:256 +0x171
github.com/tendermint/tendermint/proxy.(*appConnQuery).QuerySync(0x2?, {{0xc08ab22780, 0xeb, 0x1e0}, {0xc0e008c660, 0x23}, 0x0, 0x0})
        github.com/tendermint/[email protected]/proxy/app_conn.go:159 +0x6e
github.com/tendermint/tendermint/rpc/core.ABCIQuery(0x8?, {0xc0e008c660?, 0xc01aff6600?}, {0xc08ab22780?, 0x4?, 0xc023329650?}, 0x2?, 0x79?)
        github.com/tendermint/[email protected]/rpc/core/abci.go:20 +0xa6
reflect.Value.call({0x19e6320?, 0x22d2010?, 0x80?}, {0x1bf00c4, 0x4}, {0xc09b08b300, 0x5, 0x18?})
        reflect/value.go:556 +0x845
reflect.Value.Call({0x19e6320?, 0x22d2010?, 0x21c?}, {0xc09b08b300, 0x5, 0x5})
        reflect/value.go:339 +0xbf
github.com/tendermint/tendermint/rpc/jsonrpc/server.makeJSONRPCHandler.func1({0x251cd40, 0xc0dcd553b0}, 0xc09a7ae200)
        github.com/tendermint/[email protected]/rpc/jsonrpc/server/http_json_handler.go:96 +0x1075
github.com/tendermint/tendermint/rpc/jsonrpc/server.handleInvalidJSONRPCPaths.func1({0x251cd40?, 0xc0dcd553b0?}, 0x7fd483597288?)
        github.com/tendermint/[email protected]/rpc/jsonrpc/server/http_json_handler.go:122 +0x5d
net/http.HandlerFunc.ServeHTTP(0xc09b895740?, {0x251cd40?, 0xc0dcd553b0?}, 0xc02afb1878?)
        net/http/server.go:2084 +0x2f
net/http.(*ServeMux).ServeHTTP(0x160?, {0x251cd40, 0xc0dcd553b0}, 0xc09a7ae200)
        net/http/server.go:2462 +0x149
github.com/tendermint/tendermint/rpc/jsonrpc/server.maxBytesHandler.ServeHTTP({{0x2507da0?, 0xc01f8f0040?}, 0x414307?}, {0x251cd40?, 0xc0dcd553b0}, 0xc09a7ae200)
        github.com/tendermint/[email protected]/rpc/jsonrpc/server/http_server.go:236 +0x122
github.com/tendermint/tendermint/rpc/jsonrpc/server.RecoverAndLogHandler.func1({0x251d3a0?, 0xc0909d20e0}, 0xc09a7ae200)
        github.com/tendermint/[email protected]/rpc/jsonrpc/server/http_server.go:209 +0x37f
net/http.HandlerFunc.ServeHTTP(0x0?, {0x251d3a0?, 0xc0909d20e0?}, 0x413fa5?)
        net/http/server.go:2084 +0x2f
net/http.serverHandler.ServeHTTP({0x250c5c8?}, {0x251d3a0, 0xc0909d20e0}, 0xc09a7ae200)
        net/http/server.go:2916 +0x43b
net/http.(*conn).serve(0xc138ff4460, {0x251e3e8, 0xc01eb74150})
        net/http/server.go:1966 +0x5d7
created by net/http.(*Server).Serve
        net/http/server.go:3071 +0x4db
: panic: invalid request
    at QueryClient.queryUnverified (/Users/ruslanglaznyov/Documents/test-grant/node_modules/@cosmjs/stargate/build/queryclient/queryclient.js:107:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.simulate (/Users/ruslanglaznyov/Documents/test-grant/node_modules/@cosmjs/stargate/build/modules/tx/queries.js:48:34)
    at async SigningStargateClient.simulate (/Users/ruslanglaznyov/Documents/test-grant/node_modules/@cosmjs/stargate/build/signingstargateclient.js:89:29)
    at async SigningStargateClient.signAndBroadcast (/Users/ruslanglaznyov/Documents/test-grant/node_modules/@cosmjs/stargate/build/signingstargateclient.js:160:35)
    at async file:///Users/ruslanglaznyov/Documents/test-grant/index.js:146:29

bug: Incorrect defaults for google.protobuf.Timestamp

Tendermint/Comet BFT treats an undefined/unset Timestamp as a time.Time zero (checking against time.Time.isZero()).

This is 0001-01-01 00:00:00.000.

However, a google.protobuf.Timestamp with { seconds: 0n, nanos: 0 } as defined for undefined/unset here:

https://github.com/confio/cosmjs-types/blob/main/src/google/protobuf/timestamp.ts#L104-L109

results in 1970-01-01 00:00:00.000 (UNIX epoch).

The correct default should be:

{ seconds: -62135596800000n, nanos: 0 }

Admittedly this is golang specific I guess so probably not a good idea to change the "default" encoder but leaving this here in case someone else stumbles across it.

i.e. Always set timestamps

Use useDate=false

The conversion Timestamp -> Date is losing information since Date is millisecond precision only.

MsgGrantAllowance doesnot provide allowance context using signingStargateClient

Currently looking to create a button that lets a wallet register themselves for a feegrant on a network that includes the x/feegrant module. I have found that when the message is being signed & broadcasted, the data in the allowance type is not populated into the final signing msg.

Testing the exact same process using the cli command with flags, the message was signed and broadcasted with the correct allowance data.

Any insight on what could be the issue is greatly appreciated!

Protobufjs vulnerability

A dependabot alert appeared in one of our repos related to protobufjs, this is the alert:

image

After some traversing in our dependency tree I noticed that the latest version of cosmjs-types have it as a dependency.

image

I also saw that a PR was already merged to remove it from the package.json of the project so I would like to know when that change would be readily available so I can upgrade the version.

Thanks for your hard work!

Missing `exports` field causing packge to be incompatible with ESM

The package.json should have an exports field that matches the parts of the files list that may be imported into JS code. JS tooling (typescript, bundlers, vscode) tends to forgive the missing field when the consuming package isn't using ESM modules but imports will fail when they are using ESM.

Also the files field looks incorrect to be but I may be missing something. It's pointing to files and folders at the root that don't exist.

A useful resource to learn more about this: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-make-my-typescript-project-output-esm

Cosmos SDK 0.47.3 support

Hi,

Will this library support Cosmos SDK chains with v0.47.3? It seems as the last commit was to support v0.47.2.

Currently we are using telescope on our chain and it is breaking because of this library

See here: cosmology-tech/telescope#396

cosmjs-types 0.9.0 doesn't compile

when I try to use it the following file stops vercel from building it.
removing the utf-8 character seems to make it happy locally.


Failed to compile.
16:28:22.092 |  
16:28:22.092 | ./node_modules/@cosmjs/encoding/build/utf8.d.ts:1:1
16:28:22.092 | Type error: File appears to be binary.
16:28:22.092 |  
16:28:22.093 | > 1 \| export declare function toUtf8(str: string): Uint8Array;
16:28:22.093 | \| ^
16:28:22.093 | 2 \| /**
16:28:22.093 | 3 \|  * Takes UTF-8 data and decodes it to a string.
16:28:22.093 | 4 \|  *
16:28:22.219 | Error: Command "yarn run build" exited with 1
16:28:22.843

<br class="Apple-interchange-newline">

Error: Query failed with (6): rpc error: code = Unknown desc = failed to execute message; message index: 0: 0: unknown proposal

hi.
i'm using

  • "@cosmjs/cosmwasm-stargate": "^0.31.3",
  • "@keplr-wallet/types": "^0.12.38",
  • "cosmjs-types": "^0.9.0",
  • (among other things)

I am creating the vote via

  const prop = BigInt(proposal_id);
        const vote = CosmosMsgVote.fromPartial({
          option,
          voter: account,
          proposalId: prop,
        });

        return [
          {
            value: vote,
            typeUrl: '/cosmos.gov.v1beta1.MsgVote',
          },
        ];
      }

which used to work, (and other transactions appear to work).
but when I call SigningCosmWasmClient.simulate
it gives me

rpc error: code = Unknown desc = failed to execute message; message index: 0: 0: unknown proposal

(the proposal exists on the chain).

The only 'strange' thing is when I print out the msg it shows up as

proposalId: 18n, 

(note the 'n') .
any hints?

Granting multiple ContractExecutionAuthorization causes grants to be replaced.

When granting ContractExecutionAuthorization to 2 different contract, the 2nd grant replaces the 1st one.

1st grant message:

authorization: {
                    typeUrl: '/cosmwasm.wasm.v1.ContractExecutionAuthorization',
                    value: ContractExecutionAuthorization.encode(ContractExecutionAuthorization.fromPartial({
                        grants: [{
                            contract: "contract1",
                            filter: {
                                typeUrl: '/cosmwasm.wasm.v1.AcceptedMessageKeysFilter',
                                value: AcceptedMessageKeysFilter.encode(AcceptedMessageKeysFilter.fromPartial({ keys: ["action"] })).finish()
                            },
                            limit: {
                                typeUrl: '/cosmwasm.wasm.v1.MaxFundsLimit',
                                value: MaxFundsLimit.encode(MaxFundsLimit.fromPartial({ amounts: [{ denom: "NOTOKEN", amount: "1" }] })).finish()
                            },
                        }]
                    }),).finish(),
                }

2nd grant message:

authorization: {
                    typeUrl: '/cosmwasm.wasm.v1.ContractExecutionAuthorization',
                    value: ContractExecutionAuthorization.encode(ContractExecutionAuthorization.fromPartial({
                        grants: [{
                            contract: "contract2",
                            filter: {
                                typeUrl: '/cosmwasm.wasm.v1.AcceptedMessageKeysFilter',
                                value: AcceptedMessageKeysFilter.encode(AcceptedMessageKeysFilter.fromPartial({ keys: ["action"] })).finish()
                            },
                            limit: {
                                typeUrl: '/cosmwasm.wasm.v1.MaxFundsLimit',
                                value: MaxFundsLimit.encode(MaxFundsLimit.fromPartial({ amounts: [{ denom: "NOTOKEN", amount: "1" }] })).finish()
                            },
                        }]
                    }),).finish(),
                }

`Type urls` in const

Hi, I would want to use core cosmos type urls in some consts/enums, but couldn't find them, are they exist?

I did this PR, but realized that this should be done in Cosmos libs, not by devs in theirs projects.

Or how to do it correct?

image

`protobufjs@^6` triggers override mistake

In Hardened JavaScript and similar environments the intrinsics are frozen for security.

protobufjs had an issue which triggered what is commonly known as the override mistake (using assignment to define a property which exists is unwritable in the prototype chain), in this case constructor of a custom Error.

That issue was fixed, but only as part of the ^7 major version. I'm not sure if there are breaking changes impacting this package, but updating protobufjs to the latest major would help projects using Hardened JS, like dapps building for the Agoric chain.

Add Osmosis types

Hi guys,

I tried forking and adding Osmosis using the same logic as for wasmd and cosmos but it gets stuck saying that a proto has already been declared.

Could I get some more indications on how to do this, I would love contrbuting and adding more types :)

I think my mistake lies in the fast that I created the third-party folder by copying the one in wasmd.

Thanks

cosmos-sdk v0.45.16-ics-lsm-rc0 support

Hi all, I'm working on Stride's frontend, and we're looking to release LSM soon.

I was wondering if we can have support for v0.45.16-ics-lsm-rc0. I mostly need support for registry types like MsgTokenizeShares and MsgRedeemTokenForShares.

Currently as a workaround, I've made cosmos-sdk become a git submodule of stridejs, making it a direct part of the build, to make sure I have access to a registry that includes aforementioned transactions.

I'm not sure if this is the right place, but it seems that Stargate imports the proto encoders from this library.

If there's anything I can help with to make this happen, let me know :D

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.