@@ -79,7 +79,7 @@ export type DelegateSignerResponse = {
79
79
valid_signer : string ;
80
80
} ;
81
81
82
- export async function registerDelegateSigner (
82
+ export async function registerExampleDelegateSigner (
83
83
wallet : WalletState ,
84
84
brokerId : string ,
85
85
chainId : string ,
@@ -99,14 +99,15 @@ export async function announceDelegateSigner(
99
99
wallet : WalletState ,
100
100
chainId : string ,
101
101
brokerId : string ,
102
+ delegateContract : string ,
102
103
txHash : ethers . BytesLike
103
104
) : Promise < DelegateSignerResponse > {
104
105
const nonceRes = await fetch ( `${ getBaseUrl ( chainId ) } /v1/registration_nonce` ) ;
105
106
const nonceJson = await nonceRes . json ( ) ;
106
107
const registrationNonce = nonceJson . data . registration_nonce as string ;
107
108
108
109
const delegateSignerMessage = {
109
- delegateContract : exampleDelegateContract ,
110
+ delegateContract,
110
111
brokerId,
111
112
chainId : Number ( chainId ) ,
112
113
timestamp : Date . now ( ) ,
@@ -144,13 +145,14 @@ export async function delegateAddOrderlyKey(
144
145
wallet : WalletState ,
145
146
chainId : string ,
146
147
brokerId : string ,
148
+ delegateContract : string ,
147
149
accountId : string
148
150
) : Promise < Uint8Array > {
149
151
const privateKey = utils . randomPrivateKey ( ) ;
150
152
const orderlyKey = `ed25519:${ encodeBase58 ( await getPublicKeyAsync ( privateKey ) ) } ` ;
151
153
const timestamp = Date . now ( ) ;
152
154
const addKeyMessage = {
153
- delegateContract : exampleDelegateContract ,
155
+ delegateContract,
154
156
brokerId,
155
157
chainId : Number ( chainId ) ,
156
158
orderlyKey,
@@ -193,6 +195,7 @@ export async function delegateDeposit(
193
195
wallet : WalletState ,
194
196
chainId : string ,
195
197
brokerId : string ,
198
+ delegateContract : string ,
196
199
amount : string ,
197
200
contractAddress : string ,
198
201
accountId : string
@@ -209,13 +212,14 @@ export async function delegateDeposit(
209
212
} satisfies VaultTypes . VaultDepositFEStruct ;
210
213
const depositFee = await contract . getDepositFee ( contractAddress , depositInput ) ;
211
214
212
- await contract . depositTo ( exampleDelegateContract , depositInput , { value : depositFee } ) ;
215
+ await contract . depositTo ( delegateContract , depositInput , { value : depositFee } ) ;
213
216
}
214
217
215
218
export async function delegateWithdraw (
216
219
wallet : WalletState ,
217
220
chainId : string ,
218
221
brokerId : string ,
222
+ delegateContract : string ,
219
223
accountId : string ,
220
224
orderlyKey : Uint8Array ,
221
225
amount : string ,
@@ -230,7 +234,7 @@ export async function delegateWithdraw(
230
234
const withdrawNonce = nonceJson . data . withdraw_nonce as string ;
231
235
232
236
const delegateWithdrawMessage = {
233
- delegateContract : exampleDelegateContract ,
237
+ delegateContract,
234
238
brokerId,
235
239
chainId : Number ( chainId ) ,
236
240
receiver,
@@ -272,6 +276,7 @@ export async function delegateSettlePnL(
272
276
wallet : WalletState ,
273
277
chainId : string ,
274
278
brokerId : string ,
279
+ delegateContract : string ,
275
280
accountId : string ,
276
281
orderlyKey : Uint8Array
277
282
) : Promise < void > {
@@ -284,7 +289,7 @@ export async function delegateSettlePnL(
284
289
const settleNonce = nonceJson . data . settle_nonce as string ;
285
290
286
291
const delegateSettlePnLMessage = {
287
- delegateContract : exampleDelegateContract ,
292
+ delegateContract,
288
293
brokerId,
289
294
chainId : Number ( chainId ) ,
290
295
timestamp : Date . now ( ) ,
0 commit comments