Skip to content
Merged
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
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
{
"name": "@polymarket/builder-signing-sdk",
"description": "Polymarket SDK for creating builder headers",
"version": "0.0.9",
"version": "1.0.0",
"contributors": [
{
"name": "Jonathan Amenechi",
"url": "https://github.com/JonathanAmenechi"
}
],
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
Expand All @@ -16,13 +23,12 @@
"license": "MIT",
"packageManager": "pnpm@10.30.3",
"scripts": {
"build": "rm -rf dist && tsc --module commonjs",
"build": "rm -rf dist && tsc",
"deploy": "npm run build && npm publish",
"test": "vitest run --coverage"
},
"dependencies": {
"axios": "^1.12.2",
"tslib": "^2.8.1"
"axios": "^1.12.2"
},
"devDependencies": {
"@types/node": "^22.19.11",
Expand Down
8 changes: 0 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { BuilderSigner } from "./signer";
import { post } from "./http-helpers";
import { BuilderSigner } from "./signer.js";
import { post } from "./http-helpers/index.js";
import {
BuilderApiKeyCreds,
BuilderHeaderPayload,
BuilderType,
RemoteBuilderConfig,
RemoteSignerPayload
} from "./types";
} from "./types.js";
import { AxiosRequestHeaders } from 'axios';

export class BuilderConfig {
Expand Down
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from "./config";
export * from "./signing";
export * from "./signer";
export * from "./types";
export * from "./config.js";
export * from "./signing/index.js";
export * from "./signer.js";
export * from "./types.js";
4 changes: 2 additions & 2 deletions src/signer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { buildHmacSignature } from "./signing";
import { BuilderApiKeyCreds, BuilderHeaderPayload } from "./types";
import { buildHmacSignature } from "./signing/index.js";
import { BuilderApiKeyCreds, BuilderHeaderPayload } from "./types.js";


export class BuilderSigner {
Expand Down
4 changes: 2 additions & 2 deletions src/signing/hmac.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import crypto from "crypto";
import { createHmac } from "node:crypto";

function replaceAll(s: string, search: string, replace: string) {
return s.split(search).join(replace);
Expand All @@ -25,7 +25,7 @@ export const buildHmacSignature = (
}

const base64Secret = Buffer.from(secret, "base64");
const hmac = crypto.createHmac("sha256", base64Secret);
const hmac = createHmac("sha256", base64Secret);
const sig = hmac.update(message).digest("base64");

// NOTE: Must be url safe base64 encoding, but keep base64 "=" suffix
Expand Down
2 changes: 1 addition & 1 deletion src/signing/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "./hmac";
export * from "./hmac.js";
4 changes: 2 additions & 2 deletions tests/config.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as httpHelpers from '../src/http-helpers';
import * as httpHelpers from '../src/http-helpers/index.js';
import { describe, it, expect, vi, afterEach } from "vitest";
import { BuilderApiKeyCreds, BuilderConfig, BuilderHeaderPayload, BuilderType } from "../src";
import { BuilderApiKeyCreds, BuilderConfig, BuilderHeaderPayload, BuilderType } from "../src/index.js";

describe("builder config", () => {
afterEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion tests/hmac.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect } from "vitest";
import { buildHmacSignature } from "../src/signing";
import { buildHmacSignature } from "../src/signing/index.js";

describe("hmac", () => {
it("buildHmacSignature", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/signer.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect } from "vitest";
import { BuilderSigner, BuilderApiKeyCreds } from "../src";
import { BuilderSigner, BuilderApiKeyCreds } from "../src/index.js";

describe("builderHeaderPayload", () => {
it("createBuilderHeaderPayload", () => {
Expand Down
10 changes: 3 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@
],
"compilerOptions": {
"baseUrl": "./",
"module": "commonjs",
"module": "nodenext",
"target": "esnext",
"outDir": "./dist",
"sourceMap": true,
"declaration": true,
"moduleResolution": "node",
"esModuleInterop": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"importHelpers": true,
"moduleResolution": "nodenext",
"strict": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
Expand All @@ -29,7 +25,7 @@
"resolveJsonModule": true,
"strictNullChecks": true,
"typeRoots": ["node_modules/@types"],
"lib": ["es2018", "dom"],
"lib": ["es2022"],
"skipLibCheck": true
}
}