Giter Club home page Giter Club logo

mirror.js's People

Contributors

0xslipk avatar csanti avatar etienne-napoleone avatar hanjukim avatar mmalomo avatar ouiliame avatar wengzilla avatar yun-yeo 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

Watchers

 avatar  avatar  avatar  avatar  avatar

mirror.js's Issues

Querying reward info returns 0

Tried a simple query to get the pending rewards, and getting the pending_reward result set to zero.

let token = 'terra165nd2qmrtszehcfrntlplzern7zl4ahtlhd5t2';
const result = await mirror.staking.getRewardInfo(account, token);

Result:

{
  staker: 'xxx',
  reward_infos: [
    {
      asset_token: 'terra165nd2qmrtszehcfrntlplzern7zl4ahtlhd5t2',
      index: '44.62516407102563644',
      bond_amount: 'xxx',
      pending_reward: '0'
    }
  ]
}

TerraSwap Broken After Col-5 Upgrade

I've updated both terrajs and mirror js to the following versions

I also changed my chainID referenced to col-5
Now that im on col-5 i cant seem to interact with terraswap using mirrorjs. I noticed a slight change in txes from col-4 to col-5 where the max_spread parameter is passed at the beginning of the message. Not sure if this is related.

I get a 400 error when trying to perform swaps on terraswap

    "@mirror-protocol/mirror.js": "^2.1.1",
    "@terra-money/terra.js": "^2.0.14",
  const terra = new LCDClient({
        URL: 'https://lcd.terra.dev',
        chainID: 'columbus-5',
        url: '/txs/estimate_fee',
      method: 'post',
      data: '{"base_req":{"chain_id":"columbus-5","from":"removedaddress","gas":"auto","gas_prices":[{"denom":"uusd","amount":"0.456000000000000000"}],"gas_adjustment":"1.7"},"msgs":[{"type":"wasm/MsgExecuteContract","value":{"sender":"removedaddress","contract":"terra1amv303y8kzxuegvurh0gug2xe9wkgj65enq2ux","execute_msg":{"swap":{"offer_asset":{"info":{"native_token":{"denom":"uusd"}},"amount":"10000000"},"belief_price":"3.000000000000000000","max_spread":"0.005000000000000000"}},"coins":[{"denom":"uusd","amount":"10000000"}]}}]}',
      headers: [Object],
      baseURL: 'https://lcd.terra.dev', 



    data: {
      error: 'rpc error: code = InvalidArgument desc = failed to execute message; message index: 0: Max spread assertion: execute wasm contract failed: invalid request'
    }

EmptyKey breaks jscrypto hex conversion

Older versions of terra.js used crypto-js instead of jscrypto for cryptography. crypto-js's Hex.parse function supports converting the empty keys used in DEFAULT_MIRROR_OPTIONS and DEFAULT_TEQUILA_MIRROR_OPTIONS into hex, but jscrypto's Hex.parse does not. As a result, import { Mirror } from '@mirror-protocol/mirror.js'; raises this error:

/home/user/terra/autostaker/node_modules/jscrypto/Hex.js:1
!function(n,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else if("object"==typeof exports)exports.JsCrypto=r();else{var t=r();for(var e in n.JsCrypto=n.JsCrypto||{},t)n.JsCrypto[e]=t[e]}}(this,(function(){return function(){"use strict";var n={d:function(r,t){for(var e in t)n.o(t,e)&&!n.o(r,e)&&Object.defineProperty(r,e,{enumerable:!0,get:t[e]})}};n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),n.o=function(n,r){return Object.prototype.hasOwnProperty.call(n,r)},n.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"t",{value:!0})};var r={};n.r(r),n.d(r,{Hex:function(){return f}});var t,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",i=(t=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(t)?(t=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(t)&&t):t);var o=function(){if("undefined"!=typeof window){var r=window.crypto||window.msCrypto;if(!r){if(function(n,r){return!1!==i&&(!r||("<"===n?i<r:"<="===n?i<=r:">"===n?i>r:">="===n?i>=r:i===r))}("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return r.getRandomValues(new Uint32Array(1))[0]}}return void 0!==n.g&&n.g.crypto?function(){return n.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}(),a=function(){function n(r,t){if(Array.isArray(r)||!r)return this.i=Array.isArray(r)?r:[],void(this.u="number"==typeof t?t:4*this.i.length);if(r instanceof n)return this.i=r.words.slice(),void(this.u=r.nSigBytes);var e;try{r instanceof ArrayBuffer?e=new Uint8Array(r):(r instanceof Uint8Array||r instanceof Int8Array||r instanceof Uint8ClampedArray||r instanceof Int16Array||r instanceof Uint16Array||r instanceof Int32Array||r instanceof Uint32Array||r instanceof Float32Array||r instanceof Float64Array)&&(e=new Uint8Array(r.buffer,r.byteOffset,r.byteLength))}catch(n){throw new Error("Invalid argument")}if(!e)throw new Error("Invalid argument");for(var i=e.byteLength,o=[],a=0;a<i;a++)o[a>>>2]|=e[a]<<24-a%4*8;this.i=o,this.u=i}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.u},set:function(n){this.u=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.i},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):f.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.i,r=this.u,t=new Uint8Array(r),e=0;e<r;e++)t[e]=n[e>>>2]>>>24-e%4*8&255;return t},n.prototype.concat=function(n){var r=n.words.slice(),t=n.nSigBytes;if(this.clamp(),this.u%4)for(var e=0;e<t;e++){var i=r[e>>>2]>>>24-e%4*8&255;this.i[this.u+e>>>2]|=i<<24-(this.u+e)%4*8}else for(e=0;e<t;e+=4)this.i[this.u+e>>>2]=r[e>>>2];return this.u+=t,this},n.prototype.clamp=function(){var n=this.u;this.i[n>>>2]&=4294967295<<32-n%4*8,this.i.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.i.slice(),this.u)},n.random=function(r){for(var t=[],e=0;e<r;e+=4)t.push(o());return new n(t,r)},n}(),f={stringify:function(n){for(var r=n.nSigBytes,t=n.words,e=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;e.push((o>>>4).toString(16)),e.push((15&o).toString(16))}return e.join("")},parse:function(n){var r=n.length;if(r%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var t=[],e=0;e<r;e+=2)t[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new a(t,r/2)}};return r}()}));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ^
Error: Invalid Hex string: 
    at Object.parse (***/node_modules/jscrypto/Hex.js:1:3770)
    at addressFromPublicKey (***/node_modules/@terra-money/terra.js/src/key/Key.ts:22:23)
    at EmptyKey.Key (***/node_modules/@terra-money/terra.js/src/key/Key.ts:106:25)
    at new EmptyKey (***/node_modules/@mirror-protocol/mirror.js/src/utils/EmptyKey.ts:5:5)
    at Object.<anonymous> (***/node_modules/@mirror-protocol/mirror.js/src/client/Mirror.ts:56:8)

DEFAULT_TEQUILA_MIRROR_OPTIONS contract addresses missing

Logger.log(DEFAULT_TEQUILA_MIRROR_OPTIONS);

Log:
collector: 'terra1v046ktavwzlyct5gh8ls767fh7hc4gxc95grxy',
community: 'terra10qm80sfht0zhh3gaeej7sd4f92tswc44fn000q',
factory: 'terra10l9xc9eyrpxd5tqjgy6uxrw7dd9cv897cw8wdr',
gov: 'terra12r5ghc6ppewcdcs3hkewrz24ey6xl7mmpk478s',
mint: 'terra1s9ehcjv0dqj2gsl72xrpp0ga5fql7fj7y3kq3w',
oracle: 'terra1uvxhec74deupp47enh7z5pk55f3cvcz8nj4ww9',
collateralOracle: 'terra00',
staking: 'terra1a06dgl27rhujjphsn4drl242ufws267qxypptx',
lock: 'terra00',
mirrorToken: 'terra10llyp6v3j3her8u3ce66ragytu45kcmd9asj3u',
terraswapFactory: 'terra18qpjm4zkvqnpjpw0zn0tdr8gdzvt8au35v45xf',
airdrop: 'terra1p6nvyw7vz3fgpy4nyh3q3vc09e65sr97ejxn2p',
shortReward: 'terra00',

getCollateralPrice not decoding bech32 string

Currently running await mirrorLibrary.mirror.collaterallOracle.getCollateralPrice('uluna'); and getting back a server error: { error: 'decoding bech32 failed: invalid bech32 string length 7' }

Assume there is something wrong on the server-side.

Querying borrowing positions with `mirror.mint.getPositions()` did not return full result

Hello,

I'm trying to use the function mirror.mint.getPositions() to get all short positions.

I've set the parameter limit to a sufficiently large number (100 to be exact as the total positions shown on the app are less than 50), but there are still a few positions missing. All of these positions have position_idx less than 100,000.

Is there a way to fix this?

Thanks!

Mirror API forbidden

Hello,

I was working on a mirror app and I think I might have hit a rate limit for the API? everything jsut stopped working and said forbidden when I try to go to https://graph.mirror.finance/graphql. any idea what the limits are incase I did hit them? thanks!

What is "position_idx" in the deposit function?

Hi I was wondering what the position_idx input here in the deposit function is and how I can get it?

position_idx: Numeric.Input,

We are trying to use mirror js to interact with mirror but after reading searching the docs and testing out the mirror js deposit function for several hours, we are stuck on the position_idx input, it seems we are providing the wrong value (based on our error msg)

How do I get this position_idx input? Thank you!

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.