@pulsar.money/atlas-sdk 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/api-config.service.d.ts +1 -0
- package/dist/config/api-config.service.js +7 -0
- package/dist/config/api-config.service.js.map +1 -1
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/moonpay/index.d.ts +2 -0
- package/dist/modules/moonpay/index.js +19 -0
- package/dist/modules/moonpay/index.js.map +1 -0
- package/dist/modules/moonpay/moonpay.service.d.ts +8 -0
- package/dist/modules/moonpay/moonpay.service.js +49 -0
- package/dist/modules/moonpay/moonpay.service.js.map +1 -0
- package/dist/modules/moonpay/moonpay.types.d.ts +72 -0
- package/dist/modules/moonpay/moonpay.types.js +3 -0
- package/dist/modules/moonpay/moonpay.types.js.map +1 -0
- package/dist/modules/profiles/profiles.types.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -24,6 +24,13 @@ class ApiConfigService {
|
|
|
24
24
|
}
|
|
25
25
|
return process.env.SERVICE_TYPE;
|
|
26
26
|
}
|
|
27
|
+
static getMoonpayApiKey() {
|
|
28
|
+
const apiKey = process.env.MOONPAY_API_KEY;
|
|
29
|
+
if (!apiKey) {
|
|
30
|
+
throw new Error("MOONPAY_API_KEY environment variable is not set");
|
|
31
|
+
}
|
|
32
|
+
return apiKey;
|
|
33
|
+
}
|
|
27
34
|
}
|
|
28
35
|
exports.ApiConfigService = ApiConfigService;
|
|
29
36
|
//# sourceMappingURL=api-config.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-config.service.js","sourceRoot":"","sources":["../../src/config/api-config.service.ts"],"names":[],"mappings":";;;AAAA,MAAa,gBAAgB;IAC3B,MAAM,CAAC,eAAe;QACpB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAA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IACtC,CAAC;IAED,MAAM,CAAC,cAAc;QACnB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE;YAC7B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;SAC5C;QAED,MAAM,iBAAiB,GAAG,CAAC,YAAY,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QAC5D,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;YACzD,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;SAC9C;QAED,OAAO,OAAO,CAAC,GAAG,CAAC,YAAiD,CAAC;IACvE,CAAC;IAED,MAAM,CAAC,gBAAgB;QACrB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QAC3C,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;SACpE;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAnCD,4CAmCC"}
|
package/dist/modules/index.d.ts
CHANGED
package/dist/modules/index.js
CHANGED
|
@@ -18,4 +18,5 @@ __exportStar(require("./profiles"), exports);
|
|
|
18
18
|
__exportStar(require("./payments"), exports);
|
|
19
19
|
__exportStar(require("./public-profiles"), exports);
|
|
20
20
|
__exportStar(require("./messages"), exports);
|
|
21
|
+
__exportStar(require("./moonpay"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,6CAA2B;AAC3B,oDAAkC;AAClC,6CAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,6CAA2B;AAC3B,oDAAkC;AAClC,6CAA2B;AAC3B,4CAA0B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./moonpay.service"), exports);
|
|
18
|
+
__exportStar(require("./moonpay.types"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/moonpay/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,kDAAgC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MoonpayTransaction } from "./moonpay.types";
|
|
2
|
+
export declare class MoonpayService {
|
|
3
|
+
private readonly axiosInstance;
|
|
4
|
+
private readonly apiKey;
|
|
5
|
+
constructor();
|
|
6
|
+
getTransaction(transactionId: string): Promise<MoonpayTransaction>;
|
|
7
|
+
private handleAxiosError;
|
|
8
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.MoonpayService = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const axios_1 = require("axios");
|
|
15
|
+
const api_config_service_1 = require("../../config/api-config.service");
|
|
16
|
+
let MoonpayService = class MoonpayService {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.apiKey = api_config_service_1.ApiConfigService.getMoonpayApiKey();
|
|
19
|
+
this.axiosInstance = axios_1.default.create({
|
|
20
|
+
baseURL: "https://api.moonpay.com",
|
|
21
|
+
headers: {
|
|
22
|
+
Authorization: `Api-Key ${this.apiKey}`,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async getTransaction(transactionId) {
|
|
27
|
+
if (!transactionId) {
|
|
28
|
+
throw new common_1.BadRequestException("Transaction ID is required");
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
const response = await this.axiosInstance.get(`/v1/transactions/${transactionId}`);
|
|
32
|
+
return response.data;
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
this.handleAxiosError(error);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
handleAxiosError(error) {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
const errorMessage = ((_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message) || "An error occurred with Moonpay";
|
|
41
|
+
throw new common_1.BadRequestException(errorMessage);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.MoonpayService = MoonpayService;
|
|
45
|
+
exports.MoonpayService = MoonpayService = __decorate([
|
|
46
|
+
(0, common_1.Injectable)(),
|
|
47
|
+
__metadata("design:paramtypes", [])
|
|
48
|
+
], MoonpayService);
|
|
49
|
+
//# sourceMappingURL=moonpay.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moonpay.service.js","sourceRoot":"","sources":["../../../src/modules/moonpay/moonpay.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAiE;AACjE,iCAA6C;AAC7C,wEAAmE;AAI5D,IAAM,cAAc,GAApB,MAAM,cAAc;IAIzB;QACE,IAAI,CAAC,MAAM,GAAG,qCAAgB,CAAC,gBAAgB,EAAE,CAAC;QAElD,IAAI,CAAC,aAAa,GAAG,eAAK,CAAC,MAAM,CAAC;YAChC,OAAO,EAAE,yBAAyB;YAClC,OAAO,EAAE;gBACP,aAAa,EAAE,WAAW,IAAI,CAAC,MAAM,EAAE;aACxC;SACF,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,aAAqB;QACxC,IAAI,CAAC,aAAa,EAAE;YAClB,MAAM,IAAI,4BAAmB,CAAC,4BAA4B,CAAC,CAAC;SAC7D;QAED,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAC3C,oBAAoB,aAAa,EAAE,CACpC,CAAC;YACF,OAAO,QAAQ,CAAC,IAAI,CAAC;SACtB;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;SAC9B;IACH,CAAC;IAEO,gBAAgB,CAAC,KAAU;;QACjC,MAAM,YAAY,GAChB,CAAA,MAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,IAAI,0CAAE,OAAO,KAAI,gCAAgC,CAAC;QACpE,MAAM,IAAI,4BAAmB,CAAC,YAAY,CAAC,CAAC;IAC9C,CAAC;CACF,CAAA;AAnCY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;;GACA,cAAc,CAmC1B"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export interface MoonpayCurrency {
|
|
2
|
+
id: string;
|
|
3
|
+
createdAt: string;
|
|
4
|
+
updatedAt: string;
|
|
5
|
+
type: 'crypto' | 'fiat';
|
|
6
|
+
name: string;
|
|
7
|
+
code: string;
|
|
8
|
+
precision: number;
|
|
9
|
+
minBuyAmount: number;
|
|
10
|
+
maxBuyAmount: number;
|
|
11
|
+
minSellAmount?: number;
|
|
12
|
+
maxSellAmount?: number;
|
|
13
|
+
addressRegex?: string;
|
|
14
|
+
testnetAddressRegex?: string;
|
|
15
|
+
supportsAddressTag: boolean;
|
|
16
|
+
addressTagRegex: string | null;
|
|
17
|
+
supportsTestMode: boolean;
|
|
18
|
+
isSuspended: boolean;
|
|
19
|
+
isSupportedInUs: boolean;
|
|
20
|
+
isSellSupported: boolean;
|
|
21
|
+
notAllowedUSStates?: string[];
|
|
22
|
+
notAllowedCountries?: string[];
|
|
23
|
+
metadata?: {
|
|
24
|
+
contractAddress: number;
|
|
25
|
+
chainId: string;
|
|
26
|
+
networkCode: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface MoonpayStage {
|
|
30
|
+
stage: string;
|
|
31
|
+
status: string;
|
|
32
|
+
failureReason: string | null;
|
|
33
|
+
actions: any[];
|
|
34
|
+
}
|
|
35
|
+
export interface MoonpayTransaction {
|
|
36
|
+
id: string;
|
|
37
|
+
createdAt: string;
|
|
38
|
+
updatedAt: string;
|
|
39
|
+
baseCurrencyAmount: number;
|
|
40
|
+
quoteCurrencyAmount: number;
|
|
41
|
+
feeAmount: number;
|
|
42
|
+
extraFeeAmount: number;
|
|
43
|
+
networkFeeAmount: number;
|
|
44
|
+
areFeesIncluded: boolean;
|
|
45
|
+
status: string;
|
|
46
|
+
failureReason: string | null;
|
|
47
|
+
walletAddress: number;
|
|
48
|
+
walletAddressTag: string | null;
|
|
49
|
+
cryptoTransactionId: number;
|
|
50
|
+
redirectUrl: string;
|
|
51
|
+
returnUrl: string;
|
|
52
|
+
widgetRedirectUrl: string | null;
|
|
53
|
+
eurRate: number;
|
|
54
|
+
usdRate: number;
|
|
55
|
+
gbpRate: number;
|
|
56
|
+
bankDepositInformation: string | null;
|
|
57
|
+
bankTransferReference: string | null;
|
|
58
|
+
currencyId: string;
|
|
59
|
+
currency: MoonpayCurrency;
|
|
60
|
+
baseCurrencyId: string;
|
|
61
|
+
baseCurrency: MoonpayCurrency;
|
|
62
|
+
customerId: string;
|
|
63
|
+
cardId: string;
|
|
64
|
+
bankAccountId: string | null;
|
|
65
|
+
externalCustomerId: string;
|
|
66
|
+
externalTransactionId: string;
|
|
67
|
+
country: string;
|
|
68
|
+
state: string | null;
|
|
69
|
+
cardType: string;
|
|
70
|
+
cardPaymentType: string;
|
|
71
|
+
stages: MoonpayStage[];
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moonpay.types.js","sourceRoot":"","sources":["../../../src/modules/moonpay/moonpay.types.ts"],"names":[],"mappings":""}
|