@b3dotfun/sdk 0.0.70-alpha.2 → 0.0.70-alpha.3

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.
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.anyspendService = void 0;
7
7
  const constants_1 = require("../../anyspend/constants");
8
8
  const utils_1 = require("../../anyspend/utils");
9
+ const app_1 = __importDefault(require("../../global-account/app"));
9
10
  const invariant_1 = __importDefault(require("invariant"));
10
11
  // Service functions
11
12
  exports.anyspendService = {
@@ -42,12 +43,14 @@ exports.anyspendService = {
42
43
  },
43
44
  // Order related
44
45
  createOrder: async ({ recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId, clientReferenceId, visitorData, }) => {
46
+ const accessToken = await app_1.default.authentication.getAccessToken();
45
47
  const response = await fetch(`${constants_1.ANYSPEND_MAINNET_BASE_URL}/orders`, {
46
48
  method: "POST",
47
49
  headers: {
48
50
  "Content-Type": "application/json",
49
51
  ...(visitorData?.requestId && { "X-Fingerprint-Request-Id": visitorData.requestId }),
50
52
  ...(visitorData?.visitorId && { "X-Fingerprint-Visitor-Id": visitorData.visitorId }),
53
+ ...(accessToken && { Authorization: `Bearer ${accessToken}` }),
51
54
  },
52
55
  body: JSON.stringify({
53
56
  recipientAddress,
@@ -1,5 +1,6 @@
1
1
  import { ANYSPEND_MAINNET_BASE_URL } from "../../anyspend/constants/index.js";
2
2
  import { getNativeToken, isNativeToken } from "../../anyspend/utils/index.js";
3
+ import app from "../../global-account/app.js";
3
4
  import invariant from "invariant";
4
5
  // Service functions
5
6
  export const anyspendService = {
@@ -36,12 +37,14 @@ export const anyspendService = {
36
37
  },
37
38
  // Order related
38
39
  createOrder: async ({ recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId, clientReferenceId, visitorData, }) => {
40
+ const accessToken = await app.authentication.getAccessToken();
39
41
  const response = await fetch(`${ANYSPEND_MAINNET_BASE_URL}/orders`, {
40
42
  method: "POST",
41
43
  headers: {
42
44
  "Content-Type": "application/json",
43
45
  ...(visitorData?.requestId && { "X-Fingerprint-Request-Id": visitorData.requestId }),
44
46
  ...(visitorData?.visitorId && { "X-Fingerprint-Visitor-Id": visitorData.visitorId }),
47
+ ...(accessToken && { Authorization: `Bearer ${accessToken}` }),
45
48
  },
46
49
  body: JSON.stringify({
47
50
  recipientAddress,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.70-alpha.2",
3
+ "version": "0.0.70-alpha.3",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -1,6 +1,7 @@
1
1
  import { ANYSPEND_MAINNET_BASE_URL } from "@b3dotfun/sdk/anyspend/constants";
2
2
  import { OnrampOptions } from "@b3dotfun/sdk/anyspend/react";
3
3
  import { getNativeToken, isNativeToken } from "@b3dotfun/sdk/anyspend/utils";
4
+ import app from "@b3dotfun/sdk/global-account/app";
4
5
  import invariant from "invariant";
5
6
  import { components } from "../types/api";
6
7
  import {
@@ -85,12 +86,14 @@ export const anyspendService = {
85
86
  clientReferenceId?: string;
86
87
  visitorData?: VisitorData;
87
88
  }) => {
89
+ const accessToken = await app.authentication.getAccessToken();
88
90
  const response = await fetch(`${ANYSPEND_MAINNET_BASE_URL}/orders`, {
89
91
  method: "POST",
90
92
  headers: {
91
93
  "Content-Type": "application/json",
92
94
  ...(visitorData?.requestId && { "X-Fingerprint-Request-Id": visitorData.requestId }),
93
95
  ...(visitorData?.visitorId && { "X-Fingerprint-Visitor-Id": visitorData.visitorId }),
96
+ ...(accessToken && { Authorization: `Bearer ${accessToken}` }),
94
97
  },
95
98
  body: JSON.stringify({
96
99
  recipientAddress,