Skip to content

Commit 1e566a5

Browse files
standardize operator credential variable names (#197)
Signed-off-by: krystal <56278409+theekrystallee@users.noreply.github.com>
1 parent 4a64225 commit 1e566a5

9 files changed

+60
-60
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Apache License
1+
Apache License
22
Version 2.0, January 2004
33
http://www.apache.org/licenses/
44

sdks-and-apis/sdks/client.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -91,28 +91,28 @@ The operator is the account that will, by default, pay the transaction fee for t
9191
{% tab title="Java" %}
9292
```java
9393
// Operator account ID and private key from string value
94-
AccountId MY_ACCOUNT_ID = AccountId.fromString("0.0.96928");
95-
Ed25519PrivateKey MY_PRIVATE_KEY = PrivateKey.fromString("302e020100300506032b657004220420b9c3ebac81a72aafa5490cc78111643d016d311e60869436fbb91c7330796928");
94+
AccountId OPERATOR_ID = AccountId.fromString("0.0.96928");
95+
Ed25519PrivateKey OPERATOR_KEY = PrivateKey.fromString("302e020100300506032b657004220420b9c3ebac81a72aafa5490cc78111643d016d311e60869436fbb91c7330796928");
9696

9797
// Pre-configured client for test network (testnet)
9898
Client client = Client.forTestnet()
9999

100100
//Set the operator with the account ID and private key
101-
client.setOperator(MY_ACCOUNT_ID, MY_PRIVATE_KEY);
101+
client.setOperator(OPERATOR_ID, OPERATOR_KEY);
102102
```
103103
{% endtab %}
104104

105105
{% tab title="JavaScript" %}
106106
```javascript
107107
// Your account ID and private key from string value
108-
const MY_ACCOUNT_ID = AccountId.fromString("0.0.96928");
109-
const MY_PRIVATE_KEY = PrivateKey.fromString("302e020100300506032b657004220420b9c3ebac81a72aafa5490cc78111643d016d311e60869436fbb91c7330796928");
108+
const OPERATOR_ID = AccountId.fromString("0.0.96928");
109+
const OPERATOR_KEY = PrivateKey.fromString("302e020100300506032b657004220420b9c3ebac81a72aafa5490cc78111643d016d311e60869436fbb91c7330796928");
110110

111111
// Pre-configured client for test network (testnet)
112112
const client = Client.forTestnet()
113113

114114
//Set the operator with the account ID and private key
115-
client.setOperator(MY_ACCOUNT_ID, MY_PRIVATE_KEY);
115+
client.setOperator(OPERATOR_ID, OPERATOR_KEY);
116116
```
117117
{% endtab %}
118118

@@ -161,30 +161,30 @@ The .env file is created in the root directory of the SDK. The `.env` file store
161161
**.env**
162162

163163
```
164-
MY_ACCOUNT_ID=0.0.941
165-
MY_PRIVATE_KEY=302e020100300506032b65700422042012a4a4add3d885bd61d7ce5cff88c5ef2d510651add00a7f64cb90de3359bc5e
164+
OPERATOR_ID=0.0.941
165+
OPERATOR_KEY=302e020100300506032b65700422042012a4a4add3d885bd61d7ce5cff88c5ef2d510651add00a7f64cb90de3359bc5e
166166
```
167167

168168
{% tabs %}
169169
{% tab title="Java" %}
170170
```java
171171
//Grab the account ID and private key of the operator account from the .env file
172-
AccountId MY_ACCOUNT_ID = AccountId.fromString(Objects.requireNonNull(Dotenv.load().get("OPERATOR_ID")));
173-
Ed25519PrivateKey MY_PRIVATE_KEY = Ed25519PrivateKey.fromString(Objects.requireNonNull(Dotenv.load().get("OPERATOR_KEY")));
172+
AccountId OPERATOR_ID = AccountId.fromString(Objects.requireNonNull(Dotenv.load().get("OPERATOR_ID")));
173+
Ed25519PrivateKey OPERATOR_KEY = Ed25519PrivateKey.fromString(Objects.requireNonNull(Dotenv.load().get("OPERATOR_KEY")));
174174

175175
// Pre-configured client for test network (testnet)
176176
Client client = Client.forTestnet()
177177

178178
//Set the operator with the account ID and private key
179-
client.setOperator(MY_ACCOUNT_ID, MY_PRIVATE_KEY);
179+
client.setOperator(OPERATOR_ID, OPERATOR_KEY);
180180
```
181181
{% endtab %}
182182

183183
{% tab title="JavaScript" %}
184184
```javascript
185185
//Grab the account ID and private key of the operator account from the .env file
186-
const myAccountId = process.env.MY_ACCOUNT_ID;
187-
const myPrivateKey = process.env.MY_PRIVATE_KEY;
186+
const myAccountId = process.env.OPERATOR_ID;
187+
const myPrivateKey = process.env.OPERATOR_KEY;
188188

189189
// Pre-configured client for test network (testnet)
190190
const client = Client.forTestnet()
@@ -202,16 +202,16 @@ client.setOperator(myAccountId, myPrivateKey);
202202
}
203203

204204
//Get the operator account ID and private key
205-
MY_ACCOUNT_ID := os.Getenv("MY_ACCOUNT_ID")
206-
MY_PRIVATE_KEY := os.Getenv("MY_PRIVATE_KEY")
205+
OPERATOR_ID := os.Getenv("OPERATOR_ID")
206+
OPERATOR_KEY := os.Getenv("OPERATOR_KEY")
207207

208208

209-
myAccountID, err := hedera.AccountIDFromString(MY_ACCOUNT_ID)
209+
myAccountID, err := hedera.AccountIDFromString(OPERATOR_ID)
210210
if err != nil {
211211
panic(err)
212212
}
213213

214-
myPrivateKey, err := hedera.PrivateKeyFromString(MY_PRIVATE_KEY)
214+
myPrivateKey, err := hedera.PrivateKeyFromString(OPERATOR_KEY)
215215
if err != nil {
216216
panic(err)
217217
}
@@ -226,8 +226,8 @@ client.setOperator(myAccountId, myPrivateKey);
226226
}
227227

228228
// Get the operator account ID and private key
229-
let my_account_id = AccountId::from_str(std::env::var("MY_ACCOUNT_ID").expect("MY_ACCOUNT_ID environment variable not set")).expect("Invalid MY_ACCOUNT_ID format");
230-
let my_private_key = PrivateKey::from_str(std::env::var("MY_PRIVATE_KEY").expect("MY_PRIVATE_KEY environment variable not set")).expect("Invalid MY_PRIVATE_KEY format");
229+
let my_account_id = AccountId::from_str(std::env::var("OPERATOR_ID").expect("OPERATOR_ID environment variable not set")).expect("Invalid OPERATOR_ID format");
230+
let my_private_key = PrivateKey::from_str(std::env::var("OPERATOR_KEY").expect("OPERATOR_KEY environment variable not set")).expect("Invalid OPERATOR_KEY format");
231231
```
232232
{% endtab %}
233233
{% endtabs %}

tutorials/consensus/submit-message-to-private-topic.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ public class CreateTopicTutorial {
243243
public static void main(String[] args) throws TimeoutException, PrecheckStatusException, ReceiptStatusException, InterruptedException {
244244

245245
// Grab your Hedera testnet account ID and private key
246-
AccountId myAccountId = AccountId.fromString(Dotenv.load().get("MY_ACCOUNT_ID"));
247-
PrivateKey myPrivateKey = PrivateKey.fromString(Dotenv.load().get("MY_PRIVATE_KEY"));
246+
AccountId myAccountId = AccountId.fromString(Dotenv.load().get("OPERATOR_ID"));
247+
PrivateKey myPrivateKey = PrivateKey.fromString(Dotenv.load().get("OPERATOR_KEY"));
248248

249249
// Build your Hedera client
250250
Client client = Client.forTestnet();
@@ -311,8 +311,8 @@ const {
311311
} = require("@hashgraph/sdk");
312312

313313
// Grab the OPERATOR_ID and OPERATOR_KEY from the .env file
314-
const myAccountId = process.env.MY_ACCOUNT_ID;
315-
const myPrivateKey = process.env.MY_PRIVATE_KEY;
314+
const myAccountId = process.env.OPERATOR_ID;
315+
const myPrivateKey = process.env.OPERATOR_KEY;
316316

317317
// Build Hedera testnet and mirror node client
318318
const client = Client.forTestnet();
@@ -390,12 +390,12 @@ func main() {
390390
}
391391

392392
// Grab your testnet account ID and private key from the .env file
393-
myAccountId, err := hedera.AccountIDFromString(os.Getenv("MY_ACCOUNT_ID"))
393+
myAccountId, err := hedera.AccountIDFromString(os.Getenv("OPERATOR_ID"))
394394
if err != nil {
395395
panic(err)
396396
}
397397

398-
myPrivateKey, err := hedera.PrivateKeyFromString(os.Getenv("MY_PRIVATE_KEY"))
398+
myPrivateKey, err := hedera.PrivateKeyFromString(os.Getenv("OPERATOR_KEY"))
399399
if err != nil {
400400
panic(err)
401401
}

tutorials/consensus/submit-your-first-message.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ public class CreateTopicTutorial {
228228
public static void main(String[] args) throws TimeoutException, PrecheckStatusException, ReceiptStatusException, InterruptedException {
229229

230230
// Grab your Hedera testnet account ID and private key
231-
AccountId myAccountId = AccountId.fromString(Dotenv.load().get("MY_ACCOUNT_ID"));
232-
PrivateKey myPrivateKey = PrivateKey.fromString(Dotenv.load().get("MY_PRIVATE_KEY"));
231+
AccountId myAccountId = AccountId.fromString(Dotenv.load().get("OPERATOR_ID"));
232+
PrivateKey myPrivateKey = PrivateKey.fromString(Dotenv.load().get("OPERATOR_KEY"));
233233

234234
// Build your Hedera client
235235
Client client = Client.forTestnet();
@@ -293,8 +293,8 @@ const {
293293
} = require("@hashgraph/sdk");
294294

295295
// Grab the OPERATOR_ID and OPERATOR_KEY from the .env file
296-
const myAccountId = process.env.MY_ACCOUNT_ID;
297-
const myPrivateKey = process.env.MY_PRIVATE_KEY;
296+
const myAccountId = process.env.OPERATOR_ID;
297+
const myPrivateKey = process.env.OPERATOR_KEY;
298298

299299
// Build Hedera testnet and mirror node client
300300
const client = Client.forTestnet();
@@ -366,12 +366,12 @@ func main() {
366366
}
367367

368368
// Grab your testnet account ID and private key from the .env file
369-
myAccountId, err := hedera.AccountIDFromString(os.Getenv("MY_ACCOUNT_ID"))
369+
myAccountId, err := hedera.AccountIDFromString(os.Getenv("OPERATOR_ID"))
370370
if err != nil {
371371
panic(err)
372372
}
373373

374-
myPrivateKey, err := hedera.PrivateKeyFromString(os.Getenv("MY_PRIVATE_KEY"))
374+
myPrivateKey, err := hedera.PrivateKeyFromString(os.Getenv("OPERATOR_KEY"))
375375
if err != nil {
376376
panic(err)
377377
}

tutorials/more-tutorials/develop-a-hedera-dapp-integrated-with-walletconnect.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,8 +785,8 @@ Open `hedera-test-accounts` folder in a new visual studio code window.
785785
Create a new file and name it `.env` with the following contents. Remember to enter your account ID and your private key.
786786

787787
```shell
788-
MY_ACCOUNT_ID=<enter your account id>
789-
MY_PRIVATE_KEY=<enter your DER private key>
788+
OPERATOR_ID=<enter your account id>
789+
OPERATOR_KEY=<enter your DER private key>
790790
```
791791

792792
Within the `hedera-test-accounts` home directory, execute the following command in the terminal,

tutorials/token/create-and-transfer-an-nft-using-a-solidity-contract.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,8 +659,8 @@ const {
659659
metadata =
660660
"ipfs://bafyreie3ichmqul4xa7e6xcy34tylbuq2vf3gnjf7c55trg3b6xyjr4bku/metadata.json";
661661

662-
const operatorKey = PrivateKey.fromString(process.env.MY_PRIVATE_KEY);
663-
const operatorId = AccountId.fromString(process.env.MY_ACCOUNT_ID);
662+
const operatorKey = PrivateKey.fromString(process.env.OPERATOR_KEY);
663+
const operatorId = AccountId.fromString(process.env.OPERATOR_ID);
664664

665665
const client = Client.forTestnet().setOperator(operatorId, operatorKey);
666666

tutorials/token/create-and-transfer-your-first-fungible-token.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ public class CreateFungibleTutorial {
318318
public static void main(String[] args) throws TimeoutException, PrecheckStatusException, ReceiptStatusException {
319319

320320
//Grab your Hedera testnet account ID and private key
321-
AccountId myAccountId = AccountId.fromString(Objects.requireNonNull(Dotenv.load().get("MY_ACCOUNT_ID")));
322-
PrivateKey myPrivateKey = PrivateKey.fromString(Objects.requireNonNull(Dotenv.load().get("MY_PRIVATE_KEY")));
321+
AccountId myAccountId = AccountId.fromString(Objects.requireNonNull(Dotenv.load().get("OPERATOR_ID")));
322+
PrivateKey myPrivateKey = PrivateKey.fromString(Objects.requireNonNull(Dotenv.load().get("OPERATOR_KEY")));
323323

324324
//Create your Hedera testnet client
325325
Client client = Client.forTestnet();
@@ -545,12 +545,12 @@ func main() {
545545
}
546546

547547
//GRAB YOUR TESTNET ACCOUNT ID AND KEY FROMZ THE .ENV FILE
548-
myAccountId, err := hedera.AccountIDFromString(os.Getenv("MY_ACCOUNT_ID"))
548+
myAccountId, err := hedera.AccountIDFromString(os.Getenv("OPERATOR_ID"))
549549
if err != nil {
550550
panic(err)
551551
}
552552

553-
myPrivateKey, err := hedera.PrivateKeyFromString(os.Getenv("MY_PRIVATE_KEY"))
553+
myPrivateKey, err := hedera.PrivateKeyFromString(os.Getenv("OPERATOR_KEY"))
554554
if err != nil {
555555
panic(err)
556556
}

tutorials/token/create-and-transfer-your-first-nft.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,8 @@ public class CreateYourFirstNft {
570570
Dotenv dotenv = Dotenv.load();
571571

572572
// Grab your Hedera testnet account ID and private key
573-
AccountId myAccountId = AccountId.fromString(dotenv.get("MY_ACCOUNT_ID"));
574-
PrivateKey myPrivateKey = PrivateKey.fromStringDER(dotenv.get("MY_PRIVATE_KEY"));
573+
AccountId myAccountId = AccountId.fromString(dotenv.get("OPERATOR_ID"));
574+
PrivateKey myPrivateKey = PrivateKey.fromStringDER(dotenv.get("OPERATOR_KEY"));
575575

576576
// Create your Hedera testnet client
577577
Client client = Client.forTestnet();
@@ -937,12 +937,12 @@ func main() {
937937
}
938938

939939
// Grab your testnet account ID and private key from the .env file
940-
myAccountId, err := hedera.AccountIDFromString(os.Getenv("MY_ACCOUNT_ID"))
940+
myAccountId, err := hedera.AccountIDFromString(os.Getenv("OPERATOR_ID"))
941941
if err != nil {
942942
panic(err)
943943
}
944944

945-
myPrivateKey, err := hedera.PrivateKeyFromString(os.Getenv("MY_PRIVATE_KEY"))
945+
myPrivateKey, err := hedera.PrivateKeyFromString(os.Getenv("OPERATOR_KEY"))
946946
if err != nil {
947947
panic(err)
948948
}

tutorials/token/create-your-first-frictionless-airdrop-campaign.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,18 @@ dotenv.config();
5757

5858
async function main() {
5959
if (
60-
process.env.MY_ACCOUNT_ID == null ||
61-
process.env.MY_PRIVATE_KEY == null ||
60+
process.env.OPERATOR_ID == null ||
61+
process.env.OPERATOR_KEY == null ||
6262
process.env.HEDERA_NETWORK == null
6363
) {
6464
throw new Error(
65-
"Environment variables MY_ACCOUNT_ID, HEDERA_NETWORK, and MY_PRIVATE_KEY are required.",
65+
"Environment variables OPERATOR_ID, HEDERA_NETWORK, and OPERATOR_KEY are required.",
6666
);
6767
}
6868

6969
const client = Client.forName(process.env.HEDERA_NETWORK).setOperator(
70-
AccountId.fromString(process.env.MY_ACCOUNT_ID),
71-
PrivateKey.fromStringDer(process.env.MY_PRIVATE_KEY),
70+
AccountId.fromString(process.env.OPERATOR_ID),
71+
PrivateKey.fromStringDer(process.env.OPERATOR_KEY),
7272
);
7373

7474
/**
@@ -146,12 +146,12 @@ func main() {
146146
panic(fmt.Errorf("Unable to load environment variables from .env file. Error:\n%v\n", err))
147147
}
148148
149-
myAccountId, err := hedera.AccountIDFromString(os.Getenv("MY_ACCOUNT_ID"))
149+
myAccountId, err := hedera.AccountIDFromString(os.Getenv("OPERATOR_ID"))
150150
if err != nil {
151151
panic(err)
152152
}
153153
154-
myPrivateKey, err := hedera.PrivateKeyFromString(os.Getenv("MY_PRIVATE_KEY"))
154+
myPrivateKey, err := hedera.PrivateKeyFromString(os.Getenv("OPERATOR_KEY"))
155155
if err != nil {
156156
panic(err)
157157
}
@@ -729,8 +729,8 @@ By understanding these costs and who is responsible for them, you can build effi
729729
<summary><strong><code>.env</code> file example</strong></summary>
730730

731731
```
732-
MY_ACCOUNT_ID=0.0.1234
733-
MY_PRIVATE_KEY=302e020100300506032b657004220420ed5a93073.....
732+
OPERATOR_ID=0.0.1234
733+
OPERATOR_KEY=302e020100300506032b657004220420ed5a93073.....
734734
HEDERA_NETWORK=testnet
735735
```
736736

@@ -755,18 +755,18 @@ dotenv.config();
755755
756756
async function main() {
757757
if (
758-
process.env.MY_ACCOUNT_ID == null ||
759-
process.env.MY_PRIVATE_KEY == null ||
758+
process.env.OPERATOR_ID == null ||
759+
process.env.OPERATOR_KEY == null ||
760760
process.env.HEDERA_NETWORK == null
761761
) {
762762
throw new Error(
763-
"Environment variables MY_ACCOUNT_ID, HEDERA_NETWORK, and MY_PRIVATE_KEY are required.",
763+
"Environment variables OPERATOR_ID, HEDERA_NETWORK, and OPERATOR_KEY are required.",
764764
);
765765
}
766766
767767
const client = Client.forName(process.env.HEDERA_NETWORK).setOperator(
768-
AccountId.fromString(process.env.MY_ACCOUNT_ID),
769-
PrivateKey.fromStringDer(process.env.MY_PRIVATE_KEY),
768+
AccountId.fromString(process.env.OPERATOR_ID),
769+
PrivateKey.fromStringDer(process.env.OPERATOR_KEY),
770770
);
771771
772772
/**
@@ -1074,12 +1074,12 @@ func main() {
10741074
panic(fmt.Errorf("Unable to load environment variables from .env file. Error:\n%v\n", err))
10751075
}
10761076
1077-
myAccountId, err := hedera.AccountIDFromString(os.Getenv("MY_ACCOUNT_ID"))
1077+
myAccountId, err := hedera.AccountIDFromString(os.Getenv("OPERATOR_ID"))
10781078
if err != nil {
10791079
panic(err)
10801080
}
10811081
1082-
myPrivateKey, err := hedera.PrivateKeyFromString(os.Getenv("MY_PRIVATE_KEY"))
1082+
myPrivateKey, err := hedera.PrivateKeyFromString(os.Getenv("OPERATOR_KEY"))
10831083
if err != nil {
10841084
panic(err)
10851085
}

0 commit comments

Comments
 (0)