paytonz-node-api-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +743 -0
- package/lib/CpaySDK.d.ts +30 -0
- package/lib/CpaySDK.js +35 -0
- package/lib/CpaySDKBase.d.ts +30 -0
- package/lib/CpaySDKBase.js +216 -0
- package/lib/CryptoNowSDK.d.ts +30 -0
- package/lib/CryptoNowSDK.js +35 -0
- package/lib/CryptoNowSDKBase.d.ts +30 -0
- package/lib/CryptoNowSDKBase.js +216 -0
- package/lib/PaytonzSDK.d.ts +28 -0
- package/lib/PaytonzSDK.js +33 -0
- package/lib/PaytonzSDKBase.d.ts +30 -0
- package/lib/PaytonzSDKBase.js +198 -0
- package/lib/auth/auth.d.ts +9 -0
- package/lib/auth/auth.interface.d.ts +25 -0
- package/lib/auth/auth.interface.js +2 -0
- package/lib/auth/auth.js +37 -0
- package/lib/checkout/checkout.d.ts +24 -0
- package/lib/checkout/checkout.interface.d.ts +94 -0
- package/lib/checkout/checkout.interface.js +2 -0
- package/lib/checkout/checkout.js +215 -0
- package/lib/client/client.d.ts +11 -0
- package/lib/client/client.interface.d.ts +45 -0
- package/lib/client/client.interface.js +2 -0
- package/lib/client/client.js +62 -0
- package/lib/constant.d.ts +1 -0
- package/lib/constant.js +4 -0
- package/lib/currency/currency.d.ts +10 -0
- package/lib/currency/currency.interface.d.ts +20 -0
- package/lib/currency/currency.interface.js +2 -0
- package/lib/currency/currency.js +50 -0
- package/lib/external/external.d.ts +13 -0
- package/lib/external/external.interface.d.ts +59 -0
- package/lib/external/external.interface.js +12 -0
- package/lib/external/external.js +64 -0
- package/lib/external/external.solana.d.ts +9 -0
- package/lib/external/external.solana.js +47 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +28 -0
- package/lib/interfaces/cpay.interface.d.ts +20 -0
- package/lib/interfaces/cpay.interface.js +2 -0
- package/lib/interfaces/cryptonow.interface.d.ts +20 -0
- package/lib/interfaces/cryptonow.interface.js +2 -0
- package/lib/interfaces/paytonz.interface.d.ts +20 -0
- package/lib/interfaces/paytonz.interface.js +2 -0
- package/lib/multisend/multisend.d.ts +11 -0
- package/lib/multisend/multisend.interface.d.ts +28 -0
- package/lib/multisend/multisend.interface.js +2 -0
- package/lib/multisend/multisend.js +75 -0
- package/lib/swap/swap.d.ts +11 -0
- package/lib/swap/swap.interface.d.ts +84 -0
- package/lib/swap/swap.interface.js +2 -0
- package/lib/swap/swap.js +75 -0
- package/lib/transaction/transaction.d.ts +9 -0
- package/lib/transaction/transaction.interface.d.ts +82 -0
- package/lib/transaction/transaction.interface.js +2 -0
- package/lib/transaction/transaction.js +34 -0
- package/lib/utils/httpClient.d.ts +9 -0
- package/lib/utils/httpClient.js +64 -0
- package/lib/wallet/wallet.d.ts +16 -0
- package/lib/wallet/wallet.interface.d.ts +60 -0
- package/lib/wallet/wallet.interface.js +2 -0
- package/lib/wallet/wallet.js +107 -0
- package/lib/wallet/wallet.signature.d.ts +14 -0
- package/lib/wallet/wallet.signature.js +104 -0
- package/lib/withdrawal/withdrawal.d.ts +14 -0
- package/lib/withdrawal/withdrawal.interface.d.ts +79 -0
- package/lib/withdrawal/withdrawal.interface.js +14 -0
- package/lib/withdrawal/withdrawal.js +104 -0
- package/package.json +26 -0
- package/src/PaytonzSDK.ts +41 -0
- package/src/PaytonzSDKBase.ts +252 -0
- package/src/auth/auth.interface.ts +26 -0
- package/src/auth/auth.ts +31 -0
- package/src/checkout/checkout.interface.ts +110 -0
- package/src/checkout/checkout.ts +279 -0
- package/src/constant.ts +1 -0
- package/src/currency/currency.interface.ts +21 -0
- package/src/currency/currency.ts +60 -0
- package/src/external/external.interface.ts +65 -0
- package/src/external/external.solana.ts +54 -0
- package/src/external/external.ts +73 -0
- package/src/index.ts +5 -0
- package/src/interfaces/paytonz.interface.ts +23 -0
- package/src/multisend/multisend.interface.ts +32 -0
- package/src/multisend/multisend.ts +91 -0
- package/src/swap/swap.interface.ts +90 -0
- package/src/swap/swap.ts +93 -0
- package/src/transaction/transaction.interface.ts +76 -0
- package/src/transaction/transaction.ts +35 -0
- package/src/utils/httpClient.ts +60 -0
- package/src/wallet/wallet.interface.ts +67 -0
- package/src/wallet/wallet.signature.ts +106 -0
- package/src/wallet/wallet.ts +103 -0
- package/src/withdrawal/withdrawal.interface.ts +89 -0
- package/src/withdrawal/withdrawal.ts +135 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CpaySDKBase, CpaySDKBaseOptions } from "../CpaySDKBase";
|
|
2
|
+
import { ClientBalancesQuery, ClientListInfo, ClientListQuery, ClientRegisterInfo, ClientWalletInfo, RegisterClientOptions } from "./client.interface";
|
|
3
|
+
export interface CpaySDKOptions extends CpaySDKBaseOptions {
|
|
4
|
+
}
|
|
5
|
+
export declare class Client extends CpaySDKBase {
|
|
6
|
+
constructor(parameters: CpaySDKOptions);
|
|
7
|
+
register(options: RegisterClientOptions, accessToken?: string): Promise<ClientRegisterInfo>;
|
|
8
|
+
list(options: ClientListQuery, accessToken?: string): Promise<ClientListInfo>;
|
|
9
|
+
getBalances(clientId: string, options: ClientBalancesQuery, accessToken?: string): Promise<ClientWalletInfo[]>;
|
|
10
|
+
}
|
|
11
|
+
export default Client;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface RegisterClientOptions {
|
|
2
|
+
name: string;
|
|
3
|
+
email: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ClientRegisterInfo {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
email: string;
|
|
9
|
+
createdAt: Date;
|
|
10
|
+
updatedAt: Date;
|
|
11
|
+
}
|
|
12
|
+
export interface ClientBalancesQuery {
|
|
13
|
+
typeNetwork: string;
|
|
14
|
+
hideZeroBalance?: boolean | string;
|
|
15
|
+
}
|
|
16
|
+
export interface ClientListQuery extends ClientBalancesQuery {
|
|
17
|
+
search?: string;
|
|
18
|
+
sort?: string;
|
|
19
|
+
order?: "ASC" | "DESC";
|
|
20
|
+
page?: number;
|
|
21
|
+
limit?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ClientAsset {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
symbol: string;
|
|
27
|
+
balance: string;
|
|
28
|
+
balanceUSD: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ClientWalletInfo {
|
|
31
|
+
id: string;
|
|
32
|
+
address: string;
|
|
33
|
+
balanceUSD: string;
|
|
34
|
+
assets: ClientAsset[];
|
|
35
|
+
}
|
|
36
|
+
export interface AggregatedClientInfo extends ClientRegisterInfo {
|
|
37
|
+
wallets: ClientWalletInfo[];
|
|
38
|
+
balanceUSD: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ClientListInfo {
|
|
41
|
+
page: number;
|
|
42
|
+
pages: number;
|
|
43
|
+
countItems: number;
|
|
44
|
+
entities: AggregatedClientInfo[];
|
|
45
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Client = void 0;
|
|
13
|
+
const CpaySDKBase_1 = require("../CpaySDKBase");
|
|
14
|
+
class Client extends CpaySDKBase_1.CpaySDKBase {
|
|
15
|
+
constructor(parameters) {
|
|
16
|
+
super(parameters);
|
|
17
|
+
}
|
|
18
|
+
register(options, accessToken) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
try {
|
|
21
|
+
if (!accessToken) {
|
|
22
|
+
accessToken = yield this.getToken();
|
|
23
|
+
}
|
|
24
|
+
const path = `/api/public/client/register`;
|
|
25
|
+
return this.auth_post(`${path}`, options, accessToken);
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
throw err;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
list(options, accessToken) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
try {
|
|
35
|
+
if (!accessToken) {
|
|
36
|
+
accessToken = yield this.getToken();
|
|
37
|
+
}
|
|
38
|
+
const path = `/api/public/client/list`;
|
|
39
|
+
return this.auth_get(`${path}`, Object.assign({}, options), accessToken);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
throw err;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
getBalances(clientId, options, accessToken) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
try {
|
|
49
|
+
if (!accessToken) {
|
|
50
|
+
accessToken = yield this.getToken();
|
|
51
|
+
}
|
|
52
|
+
const path = `/api/public/client/balances/${clientId}`;
|
|
53
|
+
return this.auth_get(`${path}`, Object.assign({}, options), accessToken);
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
throw err;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.Client = Client;
|
|
62
|
+
exports.default = Client;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const REST_URL = "https://api.paytonz.com";
|
package/lib/constant.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PaytonzSDKBase, PaytonzSDKBaseOptions } from "../PaytonzSDKBase";
|
|
2
|
+
import { CurrencyInfo, CurrencyOptions } from "./currency.interface";
|
|
3
|
+
export interface PaytonzSDKOptions extends PaytonzSDKBaseOptions {
|
|
4
|
+
}
|
|
5
|
+
export declare class Currency extends PaytonzSDKBase {
|
|
6
|
+
constructor(parameters: PaytonzSDKOptions);
|
|
7
|
+
getAvailableCurrencies(options: CurrencyOptions, accessToken?: string): Promise<CurrencyInfo>;
|
|
8
|
+
getPaymasters(options: CurrencyOptions, accessToken?: string): Promise<CurrencyInfo>;
|
|
9
|
+
}
|
|
10
|
+
export default Currency;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface CurrencyInfo {
|
|
2
|
+
currencies: {
|
|
3
|
+
_id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
name: string;
|
|
6
|
+
nodeType: string;
|
|
7
|
+
currencyType: string;
|
|
8
|
+
mainCurrency?: string;
|
|
9
|
+
replenishMinimumValue?: number;
|
|
10
|
+
decimals: number;
|
|
11
|
+
supportMultisend: boolean;
|
|
12
|
+
supportSwap: boolean;
|
|
13
|
+
}[];
|
|
14
|
+
page: number;
|
|
15
|
+
pages: number;
|
|
16
|
+
}
|
|
17
|
+
export interface CurrencyOptions {
|
|
18
|
+
page?: number;
|
|
19
|
+
limit?: number;
|
|
20
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Currency = void 0;
|
|
13
|
+
const PaytonzSDKBase_1 = require("../PaytonzSDKBase");
|
|
14
|
+
class Currency extends PaytonzSDKBase_1.PaytonzSDKBase {
|
|
15
|
+
constructor(parameters) {
|
|
16
|
+
super(parameters);
|
|
17
|
+
}
|
|
18
|
+
getAvailableCurrencies(options, accessToken) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
try {
|
|
21
|
+
if (!accessToken) {
|
|
22
|
+
const { token } = yield this.auth(this.options.publicKey, this.options.privateKey);
|
|
23
|
+
accessToken = token;
|
|
24
|
+
}
|
|
25
|
+
const path = `/api/public/currency`;
|
|
26
|
+
return this.auth_get(`${path}`, Object.assign({}, options), accessToken);
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
throw err;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
getPaymasters(options, accessToken) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
try {
|
|
36
|
+
if (!accessToken) {
|
|
37
|
+
const { token } = yield this.auth(this.options.publicKey, this.options.privateKey);
|
|
38
|
+
accessToken = token;
|
|
39
|
+
}
|
|
40
|
+
const path = `/api/public/currency/paymasters`;
|
|
41
|
+
return this.auth_get(`${path}`, Object.assign({}, options), accessToken);
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
throw err;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.Currency = Currency;
|
|
50
|
+
exports.default = Currency;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PaytonzSDKBase, PaytonzSDKBaseOptions } from "../PaytonzSDKBase";
|
|
2
|
+
import { ExternalEstimateWriteInfo, ExternalOptions, ExternalWriteInfo } from "./external.interface";
|
|
3
|
+
import { ExternalSolana } from "./external.solana";
|
|
4
|
+
export interface PaytonzSDKOptions extends PaytonzSDKBaseOptions {
|
|
5
|
+
}
|
|
6
|
+
export declare class External extends PaytonzSDKBase {
|
|
7
|
+
constructor(parameters: PaytonzSDKOptions);
|
|
8
|
+
solana: ExternalSolana;
|
|
9
|
+
read(options: ExternalOptions, accessToken?: string): Promise<any>;
|
|
10
|
+
estimateWrite(options: ExternalOptions, accessToken?: string): Promise<ExternalEstimateWriteInfo>;
|
|
11
|
+
write(options: ExternalOptions, accessToken?: string): Promise<ExternalWriteInfo>;
|
|
12
|
+
}
|
|
13
|
+
export default External;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { AccessWalletOptions } from "src/interfaces/paytonz.interface";
|
|
2
|
+
export interface ExternalOptions extends AccessWalletOptions {
|
|
3
|
+
abi: Record<string, any>[];
|
|
4
|
+
contractAddress: string;
|
|
5
|
+
method: string;
|
|
6
|
+
args?: any[];
|
|
7
|
+
value?: string;
|
|
8
|
+
options?: Record<string, any>;
|
|
9
|
+
isSmartAccount?: boolean;
|
|
10
|
+
isGasless?: boolean;
|
|
11
|
+
paymasterCurrencyToken?: string;
|
|
12
|
+
idempotencyKey?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ExternalEstimateWriteInfo {
|
|
15
|
+
gasPrice?: string;
|
|
16
|
+
gasLimit?: string;
|
|
17
|
+
fee: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ExternalWriteInfo {
|
|
20
|
+
_id: string;
|
|
21
|
+
hash: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ExternalSolanaMintNftInfo extends ExternalWriteInfo {
|
|
24
|
+
address: string;
|
|
25
|
+
}
|
|
26
|
+
export interface SolanaMetadataOptions {
|
|
27
|
+
trait_type: string;
|
|
28
|
+
value: string;
|
|
29
|
+
}
|
|
30
|
+
export declare enum SolanaNftType {
|
|
31
|
+
COLLECTION = "collection",
|
|
32
|
+
NFT = "nft"
|
|
33
|
+
}
|
|
34
|
+
export declare enum SolanaNftStorageType {
|
|
35
|
+
CPAY = "cpay"
|
|
36
|
+
}
|
|
37
|
+
export interface SolanaCollectionInfo {
|
|
38
|
+
name: string;
|
|
39
|
+
family: string;
|
|
40
|
+
}
|
|
41
|
+
export interface ExternalSolanaMintNftOptions extends AccessWalletOptions {
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
symbol: string;
|
|
45
|
+
attributes?: SolanaMetadataOptions[];
|
|
46
|
+
type: SolanaNftType;
|
|
47
|
+
image?: string;
|
|
48
|
+
sellerFeeBasisPoints?: number;
|
|
49
|
+
collectionAddress?: string;
|
|
50
|
+
storage?: SolanaNftStorageType;
|
|
51
|
+
collectionInfo?: SolanaCollectionInfo;
|
|
52
|
+
payerFeePrivateKey?: string;
|
|
53
|
+
tokenOwner?: string;
|
|
54
|
+
creators?: {
|
|
55
|
+
address: string;
|
|
56
|
+
share: number;
|
|
57
|
+
}[];
|
|
58
|
+
imageLink?: string;
|
|
59
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SolanaNftStorageType = exports.SolanaNftType = void 0;
|
|
4
|
+
var SolanaNftType;
|
|
5
|
+
(function (SolanaNftType) {
|
|
6
|
+
SolanaNftType["COLLECTION"] = "collection";
|
|
7
|
+
SolanaNftType["NFT"] = "nft";
|
|
8
|
+
})(SolanaNftType = exports.SolanaNftType || (exports.SolanaNftType = {}));
|
|
9
|
+
var SolanaNftStorageType;
|
|
10
|
+
(function (SolanaNftStorageType) {
|
|
11
|
+
SolanaNftStorageType["CPAY"] = "cpay";
|
|
12
|
+
})(SolanaNftStorageType = exports.SolanaNftStorageType || (exports.SolanaNftStorageType = {}));
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.External = void 0;
|
|
13
|
+
const PaytonzSDKBase_1 = require("../PaytonzSDKBase");
|
|
14
|
+
const external_solana_1 = require("./external.solana");
|
|
15
|
+
class External extends PaytonzSDKBase_1.PaytonzSDKBase {
|
|
16
|
+
constructor(parameters) {
|
|
17
|
+
super(parameters);
|
|
18
|
+
this.solana = new external_solana_1.ExternalSolana(parameters);
|
|
19
|
+
}
|
|
20
|
+
read(options, accessToken) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
try {
|
|
23
|
+
if (!accessToken) {
|
|
24
|
+
accessToken = yield this.getToken(true);
|
|
25
|
+
}
|
|
26
|
+
const path = `/api/public/external/read`;
|
|
27
|
+
return this.auth_post(`${path}`, Object.assign({}, options), accessToken);
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
throw err;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
estimateWrite(options, accessToken) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
try {
|
|
37
|
+
if (!accessToken) {
|
|
38
|
+
accessToken = yield this.getToken(true);
|
|
39
|
+
}
|
|
40
|
+
const path = `/api/public/external/estimateWrite`;
|
|
41
|
+
return this.auth_post(`${path}`, Object.assign({}, options), accessToken);
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
throw err;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
write(options, accessToken) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
try {
|
|
51
|
+
if (!accessToken) {
|
|
52
|
+
accessToken = yield this.getToken(true);
|
|
53
|
+
}
|
|
54
|
+
const path = `/api/public/external/write`;
|
|
55
|
+
return this.auth_post(`${path}`, Object.assign({}, options), accessToken);
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
throw err;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.External = External;
|
|
64
|
+
exports.default = External;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PaytonzSDKBase, PaytonzSDKBaseOptions } from "../PaytonzSDKBase";
|
|
2
|
+
import { ExternalEstimateWriteInfo, ExternalSolanaMintNftInfo, ExternalSolanaMintNftOptions } from "./external.interface";
|
|
3
|
+
export interface PaytonzSDKOptions extends PaytonzSDKBaseOptions {
|
|
4
|
+
}
|
|
5
|
+
export declare class ExternalSolana extends PaytonzSDKBase {
|
|
6
|
+
constructor(parameters: PaytonzSDKOptions);
|
|
7
|
+
mintNft(options: ExternalSolanaMintNftOptions, accessToken?: string): Promise<ExternalSolanaMintNftInfo>;
|
|
8
|
+
estimateMintNft(options: ExternalSolanaMintNftOptions, accessToken?: string): Promise<ExternalEstimateWriteInfo>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ExternalSolana = void 0;
|
|
13
|
+
const PaytonzSDKBase_1 = require("../PaytonzSDKBase");
|
|
14
|
+
class ExternalSolana extends PaytonzSDKBase_1.PaytonzSDKBase {
|
|
15
|
+
constructor(parameters) {
|
|
16
|
+
super(parameters);
|
|
17
|
+
}
|
|
18
|
+
mintNft(options, accessToken) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
try {
|
|
21
|
+
if (!accessToken) {
|
|
22
|
+
accessToken = yield this.getToken(true);
|
|
23
|
+
}
|
|
24
|
+
const path = `/api/public/external/mint-solana-nft`;
|
|
25
|
+
return this.auth_post(`${path}`, options, accessToken);
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
throw err;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
estimateMintNft(options, accessToken) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
try {
|
|
35
|
+
if (!accessToken) {
|
|
36
|
+
accessToken = yield this.getToken(true);
|
|
37
|
+
}
|
|
38
|
+
const path = `/api/public/external/mint-solana-nft/estimate`;
|
|
39
|
+
return this.auth_post(`${path}`, options, accessToken);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
throw err;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.ExternalSolana = ExternalSolana;
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.PaytonzSDKBase = exports.default = exports.PaytonzSDK = void 0;
|
|
21
|
+
__exportStar(require("./constant"), exports);
|
|
22
|
+
var PaytonzSDK_1 = require("./PaytonzSDK");
|
|
23
|
+
Object.defineProperty(exports, "PaytonzSDK", { enumerable: true, get: function () { return __importDefault(PaytonzSDK_1).default; } });
|
|
24
|
+
var PaytonzSDK_2 = require("./PaytonzSDK");
|
|
25
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(PaytonzSDK_2).default; } });
|
|
26
|
+
var PaytonzSDKBase_1 = require("./PaytonzSDKBase");
|
|
27
|
+
Object.defineProperty(exports, "PaytonzSDKBase", { enumerable: true, get: function () { return PaytonzSDKBase_1.PaytonzSDKBase; } });
|
|
28
|
+
__exportStar(require("./interfaces/paytonz.interface"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface CpayToken {
|
|
2
|
+
token: string;
|
|
3
|
+
}
|
|
4
|
+
export interface AccessWalletOptions {
|
|
5
|
+
sign?: string;
|
|
6
|
+
password?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface BasePaginationOptions {
|
|
9
|
+
search?: string;
|
|
10
|
+
sort?: string;
|
|
11
|
+
order?: string;
|
|
12
|
+
page?: number;
|
|
13
|
+
limit?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface IGetToken {
|
|
16
|
+
publicKey: string;
|
|
17
|
+
privateKey: string;
|
|
18
|
+
walletId?: string;
|
|
19
|
+
passphrase?: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface CryptoNowToken {
|
|
2
|
+
token: string;
|
|
3
|
+
}
|
|
4
|
+
export interface AccessWalletOptions {
|
|
5
|
+
sign?: string;
|
|
6
|
+
password?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface BasePaginationOptions {
|
|
9
|
+
search?: string;
|
|
10
|
+
sort?: string;
|
|
11
|
+
order?: string;
|
|
12
|
+
page?: number;
|
|
13
|
+
limit?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface IGetToken {
|
|
16
|
+
publicKey: string;
|
|
17
|
+
privateKey: string;
|
|
18
|
+
walletId?: string;
|
|
19
|
+
passphrase?: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface PaytonzToken {
|
|
2
|
+
token: string;
|
|
3
|
+
}
|
|
4
|
+
export interface AccessWalletOptions {
|
|
5
|
+
sign?: string;
|
|
6
|
+
password?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface BasePaginationOptions {
|
|
9
|
+
search?: string;
|
|
10
|
+
sort?: string;
|
|
11
|
+
order?: string;
|
|
12
|
+
page?: number;
|
|
13
|
+
limit?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface IGetToken {
|
|
16
|
+
publicKey: string;
|
|
17
|
+
privateKey: string;
|
|
18
|
+
walletId?: string;
|
|
19
|
+
passphrase?: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PaytonzSDKBase, PaytonzSDKBaseOptions } from "../PaytonzSDKBase";
|
|
2
|
+
import { EstimateMultisendCommonOptions, EstimateMultisendInfo, EstimateSystemFeeOptions, MultisendInfo } from "./multisend.interface";
|
|
3
|
+
export interface PaytonzSDKOptions extends PaytonzSDKBaseOptions {
|
|
4
|
+
}
|
|
5
|
+
export declare class Multisend extends PaytonzSDKBase {
|
|
6
|
+
constructor(parameters: PaytonzSDKOptions);
|
|
7
|
+
estimateSystemFee(options: EstimateSystemFeeOptions, accessToken?: string): Promise<EstimateMultisendInfo>;
|
|
8
|
+
approve(options: EstimateMultisendCommonOptions, accessToken?: string): Promise<EstimateMultisendInfo>;
|
|
9
|
+
estimateMinerFee(options: EstimateMultisendCommonOptions, accessToken?: string): Promise<EstimateMultisendInfo>;
|
|
10
|
+
create(options: EstimateMultisendCommonOptions, accessToken?: string): Promise<MultisendInfo>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AccessWalletOptions } from "src/interfaces/paytonz.interface";
|
|
2
|
+
interface MultisendFileOptions {
|
|
3
|
+
address: string;
|
|
4
|
+
amount: string;
|
|
5
|
+
}
|
|
6
|
+
export interface EstimateSystemFeeOptions {
|
|
7
|
+
currencyToken: string;
|
|
8
|
+
multisendWallets: MultisendFileOptions[];
|
|
9
|
+
}
|
|
10
|
+
export interface EstimateMultisendInfo {
|
|
11
|
+
estimationId: string;
|
|
12
|
+
countTxs: number;
|
|
13
|
+
systemFee: string;
|
|
14
|
+
minerFee: string;
|
|
15
|
+
totalAmount: string;
|
|
16
|
+
allowance: string;
|
|
17
|
+
currencyFee: string;
|
|
18
|
+
needApprove: boolean;
|
|
19
|
+
multisendWallets: MultisendFileOptions[];
|
|
20
|
+
}
|
|
21
|
+
export interface EstimateMultisendCommonOptions extends AccessWalletOptions {
|
|
22
|
+
estimationId: string;
|
|
23
|
+
idempotencyKey?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface MultisendInfo {
|
|
26
|
+
ids: string[];
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Multisend = void 0;
|
|
13
|
+
const PaytonzSDKBase_1 = require("../PaytonzSDKBase");
|
|
14
|
+
class Multisend extends PaytonzSDKBase_1.PaytonzSDKBase {
|
|
15
|
+
constructor(parameters) {
|
|
16
|
+
super(parameters);
|
|
17
|
+
}
|
|
18
|
+
estimateSystemFee(options, accessToken) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
try {
|
|
21
|
+
if (!accessToken) {
|
|
22
|
+
accessToken = yield this.getToken(true);
|
|
23
|
+
}
|
|
24
|
+
const path = `/api/public/multisend/estimateSystemFee`;
|
|
25
|
+
return this.auth_post(`${path}`, options, accessToken);
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
throw err;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
approve(options, accessToken) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
try {
|
|
35
|
+
if (!accessToken) {
|
|
36
|
+
accessToken = yield this.getToken(true);
|
|
37
|
+
}
|
|
38
|
+
const path = `/api/public/multisend/approve`;
|
|
39
|
+
return this.auth_post(`${path}`, options, accessToken);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
throw err;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
estimateMinerFee(options, accessToken) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
try {
|
|
49
|
+
if (!accessToken) {
|
|
50
|
+
accessToken = yield this.getToken(true);
|
|
51
|
+
}
|
|
52
|
+
const path = `/api/public/multisend/estimateMinerFee`;
|
|
53
|
+
return this.auth_post(`${path}`, options, accessToken);
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
throw err;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
create(options, accessToken) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
try {
|
|
63
|
+
if (!accessToken) {
|
|
64
|
+
accessToken = yield this.getToken(true);
|
|
65
|
+
}
|
|
66
|
+
const path = `/api/public/multisend`;
|
|
67
|
+
return this.auth_post(`${path}`, options, accessToken);
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
throw err;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.Multisend = Multisend;
|