Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@api3/airnode-admin

Package Overview
Dependencies
Maintainers
2
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@api3/airnode-admin - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

72

dist/src/cli.js

@@ -187,3 +187,3 @@ "use strict";

xpub = _a.sent();
console.log("Airnode xpub: " + xpub);
console.log("Airnode xpub: ".concat(xpub));
return [2 /*return*/];

@@ -219,3 +219,3 @@ }

sponsorWalletAddress = _a.sent();
console.log("Sponsor wallet address: " + sponsorWalletAddress);
console.log("Sponsor wallet address: ".concat(sponsorWalletAddress));
return [2 /*return*/];

@@ -226,5 +226,5 @@ }

.command('sponsor-requester', 'Allows a requester to make requests that will be fulfilled by the Airnode using the sponsor wallet', __assign(__assign(__assign({}, airnodeRrpCommands), sponsorWallet), { 'requester-address': requesterAddress }), function (args) { return __awaiter(void 0, void 0, void 0, function () {
var airnodeRrp, requesterAddress, _a, _b, _c;
return __generator(this, function (_d) {
switch (_d.label) {
var airnodeRrp, requesterAddress, _a, _b, _c, _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0: return [4 /*yield*/, evm.getAirnodeRrp(args['provider-url'], {

@@ -235,11 +235,11 @@ airnodeRrpAddress: args['airnode-rrp'],

case 1:
airnodeRrp = _d.sent();
airnodeRrp = _e.sent();
return [4 /*yield*/, admin.sponsorRequester(airnodeRrp, args['requester-address'])];
case 2:
requesterAddress = _d.sent();
requesterAddress = _e.sent();
_b = (_a = console).log;
_c = "Requester address " + requesterAddress + " is now sponsored by ";
_d = (_c = "Requester address ".concat(requesterAddress, " is now sponsored by ")).concat;
return [4 /*yield*/, airnodeRrp.signer.getAddress()];
case 3:
_b.apply(_a, [_c + (_d.sent())]);
_b.apply(_a, [_d.apply(_c, [_e.sent()])]);
return [2 /*return*/];

@@ -250,5 +250,5 @@ }

.command('unsponsor-requester', 'Disallow a requester to make requests to the Airnode', __assign(__assign(__assign({}, airnodeRrpCommands), sponsorWallet), { 'requester-address': requesterAddress }), function (args) { return __awaiter(void 0, void 0, void 0, function () {
var airnodeRrp, requesterAddress, _a, _b, _c;
return __generator(this, function (_d) {
switch (_d.label) {
var airnodeRrp, requesterAddress, _a, _b, _c, _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0: return [4 /*yield*/, evm.getAirnodeRrp(args['provider-url'], {

@@ -259,11 +259,11 @@ airnodeRrpAddress: args['airnode-rrp'],

case 1:
airnodeRrp = _d.sent();
airnodeRrp = _e.sent();
return [4 /*yield*/, admin.unsponsorRequester(airnodeRrp, args['requester-address'])];
case 2:
requesterAddress = _d.sent();
requesterAddress = _e.sent();
_b = (_a = console).log;
_c = "Requester address " + requesterAddress + " is no longer sponsored by ";
_d = (_c = "Requester address ".concat(requesterAddress, " is no longer sponsored by ")).concat;
return [4 /*yield*/, airnodeRrp.signer.getAddress()];
case 3:
_b.apply(_a, [_c + (_d.sent())]);
_b.apply(_a, [_d.apply(_c, [_e.sent()])]);
return [2 /*return*/];

@@ -283,3 +283,3 @@ }

status = _a.sent();
console.log("Requester address sponsored: " + status);
console.log("Requester address sponsored: ".concat(status));
return [2 /*return*/];

@@ -308,3 +308,3 @@ }

templateId = _a.sent();
console.log("Template ID: " + templateId);
console.log("Template ID: ".concat(templateId));
return [2 /*return*/];

@@ -346,3 +346,3 @@ }

withdrawalRequestId = _a.sent();
console.log("Withdrawal request ID: " + withdrawalRequestId);
console.log("Withdrawal request ID: ".concat(withdrawalRequestId));
return [2 /*return*/];

@@ -363,3 +363,3 @@ }

if (response) {
console.log("Withdrawn amount: " + response.amount);
console.log("Withdrawn amount: ".concat(response.amount));
}

@@ -391,3 +391,3 @@ else {

endpointId = _a.sent();
console.log("Endpoint ID: " + endpointId);
console.log("Endpoint ID: ".concat(endpointId));
return [2 /*return*/];

@@ -410,3 +410,3 @@ }

_a.sent();
console.log("Whitelist expiration: " + new Date(args['expiration-timestamp']).toUTCString() + " (" + args['expiration-timestamp'] + ")");
console.log("Whitelist expiration: ".concat(new Date(args['expiration-timestamp']).toUTCString(), " (").concat(args['expiration-timestamp'], ")"));
return [2 /*return*/];

@@ -429,3 +429,3 @@ }

_a.sent();
console.log("Whitelist expiration: " + new Date(args['expiration-timestamp']).toUTCString() + " (" + args['expiration-timestamp'] + ")");
console.log("Whitelist expiration: ".concat(new Date(args['expiration-timestamp']).toUTCString(), " (").concat(args['expiration-timestamp'], ")"));
return [2 /*return*/];

@@ -448,3 +448,3 @@ }

_a.sent();
console.log("Whitelist status: " + args['indefinite-whitelist-status']);
console.log("Whitelist status: ".concat(args['indefinite-whitelist-status']));
return [2 /*return*/];

@@ -483,3 +483,3 @@ }

isRequesterWhitelisted = _a.sent();
console.log("Is requester whitelisted: " + isRequesterWhitelisted);
console.log("Is requester whitelisted: ".concat(isRequesterWhitelisted));
return [2 /*return*/];

@@ -489,2 +489,20 @@ }

}); })
.command('generate-mnemonic', 'Generates a random mnemonic. Uses "ethers.Wallet.createRandom" under the hood.', function () { return __awaiter(void 0, void 0, void 0, function () {
var mnemonic, lines;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, admin.generateMnemonic()];
case 1:
mnemonic = _a.sent();
lines = [
'This mnemonic is created locally on your machine using "ethers.Wallet.createRandom" under the hood.',
'Make sure to back it up securely, e.g., by writing it down on a piece of paper:',
'',
mnemonic,
];
lines.forEach(function (line) { return console.log(line); });
return [2 /*return*/];
}
});
}); })
.demandCommand(1)

@@ -496,5 +514,5 @@ .strict()

else if (err instanceof Error)
console.log("Command failed with unexpected error:\n\n" + err.message);
console.log("Command failed with unexpected error:\n\n".concat(err.message));
else
console.log("Command failed with unexpected error:\n\n" + err);
console.log("Command failed with unexpected error:\n\n".concat(err));
(0, process_1.exit)(1);

@@ -501,0 +519,0 @@ })

@@ -69,1 +69,2 @@ import * as airnodeAbi from '@api3/airnode-abi';

export declare function isRequesterWhitelisted(requesterAuthorizerWithAirnode: RequesterAuthorizerWithAirnode, airnodeAddress: string, endpointId: string, requesterAddress: string): Promise<boolean>;
export declare function generateMnemonic(): Promise<string>;

@@ -85,3 +85,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.isRequesterWhitelisted = exports.getWhitelistStatus = exports.setIndefiniteWhitelistStatus = exports.extendWhitelistExpiration = exports.setWhitelistExpiration = exports.fulfillWithdrawal = exports.sponsorToWithdrawalRequestCount = exports.sponsorToRequesterToSponsorshipStatus = exports.getTemplates = exports.getTemplate = exports.requesterToRequestCountPlusOne = exports.deriveEndpointId = exports.checkWithdrawalRequest = exports.requestWithdrawal = exports.createTemplate = exports.unsponsorRequester = exports.sponsorRequester = exports.deriveSponsorWalletAddress = exports.verifyAirnodeXpub = exports.deriveAirnodeXpub = exports.deriveWalletPathFromSponsorAddress = void 0;
exports.generateMnemonic = exports.isRequesterWhitelisted = exports.getWhitelistStatus = exports.setIndefiniteWhitelistStatus = exports.extendWhitelistExpiration = exports.setWhitelistExpiration = exports.fulfillWithdrawal = exports.sponsorToWithdrawalRequestCount = exports.sponsorToRequesterToSponsorshipStatus = exports.getTemplates = exports.getTemplate = exports.requesterToRequestCountPlusOne = exports.deriveEndpointId = exports.checkWithdrawalRequest = exports.requestWithdrawal = exports.createTemplate = exports.unsponsorRequester = exports.sponsorRequester = exports.deriveSponsorWalletAddress = exports.verifyAirnodeXpub = exports.deriveAirnodeXpub = exports.deriveWalletPathFromSponsorAddress = void 0;
var airnodeAbi = __importStar(require("@api3/airnode-abi"));

@@ -116,3 +116,3 @@ var ethers_1 = require("ethers");

}
return "0/" + paths.join('/');
return "0/".concat(paths.join('/'));
};

