@audius/sdk 1.0.10 → 1.0.12
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/NativeAudiusLibs.d.ts +6 -3
- package/dist/api/Users.d.ts +1 -1
- package/dist/index.cjs.js +135 -35
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +135 -35
- package/dist/index.esm.js.map +1 -1
- package/dist/legacy.js +135 -35
- package/dist/legacy.js.map +1 -1
- package/dist/native-libs.js +313 -45
- package/dist/native-libs.js.map +1 -1
- package/dist/services/dataContracts/EntityManagerClient.d.ts +13 -2
- package/dist/services/wormhole/ProxyWormhole.d.ts +31 -0
- package/dist/services/wormhole/Wormhole.d.ts +1 -1
- package/dist/services/wormhole/index.d.ts +1 -0
- package/package.json +2 -2
- package/src/NativeAudiusLibs.ts +27 -4
- package/src/api/Users.ts +18 -6
- package/src/services/dataContracts/AudiusContracts.ts +4 -1
- package/src/services/dataContracts/EntityManagerClient.ts +71 -3
- package/src/services/wormhole/ProxyWormhole.ts +118 -0
- package/src/services/wormhole/Wormhole.ts +1 -1
- package/src/services/wormhole/index.ts +1 -0
|
@@ -4,7 +4,8 @@ import type { Web3Manager } from '../web3Manager';
|
|
|
4
4
|
export declare enum Action {
|
|
5
5
|
CREATE = "Create",
|
|
6
6
|
UPDATE = "Update",
|
|
7
|
-
DELETE = "Delete"
|
|
7
|
+
DELETE = "Delete",
|
|
8
|
+
VERIFY = "Verify"
|
|
8
9
|
}
|
|
9
10
|
export declare enum EntityType {
|
|
10
11
|
PLAYLIST = "Playlist",
|
|
@@ -19,7 +20,17 @@ export declare class EntityManagerClient extends ContractClient {
|
|
|
19
20
|
web3Manager: Web3Manager;
|
|
20
21
|
static Action: typeof Action;
|
|
21
22
|
static EntityType: typeof EntityType;
|
|
22
|
-
|
|
23
|
+
getManageEntityParams(userId: number, entityType: EntityType, entityId: number, action: Action, metadataMultihash: string, privateKey?: string): Promise<[string, string]>;
|
|
24
|
+
/**
|
|
25
|
+
* Calls the manage entity method on chain
|
|
26
|
+
* @param {number} userId The numeric user id
|
|
27
|
+
* @param {EntityType} entityType The type of entity being modified
|
|
28
|
+
* @param {number} entityId The id of the entity
|
|
29
|
+
* @param {Action} action Action being performed on the entity
|
|
30
|
+
* @param {string} metadataMultihash CID multihash or metadata associated with action
|
|
31
|
+
* @param {string}privateKey The private key used to sign the transaction
|
|
32
|
+
*/
|
|
33
|
+
manageEntity(userId: number, entityType: EntityType, entityId: number, action: Action, metadataMultihash: string, privateKey?: string): Promise<{
|
|
23
34
|
txReceipt: TransactionReceipt;
|
|
24
35
|
}>;
|
|
25
36
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="bn.js" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import type { Hedgehog } from '@audius/hedgehog';
|
|
4
|
+
import type { EthContracts } from '../ethContracts';
|
|
5
|
+
import type { EthWeb3Manager } from '../ethWeb3Manager';
|
|
6
|
+
import type { IdentityService } from '../identity';
|
|
7
|
+
import type { SolanaWeb3Manager } from '../solana';
|
|
8
|
+
import { BN } from 'ethereumjs-util';
|
|
9
|
+
import { Nullable } from '../../utils';
|
|
10
|
+
export declare type ProxyWormholeConfig = {};
|
|
11
|
+
/** Singleton state-manager for audius proxy wormhole interaction */
|
|
12
|
+
export declare class ProxyWormhole {
|
|
13
|
+
hedgehog: Nullable<Hedgehog>;
|
|
14
|
+
ethWeb3Manager: EthWeb3Manager;
|
|
15
|
+
ethContracts: EthContracts;
|
|
16
|
+
identityService: Nullable<IdentityService>;
|
|
17
|
+
solanaWeb3Manager: SolanaWeb3Manager;
|
|
18
|
+
constructor(hedgehog: Hedgehog | null, ethWeb3Manager: EthWeb3Manager, ethContracts: EthContracts, identityService: IdentityService | null, solanaWeb3Manager: SolanaWeb3Manager);
|
|
19
|
+
/**
|
|
20
|
+
* Locks assets owned by `fromAccount` into the Solana wormhole with a target
|
|
21
|
+
* solanaAccount destination via the provided relayer wallet.
|
|
22
|
+
*/
|
|
23
|
+
_getTransferTokensToEthWormholeParams(fromAccount: string, amount: BN, solanaAccount: string): Promise<{
|
|
24
|
+
chainId: number;
|
|
25
|
+
deadline: number;
|
|
26
|
+
recipient: Buffer;
|
|
27
|
+
arbiterFee: BN;
|
|
28
|
+
signedDigest: import("ethereumjs-util").ECDSASignature;
|
|
29
|
+
}>;
|
|
30
|
+
getTransferTokensToEthWormholeMethod(fromAccount: string, amount: BN, solanaAccount: string): Promise<any>;
|
|
31
|
+
}
|
|
@@ -17,7 +17,7 @@ export declare type WormholeConfig = {
|
|
|
17
17
|
ethBridgeAddress: string;
|
|
18
18
|
ethTokenBridgeAddress: string;
|
|
19
19
|
};
|
|
20
|
-
/** Singleton state-manager for
|
|
20
|
+
/** Singleton state-manager for audius wormhole interaction */
|
|
21
21
|
export declare class Wormhole {
|
|
22
22
|
hedgehog: Nullable<Hedgehog>;
|
|
23
23
|
ethWeb3Manager: EthWeb3Manager;
|
package/package.json
CHANGED
package/src/NativeAudiusLibs.ts
CHANGED
|
@@ -38,6 +38,10 @@ import { ServiceProvider } from './api/ServiceProvider'
|
|
|
38
38
|
import type { BaseConstructorArgs } from './api/base'
|
|
39
39
|
import type { MonitoringCallbacks } from './services/types'
|
|
40
40
|
import { EntityManager } from './api/entityManager'
|
|
41
|
+
import {
|
|
42
|
+
ProxyWormhole,
|
|
43
|
+
ProxyWormholeConfig
|
|
44
|
+
} from './services/wormhole/ProxyWormhole'
|
|
41
45
|
|
|
42
46
|
type LibsIdentityServiceConfig = {
|
|
43
47
|
url: string
|
|
@@ -71,6 +75,7 @@ type AudiusLibsConfig = {
|
|
|
71
75
|
discoveryProviderConfig: LibsDiscoveryProviderConfig
|
|
72
76
|
creatorNodeConfig: CreatorNodeConfig
|
|
73
77
|
comstockConfig: LibsComstockConfig
|
|
78
|
+
wormholeConfig: ProxyWormholeConfig
|
|
74
79
|
captchaConfig: CaptchaConfig
|
|
75
80
|
hedgehogConfig: LibsHedgehogConfig
|
|
76
81
|
isServer: boolean
|
|
@@ -224,8 +229,7 @@ export class AudiusLibs {
|
|
|
224
229
|
}
|
|
225
230
|
|
|
226
231
|
/**
|
|
227
|
-
* Configures wormhole
|
|
228
|
-
* This is a stubbed version for native
|
|
232
|
+
* Configures proxy-only wormhole
|
|
229
233
|
*/
|
|
230
234
|
static configWormhole() {
|
|
231
235
|
return {}
|
|
@@ -297,6 +301,7 @@ export class AudiusLibs {
|
|
|
297
301
|
creatorNodeConfig: CreatorNodeConfig
|
|
298
302
|
discoveryProviderConfig: LibsDiscoveryProviderConfig
|
|
299
303
|
comstockConfig: LibsComstockConfig
|
|
304
|
+
wormholeConfig: ProxyWormholeConfig
|
|
300
305
|
captchaConfig: CaptchaConfig
|
|
301
306
|
hedgehogConfig: LibsHedgehogConfig
|
|
302
307
|
isServer: boolean
|
|
@@ -313,6 +318,7 @@ export class AudiusLibs {
|
|
|
313
318
|
web3Manager: Nullable<Web3Manager>
|
|
314
319
|
solanaWeb3Manager: Nullable<SolanaWeb3Manager>
|
|
315
320
|
contracts: Nullable<AudiusContracts>
|
|
321
|
+
wormholeClient: Nullable<ProxyWormhole>
|
|
316
322
|
creatorNode: Nullable<CreatorNode>
|
|
317
323
|
captcha: Nullable<Captcha>
|
|
318
324
|
schemas?: Schemas
|
|
@@ -351,6 +357,7 @@ export class AudiusLibs {
|
|
|
351
357
|
discoveryProviderConfig,
|
|
352
358
|
creatorNodeConfig,
|
|
353
359
|
comstockConfig,
|
|
360
|
+
wormholeConfig,
|
|
354
361
|
captchaConfig,
|
|
355
362
|
hedgehogConfig,
|
|
356
363
|
isServer,
|
|
@@ -371,6 +378,7 @@ export class AudiusLibs {
|
|
|
371
378
|
this.creatorNodeConfig = creatorNodeConfig
|
|
372
379
|
this.discoveryProviderConfig = discoveryProviderConfig
|
|
373
380
|
this.comstockConfig = comstockConfig
|
|
381
|
+
this.wormholeConfig = wormholeConfig
|
|
374
382
|
this.captchaConfig = captchaConfig
|
|
375
383
|
this.hedgehogConfig = hedgehogConfig
|
|
376
384
|
this.isServer = isServer
|
|
@@ -386,12 +394,13 @@ export class AudiusLibs {
|
|
|
386
394
|
this.ethContracts = null
|
|
387
395
|
this.web3Manager = null
|
|
388
396
|
this.solanaWeb3Manager = null
|
|
397
|
+
this.wormholeClient = null
|
|
389
398
|
this.contracts = null
|
|
390
399
|
this.creatorNode = null
|
|
391
400
|
this.captcha = null
|
|
392
401
|
this.comstock = null
|
|
393
402
|
|
|
394
|
-
//
|
|
403
|
+
// API
|
|
395
404
|
this.ServiceProvider = null
|
|
396
405
|
this.Account = null
|
|
397
406
|
this.User = null
|
|
@@ -506,6 +515,20 @@ export class AudiusLibs {
|
|
|
506
515
|
contractsToInit.push(this.contracts.init())
|
|
507
516
|
}
|
|
508
517
|
await Promise.all(contractsToInit)
|
|
518
|
+
if (
|
|
519
|
+
this.wormholeConfig &&
|
|
520
|
+
this.ethWeb3Manager &&
|
|
521
|
+
this.ethContracts &&
|
|
522
|
+
this.solanaWeb3Manager
|
|
523
|
+
) {
|
|
524
|
+
this.wormholeClient = new ProxyWormhole(
|
|
525
|
+
this.hedgehog,
|
|
526
|
+
this.ethWeb3Manager,
|
|
527
|
+
this.ethContracts,
|
|
528
|
+
this.identityService,
|
|
529
|
+
this.solanaWeb3Manager
|
|
530
|
+
)
|
|
531
|
+
}
|
|
509
532
|
|
|
510
533
|
/** Discovery Provider */
|
|
511
534
|
if (this.discoveryProviderConfig) {
|
|
@@ -559,7 +582,7 @@ export class AudiusLibs {
|
|
|
559
582
|
this.ethContracts,
|
|
560
583
|
this.solanaWeb3Manager,
|
|
561
584
|
null as any,
|
|
562
|
-
|
|
585
|
+
this.wormholeClient,
|
|
563
586
|
this.creatorNode,
|
|
564
587
|
this.comstock,
|
|
565
588
|
this.captcha,
|
package/src/api/Users.ts
CHANGED
|
@@ -724,13 +724,25 @@ export class Users extends Base {
|
|
|
724
724
|
async updateIsVerified(
|
|
725
725
|
userId: number,
|
|
726
726
|
isVerified: boolean,
|
|
727
|
-
privateKey: string
|
|
727
|
+
privateKey: string,
|
|
728
|
+
useEntityManager?: boolean
|
|
728
729
|
) {
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
730
|
+
if (useEntityManager) {
|
|
731
|
+
return await this.contracts.EntityManagerClient!.getManageEntityParams(
|
|
732
|
+
userId,
|
|
733
|
+
EntityManagerClient.EntityType.USER,
|
|
734
|
+
userId,
|
|
735
|
+
EntityManagerClient.Action.VERIFY,
|
|
736
|
+
'',
|
|
737
|
+
privateKey
|
|
738
|
+
)
|
|
739
|
+
} else {
|
|
740
|
+
return await this.contracts.UserFactoryClient.updateIsVerified(
|
|
741
|
+
userId,
|
|
742
|
+
isVerified,
|
|
743
|
+
privateKey
|
|
744
|
+
)
|
|
745
|
+
}
|
|
734
746
|
}
|
|
735
747
|
|
|
736
748
|
/**
|
|
@@ -207,7 +207,10 @@ export class AudiusContracts {
|
|
|
207
207
|
*/
|
|
208
208
|
async getRegistryAddressForContract(contractName: string) {
|
|
209
209
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#Computed_property_names
|
|
210
|
-
this.contracts = this.contracts ?? {
|
|
210
|
+
this.contracts = this.contracts ?? {
|
|
211
|
+
[this.registryAddress]: 'registry',
|
|
212
|
+
[this.entityManagerAddress]: 'EntityManager'
|
|
213
|
+
}
|
|
211
214
|
this.contractAddresses = this.contractAddresses ?? {
|
|
212
215
|
registry: this.registryAddress
|
|
213
216
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { TransactionReceipt } from 'web3-core'
|
|
2
|
+
import sigUtil from 'eth-sig-util'
|
|
3
|
+
import { Buffer as SafeBuffer } from 'safe-buffer'
|
|
2
4
|
|
|
3
5
|
import { ContractClient } from '../contracts/ContractClient'
|
|
4
6
|
import * as signatureSchemas from '../../data-contracts/signatureSchemas'
|
|
@@ -7,7 +9,8 @@ import type { Web3Manager } from '../web3Manager'
|
|
|
7
9
|
export enum Action {
|
|
8
10
|
CREATE = 'Create',
|
|
9
11
|
UPDATE = 'Update',
|
|
10
|
-
DELETE = 'Delete'
|
|
12
|
+
DELETE = 'Delete',
|
|
13
|
+
VERIFY = 'Verify'
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
export enum EntityType {
|
|
@@ -26,12 +29,67 @@ export class EntityManagerClient extends ContractClient {
|
|
|
26
29
|
static Action = Action
|
|
27
30
|
static EntityType = EntityType
|
|
28
31
|
|
|
32
|
+
async getManageEntityParams(
|
|
33
|
+
userId: number,
|
|
34
|
+
entityType: EntityType,
|
|
35
|
+
entityId: number,
|
|
36
|
+
action: Action,
|
|
37
|
+
metadataMultihash: string,
|
|
38
|
+
privateKey?: string
|
|
39
|
+
): Promise<[string, string]> {
|
|
40
|
+
const nonce = signatureSchemas.getNonce()
|
|
41
|
+
const chainId = await this.getEthNetId()
|
|
42
|
+
const contractAddress = await this.getAddress()
|
|
43
|
+
const signatureData = signatureSchemas.generators.getManageEntityData(
|
|
44
|
+
chainId,
|
|
45
|
+
contractAddress,
|
|
46
|
+
userId,
|
|
47
|
+
entityType,
|
|
48
|
+
entityId,
|
|
49
|
+
action,
|
|
50
|
+
metadataMultihash,
|
|
51
|
+
nonce
|
|
52
|
+
)
|
|
53
|
+
let sig
|
|
54
|
+
if (privateKey) {
|
|
55
|
+
sig = sigUtil.signTypedData(
|
|
56
|
+
SafeBuffer.from(privateKey, 'hex') as unknown as Buffer,
|
|
57
|
+
{
|
|
58
|
+
data: signatureData
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
} else {
|
|
62
|
+
sig = await this.web3Manager.signTypedData(signatureData)
|
|
63
|
+
}
|
|
64
|
+
const method = await this.getMethod(
|
|
65
|
+
'manageEntity',
|
|
66
|
+
userId,
|
|
67
|
+
entityType,
|
|
68
|
+
entityId,
|
|
69
|
+
action,
|
|
70
|
+
metadataMultihash,
|
|
71
|
+
nonce,
|
|
72
|
+
sig
|
|
73
|
+
)
|
|
74
|
+
return [method.encodeABI(), contractAddress]
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Calls the manage entity method on chain
|
|
79
|
+
* @param {number} userId The numeric user id
|
|
80
|
+
* @param {EntityType} entityType The type of entity being modified
|
|
81
|
+
* @param {number} entityId The id of the entity
|
|
82
|
+
* @param {Action} action Action being performed on the entity
|
|
83
|
+
* @param {string} metadataMultihash CID multihash or metadata associated with action
|
|
84
|
+
* @param {string}privateKey The private key used to sign the transaction
|
|
85
|
+
*/
|
|
29
86
|
async manageEntity(
|
|
30
87
|
userId: number,
|
|
31
88
|
entityType: EntityType,
|
|
32
89
|
entityId: number,
|
|
33
90
|
action: Action,
|
|
34
|
-
metadataMultihash: string
|
|
91
|
+
metadataMultihash: string,
|
|
92
|
+
privateKey?: string
|
|
35
93
|
): Promise<{ txReceipt: TransactionReceipt }> {
|
|
36
94
|
const nonce = signatureSchemas.getNonce()
|
|
37
95
|
const chainId = await this.getEthNetId()
|
|
@@ -46,7 +104,17 @@ export class EntityManagerClient extends ContractClient {
|
|
|
46
104
|
metadataMultihash,
|
|
47
105
|
nonce
|
|
48
106
|
)
|
|
49
|
-
|
|
107
|
+
let sig
|
|
108
|
+
if (privateKey) {
|
|
109
|
+
sig = sigUtil.signTypedData(
|
|
110
|
+
SafeBuffer.from(privateKey, 'hex') as unknown as Buffer,
|
|
111
|
+
{
|
|
112
|
+
data: signatureData
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
} else {
|
|
116
|
+
sig = await this.web3Manager.signTypedData(signatureData)
|
|
117
|
+
}
|
|
50
118
|
const method = await this.getMethod(
|
|
51
119
|
'manageEntity',
|
|
52
120
|
userId,
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { Hedgehog } from '@audius/hedgehog'
|
|
2
|
+
import type { EthContracts } from '../ethContracts'
|
|
3
|
+
import type { EthWeb3Manager } from '../ethWeb3Manager'
|
|
4
|
+
import type { IdentityService } from '../identity'
|
|
5
|
+
import type { SolanaWeb3Manager } from '../solana'
|
|
6
|
+
|
|
7
|
+
import bs58 from 'bs58'
|
|
8
|
+
import { BN, toBuffer } from 'ethereumjs-util'
|
|
9
|
+
|
|
10
|
+
import { Utils, sign, getTransferTokensDigest, Nullable } from '../../utils'
|
|
11
|
+
|
|
12
|
+
export type ProxyWormholeConfig = {}
|
|
13
|
+
|
|
14
|
+
/** Singleton state-manager for audius proxy wormhole interaction */
|
|
15
|
+
export class ProxyWormhole {
|
|
16
|
+
hedgehog: Nullable<Hedgehog>
|
|
17
|
+
ethWeb3Manager: EthWeb3Manager
|
|
18
|
+
ethContracts: EthContracts
|
|
19
|
+
identityService: Nullable<IdentityService>
|
|
20
|
+
solanaWeb3Manager: SolanaWeb3Manager
|
|
21
|
+
|
|
22
|
+
constructor(
|
|
23
|
+
hedgehog: Hedgehog | null,
|
|
24
|
+
ethWeb3Manager: EthWeb3Manager,
|
|
25
|
+
ethContracts: EthContracts,
|
|
26
|
+
identityService: IdentityService | null,
|
|
27
|
+
solanaWeb3Manager: SolanaWeb3Manager
|
|
28
|
+
) {
|
|
29
|
+
// Wormhole service dependecies
|
|
30
|
+
this.hedgehog = hedgehog
|
|
31
|
+
this.ethWeb3Manager = ethWeb3Manager
|
|
32
|
+
this.ethContracts = ethContracts
|
|
33
|
+
this.identityService = identityService
|
|
34
|
+
this.solanaWeb3Manager = solanaWeb3Manager
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Locks assets owned by `fromAccount` into the Solana wormhole with a target
|
|
39
|
+
* solanaAccount destination via the provided relayer wallet.
|
|
40
|
+
*/
|
|
41
|
+
async _getTransferTokensToEthWormholeParams(
|
|
42
|
+
fromAccount: string,
|
|
43
|
+
amount: BN,
|
|
44
|
+
solanaAccount: string
|
|
45
|
+
) {
|
|
46
|
+
if (!this.hedgehog) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
'Hedgehog required for _getTransferTokensToEthWormholeParams'
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
const web3 = this.ethWeb3Manager.getWeb3()
|
|
52
|
+
const wormholeClientAddress =
|
|
53
|
+
this.ethContracts.WormholeClient.contractAddress
|
|
54
|
+
|
|
55
|
+
const chainId = await web3.eth.getChainId()
|
|
56
|
+
|
|
57
|
+
const currentBlockNumber = await web3.eth.getBlockNumber()
|
|
58
|
+
const currentBlock = await web3.eth.getBlock(currentBlockNumber)
|
|
59
|
+
|
|
60
|
+
// 1 hour, sufficiently far in future
|
|
61
|
+
const deadline = (currentBlock.timestamp as unknown as number) + 60 * 60 * 1
|
|
62
|
+
const solanaB58 = bs58.decode(solanaAccount).toString('hex')
|
|
63
|
+
const recipient = toBuffer(`0x${solanaB58}`)
|
|
64
|
+
const nonce = await this.ethContracts.WormholeClient.nonces(fromAccount)
|
|
65
|
+
const arbiterFee = Utils.toBN('0')
|
|
66
|
+
|
|
67
|
+
const digest = getTransferTokensDigest(
|
|
68
|
+
web3,
|
|
69
|
+
'AudiusWormholeClient',
|
|
70
|
+
wormholeClientAddress,
|
|
71
|
+
chainId,
|
|
72
|
+
{
|
|
73
|
+
from: fromAccount,
|
|
74
|
+
amount,
|
|
75
|
+
recipientChain: chainId,
|
|
76
|
+
recipient,
|
|
77
|
+
arbiterFee
|
|
78
|
+
},
|
|
79
|
+
nonce,
|
|
80
|
+
deadline
|
|
81
|
+
)
|
|
82
|
+
const privateKey = this.hedgehog.getWallet()?.getPrivateKey()
|
|
83
|
+
const signedDigest = sign(digest, privateKey!)
|
|
84
|
+
return {
|
|
85
|
+
chainId,
|
|
86
|
+
deadline,
|
|
87
|
+
recipient,
|
|
88
|
+
arbiterFee,
|
|
89
|
+
signedDigest
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async getTransferTokensToEthWormholeMethod(
|
|
94
|
+
fromAccount: string,
|
|
95
|
+
amount: BN,
|
|
96
|
+
solanaAccount: string
|
|
97
|
+
) {
|
|
98
|
+
const { chainId, deadline, recipient, arbiterFee, signedDigest } =
|
|
99
|
+
await this._getTransferTokensToEthWormholeParams(
|
|
100
|
+
fromAccount,
|
|
101
|
+
amount,
|
|
102
|
+
solanaAccount
|
|
103
|
+
)
|
|
104
|
+
const method =
|
|
105
|
+
await this.ethContracts.WormholeClient.WormholeContract.methods.transferTokens(
|
|
106
|
+
fromAccount,
|
|
107
|
+
amount,
|
|
108
|
+
chainId,
|
|
109
|
+
recipient,
|
|
110
|
+
arbiterFee,
|
|
111
|
+
deadline,
|
|
112
|
+
signedDigest.v,
|
|
113
|
+
signedDigest.r,
|
|
114
|
+
signedDigest.s
|
|
115
|
+
)
|
|
116
|
+
return method
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -28,7 +28,7 @@ export type WormholeConfig = {
|
|
|
28
28
|
ethTokenBridgeAddress: string
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
/** Singleton state-manager for
|
|
31
|
+
/** Singleton state-manager for audius wormhole interaction */
|
|
32
32
|
export class Wormhole {
|
|
33
33
|
hedgehog: Nullable<Hedgehog>
|
|
34
34
|
ethWeb3Manager: EthWeb3Manager
|