@nadohq/shared 0.6.0 → 0.8.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.
Files changed (32) hide show
  1. package/dist/eip712/eip712ValueTypes.cjs.map +1 -1
  2. package/dist/eip712/eip712ValueTypes.d.cts +4 -2
  3. package/dist/eip712/eip712ValueTypes.d.ts +4 -2
  4. package/dist/eip712/getNadoEIP712Types.cjs +10 -1
  5. package/dist/eip712/getNadoEIP712Types.cjs.map +1 -1
  6. package/dist/eip712/getNadoEIP712Types.js +10 -1
  7. package/dist/eip712/getNadoEIP712Types.js.map +1 -1
  8. package/dist/eip712/getNadoEIP712Values.cjs +17 -1
  9. package/dist/eip712/getNadoEIP712Values.cjs.map +1 -1
  10. package/dist/eip712/getNadoEIP712Values.js +17 -1
  11. package/dist/eip712/getNadoEIP712Values.js.map +1 -1
  12. package/dist/eip712/index.d.cts +2 -2
  13. package/dist/eip712/index.d.ts +2 -2
  14. package/dist/eip712/signableRequestType.cjs.map +1 -1
  15. package/dist/eip712/signableRequestType.d.cts +2 -1
  16. package/dist/eip712/signableRequestType.d.ts +2 -1
  17. package/dist/eip712/signatureParamTypes.cjs.map +1 -1
  18. package/dist/eip712/signatureParamTypes.d.cts +6 -1
  19. package/dist/eip712/signatureParamTypes.d.ts +6 -1
  20. package/dist/index.d.cts +2 -2
  21. package/dist/index.d.ts +2 -2
  22. package/dist/utils/mapValues.cjs.map +1 -1
  23. package/dist/utils/mapValues.d.cts +1 -0
  24. package/dist/utils/mapValues.d.ts +1 -0
  25. package/dist/utils/mapValues.js.map +1 -1
  26. package/package.json +2 -2
  27. package/src/eip712/eip712ValueTypes.ts +5 -0
  28. package/src/eip712/getNadoEIP712Types.ts +9 -0
  29. package/src/eip712/getNadoEIP712Values.ts +21 -0
  30. package/src/eip712/signableRequestType.ts +2 -0
  31. package/src/eip712/signatureParamTypes.ts +6 -0
  32. package/src/utils/mapValues.ts +16 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/eip712/eip712ValueTypes.ts"],"sourcesContent":["import { Hex } from 'viem';\nimport { BigNumberish } from '../utils/math';\nimport {\n EIP712BurnNlpParams,\n EIP712CancelOrdersParams,\n EIP712CancelProductOrdersParams,\n EIP712LeaderboardAuthenticationParams,\n EIP712LinkSignerParams,\n EIP712LiquidateSubaccountParams,\n EIP712ListTriggerOrdersParams,\n EIP712MintNlpParams,\n EIP712OrderParams,\n EIP712TransferQuoteParams,\n EIP712WithdrawCollateralParams,\n} from './signatureParamTypes';\n\ntype WithEIP712Sender<\n T extends { subaccountOwner: string; subaccountName: string },\n> = Omit<T, 'subaccountOwner' | 'subaccountName'> & {\n // Hex encoded bytes32\n sender: Hex;\n};\n\nexport type EIP712WithdrawCollateralValues =\n WithEIP712Sender<EIP712WithdrawCollateralParams>;\n\nexport type EIP712LiquidateSubaccountValues = Omit<\n WithEIP712Sender<EIP712LiquidateSubaccountParams>,\n 'liquidateeOwner' | 'liquidateeName'\n> & {\n // Hex encoded bytes32\n liquidatee: string;\n};\n\nexport type EIP712OrderValues = Omit<\n WithEIP712Sender<EIP712OrderParams>,\n 'price'\n> & {\n priceX18: BigNumberish;\n};\n\nexport type EIP712ListTriggerOrdersValues =\n WithEIP712Sender<EIP712ListTriggerOrdersParams>;\n\nexport type EIP712OrderCancellationValues =\n WithEIP712Sender<EIP712CancelOrdersParams>;\n\nexport type EIP712ProductOrdersCancellationValues =\n WithEIP712Sender<EIP712CancelProductOrdersParams>;\n\nexport type EIP712LinkSignerValues = WithEIP712Sender<EIP712LinkSignerParams>;\n\nexport type EIP712TransferQuoteValues = Omit<\n WithEIP712Sender<EIP712TransferQuoteParams>,\n 'recipientSubaccountName'\n> & {\n // Hex encoded bytes32\n recipient: string;\n};\n\nexport type EIP712LeaderboardAuthenticationValues =\n WithEIP712Sender<EIP712LeaderboardAuthenticationParams>;\n\nexport type EIP712MintNlpValues = WithEIP712Sender<EIP712MintNlpParams>;\n\nexport type EIP712BurnNlpValues = WithEIP712Sender<EIP712BurnNlpParams>;\n\n/**\n * All possible requests to be signed, to the EIP712 value interface\n */\nexport interface SignableRequestTypeToEIP712Values {\n burn_nlp: EIP712BurnNlpValues;\n cancel_orders: EIP712OrderCancellationValues;\n cancel_product_orders: EIP712ProductOrdersCancellationValues;\n leaderboard_authentication: EIP712LeaderboardAuthenticationValues;\n link_signer: EIP712LinkSignerValues;\n liquidate_subaccount: EIP712LiquidateSubaccountValues;\n list_trigger_orders: EIP712ListTriggerOrdersValues;\n mint_nlp: EIP712MintNlpValues;\n place_order: EIP712OrderValues;\n transfer_quote: EIP712TransferQuoteValues;\n withdraw_collateral: EIP712WithdrawCollateralValues;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/eip712/eip712ValueTypes.ts"],"sourcesContent":["import { Hex } from 'viem';\nimport { BigNumberish } from '../utils/math';\nimport {\n EIP712BurnNlpParams,\n EIP712CancelOrdersParams,\n EIP712CancelProductOrdersParams,\n EIP712LeaderboardAuthenticationParams,\n EIP712LinkSignerParams,\n EIP712LiquidateSubaccountParams,\n EIP712ListTriggerOrdersParams,\n EIP712MintNlpParams,\n EIP712OrderParams,\n EIP712SocialAuthenticationParams,\n EIP712TransferQuoteParams,\n EIP712WithdrawCollateralParams,\n} from './signatureParamTypes';\n\ntype WithEIP712Sender<\n T extends { subaccountOwner: string; subaccountName: string },\n> = Omit<T, 'subaccountOwner' | 'subaccountName'> & {\n // Hex encoded bytes32\n sender: Hex;\n};\n\nexport type EIP712WithdrawCollateralValues =\n WithEIP712Sender<EIP712WithdrawCollateralParams>;\n\nexport type EIP712LiquidateSubaccountValues = Omit<\n WithEIP712Sender<EIP712LiquidateSubaccountParams>,\n 'liquidateeOwner' | 'liquidateeName'\n> & {\n // Hex encoded bytes32\n liquidatee: string;\n};\n\nexport type EIP712OrderValues = Omit<\n WithEIP712Sender<EIP712OrderParams>,\n 'price'\n> & {\n priceX18: BigNumberish;\n};\n\nexport type EIP712ListTriggerOrdersValues =\n WithEIP712Sender<EIP712ListTriggerOrdersParams>;\n\nexport type EIP712OrderCancellationValues =\n WithEIP712Sender<EIP712CancelOrdersParams>;\n\nexport type EIP712ProductOrdersCancellationValues =\n WithEIP712Sender<EIP712CancelProductOrdersParams>;\n\nexport type EIP712LinkSignerValues = WithEIP712Sender<EIP712LinkSignerParams>;\n\nexport type EIP712TransferQuoteValues = Omit<\n WithEIP712Sender<EIP712TransferQuoteParams>,\n 'recipientSubaccountName'\n> & {\n // Hex encoded bytes32\n recipient: string;\n};\n\nexport type EIP712LeaderboardAuthenticationValues =\n WithEIP712Sender<EIP712LeaderboardAuthenticationParams>;\n\nexport type EIP712SocialAuthenticationValues =\n WithEIP712Sender<EIP712SocialAuthenticationParams>;\n\nexport type EIP712MintNlpValues = WithEIP712Sender<EIP712MintNlpParams>;\n\nexport type EIP712BurnNlpValues = WithEIP712Sender<EIP712BurnNlpParams>;\n\n/**\n * All possible requests to be signed, to the EIP712 value interface\n */\nexport interface SignableRequestTypeToEIP712Values {\n burn_nlp: EIP712BurnNlpValues;\n cancel_orders: EIP712OrderCancellationValues;\n cancel_product_orders: EIP712ProductOrdersCancellationValues;\n leaderboard_authentication: EIP712LeaderboardAuthenticationValues;\n link_signer: EIP712LinkSignerValues;\n liquidate_subaccount: EIP712LiquidateSubaccountValues;\n list_trigger_orders: EIP712ListTriggerOrdersValues;\n mint_nlp: EIP712MintNlpValues;\n place_order: EIP712OrderValues;\n social_authentication: EIP712SocialAuthenticationValues;\n transfer_quote: EIP712TransferQuoteValues;\n withdraw_collateral: EIP712WithdrawCollateralValues;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import { Hex } from 'viem';
2
2
  import { BigNumberish } from '../utils/math/bigNumber.cjs';
3
- import { EIP712BurnNlpParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712CancelOrdersParams, EIP712OrderParams, EIP712CancelProductOrdersParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams } from './signatureParamTypes.cjs';
3
+ import { EIP712BurnNlpParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712CancelOrdersParams, EIP712OrderParams, EIP712CancelProductOrdersParams, EIP712SocialAuthenticationParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams } from './signatureParamTypes.cjs';
4
4
  import 'bignumber.js';
5
5
  import '../types/subaccountTypes.cjs';
6
6
  import '../types/bytes.cjs';
@@ -26,6 +26,7 @@ type EIP712TransferQuoteValues = Omit<WithEIP712Sender<EIP712TransferQuoteParams
26
26
  recipient: string;
27
27
  };
28
28
  type EIP712LeaderboardAuthenticationValues = WithEIP712Sender<EIP712LeaderboardAuthenticationParams>;
29
+ type EIP712SocialAuthenticationValues = WithEIP712Sender<EIP712SocialAuthenticationParams>;
29
30
  type EIP712MintNlpValues = WithEIP712Sender<EIP712MintNlpParams>;
30
31
  type EIP712BurnNlpValues = WithEIP712Sender<EIP712BurnNlpParams>;
