@@ -21,9 +21,7 @@ var astroDollar = new StellarSdk.Asset(
21
21
```
22
22
23
23
``` java
24
- KeyPair issuer = StellarSdk . Keypair . fromAccountId(
25
- " GC2BKLYOOYPDEFJKLKY6FNNRQMGFLVHJKQRGNSSRRGSMPGF32LHCQVGF" );
26
- Asset astroDollar = Asset . createNonNativeAsset(" AstroDollar" , issuer);
24
+ Asset astroDollar = Asset . createNonNativeAsset(" AstroDollar" , " GC2BKLYOOYPDEFJKLKY6FNNRQMGFLVHJKQRGNSSRRGSMPGF32LHCQVGF" );
27
25
```
28
26
29
27
``` json
@@ -106,7 +104,6 @@ server.loadAccount(receivingKeys.publicKey())
106
104
```
107
105
108
106
``` java
109
- Network . useTestNetwork();
110
107
Server server = new Server (" https://horizon-testnet.stellar.org" );
111
108
112
109
// Chaves para contas emitirem e receberem o novo ativo
@@ -116,11 +113,11 @@ KeyPair receivingKeys = KeyPair
116
113
.fromSecretSeed(" SDSAVCRE5JRAI7UFAVLE5IMIZRD6N6WOJUWKY4GFN34LOBEEUS4W2T2D" );
117
114
118
115
// Criar um objeto para representar o novo ativo
119
- Asset astroDollar = Asset . createNonNativeAsset(" AstroDollar" , issuingKeys);
116
+ Asset astroDollar = Asset . createNonNativeAsset(" AstroDollar" , issuingKeys. getAccountId() );
120
117
121
118
// Primeiro, a conta recipiente deve confiar no ativo
122
- AccountResponse receiving = server. accounts(). account(receivingKeys);
123
- Transaction allowAstroDollars = new Transaction .Builder (receiving)
119
+ AccountResponse receiving = server. accounts(). account(receivingKeys. getAccountId() );
120
+ Transaction allowAstroDollars = new Transaction .Builder (receiving, Network . TESTNET )
124
121
.addOperation(
125
122
// A operação `ChangeTrust` cria (ou altera) uma trustline
126
123
// O segundo parâmetro limita a quantidade que a conta pode manter
@@ -130,10 +127,10 @@ allowAstroDollars.sign(receivingKeys);
130
127
server. submitTransaction(allowAstroDollars);
131
128
132
129
// Depois, a conta emissora de fato envia um pagamento usando o ativo
133
- AccountResponse issuing = server. accounts(). account(issuingKeys);
130
+ AccountResponse issuing = server. accounts(). account(issuingKeys. getAccountId() );
134
131
Transaction sendAstroDollars = new Transaction .Builder (issuing)
135
132
.addOperation(
136
- new PaymentOperation .Builder (receivingKeys, astroDollar, " 10" ). build())
133
+ new PaymentOperation .Builder (receivingKeys. getAccountId() , astroDollar, " 10" ). build())
137
134
.build();
138
135
sendAstroDollars. sign(issuingKeys);
139
136
server. submitTransaction(sendAstroDollars);
@@ -233,17 +230,16 @@ server.loadAccount(issuingKeys.publicKey())
233
230
```
234
231
235
232
``` java
236
- Network . useTestNetwork();
237
233
Server server = new Server (" https://horizon-testnet.stellar.org" );
238
234
239
235
// Chaves para a conta emissora
240
236
KeyPair issuingKeys = KeyPair
241
237
.fromSecretSeed(" SCZANGBA5YHTNYVVV4C3U252E2B6P6F5T3U6MM63WBSBZATAQI3EBTQ4" );
242
- AccountResponse sourceAccount = server. accounts(). account(issuingKeys);
238
+ AccountResponse sourceAccount = server. accounts(). account(issuingKeys. getAccountId() );
243
239
244
- Transaction setHomeDomain = new Transaction .Builder (sourceAccount)
240
+ Transaction setHomeDomain = new Transaction .Builder (sourceAccount, Network . TESTNET )
245
241
.addOperation(new SetOptionsOperation .Builder ()
246
- .setHomeDomain(" seudominio .com" ) . build( )
242
+ .setHomeDomain(" yourdomain .com" )
247
243
.build();
248
244
setAuthorization. sign(issuingKeys);
249
245
server. submitTransaction(setHomeDomain);
@@ -291,15 +287,14 @@ server.submitTransaction(transaction);
291
287
```java
292
288
import org.stellar.sdk. AccountFlag ;
293
289
294
- Network . useTestNetwork();
295
290
Server server = new Server (" https://horizon-testnet.stellar.org" );
296
291
297
292
// Chaves para a conta emissora
298
293
KeyPair issuingKeys = KeyPair
299
294
.fromSecretSeed(" SCZANGBA5YHTNYVVV4C3U252E2B6P6F5T3U6MM63WBSBZATAQI3EBTQ4" );
300
- AccountResponse sourceAccount = server. accounts(). account(issuingKeys);
295
+ AccountResponse sourceAccount = server. accounts(). account(issuingKeys. getAccountId() );
301
296
302
- Transaction setAuthorization = new Transaction .Builder (sourceAccount)
297
+ Transaction setAuthorization = new Transaction .Builder (sourceAccount, Network . TESTNET )
303
298
.addOperation(new SetOptionsOperation .Builder ()
304
299
.setSetFlags(
305
300
AccountFlag . AUTH_REQUIRED_FLAG. getValue() |
@@ -337,14 +332,11 @@ server.loadAccount(accountId).then(function(account) {
337
332
338
333
```java
339
334
Asset astroDollar = Asset . createNonNativeAsset(
340
- " AstroDollar" ,
341
- KeyPair . fromAccountId(
342
- " GC2BKLYOOYPDEFJKLKY6FNNRQMGFLVHJKQRGNSSRRGSMPGF32LHCQVGF" ));
335
+ " AstroDollar" , " GC2BKLYOOYPDEFJKLKY6FNNRQMGFLVHJKQRGNSSRRGSMPGF32LHCQVGF"
336
+ );
343
337
344
338
// Carregar a conta que se quer verificar
345
- KeyPair keysToCheck = KeyPair . fromAccountId(
346
- " GA2C5RFPE6GCKMY3US5PAB6UZLKIGSPIUKSLRB6Q723BM2OARMDUYEJ5" );
347
- AccountResponse accountToCheck = server. accounts(). account(keysToCheck);
339
+ AccountResponse accountToCheck = server. accounts(). account(" GA2C5RFPE6GCKMY3US5PAB6UZLKIGSPIUKSLRB6Q723BM2OARMDUYEJ5" );
348
340
349
341
// Ver se há saldos referentes ao código do ativo e emissora que estamos procurando
350
342
boolean trusted = false ;
0 commit comments