mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-15 22:52:36 +03:00
feat: add new parameter to header for agg and remove unnecessary code
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.21.1",
|
||||
"version": "0.21.2-rc0",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/index.cjs",
|
||||
"module": "./lib/index.js",
|
||||
|
||||
@@ -6,7 +6,7 @@ import cancelOrderSchema from './schemas/cancelOrderSchema.js';
|
||||
import orderBenefitsSchema from './schemas/orderBenefitsSchema.js';
|
||||
import errorSchema from './schemas/errorSchema.js';
|
||||
import placeAtomicSwapSchema from './schemas/placeAtomicSwapSchema.js';
|
||||
import { AggregatorWS } from './ws/index.js';
|
||||
import { AggregatorWS } from './ws';
|
||||
import { atomicSwapHistorySchema } from './schemas/atomicSwapHistorySchema.js';
|
||||
import type { BasicAuthCredentials, OrderSource, SignedCancelOrderRequest, SignedOrder } from '../../types.js';
|
||||
import {
|
||||
@@ -209,6 +209,7 @@ class Aggregator {
|
||||
partnerId?: string,
|
||||
source?: OrderSource,
|
||||
rawExchangeRestrictions?: string | undefined,
|
||||
widgetOwner?: string,
|
||||
) => {
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -218,6 +219,7 @@ class Aggregator {
|
||||
},
|
||||
...(partnerId !== undefined) && { 'X-Partner-Id': partnerId },
|
||||
...(source !== undefined) && { 'X-Source': source },
|
||||
...(widgetOwner !== undefined) && { 'X-Widget-Owner': widgetOwner },
|
||||
...this.basicAuthHeaders,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { z } from 'zod';
|
||||
import { fetchWithValidation } from 'simple-typed-fetch';
|
||||
import {
|
||||
errorSchema,
|
||||
@@ -41,14 +40,6 @@ type SignatureType = {
|
||||
signature: string
|
||||
};
|
||||
|
||||
type submitTransactionDataForWidgetPayload = {
|
||||
partner_domain: string
|
||||
sender_address: string
|
||||
tx_hash: string
|
||||
chain_id: number
|
||||
signature: string
|
||||
}
|
||||
|
||||
class ReferralSystem {
|
||||
private readonly apiUrl: string
|
||||
|
||||
@@ -76,7 +67,6 @@ class ReferralSystem {
|
||||
this.getContractsAddresses = this.getContractsAddresses.bind(this);
|
||||
this.getClaimInfo = this.getClaimInfo.bind(this);
|
||||
this.getAggregatedHistory = this.getAggregatedHistory.bind(this);
|
||||
this.submitTransactionDataForWidget = this.submitTransactionDataForWidget.bind(this);
|
||||
}
|
||||
|
||||
getLink = (refererAddress: string) =>
|
||||
@@ -302,20 +292,6 @@ class ReferralSystem {
|
||||
errorSchema
|
||||
);
|
||||
};
|
||||
|
||||
submitTransactionDataForWidget = (payload: submitTransactionDataForWidgetPayload) => {
|
||||
return fetchWithValidation(
|
||||
`${this.apiUrl}/referer/widget/submit`,
|
||||
z.unknown(),
|
||||
{
|
||||
headers: {
|
||||
'Content-type': 'application/json',
|
||||
},
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload)
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
export * as schemas from './schemas/index.js';
|
||||
|
||||
Reference in New Issue
Block a user