ipfs-http-client
Version:
A client library for the IPFS HTTP API
20 lines • 517 B
JavaScript
import { toUrlSearchParams } from '../../../lib/to-url-search-params.js';
import { encodeEndpoint } from './utils.js';
export function createAdd(client) {
async function add(name, options) {
const {endpoint, key, headers, timeout, signal} = options;
await client.post('pin/remote/service/add', {
timeout,
signal,
searchParams: toUrlSearchParams({
arg: [
name,
encodeEndpoint(endpoint),
key
]
}),
headers
});
}
return add;
}