@morambacrypto/connect 0.0.18 → 0.0.19

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 CHANGED
@@ -210,6 +210,108 @@ declare class MerchantAPI {
210
210
  getSingleMerchant(jwtToken: string, query?: GetMerchantQuery): Promise<GetMerchantResponse>;
211
211
  }
212
212
 
213
+ declare enum UserTypeVal {
214
+ CUSTOMER = "customer",
215
+ VENDOR = "vendor",
216
+ AI_AGENT = "AI_agent",
217
+ DEVICE = "device",
218
+ OTHER = "other"
219
+ }
220
+ interface CreateUserPayload {
221
+ payment_method: PaymentMethod;
222
+ user_name: string;
223
+ user_email: string;
224
+ user_type: UserTypeVal;
225
+ company_id: string;
226
+ merchant_id: string;
227
+ }
228
+ interface UserData {
229
+ id: string;
230
+ merchant_id: string;
231
+ user_name: string;
232
+ user_email: string;
233
+ company_id: string;
234
+ partner_id: string;
235
+ user_type: string;
236
+ payment_network: string;
237
+ payment_token_name: string;
238
+ payment_token_address: string;
239
+ created_at: string;
240
+ updated_at: string;
241
+ }
242
+ interface CreateUserResponse {
243
+ success: boolean;
244
+ message: string;
245
+ data: UserData | null;
246
+ }
247
+ interface UpdateUserPaymentPayload {
248
+ company_id: string;
249
+ merchant_id: string;
250
+ user_id: string;
251
+ payment_method: PaymentMethod;
252
+ }
253
+ interface UpdateUserPaymentResponse {
254
+ success: boolean;
255
+ message: string;
256
+ data: UserData | null;
257
+ }
258
+ interface UpdateUserEmailPayload {
259
+ company_id: string;
260
+ merchant_id: string;
261
+ user_id: string;
262
+ email: string;
263
+ }
264
+ interface UpdateUserEmailResponse {
265
+ success: boolean;
266
+ message: string;
267
+ data: UserData | null;
268
+ }
269
+ interface UserListQuery {
270
+ company_id?: string;
271
+ limit?: number;
272
+ cursor?: string;
273
+ forward?: string;
274
+ backward?: string;
275
+ }
276
+ interface UserListData {
277
+ id: string;
278
+ company_id: string;
279
+ merchant_id: string;
280
+ user_name: string;
281
+ user_email: string;
282
+ partner_id: string;
283
+ payment_network: string;
284
+ payment_token_name: string;
285
+ payment_token_address: string;
286
+ created_at: string;
287
+ updated_at: string;
288
+ }
289
+ interface GetUserListResponse {
290
+ forward_cursor: string;
291
+ backward_cursor: string;
292
+ has_forward: boolean;
293
+ has_backward: boolean;
294
+ data: UserListData | null;
295
+ }
296
+ interface GetUserQuery {
297
+ merchant_id?: string;
298
+ }
299
+ interface GetUserResponse {
300
+ success: boolean;
301
+ message: string;
302
+ data: UserData | null;
303
+ }
304
+
305
+ declare class UserAPI {
306
+ private http;
307
+ constructor(http: HttpClient);
308
+ createUser(payload: CreateUserPayload, jwtToken: string): Promise<CreateUserResponse>;
309
+ updateUserPaymentMethod(payload: UpdateUserPaymentPayload, jwtToken: string): Promise<UpdateUserPaymentResponse>;
310
+ updateUserEmail(payload: UpdateUserEmailPayload, jwtToken: string): Promise<UpdateUserEmailResponse>;
311
+ getUserList(jwtToken: string, query?: UserListQuery): Promise<GetUserListResponse>;
312
+ getSingleUser(jwtToken: string, query?: GetUserQuery): Promise<GetUserResponse>;
313
+ }
314
+
213
315
  interface MorambaClientConfig {
214
316
  baseURL: string;
215
317
  apiKey: string;
@@ -220,6 +322,7 @@ declare class MorambaClient {
220
322
  private http;
221
323
  company: CompanyAPI;
222
324
  merchant: MerchantAPI;
325
+ user: UserAPI;
223
326
  constructor(config: MorambaClientConfig);
224
327
  }
225
328
 
@@ -245,4 +348,4 @@ declare function sepoliaApprove(options: SepoliaApproveOptions): Promise<{
245
348
  receipt: any;
246
349
  }>;
247
350
 
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 };
351
+ export { type CompanyData, type CompanyListItem, type CreateCompanyPayload, type CreateCompanyResponse, type CreateJwtPayload, type CreateJwtResponse, type CreateMerchantPayload, type CreateMerchantResponse, type CreateUserPayload, type CreateUserResponse, type GetCompaniesQuery, type GetCompaniesResponse, type GetMerchantListResponse, type GetMerchantQuery, type GetMerchantResponse, type GetUserListResponse, type GetUserQuery, type GetUserResponse, type JwtTokenData, type MerchantData, type MerchantListData, type MerchantListQuery, type MonadApproveOptions, MorambaClient, type MorambaClientConfig, type PaginationData, type PaymentMethod, type SepoliaApproveOptions, type UpdateCompanyEmailPayload, type UpdateCompanyEmailResponse, type UpdateCompanyPaymentPayload, type UpdateCompanyPaymentResponse, type UpdateMerchantEmailPayload, type UpdateMerchantEmailResponse, type UpdateMerchantPaymentPayload, type UpdateMerchantPaymentResponse, type UpdateUserEmailPayload, type UpdateUserEmailResponse, type UpdateUserPaymentPayload, type UpdateUserPaymentResponse, type UserData, type UserListData, type UserListQuery, UserTypeVal, monadApprove, sepoliaApprove };
package/dist/index.d.ts CHANGED
@@ -210,6 +210,108 @@ declare class MerchantAPI {
210
210
  getSingleMerchant(jwtToken: string, query?: GetMerchantQuery): Promise<GetMerchantResponse>;
211
211
  }
