example-js-sdk 0.0.2 → 0.0.4
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/README.md +1 -1
- package/lib/CarbonSDK.js +16 -6
- package/lib/codec/Mememax/orbix/coin/token.js +14 -26
- package/lib/codec/index.d.ts +8 -8
- package/lib/codec/index.js +15867 -15867
- package/lib/constant/network.d.ts +2 -1
- package/lib/constant/network.js +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -79,7 +79,7 @@ The tar file will be generated at `<Carbon Project>/gen/proto-ts.tar.gz`. You ca
|
|
|
79
79
|
|
|
80
80
|
Or run this in this project directory
|
|
81
81
|
```bash
|
|
82
|
-
# runs `cp ~/go/src/github.com/
|
|
82
|
+
# runs `cp ~/go/src/github.com/mememax/orbix/gen/proto-ts.tar.gz .`
|
|
83
83
|
yarn run cp-proto
|
|
84
84
|
```
|
|
85
85
|
|
package/lib/CarbonSDK.js
CHANGED
|
@@ -85,9 +85,11 @@ class CarbonSDK {
|
|
|
85
85
|
let grpcClient;
|
|
86
86
|
if (opts.useTmAbciQuery !== true && this.networkConfig.grpcUrl) {
|
|
87
87
|
const transport = typeof window === "undefined" ? (0, grpc_web_node_http_transport_1.NodeHttpTransport)() : undefined;
|
|
88
|
-
grpcClient =
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
grpcClient =
|
|
89
|
+
opts.grpcQueryClient ??
|
|
90
|
+
new GrpcQueryClient_1.default(this.networkConfig.restUrl, {
|
|
91
|
+
transport,
|
|
92
|
+
});
|
|
91
93
|
}
|
|
92
94
|
carbonQueryClient = new clients_1.CarbonQueryClient({
|
|
93
95
|
tmClient: this.tmClient,
|
|
@@ -135,7 +137,15 @@ class CarbonSDK {
|
|
|
135
137
|
console.error(error);
|
|
136
138
|
normalInit = false;
|
|
137
139
|
}
|
|
138
|
-
const sdk = new CarbonSDK({
|
|
140
|
+
const sdk = new CarbonSDK({
|
|
141
|
+
network,
|
|
142
|
+
config: configOverride,
|
|
143
|
+
tmClient,
|
|
144
|
+
defaultTimeoutBlocks,
|
|
145
|
+
chainId,
|
|
146
|
+
evmChainId: configOverride.evmChainId, // 🔧 Pass evmChainId from config
|
|
147
|
+
useTmAbciQuery: opts.useTmAbciQuery,
|
|
148
|
+
});
|
|
139
149
|
if (!normalInit)
|
|
140
150
|
return sdk;
|
|
141
151
|
if (opts.wallet) {
|
|
@@ -384,7 +394,7 @@ class CarbonSDK {
|
|
|
384
394
|
const authRequest = {
|
|
385
395
|
grant_type: auth_1.GrantType.SignatureEth,
|
|
386
396
|
message: message,
|
|
387
|
-
public_key: Buffer.from(pubKey,
|
|
397
|
+
public_key: Buffer.from(pubKey, "base64").toString("hex"),
|
|
388
398
|
signature: signature,
|
|
389
399
|
};
|
|
390
400
|
await wallet.reloadJwtToken(authRequest, opts?.authMessage);
|
|
@@ -423,7 +433,7 @@ class CarbonSDK {
|
|
|
423
433
|
const authRequest = {
|
|
424
434
|
grant_type: auth_1.GrantType.SignatureEth,
|
|
425
435
|
message: message,
|
|
426
|
-
public_key: Buffer.from(pubKey,
|
|
436
|
+
public_key: Buffer.from(pubKey, "base64").toString("hex"),
|
|
427
437
|
signature: signature,
|
|
428
438
|
};
|
|
429
439
|
await wallet.reloadJwtToken(authRequest, opts?.authMessage);
|
|
@@ -193,8 +193,7 @@ exports.Token = {
|
|
|
193
193
|
message.tokenAddress !== undefined && (obj.tokenAddress = message.tokenAddress);
|
|
194
194
|
message.bridgeAddress !== undefined && (obj.bridgeAddress = message.bridgeAddress);
|
|
195
195
|
message.isActive !== undefined && (obj.isActive = message.isActive);
|
|
196
|
-
message.createdBlockHeight !== undefined &&
|
|
197
|
-
(obj.createdBlockHeight = (message.createdBlockHeight || long_1.default.UZERO).toString());
|
|
196
|
+
message.createdBlockHeight !== undefined && (obj.createdBlockHeight = (message.createdBlockHeight || long_1.default.UZERO).toString());
|
|
198
197
|
message.isDeprecated !== undefined && (obj.isDeprecated = message.isDeprecated);
|
|
199
198
|
return obj;
|
|
200
199
|
},
|
|
@@ -208,21 +207,16 @@ exports.Token = {
|
|
|
208
207
|
message.denom = object.denom ?? "";
|
|
209
208
|
message.name = object.name ?? "";
|
|
210
209
|
message.symbol = object.symbol ?? "";
|
|
211
|
-
message.decimals =
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
message.bridgeId = (object.bridgeId !== undefined && object.bridgeId !== null)
|
|
215
|
-
? long_1.default.fromValue(object.bridgeId)
|
|
216
|
-
: long_1.default.UZERO;
|
|
217
|
-
message.chainId = (object.chainId !== undefined && object.chainId !== null)
|
|
218
|
-
? long_1.default.fromValue(object.chainId)
|
|
219
|
-
: long_1.default.UZERO;
|
|
210
|
+
message.decimals = object.decimals !== undefined && object.decimals !== null ? long_1.default.fromValue(object.decimals) : long_1.default.ZERO;
|
|
211
|
+
message.bridgeId = object.bridgeId !== undefined && object.bridgeId !== null ? long_1.default.fromValue(object.bridgeId) : long_1.default.UZERO;
|
|
212
|
+
message.chainId = object.chainId !== undefined && object.chainId !== null ? long_1.default.fromValue(object.chainId) : long_1.default.UZERO;
|
|
220
213
|
message.tokenAddress = object.tokenAddress ?? "";
|
|
221
214
|
message.bridgeAddress = object.bridgeAddress ?? "";
|
|
222
215
|
message.isActive = object.isActive ?? false;
|
|
223
|
-
message.createdBlockHeight =
|
|
224
|
-
|
|
225
|
-
|
|
216
|
+
message.createdBlockHeight =
|
|
217
|
+
object.createdBlockHeight !== undefined && object.createdBlockHeight !== null
|
|
218
|
+
? long_1.default.fromValue(object.createdBlockHeight)
|
|
219
|
+
: long_1.default.UZERO;
|
|
226
220
|
message.isDeprecated = object.isDeprecated ?? false;
|
|
227
221
|
return message;
|
|
228
222
|
},
|
|
@@ -340,16 +334,12 @@ exports.BalanceChange = {
|
|
|
340
334
|
fromPartial(object) {
|
|
341
335
|
const message = createBaseBalanceChange();
|
|
342
336
|
message.address = object.address ?? "";
|
|
343
|
-
message.blockHeight =
|
|
344
|
-
? long_1.default.fromValue(object.blockHeight)
|
|
345
|
-
: long_1.default.UZERO;
|
|
337
|
+
message.blockHeight = object.blockHeight !== undefined && object.blockHeight !== null ? long_1.default.fromValue(object.blockHeight) : long_1.default.UZERO;
|
|
346
338
|
message.denom = object.denom ?? "";
|
|
347
339
|
message.amount = object.amount ?? "";
|
|
348
340
|
message.type = object.type ?? "";
|
|
349
341
|
message.location = object.location ?? "";
|
|
350
|
-
message.metadata =
|
|
351
|
-
? exports.Metadata.fromPartial(object.metadata)
|
|
352
|
-
: undefined;
|
|
342
|
+
message.metadata = object.metadata !== undefined && object.metadata !== null ? exports.Metadata.fromPartial(object.metadata) : undefined;
|
|
353
343
|
return message;
|
|
354
344
|
},
|
|
355
345
|
};
|
|
@@ -535,8 +525,7 @@ exports.LockedCoinsRecord = {
|
|
|
535
525
|
const obj = {};
|
|
536
526
|
message.address !== undefined && (obj.address = message.address);
|
|
537
527
|
message.marketId !== undefined && (obj.marketId = message.marketId);
|
|
538
|
-
message.lockedCoins !== undefined &&
|
|
539
|
-
(obj.lockedCoins = message.lockedCoins ? exports.LockedCoins.toJSON(message.lockedCoins) : undefined);
|
|
528
|
+
message.lockedCoins !== undefined && (obj.lockedCoins = message.lockedCoins ? exports.LockedCoins.toJSON(message.lockedCoins) : undefined);
|
|
540
529
|
return obj;
|
|
541
530
|
},
|
|
542
531
|
create(base) {
|
|
@@ -546,9 +535,8 @@ exports.LockedCoinsRecord = {
|
|
|
546
535
|
const message = createBaseLockedCoinsRecord();
|
|
547
536
|
message.address = object.address ?? "";
|
|
548
537
|
message.marketId = object.marketId ?? "";
|
|
549
|
-
message.lockedCoins =
|
|
550
|
-
? exports.LockedCoins.fromPartial(object.lockedCoins)
|
|
551
|
-
: undefined;
|
|
538
|
+
message.lockedCoins =
|
|
539
|
+
object.lockedCoins !== undefined && object.lockedCoins !== null ? exports.LockedCoins.fromPartial(object.lockedCoins) : undefined;
|
|
552
540
|
return message;
|
|
553
541
|
},
|
|
554
542
|
};
|
|
@@ -602,7 +590,7 @@ exports.PositionPool = {
|
|
|
602
590
|
const obj = {};
|
|
603
591
|
message.marketId !== undefined && (obj.marketId = message.marketId);
|
|
604
592
|
if (message.coins) {
|
|
605
|
-
obj.coins = message.coins.map((e) => e ? coin_1.Coin.toJSON(e) : undefined);
|
|
593
|
+
obj.coins = message.coins.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined));
|
|
606
594
|
}
|
|
607
595
|
else {
|
|
608
596
|
obj.coins = [];
|
package/lib/codec/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Registry } from "@cosmjs/proto-signing";
|
|
2
|
-
export * from
|
|
3
|
-
export * as IBC from
|
|
4
|
-
export * as Carbon from
|
|
2
|
+
export * from "./cosmos-models";
|
|
3
|
+
export * as IBC from "./ibc-models";
|
|
4
|
+
export * as Carbon from "./carbon-models";
|
|
5
5
|
export declare const registry: Registry;
|
|
6
6
|
export declare const TxTypes: {
|
|
7
7
|
MsgSetTradingFlag: string;
|
|
@@ -493,17 +493,17 @@ export declare const TxTypes: {
|
|
|
493
493
|
};
|
|
494
494
|
export { Any } from "./google/protobuf/any";
|
|
495
495
|
export { Timestamp } from "./google/protobuf/timestamp";
|
|
496
|
-
export { DoubleValue, FloatValue, Int64Value, UInt64Value, Int32Value, UInt32Value, BoolValue, StringValue, BytesValue } from "./google/protobuf/wrappers";
|
|
496
|
+
export { DoubleValue, FloatValue, Int64Value, UInt64Value, Int32Value, UInt32Value, BoolValue, StringValue, BytesValue, } from "./google/protobuf/wrappers";
|
|
497
497
|
export { Duration } from "./google/protobuf/duration";
|
|
498
498
|
export { Empty } from "./google/protobuf/empty";
|
|
499
|
-
export { Edition, ExtensionRangeOptions_VerificationState, FieldDescriptorProto_Type, FieldDescriptorProto_Label, FileOptions_OptimizeMode, FieldOptions_CType, FieldOptions_JSType, FieldOptions_OptionRetention, FieldOptions_OptionTargetType, MethodOptions_IdempotencyLevel, FeatureSet_FieldPresence, FeatureSet_EnumType, FeatureSet_RepeatedFieldEncoding, FeatureSet_Utf8Validation, FeatureSet_MessageEncoding, FeatureSet_JsonFormat, GeneratedCodeInfo_Annotation_Semantic, FileDescriptorSet, FileDescriptorProto, DescriptorProto, DescriptorProto_ExtensionRange, DescriptorProto_ReservedRange, ExtensionRangeOptions, ExtensionRangeOptions_Declaration, FieldDescriptorProto, OneofDescriptorProto, EnumDescriptorProto, EnumDescriptorProto_EnumReservedRange, EnumValueDescriptorProto, ServiceDescriptorProto, MethodDescriptorProto, FileOptions, MessageOptions, FieldOptions, FieldOptions_EditionDefault, FieldOptions_FeatureSupport, OneofOptions, EnumOptions, EnumValueOptions, ServiceOptions, MethodOptions, UninterpretedOption, UninterpretedOption_NamePart, FeatureSet, FeatureSetDefaults, FeatureSetDefaults_FeatureSetEditionDefault, SourceCodeInfo, SourceCodeInfo_Location, GeneratedCodeInfo, GeneratedCodeInfo_Annotation, editionFromJSON, editionToJSON, extensionRangeOptions_VerificationStateFromJSON, extensionRangeOptions_VerificationStateToJSON, fieldDescriptorProto_TypeFromJSON, fieldDescriptorProto_TypeToJSON, fieldDescriptorProto_LabelFromJSON, fieldDescriptorProto_LabelToJSON, fileOptions_OptimizeModeFromJSON, fileOptions_OptimizeModeToJSON, fieldOptions_CTypeFromJSON, fieldOptions_CTypeToJSON, fieldOptions_JSTypeFromJSON, fieldOptions_JSTypeToJSON, fieldOptions_OptionRetentionFromJSON, fieldOptions_OptionRetentionToJSON, fieldOptions_OptionTargetTypeFromJSON, fieldOptions_OptionTargetTypeToJSON, methodOptions_IdempotencyLevelFromJSON, methodOptions_IdempotencyLevelToJSON, featureSet_FieldPresenceFromJSON, featureSet_FieldPresenceToJSON, featureSet_EnumTypeFromJSON, featureSet_EnumTypeToJSON, featureSet_RepeatedFieldEncodingFromJSON, featureSet_RepeatedFieldEncodingToJSON, featureSet_Utf8ValidationFromJSON, featureSet_Utf8ValidationToJSON, featureSet_MessageEncodingFromJSON, featureSet_MessageEncodingToJSON, featureSet_JsonFormatFromJSON, featureSet_JsonFormatToJSON, generatedCodeInfo_Annotation_SemanticFromJSON, generatedCodeInfo_Annotation_SemanticToJSON } from "./google/protobuf/descriptor";
|
|
499
|
+
export { Edition, ExtensionRangeOptions_VerificationState, FieldDescriptorProto_Type, FieldDescriptorProto_Label, FileOptions_OptimizeMode, FieldOptions_CType, FieldOptions_JSType, FieldOptions_OptionRetention, FieldOptions_OptionTargetType, MethodOptions_IdempotencyLevel, FeatureSet_FieldPresence, FeatureSet_EnumType, FeatureSet_RepeatedFieldEncoding, FeatureSet_Utf8Validation, FeatureSet_MessageEncoding, FeatureSet_JsonFormat, GeneratedCodeInfo_Annotation_Semantic, FileDescriptorSet, FileDescriptorProto, DescriptorProto, DescriptorProto_ExtensionRange, DescriptorProto_ReservedRange, ExtensionRangeOptions, ExtensionRangeOptions_Declaration, FieldDescriptorProto, OneofDescriptorProto, EnumDescriptorProto, EnumDescriptorProto_EnumReservedRange, EnumValueDescriptorProto, ServiceDescriptorProto, MethodDescriptorProto, FileOptions, MessageOptions, FieldOptions, FieldOptions_EditionDefault, FieldOptions_FeatureSupport, OneofOptions, EnumOptions, EnumValueOptions, ServiceOptions, MethodOptions, UninterpretedOption, UninterpretedOption_NamePart, FeatureSet, FeatureSetDefaults, FeatureSetDefaults_FeatureSetEditionDefault, SourceCodeInfo, SourceCodeInfo_Location, GeneratedCodeInfo, GeneratedCodeInfo_Annotation, editionFromJSON, editionToJSON, extensionRangeOptions_VerificationStateFromJSON, extensionRangeOptions_VerificationStateToJSON, fieldDescriptorProto_TypeFromJSON, fieldDescriptorProto_TypeToJSON, fieldDescriptorProto_LabelFromJSON, fieldDescriptorProto_LabelToJSON, fileOptions_OptimizeModeFromJSON, fileOptions_OptimizeModeToJSON, fieldOptions_CTypeFromJSON, fieldOptions_CTypeToJSON, fieldOptions_JSTypeFromJSON, fieldOptions_JSTypeToJSON, fieldOptions_OptionRetentionFromJSON, fieldOptions_OptionRetentionToJSON, fieldOptions_OptionTargetTypeFromJSON, fieldOptions_OptionTargetTypeToJSON, methodOptions_IdempotencyLevelFromJSON, methodOptions_IdempotencyLevelToJSON, featureSet_FieldPresenceFromJSON, featureSet_FieldPresenceToJSON, featureSet_EnumTypeFromJSON, featureSet_EnumTypeToJSON, featureSet_RepeatedFieldEncodingFromJSON, featureSet_RepeatedFieldEncodingToJSON, featureSet_Utf8ValidationFromJSON, featureSet_Utf8ValidationToJSON, featureSet_MessageEncodingFromJSON, featureSet_MessageEncodingToJSON, featureSet_JsonFormatFromJSON, featureSet_JsonFormatToJSON, generatedCodeInfo_Annotation_SemanticFromJSON, generatedCodeInfo_Annotation_SemanticToJSON, } from "./google/protobuf/descriptor";
|
|
500
500
|
export { RewardWeightRange, AllianceAsset, RewardWeightChangeSnapshot } from "./alliance/alliance/alliance";
|
|
501
501
|
export { MsgCreateAllianceProposal, MsgUpdateAllianceProposal, MsgDeleteAllianceProposal } from "./alliance/alliance/gov";
|
|
502
|
-
export { MsgDelegate, MsgDelegateResponse, MsgUndelegate, MsgUndelegateResponse, MsgRedelegate, MsgRedelegateResponse, MsgClaimDelegationRewards, MsgClaimDelegationRewardsResponse, MsgCreateAlliance, MsgCreateAllianceResponse, MsgUpdateAlliance, MsgUpdateAllianceResponse, MsgDeleteAlliance, MsgDeleteAllianceResponse } from "./alliance/alliance/tx";
|
|
502
|
+
export { MsgDelegate, MsgDelegateResponse, MsgUndelegate, MsgUndelegateResponse, MsgRedelegate, MsgRedelegateResponse, MsgClaimDelegationRewards, MsgClaimDelegationRewardsResponse, MsgCreateAlliance, MsgCreateAllianceResponse, MsgUpdateAlliance, MsgUpdateAllianceResponse, MsgDeleteAlliance, MsgDeleteAllianceResponse, } from "./alliance/alliance/tx";
|
|
503
503
|
export { Delegation, Undelegation, QueuedUndelegation, AllianceValidatorInfo } from "./alliance/alliance/delegations";
|
|
504
504
|
export { QueuedRedelegation, Redelegation, RedelegationEntry } from "./alliance/alliance/redelegations";
|
|
505
|
-
export { DelegateAllianceEvent, UndelegateAllianceEvent, RedelegateAllianceEvent, ClaimAllianceRewardsEvent, DeductAllianceAssetsEvent } from "./alliance/alliance/events";
|
|
506
|
-
export { QueryParamsRequest, QueryParamsResponse, QueryAlliancesRequest, QueryAlliancesResponse, QueryAllianceRequest, QueryAllianceResponse, QueryAllianceValidatorRequest, QueryAllAllianceValidatorsRequest, QueryAllAlliancesDelegationsRequest, QueryAlliancesDelegationsRequest, QueryAlliancesDelegationByValidatorRequest, DelegationResponse, QueryAlliancesDelegationsResponse, QueryAllianceDelegationRequest, QueryAllianceDelegationResponse, QueryAllianceDelegationRewardsRequest, QueryAllianceDelegationRewardsResponse, QueryAllianceValidatorResponse, QueryAllianceValidatorsResponse, QueryAllianceUnbondingsByDelegatorRequest, QueryAllianceUnbondingsByDelegatorResponse, QueryAllianceUnbondingsByDenomAndDelegatorRequest, QueryAllianceUnbondingsByDenomAndDelegatorResponse, QueryAllianceUnbondingsRequest, QueryAllianceUnbondingsResponse, QueryAllianceRedelegationsRequest, QueryAllianceRedelegationsResponse, QueryAllianceRedelegationsByDelegatorRequest, QueryAllianceRedelegationsByDelegatorResponse } from "./alliance/alliance/query";
|
|
505
|
+
export { DelegateAllianceEvent, UndelegateAllianceEvent, RedelegateAllianceEvent, ClaimAllianceRewardsEvent, DeductAllianceAssetsEvent, } from "./alliance/alliance/events";
|
|
506
|
+
export { QueryParamsRequest, QueryParamsResponse, QueryAlliancesRequest, QueryAlliancesResponse, QueryAllianceRequest, QueryAllianceResponse, QueryAllianceValidatorRequest, QueryAllAllianceValidatorsRequest, QueryAllAlliancesDelegationsRequest, QueryAlliancesDelegationsRequest, QueryAlliancesDelegationByValidatorRequest, DelegationResponse, QueryAlliancesDelegationsResponse, QueryAllianceDelegationRequest, QueryAllianceDelegationResponse, QueryAllianceDelegationRewardsRequest, QueryAllianceDelegationRewardsResponse, QueryAllianceValidatorResponse, QueryAllianceValidatorsResponse, QueryAllianceUnbondingsByDelegatorRequest, QueryAllianceUnbondingsByDelegatorResponse, QueryAllianceUnbondingsByDenomAndDelegatorRequest, QueryAllianceUnbondingsByDenomAndDelegatorResponse, QueryAllianceUnbondingsRequest, QueryAllianceUnbondingsResponse, QueryAllianceRedelegationsRequest, QueryAllianceRedelegationsResponse, QueryAllianceRedelegationsByDelegatorRequest, QueryAllianceRedelegationsByDelegatorResponse, } from "./alliance/alliance/query";
|
|
507
507
|
export { RewardHistory } from "./alliance/alliance/params";
|
|
508
508
|
export { UnbondingDelegation } from "./alliance/alliance/unbonding";
|
|
509
509
|
export { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx";
|