@evedex/exchange-crypto 1.0.17 → 1.0.19

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.
@@ -1,6 +1,6 @@
1
1
  import Big from "big.js";
2
2
  import { SignedPayload, WalletClient, NetworkChain } from "./utils/crypto";
3
- import { CreateBaseOrder, LimitOrder, MarketOrder, PositionCloseOrder, ReplaceBaseOrder, ReplaceLimitOrder, ReplaceStopLimitOrder, StopLimitOrder, TpSl } from "./utils/exchange";
3
+ import { CreateBaseOrder, LimitOrder, MarketOrder, PositionCloseOrder, ReplaceBaseOrder, ReplaceLimitOrder, ReplaceStopLimitOrder, StopLimitOrder, TpSl, type OauthConsent } from "./utils/exchange";
4
4
  export * as utils from "./utils";
5
5
  export interface AuthMessage {
6
6
  nonce: string;
@@ -73,6 +73,9 @@ export interface NormalizeTradingBalanceWithdraw extends Pick<TradingBalanceWith
73
73
  export interface SignedTradingBalanceWithdraw extends NormalizeTradingBalanceWithdraw {
74
74
  signature: string;
75
75
  }
76
+ export interface SignedOauthConsentRequest extends OauthConsent {
77
+ signature: string;
78
+ }
76
79
  export declare function signTradingBalanceWithdraw(signer: WalletClient, withdraw: TradingBalanceWithdraw): Promise<SignedTradingBalanceWithdraw>;
77
80
  export interface NormalizeTpSl extends Pick<TpSl, "instrument" | "side" | "type" | "order"> {
78
81
  quantity: string;
@@ -82,3 +85,4 @@ export interface SignedTpSl extends NormalizeTpSl {
82
85
  signature: string;
83
86
  }
84
87
  export declare function signTpSl(signer: WalletClient, tpsl: TpSl): Promise<SignedTpSl>;
88
+ export declare function signOauthConsentTequest(signer: WalletClient, payload: OauthConsent): Promise<SignedOauthConsentRequest>;
package/dist/cjs/index.js CHANGED
@@ -57,6 +57,7 @@ exports.signReplaceLimitOrder = signReplaceLimitOrder;
57
57
  exports.signReplaceStopLimitOrder = signReplaceStopLimitOrder;
58
58
  exports.signTradingBalanceWithdraw = signTradingBalanceWithdraw;
59
59
  exports.signTpSl = signTpSl;
60
+ exports.signOauthConsentTequest = signOauthConsentTequest;
60
61
  const big_js_1 = __importDefault(require("big.js"));
61
62
  const siwe_1 = require("siwe");
62
63
  const crypto_1 = require("./utils/crypto");
@@ -227,3 +228,13 @@ function signTpSl(signer, tpsl) {
227
228
  return Object.assign(Object.assign({}, normalize), { signature: signer.serializeSignature(signature) });
228
229
  });
229
230
  }
231
+ function signOauthConsentTequest(signer, payload) {
232
+ return __awaiter(this, void 0, void 0, function* () {
233
+ const { oauthRequestId } = payload;
234
+ (0, validate_1.validatePayload)({ oauthRequestId }, crypto_1.EIP721Schemas.oauthConsent);
235
+ const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(yield signer.getChainId()), crypto_1.EIP721Schemas.oauthConsent, {
236
+ oauthRequestId,
237
+ });
238
+ return Object.assign(Object.assign({}, payload), { signature });
239
+ });
240
+ }
@@ -53,6 +53,12 @@ export declare const EIP721Schemas: {
53
53
  type: string;
54
54
  }[];
55
55
  };
56
+ oauthConsent: {
57
+ "Oauth consent": {
58
+ name: string;
59
+ type: string;
60
+ }[];
61
+ };
56
62
  };
57
63
  export declare function getDomainData(chainId: string): {
58
64
  chainId: string;
@@ -87,6 +87,9 @@ exports.EIP721Schemas = {
87
87
  { name: "stopPrice", type: "uint80" },
88
88
  ],
89
89
  },
90
+ oauthConsent: {
91
+ "Oauth consent": [{ name: "oauthRequestId", type: "string" }],
92
+ },
90
93
  };
