https://medium.com/upstate-interactive/how-to-connect-an-angular-application-to-a-smart-contract-using-web3js-f83689fb6909
npm install
web3
web3modal
@walletconnect/web3-provider
crypto-browserify
assert
stream-http
https-browserify
os-browserify
@types/prop-types
url
Il vas falloir indiquer a angular comment utiliser tout ca
dans tsconfig.json
"paths" : {
"crypto": ["./node_modules/crypto-browserify"],
"stream": ["./node_modules/stream-browserify"],
"assert": ["./node_modules/assert"],
"http": ["./node_modules/stream-http"],
"https": ["./node_modules/https-browserify"],
"os": ["./node_modules/os-browserify"],
"prop-types":["./node_modules/prop-types"],
"url": ["./node_modules/url"]
}
"angularCompilerOptions": {
...
"allowSyntheticDefaultImports": true
}
Ensuite dans polyfill.ts
Sinon on ne peux pas utiliser ces variables / methodes qui sont propres a nodejs
(window as any).global = window;
global.Buffer = global.Buffer || require('buffer').Buffer;
(window as any).process = {
version: '',
env: {
NODE_DEBUG: false,
DEBUG: undefined
},
nextTick: require('next-tick')
};