@morambacrypto/connect 0.0.16 → 0.0.18
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/index.d.mts +31 -49
- package/dist/index.d.ts +31 -49
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -27,17 +27,20 @@ interface CreateJwtResponse {
|
|
|
27
27
|
|
|
28
28
|
declare class AuthAPI {
|
|
29
29
|
private http;
|
|
30
|
-
|
|
30
|
+
private partnerId;
|
|
31
|
+
private apiKey;
|
|
32
|
+
constructor(http: HttpClient, partnerId: string, apiKey: string);
|
|
31
33
|
createJwtToken(payload: CreateJwtPayload): Promise<CreateJwtResponse>;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
interface PaymentMethod
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
interface PaymentMethod {
|
|
37
|
+
payment_network: string;
|
|
38
|
+
payment_token_name: string;
|
|
39
|
+
payment_token_address: string;
|
|
38
40
|
}
|
|
41
|
+
|
|
39
42
|
interface CreateCompanyPayload {
|
|
40
|
-
payment_method: PaymentMethod
|
|
43
|
+
payment_method: PaymentMethod;
|
|
41
44
|
company_name: string;
|
|
42
45
|
company_email: string;
|
|
43
46
|
}
|
|
@@ -119,17 +122,24 @@ declare class CompanyAPI {
|
|
|
119
122
|
updateCompanyPaymentMethod(payload: UpdateCompanyPaymentPayload, jwtToken: string): Promise<UpdateCompanyPaymentResponse>;
|
|
120
123
|
}
|
|
121
124
|
|
|
122
|
-
interface PaymentMethod {
|
|
123
|
-
network: string;
|
|
124
|
-
token: string;
|
|
125
|
-
address: string;
|
|
126
|
-
}
|
|
127
125
|
interface CreateMerchantPayload {
|
|
128
126
|
payment_method: PaymentMethod;
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
merchant_name: string;
|
|
128
|
+
merchant_email: string;
|
|
131
129
|
company_id: string;
|
|
132
130
|
}
|
|
131
|
+
interface MerchantData {
|
|
132
|
+
id: string;
|
|
133
|
+
merchant_name: string;
|
|
134
|
+
merchant_email: string;
|
|
135
|
+
company_id: string;
|
|
136
|
+
partner_id: string;
|
|
137
|
+
payment_network: string;
|
|
138
|
+
payment_token_name: string;
|
|
139
|
+
payment_token_address: string;
|
|
140
|
+
created_at: string;
|
|
141
|
+
updated_at: string;
|
|
142
|
+
}
|
|
133
143
|
interface CreateMerchantResponse {
|
|
134
144
|
success: boolean;
|
|
135
145
|
message: string;
|
|
@@ -138,11 +148,7 @@ interface CreateMerchantResponse {
|
|
|
138
148
|
interface UpdateMerchantPaymentPayload {
|
|
139
149
|
company_id: string;
|
|
140
150
|
merchant_id: string;
|
|
141
|
-
payment_method:
|
|
142
|
-
network: string;
|
|
143
|
-
token: string;
|
|
144
|
-
address: string;
|
|
145
|
-
};
|
|
151
|
+
payment_method: PaymentMethod;
|
|
146
152
|
}
|
|
147
153
|
interface UpdateMerchantPaymentResponse {
|
|
148
154
|
success: boolean;
|
|
@@ -152,7 +158,7 @@ interface UpdateMerchantPaymentResponse {
|
|
|
152
158
|
interface UpdateMerchantEmailPayload {
|
|
153
159
|
company_id: string;
|
|
154
160
|
merchant_id: string;
|
|
155
|
-
|
|
161
|
+
merchant_email: string;
|
|
156
162
|
}
|
|
157
163
|
interface UpdateMerchantEmailResponse {
|
|
158
164
|
success: boolean;
|
|
@@ -169,12 +175,12 @@ interface MerchantListQuery {
|
|
|
169
175
|
interface MerchantListData {
|
|
170
176
|
id: string;
|
|
171
177
|
company_id: string;
|
|
172
|
-
|
|
173
|
-
|
|
178
|
+
merchant_name: string;
|
|
179
|
+
merchant_email: string;
|
|
174
180
|
partner_id: string;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
181
|
+
payment_network: string;
|
|
182
|
+
payment_token_name: string;
|
|
183
|
+
payment_token_address: string;
|
|
178
184
|
created_at: string;
|
|
179
185
|
updated_at: string;
|
|
180
186
|
}
|
|
@@ -188,30 +194,6 @@ interface GetMerchantListResponse {
|
|
|
188
194
|
interface GetMerchantQuery {
|
|
189
195
|
merchant_id?: string;
|
|
190
196
|
}
|
|
191
|
-
interface MerchantData {
|
|
192
|
-
id: string;
|
|
193
|
-
name: string;
|
|
194
|
-
email: string;
|
|
195
|
-
company_id: string;
|
|
196
|
-
partner_id: string;
|
|
197
|
-
network: string;
|
|
198
|
-
token: string;
|
|
199
|
-
address: string;
|
|
200
|
-
created_at: string;
|
|
201
|
-
updated_at: string;
|
|
202
|
-
}
|
|
203
|
-
interface MerchantData {
|
|
204
|
-
id: string;
|
|
205
|
-
company_id: string;
|
|
206
|
-
name: string;
|
|
207
|
-
email: string;
|
|
208
|
-
partner_id: string;
|
|
209
|
-
network: string;
|
|
210
|
-
token: string;
|
|
211
|
-
address: string;
|
|
212
|
-
created_at: string;
|
|
213
|
-
updated_at: string;
|
|
214
|
-
}
|
|
215
197
|
interface GetMerchantResponse {
|
|
216
198
|
success: boolean;
|
|
217
199
|
message: string;
|
|
@@ -263,4 +245,4 @@ declare function sepoliaApprove(options: SepoliaApproveOptions): Promise<{
|
|
|
263
245
|
receipt: any;
|
|
264
246
|
}>;
|
|
265
247
|
|
|
266
|
-
export { type CompanyData, type CompanyListItem, type CreateCompanyPayload, type CreateCompanyResponse, type CreateJwtPayload, type CreateJwtResponse, type GetCompaniesQuery, type GetCompaniesResponse, type JwtTokenData, type MonadApproveOptions, MorambaClient, type MorambaClientConfig, type PaginationData, type
|
|
248
|
+
export { type CompanyData, type CompanyListItem, type CreateCompanyPayload, type CreateCompanyResponse, type CreateJwtPayload, type CreateJwtResponse, type GetCompaniesQuery, type GetCompaniesResponse, type JwtTokenData, type MonadApproveOptions, MorambaClient, type MorambaClientConfig, type PaginationData, type SepoliaApproveOptions, type UpdateCompanyEmailPayload, type UpdateCompanyEmailResponse, type UpdateCompanyPaymentPayload, type UpdateCompanyPaymentResponse, monadApprove, sepoliaApprove };
|
package/dist/index.d.ts
CHANGED
|
@@ -27,17 +27,20 @@ interface CreateJwtResponse {
|
|
|
27
27
|
|
|
28
28
|
declare class AuthAPI {
|
|
29
29
|
private http;
|
|
30
|
-
|
|
30
|
+
private partnerId;
|
|
31
|
+
private apiKey;
|
|
32
|
+
constructor(http: HttpClient, partnerId: string, apiKey: string);
|
|
31
33
|
createJwtToken(payload: CreateJwtPayload): Promise<CreateJwtResponse>;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
interface PaymentMethod
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
interface PaymentMethod {
|
|
37
|
+
payment_network: string;
|
|
38
|
+
payment_token_name: string;
|
|
39
|
+
payment_token_address: string;
|
|
38
40
|
}
|
|
41
|
+
|
|
39
42
|
interface CreateCompanyPayload {
|
|
40
|
-
payment_method: PaymentMethod
|
|
43
|
+
payment_method: PaymentMethod;
|
|
41
44
|
company_name: string;
|
|
42
45
|
company_email: string;
|
|
43
46
|
}
|
|
@@ -119,17 +122,24 @@ declare class CompanyAPI {
|
|
|
119
122
|
updateCompanyPaymentMethod(payload: UpdateCompanyPaymentPayload, jwtToken: string): Promise<UpdateCompanyPaymentResponse>;
|
|
120
123
|
}
|
|
121
124
|
|
|
122
|
-
interface PaymentMethod {
|
|
123
|
-
network: string;
|
|
124
|
-
token: string;
|
|
125
|
-
address: string;
|
|
126
|
-
}
|
|
127
125
|
interface CreateMerchantPayload {
|
|
128
126
|
payment_method: PaymentMethod;
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
merchant_name: string;
|
|
128
|
+
merchant_email: string;
|
|
131
129
|
company_id: string;
|
|
132
130
|
}
|
|
131
|
+
interface MerchantData {
|
|
132
|
+
id: string;
|
|
133
|
+
merchant_name: string;
|
|
134
|
+
merchant_email: string;
|
|
135
|
+
company_id: string;
|
|
136
|
+
partner_id: string;
|
|
137
|
+
payment_network: string;
|
|
138
|
+
payment_token_name: string;
|
|
139
|
+
payment_token_address: string;
|
|
140
|
+
created_at: string;
|
|
141
|
+
updated_at: string;
|
|
142
|
+
}
|
|
133
143
|
interface CreateMerchantResponse {
|
|
134
144
|
success: boolean;
|
|
135
145
|
message: string;
|
|
@@ -138,11 +148,7 @@ interface CreateMerchantResponse {
|
|
|
138
148
|
interface UpdateMerchantPaymentPayload {
|
|
139
149
|
company_id: string;
|
|
140
150
|
merchant_id: string;
|
|
141
|
-
payment_method:
|
|
142
|
-
network: string;
|
|
143
|
-
token: string;
|
|
144
|
-
address: string;
|
|
145
|
-
};
|
|
151
|
+
payment_method: PaymentMethod;
|
|
146
152
|
}
|
|
147
153
|
interface UpdateMerchantPaymentResponse {
|
|
148
154
|
success: boolean;
|
|
@@ -152,7 +158,7 @@ interface UpdateMerchantPaymentResponse {
|
|
|
152
158
|
interface UpdateMerchantEmailPayload {
|
|
153
159
|
company_id: string;
|
|
154
160
|
merchant_id: string;
|
|
155
|
-
|
|
161
|
+
merchant_email: string;
|
|
156
162
|
}
|
|
157
163
|
interface UpdateMerchantEmailResponse {
|
|
158
164
|
success: boolean;
|
|
@@ -169,12 +175,12 @@ interface MerchantListQuery {
|
|
|
169
175
|
interface MerchantListData {
|
|
170
176
|
id: string;
|
|
171
177
|
company_id: string;
|
|
172
|
-
|
|
173
|
-
|
|
178
|
+
merchant_name: string;
|
|
179
|
+
merchant_email: string;
|
|
174
180
|
partner_id: string;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
181
|
+
payment_network: string;
|
|
182
|
+
payment_token_name: string;
|
|
183
|
+
payment_token_address: string;
|
|
178
184
|
created_at: string;
|
|
179
185
|
updated_at: string;
|
|
180
186
|
}
|
|
@@ -188,30 +194,6 @@ interface GetMerchantListResponse {
|
|
|
188
194
|
interface GetMerchantQuery {
|
|
189
195
|
merchant_id?: string;
|
|
190
196
|
}
|
|
191
|
-
interface MerchantData {
|
|
192
|
-
id: string;
|
|
193
|
-
name: string;
|
|
194
|
-
email: string;
|
|
195
|
-
company_id: string;
|
|
196
|
-
partner_id: string;
|
|
197
|
-
network: string;
|
|
198
|
-
token: string;
|
|
199
|
-
address: string;
|
|
200
|
-
created_at: string;
|
|
201
|
-
updated_at: string;
|
|
202
|
-
}
|
|
203
|
-
interface MerchantData {
|
|
204
|
-
id: string;
|
|
205
|
-
company_id: string;
|
|
206
|
-
name: string;
|
|
207
|
-
email: string;
|
|
208
|
-
partner_id: string;
|
|
209
|
-
network: string;
|
|
210
|
-
token: string;
|
|
211
|
-
address: string;
|
|
212
|
-
created_at: string;
|
|
213
|
-
updated_at: string;
|
|
214
|
-
}
|
|
215
197
|
interface GetMerchantResponse {
|
|
216
198
|
success: boolean;
|
|
217
199
|
message: string;
|
|
@@ -263,4 +245,4 @@ declare function sepoliaApprove(options: SepoliaApproveOptions): Promise<{
|
|
|
263
245
|
receipt: any;
|
|
264
246
|
}>;
|
|
265
247
|
|
|
266
|
-
export { type CompanyData, type CompanyListItem, type CreateCompanyPayload, type CreateCompanyResponse, type CreateJwtPayload, type CreateJwtResponse, type GetCompaniesQuery, type GetCompaniesResponse, type JwtTokenData, type MonadApproveOptions, MorambaClient, type MorambaClientConfig, type PaginationData, type
|
|
248
|
+
export { type CompanyData, type CompanyListItem, type CreateCompanyPayload, type CreateCompanyResponse, type CreateJwtPayload, type CreateJwtResponse, type GetCompaniesQuery, type GetCompaniesResponse, type JwtTokenData, type MonadApproveOptions, MorambaClient, type MorambaClientConfig, type PaginationData, type SepoliaApproveOptions, type UpdateCompanyEmailPayload, type UpdateCompanyEmailResponse, type UpdateCompanyPaymentPayload, type UpdateCompanyPaymentResponse, monadApprove, sepoliaApprove };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var U=Object.create;var d=Object.defineProperty;var
|
|
1
|
+
"use strict";var U=Object.create;var d=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty;var _=(o,e)=>{for(var t in e)d(o,t,{get:e[t],enumerable:!0})},M=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of E(e))!T.call(o,a)&&a!==t&&d(o,a,{get:()=>e[a],enumerable:!(r=k(e,a))||r.enumerable});return o};var S=(o,e,t)=>(t=o!=null?U(I(o)):{},M(e||!o||!o.__esModule?d(t,"default",{value:o,enumerable:!0}):t,o)),G=o=>M(d({},"__esModule",{value:!0}),o);var $={};_($,{MorambaClient:()=>x,monadApprove:()=>L,sepoliaApprove:()=>N});module.exports=G($);var R=S(require("axios")),u=class{constructor(e,t={},r=4,a=300){this.client=R.default.create({baseURL:e,headers:t,timeout:1e4}),this.maxRetries=r,this.retryDelay=a,this.setupRetryInterceptor()}get axiosInstance(){return this.client}setupRetryInterceptor(){this.client.interceptors.response.use(e=>e,async e=>{let t=e.config;if(!t||(t._retryCount||(t._retryCount=0),t._retryCount>=this.maxRetries))throw e;t._retryCount++;let r=this.retryDelay*Math.pow(2,t._retryCount);return await new Promise(a=>setTimeout(a,r)),this.client(t)})}post(e,t,r={}){return this.client.post(e,t,{headers:r}).then(a=>a.data)}patch(e,t,r={}){return this.client.patch(e,t,{headers:r}).then(a=>a.data)}get(e,t={}){return this.client.get(e,{headers:t}).then(r=>r.data)}};var y=class{constructor(e,t,r){this.http=e;this.partnerId=t;this.apiKey=r}createJwtToken(e){let t={...e,partner_id:this.partnerId,api_key:this.apiKey};return this.http.post("/morambacrypto/create/jwt_token",t)}};var g=class{constructor(e){this.http=e}createCompany(e,t){return this.http.post("/morambacrypto/create/company",e,{Authorization:`Bearer ${t}`})}updateCompanyEmail(e,t){return this.http.patch("/morambacrypto/update/company/email",e,{Authorization:`Bearer ${t}`})}getCompaniesByPartner(e,t){let r=new URLSearchParams;return t.limit&&r.append("limit",String(t.limit)),t.direction&&r.append("direction",t.direction),t.cursor&&r.append("cursor",t.cursor),this.http.get(`/morambacrypto/companies/partner/${t.partner_id}?${r.toString()}`,{Authorization:`Bearer ${e}`})}updateCompanyPaymentMethod(e,t){return this.http.patch("/morambacrypto/update/company/payment",e,{Authorization:`Bearer ${t}`})}};var C=class{constructor(e){this.http=e}createMerchant(e,t){return this.http.post("/morambacrypto/create/merchant",e,{Authorization:`Bearer ${t}`})}updateMerchantPaymentMethod(e,t){return this.http.patch("/morambacrypto/update/merchant/payment",e,{Authorization:`Bearer ${t}`})}updateMerchantEmail(e,t){return this.http.patch("/morambacrypto/update/merchant/email",e,{Authorization:`Bearer ${t}`})}getMerchantList(e,t={}){let r=new URLSearchParams;return t.company_id&&r.append("company_id",String(t.company_id)),t.limit&&r.append("limit",String(t.limit)),t.cursor&&r.append("cursor",t.cursor),t.forward&&r.append("cursor",t.forward),t.backward&&r.append("cursor",t.backward),this.http.get(`/morambacrypto/merchants/all?${r.toString()}`,{Authorization:`Bearer ${e}`})}getSingleMerchant(e,t={}){let r=new URLSearchParams;return t.merchant_id&&r.append("merchant_id",String(t.merchant_id)),this.http.get(`/morambacrypto/merchants?${r.toString()}`,{Authorization:`Bearer ${e}`})}};var x=class{constructor(e){this.http=new u(e.baseURL,{"Content-Type":"application/json"}),this.auth=new y(this.http,e.partnerId,e.apiKey),this.company=new g(this.http),this.merchant=new C(this.http)}};var s=require("ethers");var b={rpc:"https://testnet-rpc.monad.xyz",spender:"0xbAcEa624831C5f294a5E7FeC519232AA37ec0a8C",token:"0x62F6c82114809C00a1293be02A43C05a3F917202",decimals:18,defaultAmount:"1000"},v={rpc:"https://rpc.sepolia.org",spender:"0x6E2024Da220C081059f606D9EEAe670c84Ead9Ab",token:"0xbAcEa624831C5f294a5E7FeC519232AA37ec0a8C",decimals:18,defaultAmount:"1000"};async function L(o){let{privateKey:e,unlimited:t=!0,amount:r,decimalsOverride:a}=o,n=b,f=new s.ethers.JsonRpcProvider(n.rpc),c=new s.ethers.Wallet(e,f),P=["function approve(address spender, uint256 value) external returns (bool)"],A=new s.ethers.Contract(n.token,P,c),m=a!=null?a:n.decimals,l=r!=null?r:n.defaultAmount,w=t?s.ethers.MaxUint256:s.ethers.parseUnits(l,m);console.log("\u26A1 Monad approve()"),console.log("RPC:",n.rpc),console.log("Token:",n.token),console.log("Spender:",n.spender),console.log("Decimals:",m),console.log("Amount:",t?"UNLIMITED":l),console.log("From:",await c.getAddress());let i=await A.approve(n.spender,w);console.log("\u{1F4E4} TX:",i.hash);let h=await i.wait();return console.log("\u2705 Block:",h.blockNumber),{hash:i.hash,receipt:h}}var p=require("ethers");async function N(o){let{privateKey:e,unlimited:t=!0,amount:r,decimalsOverride:a}=o,n=v,f=new p.ethers.JsonRpcProvider(n.rpc),c=new p.ethers.Wallet(e,f),P=["function approve(address spender, uint256 value) external returns (bool)"],A=new p.ethers.Contract(n.token,P,c),m=a!=null?a:n.decimals,l=r!=null?r:n.defaultAmount,w=t?p.ethers.MaxUint256:p.ethers.parseUnits(l,m);console.log("\u26A1 Sepolia approve()"),console.log("RPC:",n.rpc),console.log("Token:",n.token),console.log("Spender:",n.spender),console.log("Decimals:",m),console.log("Amount:",t?"UNLIMITED":l),console.log("From:",await c.getAddress());let i=await A.approve(n.spender,w);console.log("\u{1F4E4} TX:",i.hash);let h=await i.wait();return console.log("\u2705 Block:",h.blockNumber),{hash:i.hash,receipt:h}}0&&(module.exports={MorambaClient,monadApprove,sepoliaApprove});
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/client/HttpClient.ts","../src/apis/auth.api.ts","../src/apis/company.api.ts","../src/apis/merchant.api.ts","../src/MorambaClient.ts","../src/authorize/monad.approve.ts","../src/utils/networks.ts","../src/authorize/sepolia.approve.ts"],"sourcesContent":["export * from \"./MorambaClient\";\nexport * from \"./types\";\nexport * from \"./authorize\";\n","import axios, { AxiosInstance, AxiosError } from \"axios\";\n\nexport class HttpClient {\n private client: AxiosInstance;\n private maxRetries: number;\n private retryDelay: number; // base delay in milliseconds\n\n constructor(\n baseURL: string,\n headers: Record<string, string> = {},\n maxRetries = 4, // default: 4 retries\n retryDelay = 300 // base delay: 300ms\n ) {\n this.client = axios.create({\n baseURL,\n headers,\n timeout: 10000,\n });\n\n this.maxRetries = maxRetries;\n this.retryDelay = retryDelay;\n\n this.setupRetryInterceptor();\n }\n\n get axiosInstance(): AxiosInstance {\n return this.client;\n }\n\n private setupRetryInterceptor() {\n this.client.interceptors.response.use(\n response => response,\n async (error: AxiosError) => {\n const config: any = error.config;\n\n if (!config) throw error;\n\n // initialize retry counter\n if (!config._retryCount) config._retryCount = 0;\n\n // stop retry if max reached\n if (config._retryCount >= this.maxRetries) {\n throw error;\n }\n\n config._retryCount++;\n\n // exponential delay: delay * 2^(retryCount)\n const delay =\n this.retryDelay * Math.pow(2, config._retryCount);\n\n await new Promise(resolve => setTimeout(resolve, delay));\n\n return this.client(config);\n }\n );\n }\n post<T = any>(url: string, data: any, extraHeaders: Record<string, string> = {}): Promise<T> {\n return this.client\n .post<T>(url, data, { headers: extraHeaders })\n .then((res) => res.data);\n }\n patch<T = any>(\n url: string,\n data: any,\n extraHeaders: Record<string, string> = {}\n ): Promise<T> {\n return this.client\n .patch<T>(url, data, { headers: extraHeaders })\n .then((res) => res.data);\n }\n get<T = any>(url: string, extraHeaders: Record<string, string> = {}): Promise<T> {\n return this.client\n .get<T>(url, { headers: extraHeaders })\n .then((res) => res.data);\n }\n}\n","import { HttpClient } from \"../client/HttpClient\";\nimport {\n CreateJwtPayload,\n CreateJwtResponse,\n} from \"../types/auth.types\";\n\nexport class AuthAPI {\n constructor(\n private http: HttpClient\n ) { }\n\n createJwtToken(payload: CreateJwtPayload): Promise<CreateJwtResponse> {\n\n return this.http.post(\"/morambacrypto/create/jwt_token\", payload);\n }\n}\n","import { HttpClient } from \"../client/HttpClient\";\nimport {\n CreateCompanyPayload,\n CreateCompanyResponse,\n UpdateCompanyEmailPayload,\n UpdateCompanyEmailResponse,\n GetCompaniesQuery,\n GetCompaniesResponse,\n UpdateCompanyPaymentPayload,\n UpdateCompanyPaymentResponse,\n} from \"../types/company.types\";\n\nexport class CompanyAPI {\n constructor(\n private http: HttpClient\n ) { }\n\n createCompany(payload: CreateCompanyPayload, jwtToken: string): Promise<CreateCompanyResponse> {\n\n return this.http.post(\n \"/morambacrypto/create/company\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateCompanyEmail(\n payload: UpdateCompanyEmailPayload,\n jwtToken: string\n ): Promise<UpdateCompanyEmailResponse> {\n return this.http.patch(\n \"/morambacrypto/update/company/email\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n getCompaniesByPartner(\n jwtToken: string,\n query: GetCompaniesQuery\n ): Promise<GetCompaniesResponse> {\n const params = new URLSearchParams();\n\n if (query.limit) params.append(\"limit\", String(query.limit));\n if (query.direction) params.append(\"direction\", query.direction);\n if (query.cursor) params.append(\"cursor\", query.cursor);\n\n return this.http.get(\n `/morambacrypto/companies/partner/${query.partner_id}?${params.toString()}`,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateCompanyPaymentMethod(\n payload: UpdateCompanyPaymentPayload,\n jwtToken: string\n ): Promise<UpdateCompanyPaymentResponse> {\n return this.http.patch(\n \"/morambacrypto/update/company/payment\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n\n}\n","import { HttpClient } from \"../client\";\nimport { CreateMerchantPayload, CreateMerchantResponse, GetMerchantListResponse, GetMerchantQuery, GetMerchantResponse, MerchantListQuery, UpdateMerchantEmailPayload, UpdateMerchantEmailResponse, UpdateMerchantPaymentPayload, UpdateMerchantPaymentResponse } from \"../types/merchant.types\";\n\nexport class MerchantAPI {\n constructor(\n private http: HttpClient\n ) { }\n createMerchant(payload: CreateMerchantPayload, jwtToken: string): Promise<CreateMerchantResponse> {\n\n\n return this.http.post(\n \"/morambacrypto/create/merchant\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateMerchantPaymentMethod(\n payload: UpdateMerchantPaymentPayload,\n jwtToken: string\n ): Promise<UpdateMerchantPaymentResponse> {\n\n\n return this.http.patch(\n \"/morambacrypto/update/merchant/payment\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateMerchantEmail(\n payload: UpdateMerchantEmailPayload,\n jwtToken: string\n ): Promise<UpdateMerchantEmailResponse> {\n\n\n return this.http.patch(\n \"/morambacrypto/update/merchant/email\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n\n getMerchantList(\n jwtToken: string,\n query: MerchantListQuery = {}\n ): Promise<GetMerchantListResponse> {\n const params = new URLSearchParams();\n if (query.company_id) params.append(\"company_id\", String(query.company_id));\n if (query.limit) params.append(\"limit\", String(query.limit));\n if (query.cursor) params.append(\"cursor\", query.cursor);\n if (query.forward) params.append(\"cursor\", query.forward);\n if (query.backward) params.append(\"cursor\", query.backward);\n\n\n return this.http.get(\n `/morambacrypto/merchants/all?${params.toString()}`,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n getSingleMerchant(\n jwtToken: string,\n query: GetMerchantQuery = {}\n ): Promise<GetMerchantResponse> {\n const params = new URLSearchParams();\n if (query.merchant_id) params.append(\"merchant_id\", String(query.merchant_id));\n\n\n return this.http.get(\n `/morambacrypto/merchants?${params.toString()}`,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n}","import { HttpClient } from \"./client/HttpClient\";\nimport { AuthAPI } from \"./apis/auth.api\";\nimport { CompanyAPI } from \"./apis/company.api\";\nimport { MerchantAPI } from \"./apis/merchant.api\";\n\nexport interface MorambaClientConfig {\n baseURL: string;\n apiKey: string;\n partnerId: string;\n}\n\nexport class MorambaClient {\n public auth: AuthAPI;\n private http: HttpClient;\n public company: CompanyAPI;\n public merchant: MerchantAPI;\n\n constructor(config: MorambaClientConfig) {\n this.http = new HttpClient(config.baseURL, {\n \"Content-Type\": \"application/json\",\n });\n\n this.auth = new AuthAPI(this.http);\n this.company = new CompanyAPI(this.http);\n this.merchant = new MerchantAPI(this.http);\n }\n}\n","\nimport { ethers } from \"ethers\";\nimport { MONAD_CONFIG } from \"../utils/networks\";\n\nexport interface MonadApproveOptions {\n privateKey: string;\n unlimited?: boolean; // default: true\n amount?: string; // user-specified amount when limited\n decimalsOverride?: number; // optional override\n}\n\nexport async function monadApprove(options: MonadApproveOptions) {\n const {\n privateKey,\n unlimited = true,\n amount,\n decimalsOverride,\n } = options;\n\n const cfg = MONAD_CONFIG;\n\n const provider = new ethers.JsonRpcProvider(cfg.rpc);\n const wallet = new ethers.Wallet(privateKey, provider);\n\n const abi = [\n \"function approve(address spender, uint256 value) external returns (bool)\"\n ];\n\n const contract = new ethers.Contract(cfg.token, abi, wallet);\n\n const decimals = decimalsOverride ?? cfg.decimals;\n const humanAmount = amount ?? cfg.defaultAmount;\n\n const value = unlimited\n ? ethers.MaxUint256\n : ethers.parseUnits(humanAmount, decimals);\n\n console.log(\"⚡ Monad approve()\");\n console.log(\"RPC:\", cfg.rpc);\n console.log(\"Token:\", cfg.token);\n console.log(\"Spender:\", cfg.spender);\n console.log(\"Decimals:\", decimals);\n console.log(\"Amount:\", unlimited ? \"UNLIMITED\" : humanAmount);\n console.log(\"From:\", await wallet.getAddress());\n\n const tx = await contract.approve(cfg.spender, value);\n console.log(\"📤 TX:\", tx.hash);\n\n const receipt = await tx.wait();\n console.log(\"✅ Block:\", receipt.blockNumber);\n\n return { hash: tx.hash, receipt };\n}\n","\nexport interface TokenNetworkConfig {\n rpc: string;\n spender: string;\n token: string;\n decimals: number;\n defaultAmount: string;\n}\n\n// ▶️ MORAMBA Token (Monad)\nexport const MONAD_CONFIG: TokenNetworkConfig = {\n rpc: \"https://testnet-rpc.monad.xyz\",\n spender: \"0xbAcEa624831C5f294a5E7FeC519232AA37ec0a8C\",\n token: \"0x62F6c82114809C00a1293be02A43C05a3F917202\",\n decimals: 18,\n defaultAmount: \"1000\",\n};\n\n// ▶️ Sepolia \nexport const SEPOLIA_CONFIG: TokenNetworkConfig = {\n rpc: \"https://rpc.sepolia.org\",\n spender: \"0x6E2024Da220C081059f606D9EEAe670c84Ead9Ab\",\n token: \"0xbAcEa624831C5f294a5E7FeC519232AA37ec0a8C\",\n decimals: 18,\n defaultAmount: \"1000\",\n};\n","import { ethers } from \"ethers\";\nimport { SEPOLIA_CONFIG } from \"../utils/networks\";\n\nexport interface SepoliaApproveOptions {\n privateKey: string;\n unlimited?: boolean;\n amount?: string;\n decimalsOverride?: number;\n}\n\nexport async function sepoliaApprove(options: SepoliaApproveOptions) {\n const {\n privateKey,\n unlimited = true,\n amount,\n decimalsOverride,\n } = options;\n\n const cfg = SEPOLIA_CONFIG;\n\n const provider = new ethers.JsonRpcProvider(cfg.rpc);\n const wallet = new ethers.Wallet(privateKey, provider);\n\n const abi = [\n \"function approve(address spender, uint256 value) external returns (bool)\"\n ];\n\n const contract = new ethers.Contract(cfg.token, abi, wallet);\n\n const decimals = decimalsOverride ?? cfg.decimals;\n const humanAmount = amount ?? cfg.defaultAmount;\n\n const value = unlimited\n ? ethers.MaxUint256\n : ethers.parseUnits(humanAmount, decimals);\n\n console.log(\"⚡ Sepolia approve()\");\n console.log(\"RPC:\", cfg.rpc);\n console.log(\"Token:\", cfg.token);\n console.log(\"Spender:\", cfg.spender);\n console.log(\"Decimals:\", decimals);\n console.log(\"Amount:\", unlimited ? \"UNLIMITED\" : humanAmount);\n console.log(\"From:\", await wallet.getAddress());\n\n const tx = await contract.approve(cfg.spender, value);\n console.log(\"📤 TX:\", tx.hash);\n\n const receipt = await tx.wait();\n console.log(\"✅ Block:\", receipt.blockNumber);\n\n return { hash: tx.hash, receipt };\n}\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,EAAA,iBAAAC,EAAA,mBAAAC,IAAA,eAAAC,EAAAL,GCAA,IAAAM,EAAiD,oBAEpCC,EAAN,KAAiB,CAKpB,YACIC,EACAC,EAAkC,CAAC,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Q,IAAI,0BAAqB,EACjC,QAAQ,IAAI,OAAQN,EAAI,GAAG,EAC3B,QAAQ,IAAI,SAAUA,EAAI,KAAK,EAC/B,QAAQ,IAAI,WAAYA,EAAI,OAAO,EACnC,QAAQ,IAAI,YAAaM,CAAQ,EACjC,QAAQ,IAAI,UAAWT,EAAY,YAAcU,CAAW,EAC5D,QAAQ,IAAI,QAAS,MAAMJ,EAAO,WAAW,CAAC,EAE9C,IAAMM,EAAK,MAAMJ,EAAS,QAAQL,EAAI,QAASQ,CAAK,EACpD,QAAQ,IAAI,gBAAUC,EAAG,IAAI,EAE7B,IAAMC,EAAU,MAAMD,EAAG,KAAK,EAC9B,eAAQ,IAAI,gBAAYC,EAAQ,WAAW,EAEpC,CAAE,KAAMD,EAAG,KAAM,QAAAC,CAAQ,CACpC","names":["index_exports","__export","MorambaClient","monadApprove","sepoliaApprove","__toCommonJS","import_axios","HttpClient","baseURL","headers","maxRetries","retryDelay","axios","response","error","config","delay","resolve","url","data","extraHeaders","res","AuthAPI","http","payload","CompanyAPI","http","payload","jwtToken","query","params","MerchantAPI","http","payload","jwtToken","query","params","MorambaClient","config","HttpClient","AuthAPI","CompanyAPI","MerchantAPI","import_ethers","MONAD_CONFIG","SEPOLIA_CONFIG","monadApprove","options","privateKey","unlimited","amount","decimalsOverride","cfg","MONAD_CONFIG","provider","wallet","abi","contract","decimals","humanAmount","value","tx","receipt","import_ethers","sepoliaApprove","options","privateKey","unlimited","amount","decimalsOverride","cfg","SEPOLIA_CONFIG","provider","wallet","abi","contract","decimals","humanAmount","value","tx","receipt"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/client/HttpClient.ts","../src/apis/auth.api.ts","../src/apis/company.api.ts","../src/apis/merchant.api.ts","../src/MorambaClient.ts","../src/authorize/monad.approve.ts","../src/utils/networks.ts","../src/authorize/sepolia.approve.ts"],"sourcesContent":["export * from \"./MorambaClient\";\nexport * from \"./types\";\nexport * from \"./authorize\";\n","import axios, { AxiosInstance, AxiosError } from \"axios\";\n\nexport class HttpClient {\n private client: AxiosInstance;\n private maxRetries: number;\n private retryDelay: number; // base delay in milliseconds\n\n constructor(\n baseURL: string,\n headers: Record<string, string> = {},\n maxRetries = 4, // default: 4 retries\n retryDelay = 300 // base delay: 300ms\n ) {\n this.client = axios.create({\n baseURL,\n headers,\n timeout: 10000,\n });\n\n this.maxRetries = maxRetries;\n this.retryDelay = retryDelay;\n\n this.setupRetryInterceptor();\n }\n\n get axiosInstance(): AxiosInstance {\n return this.client;\n }\n\n private setupRetryInterceptor() {\n this.client.interceptors.response.use(\n response => response,\n async (error: AxiosError) => {\n const config: any = error.config;\n\n if (!config) throw error;\n\n // initialize retry counter\n if (!config._retryCount) config._retryCount = 0;\n\n // stop retry if max reached\n if (config._retryCount >= this.maxRetries) {\n throw error;\n }\n\n config._retryCount++;\n\n // exponential delay: delay * 2^(retryCount)\n const delay =\n this.retryDelay * Math.pow(2, config._retryCount);\n\n await new Promise(resolve => setTimeout(resolve, delay));\n\n return this.client(config);\n }\n );\n }\n post<T = any>(url: string, data: any, extraHeaders: Record<string, string> = {}): Promise<T> {\n return this.client\n .post<T>(url, data, { headers: extraHeaders })\n .then((res) => res.data);\n }\n patch<T = any>(\n url: string,\n data: any,\n extraHeaders: Record<string, string> = {}\n ): Promise<T> {\n return this.client\n .patch<T>(url, data, { headers: extraHeaders })\n .then((res) => res.data);\n }\n get<T = any>(url: string, extraHeaders: Record<string, string> = {}): Promise<T> {\n return this.client\n .get<T>(url, { headers: extraHeaders })\n .then((res) => res.data);\n }\n}\n","import { HttpClient } from \"../client/HttpClient\";\nimport {\n CreateJwtPayload,\n CreateJwtResponse,\n} from \"../types/auth.types\";\n\nexport class AuthAPI {\n constructor(\n private http: HttpClient,\n private partnerId: string,\n private apiKey: string\n\n ) { }\n\n createJwtToken(payload: CreateJwtPayload): Promise<CreateJwtResponse> {\n let fullPayload = {\n ...payload,\n partner_id: this.partnerId,\n api_key: this.apiKey,\n };\n\n return this.http.post(\"/morambacrypto/create/jwt_token\", fullPayload);\n }\n}\n","import { HttpClient } from \"../client/HttpClient\";\nimport {\n CreateCompanyPayload,\n CreateCompanyResponse,\n UpdateCompanyEmailPayload,\n UpdateCompanyEmailResponse,\n GetCompaniesQuery,\n GetCompaniesResponse,\n UpdateCompanyPaymentPayload,\n UpdateCompanyPaymentResponse,\n} from \"../types/company.types\";\n\nexport class CompanyAPI {\n constructor(\n private http: HttpClient\n ) { }\n\n createCompany(payload: CreateCompanyPayload, jwtToken: string): Promise<CreateCompanyResponse> {\n\n return this.http.post(\n \"/morambacrypto/create/company\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateCompanyEmail(\n payload: UpdateCompanyEmailPayload,\n jwtToken: string\n ): Promise<UpdateCompanyEmailResponse> {\n return this.http.patch(\n \"/morambacrypto/update/company/email\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n getCompaniesByPartner(\n jwtToken: string,\n query: GetCompaniesQuery\n ): Promise<GetCompaniesResponse> {\n const params = new URLSearchParams();\n\n if (query.limit) params.append(\"limit\", String(query.limit));\n if (query.direction) params.append(\"direction\", query.direction);\n if (query.cursor) params.append(\"cursor\", query.cursor);\n\n return this.http.get(\n `/morambacrypto/companies/partner/${query.partner_id}?${params.toString()}`,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateCompanyPaymentMethod(\n payload: UpdateCompanyPaymentPayload,\n jwtToken: string\n ): Promise<UpdateCompanyPaymentResponse> {\n return this.http.patch(\n \"/morambacrypto/update/company/payment\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n\n}\n","import { HttpClient } from \"../client\";\nimport { CreateMerchantPayload, CreateMerchantResponse, GetMerchantListResponse, GetMerchantQuery, GetMerchantResponse, MerchantListQuery, UpdateMerchantEmailPayload, UpdateMerchantEmailResponse, UpdateMerchantPaymentPayload, UpdateMerchantPaymentResponse } from \"../types/merchant.types\";\n\nexport class MerchantAPI {\n constructor(\n private http: HttpClient\n ) { }\n createMerchant(payload: CreateMerchantPayload, jwtToken: string): Promise<CreateMerchantResponse> {\n\n\n return this.http.post(\n \"/morambacrypto/create/merchant\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateMerchantPaymentMethod(\n payload: UpdateMerchantPaymentPayload,\n jwtToken: string\n ): Promise<UpdateMerchantPaymentResponse> {\n\n\n return this.http.patch(\n \"/morambacrypto/update/merchant/payment\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateMerchantEmail(\n payload: UpdateMerchantEmailPayload,\n jwtToken: string\n ): Promise<UpdateMerchantEmailResponse> {\n\n\n return this.http.patch(\n \"/morambacrypto/update/merchant/email\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n\n getMerchantList(\n jwtToken: string,\n query: MerchantListQuery = {}\n ): Promise<GetMerchantListResponse> {\n const params = new URLSearchParams();\n if (query.company_id) params.append(\"company_id\", String(query.company_id));\n if (query.limit) params.append(\"limit\", String(query.limit));\n if (query.cursor) params.append(\"cursor\", query.cursor);\n if (query.forward) params.append(\"cursor\", query.forward);\n if (query.backward) params.append(\"cursor\", query.backward);\n\n\n return this.http.get(\n `/morambacrypto/merchants/all?${params.toString()}`,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n getSingleMerchant(\n jwtToken: string,\n query: GetMerchantQuery = {}\n ): Promise<GetMerchantResponse> {\n const params = new URLSearchParams();\n if (query.merchant_id) params.append(\"merchant_id\", String(query.merchant_id));\n\n\n return this.http.get(\n `/morambacrypto/merchants?${params.toString()}`,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n}","import { HttpClient } from \"./client/HttpClient\";\nimport { AuthAPI } from \"./apis/auth.api\";\nimport { CompanyAPI } from \"./apis/company.api\";\nimport { MerchantAPI } from \"./apis/merchant.api\";\n\nexport interface MorambaClientConfig {\n baseURL: string;\n apiKey: string;\n partnerId: string;\n}\n\nexport class MorambaClient {\n public auth: AuthAPI;\n private http: HttpClient;\n public company: CompanyAPI;\n public merchant: MerchantAPI;\n\n constructor(config: MorambaClientConfig) {\n this.http = new HttpClient(config.baseURL, {\n \"Content-Type\": \"application/json\",\n });\n\n this.auth = new AuthAPI(this.http, config.partnerId, config.apiKey);\n this.company = new CompanyAPI(this.http);\n this.merchant = new MerchantAPI(this.http);\n }\n}\n","\nimport { ethers } from \"ethers\";\nimport { MONAD_CONFIG } from \"../utils/networks\";\n\nexport interface MonadApproveOptions {\n privateKey: string;\n unlimited?: boolean; // default: true\n amount?: string; // user-specified amount when limited\n decimalsOverride?: number; // optional override\n}\n\nexport async function monadApprove(options: MonadApproveOptions) {\n const {\n privateKey,\n unlimited = true,\n amount,\n decimalsOverride,\n } = options;\n\n const cfg = MONAD_CONFIG;\n\n const provider = new ethers.JsonRpcProvider(cfg.rpc);\n const wallet = new ethers.Wallet(privateKey, provider);\n\n const abi = [\n \"function approve(address spender, uint256 value) external returns (bool)\"\n ];\n\n const contract = new ethers.Contract(cfg.token, abi, wallet);\n\n const decimals = decimalsOverride ?? cfg.decimals;\n const humanAmount = amount ?? cfg.defaultAmount;\n\n const value = unlimited\n ? ethers.MaxUint256\n : ethers.parseUnits(humanAmount, decimals);\n\n console.log(\"⚡ Monad approve()\");\n console.log(\"RPC:\", cfg.rpc);\n console.log(\"Token:\", cfg.token);\n console.log(\"Spender:\", cfg.spender);\n console.log(\"Decimals:\", decimals);\n console.log(\"Amount:\", unlimited ? \"UNLIMITED\" : humanAmount);\n console.log(\"From:\", await wallet.getAddress());\n\n const tx = await contract.approve(cfg.spender, value);\n console.log(\"📤 TX:\", tx.hash);\n\n const receipt = await tx.wait();\n console.log(\"✅ Block:\", receipt.blockNumber);\n\n return { hash: tx.hash, receipt };\n}\n","\nexport interface TokenNetworkConfig {\n rpc: string;\n spender: string;\n token: string;\n decimals: number;\n defaultAmount: string;\n}\n\n// ▶️ MORAMBA Token (Monad)\nexport const MONAD_CONFIG: TokenNetworkConfig = {\n rpc: \"https://testnet-rpc.monad.xyz\",\n spender: \"0xbAcEa624831C5f294a5E7FeC519232AA37ec0a8C\",\n token: \"0x62F6c82114809C00a1293be02A43C05a3F917202\",\n decimals: 18,\n defaultAmount: \"1000\",\n};\n\n// ▶️ Sepolia \nexport const SEPOLIA_CONFIG: TokenNetworkConfig = {\n rpc: \"https://rpc.sepolia.org\",\n spender: \"0x6E2024Da220C081059f606D9EEAe670c84Ead9Ab\",\n token: \"0xbAcEa624831C5f294a5E7FeC519232AA37ec0a8C\",\n decimals: 18,\n defaultAmount: \"1000\",\n};\n","import { ethers } from \"ethers\";\nimport { SEPOLIA_CONFIG } from \"../utils/networks\";\n\nexport interface SepoliaApproveOptions {\n privateKey: string;\n unlimited?: boolean;\n amount?: string;\n decimalsOverride?: number;\n}\n\nexport async function sepoliaApprove(options: SepoliaApproveOptions) {\n const {\n privateKey,\n unlimited = true,\n amount,\n decimalsOverride,\n } = options;\n\n const cfg = SEPOLIA_CONFIG;\n\n const provider = new ethers.JsonRpcProvider(cfg.rpc);\n const wallet = new ethers.Wallet(privateKey, provider);\n\n const abi = [\n \"function approve(address spender, uint256 value) external returns (bool)\"\n ];\n\n const contract = new ethers.Contract(cfg.token, abi, wallet);\n\n const decimals = decimalsOverride ?? cfg.decimals;\n const humanAmount = amount ?? cfg.defaultAmount;\n\n const value = unlimited\n ? ethers.MaxUint256\n : ethers.parseUnits(humanAmount, decimals);\n\n console.log(\"⚡ Sepolia approve()\");\n console.log(\"RPC:\", cfg.rpc);\n console.log(\"Token:\", cfg.token);\n console.log(\"Spender:\", cfg.spender);\n console.log(\"Decimals:\", decimals);\n console.log(\"Amount:\", unlimited ? \"UNLIMITED\" : humanAmount);\n console.log(\"From:\", await wallet.getAddress());\n\n const tx = await contract.approve(cfg.spender, value);\n console.log(\"📤 TX:\", tx.hash);\n\n const receipt = await tx.wait();\n console.log(\"✅ Block:\", receipt.blockNumber);\n\n return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AEEK,EAAMC,EAENC,EAAW,IAAI,SAAO,gBAAgBF,EAAI,GAAG,EAC7CG,EAAS,IAAI,SAAO,OAAOP,EAAYM,CAAQ,EAE/CE,EAAM,CACR,0EACJ,EAEMC,EAAW,IAAI,SAAO,SAASL,EAAI,MAAOI,EAAKD,CAAM,EAErDG,EAAWP,GAAA,KAAAA,EAAoBC,EAAI,SACnCO,EAAcT,GAAA,KAAAA,EAAUE,EAAI,cAE5BQ,EAAQX,EACR,SAAO,WACP,SAAO,WAAWU,EAAaD,CAAQ,EAE7C,QAAQ,IAAI,0BAAqB,EACjC,QAAQ,IAAI,OAAQN,EAAI,GAAG,EAC3B,QAAQ,IAAI,SAAUA,EAAI,KAAK,EAC/B,QAAQ,IAAI,WAAYA,EAAI,OAAO,EACnC,QAAQ,IAAI,YAAaM,CAAQ,EACjC,QAAQ,IAAI,UAAWT,EAAY,YAAcU,CAAW,EAC5D,QAAQ,IAAI,QAAS,MAAMJ,EAAO,WAAW,CAAC,EAE9C,IAAMM,EAAK,MAAMJ,EAAS,QAAQL,EAAI,QAASQ,CAAK,EACpD,QAAQ,IAAI,gBAAUC,EAAG,IAAI,EAE7B,IAAMC,EAAU,MAAMD,EAAG,KAAK,EAC9B,eAAQ,IAAI,gBAAYC,EAAQ,WAAW,EAEpC,CAAE,KAAMD,EAAG,KAAM,QAAAC,CAAQ,CACpC","names":["index_exports","__export","MorambaClient","monadApprove","sepoliaApprove","__toCommonJS","import_axios","HttpClient","baseURL","headers","maxRetries","retryDelay","axios","response","error","config","delay","resolve","url","data","extraHeaders","res","AuthAPI","http","partnerId","apiKey","payload","fullPayload","CompanyAPI","http","payload","jwtToken","query","params","MerchantAPI","http","payload","jwtToken","query","params","MorambaClient","config","HttpClient","AuthAPI","CompanyAPI","MerchantAPI","import_ethers","MONAD_CONFIG","SEPOLIA_CONFIG","monadApprove","options","privateKey","unlimited","amount","decimalsOverride","cfg","MONAD_CONFIG","provider","wallet","abi","contract","decimals","humanAmount","value","tx","receipt","import_ethers","sepoliaApprove","options","privateKey","unlimited","amount","decimalsOverride","cfg","SEPOLIA_CONFIG","provider","wallet","abi","contract","decimals","humanAmount","value","tx","receipt"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import R from"axios";var d=class{constructor(e,t={},r=4,a=300){this.client=R.create({baseURL:e,headers:t,timeout:1e4}),this.maxRetries=r,this.retryDelay=a,this.setupRetryInterceptor()}get axiosInstance(){return this.client}setupRetryInterceptor(){this.client.interceptors.response.use(e=>e,async e=>{let t=e.config;if(!t||(t._retryCount||(t._retryCount=0),t._retryCount>=this.maxRetries))throw e;t._retryCount++;let r=this.retryDelay*Math.pow(2,t._retryCount);return await new Promise(a=>setTimeout(a,r)),this.client(t)})}post(e,t,r={}){return this.client.post(e,t,{headers:r}).then(a=>a.data)}patch(e,t,r={}){return this.client.patch(e,t,{headers:r}).then(a=>a.data)}get(e,t={}){return this.client.get(e,{headers:t}).then(r=>r.data)}};var u=class{constructor(e){this.http=e}createJwtToken(e){return this.http.post("/morambacrypto/create/jwt_token",
|
|
1
|
+
import R from"axios";var d=class{constructor(e,t={},r=4,a=300){this.client=R.create({baseURL:e,headers:t,timeout:1e4}),this.maxRetries=r,this.retryDelay=a,this.setupRetryInterceptor()}get axiosInstance(){return this.client}setupRetryInterceptor(){this.client.interceptors.response.use(e=>e,async e=>{let t=e.config;if(!t||(t._retryCount||(t._retryCount=0),t._retryCount>=this.maxRetries))throw e;t._retryCount++;let r=this.retryDelay*Math.pow(2,t._retryCount);return await new Promise(a=>setTimeout(a,r)),this.client(t)})}post(e,t,r={}){return this.client.post(e,t,{headers:r}).then(a=>a.data)}patch(e,t,r={}){return this.client.patch(e,t,{headers:r}).then(a=>a.data)}get(e,t={}){return this.client.get(e,{headers:t}).then(r=>r.data)}};var u=class{constructor(e,t,r){this.http=e;this.partnerId=t;this.apiKey=r}createJwtToken(e){let t={...e,partner_id:this.partnerId,api_key:this.apiKey};return this.http.post("/morambacrypto/create/jwt_token",t)}};var y=class{constructor(e){this.http=e}createCompany(e,t){return this.http.post("/morambacrypto/create/company",e,{Authorization:`Bearer ${t}`})}updateCompanyEmail(e,t){return this.http.patch("/morambacrypto/update/company/email",e,{Authorization:`Bearer ${t}`})}getCompaniesByPartner(e,t){let r=new URLSearchParams;return t.limit&&r.append("limit",String(t.limit)),t.direction&&r.append("direction",t.direction),t.cursor&&r.append("cursor",t.cursor),this.http.get(`/morambacrypto/companies/partner/${t.partner_id}?${r.toString()}`,{Authorization:`Bearer ${e}`})}updateCompanyPaymentMethod(e,t){return this.http.patch("/morambacrypto/update/company/payment",e,{Authorization:`Bearer ${t}`})}};var g=class{constructor(e){this.http=e}createMerchant(e,t){return this.http.post("/morambacrypto/create/merchant",e,{Authorization:`Bearer ${t}`})}updateMerchantPaymentMethod(e,t){return this.http.patch("/morambacrypto/update/merchant/payment",e,{Authorization:`Bearer ${t}`})}updateMerchantEmail(e,t){return this.http.patch("/morambacrypto/update/merchant/email",e,{Authorization:`Bearer ${t}`})}getMerchantList(e,t={}){let r=new URLSearchParams;return t.company_id&&r.append("company_id",String(t.company_id)),t.limit&&r.append("limit",String(t.limit)),t.cursor&&r.append("cursor",t.cursor),t.forward&&r.append("cursor",t.forward),t.backward&&r.append("cursor",t.backward),this.http.get(`/morambacrypto/merchants/all?${r.toString()}`,{Authorization:`Bearer ${e}`})}getSingleMerchant(e,t={}){let r=new URLSearchParams;return t.merchant_id&&r.append("merchant_id",String(t.merchant_id)),this.http.get(`/morambacrypto/merchants?${r.toString()}`,{Authorization:`Bearer ${e}`})}};var w=class{constructor(e){this.http=new d(e.baseURL,{"Content-Type":"application/json"}),this.auth=new u(this.http,e.partnerId,e.apiKey),this.company=new y(this.http),this.merchant=new g(this.http)}};import{ethers as l}from"ethers";var x={rpc:"https://testnet-rpc.monad.xyz",spender:"0xbAcEa624831C5f294a5E7FeC519232AA37ec0a8C",token:"0x62F6c82114809C00a1293be02A43C05a3F917202",decimals:18,defaultAmount:"1000"},M={rpc:"https://rpc.sepolia.org",spender:"0x6E2024Da220C081059f606D9EEAe670c84Ead9Ab",token:"0xbAcEa624831C5f294a5E7FeC519232AA37ec0a8C",decimals:18,defaultAmount:"1000"};async function F(n){let{privateKey:e,unlimited:t=!0,amount:r,decimalsOverride:a}=n,o=x,C=new l.JsonRpcProvider(o.rpc),s=new l.Wallet(e,C),f=["function approve(address spender, uint256 value) external returns (bool)"],P=new l.Contract(o.token,f,s),p=a!=null?a:o.decimals,c=r!=null?r:o.defaultAmount,A=t?l.MaxUint256:l.parseUnits(c,p);console.log("\u26A1 Monad approve()"),console.log("RPC:",o.rpc),console.log("Token:",o.token),console.log("Spender:",o.spender),console.log("Decimals:",p),console.log("Amount:",t?"UNLIMITED":c),console.log("From:",await s.getAddress());let i=await P.approve(o.spender,A);console.log("\u{1F4E4} TX:",i.hash);let m=await i.wait();return console.log("\u2705 Block:",m.blockNumber),{hash:i.hash,receipt:m}}import{ethers as h}from"ethers";async function Q(n){let{privateKey:e,unlimited:t=!0,amount:r,decimalsOverride:a}=n,o=M,C=new h.JsonRpcProvider(o.rpc),s=new h.Wallet(e,C),f=["function approve(address spender, uint256 value) external returns (bool)"],P=new h.Contract(o.token,f,s),p=a!=null?a:o.decimals,c=r!=null?r:o.defaultAmount,A=t?h.MaxUint256:h.parseUnits(c,p);console.log("\u26A1 Sepolia approve()"),console.log("RPC:",o.rpc),console.log("Token:",o.token),console.log("Spender:",o.spender),console.log("Decimals:",p),console.log("Amount:",t?"UNLIMITED":c),console.log("From:",await s.getAddress());let i=await P.approve(o.spender,A);console.log("\u{1F4E4} TX:",i.hash);let m=await i.wait();return console.log("\u2705 Block:",m.blockNumber),{hash:i.hash,receipt:m}}export{w as MorambaClient,F as monadApprove,Q as sepoliaApprove};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client/HttpClient.ts","../src/apis/auth.api.ts","../src/apis/company.api.ts","../src/apis/merchant.api.ts","../src/MorambaClient.ts","../src/authorize/monad.approve.ts","../src/utils/networks.ts","../src/authorize/sepolia.approve.ts"],"sourcesContent":["import axios, { AxiosInstance, AxiosError } from \"axios\";\n\nexport class HttpClient {\n private client: AxiosInstance;\n private maxRetries: number;\n private retryDelay: number; // base delay in milliseconds\n\n constructor(\n baseURL: string,\n headers: Record<string, string> = {},\n maxRetries = 4, // default: 4 retries\n retryDelay = 300 // base delay: 300ms\n ) {\n this.client = axios.create({\n baseURL,\n headers,\n timeout: 10000,\n });\n\n this.maxRetries = maxRetries;\n this.retryDelay = retryDelay;\n\n this.setupRetryInterceptor();\n }\n\n get axiosInstance(): AxiosInstance {\n return this.client;\n }\n\n private setupRetryInterceptor() {\n this.client.interceptors.response.use(\n response => response,\n async (error: AxiosError) => {\n const config: any = error.config;\n\n if (!config) throw error;\n\n // initialize retry counter\n if (!config._retryCount) config._retryCount = 0;\n\n // stop retry if max reached\n if (config._retryCount >= this.maxRetries) {\n throw error;\n }\n\n config._retryCount++;\n\n // exponential delay: delay * 2^(retryCount)\n const delay =\n this.retryDelay * Math.pow(2, config._retryCount);\n\n await new Promise(resolve => setTimeout(resolve, delay));\n\n return this.client(config);\n }\n );\n }\n post<T = any>(url: string, data: any, extraHeaders: Record<string, string> = {}): Promise<T> {\n return this.client\n .post<T>(url, data, { headers: extraHeaders })\n .then((res) => res.data);\n }\n patch<T = any>(\n url: string,\n data: any,\n extraHeaders: Record<string, string> = {}\n ): Promise<T> {\n return this.client\n .patch<T>(url, data, { headers: extraHeaders })\n .then((res) => res.data);\n }\n get<T = any>(url: string, extraHeaders: Record<string, string> = {}): Promise<T> {\n return this.client\n .get<T>(url, { headers: extraHeaders })\n .then((res) => res.data);\n }\n}\n","import { HttpClient } from \"../client/HttpClient\";\nimport {\n CreateJwtPayload,\n CreateJwtResponse,\n} from \"../types/auth.types\";\n\nexport class AuthAPI {\n constructor(\n private http: HttpClient\n ) { }\n\n createJwtToken(payload: CreateJwtPayload): Promise<CreateJwtResponse> {\n\n return this.http.post(\"/morambacrypto/create/jwt_token\", payload);\n }\n}\n","import { HttpClient } from \"../client/HttpClient\";\nimport {\n CreateCompanyPayload,\n CreateCompanyResponse,\n UpdateCompanyEmailPayload,\n UpdateCompanyEmailResponse,\n GetCompaniesQuery,\n GetCompaniesResponse,\n UpdateCompanyPaymentPayload,\n UpdateCompanyPaymentResponse,\n} from \"../types/company.types\";\n\nexport class CompanyAPI {\n constructor(\n private http: HttpClient\n ) { }\n\n createCompany(payload: CreateCompanyPayload, jwtToken: string): Promise<CreateCompanyResponse> {\n\n return this.http.post(\n \"/morambacrypto/create/company\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateCompanyEmail(\n payload: UpdateCompanyEmailPayload,\n jwtToken: string\n ): Promise<UpdateCompanyEmailResponse> {\n return this.http.patch(\n \"/morambacrypto/update/company/email\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n getCompaniesByPartner(\n jwtToken: string,\n query: GetCompaniesQuery\n ): Promise<GetCompaniesResponse> {\n const params = new URLSearchParams();\n\n if (query.limit) params.append(\"limit\", String(query.limit));\n if (query.direction) params.append(\"direction\", query.direction);\n if (query.cursor) params.append(\"cursor\", query.cursor);\n\n return this.http.get(\n `/morambacrypto/companies/partner/${query.partner_id}?${params.toString()}`,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateCompanyPaymentMethod(\n payload: UpdateCompanyPaymentPayload,\n jwtToken: string\n ): Promise<UpdateCompanyPaymentResponse> {\n return this.http.patch(\n \"/morambacrypto/update/company/payment\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n\n}\n","import { HttpClient } from \"../client\";\nimport { CreateMerchantPayload, CreateMerchantResponse, GetMerchantListResponse, GetMerchantQuery, GetMerchantResponse, MerchantListQuery, UpdateMerchantEmailPayload, UpdateMerchantEmailResponse, UpdateMerchantPaymentPayload, UpdateMerchantPaymentResponse } from \"../types/merchant.types\";\n\nexport class MerchantAPI {\n constructor(\n private http: HttpClient\n ) { }\n createMerchant(payload: CreateMerchantPayload, jwtToken: string): Promise<CreateMerchantResponse> {\n\n\n return this.http.post(\n \"/morambacrypto/create/merchant\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateMerchantPaymentMethod(\n payload: UpdateMerchantPaymentPayload,\n jwtToken: string\n ): Promise<UpdateMerchantPaymentResponse> {\n\n\n return this.http.patch(\n \"/morambacrypto/update/merchant/payment\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateMerchantEmail(\n payload: UpdateMerchantEmailPayload,\n jwtToken: string\n ): Promise<UpdateMerchantEmailResponse> {\n\n\n return this.http.patch(\n \"/morambacrypto/update/merchant/email\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n\n getMerchantList(\n jwtToken: string,\n query: MerchantListQuery = {}\n ): Promise<GetMerchantListResponse> {\n const params = new URLSearchParams();\n if (query.company_id) params.append(\"company_id\", String(query.company_id));\n if (query.limit) params.append(\"limit\", String(query.limit));\n if (query.cursor) params.append(\"cursor\", query.cursor);\n if (query.forward) params.append(\"cursor\", query.forward);\n if (query.backward) params.append(\"cursor\", query.backward);\n\n\n return this.http.get(\n `/morambacrypto/merchants/all?${params.toString()}`,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n getSingleMerchant(\n jwtToken: string,\n query: GetMerchantQuery = {}\n ): Promise<GetMerchantResponse> {\n const params = new URLSearchParams();\n if (query.merchant_id) params.append(\"merchant_id\", String(query.merchant_id));\n\n\n return this.http.get(\n `/morambacrypto/merchants?${params.toString()}`,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n}","import { HttpClient } from \"./client/HttpClient\";\nimport { AuthAPI } from \"./apis/auth.api\";\nimport { CompanyAPI } from \"./apis/company.api\";\nimport { MerchantAPI } from \"./apis/merchant.api\";\n\nexport interface MorambaClientConfig {\n baseURL: string;\n apiKey: string;\n partnerId: string;\n}\n\nexport class MorambaClient {\n public auth: AuthAPI;\n private http: HttpClient;\n public company: CompanyAPI;\n public merchant: MerchantAPI;\n\n constructor(config: MorambaClientConfig) {\n this.http = new HttpClient(config.baseURL, {\n \"Content-Type\": \"application/json\",\n });\n\n this.auth = new AuthAPI(this.http);\n this.company = new CompanyAPI(this.http);\n this.merchant = new MerchantAPI(this.http);\n }\n}\n","\nimport { ethers } from \"ethers\";\nimport { MONAD_CONFIG } from \"../utils/networks\";\n\nexport interface MonadApproveOptions {\n privateKey: string;\n unlimited?: boolean; // default: true\n amount?: string; // user-specified amount when limited\n decimalsOverride?: number; // optional override\n}\n\nexport async function monadApprove(options: MonadApproveOptions) {\n const {\n privateKey,\n unlimited = true,\n amount,\n decimalsOverride,\n } = options;\n\n const cfg = MONAD_CONFIG;\n\n const provider = new ethers.JsonRpcProvider(cfg.rpc);\n const wallet = new ethers.Wallet(privateKey, provider);\n\n const abi = [\n \"function approve(address spender, uint256 value) external returns (bool)\"\n ];\n\n const contract = new ethers.Contract(cfg.token, abi, wallet);\n\n const decimals = decimalsOverride ?? cfg.decimals;\n const humanAmount = amount ?? cfg.defaultAmount;\n\n const value = unlimited\n ? ethers.MaxUint256\n : ethers.parseUnits(humanAmount, decimals);\n\n console.log(\"⚡ Monad approve()\");\n console.log(\"RPC:\", cfg.rpc);\n console.log(\"Token:\", cfg.token);\n console.log(\"Spender:\", cfg.spender);\n console.log(\"Decimals:\", decimals);\n console.log(\"Amount:\", unlimited ? \"UNLIMITED\" : humanAmount);\n console.log(\"From:\", await wallet.getAddress());\n\n const tx = await contract.approve(cfg.spender, value);\n console.log(\"📤 TX:\", tx.hash);\n\n const receipt = await tx.wait();\n console.log(\"✅ Block:\", receipt.blockNumber);\n\n return { hash: tx.hash, receipt };\n}\n","\nexport interface TokenNetworkConfig {\n rpc: string;\n spender: string;\n token: string;\n decimals: number;\n defaultAmount: string;\n}\n\n// ▶️ MORAMBA Token (Monad)\nexport const MONAD_CONFIG: TokenNetworkConfig = {\n rpc: \"https://testnet-rpc.monad.xyz\",\n spender: \"0xbAcEa624831C5f294a5E7FeC519232AA37ec0a8C\",\n token: \"0x62F6c82114809C00a1293be02A43C05a3F917202\",\n decimals: 18,\n defaultAmount: \"1000\",\n};\n\n// ▶️ Sepolia \nexport const SEPOLIA_CONFIG: TokenNetworkConfig = {\n rpc: \"https://rpc.sepolia.org\",\n spender: \"0x6E2024Da220C081059f606D9EEAe670c84Ead9Ab\",\n token: \"0xbAcEa624831C5f294a5E7FeC519232AA37ec0a8C\",\n decimals: 18,\n defaultAmount: \"1000\",\n};\n","import { ethers } from \"ethers\";\nimport { SEPOLIA_CONFIG } from \"../utils/networks\";\n\nexport interface SepoliaApproveOptions {\n privateKey: string;\n unlimited?: boolean;\n amount?: string;\n decimalsOverride?: number;\n}\n\nexport async function sepoliaApprove(options: SepoliaApproveOptions) {\n const {\n privateKey,\n unlimited = true,\n amount,\n decimalsOverride,\n } = options;\n\n const cfg = SEPOLIA_CONFIG;\n\n const provider = new ethers.JsonRpcProvider(cfg.rpc);\n const wallet = new ethers.Wallet(privateKey, provider);\n\n const abi = [\n \"function approve(address spender, uint256 value) external returns (bool)\"\n ];\n\n const contract = new ethers.Contract(cfg.token, abi, wallet);\n\n const decimals = decimalsOverride ?? cfg.decimals;\n const humanAmount = amount ?? cfg.defaultAmount;\n\n const value = unlimited\n ? ethers.MaxUint256\n : ethers.parseUnits(humanAmount, decimals);\n\n console.log(\"⚡ Sepolia approve()\");\n console.log(\"RPC:\", cfg.rpc);\n console.log(\"Token:\", cfg.token);\n console.log(\"Spender:\", cfg.spender);\n console.log(\"Decimals:\", decimals);\n console.log(\"Amount:\", unlimited ? \"UNLIMITED\" : humanAmount);\n console.log(\"From:\", await wallet.getAddress());\n\n const tx = await contract.approve(cfg.spender, value);\n console.log(\"📤 TX:\", tx.hash);\n\n const receipt = await tx.wait();\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,EAErDG,EAAWR,GAAA,KAAAA,EAAoBC,EAAI,SACnCQ,EAAcV,GAAA,KAAAA,EAAUE,EAAI,cAE5BS,EAAQZ,EACRM,EAAO,WACPA,EAAO,WAAWK,EAAaD,CAAQ,EAE7C,QAAQ,IAAI,0BAAqB,EACjC,QAAQ,IAAI,OAAQP,EAAI,GAAG,EAC3B,QAAQ,IAAI,SAAUA,EAAI,KAAK,EAC/B,QAAQ,IAAI,WAAYA,EAAI,OAAO,EACnC,QAAQ,IAAI,YAAaO,CAAQ,EACjC,QAAQ,IAAI,UAAWV,EAAY,YAAcW,CAAW,EAC5D,QAAQ,IAAI,QAAS,MAAMJ,EAAO,WAAW,CAAC,EAE9C,IAAMM,EAAK,MAAMJ,EAAS,QAAQN,EAAI,QAASS,CAAK,EACpD,QAAQ,IAAI,gBAAUC,EAAG,IAAI,EAE7B,IAAMC,EAAU,MAAMD,EAAG,KAAK,EAC9B,eAAQ,IAAI,gBAAYC,EAAQ,WAAW,EAEpC,CAAE,KAAMD,EAAG,KAAM,QAAAC,CAAQ,CACpC","names":["axios","HttpClient","baseURL","headers","maxRetries","retryDelay","response","error","config","delay","resolve","url","data","extraHeaders","res","AuthAPI","http","payload","CompanyAPI","http","payload","jwtToken","query","params","MerchantAPI","http","payload","jwtToken","query","params","MorambaClient","config","HttpClient","AuthAPI","CompanyAPI","MerchantAPI","ethers","MONAD_CONFIG","SEPOLIA_CONFIG","monadApprove","options","privateKey","unlimited","amount","decimalsOverride","cfg","MONAD_CONFIG","provider","ethers","wallet","abi","contract","decimals","humanAmount","value","tx","receipt","ethers","sepoliaApprove","options","privateKey","unlimited","amount","decimalsOverride","cfg","SEPOLIA_CONFIG","provider","ethers","wallet","abi","contract","decimals","humanAmount","value","tx","receipt"]}
|
|
1
|
+
{"version":3,"sources":["../src/client/HttpClient.ts","../src/apis/auth.api.ts","../src/apis/company.api.ts","../src/apis/merchant.api.ts","../src/MorambaClient.ts","../src/authorize/monad.approve.ts","../src/utils/networks.ts","../src/authorize/sepolia.approve.ts"],"sourcesContent":["import axios, { AxiosInstance, AxiosError } from \"axios\";\n\nexport class HttpClient {\n private client: AxiosInstance;\n private maxRetries: number;\n private retryDelay: number; // base delay in milliseconds\n\n constructor(\n baseURL: string,\n headers: Record<string, string> = {},\n maxRetries = 4, // default: 4 retries\n retryDelay = 300 // base delay: 300ms\n ) {\n this.client = axios.create({\n baseURL,\n headers,\n timeout: 10000,\n });\n\n this.maxRetries = maxRetries;\n this.retryDelay = retryDelay;\n\n this.setupRetryInterceptor();\n }\n\n get axiosInstance(): AxiosInstance {\n return this.client;\n }\n\n private setupRetryInterceptor() {\n this.client.interceptors.response.use(\n response => response,\n async (error: AxiosError) => {\n const config: any = error.config;\n\n if (!config) throw error;\n\n // initialize retry counter\n if (!config._retryCount) config._retryCount = 0;\n\n // stop retry if max reached\n if (config._retryCount >= this.maxRetries) {\n throw error;\n }\n\n config._retryCount++;\n\n // exponential delay: delay * 2^(retryCount)\n const delay =\n this.retryDelay * Math.pow(2, config._retryCount);\n\n await new Promise(resolve => setTimeout(resolve, delay));\n\n return this.client(config);\n }\n );\n }\n post<T = any>(url: string, data: any, extraHeaders: Record<string, string> = {}): Promise<T> {\n return this.client\n .post<T>(url, data, { headers: extraHeaders })\n .then((res) => res.data);\n }\n patch<T = any>(\n url: string,\n data: any,\n extraHeaders: Record<string, string> = {}\n ): Promise<T> {\n return this.client\n .patch<T>(url, data, { headers: extraHeaders })\n .then((res) => res.data);\n }\n get<T = any>(url: string, extraHeaders: Record<string, string> = {}): Promise<T> {\n return this.client\n .get<T>(url, { headers: extraHeaders })\n .then((res) => res.data);\n }\n}\n","import { HttpClient } from \"../client/HttpClient\";\nimport {\n CreateJwtPayload,\n CreateJwtResponse,\n} from \"../types/auth.types\";\n\nexport class AuthAPI {\n constructor(\n private http: HttpClient,\n private partnerId: string,\n private apiKey: string\n\n ) { }\n\n createJwtToken(payload: CreateJwtPayload): Promise<CreateJwtResponse> {\n let fullPayload = {\n ...payload,\n partner_id: this.partnerId,\n api_key: this.apiKey,\n };\n\n return this.http.post(\"/morambacrypto/create/jwt_token\", fullPayload);\n }\n}\n","import { HttpClient } from \"../client/HttpClient\";\nimport {\n CreateCompanyPayload,\n CreateCompanyResponse,\n UpdateCompanyEmailPayload,\n UpdateCompanyEmailResponse,\n GetCompaniesQuery,\n GetCompaniesResponse,\n UpdateCompanyPaymentPayload,\n UpdateCompanyPaymentResponse,\n} from \"../types/company.types\";\n\nexport class CompanyAPI {\n constructor(\n private http: HttpClient\n ) { }\n\n createCompany(payload: CreateCompanyPayload, jwtToken: string): Promise<CreateCompanyResponse> {\n\n return this.http.post(\n \"/morambacrypto/create/company\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateCompanyEmail(\n payload: UpdateCompanyEmailPayload,\n jwtToken: string\n ): Promise<UpdateCompanyEmailResponse> {\n return this.http.patch(\n \"/morambacrypto/update/company/email\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n getCompaniesByPartner(\n jwtToken: string,\n query: GetCompaniesQuery\n ): Promise<GetCompaniesResponse> {\n const params = new URLSearchParams();\n\n if (query.limit) params.append(\"limit\", String(query.limit));\n if (query.direction) params.append(\"direction\", query.direction);\n if (query.cursor) params.append(\"cursor\", query.cursor);\n\n return this.http.get(\n `/morambacrypto/companies/partner/${query.partner_id}?${params.toString()}`,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateCompanyPaymentMethod(\n payload: UpdateCompanyPaymentPayload,\n jwtToken: string\n ): Promise<UpdateCompanyPaymentResponse> {\n return this.http.patch(\n \"/morambacrypto/update/company/payment\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n\n}\n","import { HttpClient } from \"../client\";\nimport { CreateMerchantPayload, CreateMerchantResponse, GetMerchantListResponse, GetMerchantQuery, GetMerchantResponse, MerchantListQuery, UpdateMerchantEmailPayload, UpdateMerchantEmailResponse, UpdateMerchantPaymentPayload, UpdateMerchantPaymentResponse } from \"../types/merchant.types\";\n\nexport class MerchantAPI {\n constructor(\n private http: HttpClient\n ) { }\n createMerchant(payload: CreateMerchantPayload, jwtToken: string): Promise<CreateMerchantResponse> {\n\n\n return this.http.post(\n \"/morambacrypto/create/merchant\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateMerchantPaymentMethod(\n payload: UpdateMerchantPaymentPayload,\n jwtToken: string\n ): Promise<UpdateMerchantPaymentResponse> {\n\n\n return this.http.patch(\n \"/morambacrypto/update/merchant/payment\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateMerchantEmail(\n payload: UpdateMerchantEmailPayload,\n jwtToken: string\n ): Promise<UpdateMerchantEmailResponse> {\n\n\n return this.http.patch(\n \"/morambacrypto/update/merchant/email\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n\n getMerchantList(\n jwtToken: string,\n query: MerchantListQuery = {}\n ): Promise<GetMerchantListResponse> {\n const params = new URLSearchParams();\n if (query.company_id) params.append(\"company_id\", String(query.company_id));\n if (query.limit) params.append(\"limit\", String(query.limit));\n if (query.cursor) params.append(\"cursor\", query.cursor);\n if (query.forward) params.append(\"cursor\", query.forward);\n if (query.backward) params.append(\"cursor\", query.backward);\n\n\n return this.http.get(\n `/morambacrypto/merchants/all?${params.toString()}`,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n getSingleMerchant(\n jwtToken: string,\n query: GetMerchantQuery = {}\n ): Promise<GetMerchantResponse> {\n const params = new URLSearchParams();\n if (query.merchant_id) params.append(\"merchant_id\", String(query.merchant_id));\n\n\n return this.http.get(\n `/morambacrypto/merchants?${params.toString()}`,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n}","import { HttpClient } from \"./client/HttpClient\";\nimport { AuthAPI } from \"./apis/auth.api\";\nimport { CompanyAPI } from \"./apis/company.api\";\nimport { MerchantAPI } from \"./apis/merchant.api\";\n\nexport interface MorambaClientConfig {\n baseURL: string;\n apiKey: string;\n partnerId: string;\n}\n\nexport class MorambaClient {\n public auth: AuthAPI;\n private http: HttpClient;\n public company: CompanyAPI;\n public merchant: MerchantAPI;\n\n constructor(config: MorambaClientConfig) {\n this.http = new HttpClient(config.baseURL, {\n \"Content-Type\": \"application/json\",\n });\n\n this.auth = new AuthAPI(this.http, config.partnerId, config.apiKey);\n this.company = new CompanyAPI(this.http);\n this.merchant = new MerchantAPI(this.http);\n }\n}\n","\nimport { ethers } from \"ethers\";\nimport { MONAD_CONFIG } from \"../utils/networks\";\n\nexport interface MonadApproveOptions {\n privateKey: string;\n unlimited?: boolean; // default: true\n amount?: string; // user-specified amount when limited\n decimalsOverride?: number; // optional override\n}\n\nexport async function monadApprove(options: MonadApproveOptions) {\n const {\n privateKey,\n unlimited = true,\n amount,\n decimalsOverride,\n } = options;\n\n const cfg = MONAD_CONFIG;\n\n const provider = new ethers.JsonRpcProvider(cfg.rpc);\n const wallet = new ethers.Wallet(privateKey, provider);\n\n const abi = [\n \"function approve(address spender, uint256 value) external returns (bool)\"\n ];\n\n const contract = new ethers.Contract(cfg.token, abi, wallet);\n\n const decimals = decimalsOverride ?? cfg.decimals;\n const humanAmount = amount ?? cfg.defaultAmount;\n\n const value = unlimited\n ? ethers.MaxUint256\n : ethers.parseUnits(humanAmount, decimals);\n\n console.log(\"⚡ Monad approve()\");\n console.log(\"RPC:\", cfg.rpc);\n console.log(\"Token:\", cfg.token);\n console.log(\"Spender:\", cfg.spender);\n console.log(\"Decimals:\", decimals);\n console.log(\"Amount:\", unlimited ? \"UNLIMITED\" : humanAmount);\n console.log(\"From:\", await wallet.getAddress());\n\n const tx = await contract.approve(cfg.spender, value);\n console.log(\"📤 TX:\", tx.hash);\n\n const receipt = await tx.wait();\n console.log(\"✅ Block:\", receipt.blockNumber);\n\n return { hash: tx.hash, receipt };\n}\n","\nexport interface TokenNetworkConfig {\n rpc: string;\n spender: string;\n token: string;\n decimals: number;\n defaultAmount: string;\n}\n\n// ▶️ MORAMBA Token (Monad)\nexport const MONAD_CONFIG: TokenNetworkConfig = {\n rpc: \"https://testnet-rpc.monad.xyz\",\n spender: \"0xbAcEa624831C5f294a5E7FeC519232AA37ec0a8C\",\n token: \"0x62F6c82114809C00a1293be02A43C05a3F917202\",\n decimals: 18,\n defaultAmount: \"1000\",\n};\n\n// ▶️ Sepolia \nexport const SEPOLIA_CONFIG: TokenNetworkConfig = {\n rpc: \"https://rpc.sepolia.org\",\n spender: \"0x6E2024Da220C081059f606D9EEAe670c84Ead9Ab\",\n token: \"0xbAcEa624831C5f294a5E7FeC519232AA37ec0a8C\",\n decimals: 18,\n defaultAmount: \"1000\",\n};\n","import { ethers } from \"ethers\";\nimport { SEPOLIA_CONFIG } from \"../utils/networks\";\n\nexport interface SepoliaApproveOptions {\n privateKey: string;\n unlimited?: boolean;\n amount?: string;\n decimalsOverride?: number;\n}\n\nexport async function sepoliaApprove(options: SepoliaApproveOptions) {\n const {\n privateKey,\n unlimited = true,\n amount,\n decimalsOverride,\n } = options;\n\n const cfg = SEPOLIA_CONFIG;\n\n const provider = new ethers.JsonRpcProvider(cfg.rpc);\n const wallet = new ethers.Wallet(privateKey, provider);\n\n const abi = [\n \"function approve(address spender, uint256 value) external returns (bool)\"\n ];\n\n const contract = new ethers.Contract(cfg.token, abi, wallet);\n\n const decimals = decimalsOverride ?? cfg.decimals;\n const humanAmount = amount ?? cfg.defaultAmount;\n\n const value = unlimited\n ? ethers.MaxUint256\n : ethers.parseUnits(humanAmount, decimals);\n\n console.log(\"⚡ Sepolia approve()\");\n console.log(\"RPC:\", cfg.rpc);\n console.log(\"Token:\", cfg.token);\n console.log(\"Spender:\", cfg.spender);\n console.log(\"Decimals:\", decimals);\n console.log(\"Amount:\", unlimited ? \"UNLIMITED\" : humanAmount);\n console.log(\"From:\", await wallet.getAddress());\n\n const tx = await contract.approve(cfg.spender, value);\n console.log(\"📤 TX:\", tx.hash);\n\n const rece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AgBH,EAAI,GAAG,EAC7CI,EAAS,IAAID,EAAO,OAAOP,EAAYM,CAAQ,EAE/CG,EAAM,CACR,0EACJ,EAEMC,EAAW,IAAIH,EAAO,SAASH,EAAI,MAAOK,EAAKD,CAAM,EAErDG,EAAWR,GAAA,KAAAA,EAAoBC,EAAI,SACnCQ,EAAcV,GAAA,KAAAA,EAAUE,EAAI,cAE5BS,EAAQZ,EACRM,EAAO,WACPA,EAAO,WAAWK,EAAaD,CAAQ,EAE7C,QAAQ,IAAI,0BAAqB,EACjC,QAAQ,IAAI,OAAQP,EAAI,GAAG,EAC3B,QAAQ,IAAI,SAAUA,EAAI,KAAK,EAC/B,QAAQ,IAAI,WAAYA,EAAI,OAAO,EACnC,QAAQ,IAAI,YAAaO,CAAQ,EACjC,QAAQ,IAAI,UAAWV,EAAY,YAAcW,CAAW,EAC5D,QAAQ,IAAI,QAAS,MAAMJ,EAAO,WAAW,CAAC,EAE9C,IAAMM,EAAK,MAAMJ,EAAS,QAAQN,EAAI,QAASS,CAAK,EACpD,QAAQ,IAAI,gBAAUC,EAAG,IAAI,EAE7B,IAAMC,EAAU,MAAMD,EAAG,KAAK,EAC9B,eAAQ,IAAI,gBAAYC,EAAQ,WAAW,EAEpC,CAAE,KAAMD,EAAG,KAAM,QAAAC,CAAQ,CACpC","names":["axios","HttpClient","baseURL","headers","maxRetries","retryDelay","response","error","config","delay","resolve","url","data","extraHeaders","res","AuthAPI","http","partnerId","apiKey","payload","fullPayload","CompanyAPI","http","payload","jwtToken","query","params","MerchantAPI","http","payload","jwtToken","query","params","MorambaClient","config","HttpClient","AuthAPI","CompanyAPI","MerchantAPI","ethers","MONAD_CONFIG","SEPOLIA_CONFIG","monadApprove","options","privateKey","unlimited","amount","decimalsOverride","cfg","MONAD_CONFIG","provider","ethers","wallet","abi","contract","decimals","humanAmount","value","tx","receipt","ethers","sepoliaApprove","options","privateKey","unlimited","amount","decimalsOverride","cfg","SEPOLIA_CONFIG","provider","ethers","wallet","abi","contract","decimals","humanAmount","value","tx","receipt"]}
|