- Code: Select all
await gateway.connect(...)
questa non viene riconosciuta da Inde Cloud e se provo a sostituirla con:
- Code: Select all
yeld gateway.connect(...)
mi da errore: yeld non può essere usato su un metodo sconosciuto.
come ne esco?
It is currently 8 June 2025, 20:14 Advanced search
await gateway.connect(...)
yeld gateway.connect(...)
async function mioMetodo() {
...
await metodoConAwait("Hello");
...
}
await metodoAsync('a','b','c');
...
metodoAsync('a','b','c').then(function() {
...
});
const gateway = new Gateway();
await gateway.connect(ccp, { wallet, identity: 'admin' , discovery: {enabled: true, asLocalhost:false }});
console.log('Connected to Fabric gateway.');
let fSuccess = function (res) {
// op success
};
let fError = function (err) {
// op error
};
gateway.connect(ccp, {wallet, identity : 'admin', discovery : {enabled : true, asLocalhost : false} }, fSuccess, fError);
const { FileSystemWallet, Gateway } = require('fabric-network');
const fs = require('fs');
const path = require('path');
// Parse the connection profile. This would be the path to the file downloaded
// from the IBM Blockchain Platform operational console.
const ccpPath = path.resolve(__dirname, 'connection.json');
const ccp = JSON.parse(fs.readFileSync(ccpPath, 'utf8'));
const fabric = require('fabric-network');
const path = require('path');
var f = app.fs.file($connection, App.Fs.internalType.resource);
yield f.open();
var s = yield f.readAll();
yield f.close();
const ccp = JSON.parse(s);
// Configure a wallet. This wallet must already be primed with an identity that
// the application can use to interact with the peer node.
const walletPath = path.resolve(__dirname, '_idwallet');
const wallet = new FileSystemWallet(walletPath);
const walletPath = path.resolve(__dirname, '_idwallet');
const myWallet = new fabric.FileSystemWallet(walletPath);
// Create a new gateway, and connect to the gateway peer node(s). The identity
// specified must already exist in the specified wallet.
const gateway = new Gateway();
await gateway.connect(ccp, { wallet, identity: 'admin' , discovery: {enabled: true, asLocalhost:false }});
const gateway = new fabric.Gateway();
gateway.connect(ccp, {wallet: myWallet, identity : 'admin', discovery : {enabled : true, asLocalhost : false} }, fSuccess, fError);
export class Gateway {
constructor();
public connect(config: Client | string | object, options: GatewayOptions): Promise<void>;
...
}
async connect(config, options) {
..
}
import { Channel, ChannelPeer, TransactionId, User } from 'fabric-client';
import Client = require('fabric-client');
Return to Tips & Tricks - Cloud
Users browsing this forum: No registered users and 7 guests