31
32
  /**
@@ -41,8 +42,9 @@ interface SignableRequestTypeToEIP712Values {
41
42
  list_trigger_orders: EIP712ListTriggerOrdersValues;
42
43
  mint_nlp: EIP712MintNlpValues;
43
44
  place_order: EIP712OrderValues;
45
+ social_authentication: EIP712SocialAuthenticationValues;
44
46
  transfer_quote: EIP712TransferQuoteValues;
45
47
  withdraw_collateral: EIP712WithdrawCollateralValues;
46
48
  }
47
49
 
48
- export type { EIP712BurnNlpValues, EIP712LeaderboardAuthenticationValues, EIP712LinkSignerValues, EIP712LiquidateSubaccountValues, EIP712ListTriggerOrdersValues, EIP712MintNlpValues, EIP712OrderCancellationValues, EIP712OrderValues, EIP712ProductOrdersCancellationValues, EIP712TransferQuoteValues, EIP712WithdrawCollateralValues, SignableRequestTypeToEIP712Values };
50
+ export type { EIP712BurnNlpValues, EIP712LeaderboardAuthenticationValues, EIP712LinkSignerValues, EIP712LiquidateSubaccountValues, EIP712ListTriggerOrdersValues, EIP712MintNlpValues, EIP712OrderCancellationValues, EIP712OrderValues, EIP712ProductOrdersCancellationValues, EIP712SocialAuthenticationValues, EIP712TransferQuoteValues, EIP712WithdrawCollateralValues, SignableRequestTypeToEIP712Values };
@@ -1,6 +1,6 @@
1
1
  import { Hex } from 'viem';
2
2
  import { BigNumberish } from '../utils/math/bigNumber.js';
3
- import { EIP712BurnNlpParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712CancelOrdersParams, EIP712OrderParams, EIP712CancelProductOrdersParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams } from './signatureParamTypes.js';
3
+ import { EIP712BurnNlpParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712CancelOrdersParams, EIP712OrderParams, EIP712CancelProductOrdersParams, EIP712SocialAuthenticationParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams } from './signatureParamTypes.js';
4
4
  import 'bignumber.js';
5
5
  import '../types/subaccountTypes.js';
6
6
  import '../types/bytes.js';
@@ -26,6 +26,7 @@ type EIP712TransferQuoteValues = Omit<WithEIP712Sender<EIP712TransferQuoteParams
26
26
  recipient: string;
27
27
  };
28
28
  type EIP712LeaderboardAuthenticationValues = WithEIP712Sender<EIP712LeaderboardAuthenticationParams>;
29
+ type EIP712SocialAuthenticationValues = WithEIP712Sender<EIP712SocialAuthenticationParams>;
29
30
  type EIP712MintNlpValues = WithEIP712Sender<EIP712MintNlpParams>;
30
31
  type EIP712BurnNlpValues = WithEIP712Sender<EIP712BurnNlpParams>;
31
32
  /**
@@ -41,8 +42,9 @@ interface SignableRequestTypeToEIP712Values {
41
42
  list_trigger_orders: EIP712ListTriggerOrdersValues;
42
43
  mint_nlp: EIP712MintNlpValues;
43
44
  place_order: EIP712OrderValues;
45
+ social_authentication: EIP712SocialAuthenticationValues;
44
46
  transfer_quote: EIP712TransferQuoteValues;
45
47
  withdraw_collateral: EIP712WithdrawCollateralValues;
46
48
  }
47
49
 
48
- export type { EIP712BurnNlpValues, EIP712LeaderboardAuthenticationValues, EIP712LinkSignerValues, EIP712LiquidateSubaccountValues, EIP712ListTriggerOrdersValues, EIP712MintNlpValues, EIP712OrderCancellationValues, EIP712OrderValues, EIP712ProductOrdersCancellationValues, EIP712TransferQuoteValues, EIP712WithdrawCollateralValues, SignableRequestTypeToEIP712Values };
50
+ export type { EIP712BurnNlpValues, EIP712LeaderboardAuthenticationValues, EIP712LinkSignerValues, EIP712LiquidateSubaccountValues, EIP712ListTriggerOrdersValues, EIP712MintNlpValues, EIP712OrderCancellationValues, EIP712OrderValues, EIP712ProductOrdersCancellationValues, EIP712SocialAuthenticationValues, EIP712TransferQuoteValues, EIP712WithdrawCollateralValues, SignableRequestTypeToEIP712Values };
@@ -101,7 +101,16 @@ function getNadoEIP712Types(requestType) {
101
101
  return {
102
102
  LeaderboardAuthentication: [
103
103
  { name: "sender", type: "bytes32" },
104
- { name: "expiration", type: "uint64" }
104
+ { name: "expiration", type: "uint64" },
105
+ { name: "contestIds", type: "uint32[]" }
106
+ ]
107
+ };
108
+ case "social_authentication":
109
+ return {
110
+ SocialAuthentication: [
111
+ { name: "sender", type: "bytes32" },
112
+ { name: "expiration", type: "uint64" },
113
+ { name: "provider", type: "string" }
105
114
  ]
106
115
  };
107
116
  case "mint_nlp":
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/eip712/getNadoEIP712Types.ts"],"sourcesContent":["import { SignableRequestType } from './signableRequestType';\n\ninterface TypedDataField {\n name: string;\n type: string;\n}\n\n/**\n * Return the EIP712 types for a given request\n *\n * @param requestType\n */\nexport function getNadoEIP712Types(\n requestType: SignableRequestType,\n): Record<string, Array<TypedDataField>> {\n switch (requestType) {\n case 'withdraw_collateral':\n return {\n WithdrawCollateral: [\n { name: 'sender', type: 'bytes32' },\n { name: 'productId', type: 'uint32' },\n { name: 'amount', type: 'uint128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'place_order':\n return {\n Order: [\n { name: 'sender', type: 'bytes32' },\n { name: 'priceX18', type: 'int128' },\n { name: 'amount', type: 'int128' },\n { name: 'expiration', type: 'uint64' },\n { name: 'nonce', type: 'uint64' },\n { name: 'appendix', type: 'uint128' },\n ],\n };\n case 'list_trigger_orders':\n return {\n ListTriggerOrders: [\n { name: 'sender', type: 'bytes32' },\n { name: 'recvTime', type: 'uint64' },\n ],\n };\n case 'cancel_orders':\n return {\n Cancellation: [\n { name: 'sender', type: 'bytes32' },\n { name: 'productIds', type: 'uint32[]' },\n { name: 'digests', type: 'bytes32[]' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'cancel_product_orders':\n return {\n CancellationProducts: [\n { name: 'sender', type: 'bytes32' },\n { name: 'productIds', type: 'uint32[]' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'liquidate_subaccount':\n return {\n LiquidateSubaccount: [\n { name: 'sender', type: 'bytes32' },\n { name: 'liquidatee', type: 'bytes32' },\n { name: 'mode', type: 'uint8' },\n { name: 'healthGroup', type: 'uint32' },\n { name: 'amount', type: 'int128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'link_signer':\n return {\n LinkSigner: [\n { name: 'sender', type: 'bytes32' },\n { name: 'signer', type: 'bytes32' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'transfer_quote':\n return {\n TransferQuote: [\n { name: 'sender', type: 'bytes32' },\n { name: 'recipient', type: 'bytes32' },\n { name: 'amount', type: 'uint128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'leaderboard_authentication':\n return {\n LeaderboardAuthentication: [\n { name: 'sender', type: 'bytes32' },\n { name: 'expiration', type: 'uint64' },\n ],\n };\n case 'mint_nlp':\n return {\n MintNlp: [\n { name: 'sender', type: 'bytes32' },\n { name: 'quoteAmount', type: 'uint128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'burn_nlp':\n return {\n BurnNlp: [\n { name: 'sender', type: 'bytes32' },\n { name: 'nlpAmount', type: 'uint128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYO,SAAS,mBACd,aACuC;AACvC,UAAQ,aAAa;AAAA,IACnB,KAAK;AACH,aAAO;AAAA,QACL,oBAAoB;AAAA,UAClB,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,aAAa,MAAM,SAAS;AAAA,UACpC,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,SAAS,MAAM,SAAS;AAAA,QAClC;AAAA,MACF;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,OAAO;AAAA,UACL,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,YAAY,MAAM,SAAS;AAAA,UACnC,EAAE,MAAM,UAAU,MAAM,SAAS;AAAA,UACjC,EAAE,MAAM,cAAc,MAAM,SAAS;AAAA,UACrC,EAAE,MAAM,SAAS,MAAM,SAAS;AAAA,UAChC,EAAE,MAAM,YAAY,MAAM,UAAU;AAAA,QACtC;AAAA,MACF;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,mBAAmB;AAAA,UACjB,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,YAAY,MAAM,SAAS;AAAA,QACrC;AAAA,MACF;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,cAAc;AAAA,UACZ,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,cAAc,MAAM,WAAW;AAAA,UACvC,EAAE,MAAM,WAAW,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ACP,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,eAAe,MAAM,UAAU;AAAA,UACvC,EAAE,MAAM,SAAS,MAAM,SAAS;AAAA,QAClC;AAAA,MACF;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,SAAS;AAAA,UACP,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,aAAa,MAAM,UAAU;AAAA,UACrC,EAAE,MAAM,SAAS,MAAM,SAAS;AAAA,QAClC;AAAA,MACF;AAAA,EACJ;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/eip712/getNadoEIP712Types.ts"],"sourcesContent":["import { SignableRequestType } from './signableRequestType';\n\ninterface TypedDataField {\n name: string;\n type: string;\n}\n\n/**\n * Return the EIP712 types for a given request\n *\n * @param requestType\n */\nexport function getNadoEIP712Types(\n requestType: SignableRequestType,\n): Record<string, Array<TypedDataField>> {\n switch (requestType) {\n case 'withdraw_collateral':\n return {\n WithdrawCollateral: [\n { name: 'sender', type: 'bytes32' },\n { name: 'productId', type: 'uint32' },\n { name: 'amount', type: 'uint128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'place_order':\n return {\n Order: [\n { name: 'sender', type: 'bytes32' },\n { name: 'priceX18', type: 'int128' },\n { name: 'amount', type: 'int128' },\n { name: 'expiration', type: 'uint64' },\n { name: 'nonce', type: 'uint64' },\n { name: 'appendix', type: 'uint128' },\n ],\n };\n case 'list_trigger_orders':\n return {\n ListTriggerOrders: [\n { name: 'sender', type: 'bytes32' },\n { name: 'recvTime', type: 'uint64' },\n ],\n };\n case 'cancel_orders':\n return {\n Cancellation: [\n { name: 'sender', type: 'bytes32' },\n { name: 'productIds', type: 'uint32[]' },\n { name: 'digests', type: 'bytes32[]' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'cancel_product_orders':\n return {\n CancellationProducts: [\n { name: 'sender', type: 'bytes32' },\n { name: 'productIds', type: 'uint32[]' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'liquidate_subaccount':\n return {\n LiquidateSubaccount: [\n { name: 'sender', type: 'bytes32' },\n { name: 'liquidatee', type: 'bytes32' },\n { name: 'mode', type: 'uint8' },\n { name: 'healthGroup', type: 'uint32' },\n { name: 'amount', type: 'int128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'link_signer':\n return {\n LinkSigner: [\n { name: 'sender', type: 'bytes32' },\n { name: 'signer', type: 'bytes32' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'transfer_quote':\n return {\n TransferQuote: [\n { name: 'sender', type: 'bytes32' },\n { name: 'recipient', type: 'bytes32' },\n { name: 'amount', type: 'uint128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'leaderboard_authentication':\n return {\n LeaderboardAuthentication: [\n { name: 'sender', type: 'bytes32' },\n { name: 'expiration', type: 'uint64' },\n { name: 'contestIds', type: 'uint32[]' },\n ],\n };\n case 'social_authentication':\n return {\n SocialAuthentication: [\n { name: 'sender', type: 'bytes32' },\n { name: 'expiration', type: 'uint64' },\n { name: 'provider', type: 'string' },\n ],\n };\n case 'mint_nlp':\n return {\n MintNlp: [\n { name: 'sender', type: 'bytes32' },\n { name: 'quoteAmount', type: 'uint128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'burn_nlp':\n return {\n BurnNlp: [\n { name: 'sender', type: 'bytes32' },\n { name: 'nlpAmount', type: 'uint128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYO,SAAS,mBACd,aACuC;AACvC,UAAQ,aAAa;AAAA,IACnB,KAAK;AACH,aAAO;AAAA,QACL,oBAAoB;AAAA,UAClB,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,aAAa,MAAM,SAAS;AAAA,UACpC,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAA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AA,QAClC;AAAA,MACF;AAAA,EACJ;AACF;","names":[]}
@@ -79,7 +79,16 @@ function getNadoEIP712Types(requestType) {
79
79
  return {
80
80
  LeaderboardAuthentication: [
81
81
  { name: "sender", type: "bytes32" },
82
- { name: "expiration", type: "uint64" }
82
+ { name: "expiration", type: "uint64" },
83
+ { name: "contestIds", type: "uint32[]" }
84
+ ]
85
+ };
86
+ case "social_authentication":
87
+ return {
88
+ SocialAuthentication: [
89
+ { name: "sender", type: "bytes32" },
90
+ { name: "expiration", type: "uint64" },
91
+ { name: "provider", type: "string" }
83
92
  ]
84
93
  };
85
94
  case "mint_nlp":
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/eip712/getNadoEIP712Types.ts"],"sourcesContent":["import { SignableRequestType } from './signableRequestType';\n\ninterface TypedDataField {\n name: string;\n type: string;\n}\n\n/**\n * Return the EIP712 types for a given request\n *\n * @param requestType\n */\nexport function getNadoEIP712Types(\n requestType: SignableRequestType,\n): Record<string, Array<TypedDataField>> {\n switch (requestType) {\n case 'withdraw_collateral':\n return {\n WithdrawCollateral: [\n { name: 'sender', type: 'bytes32' },\n { name: 'productId', type: 'uint32' },\n { name: 'amount', type: 'uint128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'place_order':\n return {\n Order: [\n { name: 'sender', type: 'bytes32' },\n { name: 'priceX18', type: 'int128' },\n { name: 'amount', type: 'int128' },\n { name: 'expiration', type: 'uint64' },\n { name: 'nonce', type: 'uint64' },\n { name: 'appendix', type: 'uint128' },\n ],\n };\n case 'list_trigger_orders':\n return {\n ListTriggerOrders: [\n { name: 'sender', type: 'bytes32' },\n { name: 'recvTime', type: 'uint64' },\n ],\n };\n case 'cancel_orders':\n return {\n Cancellation: [\n { name: 'sender', type: 'bytes32' },\n { name: 'productIds', type: 'uint32[]' },\n { name: 'digests', type: 'bytes32[]' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'cancel_product_orders':\n return {\n CancellationProducts: [\n { name: 'sender', type: 'bytes32' },\n { name: 'productIds', type: 'uint32[]' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'liquidate_subaccount':\n return {\n LiquidateSubaccount: [\n { name: 'sender', type: 'bytes32' },\n { name: 'liquidatee', type: 'bytes32' },\n { name: 'mode', type: 'uint8' },\n { name: 'healthGroup', type: 'uint32' },\n { name: 'amount', type: 'int128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'link_signer':\n return {\n LinkSigner: [\n { name: 'sender', type: 'bytes32' },\n { name: 'signer', type: 'bytes32' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'transfer_quote':\n return {\n TransferQuote: [\n { name: 'sender', type: 'bytes32' },\n { name: 'recipient', type: 'bytes32' },\n { name: 'amount', type: 'uint128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'leaderboard_authentication':\n return {\n LeaderboardAuthentication: [\n { name: 'sender', type: 'bytes32' },\n { name: 'expiration', type: 'uint64' },\n ],\n };\n case 'mint_nlp':\n return {\n MintNlp: [\n { name: 'sender', type: 'bytes32' },\n { name: 'quoteAmount', type: 'uint128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'burn_nlp':\n return {\n BurnNlp: [\n { name: 'sender', type: 'bytes32' },\n { name: 'nlpAmount', type: 'uint128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n }\n}\n"],"mappings":";;;AAYO,SAAS,mBACd,aACuC;AACvC,UAAQ,aAAa;AAAA,IACnB,KAAK;AACH,aAAO;AAAA,QACL,oBAAoB;AAAA,UAClB,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,aAAa,MAAM,SAAS;AAAA,UACpC,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,SAAS,MAAM,SAAS;AAAA,QAClC;AAAA,MACF;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,OAAO;AAAA,UACL,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UA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C,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,SAAS,MAAM,SAAS;AAAA,QAClC;AAAA,MACF;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,eAAe;AAAA,UACb,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,aAAa,MAAM,UAAU;AAAA,UACrC,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,SAAS,MAAM,SAAS;AAAA,QAClC;AAAA,MACF;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,2BAA2B;AAAA,UACzB,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,cAAc,MAAM,SAAS;AAAA,QACvC;AAAA,MACF;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,SAAS;AAAA,UACP,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,eAAe,MAAM,UAAU;AAAA,UACvC,EAAE,MAAM,SAAS,MAAM,SAAS;AAAA,QAClC;AAAA,MACF;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,SAAS;AAAA,UACP,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,aAAa,MAAM,UAAU;AAAA,UACrC,EAAE,MAAM,SAAS,MAAM,SAAS;AAAA,QAClC;AAAA,MACF;AAAA,EACJ;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/eip712/getNadoEIP712Types.ts"],"sourcesContent":["import { SignableRequestType } from './signableRequestType';\n\ninterface TypedDataField {\n name: string;\n type: string;\n}\n\n/**\n * Return the EIP712 types for a given request\n *\n * @param requestType\n */\nexport function getNadoEIP712Types(\n requestType: SignableRequestType,\n): Record<string, Array<TypedDataField>> {\n switch (requestType) {\n case 'withdraw_collateral':\n return {\n WithdrawCollateral: [\n { name: 'sender', type: 'bytes32' },\n { name: 'productId', type: 'uint32' },\n { name: 'amount', type: 'uint128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'place_order':\n return {\n Order: [\n { name: 'sender', type: 'bytes32' },\n { name: 'priceX18', type: 'int128' },\n { name: 'amount', type: 'int128' },\n { name: 'expiration', type: 'uint64' },\n { name: 'nonce', type: 'uint64' },\n { name: 'appendix', type: 'uint128' },\n ],\n };\n case 'list_trigger_orders':\n return {\n ListTriggerOrders: [\n { name: 'sender', type: 'bytes32' },\n { name: 'recvTime', type: 'uint64' },\n ],\n };\n case 'cancel_orders':\n return {\n Cancellation: [\n { name: 'sender', type: 'bytes32' },\n { name: 'productIds', type: 'uint32[]' },\n { name: 'digests', type: 'bytes32[]' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'cancel_product_orders':\n return {\n CancellationProducts: [\n { name: 'sender', type: 'bytes32' },\n { name: 'productIds', type: 'uint32[]' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'liquidate_subaccount':\n return {\n LiquidateSubaccount: [\n { name: 'sender', type: 'bytes32' },\n { name: 'liquidatee', type: 'bytes32' },\n { name: 'mode', type: 'uint8' },\n { name: 'healthGroup', type: 'uint32' },\n { name: 'amount', type: 'int128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'link_signer':\n return {\n LinkSigner: [\n { name: 'sender', type: 'bytes32' },\n { name: 'signer', type: 'bytes32' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'transfer_quote':\n return {\n TransferQuote: [\n { name: 'sender', type: 'bytes32' },\n { name: 'recipient', type: 'bytes32' },\n { name: 'amount', type: 'uint128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'leaderboard_authentication':\n return {\n LeaderboardAuthentication: [\n { name: 'sender', type: 'bytes32' },\n { name: 'expiration', type: 'uint64' },\n { name: 'contestIds', type: 'uint32[]' },\n ],\n };\n case 'social_authentication':\n return {\n SocialAuthentication: [\n { name: 'sender', type: 'bytes32' },\n { name: 'expiration', type: 'uint64' },\n { name: 'provider', type: 'string' },\n ],\n };\n case 'mint_nlp':\n return {\n MintNlp: [\n { name: 'sender', type: 'bytes32' },\n { name: 'quoteAmount', type: 'uint128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n case 'burn_nlp':\n return {\n BurnNlp: [\n { name: 'sender', type: 'bytes32' },\n { name: 'nlpAmount', type: 'uint128' },\n { name: 'nonce', type: 'uint64' },\n ],\n };\n }\n}\n"],"mappings":";;;AAYO,SAAS,mBACd,aACuC;AACvC,UAAQ,aAAa;AAAA,IACnB,KAAK;AACH,aAAO;AAAA,QACL,oBAAoB;AAAA,UAClB,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,aAAa,MAAM,SAAS;AAAA,UACpC,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,SAAS,MAAM,SAAS;AAAA,QAClC;AAAA,MACF;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,OAAO;AAAA,UACL,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,YAAY,MAAM,SAAS;AAAA,UACnC,EAAE,MAAM,UAAU,MAAM,SAAS;AAAA,UACjC,EAAE,MAAM,cAAc,MAAM,SAAS;AAAA,UACrC,EAAE,MAAM,SAAS,MAAM,SAAS;AAAA,UAChC,EAAE,MAAM,YAAY,MAAM,UAAU;AAAA,QACtC;AAAA,MACF;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,mBAAmB;AAAA,UACjB,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,YAAY,MAAM,SAAS;AAAA,QACrC;AAAA,MACF;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,cAAc;AAAA,UACZ,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,cAAc,MAAM,WAAW;AAAA,UACvC,EAAE,MAAM,WAAW,MAAM,YAAY;AAAA,UACrC,EAAE,MAAM,SAAS,MAAM,SAAS;AAAA,QACl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AU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,cAAc,MAAM,SAAS;AAAA,UACrC,EAAE,MAAM,YAAY,MAAM,SAAS;AAAA,QACrC;AAAA,MACF;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,SAAS;AAAA,UACP,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,eAAe,MAAM,UAAU;AAAA,UACvC,EAAE,MAAM,SAAS,MAAM,SAAS;AAAA,QAClC;AAAA,MACF;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,SAAS;AAAA,UACP,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,aAAa,MAAM,UAAU;AAAA,UACrC,EAAE,MAAM,SAAS,MAAM,SAAS;AAAA,QAClC;AAAA,MACF;AAAA,EACJ;AACF;","names":[]}
@@ -65,6 +65,11 @@ function getNadoEIP712Values(requestType, params) {
65
65
  params
66
66
  );
67
67
  break;
68
+ case "social_authentication":
69
+ values = getSocialAuthenticationValues(
70
+ params
71
+ );
72
+ break;
68
73
  case "mint_nlp":
69
74
  values = getMintNlpValues(params);
70
75
  break;
@@ -176,7 +181,18 @@ function getLeaderboardAuthenticationValues(params) {
176
181
  subaccountOwner: params.subaccountOwner,
177
182
  subaccountName: params.subaccountName
178
183
  }),
179
- expiration: (0, import_math.toIntegerString)(params.expiration)
184
+ expiration: (0, import_math.toIntegerString)(params.expiration),
185
+ contestIds: params.contestIds
186
+ };
187
+ }
188
+ function getSocialAuthenticationValues(params) {
189
+ return {
190
+ sender: (0, import_bytes32.subaccountToHex)({
191
+ subaccountOwner: params.subaccountOwner,
192
+ subaccountName: params.subaccountName
193
+ }),
194
+ expiration: (0, import_math.toIntegerString)(params.expiration),
195
+ provider: params.provider
180
196
  };
181
197
  }
182
198
  function getMintNlpValues(params) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/eip712/getNadoEIP712Values.ts"],"sourcesContent":["import { subaccountToHex } from '../utils/bytes32';\nimport { addDecimals, toIntegerString } from '../utils/math';\nimport {\n EIP712BurnNlpValues,\n EIP712LeaderboardAuthenticationValues,\n EIP712LinkSignerValues,\n EIP712LiquidateSubaccountValues,\n EIP712ListTriggerOrdersValues,\n EIP712MintNlpValues,\n EIP712OrderCancellationValues,\n EIP712OrderValues,\n EIP712ProductOrdersCancellationValues,\n EIP712TransferQuoteValues,\n EIP712WithdrawCollateralValues,\n SignableRequestTypeToEIP712Values,\n} from './eip712ValueTypes';\nimport {\n SignableRequestType,\n SignableRequestTypeToParams,\n} from './signableRequestType';\nimport {\n EIP712BurnNlpParams,\n EIP712CancelOrdersParams,\n EIP712CancelProductOrdersParams,\n EIP712LeaderboardAuthenticationParams,\n EIP712LinkSignerParams,\n EIP712LiquidateSubaccountParams,\n EIP712ListTriggerOrdersParams,\n EIP712MintNlpParams,\n EIP712OrderParams,\n EIP712TransferQuoteParams,\n EIP712WithdrawCollateralParams,\n} from './signatureParamTypes';\n\n/**\n * Returns the EIP712 compatible values for signing.\n *\n * Note: We use the string representation of bigint to be compatible with JSON.stringify\n *\n * @param requestType\n * @param params\n */\nexport function getNadoEIP712Values<TReqType extends SignableRequestType>(\n requestType: TReqType,\n params: SignableRequestTypeToParams[TReqType],\n): SignableRequestTypeToEIP712Values[TReqType] {\n // Typescript does not yet support type narrowing + generic lookup types, hence the hacks here\n let values: SignableRequestTypeToEIP712Values[keyof SignableRequestTypeToEIP712Values];\n switch (requestType) {\n case 'withdraw_collateral':\n values = getWithdrawCollateralValues(\n params as EIP712WithdrawCollateralParams,\n );\n break;\n case 'place_order':\n values = getOrderValues(params as EIP712OrderParams);\n break;\n case 'list_trigger_orders':\n values = getListTriggerOrdersValues(\n params as EIP712ListTriggerOrdersParams,\n );\n break;\n case 'cancel_orders':\n values = getOrderCancellationValues(params as EIP712CancelOrdersParams);\n break;\n case 'cancel_product_orders':\n values = getProductOrdersCancellationValues(\n params as EIP712CancelProductOrdersParams,\n );\n break;\n case 'liquidate_subaccount':\n values = getLiquidateSubaccountValues(\n params as EIP712LiquidateSubaccountParams,\n );\n break;\n case 'link_signer':\n values = getLinkSignerValues(params as EIP712LinkSignerParams);\n break;\n case 'transfer_quote':\n values = getTransferQuoteValues(params as EIP712TransferQuoteParams);\n break;\n case 'leaderboard_authentication':\n values = getLeaderboardAuthenticationValues(\n params as EIP712LeaderboardAuthenticationParams,\n );\n break;\n case 'mint_nlp':\n values = getMintNlpValues(params as EIP712MintNlpParams);\n break;\n case 'burn_nlp':\n values = getBurnNlpValues(params as EIP712BurnNlpParams);\n break;\n default:\n throw new Error(`Unsupported request type: ${requestType}`);\n }\n\n return values as SignableRequestTypeToEIP712Values[TReqType];\n}\n\nfunction getWithdrawCollateralValues(\n params: EIP712WithdrawCollateralParams,\n): EIP712WithdrawCollateralValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n productId: params.productId,\n amount: toIntegerString(params.amount),\n nonce: params.nonce,\n };\n}\n\nfunction getOrderValues(params: EIP712OrderParams): EIP712OrderValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n priceX18: toIntegerString(addDecimals(params.price)),\n amount: toIntegerString(params.amount),\n expiration: toIntegerString(params.expiration),\n nonce: params.nonce,\n appendix: toIntegerString(params.appendix),\n };\n}\n\nfunction getListTriggerOrdersValues(\n params: EIP712ListTriggerOrdersParams,\n): EIP712ListTriggerOrdersValues {\n return {\n recvTime: toIntegerString(params.recvTime),\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n };\n}\n\nfunction getOrderCancellationValues(\n params: EIP712CancelOrdersParams,\n): EIP712OrderCancellationValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n productIds: params.productIds,\n digests: params.digests,\n nonce: params.nonce,\n };\n}\n\nfunction getProductOrdersCancellationValues(\n params: EIP712CancelProductOrdersParams,\n): EIP712ProductOrdersCancellationValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n productIds: params.productIds,\n nonce: params.nonce,\n };\n}\n\nfunction getLiquidateSubaccountValues(\n params: EIP712LiquidateSubaccountParams,\n): EIP712LiquidateSubaccountValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n liquidatee: subaccountToHex({\n subaccountOwner: params.liquidateeOwner,\n subaccountName: params.liquidateeName,\n }),\n mode: params.mode,\n healthGroup: toIntegerString(params.healthGroup),\n amount: toIntegerString(params.amount),\n nonce: params.nonce,\n };\n}\n\nfunction getLinkSignerValues(\n params: EIP712LinkSignerParams,\n): EIP712LinkSignerValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n signer: params.signer,\n nonce: params.nonce,\n };\n}\n\nfunction getTransferQuoteValues(\n params: EIP712TransferQuoteParams,\n): EIP712TransferQuoteValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n recipient: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.recipientSubaccountName,\n }),\n amount: toIntegerString(params.amount),\n nonce: params.nonce,\n };\n}\n\nfunction getLeaderboardAuthenticationValues(\n params: EIP712LeaderboardAuthenticationParams,\n): EIP712LeaderboardAuthenticationValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n expiration: toIntegerString(params.expiration),\n };\n}\n\nfunction getMintNlpValues(params: EIP712MintNlpParams): EIP712MintNlpValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n quoteAmount: toIntegerString(params.quoteAmount),\n nonce: params.nonce,\n };\n}\n\nfunction getBurnNlpValues(params: EIP712BurnNlpParams): EIP712BurnNlpValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n nlpAmount: toIntegerString(params.nlpAmount),\n nonce: params.nonce,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAgC;AAChC,kBAA6C;AAyCtC,SAAS,oBACd,aACA,QAC6C;AAE7C,MAAI;AACJ,UAAQ,aAAa;AAAA,IACnB,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS,eAAe,MAA2B;AACnD;AAAA,IACF,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS,2BAA2B,MAAkC;AACtE;AAAA,IACF,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS,oBAAoB,MAAgC;AAC7D;AAAA,IACF,KAAK;AACH,eAAS,uBAAuB,MAAmC;AACnE;AAAA,IACF,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS,iBAAiB,MAA6B;AACvD;AAAA,IACF,KAAK;AACH,eAAS,iBAAiB,MAA6B;AACvD;AAAA,IACF;AACE,YAAM,IAAI,MAAM,6BAA6B,WAAW,EAAE;AAAA,EAC9D;AAEA,SAAO;AACT;AAEA,SAAS,4BACP,QACgC;AAChC,SAAO;AAAA,IACL,YAAQ,gCAAgB;AAAA,MACtB,iBAAiB,OAAO;AAAA,MACxB,gBAAgB,OAAO;AAAA,IACzB,CAAC;AAAA,IACD,WAAW,OAAO;AAAA,IAClB,YAAQ,6BAAgB,OAAO,MAAM;AAAA,IACrC,OAAO,OAAO;AAAA,EAChB;AACF;AAEA,SAAS,eAAe,QAA8C;AACpE,SAAO;AA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712/getNadoEIP712Values.ts"],"sourcesContent":["import { subaccountToHex } from '../utils/bytes32';\nimport { addDecimals, toIntegerString } from '../utils/math';\nimport {\n EIP712BurnNlpValues,\n EIP712LeaderboardAuthenticationValues,\n EIP712LinkSignerValues,\n EIP712LiquidateSubaccountValues,\n EIP712ListTriggerOrdersValues,\n EIP712MintNlpValues,\n EIP712OrderCancellationValues,\n EIP712OrderValues,\n EIP712ProductOrdersCancellationValues,\n EIP712SocialAuthenticationValues,\n EIP712TransferQuoteValues,\n EIP712WithdrawCollateralValues,\n SignableRequestTypeToEIP712Values,\n} from './eip712ValueTypes';\nimport {\n SignableRequestType,\n SignableRequestTypeToParams,\n} from './signableRequestType';\nimport {\n EIP712BurnNlpParams,\n EIP712CancelOrdersParams,\n EIP712CancelProductOrdersParams,\n EIP712LeaderboardAuthenticationParams,\n EIP712LinkSignerParams,\n EIP712LiquidateSubaccountParams,\n EIP712ListTriggerOrdersParams,\n EIP712MintNlpParams,\n EIP712OrderParams,\n EIP712SocialAuthenticationParams,\n EIP712TransferQuoteParams,\n EIP712WithdrawCollateralParams,\n} from './signatureParamTypes';\n\n/**\n * Returns the EIP712 compatible values for signing.\n *\n * Note: We use the string representation of bigint to be compatible with JSON.stringify\n *\n * @param requestType\n * @param params\n */\nexport function getNadoEIP712Values<TReqType extends SignableRequestType>(\n requestType: TReqType,\n params: SignableRequestTypeToParams[TReqType],\n): SignableRequestTypeToEIP712Values[TReqType] {\n // Typescript does not yet support type narrowing + generic lookup types, hence the hacks here\n let values: SignableRequestTypeToEIP712Values[keyof SignableRequestTypeToEIP712Values];\n switch (requestType) {\n case 'withdraw_collateral':\n values = getWithdrawCollateralValues(\n params as EIP712WithdrawCollateralParams,\n );\n break;\n case 'place_order':\n values = getOrderValues(params as EIP712OrderParams);\n break;\n case 'list_trigger_orders':\n values = getListTriggerOrdersValues(\n params as EIP712ListTriggerOrdersParams,\n );\n break;\n case 'cancel_orders':\n values = getOrderCancellationValues(params as EIP712CancelOrdersParams);\n break;\n case 'cancel_product_orders':\n values = getProductOrdersCancellationValues(\n params as EIP712CancelProductOrdersParams,\n );\n break;\n case 'liquidate_subaccount':\n values = getLiquidateSubaccountValues(\n params as EIP712LiquidateSubaccountParams,\n );\n break;\n case 'link_signer':\n values = getLinkSignerValues(params as EIP712LinkSignerParams);\n break;\n case 'transfer_quote':\n values = getTransferQuoteValues(params as EIP712TransferQuoteParams);\n break;\n case 'leaderboard_authentication':\n values = getLeaderboardAuthenticationValues(\n params as EIP712LeaderboardAuthenticationParams,\n );\n break;\n case 'social_authentication':\n values = getSocialAuthenticationValues(\n params as EIP712SocialAuthenticationParams,\n );\n break;\n case 'mint_nlp':\n values = getMintNlpValues(params as EIP712MintNlpParams);\n break;\n case 'burn_nlp':\n values = getBurnNlpValues(params as EIP712BurnNlpParams);\n break;\n default:\n throw new Error(`Unsupported request type: ${requestType}`);\n }\n\n return values as SignableRequestTypeToEIP712Values[TReqType];\n}\n\nfunction getWithdrawCollateralValues(\n params: EIP712WithdrawCollateralParams,\n): EIP712WithdrawCollateralValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n productId: params.productId,\n amount: toIntegerString(params.amount),\n nonce: params.nonce,\n };\n}\n\nfunction getOrderValues(params: EIP712OrderParams): EIP712OrderValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n priceX18: toIntegerString(addDecimals(params.price)),\n amount: toIntegerString(params.amount),\n expiration: toIntegerString(params.expiration),\n nonce: params.nonce,\n appendix: toIntegerString(params.appendix),\n };\n}\n\nfunction getListTriggerOrdersValues(\n params: EIP712ListTriggerOrdersParams,\n): EIP712ListTriggerOrdersValues {\n return {\n recvTime: toIntegerString(params.recvTime),\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n };\n}\n\nfunction getOrderCancellationValues(\n params: EIP712CancelOrdersParams,\n): EIP712OrderCancellationValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n productIds: params.productIds,\n digests: params.digests,\n nonce: params.nonce,\n };\n}\n\nfunction getProductOrdersCancellationValues(\n params: EIP712CancelProductOrdersParams,\n): EIP712ProductOrdersCancellationValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n productIds: params.productIds,\n nonce: params.nonce,\n };\n}\n\nfunction getLiquidateSubaccountValues(\n params: EIP712LiquidateSubaccountParams,\n): EIP712LiquidateSubaccountValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n liquidatee: subaccountToHex({\n subaccountOwner: params.liquidateeOwner,\n subaccountName: params.liquidateeName,\n }),\n mode: params.mode,\n healthGroup: toIntegerString(params.healthGroup),\n amount: toIntegerString(params.amount),\n nonce: params.nonce,\n };\n}\n\nfunction getLinkSignerValues(\n params: EIP712LinkSignerParams,\n): EIP712LinkSignerValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n signer: params.signer,\n nonce: params.nonce,\n };\n}\n\nfunction getTransferQuoteValues(\n params: EIP712TransferQuoteParams,\n): EIP712TransferQuoteValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n recipient: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.recipientSubaccountName,\n }),\n amount: toIntegerString(params.amount),\n nonce: params.nonce,\n };\n}\n\nfunction getLeaderboardAuthenticationValues(\n params: EIP712LeaderboardAuthenticationParams,\n): EIP712LeaderboardAuthenticationValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n expiration: toIntegerString(params.expiration),\n contestIds: params.contestIds,\n };\n}\n\nfunction getSocialAuthenticationValues(\n params: EIP712SocialAuthenticationParams,\n): EIP712SocialAuthenticationValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n expiration: toIntegerString(params.expiration),\n provider: params.provider,\n };\n}\n\nfunction getMintNlpValues(params: EIP712MintNlpParams): EIP712MintNlpValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n quoteAmount: toIntegerString(params.quoteAmount),\n nonce: params.nonce,\n };\n}\n\nfunction getBurnNlpValues(params: EIP712BurnNlpParams): EIP712BurnNlpValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n nlpAmount: toIntegerString(params.nlpAmount),\n nonce: params.nonce,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAgC;AAChC,kBAA6C;AA2CtC,SAAS,oBACd,aACA,QAC6C;AAE7C,MAAI;AACJ,UAAQ,aAAa;AAAA,IACnB,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS,eAAe,MAA2B;AACnD;AAAA,IACF,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS,2BAA2B,MAAkC;AACtE;AAAA,IACF,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS,oBAAoB,MAAgC;AAC7D;AAAA,IACF,KAAK;AACH,eAAS,uBAAuB,MAAmC;AACnE;AAAA,IACF,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS,iBAAiB,MAA6B;AAC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AO;AAAA,IACL,YAAQ,gCAAgB;AAAA,MACtB,iBAAiB,OAAO;AAAA,MACxB,gBAAgB,OAAO;AAAA,IACzB,CAAC;AAAA,IACD,gBAAY,6BAAgB,OAAO,UAAU;AAAA,IAC7C,UAAU,OAAO;AAAA,EACnB;AACF;AAEA,SAAS,iBAAiB,QAAkD;AAC1E,SAAO;AAAA,IACL,YAAQ,gCAAgB;AAAA,MACtB,iBAAiB,OAAO;AAAA,MACxB,gBAAgB,OAAO;AAAA,IACzB,CAAC;AAAA,IACD,iBAAa,6BAAgB,OAAO,WAAW;AAAA,IAC/C,OAAO,OAAO;AAAA,EAChB;AACF;AAEA,SAAS,iBAAiB,QAAkD;AAC1E,SAAO;AAAA,IACL,YAAQ,gCAAgB;AAAA,MACtB,iBAAiB,OAAO;AAAA,MACxB,gBAAgB,OAAO;AAAA,IACzB,CAAC;AAAA,IACD,eAAW,6BAAgB,OAAO,SAAS;AAAA,IAC3C,OAAO,OAAO;AAAA,EAChB;AACF;","names":[]}
@@ -43,6 +43,11 @@ function getNadoEIP712Values(requestType, params) {
43
43
  params
44
44
  );
45
45
  break;
46
+ case "social_authentication":
47
+ values = getSocialAuthenticationValues(
48
+ params
49
+ );
50
+ break;
46
51
  case "mint_nlp":
47
52
  values = getMintNlpValues(params);
48
53
  break;
@@ -154,7 +159,18 @@ function getLeaderboardAuthenticationValues(params) {
154
159
  subaccountOwner: params.subaccountOwner,
155
160
  subaccountName: params.subaccountName
156
161
  }),
157
- expiration: toIntegerString(params.expiration)
162
+ expiration: toIntegerString(params.expiration),
163
+ contestIds: params.contestIds
164
+ };
165
+ }
166
+ function getSocialAuthenticationValues(params) {
167
+ return {
168
+ sender: subaccountToHex({
169
+ subaccountOwner: params.subaccountOwner,
170
+ subaccountName: params.subaccountName
171
+ }),
172
+ expiration: toIntegerString(params.expiration),
173
+ provider: params.provider
158
174
  };
159
175
  }
160
176
  function getMintNlpValues(params) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/eip712/getNadoEIP712Values.ts"],"sourcesContent":["import { subaccountToHex } from '../utils/bytes32';\nimport { addDecimals, toIntegerString } from '../utils/math';\nimport {\n EIP712BurnNlpValues,\n EIP712LeaderboardAuthenticationValues,\n EIP712LinkSignerValues,\n EIP712LiquidateSubaccountValues,\n EIP712ListTriggerOrdersValues,\n EIP712MintNlpValues,\n EIP712OrderCancellationValues,\n EIP712OrderValues,\n EIP712ProductOrdersCancellationValues,\n EIP712TransferQuoteValues,\n EIP712WithdrawCollateralValues,\n SignableRequestTypeToEIP712Values,\n} from './eip712ValueTypes';\nimport {\n SignableRequestType,\n SignableRequestTypeToParams,\n} from './signableRequestType';\nimport {\n EIP712BurnNlpParams,\n EIP712CancelOrdersParams,\n EIP712CancelProductOrdersParams,\n EIP712LeaderboardAuthenticationParams,\n EIP712LinkSignerParams,\n EIP712LiquidateSubaccountParams,\n EIP712ListTriggerOrdersParams,\n EIP712MintNlpParams,\n EIP712OrderParams,\n EIP712TransferQuoteParams,\n EIP712WithdrawCollateralParams,\n} from './signatureParamTypes';\n\n/**\n * Returns the EIP712 compatible values for signing.\n *\n * Note: We use the string representation of bigint to be compatible with JSON.stringify\n *\n * @param requestType\n * @param params\n */\nexport function getNadoEIP712Values<TReqType extends SignableRequestType>(\n requestType: TReqType,\n params: SignableRequestTypeToParams[TReqType],\n): SignableRequestTypeToEIP712Values[TReqType] {\n // Typescript does not yet support type narrowing + generic lookup types, hence the hacks here\n let values: SignableRequestTypeToEIP712Values[keyof SignableRequestTypeToEIP712Values];\n switch (requestType) {\n case 'withdraw_collateral':\n values = getWithdrawCollateralValues(\n params as EIP712WithdrawCollateralParams,\n );\n break;\n case 'place_order':\n values = getOrderValues(params as EIP712OrderParams);\n break;\n case 'list_trigger_orders':\n values = getListTriggerOrdersValues(\n params as EIP712ListTriggerOrdersParams,\n );\n break;\n case 'cancel_orders':\n values = getOrderCancellationValues(params as EIP712CancelOrdersParams);\n break;\n case 'cancel_product_orders':\n values = getProductOrdersCancellationValues(\n params as EIP712CancelProductOrdersParams,\n );\n break;\n case 'liquidate_subaccount':\n values = getLiquidateSubaccountValues(\n params as EIP712LiquidateSubaccountParams,\n );\n break;\n case 'link_signer':\n values = getLinkSignerValues(params as EIP712LinkSignerParams);\n break;\n case 'transfer_quote':\n values = getTransferQuoteValues(params as EIP712TransferQuoteParams);\n break;\n case 'leaderboard_authentication':\n values = getLeaderboardAuthenticationValues(\n params as EIP712LeaderboardAuthenticationParams,\n );\n break;\n case 'mint_nlp':\n values = getMintNlpValues(params as EIP712MintNlpParams);\n break;\n case 'burn_nlp':\n values = getBurnNlpValues(params as EIP712BurnNlpParams);\n break;\n default:\n throw new Error(`Unsupported request type: ${requestType}`);\n }\n\n return values as SignableRequestTypeToEIP712Values[TReqType];\n}\n\nfunction getWithdrawCollateralValues(\n params: EIP712WithdrawCollateralParams,\n): EIP712WithdrawCollateralValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n productId: params.productId,\n amount: toIntegerString(params.amount),\n nonce: params.nonce,\n };\n}\n\nfunction getOrderValues(params: EIP712OrderParams): EIP712OrderValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n priceX18: toIntegerString(addDecimals(params.price)),\n amount: toIntegerString(params.amount),\n expiration: toIntegerString(params.expiration),\n nonce: params.nonce,\n appendix: toIntegerString(params.appendix),\n };\n}\n\nfunction getListTriggerOrdersValues(\n params: EIP712ListTriggerOrdersParams,\n): EIP712ListTriggerOrdersValues {\n return {\n recvTime: toIntegerString(params.recvTime),\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n };\n}\n\nfunction getOrderCancellationValues(\n params: EIP712CancelOrdersParams,\n): EIP712OrderCancellationValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n productIds: params.productIds,\n digests: params.digests,\n nonce: params.nonce,\n };\n}\n\nfunction getProductOrdersCancellationValues(\n params: EIP712CancelProductOrdersParams,\n): EIP712ProductOrdersCancellationValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n productIds: params.productIds,\n nonce: params.nonce,\n };\n}\n\nfunction getLiquidateSubaccountValues(\n params: EIP712LiquidateSubaccountParams,\n): EIP712LiquidateSubaccountValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n liquidatee: subaccountToHex({\n subaccountOwner: params.liquidateeOwner,\n subaccountName: params.liquidateeName,\n }),\n mode: params.mode,\n healthGroup: toIntegerString(params.healthGroup),\n amount: toIntegerString(params.amount),\n nonce: params.nonce,\n };\n}\n\nfunction getLinkSignerValues(\n params: EIP712LinkSignerParams,\n): EIP712LinkSignerValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n signer: params.signer,\n nonce: params.nonce,\n };\n}\n\nfunction getTransferQuoteValues(\n params: EIP712TransferQuoteParams,\n): EIP712TransferQuoteValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n recipient: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.recipientSubaccountName,\n }),\n amount: toIntegerString(params.amount),\n nonce: params.nonce,\n };\n}\n\nfunction getLeaderboardAuthenticationValues(\n params: EIP712LeaderboardAuthenticationParams,\n): EIP712LeaderboardAuthenticationValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n expiration: toIntegerString(params.expiration),\n };\n}\n\nfunction getMintNlpValues(params: EIP712MintNlpParams): EIP712MintNlpValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n quoteAmount: toIntegerString(params.quoteAmount),\n nonce: params.nonce,\n };\n}\n\nfunction getBurnNlpValues(params: EIP712BurnNlpParams): EIP712BurnNlpValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n nlpAmount: toIntegerString(params.nlpAmount),\n nonce: params.nonce,\n };\n}\n"],"mappings":";;;AAAA,SAAS,uBAAuB;AAChC,SAAS,aAAa,uBAAuB;AAyCtC,SAAS,oBACd,aACA,QAC6C;AAE7C,MAAI;AACJ,UAAQ,aAAa;AAAA,IACnB,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS,eAAe,MAA2B;AACnD;AAAA,IACF,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS,2BAA2B,MAAkC;AACtE;AAAA,IACF,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS,oBAAoB,MAAgC;AAC7D;AAAA,IACF,KAAK;AACH,eAAS,uBAAuB,MAAmC;AACnE;AAAA,IACF,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS,iBAAiB,MAA6B;AACvD;AAAA,IACF,KAAK;AACH,eAAS,iBAAiB,MAA6B;AACvD;AAAA,IACF;AACE,YAAM,IAAI,MAAM,6BAA6B,WAAW,EAAE;AAAA,EAC9D;AAEA,SAAO;AACT;AAEA,SAAS,4BACP,QACgC;AAChC,SAAO;AAAA,IACL,QAAQ,gBAAgB;AAAA,MACtB,iBAAiB,OAAO;AAAA,MACxB,gBAAgB,OAAO;AAAA,IACzB,CAAC;AAAA,IACD,WAAW,OAAO;AAAA,IAClB,QAAQ,gBAAgB,OAAO,MAAM;AAAA,IACrC,OAAO,OAAO;AAAA,EAChB;AACF;AAEA,SAAS,eAAe,QA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sources":["../../src/eip712/getNadoEIP712Values.ts"],"sourcesContent":["import { subaccountToHex } from '../utils/bytes32';\nimport { addDecimals, toIntegerString } from '../utils/math';\nimport {\n EIP712BurnNlpValues,\n EIP712LeaderboardAuthenticationValues,\n EIP712LinkSignerValues,\n EIP712LiquidateSubaccountValues,\n EIP712ListTriggerOrdersValues,\n EIP712MintNlpValues,\n EIP712OrderCancellationValues,\n EIP712OrderValues,\n EIP712ProductOrdersCancellationValues,\n EIP712SocialAuthenticationValues,\n EIP712TransferQuoteValues,\n EIP712WithdrawCollateralValues,\n SignableRequestTypeToEIP712Values,\n} from './eip712ValueTypes';\nimport {\n SignableRequestType,\n SignableRequestTypeToParams,\n} from './signableRequestType';\nimport {\n EIP712BurnNlpParams,\n EIP712CancelOrdersParams,\n EIP712CancelProductOrdersParams,\n EIP712LeaderboardAuthenticationParams,\n EIP712LinkSignerParams,\n EIP712LiquidateSubaccountParams,\n EIP712ListTriggerOrdersParams,\n EIP712MintNlpParams,\n EIP712OrderParams,\n EIP712SocialAuthenticationParams,\n EIP712TransferQuoteParams,\n EIP712WithdrawCollateralParams,\n} from './signatureParamTypes';\n\n/**\n * Returns the EIP712 compatible values for signing.\n *\n * Note: We use the string representation of bigint to be compatible with JSON.stringify\n *\n * @param requestType\n * @param params\n */\nexport function getNadoEIP712Values<TReqType extends SignableRequestType>(\n requestType: TReqType,\n params: SignableRequestTypeToParams[TReqType],\n): SignableRequestTypeToEIP712Values[TReqType] {\n // Typescript does not yet support type narrowing + generic lookup types, hence the hacks here\n let values: SignableRequestTypeToEIP712Values[keyof SignableRequestTypeToEIP712Values];\n switch (requestType) {\n case 'withdraw_collateral':\n values = getWithdrawCollateralValues(\n params as EIP712WithdrawCollateralParams,\n );\n break;\n case 'place_order':\n values = getOrderValues(params as EIP712OrderParams);\n break;\n case 'list_trigger_orders':\n values = getListTriggerOrdersValues(\n params as EIP712ListTriggerOrdersParams,\n );\n break;\n case 'cancel_orders':\n values = getOrderCancellationValues(params as EIP712CancelOrdersParams);\n break;\n case 'cancel_product_orders':\n values = getProductOrdersCancellationValues(\n params as EIP712CancelProductOrdersParams,\n );\n break;\n case 'liquidate_subaccount':\n values = getLiquidateSubaccountValues(\n params as EIP712LiquidateSubaccountParams,\n );\n break;\n case 'link_signer':\n values = getLinkSignerValues(params as EIP712LinkSignerParams);\n break;\n case 'transfer_quote':\n values = getTransferQuoteValues(params as EIP712TransferQuoteParams);\n break;\n case 'leaderboard_authentication':\n values = getLeaderboardAuthenticationValues(\n params as EIP712LeaderboardAuthenticationParams,\n );\n break;\n case 'social_authentication':\n values = getSocialAuthenticationValues(\n params as EIP712SocialAuthenticationParams,\n );\n break;\n case 'mint_nlp':\n values = getMintNlpValues(params as EIP712MintNlpParams);\n break;\n case 'burn_nlp':\n values = getBurnNlpValues(params as EIP712BurnNlpParams);\n break;\n default:\n throw new Error(`Unsupported request type: ${requestType}`);\n }\n\n return values as SignableRequestTypeToEIP712Values[TReqType];\n}\n\nfunction getWithdrawCollateralValues(\n params: EIP712WithdrawCollateralParams,\n): EIP712WithdrawCollateralValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n productId: params.productId,\n amount: toIntegerString(params.amount),\n nonce: params.nonce,\n };\n}\n\nfunction getOrderValues(params: EIP712OrderParams): EIP712OrderValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n priceX18: toIntegerString(addDecimals(params.price)),\n amount: toIntegerString(params.amount),\n expiration: toIntegerString(params.expiration),\n nonce: params.nonce,\n appendix: toIntegerString(params.appendix),\n };\n}\n\nfunction getListTriggerOrdersValues(\n params: EIP712ListTriggerOrdersParams,\n): EIP712ListTriggerOrdersValues {\n return {\n recvTime: toIntegerString(params.recvTime),\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n };\n}\n\nfunction getOrderCancellationValues(\n params: EIP712CancelOrdersParams,\n): EIP712OrderCancellationValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n productIds: params.productIds,\n digests: params.digests,\n nonce: params.nonce,\n };\n}\n\nfunction getProductOrdersCancellationValues(\n params: EIP712CancelProductOrdersParams,\n): EIP712ProductOrdersCancellationValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n productIds: params.productIds,\n nonce: params.nonce,\n };\n}\n\nfunction getLiquidateSubaccountValues(\n params: EIP712LiquidateSubaccountParams,\n): EIP712LiquidateSubaccountValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n liquidatee: subaccountToHex({\n subaccountOwner: params.liquidateeOwner,\n subaccountName: params.liquidateeName,\n }),\n mode: params.mode,\n healthGroup: toIntegerString(params.healthGroup),\n amount: toIntegerString(params.amount),\n nonce: params.nonce,\n };\n}\n\nfunction getLinkSignerValues(\n params: EIP712LinkSignerParams,\n): EIP712LinkSignerValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n signer: params.signer,\n nonce: params.nonce,\n };\n}\n\nfunction getTransferQuoteValues(\n params: EIP712TransferQuoteParams,\n): EIP712TransferQuoteValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n recipient: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.recipientSubaccountName,\n }),\n amount: toIntegerString(params.amount),\n nonce: params.nonce,\n };\n}\n\nfunction getLeaderboardAuthenticationValues(\n params: EIP712LeaderboardAuthenticationParams,\n): EIP712LeaderboardAuthenticationValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n expiration: toIntegerString(params.expiration),\n contestIds: params.contestIds,\n };\n}\n\nfunction getSocialAuthenticationValues(\n params: EIP712SocialAuthenticationParams,\n): EIP712SocialAuthenticationValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n expiration: toIntegerString(params.expiration),\n provider: params.provider,\n };\n}\n\nfunction getMintNlpValues(params: EIP712MintNlpParams): EIP712MintNlpValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n quoteAmount: toIntegerString(params.quoteAmount),\n nonce: params.nonce,\n };\n}\n\nfunction getBurnNlpValues(params: EIP712BurnNlpParams): EIP712BurnNlpValues {\n return {\n sender: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n nlpAmount: toIntegerString(params.nlpAmount),\n nonce: params.nonce,\n };\n}\n"],"mappings":";;;AAAA,SAAS,uBAAuB;AAChC,SAAS,aAAa,uBAAuB;AA2CtC,SAAS,oBACd,aACA,QAC6C;AAE7C,MAAI;AACJ,UAAQ,aAAa;AAAA,IACnB,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS,eAAe,MAA2B;AACnD;AAAA,IACF,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS,2BAA2B,MAAkC;AACtE;AAAA,IACF,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS,oBAAoB,MAAgC;AAC7D;AAAA,IACF,KAAK;AACH,eAAS,uBAAuB,MAAmC;AACnE;AAAA,IACF,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS;AAAA,QACP;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,eAAS,iBAAiB,MAA6B;AACvD;AAAA,IACF,KAAK;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gB;AAAA,MACtB,iBAAiB,OAAO;AAAA,MACxB,gBAAgB,OAAO;AAAA,IACzB,CAAC;AAAA,IACD,YAAY,gBAAgB,OAAO,UAAU;AAAA,IAC7C,UAAU,OAAO;AAAA,EACnB;AACF;AAEA,SAAS,iBAAiB,QAAkD;AAC1E,SAAO;AAAA,IACL,QAAQ,gBAAgB;AAAA,MACtB,iBAAiB,OAAO;AAAA,MACxB,gBAAgB,OAAO;AAAA,IACzB,CAAC;AAAA,IACD,aAAa,gBAAgB,OAAO,WAAW;AAAA,IAC/C,OAAO,OAAO;AAAA,EAChB;AACF;AAEA,SAAS,iBAAiB,QAAkD;AAC1E,SAAO;AAAA,IACL,QAAQ,gBAAgB;AAAA,MACtB,iBAAiB,OAAO;AAAA,MACxB,gBAAgB,OAAO;AAAA,IACzB,CAAC;AAAA,IACD,WAAW,gBAAgB,OAAO,SAAS;AAAA,IAC3C,OAAO,OAAO;AAAA,EAChB;AACF;","names":[]}
@@ -1,4 +1,4 @@
1
- export { EIP712BurnNlpValues, EIP712LeaderboardAuthenticationValues, EIP712LinkSignerValues, EIP712LiquidateSubaccountValues, EIP712ListTriggerOrdersValues, EIP712MintNlpValues, EIP712OrderCancellationValues, EIP712OrderValues, EIP712ProductOrdersCancellationValues, EIP712TransferQuoteValues, EIP712WithdrawCollateralValues, SignableRequestTypeToEIP712Values } from './eip712ValueTypes.cjs';
1
+ export { EIP712BurnNlpValues, EIP712LeaderboardAuthenticationValues, EIP712LinkSignerValues, EIP712LiquidateSubaccountValues, EIP712ListTriggerOrdersValues, EIP712MintNlpValues, EIP712OrderCancellationValues, EIP712OrderValues, EIP712ProductOrdersCancellationValues, EIP712SocialAuthenticationValues, EIP712TransferQuoteValues, EIP712WithdrawCollateralValues, SignableRequestTypeToEIP712Values } from './eip712ValueTypes.cjs';
2
2
  export { getNadoEIP712Domain } from './getNadoEIP712Domain.cjs';
3
3
  export { getNadoEIP712PrimaryType } from './getNadoEIP712PrimaryType.cjs';
4
4
  export { getNadoEIP712Types } from './getNadoEIP712Types.cjs';
@@ -7,7 +7,7 @@ export { getOrderVerifyingAddress } from './getOrderVerifyingAddress.cjs';
7
7
  export { getSignedTransactionRequest } from './getSignedTransactionRequest.cjs';
8
8
  export { getOrderDigest } from './orderDigest.cjs';
9
9
  export { SignableRequestType, SignableRequestTypeToParams } from './signableRequestType.cjs';
10
- export { EIP712BurnNlpParams, EIP712CancelOrdersParams, EIP712CancelProductOrdersParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712OrderParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams, SignedEIP712OrderParams, SignedTx } from './signatureParamTypes.cjs';
10
+ export { EIP712BurnNlpParams, EIP712CancelOrdersParams, EIP712CancelProductOrdersParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712OrderParams, EIP712SocialAuthenticationParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams, SignedEIP712OrderParams, SignedTx } from './signatureParamTypes.cjs';
11
11
  import 'viem';
12
12
  import '../utils/math/bigNumber.cjs';
13
13
  import 'bignumber.js';
@@ -1,4 +1,4 @@
1
- export { EIP712BurnNlpValues, EIP712LeaderboardAuthenticationValues, EIP712LinkSignerValues, EIP712LiquidateSubaccountValues, EIP712ListTriggerOrdersValues, EIP712MintNlpValues, EIP712OrderCancellationValues, EIP712OrderValues, EIP712ProductOrdersCancellationValues, EIP712TransferQuoteValues, EIP712WithdrawCollateralValues, SignableRequestTypeToEIP712Values } from './eip712ValueTypes.js';
1
+ export { EIP712BurnNlpValues, EIP712LeaderboardAuthenticationValues, EIP712LinkSignerValues, EIP712LiquidateSubaccountValues, EIP712ListTriggerOrdersValues, EIP712MintNlpValues, EIP712OrderCancellationValues, EIP712OrderValues, EIP712ProductOrdersCancellationValues, EIP712SocialAuthenticationValues, EIP712TransferQuoteValues, EIP712WithdrawCollateralValues, SignableRequestTypeToEIP712Values } from './eip712ValueTypes.js';
2
2
  export { getNadoEIP712Domain } from './getNadoEIP712Domain.js';
3
3
  export { getNadoEIP712PrimaryType } from './getNadoEIP712PrimaryType.js';
4
4
  export { getNadoEIP712Types } from './getNadoEIP712Types.js';
@@ -7,7 +7,7 @@ export { getOrderVerifyingAddress } from './getOrderVerifyingAddress.js';
7
7
  export { getSignedTransactionRequest } from './getSignedTransactionRequest.js';
8
8
  export { getOrderDigest } from './orderDigest.js';
9
9
  export { SignableRequestType, SignableRequestTypeToParams } from './signableRequestType.js';
10
- export { EIP712BurnNlpParams, EIP712CancelOrdersParams, EIP712CancelProductOrdersParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712OrderParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams, SignedEIP712OrderParams, SignedTx } from './signatureParamTypes.js';
10
+ export { EIP712BurnNlpParams, EIP712CancelOrdersParams, EIP712CancelProductOrdersParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712OrderParams, EIP712SocialAuthenticationParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams, SignedEIP712OrderParams, SignedTx } from './signatureParamTypes.js';
11
11
  import 'viem';
12
12
  import '../utils/math/bigNumber.js';
13
13
  import 'bignumber.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/eip712/signableRequestType.ts"],"sourcesContent":["import {\n EIP712BurnNlpParams,\n EIP712CancelOrdersParams,\n EIP712CancelProductOrdersParams,\n EIP712LeaderboardAuthenticationParams,\n EIP712LinkSignerParams,\n EIP712LiquidateSubaccountParams,\n EIP712ListTriggerOrdersParams,\n EIP712MintNlpParams,\n EIP712OrderParams,\n EIP712TransferQuoteParams,\n EIP712WithdrawCollateralParams,\n} from './signatureParamTypes';\n\n/**\n * All possible requests to be signed, to the expected params\n */\nexport interface SignableRequestTypeToParams {\n burn_nlp: EIP712BurnNlpParams;\n cancel_orders: EIP712CancelOrdersParams;\n cancel_product_orders: EIP712CancelProductOrdersParams;\n leaderboard_authentication: EIP712LeaderboardAuthenticationParams;\n link_signer: EIP712LinkSignerParams;\n liquidate_subaccount: EIP712LiquidateSubaccountParams;\n list_trigger_orders: EIP712ListTriggerOrdersParams;\n mint_nlp: EIP712MintNlpParams;\n place_order: EIP712OrderParams;\n transfer_quote: EIP712TransferQuoteParams;\n withdraw_collateral: EIP712WithdrawCollateralParams;\n}\n\nexport type SignableRequestType = keyof SignableRequestTypeToParams;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/eip712/signableRequestType.ts"],"sourcesContent":["import {\n EIP712BurnNlpParams,\n EIP712CancelOrdersParams,\n EIP712CancelProductOrdersParams,\n EIP712LeaderboardAuthenticationParams,\n EIP712LinkSignerParams,\n EIP712LiquidateSubaccountParams,\n EIP712ListTriggerOrdersParams,\n EIP712MintNlpParams,\n EIP712OrderParams,\n EIP712SocialAuthenticationParams,\n EIP712TransferQuoteParams,\n EIP712WithdrawCollateralParams,\n} from './signatureParamTypes';\n\n/**\n * All possible requests to be signed, to the expected params\n */\nexport interface SignableRequestTypeToParams {\n burn_nlp: EIP712BurnNlpParams;\n cancel_orders: EIP712CancelOrdersParams;\n cancel_product_orders: EIP712CancelProductOrdersParams;\n leaderboard_authentication: EIP712LeaderboardAuthenticationParams;\n link_signer: EIP712LinkSignerParams;\n liquidate_subaccount: EIP712LiquidateSubaccountParams;\n list_trigger_orders: EIP712ListTriggerOrdersParams;\n mint_nlp: EIP712MintNlpParams;\n place_order: EIP712OrderParams;\n social_authentication: EIP712SocialAuthenticationParams;\n transfer_quote: EIP712TransferQuoteParams;\n withdraw_collateral: EIP712WithdrawCollateralParams;\n}\n\nexport type SignableRequestType = keyof SignableRequestTypeToParams;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,4 +1,4 @@
1
- import { EIP712BurnNlpParams, EIP712CancelOrdersParams, EIP712CancelProductOrdersParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712OrderParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams } from './signatureParamTypes.cjs';
1
+ import { EIP712BurnNlpParams, EIP712CancelOrdersParams, EIP712CancelProductOrdersParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712OrderParams, EIP712SocialAuthenticationParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams } from './signatureParamTypes.cjs';
2
2
  import 'viem';
3
3
  import '../types/subaccountTypes.cjs';
4
4
  import '../types/bytes.cjs';
@@ -18,6 +18,7 @@ interface SignableRequestTypeToParams {
18
18
  list_trigger_orders: EIP712ListTriggerOrdersParams;
19
19
  mint_nlp: EIP712MintNlpParams;
20
20
  place_order: EIP712OrderParams;
21
+ social_authentication: EIP712SocialAuthenticationParams;
21
22
  transfer_quote: EIP712TransferQuoteParams;
22
23
  withdraw_collateral: EIP712WithdrawCollateralParams;
23
24
  }
@@ -1,4 +1,4 @@
1
- import { EIP712BurnNlpParams, EIP712CancelOrdersParams, EIP712CancelProductOrdersParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712OrderParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams } from './signatureParamTypes.js';
1
+ import { EIP712BurnNlpParams, EIP712CancelOrdersParams, EIP712CancelProductOrdersParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712OrderParams, EIP712SocialAuthenticationParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams } from './signatureParamTypes.js';
2
2
  import 'viem';
3
3
  import '../types/subaccountTypes.js';
4
4
  import '../types/bytes.js';
@@ -18,6 +18,7 @@ interface SignableRequestTypeToParams {
18
18
  list_trigger_orders: EIP712ListTriggerOrdersParams;
19
19
  mint_nlp: EIP712MintNlpParams;
20
20
  place_order: EIP712OrderParams;
21
+ social_authentication: EIP712SocialAuthenticationParams;
21
22
  transfer_quote: EIP712TransferQuoteParams;
22
23
  withdraw_collateral: EIP712WithdrawCollateralParams;
23
24
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/eip712/signatureParamTypes.ts"],"sourcesContent":["import { Address } from 'viem';\nimport { Subaccount } from '../types/subaccountTypes';\nimport { BigNumberish } from '../utils';\n\nexport interface SignedTx<TBaseTx> {\n tx: TBaseTx;\n signature: string;\n}\n\nexport interface SignedEIP712OrderParams {\n order: EIP712OrderParams;\n signature: string;\n}\n\nexport interface EIP712WithdrawCollateralParams extends Subaccount {\n productId: number;\n amount: BigNumberish;\n nonce: string;\n}\n\nexport interface EIP712LiquidateSubaccountParams extends Subaccount {\n // Subaccount being liquidated\n liquidateeOwner: string;\n liquidateeName: string;\n // 0 = spread, 1 = long, 2 = short\n mode: number;\n // Spot & perp pair\n healthGroup: BigNumberish;\n amount: BigNumberish;\n nonce: string;\n}\n\nexport interface EIP712OrderParams extends Subaccount {\n // Expiration time in seconds, with order type encoded if relevant\n expiration: BigNumberish;\n // Limit price\n price: BigNumberish;\n // Positive for buy, negative for sell\n amount: BigNumberish;\n // A unique nonce to identify the order\n nonce: string;\n // Packed order appendix (uint128) to encode order details such as order execution behavior, isolated, etc.\n appendix: BigNumberish;\n}\n\nexport interface EIP712ListTriggerOrdersParams extends Subaccount {\n recvTime: BigNumberish;\n}\n\nexport interface EIP712CancelOrdersParams extends Subaccount {\n productIds: number[];\n digests: string[];\n nonce: string;\n}\n\nexport interface EIP712CancelProductOrdersParams extends Subaccount {\n productIds: number[];\n nonce: string;\n}\n\nexport interface EIP712LinkSignerParams extends Subaccount {\n signer: Address;\n nonce: string;\n}\n\nexport interface EIP712TransferQuoteParams extends Subaccount {\n recipientSubaccountName: string;\n amount: BigNumberish;\n nonce: string;\n}\n\nexport interface EIP712LeaderboardAuthenticationParams extends Subaccount {\n expiration: BigNumberish;\n}\n\nexport interface EIP712MintNlpParams extends Subaccount {\n quoteAmount: BigNumberish;\n nonce: string;\n}\n\nexport interface EIP712BurnNlpParams extends Subaccount {\n nlpAmount: BigNumberish;\n nonce: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/eip712/signatureParamTypes.ts"],"sourcesContent":["import { Address } from 'viem';\nimport { Subaccount } from '../types/subaccountTypes';\nimport { BigNumberish } from '../utils';\n\nexport interface SignedTx<TBaseTx> {\n tx: TBaseTx;\n signature: string;\n}\n\nexport interface SignedEIP712OrderParams {\n order: EIP712OrderParams;\n signature: string;\n}\n\nexport interface EIP712WithdrawCollateralParams extends Subaccount {\n productId: number;\n amount: BigNumberish;\n nonce: string;\n}\n\nexport interface EIP712LiquidateSubaccountParams extends Subaccount {\n // Subaccount being liquidated\n liquidateeOwner: string;\n liquidateeName: string;\n // 0 = spread, 1 = long, 2 = short\n mode: number;\n // Spot & perp pair\n healthGroup: BigNumberish;\n amount: BigNumberish;\n nonce: string;\n}\n\nexport interface EIP712OrderParams extends Subaccount {\n // Expiration time in seconds, with order type encoded if relevant\n expiration: BigNumberish;\n // Limit price\n price: BigNumberish;\n // Positive for buy, negative for sell\n amount: BigNumberish;\n // A unique nonce to identify the order\n nonce: string;\n // Packed order appendix (uint128) to encode order details such as order execution behavior, isolated, etc.\n appendix: BigNumberish;\n}\n\nexport interface EIP712ListTriggerOrdersParams extends Subaccount {\n recvTime: BigNumberish;\n}\n\nexport interface EIP712CancelOrdersParams extends Subaccount {\n productIds: number[];\n digests: string[];\n nonce: string;\n}\n\nexport interface EIP712CancelProductOrdersParams extends Subaccount {\n productIds: number[];\n nonce: string;\n}\n\nexport interface EIP712LinkSignerParams extends Subaccount {\n signer: Address;\n nonce: string;\n}\n\nexport interface EIP712TransferQuoteParams extends Subaccount {\n recipientSubaccountName: string;\n amount: BigNumberish;\n nonce: string;\n}\n\nexport interface EIP712LeaderboardAuthenticationParams extends Subaccount {\n expiration: BigNumberish;\n contestIds: number[];\n}\n\nexport interface EIP712SocialAuthenticationParams extends Subaccount {\n expiration: BigNumberish;\n provider: 'twitter';\n}\n\nexport interface EIP712MintNlpParams extends Subaccount {\n quoteAmount: BigNumberish;\n nonce: string;\n}\n\nexport interface EIP712BurnNlpParams extends Subaccount {\n nlpAmount: BigNumberish;\n nonce: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -55,6 +55,11 @@ interface EIP712TransferQuoteParams extends Subaccount {
55
55
  }
56
56
  interface EIP712LeaderboardAuthenticationParams extends Subaccount {
57
57
  expiration: BigNumberish;
58
+ contestIds: number[];
59
+ }
60
+ interface EIP712SocialAuthenticationParams extends Subaccount {
61
+ expiration: BigNumberish;
62
+ provider: 'twitter';
58
63
  }
59
64
  interface EIP712MintNlpParams extends Subaccount {
60
65
  quoteAmount: BigNumberish;
@@ -65,4 +70,4 @@ interface EIP712BurnNlpParams extends Subaccount {
65
70
  nonce: string;
66
71
  }
67
72
 
68
- export type { EIP712BurnNlpParams, EIP712CancelOrdersParams, EIP712CancelProductOrdersParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712OrderParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams, SignedEIP712OrderParams, SignedTx };
73
+ export type { EIP712BurnNlpParams, EIP712CancelOrdersParams, EIP712CancelProductOrdersParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712OrderParams, EIP712SocialAuthenticationParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams, SignedEIP712OrderParams, SignedTx };
@@ -55,6 +55,11 @@ interface EIP712TransferQuoteParams extends Subaccount {
55
55
  }
56
56
  interface EIP712LeaderboardAuthenticationParams extends Subaccount {
57
57
  expiration: BigNumberish;
58
+ contestIds: number[];
59
+ }
60
+ interface EIP712SocialAuthenticationParams extends Subaccount {
61
+ expiration: BigNumberish;
62
+ provider: 'twitter';
58
63
  }
59
64
  interface EIP712MintNlpParams extends Subaccount {
60
65
  quoteAmount: BigNumberish;
@@ -65,4 +70,4 @@ interface EIP712BurnNlpParams extends Subaccount {
65
70
  nonce: string;
66
71
  }
67
72
 
68
- export type { EIP712BurnNlpParams, EIP712CancelOrdersParams, EIP712CancelProductOrdersParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712OrderParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams, SignedEIP712OrderParams, SignedTx };
73
+ export type { EIP712BurnNlpParams, EIP712CancelOrdersParams, EIP712CancelProductOrdersParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712OrderParams, EIP712SocialAuthenticationParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams, SignedEIP712OrderParams, SignedTx };
package/dist/index.d.cts CHANGED
@@ -10,7 +10,7 @@ export { WITHDRAW_POOL_ABI } from './abis/WithdrawPool.cjs';
10
10
  export { CHAIN_ENV_TO_CHAIN, CHAIN_ID_TO_CHAIN_ENV } from './consts/chainEnvToChain.cjs';
11
11
  export { NLP_PRODUCT_ID, QUOTE_PRODUCT_ID } from './consts/productIds.cjs';
12
12
  export { NADO_DEPLOYMENTS, NadoDeploymentAddresses } from './deployments/index.cjs';
13
- export { EIP712BurnNlpValues, EIP712LeaderboardAuthenticationValues, EIP712LinkSignerValues, EIP712LiquidateSubaccountValues, EIP712ListTriggerOrdersValues, EIP712MintNlpValues, EIP712OrderCancellationValues, EIP712OrderValues, EIP712ProductOrdersCancellationValues, EIP712TransferQuoteValues, EIP712WithdrawCollateralValues, SignableRequestTypeToEIP712Values } from './eip712/eip712ValueTypes.cjs';
13
+ export { EIP712BurnNlpValues, EIP712LeaderboardAuthenticationValues, EIP712LinkSignerValues, EIP712LiquidateSubaccountValues, EIP712ListTriggerOrdersValues, EIP712MintNlpValues, EIP712OrderCancellationValues, EIP712OrderValues, EIP712ProductOrdersCancellationValues, EIP712SocialAuthenticationValues, EIP712TransferQuoteValues, EIP712WithdrawCollateralValues, SignableRequestTypeToEIP712Values } from './eip712/eip712ValueTypes.cjs';
14
14
  export { getNadoEIP712Domain } from './eip712/getNadoEIP712Domain.cjs';
15
15
  export { getNadoEIP712PrimaryType } from './eip712/getNadoEIP712PrimaryType.cjs';
16
16
  export { getNadoEIP712Types } from './eip712/getNadoEIP712Types.cjs';
@@ -19,7 +19,7 @@ export { getOrderVerifyingAddress } from './eip712/getOrderVerifyingAddress.cjs'
19
19
  export { getSignedTransactionRequest } from './eip712/getSignedTransactionRequest.cjs';
20
20
  export { getOrderDigest } from './eip712/orderDigest.cjs';
21
21
  export { SignableRequestType, SignableRequestTypeToParams } from './eip712/signableRequestType.cjs';
22
- export { EIP712BurnNlpParams, EIP712CancelOrdersParams, EIP712CancelProductOrdersParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712OrderParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams, SignedEIP712OrderParams, SignedTx } from './eip712/signatureParamTypes.cjs';
22
+ export { EIP712BurnNlpParams, EIP712CancelOrdersParams, EIP712CancelProductOrdersParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712OrderParams, EIP712SocialAuthenticationParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams, SignedEIP712OrderParams, SignedTx } from './eip712/signatureParamTypes.cjs';
23
23
  export { ClaimBuilderFeeParams, SlowModeTxType, encodeClaimBuilderFeeTx, encodeSignedOrder, encodeSignedWithdrawCollateralTx } from './encoding/encoding.cjs';
24
24
  export { ApproveDepositAllowanceParams, approveDepositAllowance } from './execute/approveDepositAllowance.cjs';
25
25
  export { DepositCollateralParams, depositCollateral } from './execute/depositCollateral.cjs';
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ export { WITHDRAW_POOL_ABI } from './abis/WithdrawPool.js';
10
10
  export { CHAIN_ENV_TO_CHAIN, CHAIN_ID_TO_CHAIN_ENV } from './consts/chainEnvToChain.js';
11
11
  export { NLP_PRODUCT_ID, QUOTE_PRODUCT_ID } from './consts/productIds.js';
12
12
  export { NADO_DEPLOYMENTS, NadoDeploymentAddresses } from './deployments/index.js';
13
- export { EIP712BurnNlpValues, EIP712LeaderboardAuthenticationValues, EIP712LinkSignerValues, EIP712LiquidateSubaccountValues, EIP712ListTriggerOrdersValues, EIP712MintNlpValues, EIP712OrderCancellationValues, EIP712OrderValues, EIP712ProductOrdersCancellationValues, EIP712TransferQuoteValues, EIP712WithdrawCollateralValues, SignableRequestTypeToEIP712Values } from './eip712/eip712ValueTypes.js';
13
+ export { EIP712BurnNlpValues, EIP712LeaderboardAuthenticationValues, EIP712LinkSignerValues, EIP712LiquidateSubaccountValues, EIP712ListTriggerOrdersValues, EIP712MintNlpValues, EIP712OrderCancellationValues, EIP712OrderValues, EIP712ProductOrdersCancellationValues, EIP712SocialAuthenticationValues, EIP712TransferQuoteValues, EIP712WithdrawCollateralValues, SignableRequestTypeToEIP712Values } from './eip712/eip712ValueTypes.js';
14
14
  export { getNadoEIP712Domain } from './eip712/getNadoEIP712Domain.js';
15
15
  export { getNadoEIP712PrimaryType } from './eip712/getNadoEIP712PrimaryType.js';
16
16
  export { getNadoEIP712Types } from './eip712/getNadoEIP712Types.js';
@@ -19,7 +19,7 @@ export { getOrderVerifyingAddress } from './eip712/getOrderVerifyingAddress.js';
19
19
  export { getSignedTransactionRequest } from './eip712/getSignedTransactionRequest.js';
20
20
  export { getOrderDigest } from './eip712/orderDigest.js';
21
21
  export { SignableRequestType, SignableRequestTypeToParams } from './eip712/signableRequestType.js';
22
- export { EIP712BurnNlpParams, EIP712CancelOrdersParams, EIP712CancelProductOrdersParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712OrderParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams, SignedEIP712OrderParams, SignedTx } from './eip712/signatureParamTypes.js';
22
+ export { EIP712BurnNlpParams, EIP712CancelOrdersParams, EIP712CancelProductOrdersParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712OrderParams, EIP712SocialAuthenticationParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams, SignedEIP712OrderParams, SignedTx } from './eip712/signatureParamTypes.js';
23
23
  export { ClaimBuilderFeeParams, SlowModeTxType, encodeClaimBuilderFeeTx, encodeSignedOrder, encodeSignedWithdrawCollateralTx } from './encoding/encoding.js';
24
24
  export { ApproveDepositAllowanceParams, approveDepositAllowance } from './execute/approveDepositAllowance.js';
25
25
  export { DepositCollateralParams, depositCollateral } from './execute/depositCollateral.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/mapValues.ts"],"sourcesContent":["/**\n * Map values of an object given mapFn. Avoids needing to pull in lodash\n */\nexport function mapValues<\n TKey extends string | number | symbol,\n TValue,\n TNewValue,\n>(\n obj: Record<TKey, TValue>,\n mapFn: (value: TValue, key: TKey, index: number) => TNewValue,\n): Record<TKey, TNewValue> {\n return Object.fromEntries(\n Object.entries(obj).map(([key, value], index) => [\n key,\n mapFn(value as TValue, key as TKey, index),\n ]),\n ) as Record<TKey, TNewValue>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,SAAS,UAKd,KACA,OACyB;AACzB,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,GAAG,UAAU;AAAA,MAC/C;AAAA,MACA,MAAM,OAAiB,KAAa,KAAK;AAAA,IAC3C,CAAC;AAAA,EACH;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/mapValues.ts"],"sourcesContent":["/**\n * Map values of an object given mapFn. Avoids needing to pull in lodash\n */\nexport function mapValues<\n TKey extends string | number | symbol,\n TValue,\n TNewValue,\n>(\n obj: Record<TKey, TValue>,\n mapFn: (value: TValue, key: TKey, index: number) => TNewValue,\n): Record<TKey, TNewValue>;\nexport function mapValues<\n TKey extends string | number | symbol,\n TValue,\n TNewValue,\n>(\n obj: Partial<Record<TKey, TValue>>,\n mapFn: (value: TValue, key: TKey, index: number) => TNewValue,\n): Partial<Record<TKey, TNewValue>>;\nexport function mapValues<\n TKey extends string | number | symbol,\n TValue,\n TNewValue,\n>(\n obj: Record<TKey, TValue>,\n mapFn: (value: TValue, key: TKey, index: number) => TNewValue,\n): Record<TKey, TNewValue> {\n return Object.fromEntries(\n Object.entries(obj).map(([key, value], index) => [\n key,\n mapFn(value as TValue, key as TKey, index),\n ]),\n ) as Record<TKey, TNewValue>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBO,SAAS,UAKd,KACA,OACyB;AACzB,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,GAAG,UAAU;AAAA,MAC/C;AAAA,MACA,MAAM,OAAiB,KAAa,KAAK;AAAA,IAC3C,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -2,5 +2,6 @@
2
2
  * Map values of an object given mapFn. Avoids needing to pull in lodash
3
3
  */
4
4
  declare function mapValues<TKey extends string | number | symbol, TValue, TNewValue>(obj: Record<TKey, TValue>, mapFn: (value: TValue, key: TKey, index: number) => TNewValue): Record<TKey, TNewValue>;
5
+ declare function mapValues<TKey extends string | number | symbol, TValue, TNewValue>(obj: Partial<Record<TKey, TValue>>, mapFn: (value: TValue, key: TKey, index: number) => TNewValue): Partial<Record<TKey, TNewValue>>;
5
6
 
6
7
  export { mapValues };
@@ -2,5 +2,6 @@
2
2
  * Map values of an object given mapFn. Avoids needing to pull in lodash
3
3
  */
4
4
  declare function mapValues<TKey extends string | number | symbol, TValue, TNewValue>(obj: Record<TKey, TValue>, mapFn: (value: TValue, key: TKey, index: number) => TNewValue): Record<TKey, TNewValue>;
5
+ declare function mapValues<TKey extends string | number | symbol, TValue, TNewValue>(obj: Partial<Record<TKey, TValue>>, mapFn: (value: TValue, key: TKey, index: number) => TNewValue): Partial<Record<TKey, TNewValue>>;
5
6
 
6
7
  export { mapValues };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/mapValues.ts"],"sourcesContent":["/**\n * Map values of an object given mapFn. Avoids needing to pull in lodash\n */\nexport function mapValues<\n TKey extends string | number | symbol,\n TValue,\n TNewValue,\n>(\n obj: Record<TKey, TValue>,\n mapFn: (value: TValue, key: TKey, index: number) => TNewValue,\n): Record<TKey, TNewValue> {\n return Object.fromEntries(\n Object.entries(obj).map(([key, value], index) => [\n key,\n mapFn(value as TValue, key as TKey, index),\n ]),\n ) as Record<TKey, TNewValue>;\n}\n"],"mappings":";;;AAGO,SAAS,UAKd,KACA,OACyB;AACzB,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,GAAG,UAAU;AAAA,MAC/C;AAAA,MACA,MAAM,OAAiB,KAAa,KAAK;AAAA,IAC3C,CAAC;AAAA,EACH;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/mapValues.ts"],"sourcesContent":["/**\n * Map values of an object given mapFn. Avoids needing to pull in lodash\n */\nexport function mapValues<\n TKey extends string | number | symbol,\n TValue,\n TNewValue,\n>(\n obj: Record<TKey, TValue>,\n mapFn: (value: TValue, key: TKey, index: number) => TNewValue,\n): Record<TKey, TNewValue>;\nexport function mapValues<\n TKey extends string | number | symbol,\n TValue,\n TNewValue,\n>(\n obj: Partial<Record<TKey, TValue>>,\n mapFn: (value: TValue, key: TKey, index: number) => TNewValue,\n): Partial<Record<TKey, TNewValue>>;\nexport function mapValues<\n TKey extends string | number | symbol,\n TValue,\n TNewValue,\n>(\n obj: Record<TKey, TValue>,\n mapFn: (value: TValue, key: TKey, index: number) => TNewValue,\n): Record<TKey, TNewValue> {\n return Object.fromEntries(\n Object.entries(obj).map(([key, value], index) => [\n key,\n mapFn(value as TValue, key as TKey, index),\n ]),\n ) as Record<TKey, TNewValue>;\n}\n"],"mappings":";;;AAmBO,SAAS,UAKd,KACA,OACyB;AACzB,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,GAAG,UAAU;AAAA,MAC/C;AAAA,MACA,MAAM,OAAiB,KAAa,KAAK;AAAA,IAC3C,CAAC;AAAA,EACH;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nadohq/shared",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Shared utilities, types, and contract helpers for Nado SDK",
@@ -52,5 +52,5 @@
52
52
  "bignumber.js": "*",
53
53
  "viem": "workspace:*"
54
54
  },
55
- "gitHead": "1ddd5c3e543913867665b7fe00b16cbaa9fc0b9f"
55
+ "gitHead": "1c5358e0dc2728f74ad86d85fe27f0218c0d655e"
56
56
  }
@@ -10,6 +10,7 @@ import {
10
10
  EIP712ListTriggerOrdersParams,
11
11
  EIP712MintNlpParams,
12
12
  EIP712OrderParams,
13
+ EIP712SocialAuthenticationParams,
13
14
  EIP712TransferQuoteParams,
14
15
  EIP712WithdrawCollateralParams,
15
16
  } from './signatureParamTypes';
@@ -61,6 +62,9 @@ export type EIP712TransferQuoteValues = Omit<
61
62
  export type EIP712LeaderboardAuthenticationValues =
62
63
  WithEIP712Sender<EIP712LeaderboardAuthenticationParams>;
63
64
 
65
+ export type EIP712SocialAuthenticationValues =
66
+ WithEIP712Sender<EIP712SocialAuthenticationParams>;
67
+
64
68
  export type EIP712MintNlpValues = WithEIP712Sender<EIP712MintNlpParams>;
65
69
 
66
70
  export type EIP712BurnNlpValues = WithEIP712Sender<EIP712BurnNlpParams>;
@@ -78,6 +82,7 @@ export interface SignableRequestTypeToEIP712Values {
78
82
  list_trigger_orders: EIP712ListTriggerOrdersValues;
79
83
  mint_nlp: EIP712MintNlpValues;
80
84
  place_order: EIP712OrderValues;
85
+ social_authentication: EIP712SocialAuthenticationValues;
81
86
  transfer_quote: EIP712TransferQuoteValues;
82
87
  withdraw_collateral: EIP712WithdrawCollateralValues;
83
88
  }
@@ -91,6 +91,15 @@ export function getNadoEIP712Types(
91
91
  LeaderboardAuthentication: [
92
92
  { name: 'sender', type: 'bytes32' },
93
93
  { name: 'expiration', type: 'uint64' },
94
+ { name: 'contestIds', type: 'uint32[]' },
95
+ ],
96
+ };
97
+ case 'social_authentication':
98
+ return {
99
+ SocialAuthentication: [
100
+ { name: 'sender', type: 'bytes32' },
101
+ { name: 'expiration', type: 'uint64' },
102
+ { name: 'provider', type: 'string' },
94
103
  ],
95
104
  };
96
105
  case 'mint_nlp':
@@ -10,6 +10,7 @@ import {
10
10
  EIP712OrderCancellationValues,
11
11
  EIP712OrderValues,
12
12
  EIP712ProductOrdersCancellationValues,
13
+ EIP712SocialAuthenticationValues,
13
14
  EIP712TransferQuoteValues,
14
15
  EIP712WithdrawCollateralValues,
15
16
  SignableRequestTypeToEIP712Values,
@@ -28,6 +29,7 @@ import {
28
29
  EIP712ListTriggerOrdersParams,
29
30
  EIP712MintNlpParams,
30
31
  EIP712OrderParams,
32
+ EIP712SocialAuthenticationParams,
31
33
  EIP712TransferQuoteParams,
32
34
  EIP712WithdrawCollateralParams,
33
35
  } from './signatureParamTypes';
@@ -84,6 +86,11 @@ export function getNadoEIP712Values<TReqType extends SignableRequestType>(
84
86
  params as EIP712LeaderboardAuthenticationParams,
85
87
  );
86
88
  break;
89
+ case 'social_authentication':
90
+ values = getSocialAuthenticationValues(
91
+ params as EIP712SocialAuthenticationParams,
92
+ );
93
+ break;
87
94
  case 'mint_nlp':
88
95
  values = getMintNlpValues(params as EIP712MintNlpParams);
89
96
  break;
@@ -222,6 +229,20 @@ function getLeaderboardAuthenticationValues(
222
229
  subaccountName: params.subaccountName,
223
230
  }),
224
231
  expiration: toIntegerString(params.expiration),
232
+ contestIds: params.contestIds,
233
+ };
234
+ }
235
+
236
+ function getSocialAuthenticationValues(
237
+ params: EIP712SocialAuthenticationParams,
238
+ ): EIP712SocialAuthenticationValues {
239
+ return {
240
+ sender: subaccountToHex({
241
+ subaccountOwner: params.subaccountOwner,
242
+ subaccountName: params.subaccountName,
243
+ }),
244
+ expiration: toIntegerString(params.expiration),
245
+ provider: params.provider,
225
246
  };
226
247
  }
227
248
 
@@ -8,6 +8,7 @@ import {
8
8
  EIP712ListTriggerOrdersParams,
9
9
  EIP712MintNlpParams,
10
10
  EIP712OrderParams,
11
+ EIP712SocialAuthenticationParams,
11
12
  EIP712TransferQuoteParams,
12
13
  EIP712WithdrawCollateralParams,
13
14
  } from './signatureParamTypes';
@@ -25,6 +26,7 @@ export interface SignableRequestTypeToParams {
25
26
  list_trigger_orders: EIP712ListTriggerOrdersParams;
26
27
  mint_nlp: EIP712MintNlpParams;
27
28
  place_order: EIP712OrderParams;
29
+ social_authentication: EIP712SocialAuthenticationParams;
28
30
  transfer_quote: EIP712TransferQuoteParams;
29
31
  withdraw_collateral: EIP712WithdrawCollateralParams;
30
32
  }
@@ -71,6 +71,12 @@ export interface EIP712TransferQuoteParams extends Subaccount {
71
71
 
72
72
  export interface EIP712LeaderboardAuthenticationParams extends Subaccount {
73
73
  expiration: BigNumberish;
74
+ contestIds: number[];
75
+ }
76
+
77
+ export interface EIP712SocialAuthenticationParams extends Subaccount {
78
+ expiration: BigNumberish;
79
+ provider: 'twitter';
74
80
  }
75
81
 
76
82
  export interface EIP712MintNlpParams extends Subaccount {
@@ -1,6 +1,22 @@
1
1
  /**
2
2
  * Map values of an object given mapFn. Avoids needing to pull in lodash
3
3
  */
4
+ export function mapValues<
5
+ TKey extends string | number | symbol,
6
+ TValue,
7
+ TNewValue,
8
+ >(
9
+ obj: Record<TKey, TValue>,
10
+ mapFn: (value: TValue, key: TKey, index: number) => TNewValue,
11
+ ): Record<TKey, TNewValue>;
12
+ export function mapValues<
13
+ TKey extends string | number | symbol,
14
+ TValue,
15
+ TNewValue,
16
+ >(
17
+ obj: Partial<Record<TKey, TValue>>,
18
+ mapFn: (value: TValue, key: TKey, index: number) => TNewValue,
19
+ ): Partial<Record<TKey, TNewValue>>;
4
20
  export function mapValues<
5
21
  TKey extends string | number | symbol,
6
22
  TValue,