@@ -131,3 +131,3 @@ exports.deriveWalletPathFromSponsorAddress = deriveWalletPathFromSponsorAddress;

if (airnodeAddress !== hdNode.derivePath('0/0').address) {
throw new Error("xpub does not belong to Airnode: " + airnodeAddress);
throw new Error("xpub does not belong to Airnode: ".concat(airnodeAddress));
}

@@ -248,3 +248,3 @@ return hdNode;

return __generator(this, function (_a) {
return [2 /*return*/, ethers_1.ethers.utils.keccak256(ethers_1.ethers.utils.defaultAbiCoder.encode(['string'], [oisTitle + "_" + endpointName]))];
return [2 /*return*/, ethers_1.ethers.utils.keccak256(ethers_1.ethers.utils.defaultAbiCoder.encode(['string', 'string'], [oisTitle, endpointName]))];
});

@@ -423,2 +423,12 @@ });

exports.isRequesterWhitelisted = isRequesterWhitelisted;
function generateMnemonic() {
return __awaiter(this, void 0, void 0, function () {
var wallet;
return __generator(this, function (_a) {
wallet = ethers_1.ethers.Wallet.createRandom();
return [2 /*return*/, wallet.mnemonic.phrase];
});
});
}
exports.generateMnemonic = generateMnemonic;
//# sourceMappingURL=implementation.js.map

