@audius/sdk 0.0.35 → 0.0.36
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 +7 -3
- package/dist/api/entityManager.d.ts +2 -1
- package/dist/index.cjs.js +38 -30
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +38 -29
- package/dist/index.esm.js.map +1 -1
- package/dist/legacy.js +38 -30
- package/dist/legacy.js.map +1 -1
- package/dist/native-libs.js +8387 -5048
- package/dist/native-libs.js.map +1 -1
- package/dist/services/solana/SolanaWeb3Manager.d.ts +2 -1
- package/dist/services/web3Manager/Web3Config.d.ts +1 -0
- package/package.json +4 -3
- package/src/NativeAudiusLibs.ts +69 -7
- package/src/api/entityManager.ts +11 -6
- package/src/services/solana/SolanaWeb3Manager.ts +6 -6
- package/src/services/web3Manager/Web3Config.ts +1 -0
- package/src/services/wormhole/Wormhole.ts +4 -4
package/dist/legacy.js
CHANGED
|
@@ -73,7 +73,7 @@ var abiDecoder__default = /*#__PURE__*/_interopDefaultLegacy(abiDecoder);
|
|
|
73
73
|
var EthereumWallet__default = /*#__PURE__*/_interopDefaultLegacy(EthereumWallet);
|
|
74
74
|
var AudiusData__namespace = /*#__PURE__*/_interopNamespace(AudiusData);
|
|
75
75
|
var anchor__default = /*#__PURE__*/_interopDefaultLegacy(anchor);
|
|
76
|
-
var
|
|
76
|
+
var solanaWeb3__namespace = /*#__PURE__*/_interopNamespace(solanaWeb3);
|
|
77
77
|
var splToken__default = /*#__PURE__*/_interopDefaultLegacy(splToken);
|
|
78
78
|
var borsh__default = /*#__PURE__*/_interopDefaultLegacy(borsh);
|
|
79
79
|
var BN__default = /*#__PURE__*/_interopDefaultLegacy(BN);
|
|
@@ -33455,9 +33455,9 @@ var formatProviders = function formatProviders(providers) {
|
|
|
33455
33455
|
};
|
|
33456
33456
|
|
|
33457
33457
|
var name = "@audius/sdk";
|
|
33458
|
-
var version = "0.0.
|
|
33458
|
+
var version = "0.0.36";
|
|
33459
33459
|
var audius = {
|
|
33460
|
-
releaseSHA: "
|
|
33460
|
+
releaseSHA: "6d1ca16dfb4944e5e5b83ee30e302fa4e6811da4"
|
|
33461
33461
|
};
|
|
33462
33462
|
var description = "";
|
|
33463
33463
|
var main = "dist/index.cjs.js";
|
|
@@ -33500,7 +33500,7 @@ var dependencies = {
|
|
|
33500
33500
|
"@improbable-eng/grpc-web-node-http-transport": "0.15.0",
|
|
33501
33501
|
"@project-serum/anchor": "0.24.1",
|
|
33502
33502
|
"@solana/spl-token": "0.1.8",
|
|
33503
|
-
"@solana/web3.js": "1.
|
|
33503
|
+
"@solana/web3.js": "1.53.0",
|
|
33504
33504
|
"abi-decoder": "2.4.0",
|
|
33505
33505
|
ajv: "6.12.2",
|
|
33506
33506
|
"async-retry": "1.3.1",
|
|
@@ -33553,6 +33553,7 @@ var devDependencies = {
|
|
|
33553
33553
|
"@types/expect": "24.3.0",
|
|
33554
33554
|
"@types/form-data": "^2.5.0",
|
|
33555
33555
|
"@types/hashids": "2.0.1",
|
|
33556
|
+
"@types/lodash": "4.14.149",
|
|
33556
33557
|
"@types/mocha": "9.1.0",
|
|
33557
33558
|
"@types/node-localstorage": "1.3.0",
|
|
33558
33559
|
"@types/pify": "^5.0.1",
|
|
@@ -35949,7 +35950,7 @@ var SolanaWeb3Manager = /*#__PURE__*/function () {
|
|
|
35949
35950
|
this.solanaWeb3Config = solanaWeb3Config;
|
|
35950
35951
|
this.identityService = identityService;
|
|
35951
35952
|
this.web3Manager = web3Manager;
|
|
35952
|
-
this.solanaWeb3 =
|
|
35953
|
+
this.solanaWeb3 = solanaWeb3__namespace;
|
|
35953
35954
|
this.splToken = splToken__default["default"];
|
|
35954
35955
|
}
|
|
35955
35956
|
|
|
@@ -35965,7 +35966,7 @@ var SolanaWeb3Manager = /*#__PURE__*/function () {
|
|
|
35965
35966
|
case 0:
|
|
35966
35967
|
_this$solanaWeb3Confi = this.solanaWeb3Config, solanaClusterEndpoint = _this$solanaWeb3Confi.solanaClusterEndpoint, mintAddress = _this$solanaWeb3Confi.mintAddress, solanaTokenAddress = _this$solanaWeb3Confi.solanaTokenAddress, claimableTokenPDA = _this$solanaWeb3Confi.claimableTokenPDA, feePayerAddress = _this$solanaWeb3Confi.feePayerAddress, claimableTokenProgramAddress = _this$solanaWeb3Confi.claimableTokenProgramAddress, rewardsManagerProgramId = _this$solanaWeb3Confi.rewardsManagerProgramId, rewardsManagerProgramPDA = _this$solanaWeb3Confi.rewardsManagerProgramPDA, rewardsManagerTokenPDA = _this$solanaWeb3Confi.rewardsManagerTokenPDA, useRelay = _this$solanaWeb3Confi.useRelay, feePayerKeypairs = _this$solanaWeb3Confi.feePayerKeypairs, confirmationTimeout = _this$solanaWeb3Confi.confirmationTimeout, audiusDataProgramId = _this$solanaWeb3Confi.audiusDataProgramId, audiusDataAdminStorageKeypairPublicKey = _this$solanaWeb3Confi.audiusDataAdminStorageKeypairPublicKey, audiusDataIdl = _this$solanaWeb3Confi.audiusDataIdl;
|
|
35967
35968
|
this.solanaClusterEndpoint = solanaClusterEndpoint;
|
|
35968
|
-
this.connection = new
|
|
35969
|
+
this.connection = new solanaWeb3.Connection(this.solanaClusterEndpoint, {
|
|
35969
35970
|
confirmTransactionInitialTimeout: confirmationTimeout || DEFAULT_CONNECTION_CONFIRMATION_TIMEOUT_MS
|
|
35970
35971
|
});
|
|
35971
35972
|
this.transactionHandler = new TransactionHandler({
|
|
@@ -36025,9 +36026,8 @@ var SolanaWeb3Manager = /*#__PURE__*/function () {
|
|
|
36025
36026
|
this.audiusDataIdl = audiusDataIdl || AudiusData.idl;
|
|
36026
36027
|
|
|
36027
36028
|
if (this.audiusDataProgramId && this.audiusDataAdminStorageKeypairPublicKey && this.audiusDataIdl) {
|
|
36028
|
-
connection = new
|
|
36029
|
-
anchorProvider = new anchor__default["default"].AnchorProvider(connection,
|
|
36030
|
-
solanaWeb3__default["default"].Keypair.generate(), anchor__default["default"].AnchorProvider.defaultOptions());
|
|
36029
|
+
connection = new solanaWeb3.Connection(this.solanaClusterEndpoint, anchor__default["default"].AnchorProvider.defaultOptions());
|
|
36030
|
+
anchorProvider = new anchor__default["default"].AnchorProvider(connection, solanaWeb3.Keypair.generate(), anchor__default["default"].AnchorProvider.defaultOptions());
|
|
36031
36031
|
this.anchorProgram = new anchor__default["default"].Program(this.audiusDataIdl, audiusDataProgramId, anchorProvider);
|
|
36032
36032
|
}
|
|
36033
36033
|
|
|
@@ -50274,7 +50274,7 @@ var Wormhole = /*#__PURE__*/function () {
|
|
|
50274
50274
|
wAudioAmount = wAudioFromWeiAudio(amount); // Generate a solana keypair derived from the hedgehog private key
|
|
50275
50275
|
// NOTE: The into to fromSeed is a 32 bytes Uint8Array
|
|
50276
50276
|
|
|
50277
|
-
rootSolanaAccount =
|
|
50277
|
+
rootSolanaAccount = solanaWeb3.Keypair.fromSeed((_this$hedgehog$wallet = this.hedgehog.wallet) === null || _this$hedgehog$wallet === void 0 ? void 0 : _this$hedgehog$wallet.getPrivateKey());
|
|
50278
50278
|
solanaAddress = rootSolanaAccount.publicKey.toString();
|
|
50279
50279
|
logs.push("Root Solana Account: ".concat(solanaAddress)); // Find the token account owned by the root solana account and get the token account's info
|
|
50280
50280
|
|
|
@@ -57223,13 +57223,13 @@ var EntityManager = /*#__PURE__*/function (_Base) {
|
|
|
57223
57223
|
key: "createPlaylist",
|
|
57224
57224
|
value: function () {
|
|
57225
57225
|
var _createPlaylist = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(_ref) {
|
|
57226
|
-
var playlistId, playlistName, trackIds, description, isAlbum, isPrivate, coverArt, responseValues, currentUserId, userId, createAction, entityType, updatedPlaylistImage, web3, currentBlockNumber, currentBlock, tracks,
|
|
57226
|
+
var playlistId, playlistName, trackIds, description, isAlbum, isPrivate, coverArt, coverArtSizes, responseValues, _dirCID, currentUserId, userId, createAction, entityType, dirCID, updatedPlaylistImage, web3, currentBlockNumber, currentBlock, tracks, metadata, _yield$this$creatorNo, metadataMultihash, manageEntityResponse, txReceipt, error;
|
|
57227
57227
|
|
|
57228
57228
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
57229
57229
|
while (1) {
|
|
57230
57230
|
switch (_context2.prev = _context2.next) {
|
|
57231
57231
|
case 0:
|
|
57232
|
-
playlistId = _ref.playlistId, playlistName = _ref.playlistName, trackIds = _ref.trackIds, description = _ref.description, isAlbum = _ref.isAlbum, isPrivate = _ref.isPrivate, coverArt = _ref.coverArt;
|
|
57232
|
+
playlistId = _ref.playlistId, playlistName = _ref.playlistName, trackIds = _ref.trackIds, description = _ref.description, isAlbum = _ref.isAlbum, isPrivate = _ref.isPrivate, coverArt = _ref.coverArt, coverArtSizes = _ref.coverArtSizes;
|
|
57233
57233
|
responseValues = this.getDefaultPlaylistReponseValues();
|
|
57234
57234
|
_context2.prev = 2;
|
|
57235
57235
|
currentUserId = this.userStateManager.getCurrentUserId();
|
|
@@ -57247,22 +57247,31 @@ var EntityManager = /*#__PURE__*/function (_Base) {
|
|
|
57247
57247
|
createAction = Action.CREATE;
|
|
57248
57248
|
entityType = EntityType.PLAYLIST;
|
|
57249
57249
|
this.REQUIRES(Services.CREATOR_NODE);
|
|
57250
|
-
|
|
57250
|
+
|
|
57251
|
+
if (!coverArt) {
|
|
57252
|
+
_context2.next = 16;
|
|
57253
|
+
break;
|
|
57254
|
+
}
|
|
57255
|
+
|
|
57256
|
+
_context2.next = 14;
|
|
57251
57257
|
return this.creatorNode.uploadImage(coverArt, true // square
|
|
57252
57258
|
);
|
|
57253
57259
|
|
|
57254
|
-
case
|
|
57260
|
+
case 14:
|
|
57255
57261
|
updatedPlaylistImage = _context2.sent;
|
|
57262
|
+
dirCID = updatedPlaylistImage.dirCID;
|
|
57263
|
+
|
|
57264
|
+
case 16:
|
|
57256
57265
|
web3 = this.web3Manager.getWeb3();
|
|
57257
|
-
_context2.next =
|
|
57266
|
+
_context2.next = 19;
|
|
57258
57267
|
return web3.eth.getBlockNumber();
|
|
57259
57268
|
|
|
57260
|
-
case
|
|
57269
|
+
case 19:
|
|
57261
57270
|
currentBlockNumber = _context2.sent;
|
|
57262
|
-
_context2.next =
|
|
57271
|
+
_context2.next = 22;
|
|
57263
57272
|
return web3.eth.getBlock(currentBlockNumber);
|
|
57264
57273
|
|
|
57265
|
-
case
|
|
57274
|
+
case 22:
|
|
57266
57275
|
currentBlock = _context2.sent;
|
|
57267
57276
|
tracks = trackIds.map(function (trackId) {
|
|
57268
57277
|
return {
|
|
@@ -57270,25 +57279,24 @@ var EntityManager = /*#__PURE__*/function (_Base) {
|
|
|
57270
57279
|
time: currentBlock.timestamp
|
|
57271
57280
|
};
|
|
57272
57281
|
});
|
|
57273
|
-
dirCID = updatedPlaylistImage.dirCID;
|
|
57274
57282
|
metadata = {
|
|
57275
57283
|
playlist_id: playlistId,
|
|
57276
57284
|
playlist_contents: {
|
|
57277
57285
|
track_ids: tracks
|
|
57278
57286
|
},
|
|
57279
57287
|
playlist_name: playlistName,
|
|
57280
|
-
playlist_image_sizes_multihash: dirCID,
|
|
57288
|
+
playlist_image_sizes_multihash: (_dirCID = dirCID) !== null && _dirCID !== void 0 ? _dirCID : coverArtSizes,
|
|
57281
57289
|
description: description,
|
|
57282
57290
|
is_album: isAlbum,
|
|
57283
57291
|
is_private: isPrivate
|
|
57284
57292
|
};
|
|
57285
|
-
_context2.next =
|
|
57293
|
+
_context2.next = 27;
|
|
57286
57294
|
return this.creatorNode.uploadPlaylistMetadata(metadata);
|
|
57287
57295
|
|
|
57288
|
-
case
|
|
57296
|
+
case 27:
|
|
57289
57297
|
_yield$this$creatorNo = _context2.sent;
|
|
57290
57298
|
metadataMultihash = _yield$this$creatorNo.metadataMultihash;
|
|
57291
|
-
_context2.next =
|
|
57299
|
+
_context2.next = 31;
|
|
57292
57300
|
return this.manageEntity({
|
|
57293
57301
|
userId: userId,
|
|
57294
57302
|
entityType: entityType,
|
|
@@ -57297,7 +57305,7 @@ var EntityManager = /*#__PURE__*/function (_Base) {
|
|
|
57297
57305
|
metadataMultihash: metadataMultihash
|
|
57298
57306
|
});
|
|
57299
57307
|
|
|
57300
|
-
case
|
|
57308
|
+
case 31:
|
|
57301
57309
|
manageEntityResponse = _context2.sent;
|
|
57302
57310
|
txReceipt = manageEntityResponse.txReceipt;
|
|
57303
57311
|
responseValues.blockHash = txReceipt.blockHash;
|
|
@@ -57305,19 +57313,19 @@ var EntityManager = /*#__PURE__*/function (_Base) {
|
|
|
57305
57313
|
responseValues.playlistId = playlistId;
|
|
57306
57314
|
return _context2.abrupt("return", responseValues);
|
|
57307
57315
|
|
|
57308
|
-
case
|
|
57309
|
-
_context2.prev =
|
|
57316
|
+
case 39:
|
|
57317
|
+
_context2.prev = 39;
|
|
57310
57318
|
_context2.t0 = _context2["catch"](2);
|
|
57311
57319
|
error = _context2.t0.message;
|
|
57312
57320
|
responseValues.error = error;
|
|
57313
57321
|
return _context2.abrupt("return", responseValues);
|
|
57314
57322
|
|
|
57315
|
-
case
|
|
57323
|
+
case 44:
|
|
57316
57324
|
case "end":
|
|
57317
57325
|
return _context2.stop();
|
|
57318
57326
|
}
|
|
57319
57327
|
}
|
|
57320
|
-
}, _callee2, this, [[2,
|
|
57328
|
+
}, _callee2, this, [[2, 39]]);
|
|
57321
57329
|
}));
|
|
57322
57330
|
|
|
57323
57331
|
function createPlaylist(_x3) {
|
|
@@ -57401,7 +57409,7 @@ var EntityManager = /*#__PURE__*/function (_Base) {
|
|
|
57401
57409
|
key: "editPlaylist",
|
|
57402
57410
|
value: function () {
|
|
57403
57411
|
var _editPlaylist = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(_ref3) {
|
|
57404
|
-
var playlistId, playlistName, description, isAlbum, isPrivate, coverArt, responseValues,
|
|
57412
|
+
var playlistId, playlistName, description, isAlbum, isPrivate, coverArt, responseValues, _dirCID2, currentUserId, userId, updateAction, entityType, dirCID, updatedPlaylistImage, playlist, existingPlaylistTracks, metadata, _yield$this$creatorNo2, metadataMultihash, resp, txReceipt, error;
|
|
57405
57413
|
|
|
57406
57414
|
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
57407
57415
|
while (1) {
|
|
@@ -57461,7 +57469,7 @@ var EntityManager = /*#__PURE__*/function (_Base) {
|
|
|
57461
57469
|
track_ids: existingPlaylistTracks
|
|
57462
57470
|
},
|
|
57463
57471
|
playlist_name: playlistName !== null && playlistName !== void 0 ? playlistName : playlist.playlist_name,
|
|
57464
|
-
playlist_image_sizes_multihash: (
|
|
57472
|
+
playlist_image_sizes_multihash: (_dirCID2 = dirCID) !== null && _dirCID2 !== void 0 ? _dirCID2 : playlist.cover_art,
|
|
57465
57473
|
description: description !== null && description !== void 0 ? description : playlist.description,
|
|
57466
57474
|
is_album: isAlbum !== null && isAlbum !== void 0 ? isAlbum : playlist.is_album,
|
|
57467
57475
|
is_private: isPrivate !== null && isPrivate !== void 0 ? isPrivate : playlist.is_private
|