@nadohq/shared 0.7.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.
- package/dist/eip712/eip712ValueTypes.cjs.map +1 -1
- package/dist/eip712/eip712ValueTypes.d.cts +4 -2
- package/dist/eip712/eip712ValueTypes.d.ts +4 -2
- package/dist/eip712/getNadoEIP712Types.cjs +8 -0
- package/dist/eip712/getNadoEIP712Types.cjs.map +1 -1
- package/dist/eip712/getNadoEIP712Types.js +8 -0
- package/dist/eip712/getNadoEIP712Types.js.map +1 -1
- package/dist/eip712/getNadoEIP712Values.cjs +15 -0
- package/dist/eip712/getNadoEIP712Values.cjs.map +1 -1
- package/dist/eip712/getNadoEIP712Values.js +15 -0
- package/dist/eip712/getNadoEIP712Values.js.map +1 -1
- package/dist/eip712/index.d.cts +2 -2
- package/dist/eip712/index.d.ts +2 -2
- package/dist/eip712/signableRequestType.cjs.map +1 -1
- package/dist/eip712/signableRequestType.d.cts +2 -1
- package/dist/eip712/signableRequestType.d.ts +2 -1
- package/dist/eip712/signatureParamTypes.cjs.map +1 -1
- package/dist/eip712/signatureParamTypes.d.cts +5 -1
- package/dist/eip712/signatureParamTypes.d.ts +5 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/package.json +2 -2
- package/src/eip712/eip712ValueTypes.ts +5 -0
- package/src/eip712/getNadoEIP712Types.ts +8 -0
- package/src/eip712/getNadoEIP712Values.ts +20 -0
- package/src/eip712/signableRequestType.ts +2 -0
- package/src/eip712/signatureParamTypes.ts +5 -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 };
|
|
@@ -105,6 +105,14 @@ function getNadoEIP712Types(requestType) {
|
|
|
105
105
|
{ name: "contestIds", type: "uint32[]" }
|
|
106
106
|
]
|
|
107
107
|
};
|
|
108
|
+
case "social_authentication":
|
|
109
|
+
return {
|
|
110
|
+
SocialAuthentication: [
|
|
111
|
+
{ name: "sender", type: "bytes32" },
|
|
112
|
+
{ name: "expiration", type: "uint64" },
|
|
113
|
+
{ name: "provider", type: "string" }
|
|
114
|
+
]
|
|
115
|
+
};
|
|
108
116
|
case "mint_nlp":
|
|
109
117
|
return {
|
|
110
118
|
MintNlp: [
|
|
@@ -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 { name: 'contestIds', type: 'uint32[]' },\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,MA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AA,IACF,KAAK;AACH,aAAO;AAAA,QACL,2BAA2B;AAAA,UACzB,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,cAAc,MAAM,SAAS;AAAA,UACrC,EAAE,MAAM,cAAc,MAAM,WAAW;AAAA,QACzC;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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA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Ae,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":[]}
|
|
@@ -83,6 +83,14 @@ function getNadoEIP712Types(requestType) {
|
|
|
83
83
|
{ name: "contestIds", type: "uint32[]" }
|
|
84
84
|
]
|
|
85
85
|
};
|
|
86
|
+
case "social_authentication":
|
|
87
|
+
return {
|
|
88
|
+
SocialAuthentication: [
|
|
89
|
+
{ name: "sender", type: "bytes32" },
|
|
90
|
+
{ name: "expiration", type: "uint64" },
|
|
91
|
+
{ name: "provider", type: "string" }
|
|
92
|
+
]
|
|
93
|
+
};
|
|
86
94
|
case "mint_nlp":
|
|
87
95
|
return {
|
|
88
96
|
MintNlp: [
|
|
@@ -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 { name: 'contestIds', type: 'uint32[]' },\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,KAA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AAA,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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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,2BAA2B;AAAA,UACzB,EAAE,MAAM,UAAU,MAAM,UAAU;AAAA,UAClC,EAAE,MAAM,cAAc,MAAM,SAAS;AAAA,UACrC,EAAE,MAAM,cAAc,MAAM,WAAW;AAAA,QACzC;AAAA,MACF;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,sBAAsB;AAAA,UACpB,EAAE,MAAM,UAAU,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;
|
|
@@ -180,6 +185,16 @@ function getLeaderboardAuthenticationValues(params) {
|
|
|
180
185
|
contestIds: params.contestIds
|
|
181
186
|
};
|
|
182
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
|
|
196
|
+
};
|
|
197
|
+
}
|
|
183
198
|
function getMintNlpValues(params) {
|
|
184
199
|
return {
|
|
185
200
|
sender: (0, import_bytes32.subaccountToHex)({
|
|
@@ -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 contestIds: params.contestIds,\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,I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AAgB,OAAO,UAAU;AAAA,IAC7C,YAAY,OAAO;AAAA,EACrB;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":[]}
|
|
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 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;A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|
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;
|
|
@@ -158,6 +163,16 @@ function getLeaderboardAuthenticationValues(params) {
|
|
|
158
163
|
contestIds: params.contestIds
|
|
159
164
|
};
|
|
160
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
|
|
174
|
+
};
|
|
175
|
+
}
|
|
161
176
|
function getMintNlpValues(params) {
|
|
162
177
|
return {
|
|
163
178
|
sender: subaccountToHex({
|
|
@@ -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 contestIds: params.contestIds,\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;AAC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A,IACrC,OAAO,OAAO;AAAA,EAChB;AACF;AAEA,SAAS,mCACP,QACuC;AACvC,SAAO;AAAA,IACL,QAAQ,gBAAgB;AAAA,MACtB,iBAAiB,OAAO;AAAA,MACxB,gBAAgB,OAAO;AAAA,IACzB,CAAC;AAAA,IACD,YAAY,gBAAgB,OAAO,UAAU;AAAA,IAC7C,YAAY,OAAO;AAAA,EACrB;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
|
+
{"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 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}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ACD,WAAW,gBAAgB,OAAO,SAAS;AAAA,IAC3C,OAAO,OAAO;AAAA,EAChB;AACF;","names":[]}
|
package/dist/eip712/index.d.cts
CHANGED
|
@@ -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';
|
package/dist/eip712/index.d.ts
CHANGED
|
@@ -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 contestIds: number[];\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":[]}
|
|
@@ -57,6 +57,10 @@ interface EIP712LeaderboardAuthenticationParams extends Subaccount {
|
|
|
57
57
|
expiration: BigNumberish;
|
|
58
58
|
contestIds: number[];
|
|
59
59
|
}
|
|
60
|
+
interface EIP712SocialAuthenticationParams extends Subaccount {
|
|
61
|
+
expiration: BigNumberish;
|
|
62
|
+
provider: 'twitter';
|
|
63
|
+
}
|
|
60
64
|
interface EIP712MintNlpParams extends Subaccount {
|
|
61
65
|
quoteAmount: BigNumberish;
|
|
62
66
|
nonce: string;
|
|
@@ -66,4 +70,4 @@ interface EIP712BurnNlpParams extends Subaccount {
|
|
|
66
70
|
nonce: string;
|
|
67
71
|
}
|
|
68
72
|
|
|
69
|
-
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 };
|
|
@@ -57,6 +57,10 @@ interface EIP712LeaderboardAuthenticationParams extends Subaccount {
|
|
|
57
57
|
expiration: BigNumberish;
|
|
58
58
|
contestIds: number[];
|
|
59
59
|
}
|
|
60
|
+
interface EIP712SocialAuthenticationParams extends Subaccount {
|
|
61
|
+
expiration: BigNumberish;
|
|
62
|
+
provider: 'twitter';
|
|
63
|
+
}
|
|
60
64
|
interface EIP712MintNlpParams extends Subaccount {
|
|
61
65
|
quoteAmount: BigNumberish;
|
|
62
66
|
nonce: string;
|
|
@@ -66,4 +70,4 @@ interface EIP712BurnNlpParams extends Subaccount {
|
|
|
66
70
|
nonce: string;
|
|
67
71
|
}
|
|
68
72
|
|
|
69
|
-
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';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nadohq/shared",
|
|
3
|
-
"version": "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": "
|
|
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
|
}
|
|
@@ -94,6 +94,14 @@ export function getNadoEIP712Types(
|
|
|
94
94
|
{ name: 'contestIds', type: 'uint32[]' },
|
|
95
95
|
],
|
|
96
96
|
};
|
|
97
|
+
case 'social_authentication':
|
|
98
|
+
return {
|
|
99
|
+
SocialAuthentication: [
|
|
100
|
+
{ name: 'sender', type: 'bytes32' },
|
|
101
|
+
{ name: 'expiration', type: 'uint64' },
|
|
102
|
+
{ name: 'provider', type: 'string' },
|
|
103
|
+
],
|
|
104
|
+
};
|
|
97
105
|
case 'mint_nlp':
|
|
98
106
|
return {
|
|
99
107
|
MintNlp: [
|
|
@@ -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;
|
|
@@ -226,6 +233,19 @@ function getLeaderboardAuthenticationValues(
|
|
|
226
233
|
};
|
|
227
234
|
}
|
|
228
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,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
|
|
229
249
|
function getMintNlpValues(params: EIP712MintNlpParams): EIP712MintNlpValues {
|
|
230
250
|
return {
|
|
231
251
|
sender: subaccountToHex({
|
|
@@ -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
|
}
|
|
@@ -74,6 +74,11 @@ export interface EIP712LeaderboardAuthenticationParams extends Subaccount {
|
|
|
74
74
|
contestIds: number[];
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
export interface EIP712SocialAuthenticationParams extends Subaccount {
|
|
78
|
+
expiration: BigNumberish;
|
|
79
|
+
provider: 'twitter';
|
|
80
|
+
}
|
|
81
|
+
|
|
77
82
|
export interface EIP712MintNlpParams extends Subaccount {
|
|
78
83
|
quoteAmount: BigNumberish;
|
|
79
84
|
nonce: string;
|