Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/hot-apricots-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@mysten/mvr-static': patch
'@mysten/sui': patch
---

Adds headers to mvr api calls
8 changes: 6 additions & 2 deletions packages/mvr-static/src/parsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ const MAX_BATCH_SIZE = 25; // files to process per batch.
const MAINNET_API_URL = 'https://mainnet.mvr.mystenlabs.com';
const TESTNET_API_URL = 'https://testnet.mvr.mystenlabs.com';

const MVR_API_HEADER = {
'Mvr-Source': 'ts-static-plugin',
};

const WARNING_MESSAGE = `/**
* This file is automatically generated by the mvr SDK.
* You can edit this file, but it will be overwritten on the next run.
Expand Down Expand Up @@ -158,7 +162,7 @@ async function resolvePackages(packages: string[], apiUrl: string) {
batches.map(async (batch) => {
const response = await fetch(`${apiUrl}/v1/resolution/bulk`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
headers: { 'Content-Type': 'application/json', ...MVR_API_HEADER },
body: JSON.stringify({
names: batch,
}),
Expand Down Expand Up @@ -199,7 +203,7 @@ async function resolveTypes(types: string[], apiUrl: string) {
batches.map(async (batch) => {
const response = await fetch(`${apiUrl}/v1/struct-definition/bulk`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
headers: { 'Content-Type': 'application/json', ...MVR_API_HEADER },
body: JSON.stringify({
types: batch,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import {
replaceNames,
} from './utils.js';

const MVR_API_HEADER = {
'Mvr-Source': 'ts-sdk-plugin',
};

export type NamedPackagesPluginOptions = {
/**
* The URL of the MVR API to use for resolving names.
Expand Down Expand Up @@ -118,7 +122,7 @@ export const namedPackagesPlugin = ({
batches.map(async (batch) => {
const response = await fetch(`${apiUrl}/v1/resolution/bulk`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
headers: { 'Content-Type': 'application/json', ...MVR_API_HEADER },
body: JSON.stringify({
names: batch,
}),
Expand Down Expand Up @@ -156,7 +160,7 @@ export const namedPackagesPlugin = ({
batches.map(async (batch) => {
const response = await fetch(`${apiUrl}/v1/struct-definition/bulk`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
headers: { 'Content-Type': 'application/json', ...MVR_API_HEADER },
body: JSON.stringify({
types: batch,
}),
Expand Down
Loading