PHP WebShell
Текущая директория: /usr/lib/node_modules/bitgo/node_modules/@near-js/accounts/lib/commonjs
Просмотр файла: account_creator.cjs
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UrlAccountCreator = exports.LocalAccountCreator = exports.AccountCreator = void 0;
/**
* Account creator provides an interface for implementations to actually create accounts
*/
class AccountCreator {
}
exports.AccountCreator = AccountCreator;
class LocalAccountCreator extends AccountCreator {
masterAccount;
initialBalance;
constructor(masterAccount, initialBalance) {
super();
this.masterAccount = masterAccount;
this.initialBalance = initialBalance;
}
/**
* Creates an account using a masterAccount, meaning the new account is created from an existing account
* @param newAccountId The name of the NEAR account to be created
* @param publicKey The public key from the masterAccount used to create this account
* @returns {Promise<void>}
*/
async createAccount(newAccountId, publicKey) {
await this.masterAccount.createAccount(newAccountId, publicKey, this.initialBalance);
}
}
exports.LocalAccountCreator = LocalAccountCreator;
class UrlAccountCreator extends AccountCreator {
connection;
helperUrl;
constructor(connection, helperUrl) {
super();
this.connection = connection;
this.helperUrl = helperUrl;
}
/**
* Creates an account using a helperUrl
* This is [hosted here](https://helper.nearprotocol.com) or set up locally with the [near-contract-helper](https://github.com/nearprotocol/near-contract-helper) repository
* @param newAccountId The name of the NEAR account to be created
* @param publicKey The public key from the masterAccount used to create this account
* @returns {Promise<void>}
*/
async createAccount(newAccountId, publicKey) {
await fetch(`${this.helperUrl}/account`, {
body: JSON.stringify({ newAccountId, newAccountPublicKey: publicKey.toString() }),
method: 'POST',
});
}
}
exports.UrlAccountCreator = UrlAccountCreator;
Выполнить команду
Для локальной разработки. Не используйте в интернете!