mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-25 07:07:39 +03:00
feature: updated placeOrder and added submitTransactionDataForWidget methods
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.19.58-rc4",
|
||||
"version": "0.19.58-rc5",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/index.cjs",
|
||||
"module": "./lib/index.js",
|
||||
|
||||
@@ -196,6 +196,7 @@ class Aggregator {
|
||||
isCreateInternalOrder: boolean,
|
||||
isReversedOrder?: boolean,
|
||||
partnerId?: string,
|
||||
fromWidget?: boolean,
|
||||
) => {
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -204,6 +205,7 @@ class Aggregator {
|
||||
'X-Reverse-Order': isReversedOrder ? 'true' : 'false',
|
||||
},
|
||||
...(partnerId !== undefined) && { 'X-Partner-Id': partnerId },
|
||||
...(fromWidget !== undefined) && { 'X-From-Widget': fromWidget ? 'true' : 'false' },
|
||||
...this.basicAuthHeaders,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { z } from 'zod';
|
||||
import { fetchWithValidation } from 'simple-typed-fetch';
|
||||
import {
|
||||
errorSchema,
|
||||
@@ -39,6 +40,12 @@ type SignatureType = {
|
||||
signature: string
|
||||
};
|
||||
|
||||
type submitTransactionDataForWidgetPayload = {
|
||||
partner_domain: string
|
||||
sender_address: string
|
||||
tx_hash: string
|
||||
}
|
||||
|
||||
class ReferralSystem {
|
||||
private readonly apiUrl: string
|
||||
|
||||
@@ -65,6 +72,7 @@ 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) =>
|
||||
@@ -264,6 +272,20 @@ 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