@injectivelabs/sdk-ts 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/classes/Address.d.ts +6 -7
- package/dist/classes/Address.d.ts.map +1 -1
- package/dist/classes/Address.js +11 -14
- package/dist/classes/Address.js.map +1 -1
- package/dist/classes/PrivateKey.d.ts +3 -6
- package/dist/classes/PrivateKey.d.ts.map +1 -1
- package/dist/classes/PrivateKey.js +4 -5
- package/dist/classes/PrivateKey.js.map +1 -1
- package/dist/classes/PublicKey.d.ts +14 -0
- package/dist/classes/PublicKey.d.ts.map +1 -0
- package/dist/classes/PublicKey.js +56 -0
- package/dist/classes/PublicKey.js.map +1 -0
- package/dist/classes/index.d.ts +1 -0
- package/dist/classes/index.d.ts.map +1 -1
- package/dist/classes/index.js +1 -0
- package/dist/classes/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare class Address {
|
|
2
2
|
address: string;
|
|
3
|
-
|
|
3
|
+
accountNumber: number;
|
|
4
4
|
sequence: number;
|
|
5
5
|
private constructor();
|
|
6
6
|
compare(address: Address): boolean;
|
|
@@ -13,14 +13,13 @@ export declare class Address {
|
|
|
13
13
|
*/
|
|
14
14
|
static fromBech32(bech: string): Address;
|
|
15
15
|
/**
|
|
16
|
-
* Create an address instance from
|
|
17
|
-
* @param {string}
|
|
16
|
+
* Create an address instance from an ethereum address
|
|
17
|
+
* @param {string} hex Ethereum address
|
|
18
|
+
* @param {string} prefix
|
|
18
19
|
* @return {Address}
|
|
19
|
-
* @throws {Error} if bech is not a valid bech32-encoded
|
|
20
|
+
* @throws {Error} if bech is not a valid bech32-encoded address
|
|
20
21
|
*/
|
|
21
|
-
static
|
|
22
|
-
static fromValidatorAddress(bech: string): Address;
|
|
23
|
-
static fromConsensusAddress(bech: string): Address;
|
|
22
|
+
static fromHex(hex: string, prefix?: string): Address;
|
|
24
23
|
/**
|
|
25
24
|
* Convert an address instance to a bech32-encoded account address
|
|
26
25
|
* @param {string} prefix
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Address.d.ts","sourceRoot":"","sources":["../../src/classes/Address.ts"],"names":[],"mappings":"AAQA,qBAAa,OAAO;IACX,OAAO,EAAE,MAAM,CAAA;IAEf,
|
|
1
|
+
{"version":3,"file":"Address.d.ts","sourceRoot":"","sources":["../../src/classes/Address.ts"],"names":[],"mappings":"AAQA,qBAAa,OAAO;IACX,OAAO,EAAE,MAAM,CAAA;IAEf,aAAa,EAAE,MAAM,CAAA;IAErB,QAAQ,EAAE,MAAM,CAAA;IAEvB,OAAO;IAMP,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO;IAIlC;;;;;;OAMG;IACH,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IASxC;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CACZ,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,MAA+B,GACtC,OAAO;IAOV;;;;OAIG;IACH,QAAQ,CAAC,MAAM,GAAE,MAA+B,GAAG,MAAM;IAQzD;;;;SAIK;IACL,gBAAgB,IAAI,MAAM;IAI1B;;;;SAIK;IACL,kBAAkB,IAAI,MAAM;IAI5B;;;;SAIK;IACL,kBAAkB,IAAI,MAAM;IAI5B;;;;SAIK;IACL,KAAK,IAAI,MAAM;IAIf;;;;;SAKK;IACL,eAAe,CAAC,KAAK,GAAE,MAAU,GAAG,MAAM;IAM1C;;;;SAIK;IACL,kBAAkB,IAAI,MAAM;CAG7B"}
|
package/dist/classes/Address.js
CHANGED
|
@@ -7,7 +7,7 @@ const constants_1 = require("../utils/constants");
|
|
|
7
7
|
class Address {
|
|
8
8
|
constructor(address) {
|
|
9
9
|
this.address = address;
|
|
10
|
-
this.
|
|
10
|
+
this.accountNumber = 0;
|
|
11
11
|
this.sequence = 0;
|
|
12
12
|
}
|
|
13
13
|
compare(address) {
|
|
@@ -23,22 +23,19 @@ class Address {
|
|
|
23
23
|
static fromBech32(bech) {
|
|
24
24
|
const address = Buffer.from(bech32_1.bech32.fromWords(bech32_1.bech32.decode(bech).words)).toString('hex');
|
|
25
25
|
const addressInHex = address.startsWith('0x') ? address : `0x${address}`;
|
|
26
|
-
return
|
|
26
|
+
return Address.fromHex(addressInHex);
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Create an address instance from
|
|
30
|
-
* @param {string}
|
|
29
|
+
* Create an address instance from an ethereum address
|
|
30
|
+
* @param {string} hex Ethereum address
|
|
31
|
+
* @param {string} prefix
|
|
31
32
|
* @return {Address}
|
|
32
|
-
* @throws {Error} if bech is not a valid bech32-encoded
|
|
33
|
+
* @throws {Error} if bech is not a valid bech32-encoded address
|
|
33
34
|
*/
|
|
34
|
-
static
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return Address.fromBech32(bech);
|
|
39
|
-
}
|
|
40
|
-
static fromConsensusAddress(bech) {
|
|
41
|
-
return Address.fromBech32(bech);
|
|
35
|
+
static fromHex(hex, prefix = constants_1.BECH32_ADDR_ACC_PREFIX) {
|
|
36
|
+
const addressBuffer = ethereumjs_util_1.Address.fromString(hex).toBuffer();
|
|
37
|
+
const address = bech32_1.bech32.encode(prefix, bech32_1.bech32.toWords(addressBuffer));
|
|
38
|
+
return new Address(address);
|
|
42
39
|
}
|
|
43
40
|
/**
|
|
44
41
|
* Convert an address instance to a bech32-encoded account address
|
|
@@ -46,7 +43,7 @@ class Address {
|
|
|
46
43
|
* @returns {string}
|
|
47
44
|
*/
|
|
48
45
|
toBech32(prefix = constants_1.BECH32_ADDR_ACC_PREFIX) {
|
|
49
|
-
const addressBuffer = ethereumjs_util_1.Address.fromString(this.
|
|
46
|
+
const addressBuffer = ethereumjs_util_1.Address.fromString(this.toHex()).toBuffer();
|
|
50
47
|
return bech32_1.bech32.encode(prefix, bech32_1.bech32.toWords(addressBuffer));
|
|
51
48
|
}
|
|
52
49
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Address.js","sourceRoot":"","sources":["../../src/classes/Address.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAC/B,qDAAiE;AACjE,kDAI2B;AAE3B,MAAa,OAAO;IAOlB,YAAoB,OAAe;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"Address.js","sourceRoot":"","sources":["../../src/classes/Address.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAC/B,qDAAiE;AACjE,kDAI2B;AAE3B,MAAa,OAAO;IAOlB,YAAoB,OAAe;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,aAAa,GAAG,CAAC,CAAA;QACtB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAA;IACnB,CAAC;IAED,OAAO,CAAC,OAAgB;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,CAAA;IACrE,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,UAAU,CAAC,IAAY;QAC5B,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CACzB,eAAM,CAAC,SAAS,CAAC,eAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAC5C,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QACjB,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAA;QAExE,OAAO,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;IACtC,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CACZ,GAAW,EACX,SAAiB,kCAAsB;QAEvC,MAAM,aAAa,GAAG,yBAAoB,CAAC,UAAU,CAAC,GAAG,CAA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A;IACrB,CAAC;CACF;AAvHD,0BAuHC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PublicKey } from './PublicKey';
|
|
1
2
|
/**
|
|
2
3
|
* Class for wrapping SigningKey that is used for signature creation and public key derivation.
|
|
3
4
|
*/
|
|
@@ -34,14 +35,10 @@ export declare class PrivateKey {
|
|
|
34
35
|
*/
|
|
35
36
|
toHex(): string;
|
|
36
37
|
/**
|
|
37
|
-
* TODO
|
|
38
38
|
* Return the PublicKey associated with this private key.
|
|
39
39
|
* @returns {PublicKey} a Private that can be used to verify the signatures made with this PrivateKey
|
|
40
|
-
|
|
41
|
-
toPublicKey(): PublicKey
|
|
42
|
-
return PublicKey.fromPublicKey(this.wallet.publicKey)
|
|
43
|
-
}
|
|
44
|
-
*/
|
|
40
|
+
**/
|
|
41
|
+
toPublicKey(): PublicKey;
|
|
45
42
|
/**
|
|
46
43
|
* Sign the given message using the edcsa sign_deterministic function.
|
|
47
44
|
* @param {any} message: the message that will be hashed and signed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrivateKey.d.ts","sourceRoot":"","sources":["../../src/classes/PrivateKey.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PrivateKey.d.ts","sourceRoot":"","sources":["../../src/classes/PrivateKey.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAQ;IAEtB,OAAO;IAIP;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI;QAAE,UAAU,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;IAU/D;;;;;;OAMG;IACH,MAAM,CAAC,YAAY,CACjB,KAAK,EAAE,MAAM,EACb,IAAI,SAA0B,GAC7B,UAAU;IAIb;;;;;;OAMG;IACH,MAAM,CAAC,cAAc,CACnB,UAAU,EAAE,MAAM,EAClB,IAAI,SAA0B,GAC7B,UAAU;IAIb;;;OAGG;IACH,KAAK,IAAI,MAAM;IAIf;;;QAGI;IACJ,WAAW,IAAI,SAAS;IAIxB;;;;OAIG;IACG,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC;CAS9C"}
|
|
@@ -18,6 +18,7 @@ const ethers_1 = require("ethers");
|
|
|
18
18
|
const secp256k1_1 = __importDefault(require("secp256k1"));
|
|
19
19
|
const keccak256_1 = __importDefault(require("keccak256"));
|
|
20
20
|
const constants_1 = require("../utils/constants");
|
|
21
|
+
const PublicKey_1 = require("./PublicKey");
|
|
21
22
|
/**
|
|
22
23
|
* Class for wrapping SigningKey that is used for signature creation and public key derivation.
|
|
23
24
|
*/
|
|
@@ -65,14 +66,12 @@ class PrivateKey {
|
|
|
65
66
|
return `0x${this.wallet.address}`;
|
|
66
67
|
}
|
|
67
68
|
/**
|
|
68
|
-
* TODO
|
|
69
69
|
* Return the PublicKey associated with this private key.
|
|
70
70
|
* @returns {PublicKey} a Private that can be used to verify the signatures made with this PrivateKey
|
|
71
|
-
|
|
72
|
-
toPublicKey()
|
|
73
|
-
|
|
71
|
+
**/
|
|
72
|
+
toPublicKey() {
|
|
73
|
+
return PublicKey_1.PublicKey.fromHex(this.wallet.publicKey);
|
|
74
74
|
}
|
|
75
|
-
*/
|
|
76
75
|
/**
|
|
77
76
|
* Sign the given message using the edcsa sign_deterministic function.
|
|
78
77
|
* @param {any} message: the message that will be hashed and signed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrivateKey.js","sourceRoot":"","sources":["../../src/classes/PrivateKey.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAAyB;AACzB,mCAA+B;AAC/B,0DAAiC;AACjC,0DAAiC;AACjC,kDAA4D;
|
|
1
|
+
{"version":3,"file":"PrivateKey.js","sourceRoot":"","sources":["../../src/classes/PrivateKey.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AA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,EAAE,KAAK,CAAC,CAAA;YAC7D,MAAM,EAAE,SAAS,EAAE,GAAG,mBAAS,CAAC,SAAS,CAAC,OAAO,EAAE,eAAe,CAAC,CAAA;YAEnE,OAAO,SAAS,CAAA;QAClB,CAAC;KAAA;CACF;AA/ED,gCA+EC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PubKey } from '@injectivelabs/chain-api/injective/crypto/v1beta1/ethsecp256k1/keys_pb';
|
|
2
|
+
import { Any } from 'google-protobuf/google/protobuf/any_pb';
|
|
3
|
+
export declare class PublicKey {
|
|
4
|
+
private type;
|
|
5
|
+
private key;
|
|
6
|
+
private constructor();
|
|
7
|
+
static fromHex(privateKey: string | Uint8Array): PublicKey;
|
|
8
|
+
toHex(): Uint8Array;
|
|
9
|
+
toPubKey(): string;
|
|
10
|
+
toBech32(): string;
|
|
11
|
+
toProto(): PubKey;
|
|
12
|
+
toAny(): Any;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=PublicKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PublicKey.d.ts","sourceRoot":"","sources":["../../src/classes/PublicKey.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,wEAAwE,CAAA;AAC/F,OAAO,EAAE,GAAG,EAAE,MAAM,wCAAwC,CAAA;AAG5D,qBAAa,SAAS;IACpB,OAAO,CAAC,IAAI,CAAQ;IAEpB,OAAO,CAAC,GAAG,CAAQ;IAEnB,OAAO;IAKP,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAcnD,KAAK,IAAI,UAAU;IAInB,QAAQ,IAAI,MAAM;IAUlB,QAAQ,IAAI,MAAM;IAIlB,OAAO;IAOP,KAAK;CASb"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PublicKey = void 0;
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
const bech32_1 = require("bech32");
|
|
9
|
+
// import { sha256, ripemd160 } from '../util/hash'
|
|
10
|
+
const keys_pb_1 = require("@injectivelabs/chain-api/injective/crypto/v1beta1/ethsecp256k1/keys_pb");
|
|
11
|
+
const any_pb_1 = require("google-protobuf/google/protobuf/any_pb");
|
|
12
|
+
const secp256k1_1 = __importDefault(require("secp256k1"));
|
|
13
|
+
class PublicKey {
|
|
14
|
+
constructor(key, type) {
|
|
15
|
+
this.key = key;
|
|
16
|
+
this.type = type;
|
|
17
|
+
}
|
|
18
|
+
static fromHex(privateKey) {
|
|
19
|
+
const privateKeyHex = Buffer.from(privateKey.toString(), 'hex');
|
|
20
|
+
const publicKeyByte = secp256k1_1.default.publicKeyCreate(privateKeyHex);
|
|
21
|
+
const buf1 = Buffer.from([10]);
|
|
22
|
+
const buf2 = Buffer.from([publicKeyByte.length]);
|
|
23
|
+
const buf3 = Buffer.from(publicKeyByte);
|
|
24
|
+
const key = Buffer.concat([buf1, buf2, buf3]).toString('base64');
|
|
25
|
+
const type = '/injective.crypto.v1beta1.ethsecp256k1.PubKey';
|
|
26
|
+
return new PublicKey(key, type);
|
|
27
|
+
}
|
|
28
|
+
toHex() {
|
|
29
|
+
return new Uint8Array([]); /* TODO */
|
|
30
|
+
}
|
|
31
|
+
toPubKey() {
|
|
32
|
+
const pubkeyAminoPrefixSecp256k1 = Buffer.from('eb5ae987' + '21', 'hex');
|
|
33
|
+
const pubKeyBytes = Buffer.concat([
|
|
34
|
+
pubkeyAminoPrefixSecp256k1,
|
|
35
|
+
Buffer.from(this.key, 'base64'),
|
|
36
|
+
]);
|
|
37
|
+
return bech32_1.bech32.encode(utils_1.BECH32_PUBKEY_ACC_PREFIX, bech32_1.bech32.toWords(pubKeyBytes));
|
|
38
|
+
}
|
|
39
|
+
toBech32() {
|
|
40
|
+
return bech32_1.bech32.encode(utils_1.BECH32_ADDR_ACC_PREFIX, bech32_1.bech32.toWords(this.toHex()));
|
|
41
|
+
}
|
|
42
|
+
toProto() {
|
|
43
|
+
const proto = new keys_pb_1.PubKey();
|
|
44
|
+
proto.setKey(this.key);
|
|
45
|
+
return proto;
|
|
46
|
+
}
|
|
47
|
+
toAny() {
|
|
48
|
+
const proto = this.toProto();
|
|
49
|
+
const message = new any_pb_1.Any();
|
|
50
|
+
message.setTypeUrl(this.type);
|
|
51
|
+
message.setValue(Buffer.from(proto.serializeBinary()).toString('base64'));
|
|
52
|
+
return message;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.PublicKey = PublicKey;
|
|
56
|
+
//# sourceMappingURL=PublicKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PublicKey.js","sourceRoot":"","sources":["../../src/classes/PublicKey.ts"],"names":[],"mappings":";;;;;;AAAA,oCAA2E;AAC3E,mCAA+B;AAC/B,mDAAmD;AACnD,oGAA+F;AAC/F,mEAA4D;AAC5D,0DAAiC;AAEjC,MAAa,SAAS;IAKpB,YAAoB,GAAW,EAAE,IAAY;QAC3C,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,UAA+B;QAC5C,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAA;QAC/D,MAAM,aAAa,GAAG,mBAAS,CAAC,eAAe,CAAC,aAAa,CAAC,CAAA;QAE9D,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QAC9B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,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IAAI,CAAC,CAAA;QAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAA;QAEzE,OAAO,OAAO,CAAA;IAChB,CAAC;CACF;AA1DD,8BA0DC"}
|
package/dist/classes/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA"}
|
package/dist/classes/index.js
CHANGED
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
__exportStar(require("./Address"), exports);
|
|
14
14
|
__exportStar(require("./Network"), exports);
|
|
15
15
|
__exportStar(require("./PrivateKey"), exports);
|
|
16
|
+
__exportStar(require("./PublicKey"), exports);
|
|
16
17
|
__exportStar(require("./InjectiveTx"), exports);
|
|
17
18
|
__exportStar(require("./TxService"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAyB;AACzB,4CAAyB;AACzB,+CAA4B;AAC5B,gDAA6B;AAC7B,8CAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAyB;AACzB,4CAAyB;AACzB,+CAA4B;AAC5B,8CAA2B;AAC3B,gDAA6B;AAC7B,8CAA2B"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/sdk-ts",
|
|
3
3
|
"description": "SDK in TypeScript for building Injective applications in a Node environment.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Bojan Angjelkoski",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"snakecase-keys": "^5.4.1",
|
|
55
55
|
"tiny-secp256k1": "^2.2.1"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "ac3037cbef81c4906682f2d9c2ba8ae2959d0453"
|
|
58
58
|
}
|