91
94
  function getDomainData(chainId) {
92
95
  return Object.assign(Object.assign({}, exports.EIP721Schemas.domain), { chainId });
@@ -58,3 +58,8 @@ export interface ReplaceLimitOrder extends ReplaceBaseOrder {
58
58
  export interface ReplaceStopLimitOrder extends ReplaceLimitOrder {
59
59
  stopPrice: Big.BigSource;
60
60
  }
61
+ export interface OauthConsent {
62
+ oauthRequestId: string;
63
+ apiKeyEnabled: boolean;
64
+ octWalletPrivateKey?: string;
65
+ }
@@ -1,6 +1,6 @@
1
1
  import Big from "big.js";
2
2
  import { SignedPayload, WalletClient, NetworkChain } from "./utils/crypto";
3
- import { CreateBaseOrder, LimitOrder, MarketOrder, PositionCloseOrder, ReplaceBaseOrder, ReplaceLimitOrder, ReplaceStopLimitOrder, StopLimitOrder, TpSl } from "./utils/exchange";
3
+ import { CreateBaseOrder, LimitOrder, MarketOrder, PositionCloseOrder, ReplaceBaseOrder, ReplaceLimitOrder, ReplaceStopLimitOrder, StopLimitOrder, TpSl, type OauthConsent } from "./utils/exchange";
4
4
  export * as utils from "./utils";
5
5
  export interface AuthMessage {
6
6
  nonce: string;
@@ -73,6 +73,9 @@ export interface NormalizeTradingBalanceWithdraw extends Pick<TradingBalanceWith
73
73
  export interface SignedTradingBalanceWithdraw extends NormalizeTradingBalanceWithdraw {
74
74
  signature: string;
75
75
  }
76
+ export interface SignedOauthConsentRequest extends OauthConsent {
77
+ signature: string;
78
+ }
76
79
  export declare function signTradingBalanceWithdraw(signer: WalletClient, withdraw: TradingBalanceWithdraw): Promise<SignedTradingBalanceWithdraw>;
77
80
  export interface NormalizeTpSl extends Pick<TpSl, "instrument" | "side" | "type" | "order"> {
78
81
  quantity: string;
@@ -82,3 +85,4 @@ export interface SignedTpSl extends NormalizeTpSl {
82
85
  signature: string;
83
86
  }
84
87
  export declare function signTpSl(signer: WalletClient, tpsl: TpSl): Promise<SignedTpSl>;
88
+ export declare function signOauthConsentTequest(signer: WalletClient, payload: OauthConsent): Promise<SignedOauthConsentRequest>;
package/dist/mjs/index.js CHANGED
@@ -202,3 +202,14 @@ export async function signTpSl(signer, tpsl) {
202
202
  signature: signer.serializeSignature(signature),
203
203
  };
204
204
  }
205
+ export async function signOauthConsentTequest(signer, payload) {
206
+ const { oauthRequestId } = payload;
207
+ validatePayload({ oauthRequestId }, EIP721Schemas.oauthConsent);
208
+ const signature = await signer.signTypedData(getDomainData(await signer.getChainId()), EIP721Schemas.oauthConsent, {
209
+ oauthRequestId,
210
+ });
211
+ return {
212
+ ...payload,
213
+ signature,
214
+ };
215
+ }
@@ -53,6 +53,12 @@ export declare const EIP721Schemas: {
53
53
  type: string;
54
54
  }[];
55
55
  };
56
+ oauthConsent: {
57
+ "Oauth consent": {
58
+ name: string;
59
+ type: string;
60
+ }[];
61
+ };
56
62
  };
57
63
  export declare function getDomainData(chainId: string): {
58
64
  chainId: string;
@@ -79,6 +79,9 @@ export const EIP721Schemas = {
79
79
  { name: "stopPrice", type: "uint80" },
80
80
  ],
81
81
  },
82
+ oauthConsent: {
83
+ "Oauth consent": [{ name: "oauthRequestId", type: "string" }],
84
+ },
82
85
  };
83
86
  export function getDomainData(chainId) {
84
87
  return {
@@ -58,3 +58,8 @@ export interface ReplaceLimitOrder extends ReplaceBaseOrder {
58
58
  export interface ReplaceStopLimitOrder extends ReplaceLimitOrder {
59
59
  stopPrice: Big.BigSource;
60
60
  }
61
+ export interface OauthConsent {
62
+ oauthRequestId: string;
63
+ apiKeyEnabled: boolean;
64
+ octWalletPrivateKey?: string;
65
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evedex/exchange-crypto",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/mjs/index.js",