carbon-js-sdk 0.7.9 → 0.7.10-beta.2
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/lib/clients/InsightsQueryClient.d.ts +1 -0
- package/lib/clients/InsightsQueryClient.js +10 -0
- package/lib/constant/ibc.js +1 -1
- package/lib/insights/common.d.ts +1 -0
- package/lib/insights/common.js +1 -0
- package/lib/modules/signless.d.ts +6 -0
- package/lib/modules/signless.js +38 -22
- package/lib/provider/amino/types/signless.d.ts +8 -0
- package/lib/provider/amino/types/signless.js +150 -7
- package/lib/util/signless.d.ts +10 -0
- package/lib/util/signless.js +82 -7
- package/package.json +1 -1
|
@@ -48,6 +48,7 @@ declare class InsightsQueryClient {
|
|
|
48
48
|
PositionStats(req: Insights.GetPositionStatsPathParams, query: Insights.GetPositionStatsQueryParams): Promise<Insights.InsightsQueryResponse<Insights.QueryGetPositionStatsResponse>>;
|
|
49
49
|
DenomToGeckoIdMap(): Promise<Insights.InsightsQueryResponse<Insights.QueryDenomToGeckoIdMap>>;
|
|
50
50
|
FundingHistory(query: Insights.QueryGetFundingRateRequest): Promise<Insights.InsightsQueryResponse<Insights.QueryGetFundingRateResponse>>;
|
|
51
|
+
HistoricalFundingHistory(query: Insights.QueryGetFundingRateRequest): Promise<Insights.InsightsQueryResponse<Insights.QueryGetFundingRateResponse>>;
|
|
51
52
|
ProposalVotes(req: Insights.GetProposalVotesPathParams, query: Insights.GetProposalVotesQueryParams): Promise<Insights.InsightsQueryResponse<Insights.QueryGetProposalVotesResponse>>;
|
|
52
53
|
Delegations(req: Insights.GetDelegationsPathParams, query: Insights.GetDelegationsQueryParams): Promise<Insights.InsightsQueryResponse<Insights.QueryGetDelegationsResponse>>;
|
|
53
54
|
OraclePrices(req?: Insights.QueryGetOraclesPriceRequest): Promise<Insights.InsightsQueryResponse<Insights.QueryGetOraclesPriceResponse>>;
|
|
@@ -391,6 +391,16 @@ class InsightsQueryClient {
|
|
|
391
391
|
return response.data;
|
|
392
392
|
});
|
|
393
393
|
}
|
|
394
|
+
HistoricalFundingHistory(query) {
|
|
395
|
+
var _a, _b;
|
|
396
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
397
|
+
const request = this.apiManager.path("market/funding/history", {}, {
|
|
398
|
+
market: (_b = (_a = query.market) === null || _a === void 0 ? void 0 : _a.replace('%2F', '/')) !== null && _b !== void 0 ? _b : "",
|
|
399
|
+
});
|
|
400
|
+
const response = yield request.get();
|
|
401
|
+
return response.data;
|
|
402
|
+
});
|
|
403
|
+
}
|
|
394
404
|
ProposalVotes(req, query) {
|
|
395
405
|
return __awaiter(this, void 0, void 0, function* () {
|
|
396
406
|
const request = this.apiManager.path("proposal/votes", req, query);
|
package/lib/constant/ibc.js
CHANGED
|
@@ -2126,7 +2126,7 @@ exports.factoryIbcMinimalDenomRegex = /^factory:([a-z\d]+):([a-z\d]+)$/i;
|
|
|
2126
2126
|
exports.cosmBridgeRegex = /^wasm\.([a-z\d]+)$/i;
|
|
2127
2127
|
exports.ibcNetworkRegex = /^([a-z\d_-]+)-([\d]+)$/i;
|
|
2128
2128
|
exports.ibcTransferChannelRegex = /^transfer\/channel-(\d+)/i;
|
|
2129
|
-
exports.ibcDefaultGas =
|
|
2129
|
+
exports.ibcDefaultGas = 500000;
|
|
2130
2130
|
exports.DefaultGasPriceStep = {
|
|
2131
2131
|
low: 0.01,
|
|
2132
2132
|
average: 0.025,
|
package/lib/insights/common.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export declare const InsightsEndpoints: {
|
|
|
36
36
|
"competition/leaderboardvolume": string;
|
|
37
37
|
"info/denom_gecko_map": string;
|
|
38
38
|
"market/funding": string;
|
|
39
|
+
"market/funding/history": string;
|
|
39
40
|
"proposal/votes": string;
|
|
40
41
|
"delegations/delegator": string;
|
|
41
42
|
"info/oracles_price": string;
|
package/lib/insights/common.js
CHANGED
|
@@ -48,6 +48,7 @@ exports.InsightsEndpoints = {
|
|
|
48
48
|
"info/denom_gecko_map": "/info/denom_gecko_map",
|
|
49
49
|
//funding
|
|
50
50
|
"market/funding": "/market/funding",
|
|
51
|
+
"market/funding/history": "/market/funding/history",
|
|
51
52
|
// Proposal api
|
|
52
53
|
"proposal/votes": "/gov/proposal/:proposalId/votes",
|
|
53
54
|
// Delegations api
|
|
@@ -3,16 +3,22 @@ import BaseModule from "./base";
|
|
|
3
3
|
export declare class SignlessModule extends BaseModule {
|
|
4
4
|
grantSignlessPermission(params: SignlessModule.GrantSignlessPermissionParams, opts?: CarbonTx.SignTxOpts): Promise<import("..").CarbonWallet.SendTxResponse>;
|
|
5
5
|
queryGranteeDetails(params: SignlessModule.QueryGrantParams): Promise<import("../codec/cosmos/authz/v1beta1/query").QueryGrantsResponse>;
|
|
6
|
+
queryGranteeAllowance(params: SignlessModule.QueryAllowanceParams): Promise<import("../codec/cosmos/feegrant/v1beta1/query").QueryAllowanceResponse>;
|
|
6
7
|
}
|
|
7
8
|
export declare namespace SignlessModule {
|
|
8
9
|
interface GrantSignlessPermissionParams {
|
|
9
10
|
grantee: string;
|
|
10
11
|
granter?: string;
|
|
11
12
|
expiry: Date;
|
|
13
|
+
existingGrantee?: boolean;
|
|
12
14
|
}
|
|
13
15
|
interface QueryGrantParams {
|
|
14
16
|
grantee?: string;
|
|
15
17
|
granter?: string;
|
|
16
18
|
msgTypeUrl?: string;
|
|
17
19
|
}
|
|
20
|
+
interface QueryAllowanceParams {
|
|
21
|
+
grantee?: string;
|
|
22
|
+
granter?: string;
|
|
23
|
+
}
|
|
18
24
|
}
|
package/lib/modules/signless.js
CHANGED
|
@@ -19,12 +19,10 @@ const authz_1 = require("../codec/cosmos/authz/v1beta1/authz");
|
|
|
19
19
|
const feegrant_1 = require("../codec/cosmos/feegrant/v1beta1/feegrant");
|
|
20
20
|
const tx_2 = require("../codec/cosmos/feegrant/v1beta1/tx");
|
|
21
21
|
const signless_1 = require("../util/signless");
|
|
22
|
-
const dayjs_1 = __importDefault(require("dayjs"));
|
|
23
|
-
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
24
22
|
const base_1 = __importDefault(require("./base"));
|
|
25
23
|
class SignlessModule extends base_1.default {
|
|
26
24
|
grantSignlessPermission(params, opts) {
|
|
27
|
-
var _a;
|
|
25
|
+
var _a, _b;
|
|
28
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
27
|
const wallet = this.getWallet();
|
|
30
28
|
const encodedGrantMsgs = signless_1.AuthorizedSignlessMsgs.map((msg) => {
|
|
@@ -47,30 +45,36 @@ class SignlessModule extends base_1.default {
|
|
|
47
45
|
};
|
|
48
46
|
});
|
|
49
47
|
let messages = encodedGrantMsgs;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
typeUrl: util_1.CarbonTx.Types.MsgGrantAllowance,
|
|
55
|
-
value: tx_2.MsgGrantAllowance.fromPartial({
|
|
48
|
+
if (params.existingGrantee) {
|
|
49
|
+
const encodedRevokeAllowanceMsg = [{
|
|
50
|
+
typeUrl: util_1.CarbonTx.Types.MsgRevokeAllowance,
|
|
51
|
+
value: tx_2.MsgRevokeAllowance.fromPartial({
|
|
56
52
|
granter: (_a = params.granter) !== null && _a !== void 0 ? _a : wallet.bech32Address,
|
|
57
53
|
grantee: params.grantee,
|
|
58
|
-
allowance: {
|
|
59
|
-
typeUrl: '/cosmos.feegrant.v1beta1.AllowedMsgAllowance',
|
|
60
|
-
value: feegrant_1.AllowedMsgAllowance.encode(feegrant_1.AllowedMsgAllowance.fromPartial({
|
|
61
|
-
allowance: {
|
|
62
|
-
typeUrl: '/cosmos.feegrant.v1beta1.BasicAllowance',
|
|
63
|
-
value: feegrant_1.BasicAllowance.encode(feegrant_1.BasicAllowance.fromPartial({
|
|
64
|
-
expiration: params.expiry,
|
|
65
|
-
})).finish(),
|
|
66
|
-
},
|
|
67
|
-
allowedMessages: ["/cosmos.authz.v1beta1.MsgExec"],
|
|
68
|
-
})).finish(),
|
|
69
|
-
},
|
|
70
54
|
}),
|
|
71
55
|
}];
|
|
72
|
-
messages =
|
|
56
|
+
messages = messages.concat(encodedRevokeAllowanceMsg);
|
|
73
57
|
}
|
|
58
|
+
const encodedAllowanceMsg = [{
|
|
59
|
+
typeUrl: util_1.CarbonTx.Types.MsgGrantAllowance,
|
|
60
|
+
value: tx_2.MsgGrantAllowance.fromPartial({
|
|
61
|
+
granter: (_b = params.granter) !== null && _b !== void 0 ? _b : wallet.bech32Address,
|
|
62
|
+
grantee: params.grantee,
|
|
63
|
+
allowance: {
|
|
64
|
+
typeUrl: '/cosmos.feegrant.v1beta1.AllowedMsgAllowance',
|
|
65
|
+
value: feegrant_1.AllowedMsgAllowance.encode(feegrant_1.AllowedMsgAllowance.fromPartial({
|
|
66
|
+
allowance: {
|
|
67
|
+
typeUrl: '/cosmos.feegrant.v1beta1.BasicAllowance',
|
|
68
|
+
value: feegrant_1.BasicAllowance.encode(feegrant_1.BasicAllowance.fromPartial({
|
|
69
|
+
expiration: params.expiry,
|
|
70
|
+
})).finish(),
|
|
71
|
+
},
|
|
72
|
+
allowedMessages: ["/cosmos.authz.v1beta1.MsgExec"],
|
|
73
|
+
})).finish(),
|
|
74
|
+
},
|
|
75
|
+
}),
|
|
76
|
+
}];
|
|
77
|
+
messages = messages.concat(encodedAllowanceMsg);
|
|
74
78
|
const result = yield wallet.sendTxs(messages, opts);
|
|
75
79
|
return result;
|
|
76
80
|
});
|
|
@@ -88,5 +92,17 @@ class SignlessModule extends base_1.default {
|
|
|
88
92
|
return response;
|
|
89
93
|
});
|
|
90
94
|
}
|
|
95
|
+
queryGranteeAllowance(params) {
|
|
96
|
+
var _a, _b;
|
|
97
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
const wallet = this.getWallet();
|
|
99
|
+
const queryParams = {
|
|
100
|
+
grantee: (_a = params.grantee) !== null && _a !== void 0 ? _a : '',
|
|
101
|
+
granter: (_b = params.granter) !== null && _b !== void 0 ? _b : wallet.bech32Address,
|
|
102
|
+
};
|
|
103
|
+
const response = yield this.sdkProvider.query.feegrant.Allowance(queryParams);
|
|
104
|
+
return response;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
91
107
|
}
|
|
92
108
|
exports.SignlessModule = SignlessModule;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { TypeUtils } from "../../../util";
|
|
2
2
|
import { AminoConverter } from "@cosmjs/stargate";
|
|
3
|
+
export declare enum SignlessTypes {
|
|
4
|
+
GrantAuthz = "/cosmos.authz.v1beta1.MsgGrant",
|
|
5
|
+
FeeGrant = "/cosmos.feegrant.v1beta1.MsgGrantAllowance",
|
|
6
|
+
MsgExec = "/cosmos.authz.v1beta1.MsgExec",
|
|
7
|
+
GenericAuthorization = "/cosmos.authz.v1beta1.GenericAuthorization",
|
|
8
|
+
AllowedMsgAllowance = "/cosmos.feegrant.v1beta1.AllowedMsgAllowance",
|
|
9
|
+
BasicAllowance = "/cosmos.feegrant.v1beta1.BasicAllowance"
|
|
10
|
+
}
|
|
3
11
|
declare const SignlessAmino: TypeUtils.SimpleMap<AminoConverter>;
|
|
4
12
|
export default SignlessAmino;
|
|
@@ -19,28 +19,171 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.SignlessTypes = void 0;
|
|
23
|
+
const authz_1 = require("../../../codec/cosmos/authz/v1beta1/authz");
|
|
24
|
+
const tx_1 = require("../../../codec/cosmos/feegrant/v1beta1/tx");
|
|
25
|
+
const util_1 = require("../../../util");
|
|
22
26
|
const CarbonTx = __importStar(require("../../../util/tx"));
|
|
23
27
|
const utils_1 = require("../utils");
|
|
24
28
|
const TxTypes = {
|
|
25
|
-
GrantAuthz: "
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
GrantAuthz: "cosmos-sdk/MsgGrant",
|
|
30
|
+
GrantAllowance: "cosmos-sdk/MsgGrantAllowance",
|
|
31
|
+
RevokeFeegrant: "cosmos-sdk/MsgRevokeAllowance",
|
|
32
|
+
MsgExec: "cosmos-sdk/MsgExec",
|
|
33
|
+
};
|
|
34
|
+
var SignlessTypes;
|
|
35
|
+
(function (SignlessTypes) {
|
|
36
|
+
SignlessTypes["GrantAuthz"] = "/cosmos.authz.v1beta1.MsgGrant";
|
|
37
|
+
SignlessTypes["FeeGrant"] = "/cosmos.feegrant.v1beta1.MsgGrantAllowance";
|
|
38
|
+
SignlessTypes["MsgExec"] = "/cosmos.authz.v1beta1.MsgExec";
|
|
39
|
+
SignlessTypes["GenericAuthorization"] = "/cosmos.authz.v1beta1.GenericAuthorization";
|
|
40
|
+
SignlessTypes["AllowedMsgAllowance"] = "/cosmos.feegrant.v1beta1.AllowedMsgAllowance";
|
|
41
|
+
SignlessTypes["BasicAllowance"] = "/cosmos.feegrant.v1beta1.BasicAllowance";
|
|
42
|
+
})(SignlessTypes = exports.SignlessTypes || (exports.SignlessTypes = {}));
|
|
43
|
+
const ContentTypes = {
|
|
44
|
+
[SignlessTypes.GenericAuthorization]: "cosmos-sdk/GenericAuthorization",
|
|
45
|
+
[SignlessTypes.AllowedMsgAllowance]: "cosmos-sdk/AllowedMsgAllowance",
|
|
46
|
+
[SignlessTypes.BasicAllowance]: "cosmos-sdk/BasicAllowance",
|
|
47
|
+
};
|
|
48
|
+
const GenericAuthorizationAminoType = {
|
|
49
|
+
aminoType: ContentTypes[SignlessTypes.GenericAuthorization],
|
|
50
|
+
valueMap: {},
|
|
51
|
+
};
|
|
52
|
+
const AllowedMsgAllowanceAminoType = {
|
|
53
|
+
aminoType: ContentTypes[SignlessTypes.AllowedMsgAllowance],
|
|
54
|
+
valueMap: {},
|
|
55
|
+
};
|
|
56
|
+
const BasicAllowanceAminoType = {
|
|
57
|
+
aminoType: ContentTypes[SignlessTypes.BasicAllowance],
|
|
58
|
+
valueMap: {
|
|
59
|
+
expiration: utils_1.ConvertEncType.Date,
|
|
60
|
+
},
|
|
28
61
|
};
|
|
29
62
|
const MsgGrantAuthz = {
|
|
30
63
|
aminoType: TxTypes.GrantAuthz,
|
|
64
|
+
valueMap: {
|
|
65
|
+
grant: {
|
|
66
|
+
expiration: utils_1.ConvertEncType.Date,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
const MsgFeeGrantAllowance = {
|
|
71
|
+
aminoType: TxTypes.GrantAllowance,
|
|
31
72
|
valueMap: {},
|
|
32
73
|
};
|
|
33
|
-
const
|
|
34
|
-
aminoType: TxTypes.
|
|
74
|
+
const MsgRevokeAllowance = {
|
|
75
|
+
aminoType: TxTypes.RevokeFeegrant,
|
|
35
76
|
valueMap: {},
|
|
36
77
|
};
|
|
37
78
|
const MsgExec = {
|
|
38
79
|
aminoType: TxTypes.MsgExec,
|
|
39
80
|
valueMap: {},
|
|
40
81
|
};
|
|
82
|
+
const GenericAuthorizationAmino = {
|
|
83
|
+
value: {
|
|
84
|
+
msg: utils_1.ConvertEncType,
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
const MsgFeeGrantAllowanceAmino = {
|
|
88
|
+
value: {
|
|
89
|
+
msg: utils_1.ConvertEncType,
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
const preProcessAmino = (value, valueMap) => {
|
|
93
|
+
return utils_1.mapEachIndiv(value, valueMap, false);
|
|
94
|
+
};
|
|
95
|
+
const checkDecodeGrantAuthz = (content, amino) => {
|
|
96
|
+
const decodedValue = util_1.SignlessUtils.decodeContent(content);
|
|
97
|
+
const newContent = {
|
|
98
|
+
type: ContentTypes[content.typeUrl],
|
|
99
|
+
value: decodedValue.value,
|
|
100
|
+
};
|
|
101
|
+
const newAmino = Object.assign({}, amino);
|
|
102
|
+
newAmino.content = Object.assign({}, GenericAuthorizationAmino.value);
|
|
103
|
+
return {
|
|
104
|
+
newContent,
|
|
105
|
+
newAmino,
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
const checkEncodeGrantAuthz = (content, amino) => {
|
|
109
|
+
const grantAuthzMsg = preProcessAmino(content.value, GenericAuthorizationAmino.value.msg);
|
|
110
|
+
const grantAuthzProp = authz_1.GenericAuthorization.fromPartial(Object.assign(Object.assign({}, content.value), { msg: grantAuthzMsg }));
|
|
111
|
+
return {
|
|
112
|
+
newContent: {
|
|
113
|
+
typeUrl: SignlessTypes.GenericAuthorization,
|
|
114
|
+
value: authz_1.GenericAuthorization.encode(grantAuthzProp).finish(),
|
|
115
|
+
},
|
|
116
|
+
newAmino: Object.assign({}, amino),
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
const grantAuthzAminoProcess = {
|
|
120
|
+
toAminoProcess: (amino, input) => {
|
|
121
|
+
const { grant } = input;
|
|
122
|
+
const propResponse = checkDecodeGrantAuthz(grant === null || grant === void 0 ? void 0 : grant.authorization, amino);
|
|
123
|
+
return {
|
|
124
|
+
amino: propResponse.newAmino,
|
|
125
|
+
input: Object.assign(Object.assign({}, input), { grant: Object.assign(Object.assign({}, grant), { authorization: propResponse.newContent }) }),
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
fromAminoProcess: (amino, input) => {
|
|
129
|
+
const { grant } = input;
|
|
130
|
+
const propResponse = checkEncodeGrantAuthz(grant === null || grant === void 0 ? void 0 : grant.authorization, amino);
|
|
131
|
+
return Object.assign(Object.assign({ amino: propResponse.newAmino }, input), { grant: Object.assign(Object.assign({}, grant), { authorization: propResponse.newContent }) });
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
const checkEncodeFeegrant = (content, amino) => {
|
|
135
|
+
const msg = preProcessAmino(content.value, MsgFeeGrantAllowanceAmino.value.msg);
|
|
136
|
+
const grantAllowance = tx_1.MsgGrantAllowance.fromPartial(Object.assign(Object.assign({}, content.value), { msg }));
|
|
137
|
+
return {
|
|
138
|
+
newContent: {
|
|
139
|
+
typeUrl: SignlessTypes.FeeGrant,
|
|
140
|
+
value: tx_1.MsgGrantAllowance.encode(grantAllowance).finish(),
|
|
141
|
+
},
|
|
142
|
+
newAmino: Object.assign({}, amino),
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
const checkDecodeFeegrant = (content, amino) => {
|
|
146
|
+
const decodedValue = util_1.SignlessUtils.decodeContent(content);
|
|
147
|
+
decodedValue.value.allowance = {
|
|
148
|
+
type: ContentTypes[decodedValue.value.allowance.typeUrl],
|
|
149
|
+
value: decodedValue.value.allowance.value,
|
|
150
|
+
};
|
|
151
|
+
const newContent = {
|
|
152
|
+
type: ContentTypes[content.typeUrl],
|
|
153
|
+
value: decodedValue.value,
|
|
154
|
+
};
|
|
155
|
+
const newAmino = Object.assign({}, amino);
|
|
156
|
+
newAmino.content = Object.assign({}, MsgFeeGrantAllowanceAmino.value);
|
|
157
|
+
return {
|
|
158
|
+
newContent,
|
|
159
|
+
newAmino,
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
const feegrantAminoProcess = {
|
|
163
|
+
toAminoProcess: (amino, input) => {
|
|
164
|
+
const { allowance } = input;
|
|
165
|
+
const propResponse = checkDecodeFeegrant(allowance, amino);
|
|
166
|
+
return {
|
|
167
|
+
amino: propResponse.newAmino,
|
|
168
|
+
input: Object.assign(Object.assign({}, input), { allowance: propResponse.newContent }),
|
|
169
|
+
};
|
|
170
|
+
},
|
|
171
|
+
fromAminoProcess: (amino, input) => {
|
|
172
|
+
const { allowance } = input;
|
|
173
|
+
const propResponse = checkEncodeFeegrant(allowance, amino);
|
|
174
|
+
return {
|
|
175
|
+
amino: propResponse.newAmino,
|
|
176
|
+
input: Object.assign(Object.assign({}, input), { allowance: propResponse.newContent }),
|
|
177
|
+
};
|
|
178
|
+
},
|
|
179
|
+
};
|
|
41
180
|
const SignlessAmino = {
|
|
42
|
-
[CarbonTx.Types.MsgGrant]: utils_1.generateAminoType(MsgGrantAuthz),
|
|
43
|
-
[CarbonTx.Types.MsgGrantAllowance]: utils_1.generateAminoType(
|
|
181
|
+
[CarbonTx.Types.MsgGrant]: utils_1.generateAminoType(MsgGrantAuthz, grantAuthzAminoProcess),
|
|
182
|
+
[CarbonTx.Types.MsgGrantAllowance]: utils_1.generateAminoType(MsgFeeGrantAllowance, feegrantAminoProcess),
|
|
183
|
+
[CarbonTx.Types.MsgRevokeAllowance]: utils_1.generateAminoType(MsgRevokeAllowance),
|
|
44
184
|
[CarbonTx.Types.MsgExec]: utils_1.generateAminoType(MsgExec),
|
|
185
|
+
[SignlessTypes.GenericAuthorization]: utils_1.generateAminoType(GenericAuthorizationAminoType),
|
|
186
|
+
[SignlessTypes.AllowedMsgAllowance]: utils_1.generateAminoType(AllowedMsgAllowanceAminoType),
|
|
187
|
+
[SignlessTypes.BasicAllowance]: utils_1.generateAminoType(BasicAllowanceAminoType),
|
|
45
188
|
};
|
|
46
189
|
exports.default = SignlessAmino;
|
package/lib/util/signless.d.ts
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
+
import { Any } from "../codec/google/protobuf/any";
|
|
1
2
|
export declare const AuthorizedSignlessMsgs: string[];
|
|
3
|
+
export interface ValueDecoded {
|
|
4
|
+
typeUrl: string;
|
|
5
|
+
value: any;
|
|
6
|
+
}
|
|
7
|
+
export declare const emptyValue: {
|
|
8
|
+
typeUrl: string;
|
|
9
|
+
value: {};
|
|
10
|
+
};
|
|
11
|
+
export declare const decodeContent: (content?: Any | undefined) => ValueDecoded;
|
package/lib/util/signless.js
CHANGED
|
@@ -1,17 +1,92 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthorizedSignlessMsgs = void 0;
|
|
3
|
+
exports.decodeContent = exports.emptyValue = exports.AuthorizedSignlessMsgs = void 0;
|
|
4
4
|
const codec_1 = require("../codec");
|
|
5
|
+
const authz_1 = require("../codec/cosmos/authz/v1beta1/authz");
|
|
6
|
+
const feegrant_1 = require("../codec/cosmos/feegrant/v1beta1/feegrant");
|
|
7
|
+
const signless_1 = require("../provider/amino/types/signless");
|
|
8
|
+
// Increment AUTHORIZED_SIGNLESS_MSGS_VERSION whenever this list is updated
|
|
5
9
|
exports.AuthorizedSignlessMsgs = [
|
|
6
|
-
//
|
|
10
|
+
// alliance
|
|
11
|
+
codec_1.TxTypes.MsgAllianceDelegate,
|
|
12
|
+
codec_1.TxTypes.MsgAllianceUndelegate,
|
|
13
|
+
codec_1.TxTypes.MsgAllianceRedelegate,
|
|
14
|
+
codec_1.TxTypes.MsgAllianceClaimDelegationRewards,
|
|
15
|
+
codec_1.TxTypes.MsgWithdrawDelegatorReward,
|
|
16
|
+
codec_1.TxTypes.MsgAllianceClaimDelegationRewards,
|
|
17
|
+
// cdp
|
|
18
|
+
codec_1.TxTypes.MsgSupplyAsset,
|
|
19
|
+
codec_1.TxTypes.MsgWithdrawAsset,
|
|
20
|
+
codec_1.TxTypes.MsgLockCollateral,
|
|
21
|
+
codec_1.TxTypes.MsgUnlockCollateral,
|
|
22
|
+
codec_1.TxTypes.MsgBorrowAsset,
|
|
23
|
+
codec_1.TxTypes.MsgSupplyAssetAndLockCollateral,
|
|
24
|
+
codec_1.TxTypes.MsgUnlockCollateral,
|
|
25
|
+
codec_1.TxTypes.MsgUnlockCollateralAndWithdrawAsset,
|
|
26
|
+
codec_1.TxTypes.MsgLiquidateCollateral,
|
|
27
|
+
codec_1.TxTypes.MsgLiquidateCollateralWithCdpTokens,
|
|
28
|
+
codec_1.TxTypes.MsgLiquidateCollateralWithCollateral,
|
|
29
|
+
codec_1.TxTypes.MsgLiquidateCollateralWithStablecoin,
|
|
30
|
+
codec_1.TxTypes.MsgRepayAsset,
|
|
31
|
+
codec_1.TxTypes.MsgRepayAssetWithCdpTokens,
|
|
32
|
+
codec_1.TxTypes.MsgRepayAssetWithCollateral,
|
|
33
|
+
codec_1.TxTypes.MsgMintStablecoin,
|
|
34
|
+
codec_1.TxTypes.MsgReturnStablecoin,
|
|
35
|
+
codec_1.TxTypes.MsgClaimRewards,
|
|
36
|
+
codec_1.TxTypes.MsgSetAccountEMode,
|
|
37
|
+
codec_1.TxTypes.MsgRemoveAccountEMode,
|
|
38
|
+
// coin
|
|
39
|
+
codec_1.TxTypes.MsgMintToken,
|
|
40
|
+
codec_1.TxTypes.MsgDepositToGroup,
|
|
41
|
+
codec_1.TxTypes.MsgDepositToGroup,
|
|
42
|
+
codec_1.TxTypes.MsgCreateToken,
|
|
43
|
+
// leverages
|
|
44
|
+
codec_1.TxTypes.MsgSetLeverage,
|
|
45
|
+
// liquiditypool
|
|
46
|
+
codec_1.TxTypes.MsgCreatePoolWithLiquidity,
|
|
47
|
+
codec_1.TxTypes.MsgAddLiquidity,
|
|
48
|
+
codec_1.TxTypes.MsgRemoveLiquidity,
|
|
49
|
+
codec_1.TxTypes.MsgStakePoolToken,
|
|
50
|
+
codec_1.TxTypes.MsgUnstakePoolToken,
|
|
51
|
+
codec_1.TxTypes.MsgClaimPoolRewards,
|
|
52
|
+
// order
|
|
7
53
|
codec_1.TxTypes.MsgCreateOrder,
|
|
8
|
-
codec_1.TxTypes.MsgEditOrder,
|
|
9
54
|
codec_1.TxTypes.MsgCancelOrder,
|
|
55
|
+
codec_1.TxTypes.MsgEditOrder,
|
|
10
56
|
codec_1.TxTypes.MsgCancelAll,
|
|
11
|
-
|
|
57
|
+
// perpspool
|
|
58
|
+
codec_1.TxTypes.MsgDepositToPool,
|
|
59
|
+
codec_1.TxTypes.MsgWithdrawFromPool,
|
|
60
|
+
// position
|
|
12
61
|
codec_1.TxTypes.MsgSetMargin,
|
|
13
|
-
//
|
|
62
|
+
// profile
|
|
14
63
|
codec_1.TxTypes.MsgUpdateProfile,
|
|
15
|
-
//
|
|
16
|
-
codec_1.TxTypes.
|
|
64
|
+
// staking
|
|
65
|
+
codec_1.TxTypes.MsgDelegate,
|
|
66
|
+
codec_1.TxTypes.MsgUndelegate,
|
|
67
|
+
codec_1.TxTypes.MsgBeginRedelegate,
|
|
17
68
|
];
|
|
69
|
+
exports.emptyValue = {
|
|
70
|
+
typeUrl: "",
|
|
71
|
+
value: {},
|
|
72
|
+
};
|
|
73
|
+
const decodeContent = (content) => {
|
|
74
|
+
if (!content) {
|
|
75
|
+
return exports.emptyValue;
|
|
76
|
+
}
|
|
77
|
+
switch (content.typeUrl) {
|
|
78
|
+
case signless_1.SignlessTypes.GenericAuthorization: {
|
|
79
|
+
return Object.assign(Object.assign({}, content), { value: authz_1.GenericAuthorization.decode(content.value) });
|
|
80
|
+
}
|
|
81
|
+
case signless_1.SignlessTypes.AllowedMsgAllowance: {
|
|
82
|
+
const value = feegrant_1.AllowedMsgAllowance.decode(content.value);
|
|
83
|
+
return Object.assign(Object.assign({}, content), { value: Object.assign(Object.assign({}, value), { allowance: Object.assign({}, exports.decodeContent(value.allowance)) }) });
|
|
84
|
+
}
|
|
85
|
+
case signless_1.SignlessTypes.BasicAllowance: {
|
|
86
|
+
return Object.assign(Object.assign({}, content), { value: feegrant_1.BasicAllowance.decode(content.value) });
|
|
87
|
+
}
|
|
88
|
+
default:
|
|
89
|
+
return exports.emptyValue;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
exports.decodeContent = decodeContent;
|