212
212
 
213
+ declare enum UserTypeVal {
214
+ CUSTOMER = "customer",
215
+ VENDOR = "vendor",
216
+ AI_AGENT = "AI_agent",
217
+ DEVICE = "device",
218
+ OTHER = "other"
219
+ }
220
+ interface CreateUserPayload {
221
+ payment_method: PaymentMethod;
222
+ user_name: string;
223
+ user_email: string;
224
+ user_type: UserTypeVal;
225
+ company_id: string;
226
+ merchant_id: string;
227
+ }
228
+ interface UserData {
229
+ id: string;
230
+ merchant_id: string;
231
+ user_name: string;
232
+ user_email: string;
233
+ company_id: string;
234
+ partner_id: string;
235
+ user_type: string;
236
+ payment_network: string;
237
+ payment_token_name: string;
238
+ payment_token_address: string;
239
+ created_at: string;
240
+ updated_at: string;
241
+ }
242
+ interface CreateUserResponse {
243
+ success: boolean;
244
+ message: string;
245
+ data: UserData | null;
246
+ }
247
+ interface UpdateUserPaymentPayload {
248
+ company_id: string;
249
+ merchant_id: string;
250
+ user_id: string;
251
+ payment_method: PaymentMethod;
252
+ }
253
+ interface UpdateUserPaymentResponse {
254
+ success: boolean;
255
+ message: string;
256
+ data: UserData | null;
257
+ }
258
+ interface UpdateUserEmailPayload {
259
+ company_id: string;
260
+ merchant_id: string;
261
+ user_id: string;
262
+ email: string;
263
+ }
264
+ interface UpdateUserEmailResponse {
265
+ success: boolean;
266
+ message: string;
267
+ data: UserData | null;
268
+ }
269
+ interface UserListQuery {
270
+ company_id?: string;
271
+ limit?: number;
272
+ cursor?: string;
273
+ forward?: string;
274
+ backward?: string;
275
+ }
276
+ interface UserListData {
277
+ id: string;
278
+ company_id: string;
279
+ merchant_id: string;
280
+ user_name: string;
281
+ user_email: string;
282
+ partner_id: string;
283
+ payment_network: string;
284
+ payment_token_name: string;
285
+ payment_token_address: string;
286
+ created_at: string;
287
+ updated_at: string;
288
+ }
289
+ interface GetUserListResponse {
290
+ forward_cursor: string;
291
+ backward_cursor: string;
292
+ has_forward: boolean;
293
+ has_backward: boolean;
294
+ data: UserListData | null;
295
+ }
296
+ interface GetUserQuery {
297
+ merchant_id?: string;
298
+ }
299
+ interface GetUserResponse {
300
+ success: boolean;
301
+ message: string;
302
+ data: UserData | null;
303
+ }
304
+
305
+ declare class UserAPI {
306
+ private http;
307
+ constructor(http: HttpClient);
308
+ createUser(payload: CreateUserPayload, jwtToken: string): Promise<CreateUserResponse>;
309
+ updateUserPaymentMethod(payload: UpdateUserPaymentPayload, jwtToken: string): Promise<UpdateUserPaymentResponse>;
310
+ updateUserEmail(payload: UpdateUserEmailPayload, jwtToken: string): Promise<UpdateUserEmailResponse>;
311
+ getUserList(jwtToken: string, query?: UserListQuery): Promise<GetUserListResponse>;
312
+ getSingleUser(jwtToken: string, query?: GetUserQuery): Promise<GetUserResponse>;
313
+ }
314
+
213
315
  interface MorambaClientConfig {
214
316
  baseURL: string;
215
317
  apiKey: string;
@@ -220,6 +322,7 @@ declare class MorambaClient {
220
322
  private http;
221
323
  company: CompanyAPI;
222
324
  merchant: MerchantAPI;
325
+ user: UserAPI;
223
326
  constructor(config: MorambaClientConfig);
224
327
  }
225
328
 
@@ -245,4 +348,4 @@ declare function sepoliaApprove(options: SepoliaApproveOptions): Promise<{
245
348
  receipt: any;
246
349
  }>;
247
350
 
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 };
351
+ export { type CompanyData, type CompanyListItem, type CreateCompanyPayload, type CreateCompanyResponse, type CreateJwtPayload, type CreateJwtResponse, type CreateMerchantPayload, type CreateMerchantResponse, type CreateUserPayload, type CreateUserResponse, type GetCompaniesQuery, type GetCompaniesResponse, type GetMerchantListResponse, type GetMerchantQuery, type GetMerchantResponse, type GetUserListResponse, type GetUserQuery, type GetUserResponse, type JwtTokenData, type MerchantData, type MerchantListData, type MerchantListQuery, type MonadApproveOptions, MorambaClient, type MorambaClientConfig, type PaginationData, type PaymentMethod, type SepoliaApproveOptions, type UpdateCompanyEmailPayload, type UpdateCompanyEmailResponse, type UpdateCompanyPaymentPayload, type UpdateCompanyPaymentResponse, type UpdateMerchantEmailPayload, type UpdateMerchantEmailResponse, type UpdateMerchantPaymentPayload, type UpdateMerchantPaymentResponse, type UpdateUserEmailPayload, type UpdateUserEmailResponse, type UpdateUserPaymentPayload, type UpdateUserPaymentResponse, type UserData, type UserListData, type UserListQuery, UserTypeVal, monadApprove, sepoliaApprove };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
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});
1
+ "use strict";var E=Object.create;var h=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var G=(a,e)=>{for(var t in e)h(a,t,{get:e[t],enumerable:!0})},A=(a,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of I(e))!L.call(a,o)&&o!==t&&h(a,o,{get:()=>e[o],enumerable:!(r=k(e,o))||r.enumerable});return a};var D=(a,e,t)=>(t=a!=null?E(S(a)):{},A(e||!a||!a.__esModule?h(t,"default",{value:a,enumerable:!0}):t,a)),T=a=>A(h({},"__esModule",{value:!0}),a);var z={};G(z,{MorambaClient:()=>R,UserTypeVal:()=>b,monadApprove:()=>$,sepoliaApprove:()=>B});module.exports=T(z);var w=D(require("axios")),u=class{constructor(e,t={},r=4,o=300){this.client=w.default.create({baseURL:e,headers:t,timeout:1e4}),this.maxRetries=r,this.retryDelay=o,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(o=>setTimeout(o,r)),this.client(t)})}post(e,t,r={}){return this.client.post(e,t,{headers:r}).then(o=>o.data)}patch(e,t,r={}){return this.client.patch(e,t,{headers:r}).then(o=>o.data)}get(e,t={}){return this.client.get(e,{headers:t}).then(r=>r.data)}};var g=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 f=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 U=class{constructor(e){this.http=e}createUser(e,t){return this.http.post("/morambacrypto/create/user",e,{Authorization:`Bearer ${t}`})}updateUserPaymentMethod(e,t){return this.http.patch("/morambacrypto/update/user/payment",e,{Authorization:`Bearer ${t}`})}updateUserEmail(e,t){return this.http.patch("/morambacrypto/update/user/email",e,{Authorization:`Bearer ${t}`})}getUserList(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/users/all?${r.toString()}`,{Authorization:`Bearer ${e}`})}getSingleUser(e,t={}){let r=new URLSearchParams;return t.merchant_id&&r.append("merchant_id",String(t.merchant_id)),this.http.get(`/morambacrypto/users?${r.toString()}`,{Authorization:`Bearer ${e}`})}};var R=class{constructor(e){this.http=new u(e.baseURL,{"Content-Type":"application/json"}),this.auth=new g(this.http,e.partnerId,e.apiKey),this.company=new y(this.http),this.merchant=new f(this.http),this.user=new U(this.http)}};var b=(n=>(n.CUSTOMER="customer",n.VENDOR="vendor",n.AI_AGENT="AI_agent",n.DEVICE="device",n.OTHER="other",n))(b||{});var i=require("ethers");var M={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 $(a){let{privateKey:e,unlimited:t=!0,amount:r,decimalsOverride:o}=a,n=M,C=new i.ethers.JsonRpcProvider(n.rpc),c=new i.ethers.Wallet(e,C),P=["function approve(address spender, uint256 value) external returns (bool)"],_=new i.ethers.Contract(n.token,P,c),m=o!=null?o:n.decimals,d=r!=null?r:n.defaultAmount,x=t?i.ethers.MaxUint256:i.ethers.parseUnits(d,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":d),console.log("From:",await c.getAddress());let s=await _.approve(n.spender,x);console.log("\u{1F4E4} TX:",s.hash);let l=await s.wait();return console.log("\u2705 Block:",l.blockNumber),{hash:s.hash,receipt:l}}var p=require("ethers");async function B(a){let{privateKey:e,unlimited:t=!0,amount:r,decimalsOverride:o}=a,n=v,C=new p.ethers.JsonRpcProvider(n.rpc),c=new p.ethers.Wallet(e,C),P=["function approve(address spender, uint256 value) external returns (bool)"],_=new p.ethers.Contract(n.token,P,c),m=o!=null?o:n.decimals,d=r!=null?r:n.defaultAmount,x=t?p.ethers.MaxUint256:p.ethers.parseUnits(d,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":d),console.log("From:",await c.getAddress());let s=await _.approve(n.spender,x);console.log("\u{1F4E4} TX:",s.hash);let l=await s.wait();return console.log("\u2705 Block:",l.blockNumber),{hash:s.hash,receipt:l}}0&&(module.exports={MorambaClient,UserTypeVal,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 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 { 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,EACnCC,EAAa,EACbC,EAAa,IACf,CACE,KAAK,OAAS,EAAAC,QAAM,OAAO,CACvB,QAAAJ,EACA,QAAAC,EACA,QAAS,GACb,CAAC,EAED,KAAK,WAAaC,EAClB,KAAK,WAAaC,EAElB,KAAK,sBAAsB,CAC/B,CAEA,IAAI,eAA+B,CAC/B,OAAO,KAAK,MAChB,CAEQ,uBAAwB,CAC5B,KAAK,OAAO,aAAa,SAAS,IAC9BE,GAAYA,EACZ,MAAOC,GAAsB,CACzB,IAAMC,EAAcD,EAAM,OAQ1B,GANI,CAACC,IAGAA,EAAO,cAAaA,EAAO,YAAc,GAG1CA,EAAO,aAAe,KAAK,YAC3B,MAAMD,EAGVC,EAAO,cAGP,IAAMC,EACF,KAAK,WAAa,KAAK,IAAI,EAAGD,EAAO,WAAW,EAEpD,aAAM,IAAI,QAAQE,GAAW,WAAWA,EAASD,CAAK,CAAC,EAEhD,KAAK,OAAOD,CAAM,CAC7B,CACJ,CACJ,CACA,KAAcG,EAAaC,EAAWC,EAAuC,CAAC,EAAe,CACzF,OAAO,KAAK,O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","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"]}
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/apis/user.api.ts","../src/MorambaClient.ts","../src/types/user.types.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\";\nimport { CreateUserPayload, CreateUserResponse, GetUserListResponse, GetUserQuery, GetUserResponse, UpdateUserEmailPayload, UpdateUserEmailResponse, UpdateUserPaymentPayload, UpdateUserPaymentResponse, UserListQuery } from \"../types/user.types\";\n\nexport class UserAPI {\n constructor(\n private http: HttpClient\n ) { }\n createUser(payload: CreateUserPayload, jwtToken: string): Promise<CreateUserResponse> {\n\n\n return this.http.post(\n \"/morambacrypto/create/user\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateUserPaymentMethod(\n payload: UpdateUserPaymentPayload,\n jwtToken: string\n ): Promise<UpdateUserPaymentResponse> {\n\n\n return this.http.patch(\n \"/morambacrypto/update/user/payment\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateUserEmail(\n payload: UpdateUserEmailPayload,\n jwtToken: string\n ): Promise<UpdateUserEmailResponse> {\n\n\n return this.http.patch(\n \"/morambacrypto/update/user/email\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n\n getUserList(\n jwtToken: string,\n query: UserListQuery = {}\n ): Promise<GetUserListResponse> {\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/users/all?${params.toString()}`,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n getSingleUser(\n jwtToken: string,\n query: GetUserQuery = {}\n ): Promise<GetUserResponse> {\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/users?${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\";\nimport { UserAPI } from \"./apis/user.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 public user: UserAPI;\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 this.user = new UserAPI(this.http);\n }\n}\n","import { PaymentMethod } from \"./payment_method.types\";\n\nexport enum UserTypeVal {\n CUSTOMER = \"customer\",\n VENDOR = \"vendor\",\n AI_AGENT = \"AI_agent\",\n DEVICE = \"device\",\n OTHER = \"other\",\n}\nexport interface CreateUserPayload {\n payment_method: PaymentMethod;\n user_name: string;\n user_email: string;\n user_type: UserTypeVal;\n company_id: string;\n merchant_id: string;\n}\n\nexport interface UserData {\n id: string;\n merchant_id: string;\n user_name: string;\n user_email: string;\n company_id: string;\n partner_id: string;\n user_type: string;\n payment_network: string;\n payment_token_name: string;\n payment_token_address: string;\n created_at: string;\n updated_at: string;\n}\n\nexport interface CreateUserResponse {\n success: boolean;\n message: string;\n data: UserData | null;\n}\n\nexport interface UpdateUserPaymentPayload {\n company_id: string;\n merchant_id: string;\n user_id: string;\n payment_method: PaymentMethod;\n}\nexport interface UpdateUserPaymentResponse {\n success: boolean;\n message: string;\n data: UserData | null;\n}\n\n\nexport interface UpdateUserEmailPayload {\n company_id: string;\n merchant_id: string;\n user_id: string;\n email: string;\n}\n\nexport interface UpdateUserEmailResponse {\n success: boolean;\n message: string;\n data: UserData | null;\n}\n\n\nexport interface UserListQuery {\n company_id?: string;\n limit?: number;\n cursor?: string;\n forward?: string;\n backward?: string;\n}\n\nexport interface UserListData {\n id: string;\n company_id: string;\n merchant_id: string;\n user_name: string;\n user_email: string;\n partner_id: string;\n payment_network: string;\n payment_token_name: string;\n payment_token_address: string;\n created_at: string;\n updated_at: string;\n\n}\nexport interface GetUserListResponse {\n forward_cursor: string;\n backward_cursor: string;\n has_forward: boolean;\n has_backward: boolean;\n data: UserListData | null;\n}\n\nexport interface GetUserQuery {\n merchant_id?: string;\n}\n\nexport interface GetUserResponse {\n success: boolean;\n message: string;\n data: UserData | null;\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,gBAAAC,EAAA,iBAAAC,EAAA,mBAAAC,IAAA,eAAAC,EAAAN,GCAA,IAAAO,EAAiD,oBAEpCC,EAAN,KAAiB,CAKpB,YACIC,EACAC,EAAkC,CAAC,EACnCC,EAAa,EACbC,EAAa,IACf,CACE,KAAK,OAAS,EAAAC,QAAM,OAAO,CACvB,QAAAJ,EACA,QAAAC,EACA,QAAS,GACb,CAAC,EAED,KAAK,WAAaC,EAClB,KAAK,WAAaC,EAElB,KAAK,sBAAsB,CAC/B,CAEA,IAAI,eAA+B,CAC/B,OAAO,KAAK,MAChB,CAEQ,uBAAwB,CAC5B,KAAK,OAAO,aAAa,SAAS,IAC9BE,GAAYA,EACZ,MAAOC,GAAsB,CACzB,IAAMC,EAAcD,EAAM,OAQ1B,GANI,CAACC,IAGAA,EAAO,cAAaA,EAAO,YAAc,GA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AAS,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","UserTypeVal","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","UserAPI","http","payload","jwtToken","query","params","MorambaClient","config","HttpClient","AuthAPI","CompanyAPI","MerchantAPI","UserAPI","UserTypeVal","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,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};
1
+ import w from"axios";var h=class{constructor(e,t={},r=4,n=300){this.client=w.create({baseURL:e,headers:t,timeout:1e4}),this.maxRetries=r,this.retryDelay=n,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(n=>setTimeout(n,r)),this.client(t)})}post(e,t,r={}){return this.client.post(e,t,{headers:r}).then(n=>n.data)}patch(e,t,r={}){return this.client.patch(e,t,{headers:r}).then(n=>n.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 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 y=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 f=class{constructor(e){this.http=e}createUser(e,t){return this.http.post("/morambacrypto/create/user",e,{Authorization:`Bearer ${t}`})}updateUserPaymentMethod(e,t){return this.http.patch("/morambacrypto/update/user/payment",e,{Authorization:`Bearer ${t}`})}updateUserEmail(e,t){return this.http.patch("/morambacrypto/update/user/email",e,{Authorization:`Bearer ${t}`})}getUserList(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/users/all?${r.toString()}`,{Authorization:`Bearer ${e}`})}getSingleUser(e,t={}){let r=new URLSearchParams;return t.merchant_id&&r.append("merchant_id",String(t.merchant_id)),this.http.get(`/morambacrypto/users?${r.toString()}`,{Authorization:`Bearer ${e}`})}};var x=class{constructor(e){this.http=new h(e.baseURL,{"Content-Type":"application/json"}),this.auth=new u(this.http,e.partnerId,e.apiKey),this.company=new g(this.http),this.merchant=new y(this.http),this.user=new f(this.http)}};var b=(a=>(a.CUSTOMER="customer",a.VENDOR="vendor",a.AI_AGENT="AI_agent",a.DEVICE="device",a.OTHER="other",a))(b||{});import{ethers as d}from"ethers";var R={rpc:"https://testnet-rpc.monad.xyz",spender:"0xbAcEa624831C5f294a5E7FeC519232AA37ec0a8C",token:"0x62F6c82114809C00a1293be02A43C05a3F917202",decimals:18,defaultAmount:"1000"},A={rpc:"https://rpc.sepolia.org",spender:"0x6E2024Da220C081059f606D9EEAe670c84Ead9Ab",token:"0xbAcEa624831C5f294a5E7FeC519232AA37ec0a8C",decimals:18,defaultAmount:"1000"};async function Z(o){let{privateKey:e,unlimited:t=!0,amount:r,decimalsOverride:n}=o,a=R,U=new d.JsonRpcProvider(a.rpc),i=new d.Wallet(e,U),C=["function approve(address spender, uint256 value) external returns (bool)"],P=new d.Contract(a.token,C,i),p=n!=null?n:a.decimals,c=r!=null?r:a.defaultAmount,_=t?d.MaxUint256:d.parseUnits(c,p);console.log("\u26A1 Monad approve()"),console.log("RPC:",a.rpc),console.log("Token:",a.token),console.log("Spender:",a.spender),console.log("Decimals:",p),console.log("Amount:",t?"UNLIMITED":c),console.log("From:",await i.getAddress());let s=await P.approve(a.spender,_);console.log("\u{1F4E4} TX:",s.hash);let m=await s.wait();return console.log("\u2705 Block:",m.blockNumber),{hash:s.hash,receipt:m}}import{ethers as l}from"ethers";async function et(o){let{privateKey:e,unlimited:t=!0,amount:r,decimalsOverride:n}=o,a=A,U=new l.JsonRpcProvider(a.rpc),i=new l.Wallet(e,U),C=["function approve(address spender, uint256 value) external returns (bool)"],P=new l.Contract(a.token,C,i),p=n!=null?n:a.decimals,c=r!=null?r:a.defaultAmount,_=t?l.MaxUint256:l.parseUnits(c,p);console.log("\u26A1 Sepolia approve()"),console.log("RPC:",a.rpc),console.log("Token:",a.token),console.log("Spender:",a.spender),console.log("Decimals:",p),console.log("Amount:",t?"UNLIMITED":c),console.log("From:",await i.getAddress());let s=await P.approve(a.spender,_);console.log("\u{1F4E4} TX:",s.hash);let m=await s.wait();return console.log("\u2705 Block:",m.blockNumber),{hash:s.hash,receipt:m}}export{x as MorambaClient,b as UserTypeVal,Z as monadApprove,et as sepoliaApprove};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -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 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 { hash: tx.hash, receipt };\n}\n"],"mappings":"AAAA,OAAOA,MAA0C,QAE1C,IAAMC,EAAN,KAAiB,CAKpB,YACIC,EACAC,EAAkC,CAAC,EACnCC,EAAa,EACbC,EAAa,IACf,CACE,KAAK,OAASL,EAAM,OAAO,CACvB,QAAAE,EACA,QAAAC,EACA,QAAS,GACb,CAAC,EAED,KAAK,WAAaC,EAClB,KAAK,WAAaC,EAElB,KAAK,sBAAsB,CAC/B,CAEA,IAAI,eAA+B,CAC/B,OAAO,KAAK,MAChB,CAEQ,uBAAwB,CAC5B,KAAK,OAAO,aAAa,SAAS,IAC9BC,GAAYA,EACZ,MAAOC,GAAsB,CACzB,IAAMC,EAAcD,EAAM,OAQ1B,GANI,CAACC,IAGAA,EAAO,cAAaA,EAAO,YAAc,GAG1CA,EAAO,aAAe,KAAK,YAC3B,MAAMD,EAGVC,EAAO,cAGP,IAAMC,EACF,KAAK,WAAa,KAAK,IAAI,EAAGD,EAAO,WAAW,EAEpD,aAAM,IAAI,QAAQE,GAAW,WAAWA,EAASD,CAAK,CAAC,EAEhD,KAAK,OAAOD,CAAM,CAC7B,CACJ,CACJ,CACA,KAAcG,EAAaC,EAAWC,EAAuC,CAAC,EAAe,CACzF,OAAO,KAAK,OACP,KAAQF,EAAKC,EAAM,CAAE,QAASC,CAAa,CAAC,EAC5C,KAAMC,GAAQA,EAAI,IAAI,CAC/B,CACA,MACIH,EACAC,EACAC,EAAuC,CAAC,EAC9B,CACV,OAAO,KAAK,OACP,MAASF,EAAKC,EAAM,CAAE,QAASC,CAAa,CAAC,EAC7C,KAAMC,GAAQA,EAAI,IAAI,CAC/B,CACA,IAAaH,EAAaE,EAAuC,CAAC,EAAe,CAC7E,OAAO,KAAK,OACP,IAAOF,EAAK,CAAE,QAASE,CAAa,CAAC,EACrC,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BAAAC,CACJ,EAAIJ,EAEEK,EAAMC,EAENC,EAAW,IAAIC,EAAO,gBAAgBH,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"]}
1
+ {"version":3,"sources":["../src/client/HttpClient.ts","../src/apis/auth.api.ts","../src/apis/company.api.ts","../src/apis/merchant.api.ts","../src/apis/user.api.ts","../src/MorambaClient.ts","../src/types/user.types.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\";\nimport { CreateUserPayload, CreateUserResponse, GetUserListResponse, GetUserQuery, GetUserResponse, UpdateUserEmailPayload, UpdateUserEmailResponse, UpdateUserPaymentPayload, UpdateUserPaymentResponse, UserListQuery } from \"../types/user.types\";\n\nexport class UserAPI {\n constructor(\n private http: HttpClient\n ) { }\n createUser(payload: CreateUserPayload, jwtToken: string): Promise<CreateUserResponse> {\n\n\n return this.http.post(\n \"/morambacrypto/create/user\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateUserPaymentMethod(\n payload: UpdateUserPaymentPayload,\n jwtToken: string\n ): Promise<UpdateUserPaymentResponse> {\n\n\n return this.http.patch(\n \"/morambacrypto/update/user/payment\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n updateUserEmail(\n payload: UpdateUserEmailPayload,\n jwtToken: string\n ): Promise<UpdateUserEmailResponse> {\n\n\n return this.http.patch(\n \"/morambacrypto/update/user/email\",\n payload,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n\n\n getUserList(\n jwtToken: string,\n query: UserListQuery = {}\n ): Promise<GetUserListResponse> {\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/users/all?${params.toString()}`,\n {\n Authorization: `Bearer ${jwtToken}`,\n }\n );\n }\n getSingleUser(\n jwtToken: string,\n query: GetUserQuery = {}\n ): Promise<GetUserResponse> {\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/users?${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\";\nimport { UserAPI } from \"./apis/user.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 public user: UserAPI;\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 this.user = new UserAPI(this.http);\n }\n}\n","import { PaymentMethod } from \"./payment_method.types\";\n\nexport enum UserTypeVal {\n CUSTOMER = \"customer\",\n VENDOR = \"vendor\",\n AI_AGENT = \"AI_agent\",\n DEVICE = \"device\",\n OTHER = \"other\",\n}\nexport interface CreateUserPayload {\n payment_method: PaymentMethod;\n user_name: string;\n user_email: string;\n user_type: UserTypeVal;\n company_id: string;\n merchant_id: string;\n}\n\nexport interface UserData {\n id: string;\n merchant_id: string;\n user_name: string;\n user_email: string;\n company_id: string;\n partner_id: string;\n user_type: string;\n payment_network: string;\n payment_token_name: string;\n payment_token_address: string;\n created_at: string;\n updated_at: string;\n}\n\nexport interface CreateUserResponse {\n success: boolean;\n message: string;\n data: UserData | null;\n}\n\nexport interface UpdateUserPaymentPayload {\n company_id: string;\n merchant_id: string;\n user_id: string;\n payment_method: PaymentMethod;\n}\nexport interface UpdateUserPaymentResponse {\n success: boolean;\n message: string;\n data: UserData | null;\n}\n\n\nexport interface UpdateUserEmailPayload {\n company_id: string;\n merchant_id: string;\n user_id: string;\n email: string;\n}\n\nexport interface UpdateUserEmailResponse {\n success: boolean;\n message: string;\n data: UserData | null;\n}\n\n\nexport interface UserListQuery {\n company_id?: string;\n limit?: number;\n cursor?: string;\n forward?: string;\n backward?: string;\n}\n\nexport interface UserListData {\n id: string;\n company_id: string;\n merchant_id: string;\n user_name: string;\n user_email: string;\n partner_id: string;\n payment_network: string;\n payment_token_name: string;\n payment_token_address: string;\n created_at: string;\n updated_at: string;\n\n}\nexport interface GetUserListResponse {\n forward_cursor: string;\n backward_cursor: string;\n has_forward: boolean;\n has_backward: boolean;\n data: UserListData | null;\n}\n\nexport interface GetUserQuery {\n merchant_id?: string;\n}\n\nexport interface GetUserResponse {\n success: boolean;\n message: string;\n data: UserData | null;\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":"AAAA,OAAOA,MAA0C,QAE1C,IAAMC,EAAN,KAAiB,CAKpB,YACIC,EACAC,EAAkC,CAAC,EACnCC,EAAa,EACbC,EAAa,IACf,CACE,KAAK,OAASL,EAAM,OAAO,CACvB,QAAAE,EACA,QAAAC,EACA,QAAS,GACb,CAAC,EAED,KAAK,WAAaC,EAClB,KAAK,WAAaC,EAElB,KAAK,sBAAsB,CAC/B,CAEA,IAAI,eAA+B,CAC/B,OAAO,KAAK,MAChB,CAEQ,uBAAwB,CAC5B,KAAK,OAAO,aAAa,SAAS,IAC9BC,GAAYA,EACZ,MAAOC,GAAsB,CACzB,IAAMC,EAAcD,EAAM,OAQ1B,GANI,CAACC,IAGAA,EAAO,cAAaA,EAAO,YAAc,GAG1CA,EAAO,aAAe,KAAK,YAC3B,MAAMD,EAGVC,EAAO,cAGP,IAAMC,EACF,KAAK,WAAa,KAAK,IAAI,EAAGD,EAAO,WAAW,EAEpD,aAAM,IAAI,QAAQE,GAAW,WAAWA,EAASD,CAAK,CAAC,EAEhD,KAAK,OAAOD,CAAM,CAC7B,CACJ,CACJ,CACA,KAAcG,EAAaC,EAAWC,EAAuC,CAAC,EAAe,CACzF,OAAO,KAAK,OACP,KAAQF,EAAKC,EAAM,CAAE,QAASC,CAAa,CAAC,EAC5C,KAAMC,GAAQA,EAAI,IAAI,CAC/B,CACA,MACIH,EACAC,EACAC,EAAuC,CAAC,EAC9B,CACV,OAAO,KAAK,OACP,MAASF,EAAKC,EAAM,CAAE,QAASC,CAAa,CAAC,EAC7C,KAAMC,GAAQA,EAAI,IAAI,CAC/B,CACA,IAAaH,EAAaE,EAAuC,CAAC,E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,eAAsBC,GAAeC,EAAgC,CACjE,GAAM,CACF,WAAAC,EACA,UAAAC,EAAY,GACZ,OAAAC,EACA,iBAAAC,CACJ,EAAIJ,EAEEK,EAAMC,EAENC,EAAW,IAAIC,EAAO,gBAAgBH,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","UserAPI","http","payload","jwtToken","query","params","MorambaClient","config","HttpClient","AuthAPI","CompanyAPI","MerchantAPI","UserAPI","UserTypeVal","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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morambacrypto/connect",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "This library use for interact with moramba-crypto project",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",