@audius/sdk 0.0.1 → 0.0.2
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/browser.js +11 -13
- package/dist/browser.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +24 -79
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +3 -3
- package/dist/legacy.js +24 -79
- package/dist/legacy.js.map +1 -1
- package/dist/types.d.ts +3 -3
- package/examples/initAudiusLibs.js +3 -4
- package/examples/initializeVersions.js +21 -9
- package/initScripts/mainnet.js +37 -14
- package/package.json +1 -1
- package/src/libs.js +20 -71
- package/src/sdk/oauth/Oauth.ts +3 -3
- package/src/sdk/sdk.ts +2 -2
- package/src/services/ethWeb3Manager/EthWeb3Manager.ts +7 -9
- package/tests/governanceTest.js +1 -1
- package/tests/helpers.js +1 -1
- package/tests/providerSelectionTest.js +3 -3
- package/tests/stakingTest.js +1 -1
package/dist/legacy.d.ts
CHANGED
|
@@ -2111,12 +2111,12 @@ declare type ButtonOptions = {
|
|
|
2111
2111
|
fullWidth: boolean;
|
|
2112
2112
|
};
|
|
2113
2113
|
declare type OauthConfig = {
|
|
2114
|
-
appName
|
|
2114
|
+
appName: string;
|
|
2115
2115
|
discoveryProvider: DiscoveryProvider;
|
|
2116
2116
|
};
|
|
2117
2117
|
declare class Oauth {
|
|
2118
2118
|
discoveryProvider: DiscoveryProvider;
|
|
2119
|
-
appName: string
|
|
2119
|
+
appName: string;
|
|
2120
2120
|
activePopupWindow: null | Window;
|
|
2121
2121
|
popupCheckInterval: NodeJS.Timer | null;
|
|
2122
2122
|
loginSuccessCallback: LoginSuccessCallback | null;
|
|
@@ -2145,7 +2145,7 @@ declare type SdkConfig = {
|
|
|
2145
2145
|
/**
|
|
2146
2146
|
* The Audius SDK
|
|
2147
2147
|
*/
|
|
2148
|
-
declare const sdk: (config
|
|
2148
|
+
declare const sdk: (config: SdkConfig) => Promise<{
|
|
2149
2149
|
oauth: Oauth | undefined;
|
|
2150
2150
|
discoveryNode: DiscoveryProvider;
|
|
2151
2151
|
}>;
|
package/dist/legacy.js
CHANGED
|
@@ -42515,17 +42515,16 @@ var EthWeb3Manager$1 = /*#__PURE__*/function () {
|
|
|
42515
42515
|
this.web3Config = web3Config;
|
|
42516
42516
|
this.web3 = new web3(provider);
|
|
42517
42517
|
this.identityService = identityService;
|
|
42518
|
-
this.hedgehog = hedgehog;
|
|
42518
|
+
this.hedgehog = hedgehog;
|
|
42519
42519
|
|
|
42520
|
-
if (this.
|
|
42521
|
-
|
|
42522
|
-
|
|
42523
|
-
|
|
42524
|
-
|
|
42520
|
+
if (this.web3Config.ownerWallet) {
|
|
42521
|
+
this.ownerWallet = this.web3Config.ownerWallet;
|
|
42522
|
+
} else if (this.hedgehog) {
|
|
42523
|
+
// Hedgehog might not exist (in the case of @audius/sdk)
|
|
42524
|
+
var storedWallet = this.hedgehog.getWallet();
|
|
42525
42525
|
|
|
42526
|
-
|
|
42527
|
-
|
|
42528
|
-
}
|
|
42526
|
+
if (storedWallet) {
|
|
42527
|
+
this.ownerWallet = storedWallet;
|
|
42529
42528
|
}
|
|
42530
42529
|
}
|
|
42531
42530
|
}
|
|
@@ -44302,7 +44301,7 @@ var Oauth = /*#__PURE__*/function () {
|
|
|
44302
44301
|
}
|
|
44303
44302
|
|
|
44304
44303
|
this.discoveryProvider = discoveryProvider;
|
|
44305
|
-
this.appName = appName
|
|
44304
|
+
this.appName = appName;
|
|
44306
44305
|
this.activePopupWindow = null;
|
|
44307
44306
|
this.loginSuccessCallback = null;
|
|
44308
44307
|
this.loginErrorCallback = null;
|
|
@@ -44534,13 +44533,12 @@ var sdk$2 = /*#__PURE__*/function () {
|
|
|
44534
44533
|
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(config) {
|
|
44535
44534
|
var _ethWeb3Config$provid;
|
|
44536
44535
|
|
|
44537
|
-
var
|
|
44538
|
-
|
|
44536
|
+
var appName, discoveryNodeConfig, ethContractsConfig, ethWeb3Config, identityServiceConfig, userStateManager, identityService, ethWeb3Manager, ethContracts, discoveryNode, oauth;
|
|
44539
44537
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
44540
44538
|
while (1) {
|
|
44541
44539
|
switch (_context.prev = _context.next) {
|
|
44542
44540
|
case 0:
|
|
44543
|
-
|
|
44541
|
+
appName = config.appName, discoveryNodeConfig = config.discoveryNodeConfig, ethContractsConfig = config.ethContractsConfig, ethWeb3Config = config.ethWeb3Config, identityServiceConfig = config.identityServiceConfig;
|
|
44544
44542
|
/** Initialize services */
|
|
44545
44543
|
|
|
44546
44544
|
userStateManager = new UserStateManager$1();
|
|
@@ -44614,7 +44612,7 @@ var require$$0$2 = /*@__PURE__*/getAugmentedNamespace(sdk$1);
|
|
|
44614
44612
|
var libs$1 = createModule("/$$rollup_base$$/src");
|
|
44615
44613
|
|
|
44616
44614
|
var name = "@audius/sdk";
|
|
44617
|
-
var version = "0.0.
|
|
44615
|
+
var version = "0.0.2";
|
|
44618
44616
|
var description = "";
|
|
44619
44617
|
var main = "dist/index.js";
|
|
44620
44618
|
var types = "dist/types.d.ts";
|
|
@@ -72731,7 +72729,7 @@ var AudiusLibs = /*#__PURE__*/function () {
|
|
|
72731
72729
|
* Unless default-valued, all configs are optional.
|
|
72732
72730
|
* @example
|
|
72733
72731
|
* const audius = AudiusLibs({
|
|
72734
|
-
* discoveryProviderConfig:
|
|
72732
|
+
* discoveryProviderConfig: {},
|
|
72735
72733
|
* creatorNodeConfig: configCreatorNode('https://my-creator.node')
|
|
72736
72734
|
* })
|
|
72737
72735
|
* await audius.init()
|
|
@@ -72936,41 +72934,27 @@ var AudiusLibs = /*#__PURE__*/function () {
|
|
|
72936
72934
|
/** Discovery Provider */
|
|
72937
72935
|
|
|
72938
72936
|
|
|
72939
|
-
|
|
72940
|
-
_context.next = 37;
|
|
72941
|
-
break;
|
|
72942
|
-
}
|
|
72943
|
-
|
|
72944
|
-
this.discoveryProvider = new DiscoveryProvider({
|
|
72945
|
-
whitelist: this.discoveryProviderConfig.whitelist,
|
|
72946
|
-
blacklist: this.discoveryProviderConfig.blacklist,
|
|
72937
|
+
this.discoveryProvider = new DiscoveryProvider(_objectSpread2({
|
|
72947
72938
|
userStateManager: this.userStateManager,
|
|
72948
72939
|
ethContracts: this.ethContracts,
|
|
72949
|
-
web3Manager: this.web3Manager
|
|
72950
|
-
|
|
72951
|
-
|
|
72952
|
-
monitoringCallbacks: this.discoveryProviderConfig.monitoringCallbacks,
|
|
72953
|
-
selectionRequestTimeout: this.discoveryProviderConfig.selectionRequestTimeout,
|
|
72954
|
-
selectionRequestRetries: this.discoveryProviderConfig.selectionRequestRetries,
|
|
72955
|
-
unhealthySlothDiffPlays: this.discoveryProviderConfig.unhealthySlotDiffPlays,
|
|
72956
|
-
unhealthBlockDiff: this.discoveryProviderConfig.unhealthyBlockDiff
|
|
72957
|
-
});
|
|
72958
|
-
_context.next = 37;
|
|
72940
|
+
web3Manager: this.web3Manager
|
|
72941
|
+
}, this.discoveryProviderConfig));
|
|
72942
|
+
_context.next = 36;
|
|
72959
72943
|
return this.discoveryProvider.init();
|
|
72960
72944
|
|
|
72961
|
-
case
|
|
72945
|
+
case 36:
|
|
72962
72946
|
if (!this.creatorNodeConfig) {
|
|
72963
|
-
_context.next =
|
|
72947
|
+
_context.next = 42;
|
|
72964
72948
|
break;
|
|
72965
72949
|
}
|
|
72966
72950
|
|
|
72967
72951
|
currentUser = this.userStateManager.getCurrentUser();
|
|
72968
72952
|
creatorNodeEndpoint = currentUser ? CreatorNode.getPrimary(currentUser.creator_node_endpoint) || this.creatorNodeConfig.fallbackUrl : this.creatorNodeConfig.fallbackUrl;
|
|
72969
72953
|
this.creatorNode = new CreatorNode(this.web3Manager, creatorNodeEndpoint, this.isServer, this.userStateManager, this.creatorNodeConfig.lazyConnect, this.schemas, this.creatorNodeConfig.passList, this.creatorNodeConfig.blockList, this.creatorNodeConfig.monitoringCallbacks);
|
|
72970
|
-
_context.next =
|
|
72954
|
+
_context.next = 42;
|
|
72971
72955
|
return this.creatorNode.init();
|
|
72972
72956
|
|
|
72973
|
-
case
|
|
72957
|
+
case 42:
|
|
72974
72958
|
/** Comstock */
|
|
72975
72959
|
if (this.comstockConfig) {
|
|
72976
72960
|
this.comstock = new Comstock(this.comstockConfig.url);
|
|
@@ -72986,7 +72970,7 @@ var AudiusLibs = /*#__PURE__*/function () {
|
|
|
72986
72970
|
this.File = _construct(File, [this.User].concat(services));
|
|
72987
72971
|
this.Rewards = _construct(Rewards, [this.ServiceProvider].concat(services));
|
|
72988
72972
|
|
|
72989
|
-
case
|
|
72973
|
+
case 51:
|
|
72990
72974
|
case "end":
|
|
72991
72975
|
return _context.stop();
|
|
72992
72976
|
}
|
|
@@ -73001,53 +72985,14 @@ var AudiusLibs = /*#__PURE__*/function () {
|
|
|
73001
72985
|
return init;
|
|
73002
72986
|
}()
|
|
73003
72987
|
}], [{
|
|
73004
|
-
key: "
|
|
72988
|
+
key: "configIdentityService",
|
|
73005
72989
|
value:
|
|
73006
|
-
/**
|
|
73007
|
-
* Configures a discovery provider wrapper
|
|
73008
|
-
* @param {Set<string>?} whitelist whether or not to include only specified nodes (default no whitelist)
|
|
73009
|
-
* @param {Set<string>?} blacklist whether or not to exclude specified nodes (default no blacklist)
|
|
73010
|
-
* @param {number?} reselectTimeout timeout to clear locally cached discovery providers
|
|
73011
|
-
* @param {(selection: string) => void?} selectionCallback invoked with the select discovery provider
|
|
73012
|
-
* @param {object?} monitoringCallbacks callbacks to be invoked with metrics from requests sent to a service
|
|
73013
|
-
* @param {function} monitoringCallbacks.request
|
|
73014
|
-
* @param {function} monitoringCallbacks.healthCheck
|
|
73015
|
-
* @param {number?} selectionRequestTimeout the amount of time (ms) an individual request should take before reselecting
|
|
73016
|
-
* @param {number?} selectionRequestRetries the number of retries to a given discovery node we make before reselecting
|
|
73017
|
-
* @param {number?} unhealthySlotDiffPlays the number of slots we would consider a discovery node unhealthy
|
|
73018
|
-
* @param {number?} unhealthyBlockDiff the number of missed blocks after which we would consider a discovery node unhealthy
|
|
73019
|
-
*/
|
|
73020
|
-
function configDiscoveryProvider() {
|
|
73021
|
-
var whitelist = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
73022
|
-
var blacklist = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
73023
|
-
var reselectTimeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
73024
|
-
var selectionCallback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
73025
|
-
var monitoringCallbacks = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
73026
|
-
var selectionRequestTimeout = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
|
|
73027
|
-
var selectionRequestRetries = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
73028
|
-
var unhealthySlotDiffPlays = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
73029
|
-
var unhealthyBlockDiff = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
|
|
73030
|
-
return {
|
|
73031
|
-
whitelist: whitelist,
|
|
73032
|
-
blacklist: blacklist,
|
|
73033
|
-
reselectTimeout: reselectTimeout,
|
|
73034
|
-
selectionCallback: selectionCallback,
|
|
73035
|
-
monitoringCallbacks: monitoringCallbacks,
|
|
73036
|
-
selectionRequestTimeout: selectionRequestTimeout,
|
|
73037
|
-
selectionRequestRetries: selectionRequestRetries,
|
|
73038
|
-
unhealthySlotDiffPlays: unhealthySlotDiffPlays,
|
|
73039
|
-
unhealthyBlockDiff: unhealthyBlockDiff
|
|
73040
|
-
};
|
|
73041
|
-
}
|
|
73042
72990
|
/**
|
|
73043
72991
|
* Configures an identity service wrapper
|
|
73044
72992
|
* @param {string} url
|
|
73045
72993
|
* @param {boolean?} useHedgehogLocalStorage whether or not to read hedgehog entropy in local storage
|
|
73046
72994
|
*/
|
|
73047
|
-
|
|
73048
|
-
}, {
|
|
73049
|
-
key: "configIdentityService",
|
|
73050
|
-
value: function configIdentityService(url) {
|
|
72995
|
+
function configIdentityService(url) {
|
|
73051
72996
|
var useHedgehogLocalStorage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
73052
72997
|
return {
|
|
73053
72998
|
url: url,
|