@polymarket/client 0.1.0-beta.9 → 0.2.0
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.
- package/README.md +1 -1
- package/dist/actions/index.d.ts +6 -6
- package/dist/actions/index.js +1 -1
- package/dist/chunk-3GYPYD7Z.js +2 -0
- package/dist/chunk-3GYPYD7Z.js.map +1 -0
- package/dist/chunk-FA3ZDOJN.js +2 -0
- package/dist/chunk-FA3ZDOJN.js.map +1 -0
- package/dist/chunk-TYJAXA3Y.js +6 -0
- package/dist/chunk-TYJAXA3Y.js.map +1 -0
- package/dist/ethers-v5.d.ts +2 -2
- package/dist/ethers-v5.js +1 -1
- package/dist/index.d.ts +14 -6
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/node.js +1 -1
- package/dist/privy.js +1 -1
- package/dist/{sports-BGrBawu_.d.ts → sports-CYYRGlQj.d.ts} +3 -3
- package/dist/{types-M1U0um0G.d.ts → types-vvy5wT5V.d.ts} +1787 -628
- package/dist/viem.d.ts +2 -2
- package/dist/viem.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-E2CLUN5M.js +0 -6
- package/dist/chunk-E2CLUN5M.js.map +0 -1
- package/dist/chunk-FSNACMPO.js +0 -2
- package/dist/chunk-FSNACMPO.js.map +0 -1
- package/dist/chunk-NTEPEJZK.js +0 -2
- package/dist/chunk-NTEPEJZK.js.map +0 -1
package/dist/node.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {e}from'./chunk-
|
|
1
|
+
import {e}from'./chunk-3GYPYD7Z.js';import g from'process';import {invariant}from'@polymarket/types';async function u(t,e,r,i,n){let s=`${e}${r}${i}`;n!==void 0&&(s+=n);let y=await globalThis.crypto.subtle.importKey("raw",l(t),{name:"HMAC",hash:"SHA-256"},false,["sign"]),c=await globalThis.crypto.subtle.sign("HMAC",y,new TextEncoder().encode(s));return f(d(c))}function l(t){let e=t.replace(/-/g,"+").replace(/_/g,"/").replace(/[^A-Za-z0-9+/=]/g,""),r=atob(e),i=new Uint8Array(r.length);for(let n=0;n<r.length;n+=1)i[n]=r.charCodeAt(n);return i.buffer}function d(t){let e=new Uint8Array(t),r="";for(let i of e)r+=String.fromCharCode(i);return btoa(r)}function f(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}invariant(g.release.name==="node","The @polymarket/client/node entrypoint requires a Node.js runtime.");invariant(typeof window>"u"&&typeof document>"u","The @polymarket/client/node entrypoint cannot be imported in a browser-like runtime.");function K(t){return new o(t)}var o=class{#e;constructor(e){this.#e=e;}get isBuilderKey(){return true}get supportGasless(){return true}async authorize(e){return this.#r(e)}async#r(e$1){try{let r=Math.floor(Date.now()/1e3);return {POLY_BUILDER_API_KEY:this.#e.key,POLY_BUILDER_PASSPHRASE:this.#e.passphrase,POLY_BUILDER_SIGNATURE:await u(this.#e.secret,r,e$1.method,e$1.path,e$1.body),POLY_BUILDER_TIMESTAMP:`${r}`}}catch(r){throw e.fromError(r,"Could not sign the builder-authenticated request")}}};
|
|
2
2
|
export{K as builderApiKey};//# sourceMappingURL=node.js.map
|
|
3
3
|
//# sourceMappingURL=node.js.map
|
package/dist/privy.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {e as e$1,d,c,b as b$1,a}from'./chunk-
|
|
1
|
+
import {e as e$1,d,c,b as b$1,a}from'./chunk-3GYPYD7Z.js';import h from'process';import {invariant,expectEvmAddress,expectTxHash,expectEvmSignature,never}from'@polymarket/types';import {Hex}from'ox';import {createPublicClient,http,WaitForTransactionReceiptTimeoutError}from'viem';import {waitForTransactionReceipt}from'viem/actions';import*as E from'viem/chains';invariant(h.release.name==="node","The @polymarket/client/privy entrypoint requires a Node.js runtime.");invariant(typeof window>"u"&&typeof document>"u","The @polymarket/client/privy entrypoint cannot be imported in a browser-like runtime.");var P=Object.values(E);function D(r){return {getAddress(){return b(r)},signTypedData(t){return A(r,t)},signMessage(t){return H(r,t)},async sendTransaction(t){return new o(await I(r,t),t.chainId)}}}async function b(r){try{let t=await r.privy.wallets().get(r.walletId);return expectEvmAddress(t.address)}catch(t){throw e$1.fromError(t,"Could not resolve signer address")}}async function I(r,t){try{let n=await r.privy.wallets().ethereum().sendTransaction(r.walletId,{authorization_context:r.authorizationContext,caip2:`eip155:${t.chainId}`,params:{transaction:{chain_id:t.chainId,data:t.data,to:t.to,value:t.value?.toString()}}});return expectTxHash(n.hash)}catch(n){s(n);}}async function A(r,t){try{let n=await r.privy.wallets().ethereum().signTypedData(r.walletId,{authorization_context:r.authorizationContext,params:{typed_data:{domain:e(t.domain),message:e(t.message),primary_type:t.primaryType,types:t.types}}});return expectEvmSignature(n.signature)}catch(n){s(n);}}async function H(r,t){try{let n=await r.privy.wallets().ethereum().signMessage(r.walletId,{authorization_context:r.authorizationContext,message:Hex.toBytes(t)});return expectEvmSignature(n.signature)}catch(n){s(n);}}function e(r){return typeof r=="bigint"?`${r}`:Array.isArray(r)?r.map(t=>e(t)):typeof r=="object"&&r!==null?Object.fromEntries(Object.entries(r).flatMap(([t,n])=>n===void 0?[]:[[t,e(n)]])):r}function s(r){throw i(r)?new d("User rejected the signing request",{cause:r}):e$1.fromError(r)}function i(r,t=new Set){if(t.has(r)||r===null||typeof r!="object")return false;t.add(r);let n=r;return n.code===4001||n.code==="ACTION_REJECTED"||n.name==="APIUserAbortError"||i(n.error,t)||i(n.cause,t)}var o=class{transactionId=null;#r;#t;constructor(t,n){this.#r=n,this.#t=t;}get transactionHash(){return this.#t}async wait(){try{let t=await waitForTransactionReceipt(createPublicClient({chain:S(this.#r),transport:http()}),{hash:this.#t}),n=expectTxHash(t.transactionHash);if(this.#t=n,t.status==="reverted")throw new c(`Transaction ${n} reverted`);return {transactionHash:n,transactionId:null}}catch(t){throw t instanceof WaitForTransactionReceiptTimeoutError?new b$1(`Timed out waiting for transaction ${this.#t} to settle`,{cause:t}):a.fromError(t)}}};function S(r){let t=P.find(n=>n.id===r);if(t!==void 0)return t;never(`Unsupported chain ID for direct Privy transaction wait: ${r}`);}export{D as signerFrom};//# sourceMappingURL=privy.js.map
|
|
2
2
|
//# sourceMappingURL=privy.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OrderResponse } from '@polymarket/bindings/clob';
|
|
2
|
-
import {
|
|
2
|
+
import { bM as RateLimitError, bO as RequestRejectedError, cx as SigningError, cE as TransportError, cH as UnexpectedResponseError, U as UserInputError, ax as InsufficientLiquidityError, h as BaseSecureClient, f9 as PrepareLimitOrderRequest, eO as OrderWorkflow, eN as OrderPostingWorkflow, fb as PrepareMarketOrderRequest, p as CancelledSigningError, bC as PostOrderError, cz as TimeoutError, cA as TransactionFailedError, fN as SignedOrder, B as BaseClient } from './types-vvy5wT5V.js';
|
|
3
3
|
import { SportsMarketTypesResponse, SportsMetadata } from '@polymarket/bindings/gamma';
|
|
4
4
|
|
|
5
5
|
type PrepareMarketOrderError = InsufficientLiquidityError | RateLimitError | RequestRejectedError | SigningError | TransportError | UnexpectedResponseError | UserInputError;
|
|
@@ -159,7 +159,7 @@ declare const CreateLimitOrderError: {
|
|
|
159
159
|
* @remarks
|
|
160
160
|
* This is a low-level function. Most SDK consumers should prefer the client instance API.
|
|
161
161
|
*
|
|
162
|
-
* GTD expirations must be at least
|
|
162
|
+
* GTD expirations must be at least 3 minutes in the future. Add your own
|
|
163
163
|
* buffer for network latency and clock skew when deriving an expiration from
|
|
164
164
|
* the current time.
|
|
165
165
|
*
|
|
@@ -177,7 +177,7 @@ declare const PlaceLimitOrderError: {
|
|
|
177
177
|
* @remarks
|
|
178
178
|
* This is a low-level function. Most SDK consumers should prefer the client instance API.
|
|
179
179
|
*
|
|
180
|
-
* GTD expirations must be at least
|
|
180
|
+
* GTD expirations must be at least 3 minutes in the future. Add your own
|
|
181
181
|
* buffer for network latency and clock skew when deriving an expiration from
|
|
182
182
|
* the current time.
|
|
183
183
|
*
|