@@ -48,2 +48,3 @@ import { RequesterAuthorizerWithAirnode, AirnodeRrp } from '@api3/airnode-protocol';

isRequesterWhitelisted: (airnodeAddress: string, endpointId: string, requesterAddress: string) => Promise<boolean>;
generateMnemonic: () => Promise<string>;
}

@@ -78,2 +78,3 @@ "use strict";

};
this.generateMnemonic = function () { return admin.generateMnemonic(); };
}

@@ -80,0 +81,0 @@ AdminSdk.getAirnodeRrp = evm.getAirnodeRrp;

{
"name": "@api3/airnode-admin",
"license": "MIT",
"version": "0.2.2",
"version": "0.3.0",
"private": false,

@@ -20,10 +20,11 @@ "bin": {

"test:e2e": "jest --selectProjects e2e",
"test:e2e:watch": "jest --coverage --watch --selectProjects e2e",
"test": "SILENCE_LOGGER=true jest --coverage --selectProjects unit",
"test:watch": "SILENCE_LOGGER=true jest --coverage --watch --selectProjects unit",
"test:e2e:update-snapshot": "yarn test:e2e --updateSnapshot",
"test:e2e:watch": "yarn test:e2e --watch",
"test": "SILENCE_LOGGER=true jest --selectProjects unit",
"test:watch": "yarn test --watch",
"test:watch:debug": "jest \"implementation.test\" --selectProjects unit --watch"
},
"dependencies": {
"@api3/airnode-abi": "^0.2.2",
"@api3/airnode-protocol": "^0.2.2",
"@api3/airnode-abi": "^0.3.0",
"@api3/airnode-protocol": "^0.3.0",
"ethers": "^5.4.5",

@@ -30,0 +31,0 @@ "lodash": "^4.17.21",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc