ggez-banking-sdk 0.1.33 → 0.1.35

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.
@@ -1157,3 +1157,6 @@ export declare enum VerificationMethod {
1157
1157
  Telegram = 2,
1158
1158
  Phone_Call = 3
1159
1159
  }
1160
+ export declare enum ChainType {
1161
+ GGEZ = 1
1162
+ }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PromotionVisibility = exports.PromotionType = exports.ValidateType = exports.VariantType = exports.CurrencyConversionType = exports.TransactionClassification = exports.WireTransferType = exports.ProgramTypes = exports.UserTrustLevelRange = exports.SourceApp = exports.CommerceProductSourceType = exports.OrderType = exports.PaymentMethodType = exports.ForgetPasswordSecurityTypes = exports.ForgetUserSecurityTypes = exports.ResponseStatusCode = exports.CountryCode = exports.DocumentType = exports.AccountStatus = exports.UserType = exports.BusinessType = exports.OrganizationRequestTypes = exports.SecurityOperationMethod = exports.TransactionInquiryStatus = exports.DeviceType = exports.TransactionType = exports.SettlementTransactionType = exports.AuthorizationOperationRequestType = exports.TransactionRequestStatus = exports.EntityStatus = exports.OperationStatus = exports.BankBeneficiaryType = exports.BankAccountTypes = exports.SecurityQuestion2 = exports.SecurityQuestion1 = exports.TrustLimits = exports.EntityVerificationStatus = exports.DocumentStatus = exports.IdentificationTypes = exports.AddressType = exports.Gender = exports.ChainRequestType = exports.ServiceProvider = exports.SecurityAuthenticationTypes = exports.ActivityType = exports.EntityData = exports.Entity = exports.ErrorLevel = exports.OrderStatus = exports.RequestStatus = void 0;
4
- exports.VerificationMethod = exports.TicketType = exports.ExternalHostMode = exports.ExternalHostMessageType = exports.GGEZGiftType = exports.PromotionGames = exports.PromotionStatus = void 0;
4
+ exports.ChainType = exports.VerificationMethod = exports.TicketType = exports.ExternalHostMode = exports.ExternalHostMessageType = exports.GGEZGiftType = exports.PromotionGames = exports.PromotionStatus = void 0;
5
5
  var RequestStatus;
6
6
  (function (RequestStatus) {
7
7
  RequestStatus[RequestStatus["Undefined"] = 0] = "Undefined";
@@ -1226,3 +1226,7 @@ var VerificationMethod;
1226
1226
  VerificationMethod[VerificationMethod["Telegram"] = 2] = "Telegram";
1227
1227
  VerificationMethod[VerificationMethod["Phone_Call"] = 3] = "Phone_Call";
1228
1228
  })(VerificationMethod || (exports.VerificationMethod = VerificationMethod = {}));
1229
+ var ChainType;
1230
+ (function (ChainType) {
1231
+ ChainType[ChainType["GGEZ"] = 1] = "GGEZ";
1232
+ })(ChainType || (exports.ChainType = ChainType = {}));
@@ -60,3 +60,9 @@ export declare const StructTicketMessageDescriptionCodes: {
60
60
  Identification_Verification_Canceled: string;
61
61
  Phone_Verification: string;
62
62
  };
63
+ export declare const BlockchainActions: {
64
+ Send: string;
65
+ MultiSend: string;
66
+ Delegate: string;
67
+ Undelegate: string;
68
+ };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StructTicketMessageDescriptionCodes = void 0;
3
+ exports.BlockchainActions = exports.StructTicketMessageDescriptionCodes = void 0;
4
4
  exports.StructTicketMessageDescriptionCodes = {
5
5
  Custom: "M000",
6
6
  Identification_Is_Being_Verified: "M100",
@@ -63,3 +63,9 @@ exports.StructTicketMessageDescriptionCodes = {
63
63
  Identification_Verification_Canceled: "M157",
64
64
  Phone_Verification: "M158",
65
65
  };
66
+ exports.BlockchainActions = {
67
+ Send: "send",
68
+ MultiSend: "multisend",
69
+ Delegate: "delegate",
70
+ Undelegate: "undelegate",
71
+ };
@@ -5,7 +5,7 @@ import { DoTransactionInterface, GetTransactionInterface } from "../interfaces/a
5
5
  import { CreateAddressInterface, DeleteUserAddressInterface, MakeAddressPrimaryInterface, UpdateAddressInterface, CreateUserEmailInterface, DeleteUserEmailInterface, UpdateUserEmailInterface, ConfirmLimitedEmailInterface, MakePrimaryUserEmailInterface, VerifyLimitedEmailInterface, ConfirmLimitedPhoneInterface, CreateUserPhoneInterface, DeleteUserPhoneInterface, MakeUserPhonePrimaryInterface, UpdateUserPhoneInterface, VerifyLimitedPhoneInterface, CreateBankAccountInterFace, UpdateBankAccountInterFace, DeleteBankAccountInterFace, MakeBankAccountPrimaryInterFace, CreateIdentificationInterface, DeleteIdentificationInterface, UpdateIdentificationInterface, UpdatePersonalInfoInterface, UpdateProfilePictureInterface, ChangeUserSecurityCodeInterface, ResetPasswordInterface, ResetSecurityQuestionsInterface, UpdateUserPreferencesInterface, ValidateSecurityCodeInterface, ActivateGoogleAuthInterface, ValidateLimitedPhoneInterface, IsEmailPresentAndValidInterface, IsPhonePresentAndValidInterface, SendOTPPhoneInterface, SendOTPEmailInterface, CreateDocumentInterface, ForgetPasswordConfirmInterface, ForgetPasswordValidateInterface, DeleteGoogleAuthInterface, CreateTicketInterface } from "../interfaces/bankingSystemInterface";
6
6
  import { IOrderInterface } from "../interfaces/transactionInterface";
7
7
  import { CreateDocumentOrganizationInterface, CreateOrganizationInterface, UpdateOrganizationInterface } from "../interfaces/organizationInterface";
8
- import { IBlockchainData, IDelegationData, ITransferData } from "../interfaces/blockchain";
8
+ import { IBlockchainData, IDelegateData, IMultiSendData, ISendData, IUndelegateData } from "../interfaces/blockchain";
9
9
  import { BlockchainRequestType } from "../constants";
10
10
  declare const Data: () => {
11
11
  dataSignUpApi: (values: SignUpInterface) => {
@@ -3267,6 +3267,6 @@ declare const Data: () => {
3267
3267
  time_zone_name: string;
3268
3268
  };
3269
3269
  };
3270
- GetBlockchainRequestData: (values: ITransferData | IDelegationData, blockchainRequestType: BlockchainRequestType) => IBlockchainData;
3270
+ GetBlockchainRequestData: (values: ISendData | IMultiSendData | IDelegateData | IUndelegateData, blockchainRequestType: BlockchainRequestType) => IBlockchainData;
3271
3271
  };
3272
3272
  export default Data;
@@ -69,31 +69,51 @@ const Data = () => {
69
69
  };
70
70
  };
