Work after api break
This commit is contained in:
Generated
+904
-82
File diff suppressed because it is too large
Load Diff
+2
-1
@@ -21,7 +21,8 @@
|
|||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
"chai": "^4.3.4",
|
"chai": "^4.3.4",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
"xrpio": "^0.2.1",
|
"rjsvm": "^0.3.0",
|
||||||
|
"xrpio": "^0.3.0",
|
||||||
"xrpl": "^2.7.0"
|
"xrpl": "^2.7.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
"oracle": true,
|
"oracle": true,
|
||||||
"secret": "sEdVwoxNkoxvRxRDaShXwWzVUkrgztd",
|
"secret": "sEd7WCM4AD8r19eyPfiG7nx6Vkx1bbU",
|
||||||
"treasuryAddress": "rnhVAr4ri5aTBUfoEzi4PPgc5yVo7jrAa5",
|
"treasuryAddress": "rhfkTrKqRNKFyY3wWqaHLSxgwfc1eMfvWz",
|
||||||
"contractAddress": "rakoA9cbkj9SbArhsQAiYFqm1fYYeWvrji", //pk: sEdVYHB7KJuK8jB1HF6Q8HQq62izZ9f
|
"contractAddress": "rrha5qSA3KUxwLYCBtm1z13KMPwsPFpvQ3", //pk: sEdVr3HmJooxVApTdqCKp4gVHrBBqUr
|
||||||
"rippleNode": "wss://s.altnet.rippletest.net:51233",
|
"rippleNode": "wss://s.altnet.rippletest.net:51233",
|
||||||
}
|
}
|
||||||
Generated
+1227
-127
File diff suppressed because it is too large
Load Diff
@@ -26,11 +26,14 @@
|
|||||||
"@cds/core": "6.6.2",
|
"@cds/core": "6.6.2",
|
||||||
"@clr/angular": "^15.12.0",
|
"@clr/angular": "^15.12.0",
|
||||||
"@clr/ui": "^15.12.0",
|
"@clr/ui": "^15.12.0",
|
||||||
|
"axios": "^1.7.7",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
"modern-normalize": "^1.1.0",
|
"modern-normalize": "^1.1.0",
|
||||||
"process": "^0.11.10",
|
"process": "^0.11.10",
|
||||||
|
"rjsvm": "^0.3.0",
|
||||||
"rxjs": "~7.5.0",
|
"rxjs": "~7.5.0",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
|
"xrpio": "^0.3.0",
|
||||||
"zod": "^3.22.4",
|
"zod": "^3.22.4",
|
||||||
"zone.js": "~0.11.4"
|
"zone.js": "~0.11.4"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -20,23 +20,41 @@
|
|||||||
|
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<clr-input-container>
|
<clr-input-container>
|
||||||
<input clrInput [disabled]="sending" required placeholder="Title" type="text" [(ngModel)]="newShout.title" name="title" />
|
<input clrInput [disabled]="sending" required placeholder="Title" type="text"
|
||||||
|
[(ngModel)]="newShout.title" name="title" />
|
||||||
</clr-input-container>
|
</clr-input-container>
|
||||||
<textarea clrTextarea [disabled]="sending" required placeholder="Shout Body" type="text" [(ngModel)]="newShout.body"
|
<textarea clrTextarea [disabled]="sending" required placeholder="Shout Body" type="text"
|
||||||
name="body"></textarea>
|
[(ngModel)]="newShout.body" name="body"></textarea>
|
||||||
<clr-input-container>
|
<clr-input-container>
|
||||||
<input clrInput [disabled]="sending" required placeholder="Your Name" type="text" [(ngModel)]="newShout.from" name="from" />
|
<input clrInput [disabled]="sending" required placeholder="Your Name" type="text"
|
||||||
|
[(ngModel)]="newShout.from" name="from" />
|
||||||
</clr-input-container>
|
</clr-input-container>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<button class="btn btn-success" (click)="submitShout()"
|
<button class="btn btn-success" (click)="submitShout()"
|
||||||
[disabled]="!loginForm.form.valid || sending">Shout</button> <span *ngIf="sending">Sending...</span>
|
[disabled]="!loginForm.form.valid || sending">Shout</button>
|
||||||
|
<span *ngIf="sending">Sending...</span>
|
||||||
|
<span *ngIf="waiting">It may take up to 30 seconds for the new entry to persist</span>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="clr-row" *ngIf="initializing">
|
||||||
|
<div class="clr-col-lg-5 clr-col-md-8 clr-col-12">
|
||||||
|
<div class="card">
|
||||||
|
<h3 class="card-header">Syncing application state</h3>
|
||||||
|
<div class="card-block">
|
||||||
|
<div class="card-text">
|
||||||
|
<span class="spinner spinner-inline">Loading...</span>
|
||||||
|
<span>Loading...</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="clr-row" *ngFor="let shout of shouts">
|
<div class="clr-row" *ngFor="let shout of shouts">
|
||||||
<div class="clr-col-lg-5 clr-col-md-8 clr-col-12">
|
<div class="clr-col-lg-5 clr-col-md-8 clr-col-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import { ShoutboxDataService } from './services/ShoutboxData.service';
|
|||||||
styleUrls: ['./app.component.scss'],
|
styleUrls: ['./app.component.scss'],
|
||||||
})
|
})
|
||||||
export class AppComponent implements OnInit{
|
export class AppComponent implements OnInit{
|
||||||
|
initializing = true
|
||||||
|
waiting = false
|
||||||
title = 'httXrp Shoutbox';
|
title = 'httXrp Shoutbox';
|
||||||
shouts: any[] = []
|
shouts: any[] = []
|
||||||
sending = false
|
sending = false
|
||||||
@@ -32,10 +34,15 @@ export class AppComponent implements OnInit{
|
|||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.sending = false
|
this.sending = false
|
||||||
|
this.waiting = true
|
||||||
|
setTimeout(() => {this.waiting = false}, 20000)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(){
|
ngOnInit(){
|
||||||
this.shouts = this.dataService.history
|
this.dataService.initialize((shout:any) => {
|
||||||
|
this.shouts.unshift(shout)
|
||||||
|
this.initializing = false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { CdsModule } from '@cds/angular';
|
|||||||
import { ClarityModule } from '@clr/angular';
|
import { ClarityModule } from '@clr/angular';
|
||||||
|
|
||||||
import { ClarityIcons, homeIcon } from '@cds/core/icon';
|
import { ClarityIcons, homeIcon } from '@cds/core/icon';
|
||||||
import { ShoutboxDataService, initShoutboxSvc } from './services/ShoutboxData.service';
|
import { ShoutboxDataService } from './services/ShoutboxData.service';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@@ -21,12 +21,6 @@ import { FormsModule } from '@angular/forms';
|
|||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
ShoutboxDataService,
|
ShoutboxDataService,
|
||||||
{
|
|
||||||
provide: APP_INITIALIZER,
|
|
||||||
useFactory: initShoutboxSvc,
|
|
||||||
deps: [ShoutboxDataService],
|
|
||||||
multi: true
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
bootstrap: [AppComponent],
|
bootstrap: [AppComponent],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ declare const RJSVM_Builder: any;
|
|||||||
declare const Datawriter: any;
|
declare const Datawriter: any;
|
||||||
|
|
||||||
const xrpNode = "wss://s.altnet.rippletest.net:51233"
|
const xrpNode = "wss://s.altnet.rippletest.net:51233"
|
||||||
const listeningAddress = "rB4v4taosTUvuup8prxj2wbrBMbmvmxgXx"
|
const listeningAddress = "rMBYWyxGx1b5zEjJKF18TTwF5X3vP2WyjR"
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ShoutboxDataService {
|
export class ShoutboxDataService {
|
||||||
@@ -20,9 +20,12 @@ export class ShoutboxDataService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
initialize = async () => {
|
initialize = async (onData:Function) => {
|
||||||
|
|
||||||
const [userWallet, drainWallet] = await Promise.all([makeTestnetWallet(), makeTestnetWallet()])
|
const [userWallet, drainWallet] = await Promise.all([makeTestnetWallet(), makeTestnetWallet()])
|
||||||
|
|
||||||
|
console.log(userWallet, drainWallet)
|
||||||
|
|
||||||
this.dataWriter = new Datawriter({
|
this.dataWriter = new Datawriter({
|
||||||
receiveAddress: drainWallet.address,
|
receiveAddress: drainWallet.address,
|
||||||
sendWallet: userWallet,
|
sendWallet: userWallet,
|
||||||
@@ -72,6 +75,7 @@ export class ShoutboxDataService {
|
|||||||
const RJSVM_Contract = {
|
const RJSVM_Contract = {
|
||||||
submit: {
|
submit: {
|
||||||
implementation: function (env:any, shout:any) {
|
implementation: function (env:any, shout:any) {
|
||||||
|
console.log(shout);
|
||||||
(this as any).state.shouts.unshift(shout)
|
(this as any).state.shouts.unshift(shout)
|
||||||
},
|
},
|
||||||
visibility: 'public',
|
visibility: 'public',
|
||||||
@@ -95,12 +99,8 @@ export class ShoutboxDataService {
|
|||||||
await rjsvm.connect()
|
await rjsvm.connect()
|
||||||
|
|
||||||
rjsvm.on('error', console.log)
|
rjsvm.on('error', console.log)
|
||||||
rjsvm.on('submit', console.log)
|
rjsvm.on('submit', onData)
|
||||||
|
|
||||||
this.history = rjsvm.state.shouts
|
this.history = rjsvm.state.shouts
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function initShoutboxSvc(svc: ShoutboxDataService): () => Promise<any> {
|
|
||||||
return svc.initialize;
|
|
||||||
}
|
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
export const makeTestnetWallet = () : Promise<{ secret: string, address: string }> => fetch('https://faucet.altnet.rippletest.net/accounts', {
|
import axios from 'axios';
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
export const makeTestnetWallet = async () : Promise<any> => {
|
||||||
'Accept': 'application/json',
|
try{
|
||||||
'Content-Type': 'application/json'
|
const response = await axios.post('https://faucet.altnet.rippletest.net/accounts', {})
|
||||||
},
|
return ({
|
||||||
}).then((raw:any) => {
|
secret: response.data.seed,
|
||||||
return raw.json().then((content:any) => {
|
address: response.data.account.address
|
||||||
return({
|
})
|
||||||
secret: content.account.secret,
|
|
||||||
address: content.account.address
|
}catch(e){
|
||||||
});
|
console.log(e)
|
||||||
})
|
}
|
||||||
});
|
}
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/rjsvm@0.2.5/lib/browser/rjsvm.browser.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/rjsvm@0.3.1/lib/browser/rjsvm.browser.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body cds-text="body" cds-theme="dark">
|
<body cds-text="body" cds-theme="dark">
|
||||||
<app-root></app-root>
|
<app-root></app-root>
|
||||||
|
|||||||
Reference in New Issue
Block a user