@riocrypto/common-server 1.0.872 → 1.0.874
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.
|
@@ -24,6 +24,50 @@ declare class BridgeClient {
|
|
|
24
24
|
created_at: string;
|
|
25
25
|
customer_id?: string;
|
|
26
26
|
}>;
|
|
27
|
+
createTransfer(bridgeCustomerId: string, amountInUSD: string, source: {
|
|
28
|
+
currency: "usdc" | "usd";
|
|
29
|
+
payment_rail: "ach" | "avalanche_c_c" | "ethereum" | "polygon";
|
|
30
|
+
external_account_id?: string;
|
|
31
|
+
from_address?: string;
|
|
32
|
+
}, destination: {
|
|
33
|
+
currency: "usdc" | "usd";
|
|
34
|
+
payment_rail: "ach" | "avalanche_c_c" | "ethereum" | "polygon";
|
|
35
|
+
external_account_id?: string;
|
|
36
|
+
to_address?: string;
|
|
37
|
+
wire_message?: string;
|
|
38
|
+
}, developerFee?: string): Promise<{
|
|
39
|
+
id: string;
|
|
40
|
+
amount: string;
|
|
41
|
+
on_behalf_of: string;
|
|
42
|
+
developer_fee: string;
|
|
43
|
+
source: {
|
|
44
|
+
currency: "usdc" | "usd";
|
|
45
|
+
payment_rail: "ach" | "avalanche_c_c" | "ethereum" | "polygon";
|
|
46
|
+
external_account_id?: string;
|
|
47
|
+
from_address?: string;
|
|
48
|
+
};
|
|
49
|
+
destination: {
|
|
50
|
+
currency: "usdc" | "usd";
|
|
51
|
+
payment_rail: "ach" | "avalanche_c_c" | "ethereum" | "polygon";
|
|
52
|
+
external_account_id?: string;
|
|
53
|
+
to_address?: string;
|
|
54
|
+
wire_message?: string;
|
|
55
|
+
};
|
|
56
|
+
state: "awaiting_source_deposit" | "pending" | "completed" | "failed";
|
|
57
|
+
source_deposit_instructions: {
|
|
58
|
+
payment_rail: "ach" | "avalanche_c_chain" | "ethereum" | "polygon";
|
|
59
|
+
amount: string;
|
|
60
|
+
currency: "usdc" | "usd";
|
|
61
|
+
from_address?: string;
|
|
62
|
+
to_address?: string;
|
|
63
|
+
deposit_message?: string;
|
|
64
|
+
bank_name?: string;
|
|
65
|
+
bank_address?: string;
|
|
66
|
+
bank_routing_number?: string;
|
|
67
|
+
bank_account_number?: string;
|
|
68
|
+
bank_beneficiary_name?: string;
|
|
69
|
+
};
|
|
70
|
+
}>;
|
|
27
71
|
}
|
|
28
72
|
export declare const buildBridgeClient: () => Promise<BridgeClient>;
|
|
29
73
|
export {};
|
|
@@ -52,6 +52,23 @@ class BridgeClient {
|
|
|
52
52
|
return data;
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
+
createTransfer(bridgeCustomerId, amountInUSD, source, destination, developerFee) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
const { data } = yield axios_1.default.post(`${this.baseUrl}/v0/transfers`, {
|
|
58
|
+
amount: amountInUSD,
|
|
59
|
+
on_behalf_of: bridgeCustomerId,
|
|
60
|
+
developer_fee: developerFee,
|
|
61
|
+
source,
|
|
62
|
+
destination,
|
|
63
|
+
}, {
|
|
64
|
+
headers: {
|
|
65
|
+
"Api-Key": this.apiKey,
|
|
66
|
+
"Idempotency-Key": (0, uuid_1.v4)(),
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
return data;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
55
72
|
}
|
|
56
73
|
const buildBridgeClient = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
74
|
// Retrieve secrets asynchronously
|
package/build/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export * from "./models/partner-auth";
|
|
|
30
30
|
export * from "./models/bank-account";
|
|
31
31
|
export * from "./models/quote";
|
|
32
32
|
export * from "./models/bridge-customer";
|
|
33
|
+
export * from "./models/bridge-transfer";
|
|
33
34
|
export * from "./clients/bitstamp-client";
|
|
34
35
|
export * from "./clients/ccxt-client";
|
|
35
36
|
export * from "./clients/kushki-client";
|
package/build/index.js
CHANGED
|
@@ -46,6 +46,7 @@ __exportStar(require("./models/partner-auth"), exports);
|
|
|
46
46
|
__exportStar(require("./models/bank-account"), exports);
|
|
47
47
|
__exportStar(require("./models/quote"), exports);
|
|
48
48
|
__exportStar(require("./models/bridge-customer"), exports);
|
|
49
|
+
__exportStar(require("./models/bridge-transfer"), exports);
|
|
49
50
|
__exportStar(require("./clients/bitstamp-client"), exports);
|
|
50
51
|
__exportStar(require("./clients/ccxt-client"), exports);
|
|
51
52
|
__exportStar(require("./clients/kushki-client"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Mongoose, Model, Document } from "mongoose";
|
|
2
|
+
interface BridgeTransferAttrs {
|
|
3
|
+
orderId: string;
|
|
4
|
+
bridgeTransferId: string;
|
|
5
|
+
}
|
|
6
|
+
interface BridgeTransferModel extends Model<BridgeTransferDoc> {
|
|
7
|
+
build(attrs: BridgeTransferAttrs): BridgeTransferDoc;
|
|
8
|
+
}
|
|
9
|
+
interface BridgeTransferDoc extends Document {
|
|
10
|
+
_id: string;
|
|
11
|
+
userId: string;
|
|
12
|
+
bridgeTransferId: string;
|
|
13
|
+
}
|
|
14
|
+
declare const buildBridgeTransfer: (mongoose: Mongoose) => BridgeTransferModel;
|
|
15
|
+
export { buildBridgeTransfer, BridgeTransferDoc };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildBridgeTransfer = void 0;
|
|
4
|
+
const buildBridgeTransfer = (mongoose) => {
|
|
5
|
+
// if model is already defined, return it
|
|
6
|
+
if (mongoose.models.BridgeTransfer) {
|
|
7
|
+
return mongoose.model("BridgeTransfer");
|
|
8
|
+
}
|
|
9
|
+
const bridgeTransferSchema = new mongoose.Schema({
|
|
10
|
+
userId: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
bridgeTransferId: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
}, {
|
|
19
|
+
toJSON: {
|
|
20
|
+
transform(doc, ret) {
|
|
21
|
+
ret.id = ret._id.valueOf();
|
|
22
|
+
delete ret._id;
|
|
23
|
+
delete ret.__v;
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
bridgeTransferSchema.statics.build = (attrs) => {
|
|
28
|
+
return new BridgeTransfer(attrs);
|
|
29
|
+
};
|
|
30
|
+
const BridgeTransfer = mongoose.model("BridgeTransfer", bridgeTransferSchema);
|
|
31
|
+
return BridgeTransfer;
|
|
32
|
+
};
|
|
33
|
+
exports.buildBridgeTransfer = buildBridgeTransfer;
|