71
71
  const GetBlockchainRequestData = (values, blockchainRequestType) => {
72
- const GetTransferRequestData = (values) => {
73
- const { transfer_data, info, authentication } = values;
72
+ const GetSendRequestData = (values) => {
73
+ const { info, transaction_data, authentication } = values;
74
74
  const data = {
75
75
  info: info,
76
- transfer_data: transfer_data,
76
+ transaction_data: transaction_data,
77
77
  authentication: authentication,
78
78
  };
79
79
  return data;
80
80
  };
81
- const GetDelegationRequestData = (values) => {
82
- const { delegation_data, info, authentication } = values;
81
+ const GetMultiSendRequestData = (values) => {
82
+ const { info, transaction_data, authentication } = values;
83
83
  const data = {
84
84
  info: info,
85
- delegation_data: delegation_data,
85
+ transaction_data: transaction_data,
86
+ authentication: authentication,
87
+ };
88
+ return data;
89
+ };
90
+ const GetDelegateRequestData = (values) => {
91
+ const { info, transaction_data, authentication } = values;
92
+ const data = {
93
+ info: info,
94
+ transaction_data: transaction_data,
95
+ authentication: authentication,
96
+ };
97
+ return data;
98
+ };
99
+ const GetUndelegateRequestData = (values) => {
100
+ const { info, transaction_data, authentication } = values;
101
+ const data = {
102
+ info: info,
103
+ transaction_data: transaction_data,
86
104
  authentication: authentication,
87
105
  };
88
106
  return data;
89
107
  };
90
108
  switch (blockchainRequestType) {
91
109
  case constants_1.BlockchainRequestType.Send:
110
+ return GetSendRequestData(values);
92
111
  case constants_1.BlockchainRequestType.Multi_Send:
93
- return GetTransferRequestData(values);
112
+ return GetMultiSendRequestData(values);
94
113
  case constants_1.BlockchainRequestType.Delegate:
114
+ return GetDelegateRequestData(values);
95
115
  case constants_1.BlockchainRequestType.UnDelegate:
96
- return GetDelegationRequestData(values);
116
+ return GetUndelegateRequestData(values);
97
117
  default:
98
118
  return null;
99
119
  }
@@ -117,7 +137,9 @@ const Data = () => {
117
137
  customField.promotion_data.gift_data = [values.giftData];
118
138
  }
119
139
  let authentication = [];
120
- if (values.mobileAuthenticationCode && values?.isMobileConfirmed && values.isMobileConfirmed == true) {
140
+ if (values.mobileAuthenticationCode &&
141
+ values?.isMobileConfirmed &&
142
+ values.isMobileConfirmed == true) {
121
143
  authentication = [
122
144
  {
123
145
  type: enum_1.SecurityAuthenticationTypes.SMS_Code,
@@ -242,7 +264,9 @@ const Data = () => {
242
264
  customField.promotion_data.gift_data = [values.giftData];
243
265
  }
244
266
  let authentication = [];
245
- if (values.mobileAuthenticationCode && values?.isMobileConfirmed && values.isMobileConfirmed == true) {
267
+ if (values.mobileAuthenticationCode &&
268
+ values?.isMobileConfirmed &&
269
+ values.isMobileConfirmed == true) {
246
270
  authentication = [
247
271
  {
248
272
  type: enum_1.SecurityAuthenticationTypes.SMS_Code,
@@ -1,3 +1,4 @@
1
+ import { ChainType } from "../constants";
1
2
  interface ICoin {
2
3
  amount: string;
3
4
  denom: string;
@@ -9,6 +10,7 @@ interface IAuthentication {
9
10
  interface IBase {
10
11
  info: {
11
12
  account_id: number;
13
+ chain_type: ChainType;
12
14
  };
13
15
  authentication: IAuthentication[];
14
16
  }
@@ -16,34 +18,49 @@ interface IEntry {
16
18
  recipient_address: string;
17
19
  coin: ICoin;
18
20
  }
21
+ export interface ISend {
22
+ address: string;
23
+ coins: ICoin[];
24
+ }
25
+ export interface IMultiSend {
26
+ recipients: ISend[];
27
+ }
19
28
  export interface ITransferData extends IBase {
20
29
  transfer_data: {
21
30
  entries: IEntry[];
22
31
  total_coins?: ICoin[];
23
32
  };
24
33
  }
25
- export interface ISendData extends ITransferData {
26
- }
27
- export interface IMultiSend extends ITransferData {
34
+ export interface ISendData extends IBase {
35
+ transaction_data: {
36
+ send: ISend;
37
+ };
28
38
  }
29
- export interface IDelegationData extends IBase {
30
- delegation_data: {
31
- validator_address: string;
32
- coin: ICoin;
39
+ export interface IMultiSendData extends IBase {
40
+ transaction_data: {
41
+ multi_send: IMultiSend;
33
42
  };
34
43
  }
35
- export interface IDelegateData extends IDelegationData {
44
+ export interface IDelegation {
45
+ validator_address: string;
46
+ coin: ICoin;
36
47
  }
37
- export interface IUnDelegateData extends IDelegationData {
48
+ export interface IDelegateData extends IBase {
49
+ transaction_data: {
50
+ delegate: IDelegation;
51
+ };
38
52
  }
39
- export interface IBlockchainData extends IBase {
40
- transfer_data?: {
41
- entries: IEntry[];
42
- total_coins?: ICoin[];
53
+ export interface IUndelegateData extends IBase {
54
+ transaction_data: {
55
+ undelegate: IDelegation;
43
56
  };
44
- delegation_data?: {
45
- validator_address: string;
46
- coin: ICoin;
57
+ }
58
+ export interface IBlockchainData extends IBase {
59
+ transaction_data: {
60
+ send?: ISend;
61
+ multi_send?: IMultiSend;
62
+ delegate?: IDelegation;
63
+ undelegate?: IDelegation;
47
64
  };
48
65
  }
49
66
  export {};
@@ -1,4 +1,4 @@
1
- import { IDelegateData, IMultiSend, ISendData, IUnDelegateData } from "./../interfaces/blockchain";
1
+ import { ISendData, IMultiSendData, IDelegateData, IUndelegateData } from "./../interfaces/blockchain";
2
2
  import { UserInfo } from "../interfaces/interface";
3
3
  export declare const useBlockchain: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, lang?: string) => {
4
4
  SendRequest: (values: ISendData) => Promise<{
@@ -7,7 +7,7 @@ export declare const useBlockchain: (token: string, userInfo: UserInfo, userId:
7
7
  message: any;
8
8
  status: string;
9
9
  }>;
10
- MultiSendRequest: (values: IMultiSend) => Promise<{
10
+ MultiSendRequest: (values: IMultiSendData) => Promise<{
11
11
  response: any;
12
12
  newUser: any;
13
13
  message: any;
@@ -19,7 +19,7 @@ export declare const useBlockchain: (token: string, userInfo: UserInfo, userId:
19
19
  message: any;
20
20
  status: string;
21
21
  }>;
22
- UnDelegateRequest: (values: IUnDelegateData) => Promise<{
22
+ UnDelegateRequest: (values: IUndelegateData) => Promise<{
23
23
  response: any;
24
24
  newUser: any;
25
25
  message: any;
@@ -23,7 +23,8 @@ const useBlockchain = (token, userInfo, userId, baseUrl, lang) => {
23
23
  };
24
24
  const RequestHandler = async (data, requestType) => {
25
25
  try {
26
- const response = await restApi_1.default.restApi(baseUrl, constants_1.HTTPMethod.POST, constants_1.Endpoints.Blockchain, GetHeadersConfig(), data);
26
+ const endpoint = (0, blockchainHelper_1.GetEndpointByRequestType)(requestType);
27
+ const response = await restApi_1.default.restApi(baseUrl, constants_1.HTTPMethod.POST, endpoint, GetHeadersConfig(), data);
27
28
  const { key, functionName } = (0, blockchainHelper_1.GetKeyAndFunctionNameByRequestType)(requestType);
28
29
  const { newUserInfo } = checkGlobalResponse(key, response, functionName, key);
29
30
  return {
@@ -3,3 +3,4 @@ export declare const GetKeyAndFunctionNameByRequestType: (requestType: Blockchai
3
3
  key: string;
4
4
  functionName: string;
5
5
  };
6
+ export declare const GetEndpointByRequestType: (requestType: BlockchainRequestType) => string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetKeyAndFunctionNameByRequestType = void 0;
3
+ exports.GetEndpointByRequestType = exports.GetKeyAndFunctionNameByRequestType = void 0;
4
4
  const constants_1 = require("../constants");
5
5
  const GetKeyAndFunctionNameByRequestType = (requestType) => {
6
6
  switch (requestType) {
@@ -17,3 +17,25 @@ const GetKeyAndFunctionNameByRequestType = (requestType) => {
17
17
  }
18
18
  };
19
19
  exports.GetKeyAndFunctionNameByRequestType = GetKeyAndFunctionNameByRequestType;
20
+ const GetEndpointByRequestType = (requestType) => {
21
+ let action;
22
+ switch (requestType) {
23
+ case constants_1.BlockchainRequestType.Send:
24
+ action = constants_1.BlockchainActions.Send;
25
+ break;
26
+ case constants_1.BlockchainRequestType.Multi_Send:
27
+ action = constants_1.BlockchainActions.MultiSend;
28
+ break;
29
+ case constants_1.BlockchainRequestType.Delegate:
30
+ action = constants_1.BlockchainActions.Delegate;
31
+ break;
32
+ case constants_1.BlockchainRequestType.UnDelegate:
33
+ action = constants_1.BlockchainActions.Undelegate;
34
+ break;
35
+ default:
36
+ action = "";
37
+ break;
38
+ }
39
+ return `${constants_1.Endpoints.Blockchain}/${action}`;
40
+ };
41
+ exports.GetEndpointByRequestType = GetEndpointByRequestType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ggez-banking-sdk",
3
- "version": "0.1.33",
3
+ "version": "0.1.35",
4
4
  "description": "A Node.js package to handle GGEZ Banking API endpoints, Simplify the process of managing CRUD operations with this efficient and easy-to-use package.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",