fix names
This commit is contained in:
parent
5e49e74b22
commit
9d082ea0a0
12 changed files with 46 additions and 55 deletions
|
|
@ -292,7 +292,7 @@ The nostr server will send back a message response, and inside the body there wi
|
||||||
|
|
||||||
- PayAdminTransactionSwap
|
- PayAdminTransactionSwap
|
||||||
- auth type: __Admin__
|
- auth type: __Admin__
|
||||||
- input: [TransactionSwapQuoteRequest](#TransactionSwapQuoteRequest)
|
- input: [PayAdminTransactionSwapRequest](#PayAdminTransactionSwapRequest)
|
||||||
- output: [AdminSwapResponse](#AdminSwapResponse)
|
- output: [AdminSwapResponse](#AdminSwapResponse)
|
||||||
|
|
||||||
- PayInvoice
|
- PayInvoice
|
||||||
|
|
@ -903,7 +903,7 @@ The nostr server will send back a message response, and inside the body there wi
|
||||||
- auth type: __Admin__
|
- auth type: __Admin__
|
||||||
- http method: __post__
|
- http method: __post__
|
||||||
- http route: __/api/admin/swap/transaction/pay__
|
- http route: __/api/admin/swap/transaction/pay__
|
||||||
- input: [TransactionSwapQuoteRequest](#TransactionSwapQuoteRequest)
|
- input: [PayAdminTransactionSwapRequest](#PayAdminTransactionSwapRequest)
|
||||||
- output: [AdminSwapResponse](#AdminSwapResponse)
|
- output: [AdminSwapResponse](#AdminSwapResponse)
|
||||||
|
|
||||||
- PayAppUserInvoice
|
- PayAppUserInvoice
|
||||||
|
|
@ -1534,6 +1534,10 @@ The nostr server will send back a message response, and inside the body there wi
|
||||||
- __service_fee__: _number_
|
- __service_fee__: _number_
|
||||||
- __txId__: _string_
|
- __txId__: _string_
|
||||||
|
|
||||||
|
### PayAdminTransactionSwapRequest
|
||||||
|
- __address__: _string_
|
||||||
|
- __swap_operation_id__: _string_
|
||||||
|
|
||||||
### PayAppUserInvoiceRequest
|
### PayAppUserInvoiceRequest
|
||||||
- __amount__: _number_
|
- __amount__: _number_
|
||||||
- __debit_npub__: _string_ *this field is optional
|
- __debit_npub__: _string_ *this field is optional
|
||||||
|
|
@ -1564,7 +1568,6 @@ The nostr server will send back a message response, and inside the body there wi
|
||||||
- __network_fee__: _number_
|
- __network_fee__: _number_
|
||||||
- __operation_id__: _string_
|
- __operation_id__: _string_
|
||||||
- __paid_at_unix__: _number_
|
- __paid_at_unix__: _number_
|
||||||
- __preimage__: _string_ *this field is optional
|
|
||||||
- __service_fee__: _number_
|
- __service_fee__: _number_
|
||||||
|
|
||||||
### Product
|
### Product
|
||||||
|
|
@ -1655,10 +1658,6 @@ The nostr server will send back a message response, and inside the body there wi
|
||||||
- __swap_operation_id__: _string_
|
- __swap_operation_id__: _string_
|
||||||
- __transaction_amount_sats__: _number_
|
- __transaction_amount_sats__: _number_
|
||||||
|
|
||||||
### TransactionSwapQuoteRequest
|
|
||||||
- __address__: _string_
|
|
||||||
- __swap_operation_id__: _string_
|
|
||||||
|
|
||||||
### TransactionSwapRequest
|
### TransactionSwapRequest
|
||||||
- __transaction_amount_sats__: _number_
|
- __transaction_amount_sats__: _number_
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ type Client struct {
|
||||||
NewProductInvoice func(query NewProductInvoice_Query) (*NewInvoiceResponse, error)
|
NewProductInvoice func(query NewProductInvoice_Query) (*NewInvoiceResponse, error)
|
||||||
OpenChannel func(req OpenChannelRequest) (*OpenChannelResponse, error)
|
OpenChannel func(req OpenChannelRequest) (*OpenChannelResponse, error)
|
||||||
PayAddress func(req PayAddressRequest) (*PayAddressResponse, error)
|
PayAddress func(req PayAddressRequest) (*PayAddressResponse, error)
|
||||||
PayAdminTransactionSwap func(req TransactionSwapQuoteRequest) (*AdminSwapResponse, error)
|
PayAdminTransactionSwap func(req PayAdminTransactionSwapRequest) (*AdminSwapResponse, error)
|
||||||
PayAppUserInvoice func(req PayAppUserInvoiceRequest) (*PayInvoiceResponse, error)
|
PayAppUserInvoice func(req PayAppUserInvoiceRequest) (*PayInvoiceResponse, error)
|
||||||
PayInvoice func(req PayInvoiceRequest) (*PayInvoiceResponse, error)
|
PayInvoice func(req PayInvoiceRequest) (*PayInvoiceResponse, error)
|
||||||
PingSubProcesses func() error
|
PingSubProcesses func() error
|
||||||
|
|
@ -1892,7 +1892,7 @@ func NewClient(params ClientParams) *Client {
|
||||||
}
|
}
|
||||||
return &res, nil
|
return &res, nil
|
||||||
},
|
},
|
||||||
PayAdminTransactionSwap: func(req TransactionSwapQuoteRequest) (*AdminSwapResponse, error) {
|
PayAdminTransactionSwap: func(req PayAdminTransactionSwapRequest) (*AdminSwapResponse, error) {
|
||||||
auth, err := params.RetrieveAdminAuth()
|
auth, err := params.RetrieveAdminAuth()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
|
|
@ -559,6 +559,10 @@ type PayAddressResponse struct {
|
||||||
Service_fee int64 `json:"service_fee"`
|
Service_fee int64 `json:"service_fee"`
|
||||||
Txid string `json:"txId"`
|
Txid string `json:"txId"`
|
||||||
}
|
}
|
||||||
|
type PayAdminTransactionSwapRequest struct {
|
||||||
|
Address string `json:"address"`
|
||||||
|
Swap_operation_id string `json:"swap_operation_id"`
|
||||||
|
}
|
||||||
type PayAppUserInvoiceRequest struct {
|
type PayAppUserInvoiceRequest struct {
|
||||||
Amount int64 `json:"amount"`
|
Amount int64 `json:"amount"`
|
||||||
Debit_npub string `json:"debit_npub"`
|
Debit_npub string `json:"debit_npub"`
|
||||||
|
|
@ -589,7 +593,6 @@ type PaymentState struct {
|
||||||
Network_fee int64 `json:"network_fee"`
|
Network_fee int64 `json:"network_fee"`
|
||||||
Operation_id string `json:"operation_id"`
|
Operation_id string `json:"operation_id"`
|
||||||
Paid_at_unix int64 `json:"paid_at_unix"`
|
Paid_at_unix int64 `json:"paid_at_unix"`
|
||||||
Preimage string `json:"preimage"`
|
|
||||||
Service_fee int64 `json:"service_fee"`
|
Service_fee int64 `json:"service_fee"`
|
||||||
}
|
}
|
||||||
type Product struct {
|
type Product struct {
|
||||||
|
|
@ -680,10 +683,6 @@ type TransactionSwapQuote struct {
|
||||||
Swap_operation_id string `json:"swap_operation_id"`
|
Swap_operation_id string `json:"swap_operation_id"`
|
||||||
Transaction_amount_sats int64 `json:"transaction_amount_sats"`
|
Transaction_amount_sats int64 `json:"transaction_amount_sats"`
|
||||||
}
|
}
|
||||||
type TransactionSwapQuoteRequest struct {
|
|
||||||
Address string `json:"address"`
|
|
||||||
Swap_operation_id string `json:"swap_operation_id"`
|
|
||||||
}
|
|
||||||
type TransactionSwapRequest struct {
|
type TransactionSwapRequest struct {
|
||||||
Transaction_amount_sats int64 `json:"transaction_amount_sats"`
|
Transaction_amount_sats int64 `json:"transaction_amount_sats"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1804,7 +1804,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
|
||||||
authCtx = authContext
|
authCtx = authContext
|
||||||
stats.guard = process.hrtime.bigint()
|
stats.guard = process.hrtime.bigint()
|
||||||
const request = req.body
|
const request = req.body
|
||||||
const error = Types.TransactionSwapQuoteRequestValidate(request)
|
const error = Types.PayAdminTransactionSwapRequestValidate(request)
|
||||||
stats.validate = process.hrtime.bigint()
|
stats.validate = process.hrtime.bigint()
|
||||||
if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback)
|
if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback)
|
||||||
const query = req.query
|
const query = req.query
|
||||||
|
|
|
||||||
|
|
@ -909,7 +909,7 @@ export default (params: ClientParams) => ({
|
||||||
}
|
}
|
||||||
return { status: 'ERROR', reason: 'invalid response' }
|
return { status: 'ERROR', reason: 'invalid response' }
|
||||||
},
|
},
|
||||||
PayAdminTransactionSwap: async (request: Types.TransactionSwapQuoteRequest): Promise<ResultError | ({ status: 'OK' }& Types.AdminSwapResponse)> => {
|
PayAdminTransactionSwap: async (request: Types.PayAdminTransactionSwapRequest): Promise<ResultError | ({ status: 'OK' }& Types.AdminSwapResponse)> => {
|
||||||
const auth = await params.retrieveAdminAuth()
|
const auth = await params.retrieveAdminAuth()
|
||||||
if (auth === null) throw new Error('retrieveAdminAuth() returned null')
|
if (auth === null) throw new Error('retrieveAdminAuth() returned null')
|
||||||
let finalRoute = '/api/admin/swap/transaction/pay'
|
let finalRoute = '/api/admin/swap/transaction/pay'
|
||||||
|
|
|
||||||
|
|
@ -798,7 +798,7 @@ export default (params: NostrClientParams, send: (to:string, message: NostrRequ
|
||||||
}
|
}
|
||||||
return { status: 'ERROR', reason: 'invalid response' }
|
return { status: 'ERROR', reason: 'invalid response' }
|
||||||
},
|
},
|
||||||
PayAdminTransactionSwap: async (request: Types.TransactionSwapQuoteRequest): Promise<ResultError | ({ status: 'OK' }& Types.AdminSwapResponse)> => {
|
PayAdminTransactionSwap: async (request: Types.PayAdminTransactionSwapRequest): Promise<ResultError | ({ status: 'OK' }& Types.AdminSwapResponse)> => {
|
||||||
const auth = await params.retrieveNostrAdminAuth()
|
const auth = await params.retrieveNostrAdminAuth()
|
||||||
if (auth === null) throw new Error('retrieveNostrAdminAuth() returned null')
|
if (auth === null) throw new Error('retrieveNostrAdminAuth() returned null')
|
||||||
const nostrRequest: NostrRequest = {}
|
const nostrRequest: NostrRequest = {}
|
||||||
|
|
|
||||||
|
|
@ -1261,7 +1261,7 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => {
|
||||||
stats.guard = process.hrtime.bigint()
|
stats.guard = process.hrtime.bigint()
|
||||||
authCtx = authContext
|
authCtx = authContext
|
||||||
const request = req.body
|
const request = req.body
|
||||||
const error = Types.TransactionSwapQuoteRequestValidate(request)
|
const error = Types.PayAdminTransactionSwapRequestValidate(request)
|
||||||
stats.validate = process.hrtime.bigint()
|
stats.validate = process.hrtime.bigint()
|
||||||
if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback)
|
if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback)
|
||||||
const response = await methods.PayAdminTransactionSwap({rpcName:'PayAdminTransactionSwap', ctx:authContext , req: request})
|
const response = await methods.PayAdminTransactionSwap({rpcName:'PayAdminTransactionSwap', ctx:authContext , req: request})
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,7 @@ export type OpenChannel_Output = ResultError | ({ status: 'OK' } & OpenChannelRe
|
||||||
export type PayAddress_Input = {rpcName:'PayAddress', req: PayAddressRequest}
|
export type PayAddress_Input = {rpcName:'PayAddress', req: PayAddressRequest}
|
||||||
export type PayAddress_Output = ResultError | ({ status: 'OK' } & PayAddressResponse)
|
export type PayAddress_Output = ResultError | ({ status: 'OK' } & PayAddressResponse)
|
||||||
|
|
||||||
export type PayAdminTransactionSwap_Input = {rpcName:'PayAdminTransactionSwap', req: TransactionSwapQuoteRequest}
|
export type PayAdminTransactionSwap_Input = {rpcName:'PayAdminTransactionSwap', req: PayAdminTransactionSwapRequest}
|
||||||
export type PayAdminTransactionSwap_Output = ResultError | ({ status: 'OK' } & AdminSwapResponse)
|
export type PayAdminTransactionSwap_Output = ResultError | ({ status: 'OK' } & AdminSwapResponse)
|
||||||
|
|
||||||
export type PayAppUserInvoice_Input = {rpcName:'PayAppUserInvoice', req: PayAppUserInvoiceRequest}
|
export type PayAppUserInvoice_Input = {rpcName:'PayAppUserInvoice', req: PayAppUserInvoiceRequest}
|
||||||
|
|
@ -3308,6 +3308,29 @@ export const PayAddressResponseValidate = (o?: PayAddressResponse, opts: PayAddr
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type PayAdminTransactionSwapRequest = {
|
||||||
|
address: string
|
||||||
|
swap_operation_id: string
|
||||||
|
}
|
||||||
|
export const PayAdminTransactionSwapRequestOptionalFields: [] = []
|
||||||
|
export type PayAdminTransactionSwapRequestOptions = OptionsBaseMessage & {
|
||||||
|
checkOptionalsAreSet?: []
|
||||||
|
address_CustomCheck?: (v: string) => boolean
|
||||||
|
swap_operation_id_CustomCheck?: (v: string) => boolean
|
||||||
|
}
|
||||||
|
export const PayAdminTransactionSwapRequestValidate = (o?: PayAdminTransactionSwapRequest, opts: PayAdminTransactionSwapRequestOptions = {}, path: string = 'PayAdminTransactionSwapRequest::root.'): Error | null => {
|
||||||
|
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||||
|
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||||
|
|
||||||
|
if (typeof o.address !== 'string') return new Error(`${path}.address: is not a string`)
|
||||||
|
if (opts.address_CustomCheck && !opts.address_CustomCheck(o.address)) return new Error(`${path}.address: custom check failed`)
|
||||||
|
|
||||||
|
if (typeof o.swap_operation_id !== 'string') return new Error(`${path}.swap_operation_id: is not a string`)
|
||||||
|
if (opts.swap_operation_id_CustomCheck && !opts.swap_operation_id_CustomCheck(o.swap_operation_id)) return new Error(`${path}.swap_operation_id: custom check failed`)
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
export type PayAppUserInvoiceRequest = {
|
export type PayAppUserInvoiceRequest = {
|
||||||
amount: number
|
amount: number
|
||||||
debit_npub?: string
|
debit_npub?: string
|
||||||
|
|
@ -3456,19 +3479,16 @@ export type PaymentState = {
|
||||||
network_fee: number
|
network_fee: number
|
||||||
operation_id: string
|
operation_id: string
|
||||||
paid_at_unix: number
|
paid_at_unix: number
|
||||||
preimage?: string
|
|
||||||
service_fee: number
|
service_fee: number
|
||||||
}
|
}
|
||||||
export type PaymentStateOptionalField = 'preimage'
|
export const PaymentStateOptionalFields: [] = []
|
||||||
export const PaymentStateOptionalFields: PaymentStateOptionalField[] = ['preimage']
|
|
||||||
export type PaymentStateOptions = OptionsBaseMessage & {
|
export type PaymentStateOptions = OptionsBaseMessage & {
|
||||||
checkOptionalsAreSet?: PaymentStateOptionalField[]
|
checkOptionalsAreSet?: []
|
||||||
amount_CustomCheck?: (v: number) => boolean
|
amount_CustomCheck?: (v: number) => boolean
|
||||||
internal_CustomCheck?: (v: boolean) => boolean
|
internal_CustomCheck?: (v: boolean) => boolean
|
||||||
network_fee_CustomCheck?: (v: number) => boolean
|
network_fee_CustomCheck?: (v: number) => boolean
|
||||||
operation_id_CustomCheck?: (v: string) => boolean
|
operation_id_CustomCheck?: (v: string) => boolean
|
||||||
paid_at_unix_CustomCheck?: (v: number) => boolean
|
paid_at_unix_CustomCheck?: (v: number) => boolean
|
||||||
preimage_CustomCheck?: (v?: string) => boolean
|
|
||||||
service_fee_CustomCheck?: (v: number) => boolean
|
service_fee_CustomCheck?: (v: number) => boolean
|
||||||
}
|
}
|
||||||
export const PaymentStateValidate = (o?: PaymentState, opts: PaymentStateOptions = {}, path: string = 'PaymentState::root.'): Error | null => {
|
export const PaymentStateValidate = (o?: PaymentState, opts: PaymentStateOptions = {}, path: string = 'PaymentState::root.'): Error | null => {
|
||||||
|
|
@ -3490,9 +3510,6 @@ export const PaymentStateValidate = (o?: PaymentState, opts: PaymentStateOptions
|
||||||
if (typeof o.paid_at_unix !== 'number') return new Error(`${path}.paid_at_unix: is not a number`)
|
if (typeof o.paid_at_unix !== 'number') return new Error(`${path}.paid_at_unix: is not a number`)
|
||||||
if (opts.paid_at_unix_CustomCheck && !opts.paid_at_unix_CustomCheck(o.paid_at_unix)) return new Error(`${path}.paid_at_unix: custom check failed`)
|
if (opts.paid_at_unix_CustomCheck && !opts.paid_at_unix_CustomCheck(o.paid_at_unix)) return new Error(`${path}.paid_at_unix: custom check failed`)
|
||||||
|
|
||||||
if ((o.preimage || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('preimage')) && typeof o.preimage !== 'string') return new Error(`${path}.preimage: is not a string`)
|
|
||||||
if (opts.preimage_CustomCheck && !opts.preimage_CustomCheck(o.preimage)) return new Error(`${path}.preimage: custom check failed`)
|
|
||||||
|
|
||||||
if (typeof o.service_fee !== 'number') return new Error(`${path}.service_fee: is not a number`)
|
if (typeof o.service_fee !== 'number') return new Error(`${path}.service_fee: is not a number`)
|
||||||
if (opts.service_fee_CustomCheck && !opts.service_fee_CustomCheck(o.service_fee)) return new Error(`${path}.service_fee: custom check failed`)
|
if (opts.service_fee_CustomCheck && !opts.service_fee_CustomCheck(o.service_fee)) return new Error(`${path}.service_fee: custom check failed`)
|
||||||
|
|
||||||
|
|
@ -4013,29 +4030,6 @@ export const TransactionSwapQuoteValidate = (o?: TransactionSwapQuote, opts: Tra
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TransactionSwapQuoteRequest = {
|
|
||||||
address: string
|
|
||||||
swap_operation_id: string
|
|
||||||
}
|
|
||||||
export const TransactionSwapQuoteRequestOptionalFields: [] = []
|
|
||||||
export type TransactionSwapQuoteRequestOptions = OptionsBaseMessage & {
|
|
||||||
checkOptionalsAreSet?: []
|
|
||||||
address_CustomCheck?: (v: string) => boolean
|
|
||||||
swap_operation_id_CustomCheck?: (v: string) => boolean
|
|
||||||
}
|
|
||||||
export const TransactionSwapQuoteRequestValidate = (o?: TransactionSwapQuoteRequest, opts: TransactionSwapQuoteRequestOptions = {}, path: string = 'TransactionSwapQuoteRequest::root.'): Error | null => {
|
|
||||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
|
||||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
|
||||||
|
|
||||||
if (typeof o.address !== 'string') return new Error(`${path}.address: is not a string`)
|
|
||||||
if (opts.address_CustomCheck && !opts.address_CustomCheck(o.address)) return new Error(`${path}.address: custom check failed`)
|
|
||||||
|
|
||||||
if (typeof o.swap_operation_id !== 'string') return new Error(`${path}.swap_operation_id: is not a string`)
|
|
||||||
if (opts.swap_operation_id_CustomCheck && !opts.swap_operation_id_CustomCheck(o.swap_operation_id)) return new Error(`${path}.swap_operation_id: custom check failed`)
|
|
||||||
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
export type TransactionSwapRequest = {
|
export type TransactionSwapRequest = {
|
||||||
transaction_amount_sats: number
|
transaction_amount_sats: number
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ service LightningPub {
|
||||||
option (nostr) = true;
|
option (nostr) = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
rpc PayAdminTransactionSwap(structs.TransactionSwapQuoteRequest) returns (structs.AdminSwapResponse) {
|
rpc PayAdminTransactionSwap(structs.PayAdminTransactionSwapRequest) returns (structs.AdminSwapResponse) {
|
||||||
option (auth_type) = "Admin";
|
option (auth_type) = "Admin";
|
||||||
option (http_method) = "post";
|
option (http_method) = "post";
|
||||||
option (http_route) = "/api/admin/swap/transaction/pay";
|
option (http_route) = "/api/admin/swap/transaction/pay";
|
||||||
|
|
|
||||||
|
|
@ -837,7 +837,7 @@ message TransactionSwapRequest {
|
||||||
int64 transaction_amount_sats = 2;
|
int64 transaction_amount_sats = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message TransactionSwapQuoteRequest {
|
message PayAdminTransactionSwapRequest {
|
||||||
string address = 1;
|
string address = 1;
|
||||||
string swap_operation_id = 2;
|
string swap_operation_id = 2;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -267,11 +267,10 @@ export class AdminManager {
|
||||||
async GetAdminTransactionSwapQuote(req: Types.TransactionSwapRequest): Promise<Types.TransactionSwapQuote> {
|
async GetAdminTransactionSwapQuote(req: Types.TransactionSwapRequest): Promise<Types.TransactionSwapQuote> {
|
||||||
return this.swaps.GetTxSwapQuote("admin", req.transaction_amount_sats, () => 0)
|
return this.swaps.GetTxSwapQuote("admin", req.transaction_amount_sats, () => 0)
|
||||||
}
|
}
|
||||||
async PayAdminTransactionSwap(req: Types.TransactionSwapQuoteRequest): Promise<Types.AdminSwapResponse> {
|
async PayAdminTransactionSwap(req: Types.PayAdminTransactionSwapRequest): Promise<Types.AdminSwapResponse> {
|
||||||
const routingFloor = this.settings.getSettings().lndSettings.routingFeeFloor
|
const routingFloor = this.settings.getSettings().lndSettings.routingFeeFloor
|
||||||
const routingLimit = this.settings.getSettings().lndSettings.routingFeeLimitBps / 10000
|
const routingLimit = this.settings.getSettings().lndSettings.routingFeeLimitBps / 10000
|
||||||
|
|
||||||
|
|
||||||
const swap = await this.swaps.PayAddrWithSwap("admin", req.swap_operation_id, req.address, async (invoice, amt) => {
|
const swap = await this.swaps.PayAddrWithSwap("admin", req.swap_operation_id, req.address, async (invoice, amt) => {
|
||||||
const r = Math.max(Math.ceil(routingLimit * amt), routingFloor)
|
const r = Math.max(Math.ceil(routingLimit * amt), routingFloor)
|
||||||
const payment = await this.lnd.PayInvoice(invoice, 0, { routingFeeLimit: r, serviceFee: 0 }, amt, { useProvider: false, from: 'system' })
|
const payment = await this.lnd.PayInvoice(invoice, 0, { routingFeeLimit: r, serviceFee: 0 }, amt, { useProvider: false, from: 'system' })
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ export default (mainHandler: Main): Types.ServerMethods => {
|
||||||
return mainHandler.adminManager.GetAdminTransactionSwapQuote(req)
|
return mainHandler.adminManager.GetAdminTransactionSwapQuote(req)
|
||||||
},
|
},
|
||||||
PayAdminTransactionSwap: async ({ ctx, req }) => {
|
PayAdminTransactionSwap: async ({ ctx, req }) => {
|
||||||
const err = Types.TransactionSwapQuoteRequestValidate(req, {
|
const err = Types.PayAdminTransactionSwapRequestValidate(req, {
|
||||||
address_CustomCheck: addr => addr !== '',
|
address_CustomCheck: addr => addr !== '',
|
||||||
swap_operation_id_CustomCheck: id => id !== '',
|
swap_operation_id_CustomCheck: id => id !== '',
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue