@audius/sdk 0.0.0 → 0.0.3

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.
@@ -55,6 +55,11 @@ type AttestationResult = {
55
55
  reason?: string
56
56
  }
57
57
 
58
+ type Reaction = {
59
+ reactedTo: string
60
+ reactionValue: number
61
+ }
62
+
58
63
  // Only probabilistically capture 50% of relay captchas
59
64
  const RELAY_CAPTCHA_SAMPLE_RATE = 0.5
60
65
 
@@ -502,6 +507,20 @@ export class IdentityService {
502
507
  })
503
508
  }
504
509
 
510
+ /**
511
+ * Post a reaction to identity.
512
+ */
513
+ async submitReaction(data: Reaction) {
514
+ const headers = await this._signData()
515
+
516
+ return await this._makeRequest({
517
+ url: '/reactions',
518
+ method: 'post',
519
+ data,
520
+ headers
521
+ })
522
+ }
523
+
505
524
  /* ------- INTERNAL FUNCTIONS ------- */
506
525
 
507
526
  async _makeRequest<T = unknown>(axiosRequestObj: AxiosRequestConfig) {
@@ -86,7 +86,7 @@ async function getAccountNonce ({
86
86
  mintKey,
87
87
  claimableTokenProgramKey
88
88
  })
89
- const accInfo = await connection.getAccountInfoAndContext(transferNonceAccount)
89
+ const accInfo = await connection.getAccountInfoAndContext(transferNonceAccount, 'confirmed')
90
90
  if (accInfo.value) {
91
91
  const nonceAccount = borsh.deserialize(NonceAccountSchema, NonceAccount, accInfo.value.data)
92
92
  nonce = nonceAccount.nonce
@@ -1,7 +1,7 @@
1
1
  import bs58 from 'bs58'
2
2
  import Web3 from '../web3'
3
3
  import axios, { AxiosResponse } from 'axios'
4
- import Hashids from 'hashids/cjs'
4
+ import Hashids from 'hashids'
5
5
  import { MultiProvider } from './multiProvider'
6
6
  import { uuid } from './uuid'
7
7
  import {
@@ -5,7 +5,7 @@ const nock = require('nock')
5
5
  const { Vote } = require('../src/services/ethContracts/GovernanceClient')
6
6
  const time = require('@openzeppelin/test-helpers/src/time')
7
7
  const { initializeLibConfig } = require('./helpers')
8
- const AudiusLibs = require('../src')
8
+ const AudiusLibs = require('../src/libs')
9
9
 
10
10
  const { audiusInstance: audius0, getRandomLocalhost } = helpers
11
11
 
package/tests/helpers.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const nock = require('nock')
2
2
 
3
3
  const Web3 = require('../src/web3')
4
- const AudiusLibs = require('../src/index')
4
+ const AudiusLibs = require('../src/libs')
5
5
  const dataContractsConfig = require('../data-contracts/config.json')
6
6
  const ethContractsConfig = require('../eth-contracts/config.json')
7
7
 
@@ -211,7 +211,7 @@ function createContractClientWithInternalWeb3() {
211
211
  web3ProviderEndpoints: gateways
212
212
  }
213
213
  }
214
- const web3Manager = new Web3Manager()
214
+ const web3Manager = new Web3Manager({})
215
215
  web3Manager.web3 = createWeb3Obj('https://audius.poa.network')
216
216
  web3Manager.web3Config = web3Config
217
217
  return createContractClient(web3Manager)
@@ -224,7 +224,7 @@ function createContractClientWithExternalWeb3() {
224
224
  web3ProviderEndpoints: gateways
225
225
  }
226
226
  }
227
- const web3Manager = new Web3Manager()
227
+ const web3Manager = new Web3Manager({})
228
228
  web3Manager.web3 = createWeb3Obj('https://audius.poa.network')
229
229
  web3Manager.web3Config = web3Config
230
230
  return createContractClient(web3Manager)
@@ -235,7 +235,7 @@ function createContractClientWithEthWeb3Manager() {
235
235
  providers: ['https://audius.eth.network'],
236
236
  ownerWallet: '0xwallet'
237
237
  }
238
- const ethWeb3Manager = new EthWeb3Manager(web3Config)
238
+ const ethWeb3Manager = new EthWeb3Manager({ web3Config })
239
239
  ethWeb3Manager.web3 = createWeb3Obj('https://eth.network')
240
240
  return createContractClient(ethWeb3Manager)
241
241
  }
@@ -7,7 +7,7 @@ const { time } = require('@openzeppelin/test-helpers')
7
7
  const { getRandomLocalhost, audiusInstance: audius0 } = helpers
8
8
  const initializeLibConfig = helpers.initializeLibConfig
9
9
  const ethContractsConfig = require('../eth-contracts/config.json')
10
- const AudiusLibs = require('../src/index');
10
+ const AudiusLibs = require('../src/libs');
11
11
  const { convertAudsToWeiBN } = require('../initScripts/helpers/utils');
12
12
  const { initial } = require('lodash')
13
13
  const { deregisterSPEndpoint } = require('./helpers')