@injectivelabs/sdk-ts 1.14.11-beta.63 → 1.14.11-beta.65
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/cjs/client/chain/grpc/ChainGrpcAuthZApi.d.ts +3 -16
- package/dist/cjs/client/chain/grpc/ChainGrpcAuthZApi.d.ts.map +1 -1
- package/dist/cjs/client/chain/transformers/ChainGrpcAuthZTransformer.d.ts +6 -26
- package/dist/cjs/client/chain/transformers/ChainGrpcAuthZTransformer.d.ts.map +1 -1
- package/dist/cjs/client/chain/transformers/ChainGrpcAuthZTransformer.js +24 -7
- package/dist/cjs/client/chain/transformers/ChainGrpcAuthZTransformer.js.map +1 -1
- package/dist/cjs/client/chain/types/authZ.d.ts +12 -0
- package/dist/cjs/client/chain/types/authZ.d.ts.map +1 -1
- package/dist/cjs/client/chain/types/authZ.js +5 -0
- package/dist/cjs/client/chain/types/authZ.js.map +1 -1
- package/dist/cjs/core/modules/authz/msgs/MsgGrant.d.ts +7 -3
- package/dist/cjs/core/modules/authz/msgs/MsgGrant.d.ts.map +1 -1
- package/dist/cjs/core/modules/authz/msgs/MsgGrant.js +8 -7
- package/dist/cjs/core/modules/authz/msgs/MsgGrant.js.map +1 -1
- package/dist/cjs/core/modules/authz/utils.d.ts +2 -0
- package/dist/cjs/core/modules/authz/utils.d.ts.map +1 -1
- package/dist/cjs/core/modules/authz/utils.js +12 -1
- package/dist/cjs/core/modules/authz/utils.js.map +1 -1
- package/dist/esm/client/chain/grpc/ChainGrpcAuthZApi.d.ts +3 -16
- package/dist/esm/client/chain/grpc/ChainGrpcAuthZApi.d.ts.map +1 -1
- package/dist/esm/client/chain/transformers/ChainGrpcAuthZTransformer.d.ts +6 -26
- package/dist/esm/client/chain/transformers/ChainGrpcAuthZTransformer.d.ts.map +1 -1
- package/dist/esm/client/chain/transformers/ChainGrpcAuthZTransformer.js +24 -7
- package/dist/esm/client/chain/transformers/ChainGrpcAuthZTransformer.js.map +1 -1
- package/dist/esm/client/chain/types/authZ.d.ts +12 -0
- package/dist/esm/client/chain/types/authZ.d.ts.map +1 -1
- package/dist/esm/client/chain/types/authZ.js +4 -1
- package/dist/esm/client/chain/types/authZ.js.map +1 -1
- package/dist/esm/core/modules/authz/msgs/MsgGrant.d.ts +7 -3
- package/dist/esm/core/modules/authz/msgs/MsgGrant.d.ts.map +1 -1
- package/dist/esm/core/modules/authz/msgs/MsgGrant.js +9 -8
- package/dist/esm/core/modules/authz/msgs/MsgGrant.js.map +1 -1
- package/dist/esm/core/modules/authz/utils.d.ts +2 -0
- package/dist/esm/core/modules/authz/utils.d.ts.map +1 -1
- package/dist/esm/core/modules/authz/utils.js +10 -0
- package/dist/esm/core/modules/authz/utils.js.map +1 -1
- package/package.json +2 -2
|
@@ -15,28 +15,15 @@ export declare class ChainGrpcAuthZApi extends BaseGrpcConsumer {
|
|
|
15
15
|
msgTypeUrl?: string;
|
|
16
16
|
}): Promise<{
|
|
17
17
|
pagination: import("../../../types/pagination").Pagination;
|
|
18
|
-
grants:
|
|
19
|
-
authorization: string;
|
|
20
|
-
expiration: Date | undefined;
|
|
21
|
-
}[];
|
|
18
|
+
grants: import("../types").GrantWithDecodedAuthorization[];
|
|
22
19
|
}>;
|
|
23
20
|
fetchGranterGrants(granter: string, pagination?: PaginationOption): Promise<{
|
|
24
21
|
pagination: import("../../../types/pagination").Pagination;
|
|
25
|
-
grants:
|
|
26
|
-
granter: string;
|
|
27
|
-
grantee: string;
|
|
28
|
-
authorization: string;
|
|
29
|
-
expiration: Date | undefined;
|
|
30
|
-
}[];
|
|
22
|
+
grants: import("../types").GrantAuthorizationWithDecodedAuthorization[];
|
|
31
23
|
}>;
|
|
32
24
|
fetchGranteeGrants(grantee: string, pagination?: PaginationOption): Promise<{
|
|
33
25
|
pagination: import("../../../types/pagination").Pagination;
|
|
34
|
-
grants:
|
|
35
|
-
granter: string;
|
|
36
|
-
grantee: string;
|
|
37
|
-
authorization: string;
|
|
38
|
-
expiration: Date | undefined;
|
|
39
|
-
}[];
|
|
26
|
+
grants: import("../types").GrantAuthorizationWithDecodedAuthorization[];
|
|
40
27
|
}>;
|
|
41
28
|
}
|
|
42
29
|
//# sourceMappingURL=ChainGrpcAuthZApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChainGrpcAuthZApi.d.ts","sourceRoot":"","sources":["../../../../../src/client/chain/grpc/ChainGrpcAuthZApi.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,gBAAgB,MAAM,6BAA6B,CAAA;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAI5D;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,gBAAgB;IACrD,SAAS,CAAC,MAAM,EAAE,MAAM,CAAoB;IAE5C,SAAS,CAAC,MAAM,EAAE,uBAAuB,CAAC,eAAe,CAAA;gBAE7C,QAAQ,EAAE,MAAM;IAQtB,WAAW,CAAC,EAChB,UAAU,EACV,OAAO,EACP,OAAO,EACP,UAAU,GACX,EAAE;QACD,UAAU,CAAC,EAAE,gBAAgB,CAAA;QAC7B,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;QACf,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB
|
|
1
|
+
{"version":3,"file":"ChainGrpcAuthZApi.d.ts","sourceRoot":"","sources":["../../../../../src/client/chain/grpc/ChainGrpcAuthZApi.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,gBAAgB,MAAM,6BAA6B,CAAA;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAI5D;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,gBAAgB;IACrD,SAAS,CAAC,MAAM,EAAE,MAAM,CAAoB;IAE5C,SAAS,CAAC,MAAM,EAAE,uBAAuB,CAAC,eAAe,CAAA;gBAE7C,QAAQ,EAAE,MAAM;IAQtB,WAAW,CAAC,EAChB,UAAU,EACV,OAAO,EACP,OAAO,EACP,UAAU,GACX,EAAE;QACD,UAAU,CAAC,EAAE,gBAAgB,CAAA;QAC7B,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;QACf,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB;;;;IA6CK,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,gBAAgB;;;;IAuCjE,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,gBAAgB;;;;CAsCxE"}
|
|
@@ -1,42 +1,22 @@
|
|
|
1
1
|
import { CosmosAuthzV1Beta1Authz, CosmosAuthzV1Beta1Query } from '@injectivelabs/core-proto-ts';
|
|
2
|
+
import { GrantAuthorizationWithDecodedAuthorization, GrantWithDecodedAuthorization } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* @category Chain Grpc Transformer
|
|
4
5
|
*/
|
|
5
6
|
export declare class ChainGrpcAuthZTransformer {
|
|
6
|
-
static grpcGrantToGrant(grant: CosmosAuthzV1Beta1Authz.Grant):
|
|
7
|
-
|
|
8
|
-
expiration: Date | undefined;
|
|
9
|
-
};
|
|
10
|
-
static grpcGrantAuthorizationToGrantAuthorization(grant: CosmosAuthzV1Beta1Authz.GrantAuthorization): {
|
|
11
|
-
granter: string;
|
|
12
|
-
grantee: string;
|
|
13
|
-
authorization: string;
|
|
14
|
-
expiration: Date | undefined;
|
|
15
|
-
};
|
|
7
|
+
static grpcGrantToGrant(grant: CosmosAuthzV1Beta1Authz.Grant): GrantWithDecodedAuthorization;
|
|
8
|
+
static grpcGrantAuthorizationToGrantAuthorization(grant: CosmosAuthzV1Beta1Authz.GrantAuthorization): GrantAuthorizationWithDecodedAuthorization;
|
|
16
9
|
static grpcGrantsToGrants(response: CosmosAuthzV1Beta1Query.QueryGrantsResponse): {
|
|
17
10
|
pagination: import("../../..").Pagination;
|
|
18
|
-
grants:
|
|
19
|
-
authorization: string;
|
|
20
|
-
expiration: Date | undefined;
|
|
21
|
-
}[];
|
|
11
|
+
grants: GrantWithDecodedAuthorization[];
|
|
22
12
|
};
|
|
23
13
|
static grpcGranteeGrantsToGranteeGrants(response: CosmosAuthzV1Beta1Query.QueryGranteeGrantsResponse): {
|
|
24
14
|
pagination: import("../../..").Pagination;
|
|
25
|
-
grants:
|
|
26
|
-
granter: string;
|
|
27
|
-
grantee: string;
|
|
28
|
-
authorization: string;
|
|
29
|
-
expiration: Date | undefined;
|
|
30
|
-
}[];
|
|
15
|
+
grants: GrantAuthorizationWithDecodedAuthorization[];
|
|
31
16
|
};
|
|
32
17
|
static grpcGranterGrantsToGranterGrants(response: CosmosAuthzV1Beta1Query.QueryGranterGrantsResponse): {
|
|
33
18
|
pagination: import("../../..").Pagination;
|
|
34
|
-
grants:
|
|
35
|
-
granter: string;
|
|
36
|
-
grantee: string;
|
|
37
|
-
authorization: string;
|
|
38
|
-
expiration: Date | undefined;
|
|
39
|
-
}[];
|
|
19
|
+
grants: GrantAuthorizationWithDecodedAuthorization[];
|
|
40
20
|
};
|
|
41
21
|
}
|
|
42
22
|
//# sourceMappingURL=ChainGrpcAuthZTransformer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChainGrpcAuthZTransformer.d.ts","sourceRoot":"","sources":["../../../../../src/client/chain/transformers/ChainGrpcAuthZTransformer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChainGrpcAuthZTransformer.d.ts","sourceRoot":"","sources":["../../../../../src/client/chain/transformers/ChainGrpcAuthZTransformer.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,0CAA0C,EAC1C,6BAA6B,EAC9B,MAAM,UAAU,CAAA;AAEjB;;GAEG;AACH,qBAAa,yBAAyB;IACpC,MAAM,CAAC,gBAAgB,CACrB,KAAK,EAAE,uBAAuB,CAAC,KAAK,GACnC,6BAA6B;IAUhC,MAAM,CAAC,0CAA0C,CAC/C,KAAK,EAAE,uBAAuB,CAAC,kBAAkB,GAChD,0CAA0C;IAY7C,MAAM,CAAC,kBAAkB,CACvB,QAAQ,EAAE,uBAAuB,CAAC,mBAAmB;;;;IAQvD,MAAM,CAAC,gCAAgC,CACrC,QAAQ,EAAE,uBAAuB,CAAC,0BAA0B;;;;IAU9D,MAAM,CAAC,gCAAgC,CACrC,QAAQ,EAAE,uBAAuB,CAAC,0BAA0B;;;;CAS/D"}
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ChainGrpcAuthZTransformer = void 0;
|
|
4
|
+
const exceptions_1 = require("@injectivelabs/exceptions");
|
|
4
5
|
const pagination_1 = require("../../../utils/pagination");
|
|
6
|
+
const core_proto_ts_1 = require("@injectivelabs/core-proto-ts");
|
|
5
7
|
/**
|
|
6
8
|
* @category Chain Grpc Transformer
|
|
7
9
|
*/
|
|
8
10
|
class ChainGrpcAuthZTransformer {
|
|
9
11
|
static grpcGrantToGrant(grant) {
|
|
12
|
+
const authorization = decodeAuthorizationNoThrow(grant.authorization);
|
|
10
13
|
return {
|
|
11
|
-
authorization:
|
|
14
|
+
authorization: authorization === null || authorization === void 0 ? void 0 : authorization.authorization,
|
|
15
|
+
authorizationType: (authorization === null || authorization === void 0 ? void 0 : authorization.authorizationType) || '',
|
|
12
16
|
expiration: grant.expiration,
|
|
13
17
|
};
|
|
14
18
|
}
|
|
15
19
|
static grpcGrantAuthorizationToGrantAuthorization(grant) {
|
|
20
|
+
const authorization = decodeAuthorizationNoThrow(grant.authorization);
|
|
16
21
|
return {
|
|
17
22
|
granter: grant.granter,
|
|
18
23
|
grantee: grant.grantee,
|
|
19
|
-
authorization:
|
|
24
|
+
authorization: authorization === null || authorization === void 0 ? void 0 : authorization.authorization,
|
|
25
|
+
authorizationType: (authorization === null || authorization === void 0 ? void 0 : authorization.authorizationType) || '',
|
|
20
26
|
expiration: grant.expiration,
|
|
21
27
|
};
|
|
22
28
|
}
|
|
@@ -41,14 +47,25 @@ class ChainGrpcAuthZTransformer {
|
|
|
41
47
|
}
|
|
42
48
|
exports.ChainGrpcAuthZTransformer = ChainGrpcAuthZTransformer;
|
|
43
49
|
const decodeAuthorization = (authorization) => {
|
|
44
|
-
if (!authorization) {
|
|
45
|
-
return '';
|
|
46
|
-
}
|
|
47
50
|
switch (authorization.typeUrl) {
|
|
48
51
|
case '/cosmos.authz.v1beta1.GenericAuthorization':
|
|
49
|
-
return
|
|
52
|
+
return {
|
|
53
|
+
authorization: core_proto_ts_1.CosmosAuthzV1Beta1Authz.GenericAuthorization.decode(authorization.value),
|
|
54
|
+
authorizationType: '/cosmos.authz.v1beta1.GenericAuthorization',
|
|
55
|
+
};
|
|
50
56
|
default:
|
|
51
|
-
|
|
57
|
+
throw new exceptions_1.GeneralException(new Error('Unsupported authorization type'));
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const decodeAuthorizationNoThrow = (authorization) => {
|
|
61
|
+
if (!authorization) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
return decodeAuthorization(authorization);
|
|
66
|
+
}
|
|
67
|
+
catch (_a) {
|
|
68
|
+
return undefined;
|
|
52
69
|
}
|
|
53
70
|
};
|
|
54
71
|
//# sourceMappingURL=ChainGrpcAuthZTransformer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChainGrpcAuthZTransformer.js","sourceRoot":"","sources":["../../../../../src/client/chain/transformers/ChainGrpcAuthZTransformer.ts"],"names":[],"mappings":";;;AAAA,0DAAsE;
|
|
1
|
+
{"version":3,"file":"ChainGrpcAuthZTransformer.js","sourceRoot":"","sources":["../../../../../src/client/chain/transformers/ChainG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yBAAyB,CAAC,0CAA0C,CACrE;SACF,CAAA;IACH,CAAC;IAED,MAAM,CAAC,gCAAgC,CACrC,QAA4D;QAE5D,OAAO;YACL,UAAU,EAAE,IAAA,uCAA0B,EAAC,QAAQ,CAAC,UAAW,CAAC;YAC5D,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,CACzB,yBAAyB,CAAC,0CAA0C,CACrE;SACF,CAAA;IACH,CAAC;CACF;AAzDD,8DAyDC;AAED,MAAM,mBAAmB,GAAG,CAAC,aAAoC,EAAE,EAAE;IACnE,QAAQ,aAAa,CAAC,OAAO,EAAE,CAAC;QAC9B,KAAK,4CAA4C;YAC/C,OAAO;gBACL,aAAa,EAAE,uCAAuB,CAAC,oBAAoB,CAAC,MAAM,CAChE,aAAa,CAAC,KAAK,CACpB;gBACD,iBAAiB,EAAE,4CAA4C;aAChE,CAAA;QACH;YACE,MAAM,IAAI,6BAAgB,CAAC,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC,CAAA;IAC3E,CAAC;AACH,CAAC,CAAA;AAED,MAAM,0BAA0B,GAAG,CAAC,aAAqC,EAAE,EAAE;IAC3E,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,IAAI,CAAC;QACH,OAAO,mBAAmB,CAAC,aAAa,CAAC,CAAA;IAC3C,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CosmosAuthzV1Beta1Authz, InjectiveExchangeV1Beta1Authz } from '@injectivelabs/core-proto-ts';
|
|
2
2
|
export type Grant = CosmosAuthzV1Beta1Authz.Grant;
|
|
3
3
|
export type GrantAuthorization = CosmosAuthzV1Beta1Authz.GrantAuthorization;
|
|
4
|
+
export type GenericAuthorization = CosmosAuthzV1Beta1Authz.GenericAuthorization;
|
|
4
5
|
export type CreateSpotLimitOrderAuthz = InjectiveExchangeV1Beta1Authz.CreateSpotLimitOrderAuthz;
|
|
5
6
|
export type CreateSpotMarketOrderAuthz = InjectiveExchangeV1Beta1Authz.CreateSpotMarketOrderAuthz;
|
|
6
7
|
export type BatchCreateSpotLimitOrdersAuthz = InjectiveExchangeV1Beta1Authz.BatchCreateSpotLimitOrdersAuthz;
|
|
@@ -11,4 +12,15 @@ export type CreateDerivativeMarketOrderAuthz = InjectiveExchangeV1Beta1Authz.Cre
|
|
|
11
12
|
export type BatchCreateDerivativeLimitOrdersAuthz = InjectiveExchangeV1Beta1Authz.BatchCreateDerivativeLimitOrdersAuthz;
|
|
12
13
|
export type CancelDerivativeOrderAuthz = InjectiveExchangeV1Beta1Authz.CancelDerivativeOrderAuthz;
|
|
13
14
|
export type BatchCancelDerivativeOrdersAuthz = InjectiveExchangeV1Beta1Authz.BatchCancelDerivativeOrdersAuthz;
|
|
15
|
+
export interface GrantWithDecodedAuthorization extends Omit<Grant, 'authorization'> {
|
|
16
|
+
authorization: GenericAuthorization | undefined; /** Todo: add more authorizations */
|
|
17
|
+
authorizationType: string;
|
|
18
|
+
}
|
|
19
|
+
export interface GrantAuthorizationWithDecodedAuthorization extends Omit<GrantAuthorization, 'authorization'> {
|
|
20
|
+
authorization: GenericAuthorization | undefined; /** Todo: add more authorizations */
|
|
21
|
+
authorizationType: string;
|
|
22
|
+
}
|
|
23
|
+
export declare enum GrantAuthorizationType {
|
|
24
|
+
GenericAuthorization = "GenericAuthorization"
|
|
25
|
+
}
|
|
14
26
|
//# sourceMappingURL=authZ.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authZ.d.ts","sourceRoot":"","sources":["../../../../../src/client/chain/types/authZ.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,8BAA8B,CAAA;AAErC,MAAM,MAAM,KAAK,GAAG,uBAAuB,CAAC,KAAK,CAAA;AACjD,MAAM,MAAM,kBAAkB,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C;IACjD,aAAa,EACT,oBAAoB,GACpB,SAAS,CAAA,CAAC,oCAAoC;IAClD,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AAED,oBAAY,sBAAsB;IAChC,oBAAoB,yBAAyB;CAC9C"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GrantAuthorizationType = void 0;
|
|
4
|
+
var GrantAuthorizationType;
|
|
5
|
+
(function (GrantAuthorizationType) {
|
|
6
|
+
GrantAuthorizationType["GenericAuthorization"] = "GenericAuthorization";
|
|
7
|
+
})(GrantAuthorizationType || (exports.GrantAuthorizationType = GrantAuthorizationType = {}));
|
|
3
8
|
//# sourceMappingURL=authZ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authZ.js","sourceRoot":"","sources":["../../../../../src/client/chain/types/authZ.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"authZ.js","sourceRoot":"","sources":["../../../../../src/client/chain/types/authZ.ts"],"names":[],"mappings":";;;AA+CA,IAAY,sBAEX;AAFD,WAAY,sBAAsB;IAChC,uEAA6C,CAAA;AAC/C,CAAC,EAFW,sBAAsB,sCAAtB,sBAAsB,QAEjC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { MsgBase } from '../../MsgBase';
|
|
2
|
-
import { CosmosAuthzV1Beta1Tx, CosmosAuthzV1Beta1Authz } from '@injectivelabs/core-proto-ts';
|
|
2
|
+
import { GoogleProtobufAny, CosmosAuthzV1Beta1Tx, CosmosAuthzV1Beta1Authz } from '@injectivelabs/core-proto-ts';
|
|
3
3
|
export declare namespace MsgGrant {
|
|
4
4
|
interface Params {
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use `authorization` instead - for generic authorizations, use `getGenericAuthorizationFromMessageType` function
|
|
7
|
+
*/
|
|
8
|
+
messageType?: string;
|
|
9
|
+
authorization?: GoogleProtobufAny.Any;
|
|
6
10
|
grantee: string;
|
|
7
11
|
granter: string;
|
|
8
12
|
expiration?: number;
|
|
@@ -40,7 +44,7 @@ export default class MsgGrant extends MsgBase<MsgGrant.Params, MsgGrant.Proto> {
|
|
|
40
44
|
grant: {
|
|
41
45
|
authorization: {
|
|
42
46
|
'@type': string;
|
|
43
|
-
msg: string;
|
|
47
|
+
msg: string | undefined;
|
|
44
48
|
};
|
|
45
49
|
expiration: Date;
|
|
46
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MsgGrant.d.ts","sourceRoot":"","sources":["../../../../../../src/core/modules/authz/msgs/MsgGrant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,
|
|
1
|
+
{"version":3,"file":"MsgGrant.d.ts","sourceRoot":"","sources":["../../../../../../src/core/modules/authz/msgs/MsgGrant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,EAExB,MAAM,8BAA8B,CAAA;AAIrC,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,UAAiB,MAAM;QACrB;;WAEG;QACH,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,aAAa,CAAC,EAAE,iBAAiB,CAAC,GAAG,CAAA;QACrC,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;QACf,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,eAAe,CAAC,EAAE,MAAM,CAAA;KACzB;IAED,KAAY,KAAK,GAAG,oBAAoB,CAAC,QAAQ,CAAA;IAEjD,KAAY,MAAM,GAAG,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG;QACjE,IAAI,EAAE,GAAG,CAAA;KACV,CAAA;CACF;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC;IAC5E,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAG,QAAQ;IAI3C,OAAO;IA2BP,MAAM;;;;;;IASN,OAAO;;;;IAyBP,YAAY;;;;IASZ,MAAM;;;;;;;;;;;;IAuBb,OAAO,CAAC,YAAY;IA8Bb,QAAQ,IAAI,UAAU;CAG9B"}
|
|
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const MsgBase_1 = require("../../MsgBase");
|
|
7
7
|
const snakecase_keys_1 = __importDefault(require("snakecase-keys"));
|
|
8
8
|
const core_proto_ts_1 = require("@injectivelabs/core-proto-ts");
|
|
9
|
-
const
|
|
9
|
+
const exceptions_1 = require("@injectivelabs/exceptions");
|
|
10
|
+
const utils_1 = require("../utils");
|
|
10
11
|
/**
|
|
11
12
|
* @category Messages
|
|
12
13
|
*/
|
|
@@ -17,14 +18,14 @@ class MsgGrant extends MsgBase_1.MsgBase {
|
|
|
17
18
|
toProto() {
|
|
18
19
|
const { params } = this;
|
|
19
20
|
const timestamp = this.getTimestamp();
|
|
20
|
-
const genericAuthorization = core_proto_ts_1.CosmosAuthzV1Beta1Authz.GenericAuthorization.create();
|
|
21
|
-
genericAuthorization.msg = params.messageType;
|
|
22
|
-
const authorization = core_proto_ts_1.GoogleProtobufAny.Any.create();
|
|
23
|
-
authorization.typeUrl = genericAuthorizationType;
|
|
24
|
-
authorization.value = Buffer.from(core_proto_ts_1.CosmosAuthzV1Beta1Authz.GenericAuthorization.encode(genericAuthorization).finish());
|
|
25
21
|
const grant = core_proto_ts_1.CosmosAuthzV1Beta1Authz.Grant.create();
|
|
26
|
-
|
|
22
|
+
if (!params.authorization && !params.messageType) {
|
|
23
|
+
throw new exceptions_1.GeneralException(new Error('Either authorization or messageType must be provided'));
|
|
24
|
+
}
|
|
25
|
+
const authorization = params.authorization ||
|
|
26
|
+
(0, utils_1.getGenericAuthorizationFromMessageType)(params.messageType);
|
|
27
27
|
grant.authorization = authorization;
|
|
28
|
+
grant.expiration = new Date(Number(timestamp.seconds) * 1000);
|
|
28
29
|
const message = core_proto_ts_1.CosmosAuthzV1Beta1Tx.MsgGrant.create();
|
|
29
30
|
message.grantee = params.grantee;
|
|
30
31
|
message.granter = params.granter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MsgGrant.js","sourceRoot":"","sources":["../../../../../../src/core/modules/authz/msgs/MsgGrant.ts"],"names":[],"mappings":";;;;;AAAA,2CAAuC;AACvC,oEAA0C;AAC1C,gEAKqC;
|
|
1
|
+
{"version":3,"file":"MsgGrant.js","sourceRoot":"","sources":["../../../../../../src/core/modules/authz/msgs/MsgGrant.ts"],"names":[],"mappings":";;;;;AAAA,2CAAuC;AACvC,oEAA0C;AAC1C,gEAKqC;AACrC,0DAA4D;AAC5D,oCAAiE;AAuBjE;;GAEG;AACH,MAAqB,QAAS,SAAQ,iBAAwC;IAC5E,MAAM,CAAC,QAAQ,CAAC,MAAuB;QACrC,OAAO,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC7B,CAAC;IAEM,OAAO;QACZ,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;QAEvB,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,EAAE,CAAA;QACrC,MAAM,KAAK,GAAG,uCAAuB,CAAC,KAAK,CAAC,MAAM,EAAE,CAAA;QAEpD,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;YACjD,MAAM,IAAI,6BAAgB,CACxB,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAClE,CAAA;QACH,CAAC;QAED,MAAM,aAAa,GACjB,MAAM,CAAC,aAAa;YACpB,IAAA,8CAAsC,EAAC,MAAM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AkB,CAAC,EACpE,OAAO,CAAC,QAAQ,EAAE,EAClB,OAAO,CAAC,OAAO,EAAE,CAClB,CAAA;QAED,MAAM,SAAS,GAAG,uCAAuB,CAAC,SAAS,CAAC,MAAM,EAAE,CAAA;QAC5D,MAAM,kBAAkB,GAAG,CACzB,UAAU,CAAC,OAAO,EAAE,GAAG,IAAI;YAC3B,CAAC,MAAM,CAAC,eAAe,IAAI,CAAC,CAAC,CAC9B,CAAC,QAAQ,EAAE,CAAA;QAEZ,SAAS,CAAC,OAAO,GAAG,kBAAkB,CAAA;QAEtC,OAAO,SAAS,CAAA;IAClB,CAAC;IAEM,QAAQ;QACb,OAAO,oCAAoB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAA;IACtE,CAAC;CACF;AAnID,2BAmIC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { Msgs } from './../msgs';
|
|
2
|
+
import { GoogleProtobufAny } from '@injectivelabs/core-proto-ts';
|
|
2
3
|
export declare const msgsOrMsgExecMsgs: (msgs: Msgs | Msgs[], grantee?: string) => Msgs[];
|
|
4
|
+
export declare const getGenericAuthorizationFromMessageType: (messageTypeUrl: string) => GoogleProtobufAny.Any;
|
|
3
5
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/core/modules/authz/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/core/modules/authz/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EACL,iBAAiB,EAElB,MAAM,8BAA8B,CAAA;AAErC,eAAO,MAAM,iBAAiB,SACtB,IAAI,GAAG,IAAI,EAAE,YACT,MAAM,KACf,IAAI,EAQN,CAAA;AAED,eAAO,MAAM,sCAAsC,mBACjC,MAAM,0BAiBvB,CAAA"}
|
|
@@ -3,8 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.msgsOrMsgExecMsgs = void 0;
|
|
6
|
+
exports.getGenericAuthorizationFromMessageType = exports.msgsOrMsgExecMsgs = void 0;
|
|
7
7
|
const MsgExec_1 = __importDefault(require("./msgs/MsgExec"));
|
|
8
|
+
const core_proto_ts_1 = require("@injectivelabs/core-proto-ts");
|
|
8
9
|
const msgsOrMsgExecMsgs = (msgs, grantee) => {
|
|
9
10
|
const actualMsgs = Array.isArray(msgs) ? msgs : [msgs];
|
|
10
11
|
if (!grantee) {
|
|
@@ -13,4 +14,14 @@ const msgsOrMsgExecMsgs = (msgs, grantee) => {
|
|
|
13
14
|
return actualMsgs.map((msg) => MsgExec_1.default.fromJSON({ grantee, msgs: msg }));
|
|
14
15
|
};
|
|
15
16
|
exports.msgsOrMsgExecMsgs = msgsOrMsgExecMsgs;
|
|
17
|
+
const getGenericAuthorizationFromMessageType = (messageTypeUrl) => {
|
|
18
|
+
const genericAuthorizationType = '/cosmos.authz.v1beta1.GenericAuthorization';
|
|
19
|
+
const genericAuthorization = core_proto_ts_1.CosmosAuthzV1Beta1Authz.GenericAuthorization.create();
|
|
20
|
+
genericAuthorization.msg = messageTypeUrl;
|
|
21
|
+
const authorization = core_proto_ts_1.GoogleProtobufAny.Any.create();
|
|
22
|
+
authorization.typeUrl = genericAuthorizationType;
|
|
23
|
+
authorization.value = Buffer.from(core_proto_ts_1.CosmosAuthzV1Beta1Authz.GenericAuthorization.encode(genericAuthorization).finish());
|
|
24
|
+
return authorization;
|
|
25
|
+
};
|
|
26
|
+
exports.getGenericAuthorizationFromMessageType = getGenericAuthorizationFromMessageType;
|
|
16
27
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/core/modules/authz/utils.ts"],"names":[],"mappings":";;;;;;AAAA,6DAAoC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/core/modules/authz/utils.ts"],"names":[],"mappings":";;;;;;AAAA,6DAAoC;AAEpC,gEAGqC;AAE9B,MAAM,iBAAiB,GAAG,CAC/B,IAAmB,EACnB,OAAgB,EACR,EAAE;IACV,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAEtD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,UAAU,CAAA;IACnB,CAAC;IAED,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,iBAAO,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAA;AAC1E,CAAC,CAAA;AAXY,QAAA,iBAAiB,qBAW7B;AAEM,MAAM,sCAAsC,GAAG,CACpD,cAAsB,EACtB,EAAE;IACF,MAAM,wBAAwB,GAAG,4CAA4C,CAAA;IAE7E,MAAM,oBAAoB,GACxB,uCAAuB,CAAC,oBAAoB,CAAC,MAAM,EAAE,CAAA;IACvD,oBAAoB,CAAC,GAAG,GAAG,cAAc,CAAA;IAEzC,MAAM,aAAa,GAAG,iCAAiB,CAAC,GAAG,CAAC,MAAM,EAAE,CAAA;IACpD,aAAa,CAAC,OAAO,GAAG,wBAAwB,CAAA;IAChD,aAAa,CAAC,KAAK,GAAG,MAAM,CAAC,IAAI,CAC/B,uCAAuB,CAAC,oBAAoB,CAAC,MAAM,CACjD,oBAAoB,CACrB,CAAC,MAAM,EAAE,CACX,CAAA;IAED,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA;AAlBY,QAAA,sCAAsC,0CAkBlD"}
|
|
@@ -15,28 +15,15 @@ export declare class ChainGrpcAuthZApi extends BaseGrpcConsumer {
|
|
|
15
15
|
msgTypeUrl?: string;
|
|
16
16
|
}): Promise<{
|
|
17
17
|
pagination: import("../../../types/pagination").Pagination;
|
|
18
|
-
grants:
|
|
19
|
-
authorization: string;
|
|
20
|
-
expiration: Date | undefined;
|
|
21
|
-
}[];
|
|
18
|
+
grants: import("../types").GrantWithDecodedAuthorization[];
|
|
22
19
|
}>;
|
|
23
20
|
fetchGranterGrants(granter: string, pagination?: PaginationOption): Promise<{
|
|
24
21
|
pagination: import("../../../types/pagination").Pagination;
|
|
25
|
-
grants:
|
|
26
|
-
granter: string;
|
|
27
|
-
grantee: string;
|
|
28
|
-
authorization: string;
|
|
29
|
-
expiration: Date | undefined;
|
|
30
|
-
}[];
|
|
22
|
+
grants: import("../types").GrantAuthorizationWithDecodedAuthorization[];
|
|
31
23
|
}>;
|
|
32
24
|
fetchGranteeGrants(grantee: string, pagination?: PaginationOption): Promise<{
|
|
33
25
|
pagination: import("../../../types/pagination").Pagination;
|
|
34
|
-
grants:
|
|
35
|
-
granter: string;
|
|
36
|
-
grantee: string;
|
|
37
|
-
authorization: string;
|
|
38
|
-
expiration: Date | undefined;
|
|
39
|
-
}[];
|
|
26
|
+
grants: import("../types").GrantAuthorizationWithDecodedAuthorization[];
|
|
40
27
|
}>;
|
|
41
28
|
}
|
|
42
29
|
//# sourceMappingURL=ChainGrpcAuthZApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChainGrpcAuthZApi.d.ts","sourceRoot":"","sources":["../../../../../src/client/chain/grpc/ChainGrpcAuthZApi.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,gBAAgB,MAAM,6BAA6B,CAAA;AAE1D,OAAO,EAAE,gBAAgB,E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AsCxE"}
|
|
@@ -1,42 +1,22 @@
|
|
|
1
1
|
import { CosmosAuthzV1Beta1Authz, CosmosAuthzV1Beta1Query } from '@injectivelabs/core-proto-ts';
|
|
2
|
+
import { GrantAuthorizationWithDecodedAuthorization, GrantWithDecodedAuthorization } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* @category Chain Grpc Transformer
|
|
4
5
|
*/
|
|
5
6
|
export declare class ChainGrpcAuthZTransformer {
|
|
6
|
-
static grpcGrantToGrant(grant: CosmosAuthzV1Beta1Authz.Grant):
|
|
7
|
-
|
|
8
|
-
expiration: Date | undefined;
|
|
9
|
-
};
|
|
10
|
-
static grpcGrantAuthorizationToGrantAuthorization(grant: CosmosAuthzV1Beta1Authz.GrantAuthorization): {
|
|
11
|
-
granter: string;
|
|
12
|
-
grantee: string;
|
|
13
|
-
authorization: string;
|
|
14
|
-
expiration: Date | undefined;
|
|
15
|
-
};
|
|
7
|
+
static grpcGrantToGrant(grant: CosmosAuthzV1Beta1Authz.Grant): GrantWithDecodedAuthorization;
|
|
8
|
+
static grpcGrantAuthorizationToGrantAuthorization(grant: CosmosAuthzV1Beta1Authz.GrantAuthorization): GrantAuthorizationWithDecodedAuthorization;
|
|
16
9
|
static grpcGrantsToGrants(response: CosmosAuthzV1Beta1Query.QueryGrantsResponse): {
|
|
17
10
|
pagination: import("../../..").Pagination;
|
|
18
|
-
grants:
|
|
19
|
-
authorization: string;
|
|
20
|
-
expiration: Date | undefined;
|
|
21
|
-
}[];
|
|
11
|
+
grants: GrantWithDecodedAuthorization[];
|
|
22
12
|
};
|
|
23
13
|
static grpcGranteeGrantsToGranteeGrants(response: CosmosAuthzV1Beta1Query.QueryGranteeGrantsResponse): {
|
|
24
14
|
pagination: import("../../..").Pagination;
|
|
25
|
-
grants:
|
|
26
|
-
granter: string;
|
|
27
|
-
grantee: string;
|
|
28
|
-
authorization: string;
|
|
29
|
-
expiration: Date | undefined;
|
|
30
|
-
}[];
|
|
15
|
+
grants: GrantAuthorizationWithDecodedAuthorization[];
|
|
31
16
|
};
|
|
32
17
|
static grpcGranterGrantsToGranterGrants(response: CosmosAuthzV1Beta1Query.QueryGranterGrantsResponse): {
|
|
33
18
|
pagination: import("../../..").Pagination;
|
|
34
|
-
grants:
|
|
35
|
-
granter: string;
|
|
36
|
-
grantee: string;
|
|
37
|
-
authorization: string;
|
|
38
|
-
expiration: Date | undefined;
|
|
39
|
-
}[];
|
|
19
|
+
grants: GrantAuthorizationWithDecodedAuthorization[];
|
|
40
20
|
};
|
|
41
21
|
}
|
|
42
22
|
//# sourceMappingURL=ChainGrpcAuthZTransformer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChainGrpcAuthZTransformer.d.ts","sourceRoot":"","sources":["../../../../../src/client/chain/transformers/ChainGrpcAuthZTransformer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChainGrpcAuthZTransformer.d.ts","sourceRoot":"","sources":["../../../../../src/client/chain/transformers/ChainGrpcAuthZTransformer.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,0CAA0C,EAC1C,6BAA6B,EAC9B,MAAM,UAAU,CAAA;AAEjB;;GAEG;AACH,qBAAa,yBAAyB;IACpC,MAAM,CAAC,gBAAgB,CACrB,KAAK,EAAE,uBAAuB,CAAC,KAAK,GACnC,6BAA6B;IAUhC,MAAM,CAAC,0CAA0C,CAC/C,KAAK,EAAE,uBAAuB,CAAC,kBAAkB,GAChD,0CAA0C;IAY7C,MAAM,CAAC,kBAAkB,CACvB,QAAQ,EAAE,uBAAuB,CAAC,mBAAmB;;;;IAQvD,MAAM,CAAC,gCAAgC,CACrC,QAAQ,EAAE,uBAAuB,CAAC,0BAA0B;;;;IAU9D,MAAM,CAAC,gCAAgC,CACrC,QAAQ,EAAE,uBAAuB,CAAC,0BAA0B;;;;CAS/D"}
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
+
import { GeneralException } from '@injectivelabs/exceptions';
|
|
1
2
|
import { grpcPaginationToPagination } from '../../../utils/pagination';
|
|
3
|
+
import { CosmosAuthzV1Beta1Authz, } from '@injectivelabs/core-proto-ts';
|
|
2
4
|
/**
|
|
3
5
|
* @category Chain Grpc Transformer
|
|
4
6
|
*/
|
|
5
7
|
export class ChainGrpcAuthZTransformer {
|
|
6
8
|
static grpcGrantToGrant(grant) {
|
|
9
|
+
const authorization = decodeAuthorizationNoThrow(grant.authorization);
|
|
7
10
|
return {
|
|
8
|
-
authorization:
|
|
11
|
+
authorization: authorization?.authorization,
|
|
12
|
+
authorizationType: authorization?.authorizationType || '',
|
|
9
13
|
expiration: grant.expiration,
|
|
10
14
|
};
|
|
11
15
|
}
|
|
12
16
|
static grpcGrantAuthorizationToGrantAuthorization(grant) {
|
|
17
|
+
const authorization = decodeAuthorizationNoThrow(grant.authorization);
|
|
13
18
|
return {
|
|
14
19
|
granter: grant.granter,
|
|
15
20
|
grantee: grant.grantee,
|
|
16
|
-
authorization:
|
|
21
|
+
authorization: authorization?.authorization,
|
|
22
|
+
authorizationType: authorization?.authorizationType || '',
|
|
17
23
|
expiration: grant.expiration,
|
|
18
24
|
};
|
|
19
25
|
}
|
|
@@ -37,14 +43,25 @@ export class ChainGrpcAuthZTransformer {
|
|
|
37
43
|
}
|
|
38
44
|
}
|
|
39
45
|
const decodeAuthorization = (authorization) => {
|
|
40
|
-
if (!authorization) {
|
|
41
|
-
return '';
|
|
42
|
-
}
|
|
43
46
|
switch (authorization.typeUrl) {
|
|
44
47
|
case '/cosmos.authz.v1beta1.GenericAuthorization':
|
|
45
|
-
return
|
|
48
|
+
return {
|
|
49
|
+
authorization: CosmosAuthzV1Beta1Authz.GenericAuthorization.decode(authorization.value),
|
|
50
|
+
authorizationType: '/cosmos.authz.v1beta1.GenericAuthorization',
|
|
51
|
+
};
|
|
46
52
|
default:
|
|
47
|
-
|
|
53
|
+
throw new GeneralException(new Error('Unsupported authorization type'));
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const decodeAuthorizationNoThrow = (authorization) => {
|
|
57
|
+
if (!authorization) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
return decodeAuthorization(authorization);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return undefined;
|
|
48
65
|
}
|
|
49
66
|
};
|
|
50
67
|
//# sourceMappingURL=ChainGrpcAuthZTransformer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChainGrpcAuthZTransformer.js","sourceRoot":"","sources":["../../../../../src/client/chain/transformers/ChainGrpcAuthZTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"ChainGrpcAuthZTransformer.js","sourceRoot":"","sources":["../../../../../src/client/chain/transformers/ChainGrpcAuthZTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAA;AACtE,OAAO,EAEL,uBAAuB,GAExB,MAAM,8BAA8B,CAAA;AAMrC;;GAEG;AACH,MAAM,OAAO,yBAAyB;IACpC,MAAM,CAAC,gBAAgB,CACrB,KAAoC;QAEpC,MAAM,aAAa,GAAG,0BAA0B,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;QAErE,OAAO;YACL,aAAa,EAAE,aAAa,EAAE,aAAa;YAC3C,iBAAiB,EAAE,aAAa,EAAE,iBAAiB,IAAI,EAAE;YACzD,UAAU,EAAE,KAAK,CAAC,UAAU;SAC7B,CAAA;IACH,CAAC;IAED,MAAM,CAAC,0CAA0C,CAC/C,KAAiD;QAEjD,MAAM,aAAa,GAAG,0BAA0B,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;QAErE,OAAO;YACL,OAAO,EA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,0BAA0B,GAAG,CAAC,aAAqC,EAAE,EAAE;IAC3E,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,IAAI,CAAC;QACH,OAAO,mBAAmB,CAAC,aAAa,CAAC,CAAA;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CosmosAuthzV1Beta1Authz, InjectiveExchangeV1Beta1Authz } from '@injectivelabs/core-proto-ts';
|
|
2
2
|
export type Grant = CosmosAuthzV1Beta1Authz.Grant;
|
|
3
3
|
export type GrantAuthorization = CosmosAuthzV1Beta1Authz.GrantAuthorization;
|
|
4
|
+
export type GenericAuthorization = CosmosAuthzV1Beta1Authz.GenericAuthorization;
|
|
4
5
|
export type CreateSpotLimitOrderAuthz = InjectiveExchangeV1Beta1Authz.CreateSpotLimitOrderAuthz;
|
|
5
6
|
export type CreateSpotMarketOrderAuthz = InjectiveExchangeV1Beta1Authz.CreateSpotMarketOrderAuthz;
|
|
6
7
|
export type BatchCreateSpotLimitOrdersAuthz = InjectiveExchangeV1Beta1Authz.BatchCreateSpotLimitOrdersAuthz;
|
|
@@ -11,4 +12,15 @@ export type CreateDerivativeMarketOrderAuthz = InjectiveExchangeV1Beta1Authz.Cre
|
|
|
11
12
|
export type BatchCreateDerivativeLimitOrdersAuthz = InjectiveExchangeV1Beta1Authz.BatchCreateDerivativeLimitOrdersAuthz;
|
|
12
13
|
export type CancelDerivativeOrderAuthz = InjectiveExchangeV1Beta1Authz.CancelDerivativeOrderAuthz;
|
|
13
14
|
export type BatchCancelDerivativeOrdersAuthz = InjectiveExchangeV1Beta1Authz.BatchCancelDerivativeOrdersAuthz;
|
|
15
|
+
export interface GrantWithDecodedAuthorization extends Omit<Grant, 'authorization'> {
|
|
16
|
+
authorization: GenericAuthorization | undefined; /** Todo: add more authorizations */
|
|
17
|
+
authorizationType: string;
|
|
18
|
+
}
|
|
19
|
+
export interface GrantAuthorizationWithDecodedAuthorization extends Omit<GrantAuthorization, 'authorization'> {
|
|
20
|
+
authorization: GenericAuthorization | undefined; /** Todo: add more authorizations */
|
|
21
|
+
authorizationType: string;
|
|
22
|
+
}
|
|
23
|
+
export declare enum GrantAuthorizationType {
|
|
24
|
+
GenericAuthorization = "GenericAuthorization"
|
|
25
|
+
}
|
|
14
26
|
//# sourceMappingURL=authZ.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authZ.d.ts","sourceRoot":"","sources":["../../../../../src/client/chain/types/authZ.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,8BAA8B,CAAA;AAErC,MAAM,MAAM,KAAK,GAAG,uBAAuB,CAAC,KAAK,CAAA;AACjD,MAAM,MAAM,kBAAkB,GAAG,uBAAuB,CAAC,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"authZ.d.ts","sourceRoot":"","sources":["../../../../../src/client/chain/types/authZ.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,8BAA8B,CAAA;AAErC,MAAM,MAAM,KAAK,GAAG,uBAAuB,CAAC,KAAK,CAAA;AACjD,MAAM,MAAM,kBAAkB,GAAG,uBAAuB,CAAC,kBAAkB,CAAA;AAC3E,MAAM,MAAM,oBAAoB,GAAG,uBAAuB,CAAC,oBAAoB,CAAA;AAE/E,MAAM,MAAM,yBAAyB,GACnC,6BAA6B,CAAC,yBAAyB,CAAA;AACzD,MAAM,MAAM,0BAA0B,GACpC,6BAA6B,CAAC,0BAA0B,CAAA;AAC1D,MAAM,MAAM,+BAA+B,GACzC,6BAA6B,CAAC,+BAA+B,CAAA;AAC/D,MAAM,MAAM,oBAAoB,GAC9B,6BAA6B,CAAC,oBAAoB,CAAA;AACpD,MAAM,MAAM,0BAA0B,GACpC,6BAA6B,CAAC,0BAA0B,CAAA;AAE1D,MAAM,MAAM,+BAA+B,GACzC,6BAA6B,CAAC,+BAA+B,CAAA;AAC/D,MAAM,MAAM,gCAAgC,GAC1C,6BAA6B,CAAC,gCAAgC,CAAA;AAChE,MAAM,MAAM,qCAAqC,GAC/C,6BAA6B,CAAC,qCAAqC,CAAA;AACrE,MAAM,MAAM,0BAA0B,GACpC,6BAA6B,CAAC,0BAA0B,CAAA;AAC1D,MAAM,MAAM,gCAAgC,GAC1C,6BAA6B,CAAC,gCAAgC,CAAA;AAEhE,MAAM,WAAW,6BACf,SAAQ,IAAI,CAAC,KAAK,EAAE,eAAe,CAAC;IACpC,aAAa,EACT,oBAAoB,GACpB,SAAS,CAAA,CAAC,oCAAoC;IAClD,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AAED,MAAM,WAAW,0CACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,eAAe,CAAC;IACjD,aAAa,EACT,oBAAoB,GACpB,SAAS,CAAA,CAAC,oCAAoC;IAClD,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AAED,oBAAY,sBAAsB;IAChC,oBAAoB,yBAAyB;CAC9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authZ.js","sourceRoot":"","sources":["../../../../../src/client/chain/types/authZ.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"authZ.js","sourceRoot":"","sources":["../../../../../src/client/chain/types/authZ.ts"],"names":[],"mappings":"AA+CA,MAAM,CAAN,IAAY,sBAEX;AAFD,WAAY,sBAAsB;IAChC,uEAA6C,CAAA;AAC/C,CAAC,EAFW,sBAAsB,KAAtB,sBAAsB,QAEjC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { MsgBase } from '../../MsgBase';
|
|
2
|
-
import { CosmosAuthzV1Beta1Tx, CosmosAuthzV1Beta1Authz } from '@injectivelabs/core-proto-ts';
|
|
2
|
+
import { GoogleProtobufAny, CosmosAuthzV1Beta1Tx, CosmosAuthzV1Beta1Authz } from '@injectivelabs/core-proto-ts';
|
|
3
3
|
export declare namespace MsgGrant {
|
|
4
4
|
interface Params {
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use `authorization` instead - for generic authorizations, use `getGenericAuthorizationFromMessageType` function
|
|
7
|
+
*/
|
|
8
|
+
messageType?: string;
|
|
9
|
+
authorization?: GoogleProtobufAny.Any;
|
|
6
10
|
grantee: string;
|
|
7
11
|
granter: string;
|
|
8
12
|
expiration?: number;
|
|
@@ -40,7 +44,7 @@ export default class MsgGrant extends MsgBase<MsgGrant.Params, MsgGrant.Proto> {
|
|
|
40
44
|
grant: {
|
|
41
45
|
authorization: {
|
|
42
46
|
'@type': string;
|
|
43
|
-
msg: string;
|
|
47
|
+
msg: string | undefined;
|
|
44
48
|
};
|
|
45
49
|
expiration: Date;
|
|
46
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MsgGrant.d.ts","sourceRoot":"","sources":["../../../../../../src/core/modules/authz/msgs/MsgGrant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,
|
|
1
|
+
{"version":3,"file":"MsgGrant.d.ts","sourceRoot":"","sources":["../../../../../../src/core/modules/authz/msgs/MsgGrant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,EAExB,MAAM,8BAA8B,CAAA;AAIrC,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,UAAiB,MAAM;QACrB;;WAEG;QACH,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,aAAa,CAAC,EAAE,iBAAiB,CAAC,GAAG,CAAA;QACrC,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;QACf,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,eAAe,CAAC,EAAE,MAAM,CAAA;KACzB;IAED,KAAY,KAAK,GAAG,oBAAoB,CAAC,QAAQ,CAAA;IAEjD,KAAY,MAAM,GAAG,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG;QACjE,IAAI,EAAE,GAAG,CAAA;KACV,CAAA;CACF;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC;IAC5E,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAG,QAAQ;IAI3C,OAAO;IA2BP,MAAM;;;;;;IASN,OAAO;;;;IAyBP,YAAY;;;;IASZ,MAAM;;;;;;;;;;;;IAuBb,OAAO,CAAC,YAAY;IA8Bb,QAAQ,IAAI,UAAU;CAG9B"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { MsgBase } from '../../MsgBase';
|
|
2
2
|
import snakecaseKeys from 'snakecase-keys';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { CosmosAuthzV1Beta1Tx, CosmosAuthzV1Beta1Authz, GoogleProtobufTimestamp, } from '@injectivelabs/core-proto-ts';
|
|
4
|
+
import { GeneralException } from '@injectivelabs/exceptions';
|
|
5
|
+
import { getGenericAuthorizationFromMessageType } from '../utils';
|
|
5
6
|
/**
|
|
6
7
|
* @category Messages
|
|
7
8
|
*/
|
|
@@ -12,14 +13,14 @@ export default class MsgGrant extends MsgBase {
|
|
|
12
13
|
toProto() {
|
|
13
14
|
const { params } = this;
|
|
14
15
|
const timestamp = this.getTimestamp();
|
|
15
|
-
const genericAuthorization = CosmosAuthzV1Beta1Authz.GenericAuthorization.create();
|
|
16
|
-
genericAuthorization.msg = params.messageType;
|
|
17
|
-
const authorization = GoogleProtobufAny.Any.create();
|
|
18
|
-
authorization.typeUrl = genericAuthorizationType;
|
|
19
|
-
authorization.value = Buffer.from(CosmosAuthzV1Beta1Authz.GenericAuthorization.encode(genericAuthorization).finish());
|
|
20
16
|
const grant = CosmosAuthzV1Beta1Authz.Grant.create();
|
|
21
|
-
|
|
17
|
+
if (!params.authorization && !params.messageType) {
|
|
18
|
+
throw new GeneralException(new Error('Either authorization or messageType must be provided'));
|
|
19
|
+
}
|
|
20
|
+
const authorization = params.authorization ||
|
|
21
|
+
getGenericAuthorizationFromMessageType(params.messageType);
|
|
22
22
|
grant.authorization = authorization;
|
|
23
|
+
grant.expiration = new Date(Number(timestamp.seconds) * 1000);
|
|
23
24
|
const message = CosmosAuthzV1Beta1Tx.MsgGrant.create();
|
|
24
25
|
message.grantee = params.grantee;
|
|
25
26
|
message.granter = params.granter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MsgGrant.js","sourceRoot":"","sources":["../../../../../../src/core/modules/authz/msgs/MsgGrant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,aAAa,MAAM,gBAAgB,CAAA;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"MsgGrant.js","sourceRoot":"","sources":["../../../../../../src/core/modules/authz/msgs/MsgGrant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,aAAa,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAEL,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,sCAAsC,EAAE,MAAM,UAAU,CAAA;AAuBjE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,OAAwC;IAC5E,MAAM,CAAC,QAAQ,CAAC,MAAuB;QACrC,OAAO,IAAI,QAAQ,CAAC,MA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,MAAM,EAAE,GAAG,IAAI,CAAA;QAEvB,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YACtB,MAAM,SAAS,GAAG,uBAAuB,CAAC,SAAS,CAAC,MAAM,EAAE,CAAA;YAE5D,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAA;YAEhD,OAAO,SAAS,CAAA;QAClB,CAAC;QAED,MAAM,kBAAkB,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACzD,MAAM,OAAO,GAAG,IAAI,IAAI,EAAE,CAAA;QAC1B,MAAM,UAAU,GAAG,IAAI,IAAI,CACzB,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,aAAa,IAAI,kBAAkB,CAAC,EACpE,OAAO,CAAC,QAAQ,EAAE,EAClB,OAAO,CAAC,OAAO,EAAE,CAClB,CAAA;QAED,MAAM,SAAS,GAAG,uBAAuB,CAAC,SAAS,CAAC,MAAM,EAAE,CAAA;QAC5D,MAAM,kBAAkB,GAAG,CACzB,UAAU,CAAC,OAAO,EAAE,GAAG,IAAI;YAC3B,CAAC,MAAM,CAAC,eAAe,IAAI,CAAC,CAAC,CAC9B,CAAC,QAAQ,EAAE,CAAA;QAEZ,SAAS,CAAC,OAAO,GAAG,kBAAkB,CAAA;QAEtC,OAAO,SAAS,CAAA;IAClB,CAAC;IAEM,QAAQ;QACb,OAAO,oBAAoB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAA;IACtE,CAAC;CACF"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { Msgs } from './../msgs';
|
|
2
|
+
import { GoogleProtobufAny } from '@injectivelabs/core-proto-ts';
|
|
2
3
|
export declare const msgsOrMsgExecMsgs: (msgs: Msgs | Msgs[], grantee?: string) => Msgs[];
|
|
4
|
+
export declare const getGenericAuthorizationFromMessageType: (messageTypeUrl: string) => GoogleProtobufAny.Any;
|
|
3
5
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/core/modules/authz/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/core/modules/authz/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EACL,iBAAiB,EAElB,MAAM,8BAA8B,CAAA;AAErC,eAAO,MAAM,iBAAiB,SACtB,IAAI,GAAG,IAAI,EAAE,YACT,MAAM,KACf,IAAI,EAQN,CAAA;AAED,eAAO,MAAM,sCAAsC,mBACjC,MAAM,0BAiBvB,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import MsgExec from './msgs/MsgExec';
|
|
2
|
+
import { GoogleProtobufAny, CosmosAuthzV1Beta1Authz, } from '@injectivelabs/core-proto-ts';
|
|
2
3
|
export const msgsOrMsgExecMsgs = (msgs, grantee) => {
|
|
3
4
|
const actualMsgs = Array.isArray(msgs) ? msgs : [msgs];
|
|
4
5
|
if (!grantee) {
|
|
@@ -6,4 +7,13 @@ export const msgsOrMsgExecMsgs = (msgs, grantee) => {
|
|
|
6
7
|
}
|
|
7
8
|
return actualMsgs.map((msg) => MsgExec.fromJSON({ grantee, msgs: msg }));
|
|
8
9
|
};
|
|
10
|
+
export const getGenericAuthorizationFromMessageType = (messageTypeUrl) => {
|
|
11
|
+
const genericAuthorizationType = '/cosmos.authz.v1beta1.GenericAuthorization';
|
|
12
|
+
const genericAuthorization = CosmosAuthzV1Beta1Authz.GenericAuthorization.create();
|
|
13
|
+
genericAuthorization.msg = messageTypeUrl;
|
|
14
|
+
const authorization = GoogleProtobufAny.Any.create();
|
|
15
|
+
authorization.typeUrl = genericAuthorizationType;
|
|
16
|
+
authorization.value = Buffer.from(CosmosAuthzV1Beta1Authz.GenericAuthorization.encode(genericAuthorization).finish());
|
|
17
|
+
return authorization;
|
|
18
|
+
};
|
|
9
19
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/core/modules/authz/utils.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/core/modules/authz/utils.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAA;AAEpC,OAAO,EACL,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,8BAA8B,CAAA;AAErC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,IAAmB,EACnB,OAAgB,EACR,EAAE;IACV,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAEtD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,UAAU,CAAA;IACnB,CAAC;IAED,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAA;AAC1E,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,sCAAsC,GAAG,CACpD,cAAsB,EACtB,EAAE;IACF,MAAM,wBAAwB,GAAG,4CAA4C,CAAA;IAE7E,MAAM,oBAAoB,GACxB,uBAAuB,CAAC,oBAAoB,CAAC,MAAM,EAAE,CAAA;IACvD,oBAAoB,CAAC,GAAG,GAAG,cAAc,CAAA;IAEzC,MAAM,aAAa,GAAG,iBAAiB,CAAC,GAAG,CAAC,MAAM,EAAE,CAAA;IACpD,aAAa,CAAC,OAAO,GAAG,wBAAwB,CAAA;IAChD,aAAa,CAAC,KAAK,GAAG,MAAM,CAAC,IAAI,CAC/B,uBAAuB,CAAC,oBAAoB,CAAC,MAAM,CACjD,oBAAoB,CACrB,CAAC,MAAM,EAAE,CACX,CAAA;IAED,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA"}
|
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 browser, node, and react native environment.",
|
|
4
|
-
"version": "1.14.11-beta.
|
|
4
|
+
"version": "1.14.11-beta.65",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"author": {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"shx": "^0.3.2",
|
|
72
72
|
"snakecase-keys": "^5.4.1"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "32da7309811a4e22b82632299bf5d1743c6decf7",
|
|
75
75
|
"typedoc": {
|
|
76
76
|
"entryPoint": "./src/index.ts",
|
|
77
77
|
"readmeFile": "./README.md",
|