@polymarket/clob-client-v2 1.0.1 → 1.0.3-canary.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/dist/index.cjs +123 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +124 -61
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -191,6 +191,7 @@ interface OrderBookSummary {
|
|
|
191
191
|
tick_size: string;
|
|
192
192
|
neg_risk: boolean;
|
|
193
193
|
hash: string;
|
|
194
|
+
last_trade_price: string;
|
|
194
195
|
}
|
|
195
196
|
interface OrderSummary {
|
|
196
197
|
price: string;
|
|
@@ -867,6 +868,8 @@ declare class ClobClient {
|
|
|
867
868
|
private readonly tokenConditionMap;
|
|
868
869
|
readonly useServerTime?: boolean;
|
|
869
870
|
readonly builderConfig?: BuilderConfig;
|
|
871
|
+
readonly signatureType: SignatureTypeV2;
|
|
872
|
+
readonly funderAddress?: string;
|
|
870
873
|
private cachedVersion?;
|
|
871
874
|
readonly retryOnError?: boolean;
|
|
872
875
|
readonly throwOnError?: boolean;
|
|
@@ -994,7 +997,7 @@ declare class ApiError extends Error {
|
|
|
994
997
|
constructor(message: string, status?: number, data?: unknown);
|
|
995
998
|
}
|
|
996
999
|
|
|
997
|
-
declare const createL1Headers: (signer: ClobSigner, chainId: Chain, nonce?: number, timestamp?: number) => Promise<L1PolyHeader>;
|
|
1000
|
+
declare const createL1Headers: (signer: ClobSigner, chainId: Chain, nonce?: number, timestamp?: number, address?: string) => Promise<L1PolyHeader>;
|
|
998
1001
|
declare const createL2Headers: (signer: ClobSigner, creds: ApiKeyCreds, l2HeaderArgs: L2HeaderArgs, timestamp?: number) => Promise<L2PolyHeader>;
|
|
999
1002
|
|
|
1000
1003
|
export { ApiError, type ApiKeyCreds, type ApiKeyRaw, type ApiKeysResponse, AssetType, type BalanceAllowanceParams, type BalanceAllowanceResponse, type BanStatus, type BookParams, type BuilderApiKey, type BuilderApiKeyResponse, type BuilderConfig, type BuilderFeeRates, type BuilderTrade, type BuilderTradeParams, type BuilderTradesResponse, COLLATERAL_TOKEN_DECIMALS, CONDITIONAL_TOKEN_DECIMALS, Chain, ClobClient, type ClobClientOptions, type ClobErrorResponseBody, type ClobToken, type ContractConfig, type CreateOrderOptions, type DropNotificationParams, type Earning, type FeeDetails, type FeeInfo, type FeeInfos, type FeeRates, type L1PolyHeader, L1_AUTH_UNAVAILABLE_ERROR, type L2HeaderArgs, type L2PolyHeader, L2_AUTH_NOT_AVAILABLE, type MakerOrder, type MarketDetails, type MarketPrice, type MarketReward, type MarketTradeEvent, type NegRisk, type NewOrderV1, type NewOrderV2, type Notification, type OpenOrder, type OpenOrderParams, type OpenOrdersResponse, type OrderBookSummary, OrderBuilder, type OrderMarketCancelParams, type OrderPayload, type OrderResponse, type OrderScoring, type OrderScoringParams, type OrderSummary, OrderType, type OrdersScoring, type OrdersScoringParams, type PaginationPayload, type PostOrdersArgs, type PostOrdersV1Args, type PostOrdersV2Args, type PreMigrationOrder, type PreMigrationOrdersResponse, type PriceHistoryFilterParams, PriceHistoryInterval, type ReadonlyApiKeyResponse, type RewardsConfig, type RewardsPercentages, type RoundConfig, Side, SignatureTypeV1, SignatureTypeV2, type SignedOrder, type SimpleHeaders, type TickSize, type TickSizes, type Token, type TokenConditionMap, type TotalUserEarning, type Trade, type TradeParams, type TradesPaginatedResponse, type UserEarning, type UserMarketOrderV1, type UserMarketOrderV2, type UserOrderV1, type UserOrderV2, type UserRewardsEarning, type VersionedPostOrdersArgs, type VersionedSignedOrder, type VersionedUserMarketOrder, type VersionedUserOrder, adjustBuyAmountForFees, createL1Headers, createL2Headers, getContractConfig, isV2Order, orderToJsonV1, orderToJsonV2 };
|
package/dist/index.d.ts
CHANGED
|
@@ -191,6 +191,7 @@ interface OrderBookSummary {
|
|
|
191
191
|
tick_size: string;
|
|
192
192
|
neg_risk: boolean;
|
|
193
193
|
hash: string;
|
|
194
|
+
last_trade_price: string;
|
|
194
195
|
}
|
|
195
196
|
interface OrderSummary {
|
|
196
197
|
price: string;
|
|
@@ -867,6 +868,8 @@ declare class ClobClient {
|
|
|
867
868
|
private readonly tokenConditionMap;
|
|
868
869
|
readonly useServerTime?: boolean;
|
|
869
870
|
readonly builderConfig?: BuilderConfig;
|
|
871
|
+
readonly signatureType: SignatureTypeV2;
|
|
872
|
+
readonly funderAddress?: string;
|
|
870
873
|
private cachedVersion?;
|
|
871
874
|
readonly retryOnError?: boolean;
|
|
872
875
|
readonly throwOnError?: boolean;
|
|
@@ -994,7 +997,7 @@ declare class ApiError extends Error {
|
|
|
994
997
|
constructor(message: string, status?: number, data?: unknown);
|
|
995
998
|
}
|
|
996
999
|
|
|
997
|
-
declare const createL1Headers: (signer: ClobSigner, chainId: Chain, nonce?: number, timestamp?: number) => Promise<L1PolyHeader>;
|
|
1000
|
+
declare const createL1Headers: (signer: ClobSigner, chainId: Chain, nonce?: number, timestamp?: number, address?: string) => Promise<L1PolyHeader>;
|
|
998
1001
|
declare const createL2Headers: (signer: ClobSigner, creds: ApiKeyCreds, l2HeaderArgs: L2HeaderArgs, timestamp?: number) => Promise<L2PolyHeader>;
|
|
999
1002
|
|
|
1000
1003
|
export { ApiError, type ApiKeyCreds, type ApiKeyRaw, type ApiKeysResponse, AssetType, type BalanceAllowanceParams, type BalanceAllowanceResponse, type BanStatus, type BookParams, type BuilderApiKey, type BuilderApiKeyResponse, type BuilderConfig, type BuilderFeeRates, type BuilderTrade, type BuilderTradeParams, type BuilderTradesResponse, COLLATERAL_TOKEN_DECIMALS, CONDITIONAL_TOKEN_DECIMALS, Chain, ClobClient, type ClobClientOptions, type ClobErrorResponseBody, type ClobToken, type ContractConfig, type CreateOrderOptions, type DropNotificationParams, type Earning, type FeeDetails, type FeeInfo, type FeeInfos, type FeeRates, type L1PolyHeader, L1_AUTH_UNAVAILABLE_ERROR, type L2HeaderArgs, type L2PolyHeader, L2_AUTH_NOT_AVAILABLE, type MakerOrder, type MarketDetails, type MarketPrice, type MarketReward, type MarketTradeEvent, type NegRisk, type NewOrderV1, type NewOrderV2, type Notification, type OpenOrder, type OpenOrderParams, type OpenOrdersResponse, type OrderBookSummary, OrderBuilder, type OrderMarketCancelParams, type OrderPayload, type OrderResponse, type OrderScoring, type OrderScoringParams, type OrderSummary, OrderType, type OrdersScoring, type OrdersScoringParams, type PaginationPayload, type PostOrdersArgs, type PostOrdersV1Args, type PostOrdersV2Args, type PreMigrationOrder, type PreMigrationOrdersResponse, type PriceHistoryFilterParams, PriceHistoryInterval, type ReadonlyApiKeyResponse, type RewardsConfig, type RewardsPercentages, type RoundConfig, Side, SignatureTypeV1, SignatureTypeV2, type SignedOrder, type SimpleHeaders, type TickSize, type TickSizes, type Token, type TokenConditionMap, type TotalUserEarning, type Trade, type TradeParams, type TradesPaginatedResponse, type UserEarning, type UserMarketOrderV1, type UserMarketOrderV2, type UserOrderV1, type UserOrderV2, type UserRewardsEarning, type VersionedPostOrdersArgs, type VersionedSignedOrder, type VersionedUserMarketOrder, type VersionedUserOrder, adjustBuyAmountForFees, createL1Headers, createL2Headers, getContractConfig, isV2Order, orderToJsonV1, orderToJsonV2 };
|
package/dist/index.js
CHANGED
|
@@ -146,8 +146,8 @@ var signTypedDataWithSigner = async ({
|
|
|
146
146
|
};
|
|
147
147
|
|
|
148
148
|
// src/signing/eip712.ts
|
|
149
|
-
var buildClobEip712Signature = async (signer, chainId, timestamp, nonce) => {
|
|
150
|
-
const
|
|
149
|
+
var buildClobEip712Signature = async (signer, chainId, timestamp, nonce, address) => {
|
|
150
|
+
const resolvedAddress = address ?? await getSignerAddress(signer);
|
|
151
151
|
const ts = timestamp.toString();
|
|
152
152
|
const domain = {
|
|
153
153
|
name: "ClobAuthDomain",
|
|
@@ -163,7 +163,7 @@ var buildClobEip712Signature = async (signer, chainId, timestamp, nonce) => {
|
|
|
163
163
|
]
|
|
164
164
|
};
|
|
165
165
|
const value = {
|
|
166
|
-
address,
|
|
166
|
+
address: resolvedAddress,
|
|
167
167
|
timestamp: ts,
|
|
168
168
|
nonce,
|
|
169
169
|
message: MSG_TO_SIGN
|
|
@@ -196,7 +196,7 @@ var buildPolyHmacSignature = (secret, timestamp, method, requestPath, body) => {
|
|
|
196
196
|
};
|
|
197
197
|
|
|
198
198
|
// src/headers/index.ts
|
|
199
|
-
var createL1Headers = async (signer, chainId, nonce, timestamp) => {
|
|
199
|
+
var createL1Headers = async (signer, chainId, nonce, timestamp, address) => {
|
|
200
200
|
let ts = Math.floor(Date.now() / 1e3);
|
|
201
201
|
if (timestamp !== void 0) {
|
|
202
202
|
ts = timestamp;
|
|
@@ -205,10 +205,10 @@ var createL1Headers = async (signer, chainId, nonce, timestamp) => {
|
|
|
205
205
|
if (nonce !== void 0) {
|
|
206
206
|
n = nonce;
|
|
207
207
|
}
|
|
208
|
-
const sig = await buildClobEip712Signature(signer, chainId, ts, n);
|
|
209
|
-
const
|
|
208
|
+
const sig = await buildClobEip712Signature(signer, chainId, ts, n, address);
|
|
209
|
+
const resolvedAddress = address ?? await getSignerAddress(signer);
|
|
210
210
|
const headers = {
|
|
211
|
-
POLY_ADDRESS:
|
|
211
|
+
POLY_ADDRESS: resolvedAddress,
|
|
212
212
|
POLY_SIGNATURE: sig,
|
|
213
213
|
POLY_TIMESTAMP: `${ts}`,
|
|
214
214
|
POLY_NONCE: `${n}`
|
|
@@ -634,7 +634,7 @@ var ExchangeOrderBuilderV1 = class {
|
|
|
634
634
|
};
|
|
635
635
|
|
|
636
636
|
// src/order-utils/exchangeOrderBuilderV2.ts
|
|
637
|
-
import { hashTypedData as hashTypedData2 } from "viem";
|
|
637
|
+
import { encodeAbiParameters, hashTypedData as hashTypedData2, keccak256, toHex } from "viem";
|
|
638
638
|
|
|
639
639
|
// src/order-utils/model/ctfExchangeV2TypedData.ts
|
|
640
640
|
var CTF_EXCHANGE_V2_DOMAIN_NAME = "Polymarket CTF Exchange";
|
|
@@ -663,22 +663,51 @@ var SignatureTypeV2 = /* @__PURE__ */ ((SignatureTypeV22) => {
|
|
|
663
663
|
})(SignatureTypeV2 || {});
|
|
664
664
|
|
|
665
665
|
// src/order-utils/exchangeOrderBuilderV2.ts
|
|
666
|
+
var ORDER_TYPE_STRING = "Order(uint256 salt,address maker,address signer,uint256 tokenId,uint256 makerAmount,uint256 takerAmount,uint8 side,uint8 signatureType,uint256 timestamp,bytes32 metadata,bytes32 builder)";
|
|
667
|
+
var ORDER_TYPE_HASH = keccak256(toHex(ORDER_TYPE_STRING));
|
|
668
|
+
var DOMAIN_TYPE_HASH = keccak256(
|
|
669
|
+
toHex("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")
|
|
670
|
+
);
|
|
671
|
+
var TYPED_DATA_SIGN_STRUCT = [
|
|
672
|
+
{ name: "contents", type: "Order" },
|
|
673
|
+
{ name: "name", type: "string" },
|
|
674
|
+
{ name: "version", type: "string" },
|
|
675
|
+
{ name: "chainId", type: "uint256" },
|
|
676
|
+
{ name: "verifyingContract", type: "address" },
|
|
677
|
+
{ name: "salt", type: "bytes32" }
|
|
678
|
+
];
|
|
679
|
+
var CTF_EXCHANGE_NAME_HASH = keccak256(toHex(CTF_EXCHANGE_V2_DOMAIN_NAME));
|
|
680
|
+
var CTF_EXCHANGE_VERSION_HASH = keccak256(toHex(CTF_EXCHANGE_V2_DOMAIN_VERSION));
|
|
666
681
|
var ExchangeOrderBuilderV2 = class {
|
|
667
682
|
constructor(contractAddress, chainId, signer, generateSalt = generateOrderSalt) {
|
|
668
683
|
this.contractAddress = contractAddress;
|
|
669
684
|
this.chainId = chainId;
|
|
670
685
|
this.signer = signer;
|
|
671
686
|
this.generateSalt = generateSalt;
|
|
687
|
+
this.appDomainSep = keccak256(
|
|
688
|
+
encodeAbiParameters(
|
|
689
|
+
[
|
|
690
|
+
{ type: "bytes32" },
|
|
691
|
+
{ type: "bytes32" },
|
|
692
|
+
{ type: "bytes32" },
|
|
693
|
+
{ type: "uint256" },
|
|
694
|
+
{ type: "address" }
|
|
695
|
+
],
|
|
696
|
+
[
|
|
697
|
+
DOMAIN_TYPE_HASH,
|
|
698
|
+
CTF_EXCHANGE_NAME_HASH,
|
|
699
|
+
CTF_EXCHANGE_VERSION_HASH,
|
|
700
|
+
BigInt(chainId),
|
|
701
|
+
contractAddress
|
|
702
|
+
]
|
|
703
|
+
)
|
|
704
|
+
);
|
|
672
705
|
}
|
|
673
706
|
contractAddress;
|
|
674
707
|
chainId;
|
|
675
708
|
signer;
|
|
676
709
|
generateSalt;
|
|
677
|
-
|
|
678
|
-
* build an order object including the signature.
|
|
679
|
-
* @param orderData
|
|
680
|
-
* @returns a SignedOrder object (order + signature)
|
|
681
|
-
*/
|
|
710
|
+
appDomainSep;
|
|
682
711
|
async buildSignedOrder(orderData) {
|
|
683
712
|
const order = await this.buildOrder(orderData);
|
|
684
713
|
const orderTypedData = this.buildOrderTypedData(order);
|
|
@@ -688,11 +717,6 @@ var ExchangeOrderBuilderV2 = class {
|
|
|
688
717
|
signature: orderSignature
|
|
689
718
|
};
|
|
690
719
|
}
|
|
691
|
-
/**
|
|
692
|
-
* Creates an Order object from order data.
|
|
693
|
-
* @param OrderData
|
|
694
|
-
* @returns a Order object (not signed)
|
|
695
|
-
*/
|
|
696
720
|
async buildOrder({
|
|
697
721
|
maker,
|
|
698
722
|
tokenId,
|
|
@@ -709,9 +733,11 @@ var ExchangeOrderBuilderV2 = class {
|
|
|
709
733
|
if (!signer) {
|
|
710
734
|
signer = maker;
|
|
711
735
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
736
|
+
if (signatureType !== 3 /* POLY_1271 */) {
|
|
737
|
+
const signerAddress = await getSignerAddress(this.signer);
|
|
738
|
+
if (signer !== signerAddress) {
|
|
739
|
+
throw new Error("signer does not match");
|
|
740
|
+
}
|
|
715
741
|
}
|
|
716
742
|
return {
|
|
717
743
|
salt: this.generateSalt(),
|
|
@@ -728,11 +754,6 @@ var ExchangeOrderBuilderV2 = class {
|
|
|
728
754
|
expiration: expiration ?? "0"
|
|
729
755
|
};
|
|
730
756
|
}
|
|
731
|
-
/**
|
|
732
|
-
* Parses an Order object to EIP712 typed data
|
|
733
|
-
* @param order
|
|
734
|
-
* @returns a EIP712TypedData object
|
|
735
|
-
*/
|
|
736
757
|
buildOrderTypedData(order) {
|
|
737
758
|
return {
|
|
738
759
|
primaryType: "Order",
|
|
@@ -761,29 +782,78 @@ var ExchangeOrderBuilderV2 = class {
|
|
|
761
782
|
}
|
|
762
783
|
};
|
|
763
784
|
}
|
|
764
|
-
|
|
765
|
-
* Generates order's signature from a EIP712TypedData object + the signer address
|
|
766
|
-
* @param typedData
|
|
767
|
-
* @returns a OrderSignature that is an string
|
|
768
|
-
*/
|
|
769
|
-
buildOrderSignature(typedData) {
|
|
785
|
+
async buildOrderSignature(typedData) {
|
|
770
786
|
delete typedData.types.EIP712Domain;
|
|
771
|
-
|
|
787
|
+
const msg = typedData.message;
|
|
788
|
+
if (msg.signatureType !== 3 /* POLY_1271 */) {
|
|
789
|
+
return signTypedDataWithSigner({
|
|
790
|
+
signer: this.signer,
|
|
791
|
+
domain: typedData.domain,
|
|
792
|
+
types: typedData.types,
|
|
793
|
+
value: typedData.message,
|
|
794
|
+
primaryType: typedData.primaryType
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
const contentsHash = keccak256(
|
|
798
|
+
encodeAbiParameters(
|
|
799
|
+
[
|
|
800
|
+
{ type: "bytes32" },
|
|
801
|
+
{ type: "uint256" },
|
|
802
|
+
{ type: "address" },
|
|
803
|
+
{ type: "address" },
|
|
804
|
+
{ type: "uint256" },
|
|
805
|
+
{ type: "uint256" },
|
|
806
|
+
{ type: "uint256" },
|
|
807
|
+
{ type: "uint8" },
|
|
808
|
+
{ type: "uint8" },
|
|
809
|
+
{ type: "uint256" },
|
|
810
|
+
{ type: "bytes32" },
|
|
811
|
+
{ type: "bytes32" }
|
|
812
|
+
],
|
|
813
|
+
[
|
|
814
|
+
ORDER_TYPE_HASH,
|
|
815
|
+
BigInt(msg.salt),
|
|
816
|
+
msg.maker,
|
|
817
|
+
msg.signer,
|
|
818
|
+
BigInt(msg.tokenId),
|
|
819
|
+
BigInt(msg.makerAmount),
|
|
820
|
+
BigInt(msg.takerAmount),
|
|
821
|
+
msg.side,
|
|
822
|
+
msg.signatureType,
|
|
823
|
+
BigInt(msg.timestamp),
|
|
824
|
+
msg.metadata,
|
|
825
|
+
msg.builder
|
|
826
|
+
]
|
|
827
|
+
)
|
|
828
|
+
);
|
|
829
|
+
const innerSig = await signTypedDataWithSigner({
|
|
772
830
|
signer: this.signer,
|
|
773
|
-
domain:
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
831
|
+
domain: {
|
|
832
|
+
name: CTF_EXCHANGE_V2_DOMAIN_NAME,
|
|
833
|
+
version: CTF_EXCHANGE_V2_DOMAIN_VERSION,
|
|
834
|
+
chainId: this.chainId,
|
|
835
|
+
verifyingContract: this.contractAddress
|
|
836
|
+
},
|
|
837
|
+
types: {
|
|
838
|
+
TypedDataSign: TYPED_DATA_SIGN_STRUCT,
|
|
839
|
+
Order: CTF_EXCHANGE_V2_ORDER_STRUCT
|
|
840
|
+
},
|
|
841
|
+
primaryType: "TypedDataSign",
|
|
842
|
+
value: {
|
|
843
|
+
contents: typedData.message,
|
|
844
|
+
name: "DepositWallet",
|
|
845
|
+
version: "1",
|
|
846
|
+
chainId: this.chainId,
|
|
847
|
+
verifyingContract: msg.signer,
|
|
848
|
+
salt: bytes32Zero
|
|
849
|
+
}
|
|
777
850
|
});
|
|
851
|
+
const ctLen = ORDER_TYPE_STRING.length;
|
|
852
|
+
const lenHex = ctLen.toString(16).padStart(4, "0");
|
|
853
|
+
return `0x${innerSig.slice(2)}${this.appDomainSep.slice(2)}${contentsHash.slice(2)}${toHex(ORDER_TYPE_STRING).slice(2)}${lenHex}`;
|
|
778
854
|
}
|
|
779
|
-
/**
|
|
780
|
-
* Generates the hash of the order from a EIP712TypedData object.
|
|
781
|
-
* @param orderTypedData
|
|
782
|
-
* @returns a OrderHash that is an string
|
|
783
|
-
*/
|
|
784
855
|
buildOrderHash(orderTypedData) {
|
|
785
|
-
|
|
786
|
-
return digest;
|
|
856
|
+
return hashTypedData2(orderTypedData);
|
|
787
857
|
}
|
|
788
858
|
};
|
|
789
859
|
|
|
@@ -1087,9 +1157,10 @@ var ROUNDING_CONFIG = {
|
|
|
1087
1157
|
var createMarketOrder = async (eoaSigner, chainId, signatureType, funderAddress, userMarketOrder, options, version) => {
|
|
1088
1158
|
const eoaSignerAddress = await getSignerAddress(eoaSigner);
|
|
1089
1159
|
const maker = funderAddress === void 0 ? eoaSignerAddress : funderAddress;
|
|
1160
|
+
const signerForOrder = signatureType === 3 /* POLY_1271 */ ? maker : eoaSignerAddress;
|
|
1090
1161
|
const contractConfig = getContractConfig(chainId);
|
|
1091
1162
|
const orderData = await buildMarketOrderCreationArgs(
|
|
1092
|
-
|
|
1163
|
+
signerForOrder,
|
|
1093
1164
|
maker,
|
|
1094
1165
|
signatureType,
|
|
1095
1166
|
userMarketOrder,
|
|
@@ -1117,9 +1188,10 @@ var createMarketOrder = async (eoaSigner, chainId, signatureType, funderAddress,
|
|
|
1117
1188
|
var createOrder = async (eoaSigner, chainId, signatureType, funderAddress, userOrder, options, version) => {
|
|
1118
1189
|
const eoaSignerAddress = await getSignerAddress(eoaSigner);
|
|
1119
1190
|
const maker = funderAddress === void 0 ? eoaSignerAddress : funderAddress;
|
|
1191
|
+
const signerForOrder = signatureType === 3 /* POLY_1271 */ ? maker : eoaSignerAddress;
|
|
1120
1192
|
const contractConfig = getContractConfig(chainId);
|
|
1121
1193
|
const orderData = await buildOrderCreationArgs(
|
|
1122
|
-
|
|
1194
|
+
signerForOrder,
|
|
1123
1195
|
maker,
|
|
1124
1196
|
signatureType,
|
|
1125
1197
|
userOrder,
|
|
@@ -1270,6 +1342,8 @@ var ClobClient = class {
|
|
|
1270
1342
|
tokenConditionMap;
|
|
1271
1343
|
useServerTime;
|
|
1272
1344
|
builderConfig;
|
|
1345
|
+
signatureType;
|
|
1346
|
+
funderAddress;
|
|
1273
1347
|
cachedVersion;
|
|
1274
1348
|
retryOnError;
|
|
1275
1349
|
throwOnError;
|
|
@@ -1301,6 +1375,8 @@ var ClobClient = class {
|
|
|
1301
1375
|
funderAddress,
|
|
1302
1376
|
getSigner
|
|
1303
1377
|
);
|
|
1378
|
+
this.signatureType = signatureType ?? 0 /* EOA */;
|
|
1379
|
+
this.funderAddress = funderAddress;
|
|
1304
1380
|
this.tickSizes = {};
|
|
1305
1381
|
this.negRisk = {};
|
|
1306
1382
|
this.feeRates = {};
|
|
@@ -1712,24 +1788,11 @@ var ClobClient = class {
|
|
|
1712
1788
|
if (!params.builder_code || params.builder_code === bytes32Zero) {
|
|
1713
1789
|
throw new Error("builderCode is required and cannot be zero");
|
|
1714
1790
|
}
|
|
1715
|
-
|
|
1716
|
-
const endpoint = GET_BUILDER_TRADES;
|
|
1717
|
-
const headerArgs = {
|
|
1718
|
-
method: GET,
|
|
1719
|
-
requestPath: endpoint
|
|
1720
|
-
};
|
|
1721
|
-
const headers = await createL2Headers(
|
|
1722
|
-
this.signer,
|
|
1723
|
-
this.creds,
|
|
1724
|
-
headerArgs,
|
|
1725
|
-
this.useServerTime ? await this.getServerTime() : void 0
|
|
1726
|
-
);
|
|
1727
|
-
next_cursor = next_cursor || INITIAL_CURSOR;
|
|
1728
|
-
const _params = { ...params, next_cursor };
|
|
1791
|
+
const _params = { ...params, next_cursor: next_cursor || INITIAL_CURSOR };
|
|
1729
1792
|
const {
|
|
1730
1793
|
data,
|
|
1731
1794
|
...rest
|
|
1732
|
-
} = await this.get(`${this.host}${
|
|
1795
|
+
} = await this.get(`${this.host}${GET_BUILDER_TRADES}`, { params: _params });
|
|
1733
1796
|
return { trades: Array.isArray(data) ? [...data] : [], ...rest };
|
|
1734
1797
|
}
|
|
1735
1798
|
async getNotifications() {
|